@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,180 @@
1
+ // Persona transformer — generates per-agent subagent definitions from the
2
+ // canonical pi-flavored personas in `agents/*.md`.
3
+ //
4
+ // The canonical frontmatter carries agent-hub-only keys (`models`, `thinking`,
5
+ // `delegate_depth`, `subagents`, `kind`, `skills`). Other coding agents get a
6
+ // *generated* artifact: same name/description/body, with `tools`/`model`
7
+ // translated to the target's vocabulary and the pi-only keys dropped.
8
+ //
9
+ // Targets:
10
+ // claude-code → .claude/agents/<name>.md (tools renamed, model mapped)
11
+ // opencode → .opencode/agent/<name>.md (mode: subagent + tool denials)
12
+ // pi → agents/<name>.md (byte-identical passthrough)
13
+ //
14
+ // Used by the `agent-fleet transform-persona` CLI subcommand, which the
15
+ // guided-workspace-setup skill calls during apply. Deterministic on purpose:
16
+ // the mapping lives here, in one place, under test — never in skill prose.
17
+
18
+ import { readdirSync, readFileSync, existsSync } from "node:fs";
19
+ import { join } from "node:path";
20
+
21
+ export const TRANSFORM_AGENTS = ["claude-code", "opencode", "pi"];
22
+
23
+ // Personas coupled to the pi runtime: `bowser` depends on the pi runtime
24
+ // skill `bowser` (which drives the external `playwright-cli` tool);
25
+ // `web-debugger` depends on the always-on `chrome-devtools-mcp` extension's
26
+ // `chrome_devtools__*` tools (loaded into its coms-peer process); the
27
+ // `orchestrator` is the flavor-only agent-hub
28
+ // dispatcher persona — agent-hub builds the orchestration prompt itself,
29
+ // so standalone it is an empty shell.
30
+ export const PI_ONLY_PERSONAS = ["bowser", "web-debugger", "orchestrator"];
31
+
32
+ // pi tool name → Claude Code tool name. `find`/`ls` both collapse into Glob.
33
+ const CLAUDE_TOOL_MAP = {
34
+ read: "Read",
35
+ write: "Write",
36
+ edit: "Edit",
37
+ bash: "Bash",
38
+ grep: "Grep",
39
+ find: "Glob",
40
+ ls: "Glob",
41
+ };
42
+
43
+ // OpenCode write-capable tools we deny when the persona does not grant the
44
+ // matching pi tool. `patch` has no pi equivalent, so it follows `write`.
45
+ const OPENCODE_DENIABLE = ["write", "edit", "bash", "patch"];
46
+
47
+ export function targetRelPath(agent, name) {
48
+ switch (agent) {
49
+ case "claude-code": return join(".claude", "agents", `${name}.md`);
50
+ case "opencode": return join(".opencode", "agent", `${name}.md`);
51
+ case "pi": return join("agents", `${name}.md`);
52
+ default: throw new Error(`unknown agent "${agent}" (allowed: ${TRANSFORM_AGENTS.join(", ")})`);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * List the personas available for a target agent (availability matrix).
58
+ *
59
+ * @param {string} sourceRoot agent-fleet source root (absolute path)
60
+ * @param {object} opts
61
+ * @param {string} opts.agent one of TRANSFORM_AGENTS
62
+ * @returns {Array<{name: string, sourcePath: string, targetRelPath: string}>}
63
+ */
64
+ export function listPersonas(sourceRoot, { agent }) {
65
+ if (!TRANSFORM_AGENTS.includes(agent)) {
66
+ throw new Error(`unknown agent "${agent}" (allowed: ${TRANSFORM_AGENTS.join(", ")})`);
67
+ }
68
+ const dir = join(sourceRoot, "agents");
69
+ if (!existsSync(dir)) return [];
70
+ return readdirSync(dir)
71
+ .filter((f) => f.endsWith(".md"))
72
+ .map((f) => f.replace(/\.md$/, ""))
73
+ .filter((name) => agent === "pi" || !PI_ONLY_PERSONAS.includes(name))
74
+ .sort()
75
+ .map((name) => ({
76
+ name,
77
+ sourcePath: join(dir, `${name}.md`),
78
+ targetRelPath: targetRelPath(agent, name),
79
+ }));
80
+ }
81
+
82
+ /**
83
+ * Transform one canonical persona for a target agent.
84
+ *
85
+ * @param {string} sourceText full text of the canonical agents/<name>.md
86
+ * @param {object} opts
87
+ * @param {string} opts.agent one of TRANSFORM_AGENTS
88
+ * @returns {{name: string, content: string, targetRelPath: string}}
89
+ */
90
+ export function transformPersona(sourceText, { agent }) {
91
+ if (!TRANSFORM_AGENTS.includes(agent)) {
92
+ throw new Error(`unknown agent "${agent}" (allowed: ${TRANSFORM_AGENTS.join(", ")})`);
93
+ }
94
+
95
+ const { fields, body } = splitPersona(sourceText);
96
+ const name = fields.name;
97
+ if (!name) throw new Error("persona has no `name:` in its frontmatter");
98
+
99
+ if (agent !== "pi" && PI_ONLY_PERSONAS.includes(name)) {
100
+ throw new Error(
101
+ `persona "${name}" is pi-only (depends on the pi runtime / agent-hub) — not installable for ${agent}`,
102
+ );
103
+ }
104
+
105
+ if (agent === "pi") {
106
+ // Canonical format IS the pi format.
107
+ return { name, content: sourceText, targetRelPath: targetRelPath("pi", name) };
108
+ }
109
+
110
+ const lines = [];
111
+ if (agent === "claude-code") {
112
+ lines.push(`name: ${name}`);
113
+ lines.push(`description: ${fields.description ?? ""}`);
114
+ const tools = mapClaudeTools(fields.tools);
115
+ if (tools) lines.push(`tools: ${tools}`);
116
+ const model = mapClaudeModel(fields.model);
117
+ if (model) lines.push(`model: ${model}`);
118
+ // Keep bare color names; drop hex values Claude Code does not accept.
119
+ if (fields.color && /^[a-z]+$/.test(fields.color)) lines.push(`color: ${fields.color}`);
120
+ } else {
121
+ // opencode — invoked as a subagent; model inherited from the session
122
+ // (pi provider ids do not map 1:1 onto OpenCode provider ids).
123
+ lines.push(`description: ${fields.description ?? ""}`);
124
+ lines.push("mode: subagent");
125
+ const denials = opencodeDenials(fields.tools);
126
+ if (denials.length > 0) {
127
+ lines.push("tools:");
128
+ for (const t of denials) lines.push(` ${t}: false`);
129
+ }
130
+ }
131
+
132
+ const content = `---\n${lines.join("\n")}\n---\n${body}`;
133
+ return { name, content, targetRelPath: targetRelPath(agent, name) };
134
+ }
135
+
136
+ // ── mapping helpers ─────────────────────────────────────────────────────────
137
+
138
+ function mapClaudeTools(toolsValue) {
139
+ if (!toolsValue) return null; // no tools key → inherit all
140
+ const out = [];
141
+ for (const raw of toolsValue.split(",")) {
142
+ const mapped = CLAUDE_TOOL_MAP[raw.trim()];
143
+ if (mapped && !out.includes(mapped)) out.push(mapped);
144
+ }
145
+ return out.length > 0 ? out.join(", ") : null;
146
+ }
147
+
148
+ function mapClaudeModel(modelValue) {
149
+ if (!modelValue) return null;
150
+ if (modelValue.includes("claude-opus")) return "opus";
151
+ if (modelValue.includes("claude-sonnet")) return "sonnet";
152
+ if (modelValue.includes("claude-haiku")) return "haiku";
153
+ return null; // non-Anthropic pi route → inherit the session model
154
+ }
155
+
156
+ function opencodeDenials(toolsValue) {
157
+ if (!toolsValue) return []; // no tools key → inherit (no denials)
158
+ const granted = new Set(toolsValue.split(",").map((t) => t.trim()));
159
+ if (granted.has("write")) granted.add("patch"); // patch follows write
160
+ return OPENCODE_DENIABLE.filter((t) => !granted.has(t));
161
+ }
162
+
163
+ // ── parsing ────────────────────────────────────────────────────────────────
164
+ //
165
+ // Deliberately minimal: the canonical personas use single-line scalar values
166
+ // for every key we keep (name, description, tools, model, color). Nested
167
+ // blocks (models, subagents, skills) belong to keys we drop wholesale, so we
168
+ // only read unindented `key: value` lines and ignore everything else.
169
+
170
+ function splitPersona(text) {
171
+ const m = text.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);
172
+ if (!m) throw new Error("persona has no YAML frontmatter (--- … ---)");
173
+ const fields = {};
174
+ for (const line of m[1].split(/\r?\n/)) {
175
+ if (/^[ \t]/.test(line)) continue; // nested content of a dropped key
176
+ const kv = line.match(/^([A-Za-z_][\w-]*):\s*(.*)$/);
177
+ if (kv) fields[kv[1]] = kv[2].trim();
178
+ }
179
+ return { fields, body: text.slice(m[0].length) };
180
+ }
@@ -0,0 +1,195 @@
1
+ // update-notifier — zero-dependency check for newer versions on the npm
2
+ // registry, shared by the CLI, the Claude Code session hook, and the pi
3
+ // extension.
4
+ //
5
+ // Behaviour:
6
+ // - Cache lives at $XDG_CACHE_HOME/agent-fleet/latest-version.json
7
+ // (falls back to ~/.cache/agent-fleet/) with a 24h TTL.
8
+ // - The CLI invokes checkAndNotify() at the top of every command. If the
9
+ // cache is fresh and shows an upgrade, we print a banner immediately.
10
+ // If the cache is stale or absent, we start a background fetch (detached,
11
+ // non-blocking) and use whatever we have right now.
12
+ // - Network failures, JSON parse errors, and missing cache files are all
13
+ // swallowed silently — update checks must NEVER block the CLI or break
14
+ // a hook.
15
+ // - Opt-out: AGENT_SKILLS_NO_UPDATE_CHECK=1 in the environment disables
16
+ // everything in this module.
17
+
18
+ import { mkdirSync, readFileSync, writeFileSync, existsSync } from "node:fs";
19
+ import { homedir } from "node:os";
20
+ import { join } from "node:path";
21
+ import { request } from "node:https";
22
+ import { spawn } from "node:child_process";
23
+ import { fileURLToPath } from "node:url";
24
+
25
+ const PACKAGE_NAME = "@chankov/agent-fleet";
26
+ const REGISTRY = "https://registry.npmjs.org";
27
+ const TTL_MS = 24 * 60 * 60 * 1000;
28
+
29
+ const CACHE_DIR = join(
30
+ process.env.XDG_CACHE_HOME || join(homedir(), ".cache"),
31
+ "agent-fleet",
32
+ );
33
+ const CACHE_FILE = join(CACHE_DIR, "latest-version.json");
34
+
35
+ // ── Public surface ───────────────────────────────────────────────────────
36
+
37
+ /**
38
+ * Run the standard check + banner flow used by the CLI.
39
+ *
40
+ * @param {string} currentVersion The version of the running CLI
41
+ * @param {object} [opts]
42
+ * @param {boolean} [opts.silent] If true, return the banner string instead of printing
43
+ * @returns {string|null} The banner that would be (or was) printed
44
+ */
45
+ export function checkAndNotify(currentVersion, opts = {}) {
46
+ if (isDisabled()) return null;
47
+
48
+ const cached = readCache();
49
+ const fresh = cached && Date.now() - cached.checkedAt < TTL_MS;
50
+
51
+ if (!fresh) startBackgroundFetch();
52
+
53
+ const latest = cached?.latest;
54
+ if (!latest || !gt(latest, currentVersion)) return null;
55
+
56
+ const banner = formatBanner(currentVersion, latest);
57
+ if (!opts.silent) process.stderr.write(banner + "\n");
58
+ return banner;
59
+ }
60
+
61
+ /**
62
+ * Synchronously fetch the latest version, write the cache, and return it.
63
+ * Used by the standalone check-update entry point (hooks block on this
64
+ * intentionally — they need the answer before the session continues).
65
+ *
66
+ * @param {number} [timeoutMs] Default 2000ms — hooks must not stall the UI
67
+ * @returns {Promise<string|null>}
68
+ */
69
+ export async function fetchLatestSync(timeoutMs = 2000) {
70
+ if (isDisabled()) return null;
71
+ try {
72
+ const latest = await fetchLatest(timeoutMs);
73
+ writeCache({ latest, checkedAt: Date.now() });
74
+ return latest;
75
+ } catch {
76
+ return null;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Read the cached latest version without touching the network. Hook scripts
82
+ * use this on the fast path — if the cache is fresh, no fetch is needed.
83
+ *
84
+ * @returns {{latest:string, checkedAt:number, stale:boolean}|null}
85
+ */
86
+ export function readCacheStatus() {
87
+ const c = readCache();
88
+ if (!c) return null;
89
+ return { ...c, stale: Date.now() - c.checkedAt >= TTL_MS };
90
+ }
91
+
92
+ export function formatBanner(current, latest) {
93
+ const lines = [
94
+ `agent-fleet update available: ${current} → ${latest}`,
95
+ ` Run: npx ${PACKAGE_NAME}@latest update`,
96
+ ` Releases: https://github.com/chankov/agent-fleet/releases`,
97
+ ];
98
+ const w = Math.max(...lines.map((l) => l.length)) + 2;
99
+ const bar = "─".repeat(w);
100
+ return [
101
+ `┌${bar}┐`,
102
+ ...lines.map((l) => `│ ${l.padEnd(w - 1)}│`),
103
+ `└${bar}┘`,
104
+ ].join("\n");
105
+ }
106
+
107
+ // ── Internals ────────────────────────────────────────────────────────────
108
+
109
+ function isDisabled() {
110
+ return process.env.AGENT_SKILLS_NO_UPDATE_CHECK === "1"
111
+ || process.env.CI === "true" // never spam CI logs
112
+ || process.env.NO_UPDATE_NOTIFIER === "1"; // honour the common convention
113
+ }
114
+
115
+ function readCache() {
116
+ try {
117
+ if (!existsSync(CACHE_FILE)) return null;
118
+ return JSON.parse(readFileSync(CACHE_FILE, "utf8"));
119
+ } catch {
120
+ return null;
121
+ }
122
+ }
123
+
124
+ function writeCache(payload) {
125
+ try {
126
+ mkdirSync(CACHE_DIR, { recursive: true });
127
+ writeFileSync(CACHE_FILE, JSON.stringify(payload, null, 2), "utf8");
128
+ } catch {
129
+ // Read-only home dir, full disk, etc. — caching is best-effort.
130
+ }
131
+ }
132
+
133
+ function fetchLatest(timeoutMs) {
134
+ return new Promise((resolve, reject) => {
135
+ const url = `${REGISTRY}/${encodeURIComponent(PACKAGE_NAME).replace("%40", "@")}/latest`;
136
+ const req = request(url, { method: "GET", headers: { accept: "application/json" } }, (res) => {
137
+ if (res.statusCode !== 200) {
138
+ reject(new Error(`registry returned ${res.statusCode}`));
139
+ res.resume();
140
+ return;
141
+ }
142
+ let body = "";
143
+ res.setEncoding("utf8");
144
+ res.on("data", (chunk) => { body += chunk; });
145
+ res.on("end", () => {
146
+ try {
147
+ const parsed = JSON.parse(body);
148
+ if (typeof parsed.version !== "string") throw new Error("missing version field");
149
+ resolve(parsed.version);
150
+ } catch (err) { reject(err); }
151
+ });
152
+ });
153
+ req.on("error", reject);
154
+ req.setTimeout(timeoutMs, () => {
155
+ req.destroy(new Error("timeout"));
156
+ });
157
+ req.end();
158
+ });
159
+ }
160
+
161
+ function startBackgroundFetch() {
162
+ // Detached worker: never blocks the CLI, never inherits stdio.
163
+ // We re-enter this module via dynamic import in a fresh node process and
164
+ // run fetchLatestSync there — keeps the parent CLI exit unaffected.
165
+ try {
166
+ const modPath = fileURLToPath(import.meta.url);
167
+ const child = spawn(process.execPath, [
168
+ "-e",
169
+ `import(${JSON.stringify(modPath)}).then(m => m.fetchLatestSync(8000)).catch(() => {})`,
170
+ ], { detached: true, stdio: "ignore" });
171
+ child.unref();
172
+ } catch {
173
+ // If spawn fails (e.g. restricted env), skip — the next CLI run will retry.
174
+ }
175
+ }
176
+
177
+ // ── Tiny semver-gt comparator ────────────────────────────────────────────
178
+ // Enough for X.Y.Z comparisons; anything pre-release falls back to string
179
+ // compare on the suffix, which is good enough for "is the user behind?"
180
+
181
+ export function gt(a, b) {
182
+ const [aMain, aPre = ""] = a.split("-", 2);
183
+ const [bMain, bPre = ""] = b.split("-", 2);
184
+ const aParts = aMain.split(".").map(Number);
185
+ const bParts = bMain.split(".").map(Number);
186
+ for (let i = 0; i < 3; i++) {
187
+ const ai = aParts[i] ?? 0;
188
+ const bi = bParts[i] ?? 0;
189
+ if (ai !== bi) return ai > bi;
190
+ }
191
+ // Equal main versions: a release (no prerelease) outranks a prerelease.
192
+ if (!aPre && bPre) return true;
193
+ if (aPre && !bPre) return false;
194
+ return aPre > bPre;
195
+ }
@@ -0,0 +1,229 @@
1
+ // Advisory validation of `.ai/agent-fleet-overrides.md`.
2
+ //
3
+ // The overrides contract is "absent section/key → reader falls back to its
4
+ // built-in default", which makes every typo silent: a misspelled section
5
+ // heading or key is simply dead config nobody ever reads. The doctor surfaces
6
+ // those as WARN-ONLY findings (type "overrides") — reported next to the
7
+ // symlink/YAML findings but never auto-fixed; the fix is always a hand edit.
8
+ //
9
+ // The schema below mirrors docs/agent-fleet-setup.md. The skill sections are
10
+ // read leniently by LLM readers, so an unknown key there is a nudge, not an
11
+ // error; the agent-hub section is parsed mechanically by the pi harness, so a
12
+ // typo'd key really does nothing.
13
+
14
+ import { existsSync, readFileSync } from "node:fs";
15
+ import { join } from "node:path";
16
+
17
+ export const OVERRIDES_REL_PATH = ".ai/agent-fleet-overrides.md";
18
+
19
+ const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"];
20
+ const SLUG = "[a-z0-9]+(?:-[a-z0-9]+)*";
21
+
22
+ // One entry per known `## section`. `keys` maps exact key names to an optional
23
+ // value check; `patterns` covers the agent-hub `<key>.<persona>` families.
24
+ // A value check returns a problem string, or null when the value is fine.
25
+ const KNOWN_SECTIONS = {
26
+ "spec-driven-development": {
27
+ keys: { "spec-dir": null, "naming": null },
28
+ },
29
+ "planning-and-task-breakdown": {
30
+ keys: {
31
+ "plan-dir": null,
32
+ "naming": null,
33
+ "todo": oneOf(["embedded", "separate"]),
34
+ },
35
+ },
36
+ "browser-testing-with-devtools": {
37
+ keys: {
38
+ "dev-server": null, "ready-check": null, "base-url": null,
39
+ "auth-flow": null, "roles": null, "notes": null,
40
+ },
41
+ },
42
+ "git-workflow-and-versioning": {
43
+ keys: { "branching": oneOf(["never", "allow"]) },
44
+ },
45
+ "agent-hub": {
46
+ keys: {
47
+ "language": null,
48
+ "persona-gate": oneOf(["on", "off", "true", "false", "yes", "no", "1", "0"]),
49
+ "rules": checkFolders("rules"),
50
+ "docs": checkPaths("docs entry point"),
51
+ },
52
+ patterns: [
53
+ { re: new RegExp(`^model\\.${SLUG}$`), example: "model.<persona>" },
54
+ { re: new RegExp(`^models\\.${SLUG}$`), example: "models.<persona>" },
55
+ {
56
+ re: new RegExp(`^thinking\\.${SLUG}$`), example: "thinking.<persona>",
57
+ check: oneOf(THINKING_LEVELS),
58
+ },
59
+ { re: new RegExp(`^subagents\\.${SLUG}\\.${SLUG}$`), example: "subagents.<persona>.<role>" },
60
+ {
61
+ re: new RegExp(`^delegate-depth\\.${SLUG}$`), example: "delegate-depth.<persona>",
62
+ check: (value) =>
63
+ /^\d+$/.test(value) ? null : `"${value}" is not a non-negative integer`,
64
+ },
65
+ ],
66
+ },
67
+ "env": {
68
+ keys: { "required": checkEnvVars() },
69
+ },
70
+ };
71
+
72
+ // `## agent-team` is the legacy alias the pi harness still accepts.
73
+ const SECTION_ALIASES = { "agent-team": "agent-hub" };
74
+
75
+ function oneOf(values) {
76
+ return (value) => {
77
+ const v = value.trim().toLowerCase();
78
+ return values.includes(v) ? null : `"${value}" is not one of: ${values.join("|")}`;
79
+ };
80
+ }
81
+
82
+ // The rules key holds comma-separated repo-relative folders; a listed folder
83
+ // that doesn't exist is the folder-level equivalent of a typo'd key.
84
+ function checkFolders(label) {
85
+ return (value, ctx) => {
86
+ const missing = value.split(",").map((s) => s.trim()).filter(Boolean)
87
+ .filter((dir) => !existsSync(join(ctx.workspace, dir)));
88
+ return missing.length
89
+ ? `${label} folder${missing.length > 1 ? "s" : ""} not found in the workspace: ${missing.join(", ")}`
90
+ : null;
91
+ };
92
+ }
93
+
94
+ // The docs key holds comma-separated repo-relative documentation entry
95
+ // points — files or folders both work; existence is the only mechanical check.
96
+ function checkPaths(label) {
97
+ return (value, ctx) => {
98
+ const missing = value.split(",").map((s) => s.trim()).filter(Boolean)
99
+ .filter((p) => !existsSync(join(ctx.workspace, p)));
100
+ return missing.length
101
+ ? `${label}${missing.length > 1 ? "s" : ""} not found in the workspace: ${missing.join(", ")}`
102
+ : null;
103
+ };
104
+ }
105
+
106
+ // `## env` / `required:` lists env-var NAMES the project's readers expect
107
+ // (test accounts, STT keys, ...). Values never live in this file — the check
108
+ // is only that each name is exported in the environment or declared in the
109
+ // workspace root `.env`.
110
+ function checkEnvVars() {
111
+ return (value, ctx) => {
112
+ const problems = [];
113
+ for (const name of value.split(",").map((s) => s.trim()).filter(Boolean)) {
114
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
115
+ problems.push(`"${name}" is not a valid env var name`);
116
+ } else if (ctx.env[name] === undefined && !ctx.dotEnvNames.has(name)) {
117
+ problems.push(`${name} is not set and not declared in .env`);
118
+ }
119
+ }
120
+ return problems.length ? problems.join("; ") : null;
121
+ };
122
+ }
123
+
124
+ function readDotEnvNames(workspace) {
125
+ const names = new Set();
126
+ const path = join(workspace, ".env");
127
+ if (!existsSync(path)) return names;
128
+ let text;
129
+ try { text = readFileSync(path, "utf8"); } catch { return names; }
130
+ for (const line of text.split("\n")) {
131
+ const m = line.match(/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/);
132
+ if (m) names.add(m[1]);
133
+ }
134
+ return names;
135
+ }
136
+
137
+ /**
138
+ * Validate a workspace's `.ai/agent-fleet-overrides.md`.
139
+ *
140
+ * @param {object} opts
141
+ * @param {string} opts.workspace Workspace root (absolute path)
142
+ * @param {object} [opts.env] Environment map for the `## env` check
143
+ * @returns {Array} Advisory findings shaped like the doctor's
144
+ * ({type: "overrides", path, issue, fix}); [] when the file
145
+ * is absent or clean.
146
+ */
147
+ export function validateOverrides({ workspace, env = process.env }) {
148
+ const path = join(workspace, OVERRIDES_REL_PATH);
149
+ if (!existsSync(path)) return [];
150
+ let text;
151
+ try { text = readFileSync(path, "utf8"); } catch { return []; }
152
+
153
+ const ctx = { workspace, env, dotEnvNames: readDotEnvNames(workspace) };
154
+ const findings = [];
155
+ const finding = (issue, fix) =>
156
+ findings.push({ type: "overrides", path: OVERRIDES_REL_PATH, issue, fix });
157
+
158
+ let section = null; // canonical section name, or null outside/unknown
159
+ let sectionHeading = null; // heading as written, for messages
160
+
161
+ for (const rawLine of text.split("\n")) {
162
+ const line = rawLine.replace(/\r$/, "");
163
+
164
+ const heading = line.match(/^##\s+(.+?)\s*$/);
165
+ if (heading) {
166
+ const name = heading[1].trim().toLowerCase();
167
+ const canonical = SECTION_ALIASES[name] ?? name;
168
+ if (KNOWN_SECTIONS[canonical]) {
169
+ section = canonical;
170
+ sectionHeading = heading[1].trim();
171
+ if (SECTION_ALIASES[name]) {
172
+ finding(
173
+ `legacy section name "## ${name}"`,
174
+ `rename to "## ${canonical}" (the legacy name still works)`,
175
+ );
176
+ }
177
+ } else {
178
+ section = null;
179
+ sectionHeading = null;
180
+ finding(
181
+ `unknown section "## ${heading[1].trim()}" — no reader loads it`,
182
+ `known sections: ${Object.keys(KNOWN_SECTIONS).join(", ")}`,
183
+ );
184
+ }
185
+ continue;
186
+ }
187
+
188
+ // Only column-0 `key: value` lines are keys; indented lines are the
189
+ // content of `key: |` blocks (auth-flow, roles, notes) and stay unparsed.
190
+ if (section === null) continue;
191
+ if (/^\s/.test(line) || line.startsWith("#")) continue;
192
+ const kv = line.match(/^([A-Za-z][\w.-]*)\s*:\s*(.*)$/);
193
+ if (!kv) continue;
194
+
195
+ const key = kv[1].toLowerCase();
196
+ const value = kv[2].trim();
197
+ const schema = KNOWN_SECTIONS[section];
198
+
199
+ if (key in schema.keys) {
200
+ const check = schema.keys[key];
201
+ // Empty / `|` values open a multi-line block — nothing to value-check.
202
+ if (check && value && value !== "|") {
203
+ const problem = check(value, ctx);
204
+ if (problem) finding(`${key} in ## ${sectionHeading}: ${problem}`, "fix the value");
205
+ }
206
+ continue;
207
+ }
208
+
209
+ const pattern = (schema.patterns ?? []).find((p) => p.re.test(key));
210
+ if (pattern) {
211
+ if (pattern.check && value && value !== "|") {
212
+ const problem = pattern.check(value, ctx);
213
+ if (problem) finding(`${key} in ## ${sectionHeading}: ${problem}`, "fix the value");
214
+ }
215
+ continue;
216
+ }
217
+
218
+ const known = [
219
+ ...Object.keys(schema.keys),
220
+ ...(schema.patterns ?? []).map((p) => p.example),
221
+ ];
222
+ finding(
223
+ `unknown key "${key}" in ## ${sectionHeading} — the reader will silently ignore it`,
224
+ `known keys: ${known.join(", ")}`,
225
+ );
226
+ }
227
+
228
+ return findings;
229
+ }