agentplane 0.3.8 → 0.3.10

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 (268) hide show
  1. package/assets/AGENTS.md +4 -2
  2. package/assets/agents/CODER.json +1 -1
  3. package/assets/policy/dod.core.md +1 -1
  4. package/assets/policy/governance.md +3 -0
  5. package/assets/policy/incidents.md +22 -11
  6. package/assets/policy/workflow.branch_pr.md +2 -0
  7. package/assets/policy/workflow.direct.md +3 -1
  8. package/dist/.build-manifest.json +323 -128
  9. package/dist/cli/bootstrap-guide.d.ts +1 -0
  10. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  11. package/dist/cli/bootstrap-guide.js +19 -1
  12. package/dist/cli/command-invocations.d.ts.map +1 -1
  13. package/dist/cli/command-invocations.js +2 -0
  14. package/dist/cli/command-snippets.d.ts +2 -0
  15. package/dist/cli/command-snippets.d.ts.map +1 -1
  16. package/dist/cli/command-snippets.js +2 -0
  17. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  18. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  19. package/dist/cli/run-cli/command-catalog/core.js +10 -0
  20. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  21. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  22. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  23. package/dist/cli/run-cli/commands/config.js +13 -0
  24. package/dist/cli/run-cli.js +2 -2
  25. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  26. package/dist/cli/run-cli.test-helpers.js +34 -8
  27. package/dist/commands/backend.d.ts.map +1 -1
  28. package/dist/commands/backend.js +4 -0
  29. package/dist/commands/hooks/index.d.ts.map +1 -1
  30. package/dist/commands/hooks/index.js +8 -4
  31. package/dist/commands/incidents/advise.command.d.ts +15 -0
  32. package/dist/commands/incidents/advise.command.d.ts.map +1 -0
  33. package/dist/commands/incidents/advise.command.js +139 -0
  34. package/dist/commands/incidents/collect.command.d.ts +11 -0
  35. package/dist/commands/incidents/collect.command.d.ts.map +1 -0
  36. package/dist/commands/incidents/collect.command.js +67 -0
  37. package/dist/commands/incidents/incidents.command.d.ts +5 -0
  38. package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
  39. package/dist/commands/incidents/incidents.command.js +21 -0
  40. package/dist/commands/incidents/shared.d.ts +42 -0
  41. package/dist/commands/incidents/shared.d.ts.map +1 -0
  42. package/dist/commands/incidents/shared.js +107 -0
  43. package/dist/commands/pr/check.d.ts.map +1 -1
  44. package/dist/commands/pr/check.js +73 -2
  45. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  46. package/dist/commands/pr/integrate/cmd.js +4 -0
  47. package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
  48. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  49. package/dist/commands/pr/integrate/internal/merge.js +23 -2
  50. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  51. package/dist/commands/pr/integrate/internal/prepare.js +26 -1
  52. package/dist/commands/pr/internal/note-store.d.ts +18 -0
  53. package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
  54. package/dist/commands/pr/internal/note-store.js +66 -0
  55. package/dist/commands/pr/internal/pr-paths.d.ts +3 -0
  56. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  57. package/dist/commands/pr/internal/pr-paths.js +3 -0
  58. package/dist/commands/pr/internal/review-template.d.ts +24 -4
  59. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  60. package/dist/commands/pr/internal/review-template.js +188 -33
  61. package/dist/commands/pr/internal/sync.d.ts +32 -0
  62. package/dist/commands/pr/internal/sync.d.ts.map +1 -0
  63. package/dist/commands/pr/internal/sync.js +258 -0
  64. package/dist/commands/pr/note.d.ts.map +1 -1
  65. package/dist/commands/pr/note.js +37 -4
  66. package/dist/commands/pr/open.d.ts.map +1 -1
  67. package/dist/commands/pr/open.js +7 -54
  68. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  69. package/dist/commands/pr/pr.command.js +6 -3
  70. package/dist/commands/pr/update.d.ts.map +1 -1
  71. package/dist/commands/pr/update.js +5 -79
  72. package/dist/commands/recipes/impl/apply.d.ts +1 -1
  73. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  74. package/dist/commands/recipes/impl/apply.js +1 -1
  75. package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
  76. package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
  77. package/dist/commands/recipes/impl/commands/explain.js +1 -1
  78. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  79. package/dist/commands/recipes/impl/commands/install.js +3 -2
  80. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  81. package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
  82. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  83. package/dist/commands/recipes/impl/commands/remove.js +9 -1
  84. package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
  85. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  86. package/dist/commands/recipes/impl/installed-recipes.js +2 -1
  87. package/dist/commands/recipes/impl/project-installed-recipes.d.ts +1 -1
  88. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  89. package/dist/commands/recipes/impl/project-installed-recipes.js +2 -1
  90. package/dist/commands/recipes/impl/resolver.d.ts +1 -1
  91. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  92. package/dist/commands/recipes/impl/resolver.js +1 -1
  93. package/dist/commands/recipes.d.ts +4 -4
  94. package/dist/commands/recipes.d.ts.map +1 -1
  95. package/dist/commands/recipes.js +3 -3
  96. package/dist/commands/release/apply.command.d.ts.map +1 -1
  97. package/dist/commands/release/apply.command.js +9 -0
  98. package/dist/commands/release.test-helpers.d.ts +14 -0
  99. package/dist/commands/release.test-helpers.d.ts.map +1 -1
  100. package/dist/commands/release.test-helpers.js +14 -3
  101. package/dist/commands/shared/approval-requirements.d.ts +5 -7
  102. package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
  103. package/dist/commands/shared/approval-requirements.js +3 -73
  104. package/dist/commands/shared/network-approval.d.ts +2 -0
  105. package/dist/commands/shared/network-approval.d.ts.map +1 -1
  106. package/dist/commands/shared/network-approval.js +1 -1
  107. package/dist/commands/shared/pr-meta.d.ts +9 -0
  108. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  109. package/dist/commands/shared/pr-meta.js +27 -3
  110. package/dist/commands/shared/task-backend.d.ts +2 -0
  111. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  112. package/dist/commands/shared/task-local-freshness.d.ts +13 -0
  113. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
  114. package/dist/commands/shared/task-local-freshness.js +20 -0
  115. package/dist/commands/shared/task-mutation.d.ts +2 -0
  116. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  117. package/dist/commands/shared/task-mutation.js +7 -0
  118. package/dist/commands/task/block.d.ts.map +1 -1
  119. package/dist/commands/task/block.js +1 -0
  120. package/dist/commands/task/close-shared.d.ts.map +1 -1
  121. package/dist/commands/task/close-shared.js +1 -0
  122. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  123. package/dist/commands/task/finish-shared.js +5 -2
  124. package/dist/commands/task/finish.d.ts.map +1 -1
  125. package/dist/commands/task/finish.js +24 -0
  126. package/dist/commands/task/new.d.ts.map +1 -1
  127. package/dist/commands/task/new.js +69 -29
  128. package/dist/commands/task/set-status.d.ts.map +1 -1
  129. package/dist/commands/task/set-status.js +1 -0
  130. package/dist/commands/task/shared/transition-command.d.ts +2 -0
  131. package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
  132. package/dist/commands/task/shared/transition-command.js +1 -0
  133. package/dist/commands/task/start-ready.d.ts.map +1 -1
  134. package/dist/commands/task/start-ready.js +12 -1
  135. package/dist/commands/task/start.d.ts.map +1 -1
  136. package/dist/commands/task/start.js +11 -0
  137. package/dist/commands/task/verify-record.d.ts.map +1 -1
  138. package/dist/commands/task/verify-record.js +27 -0
  139. package/dist/commands/upgrade.d.ts.map +1 -1
  140. package/dist/commands/upgrade.js +6 -1
  141. package/dist/policy/engine.d.ts +3 -1
  142. package/dist/policy/engine.d.ts.map +1 -1
  143. package/dist/policy/engine.js +5 -6
  144. package/dist/policy/taxonomy.d.ts +17 -0
  145. package/dist/policy/taxonomy.d.ts.map +1 -0
  146. package/dist/policy/taxonomy.js +302 -0
  147. package/dist/policy/types.d.ts +2 -1
  148. package/dist/policy/types.d.ts.map +1 -1
  149. package/dist/runner/artifacts.d.ts.map +1 -1
  150. package/dist/runner/artifacts.js +2 -0
  151. package/dist/runner/context/base-prompts.d.ts +25 -0
  152. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  153. package/dist/runner/context/base-prompts.js +182 -54
  154. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  155. package/dist/runner/context/recipe-context.js +5 -0
  156. package/dist/runner/types.d.ts +12 -0
  157. package/dist/runner/types.d.ts.map +1 -1
  158. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
  159. package/dist/runner/usecases/scenario-materialize-task.js +81 -11
  160. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
  161. package/dist/runner/usecases/task-run-inspect.js +9 -7
  162. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
  163. package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
  164. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  165. package/dist/runner/usecases/task-run.js +59 -12
  166. package/dist/runtime/approvals/index.d.ts +3 -0
  167. package/dist/runtime/approvals/index.d.ts.map +1 -0
  168. package/dist/runtime/approvals/index.js +1 -0
  169. package/dist/runtime/approvals/runtime.d.ts +12 -0
  170. package/dist/runtime/approvals/runtime.d.ts.map +1 -0
  171. package/dist/runtime/approvals/runtime.js +154 -0
  172. package/dist/runtime/approvals/types.d.ts +31 -0
  173. package/dist/runtime/approvals/types.d.ts.map +1 -0
  174. package/dist/runtime/approvals/types.js +1 -0
  175. package/dist/runtime/behavior/index.d.ts +3 -0
  176. package/dist/runtime/behavior/index.d.ts.map +1 -0
  177. package/dist/runtime/behavior/index.js +1 -0
  178. package/dist/runtime/behavior/resolve.d.ts +7 -0
  179. package/dist/runtime/behavior/resolve.d.ts.map +1 -0
  180. package/dist/runtime/behavior/resolve.js +66 -0
  181. package/dist/runtime/behavior/types.d.ts +25 -0
  182. package/dist/runtime/behavior/types.d.ts.map +1 -0
  183. package/dist/runtime/behavior/types.js +1 -0
  184. package/dist/runtime/capabilities/backend.d.ts +7 -0
  185. package/dist/runtime/capabilities/backend.d.ts.map +1 -0
  186. package/dist/runtime/capabilities/backend.js +104 -0
  187. package/dist/runtime/capabilities/index.d.ts +6 -0
  188. package/dist/runtime/capabilities/index.d.ts.map +1 -0
  189. package/dist/runtime/capabilities/index.js +4 -0
  190. package/dist/runtime/capabilities/recipe.d.ts +10 -0
  191. package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
  192. package/dist/runtime/capabilities/recipe.js +123 -0
  193. package/dist/runtime/capabilities/registry.d.ts +6 -0
  194. package/dist/runtime/capabilities/registry.d.ts.map +1 -0
  195. package/dist/runtime/capabilities/registry.js +69 -0
  196. package/dist/runtime/capabilities/runner.d.ts +8 -0
  197. package/dist/runtime/capabilities/runner.d.ts.map +1 -0
  198. package/dist/runtime/capabilities/runner.js +73 -0
  199. package/dist/runtime/capabilities/types.d.ts +28 -0
  200. package/dist/runtime/capabilities/types.d.ts.map +1 -0
  201. package/dist/runtime/capabilities/types.js +1 -0
  202. package/dist/runtime/execution-profile/index.d.ts +3 -0
  203. package/dist/runtime/execution-profile/index.d.ts.map +1 -0
  204. package/dist/runtime/execution-profile/index.js +1 -0
  205. package/dist/runtime/execution-profile/resolve.d.ts +9 -0
  206. package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
  207. package/dist/runtime/execution-profile/resolve.js +80 -0
  208. package/dist/runtime/execution-profile/types.d.ts +27 -0
  209. package/dist/runtime/execution-profile/types.d.ts.map +1 -0
  210. package/dist/runtime/execution-profile/types.js +1 -0
  211. package/dist/runtime/explain/index.d.ts +3 -0
  212. package/dist/runtime/explain/index.d.ts.map +1 -0
  213. package/dist/runtime/explain/index.js +1 -0
  214. package/dist/runtime/explain/resolve.d.ts +14 -0
  215. package/dist/runtime/explain/resolve.d.ts.map +1 -0
  216. package/dist/runtime/explain/resolve.js +50 -0
  217. package/dist/runtime/explain/types.d.ts +28 -0
  218. package/dist/runtime/explain/types.d.ts.map +1 -0
  219. package/dist/runtime/explain/types.js +1 -0
  220. package/dist/runtime/harness/index.d.ts +4 -0
  221. package/dist/runtime/harness/index.d.ts.map +1 -0
  222. package/dist/runtime/harness/index.js +2 -0
  223. package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
  224. package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
  225. package/dist/runtime/harness/resolve-from-command-context.js +11 -0
  226. package/dist/runtime/harness/resolve.d.ts +13 -0
  227. package/dist/runtime/harness/resolve.d.ts.map +1 -0
  228. package/dist/runtime/harness/resolve.js +146 -0
  229. package/dist/runtime/harness/types.d.ts +65 -0
  230. package/dist/runtime/harness/types.d.ts.map +1 -0
  231. package/dist/runtime/harness/types.js +1 -0
  232. package/dist/runtime/incidents/index.d.ts +3 -0
  233. package/dist/runtime/incidents/index.d.ts.map +1 -0
  234. package/dist/runtime/incidents/index.js +1 -0
  235. package/dist/runtime/incidents/resolve.d.ts +26 -0
  236. package/dist/runtime/incidents/resolve.d.ts.map +1 -0
  237. package/dist/runtime/incidents/resolve.js +437 -0
  238. package/dist/runtime/incidents/types.d.ts +72 -0
  239. package/dist/runtime/incidents/types.d.ts.map +1 -0
  240. package/dist/runtime/incidents/types.js +1 -0
  241. package/dist/runtime/protocol/index.d.ts +3 -0
  242. package/dist/runtime/protocol/index.d.ts.map +1 -0
  243. package/dist/runtime/protocol/index.js +2 -0
  244. package/dist/runtime/protocol/resolve.d.ts +16 -0
  245. package/dist/runtime/protocol/resolve.d.ts.map +1 -0
  246. package/dist/runtime/protocol/resolve.js +36 -0
  247. package/dist/runtime/protocol/types.d.ts +36 -0
  248. package/dist/runtime/protocol/types.d.ts.map +1 -0
  249. package/dist/runtime/protocol/types.js +1 -0
  250. package/dist/runtime/task-intake/index.d.ts +3 -0
  251. package/dist/runtime/task-intake/index.d.ts.map +1 -0
  252. package/dist/runtime/task-intake/index.js +1 -0
  253. package/dist/runtime/task-intake/resolve.d.ts +48 -0
  254. package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
  255. package/dist/runtime/task-intake/resolve.js +316 -0
  256. package/dist/runtime/task-intake/types.d.ts +117 -0
  257. package/dist/runtime/task-intake/types.d.ts.map +1 -0
  258. package/dist/runtime/task-intake/types.js +1 -0
  259. package/dist/shared/protected-paths.d.ts +4 -0
  260. package/dist/shared/protected-paths.d.ts.map +1 -1
  261. package/dist/shared/protected-paths.js +4 -4
  262. package/dist/usecases/context/resolve-context.d.ts +55 -6
  263. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  264. package/dist/usecases/context/resolve-context.js +96 -6
  265. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  266. package/dist/usecases/task/task-list-usecase.js +8 -2
  267. package/dist/usecases/task/task-new-usecase.js +4 -4
  268. package/package.json +2 -3
