feat(cli): literal --text, rev/--if-rev and a claim verb for agents #82

Merged
jwarykowski merged 3 commits from feat/agent-cli into master 2026-10-25 09:20:01 +00:00
Owner

Summary

Safer writes for LLM agents driving the CLI.

  • --text "<s>" on add, sub and edit sets item text verbatim, so #123 or due: inside it stay text. A plain word in the positional string alongside --text exits 2.
  • Every item in --json output carries a rev (12-hex sha256 of the serialised item, subtasks included; computed, never stored). --if-rev <rev> on edit, sub, claim, done, undone, rm and archive refuses a stale write with exit 1 ({"error":"conflict"} under --json). Checked inside the store lock.
  • claim <ref> --by <name> records a claimed: owner and moves the item to the first working status (in-progress by default). Exit 1 if done or held by someone else; --release hands it back. Marking an item done ends its claim.
  • The TUI shows the claimer after the item text (list, table and lane views) and as a claimed row in the detail view.
  • README (new "safe writes" section under agentic tools), AGENTS.md and the bundled skill document all of it.

Testing

  • golangci-lint fmt, go vet, go test ./..., golangci-lint run clean.
  • New internal/cli/agent_test.go (literal text, stale rev on every guarded verb leaves the file byte-identical, claim/release exit codes), internal/todo/claim_test.go (including done ending a claim) and internal/tui/claim_test.go (claimer shown in every view).
  • Manual run against a temp board: literal text kept, claim then a second claimer exits 1, stale done --if-rev exits 1 with no write.
## Summary Safer writes for LLM agents driving the CLI. - `--text "<s>"` on `add`, `sub` and `edit` sets item text verbatim, so `#123` or `due:` inside it stay text. A plain word in the positional string alongside `--text` exits 2. - Every item in `--json` output carries a `rev` (12-hex sha256 of the serialised item, subtasks included; computed, never stored). `--if-rev <rev>` on `edit`, `sub`, `claim`, `done`, `undone`, `rm` and `archive` refuses a stale write with exit 1 (`{"error":"conflict"}` under `--json`). Checked inside the store lock. - `claim <ref> --by <name>` records a `claimed:` owner and moves the item to the first working status (`in-progress` by default). Exit 1 if done or held by someone else; `--release` hands it back. Marking an item done ends its claim. - The TUI shows the claimer after the item text (list, table and lane views) and as a `claimed` row in the detail view. - README (new "safe writes" section under agentic tools), AGENTS.md and the bundled skill document all of it. ## Testing - `golangci-lint fmt`, `go vet`, `go test ./...`, `golangci-lint run` clean. - New `internal/cli/agent_test.go` (literal text, stale rev on every guarded verb leaves the file byte-identical, claim/release exit codes), `internal/todo/claim_test.go` (including done ending a claim) and `internal/tui/claim_test.go` (claimer shown in every view). - Manual run against a temp board: literal text kept, claim then a second claimer exits 1, stale `done --if-rev` exits 1 with no write.
--text sets item text verbatim so #tags and due: inside it stay text.
Items carry a computed rev in JSON output; --if-rev on mutating verbs
refuses a stale write with exit 1. claim --by records an owner and
moves the item to the working status, failing if done or held.
Merge remote-tracking branch 'origin/master' into feat/agent-cli
All checks were successful
pull-request / lint-and-test (pull_request) Successful in 1m12s
30d5b6d534
feat: end a claim on done and show the claimer in the TUI
All checks were successful
pull-request / lint-and-test (pull_request) Successful in 1m20s
52af594fc8
jwarykowski deleted branch feat/agent-cli 2026-10-25 09:20:02 +00:00
Sign in to join this conversation.
No description provided.