commandmate 0.22.1 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +114 -114
  3. package/.next/app-path-routes-manifest.json +22 -22
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +9 -9
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/app/update-check/route.js +1 -1
  10. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  109. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  133. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  134. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  135. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  136. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  137. package/.next/server/app/page_client-reference-manifest.js +1 -1
  138. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  139. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  140. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  141. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  143. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  144. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  145. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  146. package/.next/server/app/worktrees/[id]/page.js +1 -1
  147. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  148. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  149. package/.next/server/app-paths-manifest.json +22 -22
  150. package/.next/server/chunks/5959.js +1 -1
  151. package/.next/server/chunks/6130.js +1 -1
  152. package/.next/server/middleware-manifest.json +5 -5
  153. package/.next/server/pages/500.html +1 -1
  154. package/.next/server/server-reference-manifest.json +1 -1
  155. package/.next/static/chunks/{6488-63dacfbab082ca8d.js → 6488-53a3e1d78e4fe8f7.js} +1 -1
  156. package/.next/static/chunks/app/worktrees/[id]/{page-c1be93f2595d0803.js → page-6dc0b8c4e808ea3e.js} +1 -1
  157. package/.next/trace +12 -12
  158. package/dist/cli/docs/agent-operations.d.ts +1 -1
  159. package/dist/cli/docs/agent-operations.d.ts.map +1 -1
  160. package/dist/cli/docs/agent-operations.js +5 -1
  161. package/dist/cli/utils/api-client.d.ts.map +1 -1
  162. package/dist/cli/utils/api-client.js +9 -2
  163. package/dist/cli/utils/server-url.d.ts +23 -0
  164. package/dist/cli/utils/server-url.d.ts.map +1 -1
  165. package/dist/cli/utils/server-url.js +33 -0
  166. package/package.json +1 -1
  167. /package/.next/static/{d4vh4O18WEhXs4WbdShIs → XpKfn5x6H-mtTaXI9yNmb}/_buildManifest.js +0 -0
  168. /package/.next/static/{d4vh4O18WEhXs4WbdShIs → XpKfn5x6H-mtTaXI9yNmb}/_ssgManifest.js +0 -0
@@ -5,6 +5,6 @@
5
5
  * This content is embedded as a string constant so that it's available
6
6
  * even when installed via `npm install -g commandmate` (where docs/ is not included).
7
7
  */
