@donotdev/cli 0.0.11 → 0.0.13

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 (68) hide show
  1. package/dependencies-matrix.json +30 -116
  2. package/dist/bin/commands/bump.js +137 -104
  3. package/dist/bin/commands/create-app.js +20 -0
  4. package/dist/bin/commands/create-project.js +63 -7
  5. package/dist/bin/commands/deploy.js +7606 -17
  6. package/dist/bin/commands/firebase-setup.d.ts +6 -0
  7. package/dist/bin/commands/firebase-setup.d.ts.map +1 -0
  8. package/dist/bin/commands/firebase-setup.js +7 -0
  9. package/dist/bin/commands/firebase-setup.js.map +1 -0
  10. package/dist/bin/commands/staging.d.ts +11 -0
  11. package/dist/bin/commands/staging.d.ts.map +1 -0
  12. package/dist/bin/commands/staging.js +12 -0
  13. package/dist/bin/commands/staging.js.map +1 -0
  14. package/dist/bin/dndev.js +28 -3
  15. package/dist/bin/donotdev.js +28 -3
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +7714 -62
  19. package/dist/index.js.map +1 -1
  20. package/package.json +1 -1
  21. package/templates/app-demo/src/pages/DetailPage.tsx.example +1 -1
  22. package/templates/app-demo/src/pages/FullPage.tsx.example +3 -3
  23. package/templates/app-demo/src/pages/HomePage.tsx.example +1 -1
  24. package/templates/app-demo/src/pages/components/ComponentRenderer.tsx.example +5 -5
  25. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +3 -3
  26. package/templates/app-next/.env.example +2 -0
  27. package/templates/app-next/src/pages/HomePage.tsx.example +2 -2
  28. package/templates/app-vite/.env.example +2 -0
  29. package/templates/app-vite/src/pages/HomePage.tsx.example +163 -73
  30. package/templates/functions-firebase/build.mjs.example +26 -10
  31. package/templates/functions-firebase/functions-firebase/build.mjs.example +26 -10
  32. package/templates/functions-firebase/functions.config.js.example +11 -15
  33. package/templates/github-consumer/.github/workflows/ci.yml.example +36 -0
  34. package/templates/root-consumer/.claude/agents/architect.md.example +2 -2
  35. package/templates/root-consumer/.claude/agents/builder.md.example +2 -2
  36. package/templates/root-consumer/.claude/agents/coder.md.example +2 -2
  37. package/templates/root-consumer/.claude/agents/extractor.md.example +2 -3
  38. package/templates/root-consumer/.claude/agents/polisher.md.example +67 -291
  39. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +4 -4
  40. package/templates/root-consumer/.claude/commands/build.md.example +2 -2
  41. package/templates/root-consumer/.claude/commands/polish.md.example +65 -81
  42. package/templates/root-consumer/.env.example +13 -13
  43. package/templates/root-consumer/.gemini/settings.json.example +9 -0
  44. package/templates/root-consumer/.gitignore.example +3 -1
  45. package/templates/root-consumer/AI.md.example +139 -0
  46. package/templates/root-consumer/CLAUDE.md.example +13 -104
  47. package/templates/root-consumer/README.md.example +81 -255
  48. package/templates/root-consumer/entities/Contact.ts.example +126 -0
  49. package/templates/root-consumer/entities/index.ts.example +6 -3
  50. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +41 -342
  51. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +2 -1
  52. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +144 -9
  53. package/templates/root-consumer/guides/dndev/INDEX.md.example +9 -0
  54. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +13 -16
  55. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +263 -0
  56. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +1 -1
  57. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +168 -0
  58. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +5 -12
  59. package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +184 -0
  60. package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +134 -69
  61. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +66 -44
  62. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +18 -1
  63. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +1 -0
  64. package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +2 -1
  65. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +2 -1
  66. package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +180 -108
  67. package/templates/root-consumer/guides/wai-way/context_map.json.example +8 -7
  68. package/templates/root-consumer/guides/wai-way/page_patterns.md.example +4 -4
