@mozole/cli 1.3.1 → 1.4.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 (88) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +52 -168
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +31 -45
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/adopt.d.ts +1 -0
  7. package/dist/commands/adopt.d.ts.map +1 -1
  8. package/dist/commands/adopt.js +192 -23
  9. package/dist/commands/adopt.js.map +1 -1
  10. package/dist/commands/doctor.d.ts.map +1 -1
  11. package/dist/commands/doctor.js +312 -271
  12. package/dist/commands/doctor.js.map +1 -1
  13. package/dist/commands/logs.d.ts.map +1 -1
  14. package/dist/commands/logs.js +10 -3
  15. package/dist/commands/logs.js.map +1 -1
  16. package/dist/commands/new.d.ts +7 -4
  17. package/dist/commands/new.d.ts.map +1 -1
  18. package/dist/commands/new.js +39 -26
  19. package/dist/commands/new.js.map +1 -1
  20. package/dist/commands/qa.d.ts.map +1 -1
  21. package/dist/commands/qa.js +18 -12
  22. package/dist/commands/qa.js.map +1 -1
  23. package/dist/commands/stats.d.ts.map +1 -1
  24. package/dist/commands/stats.js +6 -1
  25. package/dist/commands/stats.js.map +1 -1
  26. package/dist/commands/verify.d.ts.map +1 -1
  27. package/dist/commands/verify.js +12 -8
  28. package/dist/commands/verify.js.map +1 -1
  29. package/dist/config/project.d.ts +8 -7
  30. package/dist/config/project.d.ts.map +1 -1
  31. package/dist/config/project.js +39 -26
  32. package/dist/config/project.js.map +1 -1
  33. package/dist/context/cce.d.ts +0 -7
  34. package/dist/context/cce.d.ts.map +1 -1
  35. package/dist/context/cce.js +12 -43
  36. package/dist/context/cce.js.map +1 -1
  37. package/dist/governor/fingerprint.d.ts.map +1 -1
  38. package/dist/governor/fingerprint.js +38 -20
  39. package/dist/governor/fingerprint.js.map +1 -1
  40. package/dist/governor/hook.d.ts +2 -1
  41. package/dist/governor/hook.d.ts.map +1 -1
  42. package/dist/governor/hook.js +20 -11
  43. package/dist/governor/hook.js.map +1 -1
  44. package/dist/platform/executable.d.ts.map +1 -1
  45. package/dist/platform/executable.js +12 -4
  46. package/dist/platform/executable.js.map +1 -1
  47. package/dist/platform/process.d.ts.map +1 -1
  48. package/dist/platform/process.js +46 -66
  49. package/dist/platform/process.js.map +1 -1
  50. package/dist/qa/diff.d.ts +3 -3
  51. package/dist/qa/diff.d.ts.map +1 -1
  52. package/dist/qa/diff.js +13 -1
  53. package/dist/qa/diff.js.map +1 -1
  54. package/dist/qa/runner.d.ts +9 -9
  55. package/dist/qa/runner.d.ts.map +1 -1
  56. package/dist/qa/runner.js +46 -23
  57. package/dist/qa/runner.js.map +1 -1
  58. package/dist/qa/server.d.ts.map +1 -1
  59. package/dist/qa/server.js +6 -1
  60. package/dist/qa/server.js.map +1 -1
  61. package/dist/scaffold/backend.d.ts +9 -0
  62. package/dist/scaffold/backend.d.ts.map +1 -0
  63. package/dist/scaffold/backend.js +224 -0
  64. package/dist/scaffold/backend.js.map +1 -0
  65. package/dist/scaffold/standalone.d.ts +6 -0
  66. package/dist/scaffold/standalone.d.ts.map +1 -0
  67. package/dist/scaffold/standalone.js +270 -0
  68. package/dist/scaffold/standalone.js.map +1 -0
  69. package/dist/scaffold/templates.d.ts +1 -1
  70. package/dist/scaffold/templates.d.ts.map +1 -1
  71. package/dist/scaffold/templates.js +122 -81
  72. package/dist/scaffold/templates.js.map +1 -1
  73. package/dist/scaffold/write.d.ts.map +1 -1
  74. package/dist/scaffold/write.js +19 -5
  75. package/dist/scaffold/write.js.map +1 -1
  76. package/dist/telemetry/store.js +7 -3
  77. package/dist/telemetry/store.js.map +1 -1
  78. package/dist/verify/runner.d.ts.map +1 -1
  79. package/dist/verify/runner.js +15 -17
  80. package/dist/verify/runner.js.map +1 -1
  81. package/dist/version.d.ts +2 -2
  82. package/dist/version.js +1 -1
  83. package/docs/agent-audit.md +24 -0
  84. package/package.json +7 -2
  85. package/dist/scaffold/admin.d.ts +0 -8
  86. package/dist/scaffold/admin.d.ts.map +0 -1
  87. package/dist/scaffold/admin.js +0 -45
  88. package/dist/scaffold/admin.js.map +0 -1
