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.
- package/LICENSE +21 -0
- package/NOTICE +108 -0
- package/README.md +134 -0
- package/canonical/HARVEST.yaml +858 -0
- package/canonical/PROVENANCE.yaml +740 -0
- package/canonical/agents/README.md +95 -0
- package/canonical/agents/agentic-architect.md +18 -0
- package/canonical/agents/database-reviewer.md +41 -0
- package/canonical/agents/explorer-ai-engineer-analyst.md +65 -0
- package/canonical/agents/pr-reviewer.md +96 -0
- package/canonical/agents/python-reviewer.md +55 -0
- package/canonical/agents/report-formatter.md +19 -0
- package/canonical/agents/security-reviewer.md +53 -0
- package/canonical/agents/test-writer.md +34 -0
- package/canonical/commands/fh-context.md +37 -0
- package/canonical/evals/promptfoo.redteam.yaml +108 -0
- package/canonical/hooks/cost-prices.json +14 -0
- package/canonical/hooks/freeharness-auto-memory.mjs +158 -0
- package/canonical/hooks/freeharness-config-guard.mjs +162 -0
- package/canonical/hooks/freeharness-context-monitor.mjs +198 -0
- package/canonical/hooks/freeharness-converge.mjs +227 -0
- package/canonical/hooks/freeharness-cost-tracker.mjs +1027 -0
- package/canonical/hooks/freeharness-memory-guard.mjs +57 -0
- package/canonical/hooks/freeharness-output-pruner.mjs +333 -0
- package/canonical/hooks/freeharness-precompact.mjs +323 -0
- package/canonical/hooks/freeharness-repeat-tool.mjs +208 -0
- package/canonical/hooks/freeharness-security-guidance.mjs +164 -0
- package/canonical/hooks/freeharness-session-start +583 -0
- package/canonical/hooks/hooks.auto-memory.claude-code.json +16 -0
- package/canonical/hooks/hooks.claude-code.json +17 -0
- package/canonical/hooks/hooks.config-guard.claude-code.json +16 -0
- package/canonical/hooks/hooks.context-monitor.claude-code.json +15 -0
- package/canonical/hooks/hooks.converge.claude-code.json +15 -0
- package/canonical/hooks/hooks.cost-tracker.claude-code.json +37 -0
- package/canonical/hooks/hooks.memory-guard.claude-code.json +16 -0
- package/canonical/hooks/hooks.output-pruner.claude-code.json +16 -0
- package/canonical/hooks/hooks.precompact.claude-code.json +15 -0
- package/canonical/hooks/hooks.repeat-tool.claude-code.json +25 -0
- package/canonical/hooks/hooks.security-guidance.claude-code.json +16 -0
- package/canonical/mcp/servers.json +20 -0
- package/canonical/openspec/config.base.yaml +89 -0
- package/canonical/openspec/schema.spec-driven.yaml +277 -0
- package/canonical/openspec/templates/data-contract.md +36 -0
- package/canonical/openspec/templates/design.md +84 -0
- package/canonical/openspec/templates/eval-plan.md +33 -0
- package/canonical/openspec/templates/follow-ups.md +2 -0
- package/canonical/openspec/templates/proposal.md +45 -0
- package/canonical/openspec/templates/spec.md +42 -0
- package/canonical/openspec/templates/tasks.md +38 -0
- package/canonical/profiles/local-llamacpp.LOCAL-MODELS.md +47 -0
- package/canonical/profiles/local-llamacpp.json +27 -0
- package/canonical/profiles/local-ollama.json +20 -0
- package/canonical/profiles/mcp.json +91 -0
- package/canonical/rules/CLAUDE.md +78 -0
- package/canonical/rules/project-CLAUDE.template.md +62 -0
- package/canonical/rules/routing.md +20 -0
- package/canonical/rules/safety.md +41 -0
- package/canonical/settings/settings.cache-hygiene.claude-code.json +5 -0
- package/canonical/skills/agent-evaluation/SKILL.md +102 -0
- package/canonical/skills/agent-evaluation/assets/evaluation_report_template.md +206 -0
- package/canonical/skills/agent-evaluation/evals/cases.yaml +106 -0
- package/canonical/skills/agent-evaluation/references/dataset-preparation.md +351 -0
- package/canonical/skills/agent-evaluation/references/scorers-constraints.md +165 -0
- package/canonical/skills/agent-evaluation/references/scorers.md +431 -0
- package/canonical/skills/agent-evaluation/references/setup-guide.md +252 -0
- package/canonical/skills/agent-evaluation/references/tracing-integration.md +164 -0
- package/canonical/skills/agent-evaluation/references/troubleshooting.md +514 -0
- package/canonical/skills/agent-evaluation/scripts/analyze_results.py +462 -0
- package/canonical/skills/agent-evaluation/scripts/create_dataset_template.py +382 -0
- package/canonical/skills/agent-evaluation/scripts/list_datasets.py +273 -0
- package/canonical/skills/agent-evaluation/scripts/run_evaluation_template.py +309 -0
- package/canonical/skills/agent-evaluation/scripts/setup_mlflow.py +353 -0
- package/canonical/skills/agent-evaluation/scripts/utils/__init__.py +27 -0
- package/canonical/skills/agent-evaluation/scripts/utils/env_validation.py +123 -0
- package/canonical/skills/agent-evaluation/scripts/utils/tracing_utils.py +108 -0
- package/canonical/skills/agent-evaluation/scripts/validate_agent_tracing.py +148 -0
- package/canonical/skills/agent-evaluation/scripts/validate_auth.py +240 -0
- package/canonical/skills/agent-evaluation/scripts/validate_environment.py +185 -0
- package/canonical/skills/agent-evaluation/scripts/validate_tracing_runtime.py +318 -0
- package/canonical/skills/agentic-architecture/SKILL.md +41 -0
- package/canonical/skills/agentic-architecture/evals/cases.yaml +94 -0
- package/canonical/skills/agentic-architecture/reference/context-engineering.md +75 -0
- package/canonical/skills/agentic-architecture/reference/patterns.md +76 -0
- package/canonical/skills/agentic-architecture/reference/reliability-observability.md +94 -0
- package/canonical/skills/agentic-architecture/reference/review-framework.md +59 -0
- package/canonical/skills/code-review/SKILL.md +52 -0
- package/canonical/skills/code-review/evals/cases.yaml +197 -0
- package/canonical/skills/git-workflow/SKILL.md +41 -0
- package/canonical/skills/git-workflow/evals/cases.yaml +92 -0
- package/canonical/skills/local-code/SKILL.md +24 -0
- package/canonical/skills/local-code/evals/cases.yaml +85 -0
- package/canonical/skills/local-code/scripts/query_llama.py +68 -0
- package/canonical/skills/report-formatting/SKILL.md +62 -0
- package/canonical/skills/report-formatting/evals/cases.yaml +83 -0
- package/canonical/skills/report-formatting/reference/ARCHITECTURE.md +135 -0
- package/canonical/skills/report-formatting/reference/HELPERS.md +120 -0
- package/canonical/skills/report-formatting/reference/PPTX.md +136 -0
- package/canonical/skills/report-formatting/reference/RELEASE.md +99 -0
- package/canonical/skills/report-formatting/reference/TEMPLATES.md +48 -0
- package/canonical/skills/report-formatting/reference/authoring.md +66 -0
- package/canonical/skills/report-formatting/scripts/architecture-template.md +271 -0
- package/canonical/skills/report-formatting/scripts/assets/claro-logo.png +0 -0
- package/canonical/skills/report-formatting/scripts/assets/claro-wordmark.svg +1 -0
- package/canonical/skills/report-formatting/scripts/build-architecture.js +57 -0
- package/canonical/skills/report-formatting/scripts/build-md-claro.js +224 -0
- package/canonical/skills/report-formatting/scripts/build-release.js +51 -0
- package/canonical/skills/report-formatting/scripts/check-env.js +58 -0
- package/canonical/skills/report-formatting/scripts/docmodel.js +283 -0
- package/canonical/skills/report-formatting/scripts/example-build.js +119 -0
- package/canonical/skills/report-formatting/scripts/example_build_ArchitectureReview_docx.js +195 -0
- package/canonical/skills/report-formatting/scripts/example_build_ExecutiveReport_docx.js +114 -0
- package/canonical/skills/report-formatting/scripts/package.json +17 -0
- package/canonical/skills/report-formatting/scripts/pptx/example_build_StatusReport_pptx.py +223 -0
- package/canonical/skills/report-formatting/scripts/pptx/example_build_WeeklyStatus_pptx.py +245 -0
- package/canonical/skills/report-formatting/scripts/pptx/pptx_office.py +144 -0
- package/canonical/skills/report-formatting/scripts/pptx/requirements.txt +7 -0
- package/canonical/skills/report-formatting/scripts/pptx/status_report_blocks.py +193 -0
- package/canonical/skills/report-formatting/scripts/pptx/theme_claro_pptx.py +473 -0
- package/canonical/skills/report-formatting/scripts/release-template.md +80 -0
- package/canonical/skills/report-formatting/scripts/render-mermaid.js +105 -0
- package/canonical/skills/report-formatting/scripts/theme-claro.js +403 -0
- package/canonical/skills/subagent-driven-development/SKILL.md +60 -0
- package/canonical/skills/subagent-driven-development/evals/cases.yaml +208 -0
- package/canonical/skills/subagent-driven-development/reference/brief.md +91 -0
- package/canonical/skills/subagent-driven-development/reference/handoff.md +118 -0
- package/canonical/skills/subagent-driven-development/scripts/validate-handoff.mjs +850 -0
- package/canonical/skills/systematic-debugging/SKILL.md +44 -0
- package/canonical/skills/systematic-debugging/evals/cases.yaml +90 -0
- package/canonical/skills/test-driven-development/SKILL.md +42 -0
- package/canonical/skills/test-driven-development/evals/cases.yaml +86 -0
- package/canonical/skills/test-driven-development/reference/writing-good-tests.md +52 -0
- package/canonical/skills/verification-before-completion/SKILL.md +53 -0
- package/canonical/skills/verification-before-completion/evals/cases.yaml +107 -0
- package/dist/adapters/content/language-lint.d.ts +46 -0
- package/dist/adapters/content/language-lint.js +191 -0
- package/dist/adapters/harness/claude-code.d.ts +57 -0
- package/dist/adapters/harness/claude-code.js +385 -0
- package/dist/adapters/harness/index.d.ts +3 -0
- package/dist/adapters/harness/index.js +17 -0
- package/dist/adapters/harness/opencode.d.ts +7 -0
- package/dist/adapters/harness/opencode.js +166 -0
- package/dist/adapters/harness/plugin.d.ts +22 -0
- package/dist/adapters/harness/plugin.js +257 -0
- package/dist/adapters/memory/doctor.d.ts +480 -0
- package/dist/adapters/memory/doctor.js +1217 -0
- package/dist/adapters/memory/vendored.d.ts +150 -0
- package/dist/adapters/memory/vendored.js +487 -0
- package/dist/adapters/package/node.d.ts +9 -0
- package/dist/adapters/package/node.js +20 -0
- package/dist/adapters/prompt/readline.d.ts +19 -0
- package/dist/adapters/prompt/readline.js +53 -0
- package/dist/adapters/sync/diff.d.ts +43 -0
- package/dist/adapters/sync/diff.js +380 -0
- package/dist/cli/cleanup.d.ts +86 -0
- package/dist/cli/cleanup.js +382 -0
- package/dist/cli/cost.d.ts +304 -0
- package/dist/cli/cost.js +501 -0
- package/dist/cli/doctor.d.ts +205 -0
- package/dist/cli/doctor.js +654 -0
- package/dist/cli/executor.d.ts +5 -0
- package/dist/cli/executor.js +48 -0
- package/dist/cli/plugin-validate.d.ts +37 -0
- package/dist/cli/plugin-validate.js +256 -0
- package/dist/cli/prefix.d.ts +68 -0
- package/dist/cli/prefix.js +218 -0
- package/dist/cli/profile.d.ts +170 -0
- package/dist/cli/profile.js +285 -0
- package/dist/cli/runner.d.ts +10 -0
- package/dist/cli/runner.js +27 -0
- package/dist/cli/uninstall.d.ts +65 -0
- package/dist/cli/uninstall.js +147 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +989 -0
- package/dist/infra/dogfood.d.ts +31 -0
- package/dist/infra/dogfood.js +51 -0
- package/dist/infra/fsutil.d.ts +40 -0
- package/dist/infra/fsutil.js +143 -0
- package/dist/infra/manifest.d.ts +76 -0
- package/dist/infra/manifest.js +92 -0
- package/dist/infra/paths.d.ts +19 -0
- package/dist/infra/paths.js +74 -0
- package/dist/infra/routing.d.ts +4 -0
- package/dist/infra/routing.js +7 -0
- package/node_modules/@freeharness/core/dist/context.d.ts +30 -0
- package/node_modules/@freeharness/core/dist/context.js +1 -0
- package/node_modules/@freeharness/core/dist/index.d.ts +5 -0
- package/node_modules/@freeharness/core/dist/index.js +6 -0
- package/node_modules/@freeharness/core/dist/planner.d.ts +13 -0
- package/node_modules/@freeharness/core/dist/planner.js +18 -0
- package/node_modules/@freeharness/core/dist/ports.d.ts +90 -0
- package/node_modules/@freeharness/core/dist/ports.js +1 -0
- package/node_modules/@freeharness/core/dist/registry.d.ts +41 -0
- package/node_modules/@freeharness/core/dist/registry.js +124 -0
- package/node_modules/@freeharness/core/dist/tiers.d.ts +30 -0
- package/node_modules/@freeharness/core/dist/tiers.js +99 -0
- package/node_modules/@freeharness/core/package.json +34 -0
- package/node_modules/@freeharness/sdd/PROVENANCE.yaml +175 -0
- package/node_modules/@freeharness/sdd/dist/src/bin/openspec.d.ts +2 -0
- package/node_modules/@freeharness/sdd/dist/src/bin/openspec.js +166 -0
- package/node_modules/@freeharness/sdd/dist/src/index.d.ts +14 -0
- package/node_modules/@freeharness/sdd/dist/src/index.js +11 -0
- package/node_modules/@freeharness/sdd/dist/src/init.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/src/init.js +190 -0
- package/node_modules/@freeharness/sdd/dist/src/root-resolver.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/src/root-resolver.js +32 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/archive.d.ts +81 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/archive.js +483 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/context.d.ts +4 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/context.js +48 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.d.ts +57 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.js +279 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/instructions.d.ts +67 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/instructions.js +460 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/list.d.ts +5 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/list.js +95 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/new-change.d.ts +6 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/new-change.js +150 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/schemas.d.ts +4 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/schemas.js +23 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/shared.d.ts +56 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/shared.js +140 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/status.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/status.js +85 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/validate.d.ts +6 -0
- package/node_modules/@freeharness/sdd/dist/src/shim/validate.js +229 -0
- package/node_modules/@freeharness/sdd/dist/src/validate-change.d.ts +40 -0
- package/node_modules/@freeharness/sdd/dist/src/validate-change.js +114 -0
- package/node_modules/@freeharness/sdd/dist/src/validate.d.ts +24 -0
- package/node_modules/@freeharness/sdd/dist/src/validate.js +72 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.d.ts +130 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.js +981 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.d.ts +46 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.js +128 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.d.ts +26 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.js +32 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.d.ts +50 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.js +394 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.d.ts +15 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.js +49 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.d.ts +71 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.js +164 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.d.ts +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.js +21 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.d.ts +102 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.js +230 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.d.ts +18 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.js +138 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.d.ts +82 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.js +333 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.js +110 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.d.ts +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.js +32 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.d.ts +33 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.js +149 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.js +49 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.js +31 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.d.ts +10 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.js +10 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.js +26 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.d.ts +28 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.js +41 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.d.ts +23 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.js +25 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.d.ts +72 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.js +76 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.js +53 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.d.ts +62 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.js +7 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.d.ts +35 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.js +47 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.d.ts +33 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.js +55 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.d.ts +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.js +11 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.d.ts +48 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.js +99 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.d.ts +19 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.js +18 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.d.ts +18 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.js +4 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.d.ts +19 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.js +207 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.js +409 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.js +673 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.js +230 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.js +550 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.js +107 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.js +228 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.js +147 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.js +571 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.js +322 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.d.ts +7 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.js +7 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.js +518 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.js +176 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.d.ts +9 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.js +344 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.js +54 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.d.ts +35 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.js +171 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.d.ts +27 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.js +210 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.d.ts +14 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.js +48 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.d.ts +22 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.js +186 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.d.ts +65 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.js +409 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.d.ts +55 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.js +98 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.d.ts +8 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.js +77 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.d.ts +44 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.js +116 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.d.ts +12 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.js +17 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.d.ts +72 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.js +30 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.d.ts +3 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.js +3 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.d.ts +17 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.js +14 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.d.ts +39 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.js +114 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.d.ts +45 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.js +105 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.d.ts +15 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.js +56 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.d.ts +17 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.js +1 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.d.ts +94 -0
- package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.js +756 -0
- package/node_modules/@freeharness/sdd/package.json +57 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/LICENSE.upstream +22 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/schema.upstream.yaml +232 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/README.md +19 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-apply-change/SKILL.md +187 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-archive-change/SKILL.md +181 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-bulk-archive-change/SKILL.md +338 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-continue-change/SKILL.md +117 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-explore/SKILL.md +342 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-ff-change/SKILL.md +116 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-new-change/SKILL.md +76 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-onboard/SKILL.md +560 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-propose/SKILL.md +162 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-sync-specs/SKILL.md +261 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-update-change/SKILL.md +90 -0
- package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-verify-change/SKILL.md +174 -0
- package/package.json +70 -0
- package/provenance/canonical.PROVENANCE.yaml +740 -0
- package/provenance/claude-mem.LICENSE.upstream +202 -0
- package/provenance/memory.PROVENANCE.yaml +399 -0
- package/provenance/sdd.PROVENANCE.yaml +175 -0
- package/vendor-licenses/caveman.LICENSE +27 -0
- package/vendor-licenses/deepseek-harness.LICENSE +21 -0
- package/vendor-licenses/ecc.LICENSE +21 -0
- package/vendor-licenses/pi.LICENSE +21 -0
- package/vendor-licenses/superpowers.LICENSE +21 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
|
|
2
|
+
export function getUpdateChangeSkillTemplate() {
|
|
3
|
+
return {
|
|
4
|
+
name: 'openspec-update-change',
|
|
5
|
+
description: "Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.",
|
|
6
|
+
instructions: `Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
|
7
|
+
|
|
8
|
+
${STORE_SELECTION_GUIDANCE}
|
|
9
|
+
|
|
10
|
+
**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.
|
|
11
|
+
|
|
12
|
+
\`/opsx:continue\` is an optional workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, \`openspec status --change "<name>" --json\` shows the next artifact and \`openspec instructions "<artifact-id>" --change "<name>" --json\` explains how to create it.
|
|
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 sorted by most recently modified, and ask the user to select one
|
|
22
|
+
|
|
23
|
+
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
|
24
|
+
- Change name
|
|
25
|
+
- Schema (from \`schema\` field if present, otherwise "spec-driven")
|
|
26
|
+
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
|
27
|
+
- How recently it was modified (from \`lastModified\` field)
|
|
28
|
+
|
|
29
|
+
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
|
|
30
|
+
|
|
31
|
+
Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:update <other>\`).
|
|
32
|
+
|
|
33
|
+
2. **Get the change's artifacts**
|
|
34
|
+
\`\`\`bash
|
|
35
|
+
openspec status --change "<name>" --json
|
|
36
|
+
\`\`\`
|
|
37
|
+
Parse the JSON to understand current state. The response includes:
|
|
38
|
+
- \`schemaName\`: The workflow schema being used (e.g., "spec-driven")
|
|
39
|
+
- \`artifacts\`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
|
40
|
+
- \`isPlanningComplete\`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as \`isComplete\`.
|
|
41
|
+
- \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context. Use these instead of assuming repo-local paths.
|
|
42
|
+
|
|
43
|
+
The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
|
|
44
|
+
|
|
45
|
+
The files to edit are \`artifactPaths.<id>.existingOutputPaths\` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. \`specs/**/*.md\`). Do NOT write to \`resolvedOutputPath\`: for a glob artifact it is still the glob pattern, not a real file.
|
|
46
|
+
|
|
47
|
+
3. **Understand the request**
|
|
48
|
+
- If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
|
|
49
|
+
- If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
|
|
50
|
+
|
|
51
|
+
4. **Read and reconcile**
|
|
52
|
+
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
|
53
|
+
- Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
|
54
|
+
- Note everything that is now inconsistent, missing, or contradictory.
|
|
55
|
+
- Revise only files that already exist (\`existingOutputPaths\`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to \`/opsx:continue\` to create them.
|
|
56
|
+
- If the change is already coherent, say so and make no edits.
|
|
57
|
+
|
|
58
|
+
5. **Confirm and apply, one artifact at a time**
|
|
59
|
+
- Show each proposed revision and why. Write only after the user confirms.
|
|
60
|
+
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
|
61
|
+
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
|
62
|
+
\`\`\`bash
|
|
63
|
+
openspec instructions "<artifact-id>" --change "<name>" --json
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
6. **Point to the next step (guidance only - NEVER act on it)**
|
|
67
|
+
- Artifacts still missing -> suggest \`/opsx:continue\` to create them.
|
|
68
|
+
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest \`/opsx:apply\` to carry the delta into code.
|
|
69
|
+
- Everything done and implemented -> suggest \`/opsx:archive\`.
|
|
70
|
+
|
|
71
|
+
**Output**
|
|
72
|
+
|
|
73
|
+
After each invocation, show:
|
|
74
|
+
- Which artifacts were revised (and which proposed revisions were rejected)
|
|
75
|
+
- Anything deferred to \`/opsx:continue\` (not-yet-created artifacts or files)
|
|
76
|
+
- Where the change stands and the recommended next command
|
|
77
|
+
|
|
78
|
+
**Guardrails**
|
|
79
|
+
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to \`/opsx:apply\`.
|
|
80
|
+
- Use the artifact ids and paths reported by \`openspec status\`; never branch on hardcoded artifact names.
|
|
81
|
+
- Edit only the concrete files in \`existingOutputPaths\`; never write to a glob \`resolvedOutputPath\`.
|
|
82
|
+
- Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is \`/opsx:continue\`'s job.
|
|
83
|
+
- Confirm every edit with the user before writing.
|
|
84
|
+
- If the request changes the change's *intent* rather than refining it, first verify whether the optional \`/opsx:new\` workflow is available. If it is, recommend starting fresh with \`/opsx:new\` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend \`openspec new change "<new-change-name>"\` instead.`,
|
|
85
|
+
license: 'MIT',
|
|
86
|
+
compatibility: 'Requires openspec CLI.',
|
|
87
|
+
metadata: { author: 'openspec', version: '1.0' },
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export function getOpsxUpdateCommandTemplate() {
|
|
91
|
+
return {
|
|
92
|
+
name: 'OPSX: Update',
|
|
93
|
+
description: "Update a change - revise existing planning artifacts and keep them coherent (Experimental)",
|
|
94
|
+
category: 'Workflow',
|
|
95
|
+
tags: ['workflow', 'artifacts', 'experimental'],
|
|
96
|
+
content: `Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
|
97
|
+
|
|
98
|
+
${STORE_SELECTION_GUIDANCE}
|
|
99
|
+
|
|
100
|
+
**Input**: Optionally specify a change name after \`/opsx:update\` (e.g., \`/opsx:update add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
101
|
+
|
|
102
|
+
\`/opsx:continue\` is an optional workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, \`openspec status --change "<name>" --json\` shows the next artifact and \`openspec instructions "<artifact-id>" --change "<name>" --json\` explains how to create it.
|
|
103
|
+
|
|
104
|
+
**Steps**
|
|
105
|
+
|
|
106
|
+
1. **Select the change**
|
|
107
|
+
|
|
108
|
+
If a name is provided, use it. Otherwise:
|
|
109
|
+
- Infer from conversation context if the user mentioned a change
|
|
110
|
+
- Auto-select if only one active change exists
|
|
111
|
+
- If ambiguous, run \`openspec list --json\` to get available changes sorted by most recently modified, and ask the user to select one
|
|
112
|
+
|
|
113
|
+
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
|
114
|
+
- Change name
|
|
115
|
+
- Schema (from \`schema\` field if present, otherwise "spec-driven")
|
|
116
|
+
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
|
117
|
+
- How recently it was modified (from \`lastModified\` field)
|
|
118
|
+
|
|
119
|
+
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
|
|
120
|
+
|
|
121
|
+
Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:update <other>\`).
|
|
122
|
+
|
|
123
|
+
2. **Get the change's artifacts**
|
|
124
|
+
\`\`\`bash
|
|
125
|
+
openspec status --change "<name>" --json
|
|
126
|
+
\`\`\`
|
|
127
|
+
Parse the JSON to understand current state. The response includes:
|
|
128
|
+
- \`schemaName\`: The workflow schema being used (e.g., "spec-driven")
|
|
129
|
+
- \`artifacts\`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
|
130
|
+
- \`isPlanningComplete\`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as \`isComplete\`.
|
|
131
|
+
- \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context. Use these instead of assuming repo-local paths.
|
|
132
|
+
|
|
133
|
+
The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
|
|
134
|
+
|
|
135
|
+
The files to edit are \`artifactPaths.<id>.existingOutputPaths\` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. \`specs/**/*.md\`). Do NOT write to \`resolvedOutputPath\`: for a glob artifact it is still the glob pattern, not a real file.
|
|
136
|
+
|
|
137
|
+
3. **Understand the request**
|
|
138
|
+
- If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
|
|
139
|
+
- If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
|
|
140
|
+
|
|
141
|
+
4. **Read and reconcile**
|
|
142
|
+
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
|
143
|
+
- Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
|
144
|
+
- Note everything that is now inconsistent, missing, or contradictory.
|
|
145
|
+
- Revise only files that already exist (\`existingOutputPaths\`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to \`/opsx:continue\` to create them.
|
|
146
|
+
- If the change is already coherent, say so and make no edits.
|
|
147
|
+
|
|
148
|
+
5. **Confirm and apply, one artifact at a time**
|
|
149
|
+
- Show each proposed revision and why. Write only after the user confirms.
|
|
150
|
+
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
|
151
|
+
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
|
152
|
+
\`\`\`bash
|
|
153
|
+
openspec instructions "<artifact-id>" --change "<name>" --json
|
|
154
|
+
\`\`\`
|
|
155
|
+
|
|
156
|
+
6. **Point to the next step (guidance only - NEVER act on it)**
|
|
157
|
+
- Artifacts still missing -> suggest \`/opsx:continue\` to create them.
|
|
158
|
+
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest \`/opsx:apply\` to carry the delta into code.
|
|
159
|
+
- Everything done and implemented -> suggest \`/opsx:archive\`.
|
|
160
|
+
|
|
161
|
+
**Output**
|
|
162
|
+
|
|
163
|
+
After each invocation, show:
|
|
164
|
+
- Which artifacts were revised (and which proposed revisions were rejected)
|
|
165
|
+
- Anything deferred to \`/opsx:continue\` (not-yet-created artifacts or files)
|
|
166
|
+
- Where the change stands and the recommended next command
|
|
167
|
+
|
|
168
|
+
**Guardrails**
|
|
169
|
+
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to \`/opsx:apply\`.
|
|
170
|
+
- Use the artifact ids and paths reported by \`openspec status\`; never branch on hardcoded artifact names.
|
|
171
|
+
- Edit only the concrete files in \`existingOutputPaths\`; never write to a glob \`resolvedOutputPath\`.
|
|
172
|
+
- Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is \`/opsx:continue\`'s job.
|
|
173
|
+
- Confirm every edit with the user before writing.
|
|
174
|
+
- If the request changes the change's *intent* rather than refining it, first verify whether the optional \`/opsx:new\` workflow is available. If it is, recommend starting fresh with \`/opsx:new\` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend \`openspec new change "<new-change-name>"\` instead.`
|
|
175
|
+
};
|
|
176
|
+
}
|
|
@@ -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 getVerifyChangeSkillTemplate(): SkillTemplate;
|
|
9
|
+
export declare function getOpsxVerifyCommandTemplate(): CommandTemplate;
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
|
|
2
|
+
export function getVerifyChangeSkillTemplate() {
|
|
3
|
+
return {
|
|
4
|
+
name: 'openspec-verify-change',
|
|
5
|
+
description: 'Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.',
|
|
6
|
+
instructions: `Verify that an implementation matches the change artifacts (specs, tasks, design).
|
|
7
|
+
|
|
8
|
+
${STORE_SELECTION_GUIDANCE}
|
|
9
|
+
|
|
10
|
+
**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.
|
|
11
|
+
|
|
12
|
+
**Steps**
|
|
13
|
+
|
|
14
|
+
1. **Select the change**
|
|
15
|
+
|
|
16
|
+
If a name is provided, use it. Otherwise:
|
|
17
|
+
- Infer from conversation context if the user mentioned a change
|
|
18
|
+
- Auto-select if only one active change exists
|
|
19
|
+
- If ambiguous, run \`openspec list --json\` to get available changes and ask the user to select one
|
|
20
|
+
|
|
21
|
+
When prompting, show changes that have implementation tasks (tasks artifact exists).
|
|
22
|
+
Include the schema used for each change if available.
|
|
23
|
+
Mark changes with incomplete tasks as "(In Progress)".
|
|
24
|
+
|
|
25
|
+
Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:verify <other>\`).
|
|
26
|
+
|
|
27
|
+
2. **Check status to understand the schema**
|
|
28
|
+
\`\`\`bash
|
|
29
|
+
openspec status --change "<name>" --json
|
|
30
|
+
\`\`\`
|
|
31
|
+
Parse the JSON to understand:
|
|
32
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven")
|
|
33
|
+
- \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context
|
|
34
|
+
- Which artifacts exist for this change
|
|
35
|
+
|
|
36
|
+
3. **Get planning context and load artifacts**
|
|
37
|
+
|
|
38
|
+
\`\`\`bash
|
|
39
|
+
openspec instructions apply --change "<name>" --json
|
|
40
|
+
\`\`\`
|
|
41
|
+
|
|
42
|
+
This returns the change directory and \`contextFiles\` (artifact ID -> array of concrete file paths). Read all available artifacts from \`contextFiles\`.
|
|
43
|
+
|
|
44
|
+
4. **Initialize verification report structure**
|
|
45
|
+
|
|
46
|
+
Create a report structure with three dimensions:
|
|
47
|
+
- **Completeness**: Track tasks and spec coverage
|
|
48
|
+
- **Correctness**: Track requirement implementation and scenario coverage
|
|
49
|
+
- **Coherence**: Track design adherence and pattern consistency
|
|
50
|
+
|
|
51
|
+
Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
|
|
52
|
+
|
|
53
|
+
5. **Verify Completeness**
|
|
54
|
+
|
|
55
|
+
**Task Completion**:
|
|
56
|
+
- If \`contextFiles.tasks\` exists, read every file path in it
|
|
57
|
+
- Parse checkboxes: \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
|
|
58
|
+
- Count complete vs total tasks
|
|
59
|
+
- If incomplete tasks exist:
|
|
60
|
+
- Add CRITICAL issue for each incomplete task
|
|
61
|
+
- Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
|
|
62
|
+
|
|
63
|
+
**Spec Coverage**:
|
|
64
|
+
- If delta specs exist in \`contextFiles.specs\`:
|
|
65
|
+
- Extract all requirements (marked with "### Requirement:")
|
|
66
|
+
- For each requirement:
|
|
67
|
+
- Search codebase for keywords related to the requirement
|
|
68
|
+
- Assess if implementation likely exists
|
|
69
|
+
- If requirements appear unimplemented:
|
|
70
|
+
- Add CRITICAL issue: "Requirement not found: <requirement name>"
|
|
71
|
+
- Recommendation: "Implement requirement X: <description>"
|
|
72
|
+
|
|
73
|
+
6. **Verify Correctness**
|
|
74
|
+
|
|
75
|
+
**Requirement Implementation Mapping**:
|
|
76
|
+
- For each requirement from delta specs:
|
|
77
|
+
- Search codebase for implementation evidence
|
|
78
|
+
- If found, note file paths and line ranges
|
|
79
|
+
- Assess if implementation matches requirement intent
|
|
80
|
+
- If divergence detected:
|
|
81
|
+
- Add WARNING: "Implementation may diverge from spec: <details>"
|
|
82
|
+
- Recommendation: "Review <file>:<lines> against requirement X"
|
|
83
|
+
|
|
84
|
+
**Scenario Coverage**:
|
|
85
|
+
- For each scenario in delta specs (marked with "#### Scenario:"):
|
|
86
|
+
- Check if conditions are handled in code
|
|
87
|
+
- Check if tests exist covering the scenario
|
|
88
|
+
- If scenario appears uncovered:
|
|
89
|
+
- Add WARNING: "Scenario not covered: <scenario name>"
|
|
90
|
+
- Recommendation: "Add test or implementation for scenario: <description>"
|
|
91
|
+
|
|
92
|
+
7. **Verify Coherence**
|
|
93
|
+
|
|
94
|
+
**Design Adherence**:
|
|
95
|
+
- If \`contextFiles.design\` exists:
|
|
96
|
+
- Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
|
|
97
|
+
- Verify implementation follows those decisions
|
|
98
|
+
- If contradiction detected:
|
|
99
|
+
- Add WARNING: "Design decision not followed: <decision>"
|
|
100
|
+
- Recommendation: "Update implementation or revise design.md to match reality"
|
|
101
|
+
- If no design.md: Skip design adherence check, note "No design.md to verify against"
|
|
102
|
+
|
|
103
|
+
**Code Pattern Consistency**:
|
|
104
|
+
- Review new code for consistency with project patterns
|
|
105
|
+
- Check file naming, directory structure, coding style
|
|
106
|
+
- If significant deviations found:
|
|
107
|
+
- Add SUGGESTION: "Code pattern deviation: <details>"
|
|
108
|
+
- Recommendation: "Consider following project pattern: <example>"
|
|
109
|
+
|
|
110
|
+
8. **Generate Verification Report**
|
|
111
|
+
|
|
112
|
+
**Summary Scorecard**:
|
|
113
|
+
\`\`\`markdown
|
|
114
|
+
## Verification Report: <change-name>
|
|
115
|
+
|
|
116
|
+
### Summary
|
|
117
|
+
| Dimension | Status |
|
|
118
|
+
|--------------|------------------|
|
|
119
|
+
| Completeness | X/Y tasks, N reqs|
|
|
120
|
+
| Correctness | M/N reqs covered |
|
|
121
|
+
| Coherence | Followed/Issues |
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
**Issues by Priority**:
|
|
125
|
+
|
|
126
|
+
1. **CRITICAL** (Must fix before archive):
|
|
127
|
+
- Incomplete tasks
|
|
128
|
+
- Missing requirement implementations
|
|
129
|
+
- Each with specific, actionable recommendation
|
|
130
|
+
|
|
131
|
+
2. **WARNING** (Should fix):
|
|
132
|
+
- Spec/design divergences
|
|
133
|
+
- Missing scenario coverage
|
|
134
|
+
- Each with specific recommendation
|
|
135
|
+
|
|
136
|
+
3. **SUGGESTION** (Nice to fix):
|
|
137
|
+
- Pattern inconsistencies
|
|
138
|
+
- Minor improvements
|
|
139
|
+
- Each with specific recommendation
|
|
140
|
+
|
|
141
|
+
**Final Assessment**:
|
|
142
|
+
- If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
|
|
143
|
+
- If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
|
|
144
|
+
- If all clear: "All checks passed. Ready for archive."
|
|
145
|
+
|
|
146
|
+
**Verification Heuristics**
|
|
147
|
+
|
|
148
|
+
- **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
|
|
149
|
+
- **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
|
|
150
|
+
- **Coherence**: Look for glaring inconsistencies, don't nitpick style
|
|
151
|
+
- **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
|
|
152
|
+
- **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
|
|
153
|
+
|
|
154
|
+
**Graceful Degradation**
|
|
155
|
+
|
|
156
|
+
- If only tasks.md exists: verify task completion only, skip spec/design checks
|
|
157
|
+
- If tasks + specs exist: verify completeness and correctness, skip design
|
|
158
|
+
- If full artifacts: verify all three dimensions
|
|
159
|
+
- Always note which checks were skipped and why
|
|
160
|
+
|
|
161
|
+
**Output Format**
|
|
162
|
+
|
|
163
|
+
Use clear markdown with:
|
|
164
|
+
- Table for summary scorecard
|
|
165
|
+
- Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
|
|
166
|
+
- Code references in format: \`file.ts:123\`
|
|
167
|
+
- Specific, actionable recommendations
|
|
168
|
+
- No vague suggestions like "consider reviewing"`,
|
|
169
|
+
license: 'MIT',
|
|
170
|
+
compatibility: 'Requires openspec CLI.',
|
|
171
|
+
metadata: { author: 'openspec', version: '1.0' },
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export function getOpsxVerifyCommandTemplate() {
|
|
175
|
+
return {
|
|
176
|
+
name: 'OPSX: Verify',
|
|
177
|
+
description: 'Verify implementation matches change artifacts before archiving',
|
|
178
|
+
category: 'Workflow',
|
|
179
|
+
tags: ['workflow', 'verify', 'experimental'],
|
|
180
|
+
content: `Verify that an implementation matches the change artifacts (specs, tasks, design).
|
|
181
|
+
|
|
182
|
+
${STORE_SELECTION_GUIDANCE}
|
|
183
|
+
|
|
184
|
+
**Input**: Optionally specify a change name after \`/opsx:verify\` (e.g., \`/opsx:verify add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
185
|
+
|
|
186
|
+
**Steps**
|
|
187
|
+
|
|
188
|
+
1. **Select the change**
|
|
189
|
+
|
|
190
|
+
If a name is provided, use it. Otherwise:
|
|
191
|
+
- Infer from conversation context if the user mentioned a change
|
|
192
|
+
- Auto-select if only one active change exists
|
|
193
|
+
- If ambiguous, run \`openspec list --json\` to get available changes and ask the user to select one
|
|
194
|
+
|
|
195
|
+
When prompting, show changes that have implementation tasks (tasks artifact exists).
|
|
196
|
+
Include the schema used for each change if available.
|
|
197
|
+
Mark changes with incomplete tasks as "(In Progress)".
|
|
198
|
+
|
|
199
|
+
Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:verify <other>\`).
|
|
200
|
+
|
|
201
|
+
2. **Check status to understand the schema**
|
|
202
|
+
\`\`\`bash
|
|
203
|
+
openspec status --change "<name>" --json
|
|
204
|
+
\`\`\`
|
|
205
|
+
Parse the JSON to understand:
|
|
206
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven")
|
|
207
|
+
- \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context
|
|
208
|
+
- Which artifacts exist for this change
|
|
209
|
+
|
|
210
|
+
3. **Get planning context and load artifacts**
|
|
211
|
+
|
|
212
|
+
\`\`\`bash
|
|
213
|
+
openspec instructions apply --change "<name>" --json
|
|
214
|
+
\`\`\`
|
|
215
|
+
|
|
216
|
+
This returns the change directory and \`contextFiles\` (artifact ID -> array of concrete file paths). Read all available artifacts from \`contextFiles\`.
|
|
217
|
+
|
|
218
|
+
4. **Initialize verification report structure**
|
|
219
|
+
|
|
220
|
+
Create a report structure with three dimensions:
|
|
221
|
+
- **Completeness**: Track tasks and spec coverage
|
|
222
|
+
- **Correctness**: Track requirement implementation and scenario coverage
|
|
223
|
+
- **Coherence**: Track design adherence and pattern consistency
|
|
224
|
+
|
|
225
|
+
Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
|
|
226
|
+
|
|
227
|
+
5. **Verify Completeness**
|
|
228
|
+
|
|
229
|
+
**Task Completion**:
|
|
230
|
+
- If \`contextFiles.tasks\` exists, read every file path in it
|
|
231
|
+
- Parse checkboxes: \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
|
|
232
|
+
- Count complete vs total tasks
|
|
233
|
+
- If incomplete tasks exist:
|
|
234
|
+
- Add CRITICAL issue for each incomplete task
|
|
235
|
+
- Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
|
|
236
|
+
|
|
237
|
+
**Spec Coverage**:
|
|
238
|
+
- If delta specs exist in \`contextFiles.specs\`:
|
|
239
|
+
- Extract all requirements (marked with "### Requirement:")
|
|
240
|
+
- For each requirement:
|
|
241
|
+
- Search codebase for keywords related to the requirement
|
|
242
|
+
- Assess if implementation likely exists
|
|
243
|
+
- If requirements appear unimplemented:
|
|
244
|
+
- Add CRITICAL issue: "Requirement not found: <requirement name>"
|
|
245
|
+
- Recommendation: "Implement requirement X: <description>"
|
|
246
|
+
|
|
247
|
+
6. **Verify Correctness**
|
|
248
|
+
|
|
249
|
+
**Requirement Implementation Mapping**:
|
|
250
|
+
- For each requirement from delta specs:
|
|
251
|
+
- Search codebase for implementation evidence
|
|
252
|
+
- If found, note file paths and line ranges
|
|
253
|
+
- Assess if implementation matches requirement intent
|
|
254
|
+
- If divergence detected:
|
|
255
|
+
- Add WARNING: "Implementation may diverge from spec: <details>"
|
|
256
|
+
- Recommendation: "Review <file>:<lines> against requirement X"
|
|
257
|
+
|
|
258
|
+
**Scenario Coverage**:
|
|
259
|
+
- For each scenario in delta specs (marked with "#### Scenario:"):
|
|
260
|
+
- Check if conditions are handled in code
|
|
261
|
+
- Check if tests exist covering the scenario
|
|
262
|
+
- If scenario appears uncovered:
|
|
263
|
+
- Add WARNING: "Scenario not covered: <scenario name>"
|
|
264
|
+
- Recommendation: "Add test or implementation for scenario: <description>"
|
|
265
|
+
|
|
266
|
+
7. **Verify Coherence**
|
|
267
|
+
|
|
268
|
+
**Design Adherence**:
|
|
269
|
+
- If \`contextFiles.design\` exists:
|
|
270
|
+
- Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
|
|
271
|
+
- Verify implementation follows those decisions
|
|
272
|
+
- If contradiction detected:
|
|
273
|
+
- Add WARNING: "Design decision not followed: <decision>"
|
|
274
|
+
- Recommendation: "Update implementation or revise design.md to match reality"
|
|
275
|
+
- If no design.md: Skip design adherence check, note "No design.md to verify against"
|
|
276
|
+
|
|
277
|
+
**Code Pattern Consistency**:
|
|
278
|
+
- Review new code for consistency with project patterns
|
|
279
|
+
- Check file naming, directory structure, coding style
|
|
280
|
+
- If significant deviations found:
|
|
281
|
+
- Add SUGGESTION: "Code pattern deviation: <details>"
|
|
282
|
+
- Recommendation: "Consider following project pattern: <example>"
|
|
283
|
+
|
|
284
|
+
8. **Generate Verification Report**
|
|
285
|
+
|
|
286
|
+
**Summary Scorecard**:
|
|
287
|
+
\`\`\`markdown
|
|
288
|
+
## Verification Report: <change-name>
|
|
289
|
+
|
|
290
|
+
### Summary
|
|
291
|
+
| Dimension | Status |
|
|
292
|
+
|--------------|------------------|
|
|
293
|
+
| Completeness | X/Y tasks, N reqs|
|
|
294
|
+
| Correctness | M/N reqs covered |
|
|
295
|
+
| Coherence | Followed/Issues |
|
|
296
|
+
\`\`\`
|
|
297
|
+
|
|
298
|
+
**Issues by Priority**:
|
|
299
|
+
|
|
300
|
+
1. **CRITICAL** (Must fix before archive):
|
|
301
|
+
- Incomplete tasks
|
|
302
|
+
- Missing requirement implementations
|
|
303
|
+
- Each with specific, actionable recommendation
|
|
304
|
+
|
|
305
|
+
2. **WARNING** (Should fix):
|
|
306
|
+
- Spec/design divergences
|
|
307
|
+
- Missing scenario coverage
|
|
308
|
+
- Each with specific recommendation
|
|
309
|
+
|
|
310
|
+
3. **SUGGESTION** (Nice to fix):
|
|
311
|
+
- Pattern inconsistencies
|
|
312
|
+
- Minor improvements
|
|
313
|
+
- Each with specific recommendation
|
|
314
|
+
|
|
315
|
+
**Final Assessment**:
|
|
316
|
+
- If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
|
|
317
|
+
- If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
|
|
318
|
+
- If all clear: "All checks passed. Ready for archive."
|
|
319
|
+
|
|
320
|
+
**Verification Heuristics**
|
|
321
|
+
|
|
322
|
+
- **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
|
|
323
|
+
- **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
|
|
324
|
+
- **Coherence**: Look for glaring inconsistencies, don't nitpick style
|
|
325
|
+
- **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
|
|
326
|
+
- **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
|
|
327
|
+
|
|
328
|
+
**Graceful Degradation**
|
|
329
|
+
|
|
330
|
+
- If only tasks.md exists: verify task completion only, skip spec/design checks
|
|
331
|
+
- If tasks + specs exist: verify completeness and correctness, skip design
|
|
332
|
+
- If full artifacts: verify all three dimensions
|
|
333
|
+
- Always note which checks were skipped and why
|
|
334
|
+
|
|
335
|
+
**Output Format**
|
|
336
|
+
|
|
337
|
+
Use clear markdown with:
|
|
338
|
+
- Table for summary scorecard
|
|
339
|
+
- Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
|
|
340
|
+
- Code references in format: \`file.ts:123\`
|
|
341
|
+
- Specific, actionable recommendations
|
|
342
|
+
- No vague suggestions like "consider reviewing"`
|
|
343
|
+
};
|
|
344
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation threshold constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const MIN_WHY_SECTION_LENGTH = 50;
|
|
5
|
+
export declare const MIN_PURPOSE_LENGTH = 50;
|
|
6
|
+
export declare const MAX_WHY_SECTION_LENGTH = 1000;
|
|
7
|
+
export declare const MAX_REQUIREMENT_TEXT_LENGTH = 500;
|
|
8
|
+
export declare const MAX_DELTAS_PER_CHANGE = 10;
|
|
9
|
+
export declare const PURPOSE_PLACEHOLDER_PREFIX = "TBD - created by archiving change ";
|
|
10
|
+
export declare const PURPOSE_PLACEHOLDER_SUFFIX = ". Update Purpose after archive.";
|
|
11
|
+
export declare const VALIDATION_MESSAGES: {
|
|
12
|
+
readonly SCENARIO_EMPTY: "Scenario text cannot be empty";
|
|
13
|
+
readonly REQUIREMENT_EMPTY: "Requirement text cannot be empty";
|
|
14
|
+
readonly REQUIREMENT_NO_SHALL: "Requirement must contain SHALL or MUST keyword";
|
|
15
|
+
readonly REQUIREMENT_NO_SCENARIOS: "Requirement must have at least one scenario";
|
|
16
|
+
readonly SPEC_NAME_EMPTY: "Spec name cannot be empty";
|
|
17
|
+
readonly SPEC_PURPOSE_EMPTY: "Purpose section cannot be empty";
|
|
18
|
+
readonly SPEC_NO_REQUIREMENTS: "Spec must have at least one requirement";
|
|
19
|
+
readonly CHANGE_NAME_EMPTY: "Change name cannot be empty";
|
|
20
|
+
readonly CHANGE_WHY_TOO_SHORT: "Why section must be at least 50 characters";
|
|
21
|
+
readonly CHANGE_WHY_TOO_LONG: "Why section should not exceed 1000 characters";
|
|
22
|
+
readonly CHANGE_WHAT_EMPTY: "What Changes section cannot be empty";
|
|
23
|
+
readonly CHANGE_NO_DELTAS: "Change must have at least one delta";
|
|
24
|
+
readonly CHANGE_SKIP_SPECS_CONFLICT: "skip_specs is set in .openspec.yaml but spec files exist under specs/. Remove skip_specs or delete the delta spec files";
|
|
25
|
+
readonly CHANGE_SKIP_SPECS_ACCEPTED: "skip_specs is set in .openspec.yaml: change declares no spec-level behavior changes, zero deltas accepted";
|
|
26
|
+
readonly CHANGE_SKIP_SPECS_INVALID_METADATA: "skip_specs is set but .openspec.yaml is not valid change metadata, so the marker is not honored. Fix the metadata";
|
|
27
|
+
readonly CHANGE_TOO_MANY_DELTAS: "Consider splitting changes with more than 10 deltas";
|
|
28
|
+
readonly DELTA_SPEC_EMPTY: "Spec name cannot be empty";
|
|
29
|
+
readonly DELTA_DESCRIPTION_EMPTY: "Delta description cannot be empty";
|
|
30
|
+
readonly PURPOSE_TOO_BRIEF: "Purpose section is too brief (less than 50 characters)";
|
|
31
|
+
readonly PURPOSE_IS_PLACEHOLDER: string;
|
|
32
|
+
readonly REQUIREMENT_TOO_LONG: "Requirement text is very long (>500 characters). Consider breaking it down.";
|
|
33
|
+
readonly DELTA_DESCRIPTION_TOO_BRIEF: "Delta description is too brief";
|
|
34
|
+
readonly DELTA_MISSING_REQUIREMENTS: "Delta should include requirements";
|
|
35
|
+
readonly GUIDE_NO_DELTAS: "No deltas found. Ensure your change has a specs/ directory with capability folders (e.g. specs/http-server/spec.md) containing .md files that use delta headers (## ADDED/MODIFIED/REMOVED/RENAMED Requirements) and that each requirement includes at least one \"#### Scenario:\" block. If this change intentionally modifies no specs (pure refactor, tooling, docs), set \"skip_specs: true\" in the change's .openspec.yaml instead. Tip: run \"openspec change show <change-id> --json --deltas-only\" to inspect parsed deltas.";
|
|
36
|
+
readonly GUIDE_MISSING_SPEC_SECTIONS: "Missing required sections. Expected headers: \"## Purpose\" and \"## Requirements\". Example:\n## Purpose\n[brief purpose]\n\n## Requirements\n### Requirement: Clear requirement statement\nUsers SHALL ...\n\n#### Scenario: Descriptive name\n- **WHEN** ...\n- **THEN** ...";
|
|
37
|
+
readonly GUIDE_MISSING_CHANGE_SECTIONS: "Missing required sections. Expected headers: \"## Why\" and \"## What Changes\". Ensure deltas are documented in specs/ using delta headers.";
|
|
38
|
+
readonly GUIDE_SCENARIO_FORMAT: "Scenarios must use level-4 headers. Convert bullet lists into:\n#### Scenario: Short name\n- **WHEN** ...\n- **THEN** ...\n- **AND** ...";
|
|
39
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation threshold constants
|
|
3
|
+
*/
|
|
4
|
+
// Minimum character lengths
|
|
5
|
+
export const MIN_WHY_SECTION_LENGTH = 50;
|
|
6
|
+
export const MIN_PURPOSE_LENGTH = 50;
|
|
7
|
+
// Maximum character/item limits
|
|
8
|
+
export const MAX_WHY_SECTION_LENGTH = 1000;
|
|
9
|
+
export const MAX_REQUIREMENT_TEXT_LENGTH = 500;
|
|
10
|
+
export const MAX_DELTAS_PER_CHANGE = 10;
|
|
11
|
+
// The Purpose `openspec archive` writes into a main spec it creates when the
|
|
12
|
+
// delta introduced the capability without a usable `## Purpose`. Named here, and
|
|
13
|
+
// composed from these two halves at the write site, so validation recognises the
|
|
14
|
+
// placeholder through the same definition that produces it: a second, hand-copied
|
|
15
|
+
// spelling would stop matching the day the wording changed, and a check that
|
|
16
|
+
// matches nothing looks exactly like a check that found nothing.
|
|
17
|
+
export const PURPOSE_PLACEHOLDER_PREFIX = 'TBD - created by archiving change ';
|
|
18
|
+
export const PURPOSE_PLACEHOLDER_SUFFIX = '. Update Purpose after archive.';
|
|
19
|
+
// Validation messages
|
|
20
|
+
export const VALIDATION_MESSAGES = {
|
|
21
|
+
// Required content
|
|
22
|
+
SCENARIO_EMPTY: 'Scenario text cannot be empty',
|
|
23
|
+
REQUIREMENT_EMPTY: 'Requirement text cannot be empty',
|
|
24
|
+
REQUIREMENT_NO_SHALL: 'Requirement must contain SHALL or MUST keyword',
|
|
25
|
+
REQUIREMENT_NO_SCENARIOS: 'Requirement must have at least one scenario',
|
|
26
|
+
SPEC_NAME_EMPTY: 'Spec name cannot be empty',
|
|
27
|
+
SPEC_PURPOSE_EMPTY: 'Purpose section cannot be empty',
|
|
28
|
+
SPEC_NO_REQUIREMENTS: 'Spec must have at least one requirement',
|
|
29
|
+
CHANGE_NAME_EMPTY: 'Change name cannot be empty',
|
|
30
|
+
CHANGE_WHY_TOO_SHORT: `Why section must be at least ${MIN_WHY_SECTION_LENGTH} characters`,
|
|
31
|
+
CHANGE_WHY_TOO_LONG: `Why section should not exceed ${MAX_WHY_SECTION_LENGTH} characters`,
|
|
32
|
+
CHANGE_WHAT_EMPTY: 'What Changes section cannot be empty',
|
|
33
|
+
CHANGE_NO_DELTAS: 'Change must have at least one delta',
|
|
34
|
+
CHANGE_SKIP_SPECS_CONFLICT: 'skip_specs is set in .openspec.yaml but spec files exist under specs/. Remove skip_specs or delete the delta spec files',
|
|
35
|
+
CHANGE_SKIP_SPECS_ACCEPTED: 'skip_specs is set in .openspec.yaml: change declares no spec-level behavior changes, zero deltas accepted',
|
|
36
|
+
CHANGE_SKIP_SPECS_INVALID_METADATA: 'skip_specs is set but .openspec.yaml is not valid change metadata, so the marker is not honored. Fix the metadata',
|
|
37
|
+
CHANGE_TOO_MANY_DELTAS: `Consider splitting changes with more than ${MAX_DELTAS_PER_CHANGE} deltas`,
|
|
38
|
+
DELTA_SPEC_EMPTY: 'Spec name cannot be empty',
|
|
39
|
+
DELTA_DESCRIPTION_EMPTY: 'Delta description cannot be empty',
|
|
40
|
+
// Warnings
|
|
41
|
+
PURPOSE_TOO_BRIEF: `Purpose section is too brief (less than ${MIN_PURPOSE_LENGTH} characters)`,
|
|
42
|
+
PURPOSE_IS_PLACEHOLDER: 'Purpose section is still a placeholder rather than a Purpose anyone wrote (the sentence `openspec archive` ' +
|
|
43
|
+
'writes for a new capability, or a `TBD`/`TODO` marker left in its place). Replace it with what this ' +
|
|
44
|
+
'capability is for, editing the main spec directly: a `## Purpose` in a delta is read only when the ' +
|
|
45
|
+
'capability is created, so it cannot replace this one.',
|
|
46
|
+
REQUIREMENT_TOO_LONG: `Requirement text is very long (>${MAX_REQUIREMENT_TEXT_LENGTH} characters). Consider breaking it down.`,
|
|
47
|
+
DELTA_DESCRIPTION_TOO_BRIEF: 'Delta description is too brief',
|
|
48
|
+
DELTA_MISSING_REQUIREMENTS: 'Delta should include requirements',
|
|
49
|
+
// Guidance snippets (appended to primary messages for remediation)
|
|
50
|
+
GUIDE_NO_DELTAS: 'No deltas found. Ensure your change has a specs/ directory with capability folders (e.g. specs/http-server/spec.md) containing .md files that use delta headers (## ADDED/MODIFIED/REMOVED/RENAMED Requirements) and that each requirement includes at least one "#### Scenario:" block. If this change intentionally modifies no specs (pure refactor, tooling, docs), set "skip_specs: true" in the change\'s .openspec.yaml instead. Tip: run "openspec change show <change-id> --json --deltas-only" to inspect parsed deltas.',
|
|
51
|
+
GUIDE_MISSING_SPEC_SECTIONS: 'Missing required sections. Expected headers: "## Purpose" and "## Requirements". Example:\n## Purpose\n[brief purpose]\n\n## Requirements\n### Requirement: Clear requirement statement\nUsers SHALL ...\n\n#### Scenario: Descriptive name\n- **WHEN** ...\n- **THEN** ...',
|
|
52
|
+
GUIDE_MISSING_CHANGE_SECTIONS: 'Missing required sections. Expected headers: "## Why" and "## What Changes". Ensure deltas are documented in specs/ using delta headers.',
|
|
53
|
+
GUIDE_SCENARIO_FORMAT: 'Scenarios must use level-4 headers. Convert bullet lists into:\n#### Scenario: Short name\n- **WHEN** ...\n- **THEN** ...\n- **AND** ...',
|
|
54
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** One delta header that does not resolve in the current main spec. */
|
|
2
|
+
export interface UnresolvedDeltaHeader {
|
|
3
|
+
/** Delta operation the header belongs to. */
|
|
4
|
+
operation: 'MODIFIED' | 'REMOVED' | 'RENAMED';
|
|
5
|
+
/** The requirement header (RENAMED: the FROM side). */
|
|
6
|
+
header: string;
|
|
7
|
+
/** Capability id relative to the specs root (forward slashes). */
|
|
8
|
+
specId: string;
|
|
9
|
+
/** Delta file path relative to the change's specs/ dir, e.g. `auth/spec.md`. */
|
|
10
|
+
entryPath: string;
|
|
11
|
+
/** Change id whose ADDED block declares the header, when one is in flight. */
|
|
12
|
+
addedBy?: string;
|
|
13
|
+
/** The finding as printed by validate and archive. */
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Builds the printed message for one unresolved header.
|
|
18
|
+
* @param operation Delta operation.
|
|
19
|
+
* @param header Requirement header.
|
|
20
|
+
* @param specId Capability id.
|
|
21
|
+
* @param addedBy In-flight change that ADDs the header, when known.
|
|
22
|
+
* @returns Message text.
|
|
23
|
+
*/
|
|
24
|
+
export declare function unresolvedHeaderMessage(operation: UnresolvedDeltaHeader['operation'], header: string, specId: string, addedBy?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Lists the MODIFIED / REMOVED / RENAMED headers of a change that do not exist
|
|
27
|
+
* in the current main specs. A RENAMED whose FROM is gone but whose TO exists is
|
|
28
|
+
* an already-synced rename and resolves.
|
|
29
|
+
* @param changeDir Absolute change directory.
|
|
30
|
+
* @param mainSpecsDir Absolute openspec/specs directory.
|
|
31
|
+
* @param changesDir Absolute openspec/changes directory, for the ADDED-elsewhere
|
|
32
|
+
* attribution; omitted = no attribution.
|
|
33
|
+
* @returns Unresolved headers in delta-file order.
|
|
34
|
+
*/
|
|
35
|
+
export declare function findUnresolvedDeltaHeaders(changeDir: string, mainSpecsDir: string, changesDir?: string): Promise<UnresolvedDeltaHeader[]>;
|