@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
package/dist/index.js CHANGED
@@ -1089,6 +1089,148 @@ var init_cli_output = __esm({
1089
1089
  }
1090
1090
  });
1091
1091
 
1092
+ // packages/tooling/src/utils/errors.ts
1093
+ var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
1094
+ var init_errors = __esm({
1095
+ "packages/tooling/src/utils/errors.ts"() {
1096
+ "use strict";
1097
+ init_utils();
1098
+ DO_NOT_DEV_ERROR_CODES = {
1099
+ CONFIGURATION_ERROR: "configuration-error",
1100
+ CONFIG_NOT_FOUND: "config-not-found",
1101
+ CONFIG_INVALID: "config-invalid",
1102
+ PATH_RESOLUTION_ERROR: "path-resolution-error",
1103
+ FILE_OPERATION_ERROR: "file-operation-error",
1104
+ FILE_NOT_FOUND: "file-not-found",
1105
+ PERMISSION_DENIED: "permission-denied",
1106
+ GENERATION_ERROR: "generation-error",
1107
+ TEMPLATE_ERROR: "template-error",
1108
+ TEMPLATE_NOT_FOUND: "template-not-found",
1109
+ CLI_EXECUTION_ERROR: "cli-execution-error",
1110
+ COMMAND_NOT_FOUND: "command-not-found",
1111
+ COMMAND_FAILED: "command-failed",
1112
+ VALIDATION_ERROR: "validation-error",
1113
+ SCHEMA_ERROR: "schema-error",
1114
+ DEPENDENCY_ERROR: "dependency-error",
1115
+ DEPENDENCY_NOT_FOUND: "dependency-not-found",
1116
+ DEPENDENCY_VERSION_ERROR: "dependency-version-error",
1117
+ INVALID_ARGUMENT: "invalid-argument",
1118
+ MISSING_ARGUMENT: "missing-argument",
1119
+ MISSING_PROJECT_ID: "missing-project-id",
1120
+ FIREBASE_CLI_ERROR: "firebase-cli-error",
1121
+ DEPLOYMENT_FAILED: "deployment-failed",
1122
+ VERCEL_API_ERROR: "vercel-api-error",
1123
+ OPERATION_CANCELLED: "operation-cancelled",
1124
+ TIMEOUT_ERROR: "timeout-error",
1125
+ UNKNOWN_ERROR: "unknown-error"
1126
+ };
1127
+ DoNotDevError = class _DoNotDevError extends Error {
1128
+ /** The error code categorizing this error */
1129
+ code;
1130
+ /** Original error if this is wrapping another error */
1131
+ originalError;
1132
+ /** Additional context for the error */
1133
+ context;
1134
+ /** Whether this error should be displayed to the user */
1135
+ displayable;
1136
+ /**
1137
+ * Creates a new DoNotDev error
1138
+ *
1139
+ * @param {string} message - Error message
1140
+ * @param {DoNotDevErrorCode} code - Error code
1141
+ * @param {object} [options] - Additional error options
1142
+ * @param {Error} [options.originalError] - Original error if wrapping
1143
+ * @param {Record<string, any>} [options.context] - Additional context data
1144
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1145
+ */
1146
+ constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
1147
+ super(message);
1148
+ this.name = "DoNotDevError";
1149
+ this.code = code;
1150
+ this.originalError = options?.originalError;
1151
+ this.context = options?.context;
1152
+ this.displayable = options?.displayable !== false;
1153
+ Object.setPrototypeOf(this, _DoNotDevError.prototype);
1154
+ if (Error.captureStackTrace) {
1155
+ Error.captureStackTrace(this, _DoNotDevError);
1156
+ }
1157
+ }
1158
+ /**
1159
+ * Formats the error for logging or display
1160
+ *
1161
+ * @returns {string} Formatted error message with code
1162
+ */
1163
+ format() {
1164
+ return `[${this.code}] ${this.message}`;
1165
+ }
1166
+ /**
1167
+ * Creates a wrapped error from another error
1168
+ *
1169
+ * @param {Error} error - Original error to wrap
1170
+ * @param {string} [context] - Additional context for the error
1171
+ * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
1172
+ * @param {object} [options] - Additional error options
1173
+ * @param {Record<string, any>} [options.context] - Additional context data
1174
+ * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
1175
+ * @returns {DoNotDevError} New DoNotDev error wrapping the original
1176
+ */
1177
+ static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
1178
+ if (!(error2 instanceof Error)) {
1179
+ return new _DoNotDevError(
1180
+ `Unknown error: ${String(error2)}`,
1181
+ code,
1182
+ options
1183
+ );
1184
+ }
1185
+ if (error2 instanceof _DoNotDevError) {
1186
+ if (!context) {
1187
+ return error2;
1188
+ }
1189
+ return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
1190
+ originalError: error2.originalError || error2,
1191
+ context: { ...error2.context, ...options?.context || {} },
1192
+ displayable: options?.displayable ?? error2.displayable
1193
+ });
1194
+ }
1195
+ const message = context ? `${context}: ${error2.message}` : error2.message;
1196
+ return new _DoNotDevError(message, code, {
1197
+ originalError: error2,
1198
+ context: options?.context,
1199
+ displayable: options?.displayable
1200
+ });
1201
+ }
1202
+ /**
1203
+ * Maps common error types to DoNotDevErrorCode
1204
+ *
1205
+ * @param {Error} error - Error to analyze
1206
+ * @returns {DoNotDevErrorCode} Mapped error code
1207
+ */
1208
+ static getErrorCodeFromError(error2) {
1209
+ if (error2 instanceof _DoNotDevError) {
1210
+ return error2.code;
1211
+ }
1212
+ const message = error2.message.toLowerCase();
1213
+ if (error2.name === "ValidationError" || message.includes("validation")) {
1214
+ return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
1215
+ }
1216
+ if (message.includes("not found") || message.includes("no such file")) {
1217
+ return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
1218
+ }
1219
+ if (message.includes("permission") || message.includes("access denied")) {
1220
+ return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
1221
+ }
1222
+ if (message.includes("timeout") || message.includes("timed out")) {
1223
+ return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
1224
+ }
1225
+ if (message.includes("dependency") || message.includes("module not found")) {
1226
+ return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
1227
+ }
1228
+ return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
1229
+ }
1230
+ };
1231
+ }
1232
+ });
1233
+
1092
1234
  // node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
1093
1235
  var require_array = __commonJS({
1094
1236
  "node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
@@ -7832,147 +7974,6 @@ var init_PathResolver = __esm({
7832
7974
  }
7833
7975
  });
7834
7976
 
7835
- // packages/tooling/src/utils/errors.ts
7836
- var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
7837
- var init_errors = __esm({
7838
- "packages/tooling/src/utils/errors.ts"() {
7839
- "use strict";
7840
- init_utils();
7841
- DO_NOT_DEV_ERROR_CODES = {
7842
- CONFIGURATION_ERROR: "configuration-error",
7843
- CONFIG_NOT_FOUND: "config-not-found",
7844
- CONFIG_INVALID: "config-invalid",
7845
- PATH_RESOLUTION_ERROR: "path-resolution-error",
7846
- FILE_OPERATION_ERROR: "file-operation-error",
7847
- FILE_NOT_FOUND: "file-not-found",
7848
- PERMISSION_DENIED: "permission-denied",
7849
- GENERATION_ERROR: "generation-error",
7850
- TEMPLATE_ERROR: "template-error",
7851
- TEMPLATE_NOT_FOUND: "template-not-found",
7852
- CLI_EXECUTION_ERROR: "cli-execution-error",
7853
- COMMAND_NOT_FOUND: "command-not-found",
7854
- COMMAND_FAILED: "command-failed",
7855
- VALIDATION_ERROR: "validation-error",
7856
- SCHEMA_ERROR: "schema-error",
7857
- DEPENDENCY_ERROR: "dependency-error",
7858
- DEPENDENCY_NOT_FOUND: "dependency-not-found",
7859
- DEPENDENCY_VERSION_ERROR: "dependency-version-error",
7860
- INVALID_ARGUMENT: "invalid-argument",
7861
- MISSING_ARGUMENT: "missing-argument",
7862
- MISSING_PROJECT_ID: "missing-project-id",
7863
- FIREBASE_CLI_ERROR: "firebase-cli-error",
7864
- DEPLOYMENT_FAILED: "deployment-failed",
7865
- OPERATION_CANCELLED: "operation-cancelled",
7866
- TIMEOUT_ERROR: "timeout-error",
7867
- UNKNOWN_ERROR: "unknown-error"
7868
- };
7869
- DoNotDevError = class _DoNotDevError extends Error {
7870
- /** The error code categorizing this error */
7871
- code;
7872
- /** Original error if this is wrapping another error */
7873
- originalError;
7874
- /** Additional context for the error */
7875
- context;
7876
- /** Whether this error should be displayed to the user */
7877
- displayable;
7878
- /**
7879
- * Creates a new DoNotDev error
7880
- *
7881
- * @param {string} message - Error message
7882
- * @param {DoNotDevErrorCode} code - Error code
7883
- * @param {object} [options] - Additional error options
7884
- * @param {Error} [options.originalError] - Original error if wrapping
7885
- * @param {Record<string, any>} [options.context] - Additional context data
7886
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7887
- */
7888
- constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7889
- super(message);
7890
- this.name = "DoNotDevError";
7891
- this.code = code;
7892
- this.originalError = options?.originalError;
7893
- this.context = options?.context;
7894
- this.displayable = options?.displayable !== false;
7895
- Object.setPrototypeOf(this, _DoNotDevError.prototype);
7896
- if (Error.captureStackTrace) {
7897
- Error.captureStackTrace(this, _DoNotDevError);
7898
- }
7899
- }
7900
- /**
7901
- * Formats the error for logging or display
7902
- *
7903
- * @returns {string} Formatted error message with code
7904
- */
7905
- format() {
7906
- return `[${this.code}] ${this.message}`;
7907
- }
7908
- /**
7909
- * Creates a wrapped error from another error
7910
- *
7911
- * @param {Error} error - Original error to wrap
7912
- * @param {string} [context] - Additional context for the error
7913
- * @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
7914
- * @param {object} [options] - Additional error options
7915
- * @param {Record<string, any>} [options.context] - Additional context data
7916
- * @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
7917
- * @returns {DoNotDevError} New DoNotDev error wrapping the original
7918
- */
7919
- static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
7920
- if (!(error2 instanceof Error)) {
7921
- return new _DoNotDevError(
7922
- `Unknown error: ${String(error2)}`,
7923
- code,
7924
- options
7925
- );
7926
- }
7927
- if (error2 instanceof _DoNotDevError) {
7928
- if (!context) {
7929
- return error2;
7930
- }
7931
- return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
7932
- originalError: error2.originalError || error2,
7933
- context: { ...error2.context, ...options?.context || {} },
7934
- displayable: options?.displayable ?? error2.displayable
7935
- });
7936
- }
7937
- const message = context ? `${context}: ${error2.message}` : error2.message;
7938
- return new _DoNotDevError(message, code, {
7939
- originalError: error2,
7940
- context: options?.context,
7941
- displayable: options?.displayable
7942
- });
7943
- }
7944
- /**
7945
- * Maps common error types to DoNotDevErrorCode
7946
- *
7947
- * @param {Error} error - Error to analyze
7948
- * @returns {DoNotDevErrorCode} Mapped error code
7949
- */
7950
- static getErrorCodeFromError(error2) {
7951
- if (error2 instanceof _DoNotDevError) {
7952
- return error2.code;
7953
- }
7954
- const message = error2.message.toLowerCase();
7955
- if (error2.name === "ValidationError" || message.includes("validation")) {
7956
- return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
7957
- }
7958
- if (message.includes("not found") || message.includes("no such file")) {
7959
- return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
7960
- }
7961
- if (message.includes("permission") || message.includes("access denied")) {
7962
- return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
7963
- }
7964
- if (message.includes("timeout") || message.includes("timed out")) {
7965
- return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
7966
- }
7967
- if (message.includes("dependency") || message.includes("module not found")) {
7968
- return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
7969
- }
7970
- return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
7971
- }
7972
- };
7973
- }
7974
- });
7975
-
7976
7977
  // packages/tooling/src/utils/pathResolver.ts
