@donotdev/cli 0.1.46 → 0.2.1

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 (48) hide show
  1. package/dependencies-matrix.json +189 -149
  2. package/dist/bin/commands/agent-setup.js +83 -19
  3. package/dist/bin/commands/build.js +207 -62
  4. package/dist/bin/commands/bump.js +108 -44
  5. package/dist/bin/commands/cacheout.js +83 -19
  6. package/dist/bin/commands/coach.js +83 -19
  7. package/dist/bin/commands/create-app.js +111 -43
  8. package/dist/bin/commands/create-project.js +111 -43
  9. package/dist/bin/commands/db.js +134098 -72027
  10. package/dist/bin/commands/deploy.js +524 -323
  11. package/dist/bin/commands/dev.js +87 -23
  12. package/dist/bin/commands/doctor.js +83 -19
  13. package/dist/bin/commands/emu.js +93 -29
  14. package/dist/bin/commands/format.js +83 -19
  15. package/dist/bin/commands/get-demo.js +87 -23
  16. package/dist/bin/commands/make-admin.js +7466 -8217
  17. package/dist/bin/commands/preview.js +87 -23
  18. package/dist/bin/commands/seed.js +134098 -72027
  19. package/dist/bin/commands/setup-cicd.js +107 -43
  20. package/dist/bin/commands/setup.js +110 -43
  21. package/dist/bin/commands/staging.js +524 -323
  22. package/dist/bin/commands/sync-secrets.js +88 -24
  23. package/dist/bin/commands/type-check.js +83 -19
  24. package/dist/bin/commands/wai.js +83 -19
  25. package/dist/bin/dndev.js +8 -3
  26. package/dist/index.js +534 -331
  27. package/package.json +3 -3
  28. package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
  29. package/templates/app-next/src/app/layout.tsx.example +19 -1
  30. package/templates/deploy-config/vercel.json.example +13 -13
  31. package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
  32. package/templates/functions-firebase/src/billing/index.ts.example +0 -1
  33. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
  34. package/templates/functions-firebase/src/index.ts.example +0 -1
  35. package/templates/functions-supabase/supabase/config.toml.example +4 -0
  36. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
  37. package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
  38. package/templates/functions-vercel/.env.example +9 -0
  39. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
  40. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
  41. package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
  42. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
  43. package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
  44. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
  45. package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
  46. package/templates/root-consumer/.claude/settings.json.example +11 -1
  47. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  48. package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
@@ -10,11 +10,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
10
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
- var __esm = (fn, res) => function __init() {
14
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ var __esm = (fn, res, err) => function __init() {
14
+ if (err) throw err[0];
15
+ try {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ } catch (e) {
18
+ throw err = [e], e;
19
+ }
15
20
  };
16
21
  var __commonJS = (cb, mod) => function __require2() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
+ try {
23
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ } catch (e) {
25
+ throw mod = 0, e;
26
+ }
18
27
  };
