@donotdev/cli 0.1.46 → 0.2.0

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 (47) 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 +105 -37
  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 +107 -43
  8. package/dist/bin/commands/create-project.js +107 -43
  9. package/dist/bin/commands/db.js +134098 -72027
  10. package/dist/bin/commands/deploy.js +310 -239
  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 +310 -239
  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 +317 -246
  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/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
  31. package/templates/functions-firebase/src/billing/index.ts.example +0 -1
  32. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
  33. package/templates/functions-firebase/src/index.ts.example +0 -1
  34. package/templates/functions-supabase/supabase/config.toml.example +4 -0
  35. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
  36. package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
  37. package/templates/functions-vercel/.env.example +9 -0
  38. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
  39. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
  40. package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
  41. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
  42. package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
  43. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
  44. package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
  45. package/templates/root-consumer/.claude/settings.json.example +11 -1
  46. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  47. 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";
@@ -517,7 +526,7 @@ function runValidation(e, a2) {
517
526
  }
518
527
  var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, n$1;
519
528
  var init_dist3 = __esm({
520
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
529
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
521
530
  init_utils2();
522
531
  init_main();
523
532
  import_sisteransi = __toESM(require_src(), 1);
@@ -776,7 +785,7 @@ var init_dist3 = __esm({
776
785
  }
777
786
  });
778
787
 
779
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
788
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
780
789
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
781
790
  import process$1 from "node:process";
782
791
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -793,7 +802,7 @@ function formatInstructionFooter(o, e) {
793
802
  }
794
803
  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, u2, SELECT_INSTRUCTIONS, c, select, i;
795
804
  var init_dist4 = __esm({
796
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
805
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
797
806
  init_utils2();
798
807
  init_dist3();
799
808
  init_dist3();
@@ -1035,19 +1044,19 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1035
1044
  }
1036
1045
  default: {
1037
1046
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1038
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
1039
- `), f = p.length + 1;
1047
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1048
+ `), b = p.length + 1;
1040
1049
  return `${u3}${r2}${limitOptions({
1041
1050
  output: t2.output,
1042
1051
  cursor: this.cursor,
1043
1052
  options: this.options,
1044
1053
  maxItems: t2.maxItems,
1045
1054
  columnPadding: r2.length,
1046
- rowPadding: a2 + f,
1055
+ rowPadding: a2 + b,
1047
1056
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1048
1057
  }).join(`
1049
1058
  ${r2}`)}
1050
- ${b}
1059
+ ${f}
1051
1060
  `;
1052
1061
  }
1053
1062
  }
@@ -5683,9 +5692,9 @@ var require_reusify = __commonJS({
5683
5692
  }
5684
5693
  });
5685
5694
 