@@ -390,29 +390,12 @@
390
390
  "lucide-react",
391
391
  "monitoring"
392
392
  ],
393
- "dependencies": [
394
- "i18n",
395
- "react-query",
396
- "fast-glob",
397
- "cli-prompts"
398
- ],
399
- "devDependencies": [
400
- "vite",
401
- "next",
402
- "typescript"
403
- ]
393
+ "dependencies": ["i18n", "react-query", "fast-glob", "cli-prompts"],
394
+ "devDependencies": ["vite", "next", "typescript"]
404
395
  },
405
396
  "@donotdev/components": {
406
- "dependencies": [
407
- "radix",
408
- "styling",
409
- "react-day-picker"
410
- ],
411
- "peerDependencies": [
412
- "react",
413
- "shiki",
414
- "lucide-react"
415
- ],
397
+ "dependencies": ["radix", "styling", "react-day-picker"],
398
+ "peerDependencies": ["react", "shiki", "lucide-react"],
416
399
  "peerDependenciesMeta": {
417
400
  "shiki": {
418
401
  "optional": true
@@ -428,10 +411,7 @@
428
411
  "routing",
429
412
  "validation"
430
413
  ],
431
- "dependencies": [
432
- "forms",
433
- "seo"
434
- ],
414
+ "dependencies": ["forms", "seo"],
435
415
  "peerDependenciesMeta": {
436
416
  "@donotdev/crud": {
437
417
  "optional": true
@@ -439,17 +419,10 @@
439
419
  }
440
420
  },
441
421
  "@donotdev/auth": {
442
- "peerDependencies": [
443
- "react",
444
- "firebase"
445
- ]
422
+ "peerDependencies": ["react", "firebase"]
446
423
  },
447
424
  "@donotdev/billing": {
448
- "peerDependencies": [
449
- "react",
450
- "lucide-react",
451
- "stripe"
452
- ]
425
+ "peerDependencies": ["react", "lucide-react", "stripe"]
453
426
  },
454
427
  "@donotdev/crud": {
455
428
  "dependencies": [
@@ -459,9 +432,7 @@
459
432
  "@dnd-kit",
460
433
  "forms-resolvers"
461
434
  ],
462
- "devDependencies": [
463
- "tiptap"
464
- ],
435
+ "devDependencies": ["tiptap"],
465
436
  "peerDependencies": [
466
437
  "@donotdev/firebase",
467
438
  "react",
@@ -478,30 +449,18 @@
478
449
  }
479
450
  },
480
451
  "@donotdev/firebase": {
481
- "dependencies": [
482
- "browser-image-compression"
483
- ],
484
- "peerDependencies": [
485
- "firebase"
486
- ]
452
+ "dependencies": ["browser-image-compression"],
453
+ "peerDependencies": ["firebase"]
487
454
  },
488
455
  "@donotdev/i18n": {
489
- "dependencies": [
490
- "i18n"
491
- ],
492
- "peerDependencies": [
493
- "lucide-react"
494
- ]
456
+ "dependencies": ["i18n"],
457
+ "peerDependencies": ["lucide-react"]
495
458
  },
496
459
  "@donotdev/stores": {
497
- "dependencies": [
498
- "zustand"
499
- ]
460
+ "dependencies": ["zustand"]
500
461
  },
501
462
  "@donotdev/schemas": {
502
- "dependencies": [
503
- "validation"
504
- ]
463
+ "dependencies": ["validation"]
505
464
  },
506
465
  "@donotdev/types": {
507
466
  "devDependencies": [
@@ -513,34 +472,18 @@
513
472
  ]
514
473
  },
515
474
  "@donotdev/utils": {
516
- "dependencies": [
517
- "zustand"
518
- ],
519
- "peerDependencies": [
520
- "monitoring"
521
- ],
522
- "devDependencies": [
523
- "validation",
524
- "firebase",
525
- "i18n"
526
- ]
475
+ "dependencies": ["zustand"],
476
+ "peerDependencies": ["monitoring"],
477
+ "devDependencies": ["validation", "firebase", "i18n"]
527
478
  },
528
479
  "@donotdev/hooks": {
529
- "dependencies": [
530
- "react-query"
531
- ]
480
+ "dependencies": ["react-query"]
532
481
  },
533
482
  "@donotdev/cli": {
534
- "dependencies": [
535
- "cli-prompts",
536
- "cli-commander",
537
- "fast-glob"
538
- ]
483
+ "dependencies": ["cli-prompts", "cli-commander", "fast-glob"]
539
484
  },
540
485
  "@donotdev/mcp-server": {
541
- "dependencies": [
542
- "mcp-sdk"
543
- ]
486
+ "dependencies": ["mcp-sdk"]
544
487
  },
545
488
  "@donotdev/tooling": {
546
489
  "dependencies": [
@@ -550,19 +493,13 @@
550
493
  "esbuild",
551
494
  "rollup"
552
495
  ],
553
- "devDependencies": [
554
- "yaml"
555
- ]
496
+ "devDependencies": ["yaml"]
556
497
  },
557
498
  "@donotdev/oauth": {
558
- "peerDependencies": [
559
- "react"
560
- ]
499
+ "peerDependencies": ["react"]
561
500
  },
562
501
  "@donotdev/functions": {
563
- "dependencies": [
564
- "@donotdev/core"
565
- ],
502
+ "dependencies": ["@donotdev/core"],
566
503
  "peerDependencies": [
567
504
  "firebase-functions",
568
505
  "stripe",
@@ -572,10 +509,7 @@
572
509
  ]
573
510
  },
574
511
  "@donotdev/adv-comps": {
575
- "peerDependencies": [
576
- "react",
577
- "shiki"
578
- ],
512
+ "peerDependencies": ["react", "shiki"],
579
513
  "dependencies": [],
580
514
  "peerDependenciesMeta": {
581
515
  "shiki": {
@@ -712,9 +646,7 @@
712
646
  "lucide-react",
713
647
  "firebase"
714
648
  ],
715
- "devDependencies": [
716
- "root-consumer-tooling"
717
- ]
649
+ "devDependencies": ["root-consumer-tooling"]
718
650
  },
719
651
  "consumer-vite": {
720
652
  "description": "Vite app for consumers (filter inlined packages)",
@@ -738,13 +670,7 @@
738
670
  "i18n",
739
671
  "react-query"
740
672
  ],
741
- "devDependencies": [
742
- "vite",
743
- "typescript",
744
- "types",
745
- "vite-deps",
746
- "postcss"
747
- ]
673
+ "devDependencies": ["vite", "typescript", "types", "vite-deps", "postcss"]
748
674
  },
749
675
  "consumer-nextjs": {
750
676
  "description": "Nextjs app for consumers (filter inlined packages)",
@@ -767,12 +693,7 @@
767
693
  "i18n",
768
694
  "react-query"
769
695
  ],
770
- "devDependencies": [
771
- "next",
772
- "typescript",
773
- "types",
774
- "postcss"
775
- ]
696
+ "devDependencies": ["next", "typescript", "types", "postcss"]
776
697
  },
777
698
  "functions-firebase": {
778
699
  "description": "Firebase Functions app",
@@ -795,19 +716,12 @@
795
716
  "monitoring-node",
796
717
  "stripe"
797
718
  ],
798
- "devDependencies": [
799
- "vercel"
800
- ]
719
+ "devDependencies": ["vercel"]
801
720
  },
