@donotdev/cli 0.0.25 → 0.0.27

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/README.md +7 -295
  2. package/dependencies-matrix.json +49 -21
  3. package/dist/bin/commands/agent-setup.js +1 -1
  4. package/dist/bin/commands/build.js +143 -142
  5. package/dist/bin/commands/bump.js +145 -144
  6. package/dist/bin/commands/cacheout.js +142 -141
  7. package/dist/bin/commands/coach.js +156 -151
  8. package/dist/bin/commands/create-app.js +22 -22
  9. package/dist/bin/commands/create-project.js +165 -164
  10. package/dist/bin/commands/db.js +46704 -46703
  11. package/dist/bin/commands/deploy.js +674 -575
  12. package/dist/bin/commands/dev.js +179 -159
  13. package/dist/bin/commands/doctor.js +152 -151
  14. package/dist/bin/commands/emu.js +186 -176
  15. package/dist/bin/commands/format.js +142 -141
  16. package/dist/bin/commands/get-demo.js +1 -1
  17. package/dist/bin/commands/make-admin.js +64133 -64040
  18. package/dist/bin/commands/preview.js +178 -159
  19. package/dist/bin/commands/seed.js +46704 -46703
  20. package/dist/bin/commands/setup-cicd.js +164 -158
  21. package/dist/bin/commands/setup.js +409 -209
  22. package/dist/bin/commands/staging.js +674 -575
  23. package/dist/bin/commands/sync-secrets.js +142 -141
  24. package/dist/bin/commands/type-check.js +142 -141
  25. package/dist/bin/dndev.js +93 -1
  26. package/dist/bin/donotdev.js +93 -1
  27. package/dist/index.js +713 -605
  28. package/package.json +1 -1
  29. package/templates/app-next/postcss.config.js.example +3 -54
  30. package/templates/root-consumer/bunfig.toml.example +6 -49
  31. package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +19 -0
  32. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +50 -9
@@ -790,6 +790,148 @@ var init_cli_output = __esm({
790
790
  }
791
791
  });
792
792
 
