@donotdev/cli 0.0.13 → 0.0.14

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 (32) hide show
  1. package/dependencies-matrix.json +2 -2
  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 +623 -0
  5. package/dist/bin/commands/agent-setup.js.map +1 -0
  6. package/dist/bin/commands/build.js +13 -12
  7. package/dist/bin/commands/bump.js +70 -28
  8. package/dist/bin/commands/cacheout.js +13 -12
  9. package/dist/bin/commands/create-app.js +53 -151
  10. package/dist/bin/commands/create-project.js +72 -166
  11. package/dist/bin/commands/deploy.js +16 -15
  12. package/dist/bin/commands/dev.js +13 -12
  13. package/dist/bin/commands/emu.js +13 -12
  14. package/dist/bin/commands/format.js +13 -12
  15. package/dist/bin/commands/lint.js +13 -12
  16. package/dist/bin/commands/preview.js +13 -12
  17. package/dist/bin/commands/sync-secrets.js +13 -12
  18. package/dist/bin/commands/wai.js +7397 -11
  19. package/dist/index.js +74 -55
  20. package/package.json +1 -1
  21. package/templates/root-consumer/.claude/commands/brainstorm.md.example +1 -1
  22. package/templates/root-consumer/.claude/commands/build.md.example +1 -1
  23. package/templates/root-consumer/.claude/commands/design.md.example +1 -1
  24. package/templates/root-consumer/.claude/commands/polish.md.example +1 -1
  25. package/templates/root-consumer/.dndev/args.json.example +6 -0
  26. package/templates/root-consumer/.gemini/settings.json.example +2 -2
  27. package/templates/root-consumer/AI.md.example +25 -14
  28. package/templates/root-consumer/CLAUDE.md.example +10 -4
  29. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +34 -0
  30. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +186 -0
  31. package/templates/root-consumer/guides/dndev/INDEX.md.example +1 -0
  32. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +12 -7
