@neurcode-ai/cli 0.9.65 → 0.10.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 (260) hide show
  1. package/dist/commands/bootstrap-policy.d.ts +29 -0
  2. package/dist/commands/bootstrap-policy.d.ts.map +1 -0
  3. package/dist/commands/bootstrap-policy.js +334 -0
  4. package/dist/commands/bootstrap-policy.js.map +1 -0
  5. package/dist/commands/doctor.d.ts.map +1 -1
  6. package/dist/commands/doctor.js +82 -0
  7. package/dist/commands/doctor.js.map +1 -1
  8. package/dist/commands/governance.d.ts +3 -0
  9. package/dist/commands/governance.d.ts.map +1 -0
  10. package/dist/commands/governance.js +390 -0
  11. package/dist/commands/governance.js.map +1 -0
  12. package/dist/commands/quickstart.d.ts +21 -0
  13. package/dist/commands/quickstart.d.ts.map +1 -0
  14. package/dist/commands/quickstart.js +178 -0
  15. package/dist/commands/quickstart.js.map +1 -0
  16. package/dist/commands/remediate-export.d.ts +36 -0
  17. package/dist/commands/remediate-export.d.ts.map +1 -0
  18. package/dist/commands/remediate-export.js +1072 -0
  19. package/dist/commands/remediate-export.js.map +1 -0
  20. package/dist/commands/replay.d.ts.map +1 -1
  21. package/dist/commands/replay.js +14 -0
  22. package/dist/commands/replay.js.map +1 -1
  23. package/dist/commands/session.d.ts +7 -0
  24. package/dist/commands/session.d.ts.map +1 -1
  25. package/dist/commands/session.js +156 -0
  26. package/dist/commands/session.js.map +1 -1
  27. package/dist/commands/start-intent.d.ts.map +1 -1
  28. package/dist/commands/start-intent.js +61 -11
  29. package/dist/commands/start-intent.js.map +1 -1
  30. package/dist/commands/verify-guidance.d.ts +5 -0
  31. package/dist/commands/verify-guidance.d.ts.map +1 -0
  32. package/dist/commands/verify-guidance.js +49 -0
  33. package/dist/commands/verify-guidance.js.map +1 -0
  34. package/dist/commands/verify-output.d.ts +37 -0
  35. package/dist/commands/verify-output.d.ts.map +1 -0
  36. package/dist/commands/verify-output.js +572 -0
  37. package/dist/commands/verify-output.js.map +1 -0
  38. package/dist/commands/verify-render.d.ts +41 -0
  39. package/dist/commands/verify-render.d.ts.map +1 -0
  40. package/dist/commands/verify-render.js +457 -0
  41. package/dist/commands/verify-render.js.map +1 -0
  42. package/dist/commands/verify.d.ts.map +1 -1
  43. package/dist/commands/verify.js +384 -1091
  44. package/dist/commands/verify.js.map +1 -1
  45. package/dist/commands/workspace.d.ts.map +1 -1
  46. package/dist/commands/workspace.js +3 -14
  47. package/dist/commands/workspace.js.map +1 -1
  48. package/dist/context-engine/graph.d.ts.map +1 -1
  49. package/dist/context-engine/graph.js +69 -7
  50. package/dist/context-engine/graph.js.map +1 -1
  51. package/dist/context-engine/scanner.d.ts.map +1 -1
  52. package/dist/context-engine/scanner.js +9 -2
  53. package/dist/context-engine/scanner.js.map +1 -1
  54. package/dist/daemon/compatibility/execution.d.ts +42 -0
  55. package/dist/daemon/compatibility/execution.d.ts.map +1 -0
  56. package/dist/daemon/compatibility/execution.js +183 -0
  57. package/dist/daemon/compatibility/execution.js.map +1 -0
  58. package/dist/daemon/compatibility/mutation.d.ts +24 -0
  59. package/dist/daemon/compatibility/mutation.d.ts.map +1 -0
  60. package/dist/daemon/compatibility/mutation.js +724 -0
  61. package/dist/daemon/compatibility/mutation.js.map +1 -0
  62. package/dist/daemon/routes.d.ts +19 -0
  63. package/dist/daemon/routes.d.ts.map +1 -0
  64. package/dist/daemon/routes.js +123 -0
  65. package/dist/daemon/routes.js.map +1 -0
  66. package/dist/daemon/runtime/execution-bus.d.ts +217 -0
  67. package/dist/daemon/runtime/execution-bus.d.ts.map +1 -0
  68. package/dist/daemon/runtime/execution-bus.js +1420 -0
  69. package/dist/daemon/runtime/execution-bus.js.map +1 -0
  70. package/dist/daemon/runtime/workspace-runtime.d.ts +280 -0
  71. package/dist/daemon/runtime/workspace-runtime.d.ts.map +1 -0
  72. package/dist/daemon/runtime/workspace-runtime.js +1473 -0
  73. package/dist/daemon/runtime/workspace-runtime.js.map +1 -0
  74. package/dist/daemon/server.d.ts.map +1 -1
  75. package/dist/daemon/server.js +171 -874
  76. package/dist/daemon/server.js.map +1 -1
  77. package/dist/daemon/shaping.d.ts +11 -0
  78. package/dist/daemon/shaping.d.ts.map +1 -0
  79. package/dist/daemon/shaping.js +240 -0
  80. package/dist/daemon/shaping.js.map +1 -0
  81. package/dist/governance/canonical-invariants.d.ts +88 -0
  82. package/dist/governance/canonical-invariants.d.ts.map +1 -0
  83. package/dist/governance/canonical-invariants.js +197 -0
  84. package/dist/governance/canonical-invariants.js.map +1 -0
  85. package/dist/governance/canonical-ordering.d.ts +76 -0
  86. package/dist/governance/canonical-ordering.d.ts.map +1 -0
  87. package/dist/governance/canonical-ordering.js +189 -0
  88. package/dist/governance/canonical-ordering.js.map +1 -0
  89. package/dist/governance/canonical-pipeline.d.ts +9 -1
  90. package/dist/governance/canonical-pipeline.d.ts.map +1 -1
  91. package/dist/governance/canonical-pipeline.js +367 -24
  92. package/dist/governance/canonical-pipeline.js.map +1 -1
  93. package/dist/governance/diff-line-provenance.d.ts +59 -0
  94. package/dist/governance/diff-line-provenance.d.ts.map +1 -0
  95. package/dist/governance/diff-line-provenance.js +118 -0
  96. package/dist/governance/diff-line-provenance.js.map +1 -0
  97. package/dist/governance/pilot-readiness.d.ts +34 -0
  98. package/dist/governance/pilot-readiness.d.ts.map +1 -0
  99. package/dist/governance/pilot-readiness.js +226 -0
  100. package/dist/governance/pilot-readiness.js.map +1 -0
  101. package/dist/governance/policy-parity-validator.d.ts +62 -0
  102. package/dist/governance/policy-parity-validator.d.ts.map +1 -0
  103. package/dist/governance/policy-parity-validator.js +137 -0
  104. package/dist/governance/policy-parity-validator.js.map +1 -0
  105. package/dist/governance/remediation-boundary.d.ts +55 -0
  106. package/dist/governance/remediation-boundary.d.ts.map +1 -0
  107. package/dist/governance/remediation-boundary.js +120 -0
  108. package/dist/governance/remediation-boundary.js.map +1 -0
  109. package/dist/governance/structural-cache.d.ts +103 -0
  110. package/dist/governance/structural-cache.d.ts.map +1 -0
  111. package/dist/governance/structural-cache.js +235 -0
  112. package/dist/governance/structural-cache.js.map +1 -0
  113. package/dist/governance/structural-on-diff.d.ts +22 -2
  114. package/dist/governance/structural-on-diff.d.ts.map +1 -1
  115. package/dist/governance/structural-on-diff.js +36 -4
  116. package/dist/governance/structural-on-diff.js.map +1 -1
  117. package/dist/governance/structural-policy-merge.d.ts +8 -0
  118. package/dist/governance/structural-policy-merge.d.ts.map +1 -1
  119. package/dist/governance/structural-policy-merge.js +7 -0
  120. package/dist/governance/structural-policy-merge.js.map +1 -1
  121. package/dist/governance/verify-runtime-guard.d.ts +99 -0
  122. package/dist/governance/verify-runtime-guard.d.ts.map +1 -0
  123. package/dist/governance/verify-runtime-guard.js +129 -0
  124. package/dist/governance/verify-runtime-guard.js.map +1 -0
  125. package/dist/index.js +277 -77
  126. package/dist/index.js.map +1 -1
  127. package/dist/intent-engine/repo-classifier.d.ts +64 -0
  128. package/dist/intent-engine/repo-classifier.d.ts.map +1 -0
  129. package/dist/intent-engine/repo-classifier.js +178 -0
  130. package/dist/intent-engine/repo-classifier.js.map +1 -0
  131. package/dist/structural-rules/index.d.ts +4 -0
  132. package/dist/structural-rules/index.d.ts.map +1 -1
  133. package/dist/structural-rules/index.js +18 -1
  134. package/dist/structural-rules/index.js.map +1 -1
  135. package/dist/structural-rules/python/PY003-broad-except-clause.d.ts +21 -0
  136. package/dist/structural-rules/python/PY003-broad-except-clause.d.ts.map +1 -1
  137. package/dist/structural-rules/python/PY003-broad-except-clause.js +212 -21
  138. package/dist/structural-rules/python/PY003-broad-except-clause.js.map +1 -1
  139. package/dist/structural-rules/python/PY011-thread-lifecycle.d.ts +11 -0
  140. package/dist/structural-rules/python/PY011-thread-lifecycle.d.ts.map +1 -0
  141. package/dist/structural-rules/python/PY011-thread-lifecycle.js +97 -0
  142. package/dist/structural-rules/python/PY011-thread-lifecycle.js.map +1 -0
  143. package/dist/structural-rules/python/PY012-asyncio-run-misuse.d.ts +11 -0
  144. package/dist/structural-rules/python/PY012-asyncio-run-misuse.d.ts.map +1 -0
  145. package/dist/structural-rules/python/PY012-asyncio-run-misuse.js +83 -0
  146. package/dist/structural-rules/python/PY012-asyncio-run-misuse.js.map +1 -0
  147. package/dist/structural-rules/python/PY013-mutable-default-arg.d.ts +11 -0
  148. package/dist/structural-rules/python/PY013-mutable-default-arg.d.ts.map +1 -0
  149. package/dist/structural-rules/python/PY013-mutable-default-arg.js +73 -0
  150. package/dist/structural-rules/python/PY013-mutable-default-arg.js.map +1 -0
  151. package/dist/structural-rules/python/PY014-fixed-sleep-retry.d.ts +11 -0
  152. package/dist/structural-rules/python/PY014-fixed-sleep-retry.d.ts.map +1 -0
  153. package/dist/structural-rules/python/PY014-fixed-sleep-retry.js +115 -0
  154. package/dist/structural-rules/python/PY014-fixed-sleep-retry.js.map +1 -0
  155. package/dist/structural-rules/types.d.ts +12 -0
  156. package/dist/structural-rules/types.d.ts.map +1 -1
  157. package/dist/utils/active-engineering-context.d.ts +12 -0
  158. package/dist/utils/active-engineering-context.d.ts.map +1 -0
  159. package/dist/utils/active-engineering-context.js +67 -0
  160. package/dist/utils/active-engineering-context.js.map +1 -0
  161. package/dist/utils/artifact-io.d.ts +33 -0
  162. package/dist/utils/artifact-io.d.ts.map +1 -0
  163. package/dist/utils/artifact-io.js +183 -0
  164. package/dist/utils/artifact-io.js.map +1 -0
  165. package/dist/utils/change-contract.d.ts +6 -2
  166. package/dist/utils/change-contract.d.ts.map +1 -1
  167. package/dist/utils/change-contract.js +175 -0
  168. package/dist/utils/change-contract.js.map +1 -1
  169. package/dist/utils/context-pack.d.ts +12 -0
  170. package/dist/utils/context-pack.d.ts.map +1 -0
  171. package/dist/utils/context-pack.js +147 -0
  172. package/dist/utils/context-pack.js.map +1 -0
  173. package/dist/utils/control-plane.d.ts +18 -0
  174. package/dist/utils/control-plane.d.ts.map +1 -1
  175. package/dist/utils/control-plane.js +31 -4
  176. package/dist/utils/control-plane.js.map +1 -1
  177. package/dist/utils/drift-intelligence.d.ts +47 -0
  178. package/dist/utils/drift-intelligence.d.ts.map +1 -0
  179. package/dist/utils/drift-intelligence.js +2099 -0
  180. package/dist/utils/drift-intelligence.js.map +1 -0
  181. package/dist/utils/execution-actions.d.ts +22 -0
  182. package/dist/utils/execution-actions.d.ts.map +1 -0
  183. package/dist/utils/execution-actions.js +103 -0
  184. package/dist/utils/execution-actions.js.map +1 -0
  185. package/dist/utils/execution-bus.d.ts +1 -214
  186. package/dist/utils/execution-bus.d.ts.map +1 -1
  187. package/dist/utils/execution-bus.js +15 -1359
  188. package/dist/utils/execution-bus.js.map +1 -1
  189. package/dist/utils/git.d.ts +1 -0
  190. package/dist/utils/git.d.ts.map +1 -1
  191. package/dist/utils/git.js +13 -3
  192. package/dist/utils/git.js.map +1 -1
  193. package/dist/utils/governance-decisions.d.ts +75 -0
  194. package/dist/utils/governance-decisions.d.ts.map +1 -0
  195. package/dist/utils/governance-decisions.js +412 -0
  196. package/dist/utils/governance-decisions.js.map +1 -0
  197. package/dist/utils/governance-provenance.d.ts +1 -1
  198. package/dist/utils/governance-provenance.d.ts.map +1 -1
  199. package/dist/utils/governance-provenance.js +5 -7
  200. package/dist/utils/governance-provenance.js.map +1 -1
  201. package/dist/utils/governance.d.ts +108 -0
  202. package/dist/utils/governance.d.ts.map +1 -1
  203. package/dist/utils/governance.js +209 -7
  204. package/dist/utils/governance.js.map +1 -1
  205. package/dist/utils/intelligence-runtime-common.d.ts +30 -0
  206. package/dist/utils/intelligence-runtime-common.d.ts.map +1 -0
  207. package/dist/utils/intelligence-runtime-common.js +156 -0
  208. package/dist/utils/intelligence-runtime-common.js.map +1 -0
  209. package/dist/utils/intent-contract-diagnostics.d.ts +9 -0
  210. package/dist/utils/intent-contract-diagnostics.d.ts.map +1 -0
  211. package/dist/utils/intent-contract-diagnostics.js +322 -0
  212. package/dist/utils/intent-contract-diagnostics.js.map +1 -0
  213. package/dist/utils/intent-pack.d.ts +15 -0
  214. package/dist/utils/intent-pack.d.ts.map +1 -0
  215. package/dist/utils/intent-pack.js +196 -0
  216. package/dist/utils/intent-pack.js.map +1 -0
  217. package/dist/utils/plan-sync.d.ts +1 -0
  218. package/dist/utils/plan-sync.d.ts.map +1 -1
  219. package/dist/utils/plan-sync.js +23 -0
  220. package/dist/utils/plan-sync.js.map +1 -1
  221. package/dist/utils/policy-decision.d.ts +5 -0
  222. package/dist/utils/policy-decision.d.ts.map +1 -0
  223. package/dist/utils/policy-decision.js +17 -0
  224. package/dist/utils/policy-decision.js.map +1 -0
  225. package/dist/utils/replay-custody.d.ts +43 -0
  226. package/dist/utils/replay-custody.d.ts.map +1 -0
  227. package/dist/utils/replay-custody.js +168 -0
  228. package/dist/utils/replay-custody.js.map +1 -0
  229. package/dist/utils/replay-runtime.d.ts +13 -0
  230. package/dist/utils/replay-runtime.d.ts.map +1 -1
  231. package/dist/utils/replay-runtime.js +96 -9
  232. package/dist/utils/replay-runtime.js.map +1 -1
  233. package/dist/utils/repository-intelligence.d.ts +9 -0
  234. package/dist/utils/repository-intelligence.d.ts.map +1 -0
  235. package/dist/utils/repository-intelligence.js +372 -0
  236. package/dist/utils/repository-intelligence.js.map +1 -0
  237. package/dist/utils/runtime-events.d.ts.map +1 -1
  238. package/dist/utils/runtime-events.js +25 -6
  239. package/dist/utils/runtime-events.js.map +1 -1
  240. package/dist/utils/semantic-contract-intelligence.d.ts +20 -0
  241. package/dist/utils/semantic-contract-intelligence.d.ts.map +1 -0
  242. package/dist/utils/semantic-contract-intelligence.js +825 -0
  243. package/dist/utils/semantic-contract-intelligence.js.map +1 -0
  244. package/dist/utils/session-continuity.d.ts +56 -0
  245. package/dist/utils/session-continuity.d.ts.map +1 -0
  246. package/dist/utils/session-continuity.js +318 -0
  247. package/dist/utils/session-continuity.js.map +1 -0
  248. package/dist/utils/verification-evidence.d.ts.map +1 -1
  249. package/dist/utils/verification-evidence.js +4 -1
  250. package/dist/utils/verification-evidence.js.map +1 -1
  251. package/dist/utils/verify-runtime-stability.d.ts +142 -0
  252. package/dist/utils/verify-runtime-stability.d.ts.map +1 -0
  253. package/dist/utils/verify-runtime-stability.js +230 -0
  254. package/dist/utils/verify-runtime-stability.js.map +1 -0
  255. package/dist/utils/workspace-runtime.d.ts +1 -266
  256. package/dist/utils/workspace-runtime.d.ts.map +1 -1
  257. package/dist/utils/workspace-runtime.js +15 -1412
  258. package/dist/utils/workspace-runtime.js.map +1 -1
  259. package/package.json +11 -10
  260. package/LICENSE +0 -201
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ const ship_1 = require("./commands/ship");
32
32
  const remediate_1 = require("./commands/remediate");