793
+ // packages/tooling/src/utils/errors.ts
794
+ var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
795
+ var init_errors = __esm({
796
+ "packages/tooling/src/utils/errors.ts"() {
797
+ "use strict";
798
+ init_utils();
799
+ DO_NOT_DEV_ERROR_CODES = {
800
+ CONFIGURATION_ERROR: "configuration-error",
801
+ CONFIG_NOT_FOUND: "config-not-found",
802
+ CONFIG_INVALID: "config-invalid",
803
+ PATH_RESOLUTION_ERROR: "path-resolution-error",
804
+ FILE_OPERATION_ERROR: "file-operation-error",
805
+ FILE_NOT_FOUND: "file-not-found",
806
+ PERMISSION_DENIED: "permission-denied",
807
+ GENERATION_ERROR: "generation-error",
808
+ TEMPLATE_ERROR: "template-error",
809
+ TEMPLATE_NOT_FOUND: "template-not-found",
810
+ CLI_EXECUTION_ERROR: "cli-execution-error",
811
+ COMMAND_NOT_FOUND: "command-not-found",
812
+ COMMAND_FAILED: "command-failed",
813
+ VALIDATION_ERROR: "validation-error",
814
+ SCHEMA_ERROR: "schema-error",
815
+ DEPENDENCY_ERROR: "dependency-error",
816
+ DEPENDENCY_NOT_FOUND: "dependency-not-found",
817
+ DEPENDENCY_VERSION_ERROR: "dependency-version-error",
818
+ INVALID_ARGUMENT: "invalid-argument",
819
+ MISSING_ARGUMENT: "missing-argument",
820
+ MISSING_PROJECT_ID: "missing-project-id",
821
+ FIREBASE_CLI_ERROR: "firebase-cli-error",
822
+ DEPLOYMENT_FAILED: "deployment-failed",
823
+ VERCEL_API_ERROR: "vercel-api-error",
824
+ OPERATION_CANCELLED: "operation-cancelled",
825
+ TIMEOUT_ERROR: "timeout-error",
826
+ UNKNOWN_ERROR: "unknown-error"
827
+ };
828
+ DoNotDevError = class _DoNotDevError extends Error {
829
+ /** The error code categorizing this error */
830
+ code;
831
+ /** Original error if this is wrapping another error */
832
+ originalError;
833
+ /** Additional context for the error */
834
+ context;
835
+ /** Whether this error should be displayed to the user */
836
+ displayable;
837
+ /**
838
+ * Creates a new DoNotDev error
839
+ *
840
+ * @param {string} message - Error message
841
+ * @param {DoNotDevErrorCode} code - Error code
842
+ * @param {object} [options] - Additional error options
843
+ * @param {Error} [options.originalError] - Original error if wrapping
844
+ * @param {Record<string, any>} [options.context] - Additional context data
845
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
846
+ */
847
+ constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
848
+ super(message);
849
+ this.name = "DoNotDevError";
850
+ this.code = code;
851
+ this.originalError = options?.originalError;
852
+ this.context = options?.context;
853
+ this.displayable = options?.displayable !== false;
854
+ Object.setPrototypeOf(this, _DoNotDevError.prototype);
855
+ if (Error.captureStackTrace) {
856
+ Error.captureStackTrace(this, _DoNotDevError);
857
+ }
858
+ }
859
+ /**
860
+ * Formats the error for logging or display
861
+ *
862
+ * @returns {string} Formatted error message with code
863
+ */
864
+ format() {
865
+ return `[${this.code}] ${this.message}`;
866
+ }
867
+ /**
868
+ * Creates a wrapped error from another error
869
+ *
870
+ * @param {Error} error - Original error to wrap
871
+ * @param {string} [context] - Additional context for the error
872
+ * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
873
+ * @param {object} [options] - Additional error options
874
+ * @param {Record<string, any>} [options.context] - Additional context data
875
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
876
+ * @returns {DoNotDevError} New DoNotDev error wrapping the original
877
+ */
878
+ static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
879
+ if (!(error2 instanceof Error)) {
880
+ return new _DoNotDevError(
881
+ `Unknown error: ${String(error2)}`,
882
+ code,
883
+ options
884
+ );
885
+ }
886
+ if (error2 instanceof _DoNotDevError) {
887
+ if (!context) {
888
+ return error2;
889
+ }
890
+ return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
891
+ originalError: error2.originalError || error2,
892
+ context: { ...error2.context, ...options?.context || {} },
893
+ displayable: options?.displayable ?? error2.displayable
894
+ });
895
+ }
896
+ const message = context ? `${context}: ${error2.message}` : error2.message;
897
+ return new _DoNotDevError(message, code, {
898
+ originalError: error2,
899
+ context: options?.context,
900
+ displayable: options?.displayable
901
+ });
902
+ }
903
+ /**
904
+ * Maps common error types to DoNotDevErrorCode
905
+ *
906
+ * @param {Error} error - Error to analyze
907
+ * @returns {DoNotDevErrorCode} Mapped error code
908
+ */
909
+ static getErrorCodeFromError(error2) {
910
+ if (error2 instanceof _DoNotDevError) {
911
+ return error2.code;
912
+ }
913
+ const message = error2.message.toLowerCase();
914
+ if (error2.name === "ValidationError" || message.includes("validation")) {
915
+ return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
916
+ }
917
+ if (message.includes("not found") || message.includes("no such file")) {
918
+ return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
919
+ }
920
+ if (message.includes("permission") || message.includes("access denied")) {
921
+ return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
922
+ }
923
+ if (message.includes("timeout") || message.includes("timed out")) {
924
+ return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
925
+ }
926
+ if (message.includes("dependency") || message.includes("module not found")) {
927
+ return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
928
+ }
929
+ return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
930
+ }
931
+ };
932
+ }
933
+ });
934
+
793
935
  // node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
