@delegance/claude-autopilot 5.2.2 → 6.2.2
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/CHANGELOG.md +1027 -1
- package/README.md +104 -17
- package/dist/src/adapters/council/claude.js +2 -1
- package/dist/src/adapters/council/openai.js +14 -7
- package/dist/src/adapters/deploy/_http.d.ts +43 -0
- package/dist/src/adapters/deploy/_http.js +99 -0
- package/dist/src/adapters/deploy/fly.d.ts +206 -0
- package/dist/src/adapters/deploy/fly.js +696 -0
- package/dist/src/adapters/deploy/generic.d.ts +39 -0
- package/dist/src/adapters/deploy/generic.js +98 -0
- package/dist/src/adapters/deploy/index.d.ts +15 -0
- package/dist/src/adapters/deploy/index.js +78 -0
- package/dist/src/adapters/deploy/render.d.ts +181 -0
- package/dist/src/adapters/deploy/render.js +550 -0
- package/dist/src/adapters/deploy/types.d.ts +221 -0
- package/dist/src/adapters/deploy/types.js +15 -0
- package/dist/src/adapters/deploy/vercel.d.ts +143 -0
- package/dist/src/adapters/deploy/vercel.js +426 -0
- package/dist/src/adapters/pricing.d.ts +36 -0
- package/dist/src/adapters/pricing.js +40 -0
- package/dist/src/adapters/review-engine/claude.js +2 -1
- package/dist/src/adapters/review-engine/codex.js +12 -8
- package/dist/src/adapters/review-engine/gemini.js +2 -1
- package/dist/src/adapters/review-engine/openai-compatible.js +2 -1
- package/dist/src/adapters/sdk-loader.d.ts +15 -0
- package/dist/src/adapters/sdk-loader.js +77 -0
- package/dist/src/cli/autopilot.d.ts +71 -0
- package/dist/src/cli/autopilot.js +735 -0
- package/dist/src/cli/brainstorm.d.ts +23 -0
- package/dist/src/cli/brainstorm.js +131 -0
- package/dist/src/cli/costs.d.ts +15 -1
- package/dist/src/cli/costs.js +99 -10
- package/dist/src/cli/deploy.d.ts +71 -0
- package/dist/src/cli/deploy.js +539 -0
- package/dist/src/cli/fix.d.ts +18 -0
- package/dist/src/cli/fix.js +105 -11
- package/dist/src/cli/help-text.d.ts +52 -0
- package/dist/src/cli/help-text.js +400 -0
- package/dist/src/cli/implement.d.ts +91 -0
- package/dist/src/cli/implement.js +196 -0
- package/dist/src/cli/index.js +784 -222
- package/dist/src/cli/json-envelope.d.ts +187 -0
- package/dist/src/cli/json-envelope.js +270 -0
- package/dist/src/cli/json-mode.d.ts +33 -0
- package/dist/src/cli/json-mode.js +201 -0
- package/dist/src/cli/migrate.d.ts +111 -0
- package/dist/src/cli/migrate.js +305 -0
- package/dist/src/cli/plan.d.ts +81 -0
- package/dist/src/cli/plan.js +149 -0
- package/dist/src/cli/pr.d.ts +106 -0
- package/dist/src/cli/pr.js +191 -19
- package/dist/src/cli/preflight.js +102 -1
- package/dist/src/cli/review.d.ts +27 -0
- package/dist/src/cli/review.js +126 -0
- package/dist/src/cli/runs-watch-renderer.d.ts +45 -0
- package/dist/src/cli/runs-watch-renderer.js +275 -0
- package/dist/src/cli/runs-watch.d.ts +41 -0
- package/dist/src/cli/runs-watch.js +395 -0
- package/dist/src/cli/runs.d.ts +122 -0
- package/dist/src/cli/runs.js +902 -0
- package/dist/src/cli/scan.d.ts +93 -0
- package/dist/src/cli/scan.js +166 -40
- package/dist/src/cli/spec.d.ts +66 -0
- package/dist/src/cli/spec.js +132 -0
- package/dist/src/cli/validate.d.ts +29 -0
- package/dist/src/cli/validate.js +131 -0
- package/dist/src/core/config/schema.d.ts +43 -0
- package/dist/src/core/config/schema.js +25 -0
- package/dist/src/core/config/types.d.ts +17 -0
- package/dist/src/core/council/runner.d.ts +10 -1
- package/dist/src/core/council/runner.js +25 -3
- package/dist/src/core/council/types.d.ts +7 -0
- package/dist/src/core/errors.d.ts +1 -1
- package/dist/src/core/errors.js +12 -0
- package/dist/src/core/logging/redaction.d.ts +13 -0
- package/dist/src/core/logging/redaction.js +20 -0
- package/dist/src/core/migrate/detector-rules.js +6 -0
- package/dist/src/core/migrate/schema-validator.js +22 -1
- package/dist/src/core/phases/static-rules.d.ts +5 -1
- package/dist/src/core/phases/static-rules.js +2 -5
- package/dist/src/core/run-state/budget.d.ts +88 -0
- package/dist/src/core/run-state/budget.js +141 -0
- package/dist/src/core/run-state/cli-internal.d.ts +21 -0
- package/dist/src/core/run-state/cli-internal.js +174 -0
- package/dist/src/core/run-state/events.d.ts +59 -0
- package/dist/src/core/run-state/events.js +504 -0
- package/dist/src/core/run-state/lock.d.ts +61 -0
- package/dist/src/core/run-state/lock.js +206 -0
- package/dist/src/core/run-state/phase-context.d.ts +60 -0
- package/dist/src/core/run-state/phase-context.js +108 -0
- package/dist/src/core/run-state/phase-registry.d.ts +137 -0
- package/dist/src/core/run-state/phase-registry.js +162 -0
- package/dist/src/core/run-state/phase-runner.d.ts +80 -0
- package/dist/src/core/run-state/phase-runner.js +447 -0
- package/dist/src/core/run-state/provider-readback.d.ts +130 -0
- package/dist/src/core/run-state/provider-readback.js +426 -0
- package/dist/src/core/run-state/replay-decision.d.ts +69 -0
- package/dist/src/core/run-state/replay-decision.js +144 -0
- package/dist/src/core/run-state/resolve-engine.d.ts +100 -0
- package/dist/src/core/run-state/resolve-engine.js +190 -0
- package/dist/src/core/run-state/resume-preflight.d.ts +66 -0
- package/dist/src/core/run-state/resume-preflight.js +116 -0
- package/dist/src/core/run-state/run-phase-with-lifecycle.d.ts +73 -0
- package/dist/src/core/run-state/run-phase-with-lifecycle.js +186 -0
- package/dist/src/core/run-state/runs.d.ts +57 -0
- package/dist/src/core/run-state/runs.js +288 -0
- package/dist/src/core/run-state/snapshot.d.ts +14 -0
- package/dist/src/core/run-state/snapshot.js +114 -0
- package/dist/src/core/run-state/state.d.ts +40 -0
- package/dist/src/core/run-state/state.js +164 -0
- package/dist/src/core/run-state/types.d.ts +278 -0
- package/dist/src/core/run-state/types.js +13 -0
- package/dist/src/core/run-state/ulid.d.ts +11 -0
- package/dist/src/core/run-state/ulid.js +95 -0
- package/dist/src/core/schema-alignment/extractor/index.d.ts +1 -1
- package/dist/src/core/schema-alignment/extractor/index.js +2 -2
- package/dist/src/core/schema-alignment/extractor/prisma.d.ts +13 -1
- package/dist/src/core/schema-alignment/extractor/prisma.js +65 -10
- package/dist/src/core/schema-alignment/git-history.d.ts +19 -0
- package/dist/src/core/schema-alignment/git-history.js +53 -0
- package/dist/src/core/static-rules/rules/brand-tokens.js +2 -2
- package/dist/src/core/static-rules/rules/schema-alignment.js +14 -4
- package/package.json +9 -5
- package/scripts/autoregress.ts +3 -2
- package/skills/claude-autopilot.md +1 -1
- package/skills/make-interfaces-feel-better/SKILL.md +104 -0
- package/skills/migrate/SKILL.md +193 -47
- package/skills/simplify-ui/SKILL.md +103 -0
- package/skills/ui/SKILL.md +117 -0
- package/skills/ui-ux-pro-max/SKILL.md +90 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common input to a deploy operation.
|
|
3
|
+
*
|
|
4
|
+
* Adapters are free to ignore fields they don't need. The Vercel adapter uses
|
|
5
|
+
* `commitSha` (and the env-derived git source) to choose what to build; the
|
|
6
|
+
* generic adapter uses neither — it just runs the configured deploy command.
|
|
7
|
+
*/
|
|
8
|
+
export interface DeployInput {
|
|
9
|
+
/** Symbolic git ref (branch / tag). Optional — adapters fall back to the configured target. */
|
|
10
|
+
ref?: string;
|
|
11
|
+
/** Specific commit SHA to deploy. Takes precedence over `ref` when both are set. */
|
|
12
|
+
commitSha?: string;
|
|
13
|
+
/** Free-form metadata propagated to the platform when supported (Vercel attaches as deployment meta). */
|
|
14
|
+
meta?: Record<string, string>;
|
|
15
|
+
/** Abort signal — adapters MUST honor this for any in-flight HTTP / spawn work. */
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
/**
|
|
18
|
+
* Fired exactly once with the platform-native deploy ID as soon as it's
|
|
19
|
+
* known. Adapters that obtain the ID synchronously (Vercel returns it from
|
|
20
|
+
* the create-deployment POST) MUST call this immediately after the POST
|
|
21
|
+
* resolves but before polling begins. Adapters with no discrete ID (the
|
|
22
|
+
* generic shell adapter) do NOT call it.
|
|
23
|
+
*
|
|
24
|
+
* Consumers use this to start side-channel work in parallel with the
|
|
25
|
+
* deploy — most notably log streaming via `--watch`.
|
|
26
|
+
*/
|
|
27
|
+
onDeployStart?: (deployId: string) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Outcome of a deploy operation.
|
|
31
|
+
*
|
|
32
|
+
* `status: 'in-progress'` is reserved for the case where polling timed out
|
|
33
|
+
* before the platform reached a terminal state — the deploy may still finish
|
|
34
|
+
* later. The adapter does NOT auto-resume in Phase 1; the caller can re-poll
|
|
35
|
+
* via `status({ deployId })`.
|
|
36
|
+
*
|
|
37
|
+
* `fail_rolled_back` and `fail_rollback_failed` (Phase 4 of v5.6) describe
|
|
38
|
+
* the bounded auto-rollback outcomes. They both mean "the deploy itself
|
|
39
|
+
* succeeded but the post-deploy health check failed"; the suffix indicates
|
|
40
|
+
* whether the subsequent rollback attempt succeeded (`_rolled_back`) or
|
|
41
|
+
* failed (`_rollback_failed`). Adapters never set these directly — they are
|
|
42
|
+
* stamped onto the `DeployResult` by the CLI orchestration in
|
|
43
|
+
* `src/cli/deploy.ts` after `rollback()` returns. Plain `fail` continues to
|
|
44
|
+
* cover deploy-itself failures and the "no rollback configured / not
|
|
45
|
+
* supported" branches so existing consumers keep working.
|
|
46
|
+
*/
|
|
47
|
+
export interface DeployResult {
|
|
48
|
+
status: 'pass' | 'fail' | 'in-progress' | 'fail_rolled_back' | 'fail_rollback_failed';
|
|
49
|
+
/** Adapter-native deploy ID. Vercel uses `dpl_xxx`. Empty for generic when stdout has no extractable URL. */
|
|
50
|
+
deployId?: string;
|
|
51
|
+
/** Public URL of the deploy (e.g. `https://my-app-abc.vercel.app`). */
|
|
52
|
+
deployUrl?: string;
|
|
53
|
+
/** URL to the build logs / dashboard for human follow-up. */
|
|
54
|
+
buildLogsUrl?: string;
|
|
55
|
+
/** Wall-clock duration of the adapter call, in milliseconds. */
|
|
56
|
+
durationMs: number;
|
|
57
|
+
/** Human-readable summary suitable for the PR comment (last 50 log lines, status line, etc.). */
|
|
58
|
+
output?: string;
|
|
59
|
+
/** Populated when the adapter auto-rolled back to a previous deploy. Phase 3+. */
|
|
60
|
+
rolledBackTo?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Input to a one-shot status query (no polling). Used by the future
|
|
64
|
+
* `claude-autopilot deploy status <id>` CLI subcommand and by the polling
|
|
65
|
+
* loop inside `deploy()`.
|
|
66
|
+
*/
|
|
67
|
+
export interface DeployStatusInput {
|
|
68
|
+
deployId: string;
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Result of a one-shot status query. Same shape as DeployResult with the
|
|
73
|
+
* deployId required for traceability. Adapters that don't support status
|
|
74
|
+
* (e.g. generic) leave the `status` method unimplemented.
|
|
75
|
+
*/
|
|
76
|
+
export interface DeployStatusResult extends Omit<DeployResult, 'deployId'> {
|
|
77
|
+
deployId: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Input to a rollback operation. Reserved for Phase 3.
|
|
81
|
+
*
|
|
82
|
+
* `to` is optional: when omitted the adapter rolls back to the previous
|
|
83
|
+
* production deploy (looked up via the platform API).
|
|
84
|
+
*/
|
|
85
|
+
export interface DeployRollbackInput {
|
|
86
|
+
/** Specific deploy ID to roll back to. When omitted, the previous prod deploy is used. */
|
|
87
|
+
to?: string;
|
|
88
|
+
signal?: AbortSignal;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Input to a one-shot log-streaming subscription.
|
|
92
|
+
*
|
|
93
|
+
* Returned `AsyncIterable` yields `DeployLogLine`s as the platform emits
|
|
94
|
+
* them. Consumers iterate with `for await ... of`. Cancellation is via the
|
|
95
|
+
* `signal` — once aborted, the underlying transport is torn down and the
|
|
96
|
+
* iterator finishes (or throws `AbortError`, depending on adapter).
|
|
97
|
+
*/
|
|
98
|
+
export interface DeployStreamLogsInput {
|
|
99
|
+
deployId: string;
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A single log line surfaced from the platform.
|
|
104
|
+
*
|
|
105
|
+
* Fields beyond `timestamp` and `text` are best-effort — adapters populate
|
|
106
|
+
* what they have. Consumers MUST NOT rely on `level` or `source` being set.
|
|
107
|
+
*/
|
|
108
|
+
export interface DeployLogLine {
|
|
109
|
+
/** Milliseconds since epoch — from the platform if provided, else when received locally. */
|
|
110
|
+
timestamp: number;
|
|
111
|
+
/** Build phase or component (e.g. 'build', 'deploy'). Optional. */
|
|
112
|
+
source?: string;
|
|
113
|
+
/** 'info' | 'warn' | 'error' | 'stdout' | 'stderr' — adapter-defined. Optional. */
|
|
114
|
+
level?: string;
|
|
115
|
+
/** Log text, no trailing newline. */
|
|
116
|
+
text: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Self-described capability surface for an adapter.
|
|
120
|
+
*
|
|
121
|
+
* Codex review of v5.6 (#4) flagged that Render's REST polling and Fly's
|
|
122
|
+
* WebSocket streaming offer materially different log-streaming experiences,
|
|
123
|
+
* and pretending they're equivalent degrades user trust. CLI surfaces (and
|
|
124
|
+
* downstream consumers) inspect this struct to print a one-line notice when
|
|
125
|
+
* `--watch` is invoked against a `polling`-mode adapter, and to choose between
|
|
126
|
+
* native vs simulated rollback messaging in the PR comment.
|
|
127
|
+
*
|
|
128
|
+
* The field is optional — adapters that don't declare capabilities are
|
|
129
|
+
* treated as `streamMode: 'none'`, `nativeRollback: false` for safety.
|
|
130
|
+
*/
|
|
131
|
+
export interface DeployAdapterCapabilities {
|
|
132
|
+
/**
|
|
133
|
+
* How `streamLogs()` (when implemented) delivers lines:
|
|
134
|
+
* - `websocket` — real-time, push-based, near-zero gap between line emit and consumer receive
|
|
135
|
+
* - `polling` — REST-paginated polling cursor, lines may arrive in batches with short gaps
|
|
136
|
+
* - `none` — no log-streaming surface at all
|
|
137
|
+
*/
|
|
138
|
+
streamMode?: 'websocket' | 'polling' | 'none';
|
|
139
|
+
/**
|
|
140
|
+
* `true` when the platform exposes a single "promote prior release" verb
|
|
141
|
+
* (Vercel's `/promote`, Fly's `/rollback`); `false` when rollback must be
|
|
142
|
+
* simulated by re-deploying a previous successful image/commit (Render).
|
|
143
|
+
*/
|
|
144
|
+
nativeRollback?: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The DeployAdapter contract.
|
|
148
|
+
*
|
|
149
|
+
* `deploy` is required. `status` and `rollback` are optional so adapters that
|
|
150
|
+
* don't expose them (the generic shell adapter being the canonical example)
|
|
151
|
+
* can omit the methods rather than throwing at runtime.
|
|
152
|
+
*/
|
|
153
|
+
export interface DeployAdapter {
|
|
154
|
+
/** Stable identifier — surfaced in CLI output and logs. */
|
|
155
|
+
readonly name: string;
|
|
156
|
+
/**
|
|
157
|
+
* Optional self-description of the adapter's streaming + rollback shape.
|
|
158
|
+
* See {@link DeployAdapterCapabilities} for semantics. CLI consumers use
|
|
159
|
+
* this to decide whether to print the polling-mode notice on `--watch`.
|
|
160
|
+
*/
|
|
161
|
+
readonly capabilities?: DeployAdapterCapabilities;
|
|
162
|
+
deploy(input: DeployInput): Promise<DeployResult>;
|
|
163
|
+
status?(input: DeployStatusInput): Promise<DeployStatusResult>;
|
|
164
|
+
rollback?(input: DeployRollbackInput): Promise<DeployResult>;
|
|
165
|
+
/**
|
|
166
|
+
* Subscribe to real-time build logs. Optional — adapters without a
|
|
167
|
+
* platform API for log streaming (e.g. the generic shell adapter) omit
|
|
168
|
+
* this method, and the `undefined` is the canonical "not supported"
|
|
169
|
+
* signal for callers.
|
|
170
|
+
*/
|
|
171
|
+
streamLogs?(input: DeployStreamLogsInput): AsyncIterable<DeployLogLine>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Configuration block for the `deploy` phase. Lives under `deploy:` in
|
|
175
|
+
* `guardrail.config.yaml`.
|
|
176
|
+
*
|
|
177
|
+
* Fields are conditionally required based on `adapter`:
|
|
178
|
+
* - `vercel` requires `project`
|
|
179
|
+
* - `generic` requires `deployCommand`
|
|
180
|
+
*
|
|
181
|
+
* The factory in `./index.ts` enforces these rules at construction time.
|
|
182
|
+
*/
|
|
183
|
+
export interface DeployConfig {
|
|
184
|
+
/**
|
|
185
|
+
* Which adapter to use. v5.4 shipped `vercel` + `generic`; v5.6 Phase 1
|
|
186
|
+
* adds `fly`; v5.6 Phase 2 adds `render`.
|
|
187
|
+
*/
|
|
188
|
+
adapter: 'vercel' | 'fly' | 'render' | 'generic';
|
|
189
|
+
/** Vercel project ID or slug. Required when `adapter === 'vercel'`. */
|
|
190
|
+
project?: string;
|
|
191
|
+
/** Vercel team ID for team accounts. Optional. */
|
|
192
|
+
team?: string;
|
|
193
|
+
/** Deploy target. Default: `production`. */
|
|
194
|
+
target?: 'production' | 'preview';
|
|
195
|
+
/** Fly app slug. Required when `adapter === 'fly'`. */
|
|
196
|
+
app?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Pre-pushed image reference, e.g. `registry.fly.io/my-app:deployment-01`.
|
|
199
|
+
* Required when `adapter === 'fly'` — the Fly adapter does not build the
|
|
200
|
+
* image; pushing is the user's responsibility (`fly deploy --build-only --push`).
|
|
201
|
+
*/
|
|
202
|
+
image?: string;
|
|
203
|
+
/** Optional Fly region pin (e.g. `ord`). Falls back to the app's default region. */
|
|
204
|
+
region?: string;
|
|
205
|
+
/** Render service ID (e.g. `srv-abc123`). Required when `adapter === 'render'`. */
|
|
206
|
+
serviceId?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Whether Render should clear the build cache before deploying. Optional,
|
|
209
|
+
* default `'do_not_clear'`. Maps directly to the Render API body field.
|
|
210
|
+
*/
|
|
211
|
+
clearCache?: 'do_not_clear' | 'clear';
|
|
212
|
+
/** Shell command to run for the deploy (e.g. `vercel --prod`). Required when `adapter === 'generic'`. */
|
|
213
|
+
deployCommand?: string;
|
|
214
|
+
/** Stream build logs to stderr in real time. Phase 2. */
|
|
215
|
+
watchBuildLogs?: boolean;
|
|
216
|
+
/** Auto-rollback triggers. Phase 3 / 4. */
|
|
217
|
+
rollbackOn?: Array<'healthCheckFailure' | 'smokeTestFailure'>;
|
|
218
|
+
/** URL polled after deploy succeeds to confirm app health. Used by both adapters once Phase 4 lands. */
|
|
219
|
+
healthCheckUrl?: string;
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/adapters/deploy/types.ts
|
|
2
|
+
//
|
|
3
|
+
// DeployAdapter contract — Phase 1 of the v5.4 Vercel adapter spec.
|
|
4
|
+
//
|
|
5
|
+
// A DeployAdapter abstracts over the "deploy this code somewhere" step of the
|
|
6
|
+
// pipeline. Adapters can be platform-specific (vercel, fly, render) or generic
|
|
7
|
+
// (a free-form shell command à la `vercel --prod` from v5.3).
|
|
8
|
+
//
|
|
9
|
+
// Phase 1 implements `deploy()` and `status()`. `rollback()` is reserved for
|
|
10
|
+
// Phase 3 and intentionally optional on the interface so generic adapters that
|
|
11
|
+
// don't support it can omit the method entirely.
|
|
12
|
+
//
|
|
13
|
+
// Spec: docs/specs/v5.4-vercel-adapter.md
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { DeployAdapter, DeployInput, DeployLogLine, DeployResult, DeployRollbackInput, DeployStatusInput, DeployStatusResult, DeployStreamLogsInput } from './types.ts';
|
|
2
|
+
/** Vercel deployment states. The first three are terminal; the rest are interim. */
|
|
3
|
+
type VercelState = 'READY' | 'ERROR' | 'CANCELED' | 'BUILDING' | 'INITIALIZING' | 'QUEUED' | 'DEPLOYING' | 'ANALYZING';
|
|
4
|
+
/**
|
|
5
|
+
* Single entry from `GET /v6/deployments`. Vercel's list response wraps
|
|
6
|
+
* these under `{ deployments: [...] }`. We only surface the fields the
|
|
7
|
+
* rollback + status flows need; callers MUST treat all fields beyond `id`
|
|
8
|
+
* as best-effort (older deployments occasionally omit `createdAt` and
|
|
9
|
+
* `state` is not always populated for super-recent in-flight builds).
|
|
10
|
+
*/
|
|
11
|
+
export interface VercelDeployListItem {
|
|
12
|
+
id: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
state?: VercelState;
|
|
15
|
+
/** Milliseconds since epoch — Vercel returns this as a number. */
|
|
16
|
+
createdAt?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface VercelDeployAdapterOptions {
|
|
19
|
+
/** Personal access token. Falls back to `process.env.VERCEL_TOKEN`. */
|
|
20
|
+
token?: string;
|
|
21
|
+
/** Vercel project ID or slug. Required. */
|
|
22
|
+
project: string;
|
|
23
|
+
/** Vercel team ID. Optional — required only for team accounts. */
|
|
24
|
+
team?: string;
|
|
25
|
+
/** Deploy target. Default: `production`. */
|
|
26
|
+
target?: 'production' | 'preview';
|
|
27
|
+
/** Polling interval (ms) when waiting for the build to reach a terminal state. Default: 2000. */
|
|
28
|
+
pollIntervalMs?: number;
|
|
29
|
+
/** Maximum total time to poll before returning `in-progress`. Default: 15 minutes. */
|
|
30
|
+
maxPollMs?: number;
|
|
31
|
+
/** Injected fetch implementation — defaults to `globalThis.fetch`. Tests pass a mock. */
|
|
32
|
+
fetchImpl?: typeof fetch;
|
|
33
|
+
/** Injected sleep implementation — tests pass a no-op so they don't actually wait. */
|
|
34
|
+
sleepImpl?: (ms: number) => Promise<void>;
|
|
35
|
+
/** Wall-clock source — tests pass a controllable counter. */
|
|
36
|
+
nowImpl?: () => number;
|
|
37
|
+
/**
|
|
38
|
+
* Optional caller-supplied redaction patterns (in addition to the
|
|
39
|
+
* built-in default set in `core/logging/redaction.ts`). Typically wired
|
|
40
|
+
* from `config.persistence.redactionPatterns` by the CLI; tests omit it.
|
|
41
|
+
*
|
|
42
|
+
* Phase 5 of v5.6 brought Vercel into parity with Fly/Render — the v5.4
|
|
43
|
+
* adapter previously emitted `output` lines verbatim, which was a real
|
|
44
|
+
* leak hazard for any build that echoed an env var into stdout.
|
|
45
|
+
*/
|
|
46
|
+
redactionPatterns?: readonly string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Vercel deploy adapter.
|
|
50
|
+
*
|
|
51
|
+
* Construct once per pipeline run. The adapter is stateless across calls — all
|
|
52
|
+
* configuration (token, project, team) is captured at construction time.
|
|
53
|
+
*/
|
|
54
|
+
export declare class VercelDeployAdapter implements DeployAdapter {
|
|
55
|
+
readonly name = "vercel";
|
|
56
|
+
private readonly token;
|
|
57
|
+
private readonly project;
|
|
58
|
+
private readonly team;
|
|
59
|
+
private readonly target;
|
|
60
|
+
private readonly pollIntervalMs;
|
|
61
|
+
private readonly maxPollMs;
|
|
62
|
+
private readonly fetchImpl;
|
|
63
|
+
private readonly sleep;
|
|
64
|
+
private readonly now;
|
|
65
|
+
private readonly redactionPatterns;
|
|
66
|
+
constructor(opts: VercelDeployAdapterOptions);
|
|
67
|
+
deploy(input: DeployInput): Promise<DeployResult>;
|
|
68
|
+
status(input: DeployStatusInput): Promise<DeployStatusResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Phase 2 — subscribe to real-time build logs for a deployment.
|
|
71
|
+
*
|
|
72
|
+
* Streams `GET /v2/deployments/<id>/events?builds=1&follow=1` and yields a
|
|
73
|
+
* `DeployLogLine` for each `stdout` / `stderr` event. Lifecycle events
|
|
74
|
+
* (`state`, `complete`) are filtered out — the polling loop in `deploy()`
|
|
75
|
+
* already handles them. Malformed JSON lines are skipped silently rather
|
|
76
|
+
* than crashing a long-running stream.
|
|
77
|
+
*
|
|
78
|
+
* Cancellation: pass `input.signal`. Once aborted, the underlying fetch
|
|
79
|
+
* is torn down and the iterator returns.
|
|
80
|
+
*/
|
|
81
|
+
streamLogs(input: DeployStreamLogsInput): AsyncGenerator<DeployLogLine>;
|
|
82
|
+
/**
|
|
83
|
+
* Phase 3 — promote a previously-built deployment to production.
|
|
84
|
+
*
|
|
85
|
+
* Two modes:
|
|
86
|
+
* - `input.to` set → promote that deploy ID directly. Cheapest path.
|
|
87
|
+
* - `input.to` omitted → look up the previous prod deploy via
|
|
88
|
+
* `listDeployments(5)` and promote it. Throws `no_previous_deploy`
|
|
89
|
+
* when there's nothing to roll back to (project with one deploy,
|
|
90
|
+
* or every prior deploy is in ERROR/CANCELED state).
|
|
91
|
+
*
|
|
92
|
+
* Always-query is intentional: we never cache deploy IDs locally, so a
|
|
93
|
+
* promote performed from the Vercel dashboard between our deploy and
|
|
94
|
+
* our rollback is still observable.
|
|
95
|
+
*/
|
|
96
|
+
rollback(input: DeployRollbackInput): Promise<DeployResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Phase 3 — list recent production deployments for the configured
|
|
99
|
+
* project. Used by the `deploy status` CLI subcommand and by the
|
|
100
|
+
* `findPreviousProdDeployment()` helper backing `rollback()`.
|
|
101
|
+
*
|
|
102
|
+
* The list endpoint is `/v6/deployments` (v13 is for individual
|
|
103
|
+
* deployments). `target=production` filters out preview builds; `limit`
|
|
104
|
+
* caps the result set — Vercel returns newest-first so a small limit
|
|
105
|
+
* is sufficient for both rollback target detection and the CLI status
|
|
106
|
+
* display (defaults to 5).
|
|
107
|
+
*/
|
|
108
|
+
listDeployments(limit?: number, signal?: AbortSignal): Promise<VercelDeployListItem[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Apply the adapter's redaction patterns to a streamed log line's `text`.
|
|
111
|
+
* Mirrors the Fly/Render redactLine helpers introduced in v5.6 so secrets
|
|
112
|
+
* never escape the adapter via streamed log entries.
|
|
113
|
+
*/
|
|
114
|
+
private redactLine;
|
|
115
|
+
/**
|
|
116
|
+
* Returns the deployment immediately preceding the current production
|
|
117
|
+
* deployment, or `null` if no rollback target exists.
|
|
118
|
+
*
|
|
119
|
+
* "Preceding" means: among deployments with `state === 'READY'` (so we
|
|
120
|
+
* never roll back to a known-broken build), sorted newest-first by
|
|
121
|
+
* `createdAt`, the second entry. The first entry is the current prod
|
|
122
|
+
* deploy and we drop it.
|
|
123
|
+
*/
|
|
124
|
+
private findPreviousProdDeployment;
|
|
125
|
+
private pollUntilTerminal;
|
|
126
|
+
private shapeResult;
|
|
127
|
+
private headers;
|
|
128
|
+
private urlWithTeam;
|
|
129
|
+
private buildLogsUrl;
|
|
130
|
+
private assertOkOrThrow;
|
|
131
|
+
/**
|
|
132
|
+
* Like `fetchWithRetry` but tuned for the events endpoint:
|
|
133
|
+
* - 404 right after a deploy POST is a known race (the deploy hasn't yet
|
|
134
|
+
* propagated to the events service). Retry up to N times with backoff.
|
|
135
|
+
* - 5xx behaves the same as `fetchWithRetry`.
|
|
136
|
+
* - Cancels cleanly on AbortError.
|
|
137
|
+
* - Returns the last `Response` so the caller can `assertOkOrThrow` on a
|
|
138
|
+
* final non-OK status (e.g. 401 still bubbles immediately on attempt 1).
|
|
139
|
+
*/
|
|
140
|
+
private fetchEventsWithRetry;
|
|
141
|
+
}
|
|
142
|
+
export {};
|
|
143
|
+
//# sourceMappingURL=vercel.d.ts.map
|