@chankov/agent-fleet 0.0.1

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 (419) hide show
  1. package/.claude/commands/build.md +44 -0
  2. package/.claude/commands/code-simplify.md +22 -0
  3. package/.claude/commands/design-agent.md +14 -0
  4. package/.claude/commands/doctor-agent-fleet.md +17 -0
  5. package/.claude/commands/orchestrate.md +112 -0
  6. package/.claude/commands/plan.md +16 -0
  7. package/.claude/commands/prime.md +22 -0
  8. package/.claude/commands/review.md +16 -0
  9. package/.claude/commands/setup-agent-fleet.md +25 -0
  10. package/.claude/commands/ship.md +72 -0
  11. package/.claude/commands/spec.md +15 -0
  12. package/.claude/commands/test.md +19 -0
  13. package/.claude/commands/webperf.md +32 -0
  14. package/.claude/orchestrate-teams.yaml +24 -0
  15. package/.opencode/commands/af-build.md +17 -0
  16. package/.opencode/commands/af-code-simplify.md +16 -0
  17. package/.opencode/commands/af-compound.md +16 -0
  18. package/.opencode/commands/af-design-agent.md +15 -0
  19. package/.opencode/commands/af-doctor-agent-fleet.md +15 -0
  20. package/.opencode/commands/af-orchestrate.md +112 -0
  21. package/.opencode/commands/af-plan.md +16 -0
  22. package/.opencode/commands/af-prime.md +22 -0
  23. package/.opencode/commands/af-review.md +15 -0
  24. package/.opencode/commands/af-setup-agent-fleet.md +15 -0
  25. package/.opencode/commands/af-ship.md +16 -0
  26. package/.opencode/commands/af-spec.md +16 -0
  27. package/.opencode/commands/af-test.md +21 -0
  28. package/.opencode/commands/af-webperf.md +32 -0
  29. package/.opencode/orchestrate-teams.yaml +24 -0
  30. package/.pi/agents/dispatch-policy.yaml +32 -0
  31. package/.pi/agents/model-profiles.yaml +20 -0
  32. package/.pi/agents/peers.yaml +142 -0
  33. package/.pi/agents/teams.yaml +39 -0
  34. package/.pi/damage-control-rules.yaml +297 -0
  35. package/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  36. package/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  37. package/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  38. package/.pi/extensions/btw/README.md +118 -0
  39. package/.pi/extensions/btw/index.ts +917 -0
  40. package/.pi/extensions/btw/package.json +6 -0
  41. package/.pi/extensions/btw/state.js +179 -0
  42. package/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  43. package/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
  44. package/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  45. package/.pi/extensions/compact-and-continue/README.md +42 -0
  46. package/.pi/extensions/compact-and-continue/index.ts +120 -0
  47. package/.pi/extensions/compact-and-continue/package.json +6 -0
  48. package/.pi/extensions/mcp-bridge/README.md +46 -0
  49. package/.pi/extensions/mcp-bridge/index.ts +206 -0
  50. package/.pi/extensions/mcp-bridge/package.json +6 -0
  51. package/.pi/extensions/package-lock.json +1143 -0
  52. package/.pi/extensions/package.json +9 -0
  53. package/.pi/extensions/pi-voice-stt/README.md +201 -0
  54. package/.pi/extensions/pi-voice-stt/config.ts +198 -0
  55. package/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  56. package/.pi/extensions/pi-voice-stt/index.ts +248 -0
  57. package/.pi/extensions/pi-voice-stt/package.json +6 -0
  58. package/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  59. package/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  60. package/.pi/harnesses/agent-hub/README.md +562 -0
  61. package/.pi/harnesses/agent-hub/artifacts.js +92 -0
  62. package/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  63. package/.pi/harnesses/agent-hub/delegate.ts +363 -0
  64. package/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  65. package/.pi/harnesses/agent-hub/helpers.ts +165 -0
  66. package/.pi/harnesses/agent-hub/index.ts +7098 -0
  67. package/.pi/harnesses/agent-hub/package.json +6 -0
  68. package/.pi/harnesses/agent-hub/return-contract.js +215 -0
  69. package/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  70. package/.pi/harnesses/agent-hub/spawn.ts +179 -0
  71. package/.pi/harnesses/ask-user-remote/README.md +10 -0
  72. package/.pi/harnesses/ask-user-remote/index.ts +253 -0
  73. package/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  74. package/.pi/harnesses/coms/README.md +71 -0
  75. package/.pi/harnesses/coms/index.ts +1743 -0
  76. package/.pi/harnesses/coms/package.json +6 -0
  77. package/.pi/harnesses/damage-control/README.md +65 -0
  78. package/.pi/harnesses/damage-control/index.ts +250 -0
  79. package/.pi/harnesses/damage-control/package.json +6 -0
  80. package/.pi/harnesses/damage-control/shared.ts +183 -0
  81. package/.pi/harnesses/damage-control-continue/README.md +116 -0
  82. package/.pi/harnesses/damage-control-continue/index.ts +522 -0
  83. package/.pi/harnesses/damage-control-continue/package.json +6 -0
  84. package/.pi/harnesses/lib/herdr-client.ts +458 -0
  85. package/.pi/harnesses/lib/herdr-presence.ts +288 -0
  86. package/.pi/harnesses/package-lock.json +35 -0
  87. package/.pi/harnesses/package.json +9 -0
  88. package/.pi/prompts/build.md +24 -0
  89. package/.pi/prompts/code-simplify.md +22 -0
  90. package/.pi/prompts/doctor-agent-fleet.md +15 -0
  91. package/.pi/prompts/plan.md +16 -0
  92. package/.pi/prompts/review.md +16 -0
  93. package/.pi/prompts/setup-agent-fleet.md +27 -0
  94. package/.pi/prompts/ship.md +17 -0
  95. package/.pi/prompts/spec.md +15 -0
  96. package/.pi/prompts/test.md +19 -0
  97. package/.pi/skills/bowser/SKILL.md +145 -0
  98. package/.versions/0.0.1/.claude/commands/build.md +44 -0
  99. package/.versions/0.0.1/.claude/commands/code-simplify.md +22 -0
  100. package/.versions/0.0.1/.claude/commands/design-agent.md +14 -0
  101. package/.versions/0.0.1/.claude/commands/doctor-agent-fleet.md +17 -0
  102. package/.versions/0.0.1/.claude/commands/orchestrate.md +112 -0
  103. package/.versions/0.0.1/.claude/commands/plan.md +16 -0
  104. package/.versions/0.0.1/.claude/commands/prime.md +22 -0
  105. package/.versions/0.0.1/.claude/commands/review.md +16 -0
  106. package/.versions/0.0.1/.claude/commands/setup-agent-fleet.md +25 -0
  107. package/.versions/0.0.1/.claude/commands/ship.md +72 -0
  108. package/.versions/0.0.1/.claude/commands/spec.md +15 -0
  109. package/.versions/0.0.1/.claude/commands/test.md +19 -0
  110. package/.versions/0.0.1/.claude/commands/webperf.md +32 -0
  111. package/.versions/0.0.1/.claude/orchestrate-teams.yaml +24 -0
  112. package/.versions/0.0.1/.opencode/commands/af-build.md +17 -0
  113. package/.versions/0.0.1/.opencode/commands/af-code-simplify.md +16 -0
  114. package/.versions/0.0.1/.opencode/commands/af-compound.md +16 -0
  115. package/.versions/0.0.1/.opencode/commands/af-design-agent.md +15 -0
  116. package/.versions/0.0.1/.opencode/commands/af-doctor-agent-fleet.md +15 -0
  117. package/.versions/0.0.1/.opencode/commands/af-orchestrate.md +112 -0
  118. package/.versions/0.0.1/.opencode/commands/af-plan.md +16 -0
  119. package/.versions/0.0.1/.opencode/commands/af-prime.md +22 -0
  120. package/.versions/0.0.1/.opencode/commands/af-review.md +15 -0
  121. package/.versions/0.0.1/.opencode/commands/af-setup-agent-fleet.md +15 -0
  122. package/.versions/0.0.1/.opencode/commands/af-ship.md +16 -0
  123. package/.versions/0.0.1/.opencode/commands/af-spec.md +16 -0
  124. package/.versions/0.0.1/.opencode/commands/af-test.md +21 -0
  125. package/.versions/0.0.1/.opencode/commands/af-webperf.md +32 -0
  126. package/.versions/0.0.1/.opencode/orchestrate-teams.yaml +24 -0
  127. package/.versions/0.0.1/.pi/agents/dispatch-policy.yaml +32 -0
  128. package/.versions/0.0.1/.pi/agents/model-profiles.yaml +20 -0
  129. package/.versions/0.0.1/.pi/agents/peers.yaml +142 -0
  130. package/.versions/0.0.1/.pi/agents/teams.yaml +39 -0
  131. package/.versions/0.0.1/.pi/damage-control-rules.yaml +297 -0
  132. package/.versions/0.0.1/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  133. package/.versions/0.0.1/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  134. package/.versions/0.0.1/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  135. package/.versions/0.0.1/.pi/extensions/btw/README.md +118 -0
  136. package/.versions/0.0.1/.pi/extensions/btw/index.ts +917 -0
  137. package/.versions/0.0.1/.pi/extensions/btw/package.json +6 -0
  138. package/.versions/0.0.1/.pi/extensions/btw/state.js +179 -0
  139. package/.versions/0.0.1/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  140. package/.versions/0.0.1/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
  141. package/.versions/0.0.1/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  142. package/.versions/0.0.1/.pi/extensions/compact-and-continue/README.md +42 -0
  143. package/.versions/0.0.1/.pi/extensions/compact-and-continue/index.ts +120 -0
  144. package/.versions/0.0.1/.pi/extensions/compact-and-continue/package.json +6 -0
  145. package/.versions/0.0.1/.pi/extensions/mcp-bridge/README.md +46 -0
  146. package/.versions/0.0.1/.pi/extensions/mcp-bridge/index.ts +206 -0
  147. package/.versions/0.0.1/.pi/extensions/mcp-bridge/package.json +6 -0
  148. package/.versions/0.0.1/.pi/extensions/package-lock.json +1143 -0
  149. package/.versions/0.0.1/.pi/extensions/package.json +9 -0
  150. package/.versions/0.0.1/.pi/extensions/pi-voice-stt/README.md +201 -0
  151. package/.versions/0.0.1/.pi/extensions/pi-voice-stt/config.ts +198 -0
  152. package/.versions/0.0.1/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  153. package/.versions/0.0.1/.pi/extensions/pi-voice-stt/index.ts +248 -0
  154. package/.versions/0.0.1/.pi/extensions/pi-voice-stt/package.json +6 -0
  155. package/.versions/0.0.1/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  156. package/.versions/0.0.1/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  157. package/.versions/0.0.1/.pi/harnesses/agent-hub/README.md +562 -0
  158. package/.versions/0.0.1/.pi/harnesses/agent-hub/artifacts.js +92 -0
  159. package/.versions/0.0.1/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  160. package/.versions/0.0.1/.pi/harnesses/agent-hub/delegate.ts +363 -0
  161. package/.versions/0.0.1/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  162. package/.versions/0.0.1/.pi/harnesses/agent-hub/helpers.ts +165 -0
  163. package/.versions/0.0.1/.pi/harnesses/agent-hub/index.ts +7098 -0
  164. package/.versions/0.0.1/.pi/harnesses/agent-hub/package.json +6 -0
  165. package/.versions/0.0.1/.pi/harnesses/agent-hub/return-contract.js +215 -0
  166. package/.versions/0.0.1/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  167. package/.versions/0.0.1/.pi/harnesses/agent-hub/spawn.ts +179 -0
  168. package/.versions/0.0.1/.pi/harnesses/ask-user-remote/README.md +10 -0
  169. package/.versions/0.0.1/.pi/harnesses/ask-user-remote/index.ts +253 -0
  170. package/.versions/0.0.1/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  171. package/.versions/0.0.1/.pi/harnesses/coms/README.md +71 -0
  172. package/.versions/0.0.1/.pi/harnesses/coms/index.ts +1743 -0
  173. package/.versions/0.0.1/.pi/harnesses/coms/package.json +6 -0
  174. package/.versions/0.0.1/.pi/harnesses/damage-control/README.md +65 -0
  175. package/.versions/0.0.1/.pi/harnesses/damage-control/index.ts +250 -0
  176. package/.versions/0.0.1/.pi/harnesses/damage-control/package.json +6 -0
  177. package/.versions/0.0.1/.pi/harnesses/damage-control/shared.ts +183 -0
  178. package/.versions/0.0.1/.pi/harnesses/damage-control-continue/README.md +116 -0
  179. package/.versions/0.0.1/.pi/harnesses/damage-control-continue/index.ts +522 -0
  180. package/.versions/0.0.1/.pi/harnesses/damage-control-continue/package.json +6 -0
  181. package/.versions/0.0.1/.pi/harnesses/lib/herdr-client.ts +458 -0
  182. package/.versions/0.0.1/.pi/harnesses/lib/herdr-presence.ts +288 -0
  183. package/.versions/0.0.1/.pi/harnesses/package-lock.json +35 -0
  184. package/.versions/0.0.1/.pi/harnesses/package.json +9 -0
  185. package/.versions/0.0.1/.pi/prompts/build.md +24 -0
  186. package/.versions/0.0.1/.pi/prompts/code-simplify.md +22 -0
  187. package/.versions/0.0.1/.pi/prompts/doctor-agent-fleet.md +15 -0
  188. package/.versions/0.0.1/.pi/prompts/plan.md +16 -0
  189. package/.versions/0.0.1/.pi/prompts/review.md +16 -0
  190. package/.versions/0.0.1/.pi/prompts/setup-agent-fleet.md +27 -0
  191. package/.versions/0.0.1/.pi/prompts/ship.md +17 -0
  192. package/.versions/0.0.1/.pi/prompts/spec.md +15 -0
  193. package/.versions/0.0.1/.pi/prompts/test.md +19 -0
  194. package/.versions/0.0.1/.pi/skills/bowser/SKILL.md +145 -0
  195. package/.versions/0.0.1/.version +1 -0
  196. package/.versions/0.0.1/agents/architect.md +21 -0
  197. package/.versions/0.0.1/agents/bowser.md +25 -0
  198. package/.versions/0.0.1/agents/builder.md +52 -0
  199. package/.versions/0.0.1/agents/code-reviewer.md +205 -0
  200. package/.versions/0.0.1/agents/deep-researcher.md +31 -0
  201. package/.versions/0.0.1/agents/documenter.md +16 -0
  202. package/.versions/0.0.1/agents/orchestrator.md +43 -0
  203. package/.versions/0.0.1/agents/plan-reviewer.md +60 -0
  204. package/.versions/0.0.1/agents/planner.md +69 -0
  205. package/.versions/0.0.1/agents/releaser.md +22 -0
  206. package/.versions/0.0.1/agents/researcher.md +28 -0
  207. package/.versions/0.0.1/agents/security-auditor.md +166 -0
  208. package/.versions/0.0.1/agents/test-engineer.md +144 -0
  209. package/.versions/0.0.1/agents/web-debugger.md +42 -0
  210. package/.versions/0.0.1/agents/web-performance-auditor.md +192 -0
  211. package/.versions/0.0.1/hooks/SIMPLIFY-IGNORE.md +90 -0
  212. package/.versions/0.0.1/hooks/coms-stop-hook.mjs +73 -0
  213. package/.versions/0.0.1/hooks/hooks.json +14 -0
  214. package/.versions/0.0.1/hooks/session-start.sh +74 -0
  215. package/.versions/0.0.1/hooks/simplify-ignore.sh +302 -0
  216. package/.versions/0.0.1/justfile +143 -0
  217. package/.versions/0.0.1/references/accessibility-checklist.md +160 -0
  218. package/.versions/0.0.1/references/definition-of-done.md +67 -0
  219. package/.versions/0.0.1/references/fleet-coordination-patterns.md +151 -0
  220. package/.versions/0.0.1/references/observability-checklist.md +91 -0
  221. package/.versions/0.0.1/references/orchestration-patterns.md +370 -0
  222. package/.versions/0.0.1/references/performance-checklist.md +153 -0
  223. package/.versions/0.0.1/references/prompting-patterns.md +380 -0
  224. package/.versions/0.0.1/references/security-checklist.md +179 -0
  225. package/.versions/0.0.1/references/testing-patterns.md +236 -0
  226. package/.versions/0.0.1/scripts/coms-claude-bridge.ts +286 -0
  227. package/.versions/0.0.1/scripts/coms-cli.ts +372 -0
  228. package/.versions/0.0.1/scripts/coms-hermes-bridge.ts +399 -0
  229. package/.versions/0.0.1/scripts/lib/claude-bridge-core.ts +100 -0
  230. package/.versions/0.0.1/scripts/lib/coms-envelope.ts +494 -0
  231. package/.versions/0.0.1/scripts/lib/herdr-layout.ts +235 -0
  232. package/.versions/0.0.1/scripts/lib/hermes-bridge-core.ts +238 -0
  233. package/.versions/0.0.1/scripts/lib/persona-banner.ts +62 -0
  234. package/.versions/0.0.1/scripts/lib/team-project.ts +75 -0
  235. package/.versions/0.0.1/scripts/lib/team-snapshot.ts +146 -0
  236. package/.versions/0.0.1/scripts/peer-banner.ts +40 -0
  237. package/.versions/0.0.1/scripts/team-snapshot.ts +221 -0
  238. package/.versions/0.0.1/scripts/team-up.ts +245 -0
  239. package/.versions/0.0.1/skills/_internal/grilling.md +11 -0
  240. package/.versions/0.0.1/skills/browser-testing-with-devtools/SKILL.md +352 -0
  241. package/.versions/0.0.1/skills/code-review-and-quality/SKILL.md +381 -0
  242. package/.versions/0.0.1/skills/compound-learning/SKILL.md +137 -0
  243. package/.versions/0.0.1/skills/context-engineering/SKILL.md +291 -0
  244. package/.versions/0.0.1/skills/deprecation-and-migration/SKILL.md +206 -0
  245. package/.versions/0.0.1/skills/designing-agents/SKILL.md +394 -0
  246. package/.versions/0.0.1/skills/designing-agents/pi-harness-authoring.md +209 -0
  247. package/.versions/0.0.1/skills/frontend-ui-engineering/SKILL.md +328 -0
  248. package/.versions/0.0.1/skills/git-workflow-and-versioning/SKILL.md +316 -0
  249. package/.versions/0.0.1/skills/guided-workspace-setup/SKILL.md +506 -0
  250. package/.versions/0.0.1/skills/idea-refine/SKILL.md +182 -0
  251. package/.versions/0.0.1/skills/idea-refine/examples.md +238 -0
  252. package/.versions/0.0.1/skills/idea-refine/frameworks.md +99 -0
  253. package/.versions/0.0.1/skills/idea-refine/refinement-criteria.md +113 -0
  254. package/.versions/0.0.1/skills/idea-refine/scripts/idea-refine.sh +15 -0
  255. package/.versions/0.0.1/skills/incremental-implementation/SKILL.md +287 -0
  256. package/.versions/0.0.1/skills/interview-me/SKILL.md +226 -0
  257. package/.versions/0.0.1/skills/orchestration-verification/SKILL.md +181 -0
  258. package/.versions/0.0.1/skills/peer-coms/SKILL.md +81 -0
  259. package/.versions/0.0.1/skills/performance-optimization/SKILL.md +350 -0
  260. package/.versions/0.0.1/skills/planning-and-task-breakdown/SKILL.md +236 -0
  261. package/.versions/0.0.1/skills/security-and-hardening/SKILL.md +461 -0
  262. package/.versions/0.0.1/skills/spec-driven-development/SKILL.md +245 -0
  263. package/.versions/0.0.1/skills/using-agent-skills/SKILL.md +199 -0
  264. package/.versions/0.0.1/vendor/agent-skills-upstream/LICENSE +21 -0
  265. package/.versions/0.0.1/vendor/agent-skills-upstream/README.md +11 -0
  266. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  267. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  268. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  269. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  270. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  271. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  272. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  273. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  274. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  275. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  276. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  277. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  278. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  279. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  280. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  281. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  282. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  283. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  284. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  285. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  286. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  287. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  288. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  289. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  290. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  291. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  292. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  293. package/.versions/0.0.1/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  294. package/CHANGELOG.md +65 -0
  295. package/LICENSE +21 -0
  296. package/README.md +458 -0
  297. package/agents/architect.md +21 -0
  298. package/agents/bowser.md +25 -0
  299. package/agents/builder.md +52 -0
  300. package/agents/code-reviewer.md +205 -0
  301. package/agents/deep-researcher.md +31 -0
  302. package/agents/documenter.md +16 -0
  303. package/agents/orchestrator.md +43 -0
  304. package/agents/plan-reviewer.md +60 -0
  305. package/agents/planner.md +69 -0
  306. package/agents/releaser.md +22 -0
  307. package/agents/researcher.md +28 -0
  308. package/agents/security-auditor.md +166 -0
  309. package/agents/test-engineer.md +144 -0
  310. package/agents/web-debugger.md +42 -0
  311. package/agents/web-performance-auditor.md +192 -0
  312. package/bin/cli.js +633 -0
  313. package/bin/force-patch-changesets.js +44 -0
  314. package/bin/lib/bootstrap.js +323 -0
  315. package/bin/lib/detect-agent.js +49 -0
  316. package/bin/lib/doctor.js +302 -0
  317. package/bin/lib/transform-persona.js +180 -0
  318. package/bin/lib/update-notifier.js +195 -0
  319. package/bin/lib/validate-overrides.js +229 -0
  320. package/bin/snapshot-version.js +91 -0
  321. package/docs/agent-fleet-setup.md +355 -0
  322. package/docs/claude-code-coms-bridge.md +93 -0
  323. package/docs/getting-started.md +169 -0
  324. package/docs/npm-install.md +335 -0
  325. package/docs/opencode-setup.md +248 -0
  326. package/docs/pi-extensions.md +237 -0
  327. package/docs/pi-setup.md +455 -0
  328. package/docs/skill-anatomy.md +150 -0
  329. package/hooks/SIMPLIFY-IGNORE.md +90 -0
  330. package/hooks/coms-stop-hook.mjs +73 -0
  331. package/hooks/hooks.json +14 -0
  332. package/hooks/session-start.sh +74 -0
  333. package/hooks/simplify-ignore.sh +302 -0
  334. package/justfile +143 -0
  335. package/node_modules/pi-ask-user/LICENSE +21 -0
  336. package/node_modules/pi-ask-user/README.md +156 -0
  337. package/node_modules/pi-ask-user/index.ts +1795 -0
  338. package/node_modules/pi-ask-user/package.json +51 -0
  339. package/node_modules/pi-ask-user/single-select-layout.ts +203 -0
  340. package/node_modules/pi-ask-user/skills/ask-user/SKILL.md +162 -0
  341. package/node_modules/pi-ask-user/skills/ask-user/references/ask-user-skill-extension-spec.md +96 -0
  342. package/package.json +121 -0
  343. package/references/accessibility-checklist.md +160 -0
  344. package/references/definition-of-done.md +67 -0
  345. package/references/fleet-coordination-patterns.md +151 -0
  346. package/references/observability-checklist.md +91 -0
  347. package/references/orchestration-patterns.md +370 -0
  348. package/references/performance-checklist.md +153 -0
  349. package/references/prompting-patterns.md +380 -0
  350. package/references/security-checklist.md +179 -0
  351. package/references/testing-patterns.md +236 -0
  352. package/scripts/coms-claude-bridge.ts +286 -0
  353. package/scripts/coms-cli.ts +372 -0
  354. package/scripts/coms-hermes-bridge.ts +399 -0
  355. package/scripts/lib/claude-bridge-core.ts +100 -0
  356. package/scripts/lib/coms-envelope.ts +494 -0
  357. package/scripts/lib/herdr-layout.ts +235 -0
  358. package/scripts/lib/hermes-bridge-core.ts +238 -0
  359. package/scripts/lib/persona-banner.ts +62 -0
  360. package/scripts/lib/team-project.ts +75 -0
  361. package/scripts/lib/team-snapshot.ts +146 -0
  362. package/scripts/peer-banner.ts +40 -0
  363. package/scripts/team-snapshot.ts +221 -0
  364. package/scripts/team-up.ts +245 -0
  365. package/skills/_internal/grilling.md +11 -0
  366. package/skills/browser-testing-with-devtools/SKILL.md +352 -0
  367. package/skills/code-review-and-quality/SKILL.md +381 -0
  368. package/skills/compound-learning/SKILL.md +137 -0
  369. package/skills/context-engineering/SKILL.md +291 -0
  370. package/skills/deprecation-and-migration/SKILL.md +206 -0
  371. package/skills/designing-agents/SKILL.md +394 -0
  372. package/skills/designing-agents/pi-harness-authoring.md +209 -0
  373. package/skills/frontend-ui-engineering/SKILL.md +328 -0
  374. package/skills/git-workflow-and-versioning/SKILL.md +316 -0
  375. package/skills/guided-workspace-setup/SKILL.md +506 -0
  376. package/skills/idea-refine/SKILL.md +182 -0
  377. package/skills/idea-refine/examples.md +238 -0
  378. package/skills/idea-refine/frameworks.md +99 -0
  379. package/skills/idea-refine/refinement-criteria.md +113 -0
  380. package/skills/idea-refine/scripts/idea-refine.sh +15 -0
  381. package/skills/incremental-implementation/SKILL.md +287 -0
  382. package/skills/interview-me/SKILL.md +226 -0
  383. package/skills/orchestration-verification/SKILL.md +181 -0
  384. package/skills/peer-coms/SKILL.md +81 -0
  385. package/skills/performance-optimization/SKILL.md +350 -0
  386. package/skills/planning-and-task-breakdown/SKILL.md +236 -0
  387. package/skills/security-and-hardening/SKILL.md +461 -0
  388. package/skills/spec-driven-development/SKILL.md +245 -0
  389. package/skills/using-agent-skills/SKILL.md +199 -0
  390. package/vendor/agent-skills-upstream/LICENSE +21 -0
  391. package/vendor/agent-skills-upstream/README.md +11 -0
  392. package/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  393. package/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  394. package/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  395. package/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  396. package/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  397. package/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  398. package/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  399. package/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  400. package/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  401. package/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  402. package/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  403. package/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  404. package/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  405. package/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  406. package/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  407. package/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  408. package/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  409. package/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  410. package/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  411. package/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  412. package/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  413. package/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  414. package/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  415. package/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  416. package/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  417. package/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  418. package/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  419. package/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
