Skip to content

feat(agents): use claude --prefill for Use direct-launch draft#926

Open
nwparker wants to merge 1 commit intomainfrom
nwparker/composer-follow-uo
Open

feat(agents): use claude --prefill for Use direct-launch draft#926
nwparker wants to merge 1 commit intomainfrom
nwparker/composer-follow-uo

Conversation

@nwparker
Copy link
Copy Markdown
Contributor

Summary

The "Use" CTA on the Task page creates a workspace and drops the GitHub issue/PR URL into the agent's input box as a reviewable draft (not submitted). Today that's done via a post-launch bracketed-paste after waitForAgentReady + a 120ms settle — it works, but there's a real race window.

Claude Code exposes --prefill <text>, which launches the TUI with the text already in the input box and nothing submitted. For Claude users this replaces the readiness + paste dance entirely while preserving the "draft, don't send" contract.

Changes

  • src/shared/tui-agent-config.ts — add optional draftPromptFlag to TuiAgentConfig; set '--prefill' on claude only.
  • src/renderer/src/lib/tui-agent-startup.ts — new buildAgentDraftLaunchPlan helper. Returns a launch command when the agent has a prefill flag, null otherwise.
  • src/renderer/src/lib/launch-work-item-direct.ts — prefer the draft plan; skip the post-launch paste when one is used (pasting again would duplicate the URL). Every other agent keeps today's paste-after-ready path unchanged.
  • Tests: prefill case for Claude, null fallback for agents without the flag, empty-draft fallback, and cmdOverrides honoring.

Agent CLI survey

Checked every CLI we could run locally (codex, cursor-agent, droid, gemini, copilot, pi, opencode, aider) — Claude is the only one with a documented "prefill but don't submit" flag today. gemini -i/--prompt-interactive and copilot -i/--interactive both auto-execute. The draftPromptFlag shape lets us drop in additional agents as one-liners when they ship the equivalent.

Test plan

  • pnpm typecheck
  • pnpm lint (no new warnings)
  • pnpm exec vitest run src/renderer/src/lib/tui-agent-startup.test.ts — 14 tests pass
  • Manual: on the Task page with Claude as default agent, click "Use" on a GH issue → Claude opens with the issue URL pre-filled in the input, not submitted
  • Manual: repeat with a non-Claude default (codex/cursor/etc.) → behavior unchanged; URL still lands as a bracketed-paste draft after agent ready

The "Use" flow on the Task page creates a workspace and pastes the
GitHub issue/PR URL into the agent's input box as a reviewable draft
(no submit). That's implemented via a post-launch bracketed-paste after
waiting on agent readiness — works, but has a race and a 120ms settle.

Claude Code's CLI exposes `--prefill <text>`, which launches the TUI
with the text already sitting in the input box and nothing submitted.
Using it removes the readiness race entirely for Claude users and keeps
the "draft, don't send" contract.

- Add optional `draftPromptFlag` to `TuiAgentConfig`; set `--prefill`
  on claude only. No other installed agent CLI (codex, cursor-agent,
  droid, gemini, copilot, pi, opencode, aider) exposes an equivalent
  today.
- `buildAgentDraftLaunchPlan` in `tui-agent-startup` returns a launch
  command when the agent has the flag, null otherwise.
- `launch-work-item-direct` prefers the draft plan and skips the
  paste-after-ready path when it is used (pasting again would duplicate
  the URL). Every other agent keeps today's behavior unchanged.
@nwparker nwparker added the size/s Small PR (≤150 added lines, ≤10 files) label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s Small PR (≤150 added lines, ≤10 files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant