@dommaker/harness 1.3.0 ā 1.5.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 +20 -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 +104 -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 +27 -219
- 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 +17 -30
- package/dist/cli/commands/knowledge.d.ts.map +1 -1
- package/dist/cli/commands/knowledge.js +183 -273
- 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 +9 -3
- package/dist/cli/commands/update-user-model.d.ts.map +1 -1
- package/dist/cli/commands/update-user-model.js +56 -61
- 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 +68 -117
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.d.ts +20 -8
- package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.js +66 -77
- 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 +49 -66
- 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/index.d.ts +2 -2
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +2 -1
- package/dist/core/constraints/checkers/index.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 +43 -4
- package/dist/core/constraints/checkers/types.d.ts.map +1 -1
- package/dist/core/constraints/checkers/types.js +33 -0
- package/dist/core/constraints/checkers/types.js.map +1 -1
- 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 +2 -1
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +11 -13
- 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 +8 -18
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js +6 -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/types/trace.d.ts +9 -0
- package/dist/types/trace.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 +8 -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 +130 -101
- 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 +23 -8
- 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 +107 -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 +448 -378
- 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 +231 -0
- package/src/cli/commands/__tests__/registry.test.ts +75 -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 +97 -34
- 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 +127 -66
- 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 +34 -227
- package/src/cli/commands/failure.ts +33 -26
- package/src/cli/commands/init.ts +166 -220
- package/src/cli/commands/knowledge.ts +192 -289
- 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 +64 -61
- 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 +10 -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 +82 -133
- package/src/core/constraints/checkers/__tests__/capability-sync.test.ts +273 -0
- package/src/core/constraints/checkers/__tests__/check-outcome.test.ts +176 -0
- package/src/core/constraints/checkers/__tests__/context-doc-sync.test.ts +77 -0
- package/src/core/constraints/checkers/__tests__/docs-freshness.test.ts +126 -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 +153 -0
- package/src/core/constraints/checkers/capability-sync.ts +75 -96
- package/src/core/constraints/checkers/context-doc-sync.ts +15 -25
- package/src/core/constraints/checkers/docs-freshness.ts +54 -70
- package/src/core/constraints/checkers/governance-presence.ts +7 -25
- package/src/core/constraints/checkers/index.ts +9 -2
- package/src/core/constraints/checkers/no-test-simplification.ts +4 -3
- package/src/core/constraints/checkers/types.ts +60 -4
- 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 +7 -4
- 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__/checker-gate.test.ts +24 -0
- 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 +12 -15
- 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 +16 -27
- 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/types/trace.ts +10 -0
- 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
|
@@ -8,8 +8,9 @@ import chalk from 'chalk';
|
|
|
8
8
|
import * as fs from 'fs/promises';
|
|
9
9
|
import * as path from 'path';
|
|
10
10
|
import { execAsync } from '../../utils/exec';
|
|
11
|
-
import { PassesGate } from '../../core/validators/passes-gate';
|
|
11
|
+
import { PassesGate, detectTestCommand } from '../../core/validators/passes-gate';
|
|
12
12
|
import type { PassesGateConfig } from '../../types/passes-gate';
|
|
13
|
+
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
13
14
|
|
|
14
15
|
export interface PassesGateOptions {
|
|
15
16
|
/** ęµčÆå½ä»¤ */
|
|
@@ -22,45 +23,14 @@ export interface PassesGateOptions {
|
|
|
22
23
|
maxRetries?: number;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
/**
|
|
26
|
-
* ę£ęµé”¹ē®ēęµčÆå½ä»¤
|
|
27
|
-
*/
|
|
28
|
-
async function detectTestCommand(projectPath: string): Promise<string | undefined> {
|
|
29
|
-
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const content = await fs.readFile(packageJsonPath, 'utf-8');
|
|
33
|
-
const pkg = JSON.parse(content);
|
|
34
|
-
|
|
35
|
-
if (pkg.scripts?.test && pkg.scripts.test !== 'echo "Error: no test specified"') {
|
|
36
|
-
return 'npm test';
|
|
37
|
-
}
|
|
38
|
-
if (pkg.scripts?.['test:ci']) {
|
|
39
|
-
return 'npm run test:ci';
|
|
40
|
-
}
|
|
41
|
-
} catch {
|
|
42
|
-
// ę²”ę package.json
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ę£ę„å
¶ä»é”¹ē®ē±»å
|
|
46
|
-
try {
|
|
47
|
-
await fs.access(path.join(projectPath, 'pytest.ini'));
|
|
48
|
-
return 'pytest';
|
|
49
|
-
} catch {}
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
await fs.access(path.join(projectPath, 'go.mod'));
|
|
53
|
-
return 'go test ./...';
|
|
54
|
-
} catch {}
|
|
55
|
-
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
26
|
/**
|
|
60
27
|
* ę§č”ęµčÆéØę§
|
|
61
28
|
*/
|
|
62
|
-
export async function runPassesGate(
|
|
63
|
-
|
|
29
|
+
export async function runPassesGate(
|
|
30
|
+
options: PassesGateOptions,
|
|
31
|
+
io: CommandIO = processIO,
|
|
32
|
+
): Promise<CommandResult> {
|
|
33
|
+
log(io, chalk.blue('š¦ čæč”ęµčÆéØę§...'));
|
|
64
34
|
|
|
65
35
|
const projectPath = options.projectPath || process.cwd();
|
|
66
36
|
|
|
@@ -71,12 +41,12 @@ export async function runPassesGate(options: PassesGateOptions): Promise<void> {
|
|
|
71
41
|
}
|
|
72
42
|
|
|
73
43
|
if (!testCommand) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return;
|
|
44
|
+
log(io, chalk.yellow('ā ļø ęŖę£ęµå°ęµčÆå½ä»¤ļ¼č·³čæęµčÆéØę§'));
|
|
45
|
+
log(io, chalk.gray('ę示: ä½æēØ --test-command ęå®ęµčÆå½ä»¤'));
|
|
46
|
+
return { kind: 'skip', reason: 'ęŖę£ęµå°ęµčÆå½ä»¤' };
|
|
77
47
|
}
|
|
78
48
|
|
|
79
|
-
|
|
49
|
+
log(io, chalk.gray(`ęµčÆå½ä»¤: ${testCommand}`));
|
|
80
50
|
|
|
81
51
|
// é
ē½®
|
|
82
52
|
const config: PassesGateConfig = {
|
|
@@ -91,43 +61,63 @@ export async function runPassesGate(options: PassesGateOptions): Promise<void> {
|
|
|
91
61
|
const passesGate = new PassesGate(config);
|
|
92
62
|
|
|
93
63
|
try {
|
|
94
|
-
const result = await passesGate.runTests();
|
|
64
|
+
const result = await passesGate.runTests(projectPath);
|
|
95
65
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
66
|
+
log(io);
|
|
67
|
+
log(io, chalk.gray('ęµčÆē»ę:'));
|
|
68
|
+
log(io, chalk.gray(` éčæ: ${result.passedTests}/${result.totalTests}`));
|
|
69
|
+
log(io, chalk.gray(` 失蓄: ${result.failedTests}/${result.totalTests}`));
|
|
70
|
+
log(io, chalk.gray(` čę¶: ${result.duration}ms`));
|
|
101
71
|
|
|
102
72
|
if (result.passed) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
73
|
+
log(io);
|
|
74
|
+
log(io, chalk.green('ā
ęµčÆéØę§éčæ'));
|
|
75
|
+
log(io, chalk.green(' task.passes = true (ē±ęµčÆē»ę设置)'));
|
|
106
76
|
} else {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
77
|
+
log(io);
|
|
78
|
+
log(io, chalk.red('ā ęµčÆéØę§ęŖéčæ'));
|
|
79
|
+
log(io, chalk.red(' task.passes = false'));
|
|
110
80
|
|
|
111
81
|
if (result.failures && result.failures.length > 0) {
|
|
112
|
-
|
|
82
|
+
log(io, chalk.red('\n失蓄ēęµčÆ:'));
|
|
113
83
|
result.failures.forEach(f => {
|
|
114
|
-
|
|
84
|
+
log(io, chalk.red(` - ${f.name}: ${f.message}`));
|
|
115
85
|
});
|
|
116
86
|
}
|
|
117
87
|
|
|
118
|
-
|
|
88
|
+
return { kind: 'fail', reason: `passes-gate denied: ${result.failedTests}/${result.totalTests} äøŖęµčÆå¤±č“„` };
|
|
119
89
|
}
|
|
90
|
+
return { kind: 'ok' };
|
|
120
91
|
} catch (error) {
|
|
121
|
-
|
|
122
|
-
|
|
92
|
+
log(io, chalk.red(`\nā ęµčÆę§č”失蓄: ${(error as Error).message}`));
|
|
93
|
+
return { kind: 'fail', reason: `passes-gate ęµčÆę§č”å¼åøø: ${(error as Error).message}` };
|
|
123
94
|
}
|
|
124
95
|
}
|
|
125
96
|
|
|
97
|
+
/**
|
|
98
|
+
* --coverage č·Æē±å
„å£ļ¼åé7ļ¼ļ¼projectPath å
åŗ + éå¼å¼ŗč½¬ē¼ē»ļ¼
|
|
99
|
+
* čŖ definitions.ts ē optionRoutes args éå
ē§»åå½ä»¤ęØ”åć
|
|
100
|
+
*/
|
|
101
|
+
export async function coverageCheck(
|
|
102
|
+
options: Record<string, unknown>,
|
|
103
|
+
io: CommandIO = processIO,
|
|
104
|
+
): Promise<CommandResult> {
|
|
105
|
+
return checkCoverage(
|
|
106
|
+
(options.projectPath as string) || process.cwd(),
|
|
107
|
+
parseInt(String(options.coverageThreshold), 10),
|
|
108
|
+
io,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
126
112
|
/**
|
|
127
113
|
* ę£ę„ęµčÆč¦ēē
|
|
128
114
|
*/
|
|
129
|
-
export async function checkCoverage(
|
|
130
|
-
|
|
115
|
+
export async function checkCoverage(
|
|
116
|
+
projectPath: string,
|
|
117
|
+
threshold: number = 80,
|
|
118
|
+
io: CommandIO = processIO,
|
|
119
|
+
): Promise<CommandResult> {
|
|
120
|
+
log(io, chalk.blue(`š ę£ę„ęµčÆč¦ēē (éå¼: ${threshold}%)...`));
|
|
131
121
|
|
|
132
122
|
try {
|
|
133
123
|
// čæč”č¦ēēę£ę„
|
|
@@ -142,17 +132,17 @@ export async function checkCoverage(projectPath: string, threshold: number = 80)
|
|
|
142
132
|
|
|
143
133
|
const totalCoverage = coverage.total?.lines?.pct || 0;
|
|
144
134
|
|
|
145
|
-
|
|
135
|
+
log(io, chalk.gray(`å½åč¦ēē: ${totalCoverage}%`));
|
|
146
136
|
|
|
147
137
|
if (totalCoverage >= threshold) {
|
|
148
|
-
|
|
149
|
-
return
|
|
150
|
-
} else {
|
|
151
|
-
console.log(chalk.red(`ā č¦ēēäøč¶³ (${totalCoverage}% < ${threshold}%)`));
|
|
152
|
-
return false;
|
|
138
|
+
log(io, chalk.green(`ā
č¦ēēč¾¾ę (${totalCoverage}% >= ${threshold}%)`));
|
|
139
|
+
return { kind: 'ok' };
|
|
153
140
|
}
|
|
141
|
+
log(io, chalk.red(`ā č¦ēēäøč¶³ (${totalCoverage}% < ${threshold}%)`));
|
|
142
|
+
// åå²č”äøŗļ¼--coverage č·Æē±ēęŖč¾¾ę äøę¹éåŗē ļ¼ä»ę„čæåå¼č¢« bin äø¢å¼ļ¼ā skip äæē 0 é¢
|
|
143
|
+
return { kind: 'skip', reason: `č¦ēēäøč¶³: ${totalCoverage}% < ${threshold}%` };
|
|
154
144
|
} catch (error) {
|
|
155
|
-
|
|
156
|
-
return
|
|
145
|
+
log(io, chalk.yellow(`ā ļø ę ę³č·åč¦ēēäæ”ęÆ: ${(error as Error).message}`));
|
|
146
|
+
return { kind: 'skip', reason: `ę ę³č·åč¦ēēäæ”ęÆ: ${(error as Error).message}` }; // ę ę³č·åę¶č·³čæę£ę„
|
|
157
147
|
}
|
|
158
148
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import { PerformanceGate } from '../../gates/performance';
|
|
9
|
+
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
9
10
|
|
|
10
11
|
export interface PerformanceOptions {
|
|
11
12
|
/** 锹ē®č·Æå¾ */
|
|
@@ -27,8 +28,11 @@ export interface PerformanceOptions {
|
|
|
27
28
|
/**
|
|
28
29
|
* ę§č”ę§č½éØę§
|
|
29
30
|
*/
|
|
30
|
-
export async function performance(
|
|
31
|
-
|
|
31
|
+
export async function performance(
|
|
32
|
+
options: PerformanceOptions,
|
|
33
|
+
io: CommandIO = processIO,
|
|
34
|
+
): Promise<CommandResult> {
|
|
35
|
+
log(io, chalk.blue('ā” ę§č½éØę§ę£ę„...'));
|
|
32
36
|
|
|
33
37
|
const projectPath = options.projectPath || process.cwd();
|
|
34
38
|
|
|
@@ -62,47 +66,48 @@ export async function performance(options: PerformanceOptions): Promise<void> {
|
|
|
62
66
|
} as any);
|
|
63
67
|
|
|
64
68
|
if (result.passed) {
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
log(io);
|
|
70
|
+
log(io, chalk.green('ā
ę§č½éØę§ę£ę„éčæ'));
|
|
67
71
|
|
|
68
72
|
// ę¾ē¤ŗčƦē»ęę
|
|
69
73
|
if (result.details?.metrics) {
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
log(io);
|
|
75
|
+
log(io, chalk.gray('ę§č½ęę :'));
|
|
72
76
|
|
|
73
77
|
const metrics = result.details.metrics as any;
|
|
74
78
|
if (metrics.coverage !== undefined) {
|
|
75
79
|
const threshold = options.coverageThreshold || 80;
|
|
76
80
|
const status = metrics.coverage >= threshold ? 'ā
' : 'ā';
|
|
77
|
-
|
|
81
|
+
log(io, chalk.gray(` č¦ēē: ${metrics.coverage.toFixed(2)}% ${status}`));
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
if (metrics.bundleSize !== undefined) {
|
|
81
85
|
const thresholdKB = options.bundleThreshold || 500;
|
|
82
86
|
const actualKB = metrics.bundleSize / 1024;
|
|
83
87
|
const status = actualKB <= thresholdKB ? 'ā
' : 'ā';
|
|
84
|
-
|
|
88
|
+
log(io, chalk.gray(` ęå
大å°: ${actualKB.toFixed(2)} KB ${status}`));
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
if (metrics.benchmarkTime !== undefined) {
|
|
88
|
-
|
|
92
|
+
log(io, chalk.gray(` åŗåęµčÆ: ${metrics.benchmarkTime}ms`));
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
} else {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
log(io);
|
|
97
|
+
log(io, chalk.red('ā ę§č½éØę§ę£ę„失蓄'));
|
|
98
|
+
log(io, chalk.red(` ${result.message}`));
|
|
95
99
|
if (result.details?.failures) {
|
|
96
100
|
(result.details.failures as string[]).forEach((failure: string) => {
|
|
97
|
-
|
|
101
|
+
log(io, chalk.red(` - ${failure}`));
|
|
98
102
|
});
|
|
99
103
|
}
|
|
100
|
-
|
|
104
|
+
return { kind: 'fail', reason: `performance gate denied: ${result.message}` };
|
|
101
105
|
}
|
|
106
|
+
return { kind: 'ok' };
|
|
102
107
|
} catch (error: any) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
log(io);
|
|
109
|
+
log(io, chalk.red('ā ę§č½éØę§ę£ę„åŗé'));
|
|
110
|
+
log(io, chalk.red(` ${error.message}`));
|
|
111
|
+
return { kind: 'fail', reason: `performance gate error: ${error.message}` };
|
|
107
112
|
}
|
|
108
113
|
}
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* č°ēØ Studio PostEval APIļ¼éŖčÆ plan ęä»¶ē checklist items ęÆå¦é½ę对åŗē staged diffć
|
|
5
5
|
* pre-commit hook 使ēØę¤å½ä»¤é²ę¢"åč£
å®ę"ć
|
|
6
|
+
*
|
|
7
|
+
* å¤å®ē»čæåå¼å¤ęŗ¢ļ¼ę¶ęčÆå®”åé7ļ¼ļ¼API äøåÆēØ/5xx å±"ęŖå¤å®"ā skipļ¼éåŗē é¢ 0 äøåļ¼ļ¼
|
|
8
|
+
* č¦ēēäøč¶³äø 4xx ā failļ¼reason ęęęÆåŖäøé”¹å¦å³ć
|
|
6
9
|
*/
|
|
7
10
|
|
|
8
11
|
import chalk from 'chalk';
|
|
12
|
+
import { log, logError, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
9
13
|
|
|
10
14
|
export interface PostEvalPlanOptions {
|
|
11
15
|
planPath: string;
|
|
@@ -38,7 +42,10 @@ async function fetchWithRetry(url: string, body: string, retries: number): Promi
|
|
|
38
42
|
throw lastError;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
export async function postevalPlan(
|
|
45
|
+
export async function postevalPlan(
|
|
46
|
+
options: PostEvalPlanOptions,
|
|
47
|
+
io: CommandIO = processIO,
|
|
48
|
+
): Promise<CommandResult> {
|
|
42
49
|
const apiPort = process.env.API_PORT || '3001';
|
|
43
50
|
const url = `http://localhost:${apiPort}/api/v1/agents/post-eval/plan-coverage`;
|
|
44
51
|
|
|
@@ -48,12 +55,12 @@ export async function postevalPlan(options: PostEvalPlanOptions): Promise<void>
|
|
|
48
55
|
if (!res.ok) {
|
|
49
56
|
if (res.status >= 500) {
|
|
50
57
|
// Server error ā allow commit with warning (don't block on infrastructure failure)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
logError(io, chalk.yellow(`ā ļø PostEval API unavailable (${res.status}), allowing commit with warning`));
|
|
59
|
+
logError(io, chalk.yellow(` Plan: ${options.planPath}`));
|
|
60
|
+
return { kind: 'skip', reason: `PostEval API ęå”端é误 ${res.status}ļ¼ęŖå¤å®` };
|
|
54
61
|
}
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
logError(io, chalk.red(`ā PostEval API error: ${res.status} ${res.statusText}`));
|
|
63
|
+
return { kind: 'fail', reason: `PostEval API error: ${res.status} ${res.statusText}` };
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
const report = await res.json() as {
|
|
@@ -65,20 +72,27 @@ export async function postevalPlan(options: PostEvalPlanOptions): Promise<void>
|
|
|
65
72
|
const pct = Math.round(report.completeness * 100);
|
|
66
73
|
|
|
67
74
|
if (report.completeness < 1) {
|
|
68
|
-
|
|
75
|
+
logError(io, chalk.red(`ā Plan coverage: ${pct}% (${report.matchedAcs.length}/${report.matchedAcs.length + report.missedAcs.length})`));
|
|
69
76
|
if (report.missedAcs.length > 0) {
|
|
70
|
-
|
|
71
|
-
report.missedAcs.forEach((item: string) =>
|
|
77
|
+
logError(io, chalk.red('Missed items:'));
|
|
78
|
+
report.missedAcs.forEach((item: string) => logError(io, chalk.red(` - ${item}`)));
|
|
72
79
|
}
|
|
73
|
-
|
|
80
|
+
return {
|
|
81
|
+
kind: 'fail',
|
|
82
|
+
reason: `plan coverage ${pct}% < 100%ļ¼ē¼ŗ ${report.missedAcs.length} 锹: ${report.missedAcs.join('; ')}`,
|
|
83
|
+
};
|
|
74
84
|
}
|
|
75
85
|
|
|
76
|
-
|
|
86
|
+
log(io, chalk.green(`ā
Plan coverage: ${pct}%`));
|
|
87
|
+
return { kind: 'ok' };
|
|
77
88
|
} catch (error: any) {
|
|
78
89
|
// API unreachable after all retries ā allow with warning (don't block commits on infra)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
logError(io, chalk.yellow(`ā ļø Studio API unreachable after ${MAX_RETRIES} retries, allowing commit with warning`));
|
|
91
|
+
logError(io, chalk.yellow(` Plan: ${options.planPath}`));
|
|
92
|
+
logError(io, chalk.yellow(` Error: ${error?.code || error?.message || String(error)}`));
|
|
93
|
+
return {
|
|
94
|
+
kind: 'skip',
|
|
95
|
+
reason: `Studio API äøåÆč¾¾ļ¼${error?.code || error?.message || String(error)}ļ¼ļ¼ęŖå¤å®`,
|
|
96
|
+
};
|
|
83
97
|
}
|
|
84
98
|
}
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
* 7. Check private flag
|
|
16
16
|
* 8. npm publish (or skip if PR flow)
|
|
17
17
|
* 9. GitHub Release
|
|
18
|
+
*
|
|
19
|
+
* å¤å®ē»čæåå¼å¤ęŗ¢ļ¼ę¶ęčÆå®”åé7ļ¼ļ¼12 äøŖåē½®éøéØē»“ę**é¦č“„å³å**ļ¼ęÆäøŖéøéØå¤±č“„
|
|
20
|
+
* čæå `gate <id>: <åå >`ļ¼éåŗē ę å°åØ bin/harness.js åÆäøäøå¤ćč¾åŗē»ę³Øå
„ io
|
|
21
|
+
* ęµå¼ęå°ļ¼åéēŗ§åčæēØé¶ę®µäøč½éé»ļ¼ć
|
|
18
22
|
*/
|
|
19
23
|
|
|
20
24
|
import { execSync } from 'child_process';
|
|
@@ -22,6 +26,7 @@ import * as fs from 'fs';
|
|
|
22
26
|
import * as path from 'path';
|
|
23
27
|
import chalk from 'chalk';
|
|
24
28
|
import { verifyReleaseArtifacts } from '../../release';
|
|
29
|
+
import { log, logError, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
25
30
|
|
|
26
31
|
export interface ReleaseOptions {
|
|
27
32
|
bumpType?: 'patch' | 'minor' | 'major';
|
|
@@ -39,7 +44,12 @@ async function run(cmd: string, cwd: string, timeout = 60_000): Promise<{ stdout
|
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
/** éøéØå¤±č“„ē»ęļ¼reason å«éøéØę čÆļ¼åÆč¢«č°ēØę¹ééøéØęčØ */
|
|
48
|
+
function gateFail(gate: string, detail: string): CommandResult {
|
|
49
|
+
return { kind: 'fail', reason: `gate ${gate}: ${detail}` };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function release(options: ReleaseOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
43
53
|
const pkgPath = process.cwd();
|
|
44
54
|
const bumpType = options.bumpType || 'patch';
|
|
45
55
|
const dryRun = options.dryRun === 'true';
|
|
@@ -47,59 +57,59 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
47
57
|
// āā 1. Verify package āā
|
|
48
58
|
const pkgJsonPath = path.join(pkgPath, 'package.json');
|
|
49
59
|
if (!fs.existsSync(pkgJsonPath)) {
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
logError(io, chalk.red(`ā Not a package: ${pkgPath}`));
|
|
61
|
+
return gateFail('package', `not a package: ${pkgPath}`);
|
|
52
62
|
}
|
|
53
63
|
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
|
54
64
|
const pkgName = pkgJson.name;
|
|
55
65
|
const oldVersion = pkgJson.version;
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
log(io, chalk.cyan(`š¦ ${pkgName}@${oldVersion}`));
|
|
67
|
+
log(io, chalk.cyan(` bump: ${bumpType}${dryRun ? ' (dry-run)' : ''}`));
|
|
58
68
|
|
|
59
69
|
// āā 2. Check branch (must be on master/main) āā
|
|
60
70
|
const branchResult = await run('git rev-parse --abbrev-ref HEAD', pkgPath);
|
|
61
71
|
const currentBranch = branchResult.stdout.trim();
|
|
62
72
|
if (currentBranch !== 'master' && currentBranch !== 'main') {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
logError(io, chalk.red(`ā Must be on master or main branch to release. Currently on: ${currentBranch}`));
|
|
74
|
+
logError(io, chalk.gray(' Run: git checkout master && git merge ' + currentBranch));
|
|
75
|
+
return gateFail('branch', `must be on master or main branch, currently on ${currentBranch}`);
|
|
66
76
|
}
|
|
67
|
-
|
|
77
|
+
log(io, chalk.green(`ā
git: on ${currentBranch}`));
|
|
68
78
|
|
|
69
79
|
// āā 2b. Check remote sync āā
|
|
70
80
|
await run('git fetch origin', pkgPath, 15_000);
|
|
71
81
|
const behind = await run(`git rev-list --count HEAD..origin/${currentBranch}`, pkgPath);
|
|
72
82
|
if (behind.stdout.trim() !== '0') {
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
logError(io, chalk.red(`ā Local ${currentBranch} is ${behind.stdout.trim()} commits behind origin/${currentBranch}. Pull first.`));
|
|
84
|
+
return gateFail('remote-sync', `local ${currentBranch} is ${behind.stdout.trim()} commits behind origin/${currentBranch}`);
|
|
75
85
|
}
|
|
76
|
-
|
|
86
|
+
log(io, chalk.green('ā
git: synced with remote'));
|
|
77
87
|
|
|
78
88
|
// āā 2c. Check clean working tree āā
|
|
79
89
|
const stat = await run('git status --porcelain -uno', pkgPath);
|
|
80
90
|
if (stat.stdout.length > 0) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
logError(io, chalk.red('ā Uncommitted changes. Commit or stash before releasing.'));
|
|
92
|
+
logError(io, chalk.gray(stat.stdout.slice(0, 500)));
|
|
93
|
+
return gateFail('clean-tree', 'working tree has uncommitted changes');
|
|
84
94
|
}
|
|
85
|
-
|
|
95
|
+
log(io, chalk.green('ā
git: clean'));
|
|
86
96
|
|
|
87
97
|
// āā 3. tsc build āā
|
|
88
|
-
|
|
98
|
+
log(io, chalk.cyan('šØ Building...'));
|
|
89
99
|
const build = await run('npx tsc', pkgPath, 60_000);
|
|
90
100
|
if (build.stderr && !build.stdout) {
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
logError(io, chalk.red('ā tsc failed:'), build.stderr.slice(0, 800));
|
|
102
|
+
return gateFail('build', `tsc failed: ${build.stderr.slice(0, 200)}`);
|
|
93
103
|
}
|
|
94
|
-
|
|
104
|
+
log(io, chalk.green('ā
tsc: built'));
|
|
95
105
|
|
|
96
106
|
// āā 4. Verify distļ¼ååøē©å®ę“ę§čŖę£ļ¼harness#77ļ¼ęø
åéęŗē 结ę¤ļ¼äøåę¬ę件甬ē¼ē ļ¼āā
|
|
97
107
|
const integrity = verifyReleaseArtifacts(pkgPath);
|
|
98
108
|
if (!integrity.ok) {
|
|
99
|
-
|
|
100
|
-
|
|
109
|
+
logError(io, chalk.red(`ā dist missing critical artifacts (${integrity.missing.length}): ${integrity.missing.join(', ')}`));
|
|
110
|
+
return gateFail('dist-artifacts', `missing critical artifacts: ${integrity.missing.join(', ')}`);
|
|
101
111
|
}
|
|
102
|
-
|
|
112
|
+
log(io, chalk.green(`ā
dist: verified (${integrity.checked.length} critical artifacts)`));
|
|
103
113
|
|
|
104
114
|
if (dryRun) {
|
|
105
115
|
const [major, minor, patch] = oldVersion.split('.').map(Number);
|
|
@@ -107,12 +117,12 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
107
117
|
if (bumpType === 'major') newVer = `${major + 1}.0.0`;
|
|
108
118
|
else if (bumpType === 'minor') newVer = `${major}.${minor + 1}.0`;
|
|
109
119
|
else newVer = `${major}.${minor}.${patch + 1}`;
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
log(io, chalk.yellow(`š Dry-run complete. Would publish: ${pkgName}@${newVer}`));
|
|
121
|
+
return { kind: 'ok' };
|
|
112
122
|
}
|
|
113
123
|
|
|
114
124
|
// āā 5. Bump version (npm version creates git commit + tag atomically) āā
|
|
115
|
-
|
|
125
|
+
log(io, chalk.cyan('š¢ Bumping version...'));
|
|
116
126
|
const [major, minor, patch] = oldVersion.split('.').map(Number);
|
|
117
127
|
let expectedNew: string;
|
|
118
128
|
if (bumpType === 'major') expectedNew = `${major + 1}.0.0`;
|
|
@@ -121,28 +131,28 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
121
131
|
const expectedTag = `v${expectedNew}`;
|
|
122
132
|
const tagExists = await run(`git tag -l "${expectedTag}"`, pkgPath);
|
|
123
133
|
if (tagExists.stdout.trim() === expectedTag) {
|
|
124
|
-
|
|
125
|
-
|
|
134
|
+
logError(io, chalk.red(`ā Tag ${expectedTag} already exists. Version may have been released already.`));
|
|
135
|
+
return gateFail('tag-conflict', `tag ${expectedTag} already exists`);
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
const bump = await run(`npm version ${bumpType} -m "release: %s"`, pkgPath);
|
|
129
139
|
if (bump.stderr && !bump.stdout) {
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
logError(io, chalk.red('ā npm version failed:'), bump.stderr);
|
|
141
|
+
return gateFail('version-bump', `npm version ${bumpType} failed: ${bump.stderr.slice(0, 200)}`);
|
|
132
142
|
}
|
|
133
143
|
const newVersion = bump.stdout.trim().replace(/^v/, '');
|
|
134
144
|
const tag = `v${newVersion}`;
|
|
135
|
-
|
|
145
|
+
log(io, chalk.green(`ā
version: ${oldVersion} ā ${newVersion} (committed + tagged)`));
|
|
136
146
|
|
|
137
147
|
// āā 6. Push (handle protected branch via PR) āā
|
|
138
|
-
|
|
148
|
+
log(io, chalk.cyan('ā¬ļø Pushing...'));
|
|
139
149
|
const push = await run(`git push origin ${currentBranch}`, pkgPath, 30_000);
|
|
140
150
|
const isProtected = push.stderr.includes('GH006') || push.stderr.includes('protected branch');
|
|
141
151
|
|
|
142
152
|
if (isProtected) {
|
|
143
153
|
// Protected branch: create release branch + PR
|
|
144
154
|
const releaseBranch = `release/v${newVersion}`;
|
|
145
|
-
|
|
155
|
+
log(io, chalk.yellow(`ā ļø ${currentBranch} is protected. Creating PR via ${releaseBranch}...`));
|
|
146
156
|
|
|
147
157
|
await run(`git checkout -b ${releaseBranch}`, pkgPath);
|
|
148
158
|
await run(`git push origin ${releaseBranch}`, pkgPath, 30_000);
|
|
@@ -151,59 +161,59 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
151
161
|
const prBody = `## Release ${pkgName}@${newVersion}\n\n- Bump version: ${oldVersion} ā ${newVersion}\n- Changelog updated\n\nAfter merge, push tag to trigger npm publish:\n\`\`\`\ngit push origin ${tag}\n\`\`\``;
|
|
152
162
|
const pr = await run(`gh pr create --title "release: ${pkgName}@${newVersion}" --body "${prBody}" --base ${currentBranch}`, pkgPath, 30_000);
|
|
153
163
|
if (pr.stdout) {
|
|
154
|
-
|
|
164
|
+
log(io, chalk.green(`ā
PR created: ${pr.stdout.trim()}`));
|
|
155
165
|
} else {
|
|
156
|
-
|
|
157
|
-
|
|
166
|
+
logError(io, chalk.red('ā PR creation failed:'), pr.stderr.slice(0, 500));
|
|
167
|
+
return gateFail('pr-create', `gh pr create failed: ${pr.stderr.slice(0, 200)}`);
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
// Switch back to original branch
|
|
161
171
|
await run(`git checkout ${currentBranch}`, pkgPath);
|
|
162
172
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return;
|
|
173
|
+
log(io, chalk.cyan('\nš Next steps:'));
|
|
174
|
+
log(io, chalk.gray(` 1. Merge the PR: ${pr.stdout.trim()}`));
|
|
175
|
+
log(io, chalk.gray(` 2. After merge, push tag to trigger npm publish:`));
|
|
176
|
+
log(io, chalk.gray(` git push origin ${tag}`));
|
|
177
|
+
log(io, chalk.gray(` 3. Or run: gh release create ${tag} --generate-notes`));
|
|
178
|
+
return { kind: 'ok' };
|
|
169
179
|
}
|
|
170
180
|
|
|
171
181
|
if (push.stderr && push.stderr.includes('error')) {
|
|
172
|
-
|
|
173
|
-
|
|
182
|
+
logError(io, chalk.red('ā git push failed:'), push.stderr.slice(0, 500));
|
|
183
|
+
return gateFail('git-push', `git push origin ${currentBranch} failed: ${push.stderr.slice(0, 200)}`);
|
|
174
184
|
}
|
|
175
185
|
await run(`git push origin ${tag}`, pkgPath, 30_000);
|
|
176
|
-
|
|
186
|
+
log(io, chalk.green('ā
git: pushed'));
|
|
177
187
|
|
|
178
188
|
// āā 7. Check private flag āā
|
|
179
189
|
if (pkgJson.private) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
190
|
+
logError(io, chalk.red('ā package.json has "private": true. Remove it before publishing.'));
|
|
191
|
+
logError(io, chalk.gray(' The release tool will NOT auto-remove private flag.'));
|
|
192
|
+
return gateFail('private-flag', 'package.json has "private": true');
|
|
183
193
|
}
|
|
184
|
-
|
|
194
|
+
log(io, chalk.green('ā
package: not private'));
|
|
185
195
|
|
|
186
196
|
// āā 8. npm publish āā
|
|
187
197
|
const origRegistry = await run('npm config get registry', pkgPath);
|
|
188
198
|
await run('npm config set registry https://registry.npmjs.org/', pkgPath);
|
|
189
|
-
|
|
199
|
+
log(io, chalk.cyan('š¤ Publishing to npm...'));
|
|
190
200
|
await run('npm publish --registry https://registry.npmjs.org/', pkgPath, 180_000);
|
|
191
201
|
await run(`npm config set registry ${origRegistry.stdout}`, pkgPath);
|
|
192
202
|
const verify = await run(`npm view ${pkgName} version --registry https://registry.npmjs.org/`, pkgPath);
|
|
193
203
|
if (verify.stdout.trim() === newVersion) {
|
|
194
|
-
|
|
204
|
+
log(io, chalk.green(`ā
npm: published ${pkgName}@${newVersion}`));
|
|
195
205
|
} else {
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
logError(io, chalk.red(`ā npm publish verification failed. Expected ${newVersion}, registry has ${verify.stdout.trim() || '???'}`));
|
|
207
|
+
return gateFail('npm-publish-verify', `expected ${newVersion}, registry has ${verify.stdout.trim() || '???'}`);
|
|
198
208
|
}
|
|
199
209
|
|
|
200
210
|
// āā 9. GitHub Release āā
|
|
201
|
-
|
|
211
|
+
log(io, chalk.cyan('š Creating GitHub Release...'));
|
|
202
212
|
const gh = await run(`gh release create ${tag} --generate-notes`, pkgPath, 30_000);
|
|
203
213
|
if (gh.stderr && gh.stderr.includes('already exists')) {
|
|
204
|
-
|
|
214
|
+
log(io, chalk.yellow(`ā ļø gh: release ${tag} already exists`));
|
|
205
215
|
} else if (gh.stderr) {
|
|
206
|
-
|
|
216
|
+
log(io, chalk.yellow(`ā ļø gh: release may have failed (non-fatal): ${gh.stderr.slice(0, 200)}`));
|
|
207
217
|
} else {
|
|
208
218
|
let repoUrl = '';
|
|
209
219
|
try {
|
|
@@ -211,9 +221,10 @@ export async function release(options: ReleaseOptions): Promise<void> {
|
|
|
211
221
|
const m = remoteUrl.match(/github\.com[:/]([^/]+)\/([^/\s.]+?)(?:\.git)?$/);
|
|
212
222
|
if (m) repoUrl = `https://github.com/${m[1]}/${m[2]}/releases/tag/${tag}`;
|
|
213
223
|
} catch { /* no remote */ }
|
|
214
|
-
|
|
224
|
+
log(io, chalk.green(`ā
GitHub Release: ${repoUrl || tag}`));
|
|
215
225
|
}
|
|
216
226
|
|
|
217
|
-
|
|
218
|
-
|
|
227
|
+
log(io, chalk.green(`\nš Released ${pkgName}@${newVersion}`));
|
|
228
|
+
log(io, chalk.gray(` npm: https://www.npmjs.com/package/${pkgName}/v/${newVersion}`));
|
|
229
|
+
return { kind: 'ok' };
|
|
219
230
|
}
|