@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
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@vibesdotdev/infra-deploy",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "bun": "./src/index.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./plugin": {
15
+ "types": "./dist/infra-deploy.plugin.d.ts",
16
+ "bun": "./src/infra-deploy.plugin.ts",
17
+ "import": "./dist/infra-deploy.plugin.js",
18
+ "default": "./dist/infra-deploy.plugin.js"
19
+ },
20
+ "./config-loader": {
21
+ "types": "./dist/config-loader.d.ts",
22
+ "bun": "./src/config-loader.ts",
23
+ "import": "./dist/config-loader.js",
24
+ "default": "./dist/config-loader.js"
25
+ },
26
+ "./regenerate": {
27
+ "types": "./dist/regenerate.d.ts",
28
+ "bun": "./src/regenerate.ts",
29
+ "import": "./dist/regenerate.js",
30
+ "default": "./dist/regenerate.js"
31
+ }
32
+ },
33
+ "publishConfig": {
34
+ "registry": "https://registry.npmjs.org",
35
+ "access": "public"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/vibesdotdev/monorepo.git",
40
+ "directory": "packages/infra-deploy"
41
+ },
42
+ "peerDependencies": {
43
+ "@vibesdotdev/runtime": "0.0.1",
44
+ "@vibesdotdev/cli": "0.0.1"
45
+ },
46
+ "dependencies": {
47
+ "@vibesdotdev/infra-core": "0.0.1",
48
+ "@vibesdotdev/connector-cloudflare": "0.0.1",
49
+ "@vibesdotdev/infra-doks": "0.0.1",
50
+ "@vibesdotdev/config": "0.0.1",
51
+ "@vibesdotdev/infra-cloudflare": "0.0.1"
52
+ },
53
+ "scripts": {
54
+ "check": "bun --bun tsc -p tsconfig.json --noEmit",
55
+ "build": "tsc -p tsconfig.json"
56
+ },
57
+ "license": "MIT",
58
+ "files": [
59
+ "dist",
60
+ "src",
61
+ "bin",
62
+ "README.md",
63
+ "SPEC.md",
64
+ "LICENSE",
65
+ "!src/**/__tests__/**",
66
+ "!src/**/__stubs__/**",
67
+ "!src/**/*.test.ts",
68
+ "!src/**/*.test.tsx",
69
+ "!src/**/*.spec.ts",
70
+ "!src/**/*.spec.tsx",
71
+ "!dist/**/__tests__/**",
72
+ "!dist/**/__stubs__/**",
73
+ "!dist/**/*.test.js",
74
+ "!dist/**/*.test.js.map",
75
+ "!dist/**/*.test.d.ts",
76
+ "!dist/**/*.test.d.ts.map",
77
+ "!dist/**/*.spec.js",
78
+ "!dist/**/*.spec.js.map",
79
+ "!dist/**/*.spec.d.ts",
80
+ "!dist/**/*.spec.d.ts.map"
81
+ ],
82
+ "vibes": {
83
+ "visibility": "public-framework"
84
+ }
85
+ }
@@ -0,0 +1,61 @@
1
+ import { createRuntimeAsset } from '@vibesdotdev/runtime';
2
+
3
+ export default createRuntimeAsset({
4
+ id: 'infra-alerts.create',
5
+ kind: 'cli/command',
6
+ name: 'create',
7
+ description: 'Create a new alert policy on the active provider',
8
+ group: 'infra-alerts',
9
+ arguments: [
10
+ {
11
+ name: 'type',
12
+ description: 'Alert type: budget | usage | error-rate | latency | custom',
13
+ required: true,
14
+ variadic: false
15
+ }
16
+ ],
17
+ options: [
18
+ { flags: '--name <name>', description: 'Policy name (defaults to "<type> alert: <threshold>")' },
19
+ {
20
+ flags: '--threshold <n>',
21
+ description: 'Threshold value (USD for budget; events/req/% per usage/error-rate)',
22
+ default: '50'
23
+ },
24
+ {
25
+ flags: '--window <window>',
26
+ description: 'Rolling window for usage/error-rate/latency (5m, 15m, 1h, 6h, 24h, 7d, 30d)'
27
+ },
28
+ {
29
+ flags: '--filter <k=v>',
30
+ description: 'Adapter-specific filter (repeatable, e.g. --filter product=workers_observability_paid_events)',
31
+ variadic: true
32
+ },
33
+ {
34
+ flags: '--email <addr>',
35
+ description: 'Email destination (repeatable)',
36
+ variadic: true
37
+ },
38
+ {
39
+ flags: '--webhook <url>',
40
+ description: 'Webhook destination (repeatable)',
41
+ variadic: true
42
+ },
43
+ {
44
+ flags: '--provider <id>',
45
+ description: 'Provider impl id (default: cloudflare-alerts when available)'
46
+ },
47
+ {
48
+ flags: '--disabled',
49
+ description: 'Create the policy in disabled state',
50
+ default: false
51
+ },
52
+ {
53
+ flags: '-o, --output <format>',
54
+ description: 'Output format (text|json)',
55
+ default: 'text'
56
+ }
57
+ ],
58
+ surfaces: ['cli'],
59
+ hardware: ['consumer', 'cloud'],
60
+ enabled: true
61
+ });
@@ -0,0 +1,131 @@
1
+ /**
2
+ * `vibes infra alerts create <type> --threshold ... --email ...`
3
+ *
4
+ * Creates one policy on the chosen provider. Resolves the impl via the
5
+ * runtime, builds an `AlertPolicy` from CLI flags, and calls
6
+ * `impl.createPolicy(policy)`. Reports the provider-assigned id on
7
+ * success.
8
+ */
9
+
10
+ import { getVibesRuntime } from '@vibesdotdev/runtime';
11
+ import { requestCLIExit, type UIContext } from '@vibesdotdev/cli/providers';
12
+ import type {
13
+ AlertsImplementation,
14
+ AlertPolicy,
15
+ AlertMechanism,
16
+ AlertType,
17
+ InfraAlertsDescriptor
18
+ } from '@vibesdotdev/infra-core/kinds';
19
+
20
+ function readString(v: unknown): string | undefined {
21
+ return typeof v === 'string' && v.length > 0 ? v : undefined;
22
+ }
23
+
24
+ function readStringArray(v: unknown): string[] {
25
+ if (Array.isArray(v)) return v.filter((x): x is string => typeof x === 'string');
26
+ if (typeof v === 'string') return [v];
27
+ return [];
28
+ }
29
+
30
+ const VALID_TYPES = new Set<AlertType>(['budget', 'usage', 'error-rate', 'latency', 'custom']);
31
+
32
+ function parseFilters(raw: string[]): Record<string, string> {
33
+ const out: Record<string, string> = {};
34
+ for (const entry of raw) {
35
+ const idx = entry.indexOf('=');
36
+ if (idx <= 0) continue;
37
+ out[entry.slice(0, idx)] = entry.slice(idx + 1);
38
+ }
39
+ return out;
40
+ }
41
+
42
+ export default {
43
+ async execute(args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void> {
44
+ const runtime = await getVibesRuntime();
45
+ const ui = (await runtime.context('cli/ui')) as UIContext;
46
+
47
+ const typeArg = readString(args.type);
48
+ if (!typeArg || !VALID_TYPES.has(typeArg as AlertType)) {
49
+ ui.error(
50
+ `Invalid alert type. Got "${typeArg ?? '(missing)'}". Expected one of: ${Array.from(VALID_TYPES).join(', ')}`
51
+ );
52
+ requestCLIExit(1);
53
+ return;
54
+ }
55
+ const type = typeArg as AlertType;
56
+
57
+ const thresholdRaw = readString(opts.threshold) ?? '50';
58
+ const threshold = Number(thresholdRaw);
59
+ if (!Number.isFinite(threshold) || threshold < 0) {
60
+ ui.error(`Invalid --threshold "${thresholdRaw}"; must be a non-negative number.`);
61
+ requestCLIExit(1);
62
+ return;
63
+ }
64
+
65
+ const emails = readStringArray(opts.email);
66
+ const webhooks = readStringArray(opts.webhook);
67
+ const mechanisms: AlertMechanism[] = [
68
+ ...emails.map((target): AlertMechanism => ({ kind: 'email', target })),
69
+ ...webhooks.map((target): AlertMechanism => ({ kind: 'webhook', target }))
70
+ ];
71
+ if (mechanisms.length === 0) {
72
+ ui.error('At least one --email or --webhook destination is required.');
73
+ requestCLIExit(1);
74
+ return;
75
+ }
76
+
77
+ const filters = parseFilters(readStringArray(opts.filter));
78
+ const name = readString(opts.name) ?? `${type} alert: ${threshold}`;
79
+ const window = readString(opts.window) as AlertPolicy['window'] | undefined;
80
+ const enabled = !(opts.disabled === true || opts.disabled === 'true');
81
+ const output = readString(opts.output) ?? 'text';
82
+ const providerFilter = readString(opts.provider);
83
+
84
+ const policy: AlertPolicy = {
85
+ name,
86
+ type,
87
+ threshold,
88
+ window,
89
+ filters,
90
+ mechanisms,
91
+ enabled
92
+ };
93
+
94
+ if (!runtime.hasKind('infra/alerts')) {
95
+ ui.error('infra/alerts kind not registered. Load a provider plugin (e.g. infra-cloudflare).');
96
+ requestCLIExit(1);
97
+ return;
98
+ }
99
+ const descriptors = runtime.assets('infra/alerts').descriptors() as InfraAlertsDescriptor[];
100
+ const target = providerFilter
101
+ ? descriptors.find((d) => d.adapter === providerFilter || d.id === providerFilter)
102
+ : descriptors[0];
103
+
104
+ if (!target) {
105
+ ui.error(
106
+ `No matching alerts provider${providerFilter ? ` for --provider "${providerFilter}"` : ''}.`
107
+ );
108
+ requestCLIExit(1);
109
+ return;
110
+ }
111
+
112
+ try {
113
+ const impl = (await runtime
114
+ .query('infra/alerts')
115
+ .withId(target.id)
116
+ .resolve()) as AlertsImplementation;
117
+ const { providerId } = await impl.createPolicy(policy);
118
+
119
+ if (output === 'json') {
120
+ ui.json({ provider: target.adapter, providerId, policy });
121
+ } else {
122
+ ui.success(
123
+ `Created ${type} policy "${name}" on ${target.adapter} → providerId=${providerId}`
124
+ );
125
+ }
126
+ } catch (err) {
127
+ ui.error(`Failed to create policy: ${err instanceof Error ? err.message : String(err)}`);
128
+ requestCLIExit(1);
129
+ }
130
+ }
131
+ };
@@ -0,0 +1,36 @@
1
+ import { createRuntimeAsset } from '@vibesdotdev/runtime';
2
+
3
+ export default createRuntimeAsset({
4
+ id: 'infra-alerts.delete',
5
+ kind: 'cli/command',
6
+ name: 'delete',
7
+ description: 'Delete an alert policy by provider id',
8
+ group: 'infra-alerts',
9
+ arguments: [
10
+ {
11
+ name: 'providerId',
12
+ description: 'Policy id on the provider (from `vibes infra alerts list`)',
13
+ required: true,
14
+ variadic: false
15
+ }
16
+ ],
17
+ options: [
18
+ {
19
+ flags: '--provider <id>',
20
+ description: 'Provider impl id (default: cloudflare-alerts when available)'
21
+ },
22
+ {
23
+ flags: '-y, --yes',
24
+ description: 'Skip confirmation prompt',
25
+ default: false
26
+ },
27
+ {
28
+ flags: '-o, --output <format>',
29
+ description: 'Output format (text|json)',
30
+ default: 'text'
31
+ }
32
+ ],
33
+ surfaces: ['cli'],
34
+ hardware: ['consumer', 'cloud'],
35
+ enabled: true
36
+ });
@@ -0,0 +1,75 @@
1
+ /**
2
+ * `vibes infra alerts delete <providerId>`
3
+ *
4
+ * Deletes a policy on the chosen provider. Requires explicit
5
+ * confirmation unless `--yes` is passed.
6
+ */
7
+
8
+ import { getVibesRuntime } from '@vibesdotdev/runtime';
9
+ import { requestCLIExit, type UIContext } from '@vibesdotdev/cli/providers';
10
+ import type { AlertsImplementation, InfraAlertsDescriptor } from '@vibesdotdev/infra-core/kinds';
11
+
12
+ function readString(v: unknown): string | undefined {
13
+ return typeof v === 'string' && v.length > 0 ? v : undefined;
14
+ }
15
+
16
+ function readBoolean(v: unknown): boolean {
17
+ return v === true || v === 'true';
18
+ }
19
+
20
+ export default {
21
+ async execute(args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void> {
22
+ const runtime = await getVibesRuntime();
23
+ const ui = (await runtime.context('cli/ui')) as UIContext;
24
+
25
+ const providerId = readString(args.providerId);
26
+ if (!providerId) {
27
+ ui.error('A providerId is required. List policies with `vibes infra alerts list` first.');
28
+ requestCLIExit(1);
29
+ return;
30
+ }
31
+ const providerFilter = readString(opts.provider);
32
+ const yes = readBoolean(opts.yes);
33
+ const output = readString(opts.output) ?? 'text';
34
+
35
+ if (!runtime.hasKind('infra/alerts')) {
36
+ ui.error('infra/alerts kind not registered.');
37
+ requestCLIExit(1);
38
+ return;
39
+ }
40
+ const descriptors = runtime.assets('infra/alerts').descriptors() as InfraAlertsDescriptor[];
41
+ const target = providerFilter
42
+ ? descriptors.find((d) => d.adapter === providerFilter || d.id === providerFilter)
43
+ : descriptors[0];
44
+ if (!target) {
45
+ ui.error('No matching alerts provider.');
46
+ requestCLIExit(1);
47
+ return;
48
+ }
49
+
50
+ if (!yes) {
51
+ ui.warn(
52
+ `About to delete alert policy "${providerId}" on ${target.adapter}. ` +
53
+ 'Re-run with --yes to confirm.'
54
+ );
55
+ requestCLIExit(0);
56
+ return;
57
+ }
58
+
59
+ try {
60
+ const impl = (await runtime
61
+ .query('infra/alerts')
62
+ .withId(target.id)
63
+ .resolve()) as AlertsImplementation;
64
+ await impl.deletePolicy(providerId);
65
+ if (output === 'json') {
66
+ ui.json({ deleted: providerId, provider: target.adapter });
67
+ } else {
68
+ ui.success(`Deleted policy ${providerId} on ${target.adapter}`);
69
+ }
70
+ } catch (err) {
71
+ ui.error(`Delete failed: ${err instanceof Error ? err.message : String(err)}`);
72
+ requestCLIExit(1);
73
+ }
74
+ }
75
+ };
@@ -0,0 +1,27 @@
1
+ import { createRuntimeAsset } from '@vibesdotdev/runtime';
2
+
3
+ export default createRuntimeAsset({
4
+ id: 'infra-alerts.list',
5
+ kind: 'cli/command',
6
+ name: 'list',
7
+ description: 'List configured alert policies across providers',
8
+ group: 'infra-alerts',
9
+ options: [
10
+ {
11
+ flags: '--provider <id>',
12
+ description: 'Restrict to a single provider impl id (e.g. cloudflare-alerts)'
13
+ },
14
+ {
15
+ flags: '--environment <name>',
16
+ description: 'Vibes environment for secret resolution (local|dev|staging|production)'
17
+ },
18
+ {
19
+ flags: '-o, --output <format>',
20
+ description: 'Output format (text|json)',
21
+ default: 'text'
22
+ }
23
+ ],
24
+ surfaces: ['cli'],
25
+ hardware: ['consumer', 'cloud'],
26
+ enabled: true
27
+ });
@@ -0,0 +1,88 @@
1
+ /**
2
+ * `vibes infra alerts list`
3
+ *
4
+ * Walks all registered `infra/alerts` implementations and prints the
5
+ * combined set of live policies on each provider. `--output json`
6
+ * returns a structured payload for piping; default is a table.
7
+ */
8
+
9
+ import { getVibesRuntime } from '@vibesdotdev/runtime';
10
+ import { requestCLIExit, type UIContext } from '@vibesdotdev/cli/providers';
11
+ import type { AlertsImplementation, AlertPolicy, InfraAlertsDescriptor } from '@vibesdotdev/infra-core/kinds';
12
+
13
+ function readString(v: unknown): string | undefined {
14
+ return typeof v === 'string' && v.length > 0 ? v : undefined;
15
+ }
16
+
17
+ interface ProviderResult {
18
+ providerId: string;
19
+ descriptorId: string;
20
+ policies: Array<AlertPolicy & { providerId: string }>;
21
+ error?: string;
22
+ }
23
+
24
+ export default {
25
+ async execute(_args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void> {
26
+ const runtime = await getVibesRuntime();
27
+ const ui = (await runtime.context('cli/ui')) as UIContext;
28
+
29
+ const providerFilter = readString(opts.provider);
30
+ const output = readString(opts.output) ?? 'text';
31
+
32
+ if (!runtime.hasKind('infra/alerts')) {
33
+ ui.warn('No infra/alerts kind registered. Ensure infra-cloudflare or sibling provider plugin is loaded.');
34
+ requestCLIExit(0);
35
+ return;
36
+ }
37
+
38
+ const descriptors = runtime.assets('infra/alerts').descriptors() as InfraAlertsDescriptor[];
39
+ if (descriptors.length === 0) {
40
+ if (output === 'json') ui.json([]);
41
+ else ui.info('No infra/alerts descriptors registered. Add a provider plugin (e.g. infra-cloudflare).');
42
+ return;
43
+ }
44
+
45
+ const results: ProviderResult[] = [];
46
+ for (const d of descriptors) {
47
+ if (providerFilter && d.adapter !== providerFilter && d.id !== providerFilter) continue;
48
+ try {
49
+ const impl = (await runtime
50
+ .query('infra/alerts')
51
+ .withId(d.id)
52
+ .resolve()) as AlertsImplementation;
53
+ const policies = await impl.listPolicies();
54
+ results.push({ providerId: d.adapter, descriptorId: d.id, policies });
55
+ } catch (err) {
56
+ results.push({
57
+ providerId: d.adapter,
58
+ descriptorId: d.id,
59
+ policies: [],
60
+ error: err instanceof Error ? err.message : String(err)
61
+ });
62
+ }
63
+ }
64
+
65
+ if (output === 'json') {
66
+ ui.json(results);
67
+ return;
68
+ }
69
+
70
+ for (const r of results) {
71
+ ui.info(`\n[${r.providerId}] (${r.descriptorId})`);
72
+ if (r.error) {
73
+ ui.error(` ${r.error}`);
74
+ continue;
75
+ }
76
+ if (r.policies.length === 0) {
77
+ ui.info(' (no policies configured)');
78
+ continue;
79
+ }
80
+ for (const p of r.policies) {
81
+ const mech = p.mechanisms.map((m) => `${m.kind}:${m.target}`).join(', ');
82
+ ui.info(
83
+ ` ${(p.enabled ? '✓' : '✗')} ${p.type.padEnd(12)} ${p.name.padEnd(40)} threshold=${p.threshold} → ${mech}`
84
+ );
85
+ }
86
+ }
87
+ }
88
+ };
@@ -0,0 +1,12 @@
1
+ import { createRuntimeAsset } from '@vibesdotdev/runtime';
2
+
3
+ export default createRuntimeAsset({
4
+ id: 'infra-alerts',
5
+ kind: 'cli/group',
6
+ name: 'alerts',
7
+ description: 'Provider-agnostic alerting / notification policies (CF Notifications, DO Monitoring, …)',
8
+ parent: 'infra',
9
+ surfaces: ['cli'],
10
+ hardware: ['consumer', 'cloud'],
11
+ enabled: true
12
+ });
@@ -0,0 +1,28 @@
1
+ import { createRuntimeAsset } from '@vibesdotdev/runtime';
2
+
3
+ export default createRuntimeAsset({
4
+ id: 'infra-audit',
5
+ kind: 'cli/command',
6
+ name: 'audit',
7
+ description: 'Read-only sweep: workers/logs/alerts/RUM status across all registered providers',
8
+ group: 'infra',
9
+ options: [
10
+ {
11
+ flags: '--provider <id>',
12
+ description: 'Restrict to a single provider impl id'
13
+ },
14
+ {
15
+ flags: '--include <kinds>',
16
+ description: 'Comma-separated subset of kinds to audit (alerts,logs,observability,workers,rum)',
17
+ default: 'alerts,logs,observability'
18
+ },
19
+ {
20
+ flags: '-o, --output <format>',
21
+ description: 'Output format (text|json)',
22
+ default: 'text'
23
+ }
24
+ ],
25
+ surfaces: ['cli'],
26
+ hardware: ['consumer', 'cloud'],
27
+ enabled: true
28
+ });