@@ -0,0 +1,323 @@
1
+ // bootstrap.js — drop the minimum installer artifacts a coding agent needs
2
+ // to recognize `/setup-agent-fleet` and `/doctor-agent-fleet`.
3
+ //
4
+ // The CLI's `init` calls this before the handoff message. Without it, a
5
+ // fresh workspace has no `.claude/commands/setup-agent-fleet.md`, `.pi/prompts/setup-agent-fleet.md`,
6
+ // etc., so the agent has no idea what `/setup-agent-fleet` is and the whole hand-off
7
+ // breaks silently.
8
+ //
9
+ // What we bootstrap (per agent):
10
+ // - The `setup` slash command (so the user can invoke it)
11
+ // - The `doctor` slash command (same)
12
+ // - The `guided-workspace-setup` skill body (the slash command says
13
+ // "load this skill" — the skill must be present somewhere the agent
14
+ // auto-discovers)
15
+ //
16
+ // What we do NOT bootstrap:
17
+ // - Any of the user-facing skills (spec-driven-development,
18
+ // test-driven-development, …). Those are picked by the user inside
19
+ // /setup-agent-fleet, by design. The CLI never decides the workspace's catalogue
20
+ // for the user.
21
+ //
22
+ // Method:
23
+ // `copy` — safe default; works for npx caches that may be cleaned
24
+ // `symlink` — leaner; only safe when the source root is stable
25
+ // (global install / git clone). Warning printed if the
26
+ // source path looks like an npx cache.
27
+
28
+ import { existsSync, mkdirSync, copyFileSync, symlinkSync, unlinkSync, lstatSync, rmSync, readdirSync, rmdirSync, writeFileSync, readFileSync } from "node:fs";
29
+ import { dirname, join, relative } from "node:path";
30
+
31
+ // Marker file the skill reads to find the authoritative source root. Written
32
+ // by bootstrap, deleted by cleanupInstaller. Without this, the skill would
33
+ // have to guess the source root from its own SKILL.md location — but bootstrap
34
+ // copies SKILL.md into the workspace, so that heuristic always lies.
35
+ const BOOTSTRAP_MARKER = join(".ai", ".agent-fleet-bootstrap.json");
36
+
37
+ function writeMarker({ workspace, sourceRoot, agent, method }) {
38
+ const path = join(workspace, BOOTSTRAP_MARKER);
39
+ const version = readPackageVersion(sourceRoot);
40
+ const payload = {
41
+ sourceRoot,
42
+ version,
43
+ agent,
44
+ method,
45
+ bootstrappedAt: new Date().toISOString(),
46
+ _comment: "Written by `npx @chankov/agent-fleet init`. Read by the guided-workspace-setup skill to locate the source package. Safe to delete; will be regenerated on next init.",
47
+ };
48
+ mkdirSync(dirname(path), { recursive: true });
49
+ writeFileSync(path, JSON.stringify(payload, null, 2) + "\n", "utf8");
50
+ return path;
51
+ }
52
+
53
+ function readPackageVersion(sourceRoot) {
54
+ try {
55
+ const pkg = JSON.parse(readFileSync(join(sourceRoot, "package.json"), "utf8"));
56
+ return pkg.version;
57
+ } catch { return null; }
58
+ }
59
+
60
+ /**
61
+ * Read the bootstrap marker if present. Lets `update` recover the agent and
62
+ * method chosen at init time. Returns null when the marker is absent (e.g.
63
+ * after guided-workspace-setup removed it in its end-of-run cleanup).
64
+ *
65
+ * @param {string} workspace
66
+ * @returns {{sourceRoot?:string, version?:string, agent?:string, method?:string}|null}
67
+ */
68
+ export function readBootstrapMarker(workspace) {
69
+ try {
70
+ return JSON.parse(readFileSync(join(workspace, BOOTSTRAP_MARKER), "utf8"));
71
+ } catch { return null; }
72
+ }
73
+
74
+ // (agent → list of {kind, src, dest}) — kind is just for the report.
75
+ //
76
+ // All installer slash commands are namespaced with `-agent-fleet` so they
77
+ // don't collide with workspace-defined or other-tool slash commands. The
78
+ // short names (setup, doctor, as-setup, as-doctor) were used in 0.2.0 and
79
+ // earlier — cleanupLegacyNames() removes those if found.
80
+ function plan({ agent, sourceRoot, workspace }) {
81
+ const skillSrc = join(sourceRoot, "skills", "guided-workspace-setup", "SKILL.md");
82
+
83
+ switch (agent) {
84
+ case "claude-code":
85
+ return [
86
+ { kind: "command", src: join(sourceRoot, ".claude/commands/setup-agent-fleet.md"),
87
+ dest: join(workspace, ".claude/commands/setup-agent-fleet.md") },
88
+ { kind: "command", src: join(sourceRoot, ".claude/commands/doctor-agent-fleet.md"),
89
+ dest: join(workspace, ".claude/commands/doctor-agent-fleet.md") },
90
+ { kind: "skill", src: skillSrc,
91
+ dest: join(workspace, ".claude/skills/guided-workspace-setup/SKILL.md") },
92
+ ];
93
+
94
+ case "pi":
95
+ return [
96
+ { kind: "prompt", src: join(sourceRoot, ".pi/prompts/setup-agent-fleet.md"),
97
+ dest: join(workspace, ".pi/prompts/setup-agent-fleet.md") },
98
+ { kind: "prompt", src: join(sourceRoot, ".pi/prompts/doctor-agent-fleet.md"),
99
+ dest: join(workspace, ".pi/prompts/doctor-agent-fleet.md") },
100
+ // pi auto-discovers skills from .pi/skills/ and .agents/skills/ —
101
+ // we use .pi/skills/ to avoid polluting a shared .agents/ dir if
102
+ // the user has other tools there.
103
+ { kind: "skill", src: skillSrc,
104
+ dest: join(workspace, ".pi/skills/guided-workspace-setup/SKILL.md") },
105
+ ];
106
+
107
+ case "opencode":
108
+ // OpenCode discovers skills + commands from ~/.config/opencode/ (global)
109
+ // and references AGENTS.md. A project-local bootstrap is awkward — we
110
+ // drop the command file into .opencode/commands/ (which OpenCode does
111
+ // load from the project) and the skill alongside it, then flag the
112
+ // AGENTS.md gap for the user.
113
+ return [
114
+ { kind: "command", src: join(sourceRoot, ".opencode/commands/af-setup-agent-fleet.md"),
115
+ dest: join(workspace, ".opencode/commands/af-setup-agent-fleet.md") },
116
+ { kind: "command", src: join(sourceRoot, ".opencode/commands/af-doctor-agent-fleet.md"),
117
+ dest: join(workspace, ".opencode/commands/af-doctor-agent-fleet.md") },
118
+ { kind: "skill", src: skillSrc,
119
+ dest: join(workspace, ".opencode/skills/guided-workspace-setup/SKILL.md") },
120
+ ];
121
+
122
+ default:
123
+ throw new Error(`bootstrap: unknown agent "${agent}"`);
124
+ }
125
+ }
126
+
127
+ // Files that were the bootstrap targets in 0.2.0 and earlier (pre-rename).
128
+ // Removed during bootstrap so a workspace upgraded from 0.2.0 doesn't end
129
+ // up with both the old and new slash commands.
130
+ function legacyPaths({ agent, workspace }) {
131
+ switch (agent) {
132
+ case "claude-code":
133
+ return [
134
+ join(workspace, ".claude/commands/setup.md"),
135
+ join(workspace, ".claude/commands/doctor.md"),
136
+ ];
137
+ case "pi":
138
+ return [
139
+ join(workspace, ".pi/prompts/setup.md"),
140
+ join(workspace, ".pi/prompts/doctor.md"),
141
+ ];
142
+ case "opencode":
143
+ return [
144
+ join(workspace, ".opencode/commands/as-setup.md"),
145
+ join(workspace, ".opencode/commands/as-doctor.md"),
146
+ ];
147
+ default:
148
+ return [];
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Run the bootstrap.
154
+ *
155
+ * @param {object} opts
156
+ * @param {string} opts.agent claude-code | opencode | pi
157
+ * @param {string} opts.sourceRoot Absolute path to the installed package
158
+ * @param {string} opts.workspace Absolute path to the target workspace
159
+ * @param {"copy"|"symlink"} opts.method
160
+ * @param {boolean} [opts.dryRun]
161
+ * @returns {{written:Array, skipped:Array, warnings:Array}}
162
+ */
163
+ export function bootstrap({ agent, sourceRoot, workspace, method, dryRun = false }) {
164
+ const items = plan({ agent, sourceRoot, workspace });
165
+ const written = [], skipped = [], removed = [], warnings = [];
166
+
167
+ // Warn if the user asked for symlink against an unstable source.
168
+ if (method === "symlink" && /\/\.npm\/_npx\//.test(sourceRoot)) {
169
+ warnings.push(
170
+ "--method symlink against an npx cache path: links will break when " +
171
+ "the cache is cleaned. Consider --method copy or install globally " +
172
+ "with `npm install -g @chankov/agent-fleet`.",
173
+ );
174
+ }
175
+
176
+ // Clean up pre-0.3.0 file names if present — they were renamed to
177
+ // *-agent-fleet so they don't collide with other slash commands.
178
+ for (const oldPath of legacyPaths({ agent, workspace })) {
179
+ if (!existsSync(oldPath) && !isSymlink(oldPath)) continue;
180
+ if (dryRun) {
181
+ removed.push(oldPath);
182
+ continue;
183
+ }
184
+ try {
185
+ unlinkSync(oldPath);
186
+ removed.push(oldPath);
187
+ } catch (err) {
188
+ warnings.push(`could not remove legacy file ${relative(workspace, oldPath)}: ${err.message}`);
189
+ }
190
+ }
191
+
192
+ for (const item of items) {
193
+ if (!existsSync(item.src)) {
194
+ warnings.push(`missing source: ${relative(sourceRoot, item.src)} (skipping ${item.kind})`);
195
+ continue;
196
+ }
197
+
198
+ if (dryRun) {
199
+ written.push({ ...item, method });
200
+ continue;
201
+ }
202
+
203
+ try {
204
+ mkdirSync(dirname(item.dest), { recursive: true });
205
+
206
+ // Always replace — the bootstrap is installer scaffolding, not user
207
+ // data. If we left it stale, an upgraded package would still hand off
208
+ // to the old /setup-agent-fleet command. Step 6 of guided-workspace-setup explicitly
209
+ // never offers these files in the install menu, so we are the only
210
+ // mechanism that refreshes them.
211
+ if (existsSync(item.dest) || isSymlink(item.dest)) {
212
+ unlinkSync(item.dest);
213
+ }
214
+
215
+ if (method === "symlink") {
216
+ symlinkSync(item.src, item.dest);
217
+ } else {
218
+ // copyFileSync handles plain files; for the SKILL.md case the source
219
+ // may have sibling support files in some skills — but
220
+ // guided-workspace-setup is a single-file skill, so copyFileSync is
221
+ // fine. Switch to cpSync if that ever changes.
222
+ copyFileSync(item.src, item.dest);
223
+ }
224
+ written.push({ ...item, method });
225
+ } catch (err) {
226
+ skipped.push({ ...item, error: err.message });
227
+ }
228
+ }
229
+
230
+ // Write the marker file as the LAST step — only after all the bootstrap
231
+ // files landed successfully. If the marker exists, the skill trusts it
232
+ // absolutely; if it does not, the skill falls back to safer paths.
233
+ if (!dryRun && written.length > 0) {
234
+ try {
235
+ const markerPath = writeMarker({ workspace, sourceRoot, agent, method });
236
+ written.push({ kind: "marker", dest: markerPath, method: "write" });
237
+ } catch (err) {
238
+ warnings.push(`could not write bootstrap marker: ${err.message}`);
239
+ }
240
+ } else if (dryRun) {
241
+ written.push({ kind: "marker", dest: join(workspace, BOOTSTRAP_MARKER), method: "write" });
242
+ }
243
+
244
+ return { written, skipped, removed, warnings };
245
+ }
246
+
247
+ /**
248
+ * Remove every bootstrap artifact this module knows how to write. Called
249
+ * by guided-workspace-setup at the end of Step 10 unless the user chose
250
+ * to keep the installer commands. After cleanup, the only way back to
251
+ * /setup-agent-fleet is to re-run `npx @chankov/agent-fleet init`.
252
+ *
253
+ * The same `agent` value must be supplied that was used at bootstrap time —
254
+ * we don't have a tracking file, so we delete based on the plan map.
255
+ *
256
+ * @param {object} opts
257
+ * @param {string} opts.agent
258
+ * @param {string} opts.workspace
259
+ * @param {boolean} [opts.dryRun]
260
+ * @returns {{removed:string[], kept:string[], warnings:string[]}}
261
+ */
262
+ export function cleanupInstaller({ agent, workspace, dryRun = false }) {
263
+ const planned = plan({ agent, sourceRoot: workspace, workspace });
264
+ const removed = [], kept = [], warnings = [];
265
+
266
+ // Marker file goes too — it pointed at a source root that no longer
267
+ // matters once the install is done.
268
+ const markerPath = join(workspace, BOOTSTRAP_MARKER);
269
+ if (existsSync(markerPath)) {
270
+ if (dryRun) {
271
+ removed.push(markerPath);
272
+ } else {
273
+ try { unlinkSync(markerPath); removed.push(markerPath); }
274
+ catch (err) { warnings.push(`could not remove ${relative(workspace, markerPath)}: ${err.message}`); }
275
+ }
276
+ }
277
+
278
+ for (const item of planned) {
279
+ if (!existsSync(item.dest) && !isSymlink(item.dest)) {
280
+ kept.push(item.dest); // already gone — count it as a no-op, not an error
281
+ continue;
282
+ }
283
+ if (dryRun) {
284
+ removed.push(item.dest);
285
+ continue;
286
+ }
287
+ try {
288
+ const lst = lstatSync(item.dest);
289
+ if (lst.isDirectory() && !lst.isSymbolicLink()) {
290
+ rmSync(item.dest, { recursive: true });
291
+ } else {
292
+ unlinkSync(item.dest);
293
+ }
294
+ removed.push(item.dest);
295
+
296
+ // If we removed the only file in a parent directory we created
297
+ // (.claude/skills/guided-workspace-setup/), prune the directory too.
298
+ pruneEmptyDirsUpTo(dirname(item.dest), workspace);
299
+ } catch (err) {
300
+ warnings.push(`could not remove ${relative(workspace, item.dest)}: ${err.message}`);
301
+ }
302
+ }
303
+
304
+ return { removed, kept, warnings };
305
+ }
306
+
307
+ function pruneEmptyDirsUpTo(dir, workspace) {
308
+ // Walk upward removing empty parent dirs until we hit a non-empty one or
309
+ // the workspace root. Never delete the workspace itself.
310
+ try {
311
+ while (dir !== workspace && dir.startsWith(workspace)) {
312
+ const entries = readdirSync(dir);
313
+ if (entries.length > 0) return;
314
+ rmdirSync(dir);
315
+ dir = dirname(dir);
316
+ }
317
+ } catch { /* prune is best-effort */ }
318
+ }
319
+
320
+ function isSymlink(path) {
321
+ try { return lstatSync(path).isSymbolicLink(); }
322
+ catch { return false; }
323
+ }
@@ -0,0 +1,49 @@
1
+ // Agent detection — used by `agent-fleet init` to pick a sensible default
2
+ // for the coding agent. The user can always override with --agent.
3
+
4
+ import { existsSync } from "node:fs";
5
+ import { join } from "node:path";
6
+
7
+ export const AGENTS = ["claude-code", "opencode", "pi"];
8
+
9
+ const LABELS = {
10
+ "claude-code": "Claude Code",
11
+ "opencode": "OpenCode",
12
+ "pi": "pi",
13
+ };
14
+
15
+ export function agentLabel(agent) {
16
+ return LABELS[agent] ?? agent;
17
+ }
18
+
19
+ // Detection precedence (default):
20
+ // 1. Explicit env vars from the coding agent runtime
21
+ // 2. Workspace directory hints (.claude/ / .opencode/ / .pi/)
22
+ // 3. Null — let the caller prompt
23
+ //
24
+ // `preferWorkspaceHints` flips 1 and 2. `update` uses it: the question there
25
+ // is "which agent is *this workspace* configured for?", not "which agent am I
26
+ // running inside?" — so a pi workspace must not resolve to claude-code just
27
+ // because `update` was invoked from a Claude Code shell.
28
+ export function detectAgent({ workspace, env = process.env, preferWorkspaceHints = false } = {}) {
29
+ const byEnv = () => {
30
+ if (env.CLAUDECODE === "1" || env.CLAUDE_CODE_ENTRYPOINT) return "claude-code";
31
+ if (env.OPENCODE === "1" || env.OPENCODE_VERSION) return "opencode";
32
+ if (env.PI === "1" || env.PI_SESSION_ID) return "pi";
33
+ return null;
34
+ };
35
+
36
+ const byWorkspace = () => {
37
+ // Only one match → pick it; multiple → don't guess.
38
+ if (!workspace) return null;
39
+ const hits = [];
40
+ if (existsSync(join(workspace, ".claude"))) hits.push("claude-code");
41
+ if (existsSync(join(workspace, ".opencode"))) hits.push("opencode");
42
+ if (existsSync(join(workspace, ".pi"))) hits.push("pi");
43
+ return hits.length === 1 ? hits[0] : null;
44
+ };
45
+
46
+ return preferWorkspaceHints
47
+ ? (byWorkspace() ?? byEnv())
48
+ : (byEnv() ?? byWorkspace());
49
+ }
@@ -0,0 +1,302 @@
1
+ // Doctor scan — deterministic preflight extracted from
2
+ // guided-workspace-setup Step 5. Both `agent-fleet doctor` (CLI) and the
3
+ // `/doctor-agent-fleet` slash command call into this so behaviour cannot drift.
4
+ //
5
+ // Three classes of findings:
6
+ // 1. Broken symlinks — links whose source has been moved, renamed, or deleted
7
+ // 2. Stale persona refs — YAML configs (teams.yaml, peers.yaml) that
8
+ // still name a persona which no longer exists in the source tree
9
+ // 3. Malformed peer entries — field lines in peers.yaml that sit under a
10
+ // team before any `- name: ...` list item. The team-up launcher's
11
+ // minimal parser silently drops such lines, so the peer vanishes with
12
+ // no error. Advisory only: the fix is a hand edit.
13
+ // 4. Overrides-file problems — unknown sections/keys, invalid values, and
14
+ // unset declared env vars in .ai/agent-fleet-overrides.md. Advisory
15
+ // only: reported, never auto-fixed (the fix is always a hand edit).
16
+ //
17
+ // For each broken link we look up a canonical replacement in the source
18
+ // `agents/` or `skills/` tree (many breakages are stale names from the
19
+ // pre-merge layout, e.g. `reviewer` → `code-reviewer`).
20
+
21
+ import { readdirSync, readlinkSync, existsSync, lstatSync, statSync, unlinkSync, symlinkSync, readFileSync, writeFileSync } from "node:fs";
22
+ import { join, resolve, dirname, basename, relative, isAbsolute } from "node:path";
23
+ import { transformPersona } from "./transform-persona.js";
24
+ import { validateOverrides } from "./validate-overrides.js";
25
+
26
+ // Known canonical replacements for personas renamed during the merge.
27
+ const PERSONA_RENAMES = {
28
+ "reviewer": "code-reviewer",
29
+ "red-team": "security-auditor",
30
+ "tester": "test-engineer",
31
+ "qa": "test-engineer",
32
+ };
33
+
34
+ // Install-target directories the scanner walks, when present.
35
+ const TARGET_DIRS = [
36
+ // Personas
37
+ "agents",
38
+ ".claude/agents",
39
+ ".opencode/agent",
40
+ ".opencode/agents", // legacy plural form from older installs
41
+ ".pi/agents",
42
+ // Skills
43
+ ".claude/skills",
44
+ ".opencode/skills",
45
+ ".pi/skills",
46
+ ".agents/skills",
47
+ // Commands / prompts
48
+ ".claude/commands",
49
+ ".opencode/commands",
50
+ ".pi/prompts",
51
+ // References + hooks
52
+ ".claude/references",
53
+ ".claude/hooks",
54
+ ];
55
+
56
+ // YAML configs that may reference persona names.
57
+ const YAML_REFS = [
58
+ ".pi/agents/teams.yaml",
59
+ ".pi/agents/peers.yaml",
60
+ ];
61
+
62
+ /**
63
+ * Run the doctor scan.
64
+ *
65
+ * @param {object} opts
66
+ * @param {string} opts.workspace Workspace root (absolute path)
67
+ * @param {string} opts.sourceRoot agent-fleet source root (absolute path)
68
+ * @param {boolean} [opts.apply] If true, apply suggested fixes; otherwise just report
69
+ * @returns {Array|object} Findings array (apply=false) or {repaired,deleted,skipped} (apply=true)
70
+ */
71
+ export async function runDoctor({ workspace, sourceRoot, apply = false }) {
72
+ const findings = [];
73
+
74
+ // 1. Broken symlinks in install-target directories.
75
+ for (const rel of TARGET_DIRS) {
76
+ const dir = join(workspace, rel);
77
+ if (!existsSync(dir)) continue;
78
+ let entries;
79
+ try { entries = readdirSync(dir, { withFileTypes: true }); }
80
+ catch { continue; }
81
+
82
+ for (const entry of entries) {
83
+ const fullPath = join(dir, entry.name);
84
+ let lst;
85
+ try { lst = lstatSync(fullPath); } catch { continue; }
86
+ if (!lst.isSymbolicLink()) continue;
87
+
88
+ // Resolve where the link points.
89
+ const linkTarget = readlinkSync(fullPath);
90
+ const absTarget = isAbsolute(linkTarget)
91
+ ? linkTarget
92
+ : resolve(dirname(fullPath), linkTarget);
93
+
94
+ if (existsSync(absTarget)) continue; // healthy link
95
+
96
+ const replacement = findReplacement({
97
+ brokenName: entry.name,
98
+ kind: inferKind(rel),
99
+ sourceRoot,
100
+ });
101
+
102
+ // Personas under .claude/agents/ and .opencode/agent(s)/ must be
103
+ // GENERATED from the canonical source, never symlinked raw — a raw
104
+ // link would expose the untransformed pi-flavored frontmatter.
105
+ const personaAgent =
106
+ rel === ".claude/agents" ? "claude-code"
107
+ : rel === ".opencode/agent" || rel === ".opencode/agents" ? "opencode"
108
+ : null;
109
+
110
+ findings.push({
111
+ type: "broken-symlink",
112
+ path: relative(workspace, fullPath),
113
+ issue: `broken symlink → missing ${relative(workspace, absTarget)}`,
114
+ fix: replacement
115
+ ? personaAgent
116
+ ? `regenerate from ${relative(workspace, join(sourceRoot, replacement))} (transformed for ${personaAgent})`
117
+ : `repoint to ${relative(workspace, join(sourceRoot, replacement))}`
118
+ : "delete",
119
+ replacement,
120
+ personaAgent,
121
+ absPath: fullPath,
122
+ });
123
+ }
124
+ }
125
+
126
+ // 2. Stale persona refs in YAML configs.
127
+ for (const rel of YAML_REFS) {
128
+ const file = join(workspace, rel);
129
+ if (!existsSync(file)) continue;
130
+ const text = readFileSync(file, "utf8");
131
+ for (const [stale, canonical] of Object.entries(PERSONA_RENAMES)) {
132
+ // Match the persona name as a *standalone token* — bounded by
133
+ // start-of-line, whitespace, quotes, or a YAML separator (:, [, ], ,).
134
+ // Crucially, "-" must NOT count as a boundary, or we'd match
135
+ // "reviewer" inside "code-reviewer".
136
+ const re = new RegExp(
137
+ `(^|[\\s'"\\[\\],:])${escapeRe(stale)}(?=[\\s'"\\[\\],:]|$)`,
138
+ "gm",
139
+ );
140
+ if (re.test(text)) {
141
+ findings.push({
142
+ type: "stale-yaml-ref",
143
+ path: relative(workspace, file),
144
+ issue: `references "${stale}"`,
145
+ fix: `rename to "${canonical}"`,
146
+ stale,
147
+ canonical,
148
+ absPath: file,
149
+ });
150
+ }
151
+ }
152
+ }
153
+
154
+ // 3. Malformed peer entries in peers.yaml (advisory, never auto-fixed).
155
+ findings.push(...scanPeersYamlShape(workspace));
156
+
157
+ // 4. Advisory validation of the overrides file (never auto-fixed).
158
+ findings.push(...validateOverrides({ workspace }));
159
+
160
+ if (!apply) return findings;
161
+
162
+ // ── Apply ──────────────────────────────────────────────────────────────
163
+ let repaired = 0, deleted = 0, skipped = 0;
164
+
165
+ for (const f of findings) {
166
+ try {
167
+ if (f.type === "broken-symlink") {
168
+ if (f.replacement && f.personaAgent) {
169
+ const source = readFileSync(join(sourceRoot, f.replacement), "utf8");
170
+ const { content } = transformPersona(source, { agent: f.personaAgent });
171
+ unlinkSync(f.absPath);
172
+ writeFileSync(f.absPath, content);
173
+ repaired++;
174
+ } else if (f.replacement) {
175
+ const newTarget = join(sourceRoot, f.replacement);
176
+ unlinkSync(f.absPath);
177
+ symlinkSync(newTarget, f.absPath);
178
+ repaired++;
179
+ } else {
180
+ unlinkSync(f.absPath);
181
+ deleted++;
182
+ }
183
+ } else if (f.type === "stale-yaml-ref") {
184
+ const text = readFileSync(f.absPath, "utf8");
185
+ const re = new RegExp(
186
+ `(^|[\\s'"\\[\\],:])${escapeRe(f.stale)}(?=[\\s'"\\[\\],:]|$)`,
187
+ "gm",
188
+ );
189
+ writeFileSync(f.absPath, text.replace(re, `$1${f.canonical}`));
190
+ repaired++;
191
+ }
192
+ } catch (err) {
193
+ skipped++;
194
+ console.error(` ⚠ skipped ${f.path}: ${err.message}`);
195
+ }
196
+ }
197
+
198
+ return { repaired, deleted, skipped, findings };
199
+ }
200
+
201
+ function escapeRe(s) {
202
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
203
+ }
204
+
205
+ // Scan peers.yaml for field lines that sit under a team heading before any
206
+ // `- name: ...` list item. scripts/team-up.ts parses this file with a minimal
207
+ // hand-rolled parser that only attaches `key: value` lines to the CURRENT list
208
+ // item — an orphan field block (typically a peer whose leading `- name:` line
209
+ // was lost in an edit) is dropped without an error and the peer silently
210
+ // never spawns. One finding per team, pointing at the first orphan line.
211
+ const PEERS_YAML_REL = ".pi/agents/peers.yaml";
212
+
213
+ function scanPeersYamlShape(workspace) {
214
+ const file = join(workspace, PEERS_YAML_REL);
215
+ if (!existsSync(file)) return [];
216
+ let text;
217
+ try { text = readFileSync(file, "utf8"); } catch { return []; }
218
+
219
+ const findings = [];
220
+ let currentTeam = null;
221
+ let inItem = false;
222
+ let reportedTeam = null;
223
+
224
+ text.split("\n").forEach((rawLine, i) => {
225
+ const line = rawLine.replace(/\s+$/, "");
226
+ if (line.trim() === "" || /^\s*#/.test(line)) return;
227
+ const content = line.trim();
228
+
229
+ if (!/^\s/.test(line)) {
230
+ const m = content.match(/^([A-Za-z0-9_-]+):\s*$/);
231
+ if (m) {
232
+ currentTeam = m[1];
233
+ inItem = false;
234
+ reportedTeam = null;
235
+ }
236
+ return;
237
+ }
238
+ if (!currentTeam) return;
239
+
240
+ if (/^-\s/.test(content)) {
241
+ inItem = true;
242
+ return;
243
+ }
244
+ if (!inItem && /^[A-Za-z0-9_]+:\s*\S/.test(content) && reportedTeam !== currentTeam) {
245
+ reportedTeam = currentTeam;
246
+ findings.push({
247
+ type: "yaml-shape",
248
+ path: PEERS_YAML_REL,
249
+ issue: `team "${currentTeam}": line ${i + 1} ("${content}") appears before any "- name: ..." item — the team-up launcher silently drops it`,
250
+ fix: `add the missing "- name: <peer>" line above it in ${PEERS_YAML_REL}`,
251
+ });
252
+ }
253
+ });
254
+
255
+ return findings;
256
+ }
257
+
258
+ function inferKind(targetDir) {
259
+ if (targetDir.includes("agents")) return "agents";
260
+ if (targetDir.includes("skills")) return "skills";
261
+ if (targetDir.includes("commands") || targetDir.includes("prompts")) return "commands";
262
+ if (targetDir.includes("references")) return "references";
263
+ if (targetDir.includes("hooks")) return "hooks";
264
+ return null;
265
+ }
266
+
267
+ function findReplacement({ brokenName, kind, sourceRoot }) {
268
+ // Strip .md if present so we can compare bare names.
269
+ const bare = brokenName.replace(/\.md$/, "");
270
+
271
+ // Skills resolve against both roots; the fleet-native tree shadows the
272
+ // vendored upstream import (see docs/UPSTREAM-SKILLS.md).
273
+ const skillRoots = ["skills", join("vendor", "agent-skills-upstream", "skills")];
274
+
275
+ // First check the known-renames map.
276
+ const renamed = PERSONA_RENAMES[bare];
277
+ if (renamed) {
278
+ if (kind === "skills") {
279
+ for (const root of skillRoots) {
280
+ const candidate = join(root, renamed, "SKILL.md");
281
+ if (existsSync(join(sourceRoot, candidate))) return candidate;
282
+ }
283
+ } else {
284
+ const candidate = join("agents", `${renamed}.md`);
285
+ if (existsSync(join(sourceRoot, candidate))) return candidate;
286
+ }
287
+ }
288
+
289
+ // Fall back: same name in the canonical source tree.
290
+ if (kind === "agents") {
291
+ const candidate = join("agents", `${bare}.md`);
292
+ if (existsSync(join(sourceRoot, candidate))) return candidate;
293
+ }
294
+ if (kind === "skills") {
295
+ for (const root of skillRoots) {
296
+ const candidate = join(root, bare, "SKILL.md");
297
+ if (existsSync(join(sourceRoot, candidate))) return candidate;
298
+ }
299
+ }
300
+
301
+ return null;
302
+ }