@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performance.d.ts","sourceRoot":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AAC;KACb,CAAC;IAEF,iBAAiB;IACjB,WAAW,EAAE,MAAM,CAAC;IAEpB,oBAAoB;IACpB,gBAAgB,EAAE,MAAM,CAAC;IAEzB,YAAY;IACZ,aAAa,EAAE,MAAM,CAAC;IAEtB,WAAW;IACX,YAAY,EAAE,MAAM,CAAC;IAErB,YAAY;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7B,YAAY;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Performance Trace 类型定义
|
|
4
|
-
*
|
|
5
|
-
* 轻量设计:只记录核心信息,零 Token 成本
|
|
6
|
-
*
|
|
7
|
-
* 与 ExecutionTrace 的区别:
|
|
8
|
-
* - ExecutionTrace: 记录约束检查结果(业务行为)
|
|
9
|
-
* - PerformanceTrace: 记录操作耗时(性能指标)
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
//# sourceMappingURL=performance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sourceRoot":"","sources":["../../src/types/performance.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./rules-based"), exports);
|
|
19
|
-
__exportStar(require("./loop"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,gDAA8B;AAC9B,yCAAuB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 验证循环(Gather-Act-Verify)
|
|
3
|
-
*
|
|
4
|
-
* 编排验证流程:
|
|
5
|
-
* 1. Gather:收集当前状态
|
|
6
|
-
* 2. Act:执行动作
|
|
7
|
-
* 3. Verify:验证结果
|
|
8
|
-
* 失败时重试,最多 N 次
|
|
9
|
-
*/
|
|
10
|
-
import type { VerificationLoopConfig, LoopSnapshot, LoopStatus, VerificationResult, GatherState, ActAction, VerificationContext } from './types';
|
|
11
|
-
export type GatherFn = (attempt: number) => Promise<GatherState>;
|
|
12
|
-
export type ActFn = (state: GatherState, results: VerificationResult[]) => Promise<ActAction>;
|
|
13
|
-
export declare class VerificationLoop {
|
|
14
|
-
private config;
|
|
15
|
-
private verifier;
|
|
16
|
-
private status;
|
|
17
|
-
private attempt;
|
|
18
|
-
private results;
|
|
19
|
-
private lastError?;
|
|
20
|
-
constructor(config: VerificationLoopConfig);
|
|
21
|
-
/**
|
|
22
|
-
* 执行验证循环
|
|
23
|
-
*/
|
|
24
|
-
run(context: VerificationContext, gather: GatherFn, act?: ActFn): Promise<LoopSnapshot>;
|
|
25
|
-
private snapshot;
|
|
26
|
-
getStatus(): LoopStatus;
|
|
27
|
-
getAttempt(): number;
|
|
28
|
-
getResults(): VerificationResult[];
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../src/verification/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AACjE,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;AAE9F,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,SAAS,CAAC,CAAS;gBAEf,MAAM,EAAE,sBAAsB;IAK1C;;OAEG;IACG,GAAG,CACP,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,QAAQ,EAChB,GAAG,CAAC,EAAE,KAAK,GACV,OAAO,CAAC,YAAY,CAAC;IAsExB,OAAO,CAAC,QAAQ;IAWhB,SAAS,IAAI,UAAU;IAIvB,UAAU,IAAI,MAAM;IAIpB,UAAU,IAAI,kBAAkB,EAAE;CAGnC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* 验证循环(Gather-Act-Verify)
|
|
4
|
-
*
|
|
5
|
-
* 编排验证流程:
|
|
6
|
-
* 1. Gather:收集当前状态
|
|
7
|
-
* 2. Act:执行动作
|
|
8
|
-
* 3. Verify:验证结果
|
|
9
|
-
* 失败时重试,最多 N 次
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.VerificationLoop = void 0;
|
|
13
|
-
const rules_based_1 = require("./rules-based");
|
|
14
|
-
class VerificationLoop {
|
|
15
|
-
config;
|
|
16
|
-
verifier;
|
|
17
|
-
status = 'idle';
|
|
18
|
-
attempt = 0;
|
|
19
|
-
results = [];
|
|
20
|
-
lastError;
|
|
21
|
-
constructor(config) {
|
|
22
|
-
this.config = config;
|
|
23
|
-
this.verifier = new rules_based_1.RulesBasedVerification(config.rules);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 执行验证循环
|
|
27
|
-
*/
|
|
28
|
-
async run(context, gather, act) {
|
|
29
|
-
this.status = 'idle';
|
|
30
|
-
this.attempt = 0;
|
|
31
|
-
this.results = [];
|
|
32
|
-
this.lastError = undefined;
|
|
33
|
-
while (this.attempt < this.config.maxRetries) {
|
|
34
|
-
this.attempt++;
|
|
35
|
-
// Gather
|
|
36
|
-
this.status = 'gathering';
|
|
37
|
-
let gatherState;
|
|
38
|
-
try {
|
|
39
|
-
gatherState = await gather(this.attempt);
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
this.lastError = `Gather 失败: ${error instanceof Error ? error.message : String(error)}`;
|
|
43
|
-
this.status = 'failed';
|
|
44
|
-
return this.snapshot();
|
|
45
|
-
}
|
|
46
|
-
// Act(可选)
|
|
47
|
-
if (act && this.attempt > 1) {
|
|
48
|
-
this.status = 'acting';
|
|
49
|
-
try {
|
|
50
|
-
const action = await act(gatherState, this.results);
|
|
51
|
-
if (action.type === 'abort') {
|
|
52
|
-
this.lastError = `Act 中止: ${action.description}`;
|
|
53
|
-
this.status = 'failed';
|
|
54
|
-
return this.snapshot();
|
|
55
|
-
}
|
|
56
|
-
if (action.type === 'skip') {
|
|
57
|
-
this.status = 'passed';
|
|
58
|
-
return this.snapshot();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
this.lastError = `Act 失败: ${error instanceof Error ? error.message : String(error)}`;
|
|
63
|
-
this.status = 'failed';
|
|
64
|
-
return this.snapshot();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Verify
|
|
68
|
-
this.status = 'verifying';
|
|
69
|
-
try {
|
|
70
|
-
this.results = await this.verifier.verifyAll(context);
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
this.lastError = `Verify 失败: ${error instanceof Error ? error.message : String(error)}`;
|
|
74
|
-
this.status = 'failed';
|
|
75
|
-
return this.snapshot();
|
|
76
|
-
}
|
|
77
|
-
const allPassed = this.results.every(r => r.passed);
|
|
78
|
-
if (allPassed) {
|
|
79
|
-
this.status = 'passed';
|
|
80
|
-
return this.snapshot();
|
|
81
|
-
}
|
|
82
|
-
// failFast: 首次失败立即停止
|
|
83
|
-
if (this.config.failFast) {
|
|
84
|
-
this.lastError = '验证失败 (failFast)';
|
|
85
|
-
this.status = 'failed';
|
|
86
|
-
return this.snapshot();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
this.lastError = `达到最大重试次数 (${this.config.maxRetries})`;
|
|
90
|
-
this.status = 'failed';
|
|
91
|
-
return this.snapshot();
|
|
92
|
-
}
|
|
93
|
-
snapshot() {
|
|
94
|
-
return {
|
|
95
|
-
status: this.status,
|
|
96
|
-
attempt: this.attempt,
|
|
97
|
-
maxRetries: this.config.maxRetries,
|
|
98
|
-
results: this.results,
|
|
99
|
-
lastError: this.lastError,
|
|
100
|
-
timestamp: new Date().toISOString(),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
getStatus() {
|
|
104
|
-
return this.status;
|
|
105
|
-
}
|
|
106
|
-
getAttempt() {
|
|
107
|
-
return this.attempt;
|
|
108
|
-
}
|
|
109
|
-
getResults() {
|
|
110
|
-
return [...this.results];
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
exports.VerificationLoop = VerificationLoop;
|
|
114
|
-
//# sourceMappingURL=loop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/verification/loop.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAWH,+CAAuD;AAKvD,MAAa,gBAAgB;IACnB,MAAM,CAAyB;IAC/B,QAAQ,CAAyB;IACjC,MAAM,GAAe,MAAM,CAAC;IAC5B,OAAO,GAAG,CAAC,CAAC;IACZ,OAAO,GAAyB,EAAE,CAAC;IACnC,SAAS,CAAU;IAE3B,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,oCAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,OAA4B,EAC5B,MAAgB,EAChB,GAAW;QAEX,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,OAAO,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YAEf,SAAS;YACT,IAAI,CAAC,MAAM,GAAG,WAAW,CAA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M;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;YAClC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC;IACJ,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,UAAU;QACR,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;CACF;AAhHD,4CAgHC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 基于规则的确定性验证
|
|
3
|
-
*
|
|
4
|
-
* 执行 test / lint / typecheck / custom 规则
|
|
5
|
-
* 纯确定性验证,不依赖 LLM
|
|
6
|
-
*/
|
|
7
|
-
import type { VerificationRule, VerificationContext, VerificationResult } from './types';
|
|
8
|
-
export declare class RulesBasedVerification {
|
|
9
|
-
private rules;
|
|
10
|
-
constructor(rules: VerificationRule[]);
|
|
11
|
-
/**
|
|
12
|
-
* 执行所有规则验证
|
|
13
|
-
*/
|
|
14
|
-
verifyAll(context: VerificationContext): Promise<VerificationResult[]>;
|
|
15
|
-
/**
|
|
16
|
-
* 执行单条规则验证
|
|
17
|
-
*/
|
|
18
|
-
verifyRule(rule: VerificationRule, context: VerificationContext): Promise<VerificationResult>;
|
|
19
|
-
/**
|
|
20
|
-
* 执行命令类规则
|
|
21
|
-
*/
|
|
22
|
-
private executeCommand;
|
|
23
|
-
/**
|
|
24
|
-
* 执行自定义规则
|
|
25
|
-
*/
|
|
26
|
-
private executeCustom;
|
|
27
|
-
/**
|
|
28
|
-
* 添加规则
|
|
29
|
-
*/
|
|
30
|
-
addRule(rule: VerificationRule): void;
|
|
31
|
-
/**
|
|
32
|
-
* 移除规则
|
|
33
|
-
*/
|
|
34
|
-
removeRule(ruleId: string): void;
|
|
35
|
-
/**
|
|
36
|
-
* 获取规则列表
|
|
37
|
-
*/
|
|
38
|
-
getRules(): VerificationRule[];
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=rules-based.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rules-based.d.ts","sourceRoot":"","sources":["../../src/verification/rules-based.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,qBAAa,sBAAsB;IACjC,OAAO,CAAC,KAAK,CAAqB;gBAEtB,KAAK,EAAE,gBAAgB,EAAE;IAIrC;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAW5E;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6BnG;;OAEG;YACW,cAAc;IAyC5B;;OAEG;YACW,aAAa;IAiB3B;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAIrC;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIhC;;OAEG;IACH,QAAQ,IAAI,gBAAgB,EAAE;CAG/B"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* 基于规则的确定性验证
|
|
4
|
-
*
|
|
5
|
-
* 执行 test / lint / typecheck / custom 规则
|
|
6
|
-
* 纯确定性验证,不依赖 LLM
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.RulesBasedVerification = void 0;
|
|
10
|
-
const child_process_1 = require("child_process");
|
|
11
|
-
class RulesBasedVerification {
|
|
12
|
-
rules;
|
|
13
|
-
constructor(rules) {
|
|
14
|
-
this.rules = rules;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* 执行所有规则验证
|
|
18
|
-
*/
|
|
19
|
-
async verifyAll(context) {
|
|
20
|
-
const results = [];
|
|
21
|
-
for (const rule of this.rules) {
|
|
22
|
-
const result = await this.verifyRule(rule, context);
|
|
23
|
-
results.push(result);
|
|
24
|
-
}
|
|
25
|
-
return results;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 执行单条规则验证
|
|
29
|
-
*/
|
|
30
|
-
async verifyRule(rule, context) {
|
|
31
|
-
const start = Date.now();
|
|
32
|
-
try {
|
|
33
|
-
switch (rule.type) {
|
|
34
|
-
case 'test':
|
|
35
|
-
case 'lint':
|
|
36
|
-
case 'typecheck':
|
|
37
|
-
return await this.executeCommand(rule, context, start);
|
|
38
|
-
case 'custom':
|
|
39
|
-
return await this.executeCustom(rule, context, start);
|
|
40
|
-
default:
|
|
41
|
-
return {
|
|
42
|
-
passed: false,
|
|
43
|
-
ruleId: rule.id,
|
|
44
|
-
message: `未知的规则类型: ${rule.type}`,
|
|
45
|
-
duration: Date.now() - start,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
passed: false,
|
|
52
|
-
ruleId: rule.id,
|
|
53
|
-
message: `验证执行失败: ${error instanceof Error ? error.message : String(error)}`,
|
|
54
|
-
duration: Date.now() - start,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* 执行命令类规则
|
|
60
|
-
*/
|
|
61
|
-
async executeCommand(rule, context, start) {
|
|
62
|
-
if (!rule.command) {
|
|
63
|
-
return {
|
|
64
|
-
passed: false,
|
|
65
|
-
ruleId: rule.id,
|
|
66
|
-
message: `规则 ${rule.id} 缺少 command`,
|
|
67
|
-
duration: Date.now() - start,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const output = (0, child_process_1.execSync)(rule.command, {
|
|
72
|
-
cwd: context.projectRoot,
|
|
73
|
-
timeout: rule.timeout ?? 30000,
|
|
74
|
-
encoding: 'utf-8',
|
|
75
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
passed: true,
|
|
79
|
-
ruleId: rule.id,
|
|
80
|
-
message: `${rule.name} 通过`,
|
|
81
|
-
details: output.slice(0, 1000),
|
|
82
|
-
duration: Date.now() - start,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
const execError = error;
|
|
87
|
-
return {
|
|
88
|
-
passed: false,
|
|
89
|
-
ruleId: rule.id,
|
|
90
|
-
message: `${rule.name} 失败 (exit ${execError.status ?? 'unknown'})`,
|
|
91
|
-
details: (execError.stderr ?? execError.stdout ?? '').slice(0, 1000),
|
|
92
|
-
duration: Date.now() - start,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* 执行自定义规则
|
|
98
|
-
*/
|
|
99
|
-
async executeCustom(rule, context, start) {
|
|
100
|
-
if (!rule.verify) {
|
|
101
|
-
return {
|
|
102
|
-
passed: false,
|
|
103
|
-
ruleId: rule.id,
|
|
104
|
-
message: `规则 ${rule.id} 缺少 verify 函数`,
|
|
105
|
-
duration: Date.now() - start,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return rule.verify(context);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* 添加规则
|
|
112
|
-
*/
|
|
113
|
-
addRule(rule) {
|
|
114
|
-
this.rules.push(rule);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* 移除规则
|
|
118
|
-
*/
|
|
119
|
-
removeRule(ruleId) {
|
|
120
|
-
this.rules = this.rules.filter(r => r.id !== ruleId);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* 获取规则列表
|
|
124
|
-
*/
|
|
125
|
-
getRules() {
|
|
126
|
-
return [...this.rules];
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports.RulesBasedVerification = RulesBasedVerification;
|
|
130
|
-
//# sourceMappingURL=rules-based.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rules-based.js","sourceRoot":"","sources":["../../src/verification/rules-based.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iDAAyC;AAOzC,MAAa,sBAAsB;IACzB,KAAK,CAAqB;IAElC,YAAY,KAAyB;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,OAA4B;QAC1C,MAAM,OAAO,GAAyB,EAAE,CAAC;QAEzC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,IAAsB,EAAE,OAA4B;QACnE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEzB,IAAI,CAAC;YACH,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,MAAM,CAAC;gBACZ,KAAK,MAAM,CAAC;gBACZ,KAAK,WAAW;oBACd,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;gBACzD,KAAK,QAAQ;oBACX,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAA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M,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;CACF;AAzID,wDAyIC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verification Loop 类型定义
|
|
3
|
-
*/
|
|
4
|
-
/** 验证规则类型 */
|
|
5
|
-
export type VerificationRuleType = 'test' | 'lint' | 'typecheck' | 'custom';
|
|
6
|
-
/** 验证规则 */
|
|
7
|
-
export interface VerificationRule {
|
|
8
|
-
id: string;
|
|
9
|
-
type: VerificationRuleType;
|
|
10
|
-
name: string;
|
|
11
|
-
description: string;
|
|
12
|
-
/** 执行命令(用于 test/lint/typecheck) */
|
|
13
|
-
command?: string;
|
|
14
|
-
/** 自定义验证函数(用于 custom) */
|
|
15
|
-
verify?: (context: VerificationContext) => Promise<VerificationResult>;
|
|
16
|
-
/** 超时(ms) */
|
|
17
|
-
timeout?: number;
|
|
18
|
-
}
|
|
19
|
-
/** 验证上下文 */
|
|
20
|
-
export interface VerificationContext {
|
|
21
|
-
/** 项目根目录 */
|
|
22
|
-
projectRoot: string;
|
|
23
|
-
/** 变更的文件列表 */
|
|
24
|
-
changedFiles?: string[];
|
|
25
|
-
/** 额外元数据 */
|
|
26
|
-
metadata?: Record<string, unknown>;
|
|
27
|
-
}
|
|
28
|
-
/** 单条规则的验证结果 */
|
|
29
|
-
export interface VerificationResult {
|
|
30
|
-
passed: boolean;
|
|
31
|
-
ruleId: string;
|
|
32
|
-
message?: string;
|
|
33
|
-
details?: string;
|
|
34
|
-
duration: number;
|
|
35
|
-
}
|
|
36
|
-
/** 验证循环状态 */
|
|
37
|
-
export type LoopStatus = 'idle' | 'gathering' | 'acting' | 'verifying' | 'passed' | 'failed';
|
|
38
|
-
/** 验证循环配置 */
|
|
39
|
-
export interface VerificationLoopConfig {
|
|
40
|
-
/** 最大重试次数 */
|
|
41
|
-
maxRetries: number;
|
|
42
|
-
/** 验证规则 */
|
|
43
|
-
rules: VerificationRule[];
|
|
44
|
-
/** 是否在首次失败时立即停止 */
|
|
45
|
-
failFast?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/** 验证循环快照 */
|
|
48
|
-
export interface LoopSnapshot {
|
|
49
|
-
status: LoopStatus;
|
|
50
|
-
attempt: number;
|
|
51
|
-
maxRetries: number;
|
|
52
|
-
results: VerificationResult[];
|
|
53
|
-
lastError?: string;
|
|
54
|
-
timestamp: string;
|
|
55
|
-
}
|
|
56
|
-
/** Gather 阶段的状态 */
|
|
57
|
-
export interface GatherState {
|
|
58
|
-
changedFiles: string[];
|
|
59
|
-
testResults?: string;
|
|
60
|
-
lintResults?: string;
|
|
61
|
-
metadata: Record<string, unknown>;
|
|
62
|
-
}
|
|
63
|
-
/** Act 阶段的动作 */
|
|
64
|
-
export interface ActAction {
|
|
65
|
-
type: 'fix' | 'retry' | 'skip' | 'abort';
|
|
66
|
-
description: string;
|
|
67
|
-
target?: string;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,aAAa;AACb,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE5E,WAAW;AACX,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,oBAAoB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CA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,OAAO,CAAC,CAAC;CACnC;AAED,gBAAgB;AAChB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AnnotationChecker 测试
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
|
6
|
-
import { checkFile, checkDirectory } from '../spec/annotation-checker';
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
|
|
10
|
-
describe('AnnotationChecker', () => {
|
|
11
|
-
const tempDir = path.join(process.cwd(), 'temp-test-annotations');
|
|
12
|
-
const validFile = path.join(tempDir, 'valid.ts');
|
|
13
|
-
const invalidFile = path.join(tempDir, 'invalid.ts');
|
|
14
|
-
|
|
15
|
-
beforeAll(() => {
|
|
16
|
-
fs.mkdirSync(tempDir, { recursive: true });
|
|
17
|
-
|
|
18
|
-
// 创建有效文件
|
|
19
|
-
fs.writeFileSync(validFile, `
|
|
20
|
-
/**
|
|
21
|
-
* @spec AR-001
|
|
22
|
-
* @implements AR-001-C1
|
|
23
|
-
* @acceptance AC-001
|
|
24
|
-
* @author test
|
|
25
|
-
* @since 2026-01-01
|
|
26
|
-
*/
|
|
27
|
-
export class ValidClass {
|
|
28
|
-
/**
|
|
29
|
-
* @spec AR-001-S1
|
|
30
|
-
*/
|
|
31
|
-
validMethod() {}
|
|
32
|
-
}
|
|
33
|
-
`);
|
|
34
|
-
|
|
35
|
-
// 创建无效文件(缺少必要字段)
|
|
36
|
-
fs.writeFileSync(invalidFile, `
|
|
37
|
-
/**
|
|
38
|
-
* @spec invalid-id
|
|
39
|
-
*/
|
|
40
|
-
export class InvalidClass {
|
|
41
|
-
method() {}
|
|
42
|
-
}
|
|
43
|
-
`);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
afterAll(() => {
|
|
47
|
-
try {
|
|
48
|
-
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
49
|
-
} catch {
|
|
50
|
-
// ignore
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('checkFile', () => {
|
|
55
|
-
it('应该检查有效文件', () => {
|
|
56
|
-
const result = checkFile(validFile);
|
|
57
|
-
|
|
58
|
-
expect(result.annotations.length).toBeGreaterThan(0);
|
|
59
|
-
// 可能有关键字段缺失的警告,但不应该有错误
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('应该检查无效文件', () => {
|
|
63
|
-
const result = checkFile(invalidFile);
|
|
64
|
-
|
|
65
|
-
expect(result.annotations.length).toBeGreaterThan(0);
|
|
66
|
-
// Spec ID 格式不正确应该报错
|
|
67
|
-
expect(result.errors.length).toBeGreaterThan(0);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('应该解析 Spec ID', () => {
|
|
71
|
-
const result = checkFile(validFile);
|
|
72
|
-
|
|
73
|
-
const annotation = result.annotations[0];
|
|
74
|
-
expect(annotation.specId).toBe('AR-001');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('应该解析 implements 字段', () => {
|
|
78
|
-
const result = checkFile(validFile);
|
|
79
|
-
|
|
80
|
-
const annotation = result.annotations[0];
|
|
81
|
-
expect(annotation.implements).toBeDefined();
|
|
82
|
-
expect(annotation.implements?.length).toBeGreaterThan(0);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('应该解析 acceptance 字段', () => {
|
|
86
|
-
const result = checkFile(validFile);
|
|
87
|
-
|
|
88
|
-
const annotation = result.annotations[0];
|
|
89
|
-
expect(annotation.acceptance).toBeDefined();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('应该解析行号', () => {
|
|
93
|
-
const result = checkFile(validFile);
|
|
94
|
-
|
|
95
|
-
expect(result.annotations[0].line).toBeGreaterThan(0);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('文件不存在应该抛出异常', () => {
|
|
99
|
-
expect(() => checkFile('/nonexistent/file.ts')).toThrow();
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe('checkDirectory', () => {
|
|
104
|
-
it('应该检查目录中的所有文件', () => {
|
|
105
|
-
const results = checkDirectory(tempDir);
|
|
106
|
-
|
|
107
|
-
expect(results.length).toBeGreaterThan(0);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('应该返回每个文件的结果', () => {
|
|
111
|
-
const results = checkDirectory(tempDir);
|
|
112
|
-
|
|
113
|
-
expect(results.some(r => r.file.includes('valid.ts'))).toBe(true);
|
|
114
|
-
expect(results.some(r => r.file.includes('invalid.ts'))).toBe(true);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('空目录应该返回空数组', () => {
|
|
118
|
-
const emptyDir = path.join(tempDir, 'empty');
|
|
119
|
-
fs.mkdirSync(emptyDir, { recursive: true });
|
|
120
|
-
|
|
121
|
-
const results = checkDirectory(emptyDir);
|
|
122
|
-
|
|
123
|
-
expect(results.length).toBe(0);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
describe('Spec ID 格式验证', () => {
|
|
128
|
-
it('有效 Spec ID 应该通过', () => {
|
|
129
|
-
const validSpecFile = path.join(tempDir, 'spec-valid.ts');
|
|
130
|
-
fs.writeFileSync(validSpecFile, `
|
|
131
|
-
/**
|
|
132
|
-
* @spec WS-001
|
|
133
|
-
*/
|
|
134
|
-
export class Test {}
|
|
135
|
-
`);
|
|
136
|
-
|
|
137
|
-
const result = checkFile(validSpecFile);
|
|
138
|
-
expect(result.errors.some(e => e.code === 'INVALID_SPEC_FORMAT')).toBe(false);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('无效 Spec ID 应该报错', () => {
|
|
142
|
-
const invalidSpecFile = path.join(tempDir, 'spec-invalid.ts');
|
|
143
|
-
fs.writeFileSync(invalidSpecFile, `
|
|
144
|
-
/**
|
|
145
|
-
* @spec INVALID
|
|
146
|
-
*/
|
|
147
|
-
export class Test {}
|
|
148
|
-
`);
|
|
149
|
-
|
|
150
|
-
const result = checkFile(invalidSpecFile);
|
|
151
|
-
expect(result.errors.some(e => e.code === 'INVALID_SPEC_FORMAT')).toBe(true);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
describe('警告', () => {
|
|
156
|
-
it('缺少 implements 应该警告', () => {
|
|
157
|
-
const warnFile = path.join(tempDir, 'warn.ts');
|
|
158
|
-
fs.writeFileSync(warnFile, `
|
|
159
|
-
/**
|
|
160
|
-
* @spec AR-001
|
|
161
|
-
*/
|
|
162
|
-
export class WarnClass {}
|
|
163
|
-
`);
|
|
164
|
-
|
|
165
|
-
const result = checkFile(warnFile);
|
|
166
|
-
expect(result.warnings.some(w => w.code === 'MISSING_IMPLEMENTS')).toBe(true);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it('缺少 acceptance 应该警告', () => {
|
|
170
|
-
const warnFile = path.join(tempDir, 'warn2.ts');
|
|
171
|
-
fs.writeFileSync(warnFile, `
|
|
172
|
-
/**
|
|
173
|
-
* @spec AR-001
|
|
174
|
-
* @implements AR-001-C1
|
|
175
|
-
*/
|
|
176
|
-
export class WarnClass2 {}
|
|
177
|
-
`);
|
|
178
|
-
|
|
179
|
-
const result = checkFile(warnFile);
|
|
180
|
-
expect(result.warnings.some(w => w.code === 'MISSING_ACCEPTANCE')).toBe(true);
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
});
|