freeharness 0.4.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 (375) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +108 -0
  3. package/README.md +134 -0
  4. package/canonical/HARVEST.yaml +858 -0
  5. package/canonical/PROVENANCE.yaml +740 -0
  6. package/canonical/agents/README.md +95 -0
  7. package/canonical/agents/agentic-architect.md +18 -0
  8. package/canonical/agents/database-reviewer.md +41 -0
  9. package/canonical/agents/explorer-ai-engineer-analyst.md +65 -0
  10. package/canonical/agents/pr-reviewer.md +96 -0
  11. package/canonical/agents/python-reviewer.md +55 -0
  12. package/canonical/agents/report-formatter.md +19 -0
  13. package/canonical/agents/security-reviewer.md +53 -0
  14. package/canonical/agents/test-writer.md +34 -0
  15. package/canonical/commands/fh-context.md +37 -0
  16. package/canonical/evals/promptfoo.redteam.yaml +108 -0
  17. package/canonical/hooks/cost-prices.json +14 -0
  18. package/canonical/hooks/freeharness-auto-memory.mjs +158 -0
  19. package/canonical/hooks/freeharness-config-guard.mjs +162 -0
  20. package/canonical/hooks/freeharness-context-monitor.mjs +198 -0
  21. package/canonical/hooks/freeharness-converge.mjs +227 -0
  22. package/canonical/hooks/freeharness-cost-tracker.mjs +1027 -0
  23. package/canonical/hooks/freeharness-memory-guard.mjs +57 -0
  24. package/canonical/hooks/freeharness-output-pruner.mjs +333 -0
  25. package/canonical/hooks/freeharness-precompact.mjs +323 -0
  26. package/canonical/hooks/freeharness-repeat-tool.mjs +208 -0
  27. package/canonical/hooks/freeharness-security-guidance.mjs +164 -0
  28. package/canonical/hooks/freeharness-session-start +583 -0
  29. package/canonical/hooks/hooks.auto-memory.claude-code.json +16 -0
  30. package/canonical/hooks/hooks.claude-code.json +17 -0
  31. package/canonical/hooks/hooks.config-guard.claude-code.json +16 -0
  32. package/canonical/hooks/hooks.context-monitor.claude-code.json +15 -0
  33. package/canonical/hooks/hooks.converge.claude-code.json +15 -0
  34. package/canonical/hooks/hooks.cost-tracker.claude-code.json +37 -0
  35. package/canonical/hooks/hooks.memory-guard.claude-code.json +16 -0
  36. package/canonical/hooks/hooks.output-pruner.claude-code.json +16 -0
  37. package/canonical/hooks/hooks.precompact.claude-code.json +15 -0
  38. package/canonical/hooks/hooks.repeat-tool.claude-code.json +25 -0
  39. package/canonical/hooks/hooks.security-guidance.claude-code.json +16 -0
  40. package/canonical/mcp/servers.json +20 -0
  41. package/canonical/openspec/config.base.yaml +89 -0
  42. package/canonical/openspec/schema.spec-driven.yaml +277 -0
  43. package/canonical/openspec/templates/data-contract.md +36 -0
  44. package/canonical/openspec/templates/design.md +84 -0
  45. package/canonical/openspec/templates/eval-plan.md +33 -0
  46. package/canonical/openspec/templates/follow-ups.md +2 -0
  47. package/canonical/openspec/templates/proposal.md +45 -0
  48. package/canonical/openspec/templates/spec.md +42 -0
  49. package/canonical/openspec/templates/tasks.md +38 -0
  50. package/canonical/profiles/local-llamacpp.LOCAL-MODELS.md +47 -0
  51. package/canonical/profiles/local-llamacpp.json +27 -0
  52. package/canonical/profiles/local-ollama.json +20 -0
  53. package/canonical/profiles/mcp.json +91 -0
  54. package/canonical/rules/CLAUDE.md +78 -0
  55. package/canonical/rules/project-CLAUDE.template.md +62 -0
  56. package/canonical/rules/routing.md +20 -0
  57. package/canonical/rules/safety.md +41 -0
  58. package/canonical/settings/settings.cache-hygiene.claude-code.json +5 -0
  59. package/canonical/skills/agent-evaluation/SKILL.md +102 -0
  60. package/canonical/skills/agent-evaluation/assets/evaluation_report_template.md +206 -0
  61. package/canonical/skills/agent-evaluation/evals/cases.yaml +106 -0
  62. package/canonical/skills/agent-evaluation/references/dataset-preparation.md +351 -0
  63. package/canonical/skills/agent-evaluation/references/scorers-constraints.md +165 -0
  64. package/canonical/skills/agent-evaluation/references/scorers.md +431 -0
  65. package/canonical/skills/agent-evaluation/references/setup-guide.md +252 -0
  66. package/canonical/skills/agent-evaluation/references/tracing-integration.md +164 -0
  67. package/canonical/skills/agent-evaluation/references/troubleshooting.md +514 -0
  68. package/canonical/skills/agent-evaluation/scripts/analyze_results.py +462 -0
  69. package/canonical/skills/agent-evaluation/scripts/create_dataset_template.py +382 -0
  70. package/canonical/skills/agent-evaluation/scripts/list_datasets.py +273 -0
  71. package/canonical/skills/agent-evaluation/scripts/run_evaluation_template.py +309 -0
  72. package/canonical/skills/agent-evaluation/scripts/setup_mlflow.py +353 -0
  73. package/canonical/skills/agent-evaluation/scripts/utils/__init__.py +27 -0
  74. package/canonical/skills/agent-evaluation/scripts/utils/env_validation.py +123 -0
  75. package/canonical/skills/agent-evaluation/scripts/utils/tracing_utils.py +108 -0
  76. package/canonical/skills/agent-evaluation/scripts/validate_agent_tracing.py +148 -0
  77. package/canonical/skills/agent-evaluation/scripts/validate_auth.py +240 -0
  78. package/canonical/skills/agent-evaluation/scripts/validate_environment.py +185 -0
  79. package/canonical/skills/agent-evaluation/scripts/validate_tracing_runtime.py +318 -0
  80. package/canonical/skills/agentic-architecture/SKILL.md +41 -0
  81. package/canonical/skills/agentic-architecture/evals/cases.yaml +94 -0
  82. package/canonical/skills/agentic-architecture/reference/context-engineering.md +75 -0
  83. package/canonical/skills/agentic-architecture/reference/patterns.md +76 -0
  84. package/canonical/skills/agentic-architecture/reference/reliability-observability.md +94 -0
  85. package/canonical/skills/agentic-architecture/reference/review-framework.md +59 -0
  86. package/canonical/skills/code-review/SKILL.md +52 -0
  87. package/canonical/skills/code-review/evals/cases.yaml +197 -0
  88. package/canonical/skills/git-workflow/SKILL.md +41 -0
  89. package/canonical/skills/git-workflow/evals/cases.yaml +92 -0
  90. package/canonical/skills/local-code/SKILL.md +24 -0
  91. package/canonical/skills/local-code/evals/cases.yaml +85 -0
  92. package/canonical/skills/local-code/scripts/query_llama.py +68 -0
  93. package/canonical/skills/report-formatting/SKILL.md +62 -0
  94. package/canonical/skills/report-formatting/evals/cases.yaml +83 -0
  95. package/canonical/skills/report-formatting/reference/ARCHITECTURE.md +135 -0
  96. package/canonical/skills/report-formatting/reference/HELPERS.md +120 -0
  97. package/canonical/skills/report-formatting/reference/PPTX.md +136 -0
  98. package/canonical/skills/report-formatting/reference/RELEASE.md +99 -0
  99. package/canonical/skills/report-formatting/reference/TEMPLATES.md +48 -0
  100. package/canonical/skills/report-formatting/reference/authoring.md +66 -0
  101. package/canonical/skills/report-formatting/scripts/architecture-template.md +271 -0
  102. package/canonical/skills/report-formatting/scripts/assets/claro-logo.png +0 -0
  103. package/canonical/skills/report-formatting/scripts/assets/claro-wordmark.svg +1 -0
  104. package/canonical/skills/report-formatting/scripts/build-architecture.js +57 -0
  105. package/canonical/skills/report-formatting/scripts/build-md-claro.js +224 -0
  106. package/canonical/skills/report-formatting/scripts/build-release.js +51 -0
  107. package/canonical/skills/report-formatting/scripts/check-env.js +58 -0
  108. package/canonical/skills/report-formatting/scripts/docmodel.js +283 -0
  109. package/canonical/skills/report-formatting/scripts/example-build.js +119 -0
  110. package/canonical/skills/report-formatting/scripts/example_build_ArchitectureReview_docx.js +195 -0
  111. package/canonical/skills/report-formatting/scripts/example_build_ExecutiveReport_docx.js +114 -0
  112. package/canonical/skills/report-formatting/scripts/package.json +17 -0
  113. package/canonical/skills/report-formatting/scripts/pptx/example_build_StatusReport_pptx.py +223 -0
  114. package/canonical/skills/report-formatting/scripts/pptx/example_build_WeeklyStatus_pptx.py +245 -0
  115. package/canonical/skills/report-formatting/scripts/pptx/pptx_office.py +144 -0
  116. package/canonical/skills/report-formatting/scripts/pptx/requirements.txt +7 -0
  117. package/canonical/skills/report-formatting/scripts/pptx/status_report_blocks.py +193 -0
  118. package/canonical/skills/report-formatting/scripts/pptx/theme_claro_pptx.py +473 -0
  119. package/canonical/skills/report-formatting/scripts/release-template.md +80 -0
  120. package/canonical/skills/report-formatting/scripts/render-mermaid.js +105 -0
  121. package/canonical/skills/report-formatting/scripts/theme-claro.js +403 -0
  122. package/canonical/skills/subagent-driven-development/SKILL.md +60 -0
  123. package/canonical/skills/subagent-driven-development/evals/cases.yaml +208 -0
  124. package/canonical/skills/subagent-driven-development/reference/brief.md +91 -0
  125. package/canonical/skills/subagent-driven-development/reference/handoff.md +118 -0
  126. package/canonical/skills/subagent-driven-development/scripts/validate-handoff.mjs +850 -0
  127. package/canonical/skills/systematic-debugging/SKILL.md +44 -0
  128. package/canonical/skills/systematic-debugging/evals/cases.yaml +90 -0
  129. package/canonical/skills/test-driven-development/SKILL.md +42 -0
  130. package/canonical/skills/test-driven-development/evals/cases.yaml +86 -0
  131. package/canonical/skills/test-driven-development/reference/writing-good-tests.md +52 -0
  132. package/canonical/skills/verification-before-completion/SKILL.md +53 -0
  133. package/canonical/skills/verification-before-completion/evals/cases.yaml +107 -0
  134. package/dist/adapters/content/language-lint.d.ts +46 -0
  135. package/dist/adapters/content/language-lint.js +191 -0
  136. package/dist/adapters/harness/claude-code.d.ts +57 -0
  137. package/dist/adapters/harness/claude-code.js +385 -0
  138. package/dist/adapters/harness/index.d.ts +3 -0
  139. package/dist/adapters/harness/index.js +17 -0
  140. package/dist/adapters/harness/opencode.d.ts +7 -0
  141. package/dist/adapters/harness/opencode.js +166 -0
  142. package/dist/adapters/harness/plugin.d.ts +22 -0
  143. package/dist/adapters/harness/plugin.js +257 -0
  144. package/dist/adapters/memory/doctor.d.ts +480 -0
  145. package/dist/adapters/memory/doctor.js +1217 -0
  146. package/dist/adapters/memory/vendored.d.ts +150 -0
  147. package/dist/adapters/memory/vendored.js +487 -0
  148. package/dist/adapters/package/node.d.ts +9 -0
  149. package/dist/adapters/package/node.js +20 -0
  150. package/dist/adapters/prompt/readline.d.ts +19 -0
  151. package/dist/adapters/prompt/readline.js +53 -0
  152. package/dist/adapters/sync/diff.d.ts +43 -0
  153. package/dist/adapters/sync/diff.js +380 -0
  154. package/dist/cli/cleanup.d.ts +86 -0
  155. package/dist/cli/cleanup.js +382 -0
  156. package/dist/cli/cost.d.ts +304 -0
  157. package/dist/cli/cost.js +501 -0
  158. package/dist/cli/doctor.d.ts +205 -0
  159. package/dist/cli/doctor.js +654 -0
  160. package/dist/cli/executor.d.ts +5 -0
  161. package/dist/cli/executor.js +48 -0
  162. package/dist/cli/plugin-validate.d.ts +37 -0
  163. package/dist/cli/plugin-validate.js +256 -0
  164. package/dist/cli/prefix.d.ts +68 -0
  165. package/dist/cli/prefix.js +218 -0
  166. package/dist/cli/profile.d.ts +170 -0
  167. package/dist/cli/profile.js +285 -0
  168. package/dist/cli/runner.d.ts +10 -0
  169. package/dist/cli/runner.js +27 -0
  170. package/dist/cli/uninstall.d.ts +65 -0
  171. package/dist/cli/uninstall.js +147 -0
  172. package/dist/index.d.ts +8 -0
  173. package/dist/index.js +989 -0
  174. package/dist/infra/dogfood.d.ts +31 -0
  175. package/dist/infra/dogfood.js +51 -0
  176. package/dist/infra/fsutil.d.ts +40 -0
  177. package/dist/infra/fsutil.js +143 -0
  178. package/dist/infra/manifest.d.ts +76 -0
  179. package/dist/infra/manifest.js +92 -0
  180. package/dist/infra/paths.d.ts +19 -0
  181. package/dist/infra/paths.js +74 -0
  182. package/dist/infra/routing.d.ts +4 -0
  183. package/dist/infra/routing.js +7 -0
  184. package/node_modules/@freeharness/core/dist/context.d.ts +30 -0
  185. package/node_modules/@freeharness/core/dist/context.js +1 -0
  186. package/node_modules/@freeharness/core/dist/index.d.ts +5 -0
  187. package/node_modules/@freeharness/core/dist/index.js +6 -0
  188. package/node_modules/@freeharness/core/dist/planner.d.ts +13 -0
  189. package/node_modules/@freeharness/core/dist/planner.js +18 -0
  190. package/node_modules/@freeharness/core/dist/ports.d.ts +90 -0
  191. package/node_modules/@freeharness/core/dist/ports.js +1 -0
  192. package/node_modules/@freeharness/core/dist/registry.d.ts +41 -0
  193. package/node_modules/@freeharness/core/dist/registry.js +124 -0
  194. package/node_modules/@freeharness/core/dist/tiers.d.ts +30 -0
  195. package/node_modules/@freeharness/core/dist/tiers.js +99 -0
  196. package/node_modules/@freeharness/core/package.json +34 -0
  197. package/node_modules/@freeharness/sdd/PROVENANCE.yaml +175 -0
  198. package/node_modules/@freeharness/sdd/dist/src/bin/openspec.d.ts +2 -0
  199. package/node_modules/@freeharness/sdd/dist/src/bin/openspec.js +166 -0
  200. package/node_modules/@freeharness/sdd/dist/src/index.d.ts +14 -0
  201. package/node_modules/@freeharness/sdd/dist/src/index.js +11 -0
  202. package/node_modules/@freeharness/sdd/dist/src/init.d.ts +39 -0
  203. package/node_modules/@freeharness/sdd/dist/src/init.js +190 -0
  204. package/node_modules/@freeharness/sdd/dist/src/root-resolver.d.ts +8 -0
  205. package/node_modules/@freeharness/sdd/dist/src/root-resolver.js +32 -0
  206. package/node_modules/@freeharness/sdd/dist/src/shim/archive.d.ts +81 -0
  207. package/node_modules/@freeharness/sdd/dist/src/shim/archive.js +483 -0
  208. package/node_modules/@freeharness/sdd/dist/src/shim/context.d.ts +4 -0
  209. package/node_modules/@freeharness/sdd/dist/src/shim/context.js +48 -0
  210. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.d.ts +57 -0
  211. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.js +279 -0
  212. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.d.ts +67 -0
  213. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.js +460 -0
  214. package/node_modules/@freeharness/sdd/dist/src/shim/list.d.ts +5 -0
  215. package/node_modules/@freeharness/sdd/dist/src/shim/list.js +95 -0
  216. package/node_modules/@freeharness/sdd/dist/src/shim/new-change.d.ts +6 -0
  217. package/node_modules/@freeharness/sdd/dist/src/shim/new-change.js +150 -0
  218. package/node_modules/@freeharness/sdd/dist/src/shim/schemas.d.ts +4 -0
  219. package/node_modules/@freeharness/sdd/dist/src/shim/schemas.js +23 -0
  220. package/node_modules/@freeharness/sdd/dist/src/shim/shared.d.ts +56 -0
  221. package/node_modules/@freeharness/sdd/dist/src/shim/shared.js +140 -0
  222. package/node_modules/@freeharness/sdd/dist/src/shim/status.d.ts +8 -0
  223. package/node_modules/@freeharness/sdd/dist/src/shim/status.js +85 -0
  224. package/node_modules/@freeharness/sdd/dist/src/shim/validate.d.ts +6 -0
  225. package/node_modules/@freeharness/sdd/dist/src/shim/validate.js +229 -0
  226. package/node_modules/@freeharness/sdd/dist/src/validate-change.d.ts +40 -0
  227. package/node_modules/@freeharness/sdd/dist/src/validate-change.js +114 -0
  228. package/node_modules/@freeharness/sdd/dist/src/validate.d.ts +24 -0
  229. package/node_modules/@freeharness/sdd/dist/src/validate.js +72 -0
  230. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.d.ts +130 -0
  231. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.js +981 -0
  232. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.d.ts +46 -0
  233. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.js +128 -0
  234. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.d.ts +26 -0
  235. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.js +32 -0
  236. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.d.ts +50 -0
  237. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.js +394 -0
  238. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.d.ts +15 -0
  239. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.js +49 -0
  240. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.d.ts +71 -0
  241. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.js +164 -0
  242. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.d.ts +11 -0
  243. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.js +21 -0
  244. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.d.ts +102 -0
  245. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.js +230 -0
  246. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.d.ts +18 -0
  247. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.js +138 -0
  248. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.d.ts +82 -0
  249. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.js +333 -0
  250. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.d.ts +12 -0
  251. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.js +110 -0
  252. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.d.ts +11 -0
  253. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.js +32 -0
  254. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.d.ts +33 -0
  255. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.js +149 -0
  256. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.d.ts +39 -0
  257. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.js +49 -0
  258. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.d.ts +12 -0
  259. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.js +31 -0
  260. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.d.ts +10 -0
  261. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.js +10 -0
  262. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.d.ts +12 -0
  263. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.js +26 -0
  264. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.d.ts +28 -0
  265. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.js +41 -0
  266. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.d.ts +23 -0
  267. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.js +25 -0
  268. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.d.ts +72 -0
  269. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.js +76 -0
  270. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.d.ts +39 -0
  271. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.js +53 -0
  272. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.d.ts +62 -0
  273. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.js +7 -0
  274. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.d.ts +35 -0
  275. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.js +47 -0
  276. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.d.ts +33 -0
  277. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.js +55 -0
  278. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.d.ts +11 -0
  279. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.js +11 -0
  280. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.d.ts +48 -0
  281. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.js +99 -0
  282. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.d.ts +19 -0
  283. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.js +18 -0
  284. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.d.ts +18 -0
  285. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.js +4 -0
  286. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.d.ts +19 -0
  287. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.js +207 -0
  288. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.d.ts +12 -0
  289. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.js +409 -0
  290. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.d.ts +9 -0
  291. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.js +673 -0
  292. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.d.ts +9 -0
  293. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.js +230 -0
  294. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.d.ts +12 -0
  295. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.js +550 -0
  296. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.d.ts +8 -0
  297. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.js +107 -0
  298. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.d.ts +12 -0
  299. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.js +228 -0
  300. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.d.ts +9 -0
  301. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.js +147 -0
  302. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.d.ts +9 -0
  303. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.js +571 -0
  304. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.d.ts +12 -0
  305. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.js +322 -0
  306. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.d.ts +7 -0
  307. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.js +7 -0
  308. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.d.ts +9 -0
  309. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.js +518 -0
  310. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.d.ts +9 -0
  311. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.js +176 -0
  312. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.d.ts +9 -0
  313. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.js +344 -0
  314. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.d.ts +39 -0
  315. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.js +54 -0
  316. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.d.ts +35 -0
  317. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.js +171 -0
  318. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.d.ts +27 -0
  319. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.js +210 -0
  320. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.d.ts +14 -0
  321. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.js +48 -0
  322. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.d.ts +22 -0
  323. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.js +186 -0
  324. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.d.ts +65 -0
  325. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.js +409 -0
  326. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.d.ts +55 -0
  327. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.js +98 -0
  328. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.d.ts +8 -0
  329. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.js +77 -0
  330. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.d.ts +44 -0
  331. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.js +116 -0
  332. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.d.ts +12 -0
  333. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.js +17 -0
  334. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.d.ts +72 -0
  335. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.js +30 -0
  336. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.d.ts +3 -0
  337. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.js +3 -0
  338. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.d.ts +17 -0
  339. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.js +14 -0
  340. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.d.ts +39 -0
  341. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.js +114 -0
  342. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.d.ts +45 -0
  343. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.js +105 -0
  344. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.d.ts +15 -0
  345. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.js +56 -0
  346. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.d.ts +17 -0
  347. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.js +1 -0
  348. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.d.ts +94 -0
  349. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.js +756 -0
  350. package/node_modules/@freeharness/sdd/package.json +57 -0
  351. package/node_modules/@freeharness/sdd/vendor/openspec/LICENSE.upstream +22 -0
  352. package/node_modules/@freeharness/sdd/vendor/openspec/assets/schema.upstream.yaml +232 -0
  353. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/README.md +19 -0
  354. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-apply-change/SKILL.md +187 -0
  355. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-archive-change/SKILL.md +181 -0
  356. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-bulk-archive-change/SKILL.md +338 -0
  357. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-continue-change/SKILL.md +117 -0
  358. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-explore/SKILL.md +342 -0
  359. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-ff-change/SKILL.md +116 -0
  360. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-new-change/SKILL.md +76 -0
  361. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-onboard/SKILL.md +560 -0
  362. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-propose/SKILL.md +162 -0
  363. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-sync-specs/SKILL.md +261 -0
  364. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-update-change/SKILL.md +90 -0
  365. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-verify-change/SKILL.md +174 -0
  366. package/package.json +70 -0
  367. package/provenance/canonical.PROVENANCE.yaml +740 -0
  368. package/provenance/claude-mem.LICENSE.upstream +202 -0
  369. package/provenance/memory.PROVENANCE.yaml +399 -0
  370. package/provenance/sdd.PROVENANCE.yaml +175 -0
  371. package/vendor-licenses/caveman.LICENSE +27 -0
  372. package/vendor-licenses/deepseek-harness.LICENSE +21 -0
  373. package/vendor-licenses/ecc.LICENSE +21 -0
  374. package/vendor-licenses/pi.LICENSE +21 -0
  375. package/vendor-licenses/superpowers.LICENSE +21 -0
