Agent-usable CLI: projects, worktrees, status commands + Claude-in-tmux #222
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#222
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A personal assistant agent needs to use
iwexclusively to manage development workflows. Currentlyiwlacks the primitives the agent needs: listing projects, listing worktrees with status, getting detailed worktree state, and launching an agent in a worktree session.Additionally, several commands violate the architecture rule of not importing from
dashboard/—ServerClient,ServerConfigRepository, andProcessManagerare pure I/O adapters that happen to live indashboard/.Goal
Add CLI commands and enhancements so an agent can:
All commands support
--jsonfor machine-readable output.New commands
iw projects [--json]List all known projects derived from registered worktrees in
state.json.Output: project name, main tree path, tracker type, team, worktree count.
iw worktrees [--json]List worktrees for the current project with status summary from cached state.
Output per worktree: issue ID, path, PR state, review-state display, needs_attention flag.
iw status [issue-id] [--json]Detailed status of one worktree combining cached + fresh local data.
Output: git (branch, clean/dirty), issue (title, status, url), PR (url, state, number), review-state (display, badges, artifacts, available_actions, needs_attention), progress (current phase, total phases).
Fresh review-state.json is read from disk; other data comes from server state cache.
Enhancements
iw start <issue> --prompt "..."After worktree + tmux session creation, launch an agent in the pane with the given prompt.
--promptimplies detach — the command creates the session, sends the agent command viatmux send-keys, and exits immediately (no blockingtmux attach).iw owns the agent launch mechanism. The caller provides the prompt (what to do), iw decides how to spawn the agent (currently:
claude --dangerously-skip-permissions --prompt "..."). This allows changing the agent mechanism later without affecting callers.iw open <issue> --prompt "..."Send agent command to an existing worktree session. Same principle as start.
Architecture cleanup
Move shared infrastructure out of
dashboard/into proper layers:Move to
adapters/(pure I/O, zero dashboard dependencies):ServerClient— HTTP client for server communicationServerConfigRepository— JSON config file I/OProcessManager— background process spawning and PID managementMove to
model/(pure logic):MainProject.deriveMainProjectPath()→ProjectPathpure string logicExtract to
model/:ServerStateCodec— shared ReadWriter instances for state JSON serializationNew in
adapters/:StateReader— reads state.json from standard locationTmuxAdapter.sendKeys()— send keystrokes to tmux sessionAfter this, commands import only from
model/andadapters/. Dashboard imports from all three. Clean layering.Implementation phases
Phase 1: Architecture cleanup
ServerClient,ServerConfigRepository,ProcessManagertoadapters/ServerStateCodectomodel/StateReaderadapterderiveMainProjectPathtomodel/TmuxAdapter.sendKeysPhase 2:
iw projectscommand--jsonflag support + E2E testsPhase 3:
iw worktreescommand--jsonflag support + E2E testsPhase 4:
iw statuscommand--jsonflag support + E2E testsPhase 5:
--promptfor start/open--promptfrom args (implies--detach)TmuxAdapter.sendKeysafter session creationtmux attachwhen--promptgivenClosed by
b0d2152IW-222: Agent-usable CLI — projects, worktrees, status + --prompt (#229)