@neurcode-ai/cli 0.10.1 → 0.14.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.
Files changed (199) hide show
  1. package/.telemetry-bundle/dist/contracts.d.ts +1 -1
  2. package/README.md +74 -25
  3. package/dist/commands/governance.d.ts.map +1 -1
  4. package/dist/commands/governance.js +12 -0
  5. package/dist/commands/governance.js.map +1 -1
  6. package/dist/commands/home.d.ts +21 -0
  7. package/dist/commands/home.d.ts.map +1 -0
  8. package/dist/commands/home.js +253 -0
  9. package/dist/commands/home.js.map +1 -0
  10. package/dist/commands/login.js +1 -1
  11. package/dist/commands/login.js.map +1 -1
  12. package/dist/commands/quickstart.d.ts.map +1 -1
  13. package/dist/commands/quickstart.js +13 -11
  14. package/dist/commands/quickstart.js.map +1 -1
  15. package/dist/commands/remediate-export.d.ts.map +1 -1
  16. package/dist/commands/remediate-export.js +17 -2
  17. package/dist/commands/remediate-export.js.map +1 -1
  18. package/dist/commands/replay.d.ts.map +1 -1
  19. package/dist/commands/replay.js +36 -0
  20. package/dist/commands/replay.js.map +1 -1
  21. package/dist/commands/verify-output.d.ts.map +1 -1
  22. package/dist/commands/verify-output.js +88 -4
  23. package/dist/commands/verify-output.js.map +1 -1
  24. package/dist/commands/verify.d.ts +22 -1
  25. package/dist/commands/verify.d.ts.map +1 -1
  26. package/dist/commands/verify.js +467 -37
  27. package/dist/commands/verify.js.map +1 -1
  28. package/dist/daemon/server.d.ts.map +1 -1
  29. package/dist/daemon/server.js +4 -0
  30. package/dist/daemon/server.js.map +1 -1
  31. package/dist/governance/canonical-pipeline.d.ts.map +1 -1
  32. package/dist/governance/canonical-pipeline.js +29 -3
  33. package/dist/governance/canonical-pipeline.js.map +1 -1
  34. package/dist/governance/intent/drift-detector.d.ts +100 -0
  35. package/dist/governance/intent/drift-detector.d.ts.map +1 -0
  36. package/dist/governance/intent/drift-detector.js +275 -0
  37. package/dist/governance/intent/drift-detector.js.map +1 -0
  38. package/dist/governance/intent/glob-match.d.ts +43 -0
  39. package/dist/governance/intent/glob-match.d.ts.map +1 -0
  40. package/dist/governance/intent/glob-match.js +108 -0
  41. package/dist/governance/intent/glob-match.js.map +1 -0
  42. package/dist/governance/intent/import-graph.d.ts +56 -0
  43. package/dist/governance/intent/import-graph.d.ts.map +1 -0
  44. package/dist/governance/intent/import-graph.js +133 -0
  45. package/dist/governance/intent/import-graph.js.map +1 -0
  46. package/dist/governance/intent/index.d.ts +23 -0
  47. package/dist/governance/intent/index.d.ts.map +1 -0
  48. package/dist/governance/intent/index.js +48 -0
  49. package/dist/governance/intent/index.js.map +1 -0
  50. package/dist/governance/intent/intelligence-boundaries.d.ts +69 -0
  51. package/dist/governance/intent/intelligence-boundaries.d.ts.map +1 -0
  52. package/dist/governance/intent/intelligence-boundaries.js +163 -0
  53. package/dist/governance/intent/intelligence-boundaries.js.map +1 -0
  54. package/dist/governance/intent/intent-contract.d.ts +76 -0
  55. package/dist/governance/intent/intent-contract.d.ts.map +1 -0
  56. package/dist/governance/intent/intent-contract.js +397 -0
  57. package/dist/governance/intent/intent-contract.js.map +1 -0
  58. package/dist/governance/intent/intent-graph.d.ts +135 -0
  59. package/dist/governance/intent/intent-graph.d.ts.map +1 -0
  60. package/dist/governance/intent/intent-graph.js +67 -0
  61. package/dist/governance/intent/intent-graph.js.map +1 -0
  62. package/dist/governance/pipeline/computation-trace.d.ts +52 -0
  63. package/dist/governance/pipeline/computation-trace.d.ts.map +1 -0
  64. package/dist/governance/pipeline/computation-trace.js +79 -0
  65. package/dist/governance/pipeline/computation-trace.js.map +1 -0
  66. package/dist/governance/pipeline/envelope-assembly.d.ts +132 -0
  67. package/dist/governance/pipeline/envelope-assembly.d.ts.map +1 -0
  68. package/dist/governance/pipeline/envelope-assembly.js +140 -0
  69. package/dist/governance/pipeline/envelope-assembly.js.map +1 -0
  70. package/dist/governance/pipeline/fingerprint.d.ts +34 -0
  71. package/dist/governance/pipeline/fingerprint.d.ts.map +1 -0
  72. package/dist/governance/pipeline/fingerprint.js +78 -0
  73. package/dist/governance/pipeline/fingerprint.js.map +1 -0
  74. package/dist/governance/pipeline/helpers.d.ts +74 -0
  75. package/dist/governance/pipeline/helpers.d.ts.map +1 -0
  76. package/dist/governance/pipeline/helpers.js +112 -0
  77. package/dist/governance/pipeline/helpers.js.map +1 -0
  78. package/dist/governance/pipeline/index.d.ts +27 -0
  79. package/dist/governance/pipeline/index.d.ts.map +1 -0
  80. package/dist/governance/pipeline/index.js +63 -0
  81. package/dist/governance/pipeline/index.js.map +1 -0
  82. package/dist/governance/pipeline/lineage.d.ts +26 -0
  83. package/dist/governance/pipeline/lineage.d.ts.map +1 -0
  84. package/dist/governance/pipeline/lineage.js +51 -0
  85. package/dist/governance/pipeline/lineage.js.map +1 -0
  86. package/dist/governance/pipeline/orchestration/advisory-mode-contract.d.ts +15 -0
  87. package/dist/governance/pipeline/orchestration/advisory-mode-contract.d.ts.map +1 -0
  88. package/dist/governance/pipeline/orchestration/advisory-mode-contract.js +44 -0
  89. package/dist/governance/pipeline/orchestration/advisory-mode-contract.js.map +1 -0
  90. package/dist/governance/pipeline/orchestration/advisory-mode.d.ts +102 -0
  91. package/dist/governance/pipeline/orchestration/advisory-mode.d.ts.map +1 -0
  92. package/dist/governance/pipeline/orchestration/advisory-mode.js +170 -0
  93. package/dist/governance/pipeline/orchestration/advisory-mode.js.map +1 -0
  94. package/dist/governance/pipeline/orchestration/evidence-lifecycle.d.ts +133 -0
  95. package/dist/governance/pipeline/orchestration/evidence-lifecycle.d.ts.map +1 -0
  96. package/dist/governance/pipeline/orchestration/evidence-lifecycle.js +125 -0
  97. package/dist/governance/pipeline/orchestration/evidence-lifecycle.js.map +1 -0
  98. package/dist/governance/pipeline/orchestration/index.d.ts +16 -0
  99. package/dist/governance/pipeline/orchestration/index.d.ts.map +1 -0
  100. package/dist/governance/pipeline/orchestration/index.js +30 -0
  101. package/dist/governance/pipeline/orchestration/index.js.map +1 -0
  102. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.d.ts +65 -0
  103. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.d.ts.map +1 -0
  104. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.js +102 -0
  105. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.js.map +1 -0
  106. package/dist/governance/pipeline/orchestration/plan-structural-analysis.d.ts +41 -0
  107. package/dist/governance/pipeline/orchestration/plan-structural-analysis.d.ts.map +1 -0
  108. package/dist/governance/pipeline/orchestration/plan-structural-analysis.js +74 -0
  109. package/dist/governance/pipeline/orchestration/plan-structural-analysis.js.map +1 -0
  110. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.d.ts +165 -0
  111. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.d.ts.map +1 -0
  112. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.js +160 -0
  113. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.js.map +1 -0
  114. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.d.ts +152 -0
  115. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.d.ts.map +1 -0
  116. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.js +188 -0
  117. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.js.map +1 -0
  118. package/dist/governance/pipeline/runtime.d.ts +70 -0
  119. package/dist/governance/pipeline/runtime.d.ts.map +1 -0
  120. package/dist/governance/pipeline/runtime.js +223 -0
  121. package/dist/governance/pipeline/runtime.js.map +1 -0
  122. package/dist/governance/pipeline/shared-types.d.ts +7 -0
  123. package/dist/governance/pipeline/shared-types.d.ts.map +1 -0
  124. package/dist/governance/pipeline/shared-types.js +7 -0
  125. package/dist/governance/pipeline/shared-types.js.map +1 -0
  126. package/dist/governance/pipeline/stages/compiled-policy-stage.d.ts +28 -0
  127. package/dist/governance/pipeline/stages/compiled-policy-stage.d.ts.map +1 -0
  128. package/dist/governance/pipeline/stages/compiled-policy-stage.js +53 -0
  129. package/dist/governance/pipeline/stages/compiled-policy-stage.js.map +1 -0
  130. package/dist/governance/pipeline/stages/diff-normalization-stage.d.ts +63 -0
  131. package/dist/governance/pipeline/stages/diff-normalization-stage.d.ts.map +1 -0
  132. package/dist/governance/pipeline/stages/diff-normalization-stage.js +140 -0
  133. package/dist/governance/pipeline/stages/diff-normalization-stage.js.map +1 -0
  134. package/dist/governance/pipeline/stages/governance-synthesis-stage.d.ts +53 -0
  135. package/dist/governance/pipeline/stages/governance-synthesis-stage.d.ts.map +1 -0
  136. package/dist/governance/pipeline/stages/governance-synthesis-stage.js +129 -0
  137. package/dist/governance/pipeline/stages/governance-synthesis-stage.js.map +1 -0
  138. package/dist/governance/pipeline/stages/index.d.ts +29 -0
  139. package/dist/governance/pipeline/stages/index.d.ts.map +1 -0
  140. package/dist/governance/pipeline/stages/index.js +40 -0
  141. package/dist/governance/pipeline/stages/index.js.map +1 -0
  142. package/dist/governance/pipeline/stages/policy-lock-stage.d.ts +31 -0
  143. package/dist/governance/pipeline/stages/policy-lock-stage.d.ts.map +1 -0
  144. package/dist/governance/pipeline/stages/policy-lock-stage.js +71 -0
  145. package/dist/governance/pipeline/stages/policy-lock-stage.js.map +1 -0
  146. package/dist/governance/pipeline/stages/runtime-guard-stage.d.ts +29 -0
  147. package/dist/governance/pipeline/stages/runtime-guard-stage.d.ts.map +1 -0
  148. package/dist/governance/pipeline/stages/runtime-guard-stage.js +65 -0
  149. package/dist/governance/pipeline/stages/runtime-guard-stage.js.map +1 -0
  150. package/dist/governance/pipeline/stages/structural-analysis-stage.d.ts +24 -0
  151. package/dist/governance/pipeline/stages/structural-analysis-stage.d.ts.map +1 -0
  152. package/dist/governance/pipeline/stages/structural-analysis-stage.js +58 -0
  153. package/dist/governance/pipeline/stages/structural-analysis-stage.js.map +1 -0
  154. package/dist/governance/pipeline/summary.d.ts +14 -0
  155. package/dist/governance/pipeline/summary.d.ts.map +1 -0
  156. package/dist/governance/pipeline/summary.js +50 -0
  157. package/dist/governance/pipeline/summary.js.map +1 -0
  158. package/dist/governance/pipeline/types.d.ts +69 -0
  159. package/dist/governance/pipeline/types.d.ts.map +1 -0
  160. package/dist/governance/pipeline/types.js +30 -0
  161. package/dist/governance/pipeline/types.js.map +1 -0
  162. package/dist/index.js +44 -3
  163. package/dist/index.js.map +1 -1
  164. package/dist/utils/active-engineering-context.d.ts +16 -0
  165. package/dist/utils/active-engineering-context.d.ts.map +1 -1
  166. package/dist/utils/active-engineering-context.js +302 -0
  167. package/dist/utils/active-engineering-context.js.map +1 -1
  168. package/dist/utils/import-edge-classifier.d.ts +76 -0
  169. package/dist/utils/import-edge-classifier.d.ts.map +1 -0
  170. package/dist/utils/import-edge-classifier.js +308 -0
  171. package/dist/utils/import-edge-classifier.js.map +1 -0
  172. package/dist/utils/import-edge-extractor.d.ts +52 -0
  173. package/dist/utils/import-edge-extractor.d.ts.map +1 -0
  174. package/dist/utils/import-edge-extractor.js +223 -0
  175. package/dist/utils/import-edge-extractor.js.map +1 -0
  176. package/dist/utils/import-edge-governance.d.ts +37 -0
  177. package/dist/utils/import-edge-governance.d.ts.map +1 -0
  178. package/dist/utils/import-edge-governance.js +56 -0
  179. package/dist/utils/import-edge-governance.js.map +1 -0
  180. package/dist/utils/messages.d.ts.map +1 -1
  181. package/dist/utils/messages.js +19 -10
  182. package/dist/utils/messages.js.map +1 -1
  183. package/dist/utils/path-boundary-classifier.d.ts +42 -0
  184. package/dist/utils/path-boundary-classifier.d.ts.map +1 -0
  185. package/dist/utils/path-boundary-classifier.js +143 -0
  186. package/dist/utils/path-boundary-classifier.js.map +1 -0
  187. package/dist/utils/replay-html-report.d.ts +29 -0
  188. package/dist/utils/replay-html-report.d.ts.map +1 -0
  189. package/dist/utils/replay-html-report.js +309 -0
  190. package/dist/utils/replay-html-report.js.map +1 -0
  191. package/dist/utils/runtime-state.d.ts +44 -0
  192. package/dist/utils/runtime-state.d.ts.map +1 -0
  193. package/dist/utils/runtime-state.js +151 -0
  194. package/dist/utils/runtime-state.js.map +1 -0
  195. package/package.json +3 -3
  196. package/dist/utils/box.d.ts +0 -16
  197. package/dist/utils/box.d.ts.map +0 -1
  198. package/dist/utils/box.js +0 -85
  199. package/dist/utils/box.js.map +0 -1
