@neurcode-ai/cli 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +60 -8
  3. package/dist/api-client.d.ts +284 -0
  4. package/dist/api-client.d.ts.map +1 -1
  5. package/dist/api-client.js +111 -0
  6. package/dist/api-client.js.map +1 -1
  7. package/dist/commands/activate.d.ts +82 -0
  8. package/dist/commands/activate.d.ts.map +1 -0
  9. package/dist/commands/activate.js +551 -0
  10. package/dist/commands/activate.js.map +1 -0
  11. package/dist/commands/admission.d.ts +67 -0
  12. package/dist/commands/admission.d.ts.map +1 -0
  13. package/dist/commands/admission.js +350 -0
  14. package/dist/commands/admission.js.map +1 -0
  15. package/dist/commands/agent.d.ts +3 -0
  16. package/dist/commands/agent.d.ts.map +1 -0
  17. package/dist/commands/agent.js +2045 -0
  18. package/dist/commands/agent.js.map +1 -0
  19. package/dist/commands/demo.d.ts +3 -0
  20. package/dist/commands/demo.d.ts.map +1 -0
  21. package/dist/commands/demo.js +102 -0
  22. package/dist/commands/demo.js.map +1 -0
  23. package/dist/commands/init.d.ts.map +1 -1
  24. package/dist/commands/init.js +58 -44
  25. package/dist/commands/init.js.map +1 -1
  26. package/dist/commands/login.d.ts +1 -1
  27. package/dist/commands/login.d.ts.map +1 -1
  28. package/dist/commands/login.js +44 -22
  29. package/dist/commands/login.js.map +1 -1
  30. package/dist/commands/profile.d.ts +14 -0
  31. package/dist/commands/profile.d.ts.map +1 -0
  32. package/dist/commands/profile.js +118 -0
  33. package/dist/commands/profile.js.map +1 -0
  34. package/dist/commands/quickstart.d.ts +2 -2
  35. package/dist/commands/quickstart.d.ts.map +1 -1
  36. package/dist/commands/quickstart.js +31 -30
  37. package/dist/commands/quickstart.js.map +1 -1
  38. package/dist/commands/remediate-export.d.ts +6 -1
  39. package/dist/commands/remediate-export.d.ts.map +1 -1
  40. package/dist/commands/remediate-export.js +359 -7
  41. package/dist/commands/remediate-export.js.map +1 -1
  42. package/dist/commands/replay.d.ts.map +1 -1
  43. package/dist/commands/replay.js +84 -0
  44. package/dist/commands/replay.js.map +1 -1
  45. package/dist/commands/run.d.ts +3 -0
  46. package/dist/commands/run.d.ts.map +1 -0
  47. package/dist/commands/run.js +98 -0
  48. package/dist/commands/run.js.map +1 -0
  49. package/dist/commands/runtime-adapter.d.ts +8 -0
  50. package/dist/commands/runtime-adapter.d.ts.map +1 -0
  51. package/dist/commands/runtime-adapter.js +375 -0
  52. package/dist/commands/runtime-adapter.js.map +1 -0
  53. package/dist/commands/runtime-doctor.d.ts +6 -0
  54. package/dist/commands/runtime-doctor.d.ts.map +1 -0
  55. package/dist/commands/runtime-doctor.js +478 -0
  56. package/dist/commands/runtime-doctor.js.map +1 -0
  57. package/dist/commands/runtime-report.d.ts +13 -0
  58. package/dist/commands/runtime-report.d.ts.map +1 -0
  59. package/dist/commands/runtime-report.js +81 -0
  60. package/dist/commands/runtime-report.js.map +1 -0
  61. package/dist/commands/runtime-sync.d.ts +17 -0
  62. package/dist/commands/runtime-sync.d.ts.map +1 -0
  63. package/dist/commands/runtime-sync.js +656 -0
  64. package/dist/commands/runtime-sync.js.map +1 -0
  65. package/dist/commands/runtime.d.ts +16 -0
  66. package/dist/commands/runtime.d.ts.map +1 -0
  67. package/dist/commands/runtime.js +380 -0
  68. package/dist/commands/runtime.js.map +1 -0
  69. package/dist/commands/session-hook.d.ts +35 -0
  70. package/dist/commands/session-hook.d.ts.map +1 -0
  71. package/dist/commands/session-hook.js +1297 -0
  72. package/dist/commands/session-hook.js.map +1 -0
  73. package/dist/commands/session.d.ts +91 -0
  74. package/dist/commands/session.d.ts.map +1 -1
  75. package/dist/commands/session.js +1226 -0
  76. package/dist/commands/session.js.map +1 -1
  77. package/dist/commands/whoami.d.ts +7 -4
  78. package/dist/commands/whoami.d.ts.map +1 -1
  79. package/dist/commands/whoami.js +59 -34
  80. package/dist/commands/whoami.js.map +1 -1
  81. package/dist/config.d.ts.map +1 -1
  82. package/dist/config.js +24 -5
  83. package/dist/config.js.map +1 -1
  84. package/dist/daemon/routes.d.ts.map +1 -1
  85. package/dist/daemon/routes.js +8 -0
  86. package/dist/daemon/routes.js.map +1 -1
  87. package/dist/daemon/server.d.ts.map +1 -1
  88. package/dist/daemon/server.js +88 -0
  89. package/dist/daemon/server.js.map +1 -1
  90. package/dist/governance/impact-analysis.d.ts +27 -0
  91. package/dist/governance/impact-analysis.d.ts.map +1 -0
  92. package/dist/governance/impact-analysis.js +274 -0
  93. package/dist/governance/impact-analysis.js.map +1 -0
  94. package/dist/index.js +472 -29
  95. package/dist/index.js.map +1 -1
  96. package/dist/intent-engine/matcher.d.ts.map +1 -1
  97. package/dist/intent-engine/matcher.js +3 -12
  98. package/dist/intent-engine/matcher.js.map +1 -1
  99. package/dist/utils/admission-artifact.d.ts +59 -0
  100. package/dist/utils/admission-artifact.d.ts.map +1 -0
  101. package/dist/utils/admission-artifact.js +410 -0
  102. package/dist/utils/admission-artifact.js.map +1 -0
  103. package/dist/utils/agent-adapter-setup.d.ts +80 -0
  104. package/dist/utils/agent-adapter-setup.d.ts.map +1 -0
  105. package/dist/utils/agent-adapter-setup.js +577 -0
  106. package/dist/utils/agent-adapter-setup.js.map +1 -0
  107. package/dist/utils/agent-guard-supervisor.d.ts +75 -0
  108. package/dist/utils/agent-guard-supervisor.d.ts.map +1 -0
  109. package/dist/utils/agent-guard-supervisor.js +388 -0
  110. package/dist/utils/agent-guard-supervisor.js.map +1 -0
  111. package/dist/utils/agent-guard.d.ts +92 -0
  112. package/dist/utils/agent-guard.d.ts.map +1 -0
  113. package/dist/utils/agent-guard.js +326 -0
  114. package/dist/utils/agent-guard.js.map +1 -0
  115. package/dist/utils/agent-session-launcher.d.ts +89 -0
  116. package/dist/utils/agent-session-launcher.d.ts.map +1 -0
  117. package/dist/utils/agent-session-launcher.js +308 -0
  118. package/dist/utils/agent-session-launcher.js.map +1 -0
  119. package/dist/utils/bash-command-analysis.d.ts +19 -0
  120. package/dist/utils/bash-command-analysis.d.ts.map +1 -0
  121. package/dist/utils/bash-command-analysis.js +295 -0
  122. package/dist/utils/bash-command-analysis.js.map +1 -0
  123. package/dist/utils/consequence-nudges.d.ts +30 -0
  124. package/dist/utils/consequence-nudges.d.ts.map +1 -0
  125. package/dist/utils/consequence-nudges.js +313 -0
  126. package/dist/utils/consequence-nudges.js.map +1 -0
  127. package/dist/utils/drift-intelligence.d.ts.map +1 -1
  128. package/dist/utils/drift-intelligence.js +29 -7
  129. package/dist/utils/drift-intelligence.js.map +1 -1
  130. package/dist/utils/git-coverage.d.ts +57 -0
  131. package/dist/utils/git-coverage.d.ts.map +1 -0
  132. package/dist/utils/git-coverage.js +302 -0
  133. package/dist/utils/git-coverage.js.map +1 -0
  134. package/dist/utils/gitignore.d.ts.map +1 -1
  135. package/dist/utils/gitignore.js +2 -1
  136. package/dist/utils/gitignore.js.map +1 -1
  137. package/dist/utils/governed-intent.d.ts +10 -0
  138. package/dist/utils/governed-intent.d.ts.map +1 -0
  139. package/dist/utils/governed-intent.js +108 -0
  140. package/dist/utils/governed-intent.js.map +1 -0
  141. package/dist/utils/hook-heartbeat.d.ts +55 -0
  142. package/dist/utils/hook-heartbeat.d.ts.map +1 -0
  143. package/dist/utils/hook-heartbeat.js +116 -0
  144. package/dist/utils/hook-heartbeat.js.map +1 -0
  145. package/dist/utils/intent-continuity.d.ts +21 -0
  146. package/dist/utils/intent-continuity.d.ts.map +1 -0
  147. package/dist/utils/intent-continuity.js +192 -0
  148. package/dist/utils/intent-continuity.js.map +1 -0
  149. package/dist/utils/messages.d.ts +1 -1
  150. package/dist/utils/messages.d.ts.map +1 -1
  151. package/dist/utils/messages.js +24 -21
  152. package/dist/utils/messages.js.map +1 -1
  153. package/dist/utils/runtime-companion.d.ts +137 -0
  154. package/dist/utils/runtime-companion.d.ts.map +1 -0
  155. package/dist/utils/runtime-companion.js +231 -0
  156. package/dist/utils/runtime-companion.js.map +1 -0
  157. package/dist/utils/runtime-connection.d.ts +46 -0
  158. package/dist/utils/runtime-connection.d.ts.map +1 -0
  159. package/dist/utils/runtime-connection.js +148 -0
  160. package/dist/utils/runtime-connection.js.map +1 -0
  161. package/dist/utils/runtime-evidence.d.ts +68 -0
  162. package/dist/utils/runtime-evidence.d.ts.map +1 -0
  163. package/dist/utils/runtime-evidence.js +248 -0
  164. package/dist/utils/runtime-evidence.js.map +1 -0
  165. package/dist/utils/runtime-live.d.ts +33 -0
  166. package/dist/utils/runtime-live.d.ts.map +1 -0
  167. package/dist/utils/runtime-live.js +361 -0
  168. package/dist/utils/runtime-live.js.map +1 -0
  169. package/dist/utils/runtime-outbox.d.ts +76 -0
  170. package/dist/utils/runtime-outbox.d.ts.map +1 -0
  171. package/dist/utils/runtime-outbox.js +410 -0
  172. package/dist/utils/runtime-outbox.js.map +1 -0
  173. package/dist/utils/runtime-receipt.d.ts +50 -0
  174. package/dist/utils/runtime-receipt.d.ts.map +1 -0
  175. package/dist/utils/runtime-receipt.js +223 -0
  176. package/dist/utils/runtime-receipt.js.map +1 -0
  177. package/dist/utils/state.d.ts +21 -0
  178. package/dist/utils/state.d.ts.map +1 -1
  179. package/dist/utils/state.js +30 -0
  180. package/dist/utils/state.js.map +1 -1
  181. package/dist/utils/structural-understanding.d.ts +334 -0
  182. package/dist/utils/structural-understanding.d.ts.map +1 -0
  183. package/dist/utils/structural-understanding.js +2316 -0
  184. package/dist/utils/structural-understanding.js.map +1 -0
  185. package/dist/utils/v0-governance.d.ts +197 -0
  186. package/dist/utils/v0-governance.d.ts.map +1 -0
  187. package/dist/utils/v0-governance.js +904 -0
  188. package/dist/utils/v0-governance.js.map +1 -0
  189. package/package.json +11 -12
