feat(cli): hand items to coding agents (shepherd agent, sync) #51

Closed
jwarykowski wants to merge 4 commits from feat/agent into master
jwarykowski commented 2026-10-10 12:39:45 +00:00 (Migrated from github.com)

what

  • shepherd agent <ref> hands an item to a coding agent and marks it in-progress:
    • inside herdr (default): herdr worktree create on todo/<slug> (recorded on the item as a new branch: token), then herdr agent start with the item text + note as the prompt
    • --to <pane>: send to an agent already running in that herdr pane
    • --here (or no herdr): run the agent CLI in this terminal
    • --kind picks the agent (claude, codex, opencode, …); defaults from agent_kind / agent_branch_prefix in config.toml
  • shepherd sync [--all] [--dry-run] [--json] completes open items whose branch: PR has merged (via gh)
  • branch:<name> token: parsed, persisted, in list --json, the schema and filter matching
  • fix: a settings save no longer drops config keys the UI doesn't manage (placement/direction for open.sh, comments, and the new agent_*)

Docs: AGENTS.md, README (new "hand an item to an agent" section + config keys), the skill.

tests

  • internal/cli/agent_test.go: worktree flow, config + --kind, --to, no-herdr, error paths leave the item untouched, sync (dry-run, json, skips done / branchless), slug, branch: token round trip
  • internal/tui/config_test.go: settings save keeps unmanaged keys and is idempotent
  • gofmt, vet, golangci-lint clean; smoke-tested the built binary (agent --here --kind echo)

note: pre-existing local test hang

TestTagEditor and TestCopy* hang locally on Wayland (also on master): they call the real clipboard.WriteAll, and wl-copy keeps serving the clipboard so exec.Cmd.Wait never returns. CI has no clipboard tool, so it errors fast and passes there. Worth a follow-up to stub the clipboard in tests.

## what - `shepherd agent <ref>` hands an item to a coding agent and marks it `in-progress`: - inside herdr (default): `herdr worktree create` on `todo/<slug>` (recorded on the item as a new `branch:` token), then `herdr agent start` with the item text + note as the prompt - `--to <pane>`: send to an agent already running in that herdr pane - `--here` (or no herdr): run the agent CLI in this terminal - `--kind` picks the agent (claude, codex, opencode, …); defaults from `agent_kind` / `agent_branch_prefix` in `config.toml` - `shepherd sync [--all] [--dry-run] [--json]` completes open items whose `branch:` PR has merged (via `gh`) - `branch:<name>` token: parsed, persisted, in `list --json`, the schema and filter matching - fix: a settings save no longer drops config keys the UI doesn't manage (`placement`/`direction` for open.sh, comments, and the new `agent_*`) Docs: AGENTS.md, README (new "hand an item to an agent" section + config keys), the skill. ## tests - `internal/cli/agent_test.go`: worktree flow, config + `--kind`, `--to`, no-herdr, error paths leave the item untouched, sync (dry-run, json, skips done / branchless), slug, `branch:` token round trip - `internal/tui/config_test.go`: settings save keeps unmanaged keys and is idempotent - gofmt, vet, golangci-lint clean; smoke-tested the built binary (`agent --here --kind echo`) ## note: pre-existing local test hang `TestTagEditor` and `TestCopy*` hang locally on Wayland (also on `master`): they call the real `clipboard.WriteAll`, and `wl-copy` keeps serving the clipboard so `exec.Cmd.Wait` never returns. CI has no clipboard tool, so it errors fast and passes there. Worth a follow-up to stub the clipboard in tests.
jwarykowski commented 2026-10-11 23:24:46 +00:00 (Migrated from github.com)

Split up after review, so Shepherd stays a board plus a command API:

  • #57: the settings-save fix (keeps placement/direction, comments and other unmanaged keys).
  • #58: a generic hand-off hook (handoff = [...] in config.toml, shepherd handoff <ref>, @ on the board) and the branch: field.
  • The agent loop (worktree, agent start, completing items when the PR merges) moves to drover, where Pro is: jwarykowski/drover#12.

Review notes on this PR that the drover work should keep in mind: a failed agent start left the item in progress (and the worktree behind); nothing cleaned up worktrees after a merge; a PR closed without merging was never noticed; sync --every stopped for good on its first error; and the no-herdr path passed the prompt as the agent's first argument without --.

I'd close this one once #57 and #58 are in. jwarykowski/nvim-shepherd#14 needs updating to call shepherd handoff instead of shepherd agent.

Split up after review, so Shepherd stays a board plus a command API: - #57: the settings-save fix (keeps `placement`/`direction`, comments and other unmanaged keys). - #58: a generic hand-off hook (`handoff = [...]` in config.toml, `shepherd handoff <ref>`, `@` on the board) and the `branch:` field. - The agent loop (worktree, agent start, completing items when the PR merges) moves to drover, where Pro is: jwarykowski/drover#12. Review notes on this PR that the drover work should keep in mind: a failed agent start left the item in progress (and the worktree behind); nothing cleaned up worktrees after a merge; a PR closed without merging was never noticed; `sync --every` stopped for good on its first error; and the no-herdr path passed the prompt as the agent's first argument without `--`. I'd close this one once #57 and #58 are in. jwarykowski/nvim-shepherd#14 needs updating to call `shepherd handoff` instead of `shepherd agent`.
jwarykowski commented 2026-10-11 23:53:38 +00:00 (Migrated from github.com)

Closing: superseded. The agent hand-off now goes through drover (#60, #61), so Shepherd stays a board and drover runs and logs every agent job. The settings fix landed separately in #57.

Closing: superseded. The agent hand-off now goes through drover (#60, #61), so Shepherd stays a board and drover runs and logs every agent job. The settings fix landed separately in #57.

Pull request closed

Sign in to join this conversation.
No description provided.