@@ -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
@@ -54,6 +54,7 @@ const feedback_1 = require("./commands/feedback");
54
54
  const guard_1 = require("./commands/guard");
55
55
  const bootstrap_1 = require("./commands/bootstrap");
56
56
  const quickstart_1 = require("./commands/quickstart");
57
+ const home_1 = require("./commands/home");
57
58
  const bootstrap_policy_1 = require("./commands/bootstrap-policy");
58
59
  const messages_1 = require("./utils/messages");
59
60
  const config_2 = require("./config");
@@ -217,11 +218,21 @@ function configurePrimaryHelpView(root) {
217
218
  });
218
219
  }
219
220
  function printCoreWorkflowGuide() {
220
- console.log(chalk.bold.cyan('\n🛡️ Neurcode Governance Workflow\n'));
221
- console.log(chalk.bold.white('Canonical Workflow:'));
221
+ // Operational lifecycle guide. Same aesthetic as the welcome banner and
222
+ // neurcode home — subtle sophistication, no emoji ornaments, info dense.
223
+ // The lifecycle bar mirrors what the welcome banner shows so identity is
224
+ // coherent across surfaces. (See docs/ux/final-operational-experience-report.md.)
225
+ console.log('');
226
+ console.log(`${chalk.bold('neurcode')}${chalk.dim(' · operational lifecycle')}`);
227
+ console.log('');
228
+ console.log(chalk.dim(' start ▸ verify ▸ replay ▸ remediate-export ▸ re-verify'));
229
+ console.log('');
230
+ console.log(` ${chalk.bold('Canonical commands')}`);
222
231
  CORE_WORKFLOW_STEPS.forEach((step) => console.log(chalk.dim(formatCoreWorkflowStep(step))));
223
232
  console.log('');
224
- console.log(chalk.dim('Run `neurcode --help` to see enterprise, runtime-engineering, and compatibility commands.\n'));
233
+ console.log(chalk.dim(' See ') + chalk.cyan('neurcode home') + chalk.dim(' for current runtime state. ') +
234
+ chalk.dim('Run ') + chalk.cyan('neurcode --help') + chalk.dim(' for the full command surface.'));
235
+ console.log('');
225
236
  }
