@dommaker/harness 2.0.0 → 3.0.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 +19 -0
- package/README.md +7 -7
- package/dist/agents/index.d.ts +1 -2
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/lifecycle.d.ts +2 -34
- package/dist/agents/lifecycle.d.ts.map +1 -1
- package/dist/agents/lifecycle.js +1 -100
- package/dist/agents/lifecycle.js.map +1 -1
- package/dist/agents/types.d.ts +1 -19
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/{hooks → bootstrap}/bootstrap.d.ts +9 -3
- package/dist/bootstrap/bootstrap.d.ts.map +1 -0
- package/dist/{hooks → bootstrap}/bootstrap.js +26 -30
- package/dist/bootstrap/bootstrap.js.map +1 -0
- package/dist/{hooks → bootstrap}/index.d.ts +3 -2
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/{hooks → bootstrap}/index.js +3 -2
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/cli/commands/acceptance.d.ts.map +1 -1
- package/dist/cli/commands/acceptance.js +1 -1
- package/dist/cli/commands/acceptance.js.map +1 -1
- package/dist/cli/commands/check.d.ts +1 -1
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +12 -5
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/command.d.ts.map +1 -1
- package/dist/cli/commands/command.js +9 -5
- package/dist/cli/commands/command.js.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.d.ts.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.js +11 -8
- package/dist/cli/commands/constraints-pack-proposal.js.map +1 -1
- package/dist/cli/commands/constraints-reactivate.d.ts +10 -2
- package/dist/cli/commands/constraints-reactivate.d.ts.map +1 -1
- package/dist/cli/commands/constraints-reactivate.js +2 -6
- package/dist/cli/commands/constraints-reactivate.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +23 -5
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +17 -8
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/contract.d.ts.map +1 -1
- package/dist/cli/commands/contract.js +4 -6
- package/dist/cli/commands/contract.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts +2 -73
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js +2 -7
- package/dist/cli/commands/definitions.js.map +1 -1
- package/dist/cli/commands/failure.d.ts.map +1 -1
- package/dist/cli/commands/failure.js +5 -6
- package/dist/cli/commands/failure.js.map +1 -1
- package/dist/cli/commands/knowledge/health.d.ts +4 -2
- package/dist/cli/commands/knowledge/health.d.ts.map +1 -1
- package/dist/cli/commands/knowledge/health.js +25 -19
- package/dist/cli/commands/knowledge/health.js.map +1 -1
- package/dist/cli/commands/knowledge/import.d.ts +1 -1
- package/dist/cli/commands/knowledge/import.js +2 -2
- package/dist/cli/commands/knowledge/import.js.map +1 -1
- package/dist/cli/commands/knowledge/search.d.ts.map +1 -1
- package/dist/cli/commands/knowledge/search.js +1 -2
- package/dist/cli/commands/knowledge/search.js.map +1 -1
- package/dist/cli/commands/knowledge/store-access.d.ts +25 -0
- package/dist/cli/commands/knowledge/store-access.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/store-access.js +69 -0
- package/dist/cli/commands/knowledge/store-access.js.map +1 -0
- package/dist/cli/commands/knowledge-view.d.ts +6 -18
- package/dist/cli/commands/knowledge-view.d.ts.map +1 -1
- package/dist/cli/commands/knowledge-view.js +10 -61
- package/dist/cli/commands/knowledge-view.js.map +1 -1
- package/dist/cli/commands/passes-gate.d.ts.map +1 -1
- package/dist/cli/commands/passes-gate.js +7 -6
- package/dist/cli/commands/passes-gate.js.map +1 -1
- package/dist/cli/commands/release.d.ts +1 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +12 -18
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/review.d.ts.map +1 -1
- package/dist/cli/commands/review.js +15 -4
- package/dist/cli/commands/review.js.map +1 -1
- package/dist/cli/commands/security.d.ts.map +1 -1
- package/dist/cli/commands/security.js +6 -0
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/{core → cli/commands}/spec/validator.d.ts +9 -18
- package/dist/cli/commands/spec/validator.d.ts.map +1 -0
- package/dist/{core → cli/commands}/spec/validator.js +11 -42
- package/dist/cli/commands/spec/validator.js.map +1 -0
- package/dist/cli/commands/spec-baseline-check.d.ts +8 -41
- package/dist/cli/commands/spec-baseline-check.d.ts.map +1 -1
- package/dist/cli/commands/spec-baseline-check.js +31 -238
- package/dist/cli/commands/spec-baseline-check.js.map +1 -1
- package/dist/cli/commands/spec.d.ts +1 -1
- package/dist/cli/commands/spec.d.ts.map +1 -1
- package/dist/cli/commands/spec.js +14 -11
- package/dist/cli/commands/spec.js.map +1 -1
- package/dist/cli/commands/status.d.ts +0 -2
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +3 -9
- package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/compact.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/compact.js +15 -15
- package/dist/cli/commands/sync-docs/compact.js.map +1 -1
- package/dist/cli/commands/sync-docs/main-flow.d.ts +7 -23
- package/dist/cli/commands/sync-docs/main-flow.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/main-flow.js +27 -419
- package/dist/cli/commands/sync-docs/main-flow.js.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.js +2 -1
- package/dist/cli/commands/sync-docs/project-reader.js.map +1 -1
- package/dist/cli/commands/sync-docs/sync-output.d.ts +15 -0
- package/dist/cli/commands/sync-docs/sync-output.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/sync-output.js +217 -0
- package/dist/cli/commands/sync-docs/sync-output.js.map +1 -0
- package/dist/cli/commands/sync-docs/sync-state.d.ts +71 -0
- package/dist/cli/commands/sync-docs/sync-state.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/sync-state.js +274 -0
- package/dist/cli/commands/sync-docs/sync-state.js.map +1 -0
- package/dist/cli/commands/sync-docs/sync-writes.d.ts +12 -0
- package/dist/cli/commands/sync-docs/sync-writes.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/sync-writes.js +72 -0
- package/dist/cli/commands/sync-docs/sync-writes.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +0 -2
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +13 -6
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/session-manager.d.ts +0 -4
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +0 -36
- package/dist/context/session-manager.js.map +1 -1
- package/dist/context/types.d.ts +2 -24
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/types.js +2 -1
- package/dist/context/types.js.map +1 -1
- package/dist/core/app-constraints-loader.d.ts +1 -1
- package/dist/core/app-constraints-loader.d.ts.map +1 -1
- package/dist/core/app-constraints-loader.js +6 -23
- package/dist/core/app-constraints-loader.js.map +1 -1
- package/dist/core/constraint-lifecycle.d.ts +3 -8
- package/dist/core/constraint-lifecycle.d.ts.map +1 -1
- package/dist/core/constraint-lifecycle.js +26 -30
- package/dist/core/constraint-lifecycle.js.map +1 -1
- package/dist/core/constraints/check-cache.d.ts +4 -43
- package/dist/core/constraints/check-cache.d.ts.map +1 -1
- package/dist/core/constraints/check-cache.js +6 -51
- package/dist/core/constraints/check-cache.js.map +1 -1
- package/dist/core/constraints/checker.d.ts +0 -16
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +23 -64
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.js +3 -3
- package/dist/core/constraints/checkers/capability-sync.js.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.js +2 -2
- package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.js +5 -5
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
- package/dist/core/constraints/checkers/index.d.ts +17 -3
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +22 -10
- package/dist/core/constraints/checkers/index.js.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +5 -34
- package/dist/core/constraints/checkers/no-hardcoded-credentials.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 +11 -33
- package/dist/core/constraints/checkers/no-test-simplification.js.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.js +3 -8
- package/dist/core/constraints/checkers/templated/exec.js.map +1 -1
- package/dist/core/constraints/checkers/templated/regex-scan.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/regex-scan.js +8 -26
- package/dist/core/constraints/checkers/templated/regex-scan.js.map +1 -1
- package/dist/core/constraints/checkers/types.d.ts +10 -33
- package/dist/core/constraints/checkers/types.d.ts.map +1 -1
- package/dist/core/constraints/checkers/types.js +6 -46
- package/dist/core/constraints/checkers/types.js.map +1 -1
- package/dist/core/constraints/context-builder.d.ts +8 -26
- package/dist/core/constraints/context-builder.d.ts.map +1 -1
- package/dist/core/constraints/context-builder.js +9 -81
- package/dist/core/constraints/context-builder.js.map +1 -1
- package/dist/core/constraints/definitions/{iron-laws.d.ts → errors.d.ts} +1 -2
- package/dist/core/constraints/definitions/errors.d.ts.map +1 -0
- package/dist/core/constraints/definitions/{iron-laws.js → errors.js} +1 -5
- package/dist/core/constraints/definitions/errors.js.map +1 -0
- package/dist/core/constraints/definitions/{guidelines.d.ts → warnings.d.ts} +1 -2
- package/dist/core/constraints/definitions/warnings.d.ts.map +1 -0
- package/dist/core/constraints/definitions/{guidelines.js → warnings.js} +1 -6
- package/dist/core/constraints/definitions/warnings.js.map +1 -0
- package/dist/core/constraints/definitions.d.ts +2 -1
- package/dist/core/constraints/definitions.d.ts.map +1 -1
- package/dist/core/constraints/definitions.js +6 -5
- package/dist/core/constraints/definitions.js.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts +0 -9
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +0 -1
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- package/dist/core/constraints/find-constraint.d.ts +14 -0
- package/dist/core/constraints/find-constraint.d.ts.map +1 -0
- package/dist/core/constraints/find-constraint.js +25 -0
- package/dist/core/constraints/find-constraint.js.map +1 -0
- package/dist/core/constraints/governance-accessors.d.ts +54 -0
- package/dist/core/constraints/governance-accessors.d.ts.map +1 -0
- package/dist/core/constraints/governance-accessors.js +62 -0
- package/dist/core/constraints/governance-accessors.js.map +1 -0
- package/dist/core/constraints/index.d.ts +4 -4
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +1 -4
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/pack-proposal.d.ts.map +1 -1
- package/dist/core/constraints/pack-proposal.js +3 -14
- package/dist/core/constraints/pack-proposal.js.map +1 -1
- package/dist/core/constraints/run-env.d.ts +1 -13
- package/dist/core/constraints/run-env.d.ts.map +1 -1
- package/dist/core/constraints/run-env.js +2 -23
- package/dist/core/constraints/run-env.js.map +1 -1
- package/dist/core/constraints/triggers.d.ts +10 -6
- package/dist/core/constraints/triggers.d.ts.map +1 -1
- package/dist/core/constraints/triggers.js +11 -5
- package/dist/core/constraints/triggers.js.map +1 -1
- package/dist/core/constraints/usage-report.d.ts +0 -6
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +0 -9
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +7 -8
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +5 -43
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +4 -49
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/core/spec/baseline-check.d.ts +54 -0
- package/dist/core/spec/baseline-check.d.ts.map +1 -0
- package/dist/core/spec/baseline-check.js +261 -0
- package/dist/core/spec/baseline-check.js.map +1 -0
- package/dist/core/validators/check-handlers/file.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/file.js +49 -5
- package/dist/core/validators/check-handlers/file.js.map +1 -1
- package/dist/core/validators/checkpoint.d.ts +5 -13
- package/dist/core/validators/checkpoint.d.ts.map +1 -1
- package/dist/core/validators/checkpoint.js +53 -80
- package/dist/core/validators/checkpoint.js.map +1 -1
- package/dist/core/validators/cso.d.ts +1 -4
- package/dist/core/validators/cso.d.ts.map +1 -1
- package/dist/core/validators/cso.js +1 -9
- package/dist/core/validators/cso.js.map +1 -1
- package/dist/core/validators/passes-gate.d.ts +0 -4
- package/dist/core/validators/passes-gate.d.ts.map +1 -1
- package/dist/core/validators/passes-gate.js +0 -9
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/failure/classifier.d.ts +2 -21
- package/dist/failure/classifier.d.ts.map +1 -1
- package/dist/failure/classifier.js +7 -42
- package/dist/failure/classifier.js.map +1 -1
- package/dist/failure/error-types.d.ts +48 -0
- package/dist/failure/error-types.d.ts.map +1 -0
- package/dist/failure/error-types.js +122 -0
- package/dist/failure/error-types.js.map +1 -0
- package/dist/failure/index.d.ts +4 -3
- package/dist/failure/index.d.ts.map +1 -1
- package/dist/failure/index.js +8 -10
- package/dist/failure/index.js.map +1 -1
- package/dist/failure/recorder.d.ts +7 -27
- package/dist/failure/recorder.d.ts.map +1 -1
- package/dist/failure/recorder.js +11 -64
- package/dist/failure/recorder.js.map +1 -1
- package/dist/gates/acceptance.d.ts +7 -2
- package/dist/gates/acceptance.d.ts.map +1 -1
- package/dist/gates/acceptance.js +30 -36
- package/dist/gates/acceptance.js.map +1 -1
- package/dist/gates/command.d.ts +0 -16
- package/dist/gates/command.d.ts.map +1 -1
- package/dist/gates/command.js +0 -29
- package/dist/gates/command.js.map +1 -1
- package/dist/gates/contract.d.ts +0 -8
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js +3 -17
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/definitions.d.ts +1 -1
- package/dist/gates/performance.d.ts +1 -15
- package/dist/gates/performance.d.ts.map +1 -1
- package/dist/gates/performance.js +0 -19
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/registry.d.ts.map +1 -1
- package/dist/gates/registry.js +2 -5
- package/dist/gates/registry.js.map +1 -1
- package/dist/gates/review.d.ts +1 -9
- package/dist/gates/review.d.ts.map +1 -1
- package/dist/gates/review.js +22 -19
- package/dist/gates/review.js.map +1 -1
- package/dist/gates/security.d.ts +2 -9
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +7 -35
- package/dist/gates/security.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -16
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit-rules.d.ts +2 -0
- package/dist/knowledge/audit-rules.d.ts.map +1 -1
- package/dist/knowledge/audit-rules.js +10 -7
- package/dist/knowledge/audit-rules.js.map +1 -1
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/audit.js +3 -1
- package/dist/knowledge/audit.js.map +1 -1
- package/dist/knowledge/{import.d.ts → cold-start.d.ts} +2 -3
- package/dist/knowledge/cold-start.d.ts.map +1 -0
- package/dist/knowledge/{import.js → cold-start.js} +135 -182
- package/dist/knowledge/cold-start.js.map +1 -0
- package/dist/knowledge/index.d.ts +3 -5
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +3 -9
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/ingest.d.ts +29 -1
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +97 -7
- package/dist/knowledge/ingest.js.map +1 -1
- package/dist/knowledge/lifecycle.d.ts +0 -5
- package/dist/knowledge/lifecycle.d.ts.map +1 -1
- package/dist/knowledge/lifecycle.js +12 -19
- package/dist/knowledge/lifecycle.js.map +1 -1
- package/dist/knowledge/query.js +1 -1
- package/dist/knowledge/query.js.map +1 -1
- package/dist/knowledge/store.d.ts +4 -7
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +9 -27
- package/dist/knowledge/store.js.map +1 -1
- package/dist/knowledge/types.d.ts +2 -36
- package/dist/knowledge/types.d.ts.map +1 -1
- package/dist/knowledge/types.js +2 -3
- package/dist/knowledge/types.js.map +1 -1
- package/dist/monitoring/analyzer-base.d.ts +1 -10
- package/dist/monitoring/analyzer-base.d.ts.map +1 -1
- package/dist/monitoring/analyzer-base.js +1 -58
- package/dist/monitoring/analyzer-base.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +1 -52
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +2 -131
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +1 -14
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +3 -25
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/types/command-definition.d.ts +81 -0
- package/dist/types/command-definition.d.ts.map +1 -0
- package/dist/types/command-definition.js +10 -0
- package/dist/types/command-definition.js.map +1 -0
- package/dist/types/constraint.d.ts +3 -24
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/failure.d.ts +6 -39
- package/dist/types/failure.d.ts.map +1 -1
- package/dist/types/failure.js +6 -112
- package/dist/types/failure.js.map +1 -1
- package/dist/types/spec.d.ts +0 -4
- package/dist/types/spec.d.ts.map +1 -1
- package/dist/types/trace.d.ts +0 -4
- package/dist/types/trace.d.ts.map +1 -1
- package/dist/utils/clip.d.ts +8 -0
- package/dist/utils/clip.d.ts.map +1 -0
- package/dist/utils/clip.js +15 -0
- package/dist/utils/clip.js.map +1 -0
- package/dist/utils/diff-parse.d.ts +31 -0
- package/dist/utils/diff-parse.d.ts.map +1 -0
- package/dist/utils/diff-parse.js +72 -0
- package/dist/utils/diff-parse.js.map +1 -0
- package/dist/utils/guards.d.ts +6 -0
- package/dist/utils/guards.d.ts.map +1 -0
- package/dist/utils/guards.js +11 -0
- package/dist/utils/guards.js.map +1 -0
- package/dist/utils/jsonl.d.ts +0 -12
- package/dist/utils/jsonl.d.ts.map +1 -1
- package/dist/utils/jsonl.js +0 -12
- package/dist/utils/jsonl.js.map +1 -1
- package/dist/utils/log-rotate.d.ts +14 -0
- package/dist/utils/log-rotate.d.ts.map +1 -0
- package/dist/utils/log-rotate.js +74 -0
- package/dist/utils/log-rotate.js.map +1 -0
- package/dist/utils/numeric-flag.d.ts +10 -2
- package/dist/utils/numeric-flag.d.ts.map +1 -1
- package/dist/utils/numeric-flag.js +17 -2
- package/dist/utils/numeric-flag.js.map +1 -1
- package/dist/utils/package-json.d.ts +1 -1
- package/dist/utils/package-json.js +1 -1
- package/package.json +1 -1
- package/src/CONTEXT.md +9 -9
- package/src/__tests__/app-constraints-loader.test.ts +5 -7
- package/src/__tests__/checker-extra.test.ts +12 -80
- package/src/__tests__/checker-primitives-sdk.test.ts +3 -18
- package/src/__tests__/checker.test.ts +5 -7
- package/src/__tests__/checkpoint.test.ts +45 -59
- package/src/__tests__/context-files-resolution.test.ts +3 -2
- package/src/__tests__/contract-gate.test.ts +0 -32
- package/src/__tests__/cso-validator.test.ts +1 -9
- package/src/__tests__/effective-constraints.test.ts +1 -3
- package/src/__tests__/error-classifier.test.ts +1 -42
- package/src/__tests__/failure-recorder.test.ts +45 -114
- package/src/__tests__/iron-laws.test.ts +9 -16
- package/src/__tests__/layering.test.ts +3 -3
- package/src/__tests__/project-config-loader.test.ts +2 -1
- package/src/__tests__/public-exports.test.ts +4 -15
- package/src/__tests__/public-type-surface.test.ts +1 -22
- package/src/__tests__/public-value-surface.test.ts +0 -3
- package/src/__tests__/review-gate.test.ts +0 -17
- package/src/__tests__/security-gate.test.ts +0 -18
- package/src/__tests__/skip-semantics.test.ts +4 -7
- package/src/__tests__/trace-analyzer-extra.test.ts +13 -129
- package/src/__tests__/trace-analyzer.test.ts +7 -7
- package/src/__tests__/trace-collector.test.ts +0 -43
- package/src/__tests__/traces.test.ts +7 -39
- package/src/agents/CONTEXT.md +2 -4
- package/src/agents/__tests__/lifecycle.test.ts +4 -155
- package/src/agents/index.ts +0 -3
- package/src/agents/lifecycle.ts +1 -114
- package/src/agents/types.ts +1 -21
- package/src/{hooks → bootstrap}/CONTEXT.md +5 -5
- package/src/{hooks → bootstrap}/bootstrap.ts +32 -39
- package/src/{hooks → bootstrap}/index.ts +3 -2
- package/src/cli/commands/CONTEXT.md +11 -11
- package/src/cli/commands/__tests__/check-read-count.test.ts +4 -7
- package/src/cli/commands/__tests__/check-skip-output.test.ts +0 -1
- package/src/cli/commands/__tests__/command-gate-dead-options.test.ts +7 -5
- package/src/cli/commands/__tests__/constraints-pack-proposal.test.ts +0 -1
- package/src/cli/commands/__tests__/constraints-report.test.ts +2 -2
- package/src/cli/commands/__tests__/contract.test.ts +11 -4
- package/src/cli/commands/__tests__/failure.test.ts +9 -9
- package/src/cli/commands/__tests__/knowledge-view.test.ts +28 -158
- package/src/cli/commands/__tests__/knowledge.test.ts +24 -4
- package/src/cli/commands/__tests__/numeric-flag-assembly.test.ts +2 -1
- package/src/cli/commands/__tests__/passes-gate.test.ts +5 -5
- package/src/cli/commands/__tests__/project-path-convention.test.ts +4 -21
- package/src/cli/commands/__tests__/registry.test.ts +2 -0
- package/src/cli/commands/__tests__/release.test.ts +1 -1
- package/src/cli/commands/__tests__/review.test.ts +20 -6
- package/src/cli/commands/__tests__/security.test.ts +14 -0
- package/src/cli/commands/__tests__/spec-baseline-read-count.test.ts +2 -2
- package/src/cli/commands/__tests__/spec.test.ts +33 -23
- package/src/cli/commands/__tests__/validate.test.ts +32 -15
- package/src/cli/commands/acceptance.ts +1 -1
- package/src/cli/commands/check.ts +12 -6
- package/src/cli/commands/command.ts +7 -6
- package/src/cli/commands/constraints-pack-proposal.ts +10 -8
- package/src/cli/commands/constraints-reactivate.ts +13 -9
- package/src/cli/commands/constraints-retire.ts +30 -10
- package/src/cli/commands/contract.ts +4 -6
- package/src/cli/commands/definitions.ts +12 -84
- package/src/cli/commands/failure.ts +7 -8
- package/src/cli/commands/knowledge/health.ts +25 -21
- package/src/cli/commands/knowledge/import.ts +1 -1
- package/src/cli/commands/knowledge/search.ts +2 -3
- package/src/cli/commands/knowledge/store-access.ts +40 -0
- package/src/cli/commands/knowledge-view.ts +8 -32
- package/src/cli/commands/passes-gate.ts +9 -8
- package/src/cli/commands/release.ts +12 -13
- package/src/cli/commands/review.ts +15 -4
- package/src/cli/commands/security.ts +7 -0
- package/src/{core → cli/commands}/spec/__tests__/validator.test.ts +15 -53
- package/src/{core → cli/commands}/spec/validator.ts +15 -54
- package/src/cli/commands/spec-baseline-check.ts +36 -313
- package/src/cli/commands/spec.ts +15 -11
- package/src/cli/commands/status.ts +0 -2
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +4 -10
- package/src/cli/commands/sync-docs/compact.ts +12 -11
- package/src/cli/commands/sync-docs/main-flow.ts +32 -472
- package/src/cli/commands/sync-docs/project-reader.ts +2 -1
- package/src/cli/commands/sync-docs/sync-output.ts +218 -0
- package/src/cli/commands/sync-docs/sync-state.ts +327 -0
- package/src/cli/commands/sync-docs/sync-writes.ts +49 -0
- package/src/cli/commands/validate.ts +13 -8
- package/src/context/CONTEXT.md +2 -2
- package/src/context/__tests__/session-manager.test.ts +1 -59
- package/src/context/index.ts +0 -5
- package/src/context/session-manager.ts +0 -44
- package/src/context/types.ts +2 -37
- package/src/core/CONTEXT.md +9 -9
- package/src/core/app-constraints-loader.ts +5 -23
- package/src/core/constraint-lifecycle.ts +30 -39
- package/src/core/constraints/__tests__/check-cache.test.ts +2 -124
- package/src/core/constraints/__tests__/collect-constraints.test.ts +0 -6
- package/src/core/constraints/__tests__/run-env.test.ts +26 -114
- package/src/core/constraints/__tests__/triggers.test.ts +3 -2
- package/src/core/constraints/__tests__/usage-report.test.ts +3 -6
- package/src/core/constraints/check-cache.ts +4 -70
- package/src/core/constraints/checker.ts +25 -75
- package/src/core/constraints/checkers/__tests__/capability-sync.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/check-outcome.test.ts +0 -1
- package/src/core/constraints/checkers/__tests__/docs-freshness-degraded.test.ts +2 -0
- package/src/core/constraints/checkers/__tests__/docs-freshness.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/governance-presence.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/input-contract.test.ts +1 -25
- package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +3 -2
- package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +3 -0
- package/src/core/constraints/checkers/__tests__/no-test-simplification.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/templated-checkers.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/templates-registry.test.ts +0 -2
- package/src/core/constraints/checkers/__tests__/three-state-consistency.test.ts +1 -0
- package/src/core/constraints/checkers/capability-sync.ts +2 -2
- package/src/core/constraints/checkers/context-doc-sync.ts +1 -1
- package/src/core/constraints/checkers/docs-freshness.ts +1 -1
- package/src/core/constraints/checkers/index.ts +21 -8
- package/src/core/constraints/checkers/no-hardcoded-credentials.ts +5 -32
- package/src/core/constraints/checkers/no-test-simplification.ts +10 -32
- package/src/core/constraints/checkers/templated/exec.ts +1 -7
- package/src/core/constraints/checkers/templated/regex-scan.ts +6 -25
- package/src/core/constraints/checkers/types.ts +12 -65
- package/src/core/constraints/context-builder.ts +11 -85
- package/src/core/constraints/definitions/{iron-laws.ts → errors.ts} +0 -4
- package/src/core/constraints/definitions/{guidelines.ts → warnings.ts} +0 -5
- package/src/core/constraints/definitions.ts +4 -3
- package/src/core/constraints/doc-freshness/runner.ts +63 -70
- package/src/core/constraints/find-constraint.ts +24 -0
- package/src/core/constraints/governance-accessors.ts +74 -0
- package/src/core/constraints/index.ts +0 -5
- package/src/core/constraints/pack-proposal.ts +4 -15
- package/src/core/constraints/run-env.ts +1 -26
- package/src/core/constraints/triggers.ts +11 -6
- package/src/core/constraints/usage-report.ts +0 -9
- package/src/core/index.ts +5 -10
- package/src/core/project-config-loader.ts +5 -68
- package/src/core/spec/baseline-check.ts +300 -0
- package/src/core/validators/__tests__/http-retry-sleep.test.ts +1 -1
- package/src/core/validators/check-handlers/file.ts +48 -5
- package/src/core/validators/checkpoint.ts +52 -85
- package/src/core/validators/cso.ts +1 -12
- package/src/core/validators/passes-gate.ts +0 -10
- package/src/failure/CONTEXT.md +1 -1
- package/src/failure/__tests__/recorder.test.ts +2 -1
- package/src/failure/classifier.ts +2 -42
- package/src/failure/error-types.ts +122 -0
- package/src/failure/index.ts +9 -9
- package/src/failure/recorder.ts +12 -77
- package/src/gates/CONTEXT.md +2 -4
- package/src/gates/__tests__/command-single-predicate.test.ts +15 -60
- package/src/gates/__tests__/command.test.ts +0 -13
- package/src/gates/__tests__/gate-interface.test.ts +3 -5
- package/src/gates/__tests__/performance.test.ts +5 -51
- package/src/gates/__tests__/review.test.ts +27 -50
- package/src/gates/__tests__/security-default-scan.test.ts +6 -3
- package/src/gates/__tests__/security.test.ts +25 -44
- package/src/gates/acceptance.ts +31 -33
- package/src/gates/command.ts +0 -33
- package/src/gates/contract.ts +1 -18
- package/src/gates/definitions.ts +1 -1
- package/src/gates/performance.ts +0 -23
- package/src/gates/registry.ts +2 -4
- package/src/gates/review.ts +30 -21
- package/src/gates/security.ts +4 -44
- package/src/index.ts +3 -28
- package/src/knowledge/CONTEXT.md +14 -20
- package/src/knowledge/__tests__/audit.test.ts +1 -1
- package/src/knowledge/__tests__/import.test.ts +1 -1
- package/src/knowledge/__tests__/ingest-validate-entry.test.ts +235 -0
- package/src/knowledge/__tests__/ingest.test.ts +2 -3
- package/src/knowledge/__tests__/store.test.ts +2 -4
- package/src/knowledge/__tests__/tree-walker.test.ts +5 -13
- package/src/knowledge/audit-rules.ts +10 -6
- package/src/knowledge/audit.ts +3 -1
- package/src/knowledge/{import.ts → cold-start.ts} +148 -191
- package/src/knowledge/index.ts +2 -9
- package/src/knowledge/ingest.ts +110 -7
- package/src/knowledge/lifecycle.ts +11 -19
- package/src/knowledge/query.ts +1 -1
- package/src/knowledge/store.ts +12 -34
- package/src/knowledge/types.ts +2 -48
- package/src/monitoring/CONTEXT.md +3 -3
- package/src/monitoring/__tests__/skipped-lines-report.test.ts +3 -16
- package/src/monitoring/__tests__/traces.test.ts +1 -27
- package/src/monitoring/analyzer-base.ts +1 -28
- package/src/monitoring/trace-analyzer.ts +2 -161
- package/src/monitoring/traces.ts +3 -29
- package/src/types/command-definition.ts +85 -0
- package/src/types/constraint.ts +3 -32
- package/src/types/failure.ts +7 -113
- package/src/types/spec.ts +0 -4
- package/src/types/trace.ts +0 -6
- package/src/utils/__tests__/jsonl-skip-disposition.test.ts +4 -7
- package/src/utils/clip.ts +12 -0
- package/src/utils/diff-parse.ts +80 -0
- package/src/utils/guards.ts +8 -0
- package/src/utils/jsonl.ts +0 -30
- package/src/utils/log-rotate.ts +43 -0
- package/src/utils/numeric-flag.ts +24 -2
- package/src/utils/package-json.ts +1 -1
- package/dist/cli/commands/knowledge/migrate.d.ts +0 -21
- package/dist/cli/commands/knowledge/migrate.d.ts.map +0 -1
- package/dist/cli/commands/knowledge/migrate.js +0 -48
- package/dist/cli/commands/knowledge/migrate.js.map +0 -1
- package/dist/cli/commands/knowledge/sync-rag.d.ts +0 -19
- package/dist/cli/commands/knowledge/sync-rag.d.ts.map +0 -1
- package/dist/cli/commands/knowledge/sync-rag.js +0 -77
- package/dist/cli/commands/knowledge/sync-rag.js.map +0 -1
- package/dist/core/constraints/checkers/templates-registry.d.ts +0 -18
- package/dist/core/constraints/checkers/templates-registry.d.ts.map +0 -1
- package/dist/core/constraints/checkers/templates-registry.js +0 -25
- package/dist/core/constraints/checkers/templates-registry.js.map +0 -1
- package/dist/core/constraints/definitions/guidelines.d.ts.map +0 -1
- package/dist/core/constraints/definitions/guidelines.js.map +0 -1
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +0 -1
- package/dist/core/constraints/definitions/iron-laws.js.map +0 -1
- package/dist/core/spec/validator.d.ts.map +0 -1
- package/dist/core/spec/validator.js.map +0 -1
- package/dist/gates/checker-gate.d.ts +0 -27
- package/dist/gates/checker-gate.d.ts.map +0 -1
- package/dist/gates/checker-gate.js +0 -52
- package/dist/gates/checker-gate.js.map +0 -1
- package/dist/hooks/bootstrap.d.ts.map +0 -1
- package/dist/hooks/bootstrap.js.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/knowledge/doctor.d.ts +0 -37
- package/dist/knowledge/doctor.d.ts.map +0 -1
- package/dist/knowledge/doctor.js +0 -81
- package/dist/knowledge/doctor.js.map +0 -1
- package/dist/knowledge/import.d.ts.map +0 -1
- package/dist/knowledge/import.js.map +0 -1
- package/dist/knowledge/lint.d.ts +0 -90
- package/dist/knowledge/lint.d.ts.map +0 -1
- package/dist/knowledge/lint.js +0 -412
- package/dist/knowledge/lint.js.map +0 -1
- package/dist/knowledge/migration.d.ts +0 -28
- package/dist/knowledge/migration.d.ts.map +0 -1
- package/dist/knowledge/migration.js +0 -105
- package/dist/knowledge/migration.js.map +0 -1
- package/dist/knowledge/reference-tracker.d.ts +0 -31
- package/dist/knowledge/reference-tracker.d.ts.map +0 -1
- package/dist/knowledge/reference-tracker.js +0 -122
- package/dist/knowledge/reference-tracker.js.map +0 -1
- package/src/__tests__/spec-validator.test.ts +0 -58
- package/src/cli/commands/knowledge/migrate.ts +0 -61
- package/src/cli/commands/knowledge/sync-rag.ts +0 -48
- package/src/core/constraints/checkers/templates-registry.ts +0 -24
- package/src/gates/__tests__/checker-gate.test.ts +0 -86
- package/src/gates/checker-gate.ts +0 -52
- package/src/knowledge/__tests__/doctor.test.ts +0 -300
- package/src/knowledge/__tests__/lint.test.ts +0 -536
- package/src/knowledge/__tests__/migration.test.ts +0 -185
- package/src/knowledge/__tests__/reference-tracker.test.ts +0 -169
- package/src/knowledge/doctor.ts +0 -103
- package/src/knowledge/lint.ts +0 -460
- package/src/knowledge/migration.ts +0 -82
- package/src/knowledge/reference-tracker.ts +0 -99
- /package/src/{hooks → bootstrap}/__tests__/bootstrap.test.ts +0 -0
|
@@ -16,84 +16,17 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { requireNumericFlag } from '../../utils/numeric-flag';
|
|
19
|
+
import type { CommandDefinition } from '../../types/command-definition';
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
defaultValue?: string | boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 命令实现引用(per-command 懒加载路径)
|
|
34
|
-
*/
|
|
35
|
-
export interface CommandImplRef {
|
|
36
|
-
/** 实现模块名(相对 src/cli/commands,如 'check' / 'sync-docs') */
|
|
37
|
-
module: string;
|
|
38
|
-
/** 模块内导出函数名 */
|
|
39
|
-
export: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* 子命令条目:主名 → 实现(别名经 aliases 一名多注册,架构评审候选7)
|
|
44
|
-
*/
|
|
45
|
-
export interface CommandSubcommand {
|
|
46
|
-
/** 实现引用 */
|
|
47
|
-
impl: CommandImplRef;
|
|
48
|
-
/** 别名:与主名解析到同一实现(不再整块复印 args 闭包) */
|
|
49
|
-
aliases?: string[];
|
|
50
|
-
/** true = 实现签名 (positionals, options)(需要位置参数的命令,如 knowledge search);缺省 (options) */
|
|
51
|
-
withPositionals?: boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 选项条件路由(如 check --list):选项值匹配时以路由替代默认 action;
|
|
56
|
-
* 同一选项可挂多条路由(按序执行,如 passes-gate --coverage)。
|
|
57
|
-
* 实现一律以 (options) 调用;需编组/取值的指向命令模块内的具名包装导出。
|
|
58
|
-
*/
|
|
59
|
-
export interface CommandOptionRoute {
|
|
60
|
-
/** 触发选项键(commander options 对象键名,如 'list') */
|
|
61
|
-
flag: string;
|
|
62
|
-
/** 触发值 */
|
|
63
|
-
when: unknown;
|
|
64
|
-
/** 实现引用 */
|
|
65
|
-
impl: CommandImplRef;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 命令定义
|
|
70
|
-
*/
|
|
71
|
-
export interface CommandDefinition {
|
|
72
|
-
/** 命令名(commander 注册字符串,可含位置参数,如 'retire [id]') */
|
|
73
|
-
command: string;
|
|
74
|
-
/** 命令描述 */
|
|
75
|
-
description: string;
|
|
76
|
-
/** 命令别名 */
|
|
77
|
-
alias?: string;
|
|
78
|
-
/** 位置参数声明(如 '[subcommand]' / '[subcommand] [arg]' / '<planPath>') */
|
|
79
|
-
argument?: string;
|
|
80
|
-
/** 命令选项 */
|
|
81
|
-
options: CommandCliOption[];
|
|
82
|
-
/** 子命令(commander 嵌套命令,如 constraints report / retire) */
|
|
83
|
-
children?: CommandDefinition[];
|
|
84
|
-
/** 默认 action 实现引用;缺省时裸调用显示帮助(subcommand 命令) */
|
|
85
|
-
action?: CommandImplRef;
|
|
86
|
-
/** 子命令路由:位置参数首值 → 条目;未知值报错退出(strict) */
|
|
87
|
-
subcommands?: Record<string, CommandSubcommand>;
|
|
88
|
-
/** false = 未知位置参数不报错、落回默认 action(spec 的文件参数用法) */
|
|
89
|
-
subcommandStrict?: boolean;
|
|
90
|
-
/** true = 有 subcommands 但无位置参数时运行默认 action 而非显示帮助(门禁命令语义) */
|
|
91
|
-
bareRunsAction?: boolean;
|
|
92
|
-
/** 选项条件路由(匹配时替代默认 action 执行) */
|
|
93
|
-
optionRoutes?: CommandOptionRoute[];
|
|
94
|
-
/** 默认 action 实参构造(缺省为 [options]) */
|
|
95
|
-
mapActionArgs?: (positionals: (string | undefined)[], options: Record<string, unknown>) => unknown[];
|
|
96
|
-
}
|
|
21
|
+
// 命令定义形状正本在 types/command-definition(gates 侧同用,ADR-0007;下沉见该文件头注释);
|
|
22
|
+
// 此处 re-export 保持本模块既有消费方(测试面)进口不变
|
|
23
|
+
export type {
|
|
24
|
+
CommandCliOption,
|
|
25
|
+
CommandImplRef,
|
|
26
|
+
CommandSubcommand,
|
|
27
|
+
CommandOptionRoute,
|
|
28
|
+
CommandDefinition,
|
|
29
|
+
} from '../../types/command-definition';
|
|
97
30
|
|
|
98
31
|
/**
|
|
99
32
|
* 全部非门禁 CLI 命令定义(门禁命令由 GATE_DEFINITIONS 生成,见 src/gates/definitions.ts)
|
|
@@ -122,7 +55,6 @@ export const COMMAND_DEFINITIONS: CommandDefinition[] = [
|
|
|
122
55
|
options: [
|
|
123
56
|
{ flags: '-f, --file <path>', description: '检查点文件路径' },
|
|
124
57
|
{ flags: '-p, --project-path <path>', description: '项目路径' },
|
|
125
|
-
{ flags: '--strict', description: '严格模式(任何失败都退出)', defaultValue: false },
|
|
126
58
|
],
|
|
127
59
|
action: { module: 'validate', export: 'validate' },
|
|
128
60
|
},
|
|
@@ -174,7 +106,6 @@ export const COMMAND_DEFINITIONS: CommandDefinition[] = [
|
|
|
174
106
|
{ flags: '-p, --project-path <path>', description: '项目路径' },
|
|
175
107
|
{ flags: '-d, --detail', description: '显示详细信息', defaultValue: false },
|
|
176
108
|
{ flags: '-a, --anomalies', description: '只显示异常', defaultValue: false },
|
|
177
|
-
{ flags: '--hours <n>', description: '分析最近 N 小时', defaultValue: '24' },
|
|
178
109
|
],
|
|
179
110
|
action: { module: 'status', export: 'status' },
|
|
180
111
|
mapActionArgs: (_pos, options) => [
|
|
@@ -182,7 +113,6 @@ export const COMMAND_DEFINITIONS: CommandDefinition[] = [
|
|
|
182
113
|
projectPath: options.projectPath,
|
|
183
114
|
detail: options.detail,
|
|
184
115
|
anomalies: options.anomalies,
|
|
185
|
-
hours: parseInt(String(options.hours), 10),
|
|
186
116
|
},
|
|
187
117
|
],
|
|
188
118
|
},
|
|
@@ -232,7 +162,7 @@ export const COMMAND_DEFINITIONS: CommandDefinition[] = [
|
|
|
232
162
|
command: 'knowledge',
|
|
233
163
|
argument: '[subcommand] [arg]',
|
|
234
164
|
alias: 'kb',
|
|
235
|
-
description: '知识库管理(list/search/import/decay/stats/audit)',
|
|
165
|
+
description: '知识库管理(list/search/import/decay/stats/audit/snapshot/index/health)',
|
|
236
166
|
options: [
|
|
237
167
|
{ flags: '-p, --project-path <path>', description: '项目路径' },
|
|
238
168
|
{ flags: '--type <types>', description: '按类型过滤(逗号分隔)' },
|
|
@@ -259,10 +189,8 @@ export const COMMAND_DEFINITIONS: CommandDefinition[] = [
|
|
|
259
189
|
import: { impl: { module: 'knowledge/import', export: 'knowledgeImport' }, aliases: ['i'] },
|
|
260
190
|
decay: { impl: { module: 'knowledge/decay', export: 'knowledgeDecay' }, aliases: ['d'] },
|
|
261
191
|
stats: { impl: { module: 'knowledge/stats', export: 'knowledgeStats' }, aliases: ['st'] },
|
|
262
|
-
'sync-rag': { impl: { module: 'knowledge/sync-rag', export: 'knowledgeSyncRag' } },
|
|
263
192
|
audit: { impl: { module: 'knowledge/audit', export: 'knowledgeAudit' }, aliases: ['a'] },
|
|
264
193
|
snapshot: { impl: { module: 'knowledge/snapshot', export: 'knowledgeSnapshot' } },
|
|
265
|
-
migrate: { impl: { module: 'knowledge/migrate', export: 'knowledgeMigrate' } },
|
|
266
194
|
index: { impl: { module: 'knowledge/index', export: 'knowledgeIndex' }, aliases: ['idx'] },
|
|
267
195
|
health: { impl: { module: 'knowledge/health', export: 'knowledgeHealth' }, aliases: ['h'] },
|
|
268
196
|
},
|
|
@@ -302,7 +230,7 @@ export const COMMAND_DEFINITIONS: CommandDefinition[] = [
|
|
|
302
230
|
description: 'npm 发布流水线:tsc → dist 验证 → npm version → git push → npm publish → gh release。纯 CLI 实现,不依赖外部 API。',
|
|
303
231
|
options: [
|
|
304
232
|
{ flags: '--bump <type>', description: '版本递增类型', defaultValue: 'patch' },
|
|
305
|
-
{ flags: '--dry-run
|
|
233
|
+
{ flags: '--dry-run', description: '仅模拟执行', defaultValue: false },
|
|
306
234
|
],
|
|
307
235
|
action: { module: 'release', export: 'release' },
|
|
308
236
|
mapActionArgs: (_pos, options) => [{ bumpType: options.bump, dryRun: options.dryRun }],
|
|
@@ -8,8 +8,8 @@ import chalk from 'chalk';
|
|
|
8
8
|
import * as path from 'path';
|
|
9
9
|
import { FailureRecorder } from '../../failure/recorder';
|
|
10
10
|
import { DEFAULT_FAILURE_LOG_FILE } from '../../types/failure';
|
|
11
|
-
import { log,
|
|
12
|
-
import {
|
|
11
|
+
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
12
|
+
import { parseNumericFlagOrReport } from '../../utils/numeric-flag';
|
|
13
13
|
|
|
14
14
|
export interface FailureOptions {
|
|
15
15
|
/** 项目路径 */
|
|
@@ -40,9 +40,8 @@ export async function failureList(
|
|
|
40
40
|
// 原先 parseInt 出 NaN → falsy → 静默不截断。
|
|
41
41
|
let limit: number | undefined;
|
|
42
42
|
if (typeof options.limit === 'string') {
|
|
43
|
-
const parsed =
|
|
43
|
+
const parsed = parseNumericFlagOrReport(io, '--limit', options.limit, 'int');
|
|
44
44
|
if (!parsed.ok) {
|
|
45
|
-
logError(io, numericFlagMessage('--limit', parsed.raw, 'int'));
|
|
46
45
|
return { kind: 'usage-error', reason: `failure list --limit 非法限制: "${parsed.raw}"` };
|
|
47
46
|
}
|
|
48
47
|
limit = parsed.value;
|
|
@@ -51,7 +50,7 @@ export async function failureList(
|
|
|
51
50
|
}
|
|
52
51
|
const recorder = getRecorder(options.projectPath);
|
|
53
52
|
|
|
54
|
-
let records =
|
|
53
|
+
let records = recorder.getHistory();
|
|
55
54
|
|
|
56
55
|
if (options.type) {
|
|
57
56
|
records = records.filter(r => r.type === options.type);
|
|
@@ -91,7 +90,7 @@ export async function failureList(
|
|
|
91
90
|
*/
|
|
92
91
|
export async function failureStats(options: FailureOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
93
92
|
const recorder = getRecorder(options.projectPath);
|
|
94
|
-
const stats =
|
|
93
|
+
const stats = recorder.getStats();
|
|
95
94
|
|
|
96
95
|
if (options.json) {
|
|
97
96
|
log(io, JSON.stringify(stats, null, 2));
|
|
@@ -124,9 +123,9 @@ export async function failureStats(options: FailureOptions, io: CommandIO = proc
|
|
|
124
123
|
*/
|
|
125
124
|
export async function failureClear(options: FailureOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
126
125
|
const recorder = getRecorder(options.projectPath);
|
|
127
|
-
const stats =
|
|
126
|
+
const stats = recorder.getStats();
|
|
128
127
|
|
|
129
|
-
|
|
128
|
+
recorder.clear();
|
|
130
129
|
|
|
131
130
|
if (options.json) {
|
|
132
131
|
log(io, JSON.stringify({ cleared: stats.total }));
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* harness knowledge health 子命令(飞轮健康检查 — 零 token 检测数据流状态;
|
|
3
3
|
* Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
4
4
|
*
|
|
5
|
-
* 本文件只做「取数 +
|
|
6
|
-
*
|
|
5
|
+
* 本文件只做「取数 + 声明两投影」:健康分与过期判定不自有算法——健康分 =
|
|
6
|
+
* `audit-scoring.calculateHealthScore`,过期条目 = `audit-rules` 的 stale-entry
|
|
7
|
+
* 规则命中(ADR-0040 Phase 4 收口,此前本文件内联第三套打分与过期口径)。
|
|
8
|
+
* 上色、json/人读分派、退出码、路径解析与 store 构造统一在
|
|
7
9
|
* knowledge-view.ts(harness#133,架构评审候选4)。
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
12
|
import * as fs from 'fs';
|
|
11
13
|
import * as path from 'path';
|
|
12
14
|
import { evaluateFlywheel } from '../../../knowledge/flywheel-metrics';
|
|
15
|
+
import { AUDIT_RULE_LABELS } from '../../../knowledge/audit-rules';
|
|
16
|
+
import { calculateHealthScore, scanEntries } from '../../../knowledge/audit-scoring';
|
|
13
17
|
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
14
18
|
import {
|
|
15
19
|
blankLine,
|
|
@@ -43,14 +47,30 @@ interface HealthData {
|
|
|
43
47
|
issues: HealthIssue[];
|
|
44
48
|
}
|
|
45
49
|
|
|
50
|
+
/** audit severity → 本命令三档展示severity */
|
|
51
|
+
function displaySeverity(severity: 'low' | 'medium' | 'high' | 'critical'): HealthIssue['severity'] {
|
|
52
|
+
if (severity === 'critical' || severity === 'high') return 'error';
|
|
53
|
+
if (severity === 'medium') return 'warn';
|
|
54
|
+
return 'info';
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
export function knowledgeHealthView(options: KnowledgeOptions & KnowledgeDirOption, io: CommandIO) {
|
|
47
58
|
const store = openKnowledgeStore(options, io);
|
|
48
59
|
const baseDir = store.getBaseDir();
|
|
49
60
|
const entries = store.list({ excludeArchived: true });
|
|
50
61
|
|
|
51
|
-
|
|
62
|
+
// 健康分与过期判定唯一正本 = audit 纯打分(stale-entry 口径:lastReferenced || created 超阈值)
|
|
63
|
+
const auditIssues = scanEntries(entries, {}, entries);
|
|
64
|
+
const healthScore = calculateHealthScore(entries, auditIssues);
|
|
65
|
+
const staleEntries = auditIssues.filter(i => i.rule === 'stale-entry').length;
|
|
52
66
|
|
|
53
|
-
|
|
67
|
+
const issues: HealthIssue[] = auditIssues.map(i => ({
|
|
68
|
+
severity: displaySeverity(i.severity),
|
|
69
|
+
entry: i.entryId,
|
|
70
|
+
detail: `${AUDIT_RULE_LABELS[i.rule]}: ${i.detail}`,
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
// D1: 引用密度检查(低引用 = 可能孤立;逐条 issue 线索,非聚合分子,ADR-0013 范围外)
|
|
54
74
|
let lowRefEntries = 0;
|
|
55
75
|
for (const entry of entries) {
|
|
56
76
|
if (entry.referencedBy.length === 0 && entry.maturity === 'verified') {
|
|
@@ -59,18 +79,6 @@ export function knowledgeHealthView(options: KnowledgeOptions & KnowledgeDirOpti
|
|
|
59
79
|
}
|
|
60
80
|
}
|
|
61
81
|
|
|
62
|
-
// D2: 新鲜度检查
|
|
63
|
-
const now = Date.now();
|
|
64
|
-
const staleThreshold = 90 * 24 * 60 * 60 * 1000; // 90 days
|
|
65
|
-
let staleEntries = 0;
|
|
66
|
-
for (const entry of entries) {
|
|
67
|
-
const created = new Date(entry.created).getTime();
|
|
68
|
-
if (now - created > staleThreshold && entry.maturity === 'draft') {
|
|
69
|
-
staleEntries++;
|
|
70
|
-
issues.push({ severity: 'warn', entry: entry.id, detail: `draft 超过 90 天未推进` });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
82
|
// D3: 消费数据检查
|
|
75
83
|
const statsPath = path.join(baseDir, '.consumption-stats.json');
|
|
76
84
|
const consumptionData = fs.existsSync(statsPath);
|
|
@@ -83,10 +91,6 @@ export function knowledgeHealthView(options: KnowledgeOptions & KnowledgeDirOpti
|
|
|
83
91
|
const refCoverage = Math.round(metrics.refCoverage * 100);
|
|
84
92
|
const avgRefs = Math.round(metrics.avgRefs * 10) / 10;
|
|
85
93
|
|
|
86
|
-
const totalIssues = issues.filter(i => i.severity === 'error').length * 3
|
|
87
|
-
+ issues.filter(i => i.severity === 'warn').length * 1;
|
|
88
|
-
const healthScore = Math.max(0, 100 - totalIssues);
|
|
89
|
-
|
|
90
94
|
const data: HealthData = {
|
|
91
95
|
healthScore,
|
|
92
96
|
summary: { total: entries.length, lowRefEntries, staleEntries, consumptionData, refCoverage, avgRefs },
|
|
@@ -120,7 +124,7 @@ function healthSections(data: HealthData): DisplaySection[] {
|
|
|
120
124
|
title: ' 数据流状态:',
|
|
121
125
|
rows: [
|
|
122
126
|
densityRow(' 引用密度: ', 'summary.lowRefEntries', summary.lowRefEntries, ' 个零引用 verified'),
|
|
123
|
-
densityRow(' 新鲜度: ', 'summary.staleEntries', summary.staleEntries, '
|
|
127
|
+
densityRow(' 新鲜度: ', 'summary.staleEntries', summary.staleEntries, ' 个过期条目'),
|
|
124
128
|
{ cells: [
|
|
125
129
|
{ label: ' 消费追踪: ' },
|
|
126
130
|
summary.consumptionData
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 统一在 knowledge-view.ts(harness#133,架构评审候选4)。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ColdStartImporter } from '../../../knowledge/
|
|
9
|
+
import { ColdStartImporter } from '../../../knowledge/cold-start';
|
|
10
10
|
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
11
11
|
import {
|
|
12
12
|
announce,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { KnowledgeQuery } from '../../../knowledge/query';
|
|
10
10
|
import type { KnowledgeEntry } from '../../../knowledge/types';
|
|
11
11
|
import { logError, processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
12
|
-
import {
|
|
12
|
+
import { parseNumericFlagOrReport } from '../../../utils/numeric-flag';
|
|
13
13
|
import {
|
|
14
14
|
blankLine,
|
|
15
15
|
emitKnowledgeView,
|
|
@@ -80,9 +80,8 @@ export async function knowledgeSearchCommand(
|
|
|
80
80
|
logError(io, '请提供搜索关键词');
|
|
81
81
|
return { kind: 'usage-error', reason: 'knowledge search 缺少关键词位置参数' };
|
|
82
82
|
}
|
|
83
|
-
const limit =
|
|
83
|
+
const limit = parseNumericFlagOrReport(io, '--limit', options.limit as string | undefined, 'int');
|
|
84
84
|
if (!limit.ok) {
|
|
85
|
-
logError(io, numericFlagMessage('--limit', limit.raw, 'int'));
|
|
86
85
|
return { kind: 'usage-error', reason: `knowledge search --limit 非法限制: "${limit.raw}"` };
|
|
87
86
|
}
|
|
88
87
|
return knowledgeSearch(String(query), {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 知识库路径解析与 store 构造(ADR-0040 Phase 3 自 knowledge-view.ts 拆出)
|
|
3
|
+
*
|
|
4
|
+
* 与 view(投影出口)无关:constraints-retire/reactivate 的知识沉淀写口接线
|
|
5
|
+
* 也消费这里。`-p` / `KNOWLEDGE_BASE_DIR` / 缺省目录解析只在这一处
|
|
6
|
+
* (ADR-0034:消费方数据区正本由编排侧经 KNOWLEDGE_BASE_DIR 显式注入)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as os from 'os';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import { FileKnowledgeStore } from '../../../knowledge/store';
|
|
12
|
+
import type { CommandIO } from '../../command-contract';
|
|
13
|
+
|
|
14
|
+
/** 缺省知识库数据根(相对用户 home)。裸 CLI 项目缺省目录;消费方数据区正本由编排侧经 KNOWLEDGE_BASE_DIR 显式注入(ADR-0034) */
|
|
15
|
+
const KNOWLEDGE_DATA_DIR = path.join('.harness', 'knowledge');
|
|
16
|
+
|
|
17
|
+
export interface KnowledgePathOptions {
|
|
18
|
+
/** 覆盖知识库目录(audit/snapshot/migrate/index/health 收) */
|
|
19
|
+
dir?: string;
|
|
20
|
+
/** -p/--project-path */
|
|
21
|
+
projectPath?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 知识库数据根的唯一解析点。`-p` 优先,其次 KNOWLEDGE_BASE_DIR,
|
|
26
|
+
* 最后落到用户 home 缺省目录(ADR-0034 目录收编:消费方数据区正本由
|
|
27
|
+
* 编排侧经 KNOWLEDGE_BASE_DIR 显式注入,本命令不做任何旧目录兼容沿用;
|
|
28
|
+
* io 参数随兼容提示一并失去用途,签名保留免动全部调用方)。
|
|
29
|
+
*/
|
|
30
|
+
export function resolveKnowledgeBaseDir(options: KnowledgePathOptions, _io: CommandIO): string {
|
|
31
|
+
if (options.dir) return options.dir;
|
|
32
|
+
if (options.projectPath) return `${options.projectPath}/.harness/knowledge`;
|
|
33
|
+
if (process.env.KNOWLEDGE_BASE_DIR) return process.env.KNOWLEDGE_BASE_DIR;
|
|
34
|
+
return path.join(os.homedir(), KNOWLEDGE_DATA_DIR);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 知识库句柄的唯一构造点(路径解析全权交给 resolveKnowledgeBaseDir) */
|
|
38
|
+
export function openKnowledgeStore(options: KnowledgePathOptions, io: CommandIO): FileKnowledgeStore {
|
|
39
|
+
return new FileKnowledgeStore({ baseDir: resolveKnowledgeBaseDir(options, io) });
|
|
40
|
+
}
|
|
@@ -9,14 +9,13 @@
|
|
|
9
9
|
* 要么声明是人读面独有的派生量(derived,须在测试的豁免表逐条登记理由)。
|
|
10
10
|
* - **角色→样式单表 + 键→中文 label 映射**:维度 label、成熟度颜色、规则 label 的唯一权威。
|
|
11
11
|
* - **json / 人读的唯一分派与退出码**:`--json` 打 `data` 的序列化,否则渲染 display model。
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
*
|
|
13
|
+
* 路径解析与 store 构造已拆至 `knowledge/store-access.ts`(与 view 无关,
|
|
14
|
+
* retire/reactivate 的写口接线亦消费;ADR-0034 目录收编口径随之搬迁),本模块
|
|
15
|
+
* re-export 保持子命令既有进口不变。
|
|
14
16
|
*/
|
|
15
17
|
|
|
16
18
|
import chalk from 'chalk';
|
|
17
|
-
import * as os from 'os';
|
|
18
|
-
import * as path from 'path';
|
|
19
|
-
import { FileKnowledgeStore } from '../../knowledge/store';
|
|
20
19
|
import { AUDIT_RULE_LABELS } from '../../knowledge/audit-rules';
|
|
21
20
|
import type { AuditIssue, AuditRuleName } from '../../knowledge/audit-rules';
|
|
22
21
|
import type { AuditReport } from '../../knowledge/audit-dimensions';
|
|
@@ -177,30 +176,7 @@ export function emitKnowledgeView<T>(io: CommandIO, options: { json?: boolean },
|
|
|
177
176
|
|
|
178
177
|
// ── 路径解析与 store 构造 ─────────────────────────────────
|
|
179
178
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
export
|
|
184
|
-
/** 覆盖知识库目录(audit/snapshot/migrate/index/health 收) */
|
|
185
|
-
dir?: string;
|
|
186
|
-
/** -p/--project-path */
|
|
187
|
-
projectPath?: string;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* 知识库数据根的唯一解析点。`-p` 优先,其次 KNOWLEDGE_BASE_DIR,
|
|
192
|
-
* 最后落到用户 home 缺省目录(ADR-0034 目录收编:消费方数据区正本由
|
|
193
|
-
* 编排侧经 KNOWLEDGE_BASE_DIR 显式注入,本命令不做任何旧目录兼容沿用;
|
|
194
|
-
* io 参数随兼容提示一并失去用途,签名保留免动全部调用方)。
|
|
195
|
-
*/
|
|
196
|
-
export function resolveKnowledgeBaseDir(options: KnowledgePathOptions, _io: CommandIO): string {
|
|
197
|
-
if (options.dir) return options.dir;
|
|
198
|
-
if (options.projectPath) return `${options.projectPath}/.harness/knowledge`;
|
|
199
|
-
if (process.env.KNOWLEDGE_BASE_DIR) return process.env.KNOWLEDGE_BASE_DIR;
|
|
200
|
-
return path.join(os.homedir(), KNOWLEDGE_DATA_DIR);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/** 知识库句柄的唯一构造点(路径解析全权交给 resolveKnowledgeBaseDir) */
|
|
204
|
-
export function openKnowledgeStore(options: KnowledgePathOptions, io: CommandIO): FileKnowledgeStore {
|
|
205
|
-
return new FileKnowledgeStore({ baseDir: resolveKnowledgeBaseDir(options, io) });
|
|
206
|
-
}
|
|
179
|
+
// 正本已拆至 knowledge/store-access.ts(与 view 无关,retire/reactivate 亦消费);
|
|
180
|
+
// 此处 re-export 保持 knowledge 族子命令的既有进口不变
|
|
181
|
+
export { resolveKnowledgeBaseDir, openKnowledgeStore } from './knowledge/store-access';
|
|
182
|
+
export type { KnowledgePathOptions } from './knowledge/store-access';
|
|
@@ -10,8 +10,8 @@ import * as path from 'path';
|
|
|
10
10
|
import { execAsync } from '../../utils/exec';
|
|
11
11
|
import { PassesGate, detectTestCommand } from '../../core/validators/passes-gate';
|
|
12
12
|
import type { PassesGateConfig } from '../../types/passes-gate';
|
|
13
|
-
import { log,
|
|
14
|
-
import {
|
|
13
|
+
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
14
|
+
import { parseNumericFlagOrReport } from '../../utils/numeric-flag';
|
|
15
15
|
|
|
16
16
|
export interface PassesGateOptions {
|
|
17
17
|
/** 测试命令 */
|
|
@@ -115,9 +115,8 @@ export async function coverageCheck(
|
|
|
115
115
|
options: Record<string, unknown>,
|
|
116
116
|
io: CommandIO = processIO,
|
|
117
117
|
): Promise<CommandResult> {
|
|
118
|
-
const threshold =
|
|
118
|
+
const threshold = parseNumericFlagOrReport(io, '--coverage-threshold', options.coverageThreshold as string | undefined, 'int');
|
|
119
119
|
if (!threshold.ok) {
|
|
120
|
-
logError(io, numericFlagMessage('--coverage-threshold', threshold.raw, 'int'));
|
|
121
120
|
return { kind: 'usage-error', reason: `passes-gate --coverage-threshold 非法阈值: "${threshold.raw}"` };
|
|
122
121
|
}
|
|
123
122
|
return checkCoverage(
|
|
@@ -157,10 +156,12 @@ export async function checkCoverage(
|
|
|
157
156
|
return { kind: 'ok' };
|
|
158
157
|
}
|
|
159
158
|
log(io, chalk.red(`❌ 覆盖率不足 (${totalCoverage}% < ${threshold}%)`));
|
|
160
|
-
|
|
161
|
-
return { kind: 'skip', reason: `覆盖率不足: ${totalCoverage}% < ${threshold}%` };
|
|
159
|
+
return { kind: 'fail', reason: `覆盖率不足: ${totalCoverage}% < ${threshold}%` };
|
|
162
160
|
} catch (error) {
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
// fail-loud:覆盖率命令失败 / 报告缺失 / JSON 损坏都是「没查到」,不是「查过了」——
|
|
162
|
+
// 吞成 skip 退 0 会让门禁在故障时永远放行
|
|
163
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
164
|
+
log(io, chalk.red(`❌ 无法获取覆盖率信息: ${message}`));
|
|
165
|
+
return { kind: 'fail', reason: `无法获取覆盖率信息: ${message}` };
|
|
165
166
|
}
|
|
166
167
|
}
|
|
@@ -29,7 +29,7 @@ import { log, logError, processIO, type CommandIO, type CommandResult } from '..
|
|
|
29
29
|
|
|
30
30
|
export interface ReleaseOptions {
|
|
31
31
|
bumpType?: 'patch' | 'minor' | 'major';
|
|
32
|
-
dryRun?:
|
|
32
|
+
dryRun?: boolean;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
async function run(cmd: string, cwd: string, timeout = 60_000): Promise<{ stdout: string; stderr: string }> {
|
|
@@ -51,10 +51,18 @@ function gateFail(gate: string, detail: string): CommandResult {
|
|
|
51
51
|
return { kind: 'fail', reason: `gate ${gate}: ${detail}` };
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** 版本 bump 计算(dry-run 预告与实 bump 校验共用单点) */
|
|
55
|
+
function bumpedVersion(oldVersion: string, bumpType: 'patch' | 'minor' | 'major'): string {
|
|
56
|
+
const [major, minor, patch] = oldVersion.split('.').map(Number);
|
|
57
|
+
if (bumpType === 'major') return `${major + 1}.0.0`;
|
|
58
|
+
if (bumpType === 'minor') return `${major}.${minor + 1}.0`;
|
|
59
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
export async function release(options: ReleaseOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
55
63
|
const pkgPath = process.cwd();
|
|
56
64
|
const bumpType = options.bumpType || 'patch';
|
|
57
|
-
const dryRun = options.dryRun
|
|
65
|
+
const dryRun = options.dryRun ?? false;
|
|
58
66
|
|
|
59
67
|
// ── 1. Verify package ──
|
|
60
68
|
const pkgJson = readPackageJson(pkgPath);
|
|
@@ -117,22 +125,13 @@ export async function release(options: ReleaseOptions, io: CommandIO = processIO
|
|
|
117
125
|
log(io, chalk.green(`✅ dist: verified (${integrity.checked.length} critical artifacts)`));
|
|
118
126
|
|
|
119
127
|
if (dryRun) {
|
|
120
|
-
|
|
121
|
-
let newVer: string;
|
|
122
|
-
if (bumpType === 'major') newVer = `${major + 1}.0.0`;
|
|
123
|
-
else if (bumpType === 'minor') newVer = `${major}.${minor + 1}.0`;
|
|
124
|
-
else newVer = `${major}.${minor}.${patch + 1}`;
|
|
125
|
-
log(io, chalk.yellow(`🏁 Dry-run complete. Would publish: ${pkgName}@${newVer}`));
|
|
128
|
+
log(io, chalk.yellow(`🏁 Dry-run complete. Would publish: ${pkgName}@${bumpedVersion(oldVersion, bumpType)}`));
|
|
126
129
|
return { kind: 'ok' };
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
// ── 5. Bump version (npm version creates git commit + tag atomically) ──
|
|
130
133
|
log(io, chalk.cyan('🔢 Bumping version...'));
|
|
131
|
-
const
|
|
132
|
-
let expectedNew: string;
|
|
133
|
-
if (bumpType === 'major') expectedNew = `${major + 1}.0.0`;
|
|
134
|
-
else if (bumpType === 'minor') expectedNew = `${major}.${minor + 1}.0`;
|
|
135
|
-
else expectedNew = `${major}.${minor}.${patch + 1}`;
|
|
134
|
+
const expectedNew = bumpedVersion(oldVersion, bumpType);
|
|
136
135
|
const expectedTag = `v${expectedNew}`;
|
|
137
136
|
const tagExists = await run(`git tag -l "${expectedTag}"`, pkgPath);
|
|
138
137
|
if (tagExists.stdout.trim() === expectedTag) {
|
|
@@ -110,14 +110,25 @@ export async function reviewStatus(
|
|
|
110
110
|
log(io, statusColor(` - ${r.author?.login || 'unknown'}: ${r.state}`));
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
} catch {
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
} catch (error) {
|
|
114
|
+
// 「gh 说没有 PR」= 合法状态(提示即可);gh 未安装/超时/认证失败/输出损坏 = 调用失败,上抛走 fail
|
|
115
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
116
|
+
if (message.includes('no pull requests found')) {
|
|
117
|
+
log(io, chalk.yellow('\n⚠️ 未找到关联的 PR'));
|
|
118
|
+
log(io, chalk.gray(' 使用 gh pr create 创建 PR'));
|
|
119
|
+
return { kind: 'ok' };
|
|
120
|
+
}
|
|
121
|
+
throw error;
|
|
116
122
|
}
|
|
117
123
|
return { kind: 'ok' };
|
|
118
124
|
} catch (error: unknown) {
|
|
119
125
|
const message = error instanceof Error ? error.message : String(error);
|
|
126
|
+
// 只兜合法情形:不在 git 仓内 = 无审查状态可查(skip);其余(gh 失败等)= fail
|
|
127
|
+
if (message.includes('not a git repository')) {
|
|
128
|
+
log(io, chalk.yellow('⚠️ 当前目录不是 Git 仓库,无法获取审查状态'));
|
|
129
|
+
return { kind: 'skip', reason: '获取审查状态跳过: 不是 Git 仓库' };
|
|
130
|
+
}
|
|
120
131
|
log(io, chalk.red(`❌ 获取审查状态失败: ${message}`));
|
|
121
|
-
return { kind: '
|
|
132
|
+
return { kind: 'fail', reason: `获取审查状态失败: ${message}` };
|
|
122
133
|
}
|
|
123
134
|
}
|
|
@@ -211,6 +211,13 @@ export async function auditDetails(
|
|
|
211
211
|
|
|
212
212
|
const result = await gate.scan({ projectPath });
|
|
213
213
|
|
|
214
|
+
// deny 且无漏洞清单 = 扫描本身失败(fromError 报告):如实 fail,不能假绿
|
|
215
|
+
// (旧实现对该形状直回 ok,把「没扫成」显示成「没问题」)
|
|
216
|
+
if (!result.passed && !result.details?.total) {
|
|
217
|
+
log(io, chalk.red(`❌ ${result.message}`));
|
|
218
|
+
return { kind: 'fail', reason: result.message };
|
|
219
|
+
}
|
|
220
|
+
|
|
214
221
|
if (result.passed && !result.details?.total) {
|
|
215
222
|
log(io, chalk.green('✅ 未发现安全漏洞'));
|
|
216
223
|
return { kind: 'ok' };
|