794
936
  var require_array = __commonJS({
795
937
  "node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
@@ -7533,147 +7675,6 @@ var init_PathResolver = __esm({
7533
7675
  }
7534
7676
  });
7535
7677
 
7536
- // packages/tooling/src/utils/errors.ts
7537
- var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
7538
- var init_errors = __esm({
7539
- "packages/tooling/src/utils/errors.ts"() {
7540
- "use strict";
7541
- init_utils();
7542
- DO_NOT_DEV_ERROR_CODES = {
7543
- CONFIGURATION_ERROR: "configuration-error",
7544
- CONFIG_NOT_FOUND: "config-not-found",
7545
- CONFIG_INVALID: "config-invalid",
7546
- PATH_RESOLUTION_ERROR: "path-resolution-error",
7547
- FILE_OPERATION_ERROR: "file-operation-error",
7548
- FILE_NOT_FOUND: "file-not-found",
7549
- PERMISSION_DENIED: "permission-denied",
7550
- GENERATION_ERROR: "generation-error",
7551
- TEMPLATE_ERROR: "template-error",
7552
- TEMPLATE_NOT_FOUND: "template-not-found",
7553
- CLI_EXECUTION_ERROR: "cli-execution-error",
7554
- COMMAND_NOT_FOUND: "command-not-found",
7555
- COMMAND_FAILED: "command-failed",
7556
- VALIDATION_ERROR: "validation-error",
7557
- SCHEMA_ERROR: "schema-error",
7558
- DEPENDENCY_ERROR: "dependency-error",
7559
- DEPENDENCY_NOT_FOUND: "dependency-not-found",
7560
- DEPENDENCY_VERSION_ERROR: "dependency-version-error",
7561
- INVALID_ARGUMENT: "invalid-argument",
7562
- MISSING_ARGUMENT: "missing-argument",
7563
- MISSING_PROJECT_ID: "missing-project-id",
7564
- FIREBASE_CLI_ERROR: "firebase-cli-error",
7565
- DEPLOYMENT_FAILED: "deployment-failed",
7566
- OPERATION_CANCELLED: "operation-cancelled",
7567
- TIMEOUT_ERROR: "timeout-error",
7568
- UNKNOWN_ERROR: "unknown-error"
7569
- };
7570
- DoNotDevError = class _DoNotDevError extends Error {
7571
- /** The error code categorizing this error */
7572
- code;
7573
- /** Original error if this is wrapping another error */
7574
- originalError;
7575
- /** Additional context for the error */
7576
- context;
7577
- /** Whether this error should be displayed to the user */
7578
- displayable;
7579
- /**
7580
- * Creates a new DoNotDev error
7581
- *
7582
- * @param {string} message - Error message
7583
- * @param {DoNotDevErrorCode} code - Error code
7584
- * @param {object} [options] - Additional error options
7585
- * @param {Error} [options.originalError] - Original error if wrapping
7586
- * @param {Record<string, any>} [options.context] - Additional context data
7587
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7588
- */
7589
- constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7590
- super(message);
7591
- this.name = "DoNotDevError";
7592
- this.code = code;
7593
- this.originalError = options?.originalError;
7594
- this.context = options?.context;
7595
- this.displayable = options?.displayable !== false;
7596
- Object.setPrototypeOf(this, _DoNotDevError.prototype);
7597
- if (Error.captureStackTrace) {
7598
- Error.captureStackTrace(this, _DoNotDevError);
7599
- }
7600
- }
7601
- /**
7602
- * Formats the error for logging or display
7603
- *
7604
- * @returns {string} Formatted error message with code
7605
- */
7606
- format() {
7607
- return `[${this.code}] ${this.message}`;
7608
- }
7609
- /**
7610
- * Creates a wrapped error from another error
7611
- *
7612
- * @param {Error} error - Original error to wrap
7613
- * @param {string} [context] - Additional context for the error
7614
- * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
7615
- * @param {object} [options] - Additional error options
7616
- * @param {Record<string, any>} [options.context] - Additional context data
7617
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7618
- * @returns {DoNotDevError} New DoNotDev error wrapping the original
7619
- */
7620
- static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7621
- if (!(error2 instanceof Error)) {
7622
- return new _DoNotDevError(
7623
- `Unknown error: ${String(error2)}`,
7624
- code,
7625
- options
7626
- );
7627
- }
7628
- if (error2 instanceof _DoNotDevError) {
7629
- if (!context) {
7630
- return error2;
7631
- }
7632
- return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
7633
- originalError: error2.originalError || error2,
7634
- context: { ...error2.context, ...options?.context || {} },
7635
- displayable: options?.displayable ?? error2.displayable
7636
- });
7637
- }
7638
- const message = context ? `${context}: ${error2.message}` : error2.message;
7639
- return new _DoNotDevError(message, code, {
7640
- originalError: error2,
7641
- context: options?.context,
7642
- displayable: options?.displayable
7643
- });
7644
- }
7645
- /**
7646
- * Maps common error types to DoNotDevErrorCode
7647
- *
7648
- * @param {Error} error - Error to analyze
7649
- * @returns {DoNotDevErrorCode} Mapped error code
7650
- */
7651
- static getErrorCodeFromError(error2) {
7652
- if (error2 instanceof _DoNotDevError) {
7653
- return error2.code;
7654
- }
7655
- const message = error2.message.toLowerCase();
7656
- if (error2.name === "ValidationError" || message.includes("validation")) {
7657
- return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
7658
- }
7659
- if (message.includes("not found") || message.includes("no such file")) {
7660
- return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
7661
- }
7662
- if (message.includes("permission") || message.includes("access denied")) {
7663
- return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
7664
- }
7665
- if (message.includes("timeout") || message.includes("timed out")) {
7666
- return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
7667
- }
7668
- if (message.includes("dependency") || message.includes("module not found")) {
7669
- return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
7670
- }
7671
- return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
7672
- }
7673
- };
7674
- }
7675
- });
7676
-
7677
7678
  // packages/tooling/src/utils/pathResolver.ts