19
28
  var __copyProps = (to, from, except, desc) => {
20
29
  if (from && typeof from === "object" || typeof from === "function") {
@@ -453,7 +462,7 @@ var require_src = __commonJS({
453
462
  }
454
463
  });
455
464
 
456
- // node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
465
+ // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
457
466
  import { styleText } from "node:util";
458
467
  import { stdout, stdin } from "node:process";
459
468
  import l__default from "node:readline";
@@ -520,7 +529,7 @@ function runValidation(e, a2) {
520
529
  }
521
530
  var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, n$1;
522
531
  var init_dist3 = __esm({
523
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
532
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
524
533
  init_utils2();
525
534
  init_main();
526
535
  import_sisteransi = __toESM(require_src(), 1);
@@ -779,7 +788,7 @@ var init_dist3 = __esm({
779
788
  }
780
789
  });
781
790
 
782
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
791
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
783
792
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
784
793
  import process$1 from "node:process";
785
794
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -796,7 +805,7 @@ function formatInstructionFooter(o, e) {
796
805
  }
797
806
  var import_sisteransi2, unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, MULTISELECT_INSTRUCTIONS, log, cancel, W$1, C, note, u2, SELECT_INSTRUCTIONS, c, select, i;
798
807
  var init_dist4 = __esm({
799
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
808
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
800
809
  init_utils2();
801
810
  init_dist3();
802
811
  init_dist3();
@@ -1076,19 +1085,19 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1076
1085
  }
1077
1086
  default: {
1078
1087
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1079
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
1080
- `), f = p.length + 1;
1088
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1089
+ `), b = p.length + 1;
1081
1090
  return `${u3}${r2}${limitOptions({
1082
1091
  output: t2.output,
1083
1092
  cursor: this.cursor,
1084
1093
  options: this.options,
1085
1094
  maxItems: t2.maxItems,
1086
1095
  columnPadding: r2.length,
1087
- rowPadding: a2 + f,
1096
+ rowPadding: a2 + b,
1088
1097
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1089
1098
  }).join(`
1090
1099
  ${r2}`)}
1091
- ${b}
1100
+ ${f}
1092
1101
  `;
1093
1102
  }
1094
1103
  }
@@ -5724,9 +5733,9 @@ var require_reusify = __commonJS({
5724
5733
  }
5725
5734
  });
5726
5735
 
