@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,164 +0,0 @@
1
- /**
2
- * Infra Alerts Kind
3
- *
4
- * Provider-agnostic schema for alerting / notification policies that
5
- * span billing (budget + per-product usage), reliability (error rate,
6
- * latency), and operational lifecycle (deploys, subscription changes).
7
- *
8
- * Per-provider implementations (cloudflare-alerts, do-monitoring,
9
- * cloudwatch-alarms) map this shape onto the native API. Where a
10
- * provider doesn't support a `type`, the impl rejects with a clear
11
- * "unsupported" error rather than silently falling back.
12
- *
13
- * Configuration is declarative — typically encoded in an
14
- * `infra/account.config.ts` or `infra/alerts.infra.ts` file alongside
15
- * `infra/dns.ts`. The CLI (`vibes infra alerts list|create|delete`)
16
- * wraps the same primitive for one-off ops and drift detection.
17
- */
18
-
19
- import * as z from 'zod/v4';
20
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
21
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
22
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
23
-
24
- /**
25
- * Delivery channel for an alert. Provider impls translate these to
26
- * native delivery slots (e.g. CF's `mechanisms.email[]`).
27
- */
28
- const AlertMechanismSchema = z.discriminatedUnion('kind', [
29
- z.object({
30
- kind: z.literal('email'),
31
- /** Email address — must be a verified destination on the provider. */
32
- target: z.email()
33
- }),
34
- z.object({
35
- kind: z.literal('webhook'),
36
- /** Outbound webhook URL. */
37
- target: z.string().url(),
38
- /** Optional secret name (in the active secrets store) used for HMAC signing. */
39
- secretRef: z.string().optional()
40
- }),
41
- z.object({
42
- kind: z.literal('pagerduty'),
43
- /** PagerDuty integration key (Events API v2). */
44
- target: z.string().min(1)
45
- }),
46
- z.object({
47
- kind: z.literal('slack'),
48
- /** Slack webhook URL (Incoming Webhooks). */
49
- target: z.string().url()
50
- })
51
- ]);
52
-
53
- export type AlertMechanism = z.infer<typeof AlertMechanismSchema>;
54
-
55
- /**
56
- * Cross-provider alert categories. Each maps to one or more native
57
- * alert types per provider.
58
- */
59
- const AlertTypeSchema = z.enum([
60
- /** Total cost crossed a dollar threshold for the current billing period. */
61
- 'budget',
62
- /** Per-product usage crossed a numeric threshold (events/req/GB/etc.). */
63
- 'usage',
64
- /** Worker/service error rate over a rolling window. */
65
- 'error-rate',
66
- /** P99 latency or wall-time crossed a threshold. */
67
- 'latency',
68
- /** Catch-all for provider-specific types not yet modeled here. */
69
- 'custom'
70
- ]);
71
-
72
- export type AlertType = z.infer<typeof AlertTypeSchema>;
73
-
74
- const AlertWindowSchema = z.enum(['5m', '15m', '1h', '6h', '24h', '7d', '30d']);
75
-
76
- const AlertPolicySchema = z.object({
77
- /** Stable id for diffing. Auto-generated when omitted. */
78
- id: z.string().min(1).optional(),
79
- /** Human-readable name (also surfaced by the provider). */
80
- name: z.string().min(1),
81
- type: AlertTypeSchema,
82
- /**
83
- * Threshold value. `budget` reads it as USD (or local currency).
84
- * `usage`/`error-rate`/`latency` read it as units defined by the
85
- * filter (event count, %, ms).
86
- */
87
- threshold: z.number().nonnegative(),
88
- /** Optional secondary threshold for tiered alerts. */
89
- warningThreshold: z.number().nonnegative().optional(),
90
- /** Rolling window for `usage`/`error-rate`/`latency`. Ignored for `budget`. */
91
- window: AlertWindowSchema.optional(),
92
- /**
93
- * Adapter-specific filters. Examples:
94
- * { product: 'workers_observability' } // usage on a specific CF product
95
- * { worker: 'vibes-account' } // error-rate scoped to one worker
96
- * { native_alert_type: 'health_check_status_notification' } // custom escape
97
- */
98
- filters: z.record(z.string(), z.string()).default({}),
99
- mechanisms: z.array(AlertMechanismSchema).min(1),
100
- enabled: z.boolean().default(true),
101
- description: z.string().optional()
102
- });
103
-
104
- export type AlertPolicy = z.infer<typeof AlertPolicySchema>;
105
-
106
- const AlertsBaseSchema = RuntimeDescriptorSchema.extend({
107
- kind: z.literal('infra/alerts'),
108
- /** Adapter id (e.g. 'cloudflare-alerts', 'do-monitoring'). */
109
- adapter: z.string().min(1),
110
- adapterConfig: z.record(z.string(), z.unknown()).optional(),
111
- /**
112
- * Default environment name for credential resolution via `vibes
113
- * secrets`. Defaults to 'local' since the CLI / dev workflow is
114
- * the primary caller; production Workers that consume this adapter
115
- * read credentials from CF Secrets Store bindings directly, not
116
- * through this descriptor.
117
- */
118
- environment: z.string().default('local'),
119
- policies: z.array(AlertPolicySchema).default([])
120
- });
121
-
122
- export type InfraAlertsDescriptor = z.infer<typeof AlertsBaseSchema>;
123
- export type InfraAlertsDescriptorInput = z.input<typeof AlertsBaseSchema>;
124
-
125
- /**
126
- * Implementation contract every provider implements. Operations are
127
- * idempotent: `applyPolicies` reconciles the live policy set to the
128
- * desired set without trampling unrelated policies on the provider.
129
- */
130
- export interface AlertsImplementation {
131
- /** List policies currently configured on the provider. */
132
- listPolicies(): Promise<Array<AlertPolicy & { providerId: string }>>;
133
- /** Create a single policy. Returns the provider-assigned id. */
134
- createPolicy(policy: AlertPolicy): Promise<{ providerId: string }>;
135
- /** Delete a policy by provider id. */
136
- deletePolicy(providerId: string): Promise<void>;
137
- /**
138
- * Diff desired (descriptor) against live; return the set of policies
139
- * that need create/update/delete. Empty arrays = in sync.
140
- */
141
- diff(desired: AlertPolicy[]): Promise<{
142
- create: AlertPolicy[];
143
- update: Array<{ providerId: string; policy: AlertPolicy }>;
144
- delete: Array<{ providerId: string; name: string }>;
145
- }>;
146
- }
147
-
148
- export const alertsKind = createRuntimeKind<InfraAlertsDescriptor, AlertsImplementation>({
149
- id: 'infra/alerts',
150
- descriptorSchema: AlertsBaseSchema,
151
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
152
- extractStem
153
- });
154
-
155
- export type InfraAlertsKind = InfraAlertsDescriptor;
156
- export type InfraAlertsKindInput = InfraAlertsDescriptorInput;
157
-
158
- export {
159
- AlertsBaseSchema as InfraAlertsDescriptorSchema,
160
- AlertPolicySchema,
161
- AlertMechanismSchema,
162
- AlertTypeSchema,
163
- AlertWindowSchema
164
- };
@@ -1,96 +0,0 @@
1
- /**
2
- * Kind: infra/artifact
3
- *
4
- * Generic descriptor for generatable infrastructure artifacts.
5
- *
6
- * This kind is intentionally unopinionated about what gets generated.
7
- * Adapter implementations (infra-kubernetes, infra-helm, infra-cloudflare, etc.)
8
- * define their own descriptor shapes and generation logic.
9
- *
10
- * Usage pattern:
11
- * 1. Adapters register artifact generators with custom descriptors
12
- * 2. Query: runtime.query('infra/artifact').all()
13
- * 3. Resolve implementation and call its generate method
14
- * 4. Implementation returns artifact content (format determined by impl)
15
- */
16
- import * as z from 'zod/v4';
17
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
18
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
19
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
20
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
21
-
22
- /**
23
- * Minimal base schema for artifact descriptors.
24
- *
25
- * Implementations extend this with their own fields (source resources,
26
- * output format, generation options, etc.).
27
- */
28
- const ArtifactBaseSchema = RuntimeDescriptorSchema.extend({
29
- kind: z.literal('infra/artifact')
30
- });
31
-
32
- /**
33
- * Generic artifact generator interface.
34
- *
35
- * Implementations define their own input/output shapes.
36
- */
37
- export interface ArtifactGenerator {
38
- /**
39
- * Generate artifact content.
40
- *
41
- * @param options - Implementation-specific options (descriptor, context, etc.)
42
- * @returns Generated artifact (content + metadata)
43
- */
44
- generate(options?: unknown): Promise<ArtifactOutput>;
45
- }
46
-
47
- /**
48
- * Generated artifact output (generic shape).
49
- *
50
- * Implementations may return more specific types.
51
- */
52
- export interface ArtifactOutput {
53
- /** Generated content (string for text formats, Buffer for binary) */
54
- content: string | Buffer;
55
- /** Recommended filename (including extension) */
56
- filename: string;
57
- /** Full output path */
58
- path: string;
59
- /** Optional metadata */
60
- metadata?: Record<string, unknown>;
61
- }
62
-
63
- /**
64
- * Artifact descriptor type (base shape, implementations extend)
65
- */
66
- export type ArtifactDescriptor = z.infer<typeof ArtifactBaseSchema>;
67
-
68
- /**
69
- * Artifact descriptor schema
70
- */
71
- export const ArtifactDescriptorSchema = ArtifactBaseSchema;
72
-
73
- /**
74
- * Artifact kind descriptor for runtime registration.
75
- *
76
- * Note: This kind has no default implementation. Adapters must register
77
- * their own implementations via runtime plugins.
78
- */
79
- class NoOpArtifactImplementation implements ArtifactGenerator {
80
- async generate(options?: unknown): Promise<ArtifactOutput> {
81
- throw new Error(
82
- 'No artifact generator registered. Adapter plugins (infra-kubernetes, infra-helm, etc.) must register implementations.'
83
- );
84
- }
85
- }
86
-
87
- export const artifactKind = createRuntimeKind<ArtifactDescriptor, NoOpArtifactImplementation>({
88
- id: 'infra/artifact',
89
- descriptorSchema: ArtifactDescriptorSchema,
90
- defaultImplementation: NoOpArtifactImplementation,
91
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
92
- extractStem
93
- });
94
-
95
- // Re-export discovery helpers
96
- export { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
@@ -1,104 +0,0 @@
1
- /**
2
- * Kind: infra/cache
3
- *
4
- * Describes a cache service.
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base defines fields universal across adapters: id/kind/name +
9
- * the cache shape (engine, maxMemory, eviction, namespace).
10
- * - Adapter-specific fields (region, version, numNodes, size, …)
11
- * live under `config`. Each adapter package defines its own concrete schema.
12
- */
13
- import * as z from 'zod/v4';
14
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
15
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
16
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
17
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
18
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
19
-
20
- const CacheBaseSchema = RuntimeDescriptorSchema.extend({
21
- kind: z.literal('infra/cache'),
22
-
23
- /** Cache engine (e.g., 'cloudflare-kv', 'redis'). */
24
- engine: z.string().min(1).optional(),
25
-
26
- /** Maximum memory hint. */
27
- maxMemory: z.string().optional(),
28
-
29
- /** Eviction policy. */
30
- eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
31
-
32
- /** Logical namespace within the cache. */
33
- namespace: z.string().optional()
34
- });
35
-
36
- export const DOManagedRedisConfigSchema = z.object({
37
- /** Max memory allocation (e.g., '256mb', '1gb'). */
38
- maxMemory: z.string().min(1).optional(),
39
- /** Eviction policy: lru, lfu, or ttl. */
40
- eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
41
- /** DO region (default: nyc1). */
42
- region: z.string().min(1).default('nyc1'),
43
- /** Redis version (default: 7). */
44
- version: z.string().min(1).default('7'),
45
- /** Number of nodes (default: 1). */
46
- numNodes: z.number().int().positive().default(1),
47
- /** Database size tier (optional, derived from maxMemory if not set). */
48
- size: z.string().min(1).optional()
49
- });
50
-
51
- export const CloudflareKVCacheConfigSchema = z.object({
52
- /** Logical namespace within the KV store. */
53
- namespace: z.string().min(1)
54
- });
55
-
56
- export const DOKSRedisCacheConfigSchema = z.object({
57
- /** Kubernetes namespace (default: vibes). */
58
- namespace: z.string().min(1).default('vibes'),
59
- /** Container image (default: redis:{version}). */
60
- image: z.string().min(1).optional(),
61
- /** Redis version (default: 7). */
62
- version: z.string().min(1).default('7'),
63
- /** Max memory allocation (e.g., '256mb'). */
64
- maxMemory: z.string().optional(),
65
- /** Eviction policy: lru, lfu, or ttl. */
66
- eviction: z.enum(['lru', 'lfu', 'ttl']).optional(),
67
- /** Storage size (default: 1Gi). */
68
- storageSize: z.string().min(1).default('1Gi')
69
- });
70
-
71
- export const CacheConfigSchema = z.union([
72
- DOManagedRedisConfigSchema.extend({ adapter: z.literal('do-managed-redis') }),
73
- CloudflareKVCacheConfigSchema.extend({ adapter: z.literal('cloudflare-kv') }),
74
- DOKSRedisCacheConfigSchema.extend({ adapter: z.literal('doks-redis') })
75
- ]);
76
-
77
- export const CacheDescriptorSchema = CacheBaseSchema.extend({
78
- /**
79
- * Adapter-specific configuration. Discriminated union — each adapter
80
- * package defines its own config schema under its discriminator key.
81
- */
82
- config: CacheConfigSchema.optional()
83
- });
84
-
85
- export type CacheDescriptor = z.infer<typeof CacheDescriptorSchema>;
86
-
87
- class DefaultCacheImplementation {
88
- constructor(
89
- public readonly descriptor: RuntimeDescriptor,
90
- public readonly context: unknown
91
- ) {}
92
-
93
- get config(): CacheDescriptor {
94
- return this.descriptor as CacheDescriptor;
95
- }
96
- }
97
-
98
- export const cacheKind = createRuntimeKind<CacheDescriptor, DefaultCacheImplementation>({
99
- id: 'infra/cache',
100
- descriptorSchema: CacheDescriptorSchema,
101
- defaultImplementation: DefaultCacheImplementation,
102
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
103
- extractStem
104
- });
@@ -1,120 +0,0 @@
1
- /**
2
- * Kind: infra/database
3
- *
4
- * Describes a database instance.
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base defines fields universal across adapters: id/kind/name +
9
- * the database shape (engine, size, replicas, backups).
10
- * - Adapter-specific fields (namespace, storageSize, version, region, …)
11
- * live under `config`. Each adapter package defines its own concrete schema.
12
- */
13
- import * as z from 'zod/v4';
14
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
15
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
16
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
17
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
18
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
19
-
20
- export const DatabaseBackupSchema = z.object({
21
- enabled: z.boolean().default(false),
22
- schedule: z.string().optional(),
23
- retention: z.string().optional()
24
- });
25
- export type DatabaseBackup = z.infer<typeof DatabaseBackupSchema>;
26
-
27
- const DatabaseBaseSchema = RuntimeDescriptorSchema.extend({
28
- kind: z.literal('infra/database'),
29
-
30
- /** Database engine (e.g., 'turso', 'postgres'). */
31
- engine: z.string().min(1).optional(),
32
-
33
- /** Instance size hint. */
34
- size: z.string().optional(),
35
-
36
- /** Replica count. */
37
- replicas: z.number().int().nonnegative().optional(),
38
-
39
- /** Backup configuration. */
40
- backups: DatabaseBackupSchema.optional()
41
- });
42
-
43
- export const DoksDatabaseConfigSchema = z.object({
44
- /** Kubernetes namespace (default: vibes). */
45
- namespace: z.string().min(1).default('vibes'),
46
- /** Storage size for pgdata volume (default: 10Gi). */
47
- storageSize: z.string().min(1).default('10Gi'),
48
- /** Container resources. */
49
- resources: z
50
- .object({
51
- requests: z.object({ cpu: z.string().min(1), memory: z.string().min(1) }).optional(),
52
- limits: z.object({ cpu: z.string().min(1), memory: z.string().min(1) }).optional()
53
- })
54
- .optional(),
55
- /** Postgres version tag (default: 16-alpine). */
56
- version: z.string().min(1).default('16-alpine')
57
- });
58
-
59
- export const DOManagedPostgresConfigSchema = z.object({
60
- /** Database size tier (default: db-s-1vcpu-1gb). */
61
- size: z.string().min(1).default('db-s-1vcpu-1gb'),
62
- /** DO region (default: nyc1). */
63
- region: z.string().min(1).default('nyc1'),
64
- /** Postgres version (default: 16). */
65
- version: z.string().min(1).default('16')
66
- });
67
-
68
- export const TursoDatabaseConfigSchema = z.object({
69
- /** Turso database name (defaults to descriptor id). */
70
- database: z.string().min(1).optional(),
71
- /** Edge region for replication (default: aws:iad1). */
72
- region: z.string().min(1).default('aws:iad1')
73
- });
74
-
75
- export const CloudflareD1ConfigSchema = z.object({
76
- /** D1 adapter name (always 'cloudflare-d1'). */
77
- adapter: z.literal('cloudflare-d1'),
78
- /** Binding name for D1 in Cloudflare Workers (default: 'DB'). */
79
- binding: z.string().min(1).default('DB'),
80
- /** D1 database name. */
81
- databaseName: z.string().min(1),
82
- /** ID of the consuming app (for wrangler.jsonc generation). */
83
- consumerAppId: z.string().min(1)
84
- });
85
-
86
- export const DatabaseConfigSchema = z.union([
87
- DoksDatabaseConfigSchema.extend({ adapter: z.literal('doks-statefulset') }),
88
- DOManagedPostgresConfigSchema.extend({ adapter: z.literal('do-managed-postgres') }),
89
- TursoDatabaseConfigSchema.extend({ adapter: z.literal('turso') }),
90
- CloudflareD1ConfigSchema
91
- ]);
92
-
93
- export const DatabaseDescriptorSchema = DatabaseBaseSchema.extend({
94
- /**
95
- * Adapter-specific configuration. Discriminated union — each adapter
96
- * package defines its own config schema under its discriminator key.
97
- */
98
- config: DatabaseConfigSchema.optional()
99
- });
100
-
101
- export type DatabaseDescriptor = z.infer<typeof DatabaseDescriptorSchema>;
102
-
103
- class DefaultDatabaseImplementation {
104
- constructor(
105
- public readonly descriptor: RuntimeDescriptor,
106
- public readonly context: unknown
107
- ) {}
108
-
109
- get config(): DatabaseDescriptor {
110
- return this.descriptor as DatabaseDescriptor;
111
- }
112
- }
113
-
114
- export const databaseKind = createRuntimeKind<DatabaseDescriptor, DefaultDatabaseImplementation>({
115
- id: 'infra/database',
116
- descriptorSchema: DatabaseDescriptorSchema,
117
- defaultImplementation: DefaultDatabaseImplementation,
118
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
119
- extractStem
120
- });
@@ -1,26 +0,0 @@
1
- /**
2
- * Shared discovery helpers for infra resource kinds.
3
- *
4
- * All infra kinds use the same discovery pattern for *.infra.ts files.
5
- */
6
-
7
- /**
8
- * Glob pattern for discovering infra resource declaration files.
9
- */
10
- export const INFRA_DISCOVERY_PATTERN = '**/*.infra.ts';
11
-
12
- /**
13
- * Extract the stem (base name without extension) from an infra file.
14
- * Matches both .infra.ts and .infra.tsx extensions.
15
- *
16
- * @example
17
- * extractStem('auth.infra.ts') // 'auth'
18
- * extractStem('my-service.infra.tsx') // 'my-service'
19
- * extractStem('not-infra.ts') // null
20
- */
21
- export function extractStem(filename: string): string | null {
22
- const match = filename.match(/^(.+)\.infra\.tsx?$/);
23
- const stem = match ? match[1]! : null;
24
- // Return null for empty stem (e.g., '.infra.ts')
25
- return stem && stem.length > 0 ? stem : null;
26
- }
@@ -1,100 +0,0 @@
1
- /**
2
- * Kind: infra/git-hosting
3
- *
4
- * Describes a git hosting service instance (e.g. Gitea, Forgejo).
5
- *
6
- * Schema shape: strict common base + `config` discriminated union.
7
- *
8
- * - The base (this file) defines fields that are universal across every
9
- * adapter: id/kind/name + the hosting shape every git host declares
10
- * (domain, url, storagePath, authMethod, etc.).
11
- * - Adapter-specific fields (dropletSize, dockerImage, volumeSizeGb, …)
12
- * live exclusively under `config`. Each adapter package defines its own
13
- * concrete schema under its discriminator key.
14
- */
15
- import * as z from 'zod/v4';
16
- import { createRuntimeKind } from '@vibesdotdev/runtime/factory/kind';
17
- import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
18
- import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
19
- import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
20
- import { INFRA_DISCOVERY_PATTERN, extractStem } from './discovery.ts';
21
- import { deploymentEnvRequirementSchema } from '../schemas.ts';
22
-
23
- export const GitHostingTypeSchema = z.enum(['gitea', 'forgejo']);
24
- export type GitHostingType = z.infer<typeof GitHostingTypeSchema>;
25
-
26
- export const GitHostingAuthMethodSchema = z.enum(['local', 'oauth', 'token']);
27
- export type GitHostingAuthMethod = z.infer<typeof GitHostingAuthMethodSchema>;
28
-
29
- const GitHostingBaseSchema = RuntimeDescriptorSchema.extend({
30
- kind: z.literal('infra/git-hosting'),
31
-
32
- /** Primary access URL (e.g. 'https://git.vibes.dev'). */
33
- url: z.string().url(),
34
-
35
- /** Hostname for DNS resolution (e.g. 'git.vibes.dev'). */
36
- hostname: z.string().min(1),
37
-
38
- /** Git hosting software type. */
39
- type: GitHostingTypeSchema,
40
-
41
- /** Storage mount path inside the container. */
42
- storagePath: z.string().min(1).default('/data'),
43
-
44
- /** Authentication method. */
45
- authMethod: GitHostingAuthMethodSchema.default('token'),
46
-
47
- /** Whether TLS is enabled. */
48
- ssl: z.boolean().default(true),
49
-
50
- /** Environment variable requirements. */
51
- env: z.array(deploymentEnvRequirementSchema).optional()
52
- });
53
-
54
- export const GiteaDoksGitHostingConfigSchema = z.object({
55
- /** DigitalOcean Droplet size. */
56
- dropletSize: z.string().default('s-2vcpu-2gb'),
57
- /** Docker image for the Gitea container. */
58
- dockerImage: z.string().default('gitea/gitea:1.21'),
59
- /** Volume size in GiB for persistent storage. */
60
- volumeSizeGb: z.number().int().positive().default(50),
61
- /** Primary domain for the Gitea instance. */
62
- domain: z.string().min(1),
63
- /** SSH port exposed on the service. */
64
- sshPort: z.number().int().positive().default(22),
65
- /** HTTP port exposed on the service. */
66
- httpPort: z.number().int().positive().default(3000)
67
- });
68
-
69
- export const GitHostingConfigSchema = z.union([
70
- GiteaDoksGitHostingConfigSchema.extend({ adapter: z.literal('gitea-doks') })
71
- ]);
72
-
73
- export const GitHostingDescriptorSchema = GitHostingBaseSchema.extend({
74
- /**
75
- * Adapter-specific configuration. Discriminated union — each adapter
76
- * package defines its own config schema under its discriminator key.
77
- */
78
- config: GitHostingConfigSchema.optional()
79
- });
80
-
81
- export type GitHostingDescriptor = z.infer<typeof GitHostingDescriptorSchema>;
82
-
83
- class DefaultGitHostingImplementation {
84
- constructor(
85
- public readonly descriptor: RuntimeDescriptor,
86
- public readonly context: unknown
87
- ) {}
88
-
89
- get config(): GitHostingDescriptor {
90
- return this.descriptor as GitHostingDescriptor;
91
- }
92
- }
93
-
94
- export const gitHostingKind = createRuntimeKind<GitHostingDescriptor, DefaultGitHostingImplementation>({
95
- id: 'infra/git-hosting',
96
- descriptorSchema: GitHostingDescriptorSchema,
97
- defaultImplementation: DefaultGitHostingImplementation,
98
- discoveryPattern: INFRA_DISCOVERY_PATTERN,
99
- extractStem
100
- });