@donotdev/cli 0.0.24 → 0.0.26

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 (34) hide show
  1. package/README.md +7 -295
  2. package/dependencies-matrix.json +47 -135
  3. package/dist/bin/commands/agent-setup.js +3 -3
  4. package/dist/bin/commands/build.js +144 -143
  5. package/dist/bin/commands/bump.js +146 -145
  6. package/dist/bin/commands/cacheout.js +143 -142
  7. package/dist/bin/commands/coach.js +157 -152
  8. package/dist/bin/commands/create-app.js +23 -23
  9. package/dist/bin/commands/create-project.js +166 -165
  10. package/dist/bin/commands/db.js +46705 -46704
  11. package/dist/bin/commands/deploy.js +684 -580
  12. package/dist/bin/commands/dev.js +180 -160
  13. package/dist/bin/commands/doctor.js +153 -152
  14. package/dist/bin/commands/emu.js +174 -168
  15. package/dist/bin/commands/format.js +144 -143
  16. package/dist/bin/commands/get-demo.js +2 -2
  17. package/dist/bin/commands/make-admin.js +64122 -64043
  18. package/dist/bin/commands/preview.js +179 -160
  19. package/dist/bin/commands/seed.js +46705 -46704
  20. package/dist/bin/commands/setup-cicd.js +165 -159
  21. package/dist/bin/commands/setup.js +414 -214
  22. package/dist/bin/commands/staging.js +684 -580
  23. package/dist/bin/commands/sync-secrets.js +143 -142
  24. package/dist/bin/commands/type-check.js +143 -142
  25. package/dist/bin/commands/wai.js +1 -1
  26. package/dist/bin/dndev.js +79 -1
  27. package/dist/index.js +713 -593
  28. package/package.json +1 -1
  29. package/templates/root-consumer/.cursor/mcp.json.example +1 -1
  30. package/templates/root-consumer/.gemini/settings.json.example +1 -1
  31. package/templates/root-consumer/.mcp.json.example +1 -1
  32. package/templates/root-consumer/bunfig.toml.example +6 -53
  33. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +26 -9
  34. package/templates/root-consumer/vercel.json.example +2 -1
@@ -767,6 +767,148 @@ var init_cli_output = __esm({
767
767
  }
768
768
  });
769
769
 