7977
7978
  var pathResolver_exports = {};
7978
7979
  __export(pathResolver_exports, {
@@ -8485,8 +8486,8 @@ var init_typed_file_operations = __esm({
8485
8486
  "packages/tooling/src/utils/typed-file-operations.ts"() {
8486
8487
  "use strict";
8487
8488
  init_utils();
8488
- init_pathResolver();
8489
8489
  init_errors();
8490
+ init_pathResolver();
8490
8491
  }
8491
8492
  });
8492
8493
 
@@ -8576,23 +8577,23 @@ function analyzeApp(appPath, appName) {
8576
8577
  const functionsPath = joinPath(appPath, "functions");
8577
8578
  const functionsStat = statSync2(functionsPath);
8578
8579
  const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
8579
- let platform6;
8580
+ let platform7;
8580
8581
  const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
8581
8582
  const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
8582
8583
  if (firebaseJsonInFunctions || firebaseJsonInApp) {
8583
- platform6 = "firebase";
8584
+ platform7 = "firebase";
8584
8585
  }
8585
- if (!platform6) {
8586
+ if (!platform7) {
8586
8587
  const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
8587
8588
  const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
8588
8589
  if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
8589
- platform6 = "supabase";
8590
+ platform7 = "supabase";
8590
8591
  }
8591
8592
  }
8592
- if (!platform6) {
8593
+ if (!platform7) {
8593
8594
  const vercelJsonPath = joinPath(appPath, "vercel.json");
8594
8595
  if (pathExists(vercelJsonPath)) {
8595
- platform6 = "vercel";
8596
+ platform7 = "vercel";
8596
8597
  }
8597
8598
  }
8598
8599
  return {
@@ -8603,7 +8604,7 @@ function analyzeApp(appPath, appName) {
8603
8604
  framework,
8604
8605
  hasFunctions,
8605
8606
  functionsPath: hasFunctions ? functionsPath : void 0,
8606
- platform: platform6
8607
+ platform: platform7
8607
8608
  };
8608
8609
  }
8609
8610
  var init_app_detection = __esm({
@@ -8826,7 +8827,7 @@ function checkTsx() {
8826
8827
  return checkCLI("tsx");
8827
8828
  }
8828
8829
  function getCLIInstallInstructions(tool) {
8829
- const platform6 = process.platform;
8830
+ const platform7 = process.platform;
8830
8831
  const instructions = {
8831
8832
  [CLI_TOOLS.BUN]: {
8832
8833
  win32: [
@@ -8942,7 +8943,7 @@ function getCLIInstallInstructions(tool) {
8942
8943
  linux: ["bun install -g tsx"]
8943
8944
  }
8944
8945
  };
8945
- const platformInstructions = instructions[tool]?.[platform6] || instructions[tool]?.linux || [];
8946
+ const platformInstructions = instructions[tool]?.[platform7] || instructions[tool]?.linux || [];
8946
8947
  return platformInstructions.join("\n \u2022 ");
8947
8948
  }
8948
8949
  function formatCLIMissingError(tool, additionalContext) {
@@ -8957,9 +8958,9 @@ function formatCLIMissingError(tool, additionalContext) {
8957
8958
  M2.info(`
8958
8959
  ${additionalContext}`);
8959
8960
  }
8960
- const platform6 = process.platform;
8961
+ const platform7 = process.platform;
8961
8962
  M2.info("\nIf already installed, ensure it's in your PATH:");
8962
- if (platform6 === "win32") {
8963
+ if (platform7 === "win32") {
8963
8964
  M2.message(" \u2022 Check with: where " + tool);
8964
8965
  M2.message(
8965
8966
  " \u2022 Common location: C:\\Users\\<username>\\AppData\\Roaming\\npm\\"
@@ -9016,153 +9017,6 @@ var init_cli_tools = __esm({
9016
9017
  }
9017
9018
  });
9018
9019
 
9019
- // packages/tooling/src/utils/secrets-resolver.ts
9020
- function parseEnvFile(filePath) {
9021
- if (!pathExists(filePath)) return {};
9022
- const content = readSync(filePath, { format: "text" });
9023
- if (typeof content !== "string" || !content) return {};
9024
- const result = {};
9025
- for (const line of content.split(/\r?\n/)) {
9026
- const trimmed = line.trim();
9027
- if (!trimmed || trimmed.startsWith("#")) continue;
9028
- const eqIdx = trimmed.indexOf("=");
9029
- if (eqIdx === -1) continue;
9030
- const key = trimmed.slice(0, eqIdx).trim();
9031
- let value = trimmed.slice(eqIdx + 1).trim();
9032
- if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
9033
- value = value.slice(1, -1);
9034
- }
9035
- if (key && value) {
9036
- result[key] = value;
9037
- }
9038
- }
9039
- return result;
9040
- }
9041
- function readEnvVar(filePath, varName) {
9042
- if (!pathExists(filePath)) return null;
9043
- const content = readSync(filePath, { format: "text" });
9044
- if (typeof content !== "string") return null;
9045
- for (const line of content.split(/\r?\n/)) {
9046
- const trimmed = line.trim();
9047
- if (!trimmed || trimmed.startsWith("#")) continue;
9048
- if (trimmed.startsWith(`${varName}=`)) {
9049
- let val = trimmed.substring(`${varName}=`.length).trim();
9050
- if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
9051
- val = val.slice(1, -1);
9052
- }
9053
- return val || null;
9054
- }
9055
- }
9056
- return null;
9057
- }
9058
- function loadDndevSecrets(projectRoot) {
9059
- const secretsPath = joinPath(projectRoot, ".dndev.secrets");
9060
- if (cachedSecretsPath === secretsPath && cachedSecrets) {
9061
- return cachedSecrets;
9062
- }
9063
- cachedSecrets = parseEnvFile(secretsPath);
9064
- cachedSecretsPath = secretsPath;
9065
- return cachedSecrets;
9066
- }
9067
- function resolveSecret(name, projectRoot, opts) {
9068
- const appDir = opts?.appDir ?? projectRoot;
9069
- const envValue = process.env[name];
9070
- if (envValue) {
9071
- return { value: envValue, source: "process.env" };
9072
- }
9073
- const secrets = loadDndevSecrets(projectRoot);
9074
- if (secrets[name]) {
9075
- return { value: secrets[name], source: ".dndev.secrets" };
9076
- }
9077
- if (name === "SUPABASE_SECRET_KEY" && secrets["SUPABASE_SERVICE_ROLE_KEY"]) {
9078
- return {
9079
- value: secrets["SUPABASE_SERVICE_ROLE_KEY"],
9080
- source: ".dndev.secrets"
9081
- };
9082
- }
9083
- const legacyPaths = LEGACY_PATHS[name];
9084
- if (legacyPaths) {
9085
- for (const relPath of legacyPaths) {
9086
- const fullPath = joinPath(appDir, relPath);
9087
- const value = readEnvVar(fullPath, name);
9088
- if (value) {
9089
- if (!opts?.silent && !warnedLegacy.has(name)) {
9090
- warnedLegacy.add(name);
9091
- log.warn(
9092
- `${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
9093
- );
9094
- }
9095
- return { value, source: "legacy", legacyPath: relPath };
9096
- }
9097
- if (name === "SUPABASE_SECRET_KEY") {
9098
- const aliasValue = readEnvVar(fullPath, "SUPABASE_SERVICE_ROLE_KEY");
9099
- if (aliasValue) {
9100
- if (!opts?.silent && !warnedLegacy.has(name)) {
9101
- warnedLegacy.add(name);
9102
- log.warn(
9103
- `${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
9104
- );
9105
- }
9106
- return { value: aliasValue, source: "legacy", legacyPath: relPath };
9107
- }
9108
- }
9109
- }
9110
- }
9111
- return null;
9112
- }
9113
- var LEGACY_PATHS, warnedLegacy, cachedSecretsPath, cachedSecrets;
9114
- var init_secrets_resolver = __esm({
9115
- "packages/tooling/src/utils/secrets-resolver.ts"() {
9116
- "use strict";
9117
- init_utils();
9118
- init_pathResolver();
9119
- init_cli_output();
9120
- LEGACY_PATHS = {
9121
- VERCEL_TOKEN: [".env.local"],
9122
- SUPABASE_SECRET_KEY: ["supabase/functions/.env", "functions/.env"],
9123
- SUPABASE_DB_URL: ["supabase/functions/.env", "functions/.env"],
9124
- SUPABASE_ACCESS_TOKEN: ["supabase/functions/.env", "functions/.env"],
9125
- STRIPE_SECRET_KEY: ["supabase/functions/.env", "functions/.env"],
9126
- STRIPE_WEBHOOK_SECRET: ["supabase/functions/.env", "functions/.env"]
9127
- };
9128
- warnedLegacy = /* @__PURE__ */ new Set();
9129
- cachedSecretsPath = null;
9130
- cachedSecrets = null;
9131
- }
9132
- });
9133
-
9134
- // packages/tooling/src/cli/setup/vercel-token.ts
9135
- function resolvePerAppVar(appDir, varName) {
9136
- if (process.env[varName]) return process.env[varName];
9137
- const fromLocal = readEnvVar(joinPath(appDir, ".env.local"), varName);
9138
- if (fromLocal) return fromLocal;
9139
- const fromEnv = readEnvVar(joinPath(appDir, ".env"), varName);
9140
- if (fromEnv) return fromEnv;
9141
- return null;
9142
- }
9143
- function resolveVercelCredentials(appDir, projectRoot) {
9144
- const root = projectRoot ?? process.cwd();
9145
- const token = resolveSecret("VERCEL_TOKEN", root, { appDir })?.value ?? null;
9146
- const orgId = resolvePerAppVar(appDir, "VERCEL_ORG_ID");
9147
- const projectId = resolvePerAppVar(appDir, "VERCEL_PROJECT_ID");
9148
- const missing = [];
9149
- if (!token) missing.push("VERCEL_TOKEN");
9150
- if (!orgId) missing.push("VERCEL_ORG_ID");
9151
- if (!projectId) missing.push("VERCEL_PROJECT_ID");
9152
- if (missing.length > 0) return { missing };
9153
- return {
9154
- credentials: { token, orgId, projectId }
9155
- };
9156
- }
9157
- var init_vercel_token = __esm({
9158
- "packages/tooling/src/cli/setup/vercel-token.ts"() {
9159
- "use strict";
9160
- init_utils();
9161
- init_secrets_resolver();
9162
- init_pathResolver();
9163
- }
9164
- });
9165
-
9166
9020
  // node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
9167
9021
  var require_identity = __commonJS({
9168
9022
  "node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js"(exports) {
@@ -16547,59 +16401,288 @@ var init_error_handling = __esm({
16547
16401
  }
16548
16402
  });
16549
16403
 
16550
- // packages/tooling/src/apps/sync-secrets.ts
16551
- var sync_secrets_exports = {};
16552
- __export(sync_secrets_exports, {
16553
- default: () => sync_secrets_default,
16554
- detectGitHubRepo: () => detectGitHubRepo,
16555
- main: () => main5,
16556
- parseSecretsWithFallback: () => parseSecretsWithFallback,
16557
- setGitHubSecret: () => setGitHubSecret,
16558
- uploadServiceAccountToGitHub: () => uploadServiceAccountToGitHub
16559
- });
16560
- import { spawnSync as spawnSync8 } from "node:child_process";
16561
- function parseEnvFile2(filePath) {
16562
- if (!pathExists(filePath)) {
16563
- throw new DoNotDevError(
16564
- `Environment file not found: ${filePath}`,
16565
- "file-not-found",
16566
- { context: { filePath } }
16567
- );
16404
+ // packages/tooling/src/apps/vercel-api.ts
16405
+ function formatVercelError(status, body, context) {
16406
+ let vercelCode;
16407
+ let vercelMessage;
16408
+ try {
16409
+ const parsed = JSON.parse(body);
16410
+ const err = parsed.error ?? parsed;
16411
+ vercelCode = err.code;
16412
+ vercelMessage = err.message;
16413
+ } catch {
16568
16414
  }
16569
- const result = parseEnvFile(filePath);
16570
- if (Object.keys(result).length === 0) {
16571
- log.debug(`No key-value pairs found in ${filePath}`);
16415
+ let message;
16416
+ switch (status) {
16417
+ case 401:
16418
+ message = "Vercel token is invalid or expired. Generate a new one at https://vercel.com/account/tokens and update .dndev.secrets";
16419
+ break;
16420
+ case 403:
16421
+ if (vercelCode === "team_unauthorized" || body.includes("teamId")) {
16422
+ message = "Vercel token does not have access to this team. Hobby/free accounts: remove VERCEL_ORG_ID from your .env (it causes 403). Team accounts: ensure the token is scoped to the correct team.";
16423
+ } else {
16424
+ message = `Vercel access denied: ${vercelMessage ?? "check token scope and permissions"}`;
16425
+ }
16426
+ break;
16427
+ case 404:
16428
+ message = "Vercel project not found. Check VERCEL_PROJECT_ID in apps/<app>/.env \u2014 it should match the Project ID from Vercel Dashboard > Project > Settings > General.";
16429
+ break;
16430
+ case 400:
16431
+ if (vercelCode === "invalid_project_name") {
16432
+ message = "Vercel rejected the project name. This is a framework bug \u2014 please report it.";
16433
+ } else {
16434
+ message = `Vercel rejected the request: ${vercelMessage ?? body}`;
16435
+ }
16436
+ break;
16437
+ case 429:
16438
+ message = "Vercel rate limit hit. Wait a few minutes and try again.";
16439
+ break;
16440
+ default:
16441
+ message = `Vercel API error during ${context} (${status}): ${vercelMessage ?? body}`;
16572
16442
  }
16573
- return result;
16443
+ return new DoNotDevError(message, DO_NOT_DEV_ERROR_CODES.VERCEL_API_ERROR, {
16444
+ context: { status, vercelCode, context }
16445
+ });
16574
16446
  }
16575
- function parseSecretsWithFallback(envFilePath, projectRoot) {
16576
- const dndevSecretsPath = joinPath(projectRoot, ".dndev.secrets");
16577
- if (pathExists(dndevSecretsPath)) {
16578
- const secrets = parseEnvFile(dndevSecretsPath);
16579
- if (Object.keys(secrets).length > 0) {
16580
- log.info(`Reading secrets from: ${dndevSecretsPath}`);
16581
- return secrets;
16447
+ async function validateToken(token) {
16448
+ const res = await fetch(`${VERCEL_API}/v2/user`, {
16449
+ headers: { Authorization: `Bearer ${token}` }
16450
+ });
16451
+ if (!res.ok) {
16452
+ const body = await res.text();
16453
+ throw formatVercelError(res.status, body, "validate token");
16454
+ }
16455
+ const data = await res.json();
16456
+ return { username: data.user.username, email: data.user.email };
16457
+ }
16458
+ async function validateProject(token, projectId, orgId) {
16459
+ const q2 = orgId ? `?teamId=${encodeURIComponent(orgId)}` : "";
16460
+ const res = await fetch(
16461
+ `${VERCEL_API}/v9/projects/${encodeURIComponent(projectId)}${q2}`,
16462
+ {
16463
+ headers: { Authorization: `Bearer ${token}` }
16582
16464
  }
16465
+ );
16466
+ if (!res.ok) {
16467
+ const body = await res.text();
16468
+ throw formatVercelError(res.status, body, "validate project");
16583
16469
  }
16584
- return parseEnvFile2(envFilePath);
16470
+ const data = await res.json();
16471
+ return { projectName: data.name };
16585
16472
  }
16586
- function detectPlatform() {
16587
- const currentDir = process.cwd();
16588
- if (pathExists(joinPath(currentDir, "firebase.json"))) {
16589
- return "firebase";
16473
+ var VERCEL_API;
16474
+ var init_vercel_api = __esm({
16475
+ "packages/tooling/src/apps/vercel-api.ts"() {
16476
+ "use strict";
16477
+ init_utils();
16478
+ init_errors();
16479
+ VERCEL_API = "https://api.vercel.com";
16590
16480
  }
16591
- if (pathExists(joinPath(currentDir, "vercel.json")) || pathExists(joinPath(currentDir, ".vercel"))) {
16592
- return "vercel";
16481
+ });
16482
+
16483
+ // packages/tooling/src/utils/secrets-resolver.ts
16484
+ function parseEnvFile(filePath) {
16485
+ if (!pathExists(filePath)) return {};
16486
+ const content = readSync(filePath, { format: "text" });
16487
+ if (typeof content !== "string" || !content) return {};
16488
+ const result = {};
16489
+ for (const line of content.split(/\r?\n/)) {
16490
+ const trimmed = line.trim();
16491
+ if (!trimmed || trimmed.startsWith("#")) continue;
16492
+ const eqIdx = trimmed.indexOf("=");
16493
+ if (eqIdx === -1) continue;
16494
+ const key = trimmed.slice(0, eqIdx).trim();
16495
+ let value = trimmed.slice(eqIdx + 1).trim();
16496
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
16497
+ value = value.slice(1, -1);
16498
+ }
16499
+ if (key && value) {
16500
+ result[key] = value;
16501
+ }
16593
16502
  }
16594
- log.warn("No platform detected, defaulting to Firebase");
16595
- return "firebase";
16503
+ return result;
16596
16504
  }
16597
- function findFirebaseProjectDir(envFilePath) {
16598
- const currentDir = process.cwd();
16599
- const resolvedPath = joinPath(currentDir, envFilePath);
16600
- const envFileDir = getDirname(resolvedPath);
16601
- const appsMatch = envFileDir.match(/apps[\\/]([^\\/]+)[\\/]functions/);
16602
- if (appsMatch && appsMatch[1]) {
16505
+ function readEnvVar(filePath, varName) {
16506
+ if (!pathExists(filePath)) return null;
16507
+ const content = readSync(filePath, { format: "text" });
16508
+ if (typeof content !== "string") return null;
16509
+ for (const line of content.split(/\r?\n/)) {
16510
+ const trimmed = line.trim();
16511
+ if (!trimmed || trimmed.startsWith("#")) continue;
16512
+ if (trimmed.startsWith(`${varName}=`)) {
16513
+ let val = trimmed.substring(`${varName}=`.length).trim();
16514
+ if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
16515
+ val = val.slice(1, -1);
16516
+ }
16517
+ return val || null;
16518
+ }
16519
+ }
16520
+ return null;
16521
+ }
16522
+ function loadDndevSecrets(projectRoot) {
16523
+ const secretsPath = joinPath(projectRoot, ".dndev.secrets");
16524
+ if (cachedSecretsPath === secretsPath && cachedSecrets) {
16525
+ return cachedSecrets;
16526
+ }
16527
+ cachedSecrets = parseEnvFile(secretsPath);
16528
+ cachedSecretsPath = secretsPath;
16529
+ return cachedSecrets;
16530
+ }
16531
+ function resolveSecret(name, projectRoot, opts) {
16532
+ const appDir = opts?.appDir ?? projectRoot;
16533
+ const secrets = loadDndevSecrets(projectRoot);
16534
+ if (secrets[name]) {
16535
+ return { value: secrets[name], source: ".dndev.secrets" };
16536
+ }
16537
+ if (name === "SUPABASE_SECRET_KEY" && secrets["SUPABASE_SERVICE_ROLE_KEY"]) {
16538
+ return {
16539
+ value: secrets["SUPABASE_SERVICE_ROLE_KEY"],
16540
+ source: ".dndev.secrets"
16541
+ };
16542
+ }
16543
+ const envValue = process.env[name];
16544
+ if (envValue) {
16545
+ return { value: envValue, source: "process.env" };
16546
+ }
16547
+ const legacyPaths = LEGACY_PATHS[name];
16548
+ if (legacyPaths) {
16549
+ for (const relPath of legacyPaths) {
16550
+ const fullPath = joinPath(appDir, relPath);
16551
+ const value = readEnvVar(fullPath, name);
16552
+ if (value) {
16553
+ if (!opts?.silent && !warnedLegacy.has(name)) {
16554
+ warnedLegacy.add(name);
16555
+ log.warn(
16556
+ `${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
16557
+ );
16558
+ }
16559
+ return { value, source: "legacy", legacyPath: relPath };
16560
+ }
16561
+ if (name === "SUPABASE_SECRET_KEY") {
16562
+ const aliasValue = readEnvVar(fullPath, "SUPABASE_SERVICE_ROLE_KEY");
16563
+ if (aliasValue) {
16564
+ if (!opts?.silent && !warnedLegacy.has(name)) {
16565
+ warnedLegacy.add(name);
16566
+ log.warn(
16567
+ `${name} found in ${relPath} (legacy). Move it to .dndev.secrets at project root.`
16568
+ );
16569
+ }
16570
+ return { value: aliasValue, source: "legacy", legacyPath: relPath };
16571
+ }
16572
+ }
16573
+ }
16574
+ }
16575
+ return null;
16576
+ }
16577
+ var LEGACY_PATHS, warnedLegacy, cachedSecretsPath, cachedSecrets;
16578
+ var init_secrets_resolver = __esm({
16579
+ "packages/tooling/src/utils/secrets-resolver.ts"() {
16580
+ "use strict";
16581
+ init_utils();
16582
+ init_cli_output();
16583
+ init_pathResolver();
16584
+ LEGACY_PATHS = {
16585
+ VERCEL_TOKEN: [".env.local"],
16586
+ SUPABASE_SECRET_KEY: ["supabase/functions/.env", "functions/.env"],
16587
+ SUPABASE_DB_URL: ["supabase/functions/.env", "functions/.env"],
16588
+ SUPABASE_ACCESS_TOKEN: ["supabase/functions/.env", "functions/.env"],
16589
+ STRIPE_SECRET_KEY: ["supabase/functions/.env", "functions/.env"],
16590
+ STRIPE_WEBHOOK_SECRET: ["supabase/functions/.env", "functions/.env"]
16591
+ };
16592
+ warnedLegacy = /* @__PURE__ */ new Set();
16593
+ cachedSecretsPath = null;
16594
+ cachedSecrets = null;
16595
+ }
16596
+ });
16597
+
16598
+ // packages/tooling/src/cli/setup/vercel-token.ts
16599
+ function resolvePerAppVar(appDir, varName) {
16600
+ const fromLocal = readEnvVar(joinPath(appDir, ".env.local"), varName);
16601
+ if (fromLocal) return fromLocal;
16602
+ const fromEnv = readEnvVar(joinPath(appDir, ".env"), varName);
16603
+ if (fromEnv) return fromEnv;
16604
+ if (process.env[varName]) return process.env[varName];
16605
+ return null;
16606
+ }
16607
+ function resolveVercelCredentials(appDir, projectRoot) {
16608
+ const root = projectRoot ?? process.cwd();
16609
+ const token = resolveSecret("VERCEL_TOKEN", root, { appDir })?.value ?? null;
16610
+ const orgId = resolvePerAppVar(appDir, "VERCEL_ORG_ID");
16611
+ const projectId = resolvePerAppVar(appDir, "VERCEL_PROJECT_ID");
16612
+ const missing = [];
16613
+ if (!token) missing.push("VERCEL_TOKEN");
16614
+ if (!projectId) missing.push("VERCEL_PROJECT_ID");
16615
+ if (missing.length > 0) return { missing };
16616
+ return {
16617
+ credentials: {
16618
+ token,
16619
+ orgId: orgId ?? void 0,
16620
+ projectId
16621
+ }
16622
+ };
16623
+ }
16624
+ var init_vercel_token = __esm({
16625
+ "packages/tooling/src/cli/setup/vercel-token.ts"() {
16626
+ "use strict";
16627
+ init_utils();
16628
+ init_pathResolver();
16629
+ init_secrets_resolver();
16630
+ }
16631
+ });
16632
+
16633
+ // packages/tooling/src/apps/sync-secrets.ts
16634
+ var sync_secrets_exports = {};
16635
+ __export(sync_secrets_exports, {
16636
+ default: () => sync_secrets_default,
16637
+ detectGitHubRepo: () => detectGitHubRepo,
16638
+ main: () => main5,
16639
+ parseSecretsWithFallback: () => parseSecretsWithFallback,
16640
+ setGitHubSecret: () => setGitHubSecret,
16641
+ uploadServiceAccountToGitHub: () => uploadServiceAccountToGitHub
16642
+ });
16643
+ import { spawnSync as spawnSync8 } from "node:child_process";
16644
+ function parseEnvFile2(filePath) {
16645
+ if (!pathExists(filePath)) {
16646
+ throw new DoNotDevError(
16647
+ `Environment file not found: ${filePath}`,
16648
+ "file-not-found",
16649
+ { context: { filePath } }
16650
+ );
16651
+ }
16652
+ const result = parseEnvFile(filePath);
16653
+ if (Object.keys(result).length === 0) {
16654
+ log.debug(`No key-value pairs found in ${filePath}`);
16655
+ }
16656
+ return result;
16657
+ }
16658
+ function parseSecretsWithFallback(envFilePath, projectRoot) {
16659
+ const dndevSecretsPath = joinPath(projectRoot, ".dndev.secrets");
16660
+ if (pathExists(dndevSecretsPath)) {
16661
+ const secrets = parseEnvFile(dndevSecretsPath);
16662
+ if (Object.keys(secrets).length > 0) {
16663
+ log.info(`Reading secrets from: ${dndevSecretsPath}`);
16664
+ return secrets;
16665
+ }
16666
+ }
16667
+ return parseEnvFile2(envFilePath);
16668
+ }
16669
+ function detectPlatform() {
16670
+ const currentDir = process.cwd();
16671
+ if (pathExists(joinPath(currentDir, "firebase.json"))) {
16672
+ return "firebase";
16673
+ }
16674
+ if (pathExists(joinPath(currentDir, "vercel.json")) || pathExists(joinPath(currentDir, ".vercel"))) {
16675
+ return "vercel";
16676
+ }
16677
+ log.warn("No platform detected, defaulting to Firebase");
16678
+ return "firebase";
16679
+ }
16680
+ function findFirebaseProjectDir(envFilePath) {
16681
+ const currentDir = process.cwd();
16682
+ const resolvedPath = joinPath(currentDir, envFilePath);
16683
+ const envFileDir = getDirname(resolvedPath);
16684
+ const appsMatch = envFileDir.match(/apps[\\/]([^\\/]+)[\\/]functions/);
16685
+ if (appsMatch && appsMatch[1]) {
16603
16686
  const appDir = joinPath(currentDir, "apps", appsMatch[1]);
16604
16687
  if (pathExists(joinPath(appDir, "firebase.json"))) {
16605
16688
  return appDir;
@@ -17063,11 +17146,11 @@ Examples:
17063
17146
  }
17064
17147
  return 0;
17065
17148
  }
17066
- const platform6 = config.platform || detectPlatform();
17149
+ const platform7 = config.platform || detectPlatform();
17067
17150
  if (config.verbose) {
17068
17151
  log.debug(`Working directory: ${currentDir}`);
17069
17152
  log.debug(`Environment file: ${envFilePath}`);
17070
- log.debug(`Platform: ${platform6}`);
17153
+ log.debug(`Platform: ${platform7}`);
17071
17154
  log.debug(`Dry run mode: ${config.dryRun}`);
17072
17155
  }
17073
17156
  const secrets = parseSecretsWithFallback(envFilePath, currentDir);
@@ -17076,7 +17159,7 @@ Examples:
17076
17159
  log.info("No secrets found in .env file");
17077
17160
  return 0;
17078
17161
  }
17079
- log.info(`Found ${secretKeys.length} secrets to sync to ${platform6}:`);
17162
+ log.info(`Found ${secretKeys.length} secrets to sync to ${platform7}:`);
17080
17163
  secretKeys.forEach((key) => {
17081
17164
  if (config.verbose) {
17082
17165
  const value = secrets[key];
@@ -17087,12 +17170,12 @@ Examples:
17087
17170
  log.info(` ${key}`);
17088
17171
  }
17089
17172
  });
17090
- const finalFirebaseProjectDir = platform6 === "firebase" ? firebaseProjectDir || findFirebaseProjectDir(config.envFile) : void 0;
17173
+ const finalFirebaseProjectDir = platform7 === "firebase" ? firebaseProjectDir || findFirebaseProjectDir(config.envFile) : void 0;
17091
17174
  if (config.verbose && finalFirebaseProjectDir) {
17092
17175
  log.debug(`Firebase project directory: ${finalFirebaseProjectDir}`);
17093
17176
  }
17094
17177
  for (const [key, value] of Object.entries(secrets)) {
17095
- if (platform6 === "firebase") {
17178
+ if (platform7 === "firebase") {
17096
17179
  await setFirebaseSecret(
17097
17180
  key,
17098
17181
  value,
@@ -17100,18 +17183,18 @@ Examples:
17100
17183
  config.dryRun,
17101
17184
  finalFirebaseProjectDir
17102
17185
  );
17103
- } else if (platform6 === "vercel") {
17186
+ } else if (platform7 === "vercel") {
17104
17187
  setVercelSecret(key, value, config.vercelProjectId, config.dryRun);
17105
17188
  }
17106
17189
  }
17107
17190
  if (config.dryRun) {
17108
17191
  log.success(
17109
17192
  `
17110
- Dry run completed. No secrets were actually set to ${platform6}.`
17193
+ Dry run completed. No secrets were actually set to ${platform7}.`
17111
17194
  );
17112
17195
  } else {
17113
17196
  log.success(`
17114
- All secrets synced successfully to ${platform6}!`);
17197
+ All secrets synced successfully to ${platform7}!`);
17115
17198
  }
17116
17199
  return 0;
17117
17200
  } catch (err) {
@@ -17205,10 +17288,10 @@ var init_deploy_supabase_functions = __esm({
17205
17288
  "packages/tooling/src/apps/deploy-supabase-functions.ts"() {
17206
17289
  "use strict";
17207
17290
  init_utils();
17208
- init_pathResolver();
17209
17291
  init_cli_output();
17210
17292
  init_cli_tools();
17211
17293
  init_errors();
17294
+ init_pathResolver();
17212
17295
  }
17213
17296
  });
17214
17297
 
@@ -17421,21 +17504,37 @@ init_app_selector();
17421
17504
  init_cli_output();
17422
17505
  init_errors();
17423
17506
  init_pathResolver();
17424
- import { spawn, execSync as execSync3 } from "node:child_process";
17425
- import { platform } from "node:os";
17507
+ import { execSync as execSync3 } from "node:child_process";
17508
+ import { platform as platform2 } from "node:os";
17426
17509
 
17427
17510
  // packages/tooling/src/utils/spawn-utils.ts
17428
17511
  init_utils();
17429
17512
  init_cli_output();
17430
17513
  init_errors();
17431
17514
  init_pathResolver();
17432
- import { spawnSync as spawnSync2, execSync as execSync2 } from "node:child_process";
17515
+ import {
17516
+ spawn,
17517
+ spawnSync as spawnSync2,
17518
+ execSync as execSync2
17519
+ } from "node:child_process";
17520
+ import { platform } from "node:os";
17433
17521
  function createAppEnv(appPath) {
17434
17522
  return {
17435
17523
  ...process.env,
17436
17524
  DNDEV_APP_ROOT: appPath
17437
17525
  };
17438
17526
  }
17527
+ function spawnCrossPlatform(command, args, options) {
17528
+ const isWindows = platform() === "win32";
17529
+ const useShell = options.shell ?? isWindows;
17530
+ if (useShell) {
17531
+ const fullCommand = `${command} ${args.join(" ")}`;
17532
+ const { shell: _4, ...rest2 } = options;
17533
+ return spawn(fullCommand, [], { ...rest2, shell: true });
17534
+ }
17535
+ const { shell: _3, ...rest } = options;
17536
+ return spawn(command, args, rest);
17537
+ }
17439
17538
  function createEmulatorEnv(appPath, framework = "vite", options) {
17440
17539
  const baseEnv = createAppEnv(appPath);
17441
17540
  const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
@@ -17608,13 +17707,16 @@ async function main2() {
17608
17707
  log.info(`Starting dev server for ${app.name}...
17609
17708
  `);
17610
17709
  const turboArgs = ["dev", "--filter", app.packageName];
17611
- const isWindows = platform() === "win32";
17612
- const childProcess = spawn("bunx", ["turbo", ...turboArgs], {
17613
- stdio: "inherit",
17614
- env: createAppEnv(app.path),
17615
- cwd: projectRoot,
17616
- shell: isWindows
17617
- });
17710
+ const isWindows = platform2() === "win32";
17711
+ const childProcess = spawnCrossPlatform(
17712
+ "bunx",
17713
+ ["turbo", ...turboArgs],
17714
+ {
17715
+ stdio: "inherit",
17716
+ env: createAppEnv(app.path),
17717
+ cwd: projectRoot
17718
+ }
17719
+ );
17618
17720
  const cleanup = (signal) => {
17619
17721
  if (!childProcess.pid) return;
17620
17722
  log.debug(`Received ${signal}, cleaning up processes...`);
@@ -17671,23 +17773,15 @@ async function main2() {
17671
17773
 
17672
17774
  // packages/tooling/src/apps/emu.ts
17673
17775
  init_utils();
17674
- init_app_selector();
17675
- init_cli_output();
17676
- init_errors();
17677
- init_pathResolver();
17678
17776
 
17679
17777
  // packages/tooling/src/apps/emu-firebase.ts
17680
17778
  init_utils();
17681
17779
  init_cli_input();
17682
17780
  init_cli_output();
17683
17781
  init_pathResolver();
17782
+ import { spawnSync as spawnSync3, execSync as execSync4 } from "node:child_process";
17783
+ import { platform as platform3 } from "node:os";
17684
17784
  init_typed_file_operations();
17685
- import {
17686
- spawn as spawn2,
17687
- spawnSync as spawnSync3,
17688
- execSync as execSync4
17689
- } from "node:child_process";
17690
- import { platform as platform2 } from "node:os";
17691
17785
  function discoverFirebaseProjectId(appPath) {
17692
17786
  const firebasercPath = joinPath(appPath, ".firebaserc");
17693
17787
  if (pathExists(firebasercPath)) {
@@ -17943,8 +18037,8 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
17943
18037
  log.info(" stripe trigger checkout.session.completed");
17944
18038
  log.info("");
17945
18039
  }
17946
- const isWindows = platform2() === "win32";
17947
- const childProcess = spawn2(
18040
+ const isWindows = platform3() === "win32";
18041
+ const childProcess = spawnCrossPlatform(
17948
18042
  "bunx",
17949
18043
  ["concurrently", ...concurrentlyArgs],
17950
18044
  {
@@ -17953,8 +18047,7 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
17953
18047
  useEmulatorAuth: useAuth,
17954
18048
  useEmulatorFirestore: useFirestore
17955
18049
  }),
17956
- cwd: app.path,
17957
- shell: isWindows
18050
+ cwd: app.path
17958
18051
  }
17959
18052
  );
17960
18053
  const SIGNAL_EXIT_CODES3 = {
@@ -18018,8 +18111,8 @@ FIREBASE_AUTH_EMULATOR_HOST=${authEmulatorHost}
18018
18111
  // packages/tooling/src/apps/emu-supabase.ts
18019
18112
  init_utils();
18020
18113
  init_cli_output();
18021
- import { spawn as spawn3, execSync as execSync5 } from "node:child_process";
18022
- import { platform as platform3 } from "node:os";
18114
+ import { execSync as execSync5 } from "node:child_process";
18115
+ import { platform as platform4 } from "node:os";
18023
18116
  function isDockerRunning() {
18024
18117
  try {
18025
18118
  execSync5("docker info", { stdio: "pipe", timeout: 5e3 });
@@ -18043,7 +18136,7 @@ async function startSupabase(app, _projectRoot) {
18043
18136
  log.error(" bun install -g supabase\n");
18044
18137
  return 1;
18045
18138
  }
18046
- const isWindows = platform3() === "win32";
18139
+ const isWindows = platform4() === "win32";
18047
18140
  const concurrentlyArgs = [
18048
18141
  "--kill-others-on-fail",
18049
18142
  "--prefix-colors",
@@ -18055,13 +18148,12 @@ async function startSupabase(app, _projectRoot) {
18055
18148
  "supabase start",
18056
18149
  `bunx turbo dev --filter=${app.packageName}`
18057
18150
  ];
18058
- const childProcess = spawn3(
18151
+ const childProcess = spawnCrossPlatform(
18059
18152
  "bunx",
18060
18153
  ["concurrently", ...concurrentlyArgs],
18061
18154
  {
18062
18155
  stdio: "inherit",
18063
- cwd: app.path,
18064
- shell: isWindows
18156
+ cwd: app.path
18065
18157
  }
18066
18158
  );
18067
18159
  const cleanup = () => {
@@ -18101,8 +18193,8 @@ async function startSupabase(app, _projectRoot) {
18101
18193
  // packages/tooling/src/apps/emu-vercel.ts
18102
18194
  init_utils();
18103
18195
  init_cli_output();
18104
- import { spawn as spawn4, execSync as execSync6 } from "node:child_process";
18105
- import { platform as platform4 } from "node:os";
18196
+ import { execSync as execSync6 } from "node:child_process";
18197
+ import { platform as platform5 } from "node:os";
18106
18198
  async function startVercel(app, _projectRoot) {
18107
18199
  log.info(`Starting Vercel dev server for ${app.name}...
18108
18200
  `);
@@ -18113,11 +18205,10 @@ async function startVercel(app, _projectRoot) {
18113
18205
  log.error(" bun install -g vercel\n");
18114
18206
  return 1;
18115
18207
  }
18116
- const isWindows = platform4() === "win32";
18117
- const childProcess = spawn4("vercel", ["dev"], {
18208
+ const isWindows = platform5() === "win32";
18209
+ const childProcess = spawnCrossPlatform("vercel", ["dev"], {
18118
18210
  stdio: "inherit",
18119
- cwd: app.path,
18120
- shell: isWindows
18211
+ cwd: app.path
18121
18212
  });
18122
18213
  const cleanup = () => {
18123
18214
  if (!childProcess.pid) return;
@@ -18154,6 +18245,10 @@ async function startVercel(app, _projectRoot) {
18154
18245
  }
18155
18246
 
18156
18247
  // packages/tooling/src/apps/emu.ts
18248
+ init_app_selector();
18249
+ init_cli_output();
18250
+ init_errors();
18251
+ init_pathResolver();
18157
18252
  async function main3(options) {
18158
18253
  const args = process.argv.slice(2);
18159
18254
  const projectRoot = getRepoRoot();
@@ -18230,11 +18325,10 @@ init_cli_output();
18230
18325
  init_errors();
18231
18326
  init_pathResolver();
18232
18327
  import {
18233
- spawn as spawn5,
18234
18328
  spawnSync as spawnSync4,
18235
18329
  execSync as execSync7
18236
18330
  } from "node:child_process";
18237
- import { platform as platform5 } from "node:os";
18331
+ import { platform as platform6 } from "node:os";
18238
18332
  var SIGNAL_EXIT_CODES2 = {
18239
18333
  SIGINT: 130,
18240
18334
  // 128 + 2
@@ -18277,13 +18371,16 @@ async function main4() {
18277
18371
  log.info(`Previewing ${app.name}...
18278
18372
  `);
18279
18373
  const turboArgs = ["preview", "--filter", app.packageName];
18280
- const isWindows = platform5() === "win32";
18281
- const childProcess = spawn5("bunx", ["turbo", ...turboArgs], {
18282
- stdio: "inherit",
18283
- env: createAppEnv(app.path),
18284
- cwd: projectRoot,
18285
- shell: isWindows
18286
- });
18374
+ const isWindows = platform6() === "win32";
18375
+ const childProcess = spawnCrossPlatform(
18376
+ "bunx",
18377
+ ["turbo", ...turboArgs],
18378
+ {
18379
+ stdio: "inherit",
18380
+ env: createAppEnv(app.path),
18381
+ cwd: projectRoot
18382
+ }
18383
+ );
18287
18384
  const cleanup = (signal) => {
18288
18385
  if (!childProcess.pid) return;
18289
18386
  log.debug(`Received ${signal}, cleaning up processes...`);
@@ -18884,184 +18981,12 @@ async function deployFrontend(appDir, serviceAccountPath, projectId, config) {
18884
18981
  s.stop("Frontend deployed successfully");
18885
18982
  }
18886
18983
 
18887
- // packages/tooling/src/apps/deploy-vercel-frontend.ts
18984
+ // packages/tooling/src/apps/deploy-functions.ts
18888
18985
  init_utils();
18889
- init_cli_output();
18890
- init_vercel_token();
18986
+ var import_yaml = __toESM(require_dist(), 1);
18987
+ import { execSync as execSync8, spawnSync as spawnSync6 } from "node:child_process";
18988
+ init_cli_tools();
18891
18989
  init_pathResolver();
18892
- import { createHash } from "node:crypto";
18893
- import { readFile, readdir as readdir2 } from "node:fs/promises";
18894
- import { join as join3, relative as relative3 } from "node:path";
18895
- var VERCEL_API = "https://api.vercel.com";
18896
- var UPLOAD_BATCH_SIZE = 10;
18897
- var POLL_INTERVAL_MS = 3e3;
18898
- var POLL_MAX_ATTEMPTS = 100;
18899
- function apiHeaders(token, extra) {
18900
- return { Authorization: `Bearer ${token}`, ...extra };
18901
- }
18902
- function teamQuery(orgId) {
18903
- return `?teamId=${encodeURIComponent(orgId)}`;
18904
- }
18905
- async function collectDistFiles(distDir) {
18906
- const files = [];
18907
- async function walk(dir) {
18908
- const entries = await readdir2(dir, { withFileTypes: true });
18909
- for (const entry of entries) {
18910
- const fullPath = join3(dir, entry.name);
18911
- if (entry.isDirectory()) {
18912
- await walk(fullPath);
18913
- } else {
18914
- const content = await readFile(fullPath);
18915
- const sha = createHash("sha1").update(content).digest("hex");
18916
- const rel = relative3(distDir, fullPath).split("\\").join("/");
18917
- files.push({
18918
- relativePath: rel,
18919
- content,
18920
- sha,
18921
- size: content.byteLength
18922
- });
18923
- }
18924
- }
18925
- }
18926
- await walk(distDir);
18927
- return files;
18928
- }
18929
- async function uploadFiles(files, token, orgId) {
18930
- const q2 = teamQuery(orgId);
18931
- for (let i = 0; i < files.length; i += UPLOAD_BATCH_SIZE) {
18932
- const batch = files.slice(i, i + UPLOAD_BATCH_SIZE);
18933
- await Promise.all(
18934
- batch.map(async (file) => {
18935
- const res = await fetch(`${VERCEL_API}/v2/files${q2}`, {
18936
- method: "POST",
18937
- headers: apiHeaders(token, {
18938
- "Content-Type": "application/octet-stream",
18939
- "x-vercel-digest": file.sha,
18940
- "Content-Length": String(file.size)
18941
- }),
18942
- body: new Uint8Array(file.content)
18943
- });
18944
- if (!res.ok) {
18945
- const body = await res.text();
18946
- log.warn(`Upload failed: ${file.relativePath} (${res.status})`);
18947
- log.warn(` URL: ${VERCEL_API}/v2/files${q2}`);
18948
- log.warn(` SHA: ${file.sha}, Size: ${file.size}`);
18949
- log.warn(` Response: ${body}`);
18950
- throw new Error(
18951
- `File upload failed for ${file.relativePath} (${res.status}): ${body}`
18952
- );
18953
- }
18954
- })
18955
- );
18956
- }
18957
- }
18958
- async function createDeployment(files, token, orgId, projectId) {
18959
- const q2 = teamQuery(orgId);
18960
- const body = {
18961
- name: projectId,
18962
- project: projectId,
18963
- target: "production",
18964
- files: files.map((f) => ({
18965
- file: f.relativePath,
18966
- sha: f.sha,
18967
- size: f.size
18968
- })),
18969
- projectSettings: {
18970
- buildCommand: "",
18971
- installCommand: "",
18972
- outputDirectory: "."
18973
- }
18974
- };
18975
- const res = await fetch(`${VERCEL_API}/v13/deployments${q2}`, {
18976
- method: "POST",
18977
- headers: apiHeaders(token, { "Content-Type": "application/json" }),
18978
- body: JSON.stringify(body)
18979
- });
18980
- if (!res.ok) {
18981
- const text = await res.text();
18982
- throw new Error(`Create deployment failed (${res.status}): ${text}`);
18983
- }
18984
- return await res.json();
18985
- }
18986
- async function waitForReady(deploymentId, token, orgId) {
18987
- const q2 = teamQuery(orgId);
18988
- for (let attempt = 0; attempt < POLL_MAX_ATTEMPTS; attempt++) {
18989
- const res = await fetch(
18990
- `${VERCEL_API}/v13/deployments/${deploymentId}${q2}`,
18991
- { headers: apiHeaders(token) }
18992
- );
18993
- if (!res.ok) {
18994
- const text = await res.text();
18995
- throw new Error(
18996
- `Deployment status check failed (${res.status}): ${text}`
18997
- );
18998
- }
18999
- const data = await res.json();
19000
- if (data.readyState === "READY") return data;
19001
- if (data.readyState === "ERROR") {
19002
- throw new Error(
19003
- `Deployment failed: ${data.errorMessage || "Unknown error"}`
19004
- );
19005
- }
19006
- if (data.readyState === "CANCELED") {
19007
- throw new Error("Deployment was canceled");
19008
- }
19009
- await new Promise((r2) => setTimeout(r2, POLL_INTERVAL_MS));
19010
- }
19011
- throw new Error("Deployment timed out (5+ minutes)");
19012
- }
19013
- async function deployVercelFrontend(appDir, _config) {
19014
- const result = resolveVercelCredentials(appDir);
19015
- if (result.missing) {
19016
- const secretVars = result.missing.filter((v2) => v2 === "VERCEL_TOKEN");
19017
- const appVars = result.missing.filter((v2) => v2 !== "VERCEL_TOKEN");
19018
- const hints = [];
19019
- if (secretVars.length > 0)
19020
- hints.push("Add VERCEL_TOKEN to .dndev.secrets at project root.");
19021
- if (appVars.length > 0)
19022
- hints.push(`Add ${appVars.join(", ")} to apps/<app>/.env`);
19023
- throw new Error(
19024
- `Missing Vercel credentials: ${result.missing.join(", ")}
19025
- ` + hints.join("\n") + "\nSee guides/dndev/SETUP_VERCEL.md"
19026
- );
19027
- }
19028
- const { token, orgId, projectId } = result.credentials;
19029
- const distDir = joinPath(appDir, "dist");
19030
- if (!pathExists(distDir)) {
19031
- throw new Error(`dist/ not found at ${distDir}. Run build first.`);
19032
- }
19033
- log.debug("Using Vercel REST API (token-based, no CLI)");
19034
- log.info(`Vercel org: ${orgId}`);
19035
- log.info(`Vercel project: ${projectId}`);
19036
- log.info(
19037
- `Token: ${token.slice(0, 6)}...${token.slice(-4)} (${token.length} chars)`
19038
- );
19039
- log.info("Collecting dist/ files...");
19040
- const files = await collectDistFiles(distDir);
19041
- if (files.length === 0) {
19042
- throw new Error("dist/ is empty \u2014 nothing to deploy.");
19043
- }
19044
- log.info(`Found ${files.length} files`);
19045
- log.info("Uploading files to Vercel...");
19046
- await uploadFiles(files, token, orgId);
19047
- log.success(`${files.length} files uploaded`);
19048
- log.info("Creating production deployment...");
19049
- const deployment = await createDeployment(files, token, orgId, projectId);
19050
- log.info(`Deployment ${deployment.id} created, waiting...`);
19051
- const ready = await waitForReady(deployment.id, token, orgId);
19052
- const prodUrl = `https://${ready.url}`;
19053
- log.success(`Production: ${prodUrl}`);
19054
- if (ready.alias?.length) {
19055
- log.info(`Aliases: ${ready.alias.join(", ")}`);
19056
- }
19057
- }
19058
-
19059
- // packages/tooling/src/apps/deploy-functions.ts
19060
- init_utils();
19061
- var import_yaml = __toESM(require_dist(), 1);
19062
- import { execSync as execSync8, spawnSync as spawnSync6 } from "node:child_process";
19063
- init_pathResolver();
19064
- init_cli_tools();
19065
18990
  init_typed_file_operations();
19066
18991
  function backupFiles(functionsDir) {
19067
18992
  const backupDir = joinPath(functionsDir, ".deploy-backup");
@@ -19552,9 +19477,9 @@ async function deployRules(appDir, serviceAccountPath, projectId, config, option
19552
19477
  // packages/tooling/src/apps/deploy-utils.ts
19553
19478
  init_utils();
19554
19479
  import { spawnSync as spawnSync7 } from "node:child_process";
19480
+ init_error_handling();
19555
19481
  init_pathResolver();
19556
19482
  init_typed_file_operations();
19557
- init_error_handling();
19558
19483
  function detectAvailableApps() {
19559
19484
  const currentDir = process.cwd();
19560
19485
  const appsDir = joinPath(currentDir, "apps");
@@ -19787,6 +19712,195 @@ function clearFirebaseCache(appDir) {
19787
19712
  }
19788
19713
  }
19789
19714
 
19715
+ // packages/tooling/src/apps/deploy-vercel-frontend.ts
19716
+ init_utils();
19717
+ init_vercel_api();
19718
+ init_vercel_token();
19719
+ init_cli_output();
19720
+ init_pathResolver();
19721
+ import { createHash } from "node:crypto";
19722
+ import { readFile, readdir as readdir2 } from "node:fs/promises";
19723
+ import { join as join3, relative as relative3 } from "node:path";
19724
+ var VERCEL_API2 = "https://api.vercel.com";
19725
+ var UPLOAD_BATCH_SIZE = 10;
19726
+ var POLL_INTERVAL_MS = 3e3;
19727
+ var POLL_MAX_ATTEMPTS = 100;
19728
+ function apiHeaders(token, extra) {
19729
+ return { Authorization: `Bearer ${token}`, ...extra };
19730
+ }
19731
+ function teamQuery(orgId) {
19732
+ if (!orgId) return "";
19733
+ return `?teamId=${encodeURIComponent(orgId)}`;
19734
+ }
19735
+ async function collectDistFiles(distDir) {
19736
+ const files = [];
19737
+ async function walk(dir) {
19738
+ const entries = await readdir2(dir, { withFileTypes: true });
19739
+ for (const entry of entries) {
19740
+ const fullPath = join3(dir, entry.name);
19741
+ if (entry.isDirectory()) {
19742
+ await walk(fullPath);
19743
+ } else {
19744
+ const content = await readFile(fullPath);
19745
+ const sha = createHash("sha1").update(content).digest("hex");
19746
+ const rel = relative3(distDir, fullPath).split("\\").join("/");
19747
+ files.push({
19748
+ relativePath: rel,
19749
+ content,
19750
+ sha,
19751
+ size: content.byteLength
19752
+ });
19753
+ }
19754
+ }
19755
+ }
19756
+ await walk(distDir);
19757
+ return files;
19758
+ }
19759
+ async function uploadFiles(files, token, orgId) {
19760
+ const q2 = teamQuery(orgId);
19761
+ for (let i = 0; i < files.length; i += UPLOAD_BATCH_SIZE) {
19762
+ const batch = files.slice(i, i + UPLOAD_BATCH_SIZE);
19763
+ await Promise.all(
19764
+ batch.map(async (file) => {
19765
+ const res = await fetch(`${VERCEL_API2}/v2/files${q2}`, {
19766
+ method: "POST",
19767
+ headers: apiHeaders(token, {
19768
+ "Content-Type": "application/octet-stream",
19769
+ "x-vercel-digest": file.sha,
19770
+ "Content-Length": String(file.size)
19771
+ }),
19772
+ body: new Uint8Array(file.content)
19773
+ });
19774
+ if (!res.ok) {
19775
+ const body = await res.text();
19776
+ throw formatVercelError(
19777
+ res.status,
19778
+ body,
19779
+ `upload file ${file.relativePath}`
19780
+ );
19781
+ }
19782
+ })
19783
+ );
19784
+ }
19785
+ }
19786
+ async function createDeployment(files, token, orgId, projectId, projectName) {
19787
+ const q2 = teamQuery(orgId);
19788
+ const body = {
19789
+ name: projectName,
19790
+ project: projectId,
19791
+ target: "production",
19792
+ files: files.map((f) => ({
19793
+ file: f.relativePath,
19794
+ sha: f.sha,
19795
+ size: f.size
19796
+ })),
19797
+ projectSettings: {
19798
+ buildCommand: "",
19799
+ installCommand: "",
19800
+ outputDirectory: "."
19801
+ }
19802
+ };
19803
+ const res = await fetch(`${VERCEL_API2}/v13/deployments${q2}`, {
19804
+ method: "POST",
19805
+ headers: apiHeaders(token, { "Content-Type": "application/json" }),
19806
+ body: JSON.stringify(body)
19807
+ });
19808
+ if (!res.ok) {
19809
+ const text = await res.text();
19810
+ throw formatVercelError(res.status, text, "create deployment");
19811
+ }
19812
+ return await res.json();
19813
+ }
19814
+ async function waitForReady(deploymentId, token, orgId) {
19815
+ const q2 = teamQuery(orgId);
19816
+ for (let attempt = 0; attempt < POLL_MAX_ATTEMPTS; attempt++) {
19817
+ const res = await fetch(
19818
+ `${VERCEL_API2}/v13/deployments/${deploymentId}${q2}`,
19819
+ { headers: apiHeaders(token) }
19820
+ );
19821
+ if (!res.ok) {
19822
+ const text = await res.text();
19823
+ throw formatVercelError(res.status, text, "check deployment status");
19824
+ }
19825
+ const data = await res.json();
19826
+ if (data.readyState === "READY") return data;
19827
+ if (data.readyState === "ERROR") {
19828
+ throw new Error(
19829
+ `Deployment failed: ${data.errorMessage || "Unknown error"}`
19830
+ );
19831
+ }
19832
+ if (data.readyState === "CANCELED") {
19833
+ throw new Error("Deployment was canceled");
19834
+ }
19835
+ await new Promise((r2) => setTimeout(r2, POLL_INTERVAL_MS));
19836
+ }
19837
+ throw new Error("Deployment timed out (5+ minutes)");
19838
+ }
19839
+ async function deployVercelFrontend(appDir, _config) {
19840
+ const result = resolveVercelCredentials(appDir);
19841
+ if (result.missing) {
19842
+ const secretVars = result.missing.filter((v2) => v2 === "VERCEL_TOKEN");
19843
+ const appVars = result.missing.filter((v2) => v2 !== "VERCEL_TOKEN");
19844
+ const hints = [];
19845
+ if (secretVars.length > 0)
19846
+ hints.push("Add VERCEL_TOKEN to .dndev.secrets at project root.");
19847
+ if (appVars.length > 0)
19848
+ hints.push(`Add ${appVars.join(", ")} to apps/<app>/.env`);
19849
+ throw new Error(
19850
+ `Missing Vercel credentials: ${result.missing.join(", ")}
19851
+ ` + hints.join("\n") + "\nSee guides/dndev/SETUP_VERCEL.md"
19852
+ );
19853
+ }
19854
+ const { token, orgId, projectId } = result.credentials;
19855
+ const distDir = joinPath(appDir, "dist");
19856
+ if (!pathExists(distDir)) {
19857
+ throw new Error(`dist/ not found at ${distDir}. Run build first.`);
19858
+ }
19859
+ log.debug("Using Vercel REST API (token-based, no CLI)");
19860
+ log.info(`Vercel org: ${orgId ?? "(personal account)"}`);
19861
+ log.info(`Vercel project: ${projectId}`);
19862
+ log.info(
19863
+ `Token: ${token.slice(0, 6)}...${token.slice(-4)} (${token.length} chars)`
19864
+ );
19865
+ log.info("Validating Vercel credentials...");
19866
+ const user = await validateToken(token);
19867
+ log.success(`Token valid (${user.username})`);
19868
+ const project = await validateProject(token, projectId, orgId);
19869
+ log.success(`Project accessible (${project.projectName})`);
19870
+ log.info("Collecting dist/ files...");
19871
+ const files = await collectDistFiles(distDir);
19872
+ if (files.length === 0) {
19873
+ throw new Error("dist/ is empty \u2014 nothing to deploy.");
19874
+ }
19875
+ log.info(`Found ${files.length} files`);
19876
+ log.info("Uploading files to Vercel...");
19877
+ await uploadFiles(files, token, orgId);
19878
+ log.success(`${files.length} files uploaded`);
19879
+ log.info("Creating production deployment...");
19880
+ const deployment = await createDeployment(
19881
+ files,
19882
+ token,
19883
+ orgId,
19884
+ projectId,
19885
+ project.projectName
19886
+ );
19887
+ log.info(`Deployment ${deployment.id} created, waiting...`);
19888
+ const ready = await waitForReady(deployment.id, token, orgId);
19889
+ const prodUrl = `https://${ready.url}`;
19890
+ log.success(`Production: ${prodUrl}`);
19891
+ if (ready.alias?.length) {
19892
+ log.info(`Aliases: ${ready.alias.join(", ")}`);
19893
+ }
19894
+ }
19895
+
19896
+ // packages/tooling/src/apps/deploy.ts
19897
+ init_cli_input();
19898
+ init_cli_output();
19899
+ init_cli_output();
19900
+ init_cli_tools();
19901
+ init_errors();
19902
+ init_pathResolver();
19903
+
19790
19904
  // packages/tooling/src/utils/provider-detection.ts
19791
19905
  init_utils();
19792
19906
  init_pathResolver();
@@ -19871,12 +19985,6 @@ function detectProvider(appDir) {
19871
19985
  }
19872
19986
 
19873
19987
  // packages/tooling/src/apps/deploy.ts
19874
- init_cli_input();
19875
- init_cli_output();
19876
- init_cli_output();
19877
- init_cli_tools();
19878
- init_errors();
19879
- init_pathResolver();
19880
19988
  async function main6(options = {}) {
19881
19989
  const isStaging = options.staging ?? false;
19882
19990
  const config = {
@@ -20238,6 +20346,28 @@ init_sync_secrets();
20238
20346
 
20239
20347
  // packages/tooling/src/scaffolding/create-app.ts
20240
20348
  init_utils();
20349
+
20350
+ // packages/tooling/src/scaffolding/scaffold-matrix.ts
20351
+ init_utils();
20352
+ function resolveDeployConfig(host, backend) {
20353
+ if (host === "none") return null;
20354
+ if (host === "firebase") return "firebase";
20355
+ if (backend === "supabase") return "vercel-supabase";
20356
+ return "vercel-vercel";
20357
+ }
20358
+ function getScaffoldParts(builder, host, functions, backend) {
20359
+ const baseTemplate = builder === "nextjs" ? "app-next" : builder === "demo" ? "app-demo" : builder === "dndev" ? "app-dndev" : `app-${builder}`;
20360
+ return {
20361
+ builder,
20362
+ backend,
20363
+ baseTemplate,
20364
+ overlay: backend !== "none" ? `overlay-${backend}` : null,
20365
+ deployConfig: resolveDeployConfig(host, backend),
20366
+ functionsTemplate: functions !== "none" ? `functions-${functions}` : null
20367
+ };
20368
+ }
20369
+
20370
+ // packages/tooling/src/scaffolding/create-app.ts
20241
20371
  init_cli_input();
20242
20372
  init_cli_output();
20243
20373
 
@@ -20383,8 +20513,8 @@ function generatePackageJson(templateName, mode, options = {}) {
20383
20513
  result.main = "lib/index.js";
20384
20514
  result.engines = { node: "22" };
20385
20515
  if (options.appName) {
20386
- const platform6 = templateName.includes("vercel") ? "Vercel" : "Firebase";
20387
- result.description = `${options.appName} ${platform6} Functions`;
20516
+ const platform7 = templateName.includes("vercel") ? "Vercel" : "Firebase";
20517
+ result.description = `${options.appName} ${platform7} Functions`;
20388
20518
  }
20389
20519
  if (mode === "development") {
20390
20520
  const workspacePkgs = [
@@ -20422,28 +20552,6 @@ function generatePackageJson(templateName, mode, options = {}) {
20422
20552
  // packages/tooling/src/scaffolding/create-app.ts
20423
20553
  init_pathResolver();
20424
20554
  init_pathResolver();
20425
-
20426
- // packages/tooling/src/scaffolding/scaffold-matrix.ts
20427
- init_utils();
20428
- function resolveDeployConfig(host, backend) {
20429
- if (host === "none") return null;
20430
- if (host === "firebase") return "firebase";
20431
- if (backend === "supabase") return "vercel-supabase";
20432
- return "vercel-vercel";
20433
- }
20434
- function getScaffoldParts(builder, host, functions, backend) {
20435
- const baseTemplate = builder === "nextjs" ? "app-next" : builder === "demo" ? "app-demo" : builder === "dndev" ? "app-dndev" : `app-${builder}`;
20436
- return {
20437
- builder,
20438
- backend,
20439
- baseTemplate,
20440
- overlay: backend !== "none" ? `overlay-${backend}` : null,
20441
- deployConfig: resolveDeployConfig(host, backend),
20442
- functionsTemplate: functions !== "none" ? `functions-${functions}` : null
20443
- };
20444
- }
20445
-
20446
- // packages/tooling/src/scaffolding/create-app.ts
20447
20555
  var SHOW_WIP = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
20448
20556
  async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
20449
20557
  const isInteractive = !appName || !appConfig;