@@ -0,0 +1,673 @@
1
+ import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
2
+ export function getBulkArchiveChangeSkillTemplate() {
3
+ return {
4
+ name: 'openspec-bulk-archive-change',
5
+ description: 'Archive multiple completed changes at once. Use when archiving several parallel changes.',
6
+ instructions: `Archive multiple completed changes in a single operation.
7
+
8
+ This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
9
+
10
+ ${STORE_SELECTION_GUIDANCE}
11
+
12
+ \`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve the full path from each delta spec when resolving its main spec.
13
+
14
+ **Input**: None required (prompts for selection)
15
+
16
+ **Steps**
17
+
18
+ 1. **Get active changes**
19
+
20
+ Run \`openspec list --json\` to get all active changes.
21
+
22
+ If no active changes exist, inform user and stop.
23
+
24
+ 2. **Prompt for change selection**
25
+
26
+ Ask the user to choose changes (multi-select):
27
+ - Show each change with its schema
28
+ - Include an option for "All changes"
29
+ - Allow any number of selections (1+ works, 2+ is the typical use case)
30
+
31
+ **IMPORTANT**: Do NOT auto-select. Always let the user choose.
32
+
33
+ **Load current archive inputs once for the selected root before batch validation:**
34
+
35
+ Choose one selected change from this root and run
36
+ \`openspec instructions archive --change "<selected-change>" --json\` with the
37
+ same selected-root flags. This lookup is advisory and optional: it only supplies
38
+ extra prompt inputs, so it must never block the batch. If it fails or returns
39
+ invalid JSON — for example on an older CLI that does not support this command
40
+ yet — continue the batch with no context and no operation guidance. Do not
41
+ report an error and do not stop.
42
+
43
+ A valid response may omit \`context\` and \`operationGuidance\`. Treat
44
+ \`context\` as a required prompt-level input across the batch: read and consider
45
+ it, and apply relevant project facts, conventions, and constraints. Treat
46
+ \`operationGuidance\` as optional additive advice: read and consider every
47
+ entry, and follow entries that are applicable and compatible with the built-in
48
+ batch workflow.
49
+
50
+ Keep both fields separate from conflict analysis, explicit user choices,
51
+ resolved paths, CLI checks, and command contracts. If context conflicts with one
52
+ of those controlling inputs, report the conflict and preserve the controlling
53
+ value. If guidance is inapplicable or conflicts with a controlling input, do not
54
+ follow it and explain why. Do not infer skipped prompts, replacement paths, or
55
+ flags from either field, and do not copy their text verbatim into specs, changes,
56
+ or summaries. These are prompt-level behavior contracts, not enforceable checks.
57
+
58
+ 3. **Batch validation - gather status for all selected changes**
59
+
60
+ For each selected change, collect:
61
+
62
+ a. **Artifact status** - Run \`openspec status --change "<name>" --json\`
63
+ - Parse \`schemaName\`, \`artifacts\`, \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`
64
+ - Note which artifacts are \`done\` vs other states
65
+
66
+ b. **Task completion** - Read \`artifactPaths.tasks.existingOutputPaths\` from status JSON
67
+ - Count \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
68
+ - If no tasks file exists, note as "No tasks"
69
+
70
+ c. **Delta specs** - Check \`artifactPaths.specs.existingOutputPaths\` from status JSON
71
+ - List which capability specs exist
72
+ - For each, extract requirement names (lines matching \`### Requirement: <name>\`)
73
+ - Treat this list as the only delta-spec source. If the \`specs\` entry is
74
+ missing or the list is empty, perform no spec sync or specs-instruction
75
+ lookup for that change; do not infer deltas from unrelated artifacts.
76
+ - Evaluate this independently for every change, including mixed-schema
77
+ batches where some schemas have no \`specs\` artifact.
78
+ 4. **Detect spec conflicts**
79
+
80
+ Build a map keyed by \`<capability-path>\`, the exact path relative to \`specs/\`:
81
+
82
+ \`\`\`text
83
+ identity/user-auth -> [change-a, change-b] <- CONFLICT (2+ changes)
84
+ billing/user-auth -> [change-c] <- OK (different full path)
85
+ \`\`\`
86
+
87
+ A conflict exists when 2+ selected changes have delta specs for the exact same \`<capability-path>\`.
88
+
89
+ 5. **Resolve conflicts agentically**
90
+
91
+ **For each conflict**, investigate the codebase:
92
+
93
+ a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify
94
+
95
+ b. **Search the codebase** for implementation evidence:
96
+ - Look for code implementing requirements from each delta spec
97
+ - Check for related files, functions, or tests
98
+
99
+ c. **Determine resolution**:
100
+ - If only one change is actually implemented -> sync that one's specs
101
+ - If both implemented -> apply in chronological order (older first, newer overwrites)
102
+ - If neither implemented -> skip spec sync, warn user
103
+
104
+ d. **Record resolution** for each conflict:
105
+ - An inclusion or exclusion decision for every delta spec, keyed by change and \`<capability-path>\`
106
+ - Which included delta specs to apply and in what order
107
+ - Which delta specs to exclude from sync because their implementation is missing
108
+ - Rationale (what was found in codebase)
109
+
110
+ 6. **Show consolidated status table**
111
+
112
+ Display a table summarizing all changes:
113
+
114
+ \`\`\`markdown
115
+ | Change | Artifacts | Tasks | Specs | Conflicts | Status |
116
+ |---------------------|-----------|-------|---------|-----------|--------|
117
+ | schema-management | Done | 5/5 | 2 delta | None | Ready |
118
+ | project-config | Done | 3/3 | 1 delta | None | Ready |
119
+ | add-oauth | Done | 4/4 | 1 delta | identity/user-auth (!) | Ready* |
120
+ | add-verify-skill | 1 left | 2/5 | None | None | Warn |
121
+ \`\`\`
122
+
123
+ For conflicts, show the resolution:
124
+ \`\`\`text
125
+ * Conflict resolution:
126
+ - identity/user-auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
127
+ \`\`\`
128
+
129
+ For incomplete changes, show warnings:
130
+ \`\`\`text
131
+ Warnings:
132
+ - add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
133
+ \`\`\`
134
+
135
+ 7. **Confirm batch operation**
136
+
137
+ Ask the user a single confirmation question:
138
+
139
+ - "Archive N changes?" with options based on status
140
+ - Options might include:
141
+ - "Archive all N changes"
142
+ - "Archive only N ready changes (skip incomplete)"
143
+ - "Cancel"
144
+
145
+ If there are incomplete changes, make clear they'll be archived with warnings.
146
+
147
+ Route on the answer by intent, not by exact label — you wrote these labels,
148
+ so match what the user picked rather than the wording above:
149
+ - "Cancel" — stop, do not archive. Report that nothing was archived and skip the remaining steps.
150
+ - The archive-everything option — proceed with every selected change
151
+ - The ready-only option — proceed with only the changes the step 6 table marks \`Ready\` or \`Ready*\`, and record the rest as Skipped in step 8d. If a \`Ready*\` change's conflict partner is skipped, re-derive that conflict's resolution using only the changes being archived.
152
+ - Anything else — ask again rather than archiving
153
+
154
+ Before step 8 writes the first main spec or moves any change, fetch every
155
+ required specs-rule snapshot for the confirmed batch. For each change that will
156
+ sync concrete \`artifactPaths.specs.existingOutputPaths\`, run
157
+ \`openspec instructions specs --change "<name>" --json\` exactly once with the
158
+ same selected-root flags. Obtain all snapshots before the first write or move.
159
+ If any lookup exits non-zero or returns invalid artifact-instruction JSON,
160
+ identify the affected change, report the error, and stop the whole batch before
161
+ any main-spec write or change move. Do not treat lookup failure as omitted
162
+ rules. A valid response without \`rules\` is the no-rules case.
163
+
164
+ 8. **Execute archive for each confirmed change**
165
+
166
+ Before processing, carry the recorded decisions from step 5 (after any step 7 re-derivation) into two per-delta sets:
167
+ - \`includedDeltas\`: all non-conflicting delta specs from confirmed changes plus conflict deltas selected for sync
168
+ - \`excludedDeltas\`: conflict deltas from confirmed changes excluded because their implementation is missing
169
+ - A single change can have both included and excluded delta specs. Keep the decision per delta; do not collapse it into a per-change sync flag.
170
+
171
+ Process changes in the determined order (respecting conflict resolution):
172
+
173
+ a. **Sync included delta specs**:
174
+ - Run the \`openspec-sync-specs\` workflow inline (agent-driven intelligent merge) only for changes with entries in \`includedDeltas\`, passing only the included delta paths and explicitly instructing it to ignore that change's \`excludedDeltas\`. Wait for it to finish.
175
+ - For conflicts, apply in resolved order.
176
+ - Pass that change's fetched specs-rule snapshot into inline sync; inline
177
+ sync must reuse it without fetching instructions again
178
+ - Apply artifact rules only to main specs produced by that change. They do
179
+ not change conflict resolution, archive behavior, or CLI contracts, and
180
+ their text is not copied into an output file
181
+ - Do not delegate to a background task — step 8c would move \`changeRoot\` out from under a sync that is still reading it.
182
+ - If a change has no included delta specs, do not run the sync workflow for it.
183
+
184
+ b. **Verify included delta specs before moving changeRoot**:
185
+ - Re-run the comparison only for delta specs in \`includedDeltas\` against main spec at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` (use the store-aware \`planningHome.root\` from step 3 status JSON, not a hardcoded repo path).
186
+ - Verify that main specs are updated:
187
+ - ADDED requirements present
188
+ - MODIFIED requirements carrying scenario and description changes named in the delta, with their other scenarios intact
189
+ - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving \`## Requirements\` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
190
+ - RENAMED requirements present under the new name and absent under the old one
191
+ - Do not verify delta specs in \`excludedDeltas\`; they are intentionally left unsynced.
192
+ - If sync failed or any capability does not match verification, report what differs and fail/skip moving that change's \`changeRoot\` — do not archive that change. \`changeRoot\` remains intact.
193
+
194
+ c. **Perform the archive**:
195
+
196
+ Target name: use the change name as-is when it already starts with a \`YYYY-MM-DD-\` prefix; otherwise prepend the current date as \`YYYY-MM-DD-<name>\` (same rule as \`openspec archive\`).
197
+
198
+ \`\`\`bash
199
+ mkdir -p "<planningHome.changesDir>/archive"
200
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
201
+ \`\`\`
202
+
203
+ d. **Track outcome** for each change:
204
+ - Success: archived successfully
205
+ - Failed: error during archive or spec verification (record error)
206
+ - Skipped: user chose not to archive (if applicable)
207
+ - Sync skipped: for every delta in \`excludedDeltas\`, report \`sync skipped\` with the change, \`<capability-path>\`, and recorded reason. This is distinct from skipping the archive.
208
+
209
+ 9. **Display summary**
210
+
211
+ Show final results:
212
+
213
+ \`\`\`markdown
214
+ ## Bulk Archive Complete
215
+
216
+ Archived 3 changes:
217
+ - schema-management-cli -> archive/2026-01-19-schema-management-cli/
218
+ - project-config -> archive/2026-01-19-project-config/
219
+ - add-oauth -> archive/2026-01-19-add-oauth/
220
+
221
+ Skipped 1 change:
222
+ - add-verify-skill (user chose not to archive incomplete)
223
+
224
+ Spec sync summary:
225
+ - 4 delta specs synced to main specs
226
+ - 1 delta spec sync skipped (add-jwt, identity/user-auth: implementation not found)
227
+ - 1 conflict resolved (identity/user-auth: synced add-oauth, skipped add-jwt)
228
+ \`\`\`
229
+
230
+ If any failures:
231
+ \`\`\`text
232
+ Failed 1 change:
233
+ - some-change: Archive directory already exists
234
+ \`\`\`
235
+
236
+ **Conflict Resolution Examples**
237
+
238
+ Example 1: Only one implemented
239
+ \`\`\`text
240
+ Conflict: <planningHome.root>/openspec/specs/auth/spec.md touched by [add-oauth, add-jwt]
241
+
242
+ Checking add-oauth:
243
+ - Delta adds "OAuth Provider Integration" requirement
244
+ - Searching codebase... found src/auth/oauth.ts implementing OAuth flow
245
+
246
+ Checking add-jwt:
247
+ - Delta adds "JWT Token Handling" requirement
248
+ - Searching codebase... no JWT implementation found
249
+
250
+ Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
251
+ \`\`\`
252
+
253
+ Example 2: Both implemented
254
+ \`\`\`text
255
+ Conflict: <planningHome.root>/openspec/specs/api/spec.md touched by [add-rest-api, add-graphql]
256
+
257
+ Checking add-rest-api (created 2026-01-10):
258
+ - Delta adds "REST Endpoints" requirement
259
+ - Searching codebase... found src/api/rest.ts
260
+
261
+ Checking add-graphql (created 2026-01-15):
262
+ - Delta adds "GraphQL Schema" requirement
263
+ - Searching codebase... found src/api/graphql.ts
264
+
265
+ Resolution: Both implemented. Will apply add-rest-api specs first,
266
+ then add-graphql specs (chronological order, newer takes precedence).
267
+ \`\`\`
268
+
269
+ **Output On Success**
270
+
271
+ \`\`\`markdown
272
+ ## Bulk Archive Complete
273
+
274
+ Archived N changes:
275
+ - <change-1> -> archive/<target-name-1>/
276
+ - <change-2> -> archive/<target-name-2>/
277
+
278
+ Spec sync summary:
279
+ - N delta specs synced to main specs
280
+ - No conflicts (or: M conflicts resolved)
281
+ \`\`\`
282
+
283
+ **Output On Partial Success**
284
+
285
+ \`\`\`markdown
286
+ ## Bulk Archive Complete (partial)
287
+
288
+ Archived N changes:
289
+ - <change-1> -> archive/<target-name-1>/
290
+
291
+ Skipped M changes:
292
+ - <change-2> (user chose not to archive incomplete)
293
+
294
+ Failed K changes:
295
+ - <change-3>: Archive directory already exists
296
+ \`\`\`
297
+
298
+ **Output When No Changes**
299
+
300
+ \`\`\`markdown
301
+ ## No Changes to Archive
302
+
303
+ No active changes found. Create a new change to get started.
304
+ \`\`\`
305
+
306
+ **Guardrails**
307
+ - Allow any number of changes (1+ is fine, 2+ is the typical use case)
308
+ - Always prompt for selection, never auto-select
309
+ - Detect spec conflicts early and resolve by checking codebase
310
+ - When both changes are implemented, apply specs in chronological order
311
+ - Skip spec sync only when implementation is missing (warn user)
312
+ - Show clear per-change status before confirming
313
+ - Use single confirmation for entire batch
314
+ - Never archive after the user cancels the confirmation — a cancelled batch archives nothing
315
+ - Track and report all outcomes (success/skip/fail)
316
+ - Preserve .openspec.yaml when moving to archive
317
+ - Archive directory target uses current date: YYYY-MM-DD-<name>; a name that already starts with a \`YYYY-MM-DD-\` prefix is used as-is (never stack a second date)
318
+ - If archive target exists, fail that change but continue with others
319
+ - If sync is requested, run the \`openspec-sync-specs\` workflow inline (agent-driven) for each change with included delta specs
320
+ - Carry the per-delta \`includedDeltas\` and \`excludedDeltas\` decisions into execution; sync and verify only included deltas
321
+ - Report every excluded delta as \`sync skipped\` without treating the archive itself as skipped
322
+ - Never archive a change while a spec sync is still in flight — run the sync inline and verify main specs at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` before moving \`changeRoot\`
323
+ - Fetch archive inputs once per selected root before spec inspection or moves
324
+ - Fetch all required specs-rule snapshots before the batch's first main-spec write or move
325
+ - A failed archive-inputs lookup never blocks the batch; it proceeds with no context or guidance
326
+ - A failed specs instruction lookup stops the whole batch atomically
327
+ - Changes without concrete \`artifactPaths.specs.existingOutputPaths\` continue without spec sync
328
+ - Apply relevant runtime context across the batch and report conflicts
329
+ - Operation guidance remains advisory; consider every entry and explain rejected advice
330
+ - Keep runtime inputs, conflict analysis, CLI-derived values, and artifact rules separate
331
+ - Artifact rules constrain only written specs
332
+ - Never copy runtime input or artifact-rule text verbatim into output files`,
333
+ license: 'MIT',
334
+ compatibility: 'Requires openspec CLI.',
335
+ metadata: { author: 'openspec', version: '1.0' },
336
+ };
337
+ }
338
+ export function getOpsxBulkArchiveCommandTemplate() {
339
+ return {
340
+ name: 'OPSX: Bulk Archive',
341
+ description: 'Archive multiple completed changes at once',
342
+ category: 'Workflow',
343
+ tags: ['workflow', 'archive', 'experimental', 'bulk'],
344
+ content: `Archive multiple completed changes in a single operation.
345
+
346
+ This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
347
+
348
+ ${STORE_SELECTION_GUIDANCE}
349
+
350
+ \`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve the full path from each delta spec when resolving its main spec.
351
+
352
+ **Input**: None required (prompts for selection)
353
+
354
+ **Steps**
355
+
356
+ 1. **Get active changes**
357
+
358
+ Run \`openspec list --json\` to get all active changes.
359
+
360
+ If no active changes exist, inform user and stop.
361
+
362
+ 2. **Prompt for change selection**
363
+
364
+ Ask the user to choose changes (multi-select):
365
+ - Show each change with its schema
366
+ - Include an option for "All changes"
367
+ - Allow any number of selections (1+ works, 2+ is the typical use case)
368
+
369
+ **IMPORTANT**: Do NOT auto-select. Always let the user choose.
370
+
371
+ **Load current archive inputs once for the selected root before batch validation:**
372
+
373
+ Choose one selected change from this root and run
374
+ \`openspec instructions archive --change "<selected-change>" --json\` with the
375
+ same selected-root flags. This lookup is advisory and optional: it only supplies
376
+ extra prompt inputs, so it must never block the batch. If it fails or returns
377
+ invalid JSON — for example on an older CLI that does not support this command
378
+ yet — continue the batch with no context and no operation guidance. Do not
379
+ report an error and do not stop.
380
+
381
+ A valid response may omit \`context\` and \`operationGuidance\`. Treat
382
+ \`context\` as a required prompt-level input across the batch: read and consider
383
+ it, and apply relevant project facts, conventions, and constraints. Treat
384
+ \`operationGuidance\` as optional additive advice: read and consider every
385
+ entry, and follow entries that are applicable and compatible with the built-in
386
+ batch workflow.
387
+
388
+ Keep both fields separate from conflict analysis, explicit user choices,
389
+ resolved paths, CLI checks, and command contracts. If context conflicts with one
390
+ of those controlling inputs, report the conflict and preserve the controlling
391
+ value. If guidance is inapplicable or conflicts with a controlling input, do not
392
+ follow it and explain why. Do not infer skipped prompts, replacement paths, or
393
+ flags from either field, and do not copy their text verbatim into specs, changes,
394
+ or summaries. These are prompt-level behavior contracts, not enforceable checks.
395
+
396
+ 3. **Batch validation - gather status for all selected changes**
397
+
398
+ For each selected change, collect:
399
+
400
+ a. **Artifact status** - Run \`openspec status --change "<name>" --json\`
401
+ - Parse \`schemaName\`, \`artifacts\`, \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`
402
+ - Note which artifacts are \`done\` vs other states
403
+
404
+ b. **Task completion** - Read \`artifactPaths.tasks.existingOutputPaths\` from status JSON
405
+ - Count \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
406
+ - If no tasks file exists, note as "No tasks"
407
+
408
+ c. **Delta specs** - Check \`artifactPaths.specs.existingOutputPaths\` from status JSON
409
+ - List which capability specs exist
410
+ - For each, extract requirement names (lines matching \`### Requirement: <name>\`)
411
+ - Treat this list as the only delta-spec source. If the \`specs\` entry is
412
+ missing or the list is empty, perform no spec sync or specs-instruction
413
+ lookup for that change; do not infer deltas from unrelated artifacts.
414
+ - Evaluate this independently for every change, including mixed-schema
415
+ batches where some schemas have no \`specs\` artifact.
416
+
417
+ 4. **Detect spec conflicts**
418
+
419
+ Build a map keyed by \`<capability-path>\`, the exact path relative to \`specs/\`:
420
+
421
+ \`\`\`text
422
+ identity/user-auth -> [change-a, change-b] <- CONFLICT (2+ changes)
423
+ billing/user-auth -> [change-c] <- OK (different full path)
424
+ \`\`\`
425
+
426
+ A conflict exists when 2+ selected changes have delta specs for the exact same \`<capability-path>\`.
427
+
428
+ 5. **Resolve conflicts agentically**
429
+
430
+ **For each conflict**, investigate the codebase:
431
+
432
+ a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify
433
+
434
+ b. **Search the codebase** for implementation evidence:
435
+ - Look for code implementing requirements from each delta spec
436
+ - Check for related files, functions, or tests
437
+
438
+ c. **Determine resolution**:
439
+ - If only one change is actually implemented -> sync that one's specs
440
+ - If both implemented -> apply in chronological order (older first, newer overwrites)
441
+ - If neither implemented -> skip spec sync, warn user
442
+
443
+ d. **Record resolution** for each conflict:
444
+ - An inclusion or exclusion decision for every delta spec, keyed by change and \`<capability-path>\`
445
+ - Which included delta specs to apply and in what order
446
+ - Which delta specs to exclude from sync because their implementation is missing
447
+ - Rationale (what was found in codebase)
448
+
449
+ 6. **Show consolidated status table**
450
+
451
+ Display a table summarizing all changes:
452
+
453
+ \`\`\`markdown
454
+ | Change | Artifacts | Tasks | Specs | Conflicts | Status |
455
+ |---------------------|-----------|-------|---------|-----------|--------|
456
+ | schema-management | Done | 5/5 | 2 delta | None | Ready |
457
+ | project-config | Done | 3/3 | 1 delta | None | Ready |
458
+ | add-oauth | Done | 4/4 | 1 delta | identity/user-auth (!) | Ready* |
459
+ | add-verify-skill | 1 left | 2/5 | None | None | Warn |
460
+ \`\`\`
461
+
462
+ For conflicts, show the resolution:
463
+ \`\`\`text
464
+ * Conflict resolution:
465
+ - identity/user-auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
466
+ \`\`\`
467
+
468
+ For incomplete changes, show warnings:
469
+ \`\`\`text
470
+ Warnings:
471
+ - add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
472
+ \`\`\`
473
+
474
+ 7. **Confirm batch operation**
475
+
476
+ Ask the user a single confirmation question:
477
+
478
+ - "Archive N changes?" with options based on status
479
+ - Options might include:
480
+ - "Archive all N changes"
481
+ - "Archive only N ready changes (skip incomplete)"
482
+ - "Cancel"
483
+
484
+ If there are incomplete changes, make clear they'll be archived with warnings.
485
+
486
+ Route on the answer by intent, not by exact label — you wrote these labels,
487
+ so match what the user picked rather than the wording above:
488
+ - "Cancel" — stop, do not archive. Report that nothing was archived and skip the remaining steps.
489
+ - The archive-everything option — proceed with every selected change
490
+ - The ready-only option — proceed with only the changes the step 6 table marks \`Ready\` or \`Ready*\`, and record the rest as Skipped in step 8d. If a \`Ready*\` change's conflict partner is skipped, re-derive that conflict's resolution using only the changes being archived.
491
+ - Anything else — ask again rather than archiving
492
+
493
+ Before step 8 writes the first main spec or moves any change, fetch every
494
+ required specs-rule snapshot for the confirmed batch. For each change that will
495
+ sync concrete \`artifactPaths.specs.existingOutputPaths\`, run
496
+ \`openspec instructions specs --change "<name>" --json\` exactly once with the
497
+ same selected-root flags. Obtain all snapshots before the first write or move.
498
+ If any lookup exits non-zero or returns invalid artifact-instruction JSON,
499
+ identify the affected change, report the error, and stop the whole batch before
500
+ any main-spec write or change move. Do not treat lookup failure as omitted
501
+ rules. A valid response without \`rules\` is the no-rules case.
502
+
503
+ 8. **Execute archive for each confirmed change**
504
+
505
+ Before processing, carry the recorded decisions from step 5 (after any step 7 re-derivation) into two per-delta sets:
506
+ - \`includedDeltas\`: all non-conflicting delta specs from confirmed changes plus conflict deltas selected for sync
507
+ - \`excludedDeltas\`: conflict deltas from confirmed changes excluded because their implementation is missing
508
+ - A single change can have both included and excluded delta specs. Keep the decision per delta; do not collapse it into a per-change sync flag.
509
+
510
+ Process changes in the determined order (respecting conflict resolution):
511
+
512
+ a. **Sync included delta specs**:
513
+ - Run the \`/opsx:sync\` workflow inline (agent-driven intelligent merge) only for changes with entries in \`includedDeltas\`, passing only the included delta paths and explicitly instructing it to ignore that change's \`excludedDeltas\`. Wait for it to finish.
514
+ - For conflicts, apply in resolved order.
515
+ - Pass that change's fetched specs-rule snapshot into inline sync; inline
516
+ sync must reuse it without fetching instructions again
517
+ - Apply artifact rules only to main specs produced by that change. They do
518
+ not change conflict resolution, archive behavior, or CLI contracts, and
519
+ their text is not copied into an output file
520
+ - Do not delegate to a background task — step 8c would move \`changeRoot\` out from under a sync that is still reading it.
521
+ - If a change has no included delta specs, do not run the sync workflow for it.
522
+
523
+ b. **Verify included delta specs before moving changeRoot**:
524
+ - Re-run the comparison only for delta specs in \`includedDeltas\` against main spec at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` (use the store-aware \`planningHome.root\` from step 3 status JSON, not a hardcoded repo path).
525
+ - Verify that main specs are updated:
526
+ - ADDED requirements present
527
+ - MODIFIED requirements carrying scenario and description changes named in the delta, with their other scenarios intact
528
+ - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving \`## Requirements\` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
529
+ - RENAMED requirements present under the new name and absent under the old one
530
+ - Do not verify delta specs in \`excludedDeltas\`; they are intentionally left unsynced.
531
+ - If sync failed or any capability does not match verification, report what differs and fail/skip moving that change's \`changeRoot\` — do not archive that change. \`changeRoot\` remains intact.
532
+
533
+ c. **Perform the archive**:
534
+
535
+ Target name: use the change name as-is when it already starts with a \`YYYY-MM-DD-\` prefix; otherwise prepend the current date as \`YYYY-MM-DD-<name>\` (same rule as \`openspec archive\`).
536
+
537
+ \`\`\`bash
538
+ mkdir -p "<planningHome.changesDir>/archive"
539
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
540
+ \`\`\`
541
+
542
+ d. **Track outcome** for each change:
543
+ - Success: archived successfully
544
+ - Failed: error during archive or spec verification (record error)
545
+ - Skipped: user chose not to archive (if applicable)
546
+ - Sync skipped: for every delta in \`excludedDeltas\`, report \`sync skipped\` with the change, \`<capability-path>\`, and recorded reason. This is distinct from skipping the archive.
547
+
548
+ 9. **Display summary**
549
+
550
+ Show final results:
551
+
552
+ \`\`\`markdown
553
+ ## Bulk Archive Complete
554
+
555
+ Archived 3 changes:
556
+ - schema-management-cli -> archive/2026-01-19-schema-management-cli/
557
+ - project-config -> archive/2026-01-19-project-config/
558
+ - add-oauth -> archive/2026-01-19-add-oauth/
559
+
560
+ Skipped 1 change:
561
+ - add-verify-skill (user chose not to archive incomplete)
562
+
563
+ Spec sync summary:
564
+ - 4 delta specs synced to main specs
565
+ - 1 delta spec sync skipped (add-jwt, identity/user-auth: implementation not found)
566
+ - 1 conflict resolved (identity/user-auth: synced add-oauth, skipped add-jwt)
567
+ \`\`\`
568
+
569
+ If any failures:
570
+ \`\`\`text
571
+ Failed 1 change:
572
+ - some-change: Archive directory already exists
573
+ \`\`\`
574
+
575
+ **Conflict Resolution Examples**
576
+
577
+ Example 1: Only one implemented
578
+ \`\`\`text
579
+ Conflict: <planningHome.root>/openspec/specs/auth/spec.md touched by [add-oauth, add-jwt]
580
+
581
+ Checking add-oauth:
582
+ - Delta adds "OAuth Provider Integration" requirement
583
+ - Searching codebase... found src/auth/oauth.ts implementing OAuth flow
584
+
585
+ Checking add-jwt:
586
+ - Delta adds "JWT Token Handling" requirement
587
+ - Searching codebase... no JWT implementation found
588
+
589
+ Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
590
+ \`\`\`
591
+
592
+ Example 2: Both implemented
593
+ \`\`\`text
594
+ Conflict: <planningHome.root>/openspec/specs/api/spec.md touched by [add-rest-api, add-graphql]
595
+
596
+ Checking add-rest-api (created 2026-01-10):
597
+ - Delta adds "REST Endpoints" requirement
598
+ - Searching codebase... found src/api/rest.ts
599
+
600
+ Checking add-graphql (created 2026-01-15):
601
+ - Delta adds "GraphQL Schema" requirement
602
+ - Searching codebase... found src/api/graphql.ts
603
+
604
+ Resolution: Both implemented. Will apply add-rest-api specs first,
605
+ then add-graphql specs (chronological order, newer takes precedence).
606
+ \`\`\`
607
+
608
+ **Output On Success**
609
+
610
+ \`\`\`markdown
611
+ ## Bulk Archive Complete
612
+
613
+ Archived N changes:
614
+ - <change-1> -> archive/<target-name-1>/
615
+ - <change-2> -> archive/<target-name-2>/
616
+
617
+ Spec sync summary:
618
+ - N delta specs synced to main specs
619
+ - No conflicts (or: M conflicts resolved)
620
+ \`\`\`
621
+
622
+ **Output On Partial Success**
623
+
624
+ \`\`\`markdown
625
+ ## Bulk Archive Complete (partial)
626
+
627
+ Archived N changes:
628
+ - <change-1> -> archive/<target-name-1>/
629
+
630
+ Skipped M changes:
631
+ - <change-2> (user chose not to archive incomplete)
632
+
633
+ Failed K changes:
634
+ - <change-3>: Archive directory already exists
635
+ \`\`\`
636
+
637
+ **Output When No Changes**
638
+
639
+ \`\`\`markdown
640
+ ## No Changes to Archive
641
+
642
+ No active changes found. Create a new change to get started.
643
+ \`\`\`
644
+
645
+ **Guardrails**
646
+ - Allow any number of changes (1+ is fine, 2+ is the typical use case)
647
+ - Always prompt for selection, never auto-select
648
+ - Detect spec conflicts early and resolve by checking codebase
649
+ - When both changes are implemented, apply specs in chronological order
650
+ - Skip spec sync only when implementation is missing (warn user)
651
+ - Show clear per-change status before confirming
652
+ - Use single confirmation for entire batch
653
+ - Never archive after the user cancels the confirmation — a cancelled batch archives nothing
654
+ - Track and report all outcomes (success/skip/fail)
655
+ - Preserve .openspec.yaml when moving to archive
656
+ - Archive directory target uses current date: YYYY-MM-DD-<name>; a name that already starts with a \`YYYY-MM-DD-\` prefix is used as-is (never stack a second date)
657
+ - If archive target exists, fail that change but continue with others
658
+ - If sync is requested, run the \`/opsx:sync\` workflow inline (agent-driven) for each change with included delta specs
659
+ - Carry the per-delta \`includedDeltas\` and \`excludedDeltas\` decisions into execution; sync and verify only included deltas
660
+ - Report every excluded delta as \`sync skipped\` without treating the archive itself as skipped
661
+ - Never archive a change while a spec sync is still in flight — run the sync inline and verify main specs at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` before moving \`changeRoot\`
662
+ - Fetch archive inputs once per selected root before spec inspection or moves
663
+ - Fetch all required specs-rule snapshots before the batch's first main-spec write or move
664
+ - A failed archive-inputs lookup never blocks the batch; it proceeds with no context or guidance
665
+ - A failed specs instruction lookup stops the whole batch atomically
666
+ - Changes without concrete \`artifactPaths.specs.existingOutputPaths\` continue without spec sync
667
+ - Apply relevant runtime context across the batch and report conflicts
668
+ - Operation guidance remains advisory; consider every entry and explain rejected advice
669
+ - Keep runtime inputs, conflict analysis, CLI-derived values, and artifact rules separate
670
+ - Artifact rules constrain only written specs
671
+ - Never copy runtime input or artifact-rule text verbatim into output files`
672
+ };
673
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Skill Template Workflow Modules
3
+ *
4
+ * This file is generated by splitting the legacy monolithic
5
+ * templates file into workflow-focused modules.
6
+ */
7
+ import type { SkillTemplate, CommandTemplate } from '../types.js';
8
+ export declare function getContinueChangeSkillTemplate(): SkillTemplate;
9
+ export declare function getOpsxContinueCommandTemplate(): CommandTemplate;