33
33
  const remediate_governance_1 = require("./commands/remediate-governance");
34
34
  const fix_1 = require("./commands/fix");
35
+ const remediate_export_1 = require("./commands/remediate-export");
35
36
  const generate_1 = require("./commands/generate");
36
37
  const config_1 = require("./commands/config");
37
38
  const map_1 = require("./commands/map");
@@ -52,6 +53,8 @@ const contract_1 = require("./commands/contract");
52
53
  const feedback_1 = require("./commands/feedback");
53
54
  const guard_1 = require("./commands/guard");
54
55
  const bootstrap_1 = require("./commands/bootstrap");
56
+ const quickstart_1 = require("./commands/quickstart");
57
+ const bootstrap_policy_1 = require("./commands/bootstrap-policy");
55
58
  const messages_1 = require("./utils/messages");
56
59
  const config_2 = require("./config");
57
60
  const start_intent_1 = require("./commands/start-intent");
@@ -61,7 +64,9 @@ const export_1 = require("./commands/export");
61
64
  const control_plane_1 = require("./commands/control-plane");
62
65
  const workspace_1 = require("./commands/workspace");
63
66
  const replay_1 = require("./commands/replay");
67
+ const governance_1 = require("./commands/governance");
64
68
  const execution_bus_1 = require("./utils/execution-bus");
