@dommaker/harness 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +2 -4
- package/bin/harness.js +12 -37
- package/dist/cli/commands/check.d.ts +2 -2
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +8 -33
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/constraints-report.js +1 -1
- package/dist/cli/commands/constraints-report.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +6 -3
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +34 -25
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts +2 -0
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js.map +1 -1
- package/dist/cli/commands/init.d.ts +21 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +118 -40
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/knowledge.d.ts.map +1 -1
- package/dist/cli/commands/knowledge.js +1 -12
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/report.d.ts.map +1 -1
- package/dist/cli/commands/report.js +0 -2
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/status.js +2 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/context/index.d.ts +9 -6
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +18 -20
- package/dist/context/index.js.map +1 -1
- package/dist/core/constraints/capabilities-parser.d.ts +3 -2
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
- package/dist/core/constraints/capabilities-parser.js +25 -47
- package/dist/core/constraints/capabilities-parser.js.map +1 -1
- package/dist/core/constraints/checker.d.ts +29 -32
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +34 -126
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/governance-presence.d.ts +20 -0
- package/dist/core/constraints/checkers/governance-presence.d.ts.map +1 -0
- package/dist/core/constraints/checkers/governance-presence.js +76 -0
- package/dist/core/constraints/checkers/governance-presence.js.map +1 -0
- package/dist/core/constraints/checkers/index.d.ts +2 -1
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +5 -0
- package/dist/core/constraints/checkers/index.js.map +1 -1
- package/dist/core/constraints/checkers/types.d.ts +25 -0
- package/dist/core/constraints/checkers/types.d.ts.map +1 -1
- package/dist/core/constraints/checkers/types.js +24 -0
- package/dist/core/constraints/checkers/types.js.map +1 -1
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
- package/dist/core/constraints/definitions/guidelines.js +21 -2
- package/dist/core/constraints/definitions/guidelines.js.map +1 -1
- package/dist/core/constraints/definitions/prompts.d.ts.map +1 -1
- package/dist/core/constraints/definitions/prompts.js +0 -5
- package/dist/core/constraints/definitions/prompts.js.map +1 -1
- package/dist/core/constraints/index.d.ts +1 -2
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +1 -7
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/injection-drift.d.ts +29 -4
- package/dist/core/constraints/injection-drift.d.ts.map +1 -1
- package/dist/core/constraints/injection-drift.js +52 -20
- package/dist/core/constraints/injection-drift.js.map +1 -1
- package/dist/core/constraints/usage-report.d.ts +1 -2
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +2 -5
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/effective-constraints.d.ts +24 -4
- package/dist/core/effective-constraints.d.ts.map +1 -1
- package/dist/core/effective-constraints.js +28 -7
- package/dist/core/effective-constraints.js.map +1 -1
- package/dist/core/effective-set.d.ts +30 -0
- package/dist/core/effective-set.d.ts.map +1 -0
- package/dist/core/effective-set.js +35 -0
- package/dist/core/effective-set.js.map +1 -0
- package/dist/core/index.d.ts +13 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +44 -21
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +3 -6
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +47 -61
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/failure/constraint-handler.d.ts +1 -1
- package/dist/failure/constraint-handler.js +1 -1
- package/dist/gates/checker-gate.d.ts +1 -4
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +3 -11
- package/dist/gates/checker-gate.js.map +1 -1
- package/dist/gates/definitions.d.ts +9 -38
- package/dist/gates/definitions.d.ts.map +1 -1
- package/dist/gates/definitions.js +24 -13
- package/dist/gates/definitions.js.map +1 -1
- package/dist/gates/effective-gates.d.ts.map +1 -1
- package/dist/gates/effective-gates.js +14 -18
- package/dist/gates/effective-gates.js.map +1 -1
- package/dist/gates/index.d.ts +1 -1
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js.map +1 -1
- package/dist/hooks/bootstrap.d.ts.map +1 -1
- package/dist/hooks/bootstrap.js +0 -3
- package/dist/hooks/bootstrap.js.map +1 -1
- package/dist/index.d.ts +43 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +180 -143
- package/dist/index.js.map +1 -1
- package/dist/knowledge/query.d.ts +15 -0
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js +23 -0
- package/dist/knowledge/query.js.map +1 -1
- package/dist/monitoring/analyzer-base.d.ts +0 -4
- package/dist/monitoring/analyzer-base.d.ts.map +1 -1
- package/dist/monitoring/analyzer-base.js +0 -21
- package/dist/monitoring/analyzer-base.js.map +1 -1
- package/dist/monitoring/index.d.ts +6 -12
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/index.js +13 -29
- package/dist/monitoring/index.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +2 -68
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +0 -4
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +0 -14
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/presets/index.d.ts +2 -2
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +3 -4
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/standard.d.ts +10 -22
- package/dist/presets/standard.d.ts.map +1 -1
- package/dist/presets/standard.js +15 -75
- package/dist/presets/standard.js.map +1 -1
- package/dist/types/constraint.d.ts +1 -29
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js +1 -1
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/project-config.d.ts +4 -8
- package/dist/types/project-config.d.ts.map +1 -1
- package/dist/types/trace.d.ts +5 -18
- package/dist/types/trace.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/CONTEXT.md +4 -5
- package/src/__tests__/checker-extra.test.ts +33 -139
- package/src/__tests__/checker.test.ts +0 -376
- package/src/__tests__/governance-presence.test.ts +129 -0
- package/src/__tests__/iron-laws.test.ts +7 -7
- package/src/__tests__/project-config-loader-extra.test.ts +42 -29
- package/src/__tests__/public-exports.test.ts +138 -0
- package/src/__tests__/trace-analyzer-extra.test.ts +6 -86
- package/src/__tests__/trace-analyzer.test.ts +4 -5
- package/src/__tests__/trace-collector.test.ts +0 -11
- package/src/__tests__/traces.test.ts +3 -22
- package/src/cli/commands/CONTEXT.md +6 -3
- package/src/cli/commands/__tests__/check-skip-output.test.ts +10 -7
- package/src/cli/commands/__tests__/check.test.ts +29 -69
- package/src/cli/commands/__tests__/constraints-report.test.ts +3 -3
- package/src/cli/commands/__tests__/constraints-retire.test.ts +45 -4
- package/src/cli/commands/__tests__/init-injection.test.ts +202 -0
- package/src/cli/commands/__tests__/knowledge.test.ts +90 -1
- package/src/cli/commands/__tests__/registry.test.ts +8 -6
- package/src/cli/commands/__tests__/status-extra.test.ts +6 -6
- package/src/cli/commands/__tests__/status.test.ts +6 -6
- package/src/cli/commands/__tests__/sync-docs-agents.test.ts +28 -0
- package/src/cli/commands/check.ts +9 -35
- package/src/cli/commands/constraints-report.ts +1 -1
- package/src/cli/commands/constraints-retire.ts +38 -27
- package/src/cli/commands/definitions.ts +2 -0
- package/src/cli/commands/init.ts +129 -40
- package/src/cli/commands/knowledge.ts +1 -16
- package/src/cli/commands/report.ts +0 -2
- package/src/cli/commands/status.ts +2 -2
- package/src/context/index.ts +29 -6
- package/src/core/CONTEXT.md +4 -3
- package/src/core/__tests__/effective-set.test.ts +80 -0
- package/src/core/constraints/__tests__/injection-drift.test.ts +90 -0
- package/src/core/constraints/capabilities-parser.ts +43 -49
- package/src/core/constraints/checker.ts +51 -145
- package/src/core/constraints/checkers/governance-presence.ts +74 -0
- package/src/core/constraints/checkers/index.ts +4 -1
- package/src/core/constraints/checkers/types.ts +42 -0
- package/src/core/constraints/definitions/guidelines.ts +22 -2
- package/src/core/constraints/definitions/prompts.ts +0 -5
- package/src/core/constraints/index.ts +2 -17
- package/src/core/constraints/injection-drift.ts +60 -21
- package/src/core/constraints/usage-report.ts +5 -8
- package/src/core/effective-constraints.ts +35 -7
- package/src/core/effective-set.ts +56 -0
- package/src/core/index.ts +80 -6
- package/src/core/project-config-loader.ts +53 -68
- package/src/failure/CONTEXT.md +1 -1
- package/src/failure/constraint-handler.ts +1 -1
- package/src/gates/CONTEXT.md +3 -3
- package/src/gates/checker-gate.ts +4 -12
- package/src/gates/definitions.ts +27 -50
- package/src/gates/effective-gates.ts +14 -21
- package/src/gates/index.ts +1 -1
- package/src/hooks/bootstrap.ts +0 -3
- package/src/index.ts +384 -148
- package/src/knowledge/CONTEXT.md +2 -2
- package/src/knowledge/__tests__/query.test.ts +64 -0
- package/src/knowledge/query.ts +28 -0
- package/src/monitoring/CONTEXT.md +7 -13
- package/src/monitoring/__tests__/traces.test.ts +0 -10
- package/src/monitoring/analyzer-base.ts +0 -22
- package/src/monitoring/index.ts +6 -12
- package/src/monitoring/trace-analyzer.ts +2 -73
- package/src/monitoring/traces.ts +0 -20
- package/src/presets/__tests__/standard.test.ts +48 -69
- package/src/presets/index.ts +3 -5
- package/src/presets/standard.ts +14 -79
- package/src/spec/CONTEXT.md +5 -13
- package/src/types/constraint.ts +1 -51
- package/src/types/index.ts +0 -12
- package/src/types/project-config.ts +4 -10
- package/src/types/trace.ts +5 -30
- package/dist/core/constraints/interceptor.d.ts +0 -39
- package/dist/core/constraints/interceptor.d.ts.map +0 -1
- package/dist/core/constraints/interceptor.js +0 -166
- package/dist/core/constraints/interceptor.js.map +0 -1
- package/dist/dashboard/data.d.ts +0 -31
- package/dist/dashboard/data.d.ts.map +0 -1
- package/dist/dashboard/data.js +0 -81
- package/dist/dashboard/data.js.map +0 -1
- package/dist/dashboard/index.d.ts +0 -4
- package/dist/dashboard/index.d.ts.map +0 -1
- package/dist/dashboard/index.js +0 -20
- package/dist/dashboard/index.js.map +0 -1
- package/dist/dashboard/stats.d.ts +0 -20
- package/dist/dashboard/stats.d.ts.map +0 -1
- package/dist/dashboard/stats.js +0 -115
- package/dist/dashboard/stats.js.map +0 -1
- package/dist/dashboard/types.d.ts +0 -110
- package/dist/dashboard/types.d.ts.map +0 -1
- package/dist/dashboard/types.js +0 -8
- package/dist/dashboard/types.js.map +0 -1
- package/dist/monitoring/constraint-doctor.d.ts +0 -76
- package/dist/monitoring/constraint-doctor.d.ts.map +0 -1
- package/dist/monitoring/constraint-doctor.js +0 -189
- package/dist/monitoring/constraint-doctor.js.map +0 -1
- package/dist/monitoring/diagnosis-rules.d.ts +0 -18
- package/dist/monitoring/diagnosis-rules.d.ts.map +0 -1
- package/dist/monitoring/diagnosis-rules.js +0 -119
- package/dist/monitoring/diagnosis-rules.js.map +0 -1
- package/dist/monitoring/knowledge-doctor.d.ts +0 -78
- package/dist/monitoring/knowledge-doctor.d.ts.map +0 -1
- package/dist/monitoring/knowledge-doctor.js +0 -266
- package/dist/monitoring/knowledge-doctor.js.map +0 -1
- package/dist/monitoring/knowledge-evolver.d.ts +0 -72
- package/dist/monitoring/knowledge-evolver.d.ts.map +0 -1
- package/dist/monitoring/knowledge-evolver.js +0 -205
- package/dist/monitoring/knowledge-evolver.js.map +0 -1
- package/dist/monitoring/performance-analyzer.d.ts +0 -92
- package/dist/monitoring/performance-analyzer.d.ts.map +0 -1
- package/dist/monitoring/performance-analyzer.js +0 -343
- package/dist/monitoring/performance-analyzer.js.map +0 -1
- package/dist/monitoring/performance-collector.d.ts +0 -103
- package/dist/monitoring/performance-collector.d.ts.map +0 -1
- package/dist/monitoring/performance-collector.js +0 -298
- package/dist/monitoring/performance-collector.js.map +0 -1
- package/dist/safety/index.d.ts +0 -6
- package/dist/safety/index.d.ts.map +0 -1
- package/dist/safety/index.js +0 -22
- package/dist/safety/index.js.map +0 -1
- package/dist/safety/input-guardrail.d.ts +0 -36
- package/dist/safety/input-guardrail.d.ts.map +0 -1
- package/dist/safety/input-guardrail.js +0 -118
- package/dist/safety/input-guardrail.js.map +0 -1
- package/dist/safety/output-guardrail.d.ts +0 -39
- package/dist/safety/output-guardrail.d.ts.map +0 -1
- package/dist/safety/output-guardrail.js +0 -147
- package/dist/safety/output-guardrail.js.map +0 -1
- package/dist/safety/sandbox.d.ts +0 -45
- package/dist/safety/sandbox.d.ts.map +0 -1
- package/dist/safety/sandbox.js +0 -134
- package/dist/safety/sandbox.js.map +0 -1
- package/dist/safety/tool-guardrail.d.ts +0 -51
- package/dist/safety/tool-guardrail.d.ts.map +0 -1
- package/dist/safety/tool-guardrail.js +0 -147
- package/dist/safety/tool-guardrail.js.map +0 -1
- package/dist/safety/types.d.ts +0 -104
- package/dist/safety/types.d.ts.map +0 -1
- package/dist/safety/types.js +0 -6
- package/dist/safety/types.js.map +0 -1
- package/dist/spec/annotation-checker.d.ts +0 -47
- package/dist/spec/annotation-checker.d.ts.map +0 -1
- package/dist/spec/annotation-checker.js +0 -279
- package/dist/spec/annotation-checker.js.map +0 -1
- package/dist/types/enforcement.d.ts +0 -42
- package/dist/types/enforcement.d.ts.map +0 -1
- package/dist/types/enforcement.js +0 -6
- package/dist/types/enforcement.js.map +0 -1
- package/dist/types/monitoring-types.d.ts +0 -53
- package/dist/types/monitoring-types.d.ts.map +0 -1
- package/dist/types/monitoring-types.js +0 -10
- package/dist/types/monitoring-types.js.map +0 -1
- package/dist/types/performance.d.ts +0 -204
- package/dist/types/performance.d.ts.map +0 -1
- package/dist/types/performance.js +0 -12
- package/dist/types/performance.js.map +0 -1
- package/dist/verification/index.d.ts +0 -4
- package/dist/verification/index.d.ts.map +0 -1
- package/dist/verification/index.js +0 -20
- package/dist/verification/index.js.map +0 -1
- package/dist/verification/loop.d.ts +0 -30
- package/dist/verification/loop.d.ts.map +0 -1
- package/dist/verification/loop.js +0 -114
- package/dist/verification/loop.js.map +0 -1
- package/dist/verification/rules-based.d.ts +0 -40
- package/dist/verification/rules-based.d.ts.map +0 -1
- package/dist/verification/rules-based.js +0 -130
- package/dist/verification/rules-based.js.map +0 -1
- package/dist/verification/types.d.ts +0 -69
- package/dist/verification/types.d.ts.map +0 -1
- package/dist/verification/types.js +0 -6
- package/dist/verification/types.js.map +0 -1
- package/src/__tests__/annotation-checker.test.ts +0 -183
- package/src/__tests__/constraint-doctor.test.ts +0 -271
- package/src/__tests__/doctor-extra.test.ts +0 -155
- package/src/__tests__/extend-exceptions.test.ts +0 -149
- package/src/__tests__/interceptor.test.ts +0 -89
- package/src/__tests__/performance-analyzer.test.ts +0 -499
- package/src/__tests__/performance-collector.test.ts +0 -276
- package/src/__tests__/presets.test.ts +0 -65
- package/src/core/constraints/__tests__/interceptor.test.ts +0 -267
- package/src/core/constraints/interceptor.ts +0 -217
- package/src/dashboard/CONTEXT.md +0 -21
- package/src/dashboard/__tests__/data.test.ts +0 -111
- package/src/dashboard/__tests__/stats.test.ts +0 -159
- package/src/dashboard/data.ts +0 -103
- package/src/dashboard/index.ts +0 -3
- package/src/dashboard/stats.ts +0 -127
- package/src/dashboard/types.ts +0 -130
- package/src/monitoring/__tests__/knowledge-doctor.test.ts +0 -278
- package/src/monitoring/__tests__/knowledge-evolver.test.ts +0 -368
- package/src/monitoring/__tests__/performance-analyzer.test.ts +0 -137
- package/src/monitoring/__tests__/performance-collector.test.ts +0 -331
- package/src/monitoring/constraint-doctor.ts +0 -228
- package/src/monitoring/diagnosis-rules.ts +0 -132
- package/src/monitoring/knowledge-doctor.ts +0 -322
- package/src/monitoring/knowledge-evolver.ts +0 -289
- package/src/monitoring/performance-analyzer.ts +0 -400
- package/src/monitoring/performance-collector.ts +0 -326
- package/src/safety/CONTEXT.md +0 -23
- package/src/safety/__tests__/input-guardrail.test.ts +0 -105
- package/src/safety/__tests__/output-guardrail.test.ts +0 -108
- package/src/safety/__tests__/sandbox.test.ts +0 -158
- package/src/safety/__tests__/tool-guardrail.test.ts +0 -127
- package/src/safety/index.ts +0 -5
- package/src/safety/input-guardrail.ts +0 -133
- package/src/safety/output-guardrail.ts +0 -170
- package/src/safety/sandbox.ts +0 -148
- package/src/safety/tool-guardrail.ts +0 -176
- package/src/safety/types.ts +0 -124
- package/src/spec/__tests__/annotation-checker.test.ts +0 -294
- package/src/spec/annotation-checker.ts +0 -320
- package/src/types/enforcement.ts +0 -48
- package/src/types/monitoring-types.ts +0 -68
- package/src/types/performance.ts +0 -295
- package/src/verification/CONTEXT.md +0 -23
- package/src/verification/__tests__/loop.test.ts +0 -303
- package/src/verification/__tests__/rules-based.test.ts +0 -240
- package/src/verification/index.ts +0 -3
- package/src/verification/loop.ts +0 -137
- package/src/verification/rules-based.ts +0 -152
- package/src/verification/types.ts +0 -81
package/dist/core/index.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 核心模块导出(ADR-0003:显式清单,禁 export *)
|
|
3
|
+
*
|
|
4
|
+
* checkConstraints 与包根统一为 options 对象签名(CheckConstraintsOptions),
|
|
5
|
+
* 不再暴露位置参数版。
|
|
3
6
|
*/
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
+
export { IRON_LAWS, GUIDELINES, PROMPTS, getAllConstraints, findConstraintsByTrigger, getConstraint, ConstraintChecker, checkConstraint, checkConstraints, checkBeforeExecution, constraintChecker, CONSTRAINTS_START_MARKER, CONSTRAINTS_END_MARKER, renderConstraintsSection, CheckCache, renderConstraintsByTrigger, ConstraintViolationError, } from './constraints';
|
|
8
|
+
export type { CheckConstraintsOptions, CheckCacheConfig, CheckSamplingConfig, RenderConstraintsByTriggerOptions, ConstraintId, ConstraintKind, ConstraintLevel, ConstraintTrigger, Constraint, ConstraintResult, ConstraintContext, ConstraintCheckResult, IronLawContext, } from './constraints';
|
|
9
|
+
export { CheckpointValidator, PassesGate, createPassesGate, CSOValidator, } from './validators';
|
|
10
|
+
export type { CSOValidationResult, CSOIssue, Checkpoint, CheckpointCheck, CheckpointResult, CheckResult, CheckpointContext, CheckType, CheckConfig, PassesGateConfig, PassesGateResult, TaskTestResult, DynamicTask, } from './validators';
|
|
11
|
+
export { SessionStartup, createSessionStartup, DEFAULT_CODE_CHECKPOINTS, MINIMAL_CHECKPOINTS, CleanStateManager, createCleanStateManager, } from './session';
|
|
7
12
|
export { SpecValidator } from './spec/validator';
|
|
8
13
|
export type { SpecValidatorConfig, SpecValidationResult, BatchSpecValidationResult, SpecSchemaDefinition, SpecType, } from '../types/spec';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
14
|
+
export { ProjectConfigLoader, loadRawProjectConfig, getCapabilitiesMode, } from './project-config-loader';
|
|
15
|
+
export type { CapabilitiesMode } from './project-config-loader';
|
|
16
|
+
export { getEffectiveConstraints, lintEffectiveConfig, } from './effective-constraints';
|
|
17
|
+
export type { EffectiveConfigLint } from './effective-constraints';
|
|
11
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,UAAU,EACV,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,iCAAiC,EACjC,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,QAAQ,GACT,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -1,32 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 核心模块导出(ADR-0003:显式清单,禁 export *)
|
|
4
|
+
*
|
|
5
|
+
* checkConstraints 与包根统一为 options 对象签名(CheckConstraintsOptions),
|
|
6
|
+
* 不再暴露位置参数版。
|
|
4
7
|
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.SpecValidator = void 0;
|
|
9
|
+
exports.lintEffectiveConfig = exports.getEffectiveConstraints = exports.getCapabilitiesMode = exports.loadRawProjectConfig = exports.ProjectConfigLoader = exports.SpecValidator = exports.createCleanStateManager = exports.CleanStateManager = exports.MINIMAL_CHECKPOINTS = exports.DEFAULT_CODE_CHECKPOINTS = exports.createSessionStartup = exports.SessionStartup = exports.CSOValidator = exports.createPassesGate = exports.PassesGate = exports.CheckpointValidator = exports.ConstraintViolationError = exports.renderConstraintsByTrigger = exports.CheckCache = exports.renderConstraintsSection = exports.CONSTRAINTS_END_MARKER = exports.CONSTRAINTS_START_MARKER = exports.constraintChecker = exports.checkBeforeExecution = exports.checkConstraints = exports.checkConstraint = exports.ConstraintChecker = exports.getConstraint = exports.findConstraintsByTrigger = exports.getAllConstraints = exports.PROMPTS = exports.GUIDELINES = exports.IRON_LAWS = void 0;
|
|
21
10
|
// 约束系统(三层:Iron Laws / Guidelines / Tips)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
var constraints_1 = require("./constraints");
|
|
12
|
+
Object.defineProperty(exports, "IRON_LAWS", { enumerable: true, get: function () { return constraints_1.IRON_LAWS; } });
|
|
13
|
+
Object.defineProperty(exports, "GUIDELINES", { enumerable: true, get: function () { return constraints_1.GUIDELINES; } });
|
|
14
|
+
Object.defineProperty(exports, "PROMPTS", { enumerable: true, get: function () { return constraints_1.PROMPTS; } });
|
|
15
|
+
Object.defineProperty(exports, "getAllConstraints", { enumerable: true, get: function () { return constraints_1.getAllConstraints; } });
|
|
16
|
+
Object.defineProperty(exports, "findConstraintsByTrigger", { enumerable: true, get: function () { return constraints_1.findConstraintsByTrigger; } });
|
|
17
|
+
Object.defineProperty(exports, "getConstraint", { enumerable: true, get: function () { return constraints_1.getConstraint; } });
|
|
18
|
+
Object.defineProperty(exports, "ConstraintChecker", { enumerable: true, get: function () { return constraints_1.ConstraintChecker; } });
|
|
19
|
+
Object.defineProperty(exports, "checkConstraint", { enumerable: true, get: function () { return constraints_1.checkConstraint; } });
|
|
20
|
+
Object.defineProperty(exports, "checkConstraints", { enumerable: true, get: function () { return constraints_1.checkConstraints; } });
|
|
21
|
+
Object.defineProperty(exports, "checkBeforeExecution", { enumerable: true, get: function () { return constraints_1.checkBeforeExecution; } });
|
|
22
|
+
Object.defineProperty(exports, "constraintChecker", { enumerable: true, get: function () { return constraints_1.constraintChecker; } });
|
|
23
|
+
Object.defineProperty(exports, "CONSTRAINTS_START_MARKER", { enumerable: true, get: function () { return constraints_1.CONSTRAINTS_START_MARKER; } });
|
|
24
|
+
Object.defineProperty(exports, "CONSTRAINTS_END_MARKER", { enumerable: true, get: function () { return constraints_1.CONSTRAINTS_END_MARKER; } });
|
|
25
|
+
Object.defineProperty(exports, "renderConstraintsSection", { enumerable: true, get: function () { return constraints_1.renderConstraintsSection; } });
|
|
26
|
+
Object.defineProperty(exports, "CheckCache", { enumerable: true, get: function () { return constraints_1.CheckCache; } });
|
|
27
|
+
Object.defineProperty(exports, "renderConstraintsByTrigger", { enumerable: true, get: function () { return constraints_1.renderConstraintsByTrigger; } });
|
|
28
|
+
Object.defineProperty(exports, "ConstraintViolationError", { enumerable: true, get: function () { return constraints_1.ConstraintViolationError; } });
|
|
29
|
+
// 验证器(检查点 / PassesGate / CSO)
|
|
30
|
+
var validators_1 = require("./validators");
|
|
31
|
+
Object.defineProperty(exports, "CheckpointValidator", { enumerable: true, get: function () { return validators_1.CheckpointValidator; } });
|
|
32
|
+
Object.defineProperty(exports, "PassesGate", { enumerable: true, get: function () { return validators_1.PassesGate; } });
|
|
33
|
+
Object.defineProperty(exports, "createPassesGate", { enumerable: true, get: function () { return validators_1.createPassesGate; } });
|
|
34
|
+
Object.defineProperty(exports, "CSOValidator", { enumerable: true, get: function () { return validators_1.CSOValidator; } });
|
|
35
|
+
// 会话启动 / 净室状态
|
|
36
|
+
var session_1 = require("./session");
|
|
37
|
+
Object.defineProperty(exports, "SessionStartup", { enumerable: true, get: function () { return session_1.SessionStartup; } });
|
|
38
|
+
Object.defineProperty(exports, "createSessionStartup", { enumerable: true, get: function () { return session_1.createSessionStartup; } });
|
|
39
|
+
Object.defineProperty(exports, "DEFAULT_CODE_CHECKPOINTS", { enumerable: true, get: function () { return session_1.DEFAULT_CODE_CHECKPOINTS; } });
|
|
40
|
+
Object.defineProperty(exports, "MINIMAL_CHECKPOINTS", { enumerable: true, get: function () { return session_1.MINIMAL_CHECKPOINTS; } });
|
|
41
|
+
Object.defineProperty(exports, "CleanStateManager", { enumerable: true, get: function () { return session_1.CleanStateManager; } });
|
|
42
|
+
Object.defineProperty(exports, "createCleanStateManager", { enumerable: true, get: function () { return session_1.createCleanStateManager; } });
|
|
25
43
|
// Spec 验证器
|
|
26
44
|
var validator_1 = require("./spec/validator");
|
|
27
45
|
Object.defineProperty(exports, "SpecValidator", { enumerable: true, get: function () { return validator_1.SpecValidator; } });
|
|
28
46
|
// 项目配置加载器
|
|
29
|
-
|
|
47
|
+
var project_config_loader_1 = require("./project-config-loader");
|
|
48
|
+
Object.defineProperty(exports, "ProjectConfigLoader", { enumerable: true, get: function () { return project_config_loader_1.ProjectConfigLoader; } });
|
|
49
|
+
Object.defineProperty(exports, "loadRawProjectConfig", { enumerable: true, get: function () { return project_config_loader_1.loadRawProjectConfig; } });
|
|
50
|
+
Object.defineProperty(exports, "getCapabilitiesMode", { enumerable: true, get: function () { return project_config_loader_1.getCapabilitiesMode; } });
|
|
30
51
|
// 生效约束集(ADR-0001:唯一生效集来源)
|
|
31
|
-
|
|
52
|
+
var effective_constraints_1 = require("./effective-constraints");
|
|
53
|
+
Object.defineProperty(exports, "getEffectiveConstraints", { enumerable: true, get: function () { return effective_constraints_1.getEffectiveConstraints; } });
|
|
54
|
+
Object.defineProperty(exports, "lintEffectiveConfig", { enumerable: true, get: function () { return effective_constraints_1.lintEffectiveConfig; } });
|
|
32
55
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yCAAyC;AACzC,6CAkBuB;AAjBrB,wGAAA,SAAS,OAAA;AACT,yGAAA,UAAU,OAAA;AACV,sGAAA,OAAO,OAAA;AACP,gHAAA,iBAAiB,OAAA;AACjB,uHAAA,wBAAwB,OAAA;AACxB,4GAAA,aAAa,OAAA;AACb,gHAAA,iBAAiB,OAAA;AACjB,8GAAA,eAAe,OAAA;AACf,+GAAA,gBAAgB,OAAA;AAChB,mHAAA,oBAAoB,OAAA;AACpB,gHAAA,iBAAiB,OAAA;AACjB,uHAAA,wBAAwB,OAAA;AACxB,qHAAA,sBAAsB,OAAA;AACtB,uHAAA,wBAAwB,OAAA;AACxB,yGAAA,UAAU,OAAA;AACV,yHAAA,0BAA0B,OAAA;AAC1B,uHAAA,wBAAwB,OAAA;AAkB1B,8BAA8B;AAC9B,2CAKsB;AAJpB,iHAAA,mBAAmB,OAAA;AACnB,wGAAA,UAAU,OAAA;AACV,8GAAA,gBAAgB,OAAA;AAChB,0GAAA,YAAY,OAAA;AAkBd,cAAc;AACd,qCAOmB;AANjB,yGAAA,cAAc,OAAA;AACd,+GAAA,oBAAoB,OAAA;AACpB,mHAAA,wBAAwB,OAAA;AACxB,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;AACjB,kHAAA,uBAAuB,OAAA;AAGzB,WAAW;AACX,8CAAiD;AAAxC,0GAAA,aAAa,OAAA;AAStB,UAAU;AACV,iEAIiC;AAH/B,4HAAA,mBAAmB,OAAA;AACnB,6HAAA,oBAAoB,OAAA;AACpB,4HAAA,mBAAmB,OAAA;AAIrB,0BAA0B;AAC1B,iEAGiC;AAF/B,gIAAA,uBAAuB,OAAA;AACvB,4HAAA,mBAAmB,OAAA"}
|
|
@@ -41,22 +41,19 @@ export declare class ProjectConfigLoader {
|
|
|
41
41
|
* 合并内置约束和自定义约束(ADR-0001 生效集完整链路)
|
|
42
42
|
*
|
|
43
43
|
* 合并顺序:内置 → preset 裁剪 → config.yml `constraints.<id>.enabled:false`
|
|
44
|
-
* 删除(对内置与 custom 同效)→ custom-constraints
|
|
44
|
+
* 删除(对内置与 custom 同效)→ custom-constraints 追加
|
|
45
45
|
* (禁用/已退役的 custom 不追加)→ scenes 过滤
|
|
46
46
|
* (带 appliesTo 的 prompt 仅当 scenes 交集非空时保留)。
|
|
47
47
|
*
|
|
48
48
|
* config.yml 中未知约束 id(如已移除约束的禁用残留)静默忽略,
|
|
49
49
|
* 记录在结果 unknownIds 中供诊断。
|
|
50
50
|
*
|
|
51
|
-
* @param options.preset 覆盖 config.yml 的 preset(CLI --preset
|
|
51
|
+
* @param options.preset 覆盖 config.yml 的 preset(CLI --preset 用);
|
|
52
|
+
* 未知预设名回落 standard + stderr 警告
|
|
52
53
|
*/
|
|
53
54
|
mergeConstraints(options?: {
|
|
54
55
|
preset?: string;
|
|
55
56
|
}): MergedConstraintsConfig;
|
|
56
|
-
/**
|
|
57
|
-
* 在合并结果中查找内置约束
|
|
58
|
-
*/
|
|
59
|
-
private findBuiltInConstraint;
|
|
60
57
|
/**
|
|
61
58
|
* 将自定义约束定义转换为 Constraint
|
|
62
59
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-config-loader.d.ts","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EACV,aAAa,EACb,0BAA0B,EAC1B,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"project-config-loader.d.ts","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EACV,aAAa,EACb,0BAA0B,EAC1B,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAqBjC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CA8B7F;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;AAEvE;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAWzE;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,iBAAiB,CAA6C;gBAE1D,WAAW,CAAC,EAAE,MAAM;IAMhC;;OAEG;IACH,IAAI,IAAI,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyB7B;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,uBAAuB;IAqGxE;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,SAAS,IAAI,aAAa;IAI1B;;OAEG;IACH,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAIlE;;OAEG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAclD;;OAEG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU;IAU7E;;OAEG;IACH,eAAe,IAAI,OAAO;CAM3B"}
|
|
@@ -47,6 +47,7 @@ const path = __importStar(require("path"));
|
|
|
47
47
|
const yaml = __importStar(require("js-yaml"));
|
|
48
48
|
const definitions_1 = require("./constraints/definitions");
|
|
49
49
|
const presets_1 = require("../presets");
|
|
50
|
+
const effective_set_1 = require("./effective-set");
|
|
50
51
|
/**
|
|
51
52
|
* 默认配置
|
|
52
53
|
*/
|
|
@@ -163,45 +164,66 @@ class ProjectConfigLoader {
|
|
|
163
164
|
* 合并内置约束和自定义约束(ADR-0001 生效集完整链路)
|
|
164
165
|
*
|
|
165
166
|
* 合并顺序:内置 → preset 裁剪 → config.yml `constraints.<id>.enabled:false`
|
|
166
|
-
* 删除(对内置与 custom 同效)→ custom-constraints
|
|
167
|
+
* 删除(对内置与 custom 同效)→ custom-constraints 追加
|
|
167
168
|
* (禁用/已退役的 custom 不追加)→ scenes 过滤
|
|
168
169
|
* (带 appliesTo 的 prompt 仅当 scenes 交集非空时保留)。
|
|
169
170
|
*
|
|
170
171
|
* config.yml 中未知约束 id(如已移除约束的禁用残留)静默忽略,
|
|
171
172
|
* 记录在结果 unknownIds 中供诊断。
|
|
172
173
|
*
|
|
173
|
-
* @param options.preset 覆盖 config.yml 的 preset(CLI --preset
|
|
174
|
+
* @param options.preset 覆盖 config.yml 的 preset(CLI --preset 用);
|
|
175
|
+
* 未知预设名回落 standard + stderr 警告
|
|
174
176
|
*/
|
|
175
177
|
mergeConstraints(options) {
|
|
176
|
-
// 0. preset
|
|
177
|
-
const
|
|
178
|
+
// 0. preset 裁剪(strict 是 standard 的别名;未知名回落 standard)
|
|
179
|
+
const presetName = options?.preset ?? this.config.preset ?? 'standard';
|
|
180
|
+
let preset = presets_1.PRESETS_BY_NAME[presetName];
|
|
181
|
+
if (!preset) {
|
|
182
|
+
console.error(`[harness] 未知预设 "${presetName}",已回落 standard`);
|
|
183
|
+
preset = presets_1.STANDARD_PRESET;
|
|
184
|
+
}
|
|
185
|
+
const pick = (source, ids) => {
|
|
186
|
+
if (ids === null)
|
|
187
|
+
return { ...source };
|
|
188
|
+
const filtered = {};
|
|
189
|
+
for (const id of ids) {
|
|
190
|
+
if (source[id])
|
|
191
|
+
filtered[id] = source[id];
|
|
192
|
+
}
|
|
193
|
+
return filtered;
|
|
194
|
+
};
|
|
195
|
+
const presetDisabled = (source, ids) => (ids === null ? [] : Object.keys(source).filter(id => !ids.includes(id)));
|
|
178
196
|
const unknownIds = [];
|
|
179
197
|
const result = {
|
|
180
|
-
ironLaws:
|
|
181
|
-
guidelines:
|
|
182
|
-
prompts:
|
|
183
|
-
disabled: [
|
|
198
|
+
ironLaws: pick(definitions_1.IRON_LAWS, preset.ironLaws),
|
|
199
|
+
guidelines: pick(definitions_1.GUIDELINES, preset.guidelines),
|
|
200
|
+
prompts: pick(definitions_1.PROMPTS, preset.prompts),
|
|
201
|
+
disabled: [
|
|
202
|
+
...presetDisabled(definitions_1.IRON_LAWS, preset.ironLaws),
|
|
203
|
+
...presetDisabled(definitions_1.GUIDELINES, preset.guidelines),
|
|
204
|
+
...presetDisabled(definitions_1.PROMPTS, preset.prompts),
|
|
205
|
+
],
|
|
184
206
|
custom: [],
|
|
185
207
|
unknownIds,
|
|
186
208
|
};
|
|
187
|
-
// 1.
|
|
209
|
+
// 1. 处理启用/禁用配置(未知 id 静默忽略,记录供诊断)
|
|
188
210
|
if (this.config.constraints) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
211
|
+
const knownIds = new Set([
|
|
212
|
+
...Object.keys(definitions_1.IRON_LAWS),
|
|
213
|
+
...Object.keys(definitions_1.GUIDELINES),
|
|
214
|
+
...Object.keys(definitions_1.PROMPTS),
|
|
215
|
+
...Object.keys(this.customConstraints),
|
|
216
|
+
]);
|
|
217
|
+
const filtered = (0, effective_set_1.filterEnabledEntries)(knownIds, this.config.constraints, {
|
|
218
|
+
onUnknownId: 'collect',
|
|
219
|
+
});
|
|
220
|
+
unknownIds.push(...filtered.unknownIds);
|
|
221
|
+
for (const constraintId of filtered.disabledIds) {
|
|
222
|
+
result.disabled.push(constraintId);
|
|
223
|
+
// 从对应层级中移除
|
|
224
|
+
delete result.ironLaws[constraintId];
|
|
225
|
+
delete result.guidelines[constraintId];
|
|
226
|
+
delete result.prompts[constraintId];
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
229
|
// 2. 添加自定义约束(config.yml 禁用的 id 不追加:step 1 已将其
|
|
@@ -211,36 +233,7 @@ class ProjectConfigLoader {
|
|
|
211
233
|
if (result.disabled.includes(id) || customDef.retired) {
|
|
212
234
|
continue;
|
|
213
235
|
}
|
|
214
|
-
const extendExceptions = customDef.extend_exceptions;
|
|
215
|
-
const isExtendOnly = !!extendExceptions && extendExceptions.length > 0 &&
|
|
216
|
-
!customDef.rule &&
|
|
217
|
-
!customDef.exceptions;
|
|
218
|
-
if (isExtendOnly) {
|
|
219
|
-
const builtIn = this.findBuiltInConstraint(id, result);
|
|
220
|
-
if (builtIn) {
|
|
221
|
-
const constraint = { ...builtIn };
|
|
222
|
-
constraint.exceptions = [
|
|
223
|
-
...(builtIn.exceptions || []),
|
|
224
|
-
...extendExceptions,
|
|
225
|
-
];
|
|
226
|
-
if (result.ironLaws[id])
|
|
227
|
-
result.ironLaws[id] = constraint;
|
|
228
|
-
if (result.guidelines[id])
|
|
229
|
-
result.guidelines[id] = constraint;
|
|
230
|
-
if (result.prompts[id])
|
|
231
|
-
result.prompts[id] = constraint;
|
|
232
|
-
continue;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
236
|
const constraint = this.toConstraint(customDef, id);
|
|
236
|
-
if (extendExceptions && extendExceptions.length > 0) {
|
|
237
|
-
const builtIn = this.findBuiltInConstraint(id, result);
|
|
238
|
-
constraint.exceptions = [
|
|
239
|
-
...(builtIn?.exceptions || []),
|
|
240
|
-
...(customDef.exceptions || []),
|
|
241
|
-
...extendExceptions,
|
|
242
|
-
];
|
|
243
|
-
}
|
|
244
237
|
result.custom.push(id);
|
|
245
238
|
const level = customDef.level || 'guideline';
|
|
246
239
|
switch (level) {
|
|
@@ -268,12 +261,6 @@ class ProjectConfigLoader {
|
|
|
268
261
|
}
|
|
269
262
|
return result;
|
|
270
263
|
}
|
|
271
|
-
/**
|
|
272
|
-
* 在合并结果中查找内置约束
|
|
273
|
-
*/
|
|
274
|
-
findBuiltInConstraint(id, merged) {
|
|
275
|
-
return merged.ironLaws[id] || merged.guidelines[id] || merged.prompts?.[id];
|
|
276
|
-
}
|
|
277
264
|
/**
|
|
278
265
|
* 将自定义约束定义转换为 Constraint
|
|
279
266
|
*
|
|
@@ -290,7 +277,6 @@ class ProjectConfigLoader {
|
|
|
290
277
|
rule: def.rule || '',
|
|
291
278
|
message: def.message || '',
|
|
292
279
|
trigger: (def.trigger || 'manual'),
|
|
293
|
-
exceptions: def.exceptions,
|
|
294
280
|
description: def.description,
|
|
295
281
|
promptInjection: def.promptInjection,
|
|
296
282
|
enabled: def.enabled !== false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-config-loader.js","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"project-config-loader.js","sourceRoot":"","sources":["../../src/core/project-config-loader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCH,oDA8BC;AAYD,kDAWC;AAxFD,uCAAyB;AACzB,2CAA6B;AAC7B,8CAAgC;AAQhC,2DAA2E;AAC3E,wCAA8D;AAC9D,mDAAuD;AAEvD;;GAEG;AACH,MAAM,cAAc,GAAkB;IACpC,MAAM,EAAE,UAAU;IAClB,uBAAuB,EAAE,wBAAwB;CAClD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,cAAc,GAAG,IAAI,GAAG,EAA2E,CAAC;AAE1G;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,WAAmB;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,I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统一 Gate,供守卫链(如 studio
|
|
5
5
|
* runCompletionGuards)复用 runGates 的 deny 单调 / ask fail-closed 语义。
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* (stagedDiff 空、srcScan 空)——证据 flag 未接线的 checker 按契约返回
|
|
9
|
-
* 'skip'(不阻断,映射为 abstain);纯上下文判断的 checker 照常判定。
|
|
10
|
-
* studio 侧若需 git 证据,在 #129 接线时扩展 CheckEnv 构造。
|
|
7
|
+
* env 经 buildCheckEnv(..., 'none') 构造(显式不接证据),语义见工厂 doc。
|
|
11
8
|
*/
|
|
12
9
|
import type { ConstraintCheck } from '../core/constraints/checkers';
|
|
13
10
|
import type { Gate } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker-gate.d.ts","sourceRoot":"","sources":["../../src/gates/checker-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"checker-gate.d.ts","sourceRoot":"","sources":["../../src/gates/checker-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,IAAI,EAA6B,MAAM,SAAS,CAAC;AAG/D;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,SAAI,GAAG,IAAI,CAuBzE"}
|
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
* 把已注册的 ConstraintCheck 适配为统一 Gate,供守卫链(如 studio
|
|
6
6
|
* runCompletionGuards)复用 runGates 的 deny 单调 / ask fail-closed 语义。
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* (stagedDiff 空、srcScan 空)——证据 flag 未接线的 checker 按契约返回
|
|
10
|
-
* 'skip'(不阻断,映射为 abstain);纯上下文判断的 checker 照常判定。
|
|
11
|
-
* studio 侧若需 git 证据,在 #129 接线时扩展 CheckEnv 构造。
|
|
8
|
+
* env 经 buildCheckEnv(..., 'none') 构造(显式不接证据),语义见工厂 doc。
|
|
12
9
|
*/
|
|
13
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
11
|
exports.createCheckerGate = createCheckerGate;
|
|
12
|
+
const checkers_1 = require("../core/constraints/checkers");
|
|
15
13
|
const decision_1 = require("./decision");
|
|
16
14
|
/**
|
|
17
15
|
* 将已注册 checker 适配为统一 Gate(checker-as-guard 接线点)
|
|
@@ -28,13 +26,7 @@ function createCheckerGate(check, order = 0) {
|
|
|
28
26
|
async evaluate(ctx) {
|
|
29
27
|
const startTime = Date.now();
|
|
30
28
|
const projectPath = ctx.projectPath || process.cwd();
|
|
31
|
-
const env = {
|
|
32
|
-
context: { operation: 'manual', projectPath },
|
|
33
|
-
projectPath,
|
|
34
|
-
stagedDiff: async () => '',
|
|
35
|
-
stagedDiffNames: async () => '',
|
|
36
|
-
srcScan: () => [],
|
|
37
|
-
};
|
|
29
|
+
const env = (0, checkers_1.buildCheckEnv)({ operation: 'manual', projectPath }, 'none');
|
|
38
30
|
const outcome = await check.evaluate(env);
|
|
39
31
|
return (0, decision_1.decisionFromResult)({
|
|
40
32
|
gate: check.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker-gate.js","sourceRoot":"","sources":["../../src/gates/checker-gate.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"checker-gate.js","sourceRoot":"","sources":["../../src/gates/checker-gate.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAeH,8CAuBC;AAnCD,2DAA6D;AAE7D,yCAAgD;AAEhD;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAAC,KAAsB,EAAE,KAAK,GAAG,CAAC;IACjE,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK;QACL,KAAK,CAAC,QAAQ,CAAC,GAAgB;YAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YACrD,MAAM,GAAG,GAAG,IAAA,wBAAa,EAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC;YACxE,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC1C,OAAO,IAAA,6BAAkB,EAAC;gBACxB,IAAI,EAAE,KAAK,CAAC,EAAE;gBACd,MAAM,EAAE,OAAO,KAAK,KAAK;gBACzB,OAAO,EACL,OAAO,KAAK,KAAK;oBACf,CAAC,CAAC,YAAY,KAAK,CAAC,EAAE,QAAQ;oBAC9B,CAAC,CAAC,OAAO,KAAK,MAAM;wBAClB,CAAC,CAAC,YAAY,KAAK,CAAC,EAAE,aAAa;wBACnC,CAAC,CAAC,YAAY,KAAK,CAAC,EAAE,MAAM;gBAClC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;aACjC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -3,46 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - 每个门禁在此声明 id / description / 默认 order / CLI 元数据;
|
|
5
5
|
* registry.ts 按此表做「定义↔实现」双向闭环校验(复制 checker 闭环模式)。
|
|
6
|
-
* - CLI
|
|
7
|
-
*
|
|
8
|
-
* module+export(CommandImplRef),
|
|
6
|
+
* - CLI 元数据即 CommandDefinition(架构评审候选8,ADR-0007:形状对齐通用
|
|
7
|
+
* 命令定义,bin/harness.js 单引擎单循环生成全部命令):命令名/别名/选项/
|
|
8
|
+
* 子命令路由与历史手工块完全兼容;实现引用为 module+export(CommandImplRef),
|
|
9
|
+
* bin 按需 per-command 懒加载(H5/O2)。门禁特有语义由两个标志表达:
|
|
10
|
+
* subcommandStrict:false(未知位置参数落回默认 action)+
|
|
11
|
+
* bareRunsAction:true(无位置参数时跑默认 action 而非显示帮助)。
|
|
9
12
|
* - 本模块禁止 import 任何门禁/命令实现(仅 type import,运行时零依赖)——
|
|
10
13
|
* bin 启动期只加载本纯数据模块(保持 --help/--version 懒加载,
|
|
11
14
|
* 闭环校验在 registry 加载期执行)。
|
|
12
15
|
*/
|
|
13
|
-
import type {
|
|
14
|
-
/**
|
|
15
|
-
* 门禁 CLI 选项元数据(直接映射 commander `.option()`)
|
|
16
|
-
*/
|
|
17
|
-
export interface GateCliOption {
|
|
18
|
-
/** commander option flags,如 '-p, --project-path <path>' */
|
|
19
|
-
flags: string;
|
|
20
|
-
/** 选项描述 */
|
|
21
|
-
description: string;
|
|
22
|
-
/** commander 缺省值;negated option(如 --no-strict)不设,由 commander 默认 true */
|
|
23
|
-
defaultValue?: string | boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 门禁 CLI 命令元数据(bin/harness.js 注册表驱动生成)
|
|
27
|
-
*/
|
|
28
|
-
export interface GateCliDefinition {
|
|
29
|
-
/** 命令名(历史命令名兼容保留) */
|
|
30
|
-
command: string;
|
|
31
|
-
/** 命令别名 */
|
|
32
|
-
alias?: string;
|
|
33
|
-
/** 位置参数声明,如 '[subcommand]' / '[cmd]' */
|
|
34
|
-
argument?: string;
|
|
35
|
-
/** 命令描述 */
|
|
36
|
-
description: string;
|
|
37
|
-
/** 命令选项 */
|
|
38
|
-
options: GateCliOption[];
|
|
39
|
-
/** 子命令名 → 命令实现引用(module+export);命中后按 [options] 透传 */
|
|
40
|
-
subcommands?: Record<string, CommandImplRef>;
|
|
41
|
-
/** 默认 action 命令实现引用(module+export) */
|
|
42
|
-
action: CommandImplRef;
|
|
43
|
-
/** 默认 action 实参构造:arg = 位置参数(无位置参数时为 undefined),options = commander 选项对象 */
|
|
44
|
-
mapActionArgs: (arg: string | undefined, options: Record<string, unknown>) => unknown[];
|
|
45
|
-
}
|
|
16
|
+
import type { CommandDefinition } from '../cli/commands/definitions';
|
|
46
17
|
/**
|
|
47
18
|
* 门禁定义
|
|
48
19
|
*/
|
|
@@ -53,8 +24,8 @@ export interface GateDefinition {
|
|
|
53
24
|
description: string;
|
|
54
25
|
/** 默认顺序(config.yml `gates.order` 可覆盖),小者先执行 */
|
|
55
26
|
order: number;
|
|
56
|
-
/** CLI
|
|
57
|
-
cli:
|
|
27
|
+
/** CLI 元数据(形状 = CommandDefinition,bin/harness.js 通用引擎驱动生成) */
|
|
28
|
+
cli: CommandDefinition;
|
|
58
29
|
}
|
|
59
30
|
/**
|
|
60
31
|
* 6 门禁定义(默认 order 按字母序,与历史 bin 块顺序一致)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/gates/definitions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/gates/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,GAAG,EAAE,iBAAiB,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAoJ5C,CAAC"}
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - 每个门禁在此声明 id / description / 默认 order / CLI 元数据;
|
|
6
6
|
* registry.ts 按此表做「定义↔实现」双向闭环校验(复制 checker 闭环模式)。
|
|
7
|
-
* - CLI
|
|
8
|
-
*
|
|
9
|
-
* module+export(CommandImplRef),
|
|
7
|
+
* - CLI 元数据即 CommandDefinition(架构评审候选8,ADR-0007:形状对齐通用
|
|
8
|
+
* 命令定义,bin/harness.js 单引擎单循环生成全部命令):命令名/别名/选项/
|
|
9
|
+
* 子命令路由与历史手工块完全兼容;实现引用为 module+export(CommandImplRef),
|
|
10
|
+
* bin 按需 per-command 懒加载(H5/O2)。门禁特有语义由两个标志表达:
|
|
11
|
+
* subcommandStrict:false(未知位置参数落回默认 action)+
|
|
12
|
+
* bareRunsAction:true(无位置参数时跑默认 action 而非显示帮助)。
|
|
10
13
|
* - 本模块禁止 import 任何门禁/命令实现(仅 type import,运行时零依赖)——
|
|
11
14
|
* bin 启动期只加载本纯数据模块(保持 --help/--version 懒加载,
|
|
12
15
|
* 闭环校验在 registry 加载期执行)。
|
|
@@ -33,9 +36,11 @@ exports.GATE_DEFINITIONS = [
|
|
|
33
36
|
{ flags: '--check-all', description: '检查所有任务', defaultValue: false },
|
|
34
37
|
{ flags: '--run-e2e', description: '运行 E2E 测试', defaultValue: false },
|
|
35
38
|
],
|
|
36
|
-
subcommands: { list: { module: 'acceptance', export: 'listAcceptanceCriteria' } },
|
|
39
|
+
subcommands: { list: { impl: { module: 'acceptance', export: 'listAcceptanceCriteria' } } },
|
|
40
|
+
subcommandStrict: false,
|
|
41
|
+
bareRunsAction: true,
|
|
37
42
|
action: { module: 'acceptance', export: 'acceptance' },
|
|
38
|
-
mapActionArgs: (
|
|
43
|
+
mapActionArgs: (_positionals, options) => [options],
|
|
39
44
|
},
|
|
40
45
|
},
|
|
41
46
|
{
|
|
@@ -54,7 +59,7 @@ exports.GATE_DEFINITIONS = [
|
|
|
54
59
|
{ flags: '--strict', description: '严格模式(warn 也阻止)' },
|
|
55
60
|
],
|
|
56
61
|
action: { module: 'command', export: 'executeCommand' },
|
|
57
|
-
mapActionArgs: (
|
|
62
|
+
mapActionArgs: (positionals, options) => [positionals[0], options],
|
|
58
63
|
},
|
|
59
64
|
},
|
|
60
65
|
{
|
|
@@ -71,9 +76,11 @@ exports.GATE_DEFINITIONS = [
|
|
|
71
76
|
{ flags: '--no-strict', description: '关闭严格模式' },
|
|
72
77
|
{ flags: '--allow-breaking', description: '允许破坏性变更', defaultValue: false },
|
|
73
78
|
],
|
|
74
|
-
subcommands: { validate: { module: 'contract', export: 'validateSchema' } },
|
|
79
|
+
subcommands: { validate: { impl: { module: 'contract', export: 'validateSchema' } } },
|
|
80
|
+
subcommandStrict: false,
|
|
81
|
+
bareRunsAction: true,
|
|
75
82
|
action: { module: 'contract', export: 'contract' },
|
|
76
|
-
mapActionArgs: (
|
|
83
|
+
mapActionArgs: (_positionals, options) => [options],
|
|
77
84
|
},
|
|
78
85
|
},
|
|
79
86
|
{
|
|
@@ -94,7 +101,7 @@ exports.GATE_DEFINITIONS = [
|
|
|
94
101
|
{ flags: '--benchmark-timeout <n>', description: '基准测试超时(秒)', defaultValue: '60' },
|
|
95
102
|
],
|
|
96
103
|
action: { module: 'performance', export: 'performance' },
|
|
97
|
-
mapActionArgs: (
|
|
104
|
+
mapActionArgs: (_positionals, options) => [
|
|
98
105
|
{
|
|
99
106
|
projectPath: options.projectPath,
|
|
100
107
|
coverage: options.coverage,
|
|
@@ -122,9 +129,11 @@ exports.GATE_DEFINITIONS = [
|
|
|
122
129
|
{ flags: '--no-block-on-changes', description: '不阻止变更请求' },
|
|
123
130
|
{ flags: '--allowed-reviewers <list>', description: '允许的审查者(逗号分隔)' },
|
|
124
131
|
],
|
|
125
|
-
subcommands: { status: { module: 'review', export: 'reviewStatus' } },
|
|
132
|
+
subcommands: { status: { impl: { module: 'review', export: 'reviewStatus' } } },
|
|
133
|
+
subcommandStrict: false,
|
|
134
|
+
bareRunsAction: true,
|
|
126
135
|
action: { module: 'review', export: 'review' },
|
|
127
|
-
mapActionArgs: (
|
|
136
|
+
mapActionArgs: (_positionals, options) => [
|
|
128
137
|
{
|
|
129
138
|
projectPath: options.projectPath,
|
|
130
139
|
minReviewers: parseInt(String(options.minReviewers), 10),
|
|
@@ -151,9 +160,11 @@ exports.GATE_DEFINITIONS = [
|
|
|
151
160
|
{ flags: '--ignore-dev-deps', description: '忽略开发依赖', defaultValue: false },
|
|
152
161
|
{ flags: '--scan-command <cmd>', description: '自定义扫描命令' },
|
|
153
162
|
],
|
|
154
|
-
subcommands: { audit: { module: 'security', export: 'auditDetails' } },
|
|
163
|
+
subcommands: { audit: { impl: { module: 'security', export: 'auditDetails' } } },
|
|
164
|
+
subcommandStrict: false,
|
|
165
|
+
bareRunsAction: true,
|
|
155
166
|
action: { module: 'security', export: 'security' },
|
|
156
|
-
mapActionArgs: (
|
|
167
|
+
mapActionArgs: (_positionals, options) => [options],
|
|
157
168
|
},
|
|
158
169
|
},
|
|
159
170
|
];
|