770
+ // packages/tooling/src/utils/errors.ts
771
+ var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
772
+ var init_errors = __esm({
773
+ "packages/tooling/src/utils/errors.ts"() {
774
+ "use strict";
775
+ init_utils();
776
+ DO_NOT_DEV_ERROR_CODES = {
777
+ CONFIGURATION_ERROR: "configuration-error",
778
+ CONFIG_NOT_FOUND: "config-not-found",
779
+ CONFIG_INVALID: "config-invalid",
780
+ PATH_RESOLUTION_ERROR: "path-resolution-error",
781
+ FILE_OPERATION_ERROR: "file-operation-error",
782
+ FILE_NOT_FOUND: "file-not-found",
783
+ PERMISSION_DENIED: "permission-denied",
784
+ GENERATION_ERROR: "generation-error",
785
+ TEMPLATE_ERROR: "template-error",
786
+ TEMPLATE_NOT_FOUND: "template-not-found",
787
+ CLI_EXECUTION_ERROR: "cli-execution-error",
788
+ COMMAND_NOT_FOUND: "command-not-found",
789
+ COMMAND_FAILED: "command-failed",
790
+ VALIDATION_ERROR: "validation-error",
791
+ SCHEMA_ERROR: "schema-error",
792
+ DEPENDENCY_ERROR: "dependency-error",
793
+ DEPENDENCY_NOT_FOUND: "dependency-not-found",
794
+ DEPENDENCY_VERSION_ERROR: "dependency-version-error",
795
+ INVALID_ARGUMENT: "invalid-argument",
796
+ MISSING_ARGUMENT: "missing-argument",
797
+ MISSING_PROJECT_ID: "missing-project-id",
798
+ FIREBASE_CLI_ERROR: "firebase-cli-error",
799
+ DEPLOYMENT_FAILED: "deployment-failed",
800
+ VERCEL_API_ERROR: "vercel-api-error",
801
+ OPERATION_CANCELLED: "operation-cancelled",
802
+ TIMEOUT_ERROR: "timeout-error",
803
+ UNKNOWN_ERROR: "unknown-error"
804
+ };
805
+ DoNotDevError = class _DoNotDevError extends Error {
806
+ /** The error code categorizing this error */
807
+ code;
808
+ /** Original error if this is wrapping another error */
809
+ originalError;
810
+ /** Additional context for the error */
811
+ context;
812
+ /** Whether this error should be displayed to the user */
813
+ displayable;
814
+ /**
815
+ * Creates a new DoNotDev error
816
+ *
817
+ * @param {string} message - Error message
818
+ * @param {DoNotDevErrorCode} code - Error code
819
+ * @param {object} [options] - Additional error options
820
+ * @param {Error} [options.originalError] - Original error if wrapping
821
+ * @param {Record<string, any>} [options.context] - Additional context data
822
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
823
+ */
824
+ constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
825
+ super(message);
826
+ this.name = "DoNotDevError";
827
+ this.code = code;
828
+ this.originalError = options?.originalError;
829
+ this.context = options?.context;
830
+ this.displayable = options?.displayable !== false;
831
+ Object.setPrototypeOf(this, _DoNotDevError.prototype);
832
+ if (Error.captureStackTrace) {
833
+ Error.captureStackTrace(this, _DoNotDevError);
834
+ }
835
+ }
836
+ /**
837
+ * Formats the error for logging or display
838
+ *
839
+ * @returns {string} Formatted error message with code
840
+ */
841
+ format() {
842
+ return `[${this.code}] ${this.message}`;
843
+ }
844
+ /**
845
+ * Creates a wrapped error from another error
846
+ *
847
+ * @param {Error} error - Original error to wrap
848
+ * @param {string} [context] - Additional context for the error
849
+ * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
850
+ * @param {object} [options] - Additional error options
851
+ * @param {Record<string, any>} [options.context] - Additional context data
852
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
853
+ * @returns {DoNotDevError} New DoNotDev error wrapping the original
854
+ */
855
+ static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
856
+ if (!(error2 instanceof Error)) {
857
+ return new _DoNotDevError(
858
+ `Unknown error: ${String(error2)}`,
859
+ code,
860
+ options
861
+ );
862
+ }
863
+ if (error2 instanceof _DoNotDevError) {
864
+ if (!context) {
865
+ return error2;
866
+ }
867
+ return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
868
+ originalError: error2.originalError || error2,
869
+ context: { ...error2.context, ...options?.context || {} },
870
+ displayable: options?.displayable ?? error2.displayable
871
+ });
872
+ }
873
+ const message = context ? `${context}: ${error2.message}` : error2.message;
874
+ return new _DoNotDevError(message, code, {
875
+ originalError: error2,
876
+ context: options?.context,
877
+ displayable: options?.displayable
878
+ });
879
+ }
880
+ /**
881
+ * Maps common error types to DoNotDevErrorCode
882
+ *
883
+ * @param {Error} error - Error to analyze
884
+ * @returns {DoNotDevErrorCode} Mapped error code
885
+ */
886
+ static getErrorCodeFromError(error2) {
887
+ if (error2 instanceof _DoNotDevError) {
888
+ return error2.code;
889
+ }
890
+ const message = error2.message.toLowerCase();
891
+ if (error2.name === "ValidationError" || message.includes("validation")) {
892
+ return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
893
+ }
894
+ if (message.includes("not found") || message.includes("no such file")) {
895
+ return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
896
+ }
897
+ if (message.includes("permission") || message.includes("access denied")) {
898
+ return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
899
+ }
900
+ if (message.includes("timeout") || message.includes("timed out")) {
901
+ return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
902
+ }
903
+ if (message.includes("dependency") || message.includes("module not found")) {
904
+ return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
905
+ }
906
+ return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
907
+ }
908
+ };
909
+ }
910
+ });
911
+
770
912
  // node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