69
+ const execution_actions_1 = require("./utils/execution-actions");
65
70
  // Read version from package.json
66
71
  let version = '0.1.2'; // fallback
67
72
  try {
@@ -76,38 +81,87 @@ const program = new commander_1.Command();
76
81
  const CORE_WORKFLOW_STEPS = [
77
82
  {
78
83
  command: 'neurcode start "<intent>"',
79
- description: 'Declare intent and initialize plan context',
84
+ description: 'Declare governance context and bounded implementation scope',
80
85
  },
81
86
  {
82
- command: 'neurcode verify',
83
- description: 'Check code against policies and plan',
87
+ command: 'neurcode verify --evidence',
88
+ description: 'Verify the current diff against intent, policy, and change contracts',
84
89
  },
85
90
  {
86
- command: 'neurcode fix',
87
- description: 'Get prioritized, file-level remediation guidance',
91
+ command: 'neurcode replay --json',
92
+ description: 'Inspect deterministic replay and provenance receipts from the last run',
88
93
  },
89
94
  {
90
- command: 'neurcode patch --file <path>',
91
- description: 'Apply a deterministic fix to a specific file',
95
+ command: 'neurcode remediate-export --finding-index 0',
96
+ description: 'Export bounded remediation context for an external remediation tool',
92
97
  },
93
98
  {
94
- command: 'neurcode verify',
95
- description: 'Confirm patches resolve all findings',
99
+ command: 'neurcode verify --ci',
100
+ description: 'Re-verify in CI with deterministic receipts and governance artifacts',
96
101
  },
97
102
  ];
98
- const PRIMARY_COMMAND_NAMES = new Set(['start', 'generate', 'export', 'verify', 'fix', 'patch', 'daemon']);
99
- const EXECUTION_ACTION_TYPES = [
103
+ const CANONICAL_OPERATOR_COMMAND_NAMES = new Set([
104
+ 'start',
105
+ 'quickstart',
100
106
  'verify',
101
- 'fix',
107
+ 'remediate-export',
108
+ 'replay',
109
+ ]);
110
+ const ENTERPRISE_OPERATIONS_COMMAND_NAMES = new Set([
111
+ 'policy',
112
+ 'governance',
113
+ 'workspace',
114
+ 'control-plane',
115
+ 'pilot-report',
116
+ 'daemon',
117
+ 'doctor',
118
+ 'compat',
119
+ 'login',
120
+ 'logout',
121
+ 'init',
122
+ 'whoami',
123
+ 'config',
124
+ 'repo',
125
+ 'approve',
126
+ 'bootstrap-policy',
127
+ ]);
128
+ const RUNTIME_ENGINEERING_COMMAND_NAMES = new Set([
129
+ 'audit',
130
+ 'contract',
131
+ 'feedback',
132
+ 'guard',
133
+ 'bootstrap',
134
+ 'map',
135
+ 'execute',
136
+ 'executions',
137
+ 'session',
138
+ 'brain',
139
+ ]);
140
+ const LEGACY_COMPATIBILITY_COMMAND_NAMES = new Set([
141
+ 'check',
142
+ 'refactor',
143
+ 'security',
144
+ 'ask',
145
+ 'plan',
146
+ 'plan-slo',
147
+ 'ship',
148
+ 'ship-resume',
149
+ 'ship-runs',
150
+ 'ship-attestation-verify',
151
+ 'apply',
152
+ 'allow',
153
+ 'simulate',
154
+ 'watch',
155
+ 'remediate',
156
+ 'remediate-validate',
157
+ 'remediate-status',
158
+ 'generate',
102
159
  'patch',
103
- 'apply-safe',
104
- 'reverify',
105
- 'policy-sync',
106
- 'intent-update',
107
- ];
108
- function isExecutionActionType(value) {
109
- return EXECUTION_ACTION_TYPES.includes(value);
110
- }
160
+ 'fix',
161
+ 'prompt',
162
+ 'revert',
163
+ 'export',
164
+ ]);
111
165
  function shouldRouteJsonLegacyCommandThroughExecutionBus(jsonEnabled) {
112
166
  if (!jsonEnabled)
113
167
  return false;
@@ -126,27 +180,31 @@ function emitJsonPayloadWithExitCode(payload, exitCode) {
126
180
  function formatCoreWorkflowStep(step) {
127
181
  return ` * ${step.command.padEnd(28)} ${step.description}`;
128
182
  }
129
- function buildAdvancedLegacyCommandsList(root) {
130
- const advancedCommands = [];
131
- for (const subcommand of root.commands) {
132
- const commandName = subcommand.name();
133
- if (commandName === 'help' || PRIMARY_COMMAND_NAMES.has(commandName)) {
134
- continue;
135
- }
136
- advancedCommands.push(commandName);
137
- }
138
- return advancedCommands.sort((left, right) => left.localeCompare(right));
183
+ function collectCommandLayer(root, commandNames, preferredOrder) {
184
+ const visible = new Set(root.commands
185
+ .map((subcommand) => subcommand.name())
186
+ .filter((commandName) => commandName !== 'help' && commandNames.has(commandName)));
187
+ const ordered = preferredOrder.filter((commandName) => visible.has(commandName));
188
+ const remainder = [...visible]
189
+ .filter((commandName) => !preferredOrder.includes(commandName))
190
+ .sort((left, right) => left.localeCompare(right));
191
+ return [...ordered, ...remainder];
139
192
  }
140
193
  function buildAdvancedLegacyHints(root) {
141
- return buildAdvancedLegacyCommandsList(root).map((commandName) => `neurcode ${commandName}`);
194
+ const fallbackCommands = root.commands
195
+ .map((subcommand) => subcommand.name())
196
+ .filter((commandName) => commandName !== 'help'
197
+ && !CANONICAL_OPERATOR_COMMAND_NAMES.has(commandName))
198
+ .sort((left, right) => left.localeCompare(right));
199
+ return fallbackCommands.map((commandName) => `neurcode ${commandName}`);
142
200
  }
143
201
  function configurePrimaryHelpView(root) {
144
- const primaryOrder = ['start', 'generate', 'verify', 'fix'];
202
+ const primaryOrder = ['start', 'quickstart', 'verify', 'remediate-export', 'replay'];
145
203
  root.configureHelp({
146
204
  visibleCommands: (command) => {
147
205
  const filtered = command.commands.filter((subcommand) => {
148
206
  const commandName = subcommand.name();
149
- return commandName === 'help' || PRIMARY_COMMAND_NAMES.has(commandName);
207
+ return commandName === 'help' || CANONICAL_OPERATOR_COMMAND_NAMES.has(commandName);
150
208
  });
151
209
  return filtered.sort((left, right) => {
152
210
  const leftIndex = primaryOrder.indexOf(left.name());
@@ -159,28 +217,93 @@ function configurePrimaryHelpView(root) {
159
217
  });
160
218
  }
161
219
  function printCoreWorkflowGuide() {
162
- console.log(chalk.bold.cyan('\n🚀 Neurcode Start\n'));
163
- console.log(chalk.bold.white('Core Workflow:'));
220
+ console.log(chalk.bold.cyan('\n🛡️ Neurcode Governance Workflow\n'));
221
+ console.log(chalk.bold.white('Canonical Workflow:'));
164
222
  CORE_WORKFLOW_STEPS.forEach((step) => console.log(chalk.dim(formatCoreWorkflowStep(step))));
165
223
  console.log('');
166
- console.log(chalk.dim('Run `neurcode --help` to see advanced and legacy commands.\n'));
224
+ console.log(chalk.dim('Run `neurcode --help` to see enterprise, runtime-engineering, and compatibility commands.\n'));
225
+ }
226
+ function formatCommandList(commandNames) {
227
+ return commandNames.length > 0
228
+ ? commandNames.map((commandName) => ` * neurcode ${commandName}`)
229
+ : [' * (none)'];
167
230
  }
168
- function renderHelpFooter(advancedCommands) {
169
- const advancedLines = advancedCommands.map((commandName) => ` * neurcode ${commandName}`);
231
+ function renderHelpFooter(root) {
232
+ const enterpriseOperations = collectCommandLayer(root, ENTERPRISE_OPERATIONS_COMMAND_NAMES, [
233
+ 'policy',
234
+ 'governance',
235
+ 'workspace',
236
+ 'control-plane',
237
+ 'pilot-report',
238
+ 'daemon',
239
+ 'doctor',
240
+ 'compat',
241
+ 'login',
242
+ 'logout',
243
+ 'init',
244
+ 'whoami',
245
+ 'config',
246
+ 'repo',
247
+ 'approve',
248
+ 'bootstrap-policy',
249
+ ]);
250
+ const runtimeEngineering = collectCommandLayer(root, RUNTIME_ENGINEERING_COMMAND_NAMES, [
251
+ 'audit',
252
+ 'contract',
253
+ 'feedback',
254
+ 'guard',
255
+ 'bootstrap',
256
+ 'map',
257
+ 'execute',
258
+ 'executions',
259
+ 'session',
260
+ 'brain',
261
+ ]);
262
+ const compatibilityCommands = collectCommandLayer(root, LEGACY_COMPATIBILITY_COMMAND_NAMES, [
263
+ 'fix',
264
+ 'patch',
265
+ 'generate',
266
+ 'prompt',
267
+ 'plan',
268
+ 'ask',
269
+ 'remediate',
270
+ 'remediate-validate',
271
+ 'remediate-status',
272
+ 'ship',
273
+ 'ship-resume',
274
+ 'ship-runs',
275
+ 'ship-attestation-verify',
276
+ 'apply',
277
+ 'export',
278
+ 'revert',
279
+ 'check',
280
+ 'refactor',
281
+ 'security',
282
+ 'simulate',
283
+ 'watch',
284
+ 'allow',
285
+ 'plan-slo',
286
+ ]);
170
287
  return [
171
288
  '',
172
289
  'Core Workflow',
173
290
  ...CORE_WORKFLOW_STEPS.map((step) => formatCoreWorkflowStep(step)),
174
291
  '',
175
- 'Advanced / Legacy Commands',
176
- ...(advancedLines.length > 0 ? advancedLines : [' * (none)']),
292
+ 'Enterprise Operations',
293
+ ...formatCommandList(enterpriseOperations),
294
+ '',
295
+ 'Runtime Engineering',
296
+ ...formatCommandList(runtimeEngineering),
297
+ '',
298
+ 'Compatibility / Legacy',
299
+ ...formatCommandList(compatibilityCommands),
177
300
  '',
178
301
  'Run `neurcode <command> --help` for command-specific details.',
179
302
  ].join('\n');
180
303
  }
181
304
  program
182
305
  .name('neurcode')
183
- .description('AI-powered code governance and diff analysis')
306
+ .description('Intent-aware deterministic governance infrastructure for AI-assisted engineering')
184
307
  .version(version);
185
308
  // Show welcome banner before parsing (for help or unauthenticated users)
186
309
  async function showWelcomeIfNeeded() {
@@ -199,7 +322,7 @@ showWelcomeIfNeeded().catch(() => {
199
322
  });
200
323
  program
201
324
  .command('start [intent...]')
202
- .description('Initialize what you are building')
325
+ .description('Declare governance intent and initialize bounded change context')
203
326
  .option('--run-init', 'Run `neurcode init` immediately after showing the guide')
204
327
  .option('--json', 'Output machine-readable onboarding metadata')
205
328
  .action(async (intentParts, options) => {
@@ -250,6 +373,7 @@ program
250
373
  (0, security_1.securityCommand)(program);
251
374
  (0, brain_1.brainCommand)(program);
252
375
  (0, policy_1.policyCommand)(program);
376
+ (0, governance_1.governanceCommand)(program);
253
377
  (0, control_plane_1.controlPlaneCommand)(program);
254
378
  (0, workspace_1.workspaceCommand)(program);
255
379
  (0, replay_1.replayCommand)(program);
@@ -339,6 +463,32 @@ program
339
463
  cliVersion: version,
340
464
  });
341
465
  });
466
+ program
467
+ .command('quickstart')
468
+ .description('Guided onboarding — first deterministic finding in under 2 minutes (no network required)')
469
+ .option('--force', 'Overwrite existing starter files')
470
+ .option('--json', 'Output machine-readable JSON')
471
+ .action(async (options) => {
472
+ await (0, quickstart_1.quickstartCommand)({
473
+ force: options.force === true,
474
+ json: options.json === true,
475
+ });
476
+ });
477
+ program
478
+ .command('bootstrap-policy')
479
+ .description('Generate deterministic enterprise policies based on detected repo ecosystem (no network, no LLM)')
480
+ .option('--force', 'Overwrite existing policy file')
481
+ .option('--ecosystem <type>', 'Override detected ecosystem (typescript|python|go|java|infra|mixed)')
482
+ .option('--profile <type>', 'Override detected profile (backend-service|auth-payment|queue-workflow|infra|general)')
483
+ .option('--json', 'Output machine-readable JSON')
484
+ .action(async (options) => {
485
+ await (0, bootstrap_policy_1.bootstrapPolicyCommand)({
486
+ force: options.force === true,
487
+ ecosystem: options.ecosystem,
488
+ profile: options.profile,
489
+ json: options.json === true,
490
+ });
491
+ });
342
492
  program
343
493
  .command('compat')
344
494
  .description('Show runtime compatibility contract (CLI <-> Action <-> API)')
@@ -409,7 +559,7 @@ program
409
559
  });
410
560
  program
411
561
  .command('ask')
412
- .description('Ask a repo question with grounded, citation-backed answers')
562
+ .description('Advanced: ask a repo question with grounded, citation-backed answers')
413
563
  .argument('<question...>', 'Question about the codebase')
414
564
  .option('--project-id <id>', 'Project ID')
415
565
  .option('--json', 'Output machine-readable JSON')
@@ -433,7 +583,7 @@ program
433
583
  });
434
584
  program
435
585
  .command('plan')
436
- .description('Generate an execution plan for a user intent')
586
+ .description('Legacy: generate an execution plan for a user intent')
437
587
  .argument('<intent...>', 'Description of what you want to accomplish')
438
588
  .option('--project-id <id>', 'Project ID')
439
589
  .option('--ticket <id>', 'Ticket ID from Linear or Jira (e.g., PROJ-123, ABC-123)')
@@ -498,7 +648,7 @@ planSloCmd
498
648
  });
499
649
  program
500
650
  .command('ship')
501
- .description('Plan, apply, verify, auto-remediate, and produce a merge confidence card')
651
+ .description('Legacy: run the older autonomous ship loop and produce a merge confidence card')
502
652
  .argument('<goal...>', 'Implementation goal to ship')
503
653
  .option('--project-id <id>', 'Project ID')
504
654
  .option('--max-fix-attempts <n>', 'Maximum auto-remediation attempts (default: 2)', (val) => parseInt(val, 10))
@@ -534,7 +684,7 @@ program
534
684
  });