7678
7679
  import { createRequire as createRequire2 } from "node:module";
7679
7680
  import {
@@ -582,6 +582,148 @@ var init_cli_output = __esm({
582
582
  }
583
583
  });
584
584
 
585
+ // packages/tooling/src/utils/errors.ts
586
+ var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
587
+ var init_errors = __esm({
588
+ "packages/tooling/src/utils/errors.ts"() {
589
+ "use strict";
590
+ init_utils();
591
+ DO_NOT_DEV_ERROR_CODES = {
592
+ CONFIGURATION_ERROR: "configuration-error",
593
+ CONFIG_NOT_FOUND: "config-not-found",
594
+ CONFIG_INVALID: "config-invalid",
595
+ PATH_RESOLUTION_ERROR: "path-resolution-error",
596
+ FILE_OPERATION_ERROR: "file-operation-error",
597
+ FILE_NOT_FOUND: "file-not-found",
598
+ PERMISSION_DENIED: "permission-denied",
599
+ GENERATION_ERROR: "generation-error",
600
+ TEMPLATE_ERROR: "template-error",
601
+ TEMPLATE_NOT_FOUND: "template-not-found",
602
+ CLI_EXECUTION_ERROR: "cli-execution-error",
603
+ COMMAND_NOT_FOUND: "command-not-found",
604
+ COMMAND_FAILED: "command-failed",
605
+ VALIDATION_ERROR: "validation-error",
606
+ SCHEMA_ERROR: "schema-error",
607
+ DEPENDENCY_ERROR: "dependency-error",
608
+ DEPENDENCY_NOT_FOUND: "dependency-not-found",
609
+ DEPENDENCY_VERSION_ERROR: "dependency-version-error",
610
+ INVALID_ARGUMENT: "invalid-argument",
611
+ MISSING_ARGUMENT: "missing-argument",
612
+ MISSING_PROJECT_ID: "missing-project-id",
613
+ FIREBASE_CLI_ERROR: "firebase-cli-error",
614
+ DEPLOYMENT_FAILED: "deployment-failed",
615
+ VERCEL_API_ERROR: "vercel-api-error",
616
+ OPERATION_CANCELLED: "operation-cancelled",
617
+ TIMEOUT_ERROR: "timeout-error",
618
+ UNKNOWN_ERROR: "unknown-error"
619
+ };
620
+ DoNotDevError = class _DoNotDevError extends Error {
621
+ /** The error code categorizing this error */
622
+ code;
623
+ /** Original error if this is wrapping another error */
624
+ originalError;
625
+ /** Additional context for the error */
626
+ context;
627
+ /** Whether this error should be displayed to the user */
628
+ displayable;
629
+ /**
630
+ * Creates a new DoNotDev error
631
+ *
632
+ * @param {string} message - Error message
633
+ * @param {DoNotDevErrorCode} code - Error code
634
+ * @param {object} [options] - Additional error options
635
+ * @param {Error} [options.originalError] - Original error if wrapping
636
+ * @param {Record<string, any>} [options.context] - Additional context data
637
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
638
+ */
639
+ constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
640
+ super(message);
641
+ this.name = "DoNotDevError";
642
+ this.code = code;
643
+ this.originalError = options?.originalError;
644
+ this.context = options?.context;
645
+ this.displayable = options?.displayable !== false;
646
+ Object.setPrototypeOf(this, _DoNotDevError.prototype);
647
+ if (Error.captureStackTrace) {
648
+ Error.captureStackTrace(this, _DoNotDevError);
649
+ }
650
+ }
651
+ /**
652
+ * Formats the error for logging or display
653
+ *
654
+ * @returns {string} Formatted error message with code
655
+ */
656
+ format() {
657
+ return `[${this.code}] ${this.message}`;
658
+ }
659
+ /**
660
+ * Creates a wrapped error from another error
661
+ *
662
+ * @param {Error} error - Original error to wrap
663
+ * @param {string} [context] - Additional context for the error
664
+ * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
665
+ * @param {object} [options] - Additional error options
666
+ * @param {Record<string, any>} [options.context] - Additional context data
667
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
668
+ * @returns {DoNotDevError} New DoNotDev error wrapping the original
669
+ */
670
+ static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
671
+ if (!(error2 instanceof Error)) {
672
+ return new _DoNotDevError(
673
+ `Unknown error: ${String(error2)}`,
674
+ code,
675
+ options
676
+ );
677
+ }
678
+ if (error2 instanceof _DoNotDevError) {
679
+ if (!context) {
680
+ return error2;
681
+ }
682
+ return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
683
+ originalError: error2.originalError || error2,
684
+ context: { ...error2.context, ...options?.context || {} },
685
+ displayable: options?.displayable ?? error2.displayable
686
+ });
687
+ }
688
+ const message = context ? `${context}: ${error2.message}` : error2.message;
689
+ return new _DoNotDevError(message, code, {
690
+ originalError: error2,
691
+ context: options?.context,
692
+ displayable: options?.displayable
693
+ });
694
+ }
695
+ /**
696
+ * Maps common error types to DoNotDevErrorCode
697
+ *
698
+ * @param {Error} error - Error to analyze
699
+ * @returns {DoNotDevErrorCode} Mapped error code
700
+ */
701
+ static getErrorCodeFromError(error2) {
702
+ if (error2 instanceof _DoNotDevError) {
703
+ return error2.code;
704
+ }
705
+ const message = error2.message.toLowerCase();
706
+ if (error2.name === "ValidationError" || message.includes("validation")) {
707
+ return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
708
+ }
709
+ if (message.includes("not found") || message.includes("no such file")) {
710
+ return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
711
+ }
712
+ if (message.includes("permission") || message.includes("access denied")) {
713
+ return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
714
+ }
715
+ if (message.includes("timeout") || message.includes("timed out")) {
716
+ return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
717
+ }
718
+ if (message.includes("dependency") || message.includes("module not found")) {
719
+ return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
720
+ }
721
+ return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
722
+ }
723
+ };
724
+ }
725
+ });
726
+
585
727
  // node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