8
- export declare const AGENT_OPERATIONS_GUIDE = "# CLI Agent Operations Guide\n\nOperate agent sessions from the CommandMate CLI.\nThese commands enable coding agents (Claude Code, Codex, etc.) to orchestrate other agents in parallel.\n\n## Prerequisites\n\n- CommandMate server must be running: commandmate start --daemon\n- Target worktrees must be registered (visible in browser UI sidebar)\n- Use CM_PORT env var to connect to a different port (default: 3000)\n- Use CM_AUTH_TOKEN env var for authenticated servers\n\n## Commands\n\n### commandmate ls\n List worktrees with status.\n\n commandmate ls # Table format (ID, NAME, STATUS, DEFAULT)\n commandmate ls --json # JSON output (for agent consumption)\n commandmate ls --quiet # IDs only, one per line (for piping)\n commandmate ls --branch <prefix> # Filter by branch name prefix\n commandmate ls --id <prefix> # Filter by worktree id prefix\n\n Worktree ids are <repo>-<branch> slugs (e.g. anvil-develop). --id / --branch\n front-match is case-sensitive and does NOT guarantee uniqueness (e.g.\n --id anvil-develop also matches anvil-develop-2). --branch and --id combine\n as AND. Use --id to disambiguate the same branch across repositories.\n\n STATUS values:\n idle - Session not started\n ready - Session running, waiting for input (task completed)\n running - Agent executing a task\n waiting - Confirmation prompt active (Yes/No, etc.)\n\n### commandmate sync\n Ask the server to re-scan repositories and sync worktrees to its database\n (same endpoint as the GUI sync button). Run it after 'git worktree add' so the\n new worktree appears in 'commandmate ls' without opening the GUI (Issue #1680).\n\n commandmate sync # Prints the server's summary message\n commandmate sync --json # Full API response (worktreeCount,\n # repositoryCount, repositories,\n # deletedCount, cleanupWarnings)\n\n### commandmate send <worktree-id> \"<message>\"\n Send a message to an agent (async). Starts session automatically if not running.\n\n Options:\n --instance <id> Agent instance ID: <agent> or <agent>-<n> (e.g. claude-2, or codex\n for the codex primary instance). The recommended way to name a\n target: send / wait / respond / capture / auto-yes all take it.\n --agent <id> Ad-hoc CLI tool for an instance the roster does not know:\n claude (default), codex, gemini, vibe-local, opencode, copilot, antigravity\n --register Register the --instance session into the agent-instance roster\n --auto-yes Enable auto-yes before sending (session-wide, no policy\n guard -- for unattended runs prefer --contract with an\n autoYes policy: mode / denyPatterns)\n --duration <d> Auto-yes duration: 1h, 3h, 8h (default: 1h)\n --stop-pattern <p> Auto-yes stop condition (regex; matches terminal output,\n cannot block commands -- see auto-yes below)\n --ignore-structured-prompt\n Send even if only the agent's hooks report an open dialog.\n For a session whose pane looks idle but keeps refusing;\n a dialog visible in the terminal is still refused.\n\n Refused while the agent is waiting on a prompt (exit 2). Keystrokes sent to\n an open dialog never reach the agent -- they pile up in the dialog's own\n input line, and the next respond then carries that text along as a message\n instead of an answer. Nudging a stalled worker is how this gets worse.\n Answer first: commandmate respond <id> <answer>. respond, special keys and\n prompt-response are never refused -- they are the way out. Timer-fired sends\n ARE refused (same service layer) and record [prompt_waiting] as their reason.\n It fails open if the pane cannot be read, so treat it as a narrowing, not a\n guarantee.\n\n Two layers can report the dialog: the terminal scraper, and the agent's own\n hooks. Either one is enough to refuse -- the dialog the scraper cannot read is\n exactly the one that caused this. A frame neither layer classifies is still\n wait's \"unclassified\" case instead.\n\n A hook-reported dialog is released by the agent's next event, and hooks are\n fail-open, so the record can outlive its dialog. It therefore stops blocking\n sends 5 minutes after it was reported -- and immediately with\n --ignore-structured-prompt, or CM_STRUCTURED_SEND_GUARD=off for the server.\n A session nobody can send to is worse than a missed guard. Both bypasses are\n narrow: a prompt on screen is still refused, and the payload still reports it\n (wait and the UI do not go quiet).\n\n Finding worktree IDs:\n WT=$(commandmate ls --branch feature/101 --quiet)\n WT=$(commandmate ls --id anvil- --quiet) # disambiguate by repo (id prefix)\n commandmate send \"$WT\" \"Implement this\"\n\n Targeting a non-default agent (Issue #1638): pass --instance, not --agent. Only\n --instance is accepted by every command -- 'wait --agent' does not exist -- so a\n workflow that names the agent on 'send' and nothing on 'wait' waits on the wrong\n session in silence.\n commandmate send \"$WT\" \"Implement this\" --instance codex\n commandmate wait \"$WT\" --instance codex\n\n### commandmate wait <worktree-id...>\n Block until agent completes or prompt is detected.\n\n Options:\n --timeout <seconds> Maximum wait time\n --on-prompt <mode> agent (default) or human\n --stall-timeout <seconds> Max time without output change\n --instance <id> Agent instance to wait on. There is no --agent here.\n --verify After completion, run every verification gate\n --require-work After completion, run only the work-evidence gate\n\n Exit codes:\n 0 - Completed (agent idle/ready), and verified when --verify was given\n 10 - Prompt detected (--on-prompt agent mode)\n 20 - A verification gate failed (--verify)\n 21 - Nothing to verify: no commits, no uncommitted changes\n 124 - Timeout exceeded\n\n --on-prompt modes:\n agent - Returns exit 10 immediately with prompt JSON on stdout\n human - Keeps blocking until human responds via browser UI\n\n Prompt JSON output (exit 10):\n {\"worktreeId\":\"...\",\"cliToolId\":\"claude\",\"type\":\"yes_no\",\"question\":\"...\",\"options\":[\"yes\",\"no\"],\"status\":\"pending\"}\n The payload IS the prompt -- read it from stdout before falling back to\n capture. For type \"selection_list\", options is empty by design and the\n question field carries the reason.\n\n Three \"type\" values share exit 10; only the first is answerable with\n respond:\n yes_no / multiple_choice a parsed prompt -> commandmate respond\n selection_list arrow-key menu -> special keys\n unclassified the frame is interactive but detection could\n not parse it, and it has stayed that way for\n 60s -> look at the pane: capture <id> --pane\n \"unclassified\" exists because a frame that slips past detection disables\n auto-yes, the contract's autoYes policy and this exit 10 all at once. It\n needs the dwell: a capture taken mid-repaint can raise the flag once.\n --on-prompt human keeps waiting for it, same as the other two.\n\n --verify turns \"the agent stopped\" into \"the work passes the repository's own\n checks\". Verification only runs when completion was detected: a prompt (10) or\n a timeout (124) is reported as-is and never verified. With several worktrees,\n gates run one worktree at a time because the server caps concurrent runs.\n\n### commandmate verify <worktree-id>\n Run the gates declared in .commandmate/verify.yaml against a worktree.\n\n Options:\n --gates <id1,id2> Gate ids to run (default: work-evidence + all declared)\n --instance <id> Attribute the run to an agent instance\n --timeout <seconds> Stop polling after N seconds (exit 124)\n --json Print the run and its gate results as JSON on stdout\n\n Exit codes:\n 0 - Every gate passed\n 20 - A gate failed, timed out, or errored\n 21 - work-evidence found nothing to verify (no commits, no changes)\n 99 - The run produced no verdict (bad verify.yaml, gates skipped, cancelled)\n 124 - --timeout elapsed while the run was still going\n\n Output (progress on stderr, verdict on stdout):\n GATE work-evidence PASS (commits=3, uncommitted=2)\n GATE lint PASS (exit=0, 12.3s)\n GATE unit FAIL (exit=1, 45.0s)\n RESULT failed\n\n Gates run in the worktree's own directory. Gates are skipped (run status 99,\n never 0) in the checkout the server itself runs from when verify.yaml sets\n options.skipInPrimaryCheckout, so a 'build' gate cannot replace the assets the\n live app is serving.\n\n### commandmate verify history / commandmate verify show <run-id>\n Read past verification runs. Both are read-only and never start a run, so\n neither returns 20 or 21 \u2014 those mean \"this tree failed verification\", and a\n question about history is not a verdict on the current tree.\n\n commandmate verify history # every worktree, newest 50\n commandmate verify history --worktree <id> # one worktree\n commandmate verify history --days 14 --limit 100 # window and page size\n commandmate verify history --json # JSON array on stdout\n commandmate verify show 42 # gates + log tails\n commandmate verify show 42 --json\n\n history options:\n --worktree <id> Restrict to one worktree (default: all)\n --days <n> Look back n days, 1..90 (default: no lower bound)\n --limit <n> Maximum runs, 1..500 (default: 50)\n\n One run per line. The leading #<run-id> is what \"verify show\" takes:\n #42 2026-07-31T04:12:00.000Z myrepo-feature-101 manual failed failed: unit,build\n\n The listing carries gate verdicts but NOT gate log bodies \u2014 logTail is absent\n from the JSON, not null. Use \"verify show <run-id>\" when you need the log.\n\n Exit codes:\n 0 - Read succeeded (also when nothing matched: stderr note, or [] in JSON)\n 2 - Bad argument (--days/--limit out of range, bad worktree or run id)\n 99 - No such run (404), or an unexpected failure\n\n### commandmate respond <worktree-id> \"<answer>\"\n Respond to an agent's prompt.\n\n commandmate respond <id> \"yes\" # Yes/No\n commandmate respond <id> \"2\" # Multiple choice (number)\n commandmate respond <id> \"custom text\" # Free text\n commandmate respond <id> \"yes\" --instance codex-2 # Specific instance\n\n Exit codes:\n 0 - Response sent\n 99 - Prompt already dismissed (prompt_no_longer_active)\n\n### commandmate capture <worktree-id>\n Get current terminal output.\n\n commandmate capture <id> # Plain text\n commandmate capture <id> --json # JSON with status info\n commandmate capture <id> --instance codex # Specific instance\n\n### commandmate auto-yes <worktree-id>\n Control auto-yes (automatic prompt response).\n\n commandmate auto-yes <id> --enable # Enable (default 1h)\n commandmate auto-yes <id> --enable --duration 3h # With duration\n commandmate auto-yes <id> --enable --stop-pattern \"error\"\n commandmate auto-yes <id> --disable # Disable\n commandmate auto-yes <id> --enable --instance codex-2 # Scoped to one instance\n\n --stop-pattern matches new terminal output, not the commands an agent runs.\n It cannot block a command; a build log that merely prints the pattern\n (e.g. \"rm -rf\" in an npm script) also triggers it and stops auto-yes.\n To suppress auto-responses for risky prompts, use the task contract's\n autoYes.denyPatterns instead (docs/design/task-contract.md).\n\n### commandmate instances <worktree-id> [action] [args]\n Discover and manage a worktree's agent-instance roster (1 agent, multiple sessions).\n\n commandmate instances <id> # List roster + running/auto-yes status\n commandmate instances <id> --json # JSON output\n commandmate instances <id> add --agent codex # Add an instance (auto-generates ID, e.g. codex-2)\n commandmate instances <id> add --agent codex --alias \"Review\" --id codex-3\n commandmate instances <id> remove <instance-id> # Remove from roster\n commandmate instances <id> remove <instance-id> --kill # Remove and kill its session\n commandmate instances <id> alias <instance-id> \"New Name\"\n commandmate instances <id> kill <instance-id> # Kill only that instance's session\n\n See \"Multi-Session\" below for the ID convention and roster semantics.\n\n### commandmate skill <subcommand>\n Manage official Agent Skills. Every subcommand is a thin client over the same\n APIs the browser UI uses: the CLI never downloads, extracts, writes or deletes\n anything itself, and never sends a filesystem path, artifact URL, file list or\n checksum (the API rejects those outright).\n\n commandmate skill list [--json] [--prerelease]\n commandmate skill info <skill-id> [--version <v>] [--json]\n commandmate skill plan <skill-id> --worktree <id> [--version <v>] [--json]\n commandmate skill install <skill-id> --worktree <id> --version <exact> [--dry-run] [--yes] [--ack-risk <id>@<version>] [--json]\n commandmate skill uninstall <skill-id> --worktree <id> [--dry-run] [--yes] [--json]\n commandmate skill status <skill-id> --worktree <id> [--json]\n\n Confirmation contract (writes = install / uninstall):\n - A plan is always built and shown first. --dry-run stops there.\n - Without a TTY, a write REQUIRES --yes. A missing --yes is refused, never\n assumed: an environment that cannot prompt must not install silently.\n - A high-risk Skill additionally requires --ack-risk <skill-id>@<version>\n with the exact id and version. --yes alone never carries a high-risk\n install, in a TTY or out of one.\n\n Exit codes:\n 0 success\n 1 the server or the Catalog could not be reached (retryable)\n 2 invalid arguments, unknown Skill or unknown version\n 11 the worktree refused it (local change, conflict, lock, plan drift)\n 12 the write was never confirmed (no --yes, declined, or missing --ack-risk)\n 13 files changed but the operation needs reconciliation\n\n --json prints the API response body verbatim on stdout; diagnostics, prompts\n and errors always go to stderr, so a failed --json run leaves stdout empty.\n\n 'skill status' reports one Skill in one worktree, read from the install\n receipt on disk. There is no per-worktree listing endpoint yet, so <skill-id>\n is required.\n\n## Multi-Session (1 agent, multiple sessions)\n\n A worktree can run several sessions of the same CLI tool concurrently. Each\n session is an \"instance\" identified by an instance ID:\n <agent> - the agent's primary instance (e.g. \"claude\")\n <agent>-<n> - an additional instance, n >= 2 (e.g. \"claude-2\", \"claude-3\")\n\n --instance is accepted by send / wait / respond / capture / auto-yes.\n send --instance auto-starts the session if it is not already running.\n\n --instance alone is the recommended way to name a target (Issue #1638). It is\n the only flag all five commands share: --agent is rejected by 'wait'. A\n rostered instance already carries its CLI tool (Issue #1629), and an instance\n id that is itself a tool id resolves to that tool's primary instance even\n without a roster entry, so '--instance codex' needs no --agent.\n\n --agent remains accepted by send / respond / capture / auto-yes as the\n supplement for ad-hoc instances the roster does not know -- notably\n '--register', which cannot infer the tool from an id like codex-3. Passing an\n --agent that contradicts the roster is an error (exit 2), not an override.\n\n The roster (visible in the browser UI's Agent panel) is the list of known\n instances with aliases and display order. Ad-hoc sessions started via\n 'send --instance' do NOT appear in the roster unless registered:\n commandmate send <id> \"...\" --instance claude-2 --register\n Without --register, the session still runs and responds to CLI commands,\n but it will not show up in the UI sidebar/roster until added there or via\n 'commandmate instances <id> add'.\n\n Per-instance auto-yes: --instance scopes --auto-yes/--duration/--stop-pattern\n to that specific session, independent of other instances of the same agent.\n\n commandmate instances <id> # discover valid --instance values\n commandmate send <id> \"task\" --instance codex-2 --auto-yes\n commandmate wait <id> --instance codex-2 --timeout 600\n commandmate capture <id> --instance codex-2\n\n## All Exit Codes\n\n 0 SUCCESS - Completed successfully\n 1 DEPENDENCY_ERROR - Server not running\n 2 CONFIG_ERROR - Validation error (invalid agent, duration, etc.)\n 10 PROMPT_DETECTED - Prompt detected during wait\n 20 VERIFY_FAILED - A verification gate failed (verify, wait --verify)\n 21 NOT_STARTED - Nothing to verify: no commits, no uncommitted changes\n 99 UNEXPECTED_ERROR - Unexpected error / resource not found / no verdict\n 124 TIMEOUT - Wait or verification timeout exceeded\n\n When one 'wait' covers several worktrees, the reported code is the highest\n priority one observed: 10 > 20 > 21 > 124.\n\n## Troubleshooting\n\n Server not running:\n commandmate start --daemon\n CM_PORT=3011 commandmate ls # Different port\n\n Worktree not found:\n commandmate ls --quiet # Check registered IDs\n commandmate sync # Sync new worktrees (e.g. after git worktree add)\n\n Authentication:\n CM_AUTH_TOKEN=your-token commandmate ls\n";
8
+ export declare const AGENT_OPERATIONS_GUIDE = "# CLI Agent Operations Guide\n\nOperate agent sessions from the CommandMate CLI.\nThese commands enable coding agents (Claude Code, Codex, etc.) to orchestrate other agents in parallel.\n\n## Prerequisites\n\n- CommandMate server must be running: commandmate start --daemon\n- Target worktrees must be registered (visible in browser UI sidebar)\n- Connection target is resolved as: exported CM_PORT > ~/.commandmate/.env CM_PORT > 3000\n (CM_BIND and the CM_HTTPS_CERT + CM_HTTPS_KEY pair are honoured the same way)\n- Use CM_AUTH_TOKEN env var for authenticated servers\n\n## Commands\n\n### commandmate ls\n List worktrees with status.\n\n commandmate ls # Table format (ID, NAME, STATUS, DEFAULT)\n commandmate ls --json # JSON output (for agent consumption)\n commandmate ls --quiet # IDs only, one per line (for piping)\n commandmate ls --branch <prefix> # Filter by branch name prefix\n commandmate ls --id <prefix> # Filter by worktree id prefix\n\n Worktree ids are <repo>-<branch> slugs (e.g. anvil-develop). --id / --branch\n front-match is case-sensitive and does NOT guarantee uniqueness (e.g.\n --id anvil-develop also matches anvil-develop-2). --branch and --id combine\n as AND. Use --id to disambiguate the same branch across repositories.\n\n STATUS values:\n idle - Session not started\n ready - Session running, waiting for input (task completed)\n running - Agent executing a task\n waiting - Confirmation prompt active (Yes/No, etc.)\n\n### commandmate sync\n Ask the server to re-scan repositories and sync worktrees to its database\n (same endpoint as the GUI sync button). Run it after 'git worktree add' so the\n new worktree appears in 'commandmate ls' without opening the GUI (Issue #1680).\n\n commandmate sync # Prints the server's summary message\n commandmate sync --json # Full API response (worktreeCount,\n # repositoryCount, repositories,\n # deletedCount, cleanupWarnings)\n\n### commandmate send <worktree-id> \"<message>\"\n Send a message to an agent (async). Starts session automatically if not running.\n\n Options:\n --instance <id> Agent instance ID: <agent> or <agent>-<n> (e.g. claude-2, or codex\n for the codex primary instance). The recommended way to name a\n target: send / wait / respond / capture / auto-yes all take it.\n --agent <id> Ad-hoc CLI tool for an instance the roster does not know:\n claude (default), codex, gemini, vibe-local, opencode, copilot, antigravity\n --register Register the --instance session into the agent-instance roster\n --auto-yes Enable auto-yes before sending (session-wide, no policy\n guard -- for unattended runs prefer --contract with an\n autoYes policy: mode / denyPatterns)\n --duration <d> Auto-yes duration: 1h, 3h, 8h (default: 1h)\n --stop-pattern <p> Auto-yes stop condition (regex; matches terminal output,\n cannot block commands -- see auto-yes below)\n --ignore-structured-prompt\n Send even if only the agent's hooks report an open dialog.\n For a session whose pane looks idle but keeps refusing;\n a dialog visible in the terminal is still refused.\n\n Refused while the agent is waiting on a prompt (exit 2). Keystrokes sent to\n an open dialog never reach the agent -- they pile up in the dialog's own\n input line, and the next respond then carries that text along as a message\n instead of an answer. Nudging a stalled worker is how this gets worse.\n Answer first: commandmate respond <id> <answer>. respond, special keys and\n prompt-response are never refused -- they are the way out. Timer-fired sends\n ARE refused (same service layer) and record [prompt_waiting] as their reason.\n It fails open if the pane cannot be read, so treat it as a narrowing, not a\n guarantee.\n\n Two layers can report the dialog: the terminal scraper, and the agent's own\n hooks. Either one is enough to refuse -- the dialog the scraper cannot read is\n exactly the one that caused this. A frame neither layer classifies is still\n wait's \"unclassified\" case instead.\n\n A hook-reported dialog is released by the agent's next event, and hooks are\n fail-open, so the record can outlive its dialog. It therefore stops blocking\n sends 5 minutes after it was reported -- and immediately with\n --ignore-structured-prompt, or CM_STRUCTURED_SEND_GUARD=off for the server.\n A session nobody can send to is worse than a missed guard. Both bypasses are\n narrow: a prompt on screen is still refused, and the payload still reports it\n (wait and the UI do not go quiet).\n\n Finding worktree IDs:\n WT=$(commandmate ls --branch feature/101 --quiet)\n WT=$(commandmate ls --id anvil- --quiet) # disambiguate by repo (id prefix)\n commandmate send \"$WT\" \"Implement this\"\n\n Targeting a non-default agent (Issue #1638): pass --instance, not --agent. Only\n --instance is accepted by every command -- 'wait --agent' does not exist -- so a\n workflow that names the agent on 'send' and nothing on 'wait' waits on the wrong\n session in silence.\n commandmate send \"$WT\" \"Implement this\" --instance codex\n commandmate wait \"$WT\" --instance codex\n\n### commandmate wait <worktree-id...>\n Block until agent completes or prompt is detected.\n\n Options:\n --timeout <seconds> Maximum wait time\n --on-prompt <mode> agent (default) or human\n --stall-timeout <seconds> Max time without output change\n --instance <id> Agent instance to wait on. There is no --agent here.\n --verify After completion, run every verification gate\n --require-work After completion, run only the work-evidence gate\n\n Exit codes:\n 0 - Completed (agent idle/ready), and verified when --verify was given\n 10 - Prompt detected (--on-prompt agent mode)\n 20 - A verification gate failed (--verify)\n 21 - Nothing to verify: no commits, no uncommitted changes\n 124 - Timeout exceeded\n\n --on-prompt modes:\n agent - Returns exit 10 immediately with prompt JSON on stdout\n human - Keeps blocking until human responds via browser UI\n\n Prompt JSON output (exit 10):\n {\"worktreeId\":\"...\",\"cliToolId\":\"claude\",\"type\":\"yes_no\",\"question\":\"...\",\"options\":[\"yes\",\"no\"],\"status\":\"pending\"}\n The payload IS the prompt -- read it from stdout before falling back to\n capture. For type \"selection_list\", options is empty by design and the\n question field carries the reason.\n\n Three \"type\" values share exit 10; only the first is answerable with\n respond:\n yes_no / multiple_choice a parsed prompt -> commandmate respond\n selection_list arrow-key menu -> special keys\n unclassified the frame is interactive but detection could\n not parse it, and it has stayed that way for\n 60s -> look at the pane: capture <id> --pane\n \"unclassified\" exists because a frame that slips past detection disables\n auto-yes, the contract's autoYes policy and this exit 10 all at once. It\n needs the dwell: a capture taken mid-repaint can raise the flag once.\n --on-prompt human keeps waiting for it, same as the other two.\n\n --verify turns \"the agent stopped\" into \"the work passes the repository's own\n checks\". Verification only runs when completion was detected: a prompt (10) or\n a timeout (124) is reported as-is and never verified. With several worktrees,\n gates run one worktree at a time because the server caps concurrent runs.\n\n### commandmate verify <worktree-id>\n Run the gates declared in .commandmate/verify.yaml against a worktree.\n\n Options:\n --gates <id1,id2> Gate ids to run (default: work-evidence + all declared)\n --instance <id> Attribute the run to an agent instance\n --timeout <seconds> Stop polling after N seconds (exit 124)\n --json Print the run and its gate results as JSON on stdout\n\n Exit codes:\n 0 - Every gate passed\n 20 - A gate failed, timed out, or errored\n 21 - work-evidence found nothing to verify (no commits, no changes)\n 99 - The run produced no verdict (bad verify.yaml, gates skipped, cancelled)\n 124 - --timeout elapsed while the run was still going\n\n Output (progress on stderr, verdict on stdout):\n GATE work-evidence PASS (commits=3, uncommitted=2)\n GATE lint PASS (exit=0, 12.3s)\n GATE unit FAIL (exit=1, 45.0s)\n RESULT failed\n\n Gates run in the worktree's own directory. Gates are skipped (run status 99,\n never 0) in the checkout the server itself runs from when verify.yaml sets\n options.skipInPrimaryCheckout, so a 'build' gate cannot replace the assets the\n live app is serving.\n\n### commandmate verify history / commandmate verify show <run-id>\n Read past verification runs. Both are read-only and never start a run, so\n neither returns 20 or 21 \u2014 those mean \"this tree failed verification\", and a\n question about history is not a verdict on the current tree.\n\n commandmate verify history # every worktree, newest 50\n commandmate verify history --worktree <id> # one worktree\n commandmate verify history --days 14 --limit 100 # window and page size\n commandmate verify history --json # JSON array on stdout\n commandmate verify show 42 # gates + log tails\n commandmate verify show 42 --json\n\n history options:\n --worktree <id> Restrict to one worktree (default: all)\n --days <n> Look back n days, 1..90 (default: no lower bound)\n --limit <n> Maximum runs, 1..500 (default: 50)\n\n One run per line. The leading #<run-id> is what \"verify show\" takes:\n #42 2026-07-31T04:12:00.000Z myrepo-feature-101 manual failed failed: unit,build\n\n The listing carries gate verdicts but NOT gate log bodies \u2014 logTail is absent\n from the JSON, not null. Use \"verify show <run-id>\" when you need the log.\n\n Exit codes:\n 0 - Read succeeded (also when nothing matched: stderr note, or [] in JSON)\n 2 - Bad argument (--days/--limit out of range, bad worktree or run id)\n 99 - No such run (404), or an unexpected failure\n\n### commandmate respond <worktree-id> \"<answer>\"\n Respond to an agent's prompt.\n\n commandmate respond <id> \"yes\" # Yes/No\n commandmate respond <id> \"2\" # Multiple choice (number)\n commandmate respond <id> \"custom text\" # Free text\n commandmate respond <id> \"yes\" --instance codex-2 # Specific instance\n\n Exit codes:\n 0 - Response sent\n 99 - Prompt already dismissed (prompt_no_longer_active)\n\n### commandmate capture <worktree-id>\n Get current terminal output.\n\n commandmate capture <id> # Plain text\n commandmate capture <id> --json # JSON with status info\n commandmate capture <id> --instance codex # Specific instance\n\n### commandmate auto-yes <worktree-id>\n Control auto-yes (automatic prompt response).\n\n commandmate auto-yes <id> --enable # Enable (default 1h)\n commandmate auto-yes <id> --enable --duration 3h # With duration\n commandmate auto-yes <id> --enable --stop-pattern \"error\"\n commandmate auto-yes <id> --disable # Disable\n commandmate auto-yes <id> --enable --instance codex-2 # Scoped to one instance\n\n --stop-pattern matches new terminal output, not the commands an agent runs.\n It cannot block a command; a build log that merely prints the pattern\n (e.g. \"rm -rf\" in an npm script) also triggers it and stops auto-yes.\n To suppress auto-responses for risky prompts, use the task contract's\n autoYes.denyPatterns instead (docs/design/task-contract.md).\n\n### commandmate instances <worktree-id> [action] [args]\n Discover and manage a worktree's agent-instance roster (1 agent, multiple sessions).\n\n commandmate instances <id> # List roster + running/auto-yes status\n commandmate instances <id> --json # JSON output\n commandmate instances <id> add --agent codex # Add an instance (auto-generates ID, e.g. codex-2)\n commandmate instances <id> add --agent codex --alias \"Review\" --id codex-3\n commandmate instances <id> remove <instance-id> # Remove from roster\n commandmate instances <id> remove <instance-id> --kill # Remove and kill its session\n commandmate instances <id> alias <instance-id> \"New Name\"\n commandmate instances <id> kill <instance-id> # Kill only that instance's session\n\n See \"Multi-Session\" below for the ID convention and roster semantics.\n\n### commandmate skill <subcommand>\n Manage official Agent Skills. Every subcommand is a thin client over the same\n APIs the browser UI uses: the CLI never downloads, extracts, writes or deletes\n anything itself, and never sends a filesystem path, artifact URL, file list or\n checksum (the API rejects those outright).\n\n commandmate skill list [--json] [--prerelease]\n commandmate skill info <skill-id> [--version <v>] [--json]\n commandmate skill plan <skill-id> --worktree <id> [--version <v>] [--json]\n commandmate skill install <skill-id> --worktree <id> --version <exact> [--dry-run] [--yes] [--ack-risk <id>@<version>] [--json]\n commandmate skill uninstall <skill-id> --worktree <id> [--dry-run] [--yes] [--json]\n commandmate skill status <skill-id> --worktree <id> [--json]\n\n Confirmation contract (writes = install / uninstall):\n - A plan is always built and shown first. --dry-run stops there.\n - Without a TTY, a write REQUIRES --yes. A missing --yes is refused, never\n assumed: an environment that cannot prompt must not install silently.\n - A high-risk Skill additionally requires --ack-risk <skill-id>@<version>\n with the exact id and version. --yes alone never carries a high-risk\n install, in a TTY or out of one.\n\n Exit codes:\n 0 success\n 1 the server or the Catalog could not be reached (retryable)\n 2 invalid arguments, unknown Skill or unknown version\n 11 the worktree refused it (local change, conflict, lock, plan drift)\n 12 the write was never confirmed (no --yes, declined, or missing --ack-risk)\n 13 files changed but the operation needs reconciliation\n\n --json prints the API response body verbatim on stdout; diagnostics, prompts\n and errors always go to stderr, so a failed --json run leaves stdout empty.\n\n 'skill status' reports one Skill in one worktree, read from the install\n receipt on disk. There is no per-worktree listing endpoint yet, so <skill-id>\n is required.\n\n## Multi-Session (1 agent, multiple sessions)\n\n A worktree can run several sessions of the same CLI tool concurrently. Each\n session is an \"instance\" identified by an instance ID:\n <agent> - the agent's primary instance (e.g. \"claude\")\n <agent>-<n> - an additional instance, n >= 2 (e.g. \"claude-2\", \"claude-3\")\n\n --instance is accepted by send / wait / respond / capture / auto-yes.\n send --instance auto-starts the session if it is not already running.\n\n --instance alone is the recommended way to name a target (Issue #1638). It is\n the only flag all five commands share: --agent is rejected by 'wait'. A\n rostered instance already carries its CLI tool (Issue #1629), and an instance\n id that is itself a tool id resolves to that tool's primary instance even\n without a roster entry, so '--instance codex' needs no --agent.\n\n --agent remains accepted by send / respond / capture / auto-yes as the\n supplement for ad-hoc instances the roster does not know -- notably\n '--register', which cannot infer the tool from an id like codex-3. Passing an\n --agent that contradicts the roster is an error (exit 2), not an override.\n\n The roster (visible in the browser UI's Agent panel) is the list of known\n instances with aliases and display order. Ad-hoc sessions started via\n 'send --instance' do NOT appear in the roster unless registered:\n commandmate send <id> \"...\" --instance claude-2 --register\n Without --register, the session still runs and responds to CLI commands,\n but it will not show up in the UI sidebar/roster until added there or via\n 'commandmate instances <id> add'.\n\n Per-instance auto-yes: --instance scopes --auto-yes/--duration/--stop-pattern\n to that specific session, independent of other instances of the same agent.\n\n commandmate instances <id> # discover valid --instance values\n commandmate send <id> \"task\" --instance codex-2 --auto-yes\n commandmate wait <id> --instance codex-2 --timeout 600\n commandmate capture <id> --instance codex-2\n\n## All Exit Codes\n\n 0 SUCCESS - Completed successfully\n 1 DEPENDENCY_ERROR - Server not running\n 2 CONFIG_ERROR - Validation error (invalid agent, duration, etc.)\n 10 PROMPT_DETECTED - Prompt detected during wait\n 20 VERIFY_FAILED - A verification gate failed (verify, wait --verify)\n 21 NOT_STARTED - Nothing to verify: no commits, no uncommitted changes\n 99 UNEXPECTED_ERROR - Unexpected error / resource not found / no verdict\n 124 TIMEOUT - Wait or verification timeout exceeded\n\n When one 'wait' covers several worktrees, the reported code is the highest\n priority one observed: 10 > 20 > 21 > 124.\n\n## Troubleshooting\n\n Server not running:\n commandmate start --daemon\n CM_PORT=3011 commandmate ls # Different port\n\n Worktree not found:\n commandmate ls --quiet # Check registered IDs\n commandmate sync # Sync new worktrees (e.g. after git worktree add)\n commandmate status # Confirm 'ls' and 'status' report the same Port\n # (with several servers running, an exported CM_PORT\n # points 'ls' at a different one)\n\n Authentication:\n CM_AUTH_TOKEN=your-token commandmate ls\n";
9
9
  export declare const AGENT_OPERATIONS_SAMPLES = "# CLI Agent Operations - Workflow Samples\n\nCopy and adapt these patterns for your use case.\n\n## 1. Basic: send, wait, capture\n\n WT=$(commandmate ls --branch feature/101 --quiet)\n commandmate send \"$WT\" \"Implement Issue #101 with TDD\"\n commandmate wait \"$WT\" --timeout 600\n commandmate capture \"$WT\"\n\n## 2. With Auto-Yes (unattended execution)\n\n WT=$(commandmate ls --branch feature/101 --quiet)\n commandmate send \"$WT\" \"Implement Issue #101\" --auto-yes --duration 3h\n commandmate wait \"$WT\" --timeout 1800\n commandmate auto-yes \"$WT\" --disable # Disable for safety\n commandmate capture \"$WT\" --json\n\n## 3. Prompt Response Loop\n\n WT=$(commandmate ls --branch feature/101 --quiet)\n commandmate send \"$WT\" \"Refactor this module\"\n\n while true; do\n commandmate wait \"$WT\" --timeout 600 --on-prompt agent\n EXIT_CODE=$?\n\n if [ $EXIT_CODE -eq 0 ]; then\n echo \"Done\"\n break\n elif [ $EXIT_CODE -eq 10 ]; then\n commandmate respond \"$WT\" \"yes\"\n elif [ $EXIT_CODE -eq 124 ]; then\n echo \"Timeout\"\n break\n fi\n done\n\n commandmate capture \"$WT\"\n\n## 4. Parallel Worktrees\n\n WT1=$(commandmate ls --branch feature/101 --quiet)\n WT2=$(commandmate ls --branch feature/102 --quiet)\n\n commandmate send \"$WT1\" \"Implement #101\" --auto-yes\n commandmate send \"$WT2\" \"Implement #102\" --auto-yes --instance codex\n\n # One --instance covers every worktree id in the call, so worktrees on\n # different instances need one wait each. Both agents keep running while the\n # first wait blocks, so this costs no wall clock over a combined wait.\n # A bare 'wait \"$WT2\"' would watch WT2's DEFAULT agent, not the codex session:\n # 'wait' has no --agent to correct that with.\n commandmate wait \"$WT1\" --timeout 1800\n commandmate wait \"$WT2\" --instance codex --timeout 1800\n\n commandmate capture \"$WT1\" --json\n commandmate capture \"$WT2\" --instance codex --json\n\n## 5. Check status before sending\n\n # Find worktrees and check status\n commandmate ls --json | python3 -c \"\n import sys, json\n for wt in json.load(sys.stdin):\n if wt['name'].startswith('feature/'):\n print(f\\\"{wt['id']} {wt['name']}\\\")\n \"\n\n## 6. Error handling pattern\n\n WT=$(commandmate ls --branch feature/101 --quiet)\n\n if [ -z \"$WT\" ]; then\n echo \"Error: worktree not found\"\n exit 1\n fi\n\n commandmate send \"$WT\" \"Fix the bug\" --auto-yes\n commandmate wait \"$WT\" --timeout 600\n EXIT_CODE=$?\n\n case $EXIT_CODE in\n 0) echo \"Success\"; commandmate capture \"$WT\" ;;\n 10) echo \"Prompt detected\"; commandmate respond \"$WT\" \"yes\" ;;\n 124) echo \"Timeout\"; commandmate capture \"$WT\" --json ;;\n *) echo \"Error: exit $EXIT_CODE\" ;;\n esac\n\n## 7. Multi-Session: run a second Codex session alongside the primary agent\n\n WT=$(commandmate ls --branch feature/101 --quiet)\n\n # Discover the roster before picking an --instance value\n commandmate instances \"$WT\"\n\n # Register a second Codex instance, then send/wait/capture scoped to it.\n # Once it is in the roster, --instance alone carries the CLI tool.\n commandmate instances \"$WT\" add --agent codex --alias \"Review\"\n commandmate send \"$WT\" \"Review the diff\" --instance codex-2 --auto-yes\n commandmate wait \"$WT\" --instance codex-2 --timeout 600\n commandmate capture \"$WT\" --instance codex-2 --json\n\n # Ad-hoc instance without pre-registering (still runs; register to show in UI).\n # --agent is required here: codex-3 is not in the roster yet, so nothing else\n # says which CLI tool to start.\n commandmate send \"$WT\" \"Quick check\" --agent codex --instance codex-3 --register\n\n # Clean up when done\n commandmate instances \"$WT\" remove codex-2 --kill\n\n## 8. Verify the work instead of trusting \"the agent stopped\"\n\n WT=$(commandmate ls --branch feature/101 --quiet)\n commandmate send \"$WT\" \"Implement Issue #101 with TDD\" --auto-yes\n\n # One call: wait for completion, then run every gate in .commandmate/verify.yaml\n commandmate wait \"$WT\" --timeout 1800 --verify\n case $? in\n 0) echo \"Verified\" ;;\n 10) commandmate respond \"$WT\" \"yes\" ;;\n 20) echo \"A gate failed\"; commandmate verify \"$WT\" --json ;;\n 21) echo \"The agent produced nothing\" ;;\n esac\n\n # Cheap pre-check: is there any work at all, before paying for the full suite?\n commandmate wait \"$WT\" --require-work || echo \"no commits and no changes\"\n\n # Re-run a subset after a fix, without waiting on the agent\n commandmate verify \"$WT\" --gates lint,unit\n";
