@dommaker/harness 1.3.0 → 1.4.0
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/CHANGELOG.md +8 -0
- package/README.md +0 -2
- package/bin/harness.js +86 -32
- package/dist/cli/command-contract.d.ts +83 -0
- package/dist/cli/command-contract.d.ts.map +1 -0
- package/dist/cli/command-contract.js +66 -0
- package/dist/cli/command-contract.js.map +1 -0
- package/dist/cli/commands/acceptance.d.ts +3 -2
- package/dist/cli/commands/acceptance.d.ts.map +1 -1
- package/dist/cli/commands/acceptance.js +28 -24
- package/dist/cli/commands/acceptance.js.map +1 -1
- package/dist/cli/commands/analyze-sessions.d.ts +2 -1
- package/dist/cli/commands/analyze-sessions.d.ts.map +1 -1
- package/dist/cli/commands/analyze-sessions.js +25 -24
- package/dist/cli/commands/analyze-sessions.js.map +1 -1
- package/dist/cli/commands/check.d.ts +14 -2
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +76 -61
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/command.d.ts +5 -1
- package/dist/cli/commands/command.d.ts.map +1 -1
- package/dist/cli/commands/command.js +26 -17
- package/dist/cli/commands/command.js.map +1 -1
- package/dist/cli/commands/constraints-report.d.ts +2 -1
- package/dist/cli/commands/constraints-report.d.ts.map +1 -1
- package/dist/cli/commands/constraints-report.js +37 -33
- package/dist/cli/commands/constraints-report.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +6 -5
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +50 -52
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/constraints.d.ts +2 -1
- package/dist/cli/commands/constraints.d.ts.map +1 -1
- package/dist/cli/commands/constraints.js +10 -27
- package/dist/cli/commands/constraints.js.map +1 -1
- package/dist/cli/commands/contract.d.ts +3 -2
- package/dist/cli/commands/contract.d.ts.map +1 -1
- package/dist/cli/commands/contract.js +45 -42
- package/dist/cli/commands/contract.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts +11 -11
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js +29 -214
- package/dist/cli/commands/definitions.js.map +1 -1
- package/dist/cli/commands/failure.d.ts +5 -4
- package/dist/cli/commands/failure.d.ts.map +1 -1
- package/dist/cli/commands/failure.js +31 -25
- package/dist/cli/commands/failure.js.map +1 -1
- package/dist/cli/commands/init.d.ts +7 -5
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +147 -211
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/knowledge.d.ts +21 -15
- package/dist/cli/commands/knowledge.d.ts.map +1 -1
- package/dist/cli/commands/knowledge.js +214 -199
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/passes-gate.d.ts +8 -2
- package/dist/cli/commands/passes-gate.d.ts.map +1 -1
- package/dist/cli/commands/passes-gate.js +44 -66
- package/dist/cli/commands/passes-gate.js.map +1 -1
- package/dist/cli/commands/performance.d.ts +2 -1
- package/dist/cli/commands/performance.d.ts.map +1 -1
- package/dist/cli/commands/performance.js +20 -18
- package/dist/cli/commands/performance.js.map +1 -1
- package/dist/cli/commands/posteval-plan.d.ts +5 -1
- package/dist/cli/commands/posteval-plan.d.ts.map +1 -1
- package/dist/cli/commands/posteval-plan.js +26 -15
- package/dist/cli/commands/posteval-plan.js.map +1 -1
- package/dist/cli/commands/release.d.ts +6 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +69 -59
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/report.d.ts +2 -1
- package/dist/cli/commands/report.d.ts.map +1 -1
- package/dist/cli/commands/report.js +9 -5
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/review.d.ts +3 -2
- package/dist/cli/commands/review.d.ts.map +1 -1
- package/dist/cli/commands/review.js +33 -29
- package/dist/cli/commands/review.js.map +1 -1
- package/dist/cli/commands/sdd.d.ts +2 -1
- package/dist/cli/commands/sdd.d.ts.map +1 -1
- package/dist/cli/commands/sdd.js +7 -5
- package/dist/cli/commands/sdd.js.map +1 -1
- package/dist/cli/commands/security.d.ts +3 -2
- package/dist/cli/commands/security.d.ts.map +1 -1
- package/dist/cli/commands/security.js +29 -26
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/cli/commands/spec-baseline-check.d.ts +2 -1
- package/dist/cli/commands/spec-baseline-check.d.ts.map +1 -1
- package/dist/cli/commands/spec-baseline-check.js +15 -11
- package/dist/cli/commands/spec-baseline-check.js.map +1 -1
- package/dist/cli/commands/spec.d.ts +7 -2
- package/dist/cli/commands/spec.d.ts.map +1 -1
- package/dist/cli/commands/spec.js +61 -51
- package/dist/cli/commands/spec.js.map +1 -1
- package/dist/cli/commands/status.d.ts +2 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +57 -53
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/sync-docs/agents-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/agents-syncer.js +5 -2
- package/dist/cli/commands/sync-docs/agents-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/context-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/context-syncer.js +3 -2
- package/dist/cli/commands/sync-docs/context-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/index.d.ts +2 -1
- package/dist/cli/commands/sync-docs/index.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/index.js +68 -88
- package/dist/cli/commands/sync-docs/index.js.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.d.ts +6 -1
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.js +14 -16
- package/dist/cli/commands/sync-docs/project-reader.js.map +1 -1
- package/dist/cli/commands/update-user-model.d.ts +2 -1
- package/dist/cli/commands/update-user-model.d.ts.map +1 -1
- package/dist/cli/commands/update-user-model.js +31 -45
- package/dist/cli/commands/update-user-model.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +4 -3
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +28 -26
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/session-mining/transcript.d.ts +7 -1
- package/dist/cli/session-mining/transcript.d.ts.map +1 -1
- package/dist/cli/session-mining/transcript.js +21 -14
- package/dist/cli/session-mining/transcript.js.map +1 -1
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +19 -32
- package/dist/context/session-manager.js.map +1 -1
- package/dist/core/constraints/agent-prompt-renderer.d.ts.map +1 -1
- package/dist/core/constraints/agent-prompt-renderer.js +1 -4
- package/dist/core/constraints/agent-prompt-renderer.js.map +1 -1
- package/dist/core/constraints/capabilities-parser.d.ts +24 -7
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
- package/dist/core/constraints/capabilities-parser.js +32 -28
- package/dist/core/constraints/capabilities-parser.js.map +1 -1
- package/dist/core/constraints/capabilities-reconcile.d.ts +67 -0
- package/dist/core/constraints/capabilities-reconcile.d.ts.map +1 -0
- package/dist/core/constraints/capabilities-reconcile.js +105 -0
- package/dist/core/constraints/capabilities-reconcile.js.map +1 -0
- package/dist/core/constraints/checker.d.ts +21 -43
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +64 -115
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.d.ts +4 -3
- package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.js +29 -69
- package/dist/core/constraints/checkers/capability-sync.js.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.d.ts +4 -2
- package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.js +13 -22
- package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.d.ts.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.js +37 -63
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
- package/dist/core/constraints/checkers/governance-presence.d.ts +2 -2
- package/dist/core/constraints/checkers/governance-presence.d.ts.map +1 -1
- package/dist/core/constraints/checkers/governance-presence.js +7 -28
- package/dist/core/constraints/checkers/governance-presence.js.map +1 -1
- package/dist/core/constraints/checkers/no-test-simplification.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-test-simplification.js +4 -3
- package/dist/core/constraints/checkers/no-test-simplification.js.map +1 -1
- package/dist/core/constraints/checkers/types.d.ts +2 -2
- package/dist/core/constraints/context-builder.d.ts +15 -14
- package/dist/core/constraints/context-builder.d.ts.map +1 -1
- package/dist/core/constraints/context-builder.js +32 -96
- package/dist/core/constraints/context-builder.js.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +2 -1
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- package/dist/core/constraints/git-evidence.d.ts +60 -0
- package/dist/core/constraints/git-evidence.d.ts.map +1 -0
- package/dist/core/constraints/git-evidence.js +88 -0
- package/dist/core/constraints/git-evidence.js.map +1 -0
- package/dist/core/constraints/injection-drift.d.ts +3 -20
- package/dist/core/constraints/injection-drift.d.ts.map +1 -1
- package/dist/core/constraints/injection-drift.js +10 -57
- package/dist/core/constraints/injection-drift.js.map +1 -1
- package/dist/core/constraints/injection-writer.d.ts +113 -0
- package/dist/core/constraints/injection-writer.d.ts.map +1 -0
- package/dist/core/constraints/injection-writer.js +228 -0
- package/dist/core/constraints/injection-writer.js.map +1 -0
- package/dist/core/constraints/usage-report.d.ts +22 -1
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +27 -20
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +32 -1
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +39 -9
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/core/validators/passes-gate.d.ts +15 -64
- package/dist/core/validators/passes-gate.d.ts.map +1 -1
- package/dist/core/validators/passes-gate.js +84 -222
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/core/validators/test-output.d.ts +58 -0
- package/dist/core/validators/test-output.d.ts.map +1 -0
- package/dist/core/validators/test-output.js +109 -0
- package/dist/core/validators/test-output.js.map +1 -0
- package/dist/failure/recorder.d.ts +6 -0
- package/dist/failure/recorder.d.ts.map +1 -1
- package/dist/failure/recorder.js +12 -8
- package/dist/failure/recorder.js.map +1 -1
- package/dist/gates/acceptance.d.ts +1 -48
- package/dist/gates/acceptance.d.ts.map +1 -1
- package/dist/gates/acceptance.js +6 -38
- package/dist/gates/acceptance.js.map +1 -1
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +6 -11
- package/dist/gates/checker-gate.js.map +1 -1
- package/dist/gates/command.d.ts.map +1 -1
- package/dist/gates/command.js +10 -22
- package/dist/gates/command.js.map +1 -1
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js +22 -61
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/performance.d.ts.map +1 -1
- package/dist/gates/performance.js +13 -31
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/review.d.ts.map +1 -1
- package/dist/gates/review.js +21 -53
- package/dist/gates/review.js.map +1 -1
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +14 -32
- package/dist/gates/security.js.map +1 -1
- package/dist/gates/types.d.ts +28 -5
- package/dist/gates/types.d.ts.map +1 -1
- package/dist/gates/types.js +38 -1
- package/dist/gates/types.js.map +1 -1
- package/dist/hooks/bootstrap.d.ts +2 -0
- package/dist/hooks/bootstrap.d.ts.map +1 -1
- package/dist/hooks/bootstrap.js +5 -2
- package/dist/hooks/bootstrap.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit.d.ts +7 -2
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/audit.js +59 -79
- package/dist/knowledge/audit.js.map +1 -1
- package/dist/knowledge/flywheel-metrics.d.ts +39 -0
- package/dist/knowledge/flywheel-metrics.d.ts.map +1 -0
- package/dist/knowledge/flywheel-metrics.js +47 -0
- package/dist/knowledge/flywheel-metrics.js.map +1 -0
- package/dist/knowledge/import.d.ts.map +1 -1
- package/dist/knowledge/import.js +4 -14
- package/dist/knowledge/import.js.map +1 -1
- package/dist/knowledge/index-generator.d.ts.map +1 -1
- package/dist/knowledge/index-generator.js +17 -14
- package/dist/knowledge/index-generator.js.map +1 -1
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +9 -4
- package/dist/knowledge/ingest.js.map +1 -1
- package/dist/knowledge/migration.d.ts.map +1 -1
- package/dist/knowledge/migration.js +11 -8
- package/dist/knowledge/migration.js.map +1 -1
- package/dist/knowledge/reference-tracker.d.ts.map +1 -1
- package/dist/knowledge/reference-tracker.js +12 -9
- package/dist/knowledge/reference-tracker.js.map +1 -1
- package/dist/knowledge/store.d.ts +15 -0
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +59 -10
- package/dist/knowledge/store.js.map +1 -1
- package/dist/monitoring/context-tracker.d.ts.map +1 -1
- package/dist/monitoring/context-tracker.js +11 -20
- package/dist/monitoring/context-tracker.js.map +1 -1
- package/dist/monitoring/index.d.ts +1 -1
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/index.js +1 -2
- package/dist/monitoring/index.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +15 -0
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +19 -2
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +21 -2
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +38 -29
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/release/index.d.ts +2 -2
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +1 -5
- package/dist/release/index.js.map +1 -1
- package/dist/sdd/index-generator.js +10 -11
- package/dist/sdd/index-generator.js.map +1 -1
- package/dist/test-setup/project-fixture.d.ts +48 -0
- package/dist/test-setup/project-fixture.d.ts.map +1 -0
- package/dist/test-setup/project-fixture.js +106 -0
- package/dist/test-setup/project-fixture.js.map +1 -0
- package/dist/types/constraint.d.ts +0 -18
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/passes-gate.d.ts +10 -25
- package/dist/types/passes-gate.d.ts.map +1 -1
- package/dist/types/project-config.d.ts +1 -1
- package/dist/types/session.d.ts +6 -5
- package/dist/types/session.d.ts.map +1 -1
- package/dist/utils/exec.d.ts +10 -0
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +12 -0
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/file-walk.d.ts +9 -1
- package/dist/utils/file-walk.d.ts.map +1 -1
- package/dist/utils/file-walk.js +10 -1
- package/dist/utils/file-walk.js.map +1 -1
- package/dist/utils/frontmatter.d.ts +73 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +141 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/jsonl.d.ts +92 -0
- package/dist/utils/jsonl.d.ts.map +1 -0
- package/dist/utils/jsonl.js +166 -0
- package/dist/utils/jsonl.js.map +1 -0
- package/dist/utils/package-version.d.ts +16 -0
- package/dist/utils/package-version.d.ts.map +1 -0
- package/dist/utils/package-version.js +63 -0
- package/dist/utils/package-version.js.map +1 -0
- package/package.json +1 -1
- package/src/CONTEXT.md +7 -2
- package/src/__tests__/acceptance-gate.test.ts +3 -1
- package/src/__tests__/checker-extra.test.ts +7 -1218
- package/src/__tests__/context-files-resolution.test.ts +116 -0
- package/src/__tests__/effective-constraints.test.ts +10 -13
- package/src/__tests__/exec.test.ts +35 -1
- package/src/__tests__/layering.test.ts +152 -0
- package/src/__tests__/passes-gate-extra.test.ts +0 -145
- package/src/__tests__/passes-gate.test.ts +142 -106
- package/src/__tests__/skip-semantics.test.ts +5 -9
- package/src/cli/__tests__/command-contract.test.ts +170 -0
- package/src/cli/command-contract.ts +108 -0
- package/src/cli/commands/CONTEXT.md +22 -7
- package/src/cli/commands/__tests__/acceptance.test.ts +40 -33
- package/src/cli/commands/__tests__/analyze-sessions.test.ts +35 -29
- package/src/cli/commands/__tests__/bin-exit-mapping.test.ts +101 -0
- package/src/cli/commands/__tests__/check-drift.test.ts +27 -34
- package/src/cli/commands/__tests__/check-skip-output.test.ts +21 -24
- package/src/cli/commands/__tests__/check.test.ts +378 -382
- package/src/cli/commands/__tests__/command.test.ts +85 -70
- package/src/cli/commands/__tests__/constraints-report.test.ts +100 -71
- package/src/cli/commands/__tests__/constraints-retire.test.ts +152 -95
- package/src/cli/commands/__tests__/contract.test.ts +27 -34
- package/src/cli/commands/__tests__/failure.test.ts +31 -34
- package/src/cli/commands/__tests__/init-injection.test.ts +58 -28
- package/src/cli/commands/__tests__/init.test.ts +77 -48
- package/src/cli/commands/__tests__/knowledge-flywheel-consistency.test.ts +108 -0
- package/src/cli/commands/__tests__/knowledge.test.ts +69 -43
- package/src/cli/commands/__tests__/passes-gate.test.ts +43 -45
- package/src/cli/commands/__tests__/performance.test.ts +22 -23
- package/src/cli/commands/__tests__/posteval-plan.test.ts +39 -38
- package/src/cli/commands/__tests__/project-path-anchoring.test.ts +157 -0
- package/src/cli/commands/__tests__/project-path-convention.test.ts +169 -0
- package/src/cli/commands/__tests__/registry.test.ts +69 -35
- package/src/cli/commands/__tests__/release.test.ts +209 -80
- package/src/cli/commands/__tests__/report-extra.test.ts +16 -16
- package/src/cli/commands/__tests__/report.test.ts +25 -25
- package/src/cli/commands/__tests__/review.test.ts +33 -31
- package/src/cli/commands/__tests__/security.test.ts +23 -27
- package/src/cli/commands/__tests__/spec-baseline-check.test.ts +20 -20
- package/src/cli/commands/__tests__/spec.test.ts +41 -29
- package/src/cli/commands/__tests__/status-extra.test.ts +18 -18
- package/src/cli/commands/__tests__/status-skipped-lines.test.ts +72 -0
- package/src/cli/commands/__tests__/status.test.ts +34 -34
- package/src/cli/commands/__tests__/sync-docs-agents.test.ts +77 -78
- package/src/cli/commands/__tests__/sync-docs.test.ts +72 -74
- package/src/cli/commands/__tests__/update-user-model.test.ts +62 -33
- package/src/cli/commands/__tests__/validate.test.ts +27 -29
- package/src/cli/commands/acceptance.ts +35 -24
- package/src/cli/commands/analyze-sessions.ts +25 -24
- package/src/cli/commands/check.ts +88 -65
- package/src/cli/commands/command.ts +30 -17
- package/src/cli/commands/constraints-report.ts +37 -34
- package/src/cli/commands/constraints-retire.ts +58 -55
- package/src/cli/commands/constraints.ts +10 -27
- package/src/cli/commands/contract.ts +51 -42
- package/src/cli/commands/definitions.ts +36 -222
- package/src/cli/commands/failure.ts +33 -26
- package/src/cli/commands/init.ts +166 -220
- package/src/cli/commands/knowledge.ts +225 -203
- package/src/cli/commands/passes-gate.ts +58 -68
- package/src/cli/commands/performance.ts +23 -18
- package/src/cli/commands/posteval-plan.ts +29 -15
- package/src/cli/commands/release.ts +70 -59
- package/src/cli/commands/report.ts +9 -5
- package/src/cli/commands/review.ts +39 -29
- package/src/cli/commands/sdd.ts +7 -5
- package/src/cli/commands/security.ts +35 -26
- package/src/cli/commands/spec-baseline-check.ts +16 -11
- package/src/cli/commands/spec.ts +66 -53
- package/src/cli/commands/status.ts +59 -53
- package/src/cli/commands/sync-docs/agents-syncer.ts +5 -2
- package/src/cli/commands/sync-docs/context-syncer.ts +3 -2
- package/src/cli/commands/sync-docs/index.ts +73 -100
- package/src/cli/commands/sync-docs/project-reader.ts +17 -18
- package/src/cli/commands/update-user-model.ts +33 -45
- package/src/cli/commands/validate.ts +31 -25
- package/src/cli/session-mining/__tests__/transcript.test.ts +118 -0
- package/src/cli/session-mining/transcript.ts +26 -8
- package/src/context/session-manager.ts +19 -33
- package/src/core/CONTEXT.md +9 -6
- package/src/core/constraints/__tests__/capabilities-reconcile.test.ts +200 -0
- package/src/core/constraints/__tests__/capability-counts.test.ts +94 -0
- package/src/core/constraints/__tests__/git-evidence.test.ts +208 -0
- package/src/core/constraints/__tests__/injection-drift.test.ts +3 -10
- package/src/core/constraints/__tests__/injection-writer.test.ts +231 -0
- package/src/core/constraints/__tests__/trace-injection.test.ts +71 -0
- package/src/core/constraints/__tests__/usage-report.test.ts +112 -0
- package/src/core/constraints/agent-prompt-renderer.ts +2 -6
- package/src/core/constraints/capabilities-parser.ts +53 -35
- package/src/core/constraints/capabilities-reconcile.ts +166 -0
- package/src/core/constraints/checker.ts +75 -130
- package/src/core/constraints/checkers/__tests__/capability-sync.test.ts +214 -0
- package/src/core/constraints/checkers/__tests__/context-doc-sync.test.ts +77 -0
- package/src/core/constraints/checkers/__tests__/docs-freshness.test.ts +117 -0
- package/src/{__tests__ → core/constraints/checkers/__tests__}/governance-presence.test.ts +83 -9
- package/src/core/constraints/checkers/__tests__/iron-flags.test.ts +50 -0
- package/src/core/constraints/checkers/__tests__/no-bypass-checkpoint.test.ts +76 -0
- package/src/{__tests__ → core/constraints/checkers/__tests__}/no-hardcoded-credentials.test.ts +4 -3
- package/src/core/constraints/checkers/__tests__/no-test-simplification.test.ts +58 -0
- package/src/core/constraints/checkers/__tests__/three-state-consistency.test.ts +145 -0
- package/src/core/constraints/checkers/capability-sync.ts +29 -88
- package/src/core/constraints/checkers/context-doc-sync.ts +15 -25
- package/src/core/constraints/checkers/docs-freshness.ts +40 -69
- package/src/core/constraints/checkers/governance-presence.ts +7 -25
- package/src/core/constraints/checkers/no-test-simplification.ts +4 -3
- package/src/core/constraints/checkers/types.ts +2 -2
- package/src/core/constraints/context-builder.ts +39 -91
- package/src/core/constraints/doc-freshness/runner.ts +2 -1
- package/src/core/constraints/git-evidence.ts +120 -0
- package/src/core/constraints/injection-drift.ts +13 -60
- package/src/core/constraints/injection-writer.ts +212 -0
- package/src/core/constraints/usage-report.ts +36 -17
- package/src/core/index.ts +4 -2
- package/src/core/project-config-loader.ts +49 -9
- package/src/core/validators/__tests__/passes-gate.test.ts +2 -56
- package/src/core/validators/__tests__/test-output.test.ts +372 -0
- package/src/core/validators/passes-gate.ts +86 -248
- package/src/core/validators/test-output.ts +128 -0
- package/src/failure/__tests__/recorder.test.ts +168 -0
- package/src/failure/recorder.ts +12 -10
- package/src/gates/CONTEXT.md +6 -3
- package/src/gates/__tests__/acceptance-types-single-source.test.ts +68 -0
- package/src/gates/__tests__/acceptance.test.ts +4 -86
- package/src/gates/__tests__/effective-gates.test.ts +3 -8
- package/src/gates/__tests__/test-verdict-consistency.test.ts +140 -0
- package/src/gates/acceptance.ts +19 -84
- package/src/gates/checker-gate.ts +8 -7
- package/src/gates/command.ts +10 -16
- package/src/gates/contract.ts +22 -61
- package/src/gates/performance.ts +10 -22
- package/src/gates/review.ts +21 -41
- package/src/gates/security.ts +10 -22
- package/src/gates/types.ts +70 -5
- package/src/hooks/CONTEXT.md +1 -1
- package/src/hooks/bootstrap.ts +5 -2
- package/src/index.ts +0 -4
- package/src/knowledge/CONTEXT.md +8 -3
- package/src/knowledge/__tests__/audit-labels.test.ts +44 -0
- package/src/knowledge/__tests__/flywheel-metrics.test.ts +135 -0
- package/src/knowledge/__tests__/import.test.ts +44 -0
- package/src/knowledge/__tests__/index-generator.test.ts +53 -0
- package/src/knowledge/__tests__/ingest.test.ts +85 -0
- package/src/knowledge/__tests__/migration.test.ts +47 -0
- package/src/knowledge/__tests__/reference-tracker.test.ts +16 -0
- package/src/knowledge/__tests__/store.test.ts +194 -0
- package/src/knowledge/audit.ts +67 -71
- package/src/knowledge/flywheel-metrics.ts +71 -0
- package/src/knowledge/import.ts +4 -18
- package/src/knowledge/index-generator.ts +19 -14
- package/src/knowledge/ingest.ts +9 -4
- package/src/knowledge/migration.ts +11 -8
- package/src/knowledge/reference-tracker.ts +12 -8
- package/src/knowledge/store.ts +64 -11
- package/src/monitoring/CONTEXT.md +8 -3
- package/src/monitoring/__tests__/skipped-lines-report.test.ts +178 -0
- package/src/monitoring/__tests__/traces.test.ts +57 -0
- package/src/monitoring/context-tracker.ts +11 -23
- package/src/monitoring/index.ts +1 -1
- package/src/monitoring/trace-analyzer.ts +21 -2
- package/src/monitoring/traces.ts +39 -36
- package/src/release/CONTEXT.md +1 -0
- package/src/release/__tests__/barrel.test.ts +60 -0
- package/src/release/index.ts +2 -13
- package/src/sdd/__tests__/index-generator.test.ts +71 -0
- package/src/sdd/index-generator.ts +9 -9
- package/src/test-setup/__tests__/project-fixture.test.ts +178 -0
- package/src/test-setup/project-fixture.ts +87 -0
- package/src/tools/CONTEXT.md +6 -0
- package/src/tools/__tests__/registry.test.ts +221 -0
- package/src/types/__tests__/types.test.ts +4 -5
- package/src/types/constraint.ts +0 -25
- package/src/types/passes-gate.ts +10 -30
- package/src/types/project-config.ts +1 -1
- package/src/types/session.ts +5 -5
- package/src/utils/__tests__/frontmatter.test.ts +206 -0
- package/src/utils/__tests__/jsonl-skip-disposition.test.ts +175 -0
- package/src/utils/__tests__/jsonl.test.ts +187 -0
- package/src/utils/__tests__/package-version.test.ts +97 -0
- package/src/utils/exec.ts +15 -0
- package/src/utils/file-walk.ts +11 -2
- package/src/utils/frontmatter.ts +121 -0
- package/src/utils/jsonl.ts +167 -0
- package/src/utils/package-version.ts +27 -0
- package/dist/cli/commands/doc-freshness-check.d.ts +0 -53
- package/dist/cli/commands/doc-freshness-check.d.ts.map +0 -1
- package/dist/cli/commands/doc-freshness-check.js +0 -352
- package/dist/cli/commands/doc-freshness-check.js.map +0 -1
- package/dist/types/index.d.ts +0 -14
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -39
- package/dist/types/index.js.map +0 -1
- package/src/__tests__/long-running.test.ts +0 -17
- package/src/__tests__/passes-gate-extension.test.ts +0 -151
- package/src/cli/commands/__tests__/doc-freshness-check.test.ts +0 -168
- package/src/cli/commands/doc-freshness-check.ts +0 -386
- package/src/spec/CONTEXT.md +0 -11
- package/src/types/index.ts +0 -47
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* harness doc-freshness-check 命令
|
|
3
|
-
*
|
|
4
|
-
* 从文档中提取可验证的声明(claims),与代码/文件系统对照,输出差异。
|
|
5
|
-
* 纯代码操作,零 LLM 调用。
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import chalk from 'chalk';
|
|
9
|
-
import * as fs from 'fs';
|
|
10
|
-
import * as path from 'path';
|
|
11
|
-
import { walkFiles } from '../../utils/file-walk';
|
|
12
|
-
|
|
13
|
-
export interface DocFreshnessCheckOptions {
|
|
14
|
-
/** 输出 JSON 格式 */
|
|
15
|
-
format?: 'json' | 'table';
|
|
16
|
-
/** 变更文件列表(逗号分隔),用于聚焦检查 */
|
|
17
|
-
changedFiles?: string;
|
|
18
|
-
/** 项目路径 */
|
|
19
|
-
projectPath?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** 声明类型 */
|
|
23
|
-
export type ClaimType = 'numeric' | 'list' | 'status' | 'narrative';
|
|
24
|
-
|
|
25
|
-
/** 单条声明 */
|
|
26
|
-
export interface Claim {
|
|
27
|
-
/** 原始文本片段 */
|
|
28
|
-
text: string;
|
|
29
|
-
/** 声明类型 */
|
|
30
|
-
type: ClaimType;
|
|
31
|
-
/** 行号 */
|
|
32
|
-
line: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** 验证结果 */
|
|
36
|
-
export interface ClaimResult {
|
|
37
|
-
/** 原始声明 */
|
|
38
|
-
claim: string;
|
|
39
|
-
/** 声明类型 */
|
|
40
|
-
type: ClaimType;
|
|
41
|
-
/** 文档中的期望值 */
|
|
42
|
-
expected: string;
|
|
43
|
-
/** 实际值 */
|
|
44
|
-
actual: string;
|
|
45
|
-
/** 来源文件 */
|
|
46
|
-
file: string;
|
|
47
|
-
/** 是否匹配 */
|
|
48
|
-
match: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ============================================
|
|
52
|
-
// Claim 提取器
|
|
53
|
-
// ============================================
|
|
54
|
-
|
|
55
|
-
/** 数字声明:N 个/条/项 + 名词 */
|
|
56
|
-
const NUMERIC_PATTERNS = [
|
|
57
|
-
/(\d+)\s*个\s*(Agent|角色|能力|子系统|模块|端点|命令|组件|层级|阶段|步骤|断点|问题|维度|门|规则|约束)/g,
|
|
58
|
-
/(\d+)\s*条\s*(知识|规则|约束|命令|铁律|指南|提示|断点|问题|结果|记录)/g,
|
|
59
|
-
/(\d+)\s*项\s*(检查|任务|功能|变更|修复|优化|指标|配置)/g,
|
|
60
|
-
/(\d+)\s*(?:大|层)\s*(能力|约束|架构|层级)/g,
|
|
61
|
-
/(\d+)\s*个\s*(?:CLI\s*)?subcommand/gi,
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
/** 列表声明:A, B, C, ... (至少 3 项) */
|
|
65
|
-
const LIST_PATTERN = /[A-Z][a-zA-Z]+(?:[,,、]\s*[A-Z][a-zA-Z]+){2,}/g;
|
|
66
|
-
|
|
67
|
-
/** 状态标记 */
|
|
68
|
-
const STATUS_PATTERNS = [
|
|
69
|
-
/✅\s*(已完成|已实现|已修复|已部署|已连通|已验证)/g,
|
|
70
|
-
/❌\s*(缺失|未实现|未完成|失败)/g,
|
|
71
|
-
/\bDEPRECATED\b/g,
|
|
72
|
-
/\bTODO\b/g,
|
|
73
|
-
/待(开发|实现|修复|完善|验证)/g,
|
|
74
|
-
/已(废弃|弃用|移除|删除)/g,
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 从 markdown 内容提取 claims
|
|
79
|
-
*/
|
|
80
|
-
export function extractClaims(content: string, filePath: string): ClaimResult[] {
|
|
81
|
-
const lines = content.split('\n');
|
|
82
|
-
const results: ClaimResult[] = [];
|
|
83
|
-
|
|
84
|
-
for (let i = 0; i < lines.length; i++) {
|
|
85
|
-
const line = lines[i];
|
|
86
|
-
|
|
87
|
-
// 数字声明
|
|
88
|
-
for (const pattern of NUMERIC_PATTERNS) {
|
|
89
|
-
pattern.lastIndex = 0;
|
|
90
|
-
let match;
|
|
91
|
-
while ((match = pattern.exec(line)) !== null) {
|
|
92
|
-
const fullMatch = match[0];
|
|
93
|
-
const number = match[1];
|
|
94
|
-
results.push({
|
|
95
|
-
claim: fullMatch,
|
|
96
|
-
type: 'numeric',
|
|
97
|
-
expected: number,
|
|
98
|
-
actual: '', // 待验证
|
|
99
|
-
file: filePath,
|
|
100
|
-
match: false,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// 列表声明
|
|
106
|
-
const listMatches = line.match(LIST_PATTERN);
|
|
107
|
-
if (listMatches) {
|
|
108
|
-
for (const m of listMatches) {
|
|
109
|
-
const items = m.split(/[,,、]/).map(s => s.trim()).filter(Boolean);
|
|
110
|
-
if (items.length >= 3) {
|
|
111
|
-
results.push({
|
|
112
|
-
claim: m,
|
|
113
|
-
type: 'list',
|
|
114
|
-
expected: items.join(', '),
|
|
115
|
-
actual: '', // 待验证
|
|
116
|
-
file: filePath,
|
|
117
|
-
match: false,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 状态标记
|
|
124
|
-
for (const pattern of STATUS_PATTERNS) {
|
|
125
|
-
pattern.lastIndex = 0;
|
|
126
|
-
let match;
|
|
127
|
-
while ((match = pattern.exec(line)) !== null) {
|
|
128
|
-
results.push({
|
|
129
|
-
claim: match[0],
|
|
130
|
-
type: 'status',
|
|
131
|
-
expected: match[0],
|
|
132
|
-
actual: '', // 待验证
|
|
133
|
-
file: filePath,
|
|
134
|
-
match: false,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return results;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// ============================================
|
|
144
|
-
// 验证器
|
|
145
|
-
// ============================================
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* 在项目目录中 grep 搜索匹配内容,返回匹配行数
|
|
149
|
-
*/
|
|
150
|
-
function countGrepMatches(pattern: string, projectPath: string, fileGlob?: string): number {
|
|
151
|
-
const searchDir = projectPath || process.cwd();
|
|
152
|
-
let count = 0;
|
|
153
|
-
const regex = new RegExp(pattern, 'gi');
|
|
154
|
-
|
|
155
|
-
const files = walkFiles(searchDir, {
|
|
156
|
-
skipDirs: ['node_modules', 'dist'],
|
|
157
|
-
skipHidden: true,
|
|
158
|
-
filter: (name) => !fileGlob || matchGlob(name, fileGlob),
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
for (const fullPath of files) {
|
|
162
|
-
try {
|
|
163
|
-
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
164
|
-
const matches = content.match(regex);
|
|
165
|
-
if (matches) count += matches.length;
|
|
166
|
-
} catch {
|
|
167
|
-
// skip unreadable files
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return count;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* 简单 glob 匹配(支持 *.ext 和 *)
|
|
176
|
-
*/
|
|
177
|
-
function matchGlob(filename: string, glob: string): boolean {
|
|
178
|
-
if (glob === '*') return true;
|
|
179
|
-
if (glob.startsWith('*.')) {
|
|
180
|
-
const ext = glob.slice(1);
|
|
181
|
-
return filename.endsWith(ext);
|
|
182
|
-
}
|
|
183
|
-
return filename === glob;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* 验证数字声明:计数相关文件/代码模式
|
|
188
|
-
*/
|
|
189
|
-
function verifyNumericClaim(claim: ClaimResult, projectPath: string): ClaimResult {
|
|
190
|
-
const expected = parseInt(claim.expected, 10);
|
|
191
|
-
|
|
192
|
-
// 从声明文本推断搜索模式
|
|
193
|
-
let searchPattern = '';
|
|
194
|
-
let fileGlob = '*.ts';
|
|
195
|
-
|
|
196
|
-
if (claim.claim.includes('Agent')) {
|
|
197
|
-
searchPattern = 'export (class|interface|function) \\w*Agent';
|
|
198
|
-
} else if (claim.claim.includes('命令') || claim.claim.includes('subcommand')) {
|
|
199
|
-
fileGlob = '*.ts';
|
|
200
|
-
searchPattern = "program\\.command\\(";
|
|
201
|
-
} else if (claim.claim.includes('铁律') || claim.claim.includes('约束') || claim.claim.includes('规则')) {
|
|
202
|
-
searchPattern = "severity:\\s*['\"]?error";
|
|
203
|
-
fileGlob = '*.ts';
|
|
204
|
-
} else if (claim.claim.includes('指南')) {
|
|
205
|
-
searchPattern = "severity:\\s*['\"]?warning";
|
|
206
|
-
fileGlob = '*.ts';
|
|
207
|
-
} else if (claim.claim.includes('端点')) {
|
|
208
|
-
searchPattern = '(router|app)\\.(get|post|put|delete|patch)\\(';
|
|
209
|
-
fileGlob = '*.ts';
|
|
210
|
-
} else {
|
|
211
|
-
// 无法自动验证的数字声明
|
|
212
|
-
return { ...claim, actual: 'N/A (cannot auto-verify)', match: true };
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const actual = countGrepMatches(searchPattern, projectPath, fileGlob);
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
...claim,
|
|
219
|
-
actual: String(actual),
|
|
220
|
-
match: Math.abs(actual - expected) <= Math.max(1, Math.floor(expected * 0.1)), // 10% tolerance
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* 验证列表声明:检查列表中的每一项是否存在于代码中
|
|
226
|
-
*/
|
|
227
|
-
function verifyListClaim(claim: ClaimResult, projectPath: string): ClaimResult {
|
|
228
|
-
const items = claim.expected.split(',').map(s => s.trim());
|
|
229
|
-
const found: string[] = [];
|
|
230
|
-
const missing: string[] = [];
|
|
231
|
-
|
|
232
|
-
for (const item of items) {
|
|
233
|
-
const count = countGrepMatches(item, projectPath);
|
|
234
|
-
if (count > 0) {
|
|
235
|
-
found.push(item);
|
|
236
|
-
} else {
|
|
237
|
-
missing.push(item);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return {
|
|
242
|
-
...claim,
|
|
243
|
-
actual: missing.length === 0
|
|
244
|
-
? `all ${items.length} found`
|
|
245
|
-
: `missing: ${missing.join(', ')}`,
|
|
246
|
-
match: missing.length === 0,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* 验证状态声明:检查标记是否与代码/文件一致
|
|
252
|
-
*/
|
|
253
|
-
function verifyStatusClaim(claim: ClaimResult, _projectPath: string): ClaimResult {
|
|
254
|
-
// 状态声明的验证较复杂,标记为需要人工确认
|
|
255
|
-
return {
|
|
256
|
-
...claim,
|
|
257
|
-
actual: 'needs manual verification',
|
|
258
|
-
match: true, // 不阻断
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* 验证所有 claims
|
|
264
|
-
*/
|
|
265
|
-
export function verifyClaims(
|
|
266
|
-
claims: ClaimResult[],
|
|
267
|
-
projectPath: string,
|
|
268
|
-
): ClaimResult[] {
|
|
269
|
-
return claims.map(claim => {
|
|
270
|
-
switch (claim.type) {
|
|
271
|
-
case 'numeric':
|
|
272
|
-
return verifyNumericClaim(claim, projectPath);
|
|
273
|
-
case 'list':
|
|
274
|
-
return verifyListClaim(claim, projectPath);
|
|
275
|
-
case 'status':
|
|
276
|
-
return verifyStatusClaim(claim, projectPath);
|
|
277
|
-
default:
|
|
278
|
-
return { ...claim, actual: 'N/A', match: true };
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// ============================================
|
|
284
|
-
// 输出格式化
|
|
285
|
-
// ============================================
|
|
286
|
-
|
|
287
|
-
function formatTable(results: ClaimResult[]): string {
|
|
288
|
-
if (results.length === 0) return chalk.yellow('未发现可验证的声明');
|
|
289
|
-
|
|
290
|
-
const lines: string[] = [];
|
|
291
|
-
lines.push(chalk.blue(`文档新鲜度检查 (${results.length} 条声明)\n`));
|
|
292
|
-
|
|
293
|
-
// 统计
|
|
294
|
-
const mismatches = results.filter(r => !r.match);
|
|
295
|
-
lines.push(chalk.bold(` 匹配: ${results.length - mismatches.length}/${results.length}`));
|
|
296
|
-
if (mismatches.length > 0) {
|
|
297
|
-
lines.push(chalk.red(` 不匹配: ${mismatches.length}\n`));
|
|
298
|
-
} else {
|
|
299
|
-
lines.push(chalk.green(' 全部匹配\n'));
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// 按类型分组
|
|
303
|
-
const byType: Record<string, ClaimResult[]> = {};
|
|
304
|
-
for (const r of results) {
|
|
305
|
-
if (!byType[r.type]) byType[r.type] = [];
|
|
306
|
-
byType[r.type].push(r);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const typeLabels: Record<string, string> = {
|
|
310
|
-
numeric: '数字声明',
|
|
311
|
-
list: '列表声明',
|
|
312
|
-
status: '状态标记',
|
|
313
|
-
narrative: '叙述声明',
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
for (const [type, items] of Object.entries(byType)) {
|
|
317
|
-
lines.push(chalk.bold(` ${typeLabels[type] || type} (${items.length}):`));
|
|
318
|
-
for (const item of items) {
|
|
319
|
-
const icon = item.match ? chalk.green('✓') : chalk.red('✗');
|
|
320
|
-
lines.push(` ${icon} ${item.claim}`);
|
|
321
|
-
if (!item.match) {
|
|
322
|
-
lines.push(` 期望: ${item.expected}`);
|
|
323
|
-
lines.push(` 实际: ${chalk.yellow(item.actual)}`);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
lines.push('');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return lines.join('\n');
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// ============================================
|
|
333
|
-
// 主入口
|
|
334
|
-
// ============================================
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* doc-freshness-check CLI 命令
|
|
338
|
-
*/
|
|
339
|
-
export async function docFreshnessCheck(
|
|
340
|
-
docPath: string,
|
|
341
|
-
options: DocFreshnessCheckOptions = {},
|
|
342
|
-
): Promise<void> {
|
|
343
|
-
// 验证文件存在
|
|
344
|
-
const resolvedPath = path.resolve(docPath);
|
|
345
|
-
if (!fs.existsSync(resolvedPath)) {
|
|
346
|
-
console.error(chalk.red(`文件不存在: ${resolvedPath}`));
|
|
347
|
-
process.exitCode = 1;
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (!resolvedPath.endsWith('.md')) {
|
|
352
|
-
console.error(chalk.yellow(`警告: 文件不是 .md 格式,可能无法正确解析`));
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
const projectPath = options.projectPath || path.dirname(resolvedPath);
|
|
356
|
-
|
|
357
|
-
// 读取文档
|
|
358
|
-
const content = fs.readFileSync(resolvedPath, 'utf-8');
|
|
359
|
-
|
|
360
|
-
// 提取声明
|
|
361
|
-
const claims = extractClaims(content, resolvedPath);
|
|
362
|
-
|
|
363
|
-
// 如果指定了变更文件,只验证与变更文件相关的声明
|
|
364
|
-
if (options.changedFiles) {
|
|
365
|
-
const changed = options.changedFiles.split(',').map(s => s.trim());
|
|
366
|
-
// 过滤:保留所有 claims,但只验证与变更文件相关的
|
|
367
|
-
// 实际实现中可以根据声明内容推断相关文件
|
|
368
|
-
void changed; // 预留
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// 验证
|
|
372
|
-
const results = verifyClaims(claims, projectPath);
|
|
373
|
-
|
|
374
|
-
// 输出
|
|
375
|
-
if (options.format === 'json') {
|
|
376
|
-
console.log(JSON.stringify(results, null, 2));
|
|
377
|
-
} else {
|
|
378
|
-
console.log(formatTable(results));
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// 有不匹配时 exit 1
|
|
382
|
-
const mismatches = results.filter(r => !r.match);
|
|
383
|
-
if (mismatches.length > 0) {
|
|
384
|
-
process.exitCode = 1;
|
|
385
|
-
}
|
|
386
|
-
}
|
package/src/spec/CONTEXT.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# spec/
|
|
2
|
-
|
|
3
|
-
## 职责
|
|
4
|
-
(空目录)原 @spec 注释规范检查(annotation-checker)已随 ADR-0003 删除。
|
|
5
|
-
|
|
6
|
-
## 已接线的 spec 故事
|
|
7
|
-
- `src/core/spec/validator.ts` — SpecValidator:spec 文档结构/内容验证(CLI `harness spec` 消费)
|
|
8
|
-
- `src/gates/acceptance.ts` — SpecAcceptanceGate:验收标准门禁
|
|
9
|
-
|
|
10
|
-
## 注意事项
|
|
11
|
-
- @spec 注释检查若需恢复,应迁移为 ConstraintCheck 注册进闭环注册表(ADR-0003 后续立项),不在本目录重建独立子系统
|
package/src/types/index.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 类型导出
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// 约束类型(三层体系)
|
|
6
|
-
export * from './constraint';
|
|
7
|
-
|
|
8
|
-
export * from './checkpoint';
|
|
9
|
-
export * from './passes-gate';
|
|
10
|
-
export * from './cso';
|
|
11
|
-
|
|
12
|
-
// Trace 类型(Execution Trace 系统)
|
|
13
|
-
export * from './trace';
|
|
14
|
-
|
|
15
|
-
// Session 类型(排除与 passes-gate 冲突的类型)
|
|
16
|
-
export {
|
|
17
|
-
StartupCheckpoints,
|
|
18
|
-
StartupCheckpointType,
|
|
19
|
-
StartupCheckpointResult,
|
|
20
|
-
CleanStateConfig,
|
|
21
|
-
CleanStateResult,
|
|
22
|
-
DetectedBug,
|
|
23
|
-
TaskListJson,
|
|
24
|
-
TaskStepStatus,
|
|
25
|
-
SessionInfo,
|
|
26
|
-
} from './session';
|
|
27
|
-
|
|
28
|
-
// 从 session 导入 DynamicTask,扩展 passes-gate 的定义
|
|
29
|
-
export { DynamicTask as ExtendedDynamicTask, TaskTestResult as ExtendedTaskTestResult } from './session';
|
|
30
|
-
|
|
31
|
-
// 项目配置类型
|
|
32
|
-
export * from './project-config';
|
|
33
|
-
|
|
34
|
-
// Spec 验证类型
|
|
35
|
-
export * from './spec';
|
|
36
|
-
|
|
37
|
-
// Failure 类型(定义已归位 types/failure.ts,failure 模块经 failure/types.ts 再导出保持兼容)
|
|
38
|
-
// 显式再导出(不用 export *):根入口同时星导出 ./failure,星-星歧义会静默丢符号
|
|
39
|
-
export {
|
|
40
|
-
ErrorType,
|
|
41
|
-
FailureLevel,
|
|
42
|
-
ErrorClassificationRule,
|
|
43
|
-
FailureRecord,
|
|
44
|
-
ClassificationResult,
|
|
45
|
-
DEFAULT_CLASSIFICATION_RULES,
|
|
46
|
-
DEFAULT_LEVEL_MAPPING,
|
|
47
|
-
} from './failure';
|