771
913
  var require_array = __commonJS({
772
914
  "node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
@@ -7510,147 +7652,6 @@ var init_PathResolver = __esm({
7510
7652
  }
7511
7653
  });
7512
7654
 
7513
- // packages/tooling/src/utils/errors.ts
7514
- var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
7515
- var init_errors = __esm({
7516
- "packages/tooling/src/utils/errors.ts"() {
7517
- "use strict";
7518
- init_utils();
7519
- DO_NOT_DEV_ERROR_CODES = {
7520
- CONFIGURATION_ERROR: "configuration-error",
7521
- CONFIG_NOT_FOUND: "config-not-found",
7522
- CONFIG_INVALID: "config-invalid",
7523
- PATH_RESOLUTION_ERROR: "path-resolution-error",
7524
- FILE_OPERATION_ERROR: "file-operation-error",
7525
- FILE_NOT_FOUND: "file-not-found",
7526
- PERMISSION_DENIED: "permission-denied",
7527
- GENERATION_ERROR: "generation-error",
7528
- TEMPLATE_ERROR: "template-error",
7529
- TEMPLATE_NOT_FOUND: "template-not-found",
7530
- CLI_EXECUTION_ERROR: "cli-execution-error",
7531
- COMMAND_NOT_FOUND: "command-not-found",
7532
- COMMAND_FAILED: "command-failed",
7533
- VALIDATION_ERROR: "validation-error",
7534
- SCHEMA_ERROR: "schema-error",
7535
- DEPENDENCY_ERROR: "dependency-error",
7536
- DEPENDENCY_NOT_FOUND: "dependency-not-found",
7537
- DEPENDENCY_VERSION_ERROR: "dependency-version-error",
7538
- INVALID_ARGUMENT: "invalid-argument",
7539
- MISSING_ARGUMENT: "missing-argument",
7540
- MISSING_PROJECT_ID: "missing-project-id",
7541
- FIREBASE_CLI_ERROR: "firebase-cli-error",
7542
- DEPLOYMENT_FAILED: "deployment-failed",
7543
- OPERATION_CANCELLED: "operation-cancelled",
7544
- TIMEOUT_ERROR: "timeout-error",
7545
- UNKNOWN_ERROR: "unknown-error"
7546
- };
7547
- DoNotDevError = class _DoNotDevError extends Error {
7548
- /** The error code categorizing this error */
7549
- code;
7550
- /** Original error if this is wrapping another error */
7551
- originalError;
7552
- /** Additional context for the error */
7553
- context;
7554
- /** Whether this error should be displayed to the user */
7555
- displayable;
7556
- /**
7557
- * Creates a new DoNotDev error
7558
- *
7559
- * @param {string} message - Error message
7560
- * @param {DoNotDevErrorCode} code - Error code
7561
- * @param {object} [options] - Additional error options
7562
- * @param {Error} [options.originalError] - Original error if wrapping
7563
- * @param {Record<string, any>} [options.context] - Additional context data
7564
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7565
- */
7566
- constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7567
- super(message);
7568
- this.name = "DoNotDevError";
7569
- this.code = code;
7570
- this.originalError = options?.originalError;
7571
- this.context = options?.context;
7572
- this.displayable = options?.displayable !== false;
7573
- Object.setPrototypeOf(this, _DoNotDevError.prototype);
7574
- if (Error.captureStackTrace) {
7575
- Error.captureStackTrace(this, _DoNotDevError);
7576
- }
7577
- }
7578
- /**
7579
- * Formats the error for logging or display
7580
- *
7581
- * @returns {string} Formatted error message with code
7582
- */
7583
- format() {
7584
- return `[${this.code}] ${this.message}`;
7585
- }
7586
- /**
7587
- * Creates a wrapped error from another error
7588
- *
7589
- * @param {Error} error - Original error to wrap
7590
- * @param {string} [context] - Additional context for the error
7591
- * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
7592
- * @param {object} [options] - Additional error options
7593
- * @param {Record<string, any>} [options.context] - Additional context data
7594
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7595
- * @returns {DoNotDevError} New DoNotDev error wrapping the original
7596
- */
7597
- static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7598
- if (!(error2 instanceof Error)) {
7599
- return new _DoNotDevError(
7600
- `Unknown error: ${String(error2)}`,
7601
- code,
7602
- options
7603
- );
7604
- }
7605
- if (error2 instanceof _DoNotDevError) {
7606
- if (!context) {
7607
- return error2;
7608
- }
7609
- return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
7610
- originalError: error2.originalError || error2,
7611
- context: { ...error2.context, ...options?.context || {} },
7612
- displayable: options?.displayable ?? error2.displayable
7613
- });
7614
- }
7615
- const message = context ? `${context}: ${error2.message}` : error2.message;
7616
- return new _DoNotDevError(message, code, {
7617
- originalError: error2,
7618
- context: options?.context,
7619
- displayable: options?.displayable
7620
- });
7621
- }
7622
- /**
7623
- * Maps common error types to DoNotDevErrorCode
7624
- *
7625
- * @param {Error} error - Error to analyze
7626
- * @returns {DoNotDevErrorCode} Mapped error code
7627
- */
7628
- static getErrorCodeFromError(error2) {
7629
- if (error2 instanceof _DoNotDevError) {
7630
- return error2.code;
7631
- }
7632
- const message = error2.message.toLowerCase();
7633
- if (error2.name === "ValidationError" || message.includes("validation")) {
7634
- return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
7635
- }
7636
- if (message.includes("not found") || message.includes("no such file")) {
7637
- return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
7638
- }
7639
- if (message.includes("permission") || message.includes("access denied")) {
7640
- return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
7641
- }
7642
- if (message.includes("timeout") || message.includes("timed out")) {
7643
- return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
7644
- }
7645
- if (message.includes("dependency") || message.includes("module not found")) {
7646
- return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
7647
- }
7648
- return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
7649
- }
7650
- };
7651
- }
7652
- });
7653
-
7654
7655
  // packages/tooling/src/utils/pathResolver.ts
