@vibesdotdev/infra-core 0.0.1 → 1.0.0-rc.4

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 (320) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +33 -63
  3. package/dist/bootstrap/seed.descriptor.d.ts +1 -1
  4. package/dist/bootstrap/seed.descriptor.d.ts.map +1 -1
  5. package/dist/bootstrap/seed.descriptor.js +1 -1
  6. package/dist/bootstrap/seed.descriptor.js.map +1 -1
  7. package/dist/bootstrap/seed.impl-shape.d.ts +1 -1
  8. package/dist/bootstrap/seed.impl-shape.d.ts.map +1 -1
  9. package/dist/bootstrap/seed.kind.d.ts +1 -3
  10. package/dist/bootstrap/seed.kind.d.ts.map +1 -1
  11. package/dist/bootstrap/seed.kind.js +17 -4
  12. package/dist/bootstrap/seed.kind.js.map +1 -1
  13. package/dist/bootstrap/seed.runner.d.ts +9 -2
  14. package/dist/bootstrap/seed.runner.d.ts.map +1 -1
  15. package/dist/bootstrap/seed.runner.js +37 -18
  16. package/dist/bootstrap/seed.runner.js.map +1 -1
  17. package/dist/capped-id.d.ts +19 -0
  18. package/dist/capped-id.d.ts.map +1 -0
  19. package/dist/capped-id.js +64 -0
  20. package/dist/capped-id.js.map +1 -0
  21. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts +23 -0
  22. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.d.ts.map +1 -0
  23. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js +33 -0
  24. package/dist/cli/generate/artifact/artifact.cli-command.descriptor.js.map +1 -0
  25. package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts +24 -0
  26. package/dist/cli/generate/artifact/artifact.cli-command.impl.d.ts.map +1 -0
  27. package/dist/cli/generate/artifact/artifact.cli-command.impl.js +73 -0
  28. package/dist/cli/generate/artifact/artifact.cli-command.impl.js.map +1 -0
  29. package/dist/cli/generate/context.d.ts +17 -0
  30. package/dist/cli/generate/context.d.ts.map +1 -0
  31. package/dist/cli/generate/context.js +24 -0
  32. package/dist/cli/generate/context.js.map +1 -0
  33. package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts +30 -0
  34. package/dist/cli/generate/generate/generate.cli-command.descriptor.d.ts.map +1 -0
  35. package/dist/cli/generate/generate/generate.cli-command.descriptor.js +25 -0
  36. package/dist/cli/generate/generate/generate.cli-command.descriptor.js.map +1 -0
  37. package/dist/cli/generate/generate/generate.cli-command.impl.d.ts +25 -0
  38. package/dist/cli/generate/generate/generate.cli-command.impl.d.ts.map +1 -0
  39. package/dist/cli/generate/generate/generate.cli-command.impl.js +64 -0
  40. package/dist/cli/generate/generate/generate.cli-command.impl.js.map +1 -0
  41. package/dist/cli/generate/generate-core.d.ts +51 -0
  42. package/dist/cli/generate/generate-core.d.ts.map +1 -0
  43. package/dist/cli/generate/generate-core.js +172 -0
  44. package/dist/cli/generate/generate-core.js.map +1 -0
  45. package/dist/cli/generate/index.d.ts +5 -0
  46. package/dist/cli/generate/index.d.ts.map +1 -0
  47. package/dist/cli/generate/index.js +5 -0
  48. package/dist/cli/generate/index.js.map +1 -0
  49. package/dist/credentials/resolve.d.ts +82 -22
  50. package/dist/credentials/resolve.d.ts.map +1 -1
  51. package/dist/credentials/resolve.js +251 -77
  52. package/dist/credentials/resolve.js.map +1 -1
  53. package/dist/deployment-environment.d.ts +30 -0
  54. package/dist/deployment-environment.d.ts.map +1 -0
  55. package/dist/deployment-environment.js +53 -0
  56. package/dist/deployment-environment.js.map +1 -0
  57. package/dist/deployment.d.ts +8 -4
  58. package/dist/deployment.d.ts.map +1 -1
  59. package/dist/deployment.js +30 -0
  60. package/dist/deployment.js.map +1 -1
  61. package/dist/doks/cloud/base.d.ts +49 -0
  62. package/dist/doks/cloud/base.d.ts.map +1 -0
  63. package/dist/doks/cloud/base.js +138 -0
  64. package/dist/doks/cloud/base.js.map +1 -0
  65. package/dist/doks/cloud/factory.d.ts +18 -0
  66. package/dist/doks/cloud/factory.d.ts.map +1 -0
  67. package/dist/doks/cloud/factory.js +22 -0
  68. package/dist/doks/cloud/factory.js.map +1 -0
  69. package/dist/doks/cloud/index.d.ts +5 -0
  70. package/dist/doks/cloud/index.d.ts.map +1 -0
  71. package/dist/doks/cloud/index.js +4 -0
  72. package/dist/doks/cloud/index.js.map +1 -0
  73. package/dist/doks/types.d.ts +95 -0
  74. package/dist/doks/types.d.ts.map +1 -0
  75. package/dist/doks/types.js +14 -0
  76. package/dist/doks/types.js.map +1 -0
  77. package/dist/generate/index.d.ts +29 -0
  78. package/dist/generate/index.d.ts.map +1 -0
  79. package/dist/generate/index.js +28 -0
  80. package/dist/generate/index.js.map +1 -0
  81. package/dist/generate/infra-generate.plugin.d.ts +3 -0
  82. package/dist/generate/infra-generate.plugin.d.ts.map +1 -0
  83. package/dist/generate/infra-generate.plugin.js +23 -0
  84. package/dist/generate/infra-generate.plugin.js.map +1 -0
  85. package/dist/generate/plugin.d.ts +2 -0
  86. package/dist/generate/plugin.d.ts.map +1 -0
  87. package/dist/generate/plugin.js +2 -0
  88. package/dist/generate/plugin.js.map +1 -0
  89. package/dist/heartbeat/cron-heartbeat.d.ts +97 -0
  90. package/dist/heartbeat/cron-heartbeat.d.ts.map +1 -0
  91. package/dist/heartbeat/cron-heartbeat.js +200 -0
  92. package/dist/heartbeat/cron-heartbeat.js.map +1 -0
  93. package/dist/index.d.ts +34 -20
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +28 -14
  96. package/dist/index.js.map +1 -1
  97. package/dist/infra.plugin.d.ts +1 -1
  98. package/dist/infra.plugin.d.ts.map +1 -1
  99. package/dist/infra.plugin.js +62 -12
  100. package/dist/infra.plugin.js.map +1 -1
  101. package/dist/kinds/alerts.kind.d.ts +64 -25
  102. package/dist/kinds/alerts.kind.d.ts.map +1 -1
  103. package/dist/kinds/alerts.kind.js +43 -16
  104. package/dist/kinds/alerts.kind.js.map +1 -1
  105. package/dist/kinds/artifact.kind.d.ts +58 -10
  106. package/dist/kinds/artifact.kind.d.ts.map +1 -1
  107. package/dist/kinds/artifact.kind.js +26 -9
  108. package/dist/kinds/artifact.kind.js.map +1 -1
  109. package/dist/kinds/billing.kind.d.ts +88 -0
  110. package/dist/kinds/billing.kind.d.ts.map +1 -0
  111. package/dist/kinds/billing.kind.js +48 -0
  112. package/dist/kinds/billing.kind.js.map +1 -0
  113. package/dist/kinds/build-job.kind.d.ts +381 -0
  114. package/dist/kinds/build-job.kind.d.ts.map +1 -0
  115. package/dist/kinds/build-job.kind.js +216 -0
  116. package/dist/kinds/build-job.kind.js.map +1 -0
  117. package/dist/kinds/cache.kind.d.ts +39 -92
  118. package/dist/kinds/cache.kind.d.ts.map +1 -1
  119. package/dist/kinds/cache.kind.js +26 -51
  120. package/dist/kinds/cache.kind.js.map +1 -1
  121. package/dist/kinds/cluster.kind.d.ts +154 -0
  122. package/dist/kinds/cluster.kind.d.ts.map +1 -0
  123. package/dist/kinds/cluster.kind.js +99 -0
  124. package/dist/kinds/cluster.kind.js.map +1 -0
  125. package/dist/kinds/compute-source.kind.d.ts +138 -0
  126. package/dist/kinds/compute-source.kind.d.ts.map +1 -0
  127. package/dist/kinds/compute-source.kind.js +145 -0
  128. package/dist/kinds/compute-source.kind.js.map +1 -0
  129. package/dist/kinds/compute-sources.descriptors.d.ts +45 -0
  130. package/dist/kinds/compute-sources.descriptors.d.ts.map +1 -0
  131. package/dist/kinds/compute-sources.descriptors.js +93 -0
  132. package/dist/kinds/compute-sources.descriptors.js.map +1 -0
  133. package/dist/kinds/container-registry.kind.d.ts +62 -0
  134. package/dist/kinds/container-registry.kind.d.ts.map +1 -0
  135. package/dist/kinds/container-registry.kind.js +47 -0
  136. package/dist/kinds/container-registry.kind.js.map +1 -0
  137. package/dist/kinds/database-migrator.kind.d.ts +6 -0
  138. package/dist/kinds/database-migrator.kind.d.ts.map +1 -0
  139. package/dist/kinds/database-migrator.kind.js +28 -0
  140. package/dist/kinds/database-migrator.kind.js.map +1 -0
  141. package/dist/kinds/database.kind.d.ts +114 -93
  142. package/dist/kinds/database.kind.d.ts.map +1 -1
  143. package/dist/kinds/database.kind.js +93 -54
  144. package/dist/kinds/database.kind.js.map +1 -1
  145. package/dist/kinds/deployment-provider.kind.d.ts +5 -0
  146. package/dist/kinds/deployment-provider.kind.d.ts.map +1 -0
  147. package/dist/kinds/deployment-provider.kind.js +11 -0
  148. package/dist/kinds/deployment-provider.kind.js.map +1 -0
  149. package/dist/kinds/discovery.d.ts +5 -12
  150. package/dist/kinds/discovery.d.ts.map +1 -1
  151. package/dist/kinds/discovery.js +5 -17
  152. package/dist/kinds/discovery.js.map +1 -1
  153. package/dist/kinds/dns.kind.d.ts +162 -0
  154. package/dist/kinds/dns.kind.d.ts.map +1 -0
  155. package/dist/kinds/dns.kind.js +54 -0
  156. package/dist/kinds/dns.kind.js.map +1 -0
  157. package/dist/kinds/drift.kind.d.ts +115 -0
  158. package/dist/kinds/drift.kind.d.ts.map +1 -0
  159. package/dist/kinds/drift.kind.js +60 -0
  160. package/dist/kinds/drift.kind.js.map +1 -0
  161. package/dist/kinds/edge-tls.kind.d.ts +194 -0
  162. package/dist/kinds/edge-tls.kind.d.ts.map +1 -0
  163. package/dist/kinds/edge-tls.kind.js +58 -0
  164. package/dist/kinds/edge-tls.kind.js.map +1 -0
  165. package/dist/kinds/firewall.kind.d.ts +92 -0
  166. package/dist/kinds/firewall.kind.d.ts.map +1 -0
  167. package/dist/kinds/firewall.kind.js +59 -0
  168. package/dist/kinds/firewall.kind.js.map +1 -0
  169. package/dist/kinds/git-hosting.kind.d.ts +36 -38
  170. package/dist/kinds/git-hosting.kind.d.ts.map +1 -1
  171. package/dist/kinds/git-hosting.kind.js +23 -34
  172. package/dist/kinds/git-hosting.kind.js.map +1 -1
  173. package/dist/kinds/index.d.ts +40 -15
  174. package/dist/kinds/index.d.ts.map +1 -1
  175. package/dist/kinds/index.js +39 -14
  176. package/dist/kinds/index.js.map +1 -1
  177. package/dist/kinds/inventory.kind.d.ts +326 -0
  178. package/dist/kinds/inventory.kind.d.ts.map +1 -0
  179. package/dist/kinds/inventory.kind.js +188 -0
  180. package/dist/kinds/inventory.kind.js.map +1 -0
  181. package/dist/kinds/load-balancer.kind.d.ts +135 -0
  182. package/dist/kinds/load-balancer.kind.d.ts.map +1 -0
  183. package/dist/kinds/load-balancer.kind.js +71 -0
  184. package/dist/kinds/load-balancer.kind.js.map +1 -0
  185. package/dist/kinds/logs.kind.d.ts +74 -3
  186. package/dist/kinds/logs.kind.d.ts.map +1 -1
  187. package/dist/kinds/logs.kind.js +26 -17
  188. package/dist/kinds/logs.kind.js.map +1 -1
  189. package/dist/kinds/nfs.kind.d.ts +67 -0
  190. package/dist/kinds/nfs.kind.d.ts.map +1 -0
  191. package/dist/kinds/nfs.kind.js +45 -0
  192. package/dist/kinds/nfs.kind.js.map +1 -0
  193. package/dist/kinds/node-pool.kind.d.ts +134 -0
  194. package/dist/kinds/node-pool.kind.d.ts.map +1 -0
  195. package/dist/kinds/node-pool.kind.js +88 -0
  196. package/dist/kinds/node-pool.kind.js.map +1 -0
  197. package/dist/kinds/object-storage.kind.d.ts +50 -24
  198. package/dist/kinds/object-storage.kind.d.ts.map +1 -1
  199. package/dist/kinds/object-storage.kind.js +40 -23
  200. package/dist/kinds/object-storage.kind.js.map +1 -1
  201. package/dist/kinds/observability.kind.d.ts +104 -6
  202. package/dist/kinds/observability.kind.d.ts.map +1 -1
  203. package/dist/kinds/observability.kind.js +67 -9
  204. package/dist/kinds/observability.kind.js.map +1 -1
  205. package/dist/kinds/package-registry.kind.d.ts +27 -31
  206. package/dist/kinds/package-registry.kind.d.ts.map +1 -1
  207. package/dist/kinds/package-registry.kind.js +13 -26
  208. package/dist/kinds/package-registry.kind.js.map +1 -1
  209. package/dist/kinds/queue.kind.d.ts +67 -63
  210. package/dist/kinds/queue.kind.d.ts.map +1 -1
  211. package/dist/kinds/queue.kind.js +55 -33
  212. package/dist/kinds/queue.kind.js.map +1 -1
  213. package/dist/kinds/read-descriptor.d.ts +15 -0
  214. package/dist/kinds/read-descriptor.d.ts.map +1 -0
  215. package/dist/kinds/read-descriptor.js +11 -0
  216. package/dist/kinds/read-descriptor.js.map +1 -0
  217. package/dist/kinds/rum.kind.d.ts +36 -6
  218. package/dist/kinds/rum.kind.d.ts.map +1 -1
  219. package/dist/kinds/rum.kind.js +6 -7
  220. package/dist/kinds/rum.kind.js.map +1 -1
  221. package/dist/kinds/sandbox.kind.d.ts +136 -36
  222. package/dist/kinds/sandbox.kind.d.ts.map +1 -1
  223. package/dist/kinds/sandbox.kind.js +80 -34
  224. package/dist/kinds/sandbox.kind.js.map +1 -1
  225. package/dist/kinds/select-compute-source.d.ts +72 -0
  226. package/dist/kinds/select-compute-source.d.ts.map +1 -0
  227. package/dist/kinds/select-compute-source.js +170 -0
  228. package/dist/kinds/select-compute-source.js.map +1 -0
  229. package/dist/kinds/service-release.kind.d.ts +771 -0
  230. package/dist/kinds/service-release.kind.d.ts.map +1 -0
  231. package/dist/kinds/service-release.kind.js +676 -0
  232. package/dist/kinds/service-release.kind.js.map +1 -0
  233. package/dist/kinds/spend-guard.kind.d.ts +40 -0
  234. package/dist/kinds/spend-guard.kind.d.ts.map +1 -0
  235. package/dist/kinds/spend-guard.kind.js +133 -0
  236. package/dist/kinds/spend-guard.kind.js.map +1 -0
  237. package/dist/kinds/utilization.kind.d.ts +88 -0
  238. package/dist/kinds/utilization.kind.d.ts.map +1 -0
  239. package/dist/kinds/utilization.kind.js +62 -0
  240. package/dist/kinds/utilization.kind.js.map +1 -0
  241. package/dist/kinds/volume.kind.d.ts +54 -0
  242. package/dist/kinds/volume.kind.d.ts.map +1 -0
  243. package/dist/kinds/volume.kind.js +39 -0
  244. package/dist/kinds/volume.kind.js.map +1 -0
  245. package/dist/kinds/vpc.kind.d.ts +61 -0
  246. package/dist/kinds/vpc.kind.d.ts.map +1 -0
  247. package/dist/kinds/vpc.kind.js +51 -0
  248. package/dist/kinds/vpc.kind.js.map +1 -0
  249. package/dist/kinds/web-app.kind.d.ts +115 -45
  250. package/dist/kinds/web-app.kind.d.ts.map +1 -1
  251. package/dist/kinds/web-app.kind.js +69 -42
  252. package/dist/kinds/web-app.kind.js.map +1 -1
  253. package/dist/kinds/worker.kind.d.ts +291 -188
  254. package/dist/kinds/worker.kind.d.ts.map +1 -1
  255. package/dist/kinds/worker.kind.js +45 -123
  256. package/dist/kinds/worker.kind.js.map +1 -1
  257. package/dist/schemas/database-migration.d.ts +173 -0
  258. package/dist/schemas/database-migration.d.ts.map +1 -0
  259. package/dist/schemas/database-migration.js +88 -0
  260. package/dist/schemas/database-migration.js.map +1 -0
  261. package/dist/schemas/deployment-environment.d.ts +11 -0
  262. package/dist/schemas/deployment-environment.d.ts.map +1 -0
  263. package/dist/schemas/deployment-environment.js +9 -0
  264. package/dist/schemas/deployment-environment.js.map +1 -0
  265. package/dist/schemas/deployment-provider.d.ts +336 -0
  266. package/dist/schemas/deployment-provider.d.ts.map +1 -0
  267. package/dist/schemas/deployment-provider.js +198 -0
  268. package/dist/schemas/deployment-provider.js.map +1 -0
  269. package/dist/schemas/log-stream.d.ts +27 -0
  270. package/dist/schemas/log-stream.d.ts.map +1 -0
  271. package/dist/schemas/log-stream.js +31 -0
  272. package/dist/schemas/log-stream.js.map +1 -0
  273. package/dist/schemas/spend-guard.d.ts +155 -0
  274. package/dist/schemas/spend-guard.d.ts.map +1 -0
  275. package/dist/schemas/spend-guard.js +61 -0
  276. package/dist/schemas/spend-guard.js.map +1 -0
  277. package/dist/schemas.d.ts +190 -20
  278. package/dist/schemas.d.ts.map +1 -1
  279. package/dist/schemas.js +137 -31
  280. package/dist/schemas.js.map +1 -1
  281. package/dist/service.d.ts +87 -0
  282. package/dist/service.d.ts.map +1 -0
  283. package/dist/service.js +199 -0
  284. package/dist/service.js.map +1 -0
  285. package/dist/settle-work.d.ts +20 -0
  286. package/dist/settle-work.d.ts.map +1 -0
  287. package/dist/settle-work.js +22 -0
  288. package/dist/settle-work.js.map +1 -0
  289. package/dist/web-app-projection.d.ts +132 -0
  290. package/dist/web-app-projection.d.ts.map +1 -0
  291. package/dist/web-app-projection.js +93 -0
  292. package/dist/web-app-projection.js.map +1 -0
  293. package/package.json +89 -39
  294. package/SPEC.md +0 -169
  295. package/src/bootstrap/index.ts +0 -15
  296. package/src/bootstrap/seed.descriptor.ts +0 -24
  297. package/src/bootstrap/seed.impl-shape.ts +0 -5
  298. package/src/bootstrap/seed.kind.ts +0 -26
  299. package/src/bootstrap/seed.runner.ts +0 -87
  300. package/src/credentials/resolve.ts +0 -205
  301. package/src/deployment.ts +0 -57
  302. package/src/index.ts +0 -149
  303. package/src/infra.plugin.ts +0 -54
  304. package/src/kinds/alerts.kind.ts +0 -164
  305. package/src/kinds/artifact.kind.ts +0 -96
  306. package/src/kinds/cache.kind.ts +0 -104
  307. package/src/kinds/database.kind.ts +0 -120
  308. package/src/kinds/discovery.ts +0 -26
  309. package/src/kinds/git-hosting.kind.ts +0 -100
  310. package/src/kinds/index.ts +0 -139
  311. package/src/kinds/logs.kind.ts +0 -104
  312. package/src/kinds/object-storage.kind.ts +0 -101
  313. package/src/kinds/observability.kind.ts +0 -178
  314. package/src/kinds/package-registry.kind.ts +0 -95
  315. package/src/kinds/queue.kind.ts +0 -102
  316. package/src/kinds/rum.kind.ts +0 -135
  317. package/src/kinds/sandbox.kind.ts +0 -115
  318. package/src/kinds/web-app.kind.ts +0 -103
  319. package/src/kinds/worker.kind.ts +0 -203
  320. package/src/schemas.ts +0 -127