226
237
  function formatCommandList(commandNames) {
227
238
  return commandNames.length > 0
@@ -377,6 +388,32 @@ program
377
388
  (0, control_plane_1.controlPlaneCommand)(program);
378
389
  (0, workspace_1.workspaceCommand)(program);
379
390
  (0, replay_1.replayCommand)(program);
391
+ (0, home_1.homeCommand)(program);
392
+ // Top-level discoverability alias for `neurcode replay timeline`. Reviewers
393
+ // asking "what changed and when?" should not need to know the subcommand
394
+ // hierarchy. Same canonical artifact source, same deterministic output.
395
+ program
396
+ .command('timeline')
397
+ .description('Operational governance timeline (alias for `replay timeline`)')
398
+ .option('--workspace <workspaceId>', 'Workspace scope')
399
+ .option('--from <timestamp>', 'ISO start timestamp')
400
+ .option('--to <timestamp>', 'ISO end timestamp')
401
+ .option('--limit <count>', 'Maximum timeline items to return', (value) => Number.parseInt(value, 10))
402
+ .option('--json', 'Output JSON')
403
+ .action(async (options) => {
404
+ const args = ['replay', 'timeline'];
405
+ if (options.workspace)
406
+ args.push('--workspace', String(options.workspace));
407
+ if (options.from)
408
+ args.push('--from', String(options.from));
409
+ if (options.to)
410
+ args.push('--to', String(options.to));
411
+ if (Number.isFinite(options.limit))
412
+ args.push('--limit', String(options.limit));
413
+ if (options.json)
414
+ args.push('--json');
415
+ await program.parseAsync(['node', 'neurcode', ...args]);
416
+ });
380
417
  (0, audit_1.auditCommand)(program);
381
418
  (0, contract_1.contractCommand)(program);
382
419
  (0, feedback_1.feedbackCommand)(program);
@@ -1153,6 +1190,7 @@ program
1153
1190
  .option('--api-key <key>', 'Neurcode API Key (overrides config and env var)')
1154
1191
  .option('--api-url <url>', 'Override API URL (default: https://api.neurcode.com)')
1155
1192
  .option('--local-only', 'Offline structural fallback: skip API, run deterministic structural rules only (sets NEURCODE_VERIFY_LOCAL_ONLY=1)')
1193
+ .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
1194
  .action(async (options) => {
1157
1195
  if (options.localOnly === true) {
1158
1196
  process.env.NEURCODE_VERIFY_LOCAL_ONLY = '1';
@@ -1217,6 +1255,8 @@ program
1217
1255
  verifyArgs.push('--api-key', options.apiKey);
1218
1256
  if (options.apiUrl)
1219
1257
  verifyArgs.push('--api-url', options.apiUrl);
1258
+ if (options.requireIntentRuntime === true)
1259
+ verifyArgs.push('--require-intent-runtime');
1220
1260
  const run = await (0, execution_bus_1.runExecution)({
1221
1261
  type: 'verify',
1222
1262
  source: 'cli',
@@ -1262,6 +1302,7 @@ program
1262
1302
  verifyJobTimeoutMs: Number.isFinite(options.verifyJobTimeoutMs) ? options.verifyJobTimeoutMs : undefined,
1263
1303
  verifyIdempotencyKey: options.verifyIdempotencyKey,
1264
1304
  verifyJobMaxAttempts: Number.isFinite(options.verifyJobMaxAttempts) ? options.verifyJobMaxAttempts : undefined,
1305
+ requireIntentRuntime: options.requireIntentRuntime === true,
1265
1306
  });
1266
1307
  });
1267
1308
  program