7655
7656
  import { createRequire as createRequire2 } from "node:module";
7656
7657
  import {
@@ -7710,14 +7711,14 @@ var init_typed_file_operations = __esm({
7710
7711
  "packages/tooling/src/utils/typed-file-operations.ts"() {
7711
7712
  "use strict";
7712
7713
  init_utils();
7713
- init_pathResolver();
7714
7714
  init_errors();
7715
+ init_pathResolver();
7715
7716
  }
7716
7717
  });
7717
7718
 
7718
7719
  // packages/tooling/src/bundler/utils.ts
7719
7720
  import { Buffer } from "node:buffer";
7720
- import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
7721
+ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
7721
7722
  import { createRequire as createRequire3 } from "node:module";
7722
7723
  import { dirname as dirname3, resolve as resolve3 } from "node:path";
7723
7724
  import process from "node:process";
@@ -7801,23 +7802,23 @@ function analyzeApp(appPath, appName) {
7801
7802
  const functionsPath = joinPath(appPath, "functions");
7802
7803
  const functionsStat = statSync2(functionsPath);
7803
7804
  const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
7804
- let platform2;
7805
+ let platform3;
7805
7806
  const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
7806
7807
  const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
7807
7808
  if (firebaseJsonInFunctions || firebaseJsonInApp) {
7808
- platform2 = "firebase";
7809
+ platform3 = "firebase";
7809
7810
  }
7810
- if (!platform2) {
7811
+ if (!platform3) {
7811
7812
  const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
7812
7813
  const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
7813
7814
  if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
7814
- platform2 = "supabase";
7815
+ platform3 = "supabase";
7815
7816
  }
7816
7817
  }
7817
- if (!platform2) {
7818
+ if (!platform3) {
7818
7819
  const vercelJsonPath = joinPath(appPath, "vercel.json");
7819
7820
  if (pathExists(vercelJsonPath)) {
7820
- platform2 = "vercel";
7821
+ platform3 = "vercel";
7821
7822
  }
7822
7823
  }
7823
7824
  return {
@@ -7828,7 +7829,7 @@ function analyzeApp(appPath, appName) {
7828
7829
  framework,
7829
7830
  hasFunctions,
7830
7831
  functionsPath: hasFunctions ? functionsPath : void 0,
7831
- platform: platform2
7832
+ platform: platform3
7832
7833
  };
7833
7834
  }
7834
7835
  var init_app_detection = __esm({
@@ -7899,18 +7900,34 @@ init_app_selector();
7899
7900
  init_cli_output();
7900
7901
  init_errors();
7901
7902
  init_pathResolver();
7902
- import { spawn, execSync as execSync2 } from "node:child_process";
7903
- import { platform } from "node:os";
7903
+ import { execSync as execSync2 } from "node:child_process";
7904
+ import { platform as platform2 } from "node:os";
7904
7905
 
7905
7906
  // packages/tooling/src/utils/spawn-utils.ts
7906
7907
  init_utils();
7907
- import { spawnSync, execSync } from "node:child_process";
7908
+ import {
7909
+ spawn,
7910
+ spawnSync,
7911
+ execSync
7912
+ } from "node:child_process";
7913
+ import { platform } from "node:os";
7908
7914
  function createAppEnv(appPath) {
7909
7915
  return {
7910
7916
  ...process.env,
7911
7917
  DNDEV_APP_ROOT: appPath
7912
7918
  };
7913
7919
  }
7920
+ function spawnCrossPlatform(command, args, options) {
7921
+ const isWindows = platform() === "win32";
7922
+ const useShell = options.shell ?? isWindows;
7923
+ if (useShell) {
7924
+ const fullCommand = `${command} ${args.join(" ")}`;
7925
+ const { shell: _4, ...rest2 } = options;
7926
+ return spawn(fullCommand, [], { ...rest2, shell: true });
7927
+ }
7928
+ const { shell: _3, ...rest } = options;
7929
+ return spawn(command, args, rest);
7930
+ }
7914
7931
 
7915
7932
  // packages/tooling/src/apps/dev.ts
7916
7933
  var SIGNAL_EXIT_CODES = {
@@ -7936,13 +7953,16 @@ async function main() {
7936
7953
  log.info(`Starting dev server for ${app.name}...
7937
7954
  `);
7938
7955
  const turboArgs = ["dev", "--filter", app.packageName];
7939
- const isWindows = platform() === "win32";
7940
- const childProcess = spawn("bunx", ["turbo", ...turboArgs], {
7941
- stdio: "inherit",
7942
- env: createAppEnv(app.path),
7943
- cwd: projectRoot,
7944
- shell: isWindows
7945
- });
7956
+ const isWindows = platform2() === "win32";
7957
+ const childProcess = spawnCrossPlatform(
7958
+ "bunx",
7959
+ ["turbo", ...turboArgs],
7960
+ {
7961
+ stdio: "inherit",
7962
+ env: createAppEnv(app.path),
7963
+ cwd: projectRoot
7964
+ }
7965
+ );
7946
7966
  const cleanup = (signal) => {
7947
7967
  if (!childProcess.pid) return;
7948
7968
  log.debug(`Received ${signal}, cleaning up processes...`);