5686
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
5695
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5687
5696
  var require_queue = __commonJS({
5688
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
5697
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5689
5698
  "use strict";
5690
5699
  init_utils2();
5691
5700
  var reusify = require_reusify();
@@ -5865,11 +5874,12 @@ var require_queue = __commonJS({
5865
5874
  current.value = null;
5866
5875
  current.callback = noop;
5867
5876
  current.errorHandler = null;
5877
+ current.next = null;
5868
5878
  if (errorHandler2) {
5869
5879
  errorHandler2(new Error("abort"), val);
5870
5880
  }
5871
5881
  callback.call(context2, new Error("abort"));
5872
- current.release(current);
5882
+ cache.release(current);
5873
5883
  current = next;
5874
5884
  }
5875
5885
  self.drain = noop;
@@ -7335,7 +7345,7 @@ import {
7335
7345
  sep,
7336
7346
  extname
7337
7347
  } from "node:path";
7338
- import "node:url";
7348
+ import { fileURLToPath } from "node:url";
7339
7349
  function safeExecuteAsync(fn, message) {
7340
7350
  return fn().catch((error2) => {
7341
7351
  throw new Error(
@@ -7392,6 +7402,7 @@ var init_PathResolver = __esm({
7392
7402
  options;
7393
7403
  _repoRoot;
7394
7404
  _appRoot = null;
7405
+ _writtenPaths = null;
7395
7406
  /**
7396
7407
  * Get or create singleton instance
7397
7408
  * @param options - Configuration options
@@ -7710,16 +7721,17 @@ var init_PathResolver = __esm({
7710
7721
  }
7711
7722
  const detectedFormat = this._detectFormat(filePath, format);
7712
7723
  let writeContent;
7713
- if (Buffer.isBuffer(content)) {
7724
+ if (Buffer2.isBuffer(content)) {
7714
7725
  writeContent = content;
7715
7726
  } else if (detectedFormat === "json" && typeof content === "object") {
7716
- writeContent = JSON.stringify(content, null, 2);
7727
+ writeContent = `${JSON.stringify(content, null, 2)}
7728
+ `;
7717
7729
  } else {
7718
7730
  writeContent = String(content);
7719
7731
  }
7720
7732
  try {
7721
7733
  return await safeExecuteAsync(async () => {
7722
- if (Buffer.isBuffer(writeContent)) {
7734
+ if (Buffer2.isBuffer(writeContent)) {
7723
7735
  await fs.promises.writeFile(normalizedPath, writeContent);
7724
7736
  } else {
7725
7737
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -7771,19 +7783,21 @@ var init_PathResolver = __esm({
7771
7783
  }
7772
7784
  const detectedFormat = this._detectFormat(filePath, format);
7773
7785
  let writeContent;
7774
- if (Buffer.isBuffer(content)) {
7786
+ if (Buffer2.isBuffer(content)) {
7775
7787
  writeContent = content;
7776
7788
  } else if (detectedFormat === "json" && typeof content === "object") {
7777
- writeContent = JSON.stringify(content, null, 2);
7789
+ writeContent = `${JSON.stringify(content, null, 2)}
7790
+ `;
7778
7791
  } else {
7779
7792
  writeContent = String(content);
7780
7793
  }
7781
7794
  try {
7782
- if (Buffer.isBuffer(writeContent)) {
7795
+ if (Buffer2.isBuffer(writeContent)) {
7783
7796
  fs.writeFileSync(normalizedPath, writeContent);
7784
7797
  } else {
7785
7798
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
7786
7799
  }
7800
+ this._writtenPaths?.add(normalizedPath);
7787
7801
  if (verbose) {
7788
7802
  log3.info(
7789
7803
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -7868,6 +7882,7 @@ var init_PathResolver = __esm({
7868
7882
  }
7869
7883
  try {
7870
7884
  fs.copyFileSync(srcPath, normalizedDestPath);
7885
+ this._writtenPaths?.add(normalizedDestPath);
7871
7886
  if (verbose) {
7872
7887
  log3.info(
7873
7888
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -7935,6 +7950,24 @@ var init_PathResolver = __esm({
7935
7950
  return null;
7936
7951
  }
7937
7952
  }
7953
+ /**
7954
+ * Resolve the real path of a file, following symlinks
7955
+ * @param filePath - Path to resolve
7956
+ * @returns Resolved real path
7957
+ */
7958
+ realpathSync(filePath) {
7959
+ return fs.realpathSync(filePath);
7960
+ }
7961
+ /**
7962
+ * Watch a directory for changes
7963
+ * @param dirPath - Directory to watch
7964
+ * @param options - fs.watch options
7965
+ * @param callback - Callback for change events
7966
+ * @returns FSWatcher instance
7967
+ */
7968
+ watch(dirPath, options, callback) {
7969
+ return fs.watch(dirPath, options, callback);
7970
+ }
7938
7971
  /**
7939
7972
  * Get file stats synchronously (follows symlinks)
7940
7973
  * Returns null if file doesn't exist (graceful degradation)
@@ -8014,6 +8047,28 @@ var init_PathResolver = __esm({
8014
8047
  * Get app root (where vite.config.ts is, Vite's config.root)
8015
8048
  * Falls back to repoRoot if not set
8016
8049
  */
8050
+ /**
8051
+ * Start recording every path written by writeSync/copySync.
8052
+ * Lets a generator know exactly which files the current run produced,
8053
+ * without comparing file timestamps to a clock.
8054
+ */
8055
+ startWriteRecording() {
8056
+ this._writtenPaths = /* @__PURE__ */ new Set();
8057
+ }
8058
+ /**
8059
+ * Stop recording and return the normalized paths written since
8060
+ * startWriteRecording().
8061
+ */
8062
+ stopWriteRecording() {
8063
+ if (!this._writtenPaths) {
8064
+ throw new Error(
8065
+ "stopWriteRecording() called without startWriteRecording()"
8066
+ );
8067
+ }
8068
+ const written = this._writtenPaths;
8069
+ this._writtenPaths = null;
8070
+ return written;
8071
+ }
8017
8072
  getAppRoot() {
8018
8073
  if (!this._appRoot) {
8019
8074
  return this._repoRoot;
@@ -8271,6 +8326,15 @@ var init_PathResolver = __esm({
8271
8326
  const cjsPath = this.getEmptyCjsModulePath();
8272
8327
  return cjsPath.replace(/\.cjs$/, ".js");
8273
8328
  }
8329
+ /**
8330
+ * Get absolute path to empty flag component module.
8331
+ * Returns `export default () => null;` — used by flag filtering plugins
8332
+ * to replace unused flag files at build time.
8333
+ */
8334
+ getEmptyFlagModulePath() {
8335
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8336
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8337
+ }
8274
8338
  /**
8275
8339
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8276
8340
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8396,7 +8460,7 @@ var init_typed_file_operations = __esm({
8396
8460
  });
8397
8461
 
8398
8462
  // packages/tooling/src/bundler/utils.ts
8399
- import { Buffer } from "node:buffer";
8463
+ import { Buffer as Buffer2 } from "node:buffer";
8400
8464
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
8401
8465
  import { createRequire as createRequire3 } from "node:module";
8402
8466
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -8413,7 +8477,7 @@ var init_utils2 = __esm({
8413
8477
  globalThis.require = require2;
8414
8478
  globalThis.__filename = __filename;
8415
8479
  globalThis.__dirname = __dirname;
8416
- globalThis.Buffer = Buffer;
8480
+ globalThis.Buffer = Buffer2;
8417
8481
  globalThis.process = process;
8418
8482
  if (typeof global === "undefined") {
8419
8483
  globalThis.global = globalThis;
@@ -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 __export = (target, all) => {
20
29
  for (var name in all)
@@ -457,13 +466,13 @@ var require_src = __commonJS({
457
466
  }
458
467
  });
459
468
 
460
- // node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
469
+ // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
461
470
  import { styleText } from "node:util";
462
471
  import { stdout, stdin } from "node:process";
463
472
  import { ReadStream } from "node:tty";
464
473
  var import_sisteransi, a$1, t, settings, R, getColumns;
465
474
  var init_dist3 = __esm({
466
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
475
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
467
476
  init_utils2();
468
477
  init_main();
469
478
  import_sisteransi = __toESM(require_src(), 1);
@@ -516,7 +525,7 @@ var init_dist3 = __esm({
516
525
  }
517
526
  });
518
527
 
519
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
528
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
520
529
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
521
530
  import process$1 from "node:process";
522
531
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -529,7 +538,7 @@ function isUnicodeSupported() {
529
538
  }
530
539
  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, MULTISELECT_INSTRUCTIONS, log, intro, outro, W$1, C, note, u2, SELECT_INSTRUCTIONS, i;
531
540
  var init_dist4 = __esm({
532
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
541
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
533
542
  init_utils2();
534
543
  init_dist3();
535
544
  init_dist3();
@@ -5293,9 +5302,9 @@ var require_reusify = __commonJS({
5293
5302
  }
5294
5303
  });
5295
5304
 
5296
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
5305
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5297
5306
  var require_queue = __commonJS({
5298
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
5307
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5299
5308
  "use strict";
5300
5309
  init_utils2();
5301
5310
  var reusify = require_reusify();
@@ -5475,11 +5484,12 @@ var require_queue = __commonJS({
5475
5484
  current.value = null;
5476
5485
  current.callback = noop;
5477
5486
  current.errorHandler = null;
5487
+ current.next = null;
5478
5488
  if (errorHandler2) {
5479
5489
  errorHandler2(new Error("abort"), val);
5480
5490
  }
5481
5491
  callback.call(context2, new Error("abort"));
5482
- current.release(current);
5492
+ cache.release(current);
5483
5493
  current = next;
5484
5494
  }
5485
5495
  self.drain = noop;
@@ -6945,7 +6955,7 @@ import {
6945
6955
  sep,
6946
6956
  extname
6947
6957
  } from "node:path";
6948
- import "node:url";
6958
+ import { fileURLToPath } from "node:url";
6949
6959
  function safeExecuteAsync(fn, message) {
6950
6960
  return fn().catch((error2) => {
6951
6961
  throw new Error(
@@ -7002,6 +7012,7 @@ var init_PathResolver = __esm({
7002
7012
  options;
7003
7013
  _repoRoot;
7004
7014
  _appRoot = null;
7015
+ _writtenPaths = null;
7005
7016
  /**
7006
7017
  * Get or create singleton instance
7007
7018
  * @param options - Configuration options
@@ -7320,16 +7331,17 @@ var init_PathResolver = __esm({
7320
7331
  }
7321
7332
  const detectedFormat = this._detectFormat(filePath, format);
7322
7333
  let writeContent;
7323
- if (Buffer.isBuffer(content)) {
7334
+ if (Buffer2.isBuffer(content)) {
7324
7335
  writeContent = content;
7325
7336
  } else if (detectedFormat === "json" && typeof content === "object") {
7326
- writeContent = JSON.stringify(content, null, 2);
7337
+ writeContent = `${JSON.stringify(content, null, 2)}
7338
+ `;
7327
7339
  } else {
7328
7340
  writeContent = String(content);
7329
7341
  }
7330
7342
  try {
7331
7343
  return await safeExecuteAsync(async () => {
7332
- if (Buffer.isBuffer(writeContent)) {
7344
+ if (Buffer2.isBuffer(writeContent)) {
7333
7345
  await fs.promises.writeFile(normalizedPath, writeContent);
7334
7346
  } else {
7335
7347
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -7381,19 +7393,21 @@ var init_PathResolver = __esm({
7381
7393
  }
7382
7394
  const detectedFormat = this._detectFormat(filePath, format);
7383
7395
  let writeContent;
7384
- if (Buffer.isBuffer(content)) {
7396
+ if (Buffer2.isBuffer(content)) {
7385
7397
  writeContent = content;
7386
7398
  } else if (detectedFormat === "json" && typeof content === "object") {
7387
- writeContent = JSON.stringify(content, null, 2);
7399
+ writeContent = `${JSON.stringify(content, null, 2)}
7400
+ `;
7388
7401
  } else {
7389
7402
  writeContent = String(content);
7390
7403
  }
7391
7404
  try {
7392
- if (Buffer.isBuffer(writeContent)) {
7405
+ if (Buffer2.isBuffer(writeContent)) {
7393
7406
  fs.writeFileSync(normalizedPath, writeContent);
7394
7407
  } else {
7395
7408
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
7396
7409
  }
7410
+ this._writtenPaths?.add(normalizedPath);
7397
7411
  if (verbose) {
7398
7412
  log3.info(
7399
7413
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -7478,6 +7492,7 @@ var init_PathResolver = __esm({
7478
7492
  }
7479
7493
  try {
7480
7494
  fs.copyFileSync(srcPath, normalizedDestPath);
7495
+ this._writtenPaths?.add(normalizedDestPath);
7481
7496
  if (verbose) {
7482
7497
  log3.info(
7483
7498
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -7545,6 +7560,24 @@ var init_PathResolver = __esm({
7545
7560
  return null;
7546
7561
  }
7547
7562
  }
7563
+ /**
7564
+ * Resolve the real path of a file, following symlinks
7565
+ * @param filePath - Path to resolve
7566
+ * @returns Resolved real path
7567
+ */
7568
+ realpathSync(filePath) {
7569
+ return fs.realpathSync(filePath);
7570
+ }
7571
+ /**
7572
+ * Watch a directory for changes
7573
+ * @param dirPath - Directory to watch
7574
+ * @param options - fs.watch options
7575
+ * @param callback - Callback for change events
7576
+ * @returns FSWatcher instance
7577
+ */
7578
+ watch(dirPath, options, callback) {
7579
+ return fs.watch(dirPath, options, callback);
7580
+ }
7548
7581
  /**
7549
7582
  * Get file stats synchronously (follows symlinks)
7550
7583
  * Returns null if file doesn't exist (graceful degradation)
@@ -7624,6 +7657,28 @@ var init_PathResolver = __esm({
7624
7657
  * Get app root (where vite.config.ts is, Vite's config.root)
7625
7658
  * Falls back to repoRoot if not set
7626
7659
  */
7660
+ /**
7661
+ * Start recording every path written by writeSync/copySync.
7662
+ * Lets a generator know exactly which files the current run produced,
7663
+ * without comparing file timestamps to a clock.
7664
+ */
7665
+ startWriteRecording() {
7666
+ this._writtenPaths = /* @__PURE__ */ new Set();
7667
+ }
7668
+ /**
7669
+ * Stop recording and return the normalized paths written since
7670
+ * startWriteRecording().
7671
+ */
7672
+ stopWriteRecording() {
7673
+ if (!this._writtenPaths) {
7674
+ throw new Error(
7675
+ "stopWriteRecording() called without startWriteRecording()"
7676
+ );
7677
+ }
7678
+ const written = this._writtenPaths;
7679
+ this._writtenPaths = null;
7680
+ return written;
7681
+ }
7627
7682
  getAppRoot() {
7628
7683
  if (!this._appRoot) {
7629
7684
  return this._repoRoot;
@@ -7881,6 +7936,15 @@ var init_PathResolver = __esm({
7881
7936
  const cjsPath = this.getEmptyCjsModulePath();
7882
7937
  return cjsPath.replace(/\.cjs$/, ".js");
7883
7938
  }
7939
+ /**
7940
+ * Get absolute path to empty flag component module.
7941
+ * Returns `export default () => null;` — used by flag filtering plugins
7942
+ * to replace unused flag files at build time.
7943
+ */
7944
+ getEmptyFlagModulePath() {
7945
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
7946
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
7947
+ }
7884
7948
  /**
7885
7949
  * Get absolute path to empty CJS module for esbuild pre-bundling.
7886
7950
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8005,7 +8069,7 @@ var init_typed_file_operations = __esm({
8005
8069
  });
8006
8070
 
8007
8071
  // packages/tooling/src/bundler/utils.ts
8008
- import { Buffer } from "node:buffer";
8072
+ import { Buffer as Buffer2 } from "node:buffer";
8009
8073
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
8010
8074
  import { createRequire as createRequire3 } from "node:module";
8011
8075
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -8022,7 +8086,7 @@ var init_utils2 = __esm({
8022
8086
  globalThis.require = require2;
8023
8087
  globalThis.__filename = __filename;
8024
8088
  globalThis.__dirname = __dirname;
8025
- globalThis.Buffer = Buffer;
8089
+ globalThis.Buffer = Buffer2;
8026
8090
  globalThis.process = process;
8027
8091
  if (typeof global === "undefined") {
8028
8092
  globalThis.global = globalThis;