535
685
  program
536
686
  .command('ship-resume')
537
- .description('Resume a previously started ship run from its checkpoint')
687
+ .description('Legacy: resume a previously started ship run from its checkpoint')
538
688
  .argument('<run-id>', 'Ship run ID (see neurcode ship-runs)')
539
689
  .option('--project-id <id>', 'Project ID override')
540
690
  .option('--max-fix-attempts <n>', 'Maximum auto-remediation attempts override', (val) => parseInt(val, 10))
@@ -564,7 +714,7 @@ program
564
714
  });
565
715
  program
566
716
  .command('ship-runs')
567
- .description('List persisted ship runs for this repository')
717
+ .description('Legacy: list persisted ship runs for this repository')
568
718
  .option('--limit <n>', 'Maximum runs to show (default: 20)', (val) => parseInt(val, 10))
569
719
  .option('--json', 'Output machine-readable JSON')
570
720
  .action((options) => {
@@ -575,7 +725,7 @@ program
575
725
  });
576
726
  program
577
727
  .command('ship-attestation-verify')
578
- .description('Verify a ship release attestation against the referenced merge card artifact')
728
+ .description('Legacy: verify a ship release attestation against the referenced merge card artifact')
579
729
  .argument('<path>', 'Path to release attestation JSON file')
