@vibesdotdev/infra-deploy 0.0.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 (183) hide show
  1. package/README.md +125 -0
  2. package/SPEC.md +181 -0
  3. package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.d.ts +39 -0
  4. package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.d.ts.map +1 -0
  5. package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.js +61 -0
  6. package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.js.map +1 -0
  7. package/dist/cli/alerts/infra-alerts-create.cli-command.impl.d.ts +13 -0
  8. package/dist/cli/alerts/infra-alerts-create.cli-command.impl.d.ts.map +1 -0
  9. package/dist/cli/alerts/infra-alerts-create.cli-command.impl.js +109 -0
  10. package/dist/cli/alerts/infra-alerts-create.cli-command.impl.js.map +1 -0
  11. package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.d.ts +31 -0
  12. package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.d.ts.map +1 -0
  13. package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.js +36 -0
  14. package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.js.map +1 -0
  15. package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.d.ts +11 -0
  16. package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.d.ts.map +1 -0
  17. package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.js +67 -0
  18. package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.js.map +1 -0
  19. package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.d.ts +21 -0
  20. package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.d.ts.map +1 -0
  21. package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.js +27 -0
  22. package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.js.map +1 -0
  23. package/dist/cli/alerts/infra-alerts-list.cli-command.impl.d.ts +12 -0
  24. package/dist/cli/alerts/infra-alerts-list.cli-command.impl.d.ts.map +1 -0
  25. package/dist/cli/alerts/infra-alerts-list.cli-command.impl.js +74 -0
  26. package/dist/cli/alerts/infra-alerts-list.cli-command.impl.js.map +1 -0
  27. package/dist/cli/alerts/infra-alerts.cli-group.descriptor.d.ts +12 -0
  28. package/dist/cli/alerts/infra-alerts.cli-group.descriptor.d.ts.map +1 -0
  29. package/dist/cli/alerts/infra-alerts.cli-group.descriptor.js +12 -0
  30. package/dist/cli/alerts/infra-alerts.cli-group.descriptor.js.map +1 -0
  31. package/dist/cli/audit/infra-audit.cli-command.descriptor.d.ts +21 -0
  32. package/dist/cli/audit/infra-audit.cli-command.descriptor.d.ts.map +1 -0
  33. package/dist/cli/audit/infra-audit.cli-command.descriptor.js +28 -0
  34. package/dist/cli/audit/infra-audit.cli-command.descriptor.js.map +1 -0
  35. package/dist/cli/audit/infra-audit.cli-command.impl.d.ts +18 -0
  36. package/dist/cli/audit/infra-audit.cli-command.impl.d.ts.map +1 -0
  37. package/dist/cli/audit/infra-audit.cli-command.impl.js +219 -0
  38. package/dist/cli/audit/infra-audit.cli-command.impl.js.map +1 -0
  39. package/dist/cli/infra-deploy.cli-group.descriptor.d.ts +12 -0
  40. package/dist/cli/infra-deploy.cli-group.descriptor.d.ts.map +1 -0
  41. package/dist/cli/infra-deploy.cli-group.descriptor.js +12 -0
  42. package/dist/cli/infra-deploy.cli-group.descriptor.js.map +1 -0
  43. package/dist/cli/infra.cli-group.descriptor.d.ts +11 -0
  44. package/dist/cli/infra.cli-group.descriptor.d.ts.map +1 -0
  45. package/dist/cli/infra.cli-group.descriptor.js +11 -0
  46. package/dist/cli/infra.cli-group.descriptor.js.map +1 -0
  47. package/dist/cli/list/infra-deploy.list.cli-command.descriptor.d.ts +34 -0
  48. package/dist/cli/list/infra-deploy.list.cli-command.descriptor.d.ts.map +1 -0
  49. package/dist/cli/list/infra-deploy.list.cli-command.descriptor.js +29 -0
  50. package/dist/cli/list/infra-deploy.list.cli-command.descriptor.js.map +1 -0
  51. package/dist/cli/list/infra-deploy.list.cli-command.impl.d.ts +5 -0
  52. package/dist/cli/list/infra-deploy.list.cli-command.impl.d.ts.map +1 -0
  53. package/dist/cli/list/infra-deploy.list.cli-command.impl.js +110 -0
  54. package/dist/cli/list/infra-deploy.list.cli-command.impl.js.map +1 -0
  55. package/dist/cli/logs/infra-logs.cli-command.descriptor.d.ts +39 -0
  56. package/dist/cli/logs/infra-logs.cli-command.descriptor.d.ts.map +1 -0
  57. package/dist/cli/logs/infra-logs.cli-command.descriptor.js +64 -0
  58. package/dist/cli/logs/infra-logs.cli-command.descriptor.js.map +1 -0
  59. package/dist/cli/logs/infra-logs.cli-command.impl.d.ts +5 -0
  60. package/dist/cli/logs/infra-logs.cli-command.impl.d.ts.map +1 -0
  61. package/dist/cli/logs/infra-logs.cli-command.impl.js +323 -0
  62. package/dist/cli/logs/infra-logs.cli-command.impl.js.map +1 -0
  63. package/dist/cli/logs/stream-worker-tail.d.ts +62 -0
  64. package/dist/cli/logs/stream-worker-tail.d.ts.map +1 -0
  65. package/dist/cli/logs/stream-worker-tail.js +165 -0
  66. package/dist/cli/logs/stream-worker-tail.js.map +1 -0
  67. package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.d.ts +27 -0
  68. package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.d.ts.map +1 -0
  69. package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.js +75 -0
  70. package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.js.map +1 -0
  71. package/dist/cli/npm/infra-npm-publish.cli-command.impl.d.ts +5 -0
  72. package/dist/cli/npm/infra-npm-publish.cli-command.impl.d.ts.map +1 -0
  73. package/dist/cli/npm/infra-npm-publish.cli-command.impl.js +383 -0
  74. package/dist/cli/npm/infra-npm-publish.cli-command.impl.js.map +1 -0
  75. package/dist/cli/npm/infra-npm.cli-group.descriptor.d.ts +12 -0
  76. package/dist/cli/npm/infra-npm.cli-group.descriptor.d.ts.map +1 -0
  77. package/dist/cli/npm/infra-npm.cli-group.descriptor.js +12 -0
  78. package/dist/cli/npm/infra-npm.cli-group.descriptor.js.map +1 -0
  79. package/dist/cli/observability/infra-observability-set.cli-command.descriptor.d.ts +25 -0
  80. package/dist/cli/observability/infra-observability-set.cli-command.descriptor.d.ts.map +1 -0
  81. package/dist/cli/observability/infra-observability-set.cli-command.descriptor.js +57 -0
  82. package/dist/cli/observability/infra-observability-set.cli-command.descriptor.js.map +1 -0
  83. package/dist/cli/observability/infra-observability-set.cli-command.impl.d.ts +17 -0
  84. package/dist/cli/observability/infra-observability-set.cli-command.impl.d.ts.map +1 -0
  85. package/dist/cli/observability/infra-observability-set.cli-command.impl.js +152 -0
  86. package/dist/cli/observability/infra-observability-set.cli-command.impl.js.map +1 -0
  87. package/dist/cli/observability/infra-observability-status.cli-command.descriptor.d.ts +21 -0
  88. package/dist/cli/observability/infra-observability-status.cli-command.descriptor.d.ts.map +1 -0
  89. package/dist/cli/observability/infra-observability-status.cli-command.descriptor.js +35 -0
  90. package/dist/cli/observability/infra-observability-status.cli-command.descriptor.js.map +1 -0
  91. package/dist/cli/observability/infra-observability-status.cli-command.impl.d.ts +17 -0
  92. package/dist/cli/observability/infra-observability-status.cli-command.impl.d.ts.map +1 -0
  93. package/dist/cli/observability/infra-observability-status.cli-command.impl.js +99 -0
  94. package/dist/cli/observability/infra-observability-status.cli-command.impl.js.map +1 -0
  95. package/dist/cli/observability/infra-observability.cli-group.descriptor.d.ts +12 -0
  96. package/dist/cli/observability/infra-observability.cli-group.descriptor.d.ts.map +1 -0
  97. package/dist/cli/observability/infra-observability.cli-group.descriptor.js +12 -0
  98. package/dist/cli/observability/infra-observability.cli-group.descriptor.js.map +1 -0
  99. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.d.ts +27 -0
  100. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.d.ts.map +1 -0
  101. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.js +35 -0
  102. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.js.map +1 -0
  103. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.d.ts +5 -0
  104. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.d.ts.map +1 -0
  105. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.js +99 -0
  106. package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.js.map +1 -0
  107. package/dist/cli/rum/infra-rum-status.cli-command.descriptor.d.ts +21 -0
  108. package/dist/cli/rum/infra-rum-status.cli-command.descriptor.d.ts.map +1 -0
  109. package/dist/cli/rum/infra-rum-status.cli-command.descriptor.js +27 -0
  110. package/dist/cli/rum/infra-rum-status.cli-command.descriptor.js.map +1 -0
  111. package/dist/cli/rum/infra-rum-status.cli-command.impl.d.ts +12 -0
  112. package/dist/cli/rum/infra-rum-status.cli-command.impl.d.ts.map +1 -0
  113. package/dist/cli/rum/infra-rum-status.cli-command.impl.js +88 -0
  114. package/dist/cli/rum/infra-rum-status.cli-command.impl.js.map +1 -0
  115. package/dist/cli/rum/infra-rum.cli-group.descriptor.d.ts +12 -0
  116. package/dist/cli/rum/infra-rum.cli-group.descriptor.d.ts.map +1 -0
  117. package/dist/cli/rum/infra-rum.cli-group.descriptor.js +12 -0
  118. package/dist/cli/rum/infra-rum.cli-group.descriptor.js.map +1 -0
  119. package/dist/cli/run/infra-deploy.run.cli-command.descriptor.d.ts +27 -0
  120. package/dist/cli/run/infra-deploy.run.cli-command.descriptor.d.ts.map +1 -0
  121. package/dist/cli/run/infra-deploy.run.cli-command.descriptor.js +49 -0
  122. package/dist/cli/run/infra-deploy.run.cli-command.descriptor.js.map +1 -0
  123. package/dist/cli/run/infra-deploy.run.cli-command.impl.d.ts +5 -0
  124. package/dist/cli/run/infra-deploy.run.cli-command.impl.d.ts.map +1 -0
  125. package/dist/cli/run/infra-deploy.run.cli-command.impl.js +272 -0
  126. package/dist/cli/run/infra-deploy.run.cli-command.impl.js.map +1 -0
  127. package/dist/cli/shared/discover-deployments.d.ts +41 -0
  128. package/dist/cli/shared/discover-deployments.d.ts.map +1 -0
  129. package/dist/cli/shared/discover-deployments.js +95 -0
  130. package/dist/cli/shared/discover-deployments.js.map +1 -0
  131. package/dist/config-loader.d.ts +24 -0
  132. package/dist/config-loader.d.ts.map +1 -0
  133. package/dist/config-loader.js +135 -0
  134. package/dist/config-loader.js.map +1 -0
  135. package/dist/index.d.ts +5 -0
  136. package/dist/index.d.ts.map +1 -0
  137. package/dist/index.js +4 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/infra-deploy.plugin.d.ts +3 -0
  140. package/dist/infra-deploy.plugin.d.ts.map +1 -0
  141. package/dist/infra-deploy.plugin.js +59 -0
  142. package/dist/infra-deploy.plugin.js.map +1 -0
  143. package/dist/regenerate.d.ts +55 -0
  144. package/dist/regenerate.d.ts.map +1 -0
  145. package/dist/regenerate.js +206 -0
  146. package/dist/regenerate.js.map +1 -0
  147. package/package.json +85 -0
  148. package/src/cli/alerts/infra-alerts-create.cli-command.descriptor.ts +61 -0
  149. package/src/cli/alerts/infra-alerts-create.cli-command.impl.ts +131 -0
  150. package/src/cli/alerts/infra-alerts-delete.cli-command.descriptor.ts +36 -0
  151. package/src/cli/alerts/infra-alerts-delete.cli-command.impl.ts +75 -0
  152. package/src/cli/alerts/infra-alerts-list.cli-command.descriptor.ts +27 -0
  153. package/src/cli/alerts/infra-alerts-list.cli-command.impl.ts +88 -0
  154. package/src/cli/alerts/infra-alerts.cli-group.descriptor.ts +12 -0
  155. package/src/cli/audit/infra-audit.cli-command.descriptor.ts +28 -0
  156. package/src/cli/audit/infra-audit.cli-command.impl.ts +293 -0
  157. package/src/cli/infra-deploy.cli-group.descriptor.ts +12 -0
  158. package/src/cli/infra.cli-group.descriptor.ts +11 -0
  159. package/src/cli/list/infra-deploy.list.cli-command.descriptor.ts +29 -0
  160. package/src/cli/list/infra-deploy.list.cli-command.impl.ts +125 -0
  161. package/src/cli/logs/infra-logs.cli-command.descriptor.ts +65 -0
  162. package/src/cli/logs/infra-logs.cli-command.impl.ts +354 -0
  163. package/src/cli/logs/stream-worker-tail.ts +202 -0
  164. package/src/cli/npm/infra-npm-publish.cli-command.descriptor.ts +75 -0
  165. package/src/cli/npm/infra-npm-publish.cli-command.impl.ts +474 -0
  166. package/src/cli/npm/infra-npm.cli-group.descriptor.ts +12 -0
  167. package/src/cli/observability/infra-observability-set.cli-command.descriptor.ts +57 -0
  168. package/src/cli/observability/infra-observability-set.cli-command.impl.ts +173 -0
  169. package/src/cli/observability/infra-observability-status.cli-command.descriptor.ts +35 -0
  170. package/src/cli/observability/infra-observability-status.cli-command.impl.ts +124 -0
  171. package/src/cli/observability/infra-observability.cli-group.descriptor.ts +12 -0
  172. package/src/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.ts +36 -0
  173. package/src/cli/regenerate/infra-deploy.regenerate.cli-command.impl.ts +103 -0
  174. package/src/cli/rum/infra-rum-status.cli-command.descriptor.ts +27 -0
  175. package/src/cli/rum/infra-rum-status.cli-command.impl.ts +112 -0
  176. package/src/cli/rum/infra-rum.cli-group.descriptor.ts +12 -0
  177. package/src/cli/run/infra-deploy.run.cli-command.descriptor.ts +49 -0
  178. package/src/cli/run/infra-deploy.run.cli-command.impl.ts +330 -0
  179. package/src/cli/shared/discover-deployments.ts +127 -0
  180. package/src/config-loader.ts +179 -0
  181. package/src/index.ts +11 -0
  182. package/src/infra-deploy.plugin.ts +83 -0
  183. package/src/regenerate.ts +230 -0
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Discover deployed apps in a workspace by scanning for `deployment.config.ts`
3
+ * files. Used by infra CLI commands that need the live inventory of deployed
4
+ * workers/sites without hardcoding app names in framework packages.
5
+ */
6
+ import { readdir, stat } from 'node:fs/promises';
7
+ import { join, isAbsolute, resolve } from 'node:path';
8
+ import { loadDeploymentConfig } from "../../config-loader.js";
9
+ const CONFIG_NAMES = new Set([
10
+ 'deployment.config.ts',
11
+ 'deployment.config.js',
12
+ 'deployment.config.mjs'
13
+ ]);
14
+ const IGNORED_DIRS = new Set([
15
+ 'node_modules',
16
+ '.git',
17
+ '.svelte-kit',
18
+ 'dist',
19
+ '.next',
20
+ '.turbo',
21
+ '.vite',
22
+ '.wrangler'
23
+ ]);
24
+ async function findConfigs(root, maxDepth) {
25
+ const found = [];
26
+ async function walk(dir, depth) {
27
+ if (depth > maxDepth)
28
+ return;
29
+ let entries;
30
+ try {
31
+ entries = await readdir(dir);
32
+ }
33
+ catch {
34
+ return;
35
+ }
36
+ for (const entry of entries) {
37
+ if (CONFIG_NAMES.has(entry))
38
+ found.push(join(dir, entry));
39
+ }
40
+ for (const entry of entries) {
41
+ if (IGNORED_DIRS.has(entry) || entry.startsWith('.'))
42
+ continue;
43
+ const full = join(dir, entry);
44
+ let info;
45
+ try {
46
+ info = await stat(full);
47
+ }
48
+ catch {
49
+ continue;
50
+ }
51
+ if (info.isDirectory())
52
+ await walk(full, depth + 1);
53
+ }
54
+ }
55
+ await walk(root, 0);
56
+ return found;
57
+ }
58
+ /**
59
+ * Scan `root` for every `deployment.config.ts` and return the loaded
60
+ * deployment descriptors. Configs that fail to load are skipped; pass
61
+ * `onError` to be notified about each failure (e.g. to render
62
+ * `(unparseable)` rows in the list command).
63
+ */
64
+ export async function discoverDeployments(opts = {}) {
65
+ const rootInput = opts.root ?? process.cwd();
66
+ const root = isAbsolute(rootInput) ? rootInput : resolve(process.cwd(), rootInput);
67
+ const maxDepth = opts.maxDepth ?? 4;
68
+ const configPaths = await findConfigs(root, maxDepth);
69
+ const results = [];
70
+ for (const configPath of configPaths) {
71
+ const appDir = configPath.replace(/\/deployment\.config\.(ts|js|mjs)$/, '');
72
+ try {
73
+ const loaded = await loadDeploymentConfig(appDir);
74
+ if (opts.provider && loaded.provider !== opts.provider)
75
+ continue;
76
+ results.push({
77
+ appId: loaded.deployment.appId,
78
+ appName: loaded.deployment.appName,
79
+ provider: loaded.provider,
80
+ appDir: loaded.appDir,
81
+ workerName: loaded.workerName,
82
+ dependsOn: loaded.deployment.dependsOn ?? []
83
+ });
84
+ }
85
+ catch (err) {
86
+ opts.onError?.({
87
+ configPath,
88
+ appDir,
89
+ error: err instanceof Error ? err : new Error(String(err))
90
+ });
91
+ }
92
+ }
93
+ return results;
94
+ }
95
+ //# sourceMappingURL=discover-deployments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-deployments.js","sourceRoot":"","sources":["../../../src/cli/shared/discover-deployments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC5B,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;CACvB,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC5B,cAAc;IACd,MAAM;IACN,aAAa;IACb,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,WAAW;CACX,CAAC,CAAC;AAgCH,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,QAAgB;IACxD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,UAAU,IAAI,CAAC,GAAW,EAAE,KAAa;QAC7C,IAAI,KAAK,GAAG,QAAQ;YAAE,OAAO;QAC7B,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACJ,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;QAAC,MAAM,CAAC;YACR,OAAO;QACR,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,CA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AU,CAAC,OAAO,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;QAC5E,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ;gBAAE,SAAS;YACjE,OAAO,CAAC,IAAI,CAAC;gBACZ,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK;gBAC9B,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO;gBAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,IAAI,EAAE;aAC5C,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,OAAO,EAAE,CAAC;gBACd,UAAU;gBACV,MAAM;gBACN,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAC1D,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { AppDeployment } from '@vibesdotdev/infra-core/deployment';
2
+ export interface LoadedDeployment {
3
+ configPath: string;
4
+ appDir: string;
5
+ deployment: AppDeployment;
6
+ provider: string;
7
+ raw: unknown;
8
+ /**
9
+ * Canonical wrangler.jsonc render output, when the default export is a
10
+ * managed Cloudflare web-app deployment (see
11
+ * `@vibesdotdev/infra-cloudflare/regen`). `null` when the export isn't
12
+ * a managed deployment — used by the regen orchestrator to gate writes
13
+ * and the CI drift check.
14
+ */
15
+ wranglerJsoncString: string | null;
16
+ /** Mirrors `webAppDeployment.managed`; `false` when not a managed export. */
17
+ managed: boolean;
18
+ /** Cloudflare Workers script name, when emitted by the managed export. */
19
+ workerName: string | null;
20
+ }
21
+ export declare function resolveAppDir(input: string): string;
22
+ export declare function findConfigFile(appDir: string): string;
23
+ export declare function loadDeploymentConfig(appDir: string): Promise<LoadedDeployment>;
24
+ //# sourceMappingURL=config-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,aAAa,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb;;;;;;OAMG;IACH,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,6EAA6E;IAC7E,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAID,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUnD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQrD;AAmHD,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAgBpF"}
@@ -0,0 +1,135 @@
1
+ import { resolve, isAbsolute, join, dirname } from 'node:path';
2
+ import { existsSync, statSync } from 'node:fs';
3
+ import { spawn } from 'node:child_process';
4
+ const CONFIG_FILENAMES = ['deployment.config.ts', 'deployment.config.js', 'deployment.config.mjs'];
5
+ export function resolveAppDir(input) {
6
+ const absolute = isAbsolute(input) ? input : resolve(process.cwd(), input);
7
+ if (!existsSync(absolute)) {
8
+ throw new Error(`Path does not exist: ${absolute}`);
9
+ }
10
+ const stat = statSync(absolute);
11
+ if (!stat.isDirectory()) {
12
+ throw new Error(`Expected directory, got file: ${absolute}`);
13
+ }
14
+ return absolute;
15
+ }
16
+ export function findConfigFile(appDir) {
17
+ for (const name of CONFIG_FILENAMES) {
18
+ const candidate = join(appDir, name);
19
+ if (existsSync(candidate))
20
+ return candidate;
21
+ }
22
+ throw new Error(`No deployment config found in ${appDir}. Expected one of: ${CONFIG_FILENAMES.join(', ')}`);
23
+ }
24
+ function extractDeployment(raw) {
25
+ if (!raw || typeof raw !== 'object') {
26
+ throw new Error('deployment.config default export must be an object');
27
+ }
28
+ const record = raw;
29
+ const deployment = (record.deployment ?? record);
30
+ if (!deployment || typeof deployment !== 'object' || !('appId' in deployment)) {
31
+ throw new Error('deployment.config must export an AppDeployment (or { deployment })');
32
+ }
33
+ const provider = deployment.provider;
34
+ if (!provider || typeof provider !== 'string') {
35
+ throw new Error('deployment.provider is required');
36
+ }
37
+ return { deployment: deployment, provider };
38
+ }
39
+ /**
40
+ * Walk upward from `from` looking for the workspace root (the directory
41
+ * with a `bun.lock` or `package.json` containing `workspaces`).
42
+ */
43
+ function findWorkspaceRoot(from) {
44
+ let dir = from;
45
+ while (dir !== dirname(dir)) {
46
+ if (existsSync(join(dir, 'bun.lock')))
47
+ return dir;
48
+ const pkgPath = join(dir, 'package.json');
49
+ if (existsSync(pkgPath)) {
50
+ try {
51
+ const pkg = JSON.parse(require('node:fs').readFileSync(pkgPath, 'utf8'));
52
+ if (pkg.workspaces)
53
+ return dir;
54
+ }
55
+ catch {
56
+ // not a parseable package.json; keep walking
57
+ }
58
+ }
59
+ dir = dirname(dir);
60
+ }
61
+ return from;
62
+ }
63
+ /**
64
+ * Load a deployment.config.ts via a `bun` subprocess from the workspace
65
+ * root. Direct `await import(configPath)` doesn't work when the compiled
66
+ * `vibes` binary runs against a workspace symlink — its bundled module
67
+ * resolver has no idea where `@vibesdotdev/infra-core` lives. Subprocess
68
+ * inherits the workspace's bun (path + node_modules), so workspace
69
+ * package imports resolve as if you ran `bun apps/<app>/deployment.config.ts`
70
+ * directly.
71
+ *
72
+ * The subprocess also tries to import `@vibesdotdev/infra-cloudflare/web-app`
73
+ * and call `renderWranglerJsoncFromDefaultExport(raw)` so the canonical
74
+ * wrangler.jsonc string is returned alongside the raw config. This lets
75
+ * the regen orchestrator stay agnostic of provider-specific rendering.
76
+ * If the import fails (SDK consumer without infra-cloudflare in their
77
+ * tree), the render block is reported as `{ managed: false, rendered: null }`.
78
+ */
79
+ async function loadConfigViaSubprocess(configPath, workspaceRoot) {
80
+ return new Promise((resolvePromise, reject) => {
81
+ const script = `
82
+ const mod = await import(${JSON.stringify(configPath)});
83
+ const raw = mod.default ?? mod;
84
+ let render = { managed: false, rendered: null, workerName: null };
85
+ try {
86
+ const cf = await import('@vibesdotdev/infra-cloudflare/web-app');
87
+ if (typeof cf.renderWranglerJsoncFromDefaultExport === 'function') {
88
+ render = cf.renderWranglerJsoncFromDefaultExport(raw);
89
+ }
90
+ } catch (_) {
91
+ // infra-cloudflare not resolvable; leave render as the default null block.
92
+ }
93
+ process.stdout.write(JSON.stringify({ raw, render }));
94
+ `;
95
+ const child = spawn('bun', ['--bun', '-e', script], {
96
+ cwd: workspaceRoot,
97
+ stdio: ['ignore', 'pipe', 'pipe']
98
+ });
99
+ let stdout = '';
100
+ let stderr = '';
101
+ child.stdout?.on('data', (chunk) => (stdout += String(chunk)));
102
+ child.stderr?.on('data', (chunk) => (stderr += String(chunk)));
103
+ child.on('error', reject);
104
+ child.on('close', (code) => {
105
+ if (code !== 0) {
106
+ reject(new Error(`bun subprocess exited with code ${code}\nstderr: ${stderr.trim()}\nstdout: ${stdout.trim()}`));
107
+ return;
108
+ }
109
+ try {
110
+ resolvePromise(JSON.parse(stdout));
111
+ }
112
+ catch (err) {
113
+ reject(new Error(`Failed to parse subprocess JSON output: ${err instanceof Error ? err.message : String(err)}\nstdout: ${stdout.slice(0, 500)}`));
114
+ }
115
+ });
116
+ });
117
+ }
118
+ export async function loadDeploymentConfig(appDir) {
119
+ const dir = resolveAppDir(appDir);
120
+ const configPath = findConfigFile(dir);
121
+ const workspaceRoot = findWorkspaceRoot(dir);
122
+ const output = await loadConfigViaSubprocess(configPath, workspaceRoot);
123
+ const { deployment, provider } = extractDeployment(output.raw);
124
+ return {
125
+ configPath,
126
+ appDir: dir,
127
+ deployment,
128
+ provider,
129
+ raw: output.raw,
130
+ wranglerJsoncString: output.render.rendered,
131
+ managed: output.render.managed,
132
+ workerName: output.render.workerName
133
+ };
134
+ }
135
+ //# sourceMappingURL=config-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAuB3C,MAAM,gBAAgB,GAAG,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,uBAAuB,CAAC,CAAC;AAEnG,MAAM,UAAU,aAAa,CAAC,KAAa;IAC1C,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;IAC3E,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,iCAAiC,QAAQ,EAAE,CAAC,CA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BAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/D,OAAO;QACN,UAAU;QACV,MAAM,EAAE,GAAG;QACX,UAAU;QACV,QAAQ;QACR,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ;QAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO;QAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;KACpC,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { default as infraDeployPlugin } from './infra-deploy.plugin';
2
+ export { loadDeploymentConfig } from './config-loader.ts';
3
+ export type { LoadedDeployment } from './config-loader.ts';
4
+ export { regenerateApp, regenerateAll, regenExitCode, type RegenResult, type RegenStatus, type RegenerateOptions } from './regenerate.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACN,aAAa,EACb,aAAa,EACb,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { default as infraDeployPlugin } from './infra-deploy.plugin.js';
2
+ export { loadDeploymentConfig } from "./config-loader.js";
3
+ export { regenerateApp, regenerateAll, regenExitCode } from "./regenerate.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EACN,aAAa,EACb,aAAa,EACb,aAAa,EAIb,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("@vibesdotdev/runtime").RuntimePlugin;
2
+ export default _default;
3
+ //# sourceMappingURL=infra-deploy.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infra-deploy.plugin.d.ts","sourceRoot":"","sources":["../src/infra-deploy.plugin.ts"],"names":[],"mappings":";AAqBA,wBA6DG"}
@@ -0,0 +1,59 @@
1
+ import { createRuntimePlugin, loader } from '@vibesdotdev/runtime';
2
+ import infraGroup from "./cli/infra.cli-group.descriptor.js";
3
+ import infraDeployGroup from "./cli/infra-deploy.cli-group.descriptor.js";
4
+ import infraDeployRun from "./cli/run/infra-deploy.run.cli-command.descriptor.js";
5
+ import infraDeployList from "./cli/list/infra-deploy.list.cli-command.descriptor.js";
6
+ import infraDeployRegenerate from "./cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.js";
7
+ import infraLogs from "./cli/logs/infra-logs.cli-command.descriptor.js";
8
+ import infraNpmGroup from "./cli/npm/infra-npm.cli-group.descriptor.js";
9
+ import infraNpmPublish from "./cli/npm/infra-npm-publish.cli-command.descriptor.js";
10
+ import infraAlertsGroup from "./cli/alerts/infra-alerts.cli-group.descriptor.js";
11
+ import infraAlertsList from "./cli/alerts/infra-alerts-list.cli-command.descriptor.js";
12
+ import infraAlertsCreate from "./cli/alerts/infra-alerts-create.cli-command.descriptor.js";
13
+ import infraAlertsDelete from "./cli/alerts/infra-alerts-delete.cli-command.descriptor.js";
14
+ import infraAudit from "./cli/audit/infra-audit.cli-command.descriptor.js";
15
+ import infraObservabilityGroup from "./cli/observability/infra-observability.cli-group.descriptor.js";
16
+ import infraObservabilityStatus from "./cli/observability/infra-observability-status.cli-command.descriptor.js";
17
+ import infraObservabilitySet from "./cli/observability/infra-observability-set.cli-command.descriptor.js";
18
+ import infraRumGroup from "./cli/rum/infra-rum.cli-group.descriptor.js";
19
+ import infraRumStatus from "./cli/rum/infra-rum-status.cli-command.descriptor.js";
20
+ export default createRuntimePlugin({
21
+ id: 'infra-deploy',
22
+ name: 'Infra Deploy',
23
+ description: 'Build and deploy apps declared in deployment.config.ts',
24
+ descriptors: [
25
+ infraGroup,
26
+ infraDeployGroup,
27
+ infraDeployRun,
28
+ infraDeployList,
29
+ infraDeployRegenerate,
30
+ infraLogs,
31
+ infraNpmGroup,
32
+ infraNpmPublish,
33
+ infraAlertsGroup,
34
+ infraAlertsList,
35
+ infraAlertsCreate,
36
+ infraAlertsDelete,
37
+ infraAudit,
38
+ infraObservabilityGroup,
39
+ infraObservabilityStatus,
40
+ infraObservabilitySet,
41
+ infraRumGroup,
42
+ infraRumStatus
43
+ ],
44
+ loaders: [
45
+ loader('infra-deploy.run', () => import('./cli/run/infra-deploy.run.cli-command.impl.ts')),
46
+ loader('infra-deploy.list', () => import('./cli/list/infra-deploy.list.cli-command.impl.ts')),
47
+ loader('infra-deploy.regenerate', () => import('./cli/regenerate/infra-deploy.regenerate.cli-command.impl.ts')),
48
+ loader('infra-logs', () => import('./cli/logs/infra-logs.cli-command.impl.ts')),
49
+ loader('infra-npm.publish', () => import('./cli/npm/infra-npm-publish.cli-command.impl.ts')),
50
+ loader('infra-alerts.list', () => import('./cli/alerts/infra-alerts-list.cli-command.impl.ts')),
51
+ loader('infra-alerts.create', () => import('./cli/alerts/infra-alerts-create.cli-command.impl.ts')),
52
+ loader('infra-alerts.delete', () => import('./cli/alerts/infra-alerts-delete.cli-command.impl.ts')),
53
+ loader('infra-audit', () => import('./cli/audit/infra-audit.cli-command.impl.ts')),
54
+ loader('infra-observability.status', () => import('./cli/observability/infra-observability-status.cli-command.impl.ts')),
55
+ loader('infra-observability.set', () => import('./cli/observability/infra-observability-set.cli-command.impl.ts')),
56
+ loader('infra-rum.status', () => import('./cli/rum/infra-rum-status.cli-command.impl.ts'))
57
+ ]
58
+ });
59
+ //# sourceMappingURL=infra-deploy.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infra-deploy.plugin.js","sourceRoot":"","sources":["../src/infra-deploy.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,UAAU,MAAM,qCAAqC,CAAC;AAC7D,OAAO,gBAAgB,MAAM,4CAA4C,CAAC;AAC1E,OAAO,cAAc,MAAM,sDAAsD,CAAC;AAClF,OAAO,eAAe,MAAM,wDAAwD,CAAC;AACrF,OAAO,qBAAqB,MAAM,oEAAoE,CAAC;AACvG,OAAO,SAAS,MAAM,iDAAiD,CAAC;AACxE,OAAO,aAAa,MAAM,6CAA6C,CAAC;AACxE,OAAO,eAAe,MAAM,uDAAuD,CAAC;AACpF,OAAO,gBAAgB,MAAM,mDAAmD,CAAC;AACjF,OAAO,eAAe,MAAM,0DAA0D,CAAC;AACvF,OAAO,iBAAiB,MAAM,4DAA4D,CAAC;AAC3F,OAAO,iBAAiB,MAAM,4DAA4D,CAAC;AAC3F,OAAO,UAAU,MAAM,mDAAmD,CAAC;AAC3E,OAAO,uBAAuB,MAAM,iEAAiE,CAAC;AACtG,OAAO,wBAAwB,MAAM,0EAA0E,CAAC;AAChH,OAAO,qBAAqB,MAAM,uEAAuE,CAAC;AAC1G,OAAO,aAAa,MAAM,6CAA6C,CAAC;AACxE,OAAO,cAAc,MAAM,sDAAsD,CAAC;AAElF,eAAe,mBAAmB,CAAC;IAClC,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,wDAAwD;IAErE,WAAW,EAAE;QACZ,UAAU;QACV,gBAAgB;QAChB,cAAc;QACd,eAAe;QACf,qBAAqB;QACrB,SAAS;QACT,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,eAAe;QACf,iBAAiB;QACjB,iBAAiB;QACjB,UAAU;QACV,uBAAuB;QACvB,wBAAwB;QACxB,qBAAqB;QACrB,aAAa;QACb,cAAc;KACd;IAED,OAAO,EAAE;QACR,MAAM,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC;QAC1F,MAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,kDAAkD,CAAC,CAAC;QAC7F,MAAM,CACL,yBAAyB,EACzB,GAAG,EAAE,CAAC,MAAM,CAAC,8DAA8D,CAAC,CAC5E;QACD,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,2CAA2C,CAAC,CAAC;QAC/E,MAAM,CACL,mBAAmB,EACnB,GAAG,EAAE,CAAC,MAAM,CAAC,iDAAiD,CAAC,CAC/D;QACD,MAAM,CACL,mBAAmB,EACnB,GAAG,EAAE,CAAC,MAAM,CAAC,oDAAoD,CAAC,CAClE;QACD,MAAM,CACL,qBAAqB,EACrB,GAAG,EAAE,CAAC,MAAM,CAAC,sDAAsD,CAAC,CACpE;QACD,MAAM,CACL,qBAAqB,EACrB,GAAG,EAAE,CAAC,MAAM,CAAC,sDAAsD,CAAC,CACpE;QACD,MAAM,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAC;QAClF,MAAM,CACL,4BAA4B,EAC5B,GAAG,EAAE,CAAC,MAAM,CAAC,oEAAoE,CAAC,CAClF;QACD,MAAM,CACL,yBAAyB,EACzB,GAAG,EAAE,CAAC,MAAM,CAAC,iEAAiE,CAAC,CAC/E;QACD,MAAM,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC;KAC1F;CACD,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * wrangler.jsonc regeneration orchestrator.
3
+ *
4
+ * Reads an app's `deployment.config.ts` (via the config-loader subprocess,
5
+ * which surfaces the canonical wrangler.jsonc string from
6
+ * `@vibesdotdev/infra-cloudflare/regen` when the export is a managed
7
+ * web-app deployment), compares it against the on-disk `wrangler.jsonc`,
8
+ * and either reports drift or rewrites the file.
9
+ *
10
+ * Two modes:
11
+ * - `check` — read-only; returns `'drift'` when the on-disk file
12
+ * doesn't match the rendered string. Used by CI and pre-deploy gates.
13
+ * - `write` — overwrites the on-disk file with the rendered string.
14
+ * Used during local development after editing `deployment.config.ts`.
15
+ *
16
+ * Apps that haven't opted in via `managed: true` are reported as
17
+ * `'skipped'` — neither check nor write happens. Once every app is on
18
+ * the regen pipeline, the `managed` flag can be defaulted true and the
19
+ * skipped path removed.
20
+ *
21
+ * Provider dispatch is implicit: only Cloudflare web-app deployments
22
+ * currently surface a `wranglerJsoncString`. Other providers (DO App
23
+ * Spec) skip regen by construction.
24
+ */
25
+ export type RegenStatus = 'unchanged' | 'updated' | 'drift' | 'skipped' | 'error';
26
+ export interface RegenResult {
27
+ appId: string;
28
+ appDir: string;
29
+ wranglerJsoncPath: string;
30
+ status: RegenStatus;
31
+ /** Workers script name, when known. */
32
+ workerName?: string;
33
+ /** Reason text for 'skipped' (e.g., "not managed") or 'error'. */
34
+ reason?: string;
35
+ /** Unified diff snippet on `drift`. Truncated to ~120 lines. */
36
+ diff?: string;
37
+ }
38
+ export interface RegenerateOptions {
39
+ /** `check`: read-only drift detection. `write`: rewrite on drift. */
40
+ mode: 'check' | 'write';
41
+ }
42
+ /**
43
+ * Regenerate (or check) a single app's wrangler.jsonc. The caller
44
+ * passes the app directory containing `deployment.config.ts`.
45
+ */
46
+ export declare function regenerateApp(appDir: string, options: RegenerateOptions): Promise<RegenResult>;
47
+ /**
48
+ * Regenerate (or check) every `deployment.config.ts` under `root`.
49
+ * Non-managed deployments report `'skipped'`; the caller decides
50
+ * whether to treat skips as failure (typically: no).
51
+ */
52
+ export declare function regenerateAll(root: string, options: RegenerateOptions): Promise<RegenResult[]>;
53
+ /** Exit code logic for CLI / CI use. */
54
+ export declare function regenExitCode(results: RegenResult[], mode: 'check' | 'write'): number;
55
+ //# sourceMappingURL=regenerate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regenerate.d.ts","sourceRoot":"","sources":["../src/regenerate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAElF,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IACjC,qEAAqE;IACrE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;CACxB;AAkFD;;;GAGG;AACH,wBAAsB,aAAa,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAkEtB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,EAAE,CAAC,CAQxB;AAED,wCAAwC;AACxC,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAMrF"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * wrangler.jsonc regeneration orchestrator.
3
+ *
4
+ * Reads an app's `deployment.config.ts` (via the config-loader subprocess,
5
+ * which surfaces the canonical wrangler.jsonc string from
6
+ * `@vibesdotdev/infra-cloudflare/regen` when the export is a managed
7
+ * web-app deployment), compares it against the on-disk `wrangler.jsonc`,
8
+ * and either reports drift or rewrites the file.
9
+ *
10
+ * Two modes:
11
+ * - `check` — read-only; returns `'drift'` when the on-disk file
12
+ * doesn't match the rendered string. Used by CI and pre-deploy gates.
13
+ * - `write` — overwrites the on-disk file with the rendered string.
14
+ * Used during local development after editing `deployment.config.ts`.
15
+ *
16
+ * Apps that haven't opted in via `managed: true` are reported as
17
+ * `'skipped'` — neither check nor write happens. Once every app is on
18
+ * the regen pipeline, the `managed` flag can be defaulted true and the
19
+ * skipped path removed.
20
+ *
21
+ * Provider dispatch is implicit: only Cloudflare web-app deployments
22
+ * currently surface a `wranglerJsoncString`. Other providers (DO App
23
+ * Spec) skip regen by construction.
24
+ */
25
+ import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
26
+ import { join, relative, resolve } from 'node:path';
27
+ import { loadDeploymentConfig } from "./config-loader.js";
28
+ const CONFIG_FILENAMES = new Set([
29
+ 'deployment.config.ts',
30
+ 'deployment.config.js',
31
+ 'deployment.config.mjs'
32
+ ]);
33
+ const IGNORED_DIRS = new Set([
34
+ 'node_modules',
35
+ '.git',
36
+ '.svelte-kit',
37
+ 'dist',
38
+ '.next',
39
+ '.turbo',
40
+ '.vite',
41
+ '.wrangler'
42
+ ]);
43
+ /**
44
+ * Recursive discovery for `deployment.config.ts` under `root`. Mirrors
45
+ * the `infra deploy list` walker (kept private here to avoid a circular
46
+ * dep through the CLI command). Synchronous because the orchestrator
47
+ * is called from short-lived processes (deploy hooks + CLI).
48
+ */
49
+ function findDeploymentConfigs(root, maxDepth = 4) {
50
+ const found = [];
51
+ function walk(dir, depth) {
52
+ if (depth > maxDepth)
53
+ return;
54
+ let entries;
55
+ try {
56
+ entries = readdirSync(dir);
57
+ }
58
+ catch {
59
+ return;
60
+ }
61
+ for (const entry of entries) {
62
+ if (CONFIG_FILENAMES.has(entry)) {
63
+ found.push(join(dir, entry));
64
+ }
65
+ }
66
+ for (const entry of entries) {
67
+ if (IGNORED_DIRS.has(entry) || entry.startsWith('.'))
68
+ continue;
69
+ const full = join(dir, entry);
70
+ let info;
71
+ try {
72
+ info = statSync(full);
73
+ }
74
+ catch {
75
+ continue;
76
+ }
77
+ if (info.isDirectory())
78
+ walk(full, depth + 1);
79
+ }
80
+ }
81
+ walk(root, 0);
82
+ return found;
83
+ }
84
+ function unifiedDiffSnippet(existing, rendered, contextLines = 3) {
85
+ // Compact line-by-line diff. Not a full unified-diff (no @@ hunks),
86
+ // just enough for a human to spot the drift in a CI log without
87
+ // pulling in a diff library. Caps total output at ~120 lines.
88
+ const a = existing.split('\n');
89
+ const b = rendered.split('\n');
90
+ const max = Math.max(a.length, b.length);
91
+ const lines = [];
92
+ let lastShown = -contextLines - 1;
93
+ for (let i = 0; i < max; i++) {
94
+ const left = a[i];
95
+ const right = b[i];
96
+ if (left === right)
97
+ continue;
98
+ // Backfill context above first change.
99
+ for (let j = Math.max(lastShown + 1, i - contextLines); j < i; j++) {
100
+ if (lines.length >= 120)
101
+ break;
102
+ lines.push(` ${a[j] ?? ''}`);
103
+ }
104
+ if (lines.length >= 120)
105
+ break;
106
+ if (left !== undefined)
107
+ lines.push(`- ${left}`);
108
+ if (right !== undefined)
109
+ lines.push(`+ ${right}`);
110
+ lastShown = i;
111
+ }
112
+ if (lines.length === 0)
113
+ return '';
114
+ return lines.join('\n');
115
+ }
116
+ /**
117
+ * Regenerate (or check) a single app's wrangler.jsonc. The caller
118
+ * passes the app directory containing `deployment.config.ts`.
119
+ */
120
+ export async function regenerateApp(appDir, options) {
121
+ const absoluteAppDir = resolve(appDir);
122
+ const wranglerJsoncPath = join(absoluteAppDir, 'wrangler.jsonc');
123
+ let loaded;
124
+ try {
125
+ loaded = await loadDeploymentConfig(absoluteAppDir);
126
+ }
127
+ catch (err) {
128
+ return {
129
+ appId: relative(process.cwd(), absoluteAppDir) || '.',
130
+ appDir: absoluteAppDir,
131
+ wranglerJsoncPath,
132
+ status: 'error',
133
+ reason: `Failed to load deployment.config: ${err.message}`
134
+ };
135
+ }
136
+ const appId = loaded.deployment.appId;
137
+ const workerName = loaded.workerName ?? undefined;
138
+ if (!loaded.managed || loaded.wranglerJsoncString === null) {
139
+ return {
140
+ appId,
141
+ appDir: absoluteAppDir,
142
+ wranglerJsoncPath,
143
+ status: 'skipped',
144
+ workerName,
145
+ reason: loaded.managed
146
+ ? 'deployment is not a managed Cloudflare web-app'
147
+ : 'deployment.config.ts does not opt in via managed: true'
148
+ };
149
+ }
150
+ const rendered = loaded.wranglerJsoncString;
151
+ const existing = existsSync(wranglerJsoncPath)
152
+ ? readFileSync(wranglerJsoncPath, 'utf-8')
153
+ : null;
154
+ if (existing === rendered) {
155
+ return {
156
+ appId,
157
+ appDir: absoluteAppDir,
158
+ wranglerJsoncPath,
159
+ status: 'unchanged',
160
+ workerName
161
+ };
162
+ }
163
+ if (options.mode === 'check') {
164
+ return {
165
+ appId,
166
+ appDir: absoluteAppDir,
167
+ wranglerJsoncPath,
168
+ status: 'drift',
169
+ workerName,
170
+ diff: existing === null ? '(no existing wrangler.jsonc)' : unifiedDiffSnippet(existing, rendered)
171
+ };
172
+ }
173
+ writeFileSync(wranglerJsoncPath, rendered, 'utf-8');
174
+ return {
175
+ appId,
176
+ appDir: absoluteAppDir,
177
+ wranglerJsoncPath,
178
+ status: 'updated',
179
+ workerName
180
+ };
181
+ }
182
+ /**
183
+ * Regenerate (or check) every `deployment.config.ts` under `root`.
184
+ * Non-managed deployments report `'skipped'`; the caller decides
185
+ * whether to treat skips as failure (typically: no).
186
+ */
187
+ export async function regenerateAll(root, options) {
188
+ const configPaths = findDeploymentConfigs(resolve(root));
189
+ const results = [];
190
+ for (const configPath of configPaths) {
191
+ const appDir = configPath.replace(/\/deployment\.config\.(ts|js|mjs)$/, '');
192
+ results.push(await regenerateApp(appDir, options));
193
+ }
194
+ return results;
195
+ }
196
+ /** Exit code logic for CLI / CI use. */
197
+ export function regenExitCode(results, mode) {
198
+ for (const r of results) {
199
+ if (r.status === 'error')
200
+ return 1;
201
+ if (mode === 'check' && r.status === 'drift')
202
+ return 1;
203
+ }
204
+ return 0;
205
+ }
206
+ //# sourceMappingURL=regenerate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regenerate.js","sourceRoot":"","sources":["../src/regenerate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAsB1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAChC,sBAAsB;IACtB,sBAAsB;IACtB,uBAAuB;CACvB,CAAC,CAAC;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC5B,cAAc;IACd,MAAM;IACN,aAAa;IACb,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,WAAW;CACX,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,IAAY,EAAE,QAAQ,GAAG,CAAC;IACxD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,SAAS,IAAI,CAAC,GAAW,EAAE,KAAa;QACvC,IAAI,KAAK,GAAG,QAAQ;YAAE,OAAO;QAC7B,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACJ,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACR,OAAO;QACR,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CA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