@@ -0,0 +1,478 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runtimeDoctorCommand = runtimeDoctorCommand;
4
+ const governance_runtime_1 = require("@neurcode-ai/governance-runtime");
5
+ const agent_session_launcher_1 = require("../utils/agent-session-launcher");
6
+ const agent_guard_supervisor_1 = require("../utils/agent-guard-supervisor");
7
+ const v0_governance_1 = require("../utils/v0-governance");
8
+ const runtime_connection_1 = require("../utils/runtime-connection");
9
+ const runtime_outbox_1 = require("../utils/runtime-outbox");
10
+ const hook_heartbeat_1 = require("../utils/hook-heartbeat");
11
+ /** True when the goal produced an over-broad approval scope (e.g. `**`). */
12
+ function hasOverBroadApprovalScope(session) {
13
+ const globs = session.contract?.approvalRequiredGlobs ?? [];
14
+ return globs.includes('**');
15
+ }
16
+ let chalk;
17
+ try {
18
+ chalk = require('chalk');
19
+ }
20
+ catch {
21
+ chalk = {
22
+ green: (s) => s,
23
+ yellow: (s) => s,
24
+ red: (s) => s,
25
+ bold: (s) => s,
26
+ dim: (s) => s,
27
+ white: (s) => s,
28
+ };
29
+ }
30
+ function statusLabel(status) {
31
+ if (status === 'pass')
32
+ return chalk.green('PASS');
33
+ if (status === 'warn')
34
+ return chalk.yellow('WARN');
35
+ if (status === 'fail')
36
+ return chalk.red('FAIL');
37
+ return chalk.dim('SKIP');
38
+ }
39
+ function printCheck(check) {
40
+ console.log(`${statusLabel(check.status)} ${chalk.bold(check.label)}`);
41
+ console.log(chalk.dim(` ${check.message}`));
42
+ if (check.recommendation) {
43
+ console.log(chalk.dim(` Next: ${check.recommendation}`));
44
+ }
45
+ console.log('');
46
+ }
47
+ function compatibilityModeLabel(value) {
48
+ return value.replace(/_/g, ' ');
49
+ }
50
+ function runtimeDoctorCommand(options = {}) {
51
+ const repoRoot = (0, v0_governance_1.resolveRepoRoot)(options.dir || process.cwd());
52
+ const staleness = (0, v0_governance_1.getProfileStaleness)(repoRoot);
53
+ const activation = (0, v0_governance_1.inspectClaudeActivation)(repoRoot);
54
+ const copilotActivation = (0, v0_governance_1.inspectCopilotActivation)(repoRoot);
55
+ const activeSession = (0, governance_runtime_1.loadActiveSession)(repoRoot);
56
+ const governanceConfig = (0, v0_governance_1.readRuntimeGovernanceConfig)(repoRoot);
57
+ const connection = (0, runtime_connection_1.loadRuntimeConnection)(repoRoot);
58
+ const transport = (0, runtime_outbox_1.inspectRuntimeOutbox)(repoRoot);
59
+ const heartbeat = (0, hook_heartbeat_1.readHookHeartbeat)(repoRoot);
60
+ const h = activation.hooks;
61
+ const ch = copilotActivation.hooks;
62
+ const launcherState = activeSession ? (0, agent_session_launcher_1.latestAgentLauncherState)(activeSession) : null;
63
+ const activeAdapter = launcherState?.agent.adapter
64
+ || (activeSession && h.installed ? 'claude-code-hooks' : activeSession && ch.installed ? 'copilot-hooks' : null);
65
+ const activeCapability = activeAdapter ? (0, governance_runtime_1.getAgentRuntimeAdapterCapability)(activeAdapter) : null;
66
+ const supervisor = activeSession ? (0, agent_guard_supervisor_1.inspectAgentGuardSupervisor)(repoRoot, activeSession.sessionId) : null;
67
+ const checks = [];
68
+ const dashboardSyncFailed = Boolean(connection?.autoSync.enabled && connection.autoSync.lastStatus === 'failed');
69
+ const dashboardSyncRecovered = dashboardSyncFailed && transport.health === 'healthy' && Boolean(transport.lastDeliveredAt);
70
+ checks.push({
71
+ id: 'profile',
72
+ label: 'Governance profile',
73
+ status: staleness.status === 'fresh' ? 'pass' : 'warn',
74
+ message: staleness.status === 'fresh'
75
+ ? `Fresh profile at ${staleness.profilePath} (${staleness.currentProfile.topology.trackedFileCount} tracked files).`
76
+ : `${staleness.status}: ${staleness.reasons.join('; ') || 'profile needs refresh'}.`,
77
+ recommendation: staleness.status === 'fresh' ? undefined : 'Run `neurcode activate claude` or `neurcode activate copilot` to refresh it.',
78
+ });
79
+ // ── Claude Code hooks (on-disk correctness) ────────────────────────────────
80
+ // Priority: parse error > stale bare hooks > missing pinned entrypoint > installed > missing.
81
+ const entrypointMissing = h.entrypoint !== null && h.entrypointExists === false;
82
+ let hooksStatus;
83
+ let hooksMessage;
84
+ let hooksRec;
85
+ if (h.error) {
86
+ hooksStatus = 'fail';
87
+ hooksMessage = `Could not parse ${h.settingsPath}: ${h.error}`;
88
+ hooksRec = 'Fix the JSON in .claude/settings.json, then run `neurcode activate claude`.';
89
+ }
90
+ else if (entrypointMissing) {
91
+ hooksStatus = 'fail';
92
+ hooksMessage = `Pinned hook entrypoint is missing on disk: ${h.entrypoint}. Claude Code cannot run governance and FAILS OPEN (writes proceed ungoverned).`;
93
+ hooksRec = 'Run `pnpm build:cli` to produce dist/index.js, then `neurcode activate claude`.';
94
+ }
95
+ else if (h.stale) {
96
+ hooksStatus = 'fail';
97
+ hooksMessage = `Stale Neurcode hooks in ${h.settingsPath}: ${h.staleCommands.join('; ')}.`;
98
+ hooksRec = 'Run `neurcode activate claude`, then restart Claude Code in this repo.';
99
+ }
100
+ else if (h.installed) {
101
+ hooksStatus = 'pass';
102
+ hooksMessage = `Installed in ${h.settingsPath}${h.entrypoint ? ` (pinned: ${h.entrypoint})` : ''}.`;
103
+ // Portability is advisory: absolute machine paths don't travel to other machines/CI.
104
+ if (h.entrypointPortable === false) {
105
+ hooksRec = `Pinned hook path is absolute and machine-specific; it will not work for teammates/CI on a different checkout. Each machine must run \`neurcode activate claude\` locally.`;
106
+ }
107
+ }
108
+ else {
109
+ hooksStatus = 'warn';
110
+ hooksMessage = `Missing one or more hooks in ${h.settingsPath}.`;
111
+ hooksRec = 'Run `neurcode activate claude`.';
112
+ }
113
+ checks.push({
114
+ id: 'claude_hooks',
115
+ label: 'Claude Code hooks',
116
+ status: hooksStatus,
117
+ message: hooksMessage,
118
+ recommendation: hooksRec,
119
+ });
120
+ const copilotEntrypointMissing = ch.entrypoint !== null && ch.entrypointExists === false;
121
+ let copilotHooksStatus;
122
+ let copilotHooksMessage;
123
+ let copilotHooksRec;
124
+ if (ch.error) {
125
+ copilotHooksStatus = 'fail';
126
+ copilotHooksMessage = `Could not parse ${ch.hooksPath}: ${ch.error}`;
127
+ copilotHooksRec = 'Fix the JSON in .github/hooks/neurcode.json, then run `neurcode activate copilot`.';
128
+ }
129
+ else if (copilotEntrypointMissing) {
130
+ copilotHooksStatus = 'fail';
131
+ copilotHooksMessage = `Pinned Copilot hook entrypoint is missing on disk: ${ch.entrypoint}. Copilot cannot run governance and FAILS OPEN (writes proceed ungoverned).`;
132
+ copilotHooksRec = 'Run `pnpm build:cli` to produce dist/index.js, then `neurcode activate copilot`.';
133
+ }
134
+ else if (ch.stale) {
135
+ copilotHooksStatus = 'fail';
136
+ copilotHooksMessage = `Stale Neurcode hooks in ${ch.hooksPath}: ${ch.staleCommands.join('; ')}.`;
137
+ copilotHooksRec = 'Run `neurcode activate copilot`, then reload VS Code / Copilot Agent Mode in this repo.';
138
+ }
139
+ else if (ch.installed) {
140
+ copilotHooksStatus = 'pass';
141
+ copilotHooksMessage = `Installed in ${ch.hooksPath}${ch.entrypoint ? ` (pinned: ${ch.entrypoint})` : ''}.`;
142
+ if (ch.entrypointPortable === false) {
143
+ copilotHooksRec = 'Pinned hook path is absolute and machine-specific; each machine should run `neurcode activate copilot` locally.';
144
+ }
145
+ }
146
+ else {
147
+ copilotHooksStatus = 'skip';
148
+ copilotHooksMessage = `No Copilot hooks installed in ${ch.hooksPath}.`;
149
+ copilotHooksRec = 'Run `neurcode activate copilot` to govern VS Code Copilot Agent Mode.';
150
+ }
151
+ checks.push({
152
+ id: 'copilot_hooks',
153
+ label: 'GitHub Copilot hooks',
154
+ status: copilotHooksStatus,
155
+ message: copilotHooksMessage,
156
+ recommendation: copilotHooksRec,
157
+ });
158
+ // ── Live hook liveness / restart detection ─────────────────────────────────
159
+ // Hooks load at Claude Code startup and do NOT hot-reload. doctor green on disk does
160
+ // not prove the *running* session is governed. Compare the live heartbeat (written by
161
+ // the hook that is actually executing) against what is installed on disk now.
162
+ const activeHookEntrypoint = h.installed ? h.entrypoint : ch.installed ? ch.entrypoint : h.entrypoint || ch.entrypoint;
163
+ const activeHookLabel = h.installed ? 'Claude Code' : ch.installed ? 'GitHub Copilot' : 'agent';
164
+ const installedFingerprint = activeHookEntrypoint ? (0, hook_heartbeat_1.fingerprintEntrypoint)(activeHookEntrypoint) : null;
165
+ let liveness;
166
+ const RESTART_MSG = 'restart or reload the coding agent in this repo before demoing governance.';
167
+ const describeHeartbeat = (hb) => `last live hook: ${hb.lastEvent.type} @ ${hb.lastEvent.ts} (cli ${hb.cliVersion})`;
168
+ if ((h.stale || entrypointMissing || h.error) && !ch.installed) {
169
+ liveness = {
170
+ status: 'skip',
171
+ message: 'Resolve a hard-hook agent check above before live governance can be confirmed.',
172
+ };
173
+ }
174
+ else if (activeSession && activeSession.status === 'active') {
175
+ if (!heartbeat) {
176
+ liveness = {
177
+ status: 'warn',
178
+ message: `A Neurcode session is active but no live hook heartbeat has been recorded yet (the running ${activeHookLabel} session may not be executing the installed hooks).`,
179
+ recommendation: `If the agent was open before activation, ${RESTART_MSG}`,
180
+ };
181
+ }
182
+ else if (installedFingerprint && heartbeat.entrypointFingerprint !== installedFingerprint) {
183
+ // The live hook runs a different entrypoint than what is installed on disk now —
184
+ // hooks were changed after the running Claude session loaded them.
185
+ liveness = {
186
+ status: 'fail',
187
+ message: `Installed hooks changed after the active session started — the live hook runs ${heartbeat.entrypoint}, but disk now pins a different ${activeHookLabel} entrypoint. The running session is governed by stale hooks.`,
188
+ recommendation: RESTART_MSG,
189
+ };
190
+ }
191
+ else {
192
+ liveness = {
193
+ status: 'pass',
194
+ message: `Live governance confirmed: ${describeHeartbeat(heartbeat)}; running entrypoint matches disk.`,
195
+ };
196
+ }
197
+ }
198
+ else {
199
+ liveness = {
200
+ status: heartbeat ? 'pass' : 'skip',
201
+ message: heartbeat
202
+ ? `No active session. ${describeHeartbeat(heartbeat)}.`
203
+ : 'No live hook heartbeat yet (no governed Claude Code session has run in this repo).',
204
+ };
205
+ }
206
+ checks.push({ id: 'hook_liveness', label: 'Live hook heartbeat / restart', ...liveness });
207
+ checks.push({
208
+ id: 'claude_mcp',
209
+ label: 'Claude MCP approval tool',
210
+ status: activation.mcp.error
211
+ ? 'fail'
212
+ : activation.mcp.configured
213
+ ? 'pass'
214
+ : activation.mcp.stale
215
+ ? 'fail'
216
+ : 'warn',
217
+ message: activation.mcp.error
218
+ ? `Could not parse ${activation.mcp.configPath}: ${activation.mcp.error}`
219
+ : activation.mcp.configured
220
+ ? `Configured in ${activation.mcp.configPath}: npx -y @neurcode-ai/mcp-server.`
221
+ : activation.mcp.stale
222
+ ? `Stale neurcode MCP server entry in ${activation.mcp.configPath}: ${activation.mcp.staleReasons.join('; ')}. Claude may not expose neurcode_session_approve.`
223
+ : `neurcode MCP server entry is missing from ${activation.mcp.configPath}.`,
224
+ recommendation: activation.mcp.configured
225
+ ? undefined
226
+ : activation.mcp.stale
227
+ ? 'Run `neurcode activate claude`, then reload Claude MCP servers or restart Claude Code.'
228
+ : 'Run `neurcode activate claude` or use `neurcode session approve --path <path>` locally.',
229
+ });
230
+ const sessionActive = Boolean(activeSession && activeSession.status === 'active');
231
+ const overBroadScope = sessionActive && activeSession ? hasOverBroadApprovalScope(activeSession) : false;
232
+ checks.push({
233
+ id: 'active_session',
234
+ label: 'Active governance session',
235
+ status: !sessionActive ? 'skip' : overBroadScope ? 'warn' : 'pass',
236
+ message: !sessionActive
237
+ ? 'No active governed agent session. This is normal until an agent session starts.'
238
+ : overBroadScope
239
+ ? `Session ${activeSession.sessionId} is active but its scope is over-broad: approvalRequiredGlobs includes "**", so every file needs approval. This usually means the goal/prompt was very long or path-heavy.`
240
+ : `Session ${activeSession.sessionId} is active (${activeSession.contract.scopeMode} scope).`,
241
+ recommendation: !sessionActive
242
+ ? undefined
243
+ : overBroadScope
244
+ ? 'For demos, start sessions with a short, crisp goal (e.g. "Add retry with backoff to the export task") so scope stays tight.'
245
+ : 'Run `neurcode status` for live session details.',
246
+ });
247
+ checks.push({
248
+ id: 'agent_compatibility',
249
+ label: 'Agent compatibility / enforcement truth',
250
+ status: activeCapability
251
+ ? activeCapability.enforcementLevel === 'hard_deny'
252
+ ? 'pass'
253
+ : supervisor?.effectiveStatus === 'running'
254
+ ? 'pass'
255
+ : activeCapability.supervisorSupported
256
+ ? 'warn'
257
+ : 'warn'
258
+ : 'skip',
259
+ message: activeCapability
260
+ ? `${launcherState?.agent.normalized || activeCapability.adapter} uses ${compatibilityModeLabel(activeCapability.compatibilityMode)}. Actually enforceable: ${activeCapability.enforceable.join('; ')}. Advisory only: ${activeCapability.advisoryOnly.join('; ')}.`
261
+ : 'No active agent adapter was detected. Claude Code hard hooks can be checked above; Codex/Cursor need cooperative runtime calls or supervisor mode.',
262
+ recommendation: activeCapability && activeCapability.enforcementLevel !== 'hard_deny'
263
+ ? supervisor?.effectiveStatus === 'running'
264
+ ? `Supervisor/diff-watch is running for session ${activeSession?.sessionId}; last pass: ${supervisor.state?.lastPass === null ? 'pending' : supervisor.state?.lastPass ? 'yes' : 'no'}.`
265
+ : activeCapability.supervisorSupported && activeSession
266
+ ? 'For Codex/Cursor, run `neurcode agent guard start --supervise --goal "<task>"` or `neurcode agent guard supervise run` before finalizing/committing.'
267
+ : 'Use cooperative `neurcode runtime-adapter event` calls before edits; this host is not a hard pre-write blocker.'
268
+ : undefined,
269
+ });
270
+ const codexCapability = (0, governance_runtime_1.getAgentRuntimeAdapterCapability)('codex-mcp');
271
+ const cursorCapability = (0, governance_runtime_1.getAgentRuntimeAdapterCapability)('cursor-mcp');
272
+ const vscodeCapability = (0, governance_runtime_1.getAgentRuntimeAdapterCapability)('vscode-extension');
273
+ const actionCapability = (0, governance_runtime_1.getAgentRuntimeAdapterCapability)('github-action');
274
+ checks.push({
275
+ id: 'codex_cursor_supervisor_workflow',
276
+ label: 'Codex / Cursor supervised workflow',
277
+ status: activeAdapter === 'codex-mcp' || activeAdapter === 'cursor-mcp'
278
+ ? supervisor?.effectiveStatus === 'running'
279
+ ? 'pass'
280
+ : 'warn'
281
+ : 'skip',
282
+ message: activeAdapter === 'codex-mcp' || activeAdapter === 'cursor-mcp'
283
+ ? `${activeAdapter} is active. Control level: ${compatibilityModeLabel((activeAdapter === 'codex-mcp' ? codexCapability : cursorCapability).compatibilityMode)}; enforceable: ${(activeAdapter === 'codex-mcp' ? codexCapability : cursorCapability).enforceable.join('; ')}.`
284
+ : 'Codex and Cursor are compatibility modes: supervised CLI/MCP workflow plus admission/evidence path, not Claude-style host hooks.',
285
+ recommendation: activeAdapter === 'codex-mcp' || activeAdapter === 'cursor-mcp'
286
+ ? supervisor?.effectiveStatus === 'running'
287
+ ? 'Keep the supervisor running until finish, then export runtime admission.'
288
+ : 'Start with `neurcode agent guard start codex --goal "<task>"` or `neurcode agent guard start cursor --goal "<task>"`.'
289
+ : 'Run `neurcode activate codex` or `neurcode activate cursor` to print the workflow commands.',
290
+ });
291
+ checks.push({
292
+ id: 'vscode_companion_workflow',
293
+ label: 'VS Code / Copilot companion workflow',
294
+ status: activeAdapter === 'vscode-extension' ? 'pass' : 'skip',
295
+ message: activeAdapter === 'vscode-extension'
296
+ ? `${vscodeCapability.adapter} is active as ${compatibilityModeLabel(vscodeCapability.compatibilityMode)}.`
297
+ : 'VS Code is an observe-only Runtime Companion; Copilot hooks require `neurcode activate copilot` and host hook discovery.',
298
+ recommendation: activeAdapter === 'vscode-extension'
299
+ ? 'Use the extension for visibility and exact-path approval UX; pair it with a hooked or supervised agent for write accountability.'
300
+ : 'Run `neurcode activate vscode` for companion guidance or `neurcode activate copilot` when using Copilot Agent Mode hooks.',
301
+ });
302
+ checks.push({
303
+ id: 'github_action_admission_workflow',
304
+ label: 'GitHub Action / runtime admission',
305
+ status: 'skip',
306
+ message: `${actionCapability.adapter} is ${compatibilityModeLabel(actionCapability.compatibilityMode)}: PR-time advisory routing plus admission display when .neurcode-admission records are committed.`,
307
+ recommendation: 'Run `neurcode admission doctor`, then `neurcode session export-admission <session-id> --explain` before opening a PR with the public Action.',
308
+ });
309
+ checks.push({
310
+ id: 'governance_config',
311
+ label: 'Runtime governance config',
312
+ status: governanceConfig.error ? 'warn' : governanceConfig.exists ? 'pass' : 'skip',
313
+ message: governanceConfig.error
314
+ ? `Malformed config at ${governanceConfig.path}: ${governanceConfig.error}`
315
+ : governanceConfig.exists
316
+ ? `Config loaded from ${governanceConfig.path}.`
317
+ : 'No .neurcode/governance.json file. Using detected CODEOWNERS/sensitive boundaries only.',
318
+ recommendation: governanceConfig.error
319
+ ? 'Fix .neurcode/governance.json. Expected arrays: approvalRequiredGlobs, sensitiveGlobs, safeSupportGlobs, ignoredGlobs; optional planCoherence: off|warn|block.'
320
+ : undefined,
321
+ });
322
+ checks.push({
323
+ id: 'approval_ux',
324
+ label: 'Approval UX',
325
+ status: activation.mcp.configured ? 'pass' : activation.mcp.stale ? 'fail' : 'warn',
326
+ message: activation.mcp.configured
327
+ ? 'MCP tool `neurcode_session_approve` and CLI command `neurcode session approve` are available.'
328
+ : activation.mcp.stale
329
+ ? 'CLI approval is available; MCP approval config is stale, so Claude may not expose `neurcode_session_approve`.'
330
+ : 'CLI approval is available; MCP approval is not configured yet.',
331
+ recommendation: activation.mcp.configured
332
+ ? undefined
333
+ : activation.mcp.stale
334
+ ? 'Run `neurcode activate claude`, then reload Claude MCP servers or restart Claude Code.'
335
+ : 'Run `neurcode activate claude` to configure MCP approval.',
336
+ });
337
+ checks.push({
338
+ id: 'dashboard_connection',
339
+ label: 'Dashboard pairing / bulk evidence sync',
340
+ status: !connection ? 'warn' : dashboardSyncFailed ? dashboardSyncRecovered ? 'warn' : 'fail' : 'pass',
341
+ message: connection
342
+ ? `Connected to ${connection.repo.name}; bulk evidence sync is ${connection.autoSync.enabled ? 'enabled' : 'disabled'} (${connection.autoSync.lastStatus || 'never synced'}).` +
343
+ (dashboardSyncRecovered ? ` Live block/approval transport is separate and recovered at ${transport.lastDeliveredAt}.` : '')
344
+ : 'This repo is not paired with the Neurcode dashboard yet.',
345
+ recommendation: !connection
346
+ ? 'From Runtime Evidence, copy the activation command or run `neurcode activate claude --connect <token>`.'
347
+ : dashboardSyncFailed
348
+ ? dashboardSyncRecovered
349
+ ? 'Run `neurcode sync --runtime --json` to refresh bulk evidence metadata after recovery. Live approvals can still be visible while this is pending.'
350
+ : `Run \`neurcode sync --runtime --json\` and inspect the bulk evidence error${connection.autoSync.lastError ? ` (${connection.autoSync.lastError})` : ''}.`
351
+ : undefined,
352
+ });
353
+ checks.push({
354
+ id: 'runtime_transport',
355
+ label: 'Live runtime transport',
356
+ status: !connection
357
+ ? 'skip'
358
+ : transport.health === 'degraded'
359
+ ? 'fail'
360
+ : transport.health === 'retrying'
361
+ ? 'warn'
362
+ : 'pass',
363
+ message: !connection
364
+ ? 'Runtime transport activates after this repo is paired with the dashboard.'
365
+ : transport.health === 'degraded'
366
+ ? `${transport.deadLetterEvents} source-free event${transport.deadLetterEvents === 1 ? '' : 's'} moved to the local dead-letter queue after bounded delivery attempts.`
367
+ : transport.pendingEvents > 0
368
+ ? `${transport.pendingEvents} source-free event${transport.pendingEvents === 1 ? '' : 's'} queued locally (${transport.retryingEvents} retrying, ${transport.pendingSessionSnapshots} session snapshot${transport.pendingSessionSnapshots === 1 ? '' : 's'}, ${transport.pendingApprovalAcks} approval acknowledgement${transport.pendingApprovalAcks === 1 ? '' : 's'}).`
369
+ : transport.lastDeliveredAt
370
+ ? `Outbox empty. Last cloud delivery: ${transport.lastDeliveredAt}.`
371
+ : 'Outbox empty. No live runtime event has needed cloud delivery yet.',
372
+ recommendation: transport.health === 'degraded'
373
+ ? `Inspect the delivery error, then run \`neurcode sync --runtime --retry-dead-letters\`. Last dead-letter error: ${transport.lastDeadLetterError || 'unknown'}`
374
+ : transport.lastError
375
+ ? `Cloud delivery will retry automatically. Last error: ${transport.lastError}`
376
+ : transport.lastRecoveredAt
377
+ ? `Transport recovered after a previous delivery failure at ${transport.lastRecoveredAt}.`
378
+ : undefined,
379
+ });
380
+ const summary = {
381
+ pass: checks.filter((c) => c.status === 'pass').length,
382
+ warn: checks.filter((c) => c.status === 'warn').length,
383
+ fail: checks.filter((c) => c.status === 'fail').length,
384
+ skip: checks.filter((c) => c.status === 'skip').length,
385
+ };
386
+ const payload = {
387
+ ok: summary.fail === 0,
388
+ repoRoot,
389
+ profileStatus: staleness.status,
390
+ restartRequired: liveness.status === 'fail',
391
+ hooks: {
392
+ installed: h.installed,
393
+ stale: h.stale,
394
+ entrypoint: h.entrypoint,
395
+ entrypointExists: h.entrypointExists,
396
+ entrypointPortable: h.entrypointPortable,
397
+ },
398
+ copilotHooks: {
399
+ installed: ch.installed,
400
+ stale: ch.stale,
401
+ hooksPath: ch.hooksPath,
402
+ entrypoint: ch.entrypoint,
403
+ entrypointExists: ch.entrypointExists,
404
+ entrypointPortable: ch.entrypointPortable,
405
+ },
406
+ mcp: {
407
+ configured: activation.mcp.configured,
408
+ present: activation.mcp.present,
409
+ stale: activation.mcp.stale,
410
+ configPath: activation.mcp.configPath,
411
+ entry: activation.mcp.entry,
412
+ expectedEntry: activation.mcp.expectedEntry,
413
+ staleReasons: activation.mcp.staleReasons,
414
+ },
415
+ hookHeartbeat: heartbeat
416
+ ? {
417
+ cliVersion: heartbeat.cliVersion,
418
+ entrypoint: heartbeat.entrypoint,
419
+ entrypointFingerprint: heartbeat.entrypointFingerprint,
420
+ lastEvent: heartbeat.lastEvent,
421
+ events: heartbeat.events,
422
+ matchesInstalled: installedFingerprint
423
+ ? heartbeat.entrypointFingerprint === installedFingerprint
424
+ : null,
425
+ }
426
+ : null,
427
+ agentCompatibility: activeCapability
428
+ ? {
429
+ currentAgent: launcherState?.agent.normalized || null,
430
+ adapter: activeCapability.adapter,
431
+ enforcementLevel: activeCapability.enforcementLevel,
432
+ compatibilityMode: activeCapability.compatibilityMode,
433
+ enforceable: activeCapability.enforceable,
434
+ advisoryOnly: activeCapability.advisoryOnly,
435
+ supervisorSupported: activeCapability.supervisorSupported,
436
+ supervisor: supervisor
437
+ ? {
438
+ effectiveStatus: supervisor.effectiveStatus,
439
+ alive: supervisor.alive,
440
+ statePath: supervisor.statePath,
441
+ lastPass: supervisor.state?.lastPass ?? null,
442
+ lastEvaluatedAt: supervisor.state?.lastEvaluatedAt ?? null,
443
+ lastChangedFiles: supervisor.state?.lastChangedFiles ?? 0,
444
+ }
445
+ : null,
446
+ }
447
+ : null,
448
+ dashboardPairing: connection
449
+ ? {
450
+ repoName: connection.repo.name,
451
+ autoSyncEnabled: connection.autoSync.enabled,
452
+ lastStatus: connection.autoSync.lastStatus || null,
453
+ lastDeliveredAt: transport.lastDeliveredAt || null,
454
+ outboxHealth: transport.health,
455
+ }
456
+ : null,
457
+ checks,
458
+ summary,
459
+ };
460
+ if (options.json) {
461
+ console.log(JSON.stringify(payload, null, 2));
462
+ }
463
+ else {
464
+ console.log('');
465
+ console.log(chalk.bold('Neurcode runtime doctor'));
466
+ console.log(chalk.dim('-'.repeat(64)));
467
+ console.log(`Repo: ${chalk.white(repoRoot)}`);
468
+ console.log('');
469
+ for (const check of checks)
470
+ printCheck(check);
471
+ console.log(chalk.dim('-'.repeat(64)));
472
+ console.log(`Pass ${summary.pass} | Warn ${summary.warn} | Fail ${summary.fail} | Skip ${summary.skip}`);
473
+ console.log('');
474
+ }
475
+ if (summary.fail > 0)
476
+ process.exitCode = 1;
477
+ }
478
+ //# sourceMappingURL=runtime-doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-doctor.js","sourceRoot":"","sources":["../../src/commands/runtime-doctor.ts"],"names":[],"mappings":";;AA4EA,oDAgbC;AA5fD,wEAKyC;AACzC,4EAA2E;AAC3E,4EAA8E;AAC9E,0DAMgC;AAChC,oEAAoE;AACpE,4DAA+D;AAC/D,4DAIiC;AAEjC,4EAA4E;AAC5E,SAAS,yBAAyB,CAAC,OAA0B;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,qBAAqB,IAAI,EAAE,CAAC;IAC5D,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,IAAI,KAAU,CAAC;AACf,IAAI,CAAC;IAAC,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAAC,CAAC;AAAC,MAAM,CAAC;IACvC,KAAK,GAAG;QACN,KAAK,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC;QACvB,MAAM,EA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
+ runtime?: boolean;
4
+ since?: string;
5
+ format?: string;
6
+ out?: string;
7
+ dir?: string;
8
+ json?: boolean;
9
+ }
10
+ export declare function runtimeReportCommand(options?: RuntimeReportOptions): void;
11
+ export declare function reportCommand(program: Command): void;
12
+ export {};
13
+ //# sourceMappingURL=runtime-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-report.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBzC,UAAU,oBAAoB;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,oBAAyB,GAAG,IAAI,CAwC7E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoBpD"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runtimeReportCommand = runtimeReportCommand;
4
+ exports.reportCommand = reportCommand;
5
+ const fs_1 = require("fs");
6
+ const runtime_evidence_1 = require("../utils/runtime-evidence");
7
+ const v0_governance_1 = require("../utils/v0-governance");
8
+ let chalk;
9
+ try {
10
+ chalk = require('chalk');
11
+ }
12
+ catch {
13
+ chalk = {
14
+ green: (s) => s,
15
+ red: (s) => s,
16
+ yellow: (s) => s,
17
+ dim: (s) => s,
18
+ };
19
+ }
20
+ function runtimeReportCommand(options = {}) {
21
+ if (options.runtime !== true) {
22
+ const message = 'Only runtime reports are supported in V0.2. Run `neurcode report --runtime`.';
23
+ if (options.json || options.format === 'json') {
24
+ console.log(JSON.stringify({ ok: false, error: message }, null, 2));
25
+ }
26
+ else {
27
+ console.error(chalk.yellow(message));
28
+ }
29
+ process.exitCode = 2;
30
+ return;
31
+ }
32
+ try {
33
+ const repoRoot = (0, v0_governance_1.resolveRepoRoot)(options.dir || process.cwd());
34
+ const report = (0, runtime_evidence_1.buildRuntimeEvidenceReport)(repoRoot, { since: options.since });
35
+ const format = options.json ? 'json' : (options.format || 'markdown').toLowerCase();
36
+ if (format !== 'json' && format !== 'markdown') {
37
+ throw new Error(`Unsupported report format "${format}". Use markdown or json.`);
38
+ }
39
+ const body = format === 'json'
40
+ ? JSON.stringify({ ok: true, ...report }, null, 2) + '\n'
41
+ : (0, runtime_evidence_1.renderRuntimeEvidenceMarkdown)(report);
42
+ if (options.out) {
43
+ (0, fs_1.writeFileSync)(options.out, body, 'utf8');
44
+ console.log(chalk.green(`Runtime report written to ${options.out}`));
45
+ return;
46
+ }
47
+ process.stdout.write(body);
48
+ }
49
+ catch (error) {
50
+ const message = error instanceof Error ? error.message : String(error);
51
+ if (options.json || options.format === 'json') {
52
+ console.log(JSON.stringify({ ok: false, error: message }, null, 2));
53
+ }
54
+ else {
55
+ console.error(chalk.red(`Runtime report failed: ${message}`));
56
+ }
57
+ process.exitCode = 1;
58
+ }
59
+ }
60
+ function reportCommand(program) {
61
+ program
62
+ .command('report')
63
+ .description('Generate local governance evidence reports')
64
+ .option('--runtime', 'Generate a report from local in-flow governance sessions')
65
+ .option('--since <duration>', 'Limit to sessions with events in the window, e.g. 24h, 7d, 2w')
66
+ .option('--format <format>', 'Output format: markdown | json', 'markdown')
67
+ .option('--out <path>', 'Write report to a file')
68
+ .option('--dir <path>', 'Repository root (default: current directory)')
69
+ .option('--json', 'Alias for --format json')
70
+ .action((options) => {
71
+ runtimeReportCommand({
72
+ runtime: options.runtime === true,
73
+ since: options.since,
74
+ format: options.format,
75
+ out: options.out,
76
+ dir: options.dir,
77
+ json: options.json === true,
78
+ });
79
+ });
80
+ }
81
+ //# sourceMappingURL=runtime-report.js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EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,OAAgB;IAC5C,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,4CAA4C,CAAC;SACzD,MAAM,CAAC,WAAW,EAAE,0DAA0D,CAAC;SAC/E,MAAM,CAAC,oBAAoB,EAAE,+DAA+D,CAAC;SAC7F,MAAM,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,UAAU,CAAC;SACzE,MAAM,CAAC,cAAc,EAAE,wBAAwB,CAAC;SAChD,MAAM,CAAC,cAAc,EAAE,8CAA8C,CAAC;SACtE,MAAM,CAAC,QAAQ,EAAE,yBAAyB,CAAC;SAC3C,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;QAClB,oBAAoB,CAAC;YACnB,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI;YACjC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Command } from 'commander';
2
+ import { type RuntimeEvidenceUploadRequest } from '../api-client';
3
+ import { type LocalGovernanceSessionRecord } from '../utils/runtime-evidence';
4
+ interface RuntimeSyncOptions {
5
+ runtime?: boolean;
6
+ dryRun?: boolean;
7
+ since?: string;
8
+ includeActive?: boolean;
9
+ retryDeadLetters?: boolean;
10
+ dir?: string;
11
+ json?: boolean;
12
+ }
13
+ export declare function buildRuntimeEvidenceUploadBatches(repoRoot: string, records: LocalGovernanceSessionRecord[]): RuntimeEvidenceUploadRequest[];
14
+ export declare function runtimeSyncCommand(options?: RuntimeSyncOptions): Promise<void>;
15
+ export declare function syncCommand(program: Command): void;
16
+ export {};
17
+ //# sourceMappingURL=runtime-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-sync.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,OAAO,EAAa,KAAK,4BAA4B,EAAsC,MAAM,eAAe,CAAC;AAEjH,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,2BAA2B,CAAC;AA4BnC,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AA8XD,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,4BAA4B,EAAE,GACtC,4BAA4B,EAAE,CAiBhC;AAgDD,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoMxF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoBlD"}