@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.
- package/README.md +125 -0
- package/SPEC.md +181 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.d.ts +39 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.js +61 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.descriptor.js.map +1 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.impl.d.ts +13 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.impl.js +109 -0
- package/dist/cli/alerts/infra-alerts-create.cli-command.impl.js.map +1 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.d.ts +31 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.js +36 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.descriptor.js.map +1 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.d.ts +11 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.js +67 -0
- package/dist/cli/alerts/infra-alerts-delete.cli-command.impl.js.map +1 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.d.ts +21 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.js +27 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.descriptor.js.map +1 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.impl.d.ts +12 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.impl.js +74 -0
- package/dist/cli/alerts/infra-alerts-list.cli-command.impl.js.map +1 -0
- package/dist/cli/alerts/infra-alerts.cli-group.descriptor.d.ts +12 -0
- package/dist/cli/alerts/infra-alerts.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/alerts/infra-alerts.cli-group.descriptor.js +12 -0
- package/dist/cli/alerts/infra-alerts.cli-group.descriptor.js.map +1 -0
- package/dist/cli/audit/infra-audit.cli-command.descriptor.d.ts +21 -0
- package/dist/cli/audit/infra-audit.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/audit/infra-audit.cli-command.descriptor.js +28 -0
- package/dist/cli/audit/infra-audit.cli-command.descriptor.js.map +1 -0
- package/dist/cli/audit/infra-audit.cli-command.impl.d.ts +18 -0
- package/dist/cli/audit/infra-audit.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/audit/infra-audit.cli-command.impl.js +219 -0
- package/dist/cli/audit/infra-audit.cli-command.impl.js.map +1 -0
- package/dist/cli/infra-deploy.cli-group.descriptor.d.ts +12 -0
- package/dist/cli/infra-deploy.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/infra-deploy.cli-group.descriptor.js +12 -0
- package/dist/cli/infra-deploy.cli-group.descriptor.js.map +1 -0
- package/dist/cli/infra.cli-group.descriptor.d.ts +11 -0
- package/dist/cli/infra.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/infra.cli-group.descriptor.js +11 -0
- package/dist/cli/infra.cli-group.descriptor.js.map +1 -0
- package/dist/cli/list/infra-deploy.list.cli-command.descriptor.d.ts +34 -0
- package/dist/cli/list/infra-deploy.list.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/list/infra-deploy.list.cli-command.descriptor.js +29 -0
- package/dist/cli/list/infra-deploy.list.cli-command.descriptor.js.map +1 -0
- package/dist/cli/list/infra-deploy.list.cli-command.impl.d.ts +5 -0
- package/dist/cli/list/infra-deploy.list.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/list/infra-deploy.list.cli-command.impl.js +110 -0
- package/dist/cli/list/infra-deploy.list.cli-command.impl.js.map +1 -0
- package/dist/cli/logs/infra-logs.cli-command.descriptor.d.ts +39 -0
- package/dist/cli/logs/infra-logs.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/logs/infra-logs.cli-command.descriptor.js +64 -0
- package/dist/cli/logs/infra-logs.cli-command.descriptor.js.map +1 -0
- package/dist/cli/logs/infra-logs.cli-command.impl.d.ts +5 -0
- package/dist/cli/logs/infra-logs.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/logs/infra-logs.cli-command.impl.js +323 -0
- package/dist/cli/logs/infra-logs.cli-command.impl.js.map +1 -0
- package/dist/cli/logs/stream-worker-tail.d.ts +62 -0
- package/dist/cli/logs/stream-worker-tail.d.ts.map +1 -0
- package/dist/cli/logs/stream-worker-tail.js +165 -0
- package/dist/cli/logs/stream-worker-tail.js.map +1 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.d.ts +27 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.js +75 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.descriptor.js.map +1 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.impl.d.ts +5 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.impl.js +383 -0
- package/dist/cli/npm/infra-npm-publish.cli-command.impl.js.map +1 -0
- package/dist/cli/npm/infra-npm.cli-group.descriptor.d.ts +12 -0
- package/dist/cli/npm/infra-npm.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/npm/infra-npm.cli-group.descriptor.js +12 -0
- package/dist/cli/npm/infra-npm.cli-group.descriptor.js.map +1 -0
- package/dist/cli/observability/infra-observability-set.cli-command.descriptor.d.ts +25 -0
- package/dist/cli/observability/infra-observability-set.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/observability/infra-observability-set.cli-command.descriptor.js +57 -0
- package/dist/cli/observability/infra-observability-set.cli-command.descriptor.js.map +1 -0
- package/dist/cli/observability/infra-observability-set.cli-command.impl.d.ts +17 -0
- package/dist/cli/observability/infra-observability-set.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/observability/infra-observability-set.cli-command.impl.js +152 -0
- package/dist/cli/observability/infra-observability-set.cli-command.impl.js.map +1 -0
- package/dist/cli/observability/infra-observability-status.cli-command.descriptor.d.ts +21 -0
- package/dist/cli/observability/infra-observability-status.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/observability/infra-observability-status.cli-command.descriptor.js +35 -0
- package/dist/cli/observability/infra-observability-status.cli-command.descriptor.js.map +1 -0
- package/dist/cli/observability/infra-observability-status.cli-command.impl.d.ts +17 -0
- package/dist/cli/observability/infra-observability-status.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/observability/infra-observability-status.cli-command.impl.js +99 -0
- package/dist/cli/observability/infra-observability-status.cli-command.impl.js.map +1 -0
- package/dist/cli/observability/infra-observability.cli-group.descriptor.d.ts +12 -0
- package/dist/cli/observability/infra-observability.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/observability/infra-observability.cli-group.descriptor.js +12 -0
- package/dist/cli/observability/infra-observability.cli-group.descriptor.js.map +1 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.d.ts +27 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.js +35 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.js.map +1 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.d.ts +5 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.js +99 -0
- package/dist/cli/regenerate/infra-deploy.regenerate.cli-command.impl.js.map +1 -0
- package/dist/cli/rum/infra-rum-status.cli-command.descriptor.d.ts +21 -0
- package/dist/cli/rum/infra-rum-status.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/rum/infra-rum-status.cli-command.descriptor.js +27 -0
- package/dist/cli/rum/infra-rum-status.cli-command.descriptor.js.map +1 -0
- package/dist/cli/rum/infra-rum-status.cli-command.impl.d.ts +12 -0
- package/dist/cli/rum/infra-rum-status.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/rum/infra-rum-status.cli-command.impl.js +88 -0
- package/dist/cli/rum/infra-rum-status.cli-command.impl.js.map +1 -0
- package/dist/cli/rum/infra-rum.cli-group.descriptor.d.ts +12 -0
- package/dist/cli/rum/infra-rum.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/rum/infra-rum.cli-group.descriptor.js +12 -0
- package/dist/cli/rum/infra-rum.cli-group.descriptor.js.map +1 -0
- package/dist/cli/run/infra-deploy.run.cli-command.descriptor.d.ts +27 -0
- package/dist/cli/run/infra-deploy.run.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/run/infra-deploy.run.cli-command.descriptor.js +49 -0
- package/dist/cli/run/infra-deploy.run.cli-command.descriptor.js.map +1 -0
- package/dist/cli/run/infra-deploy.run.cli-command.impl.d.ts +5 -0
- package/dist/cli/run/infra-deploy.run.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/run/infra-deploy.run.cli-command.impl.js +272 -0
- package/dist/cli/run/infra-deploy.run.cli-command.impl.js.map +1 -0
- package/dist/cli/shared/discover-deployments.d.ts +41 -0
- package/dist/cli/shared/discover-deployments.d.ts.map +1 -0
- package/dist/cli/shared/discover-deployments.js +95 -0
- package/dist/cli/shared/discover-deployments.js.map +1 -0
- package/dist/config-loader.d.ts +24 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +135 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/infra-deploy.plugin.d.ts +3 -0
- package/dist/infra-deploy.plugin.d.ts.map +1 -0
- package/dist/infra-deploy.plugin.js +59 -0
- package/dist/infra-deploy.plugin.js.map +1 -0
- package/dist/regenerate.d.ts +55 -0
- package/dist/regenerate.d.ts.map +1 -0
- package/dist/regenerate.js +206 -0
- package/dist/regenerate.js.map +1 -0
- package/package.json +85 -0
- package/src/cli/alerts/infra-alerts-create.cli-command.descriptor.ts +61 -0
- package/src/cli/alerts/infra-alerts-create.cli-command.impl.ts +131 -0
- package/src/cli/alerts/infra-alerts-delete.cli-command.descriptor.ts +36 -0
- package/src/cli/alerts/infra-alerts-delete.cli-command.impl.ts +75 -0
- package/src/cli/alerts/infra-alerts-list.cli-command.descriptor.ts +27 -0
- package/src/cli/alerts/infra-alerts-list.cli-command.impl.ts +88 -0
- package/src/cli/alerts/infra-alerts.cli-group.descriptor.ts +12 -0
- package/src/cli/audit/infra-audit.cli-command.descriptor.ts +28 -0
- package/src/cli/audit/infra-audit.cli-command.impl.ts +293 -0
- package/src/cli/infra-deploy.cli-group.descriptor.ts +12 -0
- package/src/cli/infra.cli-group.descriptor.ts +11 -0
- package/src/cli/list/infra-deploy.list.cli-command.descriptor.ts +29 -0
- package/src/cli/list/infra-deploy.list.cli-command.impl.ts +125 -0
- package/src/cli/logs/infra-logs.cli-command.descriptor.ts +65 -0
- package/src/cli/logs/infra-logs.cli-command.impl.ts +354 -0
- package/src/cli/logs/stream-worker-tail.ts +202 -0
- package/src/cli/npm/infra-npm-publish.cli-command.descriptor.ts +75 -0
- package/src/cli/npm/infra-npm-publish.cli-command.impl.ts +474 -0
- package/src/cli/npm/infra-npm.cli-group.descriptor.ts +12 -0
- package/src/cli/observability/infra-observability-set.cli-command.descriptor.ts +57 -0
- package/src/cli/observability/infra-observability-set.cli-command.impl.ts +173 -0
- package/src/cli/observability/infra-observability-status.cli-command.descriptor.ts +35 -0
- package/src/cli/observability/infra-observability-status.cli-command.impl.ts +124 -0
- package/src/cli/observability/infra-observability.cli-group.descriptor.ts +12 -0
- package/src/cli/regenerate/infra-deploy.regenerate.cli-command.descriptor.ts +36 -0
- package/src/cli/regenerate/infra-deploy.regenerate.cli-command.impl.ts +103 -0
- package/src/cli/rum/infra-rum-status.cli-command.descriptor.ts +27 -0
- package/src/cli/rum/infra-rum-status.cli-command.impl.ts +112 -0
- package/src/cli/rum/infra-rum.cli-group.descriptor.ts +12 -0
- package/src/cli/run/infra-deploy.run.cli-command.descriptor.ts +49 -0
- package/src/cli/run/infra-deploy.run.cli-command.impl.ts +330 -0
- package/src/cli/shared/discover-deployments.ts +127 -0
- package/src/config-loader.ts +179 -0
- package/src/index.ts +11 -0
- package/src/infra-deploy.plugin.ts +83 -0
- package/src/regenerate.ts +230 -0
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# `@vibesdotdev/infra-deploy`
|
|
2
|
+
|
|
3
|
+
User-facing infra-deploy surface for the vibes CLI. Authors write a
|
|
4
|
+
`deployment.config.ts` next to their app; this package loads it and dispatches
|
|
5
|
+
to a provider adapter that wraps the real provider tooling. Used both by
|
|
6
|
+
end-users deploying their own apps to their own clouds, and by vibes itself
|
|
7
|
+
to dogfood internal deploys.
|
|
8
|
+
|
|
9
|
+
See [`SPEC.md`](./SPEC.md) for the contract.
|
|
10
|
+
|
|
11
|
+
> Commands are available under `vibes infra deploy …`.
|
|
12
|
+
|
|
13
|
+
## What's in here
|
|
14
|
+
|
|
15
|
+
- `src/infra-deploy.plugin.ts` — `runtime/plugin` registering the `infra-deploy` CLI
|
|
16
|
+
group plus `infra-deploy.run` and `infra-deploy.list` commands and their loaders.
|
|
17
|
+
- `src/config-loader.ts` — `loadDeploymentConfig(appDir)` resolves
|
|
18
|
+
`deployment.config.{ts,js,mjs}`, validates the export, and returns the
|
|
19
|
+
loaded shape used by every provider.
|
|
20
|
+
- `src/providers/cloudflare-workers.ts` — `deployCloudflareWorkers()` shells
|
|
21
|
+
out to `bunx wrangler deploy --cwd <appDir>` from the workspace root.
|
|
22
|
+
- `src/providers/digitalocean-app.ts` — `deployDigitalOceanApp()` calls the
|
|
23
|
+
DigitalOcean App Platform REST API v2 directly (no `doctl` dependency).
|
|
24
|
+
Requires `DIGITALOCEAN_API_TOKEN`.
|
|
25
|
+
- `src/cli/` — `cli/group` and `cli/command` descriptors + impls for the
|
|
26
|
+
user-facing CLI surface.
|
|
27
|
+
|
|
28
|
+
## Common usage
|
|
29
|
+
|
|
30
|
+
Authoring a per-app deployment config (in
|
|
31
|
+
`apps/<app>/deployment.config.ts`):
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { createAppDeployment } from '@vibesdotdev/infra-core/deployment';
|
|
35
|
+
|
|
36
|
+
export default createAppDeployment({
|
|
37
|
+
appId: 'my-app',
|
|
38
|
+
appName: 'My App',
|
|
39
|
+
provider: 'cloudflare-workers',
|
|
40
|
+
runtime: 'edge',
|
|
41
|
+
build: {
|
|
42
|
+
appDir: 'apps/my-app',
|
|
43
|
+
outputDir: 'apps/my-app/.svelte-kit/cloudflare',
|
|
44
|
+
buildCommand: 'bun run build:my-app',
|
|
45
|
+
workspaceRootDir: '.'
|
|
46
|
+
},
|
|
47
|
+
origins: [/* ... */],
|
|
48
|
+
env: [/* ... */]
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Deploying from the CLI:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# List every app under cwd that has a deployment.config.{ts,js,mjs}
|
|
56
|
+
vibes infra deploy list
|
|
57
|
+
|
|
58
|
+
# Deploy a specific app
|
|
59
|
+
vibes infra deploy run apps/my-app
|
|
60
|
+
|
|
61
|
+
# Show the resolved provider request without uploading
|
|
62
|
+
vibes infra deploy run apps/my-app --dry-run
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Publishing npm packages through the same infra/secrets path:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Store the token in the configured vibes secrets backend
|
|
69
|
+
vibes secrets set NPM_TOKEN --environment production
|
|
70
|
+
|
|
71
|
+
# Check the exact publish operation without requiring a token
|
|
72
|
+
vibes infra npm publish packages/cli-bin packages/vibesdev --dry-run
|
|
73
|
+
|
|
74
|
+
# Publish with a token resolved from vibes secrets
|
|
75
|
+
vibes infra npm publish packages/cli-bin packages/vibesdev --environment production --yes
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`vibes infra npm publish` packs each package first, then publishes the packed
|
|
79
|
+
tarball from a temporary directory with a one-time npm config. The npm token is
|
|
80
|
+
resolved from `vibes secrets` and is not written to the repo or a persistent
|
|
81
|
+
user-level npm config. For local operator publishes targeting production, the
|
|
82
|
+
command can read a production-scoped token from the encrypted-local backend.
|
|
83
|
+
|
|
84
|
+
If a publish token needs to be available to a remote runner, sync only that
|
|
85
|
+
key and dry-run first:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
vibes secrets push --environment production --from encrypted-local --to cloudflare-secrets-store --key NPM_TOKEN --dry-run
|
|
89
|
+
vibes secrets push --environment production --from encrypted-local --to cloudflare-secrets-store --key NPM_TOKEN
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Pulling back from remote only works with backends that expose secret values
|
|
93
|
+
(for example Vault). Cloudflare secrets backends are write-only:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
vibes secrets pull --environment production --from vault --to encrypted-local --key NPM_TOKEN --dry-run
|
|
97
|
+
vibes secrets pull --environment production --from vault --to encrypted-local --key NPM_TOKEN
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Calling a provider directly (rare — most consumers should go through the CLI
|
|
101
|
+
or the plugin):
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { loadDeploymentConfig } from '@vibesdotdev/infra-deploy/config-loader';
|
|
105
|
+
import { deployCloudflareWorkers } from '@vibesdotdev/infra-deploy/providers/cloudflare-workers';
|
|
106
|
+
|
|
107
|
+
const loaded = await loadDeploymentConfig('apps/my-app');
|
|
108
|
+
if (loaded.provider === 'cloudflare-workers') {
|
|
109
|
+
await deployCloudflareWorkers({
|
|
110
|
+
appDir: loaded.appDir,
|
|
111
|
+
deployment: loaded.deployment,
|
|
112
|
+
raw: loaded.raw
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Required environment
|
|
118
|
+
|
|
119
|
+
- **Cloudflare Workers** — `bunx wrangler` must resolve, and wrangler must be
|
|
120
|
+
authenticated (`wrangler login` or `CLOUDFLARE_API_TOKEN`).
|
|
121
|
+
- **DigitalOcean App Platform** — `DIGITALOCEAN_API_TOKEN` must be set on
|
|
122
|
+
the process. Generate a token at
|
|
123
|
+
[cloud.digitalocean.com/account/api/tokens](https://cloud.digitalocean.com/account/api/tokens).
|
|
124
|
+
- **npm publish** — `NPM_TOKEN` must be set in `vibes secrets` for the selected
|
|
125
|
+
environment, or present in the process environment for CI.
|
package/SPEC.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# `@vibesdotdev/infra-deploy`
|
|
2
|
+
|
|
3
|
+
User-facing infra-deploy surface for the vibes CLI. Anyone running `vibes` can
|
|
4
|
+
declare a `deployment.config.ts` for their own app and ship it to their own
|
|
5
|
+
cloud account — the package loads the config, **resolves the right
|
|
6
|
+
`runtime/client` for the declared provider**, and asks it to run the deploy.
|
|
7
|
+
Registered as a `runtime/plugin` consumed by
|
|
8
|
+
[`apps/cli-bin`](../../apps/cli-bin/SPEC.md). Vibes uses the same surface to
|
|
9
|
+
dogfood its own deploys. Commands are available under `vibes infra deploy …`.
|
|
10
|
+
npm publishing support is available under `vibes infra npm …`.
|
|
11
|
+
|
|
12
|
+
## Owns
|
|
13
|
+
|
|
14
|
+
- `runtime/plugin` (`infra-deploy`): registers `cli/group` `infra-deploy` and `cli/command`
|
|
15
|
+
descriptors `infra-deploy.run`, `infra-deploy.list`, `infra-deploy.regenerate`,
|
|
16
|
+
`infra-logs`, plus `cli/group` `infra-npm` and `cli/command`
|
|
17
|
+
`infra-npm.publish`
|
|
18
|
+
- **Config loader** (`./config-loader`): resolves
|
|
19
|
+
`deployment.config.{ts,js,mjs}` from an app dir, validates the exported
|
|
20
|
+
`AppDeployment`, returns
|
|
21
|
+
`{ configPath, appDir, deployment, provider, raw, managed, wranglerJsoncString, workerName }`
|
|
22
|
+
- **wrangler.jsonc regen orchestrator** (`./regenerate`): `regenerateApp`,
|
|
23
|
+
`regenerateAll`, `regenExitCode`. Used by the CLI's
|
|
24
|
+
`vibes infra deploy regenerate` command and as the pre-deploy drift gate
|
|
25
|
+
in the CLI run handler. Comparison is read-only by default; `--write`
|
|
26
|
+
rewrites the on-disk file.
|
|
27
|
+
- **CLI dispatch** (`./cli/run`): translates an `AppDeployment` plus operator
|
|
28
|
+
flags into the right `runtime/client` call. The dispatch knows the
|
|
29
|
+
provider → client-id map and nothing about provider internals:
|
|
30
|
+
- `provider: 'cloudflare-workers'` →
|
|
31
|
+
`getCloudflareWorkersDeployClient()` (from
|
|
32
|
+
`@vibesdotdev/connector-cloudflare/client`, runtime-client id
|
|
33
|
+
`cloudflare-workers-deploy`)
|
|
34
|
+
- `provider: 'digitalocean-app'` →
|
|
35
|
+
`getDigitalOceanAppDeployClient()` (from
|
|
36
|
+
`@vibesdotdev/infra-doks/client`, runtime-client id
|
|
37
|
+
`digitalocean-app-deploy`)
|
|
38
|
+
- **Deployment-run records** (`storage/manifest<DeploymentRun>` id `infra-deploy.deployment-runs`): both
|
|
39
|
+
provider dispatch arms write a `DeploymentRun` row on dispatch — `{ appId,
|
|
40
|
+
provider, status: 'started' | 'succeeded' | 'failed', startedAt, finishedAt,
|
|
41
|
+
actorScope, deploymentConfigHash, providerResourceId, logsRef }`. Reads via
|
|
42
|
+
`runtime.query('storage/manifest').withId('infra-deploy.deployment-runs')`.
|
|
43
|
+
The manifest is registered by this package's plugin so any consumer (admin
|
|
44
|
+
UI, `vibes infra deploy list`, MCP) resolves it through runtime.
|
|
45
|
+
- **npm publish command** (`./cli/npm`): packs package directories, resolves an
|
|
46
|
+
npm token through `secrets/store`, writes a temporary npm config outside the
|
|
47
|
+
repo, publishes the tarball with npm, and deletes the temporary config.
|
|
48
|
+
|
|
49
|
+
## Does not own
|
|
50
|
+
|
|
51
|
+
- `AppDeployment` schema → [`infra-core`](../infra-core/SPEC.md)
|
|
52
|
+
(`@vibesdotdev/infra-core/deployment`)
|
|
53
|
+
- Per-app `deployment.config.ts` files — each app (vibes-internal or
|
|
54
|
+
end-user) authors its own
|
|
55
|
+
- **The actual wrangler invocation** —
|
|
56
|
+
[`@vibesdotdev/connector-cloudflare`](../connector-cloudflare) owns the
|
|
57
|
+
`CloudflareWorkersDeployClient` (`runtime/client` id
|
|
58
|
+
`cloudflare-workers-deploy`). `infra-deploy` resolves it via
|
|
59
|
+
`getCloudflareWorkersDeployClient()`; it never imports
|
|
60
|
+
`node:child_process` or shells out to `wrangler` directly.
|
|
61
|
+
- **The actual DigitalOcean App Platform API call** —
|
|
62
|
+
[`@vibesdotdev/infra-doks`](../infra-doks/SPEC.md) owns the
|
|
63
|
+
`DigitalOceanAppDeployClient` (`runtime/client` id
|
|
64
|
+
`digitalocean-app-deploy`). `infra-deploy` resolves it via
|
|
65
|
+
`getDigitalOceanAppDeployClient()`; it never calls
|
|
66
|
+
`https://api.digitalocean.com` directly.
|
|
67
|
+
- Cloudflare runtime + tooling primitives →
|
|
68
|
+
[`infra-cloudflare`](../infra-cloudflare/SPEC.md)
|
|
69
|
+
- DigitalOcean infrastructure primitives →
|
|
70
|
+
[`infra-doks`](../infra-doks/SPEC.md)
|
|
71
|
+
- App build pipelines — the resolved deploy client runs each app's
|
|
72
|
+
`deployment.build.buildCommand` (or skips it when `skipBuild` is set)
|
|
73
|
+
- Long-lived cloud-account credentials → end-state pulls from
|
|
74
|
+
[`packages/secrets`](../secrets/SPEC.md) (see migration debt)
|
|
75
|
+
- CI/CD orchestration — this is a developer-local / ops-local CLI, not a
|
|
76
|
+
workflow runner
|
|
77
|
+
- Long-lived npm token files. `vibes infra npm publish` may create an
|
|
78
|
+
ephemeral npm config in the OS temp directory for the duration of a publish,
|
|
79
|
+
but it must not write a token to the workspace or user-level npm config.
|
|
80
|
+
|
|
81
|
+
## Hard rules
|
|
82
|
+
|
|
83
|
+
- Provider dispatch is driven by `deployment.provider` from the loaded config.
|
|
84
|
+
The CLI never branches on `hardware` / `connectionMode` / `isCloud`.
|
|
85
|
+
- Unsupported `provider` values are a hard failure: `ui.error` +
|
|
86
|
+
`process.exitCode = 1`. No silent default.
|
|
87
|
+
- Provider work resolves via `runtime/client` lookups. The CLI does not
|
|
88
|
+
import provider adapter code directly. Adding a new provider means:
|
|
89
|
+
(1) the owning package registers a `runtime/client` descriptor + loader,
|
|
90
|
+
(2) the owning package exposes a typed `getXyzDeployClient()` helper, and
|
|
91
|
+
(3) the CLI dispatch case calls that helper. No new `./providers/<name>.ts`
|
|
92
|
+
in this package.
|
|
93
|
+
- `loadDeploymentConfig` requires the resolved object to carry `appId` and a
|
|
94
|
+
string `provider`. Either missing is a hard failure.
|
|
95
|
+
- Pre-deploy regen gate is mandatory for Cloudflare: the CLI run handler
|
|
96
|
+
calls `regenerateApp(appDir, { mode: 'check' })` and refuses to deploy on
|
|
97
|
+
`drift` or `error`. The gate is opt-in (`managed: true`) per app until
|
|
98
|
+
every app is migrated.
|
|
99
|
+
- The package never redefines the `AppDeployment` schema. It imports the
|
|
100
|
+
type from `@vibesdotdev/infra-core/deployment`.
|
|
101
|
+
- Both provider dispatch arms MUST write a `DeploymentRun` row through the
|
|
102
|
+
`infra-deploy.deployment-runs` manifest before invoking the resolved
|
|
103
|
+
client (status `started`) and on return (status `succeeded` or `failed`).
|
|
104
|
+
A dispatch arm that runs without recording a run is a hard violation —
|
|
105
|
+
there is no second history store, and downstream surfaces
|
|
106
|
+
(`/admin/deployments`, `vibes infra deploy list`) read from this
|
|
107
|
+
manifest only.
|
|
108
|
+
- npm publish MUST pack first and publish the generated tarball from outside
|
|
109
|
+
the workspace so repo-level `.npmrc` settings cannot redirect public npm
|
|
110
|
+
packages to a private registry.
|
|
111
|
+
- npm publish MUST require `--yes` for real publishes. `--dry-run` is allowed
|
|
112
|
+
without a token.
|
|
113
|
+
- npm publish token remote sync, when needed, should use `vibes secrets push`
|
|
114
|
+
or `vibes secrets pull` with an explicit `--key NPM_TOKEN` filter and a
|
|
115
|
+
dry-run first. Cloudflare secrets backends are write-only and cannot be used
|
|
116
|
+
as pull sources for secret values.
|
|
117
|
+
|
|
118
|
+
## Migration debt (not yet executed)
|
|
119
|
+
|
|
120
|
+
- [x] **Rename.** `packages/deploy` → `packages/infra-deploy`;
|
|
121
|
+
`@vibesdotdev/deploy` → `@vibesdotdev/infra-deploy`.
|
|
122
|
+
- [x] **CLI re-parent.** Commands now live under
|
|
123
|
+
`vibes infra deploy run` / `vibes infra deploy list` /
|
|
124
|
+
`vibes infra deploy regenerate`.
|
|
125
|
+
- [x] **Dead flag.** `--commit-dirty` removed (was Pages-only; Pages provider
|
|
126
|
+
was removed).
|
|
127
|
+
- [x] **Wildcard subpath.** `./providers/*` removed from `package.json#exports`.
|
|
128
|
+
- [x] **Provider relocation.** `src/providers/*` deleted. Wrangler-invocation
|
|
129
|
+
logic moved to
|
|
130
|
+
`@vibesdotdev/connector-cloudflare/client/CloudflareWorkersDeployClient`;
|
|
131
|
+
DO App Platform logic moved to
|
|
132
|
+
`@vibesdotdev/infra-doks/client/DigitalOceanAppDeployClient`. Each is a
|
|
133
|
+
`runtime/client` descriptor registered by its owning plugin. The CLI run
|
|
134
|
+
handler resolves both via published helpers.
|
|
135
|
+
- **MCP / agent tool surface.** Provider operations (deploy, list, plus future
|
|
136
|
+
`link-cloud-account`) should also register as `tools/tool` descriptors with
|
|
137
|
+
`purpose: ['direct', 'mcp', 'agent']` per the pattern in
|
|
138
|
+
[`packages/tools`](../tools/SPEC.md)
|
|
139
|
+
(`tool-help.descriptor.ts:11-17`), so end-users and agents can invoke
|
|
140
|
+
deploys via MCP. Zero `tools/tool` descriptors exist in this package today.
|
|
141
|
+
- **Secrets integration.** `deployment.env` items marked `secret: true` are
|
|
142
|
+
forwarded as inline string values today by the DO client and ignored
|
|
143
|
+
entirely by the Cloudflare client. End-state: pull values via
|
|
144
|
+
[`packages/secrets`](../secrets/SPEC.md) and push them to provider secret
|
|
145
|
+
stores (`wrangler secret put` for Workers, `SECRET`-typed env on DO Apps).
|
|
146
|
+
Inline `value` should be the dev-only fallback, not the default. Lives
|
|
147
|
+
in the runtime-client implementations now.
|
|
148
|
+
- **Cloud-account credential brokerage.** `DigitalOceanAppDeployClient`
|
|
149
|
+
reads `process.env.DIGITALOCEAN_API_TOKEN` directly
|
|
150
|
+
(`packages/infra-doks/src/client/digitalocean-app-deploy.client.ts`).
|
|
151
|
+
The `digitalocean-droplet` impl in
|
|
152
|
+
[`infra-doks`](../infra-doks/SPEC.md) faces the identical problem (same
|
|
153
|
+
env fallback). End-state: end-users connect their own Cloudflare /
|
|
154
|
+
DigitalOcean accounts through vibes auth +
|
|
155
|
+
[`packages/secrets`](../secrets/SPEC.md); both `DigitalOceanAppDeployClient`
|
|
156
|
+
and `do-droplet` resolve a shared
|
|
157
|
+
`cloud-credentials.digitalocean.token` secret key per actor scope. The
|
|
158
|
+
Cloudflare path inherits whatever `wrangler` finds — same shape, same
|
|
159
|
+
problem.
|
|
160
|
+
|
|
161
|
+
## Public entrypoints
|
|
162
|
+
|
|
163
|
+
`.`, `./plugin`, `./config-loader`, `./regenerate`.
|
|
164
|
+
|
|
165
|
+
## Verification
|
|
166
|
+
|
|
167
|
+
`bun --bun tsc -p tsconfig.json --noEmit` (the package's `check` script).
|
|
168
|
+
Type-check only — no automated tests on disk; see
|
|
169
|
+
PROD-CHECKLIST.md for the gap list.
|
|
170
|
+
|
|
171
|
+
## Links
|
|
172
|
+
|
|
173
|
+
- [infra-core/SPEC.md](../infra-core/SPEC.md)
|
|
174
|
+
- [infra-cloudflare/SPEC.md](../infra-cloudflare/SPEC.md)
|
|
175
|
+
- [infra-doks/SPEC.md](../infra-doks/SPEC.md)
|
|
176
|
+
- [connector-cloudflare](../connector-cloudflare)
|
|
177
|
+
- [secrets/SPEC.md](../secrets/SPEC.md)
|
|
178
|
+
- [tools/SPEC.md](../tools/SPEC.md)
|
|
179
|
+
- [runtime/SPEC.md](../runtime/SPEC.md)
|
|
180
|
+
- [cli/SPEC.md](../cli/SPEC.md)
|
|
181
|
+
- [cli-bin/SPEC.md](../../apps/cli-bin/SPEC.md)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
id: string;
|
|
3
|
+
kind: "cli/command";
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
group: string;
|
|
7
|
+
arguments: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
variadic: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
options: ({
|
|
14
|
+
flags: string;
|
|
15
|
+
description: string;
|
|
16
|
+
default?: undefined;
|
|
17
|
+
variadic?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
flags: string;
|
|
20
|
+
description: string;
|
|
21
|
+
default: string;
|
|
22
|
+
variadic?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
flags: string;
|
|
25
|
+
description: string;
|
|
26
|
+
variadic: boolean;
|
|
27
|
+
default?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
flags: string;
|
|
30
|
+
description: string;
|
|
31
|
+
default: boolean;
|
|
32
|
+
variadic?: undefined;
|
|
33
|
+
})[];
|
|
34
|
+
surfaces: string[];
|
|
35
|
+
hardware: string[];
|
|
36
|
+
enabled: true;
|
|
37
|
+
};
|
|
38
|
+
export default _default;
|
|
39
|
+
//# sourceMappingURL=infra-alerts-create.cli-command.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra-alerts-create.cli-command.descriptor.d.ts","sourceRoot":"","sources":["../../../src/cli/alerts/infra-alerts-create.cli-command.descriptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBA0DG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createRuntimeAsset } from '@vibesdotdev/runtime';
|
|
2
|
+
export default createRuntimeAsset({
|
|
3
|
+
id: 'infra-alerts.create',
|
|
4
|
+
kind: 'cli/command',
|
|
5
|
+
name: 'create',
|
|
6
|
+
description: 'Create a new alert policy on the active provider',
|
|
7
|
+
group: 'infra-alerts',
|
|
8
|
+
arguments: [
|
|
9
|
+
{
|
|
10
|
+
name: 'type',
|
|
11
|
+
description: 'Alert type: budget | usage | error-rate | latency | custom',
|
|
12
|
+
required: true,
|
|
13
|
+
variadic: false
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
options: [
|
|
17
|
+
{ flags: '--name <name>', description: 'Policy name (defaults to "<type> alert: <threshold>")' },
|
|
18
|
+
{
|
|
19
|
+
flags: '--threshold <n>',
|
|
20
|
+
description: 'Threshold value (USD for budget; events/req/% per usage/error-rate)',
|
|
21
|
+
default: '50'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
flags: '--window <window>',
|
|
25
|
+
description: 'Rolling window for usage/error-rate/latency (5m, 15m, 1h, 6h, 24h, 7d, 30d)'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
flags: '--filter <k=v>',
|
|
29
|
+
description: 'Adapter-specific filter (repeatable, e.g. --filter product=workers_observability_paid_events)',
|
|
30
|
+
variadic: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
flags: '--email <addr>',
|
|
34
|
+
description: 'Email destination (repeatable)',
|
|
35
|
+
variadic: true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
flags: '--webhook <url>',
|
|
39
|
+
description: 'Webhook destination (repeatable)',
|
|
40
|
+
variadic: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
flags: '--provider <id>',
|
|
44
|
+
description: 'Provider impl id (default: cloudflare-alerts when available)'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
flags: '--disabled',
|
|
48
|
+
description: 'Create the policy in disabled state',
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
flags: '-o, --output <format>',
|
|
53
|
+
description: 'Output format (text|json)',
|
|
54
|
+
default: 'text'
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
surfaces: ['cli'],
|
|
58
|
+
hardware: ['consumer', 'cloud'],
|
|
59
|
+
enabled: true
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=infra-alerts-create.cli-command.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra-alerts-create.cli-command.descriptor.js","sourceRoot":"","sources":["../../../src/cli/alerts/infra-alerts-create.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAe,kBAAkB,CAAC;IACjC,EAAE,EAAE,qBAAqB;IACzB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE;QACV;YACC,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,KAAK;SACf;KACD;IACD,OAAO,EAAE;QACR,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,uDAAuD,EAAE;QAChG;YACC,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,qEAAqE;YAClF,OAAO,EAAE,IAAI;SACb;QACD;YACC,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,6EAA6E;SAC1F;QACD;YACC,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,+FAA+F;YAC5G,QAAQ,EAAE,IAAI;SACd;QACD;YACC,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;SACd;QACD;YACC,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACd;QACD;YACC,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,8DAA8D;SAC3E;QACD;YACC,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,qCAAqC;YAClD,OAAO,EAAE,KAAK;SACd;QACD;YACC,KAAK,EAAE,uBAAuB;YAC9B,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE,MAAM;SACf;KACD;IACD,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,IAAI;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
declare const _default: {
|
|
10
|
+
execute(args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=infra-alerts-create.cli-command.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra-alerts-create.cli-command.impl.d.ts","sourceRoot":"","sources":["../../../src/cli/alerts/infra-alerts-create.cli-command.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;kBAmCkB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;;AAD3F,wBAyFE"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
import { getVibesRuntime } from '@vibesdotdev/runtime';
|
|
10
|
+
import { requestCLIExit } from '@vibesdotdev/cli/providers';
|
|
11
|
+
function readString(v) {
|
|
12
|
+
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
13
|
+
}
|
|
14
|
+
function readStringArray(v) {
|
|
15
|
+
if (Array.isArray(v))
|
|
16
|
+
return v.filter((x) => typeof x === 'string');
|
|
17
|
+
if (typeof v === 'string')
|
|
18
|
+
return [v];
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const VALID_TYPES = new Set(['budget', 'usage', 'error-rate', 'latency', 'custom']);
|
|
22
|
+
function parseFilters(raw) {
|
|
23
|
+
const out = {};
|
|
24
|
+
for (const entry of raw) {
|
|
25
|
+
const idx = entry.indexOf('=');
|
|
26
|
+
if (idx <= 0)
|
|
27
|
+
continue;
|
|
28
|
+
out[entry.slice(0, idx)] = entry.slice(idx + 1);
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
export default {
|
|
33
|
+
async execute(args, opts) {
|
|
34
|
+
const runtime = await getVibesRuntime();
|
|
35
|
+
const ui = (await runtime.context('cli/ui'));
|
|
36
|
+
const typeArg = readString(args.type);
|
|
37
|
+
if (!typeArg || !VALID_TYPES.has(typeArg)) {
|
|
38
|
+
ui.error(`Invalid alert type. Got "${typeArg ?? '(missing)'}". Expected one of: ${Array.from(VALID_TYPES).join(', ')}`);
|
|
39
|
+
requestCLIExit(1);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const type = typeArg;
|
|
43
|
+
const thresholdRaw = readString(opts.threshold) ?? '50';
|
|
44
|
+
const threshold = Number(thresholdRaw);
|
|
45
|
+
if (!Number.isFinite(threshold) || threshold < 0) {
|
|
46
|
+
ui.error(`Invalid --threshold "${thresholdRaw}"; must be a non-negative number.`);
|
|
47
|
+
requestCLIExit(1);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const emails = readStringArray(opts.email);
|
|
51
|
+
const webhooks = readStringArray(opts.webhook);
|
|
52
|
+
const mechanisms = [
|
|
53
|
+
...emails.map((target) => ({ kind: 'email', target })),
|
|
54
|
+
...webhooks.map((target) => ({ kind: 'webhook', target }))
|
|
55
|
+
];
|
|
56
|
+
if (mechanisms.length === 0) {
|
|
57
|
+
ui.error('At least one --email or --webhook destination is required.');
|
|
58
|
+
requestCLIExit(1);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const filters = parseFilters(readStringArray(opts.filter));
|
|
62
|
+
const name = readString(opts.name) ?? `${type} alert: ${threshold}`;
|
|
63
|
+
const window = readString(opts.window);
|
|
64
|
+
const enabled = !(opts.disabled === true || opts.disabled === 'true');
|
|
65
|
+
const output = readString(opts.output) ?? 'text';
|
|
66
|
+
const providerFilter = readString(opts.provider);
|
|
67
|
+
const policy = {
|
|
68
|
+
name,
|
|
69
|
+
type,
|
|
70
|
+
threshold,
|
|
71
|
+
window,
|
|
72
|
+
filters,
|
|
73
|
+
mechanisms,
|
|
74
|
+
enabled
|
|
75
|
+
};
|
|
76
|
+
if (!runtime.hasKind('infra/alerts')) {
|
|
77
|
+
ui.error('infra/alerts kind not registered. Load a provider plugin (e.g. infra-cloudflare).');
|
|
78
|
+
requestCLIExit(1);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const descriptors = runtime.assets('infra/alerts').descriptors();
|
|
82
|
+
const target = providerFilter
|
|
83
|
+
? descriptors.find((d) => d.adapter === providerFilter || d.id === providerFilter)
|
|
84
|
+
: descriptors[0];
|
|
85
|
+
if (!target) {
|
|
86
|
+
ui.error(`No matching alerts provider${providerFilter ? ` for --provider "${providerFilter}"` : ''}.`);
|
|
87
|
+
requestCLIExit(1);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const impl = (await runtime
|
|
92
|
+
.query('infra/alerts')
|
|
93
|
+
.withId(target.id)
|
|
94
|
+
.resolve());
|
|
95
|
+
const { providerId } = await impl.createPolicy(policy);
|
|
96
|
+
if (output === 'json') {
|
|
97
|
+
ui.json({ provider: target.adapter, providerId, policy });
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
ui.success(`Created ${type} policy "${name}" on ${target.adapter} → providerId=${providerId}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
ui.error(`Failed to create policy: ${err instanceof Error ? err.message : String(err)}`);
|
|
105
|
+
requestCLIExit(1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=infra-alerts-create.cli-command.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra-alerts-create.cli-command.impl.js","sourceRoot":"","sources":["../../../src/cli/alerts/infra-alerts-create.cli-command.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAkB,MAAM,4BAA4B,CAAC;AAS5E,SAAS,UAAU,CAAC,CAAU;IAC7B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC;AAED,SAAS,eAAe,CAAC,CAAU;IAClC,IAAI,KAAK,CAAC,OA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KAAK,CAAC,cAAc,CAAC;iBACrB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;iBACjB,OAAO,EAAE,CAAyB,CAAC;YACrC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAEvD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBACvB,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACP,EAAE,CAAC,OAAO,CACT,WAAW,IAAI,YAAY,IAAI,QAAQ,MAAM,CAAC,OAAO,iBAAiB,UAAU,EAAE,CAClF,CAAC;YACH,CAAC;QACF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,EAAE,CAAC,KAAK,CAAC,4BAA4B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACzF,cAAc,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
id: string;
|
|
3
|
+
kind: "cli/command";
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
group: string;
|
|
7
|
+
arguments: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
variadic: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
options: ({
|
|
14
|
+
flags: string;
|
|
15
|
+
description: string;
|
|
16
|
+
default?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
flags: string;
|
|
19
|
+
description: string;
|
|
20
|
+
default: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
flags: string;
|
|
23
|
+
description: string;
|
|
24
|
+
default: string;
|
|
25
|
+
})[];
|
|
26
|
+
surfaces: string[];
|
|
27
|
+
hardware: string[];
|
|
28
|
+
enabled: true;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
31
|
+
//# sourceMappingURL=infra-alerts-delete.cli-command.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra-alerts-delete.cli-command.descriptor.d.ts","sourceRoot":"","sources":["../../../src/cli/alerts/infra-alerts-delete.cli-command.descriptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAiCG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createRuntimeAsset } from '@vibesdotdev/runtime';
|
|
2
|
+
export default createRuntimeAsset({
|
|
3
|
+
id: 'infra-alerts.delete',
|
|
4
|
+
kind: 'cli/command',
|
|
5
|
+
name: 'delete',
|
|
6
|
+
description: 'Delete an alert policy by provider id',
|
|
7
|
+
group: 'infra-alerts',
|
|
8
|
+
arguments: [
|
|
9
|
+
{
|
|
10
|
+
name: 'providerId',
|
|
11
|
+
description: 'Policy id on the provider (from `vibes infra alerts list`)',
|
|
12
|
+
required: true,
|
|
13
|
+
variadic: false
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
options: [
|
|
17
|
+
{
|
|
18
|
+
flags: '--provider <id>',
|
|
19
|
+
description: 'Provider impl id (default: cloudflare-alerts when available)'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
flags: '-y, --yes',
|
|
23
|
+
description: 'Skip confirmation prompt',
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
flags: '-o, --output <format>',
|
|
28
|
+
description: 'Output format (text|json)',
|
|
29
|
+
default: 'text'
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
surfaces: ['cli'],
|
|
33
|
+
hardware: ['consumer', 'cloud'],
|
|
34
|
+
enabled: true
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=infra-alerts-delete.cli-command.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra-alerts-delete.cli-command.descriptor.js","sourceRoot":"","sources":["../../../src/cli/alerts/infra-alerts-delete.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAe,kBAAkB,CAAC;IACjC,EAAE,EAAE,qBAAqB;IACzB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE;QACV;YACC,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,KAAK;SACf;KACD;IACD,OAAO,EAAE;QACR;YACC,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,8DAA8D;SAC3E;QACD;YACC,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,KAAK;SACd;QACD;YACC,KAAK,EAAE,uBAAuB;YAC9B,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE,MAAM;SACf;KACD;IACD,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,IAAI;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
declare const _default: {
|
|
8
|
+
execute(args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=infra-alerts-delete.cli-command.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra-alerts-delete.cli-command.impl.d.ts","sourceRoot":"","sources":["../../../src/cli/alerts/infra-alerts-delete.cli-command.impl.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;kBAekB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;;AAD3F,wBAuDE"}
|