@donotdev/cli 0.2.2 → 0.3.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 (64) hide show
  1. package/dependencies-matrix.json +44 -42
  2. package/dist/bin/commands/agent-setup.js +135 -67
  3. package/dist/bin/commands/build.js +352 -234
  4. package/dist/bin/commands/bump.js +385 -257
  5. package/dist/bin/commands/cacheout.js +59 -49
  6. package/dist/bin/commands/coach.js +80 -50
  7. package/dist/bin/commands/create-app.js +501 -228
  8. package/dist/bin/commands/create-project.js +377 -241
  9. package/dist/bin/commands/db-check.js +192804 -0
  10. package/dist/bin/commands/db.js +1889 -1805
  11. package/dist/bin/commands/deploy.js +476 -287
  12. package/dist/bin/commands/dev.js +139 -108
  13. package/dist/bin/commands/doctor.js +91 -57
  14. package/dist/bin/commands/emu.js +196 -154
  15. package/dist/bin/commands/format.js +83 -50
  16. package/dist/bin/commands/get-demo.js +422 -197
  17. package/dist/bin/commands/make-admin.js +835 -713
  18. package/dist/bin/commands/preview.js +139 -108
  19. package/dist/bin/commands/seed.js +2186 -2044
  20. package/dist/bin/commands/setup-cicd.js +258 -204
  21. package/dist/bin/commands/setup.js +890 -339
  22. package/dist/bin/commands/staging.js +476 -287
  23. package/dist/bin/commands/sync-secrets.js +472 -141
  24. package/dist/bin/commands/type-check.js +163 -119
  25. package/dist/bin/commands/wai.js +53 -46
  26. package/dist/bin/dndev.js +32 -7
  27. package/dist/bin/donotdev.js +18 -8
  28. package/dist/index.js +654 -375
  29. package/package.json +2 -2
  30. package/templates/app-demo/index.html.example +1 -1
  31. package/templates/app-dndev/index.html.example +1 -1
  32. package/templates/app-dndev/src/globals.css.example +1 -1
  33. package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  34. package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +1 -1
  35. package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +1 -1
  36. package/templates/app-next/src/app/AppDocument.tsx.example +58 -0
  37. package/templates/app-next/src/app/ClientLayout.tsx.example +6 -2
  38. package/templates/app-next/src/globals.css.example +1 -1
  39. package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  40. package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +1 -1
  41. package/templates/app-next/src/pages/legal/TermsPage.tsx.example +1 -1
  42. package/templates/app-vite/csp.example.json +1 -1
  43. package/templates/app-vite/index.html.example +1 -1
  44. package/templates/app-vite/src/globals.css.example +1 -1
  45. package/templates/app-vite/src/pages/FormPageExample.tsx.example +21 -16
  46. package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +1 -1
  47. package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +1 -1
  48. package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +1 -1
  49. package/templates/deploy-config/vercel.json.example +2 -2
  50. package/templates/functions-supabase/supabase/migrations/20250101000006_crud_bulk_status_guard.sql +258 -0
  51. package/templates/functions-supabase/supabase/migrations/20250101000007_rate_limit_check.sql +76 -0
  52. package/templates/overlay-supabase/src/config/providers.nextjs.ts.example +37 -0
  53. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +3 -3
  54. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +5 -1
  55. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +2 -2
  56. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
  57. package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
  58. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
  59. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +1 -1
  60. package/templates/root-consumer/.gitignore.example +7 -1
  61. package/templates/root-consumer/AGENTS.md.example +25 -2
  62. package/templates/root-consumer/README.md.example +1 -1
  63. package/templates/app-next/src/app/layout.tsx.example +0 -80
  64. package/templates/app-next/src/app/not-found.tsx.example +0 -40
@@ -405,25 +405,29 @@ var init_main = __esm({
405
405
  }
406
406
  });
407
407
 