580
730
  .option('--hmac-key <key>', 'HMAC key override for signature verification (defaults to NEURCODE_ATTEST_HMAC_KEY)')
581
731
  .option('--json', 'Output machine-readable JSON')
@@ -587,7 +737,7 @@ program
587
737
  });
588
738
  program
589
739
  .command('apply')
590
- .description('Apply a saved architect plan by generating and writing code files')
740
+ .description('Legacy: apply a saved architect plan by generating and writing code files')
591
741
  .argument('<planId>', 'Plan ID (UUID) to apply')
592
742
  .option('--force', 'Overwrite existing files without confirmation')
593
743
  .option('--json', 'Output machine-readable JSON')
@@ -625,7 +775,7 @@ program
625
775
  });
626
776
  program
627
777
  .command('simulate')
628
- .description('Predict blast radius and likely regressions before merge ("what would have broken?")')
778
+ .description('Advanced: predict blast radius and likely regressions before merge ("what would have broken?")')
629
779
  .option('--staged', 'Analyze staged changes only')
630
780
  .option('--head', 'Analyze changes against HEAD')
631
781
  .option('--base <ref>', 'Analyze changes against a specific base ref')
@@ -644,14 +794,14 @@ program
644
794
  });
645
795
  program
646
796
  .command('watch')
