@donotdev/cli 0.0.13 → 0.0.15

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 (162) hide show
  1. package/dependencies-matrix.json +357 -89
  2. package/dist/bin/commands/agent-setup.d.ts +6 -0
  3. package/dist/bin/commands/agent-setup.d.ts.map +1 -0
  4. package/dist/bin/commands/agent-setup.js +629 -0
  5. package/dist/bin/commands/agent-setup.js.map +1 -0
  6. package/dist/bin/commands/build.js +131 -50
  7. package/dist/bin/commands/bump.js +137 -49
  8. package/dist/bin/commands/cacheout.js +50 -21
  9. package/dist/bin/commands/create-app.js +270 -261
  10. package/dist/bin/commands/create-project.js +418 -197
  11. package/dist/bin/commands/deploy.js +1752 -712
  12. package/dist/bin/commands/dev.js +151 -35
  13. package/dist/bin/commands/emu.js +228 -70
  14. package/dist/bin/commands/format.js +50 -21
  15. package/dist/bin/commands/lint.js +50 -21
  16. package/dist/bin/commands/preview.js +155 -35
  17. package/dist/bin/commands/supabase-setup.d.ts +6 -0
  18. package/dist/bin/commands/supabase-setup.d.ts.map +1 -0
  19. package/dist/bin/commands/supabase-setup.js +7 -0
  20. package/dist/bin/commands/supabase-setup.js.map +1 -0
  21. package/dist/bin/commands/sync-secrets.js +224 -46
  22. package/dist/bin/commands/type-check.d.ts +14 -0
  23. package/dist/bin/commands/type-check.d.ts.map +1 -0
  24. package/dist/bin/commands/type-check.js +314 -0
  25. package/dist/bin/commands/type-check.js.map +1 -0
  26. package/dist/bin/commands/wai.js +7399 -11
  27. package/dist/bin/dndev.js +27 -2
  28. package/dist/bin/donotdev.js +27 -2
  29. package/dist/index.js +3960 -2996
  30. package/package.json +2 -2
  31. package/templates/app-demo/src/App.tsx.example +1 -0
  32. package/templates/app-demo/src/pages/FullPage.tsx.example +2 -2
  33. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +2 -2
  34. package/templates/app-demo/src/themes.css.example +5 -12
  35. package/templates/app-expo/.env.example +64 -0
  36. package/templates/app-expo/.expo/README.md.example +5 -0
  37. package/templates/app-expo/.gitignore.example +36 -0
  38. package/templates/app-expo/README.md.example +58 -0
  39. package/templates/app-expo/app/.gitkeep +2 -0
  40. package/templates/app-expo/app/_layout.tsx.example +41 -0
  41. package/templates/app-expo/app/form.tsx.example +52 -0
  42. package/templates/app-expo/app/index.tsx.example +89 -0
  43. package/templates/app-expo/app/list.tsx.example +32 -0
  44. package/templates/app-expo/app/profile.tsx.example +76 -0
  45. package/templates/app-expo/app/signin.tsx.example +53 -0
  46. package/templates/app-expo/app.json.example +39 -0
  47. package/templates/app-expo/babel.config.js.example +10 -0
  48. package/templates/app-expo/eas.json.example +20 -0
  49. package/templates/app-expo/expo-env.d.ts.example +4 -0
  50. package/templates/app-expo/metro.config.js.example +20 -0
  51. package/templates/app-expo/service-account-key.json.example +12 -0
  52. package/templates/app-expo/tsconfig.json.example +19 -0
  53. package/templates/app-next/.env.example +4 -33
  54. package/templates/app-next/src/app/ClientLayout.tsx.example +2 -0
  55. package/templates/app-next/src/app/layout.tsx.example +7 -6
  56. package/templates/app-next/src/globals.css.example +2 -11
  57. package/templates/app-next/src/pages/HomePage.tsx.example +1 -1
  58. package/templates/app-next/src/themes.css.example +10 -13
  59. package/templates/app-vite/.env.example +3 -32
  60. package/templates/app-vite/index.html.example +2 -24
  61. package/templates/app-vite/src/App.tsx.example +2 -0
  62. package/templates/app-vite/src/globals.css.example +2 -12
  63. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -2
  64. package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
  65. package/templates/app-vite/src/themes.css.example +109 -79
  66. package/templates/app-vite/vercel.json.example +11 -0
  67. package/templates/functions-firebase/build.mjs.example +2 -72
  68. package/templates/functions-firebase/functions-firebase/.env.example.example +23 -25
  69. package/templates/functions-firebase/functions-firebase/build.mjs.example +2 -72
  70. package/templates/functions-firebase/functions-firebase/tsconfig.json.example +1 -1
  71. package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +7 -0
  72. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +11 -0
  73. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +11 -0
  74. package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +7 -0
  75. package/templates/functions-supabase/supabase/functions/crud/index.ts.example +16 -0
  76. package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +7 -0
  77. package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +7 -0
  78. package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +7 -0
  79. package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +7 -0
  80. package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +7 -0
  81. package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +7 -0
  82. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +24 -0
  83. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +22 -0
  84. package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +28 -0
  85. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +28 -0
  86. package/templates/functions-vercel/functions-vercel/tsconfig.json.example +1 -1
  87. package/templates/functions-vercel/functions-vercel/vercel.json.example +1 -1
  88. package/templates/functions-vercel/vercel.json.example +1 -1
  89. package/templates/github/github/workflows/firebase-deploy.yml.example +1 -1
  90. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  91. package/templates/overlay-firebase/env.fragment.example +34 -0
  92. package/templates/overlay-firebase/env.fragment.expo.example +34 -0
  93. package/templates/overlay-firebase/env.fragment.nextjs.example +34 -0
  94. package/templates/overlay-firebase/src/config/providers.expo.ts.example +49 -0
  95. package/templates/overlay-firebase/src/config/providers.ts.example +23 -0
  96. package/templates/overlay-supabase/env.fragment.example +7 -0
  97. package/templates/overlay-supabase/env.fragment.expo.example +7 -0
  98. package/templates/overlay-supabase/env.fragment.nextjs.example +7 -0
  99. package/templates/overlay-supabase/src/config/providers.expo.ts.example +35 -0
  100. package/templates/overlay-supabase/src/config/providers.ts.example +33 -0
  101. package/templates/overlay-supabase/vercel.headers.example +23 -0
  102. package/templates/overlay-supabase/vercel.json.example +22 -0
  103. package/templates/overlay-vercel/env.fragment.example +34 -0
  104. package/templates/overlay-vercel/env.fragment.nextjs.example +34 -0
  105. package/templates/overlay-vercel/src/config/providers.ts.example +24 -0
  106. package/templates/root-consumer/.claude/agents/architect.md.example +2 -310
  107. package/templates/root-consumer/.claude/agents/builder.md.example +2 -326
  108. package/templates/root-consumer/.claude/agents/coder.md.example +2 -83
  109. package/templates/root-consumer/.claude/agents/extractor.md.example +2 -231
  110. package/templates/root-consumer/.claude/agents/polisher.md.example +2 -132
  111. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +2 -81
  112. package/templates/root-consumer/.claude/commands/brainstorm.md.example +1 -1
  113. package/templates/root-consumer/.claude/commands/build.md.example +1 -1
  114. package/templates/root-consumer/.claude/commands/design.md.example +1 -1
  115. package/templates/root-consumer/.claude/commands/grill.md.example +30 -0
  116. package/templates/root-consumer/.claude/commands/polish.md.example +1 -1
  117. package/templates/root-consumer/.claude/commands/techdebt.md.example +28 -0
  118. package/templates/root-consumer/.clinerules.example +1 -0
  119. package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +15 -0
  120. package/templates/root-consumer/.cursorrules.example +1 -0
  121. package/templates/root-consumer/.dndev/args.json.example +6 -0
  122. package/templates/root-consumer/.gemini/settings.json.example +2 -2
  123. package/templates/root-consumer/.github/copilot-instructions.md.example +1 -0
  124. package/templates/root-consumer/.windsurfrules.example +1 -0
  125. package/templates/root-consumer/AI.md.example +25 -108
  126. package/templates/root-consumer/CLAUDE.md.example +1 -128
  127. package/templates/root-consumer/CONVENTIONS.md.example +1 -0
  128. package/templates/root-consumer/GEMINI.md.example +1 -0
  129. package/templates/root-consumer/firebase.json.example +1 -1
  130. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +54 -0
  131. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -18
  132. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +1 -1
  133. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +99 -30
  134. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +186 -0
  135. package/templates/root-consumer/guides/dndev/INDEX.md.example +4 -1
  136. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +143 -12
  137. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +9 -3
  138. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +12 -7
  139. package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +234 -0
  140. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +124 -0
  141. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +6 -2
  142. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +176 -0
  143. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +5 -9
  144. package/templates/root-consumer/guides/dndev/essences_reference.css.example +174 -0
  145. package/templates/root-consumer/guides/wai-way/agents/builder.md.example +10 -0
  146. package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +25 -5
  147. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +13 -2
  148. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +2 -2
  149. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +47 -11
  150. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +15 -4
  151. package/templates/root-consumer/guides/wai-way/spec_template.md.example +7 -6
  152. package/templates/app-payload/.env.example +0 -28
  153. package/templates/app-payload/README.md.example +0 -233
  154. package/templates/app-payload/collections/Company.ts.example +0 -125
  155. package/templates/app-payload/collections/Hero.ts.example +0 -62
  156. package/templates/app-payload/collections/Media.ts.example +0 -41
  157. package/templates/app-payload/collections/Products.ts.example +0 -115
  158. package/templates/app-payload/collections/Services.ts.example +0 -104
  159. package/templates/app-payload/collections/Testimonials.ts.example +0 -92
  160. package/templates/app-payload/collections/Users.ts.example +0 -35
  161. package/templates/app-payload/src/server.ts.example +0 -79
  162. package/templates/app-payload/tsconfig.json.example +0 -24