802
721
  "entities": {
803
722
  "description": "Entities workspace package",
804
- "dependencies": [
805
- "validation"
806
- ],
807
- "devDependencies": [
808
- "eslint",
809
- "typescript"
810
- ]
723
+ "dependencies": ["validation"],
724
+ "devDependencies": ["eslint", "typescript"]
811
725
  },
812
726
  "demo": {
813
727
  "description": "Demo app template (components only)",
@@ -255,7 +255,7 @@ function m(e2, u2) {
255
255
  const t = e2;
256
256
  t.isTTY && t.setRawMode(u2);
257
257
  }
258
- var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, dD, A, kD, $D, H, SD;
258
+ var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, dD, A, OD, PD, J, LD;
259
259
  var init_dist = __esm({
260
260
  "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
261
261
  init_utils();
@@ -492,14 +492,12 @@ var init_dist = __esm({
492
492
  }
493
493
  };
494
494
  A = /* @__PURE__ */ new WeakMap();
495
- kD = Object.defineProperty;
496
- $D = (e2, u2, t) => u2 in e2 ? kD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
497
- H = (e2, u2, t) => ($D(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
498
- SD = class extends x {
495
+ OD = Object.defineProperty;
496
+ PD = (e2, u2, t) => u2 in e2 ? OD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
497
+ J = (e2, u2, t) => (PD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
498
+ LD = class extends x {
499
499
  constructor(u2) {
500
- super(u2, false), H(this, "options"), H(this, "cursor", 0), this.options = u2.options, this.value = [...u2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u2.cursorAt), 0), this.on("key", (t) => {
501
- t === "a" && this.toggleAll();
502
- }), this.on("cursor", (t) => {
500
+ super(u2, false), J(this, "options"), J(this, "cursor", 0), this.options = u2.options, this.cursor = this.options.findIndex(({ value: t }) => t === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
503
501
  switch (t) {
504
502
  case "left":
505
503
  case "up":
@@ -509,22 +507,15 @@ var init_dist = __esm({
509
507
  case "right":
510
508
  this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
511
509
  break;
512
- case "space":
513
- this.toggleValue();
514
- break;
515
510
  }
511
+ this.changeValue();
516
512
  });
517
513
  }
518
514
  get _value() {
519
- return this.options[this.cursor].value;
520
- }
521
- toggleAll() {
522
- const u2 = this.value.length === this.options.length;
523
- this.value = u2 ? [] : this.options.map((t) => t.value);
515
+ return this.options[this.cursor];
524
516
  }
525
- toggleValue() {
526
- const u2 = this.value.includes(this._value);
527
- this.value = u2 ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
517
+ changeValue() {
518
+ this.value = this._value.value;
528
519
  }
529
520
  };
530
521
  }
@@ -536,7 +527,7 @@ import y2 from "node:process";
536
527
  function ce() {
537
528
  return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
538
529
  }
539
- var import_picocolors, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, G2, ye, fe, xe, Ie, Se, M2, J;
530
+ var import_picocolors, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, G2, ye, ve, xe, Ie, Se, M2, J2;
540
531
  var init_dist2 = __esm({
541
532
  "node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs"() {
542
533
  init_utils();
@@ -609,40 +600,32 @@ ${import_picocolors.default.cyan(d2)}
609
600
  }
610
601
  } }).prompt();
611
602
  };
612
- fe = (t) => {
603
+ ve = (t) => {
613
604
  const n = (r2, i) => {
614
605
  const s = r2.label ?? String(r2.value);
615
- return i === "active" ? `${import_picocolors.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors.default.green(T)} ${import_picocolors.default.dim(s)} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : i === "active-selected" ? `${import_picocolors.default.green(T)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors.default.dim(s)}` : `${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(s)}`;
606
+ switch (i) {
607
+ case "selected":
608
+ return `${import_picocolors.default.dim(s)}`;
609
+ case "active":
610
+ return `${import_picocolors.default.green(k2)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}`;
611
+ case "cancelled":
612
+ return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;
613
+ default:
614
+ return `${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(s)}`;
615
+ }
616
616
  };
617
- return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
618
- if (this.required && r2.length === 0) return `Please select at least one option.
619
- ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
620
- }, render() {
617
+ return new LD({ options: t.options, initialValue: t.initialValue, render() {
621
618
  const r2 = `${import_picocolors.default.gray(o)}
622
619
  ${b2(this.state)} ${t.message}
623
- `, i = (s, c) => {
624
- const a = this.value.includes(s.value);
625
- return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
626
- };
620
+ `;
627
621
  switch (this.state) {
628
622
  case "submit":
629
- return `${r2}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none")}`;
630
- case "cancel": {
631
- const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors.default.dim(", "));
632
- return `${r2}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
633
- ${import_picocolors.default.gray(o)}` : ""}`;
634
- }
635
- case "error": {
636
- const s = this.error.split(`
637
- `).map((c, a) => a === 0 ? `${import_picocolors.default.yellow(d2)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
638
- `);
639
- return `${r2 + import_picocolors.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
640
- ${import_picocolors.default.yellow(o)} `)}
641
- ${s}
642
- `;
643
- }
623
+ return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
624
+ case "cancel":
625
+ return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
626
+ ${import_picocolors.default.gray(o)}`;
644
627
  default:
645
- return `${r2}${import_picocolors.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
628
+ return `${r2}${import_picocolors.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
646
629
  ${import_picocolors.default.cyan(o)} `)}
647
630
  ${import_picocolors.default.cyan(d2)}
648
631
  `;
@@ -687,7 +670,7 @@ ${import_picocolors.default.gray(d2)} ${t}
687
670
  }, error: (t) => {
688
671
  M2.message(t, { symbol: import_picocolors.default.red(K2) });
689
672
  } };
690
- J = `${import_picocolors.default.gray(o)} `;
673
+ J2 = `${import_picocolors.default.gray(o)} `;
691
674
  }
692
675
  });
693
676
 
@@ -7706,6 +7689,9 @@ import {
7706
7689
  isAbsolute as pathIsAbsolute
7707
7690
  } from "node:path";
7708
7691
  import { fileURLToPath as fileURLToPath2 } from "node:url";
7692
+ function getDirnameFromUrl(importMetaUrl) {
7693
+ return dirname2(fileURLToPath2(importMetaUrl));
7694
+ }
7709
7695
  function detectExecutionMode() {
7710
7696
  const currentDir = process.cwd();
7711
7697
  const toolingPath = joinPath(currentDir, PACKAGE_PATHS.TOOLING);
@@ -7718,6 +7704,40 @@ function detectExecutionMode() {
7718
7704
  }
7719
7705
  return "published";
7720
7706
  }
7707
+ function getTemplatesRoot() {
7708
+ const mode = detectExecutionMode();
7709
+ if (mode === "development") {
7710
+ const repoRoot = getRepoRoot();
7711
+ return normalizePath(repoRoot, PACKAGE_PATHS.CLI, "templates");
7712
+ } else {
7713
+ try {
7714
+ const cliRoot2 = resolveFrameworkPackage("@donotdev/cli");
7715
+ if (cliRoot2) {
7716
+ const templatesPath = normalizePath(cliRoot2, "templates");
7717
+ if (pathExists(templatesPath)) {
7718
+ return templatesPath;
7719
+ }
7720
+ }
7721
+ } catch {
7722
+ }
7723
+ try {
7724
+ const req = createRequire2(import.meta.url);
7725
+ const cliPackageJsonPath = req.resolve("@donotdev/cli/package.json");
7726
+ const cliRoot2 = normalizePath(dirname2(cliPackageJsonPath));
7727
+ const templatesPath = normalizePath(cliRoot2, "templates");
7728
+ if (pathExists(templatesPath)) {
7729
+ return templatesPath;
7730
+ }
7731
+ } catch {
7732
+ }
7733
+ const cliRoot = getCliRootFromBundle();
7734
+ return normalizePath(cliRoot, "templates");
7735
+ }
7736
+ }
7737
+ function getCliRootFromBundle() {
7738
+ const currentDir = getDirnameFromUrl(import.meta.url);
7739
+ return normalizePath(currentDir, "..", "..", "..");
7740
+ }
7721
7741
  async function glob(pattern, options = {}) {
7722
7742
  const patterns = Array.isArray(pattern) ? pattern : [pattern];
7723
7743
  const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
@@ -7776,7 +7796,7 @@ function globSync(pattern, options = {}) {
7776
7796
  });
7777
7797
  return results.map((p2) => pathResolverInstance.normalizePath(p2));
7778
7798
  }
7779
- var pathResolverInstance, getRepoRoot, getAppRoot, normalizePath, pathExists, read, readSync, write, writeSync, ensureDir, getRelativePathBetween, getDirname, joinPath;
7799
+ var pathResolverInstance, getRepoRoot, getAppRoot, resolveFrameworkPackage, normalizePath, pathExists, read, readSync, write, writeSync, ensureDir, getRelativePathBetween, getDirname, joinPath;
7780
7800
  var init_pathResolver = __esm({
7781
7801
  "packages/tooling/src/utils/pathResolver.ts"() {
7782
7802
  "use strict";
@@ -7785,6 +7805,7 @@ var init_pathResolver = __esm({
7785
7805
  pathResolverInstance = PathResolver.getInstance({ debug: false });
7786
7806
  getRepoRoot = () => pathResolverInstance.getRepoRoot();
7787
7807
  getAppRoot = () => pathResolverInstance.getAppRoot();
7808
+ resolveFrameworkPackage = (name, from) => pathResolverInstance.resolveFrameworkPackage(name, from || null);
7788
7809
  normalizePath = (...pathSegments) => {
7789
7810
  return pathResolverInstance.normalizePath(join2(...pathSegments));
7790
7811
  };
@@ -7856,17 +7877,16 @@ async function askForConfirmation(message, defaultValue = false) {
7856
7877
  }
7857
7878
  return result;
7858
7879
  }
7859
- async function askForMultiSelection(message, choices, defaultIndices = []) {
7880
+ async function askForSelection(message, choices, defaultValue = 0) {
7860
7881
  const options = choices.map((choice) => ({
7861
7882
  value: choice.value,
7862
7883
  label: choice.title,
7863
7884
  hint: choice.hint
7864
7885
  }));
7865
- const initialValues = defaultIndices.map((i) => choices[i]?.value).filter(Boolean);
7866
- const result = await fe({
7886
+ const result = await ve({
7867
7887
  message,
7868
7888
  options,
7869
- initialValues: initialValues.length > 0 ? initialValues : void 0
7889
+ initialValue: choices[defaultValue]?.value
7870
7890
  });
7871
7891
  if (pD(result)) {
7872
7892
  xe("Operation cancelled.");
@@ -8047,45 +8067,25 @@ var PRESERVE_IF_EXISTS = [
8047
8067
  "CLAUDE.md"
8048
8068
  // User may have customized
8049
8069
  ];
8050
- function getInstalledCliTemplatesPath() {
8051
- const appRoot = getAppRoot();
8052
- if (!appRoot) return null;
8053
- const cliTemplatesPath = joinPath(
8054
- appRoot,
8055
- "node_modules",
8056
- "@donotdev",
8057
- "cli",
8058
- "templates",
8059
- "root-consumer"
8060
- );
8061
- if (pathExists(cliTemplatesPath)) {
8062
- return normalizePath(cliTemplatesPath);
8063
- }
8064
- return null;
8065
- }
8066
- function getFrameworkTemplatesPath() {
8067
- const possiblePaths = [
8068
- joinPath(process.cwd(), "..", "packages", "cli", "templates", "root-consumer"),
8069
- joinPath(process.cwd(), "packages", "cli", "templates", "root-consumer")
8070
- ];
8071
- for (const path of possiblePaths) {
8072
- if (pathExists(path)) {
8073
- return normalizePath(path);
8070
+ function getSourceTemplatesPath() {
8071
+ try {
8072
+ const templatesRoot = getTemplatesRoot();
8073
+ const rootConsumerPath = joinPath(templatesRoot, "root-consumer");
8074
+ if (pathExists(rootConsumerPath)) {
8075
+ return normalizePath(rootConsumerPath);
8074
8076
  }
8077
+ return null;
8078
+ } catch (error2) {
8079
+ return null;
8075
8080
  }
8076
- return null;
8077
- }
8078
- function getSourceTemplatesPath() {
8079
- const installed = getInstalledCliTemplatesPath();
8080
- if (installed) return installed;
8081
- const framework = getFrameworkTemplatesPath();
8082
- if (framework) return framework;
8083
- return null;
8084
8081
  }
8085
8082
  async function syncFile(sourcePath, destPath, preserveIfExists, appRoot) {
8086
8083
  const destPathWithoutExample = destPath.endsWith(".example") ? destPath.slice(0, -8) : destPath;
8087
8084
  if (preserveIfExists && pathExists(destPathWithoutExample)) {
8088
- const relativePath = getRelativePathBetween(appRoot, destPathWithoutExample);
8085
+ const relativePath = getRelativePathBetween(
8086
+ appRoot,
8087
+ destPathWithoutExample
8088
+ );
8089
8089
  log.info(`Preserving user-customized file: ${relativePath}`);
8090
8090
  return false;
8091
8091
  }
@@ -8172,7 +8172,11 @@ async function syncTemplates(sourceRoot, destRoot, dryRun) {
8172
8172
  errors++;
8173
8173
  log.error(
8174
8174
  `Error syncing pattern ${pattern}:`,
8175
- DoNotDevError.from(error2, `Failed to sync ${pattern}`, "file-operation-error")
8175
+ DoNotDevError.from(
8176
+ error2,
8177
+ `Failed to sync ${pattern}`,
8178
+ "file-operation-error"
8179
+ )
8176
8180
  );
8177
8181
  }
8178
8182
  }
@@ -8190,10 +8194,16 @@ async function syncDocumentation(options = {}) {
8190
8194
  }
8191
8195
  const sourceRoot = getSourceTemplatesPath();
8192
8196
  if (!sourceRoot) {
8193
- log.error(
8194
- "Could not find framework templates. Make sure @donotdev/cli is installed."
8195
- );
8196
- return 1;
8197
+ log.warn("Could not find framework templates. Documentation sync skipped.");
8198
+ log.info("");
8199
+ log.info(" Templates are looked up the same way as create-project:");
8200
+ log.info(" \u2022 Published mode: node_modules/@donotdev/cli/templates");
8201
+ log.info(" \u2022 Dev mode: packages/cli/templates (from monorepo)");
8202
+ log.info("");
8203
+ log.info(" To enable docs sync:");
8204
+ log.info(" \u2022 Install @donotdev/cli: bun add -D @donotdev/cli");
8205
+ log.info(" \u2022 Or run from framework monorepo (dev mode)");
8206
+ return 0;
8197
8207
  }
8198
8208
  log.info(`Source templates: ${sourceRoot}`);
8199
8209
  log.info(`Destination: ${appRoot}`);
@@ -8202,7 +8212,9 @@ async function syncDocumentation(options = {}) {
8202
8212
  log.info(`
8203
8213
  [DRY RUN] Would sync ${result.synced} file(s)`);
8204
8214
  if (result.preserved > 0) {
8205
- log.info(`[DRY RUN] Would preserve ${result.preserved} user-customized file(s)`);
8215
+ log.info(
8216
+ `[DRY RUN] Would preserve ${result.preserved} user-customized file(s)`
8217
+ );
8206
8218
  }
8207
8219
  log.info("[DRY RUN] No files modified");
8208
8220
  } else {
@@ -8287,20 +8299,36 @@ async function main(options = {}) {
8287
8299
  updatePackages = true;
8288
8300
  updateDocs = true;
8289
8301
  } else {
8290
- const selections = await askForMultiSelection(
8302
+ const choices = [
8303
+ {
8304
+ title: "Update packages",
8305
+ value: "packages",
8306
+ hint: "Update @donotdev/* packages and dependencies"
8307
+ },
8308
+ {
8309
+ title: "Sync documentation",
8310
+ value: "docs",
8311
+ hint: "Sync guides, commands, and agents from framework"
8312
+ },
8313
+ {
8314
+ title: "Both",
8315
+ value: "both",
8316
+ hint: "Update packages and sync documentation"
8317
+ }
8318
+ ];
8319
+ const selection = await askForSelection(
8291
8320
  "What would you like to update?",
8292
- [
8293
- { title: "Update packages", value: "packages", hint: "Update @donotdev/* packages and dependencies" },
8294
- { title: "Sync documentation", value: "docs", hint: "Sync guides, commands, and agents from framework" }
8295
- ],
8296
- [0, 1]
8297
- // Both selected by default
8321
+ choices,
8322
+ 2
8323
+ // Default to "Both"
8298
8324
  );
8299
- updatePackages = selections.includes("packages");
8300
- updateDocs = selections.includes("docs");
8301
- if (!updatePackages && !updateDocs) {
8302
- log.info("Nothing selected. Exiting.");
8303
- return 0;
8325
+ if (selection === "packages") {
8326
+ updatePackages = true;
8327
+ } else if (selection === "docs") {
8328
+ updateDocs = true;
8329
+ } else if (selection === "both") {
8330
+ updatePackages = true;
8331
+ updateDocs = true;
8304
8332
  }
8305
8333
  }
8306
8334
  if (updatePackages) {
@@ -8369,7 +8397,12 @@ async function main(options = {}) {
8369
8397
  if (updates.length === 0 && majorUpdates.length === 0) {
8370
8398
  log.success("All packages up to date!");
8371
8399
  } else {
8372
- await handlePackageUpdates(updates, majorUpdates, appRoot, dryRun || false);
8400
+ await handlePackageUpdates(
8401
+ updates,
8402
+ majorUpdates,
8403
+ appRoot,
8404
+ dryRun || false
8405
+ );
8373
8406
  }
8374
8407
  }
8375
8408
  }
@@ -8027,6 +8027,26 @@ function getTemplatesRoot() {
8027
8027
  const repoRoot = getRepoRoot();
8028
8028
  return normalizePath(repoRoot, PACKAGE_PATHS.CLI, "templates");
8029
8029
  } else {
8030
+ try {
8031
+ const cliRoot2 = resolveFrameworkPackage("@donotdev/cli");
8032
+ if (cliRoot2) {
8033
+ const templatesPath = normalizePath(cliRoot2, "templates");
8034
+ if (pathExists(templatesPath)) {
8035
+ return templatesPath;
8036
+ }
8037
+ }
8038
+ } catch {
8039
+ }
8040
+ try {
8041
+ const req = createRequire2(import.meta.url);
8042
+ const cliPackageJsonPath = req.resolve("@donotdev/cli/package.json");
8043
+ const cliRoot2 = normalizePath(dirname2(cliPackageJsonPath));
8044
+ const templatesPath = normalizePath(cliRoot2, "templates");
8045
+ if (pathExists(templatesPath)) {
8046
+ return templatesPath;
8047
+ }
8048
+ } catch {
8049
+ }
8030
8050
  const cliRoot = getCliRootFromBundle();
8031
8051
  return normalizePath(cliRoot, "templates");
8032
8052
  }