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,409 @@
1
+ import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
2
+ export function getArchiveChangeSkillTemplate() {
3
+ return {
4
+ name: 'openspec-archive-change',
5
+ description: 'Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.',
6
+ instructions: `Archive a completed change in the experimental workflow.
7
+
8
+ ${STORE_SELECTION_GUIDANCE}
9
+
10
+ \`<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.
11
+
12
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
13
+
14
+ **Steps**
15
+
16
+ 1. **Select the change**
17
+
18
+ If a name is provided, use it. Otherwise:
19
+ - Infer from conversation context if the user mentioned a change
20
+ - Auto-select if only one active change exists
21
+ - If ambiguous, run \`openspec list --json\` to get available changes and ask the user to select one
22
+
23
+ When prompting, show only active changes (not already archived).
24
+ Include the schema used for each change if available.
25
+
26
+ Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:archive <other>\`).
27
+
28
+ **Load current archive inputs before the existing archive checks:**
29
+
30
+ After resolving the selected change and planning root, run:
31
+ \`\`\`bash
32
+ openspec instructions archive --change "<name>" --json
33
+ \`\`\`
34
+ Keep the same selected-root flags on this command. This lookup is advisory and
35
+ optional: it only supplies extra prompt inputs, so it must never block archiving.
36
+ If it exits non-zero or returns invalid JSON — for example on an older CLI that
37
+ does not support this command yet — continue the archive workflow with no
38
+ context and no operation guidance. Do not report an error and do not stop.
39
+
40
+ A successful response may omit both optional fields. Treat \`context\` as a
41
+ required prompt-level input: read and consider it, and apply relevant project
42
+ facts, conventions, and constraints. Treat \`operationGuidance\` as optional
43
+ additive advice: read and consider every entry, and follow entries that are
44
+ applicable and compatible with the built-in archive workflow.
45
+
46
+ Keep both fields separate from built-in steps, explicit user choices, resolved
47
+ paths, CLI checks, and command contracts. If context conflicts with one of those
48
+ controlling inputs, report the conflict and preserve the controlling value. If
49
+ guidance is inapplicable or conflicts with a controlling input, do not follow it
50
+ and explain why. Do not infer replacement paths, skipped prompts, or flags from
51
+ either field, and do not copy their text verbatim into specs, change artifacts,
52
+ or archive summaries unless the user separately asks for it. These are
53
+ prompt-level behavior contracts, not enforceable checks.
54
+
55
+ 2. **Check artifact completion status**
56
+
57
+ Run \`openspec status --change "<name>" --json\` to check artifact completion.
58
+
59
+ Parse the JSON to understand:
60
+ - \`schemaName\`: The workflow being used
61
+ - \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context
62
+ - \`artifacts\`: List of artifacts with their status (\`done\`, \`skipped\`, or other)
63
+
64
+ **If any artifacts are neither \`done\` nor \`skipped\`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
65
+ - Display warning listing incomplete artifacts
66
+ - Ask the user to confirm they want to proceed
67
+ - Proceed if user confirms
68
+
69
+ 3. **Check task completion status**
70
+
71
+ Read the tasks file (typically \`tasks.md\`) to check for incomplete tasks.
72
+
73
+ Count tasks marked with \`- [ ]\` (incomplete) vs \`- [x]\` (complete).
74
+
75
+ **If incomplete tasks found:**
76
+ - Display warning showing count of incomplete tasks
77
+ - Ask the user to confirm they want to proceed
78
+ - Proceed if user confirms
79
+
80
+ **If no tasks file exists:** Proceed without task-related warning.
81
+
82
+ 4. **Assess delta spec sync state**
83
+
84
+ Use \`artifactPaths.specs.existingOutputPaths\` from status JSON as the only
85
+ delta-spec source. If the \`specs\` entry is missing or
86
+ \`existingOutputPaths\` is empty, proceed without a sync prompt and do not infer
87
+ delta specs from other artifacts.
88
+
89
+ **If delta specs exist:**
90
+ - Compare each delta spec with its corresponding main spec at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` (use the store-aware \`planningHome.root\` from step 2, not a hardcoded repo path)
91
+ - Determine what changes would be applied (adds, modifications, removals, renames)
92
+ - Show a combined summary before prompting
93
+
94
+ **Prompt options:**
95
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
96
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
97
+
98
+ Route on the answer:
99
+ - "Cancel" — stop, do not archive
100
+ - "Archive without syncing" or "Archive now" — proceed to archive
101
+ - "Sync now" or "Sync anyway" — sync, then verify (below)
102
+ - Anything else — ask again rather than archiving
103
+
104
+ Before a selected sync writes any main spec, run
105
+ \`openspec instructions specs --change "<name>" --json\` once with the same
106
+ selected-root flags. Require a zero exit status and valid artifact-instruction
107
+ JSON. If the lookup fails or returns invalid JSON, report the error and stop
108
+ before writing any main spec or moving the change. A valid response with omitted
109
+ \`rules\` is the no-rules case. Apply returned \`rules\` only to the content and
110
+ form of main specs produced by this merge; do not use them as archive guidance,
111
+ change CLI behavior, or copy the rule text into any output file.
112
+
113
+ Then run the \`openspec-sync-specs\` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching \`specs\` instructions again. Do not delegate it to a background task — step 5 would move \`changeRoot\` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
114
+
115
+ Then re-run the comparison from the top of this step against every capability that has a delta spec in \`artifactPaths.specs.existingOutputPaths\` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
116
+ - ADDED requirements present
117
+ - MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
118
+ - 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
119
+ - RENAMED requirements present under the new name and absent under the old one
120
+
121
+ If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and \`changeRoot\` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
122
+
123
+ 5. **Perform the archive**
124
+ **Supersession check (FreeHarness)**: before moving anything, search \`openspec/specs\` and \`openspec/changes/archive\` for a decision or mechanism this change replaces. If the design.md carries a \`Supersedes: <change-id>\` line, \`openspec archive\` prints the supersession link, writes \`Superseded-by: <change>\` into the archived record's design.md, and refuses when a MODIFIED requirement repeats the superseded text unchanged (a published decision is never edited in place). If the check finds a superseded decision the design does not name, add the \`Supersedes:\` line first. A partially superseded decision stays active and cross-linked. Report the links in the summary.
125
+
126
+
127
+ Create an \`archive\` directory under \`planningHome.changesDir\` if it doesn't exist:
128
+ \`\`\`bash
129
+ mkdir -p "<planningHome.changesDir>/archive"
130
+ \`\`\`
131
+
132
+ Generate the 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-<change-name>\`. Never stack a second date (same rule as \`openspec archive\`).
133
+
134
+ **Check if target already exists:**
135
+ - If yes: Fail with error, suggest renaming existing archive or using different date
136
+ - If no: Move \`changeRoot\` to the archive directory
137
+
138
+ \`\`\`bash
139
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
140
+ \`\`\`
141
+
142
+ 6. **Display summary**
143
+
144
+ Show archive completion summary including:
145
+ - Change name
146
+ - Schema that was used
147
+ - Archive location
148
+ - Whether specs were synced (if applicable)
149
+ - Note about any warnings (incomplete artifacts/tasks)
150
+
151
+ **Output On Success**
152
+
153
+ \`\`\`markdown
154
+ ## Archive Complete
155
+
156
+ **Change:** <change-name>
157
+ **Schema:** <schema-name>
158
+ **Archived to:** the archive path derived from \`planningHome.changesDir\`/<target-name>/
159
+ **Specs:** <"✓ Synced to main specs" only if the step 4 verification passed; otherwise "No delta specs" or "Sync skipped">
160
+
161
+ <"All artifacts complete. All tasks complete." — or, if archived with warnings, list them instead (e.g. "Archived with 2 incomplete tasks")>
162
+ \`\`\`
163
+
164
+ **Guardrails**
165
+ - Announce the selected change; prompt for selection when it is ambiguous
166
+ - Use artifact graph (openspec status --json) for completion checking
167
+ - Don't block archive on warnings - just inform and confirm
168
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
169
+ - Show clear summary of what happened
170
+ - If sync is requested, run the \`openspec-sync-specs\` workflow inline (agent-driven)
171
+ - Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving \`changeRoot\`
172
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting
173
+ - Apply relevant runtime context and report conflicts; operation guidance remains advisory
174
+ - Consider every guidance entry and explain any inapplicable or conflicting advice
175
+ - Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
176
+ - Artifact rules constrain only the specs being written and are never operation guidance
177
+ - Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files`,
178
+ license: 'MIT',
179
+ compatibility: 'Requires openspec CLI.',
180
+ metadata: { author: 'openspec', version: '1.0' },
181
+ };
182
+ }
183
+ export function getOpsxArchiveCommandTemplate() {
184
+ return {
185
+ name: 'OPSX: Archive',
186
+ description: 'Archive a completed change in the experimental workflow',
187
+ category: 'Workflow',
188
+ tags: ['workflow', 'archive', 'experimental'],
189
+ content: `Archive a completed change in the experimental workflow.
190
+
191
+ ${STORE_SELECTION_GUIDANCE}
192
+
193
+ \`<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.
194
+
195
+ **Input**: Optionally specify a change name after \`/opsx:archive\` (e.g., \`/opsx:archive add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
196
+
197
+ **Steps**
198
+
199
+ 1. **Select the change**
200
+
201
+ If a name is provided, use it. Otherwise:
202
+ - Infer from conversation context if the user mentioned a change
203
+ - Auto-select if only one active change exists
204
+ - If ambiguous, run \`openspec list --json\` to get available changes and ask the user to select one
205
+
206
+ When prompting, show only active changes (not already archived).
207
+ Include the schema used for each change if available.
208
+
209
+ Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:archive <other>\`).
210
+
211
+ **Load current archive inputs before the existing archive checks:**
212
+
213
+ After resolving the selected change and planning root, run:
214
+ \`\`\`bash
215
+ openspec instructions archive --change "<name>" --json
216
+ \`\`\`
217
+ Keep the same selected-root flags on this command. This lookup is advisory and
218
+ optional: it only supplies extra prompt inputs, so it must never block archiving.
219
+ If it exits non-zero or returns invalid JSON — for example on an older CLI that
220
+ does not support this command yet — continue the archive workflow with no
221
+ context and no operation guidance. Do not report an error and do not stop.
222
+
223
+ A successful response may omit both optional fields. Treat \`context\` as a
224
+ required prompt-level input: read and consider it, and apply relevant project
225
+ facts, conventions, and constraints. Treat \`operationGuidance\` as optional
226
+ additive advice: read and consider every entry, and follow entries that are
227
+ applicable and compatible with the built-in archive workflow.
228
+
229
+ Keep both fields separate from built-in steps, explicit user choices, resolved
230
+ paths, CLI checks, and command contracts. If context conflicts with one of those
231
+ controlling inputs, report the conflict and preserve the controlling value. If
232
+ guidance is inapplicable or conflicts with a controlling input, do not follow it
233
+ and explain why. Do not infer replacement paths, skipped prompts, or flags from
234
+ either field, and do not copy their text verbatim into specs, change artifacts,
235
+ or archive summaries unless the user separately asks for it. These are
236
+ prompt-level behavior contracts, not enforceable checks.
237
+
238
+ 2. **Check artifact completion status**
239
+
240
+ Run \`openspec status --change "<name>" --json\` to check artifact completion.
241
+
242
+ Parse the JSON to understand:
243
+ - \`schemaName\`: The workflow being used
244
+ - \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context
245
+ - \`artifacts\`: List of artifacts with their status (\`done\`, \`skipped\`, or other)
246
+
247
+ **If any artifacts are neither \`done\` nor \`skipped\`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
248
+ - Display warning listing incomplete artifacts
249
+ - Prompt user for confirmation to continue
250
+ - Proceed if user confirms
251
+
252
+ 3. **Check task completion status**
253
+
254
+ Read the tasks file (typically \`tasks.md\`) to check for incomplete tasks.
255
+
256
+ Count tasks marked with \`- [ ]\` (incomplete) vs \`- [x]\` (complete).
257
+
258
+ **If incomplete tasks found:**
259
+ - Display warning showing count of incomplete tasks
260
+ - Prompt user for confirmation to continue
261
+ - Proceed if user confirms
262
+
263
+ **If no tasks file exists:** Proceed without task-related warning.
264
+
265
+ 4. **Assess delta spec sync state**
266
+
267
+ Use \`artifactPaths.specs.existingOutputPaths\` from status JSON as the only
268
+ delta-spec source. If the \`specs\` entry is missing or
269
+ \`existingOutputPaths\` is empty, proceed without a sync prompt and do not infer
270
+ delta specs from other artifacts.
271
+
272
+ **If delta specs exist:**
273
+ - Compare each delta spec with its corresponding main spec at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` (use the store-aware \`planningHome.root\` from step 2, not a hardcoded repo path)
274
+ - Determine what changes would be applied (adds, modifications, removals, renames)
275
+ - Show a combined summary before prompting
276
+
277
+ **Prompt options:**
278
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
279
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
280
+
281
+ Route on the answer:
282
+ - "Cancel" — stop, do not archive
283
+ - "Archive without syncing" or "Archive now" — proceed to archive
284
+ - "Sync now" or "Sync anyway" — sync, then verify (below)
285
+ - Anything else — ask again rather than archiving
286
+
287
+ Before a selected sync writes any main spec, run
288
+ \`openspec instructions specs --change "<name>" --json\` once with the same
289
+ selected-root flags. Require a zero exit status and valid artifact-instruction
290
+ JSON. If the lookup fails or returns invalid JSON, report the error and stop
291
+ before writing any main spec or moving the change. A valid response with omitted
292
+ \`rules\` is the no-rules case. Apply returned \`rules\` only to the content and
293
+ form of main specs produced by this merge; do not use them as archive guidance,
294
+ change CLI behavior, or copy the rule text into any output file.
295
+
296
+ Then run the \`/opsx:sync\` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching \`specs\` instructions again. Do not delegate it to a background task — step 5 would move \`changeRoot\` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
297
+
298
+ Then re-run the comparison from the top of this step against every capability that has a delta spec in \`artifactPaths.specs.existingOutputPaths\` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
299
+ - ADDED requirements present
300
+ - MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
301
+ - 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
302
+ - RENAMED requirements present under the new name and absent under the old one
303
+
304
+ If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and \`changeRoot\` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
305
+
306
+ 5. **Perform the archive**
307
+ **Supersession check (FreeHarness)**: before moving anything, search \`openspec/specs\` and \`openspec/changes/archive\` for a decision or mechanism this change replaces. If the design.md carries a \`Supersedes: <change-id>\` line, \`openspec archive\` prints the supersession link, writes \`Superseded-by: <change>\` into the archived record's design.md, and refuses when a MODIFIED requirement repeats the superseded text unchanged (a published decision is never edited in place). If the check finds a superseded decision the design does not name, add the \`Supersedes:\` line first. A partially superseded decision stays active and cross-linked. Report the links in the summary.
308
+
309
+
310
+ Create an \`archive\` directory under \`planningHome.changesDir\` if it doesn't exist:
311
+ \`\`\`bash
312
+ mkdir -p "<planningHome.changesDir>/archive"
313
+ \`\`\`
314
+
315
+ Generate the 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-<change-name>\`. Never stack a second date (same rule as \`openspec archive\`).
316
+
317
+ **Check if target already exists:**
318
+ - If yes: Fail with error, suggest renaming existing archive or using different date
319
+ - If no: Move \`changeRoot\` to the archive directory
320
+
321
+ \`\`\`bash
322
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
323
+ \`\`\`
324
+
325
+ 6. **Display summary**
326
+
327
+ Show archive completion summary including:
328
+ - Change name
329
+ - Schema that was used
330
+ - Archive location
331
+ - Spec sync status (synced / sync skipped / no delta specs)
332
+ - Note about any warnings (incomplete artifacts/tasks)
333
+
334
+ **Output On Success**
335
+
336
+ \`\`\`markdown
337
+ ## Archive Complete
338
+
339
+ **Change:** <change-name>
340
+ **Schema:** <schema-name>
341
+ **Archived to:** the archive path derived from \`planningHome.changesDir\`/<target-name>/
342
+ **Specs:** ✓ Synced to main specs
343
+
344
+ All artifacts complete. All tasks complete.
345
+ \`\`\`
346
+
347
+ **Output On Success (No Delta Specs)**
348
+
349
+ \`\`\`markdown
350
+ ## Archive Complete
351
+
352
+ **Change:** <change-name>
353
+ **Schema:** <schema-name>
354
+ **Archived to:** the archive path derived from \`planningHome.changesDir\`/<target-name>/
355
+ **Specs:** No delta specs
356
+
357
+ All artifacts complete. All tasks complete.
358
+ \`\`\`
359
+
360
+ **Output On Success With Warnings**
361
+
362
+ \`\`\`markdown
363
+ ## Archive Complete (with warnings)
364
+
365
+ **Change:** <change-name>
366
+ **Schema:** <schema-name>
367
+ **Archived to:** the archive path derived from \`planningHome.changesDir\`/<target-name>/
368
+ **Specs:** Sync skipped (user chose to skip)
369
+
370
+ **Warnings:**
371
+ - Archived with 2 incomplete artifacts
372
+ - Archived with 3 incomplete tasks
373
+ - Delta spec sync was skipped (user chose to skip)
374
+
375
+ Review the archive if this was not intentional.
376
+ \`\`\`
377
+
378
+ **Output On Error (Archive Exists)**
379
+
380
+ \`\`\`markdown
381
+ ## Archive Failed
382
+
383
+ **Change:** <change-name>
384
+ **Target:** the archive path derived from \`planningHome.changesDir\`/<target-name>/
385
+
386
+ Target archive directory already exists.
387
+
388
+ **Options:**
389
+ 1. Rename the existing archive
390
+ 2. Delete the existing archive if it's a duplicate
391
+ 3. Wait until a different date to archive
392
+ \`\`\`
393
+
394
+ **Guardrails**
395
+ - Announce the selected change; prompt for selection when it is ambiguous
396
+ - Use artifact graph (openspec status --json) for completion checking
397
+ - Don't block archive on warnings - just inform and confirm
398
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
399
+ - Show clear summary of what happened
400
+ - If sync is requested, run the \`/opsx:sync\` workflow inline (agent-driven)
401
+ - Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving \`changeRoot\`
402
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting
403
+ - Apply relevant runtime context and report conflicts; operation guidance remains advisory
404
+ - Consider every guidance entry and explain any inapplicable or conflicting advice
405
+ - Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
406
+ - Artifact rules constrain only the specs being written and are never operation guidance
407
+ - Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files`
408
+ };
409
+ }
@@ -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 getBulkArchiveChangeSkillTemplate(): SkillTemplate;
9
+ export declare function getOpsxBulkArchiveCommandTemplate(): CommandTemplate;