408
- // node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
409
- var require_src = __commonJS({
410
- "node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
411
- "use strict";
408
+ // node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
409
+ var ESC2, CSI2, cursor, erase, clear;
410
+ var init_dist3 = __esm({
411
+ "node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js"() {
412
412
  init_utils2();
413
- var ESC2 = "\x1B";
414
- var CSI2 = `${ESC2}[`;
415
- var beep = "\x07";
416
- var cursor3 = {
413
+ ESC2 = "\x1B";
414
+ CSI2 = `${ESC2}[`;
415
+ cursor = {
417
416
  to(x, y) {
418
- if (!y) return `${CSI2}${x + 1}G`;
417
+ if (!y)
418
+ return `${CSI2}${x + 1}G`;
419
419
  return `${CSI2}${y + 1};${x + 1}H`;
420
420
  },
421
421
  move(x, y) {
422
422
  let ret = "";
423
- if (x < 0) ret += `${CSI2}${-x}D`;
424
- else if (x > 0) ret += `${CSI2}${x}C`;
425
- if (y < 0) ret += `${CSI2}${-y}A`;
426
- else if (y > 0) ret += `${CSI2}${y}B`;
423
+ if (x < 0)
424
+ ret += `${CSI2}${-x}D`;
425
+ else if (x > 0)
426
+ ret += `${CSI2}${x}C`;
427
+ if (y < 0)
428
+ ret += `${CSI2}${-y}A`;
429
+ else if (y > 0)
430
+ ret += `${CSI2}${y}B`;
427
431
  return ret;
428
432
  },
429
433
  up: (count = 1) => `${CSI2}${count}A`,
@@ -438,11 +442,7 @@ var require_src = __commonJS({
438
442
  save: `${ESC2}7`,
439
443
  restore: `${ESC2}8`
440
444
  };
441
- var scroll = {
442
- up: (count = 1) => `${CSI2}S`.repeat(count),
443
- down: (count = 1) => `${CSI2}T`.repeat(count)
444
- };
445
- var erase3 = {
445
+ erase = {
446
446
  screen: `${CSI2}2J`,
447
447
  up: (count = 1) => `${CSI2}1J`.repeat(count),
448
448
  down: (count = 1) => `${CSI2}J`.repeat(count),
@@ -450,28 +450,31 @@ var require_src = __commonJS({
450
450
  lineEnd: `${CSI2}K`,
451
451
  lineStart: `${CSI2}1K`,
452
452
  lines(count) {
453
- let clear = "";
453
+ let clear2 = "";
454
454
  for (let i2 = 0; i2 < count; i2++)
455
- clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
455
+ clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
456
456
  if (count)
457
- clear += cursor3.left;
458
- return clear;
457
+ clear2 += cursor.left;
458
+ return clear2;
459
459
  }
460
460
  };
461
- module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
461
+ clear = {
462
+ screen: `${ESC2}c`
463
+ };
462
464
  }
463
465
  });
464
466
 
465
- // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
467
+ // node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
466
468
  import { styleText } from "node:util";
467
469
  import { stdout, stdin } from "node:process";
468
470
  import { ReadStream } from "node:tty";
469
- var import_sisteransi, a$1, t, settings, R, getColumns;
470
- var init_dist3 = __esm({
471
- "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
471
+ var a$1, t, settings, R, getColumns;
472
+ var init_dist4 = __esm({
473
+ "node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
472
474
  init_utils2();
473
475
  init_main();
474
- import_sisteransi = __toESM(require_src(), 1);
476
+ init_dist3();
477
+ init_dist2();
475
478
  a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
476
479
  t = [
477
480
  "January",
@@ -521,7 +524,7 @@ var init_dist3 = __esm({
521
524
  }
522
525
  });
523
526
 
524
- // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
527
+ // node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
525
528
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
526
529
  import process$1 from "node:process";
527
530
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -532,17 +535,17 @@ function isUnicodeSupported() {
532
535
  }
533
536
  return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
534
537
  }
535
- var import_sisteransi2, unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, MULTISELECT_INSTRUCTIONS, log, intro, outro, W$1, C, note, u2, SELECT_INSTRUCTIONS, i;
536
- var init_dist4 = __esm({
537
- "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
538
+ var unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, MULTISELECT_INSTRUCTIONS, log, intro, outro, W, C, note, u2, SELECT_INSTRUCTIONS, i;
539
+ var init_dist5 = __esm({
540
+ "node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
538
541
  init_utils2();
539
- init_dist3();
540
- init_dist3();
542
+ init_dist4();
543
+ init_dist4();
541
544
  init_main();
542
545
  init_dist2();
543
- import_sisteransi2 = __toESM(require_src(), 1);
546
+ init_dist3();
544
547
  unicode = isUnicodeSupported();
545
- unicodeOr = (o, e) => unicode ? o : e;
548
+ unicodeOr = (e, o) => unicode ? e : o;
546
549
  S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
547
550
  S_STEP_CANCEL = unicodeOr("\u25A0", "x");
548
551
  S_STEP_ERROR = unicodeOr("\u25B2", "x");
@@ -579,9 +582,9 @@ var init_dist4 = __esm({
579
582
  secondarySymbol: r2 = styleText2("gray", S_BAR),
580
583
  output: m = process.stdout,
581
584
  spacing: l = 1,
582
- withGuide: c
585
+ withGuide: c2
583
586
  } = {}) => {
584
- const t2 = [], o = c ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
587
+ const t2 = [], o = c2 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
585
588
  for (let i2 = 0; i2 < l; i2++)
586
589
  t2.push(f);
587
590
  const g = Array.isArray(s) ? s : s.split(`
@@ -628,18 +631,18 @@ ${styleText2("gray", S_BAR_END)} ` : "";
628
631
 
629
632
  `);
630
633
  };
631
- W$1 = (o) => o;
634
+ W = (o) => o;
632
635
  C = (o, e, s) => {
633
636
  const a2 = {
634
637
  hard: true,
635
638
  trim: false
636
639
  }, i2 = wrapAnsi(o, e, a2).split(`
637
- `), c = i2.reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), u3 = i2.map(s).reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), g = e - (u3 - c);
640
+ `), c2 = i2.reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), u3 = i2.map(s).reduce((n2, t2) => Math.max(dist_default2(t2), n2), 0), g = e - (u3 - c2);
638
641
  return wrapAnsi(o, g, a2);
639
642
  };
640
643
  note = (o = "", e = "", s) => {
641
- const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c).split(`
642
- `).map(c), ""], n2 = dist_default2(e), t2 = Math.max(
644
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W, g = ["", ...C(o, getColumns(a2) - 6, c2).split(`
645
+ `).map(c2), ""], n2 = dist_default2(e), t2 = Math.max(
643
646
  g.reduce((m, F) => {
644
647
  const O = dist_default2(F);
645
648
  return O > m ? O : m;
@@ -719,8 +722,8 @@ var init_cli_output = __esm({
719
722
  "packages/tooling/src/utils/cli-output.ts"() {
720
723
  "use strict";
721
724
  init_utils2();
722
- init_dist4();
723
- init_dist4();
725
+ init_dist5();
726
+ init_dist5();
724
727
  colors = {
725
728
  reset: "\x1B[0m",
726
729
  // Success (green)
@@ -6810,6 +6813,9 @@ import {
6810
6813
  extname
6811
6814
  } from "node:path";
6812
6815
  import { fileURLToPath } from "node:url";
6816
+ function isEexistError(error2) {
6817
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
6818
+ }
6813
6819
  function safeExecuteAsync(fn, message) {
6814
6820
  return fn().catch((error2) => {
6815
6821
  throw new Error(
@@ -7181,7 +7187,7 @@ var init_PathResolver = __esm({
7181
7187
  try {
7182
7188
  await fs.promises.mkdir(dir, { recursive: true });
7183
7189
  } catch (error2) {
7184
- if (error2?.code !== "EEXIST") throw error2;
7190
+ if (!isEexistError(error2)) throw error2;
7185
7191
  }
7186
7192
  const detectedFormat = this._detectFormat(filePath, format);
7187
7193
  let writeContent;
@@ -7243,7 +7249,7 @@ var init_PathResolver = __esm({
7243
7249
  try {
7244
7250
  fs.mkdirSync(dir, { recursive: true });
7245
7251
  } catch (error2) {
7246
- if (error2?.code !== "EEXIST") throw error2;
7252
+ if (!isEexistError(error2)) throw error2;
7247
7253
  }
7248
7254
  const detectedFormat = this._detectFormat(filePath, format);
7249
7255
  let writeContent;
@@ -7300,7 +7306,7 @@ var init_PathResolver = __esm({
7300
7306
  try {
7301
7307
  await fs.promises.mkdir(dir, { recursive: true });
7302
7308
  } catch (error2) {
7303
- if (error2?.code !== "EEXIST") throw error2;
7309
+ if (!isEexistError(error2)) throw error2;
7304
7310
  }
7305
7311
  try {
7306
7312
  return await safeExecuteAsync(async () => {
@@ -7342,7 +7348,7 @@ var init_PathResolver = __esm({
7342
7348
  try {
7343
7349
  fs.mkdirSync(dir, { recursive: true });
7344
7350
  } catch (error2) {
7345
- if (error2?.code !== "EEXIST") throw error2;
7351
+ if (!isEexistError(error2)) throw error2;
7346
7352
  }
7347
7353
  try {
7348
7354
  fs.copyFileSync(srcPath, normalizedDestPath);
@@ -7458,7 +7464,7 @@ var init_PathResolver = __esm({
7458
7464
  try {
7459
7465
  await fs.promises.mkdir(dirPath, { recursive: true });
7460
7466
  } catch (error2) {
7461
- if (error2?.code !== "EEXIST") throw error2;
7467
+ if (!isEexistError(error2)) throw error2;
7462
7468
  }
7463
7469
  }
7464
7470
  /**
@@ -7470,7 +7476,7 @@ var init_PathResolver = __esm({
7470
7476
  try {
7471
7477
  fs.mkdirSync(dirPath, { recursive: true });
7472
7478
  } catch (error2) {
7473
- if (error2?.code !== "EEXIST") throw error2;
7479
+ if (!isEexistError(error2)) throw error2;
7474
7480
  }
7475
7481
  }
7476
7482
  /**
@@ -7719,6 +7725,7 @@ var init_PathResolver = __esm({
7719
7725
  * @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
7720
7726
  * @returns Resolved patterns with absolute paths
7721
7727
  */
7728
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- why: mirrors the public PathResolver.d.ts signature; tightening it is a breaking change (any-audit)
7722
7729
  async resolvePatterns(patternType) {
7723
7730
  if (!constants.getPatternsFor) {
7724
7731
  return { framework: [], consumer: [], all: [] };
@@ -7895,6 +7902,17 @@ var init_pathResolver = __esm({
7895
7902
  }
7896
7903
  });
7897
7904
 
7905
+ // packages/tooling/src/utils/type-guards.ts
7906
+ function isObjectLike(value) {
7907
+ return typeof value === "object" && value !== null;
7908
+ }
7909
+ var init_type_guards = __esm({
7910
+ "packages/tooling/src/utils/type-guards.ts"() {
7911
+ "use strict";
7912
+ init_utils2();
7913
+ }
7914
+ });
7915
+
7898
7916
  // packages/tooling/src/bundler/utils.ts
7899
7917
  import { Buffer as Buffer2 } from "node:buffer";
7900
7918
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
@@ -7922,6 +7940,29 @@ var init_utils2 = __esm({
7922
7940
  }
7923
7941
  });
7924
7942
 
7943
+ // packages/tooling/src/utils/error-handling.ts
7944
+ function isError(error2) {
7945
+ return error2 instanceof Error;
7946
+ }
7947
+ function getErrorMessage(error2) {
7948
+ if (isError(error2)) {
7949
+ return error2.message;
7950
+ }
7951
+ if (typeof error2 === "string") {
7952
+ return error2;
7953
+ }
7954
+ if (error2 && typeof error2 === "object" && "message" in error2) {
7955
+ return String(error2.message);
7956
+ }
7957
+ return String(error2);
7958
+ }
7959
+ var init_error_handling = __esm({
7960
+ "packages/tooling/src/utils/error-handling.ts"() {
7961
+ "use strict";
7962
+ init_utils2();
7963
+ }
7964
+ });
7965
+
7925
7966
  // packages/cli/src/bin/commands/agent-setup.ts
7926
7967
  init_utils2();
7927
7968
 
@@ -7934,6 +7975,8 @@ init_utils2();
7934
7975
  // packages/tooling/src/cli/agent-setup.ts
7935
7976
  init_utils2();
7936
7977
  init_cli_output();
7978
+ init_error_handling();
7979
+ init_type_guards();
7937
7980
  init_pathResolver();
7938
7981
  var mcpConfig = {
7939
7982
  command: "bunx",
@@ -7942,12 +7985,25 @@ var mcpConfig = {
7942
7985
  function readJsonConfig(filePath, fallback) {
7943
7986
  try {
7944
7987
  if (pathExists(filePath)) {
7945
- return readSync(filePath, { format: "json" });
7988
+ const content = readSync(filePath, { format: "json" });
7989
+ return content;
7946
7990
  }
7947
7991
  } catch {
7948
7992
  }
7949
7993
  return fallback;
7950
7994
  }
7995
+ function setMcpServer(config, filePath, name, server) {
7996
+ if (!isObjectLike(config)) {
7997
+ throw new Error(`Invalid JSON config: ${filePath}`);
7998
+ }
7999
+ const servers = config.mcpServers || {};
8000
+ if (!isObjectLike(servers)) {
8001
+ throw new Error(`Invalid "mcpServers" in ${filePath}`);
8002
+ }
8003
+ config.mcpServers = servers;
8004
+ servers[name] = server;
8005
+ return config;
8006
+ }
7951
8007
  function writeJsonConfig(filePath, data) {
7952
8008
  ensureDirSync(getDirname(filePath));
7953
8009
  writeSync(filePath, data, { overwrite: true });
@@ -7963,13 +8019,16 @@ async function main(options = {}) {
7963
8019
  note(`[DRY RUN] Would write ${mcpJsonPath}`, "Claude Code");
7964
8020
  } else {
7965
8021
  try {
7966
- const config = readJsonConfig(mcpJsonPath, { mcpServers: {} });
7967
- config.mcpServers = config.mcpServers || {};
7968
- config.mcpServers.donotdev = mcpConfig;
8022
+ const config = setMcpServer(
8023
+ readJsonConfig(mcpJsonPath, { mcpServers: {} }),
8024
+ mcpJsonPath,
8025
+ "donotdev",
8026
+ mcpConfig
8027
+ );
7969
8028
  writeJsonConfig(mcpJsonPath, config);
7970
8029
  log2.success(".mcp.json configured (Claude Code).");
7971
8030
  } catch (e) {
7972
- log2.error(`Failed to configure .mcp.json: ${e.message}`);
8031
+ log2.error(`Failed to configure .mcp.json: ${getErrorMessage(e)}`);
7973
8032
  }
7974
8033
  }
7975
8034
  const cursorMcpPath = joinPath(cwd, ".cursor", "mcp.json");
@@ -7977,13 +8036,16 @@ async function main(options = {}) {
7977
8036
  note(`[DRY RUN] Would write ${cursorMcpPath}`, "Cursor");
7978
8037
  } else {
7979
8038
  try {
7980
- const config = readJsonConfig(cursorMcpPath, { mcpServers: {} });
7981
- config.mcpServers = config.mcpServers || {};
7982
- config.mcpServers.donotdev = mcpConfig;
8039
+ const config = setMcpServer(
8040
+ readJsonConfig(cursorMcpPath, { mcpServers: {} }),
8041
+ cursorMcpPath,
8042
+ "donotdev",
8043
+ mcpConfig
8044
+ );
7983
8045
  writeJsonConfig(cursorMcpPath, config);
7984
8046
  log2.success(".cursor/mcp.json configured (Cursor).");
7985
8047
  } catch (e) {
7986
- log2.error(`Failed to configure Cursor: ${e.message}`);
8048
+ log2.error(`Failed to configure Cursor: ${getErrorMessage(e)}`);
7987
8049
  }
7988
8050
  }
7989
8051
  const geminiConfigPath = joinPath(cwd, ".gemini", "settings.json");
@@ -7991,13 +8053,16 @@ async function main(options = {}) {
7991
8053
  note(`[DRY RUN] Would write ${geminiConfigPath}`, "Gemini");
7992
8054
  } else {
7993
8055
  try {
7994
- const config = readJsonConfig(geminiConfigPath, { mcpServers: {} });
7995
- config.mcpServers = config.mcpServers || {};
7996
- config.mcpServers.donotdev = { ...mcpConfig, trust: true };
8056
+ const config = setMcpServer(
8057
+ readJsonConfig(geminiConfigPath, { mcpServers: {} }),
8058
+ geminiConfigPath,
8059
+ "donotdev",
8060
+ { ...mcpConfig, trust: true }
8061
+ );
7997
8062
  writeJsonConfig(geminiConfigPath, config);
7998
8063
  log2.success(".gemini/settings.json configured (Gemini).");
7999
8064
  } catch (e) {
8000
- log2.error(`Failed to configure Gemini: ${e.message}`);
8065
+ log2.error(`Failed to configure Gemini: ${getErrorMessage(e)}`);
8001
8066
  }
8002
8067
  }
8003
8068
  const claudeConfigPath = isWindows ? joinPath(
@@ -8016,13 +8081,16 @@ async function main(options = {}) {
8016
8081
  note(`[DRY RUN] Would update ${claudeConfigPath}`, "Claude Desktop");
8017
8082
  } else {
8018
8083
  try {
8019
- const config = readJsonConfig(claudeConfigPath, { mcpServers: {} });
8020
- config.mcpServers = config.mcpServers || {};
8021
- config.mcpServers.donotdev = mcpConfig;
8084
+ const config = setMcpServer(
8085
+ readJsonConfig(claudeConfigPath, { mcpServers: {} }),
8086
+ claudeConfigPath,
8087
+ "donotdev",
8088
+ mcpConfig
8089
+ );
8022
8090
  writeJsonConfig(claudeConfigPath, config);
8023
8091
  log2.success("Claude Desktop configured (global).");
8024
8092
  } catch (e) {
8025
- log2.error(`Failed to configure Claude Desktop: ${e.message}`);
8093
+ log2.error(`Failed to configure Claude Desktop: ${getErrorMessage(e)}`);
8026
8094
  }
8027
8095
  }
8028
8096
  }