@@ -2139,7 +2139,7 @@ var require_parse = __commonJS({
2139
2139
  CHAR_NO_BREAK_SPACE,
2140
2140
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
2141
2141
  } = require_constants();
2142
- var parse = (input, options = {}) => {
2142
+ var parse2 = (input, options = {}) => {
2143
2143
  if (typeof input !== "string") {
2144
2144
  throw new TypeError("Expected a string");
2145
2145
  }
@@ -2339,7 +2339,7 @@ var require_parse = __commonJS({
2339
2339
  push({ type: "eos" });
2340
2340
  return ast;
2341
2341
  };
2342
- module.exports = parse;
2342
+ module.exports = parse2;
2343
2343
  }
2344
2344
  });
2345
2345
 
@@ -2351,7 +2351,7 @@ var require_braces = __commonJS({
2351
2351
  var stringify2 = require_stringify();
2352
2352
  var compile = require_compile();
2353
2353
  var expand = require_expand();
2354
- var parse = require_parse();
2354
+ var parse2 = require_parse();
2355
2355
  var braces = (input, options = {}) => {
2356
2356
  let output = [];
2357
2357
  if (Array.isArray(input)) {
@@ -2371,7 +2371,7 @@ var require_braces = __commonJS({
2371
2371
  }
2372
2372
  return output;
2373
2373
  };
2374
- braces.parse = (input, options = {}) => parse(input, options);
2374
+ braces.parse = (input, options = {}) => parse2(input, options);
2375
2375
  braces.stringify = (input, options = {}) => {
2376
2376
  if (typeof input === "string") {
2377
2377
  return stringify2(braces.parse(input, options), options);
@@ -3028,7 +3028,7 @@ var require_parse2 = __commonJS({
3028
3028
  var syntaxError = (type, char) => {
3029
3029
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
3030
3030
  };
3031
- var parse = (input, options) => {
3031
+ var parse2 = (input, options) => {
3032
3032
  if (typeof input !== "string") {
3033
3033
  throw new TypeError("Expected a string");
3034
3034
  }
@@ -3177,7 +3177,7 @@ var require_parse2 = __commonJS({
3177
3177
  output = token.close = `)$))${extglobStar}`;
3178
3178
  }
3179
3179
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
3180
- const expression = parse(rest, { ...options, fastpaths: false }).output;
3180
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
3181
3181
  output = token.close = `)${expression})${extglobStar})`;
3182
3182
  }
3183
3183
  if (token.prev.type === "bos") {
@@ -3702,7 +3702,7 @@ var require_parse2 = __commonJS({
3702
3702
  }
3703
3703
  return state;
3704
3704
  };
3705
- parse.fastpaths = (input, options) => {
3705
+ parse2.fastpaths = (input, options) => {
3706
3706
  const opts = { ...options };
3707
3707
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
3708
3708
  const len = input.length;
@@ -3768,7 +3768,7 @@ var require_parse2 = __commonJS({
3768
3768
  }
3769
3769
  return source;
3770
3770
  };
3771
- module.exports = parse;
3771
+ module.exports = parse2;
3772
3772
  }
3773
3773
  });
3774
3774
 
@@ -3779,7 +3779,7 @@ var require_picomatch = __commonJS({
3779
3779
  init_utils();
3780
3780
  var path = __require("path");
3781
3781
  var scan = require_scan();
3782
- var parse = require_parse2();
3782
+ var parse2 = require_parse2();
3783
3783
  var utils = require_utils2();
3784
3784
  var constants2 = require_constants2();
3785
3785
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -3867,7 +3867,7 @@ var require_picomatch = __commonJS({
3867
3867
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3868
3868
  picomatch.parse = (pattern, options) => {
3869
3869
  if (Array.isArray(pattern)) return pattern.map((p2) => picomatch.parse(p2, options));
3870
- return parse(pattern, { ...options, fastpaths: false });
3870
+ return parse2(pattern, { ...options, fastpaths: false });
3871
3871
  };
3872
3872
  picomatch.scan = (input, options) => scan(input, options);
3873
3873
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -3893,10 +3893,10 @@ var require_picomatch = __commonJS({
3893
3893
  }
3894
3894
  let parsed = { negated: false, fastpaths: true };
3895
3895
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
3896
- parsed.output = parse.fastpaths(input, options);
3896
+ parsed.output = parse2.fastpaths(input, options);
3897
3897
  }
3898
3898
  if (!parsed.output) {
3899
- parsed = parse(input, options);
3899
+ parsed = parse2(input, options);
3900
3900
  }
3901
3901
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
3902
3902
  };
@@ -7757,119 +7757,6 @@ var init_PathResolver = __esm({
7757
7757
  }
7758
7758
  });
7759
7759
 
7760
- // packages/tooling/src/utils/errors.ts
7761
- var DoNotDevError;
7762
- var init_errors = __esm({
7763
- "packages/tooling/src/utils/errors.ts"() {
7764
- "use strict";
7765
- init_utils();
7766
- DoNotDevError = class _DoNotDevError extends Error {
7767
- /** The error code categorizing this error */
7768
- code;
7769
- /** Original error if this is wrapping another error */
7770
- originalError;
7771
- /** Additional context for the error */
7772
- context;
7773
- /** Whether this error should be displayed to the user */
7774
- displayable;
7775
- /**
7776
- * Creates a new DoNotDev error
7777
- *
7778
- * @param {string} message - Error message
7779
- * @param {DoNotDevErrorCode} code - Error code
7780
- * @param {object} [options] - Additional error options
7781
- * @param {Error} [options.originalError] - Original error if wrapping
7782
- * @param {Record<string, any>} [options.context] - Additional context data
7783
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7784
- */
7785
- constructor(message, code = "unknown-error", options) {
7786
- super(message);
7787
- this.name = "DoNotDevError";
7788
- this.code = code;
7789
- this.originalError = options?.originalError;
7790
- this.context = options?.context;
7791
- this.displayable = options?.displayable !== false;
7792
- Object.setPrototypeOf(this, _DoNotDevError.prototype);
7793
- if (Error.captureStackTrace) {
7794
- Error.captureStackTrace(this, _DoNotDevError);
7795
- }
7796
- }
7797
- /**
7798
- * Formats the error for logging or display
7799
- *
7800
- * @returns {string} Formatted error message with code
7801
- */
7802
- format() {
7803
- return `[${this.code}] ${this.message}`;
7804
- }
7805
- /**
7806
- * Creates a wrapped error from another error
7807
- *
7808
- * @param {Error} error - Original error to wrap
7809
- * @param {string} [context] - Additional context for the error
7810
- * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
7811
- * @param {object} [options] - Additional error options
7812
- * @param {Record<string, any>} [options.context] - Additional context data
7813
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7814
- * @returns {DoNotDevError} New DoNotDev error wrapping the original
7815
- */
7816
- static from(error2, context, code = "unknown-error", options) {
7817
- if (!(error2 instanceof Error)) {
7818
- return new _DoNotDevError(
7819
- `Unknown error: ${String(error2)}`,
7820
- code,
7821
- options
7822
- );
7823
- }
7824
- if (error2 instanceof _DoNotDevError) {
7825
- if (!context) {
7826
- return error2;
7827
- }
7828
- return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
7829
- originalError: error2.originalError || error2,
7830
- context: { ...error2.context, ...options?.context || {} },
7831
- displayable: options?.displayable ?? error2.displayable
7832
- });
7833
- }
7834
- const message = context ? `${context}: ${error2.message}` : error2.message;
7835
- return new _DoNotDevError(message, code, {
7836
- originalError: error2,
7837
- context: options?.context,
7838
- displayable: options?.displayable
7839
- });
7840
- }
7841
- /**
7842
- * Maps common error types to DoNotDevErrorCode
7843
- *
7844
- * @param {Error} error - Error to analyze
7845
- * @returns {DoNotDevErrorCode} Mapped error code
7846
- */
7847
- static getErrorCodeFromError(error2) {
7848
- if (error2 instanceof _DoNotDevError) {
7849
- return error2.code;
7850
- }
7851
- const message = error2.message.toLowerCase();
7852
- if (error2.name === "ValidationError" || message.includes("validation")) {
7853
- return "validation-error";
7854
- }
7855
- if (message.includes("not found") || message.includes("no such file")) {
7856
- return "file-not-found";
7857
- }
7858
- if (message.includes("permission") || message.includes("access denied")) {
7859
- return "permission-denied";
7860
- }
7861
- if (message.includes("timeout") || message.includes("timed out")) {
7862
- return "timeout-error";
7863
- }
7864
- if (message.includes("dependency") || message.includes("module not found")) {
7865
- return "dependency-error";
7866
- }
7867
- return "unknown-error";
7868
- }
7869
- };
7870
- }
7871
- });
7872
-
7873
7760
  // packages/tooling/src/utils/pathResolver.ts
7874
7761
  var pathResolver_exports = {};
7875
7762
  __export(pathResolver_exports, {
@@ -7884,6 +7771,7 @@ __export(pathResolver_exports, {
7884
7771
  ensureDirSync: () => ensureDirSync,
7885
7772
  findFiles: () => findFiles,
7886
7773
  findNodeModulesDir: () => findNodeModulesDir,
7774
+ findPackageRootUp: () => findPackageRootUp,
7887
7775
  fromAppRoot: () => fromAppRoot,
7888
7776
  getAppRoot: () => getAppRoot,
7889
7777
  getBasename: () => getBasename,
@@ -7900,7 +7788,6 @@ __export(pathResolver_exports, {
7900
7788
  getRelativePathBetween: () => getRelativePathBetween,
7901
7789
  getRepoRoot: () => getRepoRoot,
7902
7790
  getTemplatesRoot: () => getTemplatesRoot,
7903
- getToolingPath: () => getToolingPath,
7904
7791
  glob: () => glob,
7905
7792
  globSync: () => globSync,
7906
7793
  isAbsolute: () => isAbsolute,
@@ -7939,6 +7826,7 @@ import {
7939
7826
  extname as extname2,
7940
7827
  relative as relative2,
7941
7828
  resolve as resolve2,
7829
+ parse,
7942
7830
  isAbsolute as pathIsAbsolute
7943
7831
  } from "node:path";
7944
7832
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -7995,37 +7883,19 @@ function getBinPath(binaryName) {
7995
7883
  }
7996
7884
  return binaryName;
7997
7885
  }
7998
- function getToolingPath() {
7999
- const mode = detectExecutionMode();
8000
- if (mode === "development") {
8001
- const repoRoot = getRepoRoot();
8002
- const packagesToolingPath = normalizePath(repoRoot, PACKAGE_PATHS.TOOLING);
8003
- if (pathExists(packagesToolingPath)) {
8004
- return normalizePath(packagesToolingPath);
8005
- }
8006
- }
8007
- throw new DoNotDevError(
8008
- "Could not find tooling package. This function is only available in development mode.",
8009
- "path-resolution-error"
8010
- );
8011
- }
8012
7886
  function detectExecutionMode() {
8013
- const currentDir = process.cwd();
8014
- const toolingPath = joinPath(currentDir, PACKAGE_PATHS.TOOLING);
8015
- if (pathExists(toolingPath)) {
8016
- return "development";
8017
- }
8018
7887
  const fileUrlPath = new URL(import.meta.url).pathname;
8019
- if (fileUrlPath.includes("node_modules/@donotdev/cli")) {
8020
- return "published";
7888
+ if (!fileUrlPath.includes("node_modules")) {
7889
+ return "development";
8021
7890
  }
8022
7891
  return "published";
8023
7892
  }
8024
7893
  function getTemplatesRoot() {
8025
7894
  const mode = detectExecutionMode();
8026
7895
  if (mode === "development") {
8027
- const repoRoot = getRepoRoot();
8028
- return normalizePath(repoRoot, PACKAGE_PATHS.CLI, "templates");
7896
+ const fileUrlPath = new URL(import.meta.url).pathname;
7897
+ const frameworkRoot = normalizePath(dirname2(fileUrlPath), "../../../..");
7898
+ return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
8029
7899
  } else {
8030
7900
  try {
8031
7901
  const cliRoot2 = resolveFrameworkPackage("@donotdev/cli");
@@ -8047,10 +7917,43 @@ function getTemplatesRoot() {
8047
7917
  }
8048
7918
  } catch {
8049
7919
  }
7920
+ try {
7921
+ const currentScriptDir = getDirnameFromUrl(import.meta.url);
7922
+ const packageRoot = findPackageRootUp(currentScriptDir, "@donotdev/cli");
7923
+ if (packageRoot) {
7924
+ const templatesPath = normalizePath(packageRoot, "templates");
7925
+ if (pathExists(templatesPath)) {
7926
+ return templatesPath;
7927
+ }
7928
+ }
7929
+ } catch {
7930
+ }
8050
7931
  const cliRoot = getCliRootFromBundle();
8051
7932
  return normalizePath(cliRoot, "templates");
8052
7933
  }
8053
7934
  }
7935
+ function findPackageRootUp(startDir, packageName) {
7936
+ let currentDir = normalizePath(startDir);
7937
+ const root = parse(currentDir).root;
7938
+ const fs2 = createRequire2(import.meta.url)("node:fs");
7939
+ while (currentDir !== root) {
7940
+ const packageJsonPath = joinPath(currentDir, "package.json");
7941
+ if (fs2.existsSync(packageJsonPath)) {
7942
+ try {
7943
+ const content = fs2.readFileSync(packageJsonPath, "utf8");
7944
+ const pkg = JSON.parse(content);
7945
+ if (pkg.name === packageName) {
7946
+ return currentDir;
7947
+ }
7948
+ } catch {
7949
+ }
7950
+ }
7951
+ const parentDir = getDirname(currentDir);
7952
+ if (parentDir === currentDir) break;
7953
+ currentDir = parentDir;
7954
+ }
7955
+ return null;
7956
+ }
8054
7957
  function getCliRootFromBundle() {
8055
7958
  const currentDir = getDirnameFromUrl(import.meta.url);
8056
7959
  return normalizePath(currentDir, "..", "..", "..");
@@ -8170,7 +8073,6 @@ var init_pathResolver = __esm({
8170
8073
  "use strict";
8171
8074
  init_utils();
8172
8075
  init_PathResolver();
8173
- init_errors();
8174
8076
  pathResolverInstance = PathResolver.getInstance({ debug: false });
8175
8077
  getPathResolver = (options) => PathResolver.getInstance(options);
8176
8078
  getRepoRoot = () => pathResolverInstance.getRepoRoot();
@@ -8287,7 +8189,7 @@ async function askForInput(message, defaultValue = "") {
8287
8189
  const result = await he({
8288
8190
  message,
8289
8191
  placeholder: defaultValue || void 0,
8290
- initialValue: defaultValue || void 0
8192
+ defaultValue: defaultValue || void 0
8291
8193
  });
8292
8194
  if (pD(result)) {
8293
8195
  xe("Operation cancelled.");