@@ -1,87 +0,0 @@
1
- import type { VibesRuntime } from '@vibesdotdev/runtime';
2
- import { getLogger } from '@vibesdotdev/logging';
3
- import type {
4
- BootstrapSeedCondition,
5
- BootstrapSeedDescriptor,
6
- BootstrapSeedMode
7
- } from './seed.descriptor.ts';
8
- import type { BootstrapSeedImpl } from './seed.impl-shape.ts';
9
-
10
- const log = getLogger('infra.bootstrap.seed');
11
-
12
- export interface BootstrapSeedRunResult {
13
- ran: string[];
14
- skipped: Array<{ id: string; reason: string }>;
15
- failed: Array<{ id: string; error: string }>;
16
- }
17
-
18
- export interface BootstrapSeedRunOptions {
19
- env: Record<string, string | undefined>;
20
- }
21
-
22
- export async function runBootstrapSeeds(
23
- runtime: VibesRuntime,
24
- mode: BootstrapSeedMode,
25
- options: BootstrapSeedRunOptions
26
- ): Promise<BootstrapSeedRunResult> {
27
- const allDescriptors = runtime
28
- .assets('bootstrap/seed')
29
- .descriptors() as unknown as readonly BootstrapSeedDescriptor[];
30
-
31
- const result: BootstrapSeedRunResult = { ran: [], skipped: [], failed: [] };
32
- const runnable: BootstrapSeedDescriptor[] = [];
33
-
34
- for (const descriptor of allDescriptors) {
35
- if (!descriptor.executeOn.includes(mode)) {
36
- result.skipped.push({
37
- id: descriptor.id,
38
- reason: `mode ${mode} not in executeOn`
39
- });
40
- continue;
41
- }
42
- if (!evaluateCondition(descriptor.condition, options.env)) {
43
- result.skipped.push({
44
- id: descriptor.id,
45
- reason: 'condition not met'
46
- });
47
- continue;
48
- }
49
- runnable.push(descriptor);
50
- }
51
-
52
- runnable.sort((a, b) => (a.priority ?? 100) - (b.priority ?? 100));
53
-
54
- for (const descriptor of runnable) {
55
- try {
56
- const impl = (await runtime
57
- .query('bootstrap/seed')
58
- .withId(descriptor.id)
59
- .resolve()) as BootstrapSeedImpl;
60
- await impl.run(runtime, options.env);
61
- result.ran.push(descriptor.id);
62
- log.info('bootstrap seed completed', {
63
- id: descriptor.id,
64
- mode,
65
- priority: descriptor.priority ?? 100
66
- });
67
- } catch (err) {
68
- const error = err instanceof Error ? err.message : String(err);
69
- result.failed.push({ id: descriptor.id, error });
70
- log.error('bootstrap seed failed', { id: descriptor.id, mode, error });
71
- }
72
- }
73
-
74
- return result;
75
- }
76
-
77
- function evaluateCondition(
78
- condition: BootstrapSeedCondition | undefined,
79
- env: Record<string, string | undefined>
80
- ): boolean {
81
- if (!condition) return true;
82
- if (condition.kind === 'always') return true;
83
- if (condition.kind === 'env-keys-present') {
84
- return condition.keys.every((key) => Boolean(env[key]));
85
- }
86
- return true;
87
- }
@@ -1,205 +0,0 @@
1
- /**
2
- * Provider-agnostic credential resolution for infra/* adapters.
3
- *
4
- * Routes through the `secrets/store` runtime kind so every adapter
5
- * (alerts, RUM, observability, …) reads from the same credential chain
6
- * the rest of the platform uses. The chain (highest precedence first):
7
- *
8
- * 1. process.env (CI / explicit overrides)
9
- * 2. The tier-resolved secrets/store implementation
10
- * - local tier → encrypted-local → env-file
11
- * - production → cloudflare-secrets-store → cloudflare-api
12
- *
13
- * Adapters declare the secret KEY NAMES (e.g. CLOUDFLARE_API_TOKEN) on
14
- * their descriptor's `adapterConfig` and use this helper to resolve
15
- * the values. The helper supports `keyCandidates` for fallback chains
16
- * (e.g. prefer a scoped CLOUDFLARE_NOTIFICATIONS_API_TOKEN, fall back
17
- * to the broad CLOUDFLARE_API_TOKEN).
18
- *
19
- * Why a helper instead of inlining the secrets/store query: provider
20
- * adapters live in different packages and shouldn't all duplicate the
21
- * tier-walk + env-overlay logic. Keeping it in infra-core makes the
22
- * abstraction explicit ("infra/* adapters route credentials through
23
- * vibes secrets") and gives us one place to evolve the chain (e.g.
24
- * adding 1Password CLI as a backend).
25
- */
26
-
27
- import { getVibesRuntime } from '@vibesdotdev/runtime';
28
-
29
- export type EnvironmentTier = 'local' | 'dev' | 'staging' | 'production';
30
-
31
- export interface ResolveAdapterCredentialOptions {
32
- /**
33
- * Ordered list of candidate keys. First one that resolves to a
34
- * non-empty value wins. Useful for scoped → fallback patterns:
35
- * ['CLOUDFLARE_NOTIFICATIONS_API_TOKEN', 'CLOUDFLARE_API_TOKEN']
36
- */
37
- keyCandidates: readonly string[];
38
- /**
39
- * Environment name to read from the secrets store (default: 'local').
40
- * Maps onto vault.environments[name] in encrypted-local.
41
- */
42
- environment?: string;
43
- /**
44
- * Tier hint for runtime store selection. Defaults to inferring from
45
- * the environment name when it matches a known tier; falls back to
46
- * 'local' otherwise.
47
- */
48
- tier?: EnvironmentTier;
49
- /**
50
- * Whether to consult process.env first. Defaults true — CI/CD and
51
- * explicit shell overrides should win. Pass false to force
52
- * store-only resolution.
53
- */
54
- includeProcessEnv?: boolean;
55
- /**
56
- * Optional human-readable name for the credential, used in error
57
- * messages when no candidate resolves (e.g. "Cloudflare API token").
58
- */
59
- humanName?: string;
60
- }
61
-
62
- export interface ResolvedAdapterCredential {
63
- /** The KEY that resolved (one of keyCandidates). Useful for audit. */
64
- key: string;
65
- /** The resolved secret value. Never logged. */
66
- value: string;
67
- /** Where the value came from: 'process.env' or the store backend id. */
68
- source: string;
69
- }
70
-
71
- interface SecretsStoreImplShape {
72
- id?: string;
73
- get?(environment: string, key: string): Promise<string | undefined>;
74
- }
75
-
76
- interface SecretsStoreDescriptorShape {
77
- id: string;
78
- priority?: number;
79
- tiers?: readonly EnvironmentTier[] | EnvironmentTier[];
80
- }
81
-
82
- /**
83
- * Tier-aware backend selection. Mirrors the secrets/store kind's own
84
- * resolver (`packages/secrets/src/kinds/store.kind.ts`) so callers
85
- * don't need to import internal helpers.
86
- */
87
- function pickBackend(
88
- descriptors: SecretsStoreDescriptorShape[],
89
- tier: EnvironmentTier
90
- ): SecretsStoreDescriptorShape | undefined {
91
- if (descriptors.length === 0) return undefined;
92
- const matches = descriptors.filter((d) => (d.tiers ?? []).includes(tier));
93
- const pool = matches.length > 0 ? matches : descriptors;
94
- pool.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
95
- return pool[0];
96
- }
97
-
98
- function inferTier(environment: string, override?: EnvironmentTier): EnvironmentTier {
99
- if (override) return override;
100
- if (environment === 'local' || environment === 'dev' || environment === 'staging' || environment === 'production') {
101
- return environment;
102
- }
103
- return 'local';
104
- }
105
-
106
- /**
107
- * Resolve a single credential by walking the candidate keys against
108
- * process.env then the active secrets store. Returns the first match.
109
- *
110
- * Throws when no candidate resolves — adapters should let this bubble
111
- * up so the CLI surfaces a clean "missing credentials" message rather
112
- * than a vague "401 Unauthorized" downstream.
113
- */
114
- export async function resolveAdapterCredential(
115
- options: ResolveAdapterCredentialOptions
116
- ): Promise<ResolvedAdapterCredential> {
117
- const env = options.environment ?? 'local';
118
- const tier = inferTier(env, options.tier);
119
- const includeEnv = options.includeProcessEnv ?? true;
120
-
121
- // 1. process.env (CI / shell override)
122
- if (includeEnv) {
123
- for (const key of options.keyCandidates) {
124
- const v = process.env[key];
125
- if (v && v.length > 0) {
126
- return { key, value: v, source: 'process.env' };
127
- }
128
- }
129
- }
130
-
131
- // 2. secrets/store runtime resolution (tier-aware, priority-ordered)
132
- const runtime = getVibesRuntime();
133
- if (!runtime.hasKind('secrets/store')) {
134
- throw new Error(
135
- `No secrets/store kind registered; cannot resolve ${options.humanName ?? options.keyCandidates[0]}. ` +
136
- 'Load the secrets plugin (and a backend like encrypted-local) before calling this adapter.'
137
- );
138
- }
139
-
140
- const descriptors = runtime
141
- .assets('secrets/store')
142
- .descriptors() as SecretsStoreDescriptorShape[];
143
- // `VIBES_DEBUG_SECRETS=1` dumps the visible descriptor pool when
144
- // you're tracing why a credential is missing or getting misrouted.
145
- if (process.env.VIBES_DEBUG_SECRETS === '1') {
146
- console.error(`[secrets-debug] descriptors visible at tier=${tier}:`);
147
- for (const d of descriptors) {
148
- console.error(` - id=${d.id} priority=${d.priority ?? '-'} tiers=${JSON.stringify(d.tiers)}`);
149
- }
150
- }
151
- const target = pickBackend(descriptors, tier);
152
- if (!target) {
153
- throw new Error(
154
- `No secrets/store backend available for tier=${tier}. Register a backend ` +
155
- '(encrypted-local for local, cloudflare-secrets-store for production) before calling this adapter.'
156
- );
157
- }
158
-
159
- const store = (await runtime
160
- .query('secrets/store')
161
- .withId(target.id)
162
- .resolve()) as SecretsStoreImplShape;
163
-
164
- if (!store || typeof store.get !== 'function') {
165
- throw new Error(
166
- `Resolved secrets/store '${target.id}' has no get() method for ${options.humanName ?? options.keyCandidates[0]}.`
167
- );
168
- }
169
-
170
- for (const key of options.keyCandidates) {
171
- try {
172
- const v = await store.get(env, key);
173
- if (v && v.length > 0) {
174
- return { key, value: v, source: target.id };
175
- }
176
- } catch {
177
- // next candidate
178
- }
179
- }
180
-
181
- throw new Error(
182
- `Missing credential: none of [${options.keyCandidates.join(', ')}] resolved from process.env or ` +
183
- `${target.id} (environment=${env}, tier=${tier}). ` +
184
- `Set the value with \`vibes secrets set --environment ${env} ${options.keyCandidates[0]} <value>\`.`
185
- );
186
- }
187
-
188
- /**
189
- * Convenience wrapper for resolving multiple credentials at once.
190
- * Each key gets a candidate list of one (the key itself). Use the
191
- * single-credential form when you need fallback chains.
192
- */
193
- export async function resolveAdapterCredentials(
194
- keys: readonly string[],
195
- options?: Omit<ResolveAdapterCredentialOptions, 'keyCandidates' | 'humanName'>
196
- ): Promise<Record<string, ResolvedAdapterCredential>> {
197
- const out: Record<string, ResolvedAdapterCredential> = {};
198
- for (const key of keys) {
199
- out[key] = await resolveAdapterCredential({
200
- keyCandidates: [key],
201
- ...(options ?? {})
202
- });
203
- }
204
- return out;
205
- }
package/src/deployment.ts DELETED
@@ -1,57 +0,0 @@
1
- import {
2
- appDeploymentSchema,
3
- deploymentDependencySchema,
4
- deploymentEnvRequirementSchema,
5
- deploymentOriginSchema,
6
- type AppDeployment,
7
- type AppDeploymentInput,
8
- type DeploymentDependency,
9
- type DeploymentEnvRequirement,
10
- type DeploymentOrigin,
11
- type DeploymentUpstream
12
- } from './schemas.ts';
13
-
14
- export function createAppDeployment(input: AppDeploymentInput): AppDeployment {
15
- return appDeploymentSchema.parse(input);
16
- }
17
-
18
- export function createDeploymentOrigin(input: DeploymentOrigin): DeploymentOrigin {
19
- return deploymentOriginSchema.parse(input);
20
- }
21
-
22
- export function createDeploymentEnvRequirement(
23
- input: DeploymentEnvRequirement
24
- ): DeploymentEnvRequirement {
25
- return deploymentEnvRequirementSchema.parse(input);
26
- }
27
-
28
- export function createDeploymentDependency(input: DeploymentDependency): DeploymentDependency {
29
- return deploymentDependencySchema.parse(input);
30
- }
31
-
32
- export function getPrimaryOrigin(deployment: AppDeployment): DeploymentOrigin {
33
- return (
34
- deployment.origins.find((origin) => origin.kind === 'primary') ?? deployment.origins[0]
35
- );
36
- }
37
-
38
- export function getUpstreamOriginEnv(
39
- upstream: DeploymentUpstream
40
- ): Record<string, string> {
41
- if (!upstream.originEnvVar) {
42
- return {};
43
- }
44
-
45
- return {
46
- [upstream.originEnvVar]: upstream.origin
47
- };
48
- }
49
-
50
- export type {
51
- AppDeployment,
52
- AppDeploymentInput,
53
- DeploymentDependency,
54
- DeploymentEnvRequirement,
55
- DeploymentOrigin,
56
- DeploymentUpstream
57
- };
package/src/index.ts DELETED
@@ -1,149 +0,0 @@
1
- export {
2
- createAppDeployment,
3
- createDeploymentOrigin,
4
- createDeploymentEnvRequirement,
5
- createDeploymentDependency,
6
- getPrimaryOrigin,
7
- getUpstreamOriginEnv
8
- } from './deployment.ts';
9
- export type {
10
- AppDeployment,
11
- AppDeploymentInput,
12
- DeploymentDependency,
13
- DeploymentEnvRequirement,
14
- DeploymentOrigin,
15
- DeploymentUpstream
16
- } from './deployment.ts';
17
- export {
18
- deploymentProviderSchema,
19
- appRuntimeSchema,
20
- deploymentOriginSchema,
21
- deploymentBuildSchema,
22
- deploymentEnvRequirementSchema,
23
- deploymentDependencySchema,
24
- deploymentUpstreamSchema,
25
- appDeploymentSchema
26
- } from './schemas.ts';
27
- export type {
28
- DeploymentProvider,
29
- AppRuntime,
30
- DeploymentOrigin as DeploymentOriginType,
31
- DeploymentBuild,
32
- DeploymentEnvRequirement as DeploymentEnvRequirementType,
33
- DeploymentDependency as DeploymentDependencyType,
34
- DeploymentUpstream as DeploymentUpstreamType,
35
- AppDeploymentInput as AppDeploymentInputType,
36
- AppDeployment as AppDeploymentType
37
- } from './schemas.ts';
38
- export {
39
- webAppKind, WebAppDescriptorSchema, WebAppConfigSchema, CloudflareWorkersWebAppConfigSchema, DigitalOceanAppWebAppConfigSchema
40
- } from './kinds/index.ts';
41
- export type { WebAppDescriptor, WebAppDependency } from './kinds/index.ts';
42
- export {
43
- workerKind, WorkerDescriptorSchema, WorkerConfigSchema, DoksDeploymentWorkerConfigSchema, WorkerScalingSchema
44
- } from './kinds/index.ts';
45
- export type { WorkerDescriptor, WorkerScaling } from './kinds/index.ts';
46
- export {
47
- databaseKind, DatabaseDescriptorSchema, DatabaseConfigSchema, DoksDatabaseConfigSchema, DOManagedPostgresConfigSchema, TursoDatabaseConfigSchema, CloudflareD1ConfigSchema, DatabaseBackupSchema
48
- } from './kinds/index.ts';
49
- export type { DatabaseDescriptor, DatabaseBackup } from './kinds/index.ts';
50
- export {
51
- queueKind, QueueDescriptorSchema, QueueConfigSchema, DoksQueueConfigSchema, QueueTopicSchema
52
- } from './kinds/index.ts';
53
- export type { QueueDescriptor, QueueTopic } from './kinds/index.ts';
54
- export { cacheKind, CacheDescriptorSchema, CacheConfigSchema, DOManagedRedisConfigSchema } from './kinds/index.ts';
55
- export type { CacheDescriptor } from './kinds/index.ts';
56
- export {
57
- objectStorageKind, ObjectStorageDescriptorSchema, ObjectStorageConfigSchema, DOSpacesConfigSchema, CorsRuleSchema, LifecycleRuleSchema
58
- } from './kinds/index.ts';
59
- export type { ObjectStorageDescriptor, CorsRule, LifecycleRule } from './kinds/index.ts';
60
- export {
61
- sandboxKind, SandboxDescriptorSchema, SandboxConfigSchema, CloudflareSandboxConfigSchema, DockerSandboxConfigSchema, DigitalOceanDropletSandboxConfigSchema, SandboxOutboundProxySchema, SandboxResourceLimitsSchema
62
- } from './kinds/index.ts';
63
- export type { SandboxDescriptor, SandboxOutboundProxy, SandboxResourceLimits } from './kinds/index.ts';
64
- export {
65
- gitHostingKind, GitHostingDescriptorSchema, GitHostingConfigSchema, GiteaDoksGitHostingConfigSchema, GitHostingTypeSchema, GitHostingAuthMethodSchema
66
- } from './kinds/index.ts';
67
- export type { GitHostingDescriptor, GitHostingType, GitHostingAuthMethod } from './kinds/index.ts';
68
- export {
69
- packageRegistryKind, PackageRegistryDescriptorSchema, PackageRegistryConfigSchema, VerdaccioDoksPackageRegistryConfigSchema, PackageRegistryTypeSchema
70
- } from './kinds/index.ts';
71
- export type { PackageRegistryDescriptor, PackageRegistryType } from './kinds/index.ts';
72
- export {
73
- logsKind, InfraLogsDescriptorSchema, type InfraLogsDescriptor, type InfraLogsDescriptorInput, type InfraLogsKind, type InfraLogsKindInput, type LogsImplementation
74
- } from './kinds/index.ts';
75
- export {
76
- artifactKind,
77
- ArtifactDescriptorSchema,
78
- type ArtifactDescriptor,
79
- type ArtifactGenerator,
80
- type ArtifactOutput
81
- } from './kinds/index.ts';
82
- export { INFRA_DISCOVERY_PATTERN, extractStem } from './kinds/index.ts';
83
- export {
84
- alertsKind,
85
- InfraAlertsDescriptorSchema,
86
- AlertPolicySchema,
87
- AlertMechanismSchema,
88
- AlertTypeSchema,
89
- AlertWindowSchema,
90
- type InfraAlertsDescriptor,
91
- type InfraAlertsDescriptorInput,
92
- type InfraAlertsKind,
93
- type InfraAlertsKindInput,
94
- type AlertsImplementation,
95
- type AlertPolicy,
96
- type AlertMechanism,
97
- type AlertType
98
- } from './kinds/index.ts';
99
- export {
100
- observabilityKind,
101
- InfraObservabilityDescriptorSchema,
102
- ObservabilityScopeSchema,
103
- ObservabilitySettingsSchema,
104
- type InfraObservabilityDescriptor,
105
- type InfraObservabilityDescriptorInput,
106
- type InfraObservabilityKind,
107
- type InfraObservabilityKindInput,
108
- type ObservabilityImplementation,
109
- type ObservabilityScope,
110
- type ObservabilitySettings,
111
- type ObservabilitySnapshot,
112
- type SetObservabilityInput,
113
- type SetObservabilityResult
114
- } from './kinds/index.ts';
115
- export {
116
- rumKind,
117
- InfraRumDescriptorSchema,
118
- RumPrivacySchema,
119
- RumInjectionSchema,
120
- type InfraRumDescriptor,
121
- type InfraRumDescriptorInput,
122
- type InfraRumKind,
123
- type InfraRumKindInput,
124
- type RumImplementation,
125
- type RumSiteSnapshot,
126
- type RumPrivacy,
127
- type RumInjection
128
- } from './kinds/index.ts';
129
- export {
130
- resolveAdapterCredential,
131
- resolveAdapterCredentials,
132
- type EnvironmentTier,
133
- type ResolveAdapterCredentialOptions,
134
- type ResolvedAdapterCredential
135
- } from './credentials/resolve.ts';
136
- export {
137
- bootstrapSeedKind,
138
- bootstrapSeedConditionSchema,
139
- bootstrapSeedDescriptorSchema,
140
- bootstrapSeedModeSchema,
141
- runBootstrapSeeds,
142
- type BootstrapSeedCondition,
143
- type BootstrapSeedDescriptor,
144
- type BootstrapSeedImpl,
145
- type BootstrapSeedMode,
146
- type BootstrapSeedRunOptions,
147
- type BootstrapSeedRunResult
148
- } from './bootstrap/index.ts';
149
- export { default as infraPlugin } from './infra.plugin';
@@ -1,54 +0,0 @@
1
- /**
2
- * Infrastructure Runtime Plugin
3
- *
4
- * Registers all infra resource kinds with the runtime.
5
- */
6
-
7
- import { createRuntimePlugin } from '@vibesdotdev/runtime/factory/plugin';
8
- import { webAppKind } from './kinds/web-app.kind';
9
- import { workerKind } from './kinds/worker.kind';
10
- import { databaseKind } from './kinds/database.kind';
11
- import { queueKind } from './kinds/queue.kind';
12
- import { cacheKind } from './kinds/cache.kind';
13
- import { objectStorageKind } from './kinds/object-storage.kind';
14
- import { sandboxKind } from './kinds/sandbox.kind';
15
- import { gitHostingKind } from './kinds/git-hosting.kind';
16
- import { packageRegistryKind } from './kinds/package-registry.kind';
17
- import { logsKind } from './kinds/logs.kind';
18
- import { alertsKind } from './kinds/alerts.kind.ts';
19
- import { observabilityKind } from './kinds/observability.kind.ts';
20
- import { rumKind } from './kinds/rum.kind.ts';
21
- import { bootstrapSeedKind } from './bootstrap/index.ts';
22
-
23
- /**
24
- * Note on layering: inference is an apps/ai domain concern, not an infra kind.
25
- * Existing runtime kinds `ai/provider`, `ai/adapter`, `ai/model`, and
26
- * `ai/generation` already express "who/how/where inference runs", and the
27
- * runtime's hardware scope + connectionMode qualifier + priority already
28
- * select between consumer-direct, consumer-worker, cloud-worker, and
29
- * cloud-via-API strategies. New strategies (CF Unified Inference, Agents
30
- * Week bindings) should be added as new `ai/provider` descriptors + adapters,
31
- * not as a parallel `infra/inference` kind.
32
- */
33
-
34
- export default createRuntimePlugin({
35
- id: 'infra',
36
- name: 'Infrastructure',
37
- description: 'Resource kinds for deployable infrastructure',
38
- kinds: [
39
- webAppKind,
40
- workerKind,
41
- databaseKind,
42
- queueKind,
43
- cacheKind,
44
- objectStorageKind,
45
- sandboxKind,
46
- gitHostingKind,
47
- packageRegistryKind,
48
- logsKind,
49
- alertsKind,
50
- observabilityKind,
51
- rumKind,
52
- bootstrapSeedKind
53
- ]
54
- });