@@ -8,7 +8,7 @@ import { inspectAntigravityWorkspace } from "../integrations/antigravity.js";
8
8
  import { resolveExecutable } from "../platform/executable.js";
9
9
  import { run } from "../platform/process.js";
10
10
  import { TaskProgress } from "../progress.js";
11
- import { inspectAdminScaffold } from "../scaffold/admin.js";
11
+ import { inspectBackendScaffold } from "../scaffold/backend.js";
12
12
  async function executable(name, args = ["--version"], required = false) {
13
13
  const resolved = await resolveExecutable(name);
14
14
  if (!resolved)
@@ -49,301 +49,342 @@ export async function doctorCommand(cwd, output = console, options = {}) {
49
49
  output,
50
50
  onUpdate: options.onProgress,
51
51
  });
52
- progress.step("Probing platform & runtime executables", "Node, npm, Git");
53
- const node = await executable("node", ["--version"], true);
54
- const nodeMajor = Number(node.value?.match(/\d+/)?.[0] ?? 0);
55
- node.healthy = node.healthy && nodeMajor >= 22;
56
- const npm = await executable("npm", ["--version"], true);
57
- const git = await executable("git");
58
- progress.logVerbose(`Node: ${node.value}, npm: ${npm.value}, git: ${git.value}`);
59
- progress.step("Probing AI agent toolchains", "Codex, Claude Code, Antigravity");
60
- const codex = await executable("codex");
61
- const claude = await executable("claude");
62
- const antigravityPath = await detectAntigravityRuntime();
63
- let antigravity = {
64
- group: "Agents",
65
- name: "Antigravity",
66
- healthy: false,
67
- value: "optional runtime not found",
68
- required: false,
69
- };
70
- if (antigravityPath) {
71
- const result = await run(antigravityPath, ["--version"], {
72
- cwd,
73
- timeoutMs: 5_000,
74
- });
75
- antigravity = {
52
+ try {
53
+ const selectedConfig = await findProjectRoot(cwd)
54
+ .then(readConfig)
55
+ .catch(() => undefined);
56
+ const plain = selectedConfig !== undefined && !selectedConfig.cce?.enabled;
57
+ progress.step("Probing platform & runtime executables", "Node, npm, Git");
58
+ const node = await executable("node", ["--version"], true);
59
+ const nodeMajor = Number(node.value?.match(/\d+/)?.[0] ?? 0);
60
+ node.healthy = node.healthy && nodeMajor >= 22;
61
+ const npm = await executable("npm", ["--version"], true);
62
+ const git = await executable("git");
63
+ progress.logVerbose(`Node: ${node.value}, npm: ${npm.value}, git: ${git.value}`);
64
+ progress.step("Probing AI agent toolchains", "Codex, Claude Code, Antigravity");
65
+ const codex = plain
66
+ ? { healthy: true, required: false }
67
+ : await executable("codex");
68
+ const claude = plain
69
+ ? { healthy: true, required: false }
70
+ : await executable("claude");
71
+ const antigravityPath = plain
72
+ ? undefined
73
+ : await detectAntigravityRuntime();
74
+ let antigravity = {
76
75
  group: "Agents",
77
76
  name: "Antigravity",
78
- healthy: result.exitCode === 0,
79
- value: (result.stdout || result.stderr).trim().split(/\r?\n/)[0],
77
+ healthy: false,
78
+ value: "optional runtime not found",
80
79
  required: false,
81
80
  };
82
- }
83
- progress.logVerbose(`Agents: Codex=${codex.healthy}, Claude=${claude.healthy}, Antigravity=${antigravity.healthy}`);
84
- progress.step("Verifying headless browser environment", "Chromium");
85
- progress.logVerbose("Checking Playwright Chromium executable");
86
- const cceInspection = await inspectCceRuntime(resolveExecutable, cwd);
87
- const cceRuntime = cceInspection.runtime;
88
- const cceDiagnostic = {
89
- group: "Context",
90
- name: "CCE runtime",
91
- healthy: cceInspection.healthy,
92
- value: cceInspection.value,
93
- required: false,
94
- };
95
- const diagnostics = [
96
- {
97
- group: "Platform",
98
- name: "OS",
99
- healthy: true,
100
- value: os.platform(),
101
- required: true,
102
- },
103
- {
104
- group: "Platform",
105
- name: "Architecture",
106
- healthy: true,
107
- value: os.arch(),
108
- required: true,
109
- },
110
- { ...node, group: "Runtime", name: "Node" },
111
- { ...npm, group: "Runtime", name: "npm" },
112
- { ...git, group: "Runtime", name: "Git" },
113
- { ...codex, group: "Agents", name: "Codex", required: false },
114
- { ...claude, group: "Agents", name: "Claude Code", required: false },
115
- antigravity,
116
- ];
117
- try {
118
- await access(chromium.executablePath());
119
- diagnostics.push({
120
- group: "Browser",
121
- name: "Chromium",
122
- healthy: true,
123
- required: true,
124
- });
125
- }
126
- catch {
127
- diagnostics.push({
128
- group: "Browser",
129
- name: "Chromium",
130
- healthy: false,
131
- required: true,
132
- });
133
- }
134
- try {
135
- progress.step("Inspecting project structure & dependencies", "package.json, configs");
136
- const root = await findProjectRoot(cwd);
137
- const mozoleConfig = await readConfig(root);
138
- const antigravityWorkspace = await inspectAntigravityWorkspace(root);
139
- progress.logVerbose(`Found project root: ${root}`);
140
- progress.step("Testing context retrieval & workspace integration", "CCE index, MCP & retrieval probe");
141
- const cceRequired = mozoleConfig.cce.enabled;
142
- let indexHealthy = !mozoleConfig.cce.enabled;
143
- let indexValue;
144
- if (mozoleConfig.cce.enabled) {
145
- if (cceDiagnostic.healthy && cceRuntime) {
146
- progress.logVerbose("Checking CCE status");
147
- const status = await run(cceRuntime.command, [...cceRuntime.prefix, "status"], { cwd: root, timeoutMs: 5_000 });
148
- if (status.signal === "SIGTERM" || status.signal === "SIGKILL") {
149
- indexHealthy = false;
150
- indexValue = "timed out";
151
- }
152
- else {
153
- const statusText = `${status.stdout}\n${status.stderr}`;
154
- if (isBrokenUvTrampoline(statusText)) {
81
+ if (antigravityPath) {
82
+ const result = await run(antigravityPath, ["--version"], {
83
+ cwd,
84
+ timeoutMs: 5_000,
85
+ });
86
+ antigravity = {
87
+ group: "Agents",
88
+ name: "Antigravity",
89
+ healthy: result.exitCode === 0,
90
+ value: (result.stdout || result.stderr).trim().split(/\r?\n/)[0],
91
+ required: false,
92
+ };
93
+ }
94
+ progress.logVerbose(`Agents: Codex=${codex.healthy}, Claude=${claude.healthy}, Antigravity=${antigravity.healthy}`);
95
+ progress.step("Verifying headless browser environment", "Chromium");
96
+ progress.logVerbose("Checking Playwright Chromium executable");
97
+ const cceInspection = plain
98
+ ? {
99
+ healthy: false,
100
+ value: "disabled",
101
+ runtime: undefined,
102
+ brokenTrampoline: false,
103
+ }
104
+ : await inspectCceRuntime(resolveExecutable, cwd);
105
+ const cceRuntime = cceInspection.runtime;
106
+ const cceDiagnostic = {
107
+ group: "Context",
108
+ name: "CCE runtime",
109
+ healthy: cceInspection.healthy,
110
+ value: cceInspection.value,
111
+ required: false,
112
+ };
113
+ const diagnostics = [
114
+ {
115
+ group: "Platform",
116
+ name: "OS",
117
+ healthy: true,
118
+ value: os.platform(),
119
+ required: true,
120
+ },
121
+ {
122
+ group: "Platform",
123
+ name: "Architecture",
124
+ healthy: true,
125
+ value: os.arch(),
126
+ required: true,
127
+ },
128
+ { ...node, group: "Runtime", name: "Node" },
129
+ { ...npm, group: "Runtime", name: "npm" },
130
+ { ...git, group: "Runtime", name: "Git" },
131
+ { ...codex, group: "Agents", name: "Codex", required: false },
132
+ { ...claude, group: "Agents", name: "Claude Code", required: false },
133
+ antigravity,
134
+ ];
135
+ try {
136
+ await access(chromium.executablePath());
137
+ diagnostics.push({
138
+ group: "Browser",
139
+ name: "Chromium",
140
+ healthy: true,
141
+ required: true,
142
+ });
143
+ }
144
+ catch {
145
+ diagnostics.push({
146
+ group: "Browser",
147
+ name: "Chromium",
148
+ healthy: false,
149
+ required: true,
150
+ });
151
+ }
152
+ try {
153
+ progress.step("Inspecting project structure & dependencies", "package.json, configs");
154
+ const root = await findProjectRoot(cwd);
155
+ const mozoleConfig = await readConfig(root);
156
+ const antigravityWorkspace = await inspectAntigravityWorkspace(root);
157
+ progress.logVerbose(`Found project root: ${root}`);
158
+ progress.step("Testing context retrieval & workspace integration", "CCE index, MCP & retrieval probe");
159
+ const cceRequired = Boolean(mozoleConfig.cce?.enabled);
160
+ let indexHealthy = !mozoleConfig.cce?.enabled;
161
+ let indexValue;
162
+ if (mozoleConfig.cce?.enabled) {
163
+ if (cceDiagnostic.healthy && cceRuntime) {
164
+ progress.logVerbose("Checking CCE status");
165
+ const status = await run(cceRuntime.command, [...cceRuntime.prefix, "status"], { cwd: root, timeoutMs: 5_000 });
166
+ if (status.signal === "SIGTERM" || status.signal === "SIGKILL") {
155
167
  indexHealthy = false;
156
- indexValue = "uv trampoline broken";
168
+ indexValue = "timed out";
157
169
  }
158
170
  else {
159
- indexHealthy =
160
- status.exitCode === 0 &&
161
- !statusText.includes("Project not indexed yet") &&
162
- !statusText.includes("Not indexed yet") &&
163
- mozoleConfig.cce.initialized;
164
- if (!indexHealthy) {
165
- indexValue = "not indexed";
171
+ const statusText = `${status.stdout}\n${status.stderr}`;
172
+ if (isBrokenUvTrampoline(statusText)) {
173
+ indexHealthy = false;
174
+ indexValue = "uv trampoline broken";
175
+ }
176
+ else {
177
+ indexHealthy =
178
+ status.exitCode === 0 &&
179
+ !statusText.includes("Project not indexed yet") &&
180
+ !statusText.includes("Not indexed yet") &&
181
+ mozoleConfig.cce.initialized;
182
+ if (!indexHealthy) {
183
+ indexValue = "not indexed";
184
+ }
166
185
  }
167
186
  }
168
187
  }
188
+ else {
189
+ indexHealthy = false;
190
+ indexValue = cceInspection.brokenTrampoline
191
+ ? "uv trampoline broken"
192
+ : "cce unavailable";
193
+ }
169
194
  }
170
- else {
171
- indexHealthy = false;
172
- indexValue = cceInspection.brokenTrampoline
173
- ? "uv trampoline broken"
174
- : "cce unavailable";
195
+ let mcpHealthy = !mozoleConfig.cce?.enabled;
196
+ let mcpValue;
197
+ if (mozoleConfig.cce?.enabled) {
198
+ mcpHealthy = antigravityWorkspace.cceMcp;
199
+ if (!mcpHealthy)
200
+ mcpValue = "not configured";
175
201
  }
176
- }
177
- let mcpHealthy = !mozoleConfig.cce.enabled;
178
- let mcpValue;
179
- if (mozoleConfig.cce.enabled) {
180
- mcpHealthy = antigravityWorkspace.cceMcp;
181
- if (!mcpHealthy)
182
- mcpValue = "not configured";
183
- }
184
- let retrievalHealthy = !mozoleConfig.cce.enabled;
185
- let retrievalValue;
186
- if (mozoleConfig.cce.enabled) {
187
- if (!cceDiagnostic.healthy || !cceRuntime) {
188
- retrievalHealthy = false;
189
- retrievalValue = cceInspection.brokenTrampoline
190
- ? "uv trampoline broken"
191
- : "cce unavailable";
202
+ let retrievalHealthy = !mozoleConfig.cce?.enabled;
203
+ let retrievalValue;
204
+ if (mozoleConfig.cce?.enabled) {
205
+ if (!cceDiagnostic.healthy || !cceRuntime) {
206
+ retrievalHealthy = false;
207
+ retrievalValue = cceInspection.brokenTrampoline
208
+ ? "uv trampoline broken"
209
+ : "cce unavailable";
210
+ }
211
+ else if (!indexHealthy) {
212
+ retrievalHealthy = false;
213
+ retrievalValue = indexValue ?? "not indexed";
214
+ }
215
+ else {
216
+ progress.logVerbose("Probing CCE retrieval");
217
+ const probe = await probeCceRetrieval(root, cceRuntime, 5_000);
218
+ retrievalHealthy = probe.healthy;
219
+ retrievalValue = probe.value;
220
+ }
192
221
  }
193
- else if (!indexHealthy) {
194
- retrievalHealthy = false;
195
- retrievalValue = indexValue ?? "not indexed";
222
+ diagnostics.push({
223
+ group: "Context",
224
+ name: "CCE runtime",
225
+ healthy: cceDiagnostic.healthy,
226
+ value: cceDiagnostic.value,
227
+ required: cceRequired,
228
+ });
229
+ diagnostics.push({
230
+ group: "Context",
231
+ name: "CCE index",
232
+ healthy: indexHealthy,
233
+ value: indexValue,
234
+ required: cceRequired,
235
+ });
236
+ diagnostics.push({
237
+ group: "Context",
238
+ name: "CCE MCP",
239
+ healthy: mcpHealthy,
240
+ value: mcpValue,
241
+ required: cceRequired,
242
+ });
243
+ diagnostics.push({
244
+ group: "Context",
245
+ name: "CCE retrieval",
246
+ healthy: retrievalHealthy,
247
+ value: retrievalValue,
248
+ required: cceRequired,
249
+ });
250
+ let pkg = {};
251
+ let pkgError;
252
+ try {
253
+ pkg = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
196
254
  }
197
- else {
198
- progress.logVerbose("Probing CCE retrieval");
199
- const probe = await probeCceRetrieval(root, cceRuntime, 5_000);
200
- retrievalHealthy = probe.healthy;
201
- retrievalValue = probe.value;
255
+ catch (error) {
256
+ pkgError =
257
+ error instanceof SyntaxError
258
+ ? "invalid package.json"
259
+ : "missing package.json";
202
260
  }
203
- }
204
- diagnostics.push({
205
- group: "Context",
206
- name: "CCE runtime",
207
- healthy: cceDiagnostic.healthy,
208
- value: cceDiagnostic.value,
209
- required: cceRequired,
210
- });
211
- diagnostics.push({
212
- group: "Context",
213
- name: "CCE index",
214
- healthy: indexHealthy,
215
- value: indexValue,
216
- required: cceRequired,
217
- });
218
- diagnostics.push({
219
- group: "Context",
220
- name: "CCE MCP",
221
- healthy: mcpHealthy,
222
- value: mcpValue,
223
- required: cceRequired,
224
- });
225
- diagnostics.push({
226
- group: "Context",
227
- name: "CCE retrieval",
228
- healthy: retrievalHealthy,
229
- value: retrievalValue,
230
- required: cceRequired,
231
- });
232
- const pkg = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
233
- const hasReactRouter = Boolean(packageVersion(pkg, "react-router") ||
234
- packageVersion(pkg, "@react-router/dev"));
235
- const hasVite = Boolean(packageVersion(pkg, "vite") ||
236
- packageVersion(pkg, "@vitejs/plugin-react"));
237
- for (const [label, key, required, opt] of [
238
- [
239
- "React Router",
240
- "react-router",
241
- hasReactRouter || !hasVite,
242
- !hasReactRouter && hasVite,
243
- ],
244
- ["React", "react", true, false],
245
- ["Vite", "vite", hasVite || !hasReactRouter, false],
246
- ["TypeScript", "typescript", true, false],
247
- ["Biome", "@biomejs/biome", true, false],
248
- ["Vitest", "vitest", true, false],
249
- ])
261
+ const hasReactRouter = Boolean(packageVersion(pkg, "react-router") ||
262
+ packageVersion(pkg, "@react-router/dev"));
263
+ const hasVite = Boolean(packageVersion(pkg, "vite") ||
264
+ packageVersion(pkg, "@vitejs/plugin-react"));
265
+ for (const [label, key, required, opt] of [
266
+ [
267
+ "React Router",
268
+ "react-router",
269
+ hasReactRouter || !hasVite,
270
+ !hasReactRouter && hasVite,
271
+ ],
272
+ ["React", "react", true, false],
273
+ ["Vite", "vite", hasVite || !hasReactRouter, false],
274
+ ["TypeScript", "typescript", true, false],
275
+ ["Biome", "@biomejs/biome", true, false],
276
+ ["Vitest", "vitest", true, false],
277
+ ])
278
+ diagnostics.push({
279
+ group: "Project",
280
+ name: label,
281
+ healthy: Boolean(packageVersion(pkg, key)),
282
+ value: packageVersion(pkg, key) ?? (opt ? "optional" : undefined),
283
+ required,
284
+ });
250
285
  diagnostics.push({
251
286
  group: "Project",
252
- name: label,
253
- healthy: Boolean(packageVersion(pkg, key)),
254
- value: packageVersion(pkg, key) ?? (opt ? "optional" : undefined),
255
- required,
287
+ name: "Mozole metadata",
288
+ healthy: !pkgError,
289
+ value: pkgError,
290
+ required: true,
256
291
  });
257
- diagnostics.push({
258
- group: "Project",
259
- name: "Mozole metadata",
260
- healthy: true,
261
- required: true,
262
- });
263
- const admin = await inspectAdminScaffold(root, mozoleConfig);
264
- diagnostics.push({
265
- group: "Project",
266
- name: "Admin runtime",
267
- healthy: admin.healthy,
268
- value: admin.detail,
269
- required: admin.enabled,
270
- });
271
- for (const [name, healthy] of [
272
- ["Workspace", antigravityWorkspace.workspace],
273
- ["CCE MCP", antigravityWorkspace.cceMcp],
274
- ["Rule", antigravityWorkspace.rule],
275
- ["Workflows", antigravityWorkspace.workflows],
276
- ])
292
+ const backend = await inspectBackendScaffold(root, mozoleConfig);
277
293
  diagnostics.push({
278
- group: "Antigravity",
279
- name,
280
- healthy,
281
- value: !healthy && name === "Workspace"
282
- ? antigravityWorkspace.detail
283
- : undefined,
284
- required: false,
294
+ group: "Project",
295
+ name: "PHP Backend",
296
+ healthy: backend.healthy,
297
+ value: backend.detail,
298
+ required: backend.enabled,
285
299
  });
286
- diagnostics.push({
287
- group: "Governor",
288
- name: "State cache",
289
- healthy: mozoleConfig.governor.enabled,
290
- value: mozoleConfig.governor.enabled
291
- ? mozoleConfig.governor.mode
292
- : "disabled",
293
- required: mozoleConfig.governor.enabled,
294
- });
295
- for (const [name, relative, enabled] of [
296
- [
297
- "Codex hook",
298
- [".codex", "hooks.json"],
299
- mozoleConfig.governor.hooks.codex,
300
- ],
301
- [
302
- "Claude hook",
303
- [".claude", "settings.json"],
304
- mozoleConfig.governor.hooks.claude,
305
- ],
306
- ]) {
307
- let installed = !enabled;
308
- try {
309
- installed = (await readFile(path.join(root, ...relative), "utf8")).includes("mozole governor hook");
310
- }
311
- catch { }
300
+ for (const [name, healthy] of [
301
+ ["Workspace", antigravityWorkspace.workspace],
302
+ ["CCE MCP", antigravityWorkspace.cceMcp],
303
+ ["Rule", antigravityWorkspace.rule],
304
+ ["Workflows", antigravityWorkspace.workflows],
305
+ ])
306
+ diagnostics.push({
307
+ group: "Antigravity",
308
+ name,
309
+ healthy,
310
+ value: !healthy && name === "Workspace"
311
+ ? antigravityWorkspace.detail
312
+ : undefined,
313
+ required: false,
314
+ });
312
315
  diagnostics.push({
313
316
  group: "Governor",
314
- name,
315
- healthy: installed,
316
- required: enabled,
317
+ name: "State cache",
318
+ healthy: Boolean(mozoleConfig.governor?.enabled),
319
+ value: mozoleConfig.governor?.enabled
320
+ ? mozoleConfig.governor.mode
321
+ : "disabled",
322
+ required: Boolean(mozoleConfig.governor?.enabled),
317
323
  });
324
+ for (const [name, relative, enabled] of [
325
+ [
326
+ "Codex hook",
327
+ [".codex", "hooks.json"],
328
+ Boolean(mozoleConfig.governor?.hooks.codex),
329
+ ],
330
+ [
331
+ "Claude hook",
332
+ [".claude", "settings.json"],
333
+ Boolean(mozoleConfig.governor?.hooks.claude),
334
+ ],
335
+ ]) {
336
+ let installed = !enabled;
337
+ try {
338
+ installed = (await readFile(path.join(root, ...relative), "utf8")).includes("mozole governor hook");
339
+ }
340
+ catch { }
341
+ diagnostics.push({
342
+ group: "Governor",
343
+ name,
344
+ healthy: installed,
345
+ required: enabled,
346
+ });
347
+ }
318
348
  }
319
- }
320
- catch {
321
- diagnostics.push(cceDiagnostic);
322
- diagnostics.push({
323
- group: "Project",
324
- name: "Mozole project",
325
- healthy: false,
326
- value: "not found",
327
- required: false,
328
- });
329
- }
330
- let current = "";
331
- const lines = ["Mozole", ""];
332
- for (const item of diagnostics) {
333
- if (item.group !== current) {
334
- if (current)
335
- lines.push("");
336
- current = item.group;
337
- lines.push(current);
349
+ catch {
350
+ diagnostics.push(cceDiagnostic);
351
+ diagnostics.push({
352
+ group: "Project",
353
+ name: "Mozole project",
354
+ healthy: false,
355
+ value: "not found",
356
+ required: false,
357
+ });
358
+ }
359
+ if (plain) {
360
+ for (let index = diagnostics.length - 1; index >= 0; index--) {
361
+ if (["Context", "Governor", "Antigravity", "Agents"].includes(diagnostics[index]?.group ?? ""))
362
+ diagnostics.splice(index, 1);
363
+ }
364
+ }
365
+ let current = "";
366
+ const lines = ["Mozole", ""];
367
+ for (const item of diagnostics) {
368
+ if (item.group !== current) {
369
+ if (current)
370
+ lines.push("");
371
+ current = item.group;
372
+ lines.push(current);
373
+ }
374
+ lines.push(` ${item.name.padEnd(16)} ${item.healthy ? "✓" : "✗"}${item.value ? ` ${item.value}` : ""}`);
338
375
  }
339
- lines.push(` ${item.name.padEnd(16)} ${item.healthy ? "✓" : "✗"}${item.value ? ` ${item.value}` : ""}`);
376
+ const healthy = diagnostics
377
+ .filter((item) => item.required)
378
+ .every((item) => item.healthy);
379
+ lines.push("", `Status: ${healthy ? "HEALTHY" : "NEEDS ATTENTION"}`);
380
+ progress.done();
381
+ output.log(lines.join("\n"));
382
+ return healthy ? 0 : 1;
383
+ }
384
+ catch (error) {
385
+ progress.done();
386
+ output.error(`DOCTOR FAIL\n\n${error instanceof Error ? error.message : String(error)}`);
387
+ return 2;
340
388
  }
341
- const healthy = diagnostics
342
- .filter((item) => item.required)
343
- .every((item) => item.healthy);
344
- lines.push("", `Status: ${healthy ? "HEALTHY" : "NEEDS ATTENTION"}`);
345
- progress.done();
346
- output.log(lines.join("\n"));
347
- return healthy ? 0 : 1;
348
389
  }
349
390
  //# sourceMappingURL=doctor.js.map