@@ -9,6 +9,7 @@ export type BootstrapSection = {
9
9
  export declare const BOOTSTRAP_PREFLIGHT_COMMANDS: readonly [string, string, string, "git status --short --untracked-files=no", "git rev-parse --abbrev-ref HEAD"];
10
10
  export declare const BOOTSTRAP_TASK_PREP_COMMANDS: string[];
11
11
  export declare const BOOTSTRAP_DIRECT_HAPPY_PATH_COMMANDS: readonly [...string[], string, string, string, "agentplane finish <task-id> --author <ROLE> --body \"Verified: ...\" --result \"...\" --commit <git-rev>"];
12
+ export declare const BOOTSTRAP_VERIFICATION_COMMANDS: readonly [string, string, string, `${string} --check`, "agentplane doctor", "node .agentplane/policy/check-routing.mjs"];
12
13
  export declare const BOOTSTRAP_RECOVERY_COMMANDS: readonly ["agentplane doctor", "agentplane upgrade --dry-run", "agentplane upgrade"];
13
14
  export declare const BOOTSTRAP_SECTIONS: readonly BootstrapSection[];
14
15
  export declare function renderBootstrapReferenceLine(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-guide.d.ts","sourceRoot":"","sources":["../../src/cli/bootstrap-guide.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,4CAA4C,CAAC;AAClF,eAAO,MAAM,+BAA+B,0BAA0B,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,4BAA4B,iHAM/B,CAAC;AAEX,eAAO,MAAM,4BAA4B,UAIxC,CAAC;AAEF,eAAO,MAAM,oCAAoC,4JAMvC,CAAC;AAEX,eAAO,MAAM,2BAA2B,sFAI9B,CAAC;AAEX,eAAO,MAAM,kBAAkB,EAAE,SAAS,gBAAgB,EAoChD,CAAC;AAEX,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAiB3F;AAMD,wBAAgB,kBAAkB,IAAI,MAAM,CA2B3C"}
1
+ {"version":3,"file":"bootstrap-guide.d.ts","sourceRoot":"","sources":["../../src/cli/bootstrap-guide.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,4CAA4C,CAAC;AAClF,eAAO,MAAM,+BAA+B,0BAA0B,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,4BAA4B,iHAM/B,CAAC;AAEX,eAAO,MAAM,4BAA4B,UAIxC,CAAC;AAEF,eAAO,MAAM,oCAAoC,4JAMvC,CAAC;AAEX,eAAO,MAAM,+BAA+B,0HAOlC,CAAC;AAEX,eAAO,MAAM,2BAA2B,sFAI9B,CAAC;AAEX,eAAO,MAAM,kBAAkB,EAAE,SAAS,gBAAgB,EA+ChD,CAAC;AAEX,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAiB3F;AAMD,wBAAgB,kBAAkB,IAAI,MAAM,CA2B3C"}
@@ -20,6 +20,14 @@ export const BOOTSTRAP_DIRECT_HAPPY_PATH_COMMANDS = [
20
20
  COMMAND_SNIPPETS.core.verifyTask,
21
21
  'agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>',
22
22
  ];
23
+ export const BOOTSTRAP_VERIFICATION_COMMANDS = [
24
+ COMMAND_SNIPPETS.core.taskVerifyShow,
25
+ COMMAND_SNIPPETS.core.verifyTask,
26
+ COMMAND_SNIPPETS.core.incidentsAdvise,
27
+ `${COMMAND_SNIPPETS.core.incidentsCollect} --check`,
28
+ "agentplane doctor",
29
+ "node .agentplane/policy/check-routing.mjs",
30
+ ];
23
31
  export const BOOTSTRAP_RECOVERY_COMMANDS = [
24
32
  "agentplane doctor",
25
33
  "agentplane upgrade --dry-run",
@@ -49,7 +57,17 @@ export const BOOTSTRAP_SECTIONS = [
49
57
  ],
50
58
  },
51
59
  {
52
- heading: "3. Fallbacks and recovery",
60
+ heading: "3. Verification and incident reuse",
61
+ summary: "Reuse historical incident advice only through targeted lookup, and validate promotable external incident candidates before `finish`.",
62
+ commands: BOOTSTRAP_VERIFICATION_COMMANDS,
63
+ notes: [
64
+ "Use `agentplane incidents advise <task-id>` after `start-ready` when analogous scope or tags might have prior external failure modes.",
65
+ "Use `agentplane incidents collect <task-id> --check` before `finish` when task `Findings` contains reusable external `incident-candidate` blocks.",
66
+ "Keep repository-fixable defects task-local; only external or process incidents belong in `.agentplane/policy/incidents.md`.",
67
+ ],
68
+ },
69
+ {
70
+ heading: "4. Fallbacks and recovery",
53
71
  summary: "Keep exceptional paths out of the normal route: use these only for recovery, framework upgrades, or branch_pr work.",
54
72
  commands: BOOTSTRAP_RECOVERY_COMMANDS,
55
73
  notes: [
@@ -1 +1 @@
1
- {"version":3,"file":"command-invocations.d.ts","sourceRoot":"","sources":["../../src/cli/command-invocations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA6BhD,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAMvE"}
1
+ {"version":3,"file":"command-invocations.d.ts","sourceRoot":"","sources":["../../src/cli/command-invocations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA+BhD,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAMvE"}
@@ -4,6 +4,8 @@ const COMMAND_INVOCATIONS = new Map([
4
4
  "finish",
5
5
  'agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --commit <git-rev>',
6
6
  ],
7
+ ["incidents advise", "agentplane incidents advise <task-id>"],
8
+ ["incidents collect", "agentplane incidents collect <task-id>"],
7
9
  ["init", "agentplane init"],
8
10
  ["preflight", "agentplane preflight"],
9
11
  ["quickstart", "agentplane quickstart"],
@@ -1,6 +1,8 @@
1
1
  export declare const COMMAND_SNIPPETS: {
2
2
  readonly core: {
3
3
  readonly configShow: string;
4
+ readonly incidentsAdvise: string;
5
+ readonly incidentsCollect: string;
4
6
  readonly taskList: string;
5
7
  readonly taskShow: string;
6
8
  readonly taskNew: string;
@@ -1 +1 @@
1
- {"version":3,"file":"command-snippets.d.ts","sourceRoot":"","sources":["../../src/cli/command-snippets.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BnB,CAAC"}
1
+ {"version":3,"file":"command-snippets.d.ts","sourceRoot":"","sources":["../../src/cli/command-snippets.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnB,CAAC"}
@@ -3,6 +3,8 @@ const invoke = (id) => requireCanonicalCommandInvocation(id);
3
3
  export const COMMAND_SNIPPETS = {
4
4
  core: {
5
5
  configShow: invoke(["config", "show"]),
6
+ incidentsAdvise: invoke(["incidents", "advise"]),
7
+ incidentsCollect: invoke(["incidents", "collect"]),
6
8
  taskList: invoke(["task", "list"]),
7
9
  taskShow: invoke(["task", "show"]),
8
10
  taskNew: invoke(["task", "new"]),
@@ -1,3 +1,3 @@
1
1
  import { type CommandEntry } from "./shared.js";
2
- export declare const CORE_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
2
+ export declare const CORE_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
3
3
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/core.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,2VA8MkB,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/core.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,qYAiOkB,CAAC"}
@@ -5,6 +5,9 @@ import { workflowBuildSpec } from "../../../commands/workflow-build.command.js";
5
5
  import { workflowSpec } from "../../../commands/workflow.command.js";
6
6
  import { workflowDebugSpec, workflowLandSpec, workflowSyncSpec, } from "../../../commands/workflow-playbook.command.js";
7
7
  import { workflowRestoreSpec } from "../../../commands/workflow-restore.command.js";
8
+ import { incidentsAdviseSpec } from "../../../commands/incidents/advise.command.js";
9
+ import { incidentsCollectSpec } from "../../../commands/incidents/collect.command.js";
10
+ import { incidentsSpec } from "../../../commands/incidents/incidents.command.js";
8
11
  import { releaseApplySpec } from "../../../commands/release/apply.command.js";
9
12
  import { releasePlanSpec } from "../../../commands/release/plan.command.js";
10
13
  import { releaseSpec } from "../../../commands/release/release.command.js";
@@ -66,6 +69,13 @@ export const CORE_COMMANDS = [
66
69
  needsLoadedConfig: false,
67
70
  needsTaskContext: false,
68
71
  }),
72
+ entry(incidentsSpec, () => import("../../../commands/incidents/incidents.command.js").then((m) => m.runIncidents), {
73
+ needsProject: false,
74
+ needsLoadedConfig: false,
75
+ needsTaskContext: false,
76
+ }),
77
+ entry(incidentsCollectSpec, (deps) => import("../../../commands/incidents/collect.command.js").then((m) => m.makeRunIncidentsCollectHandler(deps.getCtx))),
78
+ entry(incidentsAdviseSpec, (deps) => import("../../../commands/incidents/advise.command.js").then((m) => m.makeRunIncidentsAdviseHandler(deps.getCtx))),
69
79
  entry(roleSpec, () => import("../commands/core/role.js").then((m) => m.runRole), {
70
80
  needsProject: false,
71
81
  needsLoadedConfig: false,
@@ -1,7 +1,7 @@
1
1
  import type { CommandId } from "../spec/spec.js";
2
2
  import type { CommandEntry } from "./command-catalog/shared.js";
3
3
  export type { CommandEntry, RunDeps } from "./command-catalog/shared.js";
4
- export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
4
+ export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
5
5
  export type CatalogMatch = {
6
6
  entry: (typeof COMMANDS)[number];
7
7
  consumed: number;
@@ -1 +1 @@
1
- {"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAOhE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEzE,eAAO,MAAM,QAAQ,2pDAKuB,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAYlF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,IAAI,CAGlF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI,CAEnE;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,YAAY,EAAE,CAE9F;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,MAAM,EAAE,CAEtF;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAM1D"}
1
+ {"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAOhE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEzE,eAAO,MAAM,QAAQ,qsDAKuB,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,CAAC,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AAED,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE3C,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAMlD,CAAC;AAcF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAElF;AAED,KAAK,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAgBlD,CAAC;AAoCF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,CAQlF;AAED,KAAK,gBAAgB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA4C5C,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAoBxD,CAAC;AAuCF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAQxF"}
@@ -4,6 +4,7 @@ import { buildExecutionProfile, loadConfig, saveConfig, setByDottedKey } from "@
4
4
  import { createCliEmitter } from "../../output.js";
5
5
  import { usageError } from "../../spec/errors.js";
6
6
  import { ensureWorkflowArtifacts } from "../../../shared/workflow-artifacts.js";
7
+ import { ensureActionApproved } from "../../../commands/shared/approval-requirements.js";
7
8
  import { wrapCommand } from "./wrap-command.js";
8
9
  const output = createCliEmitter();
9
10
  export const configShowSpec = {
@@ -76,6 +77,12 @@ async function cmdConfigSet(opts) {
76
77
  }, async () => {
77
78
  const resolved = await opts.deps.getResolvedProject("config set");
78
79
  const loaded = await opts.deps.getLoadedConfig("config set");
80
+ await ensureActionApproved({
81
+ action: "config_write",
82
+ config: loaded.config,
83
+ yes: false,
84
+ reason: `config set ${opts.key}`,
85
+ });
79
86
  const raw = { ...loaded.raw };
80
87
  setByDottedKey(raw, opts.key, opts.value);
81
88
  await saveConfig(resolved.agentplaneDir, raw);
@@ -140,6 +147,12 @@ async function cmdModeSet(opts) {
140
147
  }, async () => {
141
148
  const resolved = await opts.deps.getResolvedProject("mode set");
142
149
  const loaded = await opts.deps.getLoadedConfig("mode set");
150
+ await ensureActionApproved({
151
+ action: "config_write",
152
+ config: loaded.config,
153
+ yes: false,
154
+ reason: `mode set ${opts.mode}`,
155
+ });
143
156
  const raw = { ...loaded.raw };
144
157
  setByDottedKey(raw, "workflow_mode", opts.mode);
145
158
  await saveConfig(resolved.agentplaneDir, raw);
@@ -3,7 +3,7 @@ import { mapCoreError } from "./error-map.js";
3
3
  import { exitCodeForError } from "./exit-codes.js";
4
4
  import { loadDotEnv } from "../shared/env.js";
5
5
  import { CliError } from "../shared/errors.js";
6
- import { resolveContext } from "../usecases/context/resolve-context.js";
6
+ import { resolveCommandContext } from "../usecases/context/resolve-context.js";
7
7
  import { getVersion } from "../meta/version.js";
8
8
  import { getApprovalRequirements } from "../commands/shared/approval-requirements.js";
9
9
  import { parseCommandArgv } from "./spec/parse.js";
@@ -110,7 +110,7 @@ export async function runCli(argv) {
110
110
  ctxPromise ??= (async () => {
111
111
  const resolvedProject = await getResolvedProject(commandForErrorContext);
112
112
  const loadedConfig = await getLoadedConfig(commandForErrorContext);
113
- return await resolveContext({
113
+ return await resolveCommandContext({
114
114
  cwd,
115
115
  rootOverride: globals.root ?? null,
116
116
  resolvedProject,
@@ -1 +1 @@
1
- {"version":3,"file":"run-cli.test-helpers.d.ts","sourceRoot":"","sources":["../../src/cli/run-cli.test-helpers.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAiD/D,wBAAgB,sBAAsB,IAAI,IAAI,CA8C7C;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAYtD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,YAAY;;;;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6DD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;IAChF,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAqDD;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI7E;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASlE;AAED,wBAAgB,WAAW,IAAI,MAAM,CAAC,UAAU,CAgB/C;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYpF;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5E;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzE"}
@@ -18,6 +18,7 @@ const originalGitAuthorName = process.env.GIT_AUTHOR_NAME;
18
18
  const originalGitAuthorEmail = process.env.GIT_AUTHOR_EMAIL;
19
19
  const originalGitCommitterName = process.env.GIT_COMMITTER_NAME;
20
20
  const originalGitCommitterEmail = process.env.GIT_COMMITTER_EMAIL;
21
+ const originalHookRunner = process.env.AGENTPLANE_HOOK_RUNNER;
21
22
  const originalStdoutWrite = process.stdout.write.bind(process.stdout);
22
23
  const originalStderrWrite = process.stderr.write.bind(process.stderr);
23
24
  let stdioSilenceDepth = 0;
@@ -29,13 +30,17 @@ async function ensureGitTemplateRoot() {
29
30
  return gitTemplateRoot;
30
31
  gitTemplatePromise ??= (async () => {
31
32
  const root = await mkdtemp(path.join(os.tmpdir(), "agentplane-git-template-"));
32
- await execFileAsync("git", ["init", "-q"], { cwd: root });
33
+ await execFileAsync("git", ["init", "-q"], { cwd: root, env: cleanGitEnv() });
33
34
  // Tests must not rely on global git config. Configure author identity locally
34
35
  // so any helper that creates commits works in CI.
35
36
  await execFileAsync("git", ["config", "user.email", "agentplane-test@example.com"], {
36
37
  cwd: root,
38
+ env: cleanGitEnv(),
39
+ });
40
+ await execFileAsync("git", ["config", "user.name", "agentplane-test"], {
41
+ cwd: root,
42
+ env: cleanGitEnv(),
37
43
  });
38
- await execFileAsync("git", ["config", "user.name", "agentplane-test"], { cwd: root });
39
44
  return root;
40
45
  })();
41
46
  gitTemplateRoot = await gitTemplatePromise;
@@ -50,6 +55,7 @@ export function registerAgentplaneHome() {
50
55
  agentplaneHome = await mkdtemp(path.join(os.tmpdir(), "agentplane-home-"));
51
56
  process.env.AGENTPLANE_HOME = agentplaneHome;
52
57
  process.env.AGENTPLANE_NO_UPDATE_CHECK = "1";
58
+ process.env.AGENTPLANE_HOOK_RUNNER ??= path.join(process.cwd(), "packages", "agentplane", "bin", "agentplane.js");
53
59
  // Keep tests hermetic: never rely on global git config for commit authorship.
54
60
  process.env.GIT_AUTHOR_NAME ??= "agentplane-test";
55
61
  process.env.GIT_AUTHOR_EMAIL ??= "agentplane-test@example.com";
@@ -88,6 +94,10 @@ export function registerAgentplaneHome() {
88
94
  delete process.env.GIT_COMMITTER_EMAIL;
89
95
  else
90
96
  process.env.GIT_COMMITTER_EMAIL = originalGitCommitterEmail;
97
+ if (originalHookRunner === undefined)
98
+ delete process.env.AGENTPLANE_HOOK_RUNNER;
99
+ else
100
+ process.env.AGENTPLANE_HOOK_RUNNER = originalHookRunner;
91
101
  });
92
102
  afterEach(async () => {
93
103
  const roots = [...testRoots];
@@ -661,12 +671,18 @@ export async function createUpgradeBundle(files) {
661
671
  }
662
672
  export async function mkGitRepoRootWithBranch(branch) {
663
673
  const root = await mkGitRepoRoot();
664
- await execFileAsync("git", ["checkout", "-b", branch], { cwd: root });
674
+ await execFileAsync("git", ["checkout", "-b", branch], { cwd: root, env: cleanGitEnv() });
665
675
  return root;
666
676
  }
667
677
  export async function configureGitUser(root) {
668
- await execFileAsync("git", ["config", "user.email", "test@example.com"], { cwd: root });
669
- await execFileAsync("git", ["config", "user.name", "Test User"], { cwd: root });
678
+ await execFileAsync("git", ["config", "user.email", "test@example.com"], {
679
+ cwd: root,
680
+ env: cleanGitEnv(),
681
+ });
682
+ await execFileAsync("git", ["config", "user.name", "Test User"], {
683
+ cwd: root,
684
+ env: cleanGitEnv(),
685
+ });
670
686
  }
671
687
  export function cleanGitEnv() {
672
688
  const env = { ...process.env };
@@ -676,6 +692,13 @@ export function cleanGitEnv() {
676
692
  delete env.GIT_INDEX_FILE;
677
693
  delete env.GIT_OBJECT_DIRECTORY;
678
694
  delete env.GIT_ALTERNATE_OBJECT_DIRECTORIES;
695
+ env.GIT_CONFIG_GLOBAL = "/dev/null";
696
+ env.GIT_CONFIG_SYSTEM = "/dev/null";
697
+ env.GIT_TERMINAL_PROMPT = "0";
698
+ env.GIT_AUTHOR_NAME = env.GIT_AUTHOR_NAME ?? "Agentplane Test";
699
+ env.GIT_AUTHOR_EMAIL = env.GIT_AUTHOR_EMAIL ?? "agentplane-test@example.com";
700
+ env.GIT_COMMITTER_NAME = env.GIT_COMMITTER_NAME ?? "Agentplane Test";
701
+ env.GIT_COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL ?? "agentplane-test@example.com";
679
702
  return env;
680
703
  }
681
704
  export async function pathExists(filePath) {
@@ -703,12 +726,15 @@ export async function gitBranchExists(root, branch) {
703
726
  }
704
727
  }
705
728
  export async function commitAll(root, message) {
706
- await execFileAsync("git", ["add", "."], { cwd: root });
707
- await execFileAsync("git", ["commit", "-m", message], { cwd: root });
729
+ await execFileAsync("git", ["add", "."], { cwd: root, env: cleanGitEnv() });
730
+ await execFileAsync("git", ["commit", "--no-verify", "-m", message], {
731
+ cwd: root,
732
+ env: cleanGitEnv(),
733
+ });
708
734
  }
709
735
  export async function stageGitignoreIfPresent(root) {
710
736
  const gitignorePath = path.join(root, ".gitignore");
711
737
  if (!(await pathExists(gitignorePath)))
712
738
  return;
713
- await execFileAsync("git", ["add", ".gitignore"], { cwd: root });
739
+ await execFileAsync("git", ["add", ".gitignore"], { cwd: root, env: cleanGitEnv() });
714
740
  }
@@ -1 +1 @@
1
- {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/commands/backend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAInF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,eAAe,GAAG,MAAM,CAAC;IAC7D,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,eAAe,GAAG,MAAM,CAAC;IAC7D,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EA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EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,oBAAoB,CAAC;CAC7B,GAAG,OAAO,CAAC,MAAM,CAAC,CAiElB"}
@@ -28,6 +28,7 @@ export async function cmdBackendSyncParsed(opts) {
28
28
  }
29
29
  if (backendId !== "local") {
30
30
  await ensureNetworkApproved({
31
+ action: "backend_sync",
31
32
  config,
32
33
  yes: opts.flags.yes,
33
34
  reason: `backend sync may access the network (backend: ${backendId})`,
@@ -71,6 +72,7 @@ export async function cmdSyncParsed(opts) {
71
72
  }
72
73
  if (backendId !== "local") {
73
74
  await ensureNetworkApproved({
75
+ action: "backend_sync",
74
76
  config,
75
77
  yes: opts.flags.yes,
76
78
  reason: `sync may access the network (backend: ${backendId})`,
@@ -117,6 +119,7 @@ export async function cmdBackendMigrateCanonicalStateParsed(opts) {
117
119
  }
118
120
  if (backendId !== "local") {
119
121
  await ensureNetworkApproved({
122
+ action: "backend_migrate_canonical_state",
120
123
  config,
121
124
  yes: opts.flags.yes,
122
125
  reason: `backend migrate-canonical-state may access the network (backend: ${backendId})`,
@@ -170,6 +173,7 @@ export async function cmdBackendInspectParsed(opts) {
170
173
  }
171
174
  if (backendId !== "local") {
172
175
  await ensureNetworkApproved({
176
+ action: "backend_inspect",
173
177
  config,
174
178
  yes: opts.flags.yes,
175
179
  reason: `backend inspect may access the network (backend: ${backendId})`,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,UAAU,mDAAoD,CAAC;AA8G5E,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmClB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsGlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,UAAU,mDAAoD,CAAC;AAkH5E,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmClB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsGlB"}
@@ -71,17 +71,21 @@ function shimScriptText() {
71
71
  "set -e",
72
72
  'SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"',
73
73
  'REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"',
74
+ 'ENV_BIN="${AGENTPLANE_HOOK_RUNNER:-}"',
75
+ 'if [ -n "$ENV_BIN" ] && command -v node >/dev/null 2>&1 && [ -f "$ENV_BIN" ]; then',
76
+ ' exec node "$ENV_BIN" "$@"',
77
+ "fi",
74
78
  'LOCAL_BIN="$REPO_ROOT/packages/agentplane/bin/agentplane.js"',
75
79
  'if command -v node >/dev/null 2>&1 && [ -f "$LOCAL_BIN" ]; then',
76
80
  ' exec node "$LOCAL_BIN" "$@"',
77
81
  "fi",
78
- "if command -v npx >/dev/null 2>&1; then",
79
- ' exec npx --yes agentplane "$@"',
80
- "fi",
81
82
  "if command -v agentplane >/dev/null 2>&1; then",
82
83
  ' exec agentplane "$@"',
83
84
  "fi",
84
- 'echo "agentplane shim: runner not found (need node+npx or agentplane in PATH)." >&2',
85
+ "if command -v npx >/dev/null 2>&1; then",
86
+ ' exec npx --yes agentplane "$@"',
87
+ "fi",
88
+ 'echo "agentplane shim: runner not found (need env runner, repo-local source, agentplane in PATH, or node+npx)." >&2',
85
89
  " exit 127",
86
90
  "",
87
91
  ].join("\n");
@@ -0,0 +1,15 @@
1
+ import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
2
+ import { type CommandContext } from "../shared/task-backend.js";
3
+ type IncidentsAdviseParsed = {
4
+ taskId: string | null;
5
+ scope: string | null;
6
+ title: string | null;
7
+ description: string | null;
8
+ tags: string[];
9
+ limit: number;
10
+ json: boolean;
11
+ };
12
+ export declare const incidentsAdviseSpec: CommandSpec<IncidentsAdviseParsed>;
13
+ export declare function makeRunIncidentsAdviseHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: IncidentsAdviseParsed) => Promise<number>;
14
+ export {};
15
+ //# sourceMappingURL=advise.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advise.command.d.ts","sourceRoot":"","sources":["../../../src/commands/incidents/advise.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQtE,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGpF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAIF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CA6ElE,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC9E,KAAK,UAAU,EAAE,GAAG,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAAC,CA2D1E"}
@@ -0,0 +1,139 @@
1
+ import { createCliEmitter } from "../../cli/output.js";
2
+ import { usageError } from "../../cli/spec/errors.js";
3
+ import { buildIncidentAdviceQueryFromTask, renderIncidentAdvice, resolveIncidentAdviceMatches, } from "../../runtime/incidents/index.js";
4
+ import { loadCommandContext } from "../shared/task-backend.js";
5
+ import { adviseTaskIncidents, loadIncidentRegistry } from "./shared.js";
6
+ const output = createCliEmitter();
7
+ export const incidentsAdviseSpec = {
8
+ id: ["incidents", "advise"],
9
+ group: "Policy",
10
+ summary: "Resolve relevant incident advice for a task or an ad hoc scope/tag query.",
11
+ args: [{ name: "task-id", required: false, valueHint: "<task-id>" }],
12
+ options: [
13
+ {
14
+ kind: "string",
15
+ name: "scope",
16
+ valueHint: "<text>",
17
+ description: "Ad hoc scope text when querying without a task id.",
18
+ },
19
+ {
20
+ kind: "string",
21
+ name: "title",
22
+ valueHint: "<text>",
23
+ description: "Optional title text for ad hoc advice lookup.",
24
+ },
25
+ {
26
+ kind: "string",
27
+ name: "description",
28
+ valueHint: "<text>",
29
+ description: "Optional description text for ad hoc advice lookup.",
30
+ },
31
+ {
32
+ kind: "string",
33
+ name: "tag",
34
+ valueHint: "<tag>",
35
+ repeatable: true,
36
+ description: "Matching tag for ad hoc advice lookup; repeat as needed.",
37
+ },
38
+ {
39
+ kind: "string",
40
+ name: "limit",
41
+ valueHint: "<n>",
42
+ default: "5",
43
+ coerce: (raw) => Number.parseInt(raw, 10),
44
+ description: "Maximum number of advice entries to show.",
45
+ },
46
+ {
47
+ kind: "boolean",
48
+ name: "json",
49
+ default: false,
50
+ description: "Emit machine-readable advice matches.",
51
+ },
52
+ ],
53
+ validateRaw: (raw) => {
54
+ const taskId = typeof raw.args["task-id"] === "string" ? raw.args["task-id"].trim() : "";
55
+ const scope = typeof raw.opts.scope === "string" ? raw.opts.scope.trim() : "";
56
+ const title = typeof raw.opts.title === "string" ? raw.opts.title.trim() : "";
57
+ const description = typeof raw.opts.description === "string" ? raw.opts.description.trim() : "";
58
+ const tags = Array.isArray(raw.opts.tag) ? raw.opts.tag : [];
59
+ if (!taskId && !scope && !title && !description && tags.length === 0) {
60
+ throw usageError({
61
+ spec: incidentsAdviseSpec,
62
+ message: "Provide either <task-id> or at least one of --scope/--title/--description/--tag.",
63
+ });
64
+ }
65
+ },
66
+ parse: (raw) => ({
67
+ taskId: typeof raw.args["task-id"] === "string" && String(raw.args["task-id"]).trim()
68
+ ? String(raw.args["task-id"]).trim()
69
+ : null,
70
+ scope: typeof raw.opts.scope === "string" ? String(raw.opts.scope).trim() : null,
71
+ title: typeof raw.opts.title === "string" ? String(raw.opts.title).trim() : null,
72
+ description: typeof raw.opts.description === "string" ? String(raw.opts.description).trim() : null,
73
+ tags: Array.isArray(raw.opts.tag)
74
+ ? raw.opts.tag.map((value) => String(value).trim()).filter(Boolean)
75
+ : [],
76
+ limit: typeof raw.opts.limit === "number" && Number.isInteger(raw.opts.limit) && raw.opts.limit > 0
77
+ ? Number(raw.opts.limit)
78
+ : 5,
79
+ json: raw.opts.json === true,
80
+ }),
81
+ };
82
+ export function makeRunIncidentsAdviseHandler(getCtx) {
83
+ return async (ctx, p) => {
84
+ const commandContext = (await getCtx("incidents advise")) ??
85
+ (await loadCommandContext({ cwd: ctx.cwd, rootOverride: ctx.rootOverride ?? null }));
86
+ if (p.taskId) {
87
+ const result = await adviseTaskIncidents({
88
+ ctx: commandContext,
89
+ taskId: p.taskId,
90
+ limit: p.limit,
91
+ });
92
+ if (p.json) {
93
+ output.json({
94
+ task_id: p.taskId,
95
+ matches: result.matches.map((match) => ({
96
+ score: match.score,
97
+ matched_tags: match.matchedTags,
98
+ matched_terms: match.matchedTerms,
99
+ scope_matched: match.scopeMatched,
100
+ entry: match.entry,
101
+ })),
102
+ });
103
+ return 0;
104
+ }
105
+ output.line(`Incident advice for ${p.taskId}:`);
106
+ output.line(renderIncidentAdvice(result.matches));
107
+ return 0;
108
+ }
109
+ const registry = await loadIncidentRegistry(commandContext);
110
+ const query = buildIncidentAdviceQueryFromTask({
111
+ taskId: "adhoc",
112
+ title: p.title ?? p.scope ?? "",
113
+ description: p.description ?? "",
114
+ scope: p.scope,
115
+ tags: p.tags,
116
+ });
117
+ const matches = resolveIncidentAdviceMatches({
118
+ query,
119
+ registry: registry.registry,
120
+ limit: p.limit,
121
+ });
122
+ if (p.json) {
123
+ output.json({
124
+ query,
125
+ matches: matches.map((match) => ({
126
+ score: match.score,
127
+ matched_tags: match.matchedTags,
128
+ matched_terms: match.matchedTerms,
129
+ scope_matched: match.scopeMatched,
130
+ entry: match.entry,
131
+ })),
132
+ });
133
+ return 0;
134
+ }
135
+ output.line("Incident advice:");
136
+ output.line(renderIncidentAdvice(matches));
137
+ return 0;
138
+ };
139
+ }
@@ -0,0 +1,11 @@
1
+ import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
2
+ import { type CommandContext } from "../shared/task-backend.js";
3
+ type IncidentsCollectParsed = {
4
+ taskId: string;
5
+ check: boolean;
6
+ json: boolean;
7
+ };
8
+ export declare const incidentsCollectSpec: CommandSpec<IncidentsCollectParsed>;
9
+ export declare function makeRunIncidentsCollectHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: IncidentsCollectParsed) => Promise<number>;
10
+ export {};
11
+ //# sourceMappingURL=collect.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect.command.d.ts","sourceRoot":"","sources":["../../../src/commands/incidents/collect.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGpF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAoCpE,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC/E,KAAK,UAAU,EAAE,GAAG,sBAAsB,KAAG,OAAO,CAAC,MAAM,CAAC,CA+B3E"}