10
10
  //# sourceMappingURL=agent-operations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-operations.d.ts","sourceRoot":"","sources":["../../../src/cli/docs/agent-operations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,sBAAsB,+2jBA2VlC,CAAC;AAEF,eAAO,MAAM,wBAAwB,klJAmIpC,CAAC"}
1
+ {"version":3,"file":"agent-operations.d.ts","sourceRoot":"","sources":["../../../src/cli/docs/agent-operations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,sBAAsB,stkBA+VlC,CAAC;AAEF,eAAO,MAAM,wBAAwB,klJAmIpC,CAAC"}
@@ -17,7 +17,8 @@ These commands enable coding agents (Claude Code, Codex, etc.) to orchestrate ot
17
17
 
18
18
  - CommandMate server must be running: commandmate start --daemon
19
19
  - Target worktrees must be registered (visible in browser UI sidebar)
20
- - Use CM_PORT env var to connect to a different port (default: 3000)
20
+ - Connection target is resolved as: exported CM_PORT > ~/.commandmate/.env CM_PORT > 3000
21
+ (CM_BIND and the CM_HTTPS_CERT + CM_HTTPS_KEY pair are honoured the same way)
21
22
  - Use CM_AUTH_TOKEN env var for authenticated servers
22
23
 
23
24
  ## Commands
@@ -352,6 +353,9 @@ These commands enable coding agents (Claude Code, Codex, etc.) to orchestrate ot
352
353
  Worktree not found:
353
354
  commandmate ls --quiet # Check registered IDs
354
355
  commandmate sync # Sync new worktrees (e.g. after git worktree add)
356
+ commandmate status # Confirm 'ls' and 'status' report the same Port
357
+ # (with several servers running, an exported CM_PORT
358
+ # points 'ls' at a different one)
355
359
 
356
360
  Authentication:
357
361
  CM_AUTH_TOKEN=your-token commandmate ls
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,4CAA4C;AAC5C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAK3C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAaD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CASjF;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA0BD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,cAAc,CAyEhB;AAeD;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAC,CAAS;gBAEX,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAa1D,OAAO,CAAC,UAAU;IAUlB;;;OAGG;IACG,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAuBtC;;;OAGG;IACG,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IA2BvD;;;;OAIG;IACG,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAyBzD;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACxD,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA0BD;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;aAGf,QAAQ,EAAE,MAAM;aAChB,UAAU,CAAC,EAAE,MAAM;IACnC,gEAAgE;aAChD,OAAO,CAAC,EAAE,eAAe;gBAJzC,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,YAAA;IACnC,gEAAgE;IAChD,OAAO,CAAC,EAAE,eAAe,YAAA;IAM3C,uEAAuE;IACvE,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;CACF;AAkBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EACvC,OAAO,EAAE,MAAM,GACd,CAAC,CAiBH;AAOD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CASvF;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CASxE"}
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,4CAA4C;AAC5C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAK3C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAaD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CASjF;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA0BD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,cAAc,CAyEhB;AAeD;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAC,CAAS;gBAEX,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAmB1D,OAAO,CAAC,UAAU;IAUlB;;;OAGG;IACG,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAuBtC;;;OAGG;IACG,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IA2BvD;;;;OAIG;IACG,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAyBzD;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACxD,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA0BD;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;aAGf,QAAQ,EAAE,MAAM;aAChB,UAAU,CAAC,EAAE,MAAM;IACnC,gEAAgE;aAChD,OAAO,CAAC,EAAE,eAAe;gBAJzC,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,YAAA;IACnC,gEAAgE;IAChD,OAAO,CAAC,EAAE,eAAe,YAAA;IAM3C,uEAAuE;IACvE,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;CACF;AAkBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EACvC,OAAO,EAAE,MAAM,GACd,CAAC,CAiBH;AAOD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CASvF;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CASxE"}
@@ -19,6 +19,7 @@ exports.fetchDaemonVersion = fetchDaemonVersion;
19
19
  exports.warnIfVersionSkew = warnIfVersionSkew;
20
20
  const types_1 = require("../types");
21
21
  const package_info_1 = require("./package-info");
22
+ const server_url_1 = require("./server-url");
22
23
  /** Maximum stop-pattern length [SEC4-06] */
23
24
  exports.MAX_STOP_PATTERN_LENGTH = 500;
24
25
  /** Worktree ID validation pattern [SEC4-04] */
@@ -190,8 +191,14 @@ class ApiClient {
190
191
  baseUrl;
191
192
  token;
192
193
  constructor(options) {
193
- const port = process.env.CM_PORT || '3000';
194
- this.baseUrl = options?.baseUrl || `http://localhost:${port}`;
194
+ // Issue #1743: resolve through loadClientEnv() rather than `process.env.CM_PORT || '3000'`.
195
+ // Reading process.env alone ignored ~/.commandmate/.env, so with two servers running,
196
+ // `status` reported the .env port while every ApiClient-based subcommand (ls / send / wait
197
+ // / capture / …) silently talked to the default port 3000. loadClientEnv() layers .env
198
+ // *under* process.env — see its doc comment for why that order is the reverse of the one
199
+ // `status` uses. resolveServerEndpoint() then applies the same CM_BIND / CM_HTTPS_CERT +
200
+ // CM_HTTPS_KEY rules as `status`, which the old hardcoded `http://localhost:` ignored.
201
+ this.baseUrl = options?.baseUrl || (0, server_url_1.resolveServerEndpoint)((0, server_url_1.loadClientEnv)()).url;
195
202
  this.token = resolveAuthToken(options);
196
203
  // [SEC4-02] Warn about HTTP to non-localhost
197
204
  if (this.token && !this.baseUrl.startsWith('https://') && !isLocalhost(this.baseUrl)) {
@@ -35,4 +35,27 @@ export declare function resolveServerEndpoint(env: ServerEnv): ServerEndpoint;
35
35
  * @param envPath - A worktree .env layered over the main one; omit for the main server
36
36
  */
37
37
  export declare function loadEffectiveEnv(envPath?: string): NodeJS.ProcessEnv;
38
+ /**
39
+ * Build the environment a *client* resolves its connection target from (Issue #1743).
40
+ *
41
+ * The layering is deliberately the mirror image of loadEffectiveEnv(), because the two
42
+ * answer different questions:
43
+ *
44
+ * - loadEffectiveEnv() answers "where is the server?". It reproduces what daemon.start()
45
+ * hands the child (`{...process.env, ...parsed}`), so the .env the server actually booted
46
+ * with outranks whatever this shell happens to export. That is what `status` reports.
47
+ * - loadClientEnv() answers "where should this invocation dial?". An exported CM_PORT is the
48
+ * caller naming a target for this one command (`CM_PORT=3011 commandmate ls`, documented in
49
+ * docs/user-guide/cli-operations-guide.md), so it has to outrank a file default. That is
50
+ * the standard dotenv precedence, and reusing loadEffectiveEnv() here would silently break
51
+ * that documented usage.
52
+ *
53
+ * What Issue #1743 required of both is that they consult ~/.commandmate/.env at all: ApiClient
54
+ * resolved from `process.env` alone, so with two servers running, every subcommand built on it
55
+ * (ls / send / wait / capture / …) dialled the default port 3000 while `status` correctly
56
+ * reported the .env port.
57
+ *
58
+ * Resolution order: `process.env` > `~/.commandmate/.env` > resolveServerEndpoint() defaults.
59
+ */
60
+ export declare function loadClientEnv(): ServerEnv;
38
61
  //# sourceMappingURL=server-url.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-url.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/server-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAErE,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,SAAS,GAAG,cAAc,CAQpE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAWpE"}
1
+ {"version":3,"file":"server-url.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/server-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAErE,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,SAAS,GAAG,cAAc,CAQpE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAWpE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,IAAI,SAAS,CAUzC"}
@@ -11,6 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.resolveServerEndpoint = resolveServerEndpoint;
13
13
  exports.loadEffectiveEnv = loadEffectiveEnv;
14
+ exports.loadClientEnv = loadClientEnv;
14
15
  const dotenv_1 = require("dotenv");
15
16
  const env_setup_1 = require("./env-setup");
16
17
  /**
@@ -41,3 +42,35 @@ function loadEffectiveEnv(envPath) {
41
42
  : (0, dotenv_1.config)({ path: envPath }).parsed || {};
42
43
  return { ...process.env, ...mainParsed, ...ownParsed };
43
44
  }
45
+ /**
46
+ * Build the environment a *client* resolves its connection target from (Issue #1743).
47
+ *
48
+ * The layering is deliberately the mirror image of loadEffectiveEnv(), because the two
49
+ * answer different questions:
50
+ *
51
+ * - loadEffectiveEnv() answers "where is the server?". It reproduces what daemon.start()
52
+ * hands the child (`{...process.env, ...parsed}`), so the .env the server actually booted
53
+ * with outranks whatever this shell happens to export. That is what `status` reports.
54
+ * - loadClientEnv() answers "where should this invocation dial?". An exported CM_PORT is the
55
+ * caller naming a target for this one command (`CM_PORT=3011 commandmate ls`, documented in
56
+ * docs/user-guide/cli-operations-guide.md), so it has to outrank a file default. That is
57
+ * the standard dotenv precedence, and reusing loadEffectiveEnv() here would silently break
58
+ * that documented usage.
59
+ *
60
+ * What Issue #1743 required of both is that they consult ~/.commandmate/.env at all: ApiClient
61
+ * resolved from `process.env` alone, so with two servers running, every subcommand built on it
62
+ * (ls / send / wait / capture / …) dialled the default port 3000 while `status` correctly
63
+ * reported the .env port.
64
+ *
65
+ * Resolution order: `process.env` > `~/.commandmate/.env` > resolveServerEndpoint() defaults.
66
+ */
67
+ function loadClientEnv() {
68
+ // quiet: dotenv's "injecting env" banner is written to stdout, where it would corrupt
69
+ // machine-readable output such as `commandmate ls --json`.
70
+ // processEnv: this is a read-only lookup. Left to its default, dotenv would populate
71
+ // process.env with every key the file defines, turning file values into "exported"
72
+ // ones for the rest of the process — the precedence this function exists to avoid.
73
+ const parsed = (0, dotenv_1.config)({ path: (0, env_setup_1.getEnvPath)(), processEnv: {}, quiet: true }).parsed ?? {};
74
+ // process.env last: an explicitly exported variable wins over the file (see above)
75
+ return { ...parsed, ...process.env };
76
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commandmate",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
4
4
  "description": "A local control plane for agent CLIs — orchestration and visibility for Claude Code, Codex, Gemini CLI, and more across Git worktrees",
5
5
  "keywords": [
6
6
  "claude-code",