@@ -1946,7 +1946,7 @@ var require_parse = __commonJS({
1946
1946
  CHAR_NO_BREAK_SPACE,
1947
1947
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
1948
1948
  } = require_constants();
1949
- var parse = (input, options = {}) => {
1949
+ var parse2 = (input, options = {}) => {
1950
1950
  if (typeof input !== "string") {
1951
1951
  throw new TypeError("Expected a string");
1952
1952
  }
@@ -2146,7 +2146,7 @@ var require_parse = __commonJS({
2146
2146
  push({ type: "eos" });
2147
2147
  return ast;
2148
2148
  };
2149
- module.exports = parse;
2149
+ module.exports = parse2;
2150
2150
  }
2151
2151
  });
2152
2152
 
@@ -2158,7 +2158,7 @@ var require_braces = __commonJS({
2158
2158
  var stringify2 = require_stringify();
2159
2159
  var compile = require_compile();
2160
2160
  var expand = require_expand();
2161
- var parse = require_parse();
2161
+ var parse2 = require_parse();
2162
2162
  var braces = (input, options = {}) => {
2163
2163
  let output = [];
2164
2164
  if (Array.isArray(input)) {
@@ -2178,7 +2178,7 @@ var require_braces = __commonJS({
2178
2178
  }
2179
2179
  return output;
2180
2180
  };
2181
- braces.parse = (input, options = {}) => parse(input, options);
2181
+ braces.parse = (input, options = {}) => parse2(input, options);
2182
2182
  braces.stringify = (input, options = {}) => {
2183
2183
  if (typeof input === "string") {
2184
2184
  return stringify2(braces.parse(input, options), options);
@@ -2835,7 +2835,7 @@ var require_parse2 = __commonJS({
2835
2835
  var syntaxError = (type, char) => {
2836
2836
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2837
2837
  };
2838
- var parse = (input, options) => {
2838
+ var parse2 = (input, options) => {
2839
2839
  if (typeof input !== "string") {
2840
2840
  throw new TypeError("Expected a string");
2841
2841
  }
@@ -2984,7 +2984,7 @@ var require_parse2 = __commonJS({
2984
2984
  output = token.close = `)$))${extglobStar}`;
2985
2985
  }
2986
2986
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
2987
- const expression = parse(rest, { ...options, fastpaths: false }).output;
2987
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
2988
2988
  output = token.close = `)${expression})${extglobStar})`;
2989
2989
  }
2990
2990
  if (token.prev.type === "bos") {
@@ -3509,7 +3509,7 @@ var require_parse2 = __commonJS({
3509
3509
  }
3510
3510
  return state;
3511
3511
  };
3512
- parse.fastpaths = (input, options) => {
3512
+ parse2.fastpaths = (input, options) => {
3513
3513
  const opts = { ...options };
3514
3514
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
3515
3515
  const len = input.length;
@@ -3575,7 +3575,7 @@ var require_parse2 = __commonJS({
3575
3575
  }
3576
3576
  return source;
3577
3577
  };
3578
- module.exports = parse;
3578
+ module.exports = parse2;
3579
3579
  }
3580
3580
  });
3581
3581
 
@@ -3586,7 +3586,7 @@ var require_picomatch = __commonJS({
3586
3586
  init_utils();
3587
3587
  var path = __require("path");
3588
3588
  var scan = require_scan();
3589
- var parse = require_parse2();
3589
+ var parse2 = require_parse2();
3590
3590
  var utils = require_utils2();
3591
3591
  var constants2 = require_constants2();
3592
3592
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -3674,7 +3674,7 @@ var require_picomatch = __commonJS({
3674
3674
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3675
3675
  picomatch.parse = (pattern, options) => {
3676
3676
  if (Array.isArray(pattern)) return pattern.map((p2) => picomatch.parse(p2, options));
3677
- return parse(pattern, { ...options, fastpaths: false });
3677
+ return parse2(pattern, { ...options, fastpaths: false });
3678
3678
  };
3679
3679
  picomatch.scan = (input, options) => scan(input, options);
3680
3680
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -3700,10 +3700,10 @@ var require_picomatch = __commonJS({
3700
3700
  }
3701
3701
  let parsed = { negated: false, fastpaths: true };
3702
3702
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
3703
- parsed.output = parse.fastpaths(input, options);
3703
+ parsed.output = parse2.fastpaths(input, options);
3704
3704
  }
3705
3705
  if (!parsed.output) {
3706
- parsed = parse(input, options);
3706
+ parsed = parse2(input, options);
3707
3707
  }
3708
3708
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
3709
3709
  };
@@ -7565,11 +7565,39 @@ var init_PathResolver = __esm({
7565
7565
  });
7566
7566
 
7567
7567
  // packages/tooling/src/utils/errors.ts
7568
- var DoNotDevError;
7568
+ var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
7569
7569
  var init_errors = __esm({
7570
7570
  "packages/tooling/src/utils/errors.ts"() {
7571
7571
  "use strict";
7572
7572
  init_utils();
7573
+ DO_NOT_DEV_ERROR_CODES = {
7574
+ CONFIGURATION_ERROR: "configuration-error",
7575
+ CONFIG_NOT_FOUND: "config-not-found",
7576
+ CONFIG_INVALID: "config-invalid",
7577
+ PATH_RESOLUTION_ERROR: "path-resolution-error",
7578
+ FILE_OPERATION_ERROR: "file-operation-error",
7579
+ FILE_NOT_FOUND: "file-not-found",
7580
+ PERMISSION_DENIED: "permission-denied",
7581
+ GENERATION_ERROR: "generation-error",
7582
+ TEMPLATE_ERROR: "template-error",
7583
+ TEMPLATE_NOT_FOUND: "template-not-found",
7584
+ CLI_EXECUTION_ERROR: "cli-execution-error",
7585
+ COMMAND_NOT_FOUND: "command-not-found",
7586
+ COMMAND_FAILED: "command-failed",
7587
+ VALIDATION_ERROR: "validation-error",
7588
+ SCHEMA_ERROR: "schema-error",
7589
+ DEPENDENCY_ERROR: "dependency-error",
7590
+ DEPENDENCY_NOT_FOUND: "dependency-not-found",
7591
+ DEPENDENCY_VERSION_ERROR: "dependency-version-error",
7592
+ INVALID_ARGUMENT: "invalid-argument",
7593
+ MISSING_ARGUMENT: "missing-argument",
7594
+ MISSING_PROJECT_ID: "missing-project-id",
7595
+ FIREBASE_CLI_ERROR: "firebase-cli-error",
7596
+ DEPLOYMENT_FAILED: "deployment-failed",
7597
+ OPERATION_CANCELLED: "operation-cancelled",
7598
+ TIMEOUT_ERROR: "timeout-error",
7599
+ UNKNOWN_ERROR: "unknown-error"
7600
+ };
7573
7601
  DoNotDevError = class _DoNotDevError extends Error {
7574
7602
  /** The error code categorizing this error */
7575
7603
  code;
@@ -7589,7 +7617,7 @@ var init_errors = __esm({
7589
7617
  * @param {Record<string, any>} [options.context] - Additional context data
7590
7618
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7591
7619
  */
7592
- constructor(message, code = "unknown-error", options) {
7620
+ constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7593
7621
  super(message);
7594
7622
  this.name = "DoNotDevError";
7595
7623
  this.code = code;
@@ -7620,7 +7648,7 @@ var init_errors = __esm({
7620
7648
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7621
7649
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
7622
7650
  */
7623
- static from(error2, context, code = "unknown-error", options) {
7651
+ static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7624
7652
  if (!(error2 instanceof Error)) {
7625
7653
  return new _DoNotDevError(
7626
7654
  `Unknown error: ${String(error2)}`,
@@ -7657,21 +7685,21 @@ var init_errors = __esm({
7657
7685
  }
7658
7686
  const message = error2.message.toLowerCase();
7659
7687
  if (error2.name === "ValidationError" || message.includes("validation")) {
7660
- return "validation-error";
7688
+ return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
7661
7689
  }
7662
7690
  if (message.includes("not found") || message.includes("no such file")) {
7663
- return "file-not-found";
7691
+ return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
7664
7692
  }
7665
7693
  if (message.includes("permission") || message.includes("access denied")) {
7666
- return "permission-denied";
7694
+ return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
7667
7695
  }
7668
7696
  if (message.includes("timeout") || message.includes("timed out")) {
7669
- return "timeout-error";
7697
+ return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
7670
7698
  }
7671
7699
  if (message.includes("dependency") || message.includes("module not found")) {
7672
- return "dependency-error";
7700
+ return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
7673
7701
  }
7674
- return "unknown-error";
7702
+ return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
7675
7703
  }
7676
7704
  };
7677
7705
  }
@@ -7686,6 +7714,7 @@ import {
7686
7714
  extname as extname2,
7687
7715
  relative as relative2,
7688
7716
  resolve as resolve2,
7717
+ parse,
7689
7718
  isAbsolute as pathIsAbsolute
7690
7719
  } from "node:path";
7691
7720
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -7693,22 +7722,21 @@ function getDirnameFromUrl(importMetaUrl) {
7693
7722
  return dirname2(fileURLToPath2(importMetaUrl));
7694
7723
  }
7695
7724
  function detectExecutionMode() {
7696
- const currentDir = process.cwd();
7697
- const toolingPath = joinPath(currentDir, PACKAGE_PATHS.TOOLING);
7698
- if (pathExists(toolingPath)) {
7699
- return "development";
7725
+ const fileUrlPath = fileURLToPath2(import.meta.url);
7726
+ if (fileUrlPath.includes("node_modules")) {
7727
+ return "published";
7700
7728
  }
7701
- const fileUrlPath = new URL(import.meta.url).pathname;
7702
- if (fileUrlPath.includes("node_modules/@donotdev/cli")) {
7729
+ if (fileUrlPath.includes("/dist/")) {
7703
7730
  return "published";
7704
7731
  }
7705
- return "published";
7732
+ return "development";
7706
7733
  }
7707
7734
  function getTemplatesRoot() {
7708
7735
  const mode = detectExecutionMode();
7709
7736
  if (mode === "development") {
7710
- const repoRoot = getRepoRoot();
7711
- return normalizePath(repoRoot, PACKAGE_PATHS.CLI, "templates");
7737
+ const fileUrlPath = fileURLToPath2(import.meta.url);
7738
+ const frameworkRoot = normalizePath(dirname2(fileUrlPath), "../../../..");
7739
+ return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
7712
7740
  } else {
7713
7741
  try {
7714
7742
  const cliRoot2 = resolveFrameworkPackage("@donotdev/cli");
@@ -7730,10 +7758,43 @@ function getTemplatesRoot() {
7730
7758
  }
7731
7759
  } catch {
7732
7760
  }
7761
+ try {
7762
+ const currentScriptDir = getDirnameFromUrl(import.meta.url);
7763
+ const packageRoot = findPackageRootUp(currentScriptDir, "@donotdev/cli");
7764
+ if (packageRoot) {
7765
+ const templatesPath = normalizePath(packageRoot, "templates");
7766
+ if (pathExists(templatesPath)) {
7767
+ return templatesPath;
7768
+ }
7769
+ }
7770
+ } catch {
7771
+ }
7733
7772
  const cliRoot = getCliRootFromBundle();
7734
7773
  return normalizePath(cliRoot, "templates");
7735
7774
  }
7736
7775
  }
7776
+ function findPackageRootUp(startDir, packageName) {
7777
+ let currentDir = normalizePath(startDir);
7778
+ const root = parse(currentDir).root;
7779
+ const fs2 = createRequire2(import.meta.url)("node:fs");
7780
+ while (currentDir !== root) {
7781
+ const packageJsonPath = joinPath(currentDir, "package.json");
7782
+ if (fs2.existsSync(packageJsonPath)) {
7783
+ try {
7784
+ const content = fs2.readFileSync(packageJsonPath, "utf8");
7785
+ const pkg = JSON.parse(content);
7786
+ if (pkg.name === packageName) {
7787
+ return currentDir;
7788
+ }
7789
+ } catch {
7790
+ }
7791
+ }
7792
+ const parentDir = getDirname(currentDir);
7793
+ if (parentDir === currentDir) break;
7794
+ currentDir = parentDir;
7795
+ }
7796
+ return null;
7797
+ }
7737
7798
  function getCliRootFromBundle() {
7738
7799
  const currentDir = getDirnameFromUrl(import.meta.url);
7739
7800
  return normalizePath(currentDir, "..", "..", "..");
@@ -7854,18 +7915,7 @@ var init_utils = __esm({
7854
7915
  }
7855
7916
  });
7856
7917
 
7857
- // packages/cli/src/bin/commands/bump.ts
7858
- init_utils();
7859
-
7860
- // packages/tooling/src/index.ts
7861
- init_utils();
7862
-
7863
- // packages/tooling/src/cli/index.ts
7864
- init_utils();
7865
-
7866
7918
  // packages/tooling/src/utils/cli-input.ts
7867
- init_utils();
7868
- init_dist2();
7869
7919
  async function askForConfirmation(message, defaultValue = false) {
7870
7920
  const result = await ye({
7871
7921
  message,
@@ -7894,6 +7944,22 @@ async function askForSelection(message, choices, defaultValue = 0) {
7894
7944
  }
7895
7945
  return result;
7896
7946
  }
7947
+ var init_cli_input = __esm({
7948
+ "packages/tooling/src/utils/cli-input.ts"() {
7949
+ "use strict";
7950
+ init_utils();
7951
+ init_dist2();
7952
+ }
7953
+ });
7954
+
7955
+ // packages/cli/src/bin/commands/bump.ts
7956
+ init_utils();
7957
+
7958
+ // packages/tooling/src/index.ts
7959
+ init_utils();
7960
+
7961
+ // packages/tooling/src/cli/index.ts
7962
+ init_utils();
7897
7963
 
7898
7964
  // packages/tooling/src/utils/matrix.ts
7899
7965
  init_utils();
@@ -8040,6 +8106,7 @@ function compareVersions(current, expected) {
8040
8106
 
8041
8107
  // packages/tooling/src/maintenance/bump.ts
8042
8108
  init_utils();
8109
+ init_cli_input();
8043
8110
  init_cli_output();
8044
8111
  init_pathResolver();
8045
8112
 
@@ -8061,11 +8128,15 @@ var SYNC_PATHS = [
8061
8128
  "CLAUDE.md.example",
8062
8129
  // MCP config
8063
8130
  ".cursor/mcp.json.example",
8064
- ".mcp.json.example"
8131
+ ".mcp.json.example",
8132
+ // Project args (created if missing, preserved if customized)
8133
+ ".dndev/args.json.example"
8065
8134
  ];
8066
8135
  var PRESERVE_IF_EXISTS = [
8067
- "CLAUDE.md"
8136
+ "CLAUDE.md",
8068
8137
  // User may have customized
8138
+ "args.json"
8139
+ // User/agent may have customized features
8069
8140
  ];
8070
8141
  function getSourceTemplatesPath() {
8071
8142
  try {
@@ -8074,10 +8145,27 @@ function getSourceTemplatesPath() {
8074
8145
  if (pathExists(rootConsumerPath)) {
8075
8146
  return normalizePath(rootConsumerPath);
8076
8147
  }
8077
- return null;
8078
- } catch (error2) {
8079
- return null;
8148
+ } catch {
8149
+ }
8150
+ const appRoot = getAppRoot();
8151
+ if (appRoot) {
8152
+ const directPath = joinPath(
8153
+ appRoot,
8154
+ "node_modules",
8155
+ "@donotdev",
8156
+ "cli",
8157
+ "templates",
8158
+ "root-consumer"
8159
+ );
8160
+ if (pathExists(directPath)) {
8161
+ log.info("Found templates via node_modules lookup");
8162
+ return normalizePath(directPath);
8163
+ }
8080
8164
  }
8165
+ log.warn(
8166
+ "Could not find @donotdev/cli templates. Is @donotdev/cli installed?"
8167
+ );
8168
+ return null;
8081
8169
  }
8082
8170
  async function syncFile(sourcePath, destPath, preserveIfExists, appRoot) {
8083
8171
  const destPathWithoutExample = destPath.endsWith(".example") ? destPath.slice(0, -8) : destPath;
@@ -8107,7 +8195,7 @@ async function syncFile(sourcePath, destPath, preserveIfExists, appRoot) {
8107
8195
  }
8108
8196
  }
8109
8197
  await ensureDir(getDirname(destPathWithoutExample));
8110
- await write(destPathWithoutExample, content, { format: "text" });
8198
+ await write(destPathWithoutExample, content, { format: "text", overwrite: true });
8111
8199
  return true;
8112
8200
  }
8113
8201
  async function syncTemplates(sourceRoot, destRoot, dryRun) {
@@ -8194,7 +8282,7 @@ async function syncDocumentation(options = {}) {
8194
8282
  }
8195
8283
  const sourceRoot = getSourceTemplatesPath();
8196
8284
  if (!sourceRoot) {
8197
- log.warn("Could not find framework templates. Documentation sync skipped.");
8285
+ log.error("Could not find framework templates. Documentation sync failed.");
8198
8286
  log.info("");
8199
8287
  log.info(" Templates are looked up the same way as create-project:");
8200
8288
  log.info(" \u2022 Published mode: node_modules/@donotdev/cli/templates");
@@ -8203,7 +8291,7 @@ async function syncDocumentation(options = {}) {
8203
8291
  log.info(" To enable docs sync:");
8204
8292
  log.info(" \u2022 Install @donotdev/cli: bun add -D @donotdev/cli");
8205
8293
  log.info(" \u2022 Or run from framework monorepo (dev mode)");
8206
- return 0;
8294
+ return 1;
8207
8295
  }
8208
8296
  log.info(`Source templates: ${sourceRoot}`);
8209
8297
  log.info(`Destination: ${appRoot}`);
@@ -1596,7 +1596,7 @@ var require_parse = __commonJS({
1596
1596
  CHAR_NO_BREAK_SPACE,
1597
1597
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
1598
1598
  } = require_constants();
1599
- var parse = (input, options = {}) => {
1599
+ var parse2 = (input, options = {}) => {
1600
1600
  if (typeof input !== "string") {
1601
1601
  throw new TypeError("Expected a string");
1602
1602
  }
@@ -1796,7 +1796,7 @@ var require_parse = __commonJS({
1796
1796
  push({ type: "eos" });
1797
1797
  return ast;
1798
1798
  };
1799
- module.exports = parse;
1799
+ module.exports = parse2;
1800
1800
  }
1801
1801
  });
1802
1802
 
@@ -1808,7 +1808,7 @@ var require_braces = __commonJS({
1808
1808
  var stringify2 = require_stringify();
1809
1809
  var compile = require_compile();
1810
1810
  var expand = require_expand();
1811
- var parse = require_parse();
1811
+ var parse2 = require_parse();
1812
1812
  var braces = (input, options = {}) => {
1813
1813
  let output = [];
1814
1814
  if (Array.isArray(input)) {
@@ -1828,7 +1828,7 @@ var require_braces = __commonJS({
1828
1828
  }
1829
1829
  return output;
1830
1830
  };
1831
- braces.parse = (input, options = {}) => parse(input, options);
1831
+ braces.parse = (input, options = {}) => parse2(input, options);
1832
1832
  braces.stringify = (input, options = {}) => {
1833
1833
  if (typeof input === "string") {
1834
1834
  return stringify2(braces.parse(input, options), options);
@@ -2485,7 +2485,7 @@ var require_parse2 = __commonJS({
2485
2485
  var syntaxError = (type, char) => {
2486
2486
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2487
2487
  };
2488
- var parse = (input, options) => {
2488
+ var parse2 = (input, options) => {
2489
2489
  if (typeof input !== "string") {
2490
2490
  throw new TypeError("Expected a string");
2491
2491
  }
@@ -2634,7 +2634,7 @@ var require_parse2 = __commonJS({
2634
2634
  output = token.close = `)$))${extglobStar}`;
2635
2635
  }
2636
2636
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
2637
- const expression = parse(rest, { ...options, fastpaths: false }).output;
2637
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
2638
2638
  output = token.close = `)${expression})${extglobStar})`;
2639
2639
  }
2640
2640
  if (token.prev.type === "bos") {
@@ -3159,7 +3159,7 @@ var require_parse2 = __commonJS({
3159
3159
  }
3160
3160
  return state;
3161
3161
  };
3162
- parse.fastpaths = (input, options) => {
3162
+ parse2.fastpaths = (input, options) => {
3163
3163
  const opts = { ...options };
3164
3164
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
3165
3165
  const len = input.length;
@@ -3225,7 +3225,7 @@ var require_parse2 = __commonJS({
3225
3225
  }
3226
3226
  return source;
3227
3227
  };
3228
- module.exports = parse;
3228
+ module.exports = parse2;
3229
3229
  }
3230
3230
  });
3231
3231
 
@@ -3236,7 +3236,7 @@ var require_picomatch = __commonJS({
3236
3236
  init_utils();
3237
3237
  var path = __require("path");
3238
3238
  var scan = require_scan();
3239
- var parse = require_parse2();
3239
+ var parse2 = require_parse2();
3240
3240
  var utils = require_utils2();
3241
3241
  var constants2 = require_constants2();
3242
3242
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -3324,7 +3324,7 @@ var require_picomatch = __commonJS({
3324
3324
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3325
3325
  picomatch.parse = (pattern, options) => {
3326
3326
  if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
3327
- return parse(pattern, { ...options, fastpaths: false });
3327
+ return parse2(pattern, { ...options, fastpaths: false });
3328
3328
  };
3329
3329
  picomatch.scan = (input, options) => scan(input, options);
3330
3330
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -3350,10 +3350,10 @@ var require_picomatch = __commonJS({
3350
3350
  }
3351
3351
  let parsed = { negated: false, fastpaths: true };
3352
3352
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
3353
- parsed.output = parse.fastpaths(input, options);
3353
+ parsed.output = parse2.fastpaths(input, options);
3354
3354
  }
3355
3355
  if (!parsed.output) {
3356
- parsed = parse(input, options);
3356
+ parsed = parse2(input, options);
3357
3357
  }
3358
3358
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
3359
3359
  };
@@ -7215,11 +7215,39 @@ var init_PathResolver = __esm({
7215
7215
  });
7216
7216
 
7217
7217
  // packages/tooling/src/utils/errors.ts
7218
- var DoNotDevError;
7218
+ var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
7219
7219
  var init_errors = __esm({
7220
7220
  "packages/tooling/src/utils/errors.ts"() {
7221
7221
  "use strict";
7222
7222
  init_utils();
7223
+ DO_NOT_DEV_ERROR_CODES = {
7224
+ CONFIGURATION_ERROR: "configuration-error",
7225
+ CONFIG_NOT_FOUND: "config-not-found",
7226
+ CONFIG_INVALID: "config-invalid",
7227
+ PATH_RESOLUTION_ERROR: "path-resolution-error",
7228
+ FILE_OPERATION_ERROR: "file-operation-error",
7229
+ FILE_NOT_FOUND: "file-not-found",
7230
+ PERMISSION_DENIED: "permission-denied",
7231
+ GENERATION_ERROR: "generation-error",
7232
+ TEMPLATE_ERROR: "template-error",
7233
+ TEMPLATE_NOT_FOUND: "template-not-found",
7234
+ CLI_EXECUTION_ERROR: "cli-execution-error",
7235
+ COMMAND_NOT_FOUND: "command-not-found",
7236
+ COMMAND_FAILED: "command-failed",
7237
+ VALIDATION_ERROR: "validation-error",
7238
+ SCHEMA_ERROR: "schema-error",
7239
+ DEPENDENCY_ERROR: "dependency-error",
7240
+ DEPENDENCY_NOT_FOUND: "dependency-not-found",
7241
+ DEPENDENCY_VERSION_ERROR: "dependency-version-error",
7242
+ INVALID_ARGUMENT: "invalid-argument",
7243
+ MISSING_ARGUMENT: "missing-argument",
7244
+ MISSING_PROJECT_ID: "missing-project-id",
7245
+ FIREBASE_CLI_ERROR: "firebase-cli-error",
7246
+ DEPLOYMENT_FAILED: "deployment-failed",
7247
+ OPERATION_CANCELLED: "operation-cancelled",
7248
+ TIMEOUT_ERROR: "timeout-error",
7249
+ UNKNOWN_ERROR: "unknown-error"
7250
+ };
7223
7251
  DoNotDevError = class _DoNotDevError extends Error {
7224
7252
  /** The error code categorizing this error */
7225
7253
  code;
@@ -7239,7 +7267,7 @@ var init_errors = __esm({
7239
7267
  * @param {Record<string, any>} [options.context] - Additional context data
7240
7268
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7241
7269
  */
7242
- constructor(message, code = "unknown-error", options) {
7270
+ constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7243
7271
  super(message);
7244
7272
  this.name = "DoNotDevError";
7245
7273
  this.code = code;
@@ -7270,7 +7298,7 @@ var init_errors = __esm({
7270
7298
  * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7271
7299
  * @returns {DoNotDevError} New DoNotDev error wrapping the original
7272
7300
  */
7273
- static from(error2, context, code = "unknown-error", options) {
7301
+ static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7274
7302
  if (!(error2 instanceof Error)) {
7275
7303
  return new _DoNotDevError(
7276
7304
  `Unknown error: ${String(error2)}`,
@@ -7307,21 +7335,21 @@ var init_errors = __esm({
7307
7335
  }
7308
7336
  const message = error2.message.toLowerCase();
7309
7337
  if (error2.name === "ValidationError" || message.includes("validation")) {
7310
- return "validation-error";
7338
+ return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
7311
7339
  }
7312
7340
  if (message.includes("not found") || message.includes("no such file")) {
7313
- return "file-not-found";
7341
+ return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
7314
7342
  }
7315
7343
  if (message.includes("permission") || message.includes("access denied")) {
7316
- return "permission-denied";
7344
+ return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
7317
7345
  }
7318
7346
  if (message.includes("timeout") || message.includes("timed out")) {
7319
- return "timeout-error";
7347
+ return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
7320
7348
  }
7321
7349
  if (message.includes("dependency") || message.includes("module not found")) {
7322
- return "dependency-error";
7350
+ return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
7323
7351
  }
7324
- return "unknown-error";
7352
+ return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
7325
7353
  }
7326
7354
  };
7327
7355
  }
@@ -7336,6 +7364,7 @@ import {
7336
7364
  extname as extname2,
7337
7365
  relative as relative2,
7338
7366
  resolve as resolve2,
7367
+ parse,
7339
7368
  isAbsolute as pathIsAbsolute
7340
7369
  } from "node:path";
7341
7370
  import { fileURLToPath as fileURLToPath2 } from "node:url";