586
728
  var require_array = __commonJS({
587
729
  "node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
@@ -7325,147 +7467,6 @@ var init_PathResolver = __esm({
7325
7467
  }
7326
7468
  });
7327
7469
 
7328
- // packages/tooling/src/utils/errors.ts
7329
- var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
7330
- var init_errors = __esm({
7331
- "packages/tooling/src/utils/errors.ts"() {
7332
- "use strict";
7333
- init_utils();
7334
- DO_NOT_DEV_ERROR_CODES = {
7335
- CONFIGURATION_ERROR: "configuration-error",
7336
- CONFIG_NOT_FOUND: "config-not-found",
7337
- CONFIG_INVALID: "config-invalid",
7338
- PATH_RESOLUTION_ERROR: "path-resolution-error",
7339
- FILE_OPERATION_ERROR: "file-operation-error",
7340
- FILE_NOT_FOUND: "file-not-found",
7341
- PERMISSION_DENIED: "permission-denied",
7342
- GENERATION_ERROR: "generation-error",
7343
- TEMPLATE_ERROR: "template-error",
7344
- TEMPLATE_NOT_FOUND: "template-not-found",
7345
- CLI_EXECUTION_ERROR: "cli-execution-error",
7346
- COMMAND_NOT_FOUND: "command-not-found",
7347
- COMMAND_FAILED: "command-failed",
7348
- VALIDATION_ERROR: "validation-error",
7349
- SCHEMA_ERROR: "schema-error",
7350
- DEPENDENCY_ERROR: "dependency-error",
7351
- DEPENDENCY_NOT_FOUND: "dependency-not-found",
7352
- DEPENDENCY_VERSION_ERROR: "dependency-version-error",
7353
- INVALID_ARGUMENT: "invalid-argument",
7354
- MISSING_ARGUMENT: "missing-argument",
7355
- MISSING_PROJECT_ID: "missing-project-id",
7356
- FIREBASE_CLI_ERROR: "firebase-cli-error",
7357
- DEPLOYMENT_FAILED: "deployment-failed",
7358
- OPERATION_CANCELLED: "operation-cancelled",
7359
- TIMEOUT_ERROR: "timeout-error",
7360
- UNKNOWN_ERROR: "unknown-error"
7361
- };
7362
- DoNotDevError = class _DoNotDevError extends Error {
7363
- /** The error code categorizing this error */
7364
- code;
7365
- /** Original error if this is wrapping another error */
7366
- originalError;
7367
- /** Additional context for the error */
7368
- context;
7369
- /** Whether this error should be displayed to the user */
7370
- displayable;
7371
- /**
7372
- * Creates a new DoNotDev error
7373
- *
7374
- * @param {string} message - Error message
7375
- * @param {DoNotDevErrorCode} code - Error code
7376
- * @param {object} [options] - Additional error options
7377
- * @param {Error} [options.originalError] - Original error if wrapping
7378
- * @param {Record<string, any>} [options.context] - Additional context data
7379
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7380
- */
7381
- constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7382
- super(message);
7383
- this.name = "DoNotDevError";
7384
- this.code = code;
7385
- this.originalError = options?.originalError;
7386
- this.context = options?.context;
7387
- this.displayable = options?.displayable !== false;
7388
- Object.setPrototypeOf(this, _DoNotDevError.prototype);
7389
- if (Error.captureStackTrace) {
7390
- Error.captureStackTrace(this, _DoNotDevError);
7391
- }
7392
- }
7393
- /**
7394
- * Formats the error for logging or display
7395
- *
7396
- * @returns {string} Formatted error message with code
7397
- */
7398
- format() {
7399
- return `[${this.code}] ${this.message}`;
7400
- }
7401
- /**
7402
- * Creates a wrapped error from another error
7403
- *
7404
- * @param {Error} error - Original error to wrap
7405
- * @param {string} [context] - Additional context for the error
7406
- * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
7407
- * @param {object} [options] - Additional error options
7408
- * @param {Record<string, any>} [options.context] - Additional context data
7409
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7410
- * @returns {DoNotDevError} New DoNotDev error wrapping the original
7411
- */
7412
- static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7413
- if (!(error2 instanceof Error)) {
7414
- return new _DoNotDevError(
7415
- `Unknown error: ${String(error2)}`,
7416
- code,
7417
- options
7418
- );
7419
- }
7420
- if (error2 instanceof _DoNotDevError) {
7421
- if (!context) {
7422
- return error2;
7423
- }
7424
- return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
7425
- originalError: error2.originalError || error2,
7426
- context: { ...error2.context, ...options?.context || {} },
7427
- displayable: options?.displayable ?? error2.displayable
7428
- });
7429
- }
7430
- const message = context ? `${context}: ${error2.message}` : error2.message;
7431
- return new _DoNotDevError(message, code, {
7432
- originalError: error2,
7433
- context: options?.context,
7434
- displayable: options?.displayable
7435
- });
7436
- }
7437
- /**
7438
- * Maps common error types to DoNotDevErrorCode
7439
- *
7440
- * @param {Error} error - Error to analyze
7441
- * @returns {DoNotDevErrorCode} Mapped error code
7442
- */
7443
- static getErrorCodeFromError(error2) {
7444
- if (error2 instanceof _DoNotDevError) {
7445
- return error2.code;
7446
- }
7447
- const message = error2.message.toLowerCase();
7448
- if (error2.name === "ValidationError" || message.includes("validation")) {
7449
- return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
7450
- }
7451
- if (message.includes("not found") || message.includes("no such file")) {
7452
- return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
7453
- }
7454
- if (message.includes("permission") || message.includes("access denied")) {
7455
- return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
7456
- }
7457
- if (message.includes("timeout") || message.includes("timed out")) {
7458
- return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
7459
- }
7460
- if (message.includes("dependency") || message.includes("module not found")) {
7461
- return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
7462
- }
7463
- return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
7464
- }
7465
- };
7466
- }
7467
- });
7468
-
7469
7470
  // packages/tooling/src/utils/pathResolver.ts
7470
7471
  import { createRequire as createRequire2 } from "node:module";
7471
7472
  import {