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.
@@ -0,0 +1,992 @@
1
+ import { A as ServiceAdapter, C as ReleaseFlow, Ct as UnitRef, Dt as DisplayChoice, E as VersioningPort, Et as splitChangesets, F as Health, G as Output, H as VersionContribution, I as Job, J as StepPlace, K as Progress, L as JobInput, M as DecideContext, Mt as ReleaseUnit, Nt as Environment, Ot as Mood, P as Delivery, S as Open, St as StatusPlan, U as Choice, W as Clock, X as GitPosition, Y as SourceControlPort, at as Deploy, b as Feature, bt as AppBump, ct as OpenPr, dt as LinkedPr, et as RunOptions, g as MobileDistributionPort, gt as DeployPath, h as PackageRegistryPort, it as CodeHostPort, k as DeliveryAdapter, lt as ReleaseStep, m as ServerHostingPort, nt as ShellResult, ot as MergeMethod, p as StaticHostingPort, pt as ActionsMinutes, q as Prompter, rt as CiPipelinePort, st as MergeMethods, tt as Shell, ut as IssueRef, w as ReleaseModule, wt as UnreleasedApp, xt as PlannedChangeset, z as Requirement } from "./index-QneBUiDD.js";
2
+ import { n as ReleaseTag } from "./tags-DL74ni09.js";
3
+ import { z } from "zod";
4
+ import * as _$vitest from "vitest";
5
+
6
+ //#region src/testing/deliveryContract.d.ts
7
+ /** One adapter of a port, with settings an app's unit file could hold for it. */
8
+ interface ContractCase<Port extends Delivery & {
9
+ capability: string;
10
+ }> {
11
+ adapter: DeliveryAdapter<Port>;
12
+ settings: Record<string, unknown>;
13
+ }
14
+ //#endregion
15
+ //#region src/adapters/server-hosting/server-hosting.contract.d.ts
16
+ /** What every server host does, whatever its provider. */
17
+ declare const serverHostingContract: (cases: ContractCase<ServerHostingPort>[]) => void;
18
+ //#endregion
19
+ //#region src/adapters/static-hosting/static-hosting.contract.d.ts
20
+ /** What every static host does, whatever its provider. */
21
+ declare const staticHostingContract: (cases: ContractCase<StaticHostingPort>[]) => void;
22
+ //#endregion
23
+ //#region src/adapters/mobile-distribution/mobile-distribution.contract.d.ts
24
+ /** What every mobile distribution does, whatever its provider. */
25
+ declare const mobileDistributionContract: (cases: ContractCase<MobileDistributionPort>[]) => void;
26
+ //#endregion
27
+ //#region src/adapters/package-registry/package-registry.contract.d.ts
28
+ /** What every package registry does, whatever its provider. */
29
+ declare const packageRegistryContract: (cases: ContractCase<PackageRegistryPort>[]) => void;
30
+ //#endregion
31
+ //#region src/adapters/source-control/source-control.contract.d.ts
32
+ /** A repository on main with one commit, and the ways a test arranges it beyond the port. */
33
+ interface SourceControlSubject {
34
+ port: SourceControlPort;
35
+ /** The commit main is on. */
36
+ head: () => Promise<string>;
37
+ /** Writes a file the repository does not track yet. */
38
+ change: (file: string, text: string) => Promise<void>;
39
+ }
40
+ /** What every source control does, whatever its provider. */
41
+ declare const sourceControlContract: (name: string, subject: () => Promise<SourceControlSubject>) => _$vitest.SuiteCollector<object>;
42
+ //#endregion
43
+ //#region src/adapters/code-host/code-host.contract.d.ts
44
+ /** A repository on a code host, and the ways a test arranges it beyond the port. */
45
+ interface CodeHostSubject {
46
+ port: CodeHostPort;
47
+ /** A branch the host can open a pull request from, pushed with one commit on it. */
48
+ branch: (name: string) => Promise<string>;
49
+ /** A tag the host can publish release notes for. */
50
+ tag: () => Promise<string>;
51
+ /** An issue or pull request comments can go on. */
52
+ issue: IssueRef;
53
+ }
54
+ /** What every code host does, whatever its provider. */
55
+ declare const codeHostContract: (name: string, subject: () => Promise<CodeHostSubject>) => _$vitest.SuiteCollector<object>;
56
+ //#endregion
57
+ //#region src/adapters/ci-pipeline/ci-pipeline.contract.d.ts
58
+ /** A CI pipeline, and the ways a test reads it beyond the port. */
59
+ interface CiPipelineSubject {
60
+ port: CiPipelinePort;
61
+ /** A workflow that exists and has never run. */
62
+ idle: string;
63
+ }
64
+ /** What every CI pipeline does, whatever its provider. */
65
+ declare const ciPipelineContract: (name: string, subject: () => Promise<CiPipelineSubject>) => _$vitest.SuiteCollector<object>;
66
+ //#endregion
67
+ //#region src/adapters/versioning/versioning.contract.d.ts
68
+ /** A workspace with one package, and the ways a test arranges it beyond the port. */
69
+ interface VersioningSubject {
70
+ port: VersioningPort;
71
+ /** The package the workspace holds, and its folder. */
72
+ workspace: {
73
+ name: string;
74
+ folder: string;
75
+ };
76
+ }
77
+ /** What every versioning does, whatever its provider. */
78
+ declare const versioningContract: (name: string, subject: () => Promise<VersioningSubject>) => _$vitest.SuiteCollector<object>;
79
+ //#endregion
80
+ //#region src/adapters/server-hosting/__fakes__/server-hosting.fake.d.ts
81
+ /** A deploy a module asked for. */
82
+ interface Asked$3 {
83
+ tag: string;
84
+ environment: Environment;
85
+ service: string;
86
+ }
87
+ /** A server host held in memory: it deploys nothing, and records each deploy it was asked for. */
88
+ declare class ServerHostingFake implements ServerHostingPort {
89
+ readonly capability = "server-hosting";
90
+ private needs;
91
+ readonly received: Asked$3[];
92
+ /** What doctor checks for each app it ships. */
93
+ seed({
94
+ requirements
95
+ }: {
96
+ requirements: Requirement[];
97
+ }): this;
98
+ describe: ({
99
+ options
100
+ }: JobInput<Record<string, unknown>>) => string;
101
+ jobs: ({
102
+ tag,
103
+ environment,
104
+ options
105
+ }: JobInput<Record<string, unknown>>) => Job[];
106
+ requirements: () => Requirement[];
107
+ }
108
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
109
+ declare const serverHostingFake: (fake?: ServerHostingFake) => DeliveryAdapter<ServerHostingPort> & {
110
+ fake: ServerHostingFake;
111
+ };
112
+ //#endregion
113
+ //#region src/adapters/static-hosting/__fakes__/static-hosting.fake.d.ts
114
+ /** An upload a module asked for. */
115
+ interface Asked$2 {
116
+ tag: string;
117
+ environment: Environment;
118
+ site: string;
119
+ }
120
+ /** A static host held in memory: it uploads nothing, and records each upload it was asked for. */
121
+ declare class StaticHostingFake implements StaticHostingPort {
122
+ readonly capability = "static-hosting";
123
+ private needs;
124
+ readonly received: Asked$2[];
125
+ /** What doctor checks for each app it ships. */
126
+ seed({
127
+ requirements
128
+ }: {
129
+ requirements: Requirement[];
130
+ }): this;
131
+ describe: ({
132
+ options,
133
+ environment
134
+ }: JobInput<Record<string, unknown>>) => string;
135
+ jobs: ({
136
+ tag,
137
+ environment,
138
+ options
139
+ }: JobInput<Record<string, unknown>>) => Job[];
140
+ requirements: () => Requirement[];
141
+ }
142
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
143
+ declare const staticHostingFake: (fake?: StaticHostingFake) => DeliveryAdapter<StaticHostingPort> & {
144
+ fake: StaticHostingFake;
145
+ };
146
+ //#endregion
147
+ //#region src/adapters/mobile-distribution/__fakes__/mobile-distribution.fake.d.ts
148
+ interface MobileState {
149
+ /** The version each environment runs. */
150
+ live: Partial<Record<Environment, string>>;
151
+ /** How each tag does where it runs. */
152
+ health: Record<string, Health>;
153
+ requirements: Requirement[];
154
+ }
155
+ /** What a module asked of it. */
156
+ interface Asked$1 {
157
+ stage: "jobs" | "decide" | "health" | "inspect";
158
+ tag: string;
159
+ environment: Environment;
160
+ }
161
+ /**
162
+ * A mobile platform held in memory: seed what each environment runs and how a tag does; a version
163
+ * not live yet ships as an update.
164
+ */
165
+ declare class MobileDistributionFake implements MobileDistributionPort {
166
+ readonly capability = "mobile-distribution";
167
+ private state;
168
+ readonly received: Asked$1[];
169
+ seed(state: Partial<MobileState>): this;
170
+ private ask;
171
+ describe: ({
172
+ options,
173
+ environment
174
+ }: JobInput<Record<string, unknown>>) => string;
175
+ jobs: (input: JobInput<Record<string, unknown>>) => Job[];
176
+ decide: (_context: DecideContext, input: JobInput<Record<string, unknown>>) => Promise<{
177
+ action: "ship";
178
+ kind: "build" | "submit" | "publish" | "update" | "deploy";
179
+ jobs: Job[];
180
+ notLocal?: string;
181
+ } | {
182
+ action: "none";
183
+ status: string;
184
+ }>;
185
+ health: (_context: DecideContext, input: JobInput<Record<string, unknown>>) => Promise<Health>;
186
+ inspect: (_context: DecideContext, input: JobInput<Record<string, unknown>>) => Promise<{
187
+ live: string | null;
188
+ }>;
189
+ requirements: () => Requirement[];
190
+ }
191
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
192
+ declare const mobileDistributionFake: (fake?: MobileDistributionFake) => DeliveryAdapter<MobileDistributionPort> & {
193
+ fake: MobileDistributionFake;
194
+ };
195
+ //#endregion
196
+ //#region src/adapters/package-registry/__fakes__/package-registry.fake.d.ts
197
+ /** What a module asked of it. */
198
+ interface Asked {
199
+ stage: "jobs" | "decide";
200
+ tag: string;
201
+ environment: Environment;
202
+ }
203
+ /** A package registry held in memory: seed what is published, a version not there yet publishes. */
204
+ declare class PackageRegistryFake implements PackageRegistryPort {
205
+ readonly capability = "package-registry";
206
+ /** `<package>@<version>` already published. */
207
+ private published;
208
+ private needs;
209
+ readonly received: Asked[];
210
+ seed({
211
+ published,
212
+ requirements
213
+ }: {
214
+ published?: string[];
215
+ requirements?: Requirement[];
216
+ }): this;
217
+ describe: ({
218
+ unit,
219
+ options
220
+ }: JobInput<Record<string, unknown>>) => string;
221
+ jobs: ({
222
+ unit,
223
+ tag,
224
+ environment,
225
+ options
226
+ }: JobInput<Record<string, unknown>>) => Job[];
227
+ decide: (_context: DecideContext, input: JobInput<Record<string, unknown>>) => Promise<{
228
+ action: "ship";
229
+ kind: "build" | "submit" | "publish" | "update" | "deploy";
230
+ jobs: Job[];
231
+ notLocal?: string;
232
+ } | {
233
+ action: "none";
234
+ status: string;
235
+ }>;
236
+ live: (_context: DecideContext, {
237
+ unit
238
+ }: JobInput<Record<string, unknown>>) => Promise<boolean>;
239
+ requirements: () => Requirement[];
240
+ }
241
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
242
+ declare const packageRegistryFake: (fake?: PackageRegistryFake) => DeliveryAdapter<PackageRegistryPort> & {
243
+ fake: PackageRegistryFake;
244
+ };
245
+ //#endregion
246
+ //#region src/adapters/source-control/__fakes__/source-control.fake.d.ts
247
+ interface SourceState {
248
+ position: GitPosition;
249
+ clean: boolean;
250
+ /** Tag name → the commit it points at. */
251
+ tags: Record<string, string>;
252
+ /** `<dir>@<version>` → the commit that brought that version. */
253
+ versionCommits: Record<string, {
254
+ sha: string;
255
+ subject: string;
256
+ }>;
257
+ /** `<sha>:<dir>` → subjects of the commits since, newest first. */
258
+ subjects: Record<string, string[]>;
259
+ /** `<ref>:<file>` → its text at that ref. */
260
+ files: Record<string, string>;
261
+ /** `<from>..<to>` → the files that differ. */
262
+ diffs: Record<string, string[]>;
263
+ /** `<from>..<to>` → the commits after `from` up to `to`, newest first. */
264
+ commits: Record<string, {
265
+ subject: string;
266
+ files: string[];
267
+ }[]>;
268
+ changed: string[];
269
+ }
270
+ type SourceEvent = {
271
+ type: "branch";
272
+ name: string;
273
+ } | {
274
+ type: "switch";
275
+ branch: string;
276
+ } | {
277
+ type: "commit";
278
+ files: string[];
279
+ title: string;
280
+ body?: string;
281
+ } | {
282
+ type: "push";
283
+ branch: string;
284
+ } | {
285
+ type: "pull";
286
+ } | {
287
+ type: "tag";
288
+ name: string;
289
+ sha: string;
290
+ message: string;
291
+ } | {
292
+ type: "push-tags";
293
+ names: string[];
294
+ } | {
295
+ type: "discard";
296
+ files: string[];
297
+ } | {
298
+ type: "delete-branch";
299
+ name: string;
300
+ } | {
301
+ type: "delete-remote";
302
+ branch: string;
303
+ } | {
304
+ type: "delete-tag";
305
+ name: string;
306
+ };
307
+ /** A repository held in memory: seed what it contains, read back what it received. */
308
+ declare class SourceControlFake implements SourceControlPort {
309
+ private state;
310
+ readonly received: SourceEvent[];
311
+ private failures;
312
+ seed(state: Partial<SourceState>): this;
313
+ /** The `nth` call of this kind throws `error`, after it is recorded. */
314
+ failAt(type: SourceEvent["type"], nth: number, error: Error): this;
315
+ private record;
316
+ position: () => Promise<GitPosition>;
317
+ isClean: () => Promise<boolean>;
318
+ tagCommit: (tag: string) => Promise<string>;
319
+ versionCommit: (dir: string, _manifest: string, version: string) => Promise<{
320
+ sha: string;
321
+ subject: string;
322
+ }>;
323
+ subjectsSince: (sha: string, dir: string) => Promise<string[]>;
324
+ changedFiles: () => Promise<string[]>;
325
+ diffNames: (from: string, to: string) => Promise<string[]>;
326
+ commitsBetween: (from: string, to: string) => Promise<{
327
+ subject: string;
328
+ files: string[];
329
+ }[]>;
330
+ fileAt: (ref: string, file: string) => Promise<string>;
331
+ tags: () => Promise<Set<string>>;
332
+ createBranch: (name: string) => Promise<void>;
333
+ switchTo: (branch: string) => Promise<void>;
334
+ commit: (files: string[], title: string, body?: string) => Promise<void>;
335
+ push: (branch: string) => Promise<void>;
336
+ pull: () => Promise<void>;
337
+ tag: (name: string, sha: string, message: string) => Promise<void>;
338
+ pushTags: (names: string[]) => Promise<void>;
339
+ discard: (files: string[]) => Promise<void>;
340
+ deleteBranch: (name: string) => Promise<void>;
341
+ deleteRemoteBranch: (branch: string) => Promise<void>;
342
+ deleteTag: (name: string) => Promise<void>;
343
+ }
344
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
345
+ declare const sourceControlFake: (fake?: SourceControlFake) => ServiceAdapter<SourceControlPort> & {
346
+ fake: SourceControlFake;
347
+ };
348
+ //#endregion
349
+ //#region src/adapters/code-host/__fakes__/code-host.fake.d.ts
350
+ interface HostState {
351
+ openPrs: {
352
+ branch: string;
353
+ pr: OpenPr;
354
+ }[];
355
+ /** States a pull request goes through, one per poll; the last one stays. */
356
+ prStates: Record<number, ("OPEN" | "MERGED" | "CLOSED")[]>;
357
+ /** The merge methods the repository allows, and the one its pull request page preselects. */
358
+ merges: MergeMethods;
359
+ releasedTags: string[];
360
+ deployments: Deploy[];
361
+ nextPrNumber: number;
362
+ /** Merged pull requests by number, as a release reads their linked issues. */
363
+ pullRequests: Record<number, LinkedPr>;
364
+ /** `owner/name#123` → the text of its comments. */
365
+ comments: Record<string, string[]>;
366
+ }
367
+ type HostEvent = {
368
+ type: "pr";
369
+ pr: OpenPr;
370
+ base: string;
371
+ head: string;
372
+ title: string;
373
+ body: string;
374
+ label: string;
375
+ } | {
376
+ type: "merge";
377
+ pr: OpenPr;
378
+ method: MergeMethod;
379
+ } | {
380
+ type: "close";
381
+ pr: OpenPr;
382
+ comment: string;
383
+ } | {
384
+ type: "release";
385
+ tag: string;
386
+ notes: string;
387
+ latest: boolean;
388
+ } | {
389
+ type: "record";
390
+ ref: string;
391
+ environment: Environment;
392
+ } | {
393
+ type: "comment";
394
+ issue: string;
395
+ body: string;
396
+ };
397
+ /** A code host held in memory: seed its pull requests and deploys, read back what it received. */
398
+ declare class CodeHostFake implements CodeHostPort {
399
+ private state;
400
+ readonly received: HostEvent[];
401
+ /** Each pull request number, once per state check. */
402
+ readonly polled: number[];
403
+ /** Each batched read of pull requests or comments, in order. */
404
+ readonly reads: ("pull-requests" | "comments")[];
405
+ seed(state: Partial<HostState>): this;
406
+ openPrsFrom: (branchPrefix: string) => Promise<OpenPr[]>;
407
+ createPr: (pr: {
408
+ base: string;
409
+ head: string;
410
+ title: string;
411
+ body: string;
412
+ label: string;
413
+ }) => Promise<{
414
+ number: number;
415
+ url: string;
416
+ }>;
417
+ private closeError;
418
+ /** Every pull request close throws `error`. */
419
+ failClose(error: Error): this;
420
+ closePr: (pr: OpenPr, comment: string) => Promise<void>;
421
+ prState: (pr: OpenPr) => Promise<"OPEN" | "MERGED" | "CLOSED">;
422
+ mergeMethods: () => Promise<MergeMethods>;
423
+ merge: (pr: OpenPr, method: MergeMethod) => Promise<void>;
424
+ showDiff: () => Promise<void>;
425
+ openInBrowser: () => Promise<void>;
426
+ releasedTags: () => Promise<Set<string>>;
427
+ private releaseError;
428
+ /** Every release notes publish throws `error`. */
429
+ failRelease(error: Error): this;
430
+ createRelease: (tag: string, notes: string, latest: boolean) => Promise<void>;
431
+ deployments: () => Promise<Deploy[]>;
432
+ recordDeployment: (ref: string, environment: Environment) => Promise<void>;
433
+ pullRequests: (numbers: readonly number[]) => Promise<LinkedPr[]>;
434
+ comments: (on: readonly IssueRef[]) => Promise<string[][]>;
435
+ private commentError;
436
+ /** Every comment throws `error`. */
437
+ failComment(error: Error): this;
438
+ comment: (on: IssueRef, body: string) => Promise<void>;
439
+ }
440
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
441
+ declare const codeHostFake: (fake?: CodeHostFake) => ServiceAdapter<CodeHostPort> & {
442
+ fake: CodeHostFake;
443
+ };
444
+ //#endregion
445
+ //#region src/adapters/ci-pipeline/__fakes__/ci-pipeline.fake.d.ts
446
+ interface PipelineState {
447
+ workflowRuns: Record<string, Deploy[]>;
448
+ minutes: ActionsMinutes | null;
449
+ measured: Record<string, number[]>;
450
+ }
451
+ interface Dispatched {
452
+ type: "dispatch";
453
+ workflow: string;
454
+ ref: string;
455
+ inputs: Record<string, string>;
456
+ }
457
+ /** A CI pipeline held in memory: seed its runs and minutes, read back what was dispatched. */
458
+ declare class CiPipelineFake implements CiPipelinePort {
459
+ readonly shipWorkflow: string;
460
+ private state;
461
+ readonly received: Dispatched[];
462
+ constructor(shipWorkflow?: string);
463
+ seed(state: Partial<PipelineState>): this;
464
+ workflowRuns: (workflow: string) => Promise<Deploy[]>;
465
+ dispatch: (workflow: string, ref: string, inputs: Record<string, string>) => Promise<void>;
466
+ minutes: () => Promise<ActionsMinutes | null>;
467
+ measuredMinutes: (workflow: string) => Promise<number[]>;
468
+ }
469
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
470
+ declare const ciPipelineFake: (fake?: CiPipelineFake) => ServiceAdapter<CiPipelinePort> & {
471
+ fake: CiPipelineFake;
472
+ };
473
+ //#endregion
474
+ //#region src/adapters/versioning/__fakes__/versioning.fake.d.ts
475
+ type PlanOf = (added: PlannedChangeset[], held: PlannedChangeset[]) => StatusPlan;
476
+ interface VersioningState {
477
+ pending: {
478
+ id: string;
479
+ text: string;
480
+ }[];
481
+ /** What `changeset status` would answer, given what the release adds and holds back. */
482
+ plan: PlanOf;
483
+ dependencies: Record<string, string[]>;
484
+ folders: Record<string, string>;
485
+ }
486
+ /** Versioning held in memory: seed the pending changes and the plan, read back what it received. */
487
+ declare class VersioningFake implements VersioningPort {
488
+ private state;
489
+ readonly applied: {
490
+ added: PlannedChangeset[];
491
+ held: PlannedChangeset[];
492
+ }[];
493
+ readonly written: PlannedChangeset[];
494
+ seed(state: Partial<VersioningState>): this;
495
+ pending: () => Promise<{
496
+ id: string;
497
+ text: string;
498
+ }[]>;
499
+ plan: (added: PlannedChangeset[], held: PlannedChangeset[]) => Promise<StatusPlan>;
500
+ dependencies: () => Promise<Record<string, string[]>>;
501
+ folders: () => Promise<Record<string, string>>;
502
+ apply: (added: PlannedChangeset[], held: PlannedChangeset[]) => Promise<void>;
503
+ write: (changeset: PlannedChangeset) => Promise<void>;
504
+ changesetFile: (id: string) => string;
505
+ changelogFile: (dir: string) => string;
506
+ }
507
+ /** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */
508
+ declare const versioningFake: (fake?: VersioningFake) => ServiceAdapter<VersioningPort> & {
509
+ fake: VersioningFake;
510
+ };
511
+ //#endregion
512
+ //#region src/adapters/shell/__fakes__/shell.fake.d.ts
513
+ interface ShellCall {
514
+ command: string;
515
+ args: string[];
516
+ cwd?: string;
517
+ env?: Record<string, string>;
518
+ }
519
+ /** A shell that runs nothing: it keeps every call and answers from what was seeded. */
520
+ declare class RecordingShell implements Shell {
521
+ readonly calls: ShellCall[];
522
+ private answers;
523
+ private variables;
524
+ seedEnv(variables: Record<string, string>): this;
525
+ env: (name: string) => string;
526
+ /** Answers every call whose `command args` line starts with `prefix`. */
527
+ seed(prefix: string, result: Partial<ShellResult>): this;
528
+ /** Answers the next call starting with `prefix` only, ahead of what `seed` answers. */
529
+ seedOnce(prefix: string, result: Partial<ShellResult>): this;
530
+ private answer;
531
+ capture: (command: string, args: readonly string[], options?: RunOptions) => Promise<ShellResult>;
532
+ attach: (command: string, args: readonly string[], options?: RunOptions) => Promise<number>;
533
+ }
534
+ //#endregion
535
+ //#region src/adapters/terminal/__fakes__/terminal.fake.d.ts
536
+ /** Everything the CLI printed, in order, without colours. */
537
+ declare class MemoryOutput implements Output {
538
+ readonly lines: string[];
539
+ line: (text?: string) => void;
540
+ get text(): string;
541
+ }
542
+ type Answer = boolean | string | string[] | null;
543
+ /** A person who answers from a script, in order; every question asked is kept. */
544
+ declare class ScriptedPrompter implements Prompter {
545
+ readonly interactive: boolean;
546
+ readonly asked: string[];
547
+ /** The answer each choice question offered first, by question. */
548
+ readonly initials: Record<string, unknown>;
549
+ /** The choices each select question offered, by question. */
550
+ readonly choices: Record<string, Choice<string>[]>;
551
+ private answers;
552
+ constructor(interactive?: boolean);
553
+ answer(...answers: Answer[]): this;
554
+ private next;
555
+ confirm: (question: string, initial?: boolean) => Promise<boolean>;
556
+ typed: (question: string, word: string) => Promise<boolean>;
557
+ select: <Value extends string>(message: string, choices: Choice<Value>[], initial?: Value) => Promise<Awaited<Value> | null>;
558
+ multiselect: <Value extends string>(message: string, _choices: Choice<Value>[]) => Promise<Value[] | null>;
559
+ text: (message: string) => Promise<string | null>;
560
+ /** No key is ever pressed: every wait times out, unless keys were queued with `press`. */
561
+ private keys;
562
+ press(...keys: string[]): this;
563
+ waitForKey: () => Promise<string | null>;
564
+ }
565
+ //#endregion
566
+ //#region src/ports/files.port.d.ts
567
+ /** The repository's files, by path relative to its root. */
568
+ interface Files {
569
+ exists: (file: string) => boolean;
570
+ read: (file: string) => string | null;
571
+ write: (file: string, text: string) => void;
572
+ remove: (file: string) => void;
573
+ /** Entries directly in a folder; empty when it does not exist. */
574
+ list: (dir: string) => string[];
575
+ }
576
+ //#endregion
577
+ //#region src/adapters/files/node-files.adapter.d.ts
578
+ /** The repository on disk, under `root`. */
579
+ declare const nodeFiles: (root: string) => Files;
580
+ //#endregion
581
+ //#region src/adapters/shell/system-shell.adapter.d.ts
582
+ declare const systemShell: Shell;
583
+ //#endregion
584
+ //#region src/modules/suggest.d.ts
585
+ /** An adapter of any delivery port, as `init` offers them. */
586
+ type AnyDeliveryAdapter = DeliveryAdapter<ServerHostingPort> | DeliveryAdapter<StaticHostingPort> | DeliveryAdapter<MobileDistributionPort> | DeliveryAdapter<PackageRegistryPort>;
587
+ //#endregion
588
+ //#region src/ports/manifest.port.d.ts
589
+ interface Manifest {
590
+ name: string;
591
+ version: string;
592
+ }
593
+ /** Reads a unit's name and version from its folder: package.json today, pom.xml or Cargo.toml later. */
594
+ interface ManifestReader {
595
+ read: (root: string, dir: string) => Manifest | null;
596
+ }
597
+ //#endregion
598
+ //#region src/application/config/problem.d.ts
599
+ /** Something wrong in the config, said where a person can fix it. */
600
+ interface ConfigProblem {
601
+ /** Relative to the repository root. */
602
+ file: string;
603
+ line?: number;
604
+ message: string;
605
+ hint?: string;
606
+ }
607
+ //#endregion
608
+ //#region src/application/config/loadRelease.d.ts
609
+ /** A file still under its name from before shiplane, and the name it takes. */
610
+ interface Rename {
611
+ from: string;
612
+ to: string;
613
+ }
614
+ /** The release as composed: the flow, the modules in release order, the features, then the apps. */
615
+ interface Release {
616
+ root: string;
617
+ flow: ReleaseFlow;
618
+ /** What gets released, in release order. */
619
+ modules: ReleaseModule[];
620
+ /** What happens around a release, in the order they run. */
621
+ features: Feature[];
622
+ /** In release order: by module, then by name inside a module. The first is the Latest release. */
623
+ units: ReleaseUnit[];
624
+ problems: ConfigProblem[];
625
+ /** How a tag names a version, such as `{name}@{version}`. */
626
+ tagFormat: string;
627
+ /** Commits no changeset names release their unit, with a changelog from them. */
628
+ releasesCommits?: boolean;
629
+ /** How much the release says while it runs, as the config asks. */
630
+ display?: DisplayChoice;
631
+ /** Files still under their name from before shiplane. */
632
+ renames?: Rename[];
633
+ }
634
+ interface LoadOptions {
635
+ /** Where `shiplane` resolves from inside the config; by default, this very package. */
636
+ aliases?: Record<string, string>;
637
+ manifests?: ManifestReader;
638
+ }
639
+ /**
640
+ * The release as written: what `shiplane.config.ts` composes, and one app per folder that holds a
641
+ * `shiplane.unit.yml`, in release order. Every problem is collected, never thrown.
642
+ */
643
+ declare const loadRelease: (root: string, options?: LoadOptions) => Promise<Release>;
644
+ //#endregion
645
+ //#region src/application/setupContext.d.ts
646
+ /** What setting a release up needs: the repository, the person, the adapters init can offer. */
647
+ interface SetupContext {
648
+ root: string;
649
+ files: Files;
650
+ shell: Shell;
651
+ prompter: Prompter;
652
+ output: Output;
653
+ /** The official delivery adapters, offered to folders before any config exists. */
654
+ adapters: AnyDeliveryAdapter[];
655
+ /** Loads the release as the files now say. */
656
+ load: () => Promise<Release>;
657
+ }
658
+ //#endregion
659
+ //#region src/application/addUnit.d.ts
660
+ /** `shiplane add <folder>`: init's questions for one folder, its unit file written. */
661
+ declare const addUnit: (context: SetupContext, dir: string) => Promise<boolean>;
662
+ /** `shiplane remove <unit>`: its unit file goes; changesets still version it. */
663
+ declare const removeUnit: (context: SetupContext, name: string) => Promise<boolean>;
664
+ //#endregion
665
+ //#region src/application/docsFor.d.ts
666
+ /**
667
+ * `shiplane docs <module or adapter>`: every key a unit file takes, described, with its default. A
668
+ * module name reads the release config; an adapter name, the official adapters and those composed.
669
+ */
670
+ declare const docsFor: (context: SetupContext, name: string) => Promise<boolean>;
671
+ //#endregion
672
+ //#region src/application/doctor.d.ts
673
+ /**
674
+ * `shiplane doctor`: the config as written, the editor schema refreshed, the release order, a warning
675
+ * for each module no app names, then every tool and sign-in the flow, modules and features need, each
676
+ * failure with the command that fixes it, offered to run.
677
+ */
678
+ declare const doctor: (context: SetupContext) => Promise<boolean>;
679
+ //#endregion
680
+ //#region src/application/initRelease.d.ts
681
+ /**
682
+ * `shiplane init`: finds every workspace folder, guesses how each ships from what it holds, asks only
683
+ * what it cannot tell, shows every file, writes them, then runs doctor. Run again, it offers the
684
+ * folders added since and never rewrites a unit file. `--yes` takes every guess, `--blank` writes
685
+ * commented templates.
686
+ */
687
+ declare const initRelease: (context: SetupContext, {
688
+ yes,
689
+ blank
690
+ }: {
691
+ yes: boolean;
692
+ blank: boolean;
693
+ }) => Promise<boolean>;
694
+ //#endregion
695
+ //#region src/application/newAdapter.d.ts
696
+ /**
697
+ * `shiplane adapter new <name>`: a server hosting adapter, the port's contract suite run on it and on
698
+ * its Fake, and a module for it in the root config.
699
+ */
700
+ declare const newAdapter: (context: SetupContext, name: string) => Promise<boolean>;
701
+ //#endregion
702
+ //#region src/application/context.d.ts
703
+ /** Everything a use case reads and drives: the release as written, its services, the person. */
704
+ interface ReleaseContext {
705
+ release: Release;
706
+ /** Reads the release from disk again: a pull moves the versions a merged release PR brought. */
707
+ load: () => Promise<Release>;
708
+ services: Services;
709
+ /** Creates the port an adapter gives, for this repository. */
710
+ open: Open;
711
+ prompter: Prompter;
712
+ output: Output;
713
+ /** Where the release is: its stage, what it reads or runs, the mascot's mood. */
714
+ progress: Progress;
715
+ clock: Clock;
716
+ /** Runs the jobs plugins return, when they run from this machine. */
717
+ shell: Shell;
718
+ options: {
719
+ /** Answers yes to every confirmation; production never accepts it. */yes: boolean; /** Running inside GitHub Actions: a ship runs on this runner, never dispatching another. */
720
+ ci: boolean;
721
+ };
722
+ }
723
+ /** The ports the release flow runs on. */
724
+ interface Services {
725
+ sourceControl: SourceControlPort;
726
+ codeHost: CodeHostPort;
727
+ ciPipeline: CiPipelinePort;
728
+ versioning: VersioningPort;
729
+ }
730
+ //#endregion
731
+ //#region src/domain/companions.d.ts
732
+ /** A unit that goes out with the picked ones without being picked, and why. */
733
+ interface Companion {
734
+ /** The unit's name. */
735
+ app: string;
736
+ version: string;
737
+ /** The picked units it goes with. */
738
+ with: string[];
739
+ /** Why, as a person reads it. */
740
+ why: string;
741
+ }
742
+ //#endregion
743
+ //#region src/application/prepareRelease.d.ts
744
+ type Split = ReturnType<typeof splitChangesets>;
745
+ interface Prepared {
746
+ /** Changesets this release ships, the ones it writes included. */
747
+ pending: number;
748
+ /** Units the person left out: their changesets stay pending. */
749
+ held: string[];
750
+ /** Changed units the person left out: no changeset ships them. */
751
+ unreleased: UnreleasedApp[];
752
+ split: Split;
753
+ bumps: AppBump[];
754
+ /** Units the person did not pick that move anyway, with the package that drags each. */
755
+ companions: Companion[];
756
+ /** Internal packages moved along: changelogs only. */
757
+ packages: number;
758
+ /** Changesets the release writes itself. */
759
+ added: PlannedChangeset[];
760
+ /** Every changeset the release versions, with the lines it ships. */
761
+ shipped: PlannedChangeset[];
762
+ /** What plugins add to the release PR, by unit: an EAS app's build or update. */
763
+ contributions: Record<string, VersionContribution>;
764
+ }
765
+ /** What a release PR covering `scope` would version, computed without writing anything. */
766
+ declare const prepareRelease: (context: ReleaseContext, scope: ReadonlySet<string>) => Promise<Prepared>;
767
+ //#endregion
768
+ //#region src/application/openReleasePr.d.ts
769
+ /**
770
+ * Versions what `prepared` covers on one branch from main, opens its PR, and goes back to main.
771
+ * Null, with what to do, when it must not run.
772
+ */
773
+ declare const openReleasePr: (context: ReleaseContext, prepared: Prepared) => Promise<OpenPr[] | null>;
774
+ //#endregion
775
+ //#region src/application/planShips.d.ts
776
+ /**
777
+ * `shiplane plan`: every command shipping the current tags would run, both ways, in release order,
778
+ * then what the features would do. It runs nothing and asks nothing; it reads git, and the code host
779
+ * for features.
780
+ */
781
+ declare const planShips: (context: ReleaseContext, environment: Environment) => Promise<void>;
782
+ //#endregion
783
+ //#region src/application/promote.d.ts
784
+ /** Production, from what preview runs: every unit picked, its name typed, each step asked. */
785
+ declare const promote: (context: ReleaseContext, via: DeployPath | undefined) => Promise<boolean>;
786
+ //#endregion
787
+ //#region src/application/readStatus.d.ts
788
+ interface UnitStatus {
789
+ unit: string;
790
+ target: string;
791
+ version: string;
792
+ tag: string;
793
+ tagged: boolean;
794
+ changesets: number;
795
+ commits: number;
796
+ /** Something to release to this environment. */
797
+ pending: boolean;
798
+ hint: string;
799
+ /** What its plugin reads from its own platform, such as each EAS build's verdict. */
800
+ live?: unknown;
801
+ }
802
+ interface ReleaseStatus {
803
+ environment: Environment;
804
+ units: UnitStatus[];
805
+ releasePrs: OpenPr[];
806
+ untagged: ReleaseTag[];
807
+ next: ReleaseStep;
808
+ }
809
+ /** Where every unit stands on an environment, and the step a release takes next. Reads only. */
810
+ declare const readStatus: (context: ReleaseContext, environment: Environment) => Promise<ReleaseStatus>;
811
+ //#endregion
812
+ //#region src/application/releaseToPreview.d.ts
813
+ /**
814
+ * `release` on preview: the release PR, the wait for its merge, the tags, then the ship. It reads where things
815
+ * stand first, so a run stopped anywhere picks up where it left off. False when something failed.
816
+ */
817
+ declare const releaseToPreview: (context: ReleaseContext) => Promise<boolean>;
818
+ //#endregion
819
+ //#region src/application/setupFiles.d.ts
820
+ /**
821
+ * Writes the editor schema when it no longer matches the composed modules. It is generated, never
822
+ * committed: every command keeps it current. True when it wrote.
823
+ */
824
+ declare const refreshEditorSchema: (files: Files, release: Release) => boolean;
825
+ //#endregion
826
+ //#region src/application/ship.d.ts
827
+ /**
828
+ * Ships every picked unit its environment does not run yet, and returns once each one is
829
+ * triggered: EAS builds and workflows go on on their own, a Fly deploy from here once rolled out.
830
+ * Production asks for its name first. False on a failure.
831
+ */
832
+ declare const shipTo: (context: ReleaseContext, environment: Environment, {
833
+ scope,
834
+ via
835
+ }: {
836
+ scope?: ReadonlySet<string>;
837
+ via?: DeployPath;
838
+ }) => Promise<boolean>;
839
+ //#endregion
840
+ //#region src/testing/sample.d.ts
841
+ /** This repository's four shipping units, as the rule tests were written against them. */
842
+ declare const SAMPLE_UNITS: UnitRef[];
843
+ declare const SAMPLE_VERSION_FILES: Set<string>;
844
+ //#endregion
845
+ //#region src/testing/live.d.ts
846
+ /**
847
+ * Contract suites against hosted services run only with RELEASE_CONTRACT_LIVE=1, on a sandbox
848
+ * repository checked out at RELEASE_CONTRACT_REPO: they open pull requests, publish releases and
849
+ * dispatch workflows there.
850
+ */
851
+ declare const LIVE: boolean;
852
+ /** The sandbox checkout, refused when unset so a live run never touches this repository. */
853
+ declare const sandbox: () => string;
854
+ /** Runs git in the sandbox and returns what it printed. */
855
+ declare const inSandbox: (args: string[]) => string;
856
+ //#endregion
857
+ //#region src/testing/plans.d.ts
858
+ /**
859
+ * What `changeset status` answers for these pending changesets, plus the ones a release adds, minus
860
+ * the lines it holds back: every named package moves once, by its biggest bump.
861
+ */
862
+ declare const planFrom: (pending: PlannedChangeset[], versions: Record<string, string>) => (added: PlannedChangeset[], held: PlannedChangeset[]) => StatusPlan;
863
+ //#endregion
864
+ //#region src/adapters/terminal/__fakes__/progress.fake.d.ts
865
+ interface ProgressEvent {
866
+ kind: "stage" | "during" | "say";
867
+ text: string;
868
+ mood?: Mood;
869
+ step?: StepPlace;
870
+ }
871
+ /** Progress kept as events; what it says also goes to the output, as a terminal would print it. */
872
+ declare class RecordingProgress implements Progress {
873
+ private readonly output;
874
+ readonly events: ProgressEvent[];
875
+ constructor(output: Output);
876
+ stage: (stages: readonly string[], index: number) => void;
877
+ during: <T>(label: string, mood: Mood, work: () => Promise<T>, step?: StepPlace) => Promise<T>;
878
+ say: (mood: Mood, text: string) => void;
879
+ }
880
+ //#endregion
881
+ //#region src/testing/releaseContext.d.ts
882
+ declare const testUnit: (name: string, overrides?: Partial<ReleaseUnit>) => ReleaseUnit;
883
+ /** The flow's Fakes, as adapters a config would hold. */
884
+ interface FlowFakes {
885
+ sourceControl: ReturnType<typeof sourceControlFake>;
886
+ codeHost: ReturnType<typeof codeHostFake>;
887
+ ciPipeline: ReturnType<typeof ciPipelineFake>;
888
+ versioning: ReturnType<typeof versioningFake>;
889
+ }
890
+ /**
891
+ * A release over a Fake of every port the flow runs on, answered by a scripted person. The apps are
892
+ * in release order as given: the first is the Latest release.
893
+ */
894
+ declare const testContext: ({
895
+ units,
896
+ modules,
897
+ features,
898
+ yes,
899
+ interactive,
900
+ root,
901
+ tagFormat,
902
+ commitsWithoutChangeset
903
+ }: {
904
+ units: ReleaseUnit[];
905
+ modules?: ReleaseModule[]; /** The features, or how to make them from the flow's Fakes they share. */
906
+ features?: Feature[] | ((flow: FlowFakes) => Feature[]);
907
+ yes?: boolean;
908
+ interactive?: boolean;
909
+ root?: string;
910
+ tagFormat?: string; /** A release skips commits no changeset names; the config default ignores them. */
911
+ commitsWithoutChangeset?: "release" | "ignore";
912
+ }) => {
913
+ context: ReleaseContext;
914
+ flow: {
915
+ sourceControl: ServiceAdapter<SourceControlPort> & {
916
+ fake: SourceControlFake;
917
+ };
918
+ codeHost: ServiceAdapter<CodeHostPort> & {
919
+ fake: CodeHostFake;
920
+ };
921
+ ciPipeline: ServiceAdapter<CiPipelinePort> & {
922
+ fake: CiPipelineFake;
923
+ };
924
+ versioning: ServiceAdapter<VersioningPort> & {
925
+ fake: VersioningFake;
926
+ };
927
+ };
928
+ source: SourceControlFake;
929
+ host: CodeHostFake;
930
+ ci: CiPipelineFake;
931
+ versioning: VersioningFake;
932
+ prompter: ScriptedPrompter;
933
+ output: MemoryOutput;
934
+ progress: RecordingProgress;
935
+ shell: RecordingShell;
936
+ };
937
+ declare const changesetText: (packages: Record<string, string>, summary: string) => string;
938
+ //#endregion
939
+ //#region src/testing/consumer.d.ts
940
+ /** What the built CLI printed and the code it exited with. */
941
+ interface CliRun {
942
+ status: number;
943
+ output: string;
944
+ }
945
+ interface ConsumerRepository {
946
+ root: string;
947
+ /** The bare repository the checkout pushes to, standing in for GitHub. */
948
+ origin: string;
949
+ write: (file: string, text: string) => void;
950
+ read: (file: string) => string;
951
+ /** Runs git in the checkout, or in the bare origin with `{ in: "origin" }`. */
952
+ git: (args: string[], where?: {
953
+ in: "origin";
954
+ }) => string;
955
+ /** Commits every file as it stands and pushes the branch to the origin. */
956
+ commitAndPush: (title: string) => void;
957
+ /** Runs the built `shiplane` CLI in the checkout, as a person types it. */
958
+ shiplane: (args: string[]) => CliRun;
959
+ remove: () => void;
960
+ }
961
+ /** The built CLI, as `pnpm add shiplane` installs it. */
962
+ declare const builtCli: () => string;
963
+ /**
964
+ * A repository as a consumer has it: its files, the packages it installed linked in its
965
+ * node_modules, one commit pushed to a local bare origin. gh, npm and flyctl answer offline.
966
+ */
967
+ declare const consumerRepository: ({
968
+ files,
969
+ packages,
970
+ branch
971
+ }: {
972
+ files: Record<string, string>; /** The branch releases start from, created first and pushed. */
973
+ branch?: string; /** Package name to the folder it installs from, such as a plugin's workspace folder. */
974
+ packages?: Record<string, string>;
975
+ }) => ConsumerRepository;
976
+ //#endregion
977
+ //#region src/testing/workspace.d.ts
978
+ /** The public API a test config imports, resolved to source since tests run before any build. */
979
+ declare const SOURCE_ALIASES: Record<string, string>;
980
+ interface Workspace {
981
+ root: string;
982
+ write: (file: string, text: string) => void;
983
+ read: (file: string) => string;
984
+ exists: (file: string) => boolean;
985
+ remove: () => void;
986
+ }
987
+ /** A throwaway repository on disk, one entry per file, removed by `remove()`. */
988
+ declare const createWorkspace: (files: Record<string, string>) => Workspace;
989
+ declare const packageJson: (name: string, version?: string, extra?: object) => string;
990
+ //#endregion
991
+ export { type CliRun, type ConsumerRepository, type HostEvent, LIVE, MemoryOutput, RecordingShell, SAMPLE_UNITS, SAMPLE_VERSION_FILES, SOURCE_ALIASES, ScriptedPrompter, type SetupContext, type Workspace, addUnit, builtCli, changesetText, ciPipelineContract, ciPipelineFake, codeHostContract, codeHostFake, consumerRepository, createWorkspace, docsFor, doctor, inSandbox, initRelease, loadRelease, mobileDistributionContract, mobileDistributionFake, newAdapter, nodeFiles, openReleasePr, packageJson, packageRegistryContract, packageRegistryFake, planFrom, planShips, prepareRelease, promote, readStatus, refreshEditorSchema, releaseToPreview, removeUnit, sandbox, serverHostingContract, serverHostingFake, shipTo, sourceControlContract, sourceControlFake, staticHostingContract, staticHostingFake, systemShell, testContext, testUnit, versioningContract, versioningFake };
992
+ //# sourceMappingURL=testing.d.ts.map