647
- .description('Start Neurcode Watch - A local background service that records file changes for Time Machine feature')
797
+ .description('Legacy: start the local file-change recorder used by Time Machine workflows')
648
798
  .action(() => {
649
799
  (0, watch_1.watchCommand)();
650
800
  });
651
801
  // Session management commands
652
802
  const sessionCmd = program
653
803
  .command('session')
654
- .description('Manage AI coding sessions');
804
+ .description('Manage cloud sessions and local intent-runtime continuity');
655
805
  sessionCmd
656
806
  .command('list')
657
807
  .description('List all sessions for the current project')
@@ -685,9 +835,51 @@ sessionCmd
685
835
  projectId: options.projectId,
686
836
  });
687
837
  });
838
+ sessionCmd
839
+ .command('list-local')
840
+ .description('List local intent-runtime session snapshots for this repository')
841
+ .option('--json', 'Output machine-readable JSON')
842
+ .action((options) => {
843
+ (0, session_1.listLocalSessionsCommand)({
844
+ json: options.json === true,
845
+ });
846
+ });
847
+ sessionCmd
848
+ .command('current-local')
849
+ .description('Show the active local intent-runtime session')
850
+ .option('--json', 'Output machine-readable JSON')
851
+ .action((options) => {
852
+ (0, session_1.currentLocalSessionCommand)({
853
+ json: options.json === true,
854
+ });
855
+ });
856
+ sessionCmd
857
+ .command('resume-local')
858
+ .description('Restore a stored local intent-runtime session snapshot')
859
+ .option('--session-id <id>', 'Local session ID to restore (defaults to the active or latest snapshot)')
860
+ .option('--json', 'Output machine-readable JSON')
861
+ .action((options) => {
862
+ (0, session_1.resumeLocalSessionCommand)({
863
+ sessionId: options.sessionId,
864
+ json: options.json === true,
865
+ });
866
+ });
867
+ sessionCmd
868
+ .command('compare-local')
869
+ .description('Compare the approved scope and boundary expectations of two local intent sessions')
870
+ .requiredOption('--left <id>', 'Left local session ID')
871
+ .requiredOption('--right <id>', 'Right local session ID')
872
+ .option('--json', 'Output machine-readable JSON')
873
+ .action((options) => {
874
+ (0, session_1.compareLocalSessionsCommand)({
875
+ left: options.left,
876
+ right: options.right,
877
+ json: options.json === true,
878
+ });
879
+ });
688
880
  program
