Skip to content

Add p.bashEach and p.writeInput prompt helpers#107

Merged
pelikhan merged 2 commits into
mainfrom
copilot/rig-tasks-daily-evaluation
Jul 25, 2026
Merged

Add p.bashEach and p.writeInput prompt helpers#107
pelikhan merged 2 commits into
mainfrom
copilot/rig-tasks-daily-evaluation

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Two friction points from evaluation tasks — per-element shell iteration and dynamic write destinations — had no first-class helpers, forcing prose workarounds that are imprecise and non-declarative.

New helpers

p.bashEach(template, inputArrayField, options?) — runs a command template once per element in a caller-supplied array field, with {} as the element placeholder:

const healthProbe = agent({
  input: s.object({ endpoints: s.array(s.url) }),
  instructions: p`${p.bashEach("curl -s -o /dev/null -w '%{http_code}' {} --max-time 5", "endpoints")}`,
  output: s.object({ results: s.array(s.object({ url: s.url, status: s.string })) }),
});

p.writeInput(inputPathField, contentOutputField, options?) — like p.writeOutput but the destination path comes from an input field rather than a static string:

const renderer = agent({
  input: s.object({ outputPath: s.path }),
  instructions: p`Render the changelog. ${p.writeInput("outputPath", "rendered")}`,
  output: s.object({ rendered: s.string }),
});

Implementation

  • skills/rig/rig.ts: Two new PromptIntent modes (prompt.bashEach, prompt.writeInput), new pathField property on PromptIntent, PromptHelpers type entries with JSDoc, implementations, and rendering cases in renderPromptIntentInstruction
  • src/rig.test.ts: Tests for both helpers covering mode, stored fields, and options passthrough
  • skills/rig/references/prompt-intents.md: Updated helper table; merged write helpers into a unified p.write / p.writeOutput / p.writeInput decision section; expanded "Dynamic shell commands" with p.bashEach
  • skills/rig/SKILL.md, README.md: Updated intent selection tables and prose

- p.bashEach(template, inputArrayField): runs template once per element
  in a caller-supplied array field, substituting {} with each element
- p.writeInput(inputPathField, contentOutputField): writes an output field
  to a dynamic path from an input field (complements p.writeOutput)
- Add tests for both helpers in src/rig.test.ts
- Update prompt-intents.md, SKILL.md, README.md with new helpers

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] [rig-tasks] Add daily rig evaluation for 2026-07-25 Add p.bashEach and p.writeInput prompt helpers Jul 25, 2026
Copilot AI requested a review from pelikhan July 25, 2026 03:12
@pelikhan
pelikhan marked this pull request as ready for review July 25, 2026 03:14
@pelikhan
pelikhan merged commit b88e1d6 into main Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rig-tasks] Daily rig evaluation — 2026-07-25 — 5/5 passed

2 participants