@neurcode-ai/cli 0.10.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.telemetry-bundle/dist/contracts.d.ts +1 -1
- package/README.md +74 -25
- package/dist/commands/remediate-export.js +1 -1
- package/dist/commands/replay.d.ts.map +1 -1
- package/dist/commands/replay.js +36 -0
- package/dist/commands/replay.js.map +1 -1
- package/dist/commands/verify-output.d.ts.map +1 -1
- package/dist/commands/verify-output.js +66 -4
- package/dist/commands/verify-output.js.map +1 -1
- package/dist/commands/verify.d.ts +22 -1
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +446 -34
- package/dist/commands/verify.js.map +1 -1
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js +4 -0
- package/dist/daemon/server.js.map +1 -1
- package/dist/governance/intent/drift-detector.d.ts +100 -0
- package/dist/governance/intent/drift-detector.d.ts.map +1 -0
- package/dist/governance/intent/drift-detector.js +275 -0
- package/dist/governance/intent/drift-detector.js.map +1 -0
- package/dist/governance/intent/glob-match.d.ts +43 -0
- package/dist/governance/intent/glob-match.d.ts.map +1 -0
- package/dist/governance/intent/glob-match.js +108 -0
- package/dist/governance/intent/glob-match.js.map +1 -0
- package/dist/governance/intent/import-graph.d.ts +56 -0
- package/dist/governance/intent/import-graph.d.ts.map +1 -0
- package/dist/governance/intent/import-graph.js +133 -0
- package/dist/governance/intent/import-graph.js.map +1 -0
- package/dist/governance/intent/index.d.ts +23 -0
- package/dist/governance/intent/index.d.ts.map +1 -0
- package/dist/governance/intent/index.js +48 -0
- package/dist/governance/intent/index.js.map +1 -0
- package/dist/governance/intent/intelligence-boundaries.d.ts +69 -0
- package/dist/governance/intent/intelligence-boundaries.d.ts.map +1 -0
- package/dist/governance/intent/intelligence-boundaries.js +163 -0
- package/dist/governance/intent/intelligence-boundaries.js.map +1 -0
- package/dist/governance/intent/intent-contract.d.ts +76 -0
- package/dist/governance/intent/intent-contract.d.ts.map +1 -0
- package/dist/governance/intent/intent-contract.js +397 -0
- package/dist/governance/intent/intent-contract.js.map +1 -0
- package/dist/governance/intent/intent-graph.d.ts +135 -0
- package/dist/governance/intent/intent-graph.d.ts.map +1 -0
- package/dist/governance/intent/intent-graph.js +67 -0
- package/dist/governance/intent/intent-graph.js.map +1 -0
- package/dist/governance/pipeline/computation-trace.d.ts +52 -0
- package/dist/governance/pipeline/computation-trace.d.ts.map +1 -0
- package/dist/governance/pipeline/computation-trace.js +79 -0
- package/dist/governance/pipeline/computation-trace.js.map +1 -0
- package/dist/governance/pipeline/envelope-assembly.d.ts +132 -0
- package/dist/governance/pipeline/envelope-assembly.d.ts.map +1 -0
- package/dist/governance/pipeline/envelope-assembly.js +140 -0
- package/dist/governance/pipeline/envelope-assembly.js.map +1 -0
- package/dist/governance/pipeline/fingerprint.d.ts +34 -0
- package/dist/governance/pipeline/fingerprint.d.ts.map +1 -0
- package/dist/governance/pipeline/fingerprint.js +78 -0
- package/dist/governance/pipeline/fingerprint.js.map +1 -0
- package/dist/governance/pipeline/helpers.d.ts +74 -0
- package/dist/governance/pipeline/helpers.d.ts.map +1 -0
- package/dist/governance/pipeline/helpers.js +112 -0
- package/dist/governance/pipeline/helpers.js.map +1 -0
- package/dist/governance/pipeline/index.d.ts +27 -0
- package/dist/governance/pipeline/index.d.ts.map +1 -0
- package/dist/governance/pipeline/index.js +63 -0
- package/dist/governance/pipeline/index.js.map +1 -0
- package/dist/governance/pipeline/lineage.d.ts +26 -0
- package/dist/governance/pipeline/lineage.d.ts.map +1 -0
- package/dist/governance/pipeline/lineage.js +51 -0
- package/dist/governance/pipeline/lineage.js.map +1 -0
- package/dist/governance/pipeline/orchestration/advisory-mode-contract.d.ts +15 -0
- package/dist/governance/pipeline/orchestration/advisory-mode-contract.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/advisory-mode-contract.js +44 -0
- package/dist/governance/pipeline/orchestration/advisory-mode-contract.js.map +1 -0
- package/dist/governance/pipeline/orchestration/advisory-mode.d.ts +102 -0
- package/dist/governance/pipeline/orchestration/advisory-mode.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/advisory-mode.js +170 -0
- package/dist/governance/pipeline/orchestration/advisory-mode.js.map +1 -0
- package/dist/governance/pipeline/orchestration/evidence-lifecycle.d.ts +133 -0
- package/dist/governance/pipeline/orchestration/evidence-lifecycle.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/evidence-lifecycle.js +125 -0
- package/dist/governance/pipeline/orchestration/evidence-lifecycle.js.map +1 -0
- package/dist/governance/pipeline/orchestration/index.d.ts +16 -0
- package/dist/governance/pipeline/orchestration/index.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/index.js +30 -0
- package/dist/governance/pipeline/orchestration/index.js.map +1 -0
- package/dist/governance/pipeline/orchestration/intent-drift-orchestration.d.ts +65 -0
- package/dist/governance/pipeline/orchestration/intent-drift-orchestration.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/intent-drift-orchestration.js +102 -0
- package/dist/governance/pipeline/orchestration/intent-drift-orchestration.js.map +1 -0
- package/dist/governance/pipeline/orchestration/plan-structural-analysis.d.ts +41 -0
- package/dist/governance/pipeline/orchestration/plan-structural-analysis.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/plan-structural-analysis.js +74 -0
- package/dist/governance/pipeline/orchestration/plan-structural-analysis.js.map +1 -0
- package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.d.ts +165 -0
- package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.js +160 -0
- package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.js.map +1 -0
- package/dist/governance/pipeline/orchestration/scope-guard-orchestration.d.ts +152 -0
- package/dist/governance/pipeline/orchestration/scope-guard-orchestration.d.ts.map +1 -0
- package/dist/governance/pipeline/orchestration/scope-guard-orchestration.js +188 -0
- package/dist/governance/pipeline/orchestration/scope-guard-orchestration.js.map +1 -0
- package/dist/governance/pipeline/runtime.d.ts +70 -0
- package/dist/governance/pipeline/runtime.d.ts.map +1 -0
- package/dist/governance/pipeline/runtime.js +223 -0
- package/dist/governance/pipeline/runtime.js.map +1 -0
- package/dist/governance/pipeline/shared-types.d.ts +7 -0
- package/dist/governance/pipeline/shared-types.d.ts.map +1 -0
- package/dist/governance/pipeline/shared-types.js +7 -0
- package/dist/governance/pipeline/shared-types.js.map +1 -0
- package/dist/governance/pipeline/stages/compiled-policy-stage.d.ts +28 -0
- package/dist/governance/pipeline/stages/compiled-policy-stage.d.ts.map +1 -0
- package/dist/governance/pipeline/stages/compiled-policy-stage.js +53 -0
- package/dist/governance/pipeline/stages/compiled-policy-stage.js.map +1 -0
- package/dist/governance/pipeline/stages/diff-normalization-stage.d.ts +63 -0
- package/dist/governance/pipeline/stages/diff-normalization-stage.d.ts.map +1 -0
- package/dist/governance/pipeline/stages/diff-normalization-stage.js +140 -0
- package/dist/governance/pipeline/stages/diff-normalization-stage.js.map +1 -0
- package/dist/governance/pipeline/stages/governance-synthesis-stage.d.ts +53 -0
- package/dist/governance/pipeline/stages/governance-synthesis-stage.d.ts.map +1 -0
- package/dist/governance/pipeline/stages/governance-synthesis-stage.js +129 -0
- package/dist/governance/pipeline/stages/governance-synthesis-stage.js.map +1 -0
- package/dist/governance/pipeline/stages/index.d.ts +29 -0
- package/dist/governance/pipeline/stages/index.d.ts.map +1 -0
- package/dist/governance/pipeline/stages/index.js +40 -0
- package/dist/governance/pipeline/stages/index.js.map +1 -0
- package/dist/governance/pipeline/stages/policy-lock-stage.d.ts +31 -0
- package/dist/governance/pipeline/stages/policy-lock-stage.d.ts.map +1 -0
- package/dist/governance/pipeline/stages/policy-lock-stage.js +71 -0
- package/dist/governance/pipeline/stages/policy-lock-stage.js.map +1 -0
- package/dist/governance/pipeline/stages/runtime-guard-stage.d.ts +29 -0
- package/dist/governance/pipeline/stages/runtime-guard-stage.d.ts.map +1 -0
- package/dist/governance/pipeline/stages/runtime-guard-stage.js +65 -0
- package/dist/governance/pipeline/stages/runtime-guard-stage.js.map +1 -0
- package/dist/governance/pipeline/stages/structural-analysis-stage.d.ts +24 -0
- package/dist/governance/pipeline/stages/structural-analysis-stage.d.ts.map +1 -0
- package/dist/governance/pipeline/stages/structural-analysis-stage.js +58 -0
- package/dist/governance/pipeline/stages/structural-analysis-stage.js.map +1 -0
- package/dist/governance/pipeline/summary.d.ts +14 -0
- package/dist/governance/pipeline/summary.d.ts.map +1 -0
- package/dist/governance/pipeline/summary.js +50 -0
- package/dist/governance/pipeline/summary.js.map +1 -0
- package/dist/governance/pipeline/types.d.ts +69 -0
- package/dist/governance/pipeline/types.d.ts.map +1 -0
- package/dist/governance/pipeline/types.js +30 -0
- package/dist/governance/pipeline/types.js.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/active-engineering-context.d.ts +16 -0
- package/dist/utils/active-engineering-context.d.ts.map +1 -1
- package/dist/utils/active-engineering-context.js +302 -0
- package/dist/utils/active-engineering-context.js.map +1 -1
- package/dist/utils/import-edge-classifier.d.ts +76 -0
- package/dist/utils/import-edge-classifier.d.ts.map +1 -0
- package/dist/utils/import-edge-classifier.js +308 -0
- package/dist/utils/import-edge-classifier.js.map +1 -0
- package/dist/utils/import-edge-extractor.d.ts +52 -0
- package/dist/utils/import-edge-extractor.d.ts.map +1 -0
- package/dist/utils/import-edge-extractor.js +223 -0
- package/dist/utils/import-edge-extractor.js.map +1 -0
- package/dist/utils/import-edge-governance.d.ts +37 -0
- package/dist/utils/import-edge-governance.d.ts.map +1 -0
- package/dist/utils/import-edge-governance.js +56 -0
- package/dist/utils/import-edge-governance.js.map +1 -0
- package/dist/utils/path-boundary-classifier.d.ts +42 -0
- package/dist/utils/path-boundary-classifier.d.ts.map +1 -0
- package/dist/utils/path-boundary-classifier.js +143 -0
- package/dist/utils/path-boundary-classifier.js.map +1 -0
- package/dist/utils/replay-html-report.d.ts +29 -0
- package/dist/utils/replay-html-report.d.ts.map +1 -0
- package/dist/utils/replay-html-report.js +309 -0
- package/dist/utils/replay-html-report.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-lock-stage.d.ts","sourceRoot":"","sources":["../../../../src/governance/pipeline/stages/policy-lock-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAGxD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,mBAAmB,CAAC;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,uBAAuB,CAAC,eAAe,EAAE,gBAAgB,CAsDtF,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Policy Lock Stage
|
|
4
|
+
* -----------------
|
|
5
|
+
* Verifies the policy lock fingerprint against the currently-resolved policy
|
|
6
|
+
* snapshot. This is a thin wrapper around `evaluatePolicyLock` from
|
|
7
|
+
* `utils/policy-packs` — it preserves all existing semantics and only adds
|
|
8
|
+
* stage lineage, fingerprinting, and replay receipts.
|
|
9
|
+
*
|
|
10
|
+
* SEMANTIC PRESERVATION:
|
|
11
|
+
* The output `enforced`, `matched`, `lockPresent`, `lockPath`, and
|
|
12
|
+
* `mismatches[]` fields are produced by `evaluatePolicyLock` directly —
|
|
13
|
+
* they MUST be identical to the values verify.ts records inline.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.policyLockStage = void 0;
|
|
17
|
+
const policy_packs_1 = require("../../../utils/policy-packs");
|
|
18
|
+
const fingerprint_1 = require("../fingerprint");
|
|
19
|
+
const types_1 = require("../types");
|
|
20
|
+
exports.policyLockStage = {
|
|
21
|
+
id: 'policy-lock',
|
|
22
|
+
determinism: 'deterministic-structural',
|
|
23
|
+
boundary: {
|
|
24
|
+
...types_1.STRICT_REQUIRED_BOUNDARY,
|
|
25
|
+
dependencies: ['diff-normalization'],
|
|
26
|
+
},
|
|
27
|
+
description: 'Compare resolved policy snapshot against the policy lock file; report fingerprint mismatches.',
|
|
28
|
+
execute(input) {
|
|
29
|
+
if (input.skipLock) {
|
|
30
|
+
return {
|
|
31
|
+
enforced: false,
|
|
32
|
+
matched: true,
|
|
33
|
+
lockPresent: false,
|
|
34
|
+
lockPath: '',
|
|
35
|
+
mismatches: [],
|
|
36
|
+
skipped: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const validation = (0, policy_packs_1.evaluatePolicyLock)(input.projectRoot, input.currentSnapshot, {
|
|
40
|
+
requireLock: input.requireLock,
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
enforced: validation.enforced,
|
|
44
|
+
matched: validation.matched,
|
|
45
|
+
lockPresent: validation.lockPresent,
|
|
46
|
+
lockPath: validation.lockPath,
|
|
47
|
+
mismatches: [...validation.mismatches],
|
|
48
|
+
skipped: false,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
fingerprintInput(input) {
|
|
52
|
+
return (0, fingerprint_1.fingerprintStageSignal)({
|
|
53
|
+
requireLock: input.requireLock,
|
|
54
|
+
skipLock: input.skipLock,
|
|
55
|
+
snapshotFingerprint: input.currentSnapshot.effective?.fingerprint ?? null,
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
fingerprintOutput(output) {
|
|
59
|
+
return (0, fingerprint_1.fingerprintStageSignal)({
|
|
60
|
+
enforced: output.enforced,
|
|
61
|
+
matched: output.matched,
|
|
62
|
+
lockPresent: output.lockPresent,
|
|
63
|
+
skipped: output.skipped,
|
|
64
|
+
mismatchCodes: output.mismatches.map(m => m.code).sort(),
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
outputItemCount(output) {
|
|
68
|
+
return output.mismatches.length;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=policy-lock-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-lock-stage.js","sourceRoot":"","sources":["../../../../src/governance/pipeline/stages/policy-lock-stage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAGH,8DAIqC;AACrC,gDAAwD;AAExD,oCAAoD;AAkBvC,QAAA,eAAe,GAA+D;IACzF,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,0BAAuD;IACpE,QAAQ,EAAE;QACR,GAAG,gCAAwB;QAC3B,YAAY,EAAE,CAAC,oBAAoB,CAAC;KACrC;IACD,WAAW,EAAE,+FAA+F;IAE5G,OAAO,CAAC,KAAsB;QAC5B,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,KAAK;gBAClB,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,MAAM,UAAU,GAAG,IAAA,iCAAkB,EAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,eAAe,EAAE;YAC9E,WAAW,EAAE,KAAK,CAAC,WAAW;SAC/B,CAAC,CAAC;QACH,OAAO;YACL,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC;YACtC,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,gBAAgB,CAAC,KAAsB;QACrC,OAAO,IAAA,oCAAsB,EAAC;YAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,mBAAmB,EAAE,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,WAAW,IAAI,IAAI;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CAAC,MAAwB;QACxC,OAAO,IAAA,oCAAsB,EAAC;YAC5B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,aAAa,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;SACzD,CAAC,CAAC;IACL,CAAC;IAED,eAAe,CAAC,MAAwB;QACtC,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;IAClC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Guard Stage
|
|
3
|
+
* -------------------
|
|
4
|
+
* Validates the runtime guard artifact against the actual diff. Pure wrapper
|
|
5
|
+
* around `readRuntimeGuardArtifact` + `evaluateRuntimeGuardArtifact` from
|
|
6
|
+
* `utils/runtime-guard`.
|
|
7
|
+
*
|
|
8
|
+
* SEMANTIC PRESERVATION:
|
|
9
|
+
* The `RuntimeGuardEvaluation` returned here is byte-identical to what
|
|
10
|
+
* verify.ts produces inline. This stage adds lineage + fingerprinting only.
|
|
11
|
+
*/
|
|
12
|
+
import type { DiffFile } from '@neurcode-ai/diff-parser';
|
|
13
|
+
import { type RuntimeGuardArtifact, type RuntimeGuardEvaluation } from '../../../utils/runtime-guard';
|
|
14
|
+
import type { GovernancePipelineStage } from '../types';
|
|
15
|
+
export interface RuntimeGuardInput {
|
|
16
|
+
projectRoot: string;
|
|
17
|
+
guardPath?: string;
|
|
18
|
+
diffFiles: DiffFile[];
|
|
19
|
+
fileContents?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export interface RuntimeGuardOutput {
|
|
22
|
+
path: string;
|
|
23
|
+
exists: boolean;
|
|
24
|
+
artifact: RuntimeGuardArtifact | null;
|
|
25
|
+
error?: string;
|
|
26
|
+
evaluation: RuntimeGuardEvaluation | null;
|
|
27
|
+
}
|
|
28
|
+
export declare const runtimeGuardStage: GovernancePipelineStage<RuntimeGuardInput, RuntimeGuardOutput>;
|
|
29
|
+
//# sourceMappingURL=runtime-guard-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-guard-stage.d.ts","sourceRoot":"","sources":["../../../../src/governance/pipeline/stages/runtime-guard-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,iBAAiB,EAAE,uBAAuB,CACrD,iBAAiB,EACjB,kBAAkB,CAwDnB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Runtime Guard Stage
|
|
4
|
+
* -------------------
|
|
5
|
+
* Validates the runtime guard artifact against the actual diff. Pure wrapper
|
|
6
|
+
* around `readRuntimeGuardArtifact` + `evaluateRuntimeGuardArtifact` from
|
|
7
|
+
* `utils/runtime-guard`.
|
|
8
|
+
*
|
|
9
|
+
* SEMANTIC PRESERVATION:
|
|
10
|
+
* The `RuntimeGuardEvaluation` returned here is byte-identical to what
|
|
11
|
+
* verify.ts produces inline. This stage adds lineage + fingerprinting only.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.runtimeGuardStage = void 0;
|
|
15
|
+
const runtime_guard_1 = require("../../../utils/runtime-guard");
|
|
16
|
+
const fingerprint_1 = require("../fingerprint");
|
|
17
|
+
exports.runtimeGuardStage = {
|
|
18
|
+
id: 'runtime-guard',
|
|
19
|
+
determinism: 'deterministic-structural',
|
|
20
|
+
boundary: {
|
|
21
|
+
isolateFailure: true,
|
|
22
|
+
required: false,
|
|
23
|
+
dependencies: ['diff-normalization'],
|
|
24
|
+
},
|
|
25
|
+
description: 'Validate runtime guard artifact against diff; report out-of-scope files and constraint violations.',
|
|
26
|
+
execute(input) {
|
|
27
|
+
const read = (0, runtime_guard_1.readRuntimeGuardArtifact)(input.projectRoot, input.guardPath);
|
|
28
|
+
if (!read.artifact) {
|
|
29
|
+
return {
|
|
30
|
+
path: read.path,
|
|
31
|
+
exists: read.exists,
|
|
32
|
+
artifact: null,
|
|
33
|
+
error: read.error,
|
|
34
|
+
evaluation: null,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const evaluation = (0, runtime_guard_1.evaluateRuntimeGuardArtifact)(read.artifact, input.diffFiles, input.fileContents);
|
|
38
|
+
return {
|
|
39
|
+
path: read.path,
|
|
40
|
+
exists: read.exists,
|
|
41
|
+
artifact: read.artifact,
|
|
42
|
+
evaluation,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
fingerprintInput(input) {
|
|
46
|
+
return (0, fingerprint_1.fingerprintStageSignal)({
|
|
47
|
+
guardPath: input.guardPath ?? null,
|
|
48
|
+
files: input.diffFiles.map(f => f.path).sort(),
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
fingerprintOutput(output) {
|
|
52
|
+
return (0, fingerprint_1.fingerprintStageSignal)({
|
|
53
|
+
exists: output.exists,
|
|
54
|
+
expectedFilesFingerprint: output.artifact?.expectedFilesFingerprint ?? null,
|
|
55
|
+
compiledPolicyFingerprint: output.artifact?.source?.compiledPolicyFingerprint ?? null,
|
|
56
|
+
passed: output.evaluation?.pass ?? null,
|
|
57
|
+
violationCount: output.evaluation?.violations.length ?? 0,
|
|
58
|
+
outOfScopeFileCount: output.evaluation?.outOfScopeFiles.length ?? 0,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
outputItemCount(output) {
|
|
62
|
+
return output.evaluation?.violations.length ?? 0;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=runtime-guard-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-guard-stage.js","sourceRoot":"","sources":["../../../../src/governance/pipeline/stages/runtime-guard-stage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAIH,gEAKsC;AACtC,gDAAwD;AAkB3C,QAAA,iBAAiB,GAG1B;IACF,EAAE,EAAE,eAAe;IACnB,WAAW,EAAE,0BAAuD;IACpE,QAAQ,EAAE;QACR,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,CAAC,oBAAoB,CAAC;KACrC;IACD,WAAW,EAAE,oGAAoG;IAEjH,OAAO,CAAC,KAAwB;QAC9B,MAAM,IAAI,GAAG,IAAA,wCAAwB,EAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,UAAU,EAAE,IAAI;aACjB,CAAC;QACJ,CAAC;QACD,MAAM,UAAU,GAAG,IAAA,4CAA4B,EAC7C,IAAI,CAAC,QAAQ,EACb,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,YAAY,CACnB,CAAC;QACF,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU;SACX,CAAC;IACJ,CAAC;IAED,gBAAgB,CAAC,KAAwB;QACvC,OAAO,IAAA,oCAAsB,EAAC;YAC5B,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI;YAClC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CAAC,MAA0B;QAC1C,OAAO,IAAA,oCAAsB,EAAC;YAC5B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,wBAAwB,EAAE,MAAM,CAAC,QAAQ,EAAE,wBAAwB,IAAI,IAAI;YAC3E,yBAAyB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,yBAAyB,IAAI,IAAI;YACrF,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,IAAI,IAAI;YACvC,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;YACzD,mBAAmB,EAAE,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC;SACpE,CAAC,CAAC;IACL,CAAC;IAED,eAAe,CAAC,MAA0B;QACxC,OAAO,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACnD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural Analysis Stage
|
|
3
|
+
* -------------------------
|
|
4
|
+
* Runs the deterministic structural rule engine (SR/DS/PY rules) on the
|
|
5
|
+
* diff files produced by `diff-normalization`. Pure wrapper around
|
|
6
|
+
* `runStructuralOnDiffFiles` from `governance/structural-on-diff`.
|
|
7
|
+
*
|
|
8
|
+
* SEMANTIC PRESERVATION:
|
|
9
|
+
* The output `violations[]`, `rulesApplied[]`, `suppressedCount`,
|
|
10
|
+
* `newViolationCount`, `legacyDebtCount`, and `diffScopedEnforcement`
|
|
11
|
+
* fields are produced by `runStructuralOnDiffFiles` directly — verify.ts
|
|
12
|
+
* inline behavior is unchanged.
|
|
13
|
+
*/
|
|
14
|
+
import type { DiffFile } from '@neurcode-ai/diff-parser';
|
|
15
|
+
import { type StructuralOnDiffResult } from '../../structural-on-diff';
|
|
16
|
+
import type { GovernancePipelineStage } from '../types';
|
|
17
|
+
export interface StructuralAnalysisInput {
|
|
18
|
+
projectRoot: string;
|
|
19
|
+
diffFiles: DiffFile[];
|
|
20
|
+
strictFullFile?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type StructuralAnalysisOutput = StructuralOnDiffResult;
|
|
23
|
+
export declare const structuralAnalysisStage: GovernancePipelineStage<StructuralAnalysisInput, StructuralAnalysisOutput>;
|
|
24
|
+
//# sourceMappingURL=structural-analysis-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-analysis-stage.d.ts","sourceRoot":"","sources":["../../../../src/governance/pipeline/stages/structural-analysis-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAGxD,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE9D,eAAO,MAAM,uBAAuB,EAAE,uBAAuB,CAC3D,uBAAuB,EACvB,wBAAwB,CA2CzB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Structural Analysis Stage
|
|
4
|
+
* -------------------------
|
|
5
|
+
* Runs the deterministic structural rule engine (SR/DS/PY rules) on the
|
|
6
|
+
* diff files produced by `diff-normalization`. Pure wrapper around
|
|
7
|
+
* `runStructuralOnDiffFiles` from `governance/structural-on-diff`.
|
|
8
|
+
*
|
|
9
|
+
* SEMANTIC PRESERVATION:
|
|
10
|
+
* The output `violations[]`, `rulesApplied[]`, `suppressedCount`,
|
|
11
|
+
* `newViolationCount`, `legacyDebtCount`, and `diffScopedEnforcement`
|
|
12
|
+
* fields are produced by `runStructuralOnDiffFiles` directly — verify.ts
|
|
13
|
+
* inline behavior is unchanged.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.structuralAnalysisStage = void 0;
|
|
17
|
+
const structural_on_diff_1 = require("../../structural-on-diff");
|
|
18
|
+
const fingerprint_1 = require("../fingerprint");
|
|
19
|
+
const types_1 = require("../types");
|
|
20
|
+
exports.structuralAnalysisStage = {
|
|
21
|
+
id: 'structural-analysis',
|
|
22
|
+
determinism: 'deterministic-structural',
|
|
23
|
+
boundary: {
|
|
24
|
+
...types_1.STRICT_REQUIRED_BOUNDARY,
|
|
25
|
+
dependencies: ['diff-normalization'],
|
|
26
|
+
},
|
|
27
|
+
description: 'Run deterministic structural rule engine (SR/DS/PY) on diff files; classify diff-scoped vs legacy debt.',
|
|
28
|
+
execute(input) {
|
|
29
|
+
return (0, structural_on_diff_1.runStructuralOnDiffFiles)(input.projectRoot, input.diffFiles, {
|
|
30
|
+
strictFullFile: input.strictFullFile,
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
fingerprintInput(input) {
|
|
34
|
+
return (0, fingerprint_1.fingerprintStageSignal)({
|
|
35
|
+
files: input.diffFiles.map(f => f.path).sort(),
|
|
36
|
+
strictFullFile: input.strictFullFile ?? false,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
fingerprintOutput(output) {
|
|
40
|
+
return (0, fingerprint_1.fingerprintStageSignal)({
|
|
41
|
+
rulesApplied: [...output.rulesApplied].sort(),
|
|
42
|
+
violationKeys: output.violations
|
|
43
|
+
.map(v => `${v.ruleId}\x1e${v.filePath}\x1e${v.line}\x1e${v.column ?? 0}`)
|
|
44
|
+
.sort(),
|
|
45
|
+
newViolationCount: output.newViolationCount,
|
|
46
|
+
legacyDebtCount: output.legacyDebtCount,
|
|
47
|
+
suppressedCount: output.suppressedCount,
|
|
48
|
+
diffScopedEnforcement: output.diffScopedEnforcement,
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
inputItemCount(input) {
|
|
52
|
+
return input.diffFiles.length;
|
|
53
|
+
},
|
|
54
|
+
outputItemCount(output) {
|
|
55
|
+
return output.violations.length;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=structural-analysis-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-analysis-stage.js","sourceRoot":"","sources":["../../../../src/governance/pipeline/stages/structural-analysis-stage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAIH,iEAGkC;AAClC,gDAAwD;AAExD,oCAAoD;AAUvC,QAAA,uBAAuB,GAGhC;IACF,EAAE,EAAE,qBAAqB;IACzB,WAAW,EAAE,0BAAuD;IACpE,QAAQ,EAAE;QACR,GAAG,gCAAwB;QAC3B,YAAY,EAAE,CAAC,oBAAoB,CAAC;KACrC;IACD,WAAW,EAAE,yGAAyG;IAEtH,OAAO,CAAC,KAA8B;QACpC,OAAO,IAAA,6CAAwB,EAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,EAAE;YAClE,cAAc,EAAE,KAAK,CAAC,cAAc;SACrC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CAAC,KAA8B;QAC7C,OAAO,IAAA,oCAAsB,EAAC;YAC5B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;YAC9C,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,KAAK;SAC9C,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CAAC,MAAgC;QAChD,OAAO,IAAA,oCAAsB,EAAC;YAC5B,YAAY,EAAE,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE;YAC7C,aAAa,EAAE,MAAM,CAAC,UAAU;iBAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,QAAQ,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;iBACzE,IAAI,EAAE;YACT,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;YAC3C,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;SACpD,CAAC,CAAC;IACL,CAAC;IAED,cAAc,CAAC,KAA8B;QAC3C,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,eAAe,CAAC,MAAgC;QAC9C,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;IAClC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline summary builder.
|
|
3
|
+
*
|
|
4
|
+
* Derives a `GovernancePipelineSummary` from a ledger of stage results. The
|
|
5
|
+
* summary is the audience-facing surface for explainability dashboards,
|
|
6
|
+
* stage-level SLOs, and replay reconstruction.
|
|
7
|
+
*
|
|
8
|
+
* The `pipelineFingerprint` is a SHA-256 over the ordered sequence of
|
|
9
|
+
* (stageId, status, outputFingerprint?) tuples. It is independent of and
|
|
10
|
+
* non-overlapping with `GovernanceVerificationEnvelope.replayChecksum`.
|
|
11
|
+
*/
|
|
12
|
+
import type { GovernancePipelineSummary, GovernanceStageResult } from '@neurcode-ai/contracts';
|
|
13
|
+
export declare function buildPipelineSummary(ledger: readonly GovernanceStageResult[]): GovernancePipelineSummary;
|
|
14
|
+
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../../src/governance/pipeline/summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EACV,yBAAyB,EAEzB,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AAGhC,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,qBAAqB,EAAE,GACvC,yBAAyB,CAoC3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pipeline summary builder.
|
|
4
|
+
*
|
|
5
|
+
* Derives a `GovernancePipelineSummary` from a ledger of stage results. The
|
|
6
|
+
* summary is the audience-facing surface for explainability dashboards,
|
|
7
|
+
* stage-level SLOs, and replay reconstruction.
|
|
8
|
+
*
|
|
9
|
+
* The `pipelineFingerprint` is a SHA-256 over the ordered sequence of
|
|
10
|
+
* (stageId, status, outputFingerprint?) tuples. It is independent of and
|
|
11
|
+
* non-overlapping with `GovernanceVerificationEnvelope.replayChecksum`.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.buildPipelineSummary = buildPipelineSummary;
|
|
15
|
+
const crypto_1 = require("crypto");
|
|
16
|
+
const contracts_1 = require("@neurcode-ai/contracts");
|
|
17
|
+
function buildPipelineSummary(ledger) {
|
|
18
|
+
const stages = ledger.map(entry => ({
|
|
19
|
+
stageId: entry.stageId,
|
|
20
|
+
status: entry.status,
|
|
21
|
+
determinism: entry.replay.determinism,
|
|
22
|
+
durationMs: entry.metrics.durationMs,
|
|
23
|
+
inputFingerprint: entry.replay.inputFingerprint,
|
|
24
|
+
outputFingerprint: entry.replay.outputFingerprint,
|
|
25
|
+
dependsOn: [...entry.replay.dependsOn],
|
|
26
|
+
failureCategory: entry.failure?.category,
|
|
27
|
+
}));
|
|
28
|
+
const fingerprintInput = stages
|
|
29
|
+
.map(s => `${s.stageId}\x1e${s.status}\x1e${s.outputFingerprint ?? ''}`)
|
|
30
|
+
.join('\x00');
|
|
31
|
+
const pipelineFingerprint = (0, crypto_1.createHash)('sha256')
|
|
32
|
+
.update(fingerprintInput, 'utf-8')
|
|
33
|
+
.digest('hex');
|
|
34
|
+
const totalDurationMs = stages.reduce((acc, s) => acc + (s.durationMs || 0), 0);
|
|
35
|
+
const degradedStages = stages
|
|
36
|
+
.filter(s => s.status === 'degraded')
|
|
37
|
+
.map(s => s.stageId);
|
|
38
|
+
const failedStages = stages
|
|
39
|
+
.filter(s => s.status === 'failed')
|
|
40
|
+
.map(s => s.stageId);
|
|
41
|
+
return {
|
|
42
|
+
schemaVersion: contracts_1.GOVERNANCE_PIPELINE_SCHEMA_VERSION,
|
|
43
|
+
pipelineFingerprint,
|
|
44
|
+
stages,
|
|
45
|
+
totalDurationMs,
|
|
46
|
+
degradedStages,
|
|
47
|
+
failedStages,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../../src/governance/pipeline/summary.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAWH,oDAsCC;AA/CD,mCAAoC;AAOpC,sDAA4E;AAE5E,SAAgB,oBAAoB,CAClC,MAAwC;IAExC,MAAM,MAAM,GAA6B,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5D,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;QACrC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU;QACpC,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB;QAC/C,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB;QACjD,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;QACtC,eAAe,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ;KACzC,CAAC,CAAC,CAAC;IAEJ,MAAM,gBAAgB,GAAG,MAAM;SAC5B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,iBAAiB,IAAI,EAAE,EAAE,CAAC;SACvE,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,MAAM,mBAAmB,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC;SAC7C,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC;SACjC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChF,MAAM,cAAc,GAAwB,MAAM;SAC/C,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACvB,MAAM,YAAY,GAAwB,MAAM;SAC7C,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAEvB,OAAO;QACL,aAAa,EAAE,8CAAkC;QACjD,mBAAmB;QACnB,MAAM;QACN,eAAe;QACf,cAAc;QACd,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-side governance pipeline types.
|
|
3
|
+
*
|
|
4
|
+
* Builds on `@neurcode-ai/contracts` stage contracts with executor-side detail
|
|
5
|
+
* (context, stage definition, ledger). The wire-level types remain in contracts.
|
|
6
|
+
*/
|
|
7
|
+
import type { DeterminismClassification, GovernanceStageBoundary, GovernanceStageId, GovernanceStageResult } from '@neurcode-ai/contracts';
|
|
8
|
+
/**
|
|
9
|
+
* Per-run pipeline context. Carries cross-stage execution state, environment,
|
|
10
|
+
* and the in-progress ledger of stage results.
|
|
11
|
+
*
|
|
12
|
+
* The context is INTENTIONALLY narrow. Stages must not stash unstructured data
|
|
13
|
+
* here; new shared state belongs in a stage's typed output or in a dedicated
|
|
14
|
+
* follow-up contract.
|
|
15
|
+
*/
|
|
16
|
+
export interface GovernancePipelineContext {
|
|
17
|
+
/** Absolute project root, resolved once at the top of verify. */
|
|
18
|
+
readonly projectRoot: string;
|
|
19
|
+
/** True when running in CI / policy-only deterministic mode. */
|
|
20
|
+
readonly ciMode: boolean;
|
|
21
|
+
/** True when JSON mode is requested (suppresses human-readable side effects). */
|
|
22
|
+
readonly jsonMode: boolean;
|
|
23
|
+
/** Wall-clock start time of the verify run (ms since epoch). */
|
|
24
|
+
readonly startedAtMs: number;
|
|
25
|
+
/** Mutable ledger of completed stage results. Append-only by convention. */
|
|
26
|
+
readonly ledger: GovernanceStageResult[];
|
|
27
|
+
/** Optional run ID for cross-stage correlation. */
|
|
28
|
+
runId?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Stage definition contract.
|
|
32
|
+
*
|
|
33
|
+
* `execute` MUST be deterministic given its input — observable side effects
|
|
34
|
+
* (filesystem reads, git invocations, etc.) are allowed but their outputs must
|
|
35
|
+
* be reflected in `fingerprintOutput` so replays can detect drift.
|
|
36
|
+
*/
|
|
37
|
+
export interface GovernancePipelineStage<TIn, TOut> {
|
|
38
|
+
readonly id: GovernanceStageId;
|
|
39
|
+
readonly determinism: DeterminismClassification;
|
|
40
|
+
readonly boundary: GovernanceStageBoundary;
|
|
41
|
+
/** Human-readable description for explainability dashboards. */
|
|
42
|
+
readonly description?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Run the stage. Throwing aborts the pipeline UNLESS boundary.isolateFailure
|
|
45
|
+
* is true, in which case the runner catches and emits a failed result.
|
|
46
|
+
*/
|
|
47
|
+
execute(input: TIn, ctx: GovernancePipelineContext): Promise<TOut> | TOut;
|
|
48
|
+
/** Compute a deterministic fingerprint of the input for replay lineage. */
|
|
49
|
+
fingerprintInput?(input: TIn): string | undefined;
|
|
50
|
+
/** Compute a deterministic fingerprint of the output for replay lineage. */
|
|
51
|
+
fingerprintOutput?(output: TOut): string | undefined;
|
|
52
|
+
/** Report an input item count for observability. Optional. */
|
|
53
|
+
inputItemCount?(input: TIn): number | undefined;
|
|
54
|
+
/** Report an output item count for observability. Optional. */
|
|
55
|
+
outputItemCount?(output: TOut): number | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Default boundary policy: required, strict, no dependencies.
|
|
59
|
+
*
|
|
60
|
+
* Most stages should NOT use this directly — they should declare their actual
|
|
61
|
+
* upstream dependencies so replay can reconstruct the computation graph.
|
|
62
|
+
*/
|
|
63
|
+
export declare const STRICT_REQUIRED_BOUNDARY: GovernanceStageBoundary;
|
|
64
|
+
/**
|
|
65
|
+
* Boundary policy for optional observability / non-load-bearing stages.
|
|
66
|
+
* Failures here are caught and surfaced but never abort governance.
|
|
67
|
+
*/
|
|
68
|
+
export declare const OBSERVABILITY_BOUNDARY: GovernanceStageBoundary;
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/governance/pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,iEAAiE;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,qBAAqB,EAAE,CAAC;IACzC,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB,CAAC,GAAG,EAAE,IAAI;IAChD,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,yBAAyB,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,gEAAgE;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1E,2EAA2E;IAC3E,gBAAgB,CAAC,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;IAClD,4EAA4E;IAC5E,iBAAiB,CAAC,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,8DAA8D;IAC9D,cAAc,CAAC,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;IAChD,+DAA+D;IAC/D,eAAe,CAAC,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;CACpD;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,uBAItC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,uBAIpC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CLI-side governance pipeline types.
|
|
4
|
+
*
|
|
5
|
+
* Builds on `@neurcode-ai/contracts` stage contracts with executor-side detail
|
|
6
|
+
* (context, stage definition, ledger). The wire-level types remain in contracts.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OBSERVABILITY_BOUNDARY = exports.STRICT_REQUIRED_BOUNDARY = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Default boundary policy: required, strict, no dependencies.
|
|
12
|
+
*
|
|
13
|
+
* Most stages should NOT use this directly — they should declare their actual
|
|
14
|
+
* upstream dependencies so replay can reconstruct the computation graph.
|
|
15
|
+
*/
|
|
16
|
+
exports.STRICT_REQUIRED_BOUNDARY = {
|
|
17
|
+
isolateFailure: false,
|
|
18
|
+
required: true,
|
|
19
|
+
dependencies: [],
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Boundary policy for optional observability / non-load-bearing stages.
|
|
23
|
+
* Failures here are caught and surfaced but never abort governance.
|
|
24
|
+
*/
|
|
25
|
+
exports.OBSERVABILITY_BOUNDARY = {
|
|
26
|
+
isolateFailure: true,
|
|
27
|
+
required: false,
|
|
28
|
+
dependencies: [],
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/governance/pipeline/types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA4DH;;;;;GAKG;AACU,QAAA,wBAAwB,GAA4B;IAC/D,cAAc,EAAE,KAAK;IACrB,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,EAAE;CACjB,CAAC;AAEF;;;GAGG;AACU,QAAA,sBAAsB,GAA4B;IAC7D,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,EAAE;CACjB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -377,6 +377,31 @@ program
|
|
|
377
377
|
(0, control_plane_1.controlPlaneCommand)(program);
|
|
378
378
|
(0, workspace_1.workspaceCommand)(program);
|
|
379
379
|
(0, replay_1.replayCommand)(program);
|
|
380
|
+
// Top-level discoverability alias for `neurcode replay timeline`. Reviewers
|
|
381
|
+
// asking "what changed and when?" should not need to know the subcommand
|
|
382
|
+
// hierarchy. Same canonical artifact source, same deterministic output.
|
|
383
|
+
program
|
|
384
|
+
.command('timeline')
|
|
385
|
+
.description('Operational governance timeline (alias for `replay timeline`)')
|
|
386
|
+
.option('--workspace <workspaceId>', 'Workspace scope')
|
|
387
|
+
.option('--from <timestamp>', 'ISO start timestamp')
|
|
388
|
+
.option('--to <timestamp>', 'ISO end timestamp')
|
|
389
|
+
.option('--limit <count>', 'Maximum timeline items to return', (value) => Number.parseInt(value, 10))
|
|
390
|
+
.option('--json', 'Output JSON')
|
|
391
|
+
.action(async (options) => {
|
|
392
|
+
const args = ['replay', 'timeline'];
|
|
393
|
+
if (options.workspace)
|
|
394
|
+
args.push('--workspace', String(options.workspace));
|
|
395
|
+
if (options.from)
|
|
396
|
+
args.push('--from', String(options.from));
|
|
397
|
+
if (options.to)
|
|
398
|
+
args.push('--to', String(options.to));
|
|
399
|
+
if (Number.isFinite(options.limit))
|
|
400
|
+
args.push('--limit', String(options.limit));
|
|
401
|
+
if (options.json)
|
|
402
|
+
args.push('--json');
|
|
403
|
+
await program.parseAsync(['node', 'neurcode', ...args]);
|
|
404
|
+
});
|
|
380
405
|
(0, audit_1.auditCommand)(program);
|
|
381
406
|
(0, contract_1.contractCommand)(program);
|
|
382
407
|
(0, feedback_1.feedbackCommand)(program);
|
|
@@ -1153,6 +1178,7 @@ program
|
|
|
1153
1178
|
.option('--api-key <key>', 'Neurcode API Key (overrides config and env var)')
|
|
1154
1179
|
.option('--api-url <url>', 'Override API URL (default: https://api.neurcode.com)')
|
|
1155
1180
|
.option('--local-only', 'Offline structural fallback: skip API, run deterministic structural rules only (sets NEURCODE_VERIFY_LOCAL_ONLY=1)')
|
|
1181
|
+
.option('--require-intent-runtime', 'Fail if the intent-governed runtime is not active for this run (no silent downgrade to structural-only). Honours NEURCODE_REQUIRE_INTENT_RUNTIME=1.')
|
|
1156
1182
|
.action(async (options) => {
|
|
1157
1183
|
if (options.localOnly === true) {
|
|
1158
1184
|
process.env.NEURCODE_VERIFY_LOCAL_ONLY = '1';
|
|
@@ -1217,6 +1243,8 @@ program
|
|
|
1217
1243
|
verifyArgs.push('--api-key', options.apiKey);
|
|
1218
1244
|
if (options.apiUrl)
|
|
1219
1245
|
verifyArgs.push('--api-url', options.apiUrl);
|
|
1246
|
+
if (options.requireIntentRuntime === true)
|
|
1247
|
+
verifyArgs.push('--require-intent-runtime');
|
|
1220
1248
|
const run = await (0, execution_bus_1.runExecution)({
|
|
1221
1249
|
type: 'verify',
|
|
1222
1250
|
source: 'cli',
|
|
@@ -1262,6 +1290,7 @@ program
|
|
|
1262
1290
|
verifyJobTimeoutMs: Number.isFinite(options.verifyJobTimeoutMs) ? options.verifyJobTimeoutMs : undefined,
|
|
1263
1291
|
verifyIdempotencyKey: options.verifyIdempotencyKey,
|
|
1264
1292
|
verifyJobMaxAttempts: Number.isFinite(options.verifyJobMaxAttempts) ? options.verifyJobMaxAttempts : undefined,
|
|
1293
|
+
requireIntentRuntime: options.requireIntentRuntime === true,
|
|
1265
1294
|
});
|
|
1266
1295
|
});
|
|
1267
1296
|
program
|