shiplane 0.0.0 → 0.1.0
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/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/budget-C8_aayQk.js +328 -0
- package/dist/budget-C8_aayQk.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +503 -0
- package/dist/cli.js.map +1 -0
- package/dist/display-DM0xtQbT.js +55 -0
- package/dist/display-DM0xtQbT.js.map +1 -0
- package/dist/index-QneBUiDD.d.ts +867 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/issues-C5fKq1Jv.js +6 -0
- package/dist/issues-C5fKq1Jv.js.map +1 -0
- package/dist/plugin.d.ts +16 -0
- package/dist/plugin.js +7 -0
- package/dist/readStatus-D5YVR5ZC.js +2921 -0
- package/dist/readStatus-D5YVR5ZC.js.map +1 -0
- package/dist/shell-server-hosting.adapter-Bgl6-IWw.js +49 -0
- package/dist/shell-server-hosting.adapter-Bgl6-IWw.js.map +1 -0
- package/dist/src-Dlr2Sgs8.js +32 -0
- package/dist/src-Dlr2Sgs8.js.map +1 -0
- package/dist/tags-DL74ni09.d.ts +19 -0
- package/dist/testing.d.ts +992 -0
- package/dist/testing.js +1349 -0
- package/dist/testing.js.map +1 -0
- package/dist/web-app.module-Bw-npC4Z.js +83 -0
- package/dist/web-app.module-Bw-npC4Z.js.map +1 -0
- package/package.json +58 -9
|
@@ -0,0 +1,867 @@
|
|
|
1
|
+
import { z, z as z$1 } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/domain/environment.d.ts
|
|
4
|
+
/** Where a unit runs, in promotion order: production ships what preview validated. */
|
|
5
|
+
declare const ENVIRONMENTS: readonly ["preview", "production"];
|
|
6
|
+
type Environment = (typeof ENVIRONMENTS)[number];
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/domain/unit.d.ts
|
|
9
|
+
/** Something with a version that ships somewhere: an app, a published package, this CLI. */
|
|
10
|
+
interface ReleaseUnit {
|
|
11
|
+
/** Its folder's name, the name every command and `${units.<name>}` uses. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Its folder, relative to the repository root. */
|
|
14
|
+
dir: string;
|
|
15
|
+
/** Its `shiplane.unit.yml`, relative to the repository root. */
|
|
16
|
+
file: string;
|
|
17
|
+
packageName: string;
|
|
18
|
+
version: string;
|
|
19
|
+
/** The module that ships it, as its unit file names it. */
|
|
20
|
+
module: string;
|
|
21
|
+
/** As written: per-environment maps and references are resolved by `optionsFor`. */
|
|
22
|
+
options: Record<string, unknown>;
|
|
23
|
+
/** Units whose values it reads: they are dispatched before it. */
|
|
24
|
+
after: string[];
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/application/config/perEnv.d.ts
|
|
28
|
+
/** A value that is the same everywhere, or written once per environment. */
|
|
29
|
+
declare const perEnv: <Value extends z.ZodType>(value: Value) => z.ZodUnion<readonly [Value, z.ZodObject<{
|
|
30
|
+
preview: Value;
|
|
31
|
+
production: Value;
|
|
32
|
+
}, z.core.$strict>]>;
|
|
33
|
+
type PerEnv<Value> = Value | Record<Environment, Value>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/domain/display.d.ts
|
|
36
|
+
declare const MOODS: readonly ["thinking", "working", "waiting", "happy", "worried", "resting"];
|
|
37
|
+
/** What the mascot shows beside the release: reading, running, waiting on a person, done, failed, idle. */
|
|
38
|
+
type Mood = (typeof MOODS)[number];
|
|
39
|
+
/** `done` of `total` as a bar `width` characters wide. */
|
|
40
|
+
declare const progressBar: (done: number, total: number, width: number) => string;
|
|
41
|
+
/** How much the release says while it runs, as `shiplane.config.ts` or a flag asks. */
|
|
42
|
+
interface DisplayChoice {
|
|
43
|
+
/** Says each thing it reads and runs, with a progress bar. */
|
|
44
|
+
verbose?: boolean;
|
|
45
|
+
/** The mascot beside what is happening. */
|
|
46
|
+
mascot?: boolean;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/domain/changes.d.ts
|
|
50
|
+
/** A unit as changesets know it: its name here, its package name there. */
|
|
51
|
+
interface UnitRef {
|
|
52
|
+
name: string;
|
|
53
|
+
packageName: string;
|
|
54
|
+
}
|
|
55
|
+
type BumpType = "major" | "minor" | "patch" | "none";
|
|
56
|
+
/** One changeset, as `changeset status --output` lists it. */
|
|
57
|
+
interface PlannedChangeset {
|
|
58
|
+
id: string;
|
|
59
|
+
summary: string;
|
|
60
|
+
releases: {
|
|
61
|
+
name: string;
|
|
62
|
+
type: BumpType;
|
|
63
|
+
}[];
|
|
64
|
+
}
|
|
65
|
+
/** One package's version move, as `changeset status --output` lists it. */
|
|
66
|
+
interface PlannedRelease {
|
|
67
|
+
name: string;
|
|
68
|
+
type: BumpType;
|
|
69
|
+
oldVersion: string;
|
|
70
|
+
newVersion: string;
|
|
71
|
+
/** Empty when the package only moves because a workspace dependency did. */
|
|
72
|
+
changesets: string[];
|
|
73
|
+
}
|
|
74
|
+
interface StatusPlan {
|
|
75
|
+
changesets: PlannedChangeset[];
|
|
76
|
+
releases: PlannedRelease[];
|
|
77
|
+
}
|
|
78
|
+
interface AppBump {
|
|
79
|
+
/** The unit's name. */
|
|
80
|
+
app: string;
|
|
81
|
+
from: string;
|
|
82
|
+
to: string;
|
|
83
|
+
/** What the app's users get: the summaries of the changesets naming it. */
|
|
84
|
+
notes: string[];
|
|
85
|
+
/** The workspace packages it moves with, when no changeset names it. */
|
|
86
|
+
movedWith: string[];
|
|
87
|
+
}
|
|
88
|
+
/** The units a release moves, in `units` order, each with its notes or the packages it moves with. */
|
|
89
|
+
declare const appBumps: ({
|
|
90
|
+
changesets,
|
|
91
|
+
releases
|
|
92
|
+
}: StatusPlan, dependencies: Record<string, string[]>, units: readonly UnitRef[]) => AppBump[];
|
|
93
|
+
/**
|
|
94
|
+
* Holding an app back keeps its lines pending, with any package line they came with so the package
|
|
95
|
+
* does not drag the held app along. The picked apps' lines ship under the same summary.
|
|
96
|
+
*/
|
|
97
|
+
declare const splitChangesets: (changesets: PlannedChangeset[], held: readonly string[], units: readonly UnitRef[]) => {
|
|
98
|
+
ships: PlannedChangeset[];
|
|
99
|
+
waits: PlannedChangeset[];
|
|
100
|
+
};
|
|
101
|
+
interface UnreleasedApp {
|
|
102
|
+
/** The unit's name. */
|
|
103
|
+
app: string;
|
|
104
|
+
version: string;
|
|
105
|
+
/** Subjects of the commits that touched it since its current version, newest first. */
|
|
106
|
+
commits: string[];
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/domain/scope.d.ts
|
|
110
|
+
/** A unit whose live state its own platform knows, not GitHub Deployments: EAS for a mobile app. */
|
|
111
|
+
interface DecidedBy {
|
|
112
|
+
/** Who decides, as a person reads it: "EAS". */
|
|
113
|
+
platform: string;
|
|
114
|
+
/** What it decides between: "build or update". */
|
|
115
|
+
choice: string;
|
|
116
|
+
/** The command that shows its state: "shiplane status". */
|
|
117
|
+
check: string;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/domain/deploys.d.ts
|
|
121
|
+
/** The run name the deploy workflows set, so the Actions list says which version went where. */
|
|
122
|
+
declare const deployRunTitle: (tag: string, environment: Environment) => string;
|
|
123
|
+
type DeployState = "none" | "running" | "done";
|
|
124
|
+
/** One version on one environment, from the states of its GitHub deployments. */
|
|
125
|
+
declare const deployState: (states: string[]) => DeployState;
|
|
126
|
+
/** Whether a diff only moves version files: the code is still the code a release named. */
|
|
127
|
+
declare const onlyVersionFiles: (files: string[], versionFiles: ReadonlySet<string>) => boolean;
|
|
128
|
+
type DeployPath = "github" | "local";
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/domain/budget.d.ts
|
|
131
|
+
interface ActionsMinutes {
|
|
132
|
+
used: number;
|
|
133
|
+
included: number;
|
|
134
|
+
left: number;
|
|
135
|
+
}
|
|
136
|
+
/** This month's Actions minutes against the plan's allowance, from GitHub's usage summary. */
|
|
137
|
+
declare const actionsMinutes: (plan: string, usage: {
|
|
138
|
+
sku: string;
|
|
139
|
+
grossQuantity: number;
|
|
140
|
+
unitType: string;
|
|
141
|
+
}[]) => ActionsMinutes | null;
|
|
142
|
+
/** Minutes GitHub bills for a run: each job rounds up to the minute; unfinished jobs are skipped. */
|
|
143
|
+
declare const billedMinutes: (jobs: {
|
|
144
|
+
startedAt: string | null;
|
|
145
|
+
completedAt: string | null;
|
|
146
|
+
}[]) => number;
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/domain/issues.d.ts
|
|
149
|
+
/** An issue or pull request, by repository: `owner/name` and its number. */
|
|
150
|
+
interface IssueRef {
|
|
151
|
+
repository: string;
|
|
152
|
+
number: number;
|
|
153
|
+
}
|
|
154
|
+
/** A merged pull request, as a release reads which issues it relates to. */
|
|
155
|
+
interface LinkedPr extends IssueRef {
|
|
156
|
+
body: string;
|
|
157
|
+
/** The issues GitHub says it closes. */
|
|
158
|
+
closes: IssueRef[];
|
|
159
|
+
}
|
|
160
|
+
declare const issueName: ({
|
|
161
|
+
repository,
|
|
162
|
+
number
|
|
163
|
+
}: IssueRef) => string;
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/domain/releasePr.d.ts
|
|
166
|
+
interface OpenPr {
|
|
167
|
+
number: number;
|
|
168
|
+
url: string;
|
|
169
|
+
}
|
|
170
|
+
type MergeMethod = "--squash" | "--merge" | "--rebase";
|
|
171
|
+
/** What the pull request page offers: the methods the repository allows, and the one it preselects. */
|
|
172
|
+
interface MergeMethods {
|
|
173
|
+
allowed: MergeMethod[];
|
|
174
|
+
preselected: MergeMethod | null;
|
|
175
|
+
}
|
|
176
|
+
type ReleaseStep = {
|
|
177
|
+
step: "wait-merge";
|
|
178
|
+
prs: OpenPr[];
|
|
179
|
+
} | {
|
|
180
|
+
step: "release-pr";
|
|
181
|
+
} | {
|
|
182
|
+
step: "ship";
|
|
183
|
+
};
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/ports/code-host.port.d.ts
|
|
186
|
+
interface Deploy {
|
|
187
|
+
/** The run title every deploy records: `Deploy <tag> to <environment>`. */
|
|
188
|
+
title: string;
|
|
189
|
+
state: DeployState;
|
|
190
|
+
}
|
|
191
|
+
/** Where pull requests, comments, release notes and deploy records live. */
|
|
192
|
+
interface CodeHostPort {
|
|
193
|
+
/** Open pull requests whose branch starts with the prefix, oldest first. */
|
|
194
|
+
openPrsFrom: (branchPrefix: string) => Promise<OpenPr[]>;
|
|
195
|
+
createPr: (pr: {
|
|
196
|
+
base: string;
|
|
197
|
+
head: string;
|
|
198
|
+
title: string;
|
|
199
|
+
body: string;
|
|
200
|
+
label: string;
|
|
201
|
+
}) => Promise<OpenPr>;
|
|
202
|
+
prState: (pr: OpenPr) => Promise<"OPEN" | "MERGED" | "CLOSED">;
|
|
203
|
+
closePr: (pr: OpenPr, comment: string) => Promise<void>;
|
|
204
|
+
mergeMethods: () => Promise<MergeMethods>;
|
|
205
|
+
merge: (pr: OpenPr, method: MergeMethod) => Promise<void>;
|
|
206
|
+
showDiff: (pr: OpenPr) => Promise<void>;
|
|
207
|
+
openInBrowser: (pr: OpenPr) => Promise<void>;
|
|
208
|
+
/** Tags that already have release notes. */
|
|
209
|
+
releasedTags: () => Promise<Set<string>>;
|
|
210
|
+
createRelease: (tag: string, notes: string, latest: boolean) => Promise<void>;
|
|
211
|
+
/** Every deploy recorded for a tag, by a workflow or by this machine. */
|
|
212
|
+
deployments: () => Promise<Deploy[]>;
|
|
213
|
+
recordDeployment: (ref: string, environment: Environment) => Promise<void>;
|
|
214
|
+
/** Each pull request's body and the issues it closes, in the order asked, read in one go. */
|
|
215
|
+
pullRequests: (numbers: readonly number[]) => Promise<LinkedPr[]>;
|
|
216
|
+
/** The recent comments of each issue or pull request, in the order asked, read in one go. */
|
|
217
|
+
comments: (on: readonly IssueRef[]) => Promise<string[][]>;
|
|
218
|
+
/** Posts a comment on an issue or a pull request, paced so a burst stays under the host's limits. */
|
|
219
|
+
comment: (on: IssueRef, body: string) => Promise<void>;
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/ports/ci-pipeline.port.d.ts
|
|
223
|
+
/** Where workflows run: dispatched on a ref, their runs read back, the minutes they cost. */
|
|
224
|
+
interface CiPipelinePort {
|
|
225
|
+
/** The one workflow that ships on CI: `shiplane ship` on a runner, given units and an environment. */
|
|
226
|
+
readonly shipWorkflow: string;
|
|
227
|
+
/** A workflow's runs, each titled `Deploy <tag> to <environment>` when it deploys. */
|
|
228
|
+
workflowRuns: (workflow: string) => Promise<Deploy[]>;
|
|
229
|
+
dispatch: (workflow: string, ref: string, inputs: Record<string, string>) => Promise<void>;
|
|
230
|
+
/** This month's minutes, or null when the pipeline won't say. */
|
|
231
|
+
minutes: () => Promise<ActionsMinutes | null>;
|
|
232
|
+
/** Billed minutes of a workflow's last successful runs. */
|
|
233
|
+
measuredMinutes: (workflow: string) => Promise<number[]>;
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/ports/shell.port.d.ts
|
|
237
|
+
interface RunOptions {
|
|
238
|
+
cwd?: string;
|
|
239
|
+
env?: Record<string, string>;
|
|
240
|
+
input?: string;
|
|
241
|
+
}
|
|
242
|
+
interface ShellResult {
|
|
243
|
+
status: number;
|
|
244
|
+
stdout: string;
|
|
245
|
+
stderr: string;
|
|
246
|
+
}
|
|
247
|
+
/** Every vendor tool this CLI drives (git, gh, eas, flyctl, wrangler) goes through here. */
|
|
248
|
+
interface Shell {
|
|
249
|
+
/** Runs and captures its output; a non-zero exit is a result, never an error. */
|
|
250
|
+
capture: (command: string, args: readonly string[], options?: RunOptions) => Promise<ShellResult>;
|
|
251
|
+
/** Runs in the person's terminal with its output shown; resolves with the exit status. */
|
|
252
|
+
attach: (command: string, args: readonly string[], options?: RunOptions) => Promise<number>;
|
|
253
|
+
/** A variable of this process's environment, such as a token a command needs. */
|
|
254
|
+
env: (name: string) => string | undefined;
|
|
255
|
+
}
|
|
256
|
+
/** A command that exited non-zero, carrying all it printed so a failure can show why. */
|
|
257
|
+
declare class CommandFailed extends Error {
|
|
258
|
+
readonly output: string;
|
|
259
|
+
constructor(message: string, output: string);
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/domain/governance.d.ts
|
|
263
|
+
type ReleaseIntent = "build" | "update" | "submit";
|
|
264
|
+
interface GitPosition {
|
|
265
|
+
branch: string;
|
|
266
|
+
head: string;
|
|
267
|
+
/** origin/main after a fetch. */
|
|
268
|
+
originMain: string;
|
|
269
|
+
}
|
|
270
|
+
type SourceResult = {
|
|
271
|
+
allowed: true;
|
|
272
|
+
} | {
|
|
273
|
+
allowed: false;
|
|
274
|
+
why: "not-main" | "behind-main";
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* A binary ships what it was built from, so builds start from main as it is on origin. Preview
|
|
278
|
+
* updates may come from a branch for testers; production updates only from main.
|
|
279
|
+
*/
|
|
280
|
+
declare const releaseSource: (intent: ReleaseIntent, channel: Environment, {
|
|
281
|
+
branch,
|
|
282
|
+
head,
|
|
283
|
+
originMain
|
|
284
|
+
}: GitPosition) => SourceResult;
|
|
285
|
+
/** Production never runs a step nobody confirmed. */
|
|
286
|
+
declare const yesAllowed: (channel: Environment, yes: boolean) => boolean;
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/ports/source-control.port.d.ts
|
|
289
|
+
/** The repository's history, as a release reads and writes it. */
|
|
290
|
+
interface SourceControlPort {
|
|
291
|
+
/** After fetching main: the branch, its head and origin/main. */
|
|
292
|
+
position: () => Promise<GitPosition>;
|
|
293
|
+
/** No tracked file changed. */
|
|
294
|
+
isClean: () => Promise<boolean>;
|
|
295
|
+
tagCommit: (tag: string) => Promise<string | null>;
|
|
296
|
+
/** The commit that brought a version into a folder's manifest. */
|
|
297
|
+
versionCommit: (dir: string, manifest: string, version: string) => Promise<{
|
|
298
|
+
sha: string;
|
|
299
|
+
subject: string;
|
|
300
|
+
} | null>;
|
|
301
|
+
/** Subjects of the commits that touched a folder since a commit, newest first, `ignore` aside. */
|
|
302
|
+
subjectsSince: (sha: string, dir: string, ignore?: readonly string[]) => Promise<string[]>;
|
|
303
|
+
/** The commits after `from` up to `to`, newest first: each subject and the files it touched. */
|
|
304
|
+
commitsBetween: (from: string, to: string) => Promise<{
|
|
305
|
+
subject: string;
|
|
306
|
+
files: string[];
|
|
307
|
+
}[]>;
|
|
308
|
+
/** Modified and untracked files, relative to the root. */
|
|
309
|
+
changedFiles: () => Promise<string[]>;
|
|
310
|
+
diffNames: (from: string, to: string) => Promise<string[]>;
|
|
311
|
+
fileAt: (ref: string, file: string) => Promise<string | null>;
|
|
312
|
+
tags: () => Promise<Set<string>>;
|
|
313
|
+
createBranch: (name: string) => Promise<void>;
|
|
314
|
+
switchTo: (branch: string) => Promise<void>;
|
|
315
|
+
commit: (files: string[], title: string, body?: string) => Promise<void>;
|
|
316
|
+
push: (branch: string) => Promise<void>;
|
|
317
|
+
pull: () => Promise<void>;
|
|
318
|
+
tag: (name: string, sha: string, message: string) => Promise<void>;
|
|
319
|
+
pushTags: (names: string[]) => Promise<void>;
|
|
320
|
+
/** Puts tracked files back as committed and removes `files` this release created. */
|
|
321
|
+
discard: (files: string[]) => Promise<void>;
|
|
322
|
+
deleteBranch: (name: string) => Promise<void>;
|
|
323
|
+
deleteRemoteBranch: (branch: string) => Promise<void>;
|
|
324
|
+
deleteTag: (name: string) => Promise<void>;
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/ports/terminal.port.d.ts
|
|
328
|
+
/** Where the CLI writes for a person to read. */
|
|
329
|
+
interface Output {
|
|
330
|
+
line: (text?: string) => void;
|
|
331
|
+
}
|
|
332
|
+
interface Choice<Value extends string> {
|
|
333
|
+
value: Value;
|
|
334
|
+
label: string;
|
|
335
|
+
hint?: string;
|
|
336
|
+
disabled?: boolean;
|
|
337
|
+
}
|
|
338
|
+
/** Questions to the person. Without a terminal, nothing is asked: each answer is null or false. */
|
|
339
|
+
interface Prompter {
|
|
340
|
+
readonly interactive: boolean;
|
|
341
|
+
/** `initial` is the answer offered first: No unless said. */
|
|
342
|
+
confirm: (question: string, initial?: boolean) => Promise<boolean>;
|
|
343
|
+
/** The typed confirmation production asks for: true only when the word is typed exactly. */
|
|
344
|
+
typed: (question: string, word: string) => Promise<boolean>;
|
|
345
|
+
select: <Value extends string>(message: string, choices: Choice<Value>[], initial?: Value) => Promise<Value | null>;
|
|
346
|
+
multiselect: <Value extends string>(message: string, choices: Choice<Value>[], initial: Value[]) => Promise<Value[] | null>;
|
|
347
|
+
text: (message: string, initial?: string) => Promise<string | null>;
|
|
348
|
+
/** Shows `label` as waiting for up to `ms`; resolves with a key from `keys`, or null on timeout. */
|
|
349
|
+
waitForKey: (label: string, ms: number, keys: readonly string[]) => Promise<string | null>;
|
|
350
|
+
}
|
|
351
|
+
interface Clock {
|
|
352
|
+
now: () => Date;
|
|
353
|
+
/** Waits, unless something wakes it first. */
|
|
354
|
+
sleep: (ms: number) => Promise<void>;
|
|
355
|
+
}
|
|
356
|
+
/** A step's place in its run, for the counter and the bar. */
|
|
357
|
+
interface StepPlace {
|
|
358
|
+
index: number;
|
|
359
|
+
total: number;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Where the release is, for a person to follow: the stage of its journey, what it is reading or
|
|
363
|
+
* running right now, and the mascot's mood. How much of it shows is the adapter's choice.
|
|
364
|
+
*/
|
|
365
|
+
interface Progress {
|
|
366
|
+
/** The release reached `stages[index]`. */
|
|
367
|
+
stage: (stages: readonly string[], index: number) => void;
|
|
368
|
+
/** Runs `work` while showing `label`; a step also shows its place in its run. */
|
|
369
|
+
during: <T>(label: string, mood: Mood, work: () => Promise<T>, step?: StepPlace) => Promise<T>;
|
|
370
|
+
/** One line, said in a mood: done, failed, nothing to do. */
|
|
371
|
+
say: (mood: Mood, text: string) => void;
|
|
372
|
+
}
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/ports/delivery.port.d.ts
|
|
375
|
+
/** One command, as data: run here, printed by a dry run, mirrored by a CI workflow. */
|
|
376
|
+
interface Command {
|
|
377
|
+
command: string;
|
|
378
|
+
args: string[];
|
|
379
|
+
/** Relative to the repository root; the root itself when absent. */
|
|
380
|
+
cwd?: string;
|
|
381
|
+
env?: Record<string, string>;
|
|
382
|
+
/** Variables passed as `<flag> NAME=value` when set; a plan shows only `NAME=$NAME`. */
|
|
383
|
+
secrets?: {
|
|
384
|
+
flag: string;
|
|
385
|
+
name: string;
|
|
386
|
+
}[];
|
|
387
|
+
}
|
|
388
|
+
/** What shipping one tag to one environment takes. Built, never run, by an adapter. */
|
|
389
|
+
interface Job {
|
|
390
|
+
/** What a person reads: "deploy api@0.4.2 to acme-api-preview (Fly)". */
|
|
391
|
+
label: string;
|
|
392
|
+
/** The commands this machine runs, in order. */
|
|
393
|
+
local: Command[];
|
|
394
|
+
/** The ref the CI pipeline's ship workflow runs these commands from; absent when only here can. */
|
|
395
|
+
ci?: {
|
|
396
|
+
ref: string;
|
|
397
|
+
};
|
|
398
|
+
/** Record the deploy in the host's deploy records once it ran from this machine. */
|
|
399
|
+
record?: boolean;
|
|
400
|
+
/** Runs after `local` whether it failed or not, such as putting a manifest back. */
|
|
401
|
+
cleanup?: Command[];
|
|
402
|
+
}
|
|
403
|
+
/** What an adapter is told when asked for its jobs. */
|
|
404
|
+
interface JobInput<Options> {
|
|
405
|
+
unit: ReleaseUnit;
|
|
406
|
+
/** The tag being shipped: `<unit>@<version>`. */
|
|
407
|
+
tag: string;
|
|
408
|
+
environment: Environment;
|
|
409
|
+
/** The unit's options for that environment, per-environment values picked, references filled. */
|
|
410
|
+
options: Options;
|
|
411
|
+
/** The commit this machine is on. */
|
|
412
|
+
commit: string;
|
|
413
|
+
}
|
|
414
|
+
/** What a module's per-app stages may read and run. */
|
|
415
|
+
interface DecideContext {
|
|
416
|
+
root: string;
|
|
417
|
+
shell: Shell;
|
|
418
|
+
sourceControl: SourceControlPort;
|
|
419
|
+
codeHost: CodeHostPort;
|
|
420
|
+
ciPipeline: CiPipelinePort;
|
|
421
|
+
units: readonly ReleaseUnit[];
|
|
422
|
+
/** How a tag names a version, such as `{name}@{version}`. */
|
|
423
|
+
tagFormat: string;
|
|
424
|
+
/** Every file a release may move after a tag without changing what ships. */
|
|
425
|
+
versionFiles: ReadonlySet<string>;
|
|
426
|
+
/** The files changed between two commits that can reach what a unit ships. */
|
|
427
|
+
changedCode: (unit: ReleaseUnit, from: string, to: string) => Promise<string[]>;
|
|
428
|
+
now: () => Date;
|
|
429
|
+
/** The port an adapter gives, created for this repository. */
|
|
430
|
+
open: <Port>(adapter: Adapter<Port>) => Port;
|
|
431
|
+
}
|
|
432
|
+
/** How a version does where it runs, as its platform reports it. */
|
|
433
|
+
interface Health {
|
|
434
|
+
ok: boolean;
|
|
435
|
+
/** What was measured, as a person reads it: "iOS 3 launches, 0 crashes". */
|
|
436
|
+
summary: string;
|
|
437
|
+
/** Why it looks unwell, when it does. */
|
|
438
|
+
why?: string;
|
|
439
|
+
}
|
|
440
|
+
/** What a failure says, and what to run next. */
|
|
441
|
+
interface Refusal {
|
|
442
|
+
title: string;
|
|
443
|
+
detail: string;
|
|
444
|
+
commands: string[];
|
|
445
|
+
}
|
|
446
|
+
/** What a unit needs on an environment, as its adapter decides. */
|
|
447
|
+
type Decision =
|
|
448
|
+
/**
|
|
449
|
+
* Ship: a build, a submit or a publish runs from here; an update or a deploy asks how.
|
|
450
|
+
* `notLocal` says why this machine cannot ship it, leaving GitHub Actions.
|
|
451
|
+
*/
|
|
452
|
+
{
|
|
453
|
+
action: "ship";
|
|
454
|
+
kind: "build" | "submit" | "publish" | "update" | "deploy";
|
|
455
|
+
jobs: Job[];
|
|
456
|
+
notLocal?: string;
|
|
457
|
+
} /** Nothing to do; the status says why. */ | {
|
|
458
|
+
action: "none";
|
|
459
|
+
status: string;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* A move only a person picks, such as how far a rollout goes: `lines` say where it stands, then
|
|
463
|
+
* the question; an option with no jobs ships nothing and says `held`.
|
|
464
|
+
*/
|
|
465
|
+
| {
|
|
466
|
+
action: "choose";
|
|
467
|
+
lines: string[];
|
|
468
|
+
question: string;
|
|
469
|
+
suggested: string;
|
|
470
|
+
options: (Choice<string> & {
|
|
471
|
+
jobs: Job[];
|
|
472
|
+
})[];
|
|
473
|
+
held: string;
|
|
474
|
+
} | ({
|
|
475
|
+
action: "fail";
|
|
476
|
+
} & Refusal) /** A small PR has to merge first, such as moving a version; the adapter decides again after it. */ | {
|
|
477
|
+
action: "pull-request";
|
|
478
|
+
question: string;
|
|
479
|
+
branch: string;
|
|
480
|
+
title: string;
|
|
481
|
+
body: string;
|
|
482
|
+
changesets: PlannedChangeset[]; /** Writes its files and returns them, relative to the root. */
|
|
483
|
+
write: () => Promise<string[]>;
|
|
484
|
+
};
|
|
485
|
+
/** A question its detection answers first: the person sees why and may pick another option. */
|
|
486
|
+
interface VersionChoice {
|
|
487
|
+
question: string;
|
|
488
|
+
options: Choice<string>[];
|
|
489
|
+
suggested: string;
|
|
490
|
+
}
|
|
491
|
+
/** What an adapter adds to a release PR: changesets it writes, files it moves, what a person reads. */
|
|
492
|
+
interface VersionContribution {
|
|
493
|
+
blocked?: Refusal;
|
|
494
|
+
/** Asked before the summary; the adapter runs again with the answer when it differs. */
|
|
495
|
+
choice?: VersionChoice;
|
|
496
|
+
added: PlannedChangeset[];
|
|
497
|
+
writes: {
|
|
498
|
+
label: string;
|
|
499
|
+
run: () => Promise<void>;
|
|
500
|
+
}[];
|
|
501
|
+
/** Lines under the unit in the summary. */
|
|
502
|
+
summary: string[];
|
|
503
|
+
/** The "On merge" cell of the release PR. */
|
|
504
|
+
onMerge: string;
|
|
505
|
+
/** A numbered step the release announces before anything runs. */
|
|
506
|
+
step?: string;
|
|
507
|
+
}
|
|
508
|
+
/** A folder as `init` shows it to an adapter, to recognise what ships from it. */
|
|
509
|
+
interface FolderView {
|
|
510
|
+
/** Relative to the root. */
|
|
511
|
+
dir: string;
|
|
512
|
+
name: string;
|
|
513
|
+
/** Entries directly in it. */
|
|
514
|
+
files: string[];
|
|
515
|
+
has: (file: string) => boolean;
|
|
516
|
+
read: (file: string) => string | null;
|
|
517
|
+
}
|
|
518
|
+
/** What an adapter recognised in a folder. */
|
|
519
|
+
interface Detection {
|
|
520
|
+
/**
|
|
521
|
+
* `found`: a file only this target uses. `likely`: a strong sign, such as a static build's
|
|
522
|
+
* config. `possible`: a weak one, such as a Dockerfile. The strongest is suggested.
|
|
523
|
+
*/
|
|
524
|
+
certainty: "found" | "likely" | "possible";
|
|
525
|
+
/** What was seen, as a person reads it: "fly-preview.toml". */
|
|
526
|
+
reason: string;
|
|
527
|
+
/** Options read from what was seen; `questions` asks for the rest. */
|
|
528
|
+
options: Record<string, unknown>;
|
|
529
|
+
}
|
|
530
|
+
/** An option `init` asks for when nothing in the folder said it. */
|
|
531
|
+
interface Question {
|
|
532
|
+
key: string;
|
|
533
|
+
message: string;
|
|
534
|
+
initial?: string;
|
|
535
|
+
}
|
|
536
|
+
/** A tool or sign-in an adapter needs, checked by `shiplane doctor`. */
|
|
537
|
+
interface Requirement {
|
|
538
|
+
label: string;
|
|
539
|
+
/** Exits 0 when the requirement is met. */
|
|
540
|
+
check: Command;
|
|
541
|
+
/** What fixes it, offered to run. */
|
|
542
|
+
fix?: Command;
|
|
543
|
+
}
|
|
544
|
+
/** A value per environment becomes the value itself, at any depth. */
|
|
545
|
+
type Resolved<Value> = Value extends {
|
|
546
|
+
preview: infer Inner;
|
|
547
|
+
production: infer Inner;
|
|
548
|
+
} ? Resolved<Inner> : Value extends readonly (infer Item)[] ? Resolved<Item>[] : Value extends object ? { [Key in keyof Value]: Resolved<Value[Key]> } : Value;
|
|
549
|
+
/** What every delivery port does: say where a tag lands, and build the jobs that ship it. */
|
|
550
|
+
interface Delivery<Options = Record<string, unknown>> {
|
|
551
|
+
/** Where a tag lands, as a person reads it. */
|
|
552
|
+
describe(input: JobInput<Options>): string;
|
|
553
|
+
/** What shipping a tag runs: commands as data, never run by the adapter itself. */
|
|
554
|
+
jobs(input: JobInput<Options>): Job[];
|
|
555
|
+
}
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region src/ports/adapter.port.d.ts
|
|
558
|
+
/** What an adapter is given when the CLI creates its port: the repository and a shell. */
|
|
559
|
+
interface AdapterContext {
|
|
560
|
+
root: string;
|
|
561
|
+
shell: Shell;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* An adapter as shiplane.config.ts holds it: a recipe, not a live object. The CLI creates the port
|
|
565
|
+
* when a module runs, so reloading the config creates fresh ports.
|
|
566
|
+
*/
|
|
567
|
+
interface Adapter<Port> {
|
|
568
|
+
/** The provider: "git", "fly". */
|
|
569
|
+
readonly name: string;
|
|
570
|
+
readonly create: (context: AdapterContext) => Port;
|
|
571
|
+
}
|
|
572
|
+
/** An adapter of a port the release flow runs on: source control, code host, CI, versioning. */
|
|
573
|
+
interface ServiceAdapter<Port> extends Adapter<Port> {
|
|
574
|
+
/** Tools and sign-ins it needs, checked by `shiplane doctor`. */
|
|
575
|
+
readonly requirements?: () => Requirement[];
|
|
576
|
+
}
|
|
577
|
+
/** An adapter of a delivery port: what its apps' unit files hold, and what `init` recognises. */
|
|
578
|
+
interface DeliveryAdapter<Port extends {
|
|
579
|
+
capability: string;
|
|
580
|
+
}> extends Adapter<Port> {
|
|
581
|
+
/** The kind of delivery its port does, the one `init` picks a module by. */
|
|
582
|
+
readonly capability: Port["capability"];
|
|
583
|
+
/** The keys an app's unit file holds for it besides `module`. */
|
|
584
|
+
readonly settings: z.ZodObject;
|
|
585
|
+
/** Billed minutes of its CI deploy, used until a run has been measured. */
|
|
586
|
+
readonly typicalMinutes?: number;
|
|
587
|
+
/** Set when its own platform, not deploy records, knows what is live. */
|
|
588
|
+
readonly decidedBy?: DecidedBy;
|
|
589
|
+
/** What `init` recognises in a folder it ships. */
|
|
590
|
+
readonly detect?: (folder: FolderView) => Detection | null;
|
|
591
|
+
/** Settings `init` asks for that `detect` could not read. */
|
|
592
|
+
readonly questions?: (folder: FolderView, found: Record<string, unknown>, repository: string) => Question[];
|
|
593
|
+
/** Tools and sign-ins it needs for an app. */
|
|
594
|
+
readonly requirements?: (unit: ReleaseUnit) => Requirement[];
|
|
595
|
+
}
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region src/ports/versioning.port.d.ts
|
|
598
|
+
/** The intent to release: changesets today. */
|
|
599
|
+
interface VersioningPort {
|
|
600
|
+
/** Pending change files, by id, with their raw text. */
|
|
601
|
+
pending: () => Promise<{
|
|
602
|
+
id: string;
|
|
603
|
+
text: string;
|
|
604
|
+
}[]>;
|
|
605
|
+
/** What versioning would move, with these added and the `waits` held back, writing nothing. */
|
|
606
|
+
plan: (added: PlannedChangeset[], held: PlannedChangeset[]) => Promise<StatusPlan>;
|
|
607
|
+
/** Writes `added`, versions everything but `held`, and leaves `held` pending. */
|
|
608
|
+
apply: (added: PlannedChangeset[], held: PlannedChangeset[]) => Promise<void>;
|
|
609
|
+
/** Adds one pending changeset, as a person would with `pnpm changeset`. */
|
|
610
|
+
write: (changeset: PlannedChangeset) => Promise<void>;
|
|
611
|
+
/** Each workspace package's runtime workspace dependencies, by package name. */
|
|
612
|
+
dependencies: () => Promise<Record<string, string[]>>;
|
|
613
|
+
/** Each workspace package's folder, relative to the root, by package name. */
|
|
614
|
+
folders: () => Promise<Record<string, string>>;
|
|
615
|
+
/** A pending changeset's file, relative to the root. */
|
|
616
|
+
changesetFile: (id: string) => string;
|
|
617
|
+
/** The changelog a unit keeps, to read release notes from. */
|
|
618
|
+
changelogFile: (dir: string) => string;
|
|
619
|
+
}
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/modules/module.d.ts
|
|
622
|
+
/** What a module's per-app stages are told: the app, its tag, its settings for that environment. */
|
|
623
|
+
type AppInput = JobInput<Record<string, unknown>>;
|
|
624
|
+
/** Where a tag lands, as a person reads it, and the jobs that ship it there. */
|
|
625
|
+
interface ShipPlan {
|
|
626
|
+
where: string;
|
|
627
|
+
jobs: Job[];
|
|
628
|
+
}
|
|
629
|
+
/** An app a ship just triggered on an environment. */
|
|
630
|
+
interface Shipped {
|
|
631
|
+
unit: ReleaseUnit;
|
|
632
|
+
tag: string;
|
|
633
|
+
environment: Environment;
|
|
634
|
+
}
|
|
635
|
+
/** One thing done once apps ship, as data: a ship runs it, a plan only lists it. */
|
|
636
|
+
interface FollowUp {
|
|
637
|
+
label: string;
|
|
638
|
+
run: () => Promise<void>;
|
|
639
|
+
}
|
|
640
|
+
/** Creates the port an adapter gives, for this repository. */
|
|
641
|
+
type Open = <Port>(adapter: Adapter<Port>) => Port;
|
|
642
|
+
/** What a feature is told once apps ship. */
|
|
643
|
+
interface AfterShipContext {
|
|
644
|
+
/** Subjects of the commits after `from` up to `to` whose files can reach what an app ships. */
|
|
645
|
+
subjectsReaching: (unit: ReleaseUnit, from: string, to: string) => Promise<string[]>;
|
|
646
|
+
open: Open;
|
|
647
|
+
/** How a tag names a version, such as `{name}@{version}`. */
|
|
648
|
+
tagFormat: string;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* What gets released: the apps whose unit file names it. Every stage is optional; the release flow
|
|
652
|
+
* owns their order, and the order of `modules` is the release order.
|
|
653
|
+
*/
|
|
654
|
+
interface ReleaseModule {
|
|
655
|
+
readonly type: "module";
|
|
656
|
+
/** What an app's unit file names: its kind, or a name the config gives it. */
|
|
657
|
+
readonly name: string;
|
|
658
|
+
/** "backend-service", "mobile-app". */
|
|
659
|
+
readonly kind: string;
|
|
660
|
+
/** The provider its apps ship with, as output names it: "fly". */
|
|
661
|
+
readonly provider: string;
|
|
662
|
+
/** What its apps' unit files hold besides `module`. */
|
|
663
|
+
readonly settings: z.ZodObject;
|
|
664
|
+
/** The adapters it was given. */
|
|
665
|
+
readonly adapters: readonly Adapter<unknown>[];
|
|
666
|
+
/** Set when its own platform, not deploy records, knows what is live. */
|
|
667
|
+
readonly decidedBy?: DecidedBy;
|
|
668
|
+
/** Set when nothing deploys its apps: a release versions and tags them, nothing more. */
|
|
669
|
+
readonly releaseOnly?: boolean;
|
|
670
|
+
/** Billed minutes of a CI deploy, used until a run has been measured. */
|
|
671
|
+
readonly typicalMinutes?: number;
|
|
672
|
+
/** Tools and sign-ins it needs, given the apps that name it. */
|
|
673
|
+
readonly requirements?: (apps: readonly ReleaseUnit[]) => Requirement[];
|
|
674
|
+
/** Files a release may change after a tag without changing what ships. Relative to the root. */
|
|
675
|
+
readonly versionFiles?: (unit: ReleaseUnit, units: readonly ReleaseUnit[], open: Open) => string[];
|
|
676
|
+
/** Adds to the release PR, given the app's bump in it when there is one. */
|
|
677
|
+
readonly version?: (context: DecideContext, input: AppInput & {
|
|
678
|
+
bump: AppBump | undefined;
|
|
679
|
+
chosen?: string;
|
|
680
|
+
}) => Promise<VersionContribution>;
|
|
681
|
+
/** The tagged version runs on the environment, read from its platform; else deploy records say. */
|
|
682
|
+
readonly live?: (context: DecideContext, input: AppInput) => Promise<boolean>;
|
|
683
|
+
/** Decides what an app needs; without it, deploy records decide and `ship` runs. */
|
|
684
|
+
readonly decide?: (context: DecideContext, input: AppInput) => Promise<Decision>;
|
|
685
|
+
/** Where a tag lands and the jobs that ship it: data, never run by the module itself. */
|
|
686
|
+
readonly ship: (context: DecideContext, input: AppInput) => ShipPlan;
|
|
687
|
+
/** How the tagged version does on preview, read before promoting it. Null when nothing says. */
|
|
688
|
+
readonly health?: (context: DecideContext, input: AppInput) => Promise<Health | null>;
|
|
689
|
+
/** What `status --json` shows for an app, read from its platform. */
|
|
690
|
+
readonly inspect?: (context: DecideContext, input: AppInput) => Promise<unknown>;
|
|
691
|
+
}
|
|
692
|
+
/** What happens around a release, after the ship, such as telling issues what shipped. */
|
|
693
|
+
interface Feature {
|
|
694
|
+
readonly type: "feature";
|
|
695
|
+
readonly name: string;
|
|
696
|
+
/** The adapters it was given, for doctor to check. */
|
|
697
|
+
readonly adapters: readonly Adapter<unknown>[];
|
|
698
|
+
readonly requirements?: () => Requirement[];
|
|
699
|
+
/** What to do once apps ship: it only reads, a ship runs each one, a plan lists them. */
|
|
700
|
+
readonly afterShip: (context: AfterShipContext, shipped: readonly Shipped[]) => Promise<FollowUp[]>;
|
|
701
|
+
}
|
|
702
|
+
/** How the release itself runs: versions, tags, the release PR, GitHub releases, CI. */
|
|
703
|
+
interface ReleaseFlow {
|
|
704
|
+
readonly type: "flow";
|
|
705
|
+
readonly sourceControl: ServiceAdapter<SourceControlPort>;
|
|
706
|
+
readonly codeHost: ServiceAdapter<CodeHostPort>;
|
|
707
|
+
readonly ciPipeline: ServiceAdapter<CiPipelinePort>;
|
|
708
|
+
readonly versioning: ServiceAdapter<VersioningPort>;
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/application/config/defineRelease.d.ts
|
|
712
|
+
/** How a repository releases: the flow, what gets released in order, and what happens around it. */
|
|
713
|
+
interface ReleaseConfig {
|
|
714
|
+
/** Folders to look in, `dir/*` or exact. Without it, the workspace file decides. */
|
|
715
|
+
units?: string[];
|
|
716
|
+
/** How the release itself runs: an adapter per port, each from its plugin. */
|
|
717
|
+
flow: ReleaseFlow;
|
|
718
|
+
/** What gets released, in this order. The first app is the repository's Latest release. */
|
|
719
|
+
modules: ReleaseModule[];
|
|
720
|
+
/** What happens around a release, after the ship, in this order. */
|
|
721
|
+
features?: Feature[];
|
|
722
|
+
/** How a tag names a version: `{name}@{version}` when absent, or e.g. `v{version}`, `{name}--v{version}`. */
|
|
723
|
+
tag?: string;
|
|
724
|
+
/**
|
|
725
|
+
* A unit whose folder changed with no changeset naming it: `"ignore"` (the default, as changesets
|
|
726
|
+
* does) leaves it, `"release"` offers it with a changelog from its commits.
|
|
727
|
+
*/
|
|
728
|
+
commitsWithoutChangeset?: "release" | "ignore";
|
|
729
|
+
/** How much the release says while it runs; `--verbose` and `--mascot` (or `--no-…`) override. */
|
|
730
|
+
display?: DisplayChoice;
|
|
731
|
+
}
|
|
732
|
+
declare const defineRelease: (config: ReleaseConfig) => ReleaseConfig;
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region src/ports/mobile-distribution.port.d.ts
|
|
735
|
+
/**
|
|
736
|
+
* Ships a mobile app to the stores or over the air: EAS today. Its own platform knows what is live,
|
|
737
|
+
* decides between a binary and an update, and reports how a version does.
|
|
738
|
+
*/
|
|
739
|
+
interface MobileDistributionPort<Options = Record<string, unknown>> extends Delivery<Options> {
|
|
740
|
+
readonly capability: "mobile-distribution";
|
|
741
|
+
/** A store build, an over-the-air update, a choice for the person, or nothing. */
|
|
742
|
+
decide(context: DecideContext, input: JobInput<Options>): Promise<Decision>;
|
|
743
|
+
/**
|
|
744
|
+
* Files a release may change after the tag without changing what ships, such as the binary's
|
|
745
|
+
* version file. Relative to the root.
|
|
746
|
+
*/
|
|
747
|
+
versionFiles?(unit: ReleaseUnit, units: readonly ReleaseUnit[]): string[];
|
|
748
|
+
/** Adds to the release PR, given the app's bump in it when there is one. */
|
|
749
|
+
beforeVersion?(context: DecideContext, input: JobInput<Options> & {
|
|
750
|
+
bump: AppBump | undefined; /** The person's answer to its `choice`, once asked. */
|
|
751
|
+
chosen?: string;
|
|
752
|
+
}): Promise<VersionContribution>;
|
|
753
|
+
/** What `status --json` shows for the app, read from its platform. */
|
|
754
|
+
inspect?(context: DecideContext, input: JobInput<Options>): Promise<unknown>;
|
|
755
|
+
/** How the tagged version does on preview, read before promoting it. Null when nothing says. */
|
|
756
|
+
health?(context: DecideContext, input: JobInput<Options>): Promise<Health | null>;
|
|
757
|
+
}
|
|
758
|
+
//#endregion
|
|
759
|
+
//#region src/ports/package-registry.port.d.ts
|
|
760
|
+
/** Publishes a package and points a dist-tag at it: npm today. */
|
|
761
|
+
interface PackageRegistryPort<Options = Record<string, unknown>> extends Delivery<Options> {
|
|
762
|
+
readonly capability: "package-registry";
|
|
763
|
+
/** Publish, move a tag, or nothing: the registry, not GitHub Deployments, knows what is out. */
|
|
764
|
+
decide(context: DecideContext, input: JobInput<Options>): Promise<Decision>;
|
|
765
|
+
/** The version is out on the environment: published, and its dist-tag points at it. */
|
|
766
|
+
live(context: DecideContext, input: JobInput<Options>): Promise<boolean>;
|
|
767
|
+
}
|
|
768
|
+
//#endregion
|
|
769
|
+
//#region src/ports/server-hosting.port.d.ts
|
|
770
|
+
/** Runs a long-lived service, such as an API, from a tag: Fly.io today. */
|
|
771
|
+
interface ServerHostingPort<Options = Record<string, unknown>> extends Delivery<Options> {
|
|
772
|
+
readonly capability: "server-hosting";
|
|
773
|
+
}
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/ports/static-hosting.port.d.ts
|
|
776
|
+
/** Serves a static build, built against its environment: Cloudflare Pages today. */
|
|
777
|
+
interface StaticHostingPort<Options = Record<string, unknown>> extends Delivery<Options> {
|
|
778
|
+
readonly capability: "static-hosting";
|
|
779
|
+
}
|
|
780
|
+
//#endregion
|
|
781
|
+
//#region src/adapters/defineDelivery.d.ts
|
|
782
|
+
/**
|
|
783
|
+
* What an adapter author writes in one object: the recipe's static parts (name, settings, what init
|
|
784
|
+
* and doctor ask) and the port's members, which read the settings typed.
|
|
785
|
+
*/
|
|
786
|
+
type Authored<Port extends {
|
|
787
|
+
capability: string;
|
|
788
|
+
}, Schema extends z.ZodObject> = Omit<Port, "capability"> & Omit<DeliveryAdapter<Port>, "create" | "settings" | "capability"> & {
|
|
789
|
+
readonly settings: Schema;
|
|
790
|
+
};
|
|
791
|
+
type Typed<Schema extends z.ZodObject> = Resolved<z.output<Schema>>;
|
|
792
|
+
declare const defineServerHosting: <const Schema extends z.ZodObject>(adapter: Authored<ServerHostingPort<Typed<Schema>>, Schema>) => DeliveryAdapter<ServerHostingPort>;
|
|
793
|
+
declare const defineStaticHosting: <const Schema extends z.ZodObject>(adapter: Authored<StaticHostingPort<Typed<Schema>>, Schema>) => DeliveryAdapter<StaticHostingPort>;
|
|
794
|
+
declare const defineMobileDistribution: <const Schema extends z.ZodObject>(adapter: Authored<MobileDistributionPort<Typed<Schema>>, Schema> & Required<Pick<DeliveryAdapter<MobileDistributionPort>, "decidedBy">>) => DeliveryAdapter<MobileDistributionPort>;
|
|
795
|
+
declare const definePackageRegistry: <const Schema extends z.ZodObject>(adapter: Authored<PackageRegistryPort<Typed<Schema>>, Schema>) => DeliveryAdapter<PackageRegistryPort>;
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region src/application/releaseFlow.d.ts
|
|
798
|
+
/** How the release itself runs, given an adapter for each port it runs on. */
|
|
799
|
+
declare const releaseFlow: (ports: {
|
|
800
|
+
sourceControl: ServiceAdapter<SourceControlPort>;
|
|
801
|
+
codeHost: ServiceAdapter<CodeHostPort>;
|
|
802
|
+
ciPipeline: ServiceAdapter<CiPipelinePort>;
|
|
803
|
+
versioning: ServiceAdapter<VersioningPort>;
|
|
804
|
+
}) => ReleaseFlow;
|
|
805
|
+
//#endregion
|
|
806
|
+
//#region src/modules/deliveryModule.d.ts
|
|
807
|
+
/** What every module of apps takes besides its adapter: a name, when two of a kind sit side by side. */
|
|
808
|
+
interface Named {
|
|
809
|
+
/** What an app's unit file names; the module's kind by default. */
|
|
810
|
+
name?: string;
|
|
811
|
+
}
|
|
812
|
+
//#endregion
|
|
813
|
+
//#region src/modules/backend-service/backend-service.module.d.ts
|
|
814
|
+
/** A long-lived service, such as an API: deployed from its tag, recorded with the code host. */
|
|
815
|
+
declare const backendService: ({
|
|
816
|
+
name,
|
|
817
|
+
serverHosting
|
|
818
|
+
}: Named & {
|
|
819
|
+
serverHosting: DeliveryAdapter<ServerHostingPort>;
|
|
820
|
+
}) => ReleaseModule;
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region src/modules/internal-tool/internal-tool.module.d.ts
|
|
823
|
+
/**
|
|
824
|
+
* An app nothing deploys, such as a CLI run from the repository: a release versions it, tags it and
|
|
825
|
+
* publishes its notes, and every environment counts it as shipped once tagged.
|
|
826
|
+
*/
|
|
827
|
+
declare const internalTool: ({
|
|
828
|
+
name
|
|
829
|
+
}?: Named) => ReleaseModule;
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/modules/mobile-app/mobile-app.module.d.ts
|
|
832
|
+
/**
|
|
833
|
+
* A mobile app: its distribution decides between a store build and an over-the-air update, adds to
|
|
834
|
+
* the release PR, and says how a version does before it is promoted.
|
|
835
|
+
*/
|
|
836
|
+
declare const mobileApp: ({
|
|
837
|
+
name,
|
|
838
|
+
mobileDistribution
|
|
839
|
+
}: Named & {
|
|
840
|
+
mobileDistribution: DeliveryAdapter<MobileDistributionPort>;
|
|
841
|
+
}) => ReleaseModule;
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region src/modules/published-package/published-package.module.d.ts
|
|
844
|
+
/** A package others install: its registry, not deploy records, knows what is out. */
|
|
845
|
+
declare const publishedPackage: ({
|
|
846
|
+
name,
|
|
847
|
+
packageRegistry
|
|
848
|
+
}: Named & {
|
|
849
|
+
packageRegistry: DeliveryAdapter<PackageRegistryPort>;
|
|
850
|
+
}) => ReleaseModule;
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region src/modules/web-app/web-app.module.d.ts
|
|
853
|
+
/** A static site, built against the environment it ships to. */
|
|
854
|
+
declare const webApp: ({
|
|
855
|
+
name,
|
|
856
|
+
staticHosting
|
|
857
|
+
}: Named & {
|
|
858
|
+
staticHosting: DeliveryAdapter<StaticHostingPort>;
|
|
859
|
+
}) => ReleaseModule;
|
|
860
|
+
//#endregion
|
|
861
|
+
//#region src/adapters/server-hosting/shell-server-hosting.adapter.d.ts
|
|
862
|
+
/** Anything a command ships: the escape hatch until a host has its own adapter. */
|
|
863
|
+
type ShellServerHostingAdapter = DeliveryAdapter<ServerHostingPort>;
|
|
864
|
+
declare const shellServerHosting: () => ShellServerHostingAdapter;
|
|
865
|
+
//#endregion
|
|
866
|
+
export { CommandFailed as $, ServiceAdapter as A, PerEnv as At, Resolved as B, ReleaseFlow as C, UnitRef as Ct, Adapter as D, DisplayChoice as Dt, VersioningPort as E, splitChangesets as Et, Health as F, Output as G, VersionContribution as H, Job as I, StepPlace as J, Progress as K, JobInput as L, DecideContext as M, ReleaseUnit as Mt, Decision as N, Environment as Nt, AdapterContext as O, Mood as Ot, Delivery as P, yesAllowed as Q, Refusal as R, Open as S, StatusPlan as St, Shipped as T, appBumps as Tt, Choice as U, VersionChoice as V, Clock as W, GitPosition as X, SourceControlPort as Y, releaseSource as Z, ReleaseConfig as _, deployRunTitle as _t, mobileApp as a, Deploy as at, Feature as b, AppBump as bt, releaseFlow as c, OpenPr as ct, defineServerHosting as d, LinkedPr as dt, RunOptions as et, defineStaticHosting as f, issueName as ft, MobileDistributionPort as g, DeployPath as gt, PackageRegistryPort as h, billedMinutes as ht, publishedPackage as i, CodeHostPort as it, Command as j, perEnv as jt, DeliveryAdapter as k, progressBar as kt, defineMobileDistribution as l, ReleaseStep as lt, ServerHostingPort as m, actionsMinutes as mt, shellServerHosting as n, ShellResult as nt, internalTool as o, MergeMethod as ot, StaticHostingPort as p, ActionsMinutes as pt, Prompter as q, webApp as r, CiPipelinePort as rt, backendService as s, MergeMethods as st, z$1 as t, Shell as tt, definePackageRegistry as u, IssueRef as ut, defineRelease as v, deployState as vt, ReleaseModule as w, UnreleasedApp as wt, FollowUp as x, PlannedChangeset as xt, AfterShipContext as y, onlyVersionFiles as yt, Requirement as z };
|
|
867
|
+
//# sourceMappingURL=index-QneBUiDD.d.ts.map
|