5727
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
5736
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5728
5737
  var require_queue = __commonJS({
5729
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
5738
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5730
5739
  "use strict";
5731
5740
  init_utils2();
5732
5741
  var reusify = require_reusify();
@@ -5906,11 +5915,12 @@ var require_queue = __commonJS({
5906
5915
  current.value = null;
5907
5916
  current.callback = noop;
5908
5917
  current.errorHandler = null;
5918
+ current.next = null;
5909
5919
  if (errorHandler2) {
5910
5920
  errorHandler2(new Error("abort"), val);
5911
5921
  }
5912
5922
  callback.call(context2, new Error("abort"));
5913
- current.release(current);
5923
+ cache.release(current);
5914
5924
  current = next;
5915
5925
  }
5916
5926
  self.drain = noop;
@@ -7376,7 +7386,7 @@ import {
7376
7386
  sep,
7377
7387
  extname
7378
7388
  } from "node:path";
7379
- import "node:url";
7389
+ import { fileURLToPath } from "node:url";
7380
7390
  function safeExecuteAsync(fn, message) {
7381
7391
  return fn().catch((error2) => {
7382
7392
  throw new Error(
@@ -7433,6 +7443,7 @@ var init_PathResolver = __esm({
7433
7443
  options;
7434
7444
  _repoRoot;
7435
7445
  _appRoot = null;
7446
+ _writtenPaths = null;
7436
7447
  /**
7437
7448
  * Get or create singleton instance
7438
7449
  * @param options - Configuration options
@@ -7751,16 +7762,17 @@ var init_PathResolver = __esm({
7751
7762
  }
7752
7763
  const detectedFormat = this._detectFormat(filePath, format);
7753
7764
  let writeContent;
7754
- if (Buffer.isBuffer(content)) {
7765
+ if (Buffer2.isBuffer(content)) {
7755
7766
  writeContent = content;
7756
7767
  } else if (detectedFormat === "json" && typeof content === "object") {
7757
- writeContent = JSON.stringify(content, null, 2);
7768
+ writeContent = `${JSON.stringify(content, null, 2)}
7769
+ `;
7758
7770
  } else {
7759
7771
  writeContent = String(content);
7760
7772
  }
7761
7773
  try {
7762
7774
  return await safeExecuteAsync(async () => {
7763
- if (Buffer.isBuffer(writeContent)) {
7775
+ if (Buffer2.isBuffer(writeContent)) {
7764
7776
  await fs.promises.writeFile(normalizedPath, writeContent);
7765
7777
  } else {
7766
7778
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -7812,19 +7824,21 @@ var init_PathResolver = __esm({
7812
7824
  }
7813
7825
  const detectedFormat = this._detectFormat(filePath, format);
7814
7826
  let writeContent;
7815
- if (Buffer.isBuffer(content)) {
7827
+ if (Buffer2.isBuffer(content)) {
7816
7828
  writeContent = content;
7817
7829
  } else if (detectedFormat === "json" && typeof content === "object") {
7818
- writeContent = JSON.stringify(content, null, 2);
7830
+ writeContent = `${JSON.stringify(content, null, 2)}
7831
+ `;
7819
7832
  } else {
7820
7833
  writeContent = String(content);
7821
7834
  }
7822
7835
  try {
7823
- if (Buffer.isBuffer(writeContent)) {
7836
+ if (Buffer2.isBuffer(writeContent)) {
7824
7837
  fs.writeFileSync(normalizedPath, writeContent);
7825
7838
  } else {
7826
7839
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
7827
7840
  }
7841
+ this._writtenPaths?.add(normalizedPath);
7828
7842
  if (verbose) {
7829
7843
  log3.info(
7830
7844
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -7909,6 +7923,7 @@ var init_PathResolver = __esm({
7909
7923
  }
7910
7924
  try {
7911
7925
  fs.copyFileSync(srcPath, normalizedDestPath);
7926
+ this._writtenPaths?.add(normalizedDestPath);
7912
7927
  if (verbose) {
7913
7928
  log3.info(
7914
7929
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -7976,6 +7991,24 @@ var init_PathResolver = __esm({
7976
7991
  return null;
7977
7992
  }
7978
7993
  }
7994
+ /**
7995
+ * Resolve the real path of a file, following symlinks
7996
+ * @param filePath - Path to resolve
7997
+ * @returns Resolved real path
7998
+ */
7999
+ realpathSync(filePath) {
8000
+ return fs.realpathSync(filePath);
8001
+ }
8002
+ /**
8003
+ * Watch a directory for changes
8004
+ * @param dirPath - Directory to watch
8005
+ * @param options - fs.watch options
8006
+ * @param callback - Callback for change events
8007
+ * @returns FSWatcher instance
8008
+ */
8009
+ watch(dirPath, options, callback) {
8010
+ return fs.watch(dirPath, options, callback);
8011
+ }
7979
8012
  /**
7980
8013
  * Get file stats synchronously (follows symlinks)
7981
8014
  * Returns null if file doesn't exist (graceful degradation)
@@ -8055,6 +8088,28 @@ var init_PathResolver = __esm({
8055
8088
  * Get app root (where vite.config.ts is, Vite's config.root)
8056
8089
  * Falls back to repoRoot if not set
8057
8090
  */
8091
+ /**
8092
+ * Start recording every path written by writeSync/copySync.
8093
+ * Lets a generator know exactly which files the current run produced,
8094
+ * without comparing file timestamps to a clock.
8095
+ */
8096
+ startWriteRecording() {
8097
+ this._writtenPaths = /* @__PURE__ */ new Set();
8098
+ }
8099
+ /**
8100
+ * Stop recording and return the normalized paths written since
8101
+ * startWriteRecording().
8102
+ */
8103
+ stopWriteRecording() {
8104
+ if (!this._writtenPaths) {
8105
+ throw new Error(
8106
+ "stopWriteRecording() called without startWriteRecording()"
8107
+ );
8108
+ }
8109
+ const written = this._writtenPaths;
8110
+ this._writtenPaths = null;
8111
+ return written;
8112
+ }
8058
8113
  getAppRoot() {
8059
8114
  if (!this._appRoot) {
8060
8115
  return this._repoRoot;
@@ -8312,6 +8367,15 @@ var init_PathResolver = __esm({
8312
8367
  const cjsPath = this.getEmptyCjsModulePath();
8313
8368
  return cjsPath.replace(/\.cjs$/, ".js");
8314
8369
  }
8370
+ /**
8371
+ * Get absolute path to empty flag component module.
8372
+ * Returns `export default () => null;` — used by flag filtering plugins
8373
+ * to replace unused flag files at build time.
8374
+ */
8375
+ getEmptyFlagModulePath() {
8376
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8377
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8378
+ }
8315
8379
  /**
8316
8380
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8317
8381
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8415,7 +8479,7 @@ var init_pathResolver = __esm({
8415
8479
  });
8416
8480
 
8417
8481
  // packages/tooling/src/bundler/utils.ts
8418
- import { Buffer } from "node:buffer";
8482
+ import { Buffer as Buffer2 } from "node:buffer";
8419
8483
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
8420
8484
  import { createRequire as createRequire3 } from "node:module";
8421
8485
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -8432,7 +8496,7 @@ var init_utils2 = __esm({
8432
8496
  globalThis.require = require2;
8433
8497
  globalThis.__filename = __filename;
8434
8498
  globalThis.__dirname = __dirname;
8435
- globalThis.Buffer = Buffer;
8499
+ globalThis.Buffer = Buffer2;
8436
8500
  globalThis.process = process;
8437
8501
  if (typeof global === "undefined") {
8438
8502
  globalThis.global = globalThis;
@@ -9133,7 +9197,7 @@ function uploadServiceAccountToGitHub(appDir, repo, dryRun = false, staging = fa
9133
9197
  const contentRaw = readSync(filePath, { format: "text" });
9134
9198
  const content = typeof contentRaw === "string" ? contentRaw : null;
9135
9199
  if (!content) return;
9136
- const encoded = Buffer.from(content).toString("base64");
9200
+ const encoded = Buffer2.from(content).toString("base64");
9137
9201
  setGitHubSecret(secretName, encoded, repo, dryRun);
9138
9202
  }
9139
9203
  async function main(options = {}) {
@@ -10,11 +10,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
10
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
- var __esm = (fn, res) => function __init() {
14
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ var __esm = (fn, res, err) => function __init() {
14
+ if (err) throw err[0];
15
+ try {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ } catch (e) {
18
+ throw err = [e], e;
19
+ }
15
20
  };
16
21
  var __commonJS = (cb, mod) => function __require2() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
+ try {
23
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ } catch (e) {
25
+ throw mod = 0, e;
26
+ }
18
27
  };
19
28
  var __copyProps = (to, from, except, desc) => {
20
29
  if (from && typeof from === "object" || typeof from === "function") {
@@ -453,7 +462,7 @@ var require_src = __commonJS({
453
462
  }
454
463
  });
455
464
 
456
- // node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
465
+ // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
457
466
  import { styleText } from "node:util";
458
467
  import { stdout, stdin } from "node:process";
459
468
  import * as l from "node:readline";
@@ -499,7 +508,7 @@ function block({
499
508
  }
500
509
  var import_sisteransi, a$1, t, settings, R, getColumns;
501
510
  var init_dist3 = __esm({
502
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
511
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
503
512
  init_utils2();
504
513
  init_main();
505
514
  import_sisteransi = __toESM(require_src(), 1);
@@ -552,7 +561,7 @@ var init_dist3 = __esm({
552
561
  }
553
562
  });
554
563
 
555
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
564
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
556
565
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
557
566
  import process$1 from "node:process";
558
567
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -565,7 +574,7 @@ function isUnicodeSupported() {
565
574
  }
566
575
  var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, MULTISELECT_INSTRUCTIONS, log, intro, outro, W, spinner, u2, SELECT_INSTRUCTIONS, i;
567
576
  var init_dist4 = __esm({
568
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
577
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
569
578
  init_utils2();
570
579
  init_dist3();
571
580
  init_dist3();
@@ -5405,9 +5414,9 @@ var require_reusify = __commonJS({
5405
5414
  }
5406
5415
  });
5407
5416
 
5408
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
5417
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5409
5418
  var require_queue = __commonJS({
5410
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
5419
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5411
5420
  "use strict";
5412
5421
  init_utils2();
5413
5422
  var reusify = require_reusify();
@@ -5587,11 +5596,12 @@ var require_queue = __commonJS({
5587
5596
  current.value = null;
5588
5597
  current.callback = noop;
5589
5598
  current.errorHandler = null;
5599
+ current.next = null;
5590
5600
  if (errorHandler2) {
5591
5601
  errorHandler2(new Error("abort"), val);
5592
5602
  }
5593
5603
  callback.call(context2, new Error("abort"));
5594
- current.release(current);
5604
+ cache.release(current);
5595
5605
  current = next;
5596
5606
  }
5597
5607
  self.drain = noop;
@@ -7057,7 +7067,7 @@ import {
7057
7067
  sep,
7058
7068
  extname
7059
7069
  } from "node:path";
7060
- import "node:url";
7070
+ import { fileURLToPath } from "node:url";
7061
7071
  function safeExecuteAsync(fn, message) {
7062
7072
  return fn().catch((error2) => {
7063
7073
  throw new Error(
@@ -7114,6 +7124,7 @@ var init_PathResolver = __esm({
7114
7124
  options;
7115
7125
  _repoRoot;
7116
7126
  _appRoot = null;
7127
+ _writtenPaths = null;
7117
7128
  /**
7118
7129
  * Get or create singleton instance
7119
7130
  * @param options - Configuration options
@@ -7432,16 +7443,17 @@ var init_PathResolver = __esm({
7432
7443
  }
7433
7444
  const detectedFormat = this._detectFormat(filePath, format);
7434
7445
  let writeContent;
7435
- if (Buffer.isBuffer(content)) {
7446
+ if (Buffer2.isBuffer(content)) {
7436
7447
  writeContent = content;
7437
7448
  } else if (detectedFormat === "json" && typeof content === "object") {
7438
- writeContent = JSON.stringify(content, null, 2);
7449
+ writeContent = `${JSON.stringify(content, null, 2)}
7450
+ `;
7439
7451
  } else {
7440
7452
  writeContent = String(content);
7441
7453
  }
7442
7454
  try {
7443
7455
  return await safeExecuteAsync(async () => {
7444
- if (Buffer.isBuffer(writeContent)) {
7456
+ if (Buffer2.isBuffer(writeContent)) {
7445
7457
  await fs.promises.writeFile(normalizedPath, writeContent);
7446
7458
  } else {
7447
7459
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -7493,19 +7505,21 @@ var init_PathResolver = __esm({
7493
7505
  }
7494
7506
  const detectedFormat = this._detectFormat(filePath, format);
7495
7507
  let writeContent;
7496
- if (Buffer.isBuffer(content)) {
7508
+ if (Buffer2.isBuffer(content)) {
7497
7509
  writeContent = content;
7498
7510
  } else if (detectedFormat === "json" && typeof content === "object") {
7499
- writeContent = JSON.stringify(content, null, 2);
7511
+ writeContent = `${JSON.stringify(content, null, 2)}
7512
+ `;
7500
7513
  } else {
7501
7514
  writeContent = String(content);
7502
7515
  }
7503
7516
  try {
7504
- if (Buffer.isBuffer(writeContent)) {
7517
+ if (Buffer2.isBuffer(writeContent)) {
7505
7518
  fs.writeFileSync(normalizedPath, writeContent);
7506
7519
  } else {
7507
7520
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
7508
7521
  }
7522
+ this._writtenPaths?.add(normalizedPath);
7509
7523
  if (verbose) {
7510
7524
  log3.info(
7511
7525
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -7590,6 +7604,7 @@ var init_PathResolver = __esm({
7590
7604
  }
7591
7605
  try {
7592
7606
  fs.copyFileSync(srcPath, normalizedDestPath);
7607
+ this._writtenPaths?.add(normalizedDestPath);
7593
7608
  if (verbose) {
7594
7609
  log3.info(
7595
7610
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -7657,6 +7672,24 @@ var init_PathResolver = __esm({
7657
7672
  return null;
7658
7673
  }
7659
7674
  }
7675
+ /**
7676
+ * Resolve the real path of a file, following symlinks
7677
+ * @param filePath - Path to resolve
7678
+ * @returns Resolved real path
7679
+ */
7680
+ realpathSync(filePath) {
7681
+ return fs.realpathSync(filePath);
7682
+ }
7683
+ /**
7684
+ * Watch a directory for changes
7685
+ * @param dirPath - Directory to watch
7686
+ * @param options - fs.watch options
7687
+ * @param callback - Callback for change events
7688
+ * @returns FSWatcher instance
7689
+ */
7690
+ watch(dirPath, options, callback) {
7691
+ return fs.watch(dirPath, options, callback);
7692
+ }
7660
7693
  /**
7661
7694
  * Get file stats synchronously (follows symlinks)
7662
7695
  * Returns null if file doesn't exist (graceful degradation)
@@ -7736,6 +7769,28 @@ var init_PathResolver = __esm({
7736
7769
  * Get app root (where vite.config.ts is, Vite's config.root)
7737
7770
  * Falls back to repoRoot if not set
7738
7771
  */
7772
+ /**
7773
+ * Start recording every path written by writeSync/copySync.
7774
+ * Lets a generator know exactly which files the current run produced,
7775
+ * without comparing file timestamps to a clock.
7776
+ */
7777
+ startWriteRecording() {
7778
+ this._writtenPaths = /* @__PURE__ */ new Set();
7779
+ }
7780
+ /**
7781
+ * Stop recording and return the normalized paths written since
7782
+ * startWriteRecording().
7783
+ */
7784
+ stopWriteRecording() {
7785
+ if (!this._writtenPaths) {
7786
+ throw new Error(
7787
+ "stopWriteRecording() called without startWriteRecording()"
7788
+ );
7789
+ }
7790
+ const written = this._writtenPaths;
7791
+ this._writtenPaths = null;
7792
+ return written;
7793
+ }
7739
7794
  getAppRoot() {
7740
7795
  if (!this._appRoot) {
7741
7796
  return this._repoRoot;
@@ -7993,6 +8048,15 @@ var init_PathResolver = __esm({
7993
8048
  const cjsPath = this.getEmptyCjsModulePath();
7994
8049
  return cjsPath.replace(/\.cjs$/, ".js");
7995
8050
  }
8051
+ /**
8052
+ * Get absolute path to empty flag component module.
8053
+ * Returns `export default () => null;` — used by flag filtering plugins
8054
+ * to replace unused flag files at build time.
8055
+ */
8056
+ getEmptyFlagModulePath() {
8057
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8058
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8059
+ }
7996
8060
  /**
7997
8061
  * Get absolute path to empty CJS module for esbuild pre-bundling.
7998
8062
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8122,7 +8186,7 @@ var init_pathResolver = __esm({
8122
8186
  });
8123
8187
 
8124
8188
  // packages/tooling/src/bundler/utils.ts
8125
- import { Buffer } from "node:buffer";
8189
+ import { Buffer as Buffer2 } from "node:buffer";
8126
8190
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
8127
8191
  import { createRequire as createRequire3 } from "node:module";
8128
8192
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -8139,7 +8203,7 @@ var init_utils2 = __esm({
8139
8203
  globalThis.require = require2;
8140
8204
  globalThis.__filename = __filename;
8141
8205
  globalThis.__dirname = __dirname;
8142
- globalThis.Buffer = Buffer;
8206
+ globalThis.Buffer = Buffer2;
8143
8207
  globalThis.process = process;
8144
8208
  if (typeof global === "undefined") {
8145
8209
  globalThis.global = globalThis;