689
881
  .command('remediate')
690
- .description('Run verify, auto-remediate using ship loop, then re-verify')
882
+ .description('Legacy: run verify, auto-remediate using the older ship loop, then re-verify')
691
883
  .option('--goal <text>', 'Goal text for remediation ship loop')
692
884
  .option('--plan-id <id>', 'Plan ID for verify scope checks')
693
885
  .option('--project-id <id>', 'Project ID override')
@@ -743,25 +935,34 @@ program
743
935
  json: options.json === true,
744
936
  });
745
937
  });
746
- // ── neurcode remediate export ──────────────────────────────────────────────────
938
+ // ── neurcode remediate-export (Phase 2 — trust boundary export) ───────────────
747
939
  program
748
940
  .command('remediate-export')
749
- .description('Export a GovernanceRemediationRequest JSON for a governance finding (no provider invoked, no files modified). ' +
750
- 'Feed the output to Cursor / Claude / Codex to generate a constrained patch.')
751
- .option('--finding-id <id>', 'Export request for a specific finding ID')
752
- .option('--finding-index <n>', 'Export request for finding at 0-based index', (v) => parseInt(v, 10))
753
- .option('--verify-output-file <path>', 'Path to neurcode verify --json output (default: .neurcode/last-verify-output.json)')
754
- .option('--output-file <path>', 'Output path for the request artifact')
941
+ .description('Export a structured deterministic remediation payload for a governance finding.\n' +
942
+ 'Pass the output to an external remediation tool or coding workflow.\n' +
943
+ 'This command NEVER modifies any file. Neurcode verifies. External remediation owns the code change.')
944
+ .option('--finding <id>', 'Export payload for a specific finding ID')
945
+ .option('--finding-id <id>', 'Alias for --finding (backward compatible)')
946
+ .option('--finding-index <n>', 'Export payload for finding at 0-based index')
947
+ .option('--all', 'Export payloads for all findings from last verify')
948
+ .option('--format <fmt>', 'Output format: json | mcp (default: json)', 'json')
949
+ .option('--out <path>', 'Write output to file instead of stdout')
950
+ .option('--copy', 'Copy output to clipboard (macOS pbcopy)')
951
+ .option('--verify-output-file <path>', 'Path to verify JSON output (default: .neurcode/last-verify-output.json)')
755
952
  .option('--project-root <path>', 'Project root override')
756
953
  .option('--json', 'Output machine-readable JSON')
757
- .action((options) => {
758
- (0, remediate_governance_1.remediateExportCommand)({
759
- findingId: options.findingId,
760
- findingIndex: options.findingIndex !== undefined ? Number(options.findingIndex) : undefined,
954
+ .action(async (options) => {
955
+ const finding = options.finding ?? options.findingId;
956
+ await (0, remediate_export_1.remediateExportCommand)({
957
+ finding,
958
+ findingIndex: options.findingIndex,
959
+ all: options.all === true,
960
+ format: options.format === 'mcp' ? 'mcp' : 'json',
961
+ out: options.out,
962
+ copy: options.copy === true,
963
+ json: options.json === true,
761
964
  verifyOutputFile: options.verifyOutputFile,
762
- outputFile: options.outputFile,
763
965
  projectRoot: options.projectRoot,
764
- json: options.json === true,
765
966
  });
766
967
  });
767
968
  // ── neurcode remediate validate ────────────────────────────────────────────────
@@ -797,7 +998,7 @@ program
797
998
  });
798
999
  program
799
1000
  .command('generate')
800
- .description('Generate a governed plan context (reads intent from plan.json if no prompt given)')
1001
+ .description('Legacy: generate governed plan context (reads intent from plan.json if no prompt given)')
801
1002
  .argument('[prompt...]', 'Implementation prompt — omit to use intent from plan.json')
802
1003
  .option('--plan-id <id>', 'Plan ID override for scope context')
803
1004
  .option('--json', 'Output machine-readable JSON')
@@ -812,7 +1013,7 @@ program
812
1013
  });
813
1014
  program
814
1015
  .command('patch')
815
- .description('Apply a deterministic fix patch to a file (from neurcode fix suggestions)')
1016
+ .description('Legacy: apply a deterministic fix patch to a file (from neurcode fix suggestions)')
816
1017
  .requiredOption('--file <path>', 'Path to the file to patch')
817
1018
  .option('--preview-token <token>', 'Preview token generated by deterministic patch preview')
818
1019
  .option('--rollback-receipt <id>', 'Rollback a previously applied deterministic patch receipt')
@@ -850,7 +1051,7 @@ program
850
1051
  });
851
1052
  program
852
1053
  .command('fix')
853
- .description('Get actionable fixes')
1054
+ .description('Review prioritized governance findings and optional legacy patch suggestions')
854
1055
  .option('--plan-id <id>', 'Plan ID for verify scope checks')
855
1056
  .option('--project-id <id>', 'Project ID override')
856
1057
  .option('--ci', 'CI mode: deterministic verification-only flow, no local interactive/runtime assumptions')
@@ -920,7 +1121,7 @@ program
920
1121
  });
921
1122
  program
922
1123
  .command('verify')
923
- .description('Check code against policies and plan')
1124
+ .description('Run intent-aware deterministic verification against policy and bounded change scope')
924
1125
  .option('--plan-id <id>', 'Plan ID to verify against (required unless --policy-only)')
925
1126
  .option('--project-id <id>', 'Project ID')
926
1127
  .option('--ci', 'CI mode: deterministic verification-only flow, no daemon/interactive/local-state assumptions')
@@ -1065,7 +1266,7 @@ program
1065
1266
  });
1066
1267
  program
1067
1268
  .command('prompt [plan-id]')
1068
- .description('Generate a Cursor/Claude prompt from an Architect Plan (uses last plan if ID not provided)')
1269
+ .description('Legacy: generate an external prompt from an Architect Plan (uses last plan if ID not provided)')
1069
1270
  .option('--json', 'Output machine-readable JSON')
1070
1271
  .option('--output <path>', 'Write prompt output to a file')
1071
1272
  .option('--no-copy', 'Do not copy prompt to clipboard')
@@ -1116,7 +1317,7 @@ revertCmd
1116
1317
  // ── Export ────────────────────────────────────────────────────────────────────
1117
1318
  program
1118
1319
  .command('export')
1119
- .description('Export current plan as structured JSON for agent consumption')
1320
+ .description('Legacy: export current plan as structured JSON for external workflow consumption')
1120
1321
  .option('--json', 'Output machine-readable JSON to stdout')
1121
1322
  .option('--file <path>', 'Write exported plan to a file (e.g. plan.json)')
1122
1323
  .action((options) => {
@@ -1128,7 +1329,7 @@ program
1128
1329
  // ── Daemon ────────────────────────────────────────────────────────────────────
1129
1330
  program
1130
1331
  .command('daemon')
1131
- .description('Start local dashboard bridge for verify/fix/patch actions (http://localhost:4321)')
1332
+ .description('Start the local governance bridge for verify, findings, replay, and remediation export (http://localhost:4321)')
1132
1333
  .action(() => {
1133
1334
  (0, server_1.startDaemon)();
1134
1335
  });
@@ -1146,9 +1347,9 @@ program
1146
1347
  .option('--no-reverify', 'Skip post-action deterministic reverify stage')
1147
1348
  .option('--json', 'Output full execution record as JSON')
1148
1349
  .action(async (type, options) => {
1149
- if (!isExecutionActionType(type)) {
1350
+ if (!(0, execution_actions_1.isExecutionActionType)(type)) {
1150
1351
  console.error(`❌ Unsupported execution type: ${type}`);
1151
- console.error(` Supported: ${EXECUTION_ACTION_TYPES.join(', ')}`);
1352
+ console.error(` Supported: ${execution_actions_1.EXECUTION_ACTION_TYPES.join(', ')}`);
1152
1353
  process.exit(1);
1153
1354
  }
1154
1355
  const run = await (0, execution_bus_1.runExecution)({
@@ -1234,7 +1435,6 @@ program
1234
1435
  console.log('');
1235
1436
  });
1236
1437
  configurePrimaryHelpView(program);
1237
- const advancedLegacyCommands = buildAdvancedLegacyCommandsList(program);
1238
- program.addHelpText('after', renderHelpFooter(advancedLegacyCommands));
1438
+ program.addHelpText('after', renderHelpFooter(program));
1239
1439
  program.parse();
1240
1440
  //# sourceMappingURL=index.js.map