shiplane 0.5.2 → 0.6.0-fix-shiplane-ship-node-cache.3dccda9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +157 -312
- package/dist/cli.js.map +1 -1
- package/dist/{readStatus-DypM0faL.js → compose-BTQXZqHM.js} +2758 -1448
- package/dist/compose-BTQXZqHM.js.map +1 -0
- package/dist/{budget-BTnKtGF6.js → display-CfV4G1TR.js} +155 -52
- package/dist/display-CfV4G1TR.js.map +1 -0
- package/dist/{static-hosting.port-B5i6W7eD.d.ts → index-B1Rd22nM.d.ts} +482 -21
- package/dist/index.d.ts +2 -3
- package/dist/index.js +3 -4
- package/dist/{issues-TcWtMTv5.js → issues-DCRpXUBW.js} +1 -1
- package/dist/{issues-TcWtMTv5.js.map → issues-DCRpXUBW.js.map} +1 -1
- package/dist/memory.d.ts +1 -1
- package/dist/memory.js +1 -1
- package/dist/{package-registry.fake-BLBdd7IQ.d.ts → package-registry.fake-CjoePEzE.d.ts} +53 -6
- package/dist/{package-registry.fake-CN6M1-Gi.js → package-registry.fake-ykiSBd8M.js} +58 -6
- package/dist/package-registry.fake-ykiSBd8M.js.map +1 -0
- package/dist/plugin-D-JQhwVd.d.ts +118 -0
- package/dist/plugin.d.ts +3 -23
- package/dist/plugin.js +84 -7
- package/dist/plugin.js.map +1 -0
- package/dist/shell-server-hosting.adapter-CvOcC6Wh.js +369 -0
- package/dist/shell-server-hosting.adapter-CvOcC6Wh.js.map +1 -0
- package/dist/{src-DO7WyrfV.js → src-8BbKTQBb.js} +2 -2
- package/dist/src-8BbKTQBb.js.map +1 -0
- package/dist/testing.d.ts +103 -18
- package/dist/testing.js +235 -22
- package/dist/testing.js.map +1 -1
- package/package.json +2 -1
- package/dist/budget-BTnKtGF6.js.map +0 -1
- package/dist/display-IqkJ6uCw.js +0 -96
- package/dist/display-IqkJ6uCw.js.map +0 -1
- package/dist/index-C_urG4yY.d.ts +0 -252
- package/dist/package-registry.fake-CN6M1-Gi.js.map +0 -1
- package/dist/readStatus-DypM0faL.js.map +0 -1
- package/dist/shell-server-hosting.adapter-C7_5MWrl.js +0 -50
- package/dist/shell-server-hosting.adapter-C7_5MWrl.js.map +0 -1
- package/dist/src-DO7WyrfV.js.map +0 -1
- package/dist/web-app.module-BB1fY1Kd.js +0 -125
- package/dist/web-app.module-BB1fY1Kd.js.map +0 -1
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","names":[],"sources":["../src/adapters/shell/__fakes__/shell.fake.ts","../src/adapters/terminal/__fakes__/progress.fake.ts","../src/adapters/terminal/__fakes__/terminal.fake.ts","../src/testing/releaseContext.ts","../src/testing/deliveryContract.ts","../src/adapters/server-hosting/server-hosting.contract.ts","../src/adapters/static-hosting/static-hosting.contract.ts","../src/adapters/mobile-distribution/mobile-distribution.contract.ts","../src/adapters/package-registry/package-registry.contract.ts","../src/adapters/source-control/source-control.contract.ts","../src/adapters/code-host/code-host.contract.ts","../src/adapters/ci-pipeline/ci-pipeline.contract.ts","../src/adapters/versioning/versioning.contract.ts","../src/testing/sample.ts","../src/testing/live.ts","../src/testing/plans.ts","../src/testing/consumer.ts","../src/testing/workspace.ts"],"sourcesContent":["import type { RunOptions, Shell, ShellResult } from \"../../../ports/shell.port\";\n\nexport interface ShellCall {\n command: string;\n args: string[];\n cwd?: string;\n env?: Record<string, string>;\n}\n\n/** A shell that runs nothing: it keeps every call and answers from what was seeded. */\nexport class RecordingShell implements Shell {\n readonly calls: ShellCall[] = [];\n private answers: { prefix: string; result: Partial<ShellResult>; once?: boolean }[] = [];\n private variables: Record<string, string> = {};\n\n seedEnv(variables: Record<string, string>) {\n this.variables = { ...this.variables, ...variables };\n return this;\n }\n\n env = (name: string) => this.variables[name];\n\n /** Answers every call whose `command args` line starts with `prefix`. */\n seed(prefix: string, result: Partial<ShellResult>) {\n this.answers.push({ prefix, result });\n return this;\n }\n\n /** Answers the next call starting with `prefix` only, ahead of what `seed` answers. */\n seedOnce(prefix: string, result: Partial<ShellResult>) {\n this.answers.unshift({ prefix, result, once: true });\n return this;\n }\n\n private answer(command: string, args: readonly string[], options: RunOptions): ShellResult {\n this.calls.push({ command, args: [...args], cwd: options.cwd, env: options.env });\n const line = [command, ...args].join(\" \");\n const found = this.answers.find(({ prefix }) => line.startsWith(prefix));\n if (found?.once) this.answers.splice(this.answers.indexOf(found), 1);\n return { status: 0, stdout: \"\", stderr: \"\", ...found?.result };\n }\n\n capture = (command: string, args: readonly string[], options: RunOptions = {}) =>\n Promise.resolve(this.answer(command, args, options));\n\n attach = (command: string, args: readonly string[], options: RunOptions = {}) =>\n Promise.resolve(this.answer(command, args, options).status);\n}\n","import type { Mood } from \"../../../domain/display\";\nimport type { BatchPlace, Output, Progress, StepPlace } from \"../../../ports/terminal.port\";\n\nexport interface ProgressEvent {\n kind: \"stage\" | \"during\" | \"say\";\n text: string;\n mood?: Mood;\n step?: StepPlace;\n /** How many items a batch runs at once. */\n batch?: number;\n}\n\n/** Progress kept as events; what it says also goes to the output, as a terminal would print it. */\nexport class RecordingProgress implements Progress {\n readonly events: ProgressEvent[] = [];\n\n constructor(private readonly output: Output) {}\n\n stage = (stages: readonly string[], index: number) => {\n this.events.push({\n kind: \"stage\",\n text: stages[index] ?? \"\",\n step: { index, total: stages.length },\n });\n };\n\n during = <T>(\n label: string,\n mood: Mood,\n work: () => Promise<T>,\n step?: StepPlace | BatchPlace,\n ) => {\n const place = step && \"done\" in step ? { batch: step.total } : step ? { step } : {};\n this.events.push({ kind: \"during\", mood, text: label, ...place });\n return work();\n };\n\n say = (mood: Mood, text: string) => {\n this.events.push({ kind: \"say\", mood, text });\n this.output.line(text);\n };\n}\n","import type { Choice, Clock, Output, Prompter } from \"../../../ports/terminal.port\";\n\n/** Everything the CLI printed, in order, without colours. */\nexport class MemoryOutput implements Output {\n readonly lines: string[] = [];\n\n line = (text = \"\") => {\n // eslint-disable-next-line no-control-regex\n this.lines.push(text.replace(/\\u001B\\[[0-9;]*m/g, \"\"));\n };\n\n get text() {\n return this.lines.join(\"\\n\");\n }\n}\n\ntype Answer = boolean | string | string[] | null;\n\n/** A person who answers from a script, in order; every question asked is kept. */\nexport class ScriptedPrompter implements Prompter {\n readonly asked: string[] = [];\n /** The answer each choice question offered first, by question. */\n readonly initials: Record<string, unknown> = {};\n /** The choices each select question offered, by question. */\n readonly choices: Record<string, Choice<string>[]> = {};\n private answers: Answer[] = [];\n\n constructor(readonly interactive = true) {}\n\n answer(...answers: Answer[]) {\n this.answers.push(...answers);\n return this;\n }\n\n private next(question: string): Answer {\n this.asked.push(question);\n if (this.answers.length === 0) throw new Error(`Unexpected question: ${question}`);\n return this.answers.shift() ?? null;\n }\n\n confirm = (question: string, initial = false) => {\n this.initials[question] = initial;\n return Promise.resolve(this.next(question) === true);\n };\n\n typed = (question: string, word: string) => Promise.resolve(this.next(question) === word);\n\n select = <Value extends string>(message: string, choices: Choice<Value>[], initial?: Value) => {\n this.initials[message] = initial;\n this.choices[message] = choices;\n return Promise.resolve(this.next(message) as Value | null);\n };\n\n multiselect = <Value extends string>(\n message: string,\n choices: Choice<Value>[],\n initial: Value[],\n ) => {\n this.initials[message] = initial;\n this.choices[message] = choices;\n return Promise.resolve(this.next(message) as Value[] | null);\n };\n\n text = (message: string) => Promise.resolve(this.next(message) as string | null);\n\n /** No key is ever pressed: every wait times out, unless keys were queued with `press`. */\n private keys: string[] = [];\n\n press(...keys: string[]) {\n this.keys.push(...keys);\n return this;\n }\n\n waitForKey = () => Promise.resolve(this.keys.shift() ?? null);\n}\n\n/** A clock fixed at one moment, whose waits return at once. */\nexport class FixedClock implements Clock {\n constructor(private readonly at: Date) {}\n\n now = () => this.at;\n sleep = () => Promise.resolve();\n}\n","import type { Release } from \"../application/config/loadRelease\";\nimport type { ReleaseContext } from \"../application/context\";\nimport type { Approval } from \"../domain/releasePr\";\nimport type { ReleaseUnit } from \"../domain/unit\";\nimport type { Feature, ReleaseModule } from \"../modules/module\";\nimport { ciPipelineFake } from \"../adapters/ci-pipeline/__fakes__/ci-pipeline.fake\";\nimport { codeHostFake } from \"../adapters/code-host/__fakes__/code-host.fake\";\nimport { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport { sourceControlFake } from \"../adapters/source-control/__fakes__/source-control.fake\";\nimport { RecordingProgress } from \"../adapters/terminal/__fakes__/progress.fake\";\nimport {\n FixedClock,\n MemoryOutput,\n ScriptedPrompter,\n} from \"../adapters/terminal/__fakes__/terminal.fake\";\nimport { versioningFake } from \"../adapters/versioning/__fakes__/versioning.fake\";\nimport { releaseFlow } from \"../application/releaseFlow\";\nimport { DEFAULT_TAG_FORMAT } from \"../domain/tags\";\n\nexport const testUnit = (name: string, overrides: Partial<ReleaseUnit> = {}): ReleaseUnit => ({\n name,\n dir: `apps/${name}`,\n file: `apps/${name}/shiplane.unit.yml`,\n packageName: `@acme/${name}`,\n version: \"0.1.0\",\n module: \"web-app\",\n options: {},\n after: [],\n ...overrides,\n});\n\n/** The flow's Fakes, as adapters a config would hold. */\ninterface FlowFakes {\n sourceControl: ReturnType<typeof sourceControlFake>;\n codeHost: ReturnType<typeof codeHostFake>;\n ciPipeline: ReturnType<typeof ciPipelineFake>;\n versioning: ReturnType<typeof versioningFake>;\n}\n\n/**\n * A release over a Fake of every port the flow runs on, answered by a scripted person. The apps are\n * in release order as given: the first is the Latest release.\n */\nexport const testContext = ({\n units,\n modules = [],\n features = [],\n yes = false,\n interactive = true,\n root = \"/repo\",\n tagFormat = DEFAULT_TAG_FORMAT,\n approval,\n}: {\n units: ReleaseUnit[];\n modules?: ReleaseModule[];\n /** The features, or how to make them from the flow's Fakes they share. */\n features?: Feature[] | ((flow: FlowFakes) => Feature[]);\n yes?: boolean;\n interactive?: boolean;\n root?: string;\n tagFormat?: string;\n /** Whether someone else approves the release PR; the config default when absent. */\n approval?: Approval;\n}) => {\n const sourceControl = sourceControlFake();\n const codeHost = codeHostFake();\n const ciPipeline = ciPipelineFake();\n const versioning = versioningFake();\n const prompter = new ScriptedPrompter(interactive);\n const output = new MemoryOutput();\n const progress = new RecordingProgress(output);\n const shell = new RecordingShell();\n const fakes = { sourceControl, codeHost, ciPipeline, versioning };\n const flow = releaseFlow({ ...fakes, approval });\n const release: Release = {\n root,\n flow,\n modules,\n features: typeof features === \"function\" ? features(fakes) : features,\n units,\n problems: [],\n tagFormat,\n };\n const context: ReleaseContext = {\n release,\n load: () => Promise.resolve(release),\n services: {\n sourceControl: sourceControl.fake,\n codeHost: codeHost.fake,\n ciPipeline: ciPipeline.fake,\n versioning: versioning.fake,\n },\n open: (adapter) => adapter.create({ root, shell }),\n prompter,\n output,\n progress,\n clock: new FixedClock(new Date(\"2026-10-12T09:00:00Z\")),\n shell,\n options: { yes, ci: false },\n };\n return {\n context,\n flow: fakes,\n source: sourceControl.fake,\n host: codeHost.fake,\n ci: ciPipeline.fake,\n versioning: versioning.fake,\n prompter,\n output,\n progress,\n shell,\n };\n};\n\nexport const changesetText = (packages: Record<string, string>, summary: string) =>\n `---\\n${Object.entries(packages)\n .map(([name, type]) => `\"${name}\": ${type}`)\n .join(\"\\n\")}\\n---\\n\\n${summary}\\n`;\n","import { describe, expect, it } from \"vitest\";\n\nimport type { Environment } from \"../domain/environment\";\nimport type { DeliveryAdapter } from \"../ports/adapter.port\";\nimport type { Delivery, FolderView } from \"../ports/delivery.port\";\nimport { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport { optionsFor } from \"../application/config/optionsFor\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { testUnit } from \"./releaseContext\";\n\n/** One adapter of a port, with settings an app's unit file could hold for it. */\nexport interface ContractCase<Port extends Delivery & { capability: string }> {\n adapter: DeliveryAdapter<Port>;\n settings: Record<string, unknown>;\n}\n\nconst EMPTY_FOLDER: FolderView = {\n dir: \"apps/empty\",\n name: \"empty\",\n files: [],\n has: () => false,\n read: () => null,\n};\n\n/** What every adapter of a delivery port must do, whatever its provider; `more` adds the port's own. */\nexport const deliveryContract = <Port extends Delivery & { capability: string }>(\n kind: string,\n cases: ContractCase<Port>[],\n more: (adapter: DeliveryAdapter<Port>, port: Port) => void = () => undefined,\n) =>\n describe.each(cases.map((entry) => [entry.adapter.name, entry] as const))(\n `%s, as ${kind}`,\n (_name, { adapter, settings }) => {\n const port = adapter.create({ root: \"/repo\", shell: new RecordingShell() });\n const unit = testUnit(\"app\", { module: \"app\", options: settings });\n const inputFor = (environment: Environment) => ({\n unit,\n tag: \"app@0.1.0\",\n environment,\n options: optionsFor({ ...unit, options: adapter.settings.parse(settings) }, environment, [\n unit,\n ]),\n commit: \"abc1234\",\n });\n\n it(\"given an app's settings, when its unit file is read, then the adapter's schema takes them\", () => {\n expect(adapter.settings.safeParse(settings).success).toBe(true);\n });\n\n it(\"given a tag on each environment, when it says where the tag lands, then a person can read it\", () => {\n ENVIRONMENTS.forEach((environment) =>\n expect(port.describe(inputFor(environment)).trim()).not.toBe(\"\"),\n );\n });\n\n it(\"given a tag on each environment, when its jobs are built, then each says what it does and what it runs\", () => {\n ENVIRONMENTS.forEach((environment) =>\n port.jobs(inputFor(environment)).forEach((job) => {\n expect(job.label.trim()).not.toBe(\"\");\n expect(job.local.length).toBeGreaterThan(0);\n job.local.forEach(({ command }) => expect(command.trim()).not.toBe(\"\"));\n }),\n );\n });\n\n it(\"given a folder with nothing in it, when init looks at it, then the adapter recognises nothing\", () => {\n expect(adapter.detect?.(EMPTY_FOLDER) ?? null).toBeNull();\n });\n\n it(\"given an app it ships, when doctor asks what it needs, then each need has a name and a check\", () => {\n (adapter.requirements?.(unit) ?? []).forEach(({ label, check }) => {\n expect(label.trim()).not.toBe(\"\");\n expect(check.command.trim()).not.toBe(\"\");\n });\n });\n\n more(adapter, port);\n },\n );\n","import { expect, it } from \"vitest\";\n\nimport type { ServerHostingPort } from \"../../ports/server-hosting.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every server host does, whatever its provider. */\nexport const serverHostingContract = (cases: ContractCase<ServerHostingPort>[]) =>\n deliveryContract(\"server hosting\", cases, (_adapter, port) => {\n it(\"given a server host, when its kind is read, then it hosts servers\", () => {\n expect(port.capability).toBe(\"server-hosting\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { StaticHostingPort } from \"../../ports/static-hosting.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every static host does, whatever its provider. */\nexport const staticHostingContract = (cases: ContractCase<StaticHostingPort>[]) =>\n deliveryContract(\"static hosting\", cases, (_adapter, port) => {\n it(\"given a static host, when its kind is read, then it hosts static sites\", () => {\n expect(port.capability).toBe(\"static-hosting\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { MobileDistributionPort } from \"../../ports/mobile-distribution.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every mobile distribution does, whatever its provider. */\nexport const mobileDistributionContract = (cases: ContractCase<MobileDistributionPort>[]) =>\n deliveryContract(\"mobile distribution\", cases, (adapter, port) => {\n it(\"given a mobile distribution, when status asks who decides, then its platform is named\", () => {\n expect(port.capability).toBe(\"mobile-distribution\");\n expect(adapter.decidedBy?.platform.trim() ?? \"\").not.toBe(\"\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { PackageRegistryPort } from \"../../ports/package-registry.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every package registry does, whatever its provider. */\nexport const packageRegistryContract = (cases: ContractCase<PackageRegistryPort>[]) =>\n deliveryContract(\"a package registry\", cases, (_adapter, port) => {\n it(\"given a package registry, when its kind is read, then it publishes packages\", () => {\n expect(port.capability).toBe(\"package-registry\");\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { SourceControlPort } from \"../../ports/source-control.port\";\n\n/** A repository on main with one commit, and the ways a test arranges it beyond the port. */\nexport interface SourceControlSubject {\n port: SourceControlPort;\n /** The commit main is on. */\n head: () => Promise<string>;\n /** Writes a file the repository does not track yet. */\n change: (file: string, text: string) => Promise<void>;\n}\n\n/** What every source control does, whatever its provider. */\nexport const sourceControlContract = (name: string, subject: () => Promise<SourceControlSubject>) =>\n describe(`${name}, as source control`, () => {\n it(\"given a fresh checkout, when its position is read, then it is on main with nothing to commit\", async () => {\n const { port } = await subject();\n\n expect((await port.position()).branch).toBe(\"main\");\n expect(await port.isClean()).toBe(true);\n });\n\n it(\"given a commit tagged, when the tags are read, then the tag is there and names that commit\", async () => {\n const { port, head } = await subject();\n const sha = await head();\n\n await port.tag(\"app@1.0.0\", sha, \"app 1.0.0\");\n\n expect(await port.tags()).toContain(\"app@1.0.0\");\n expect(await port.tagCommit(\"app@1.0.0\")).toBe(sha);\n });\n\n it(\"given tags in every format a config names, when the tags are read, then each one is there\", async () => {\n const { port, head } = await subject();\n const sha = await head();\n for (const tag of [\"arnaud-zg--v0.2.1\", \"v1.0.0\", \"app@1.0.0\"]) {\n await port.tag(tag, sha, tag);\n }\n\n expect([...(await port.tags())].sort()).toEqual([\"app@1.0.0\", \"arnaud-zg--v0.2.1\", \"v1.0.0\"]);\n });\n\n it(\"given a tag deleted, when the tags are read, then it is gone and names no commit\", async () => {\n const { port, head } = await subject();\n await port.tag(\"app@1.0.0\", await head(), \"app 1.0.0\");\n\n await port.deleteTag(\"app@1.0.0\");\n\n expect(await port.tags()).not.toContain(\"app@1.0.0\");\n expect(await port.tagCommit(\"app@1.0.0\")).toBeNull();\n });\n\n it(\"given a branch created, when the position is read, then it is on it, and switching back returns to main\", async () => {\n const { port } = await subject();\n\n await port.createBranch(\"release/next\");\n const onBranch = (await port.position()).branch;\n await port.switchTo(\"main\");\n\n expect(onBranch).toBe(\"release/next\");\n expect((await port.position()).branch).toBe(\"main\");\n });\n\n it(\"given a new file committed, when the changes are read, then it is no longer among them\", async () => {\n const { port, change } = await subject();\n await change(\"notes.md\", \"notes\\n\");\n const before = await port.changedFiles();\n\n await port.commit([\"notes.md\"], \"docs: notes\");\n\n expect(before).toContain(\"notes.md\");\n expect(await port.changedFiles()).not.toContain(\"notes.md\");\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { IssueRef } from \"../../domain/issues\";\nimport type { CodeHostPort } from \"../../ports/code-host.port\";\n\n/** A repository on a code host, and the ways a test arranges it beyond the port. */\nexport interface CodeHostSubject {\n port: CodeHostPort;\n /** A branch the host can open a pull request from, pushed with one commit on it. */\n branch: (name: string) => Promise<string>;\n /** A tag the host can publish release notes for. */\n tag: () => Promise<string>;\n /** An issue or pull request comments can go on. */\n issue: IssueRef;\n}\n\n/** What every code host does, whatever its provider. */\nexport const codeHostContract = (name: string, subject: () => Promise<CodeHostSubject>) =>\n describe(`${name}, as a code host`, () => {\n it(\"given a pull request opened, when the open ones are read, then it is there and open\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-open\");\n\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n\n expect(pr.head).toEqual(expect.any(String));\n expect(await port.openPrsFrom(\"release/contract-open\")).toContainEqual(pr);\n expect(await port.prState(pr)).toBe(\"OPEN\");\n });\n\n it(\"given a pull request closed, when the open ones are read, then it is gone and closed\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-close\");\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n\n await port.closePr(pr, \"Closed by the contract suite.\");\n\n expect(await port.openPrsFrom(\"release/contract-close\")).not.toContainEqual(pr);\n expect(await port.prState(pr)).toBe(\"CLOSED\");\n });\n\n it(\"given release notes published for a tag, when the released tags are read, then it is among them\", async () => {\n const { port, tag } = await subject();\n const name = await tag();\n\n await port.createRelease(name, \"Published by the contract suite.\", false);\n\n expect(await port.releasedTags()).toContain(name);\n });\n\n it(\"given a deploy recorded, when the deploys are read, then it is there and done\", async () => {\n const { port, tag } = await subject();\n const name = await tag();\n\n await port.recordDeployment(name, \"preview\");\n\n expect(await port.deployments()).toContainEqual({\n title: `Deploy ${name} to preview`,\n state: \"done\",\n });\n });\n\n it(\"given a comment posted, when the comments are read, then it is among them\", async () => {\n const { port, issue } = await subject();\n const body = `Posted by the contract suite at ${new Date().toISOString()}.`;\n\n await port.comment(issue, body);\n\n expect((await port.comments([issue])).flat()).toContain(body);\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { CiPipelinePort } from \"../../ports/ci-pipeline.port\";\n\n/** A CI pipeline, and the ways a test reads it beyond the port. */\nexport interface CiPipelineSubject {\n port: CiPipelinePort;\n /** A workflow that exists and has never run. */\n idle: string;\n}\n\n/** What every CI pipeline does, whatever its provider. */\nexport const ciPipelineContract = (name: string, subject: () => Promise<CiPipelineSubject>) =>\n describe(`${name}, as a CI pipeline`, () => {\n it(\"given a workflow that never ran, when its runs are read, then there are none\", async () => {\n const { port, idle } = await subject();\n\n expect(await port.workflowRuns(idle)).toEqual([]);\n });\n\n it(\"given a workflow that never succeeded, when its billed minutes are read, then none are measured\", async () => {\n const { port, idle } = await subject();\n\n expect(await port.measuredMinutes(idle)).toEqual([]);\n });\n\n it(\"given this month's budget, when it is read, then what is left is never more than included\", async () => {\n const { port } = await subject();\n\n const minutes = await port.minutes();\n\n if (minutes) expect(minutes.left).toBeLessThanOrEqual(minutes.included);\n else expect(minutes).toBeNull();\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { VersioningPort } from \"../../ports/versioning.port\";\n\n/** A workspace with one package, and the ways a test arranges it beyond the port. */\nexport interface VersioningSubject {\n port: VersioningPort;\n /** The package the workspace holds, and its folder. */\n workspace: { name: string; folder: string };\n}\n\n/** What every versioning does, whatever its provider. */\nexport const versioningContract = (name: string, subject: () => Promise<VersioningSubject>) =>\n describe(`${name}, as versioning`, () => {\n it(\"given a change written, when the pending changes are read, then it is there naming its package and bump\", async () => {\n const { port, workspace } = await subject();\n\n await port.write({\n id: \"contract-change\",\n releases: [{ name: workspace.name, type: \"minor\" }],\n summary: \"Written by the contract suite.\",\n });\n\n const pending = await port.pending();\n expect(pending.map(({ id }) => id)).toContain(\"contract-change\");\n expect(pending.find(({ id }) => id === \"contract-change\")?.text).toContain(\n `\"${workspace.name}\": minor`,\n );\n });\n\n it(\"given a person with nothing queued, when they are told what to do, then the port says it\", async () => {\n const { port } = await subject();\n\n expect(port.nextChange).not.toBe(\"\");\n });\n\n it(\"given a workspace package, when the folders are read, then it is found in its folder\", async () => {\n const { port, workspace } = await subject();\n\n expect(await port.folders()).toMatchObject({ [workspace.name]: workspace.folder });\n });\n\n it(\"given a change and a folder, when their files are named, then they sit where a person looks\", async () => {\n const { port, workspace } = await subject();\n\n expect(port.changesetFile(\"contract-change\")).toBe(\".changeset/contract-change.md\");\n expect(port.changelogFile(workspace.folder)).toBe(`${workspace.folder}/CHANGELOG.md`);\n });\n });\n","import type { UnitRef } from \"../domain/changes\";\nimport type { DecidedBy } from \"../domain/scope\";\n\n/** This repository's four shipping units, as the rule tests were written against them. */\nexport const SAMPLE_UNITS: UnitRef[] = [\"expo\", \"api\", \"admin\", \"landing\"].map((name) => ({\n name,\n packageName: `@acme/${name}`,\n}));\n\nexport const SAMPLE_VERSION_FILES = new Set([\n \"apps/expo/app-version.json\",\n \"apps/api/public/app-version.preview.json\",\n \"apps/api/public/app-version.production.json\",\n]);\n\n// Billed minutes per deploy with no successful run to measure: the api validates before deploying.\nexport const SAMPLE_TYPICAL_MINUTES: Record<string, number> = {\n api: 13,\n admin: 5,\n landing: 4,\n expo: 8,\n};\n\nexport const EAS_DECIDES: DecidedBy = {\n platform: \"EAS\",\n choice: \"build or update\",\n check: \"shiplane status\",\n};\n","import { execFileSync } from \"node:child_process\";\nimport { z } from \"zod\";\n\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\n\n/**\n * Contract suites against hosted services run only with RELEASE_CONTRACT_LIVE=1, on a sandbox\n * repository checked out at RELEASE_CONTRACT_REPO: they open pull requests, publish releases and\n * dispatch workflows there.\n */\nexport const LIVE = systemShell.env(\"RELEASE_CONTRACT_LIVE\") === \"1\";\n\n/** The sandbox checkout, refused when unset so a live run never touches this repository. */\nexport const sandbox = () =>\n z\n .string({ message: \"RELEASE_CONTRACT_REPO names a sandbox checkout for live contracts\" })\n .min(1)\n .parse(systemShell.env(\"RELEASE_CONTRACT_REPO\"));\n\n/** Runs git in the sandbox and returns what it printed. */\nexport const inSandbox = (args: string[]) =>\n execFileSync(\"git\", args, { cwd: sandbox(), encoding: \"utf8\" }).trim();\n","import type { BumpLevel, PlannedChangeset, StatusPlan } from \"../domain/changes\";\nimport { nextVersion } from \"../domain/versions\";\n\n/**\n * What `changeset status` answers for these pending changesets, plus the ones a release adds, minus\n * the lines it holds back: every named package moves once, by its biggest bump, up to `ceiling`.\n */\nexport const planFrom =\n (pending: PlannedChangeset[], versions: Record<string, string>) =>\n (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel): StatusPlan => {\n const heldLines = new Set(\n held.flatMap(({ id, releases }) => releases.map(({ name }) => `${id}:${name}`)),\n );\n const changesets = [...pending, ...added]\n .map((changeset) => ({\n ...changeset,\n releases: changeset.releases.filter(\n ({ name }) => !heldLines.has(`${changeset.id}:${name}`),\n ),\n }))\n .filter(({ releases }) => releases.length > 0);\n const order: BumpLevel[] = [\"major\", \"minor\", \"patch\"];\n const capped = ceiling ? order.slice(order.indexOf(ceiling)) : order;\n const names = [\n ...new Set(changesets.flatMap(({ releases }) => releases.map(({ name }) => name))),\n ];\n return {\n changesets,\n releases: names.map((name) => {\n const lines = changesets.filter(({ releases }) =>\n releases.some((line) => line.name === name),\n );\n const named =\n order.find((candidate) =>\n lines.some(({ releases }) =>\n releases.some((line) => line.name === name && line.type === candidate),\n ),\n ) ?? \"patch\";\n const type = capped.includes(named) ? named : (ceiling ?? named);\n const oldVersion = versions[name] ?? \"0.1.0\";\n return {\n name,\n type,\n oldVersion,\n newVersion: nextVersion(oldVersion, type),\n changesets: lines.map(({ id }) => id),\n };\n }),\n };\n };\n","import { execFileSync, spawnSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\n\n/** What the built CLI printed and the code it exited with. */\nexport interface CliRun {\n status: number;\n output: string;\n}\n\nexport interface ConsumerRepository {\n root: string;\n /** The bare repository the checkout pushes to, standing in for GitHub. */\n origin: string;\n write: (file: string, text: string) => void;\n read: (file: string) => string;\n /** Runs git in the checkout, or in the bare origin with `{ in: \"origin\" }`. */\n git: (args: string[], where?: { in: \"origin\" }) => string;\n /** Commits every file as it stands and pushes the branch to the origin. */\n commitAndPush: (title: string) => void;\n /** Runs the built `shiplane` CLI in the checkout, as a person types it. */\n shiplane: (args: string[]) => CliRun;\n remove: () => void;\n}\n\nconst CORE = \"shiplane\";\n\nconst coreDir = (from: string): string => {\n const manifest = path.join(from, \"package.json\");\n if (fs.existsSync(manifest)) {\n const { name } = JSON.parse(fs.readFileSync(manifest, \"utf8\")) as { name?: string };\n if (name === CORE) return from;\n }\n const parent = path.dirname(from);\n if (parent === from) throw new Error(`${CORE} not found above ${import.meta.dirname}`);\n return coreDir(parent);\n};\n\n/** The built CLI, as `pnpm add shiplane` installs it. */\nexport const builtCli = (): string => {\n const cli = path.join(coreDir(import.meta.dirname), \"dist\", \"cli.js\");\n if (!fs.existsSync(cli)) {\n throw new Error(`shiplane is not built: run pnpm turbo run build --filter=${CORE}`);\n }\n return cli;\n};\n\n// No global git config, signing key, token or CI marker leaks in: a run sees only this repository.\nconst LEAKS = new Set([\"GITHUB_ACTIONS\", \"CI\", \"GITHUB_TOKEN\", \"GH_TOKEN\"]);\n\nconst hermeticEnv = (home: string, bin: string): NodeJS.ProcessEnv => ({\n ...Object.fromEntries(Object.entries(process.env).filter(([name]) => !LEAKS.has(name))),\n PATH: [bin, systemShell.env(\"PATH\") ?? \"\"].join(path.delimiter),\n HOME: home,\n GIT_CONFIG_GLOBAL: path.join(home, \".gitconfig\"),\n GIT_CONFIG_NOSYSTEM: \"1\",\n NO_COLOR: \"1\",\n // A fixed date makes each commit's hash depend on its files only, so docs can quote a run.\n GIT_AUTHOR_DATE: \"2026-01-01T00:00:00Z\",\n GIT_COMMITTER_DATE: \"2026-01-01T00:00:00Z\",\n});\n\n// The tools that reach a platform answer offline, so a run that would call one fails at once.\nconst OFFLINE = [\"gh\", \"npm\", \"flyctl\"];\n\nconst offlineTools = (bin: string) => {\n fs.mkdirSync(bin);\n OFFLINE.forEach((tool) => {\n const file = path.join(bin, tool);\n fs.writeFileSync(file, `#!/bin/sh\\necho \"${tool}: offline in this repository\" >&2\\nexit 1\\n`);\n fs.chmodSync(file, 0o755);\n });\n};\n\n/**\n * A repository as a consumer has it: its files, the packages it installed linked in its\n * node_modules, one commit pushed to a local bare origin. gh, npm and flyctl answer offline.\n */\nexport const consumerRepository = ({\n files,\n packages = {},\n branch = \"main\",\n}: {\n files: Record<string, string>;\n /** The branch releases start from, created first and pushed. */\n branch?: string;\n /** Package name to the folder it installs from, such as a plugin's workspace folder. */\n packages?: Record<string, string>;\n}): ConsumerRepository => {\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), \"shiplane-consumer-\"));\n const root = path.join(dir, \"checkout\");\n const origin = path.join(dir, \"origin.git\");\n const home = path.join(dir, \"home\");\n fs.mkdirSync(home);\n fs.writeFileSync(\n path.join(home, \".gitconfig\"),\n \"[user]\\n\\tname = Shiplane Consumer\\n\\temail = consumer@example.com\\n\" +\n \"[commit]\\n\\tgpgsign = false\\n[tag]\\n\\tgpgsign = false\\n[core]\\n\\thooksPath = /dev/null\\n\",\n );\n const bin = path.join(dir, \"bin\");\n offlineTools(bin);\n const env = hermeticEnv(home, bin);\n const git = (args: string[], where?: { in: \"origin\" }) =>\n execFileSync(\"git\", args, {\n cwd: where ? origin : root,\n env,\n stdio: \"pipe\",\n encoding: \"utf8\",\n }).trim();\n const write = (file: string, text: string) => {\n const target = path.join(root, file);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, text);\n };\n\n fs.mkdirSync(root);\n execFileSync(\"git\", [\"init\", \"--quiet\", \"--bare\", `--initial-branch=${branch}`, origin], { env });\n git([\"init\", \"--quiet\", `--initial-branch=${branch}`]);\n git([\"remote\", \"add\", \"origin\", origin]);\n write(\".gitignore\", \"node_modules\\n\");\n Object.entries(files).forEach(([file, text]) => write(file, text));\n Object.entries({ [CORE]: coreDir(import.meta.dirname), ...packages }).forEach(([name, from]) => {\n const link = path.join(root, \"node_modules\", name);\n fs.mkdirSync(path.dirname(link), { recursive: true });\n fs.symlinkSync(from, link, \"dir\");\n });\n const commitAndPush = (title: string) => {\n git([\"add\", \"--all\"]);\n git([\"commit\", \"--quiet\", \"-m\", title]);\n git([\"push\", \"--quiet\", \"origin\", branch]);\n };\n commitAndPush(\"chore: start\");\n\n const cli = builtCli();\n return {\n root,\n origin,\n write,\n read: (file) => fs.readFileSync(path.join(root, file), \"utf8\"),\n git,\n commitAndPush,\n shiplane: (args) => {\n const run = spawnSync(process.execPath, [cli, ...args], {\n cwd: root,\n env,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n return { status: run.status ?? 1, output: `${run.stdout}${run.stderr}` };\n },\n remove: () => fs.rmSync(dir, { recursive: true, force: true }),\n };\n};\n","import fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/** The public API a test config imports, resolved to source since tests run before any build. */\nexport const SOURCE_ALIASES: Record<string, string> = {\n shiplane: path.resolve(import.meta.dirname, \"../index.ts\"),\n \"shiplane/plugin\": path.resolve(import.meta.dirname, \"../plugin.ts\"),\n \"shiplane/testing\": path.resolve(import.meta.dirname, \"public.ts\"),\n};\n\nexport interface Workspace {\n root: string;\n write: (file: string, text: string) => void;\n read: (file: string) => string;\n exists: (file: string) => boolean;\n remove: () => void;\n}\n\n/** A throwaway repository on disk, one entry per file, removed by `remove()`. */\nexport const createWorkspace = (files: Record<string, string>): Workspace => {\n const root = fs.mkdtempSync(path.join(os.tmpdir(), \"release-workspace-\"));\n const write = (file: string, text: string) => {\n const target = path.join(root, file);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, text);\n };\n Object.entries(files).forEach(([file, text]) => write(file, text));\n return {\n root,\n write,\n read: (file) => fs.readFileSync(path.join(root, file), \"utf8\"),\n exists: (file) => fs.existsSync(path.join(root, file)),\n remove: () => fs.rmSync(root, { recursive: true, force: true }),\n };\n};\n\nexport const packageJson = (name: string, version = \"1.0.0\", extra: object = {}) =>\n JSON.stringify({ name, version, ...extra }, null, 2);\n"],"mappings":";;;;;;;;;;;;AAUA,IAAa,iBAAb,MAA6C;CAC3C,QAA8B,EAAE;CAChC,UAAsF,EAAE;CACxF,YAA4C,EAAE;CAE9C,QAAQ,WAAmC;AACzC,OAAK,YAAY;GAAE,GAAG,KAAK;GAAW,GAAG;GAAW;AACpD,SAAO;;CAGT,OAAO,SAAiB,KAAK,UAAU;;CAGvC,KAAK,QAAgB,QAA8B;AACjD,OAAK,QAAQ,KAAK;GAAE;GAAQ;GAAQ,CAAC;AACrC,SAAO;;;CAIT,SAAS,QAAgB,QAA8B;AACrD,OAAK,QAAQ,QAAQ;GAAE;GAAQ;GAAQ,MAAM;GAAM,CAAC;AACpD,SAAO;;CAGT,OAAe,SAAiB,MAAyB,SAAkC;AACzF,OAAK,MAAM,KAAK;GAAE;GAAS,MAAM,CAAC,GAAG,KAAK;GAAE,KAAK,QAAQ;GAAK,KAAK,QAAQ;GAAK,CAAC;EACjF,MAAM,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,IAAI;EACzC,MAAM,QAAQ,KAAK,QAAQ,MAAM,EAAE,aAAa,KAAK,WAAW,OAAO,CAAC;AACxE,MAAI,OAAO,KAAM,MAAK,QAAQ,OAAO,KAAK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U;CAAE;CAAM;CAAS,GAAG;CAAO,EAAE,MAAM,EAAE"}
|
|
1
|
+
{"version":3,"file":"testing.js","names":[],"sources":["../src/adapters/shell/__fakes__/shell.fake.ts","../src/testing/decideContract.ts","../src/adapters/files/__fakes__/memory-files.fake.ts","../src/adapters/terminal/__fakes__/progress.fake.ts","../src/adapters/terminal/__fakes__/terminal.fake.ts","../src/testing/releaseContext.ts","../src/testing/deliveryContract.ts","../src/adapters/server-hosting/server-hosting.contract.ts","../src/adapters/static-hosting/static-hosting.contract.ts","../src/adapters/mobile-distribution/mobile-distribution.contract.ts","../src/adapters/package-registry/package-registry.contract.ts","../src/adapters/source-control/source-control.contract.ts","../src/adapters/code-host/code-host.contract.ts","../src/adapters/ci-pipeline/ci-pipeline.contract.ts","../src/adapters/versioning/versioning.contract.ts","../src/testing/platformEnvContract.ts","../src/testing/sample.ts","../src/testing/live.ts","../src/testing/plans.ts","../src/testing/consumer.ts","../src/testing/workspace.ts"],"sourcesContent":["import type { RunOptions, Shell, ShellResult } from \"../../../ports/shell.port\";\n\nexport interface ShellCall {\n command: string;\n args: string[];\n cwd?: string;\n env?: Record<string, string>;\n}\n\n/** A shell that runs nothing: it keeps every call and answers from what was seeded. */\nexport class RecordingShell implements Shell {\n readonly calls: ShellCall[] = [];\n private answers: { prefix: string; result: Partial<ShellResult>; once?: boolean }[] = [];\n private variables: Record<string, string> = {};\n\n seedEnv(variables: Record<string, string>) {\n this.variables = { ...this.variables, ...variables };\n return this;\n }\n\n env = (name: string) => this.variables[name];\n\n /** Puts a folder first on the seeded PATH, as the system shell does to its process. */\n prependPath = (dir: string) => {\n const { PATH } = this.variables;\n this.variables.PATH = PATH ? `${dir}:${PATH}` : dir;\n };\n\n /** Answers every call whose `command args` line starts with `prefix`. */\n seed(prefix: string, result: Partial<ShellResult>) {\n this.answers.push({ prefix, result });\n return this;\n }\n\n /** Answers the next call starting with `prefix` only, ahead of what `seed` answers. */\n seedOnce(prefix: string, result: Partial<ShellResult>) {\n this.answers.unshift({ prefix, result, once: true });\n return this;\n }\n\n private answer(command: string, args: readonly string[], options: RunOptions): ShellResult {\n this.calls.push({ command, args: [...args], cwd: options.cwd, env: options.env });\n const line = [command, ...args].join(\" \");\n const found = this.answers.find(({ prefix }) => line.startsWith(prefix));\n if (found?.once) this.answers.splice(this.answers.indexOf(found), 1);\n return { status: 0, stdout: \"\", stderr: \"\", ...found?.result };\n }\n\n capture = (command: string, args: readonly string[], options: RunOptions = {}) =>\n Promise.resolve(this.answer(command, args, options));\n\n attach = (command: string, args: readonly string[], options: RunOptions = {}) =>\n Promise.resolve(this.answer(command, args, options).status);\n}\n","import { expect, it } from \"vitest\";\n\nimport type { ReleaseUnit } from \"../domain/unit\";\nimport type { DecideContext, Decision, JobInput } from \"../ports/delivery.port\";\nimport { CiPipelineFake } from \"../adapters/ci-pipeline/__fakes__/ci-pipeline.fake\";\nimport { CodeHostFake } from \"../adapters/code-host/__fakes__/code-host.fake\";\nimport { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport { SourceControlFake } from \"../adapters/source-control/__fakes__/source-control.fake\";\nimport { DEFAULT_TAG_FORMAT } from \"../domain/tags\";\n\ntype Input = JobInput<Record<string, unknown>>;\n\n/** A port whose own platform decides what ships, such as a registry or a mobile distribution. */\ninterface Decides {\n decide: (context: DecideContext, input: Input) => Promise<Decision>;\n live?: (context: DecideContext, input: Input) => Promise<boolean>;\n}\n\nconst ACTIONS: ReadonlySet<Decision[\"action\"]> = new Set([\n \"ship\",\n \"none\",\n \"choose\",\n \"fail\",\n \"pull-request\",\n]);\n\nexport const decides = (port: object): port is Decides =>\n \"decide\" in port && typeof port.decide === \"function\";\n\n/** A repository with nothing tagged yet, its tools answering empty, on the contract's fakes. */\nconst freshContext = (unit: ReleaseUnit): DecideContext => {\n const shell = new RecordingShell();\n return {\n root: \"/repo\",\n shell,\n sourceControl: new SourceControlFake(),\n codeHost: new CodeHostFake(),\n ciPipeline: new CiPipelineFake(),\n units: [unit],\n tagFormat: DEFAULT_TAG_FORMAT,\n versionFiles: new Set(),\n changedCode: () => Promise.resolve([]),\n now: () => new Date(\"2026-01-01T00:00:00Z\"),\n open: (adapter) => adapter.create({ root: \"/repo\", shell }),\n };\n};\n\n/** What a deciding port does on a repository with nothing tagged: it says so, and nothing is live. */\nexport const decideContract = ({\n port,\n unit,\n input,\n}: {\n port: Decides;\n unit: ReleaseUnit;\n input: Input;\n}) => {\n it(\"given a version never tagged, when the adapter decides, then it answers one of the decisions the release flow knows\", async () => {\n const decision = await port.decide(freshContext(unit), input);\n\n expect(ACTIONS.has(decision.action)).toBe(true);\n });\n\n it(\"given a version never tagged, when the adapter says whether it is live, then it is not\", async () => {\n expect(await (port.live?.(freshContext(unit), input) ?? false)).toBe(false);\n });\n};\n","import path from \"node:path\";\n\nimport type { Files } from \"../../../ports/files.port\";\n\n/** A repository held in memory, one entry per file: nothing touches the disk. */\nexport class MemoryFiles implements Files {\n private readonly texts = new Map<string, string>();\n /** Every write and removal, in order, for a test to read back. */\n readonly changes: { kind: \"write\" | \"remove\"; file: string }[] = [];\n\n constructor(files: Record<string, string> = {}) {\n Object.entries(files).forEach(([file, text]) =>\n this.texts.set(path.posix.normalize(file), text),\n );\n }\n\n private entries(dir: string) {\n const prefix = dir === \".\" || dir === \"\" ? \"\" : `${path.posix.normalize(dir)}/`;\n return [...this.texts.keys()]\n .filter((file) => file.startsWith(prefix))\n .map((file) => file.slice(prefix.length).split(\"/\"));\n }\n\n exists = (file: string) => {\n const at = path.posix.normalize(file);\n return this.texts.has(at) || [...this.texts.keys()].some((key) => key.startsWith(`${at}/`));\n };\n\n read = (file: string) => this.texts.get(path.posix.normalize(file)) ?? null;\n\n write = (file: string, text: string) => {\n this.texts.set(path.posix.normalize(file), text);\n this.changes.push({ kind: \"write\", file });\n };\n\n append = (file: string, text: string) => this.write(file, `${this.read(file) ?? \"\"}${text}`);\n\n remove = (file: string) => {\n this.texts.delete(path.posix.normalize(file));\n this.changes.push({ kind: \"remove\", file });\n };\n\n list = (dir: string) => [...new Set(this.entries(dir).map(([first = \"\"]) => first))].sort();\n\n folders = (dir: string) =>\n [\n ...new Set(\n this.entries(dir)\n .filter((parts) => parts.length > 1)\n .map(([first = \"\"]) => first),\n ),\n ].sort();\n\n /** Every file, as a snapshot a test compares before and after. */\n get all(): Record<string, string> {\n return Object.fromEntries([...this.texts].sort(([a], [b]) => a.localeCompare(b)));\n }\n}\n","import type { Mood } from \"../../../domain/display\";\nimport type { BatchPlace, Output, Progress, StepPlace } from \"../../../ports/terminal.port\";\n\nexport interface ProgressEvent {\n kind: \"stage\" | \"during\" | \"say\";\n text: string;\n mood?: Mood;\n step?: StepPlace;\n /** How many items a batch runs at once. */\n batch?: number;\n}\n\n/** Progress kept as events; what it says also goes to the output, as a terminal would print it. */\nexport class RecordingProgress implements Progress {\n readonly events: ProgressEvent[] = [];\n\n constructor(private readonly output: Output) {}\n\n stage = (stages: readonly string[], index: number) => {\n this.events.push({\n kind: \"stage\",\n text: stages[index] ?? \"\",\n step: { index, total: stages.length },\n });\n };\n\n during = <T>(\n label: string,\n mood: Mood,\n work: () => Promise<T>,\n step?: StepPlace | BatchPlace,\n ) => {\n const place = step && \"done\" in step ? { batch: step.total } : step ? { step } : {};\n this.events.push({ kind: \"during\", mood, text: label, ...place });\n return work();\n };\n\n say = (mood: Mood, text: string) => {\n this.events.push({ kind: \"say\", mood, text });\n this.output.line(text);\n };\n}\n","import type { Choice, Clock, Output, Prompter } from \"../../../ports/terminal.port\";\n\n/** Everything the CLI printed, in order, without colours. */\nexport class MemoryOutput implements Output {\n readonly lines: string[] = [];\n\n line = (text = \"\") => {\n // eslint-disable-next-line no-control-regex\n this.lines.push(text.replace(/\\u001B\\[[0-9;]*m/g, \"\"));\n };\n\n get text() {\n return this.lines.join(\"\\n\");\n }\n}\n\ntype Answer = boolean | string | string[] | null;\n\n/** A person who answers from a script, in order; every question asked is kept. */\nexport class ScriptedPrompter implements Prompter {\n readonly asked: string[] = [];\n /** The answer each choice question offered first, by question. */\n readonly initials: Record<string, unknown> = {};\n /** The choices each select question offered, by question. */\n readonly choices: Record<string, Choice<string>[]> = {};\n private answers: Answer[] = [];\n\n constructor(readonly interactive = true) {}\n\n answer(...answers: Answer[]) {\n this.answers.push(...answers);\n return this;\n }\n\n private next(question: string): Answer {\n this.asked.push(question);\n if (this.answers.length === 0) throw new Error(`Unexpected question: ${question}`);\n return this.answers.shift() ?? null;\n }\n\n confirm = (question: string, initial = false) => {\n this.initials[question] = initial;\n return Promise.resolve(this.next(question) === true);\n };\n\n typed = (question: string, word: string) => Promise.resolve(this.next(question) === word);\n\n select = <Value extends string>(message: string, choices: Choice<Value>[], initial?: Value) => {\n this.initials[message] = initial;\n this.choices[message] = choices;\n return Promise.resolve(this.next(message) as Value | null);\n };\n\n multiselect = <Value extends string>(\n message: string,\n choices: Choice<Value>[],\n initial: Value[],\n ) => {\n this.initials[message] = initial;\n this.choices[message] = choices;\n return Promise.resolve(this.next(message) as Value[] | null);\n };\n\n text = (message: string) => Promise.resolve(this.next(message) as string | null);\n\n /** No key is ever pressed: every wait times out, unless keys were queued with `press`. */\n private keys: string[] = [];\n\n press(...keys: string[]) {\n this.keys.push(...keys);\n return this;\n }\n\n waitForKey = () => Promise.resolve(this.keys.shift() ?? null);\n}\n\n/** A clock fixed at one moment, whose waits return at once. */\nexport class FixedClock implements Clock {\n constructor(private readonly at: Date) {}\n\n now = () => this.at;\n sleep = () => Promise.resolve();\n}\n","import type { Release } from \"../application/config/loadRelease\";\nimport type { ReleaseContext } from \"../application/context\";\nimport type { Approval } from \"../domain/releasePr\";\nimport type { ReleaseUnit } from \"../domain/unit\";\nimport type { Feature, ReleaseModule } from \"../modules/module\";\nimport type { Files } from \"../ports/files.port\";\nimport { ciPipelineFake } from \"../adapters/ci-pipeline/__fakes__/ci-pipeline.fake\";\nimport { codeHostFake } from \"../adapters/code-host/__fakes__/code-host.fake\";\nimport { MemoryFiles } from \"../adapters/files/__fakes__/memory-files.fake\";\nimport { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport { sourceControlFake } from \"../adapters/source-control/__fakes__/source-control.fake\";\nimport { RecordingProgress } from \"../adapters/terminal/__fakes__/progress.fake\";\nimport {\n FixedClock,\n MemoryOutput,\n ScriptedPrompter,\n} from \"../adapters/terminal/__fakes__/terminal.fake\";\nimport { versioningFake } from \"../adapters/versioning/__fakes__/versioning.fake\";\nimport { releaseFlow } from \"../application/releaseFlow\";\nimport { DEFAULT_TAG_FORMAT } from \"../domain/tags\";\n\nexport const testUnit = (name: string, overrides: Partial<ReleaseUnit> = {}): ReleaseUnit => ({\n name,\n dir: `apps/${name}`,\n file: `apps/${name}/shiplane.unit.yml`,\n packageName: `@acme/${name}`,\n version: \"0.1.0\",\n module: \"web-app\",\n options: {},\n after: [],\n ...overrides,\n});\n\n/** The flow's Fakes, as adapters a config would hold. */\ninterface FlowFakes {\n sourceControl: ReturnType<typeof sourceControlFake>;\n codeHost: ReturnType<typeof codeHostFake>;\n ciPipeline: ReturnType<typeof ciPipelineFake>;\n versioning: ReturnType<typeof versioningFake>;\n}\n\n/**\n * A release over a Fake of every port the flow runs on, answered by a scripted person. The apps are\n * in release order as given: the first is the Latest release.\n */\nexport const testContext = ({\n units,\n modules = [],\n features = [],\n yes = false,\n interactive = true,\n root = \"/repo\",\n tagFormat = DEFAULT_TAG_FORMAT,\n approval,\n files = new MemoryFiles(),\n}: {\n units: ReleaseUnit[];\n modules?: ReleaseModule[];\n /** The features, or how to make them from the flow's Fakes they share. */\n features?: Feature[] | ((flow: FlowFakes) => Feature[]);\n yes?: boolean;\n interactive?: boolean;\n root?: string;\n tagFormat?: string;\n /** Whether someone else approves the release PR; the config default when absent. */\n approval?: Approval;\n /** The repository's files; empty when absent. */\n files?: Files;\n}) => {\n const sourceControl = sourceControlFake();\n const codeHost = codeHostFake();\n const ciPipeline = ciPipelineFake();\n const versioning = versioningFake();\n const prompter = new ScriptedPrompter(interactive);\n const output = new MemoryOutput();\n const progress = new RecordingProgress(output);\n const shell = new RecordingShell();\n const fakes = { sourceControl, codeHost, ciPipeline, versioning };\n const flow = releaseFlow({ ...fakes, approval });\n const release: Release = {\n root,\n flow,\n modules,\n features: typeof features === \"function\" ? features(fakes) : features,\n units,\n problems: [],\n tagFormat,\n };\n const context: ReleaseContext = {\n release,\n load: () => Promise.resolve(release),\n services: {\n sourceControl: sourceControl.fake,\n codeHost: codeHost.fake,\n ciPipeline: ciPipeline.fake,\n versioning: versioning.fake,\n },\n open: (adapter) => adapter.create({ root, shell }),\n prompter,\n output,\n progress,\n clock: new FixedClock(new Date(\"2026-10-12T09:00:00Z\")),\n shell,\n files,\n options: { yes, ci: false },\n };\n return {\n context,\n flow: fakes,\n source: sourceControl.fake,\n host: codeHost.fake,\n ci: ciPipeline.fake,\n versioning: versioning.fake,\n prompter,\n output,\n progress,\n shell,\n };\n};\n\nexport const changesetText = (packages: Record<string, string>, summary: string) =>\n `---\\n${Object.entries(packages)\n .map(([name, type]) => `\"${name}\": ${type}`)\n .join(\"\\n\")}\\n---\\n\\n${summary}\\n`;\n","import { describe, expect, it } from \"vitest\";\n\nimport type { Environment } from \"../domain/environment\";\nimport type { DeliveryAdapter } from \"../ports/adapter.port\";\nimport type { Delivery, FolderView } from \"../ports/delivery.port\";\nimport { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport { optionsFor } from \"../application/config/optionsFor\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { decideContract, decides } from \"./decideContract\";\nimport { testUnit } from \"./releaseContext\";\n\n/** One adapter of a port, with settings an app's unit file could hold for it. */\nexport interface ContractCase<Port extends Delivery & { capability: string }> {\n adapter: DeliveryAdapter<Port>;\n settings: Record<string, unknown>;\n /** False when its decision reads a platform the contract's empty fakes cannot answer. */\n decide?: boolean;\n}\n\nconst EMPTY_FOLDER: FolderView = {\n dir: \"apps/empty\",\n name: \"empty\",\n files: [],\n has: () => false,\n read: () => null,\n};\n\n/** What every adapter of a delivery port must do, whatever its provider; `more` adds the port's own. */\nexport const deliveryContract = <Port extends Delivery & { capability: string }>(\n kind: string,\n cases: ContractCase<Port>[],\n more: (adapter: DeliveryAdapter<Port>, port: Port) => void = () => undefined,\n) =>\n describe.each(cases.map((entry) => [entry.adapter.name, entry] as const))(\n `%s, as ${kind}`,\n (_name, { adapter, settings, decide = true }) => {\n const port = adapter.create({ root: \"/repo\", shell: new RecordingShell() });\n const unit = testUnit(\"app\", { module: \"app\", options: settings });\n const inputFor = (environment: Environment) => ({\n unit,\n tag: \"app@0.1.0\",\n environment,\n options: optionsFor({ ...unit, options: adapter.settings.parse(settings) }, environment, [\n unit,\n ]),\n commit: \"abc1234\",\n defaultBranch: \"main\",\n });\n\n it(\"given an app's settings, when its unit file is read, then the adapter's schema takes them\", () => {\n expect(adapter.settings.safeParse(settings).success).toBe(true);\n });\n\n it(\"given a tag on each environment, when it says where the tag lands, then a person can read it\", () => {\n ENVIRONMENTS.forEach((environment) =>\n expect(port.describe(inputFor(environment)).trim()).not.toBe(\"\"),\n );\n });\n\n it(\"given a tag on each environment, when its jobs are built, then each says what it does and what it runs\", () => {\n ENVIRONMENTS.forEach((environment) =>\n port.jobs(inputFor(environment)).forEach((job) => {\n expect(job.label.trim()).not.toBe(\"\");\n expect(job.local.length).toBeGreaterThan(0);\n job.local.forEach(({ command }) => expect(command.trim()).not.toBe(\"\"));\n }),\n );\n });\n\n it(\"given a folder with nothing in it, when setup looks at it, then the adapter recognises nothing\", () => {\n expect(adapter.detect?.(EMPTY_FOLDER) ?? null).toBeNull();\n });\n\n it(\"given an app it ships, when doctor asks what it needs, then each need has a name and a check\", () => {\n (adapter.requirements?.(unit) ?? []).forEach(({ label, check }) => {\n expect(label.trim()).not.toBe(\"\");\n expect(check.command.trim()).not.toBe(\"\");\n });\n });\n\n if (decide && decides(port)) decideContract({ port, unit, input: inputFor(\"preview\") });\n\n more(adapter, port);\n },\n );\n","import { expect, it } from \"vitest\";\n\nimport type { ServerHostingPort } from \"../../ports/server-hosting.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every server host does, whatever its provider. */\nexport const serverHostingContract = (cases: ContractCase<ServerHostingPort>[]) =>\n deliveryContract(\"server hosting\", cases, (_adapter, port) => {\n it(\"given a server host, when its kind is read, then it hosts servers\", () => {\n expect(port.capability).toBe(\"server-hosting\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { StaticHostingPort } from \"../../ports/static-hosting.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every static host does, whatever its provider. */\nexport const staticHostingContract = (cases: ContractCase<StaticHostingPort>[]) =>\n deliveryContract(\"static hosting\", cases, (_adapter, port) => {\n it(\"given a static host, when its kind is read, then it hosts static sites\", () => {\n expect(port.capability).toBe(\"static-hosting\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { MobileDistributionPort } from \"../../ports/mobile-distribution.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every mobile distribution does, whatever its provider. */\nexport const mobileDistributionContract = (cases: ContractCase<MobileDistributionPort>[]) =>\n deliveryContract(\"mobile distribution\", cases, (adapter, port) => {\n it(\"given a mobile distribution, when status asks who decides, then its platform is named\", () => {\n expect(port.capability).toBe(\"mobile-distribution\");\n expect(adapter.decidedBy?.platform.trim() ?? \"\").not.toBe(\"\");\n });\n });\n","import { expect, it } from \"vitest\";\n\nimport type { PackageRegistryPort } from \"../../ports/package-registry.port\";\nimport type { ContractCase } from \"../../testing/deliveryContract\";\nimport { deliveryContract } from \"../../testing/deliveryContract\";\n\n/** What every package registry does, whatever its provider. */\nexport const packageRegistryContract = (cases: ContractCase<PackageRegistryPort>[]) =>\n deliveryContract(\"a package registry\", cases, (_adapter, port) => {\n it(\"given a package registry, when its kind is read, then it publishes packages\", () => {\n expect(port.capability).toBe(\"package-registry\");\n });\n });\n","import os from \"node:os\";\nimport path from \"node:path\";\nimport { describe, expect, it } from \"vitest\";\n\nimport type { SourceControlPort } from \"../../ports/source-control.port\";\n\n/** A repository on main with one commit, and the ways a test arranges it beyond the port. */\nexport interface SourceControlSubject {\n port: SourceControlPort;\n /** The commit main is on. */\n head: () => Promise<string>;\n /** Writes a file the repository does not track yet. */\n change: (file: string, text: string) => Promise<void>;\n}\n\nlet worktrees = 0;\nconst tmpWorktree = () =>\n path.join(os.tmpdir(), `shiplane-contract-worktree-${process.pid}-${(worktrees += 1)}`);\n\n/** What every source control does, whatever its provider. */\nexport const sourceControlContract = (name: string, subject: () => Promise<SourceControlSubject>) =>\n describe(`${name}, as source control`, () => {\n it(\"given a fresh checkout, when its position is read, then it is on main with nothing to commit\", async () => {\n const { port } = await subject();\n\n expect((await port.position()).branch).toBe(\"main\");\n expect(await port.isClean()).toBe(true);\n });\n\n it(\"given a fresh checkout of main, when its default branch is read, then it is main\", async () => {\n const { port } = await subject();\n\n expect(await port.defaultBranch()).toBe(\"main\");\n });\n\n it(\"given a commit tagged, when the tags are read, then the tag is there and names that commit\", async () => {\n const { port, head } = await subject();\n const sha = await head();\n\n await port.tag(\"app@1.0.0\", sha, \"app 1.0.0\");\n\n expect(await port.tags()).toContain(\"app@1.0.0\");\n expect(await port.tagCommit(\"app@1.0.0\")).toBe(sha);\n });\n\n it(\"given tags in every format a config names, when the tags are read, then each one is there\", async () => {\n const { port, head } = await subject();\n const sha = await head();\n for (const tag of [\"arnaud-zg--v0.2.1\", \"v1.0.0\", \"app@1.0.0\"]) {\n await port.tag(tag, sha, tag);\n }\n\n expect([...(await port.tags())].sort()).toEqual([\"app@1.0.0\", \"arnaud-zg--v0.2.1\", \"v1.0.0\"]);\n });\n\n it(\"given a tag deleted, when the tags are read, then it is gone and names no commit\", async () => {\n const { port, head } = await subject();\n await port.tag(\"app@1.0.0\", await head(), \"app 1.0.0\");\n\n await port.deleteTag(\"app@1.0.0\");\n\n expect(await port.tags()).not.toContain(\"app@1.0.0\");\n expect(await port.tagCommit(\"app@1.0.0\")).toBeNull();\n });\n\n it(\"given a branch created, when the position is read, then it is on it, and switching back returns to main\", async () => {\n const { port } = await subject();\n\n await port.createBranch(\"release/next\");\n const onBranch = (await port.position()).branch;\n await port.switchTo(\"main\");\n\n expect(onBranch).toBe(\"release/next\");\n expect((await port.position()).branch).toBe(\"main\");\n });\n\n it(\"given a new file committed, when the changes are read, then it is no longer among them\", async () => {\n const { port, change } = await subject();\n await change(\"notes.md\", \"notes\\n\");\n const before = await port.changedFiles();\n\n await port.commit([\"notes.md\"], \"docs: notes\");\n\n expect(before).toContain(\"notes.md\");\n expect(await port.changedFiles()).not.toContain(\"notes.md\");\n });\n\n it(\"given a branch and main each one commit ahead, when their merge base is read, then it is where the branch started\", async () => {\n const { port, change, head } = await subject();\n const start = await head();\n await port.createBranch(\"feat/x\");\n await change(\"feature.md\", \"feature\\n\");\n await port.commit([\"feature.md\"], \"feat: x\");\n const branch = await head();\n await port.switchTo(\"main\");\n await change(\"main.md\", \"main\\n\");\n await port.commit([\"main.md\"], \"chore: main moves\");\n\n expect(await port.mergeBase?.(await head(), branch)).toBe(start);\n });\n\n it(\"given an env file git ignores, when the ignored files are listed by pattern, then only it is listed\", async () => {\n const { port, change } = await subject();\n await change(\".gitignore\", \".env*\\n\");\n await port.commit([\".gitignore\"], \"chore: ignore env files\");\n await change(\".env.local\", \"TOKEN=1\\n\");\n await change(\"notes.md\", \"notes\\n\");\n\n expect(await port.ignoredFiles([\".env*\"])).toEqual([\".env.local\"]);\n });\n\n it(\"given a tag, when a worktree is added at it and removed, then it lists nothing more and the checkout stays on main\", async () => {\n const { port, head } = await subject();\n await port.tag(\"app@1.0.0\", await head(), \"app 1.0.0\");\n const dir = tmpWorktree();\n\n await port.addWorktree(dir, \"app@1.0.0\");\n await port.removeWorktree(dir);\n\n expect((await port.position()).branch).toBe(\"main\");\n expect(await port.isClean()).toBe(true);\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { IssueRef } from \"../../domain/issues\";\nimport type { CodeHostPort } from \"../../ports/code-host.port\";\n\n/** A repository on a code host, and the ways a test arranges it beyond the port. */\nexport interface CodeHostSubject {\n port: CodeHostPort;\n /** A branch the host can open a pull request from, pushed with one commit on it. */\n branch: (name: string) => Promise<string>;\n /** A tag the host can publish release notes for. */\n tag: () => Promise<string>;\n /** An issue or pull request comments can go on. */\n issue: IssueRef;\n}\n\n/** What every code host does, whatever its provider. */\nexport const codeHostContract = (name: string, subject: () => Promise<CodeHostSubject>) =>\n describe(`${name}, as a code host`, () => {\n it(\"given a pull request opened, when the open ones are read, then it is there and open\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-open\");\n\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n\n expect(pr.head).toEqual(expect.any(String));\n expect(await port.openPrsFrom(\"release/contract-open\")).toContainEqual(pr);\n expect(await port.prState(pr)).toBe(\"OPEN\");\n });\n\n it(\"given a pull request closed, when the open ones are read, then it is gone and closed\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-close\");\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n\n await port.closePr(pr, \"Closed by the contract suite.\");\n\n expect(await port.openPrsFrom(\"release/contract-close\")).not.toContainEqual(pr);\n expect(await port.prState(pr)).toBe(\"CLOSED\");\n });\n\n it(\"given a branch with an open pull request, when its pull request is read, then it is that one; another branch has none\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-for-branch\");\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n\n expect(await port.prForBranch(head)).toMatchObject({ number: pr.number, url: pr.url });\n expect(await port.prForBranch(`${head}-none`)).toBeNull();\n });\n\n it(\"given a comment upserted twice with one marker, when the comments are read, then there is one, holding the second body\", async () => {\n const { port, branch } = await subject();\n const head = await branch(\"release/contract-upsert\");\n const pr = await port.createPr({\n base: \"main\",\n head,\n title: \"chore: contract\",\n body: \"Opened by the contract suite.\",\n label: \"release\",\n });\n const marker = `<!-- contract:${Date.now()} -->`;\n const ref = {\n repository: new URL(pr.url).pathname.split(\"/\").slice(1, 3).join(\"/\"),\n number: pr.number,\n };\n\n await port.upsertComment({ on: pr, marker, body: `${marker}\\nfirst` });\n await port.upsertComment({ on: pr, marker, body: `${marker}\\nsecond` });\n\n const marked = (await port.comments([ref])).flat().filter((body) => body.includes(marker));\n expect(marked).toEqual([`${marker}\\nsecond`]);\n });\n\n it(\"given release notes published for a tag, when the released tags are read, then it is among them\", async () => {\n const { port, tag } = await subject();\n const name = await tag();\n\n await port.createRelease(name, \"Published by the contract suite.\", false);\n\n expect(await port.releasedTags()).toContain(name);\n });\n\n it(\"given release notes published with the tag before, when the released tags are read, then it is among them\", async () => {\n const { port, tag } = await subject();\n const before = await tag();\n const name = await tag();\n\n await port.createRelease(name, \"Published by the contract suite.\", false, before);\n\n expect(await port.releasedTags()).toContain(name);\n });\n\n it(\"given a deploy recorded, when the deploys are read, then it is there and done\", async () => {\n const { port, tag } = await subject();\n const name = await tag();\n\n await port.recordDeployment(name, \"preview\");\n\n expect(await port.deployments()).toContainEqual({\n title: `Deploy ${name} to preview`,\n state: \"done\",\n });\n });\n\n it(\"given a comment posted, when the comments are read, then it is among them\", async () => {\n const { port, issue } = await subject();\n const body = `Posted by the contract suite at ${new Date().toISOString()}.`;\n\n await port.comment(issue, body);\n\n expect((await port.comments([issue])).flat()).toContain(body);\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { CiPipelinePort } from \"../../ports/ci-pipeline.port\";\n\n/** A CI pipeline, and the ways a test reads it beyond the port. */\nexport interface CiPipelineSubject {\n port: CiPipelinePort;\n /** A workflow that exists and has never run. */\n idle: string;\n}\n\n/** What every CI pipeline does, whatever its provider. */\nexport const ciPipelineContract = (name: string, subject: () => Promise<CiPipelineSubject>) =>\n describe(`${name}, as a CI pipeline`, () => {\n it(\"given a workflow that never ran, when its runs are read, then there are none\", async () => {\n const { port, idle } = await subject();\n\n expect(await port.workflowRuns(idle)).toEqual([]);\n });\n\n it(\"given a workflow that never succeeded, when its billed minutes are read, then none are measured\", async () => {\n const { port, idle } = await subject();\n\n expect(await port.measuredMinutes(idle)).toEqual([]);\n });\n\n it(\"given this month's budget, when it is read, then what is left is never more than included\", async () => {\n const { port } = await subject();\n\n const minutes = await port.minutes();\n\n expect(minutes === null || minutes.left <= minutes.included).toBe(true);\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { VersioningPort } from \"../../ports/versioning.port\";\n\n/** A workspace with one package, and the ways a test arranges it beyond the port. */\nexport interface VersioningSubject {\n port: VersioningPort;\n /** The package the workspace holds, and its folder. */\n workspace: { name: string; folder: string };\n}\n\n/** What every versioning does, whatever its provider. */\nexport const versioningContract = (name: string, subject: () => Promise<VersioningSubject>) =>\n describe(`${name}, as versioning`, () => {\n it(\"given a change written, when the pending changes are read, then it is there naming its package and bump\", async () => {\n const { port, workspace } = await subject();\n\n await port.write({\n id: \"contract-change\",\n releases: [{ name: workspace.name, type: \"minor\" }],\n summary: \"Written by the contract suite.\",\n });\n\n const pending = await port.pending();\n expect(pending.map(({ id }) => id)).toContain(\"contract-change\");\n expect(pending.find(({ id }) => id === \"contract-change\")?.text).toContain(\n `\"${workspace.name}\": minor`,\n );\n });\n\n it(\"given a person with nothing queued, when they are told what to do, then the port says it\", async () => {\n const { port } = await subject();\n\n expect(port.nextChange).not.toBe(\"\");\n });\n\n it(\"given a workspace package, when the folders are read, then it is found in its folder\", async () => {\n const { port, workspace } = await subject();\n\n expect(await port.folders()).toMatchObject({ [workspace.name]: workspace.folder });\n });\n\n it(\"given a change and a folder, when their files are named, then they sit where a person looks\", async () => {\n const { port, workspace } = await subject();\n\n expect(port.changesetFile(\"contract-change\")).toBe(\".changeset/contract-change.md\");\n expect(port.changelogFile(workspace.folder)).toBe(`${workspace.folder}/CHANGELOG.md`);\n });\n });\n","import { describe, expect, it } from \"vitest\";\n\nimport type { RecordingShell } from \"../adapters/shell/__fakes__/shell.fake\";\nimport type { Environment } from \"../domain/environment\";\nimport type { DeliveryAdapter } from \"../ports/adapter.port\";\nimport { optionsFor } from \"../application/config/optionsFor\";\nimport { isEnvVarName } from \"../domain/checkEnvBeforeDeploy\";\nimport { testUnit } from \"./releaseContext\";\n\n/** One adapter's env, with the shells that answer its listing: one that lists, one that fails. */\nexport interface PlatformEnvCase {\n adapter: DeliveryAdapter<{ capability: string }>;\n settings: Record<string, unknown>;\n environment: Environment;\n /** A shell whose listing holds `names`. */\n listing: { shell: RecordingShell; names: readonly string[] };\n /** A shell whose listing fails, signed out or offline. */\n failing: RecordingShell;\n}\n\n/** What every platform env does, whatever its provider: list names only, and say how to set them. */\nexport const platformEnvContract = (cases: PlatformEnvCase[]) =>\n describe.each(cases.map((entry) => [entry.adapter.name, entry] as const))(\n \"%s, as a platform env\",\n (_name, { adapter, settings, environment, listing, failing }) => {\n const unit = testUnit(\"app\", { module: \"app\", options: settings });\n const options = optionsFor(\n { ...unit, options: adapter.settings.parse(settings) },\n environment,\n [unit],\n );\n const envOn = (shell: RecordingShell) => {\n if (!adapter.env) throw new Error(`${adapter.name} lists no env`);\n return adapter.env({ root: \"/repo\", shell });\n };\n\n it(\"given names set on the platform, when they are listed, then each is there as an env var name\", async () => {\n const listed = await envOn(listing.shell).listNames({ unit, environment, options });\n\n expect([...listed]).toEqual(expect.arrayContaining([...listing.names]));\n expect([...listed].every(isEnvVarName)).toBe(true);\n });\n\n it(\"given a listing the platform refuses, when names are listed, then it fails saying why\", async () => {\n await expect(envOn(failing).listNames({ unit, environment, options })).rejects.toThrow(\n /\\S/,\n );\n });\n\n it(\"given names to set, when the person is told how, then the command names each of them\", () => {\n const names = listing.names.filter(isEnvVarName);\n const command = envOn(listing.shell).setCommand({ unit, environment, options, names });\n\n names.forEach((name) => expect(command).toContain(name));\n });\n },\n );\n","import type { UnitRef } from \"../domain/changes\";\nimport type { DecidedBy } from \"../domain/scope\";\n\n/** This repository's four shipping units, as the rule tests were written against them. */\nexport const SAMPLE_UNITS: UnitRef[] = [\"expo\", \"api\", \"admin\", \"landing\"].map((name) => ({\n name,\n packageName: `@acme/${name}`,\n}));\n\nexport const SAMPLE_VERSION_FILES = new Set([\n \"apps/expo/app-version.json\",\n \"apps/api/public/app-version.preview.json\",\n \"apps/api/public/app-version.production.json\",\n]);\n\n// Billed minutes per deploy with no successful run to measure: the api validates before deploying.\nexport const SAMPLE_TYPICAL_MINUTES: Record<string, number> = {\n api: 13,\n admin: 5,\n landing: 4,\n expo: 8,\n};\n\nexport const EAS_DECIDES: DecidedBy = {\n platform: \"EAS\",\n choice: \"build or update\",\n check: \"shiplane status\",\n};\n","import { execFileSync } from \"node:child_process\";\nimport { z } from \"zod\";\n\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\n\n/**\n * Contract suites against hosted services run only with RELEASE_CONTRACT_LIVE=1, on a sandbox\n * repository checked out at RELEASE_CONTRACT_REPO: they open pull requests, publish releases and\n * dispatch workflows there.\n */\nexport const LIVE = systemShell.env(\"RELEASE_CONTRACT_LIVE\") === \"1\";\n\n/** The sandbox checkout, refused when unset so a live run never touches this repository. */\nexport const sandbox = () =>\n z\n .string({ message: \"RELEASE_CONTRACT_REPO names a sandbox checkout for live contracts\" })\n .min(1)\n .parse(systemShell.env(\"RELEASE_CONTRACT_REPO\"));\n\n/** Runs git in the sandbox and returns what it printed. */\nexport const inSandbox = (args: string[]) =>\n execFileSync(\"git\", args, { cwd: sandbox(), encoding: \"utf8\" }).trim();\n","import type { BumpLevel, PlannedChangeset, StatusPlan } from \"../domain/changes\";\nimport { nextVersion } from \"../domain/versions\";\n\n/**\n * What `changeset status` answers for these pending changesets, plus the ones a release adds, minus\n * the lines it holds back: every named package moves once, by its biggest bump, up to `ceiling`.\n */\nexport const planFrom =\n (pending: PlannedChangeset[], versions: Record<string, string>) =>\n (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel): StatusPlan => {\n const heldLines = new Set(\n held.flatMap(({ id, releases }) => releases.map(({ name }) => `${id}:${name}`)),\n );\n const changesets = [...pending, ...added]\n .map((changeset) => ({\n ...changeset,\n releases: changeset.releases.filter(\n ({ name }) => !heldLines.has(`${changeset.id}:${name}`),\n ),\n }))\n .filter(({ releases }) => releases.length > 0);\n const order: BumpLevel[] = [\"major\", \"minor\", \"patch\"];\n const capped = ceiling ? order.slice(order.indexOf(ceiling)) : order;\n const names = [\n ...new Set(changesets.flatMap(({ releases }) => releases.map(({ name }) => name))),\n ];\n return {\n changesets,\n releases: names.map((name) => {\n const lines = changesets.filter(({ releases }) =>\n releases.some((line) => line.name === name),\n );\n const named =\n order.find((candidate) =>\n lines.some(({ releases }) =>\n releases.some((line) => line.name === name && line.type === candidate),\n ),\n ) ?? \"patch\";\n const type = capped.includes(named) ? named : (ceiling ?? named);\n const oldVersion = versions[name] ?? \"0.1.0\";\n return {\n name,\n type,\n oldVersion,\n newVersion: nextVersion(oldVersion, type),\n changesets: lines.map(({ id }) => id),\n };\n }),\n };\n };\n","import { execFileSync, spawnSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\nimport { coreDir } from \"../cli/installed\";\n\n/** What the built CLI printed and the code it exited with. */\nexport interface CliRun {\n status: number;\n output: string;\n}\n\nexport interface ConsumerRepository {\n root: string;\n /** The bare repository the checkout pushes to, standing in for GitHub. */\n origin: string;\n write: (file: string, text: string) => void;\n read: (file: string) => string;\n /** Runs git in the checkout, or in the bare origin with `{ in: \"origin\" }`. */\n git: (args: string[], where?: { in: \"origin\" }) => string;\n /** Commits every file as it stands and pushes the branch to the origin. */\n commitAndPush: (title: string) => void;\n /** Runs the built `shiplane` CLI in the checkout, as a person types it. */\n shiplane: (args: string[]) => CliRun;\n remove: () => void;\n}\n\nconst CORE = \"shiplane\";\n\n/** The built CLI, as `pnpm add shiplane` installs it. */\nexport const builtCli = (): string => {\n const cli = path.join(coreDir(import.meta.dirname), \"dist\", \"cli.js\");\n if (!fs.existsSync(cli)) {\n throw new Error(`shiplane is not built: run pnpm turbo run build --filter=${CORE}`);\n }\n return cli;\n};\n\n// No global git config, signing key, token or CI marker leaks in: a run sees only this repository.\nconst LEAKS = new Set([\"GITHUB_ACTIONS\", \"CI\", \"GITHUB_TOKEN\", \"GH_TOKEN\"]);\n\nconst hermeticEnv = (home: string, bin: string): NodeJS.ProcessEnv => ({\n ...Object.fromEntries(Object.entries(process.env).filter(([name]) => !LEAKS.has(name))),\n PATH: [bin, systemShell.env(\"PATH\") ?? \"\"].join(path.delimiter),\n HOME: home,\n GIT_CONFIG_GLOBAL: path.join(home, \".gitconfig\"),\n GIT_CONFIG_NOSYSTEM: \"1\",\n NO_COLOR: \"1\",\n // A fixed date makes each commit's hash depend on its files only, so docs can quote a run.\n GIT_AUTHOR_DATE: \"2026-01-01T00:00:00Z\",\n GIT_COMMITTER_DATE: \"2026-01-01T00:00:00Z\",\n});\n\n// The tools that reach a platform answer offline, so a run that would call one fails at once.\nconst OFFLINE = [\"gh\", \"npm\", \"flyctl\"];\n\nconst offlineTools = (bin: string) => {\n fs.mkdirSync(bin);\n OFFLINE.forEach((tool) => {\n const file = path.join(bin, tool);\n fs.writeFileSync(file, `#!/bin/sh\\necho \"${tool}: offline in this repository\" >&2\\nexit 1\\n`);\n fs.chmodSync(file, 0o755);\n });\n};\n\n/**\n * A repository as a consumer has it: its files, the packages it installed linked in its\n * node_modules, one commit pushed to a local bare origin. gh, npm and flyctl answer offline.\n */\nexport const consumerRepository = ({\n files,\n packages = {},\n branch = \"main\",\n}: {\n files: Record<string, string>;\n /** The branch releases start from, created first and pushed. */\n branch?: string;\n /** Package name to the folder it installs from, such as a plugin's workspace folder. */\n packages?: Record<string, string>;\n}): ConsumerRepository => {\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), \"shiplane-consumer-\"));\n const root = path.join(dir, \"checkout\");\n const origin = path.join(dir, \"origin.git\");\n const home = path.join(dir, \"home\");\n fs.mkdirSync(home);\n fs.writeFileSync(\n path.join(home, \".gitconfig\"),\n \"[user]\\n\\tname = Shiplane Consumer\\n\\temail = consumer@example.com\\n\" +\n \"[commit]\\n\\tgpgsign = false\\n[tag]\\n\\tgpgsign = false\\n[core]\\n\\thooksPath = /dev/null\\n\",\n );\n const bin = path.join(dir, \"bin\");\n offlineTools(bin);\n const env = hermeticEnv(home, bin);\n const git = (args: string[], where?: { in: \"origin\" }) =>\n execFileSync(\"git\", args, {\n cwd: where ? origin : root,\n env,\n stdio: \"pipe\",\n encoding: \"utf8\",\n }).trim();\n const write = (file: string, text: string) => {\n const target = path.join(root, file);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, text);\n };\n\n fs.mkdirSync(root);\n execFileSync(\"git\", [\"init\", \"--quiet\", \"--bare\", `--initial-branch=${branch}`, origin], { env });\n git([\"init\", \"--quiet\", `--initial-branch=${branch}`]);\n git([\"remote\", \"add\", \"origin\", origin]);\n write(\".gitignore\", \"node_modules\\n\");\n Object.entries(files).forEach(([file, text]) => write(file, text));\n Object.entries({ [CORE]: coreDir(import.meta.dirname), ...packages }).forEach(([name, from]) => {\n const link = path.join(root, \"node_modules\", name);\n fs.mkdirSync(path.dirname(link), { recursive: true });\n fs.symlinkSync(from, link, \"dir\");\n });\n const commitAndPush = (title: string) => {\n git([\"add\", \"--all\"]);\n git([\"commit\", \"--quiet\", \"-m\", title]);\n git([\"push\", \"--quiet\", \"origin\", branch]);\n };\n commitAndPush(\"chore: start\");\n\n const cli = builtCli();\n return {\n root,\n origin,\n write,\n read: (file) => fs.readFileSync(path.join(root, file), \"utf8\"),\n git,\n commitAndPush,\n shiplane: (args) => {\n const run = spawnSync(process.execPath, [cli, ...args], {\n cwd: root,\n env,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n return { status: run.status ?? 1, output: `${run.stdout}${run.stderr}` };\n },\n remove: () => fs.rmSync(dir, { recursive: true, force: true }),\n };\n};\n","import fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/** The public API a test config imports, resolved to source since tests run before any build. */\nexport const SOURCE_ALIASES: Record<string, string> = {\n shiplane: path.resolve(import.meta.dirname, \"../index.ts\"),\n \"shiplane/plugin\": path.resolve(import.meta.dirname, \"../plugin.ts\"),\n \"shiplane/testing\": path.resolve(import.meta.dirname, \"public.ts\"),\n};\n\nexport interface Workspace {\n root: string;\n write: (file: string, text: string) => void;\n read: (file: string) => string;\n exists: (file: string) => boolean;\n remove: () => void;\n}\n\n/** A throwaway repository on disk, one entry per file, removed by `remove()`. */\nexport const createWorkspace = (files: Record<string, string>): Workspace => {\n const root = fs.mkdtempSync(path.join(os.tmpdir(), \"release-workspace-\"));\n const write = (file: string, text: string) => {\n const target = path.join(root, file);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n fs.writeFileSync(target, text);\n };\n Object.entries(files).forEach(([file, text]) => write(file, text));\n return {\n root,\n write,\n read: (file) => fs.readFileSync(path.join(root, file), \"utf8\"),\n exists: (file) => fs.existsSync(path.join(root, file)),\n remove: () => fs.rmSync(root, { recursive: true, force: true }),\n };\n};\n\nexport const packageJson = (name: string, version = \"1.0.0\", extra: object = {}) =>\n JSON.stringify({ name, version, ...extra }, null, 2);\n"],"mappings":";;;;;;;;;;;;AAUA,IAAa,iBAAb,MAA6C;CAC3C,QAA8B,EAAE;CAChC,UAAsF,EAAE;CACxF,YAA4C,EAAE;CAE9C,QAAQ,WAAmC;AACzC,OAAK,YAAY;GAAE,GAAG,KAAK;GAAW,GAAG;GAAW;AACpD,SAAO;;CAGT,OAAO,SAAiB,KAAK,UAAU;;CAGvC,eAAe,QAAgB;EAC7B,MAAM,EAAE,SAAS,KAAK;AACtB,OAAK,UAAU,OAAO,OAAO,GAAG,IAAI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SAAS,CAAC,MAAM,UAAU,MAAM,MAAM,KAAK,CAAC;AAClE,QAAO;EACL;EACA;EACA,OAAO,SAAS,GAAG,aAAa,KAAK,KAAK,MAAM,KAAK,EAAE,OAAO;EAC9D,SAAS,SAAS,GAAG,WAAW,KAAK,KAAK,MAAM,KAAK,CAAC;EACtD,cAAc,GAAG,OAAO,MAAM;GAAE,WAAW;GAAM,OAAO;GAAM,CAAC;EAChE;;AAGH,MAAa,eAAe,MAAc,UAAU,SAAS,QAAgB,EAAE,KAC7E,KAAK,UAAU;CAAE;CAAM;CAAS,GAAG;CAAO,EAAE,MAAM,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shiplane",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-fix-shiplane-ship-node-cache.3dccda9",
|
|
4
4
|
"description": "Release and deploy a monorepo in one command: finds what changed, versions, tags and ships each app through plugins (npm, Fly.io, EAS, Cloudflare Pages).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"release",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"lint": "eslint --cache --cache-location .cache/.eslintcache",
|
|
71
71
|
"start": "node dist/cli.js",
|
|
72
72
|
"test": "vitest run",
|
|
73
|
+
"test:mutate": "stryker run ../../stryker.config.mjs",
|
|
73
74
|
"typecheck": "tsc -p tsconfig.typecheck.json"
|
|
74
75
|
}
|
|
75
76
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"budget-BTnKtGF6.js","names":[],"sources":["../src/application/config/workspaceFolders.ts","../src/domain/tags.ts","../src/domain/governance.ts","../src/domain/versions.ts","../src/domain/changes.ts","../src/domain/deploys.ts","../src/ports/shell.port.ts","../src/domain/budget.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { parse } from \"yaml\";\nimport { z } from \"zod\";\n\nconst PnpmWorkspaceSchema = z.object({ packages: z.array(z.string()).optional() }).nullish();\nconst PackageWorkspacesSchema = z.object({\n workspaces: z\n .union([z.array(z.string()), z.object({ packages: z.array(z.string()) })])\n .optional(),\n});\n\n/** What reading a workspace needs, by path relative to its root: a disk, or files in memory. */\nexport interface WorkspaceReader {\n read: (file: string) => string | null;\n /** The folders directly inside `dir`, by name. */\n folders: (dir: string) => string[];\n exists: (file: string) => boolean;\n}\n\n/** The repository on disk, under `root`, as a workspace reader. */\nexport const diskReader = (root: string): WorkspaceReader => ({\n read: (file) => {\n const absolute = path.join(root, file);\n return fs.existsSync(absolute) ? fs.readFileSync(absolute, \"utf8\") : null;\n },\n folders: (dir) => {\n const absolute = path.join(root, dir);\n if (!fs.existsSync(absolute)) return [];\n return fs\n .readdirSync(absolute, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name);\n },\n exists: (file) => fs.existsSync(path.join(root, file)),\n});\n\nconst readerOf = (from: string | WorkspaceReader) =>\n typeof from === \"string\" ? diskReader(from) : from;\n\n/** The folders the workspace file lists: pnpm's first, then package.json, else the root alone. */\nexport const workspacePatterns = (from: string | WorkspaceReader): string[] => {\n const reader = readerOf(from);\n const pnpm = reader.read(\"pnpm-workspace.yaml\");\n const fromPnpm = pnpm === null ? undefined : PnpmWorkspaceSchema.parse(parse(pnpm))?.packages;\n if (fromPnpm && fromPnpm.length > 0) return fromPnpm;\n const manifest = reader.read(\"package.json\");\n const { workspaces } =\n manifest === null\n ? { workspaces: undefined }\n : PackageWorkspacesSchema.parse(JSON.parse(manifest));\n if (workspaces) return Array.isArray(workspaces) ? workspaces : workspaces.packages;\n return [\".\"];\n};\n\n/** Folders matching `dir/*` or an exact path, sorted. Negations and deeper globs are skipped. */\nexport const expandPatterns = (\n from: string | WorkspaceReader,\n patterns: readonly string[],\n): string[] => {\n const reader = readerOf(from);\n const folders = patterns\n .filter((pattern) => !pattern.startsWith(\"!\"))\n .map((pattern) => pattern.replace(/\\/+$/, \"\"))\n .flatMap((pattern) => {\n if (pattern.endsWith(\"/*\")) {\n const parent = pattern.slice(0, -2);\n return reader\n .folders(parent)\n .filter((name) => !name.startsWith(\".\") && name !== \"node_modules\")\n .map((name) => path.posix.join(parent, name));\n }\n if (pattern.includes(\"*\")) return [];\n return reader.exists(pattern) ? [path.posix.normalize(pattern)] : [];\n });\n return [...new Set(folders)].sort();\n};\n","/** Tag formats a config can name instead of writing one out. */\nexport const TAG_FORMATS = {\n /** `api@1.2.0`: one tag per unit, as changesets tags a monorepo. */\n package: \"{name}@{version}\",\n /**\n * `my-plugin--v1.2.0`: an agent plugin's tag. Claude Code resolves versions from it; Gemini CLI and\n * Codex install from any tag, so one tag serves all three.\n */\n plugin: \"{name}--v{version}\",\n /** `v1.2.0`: a repository that releases one unit, the most common tag there is. */\n single: \"v{version}\",\n /** `api/v1.2.0`: a tag per folder, as Go requires for a module below the repository root. */\n module: \"{name}/v{version}\",\n} as const;\n\nexport type TagFormatName = keyof typeof TAG_FORMATS;\n\n/** How a tag names a unit's version unless the config says otherwise. */\nexport const DEFAULT_TAG_FORMAT = TAG_FORMATS.package;\n\n/** A format's name resolved to the format; anything else is a format already. */\nexport const tagFormatNamed = (format: string): string =>\n Object.hasOwn(TAG_FORMATS, format) ? TAG_FORMATS[format as TagFormatName] : format;\n\n/** A unit's tag for a version, through a format like `v{version}` or `{name}--v{version}`. */\nexport const tagName = (app: string, version: string, format: string = DEFAULT_TAG_FORMAT) =>\n format.replaceAll(\"{name}\", app).replaceAll(\"{version}\", version);\n\nexport interface TagCandidate {\n /** The unit's name. */\n app: string;\n version: string;\n /** The commit that brought this version, as `git log -S` finds it. */\n commit: { sha: string; subject: string };\n /** No version of the unit was ever tagged: the commit that added it brings its first release. */\n first?: boolean;\n}\n\n/**\n * No tag names any version of the unit yet: the version it holds is its first release. 0.0.0 is a\n * unit never versioned, waiting for its first changeset.\n */\nexport const firstRelease = (\n app: string,\n version: string,\n tags: ReadonlySet<string>,\n format: string = DEFAULT_TAG_FORMAT,\n) => {\n const prefix = tagName(app, \"\", format);\n return version !== \"0.0.0\" && ![...tags].some((tag) => tag.startsWith(prefix));\n};\n\nexport interface ReleaseTag {\n /** The unit's name. */\n app: string;\n version: string;\n tag: string;\n sha: string;\n needsTag: boolean;\n needsNotes: boolean;\n}\n\nconst literal = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/** A release pull request's subject: `chore(api): release v0.0.4`, or `chore(release): ...` for several. */\nexport const isReleaseSubject = (subject: string) =>\n subject.startsWith(\"chore(release):\") || /^chore\\([^)]+\\): release v\\d/.test(subject);\n\n/**\n * A family a title names by its root brings the root and every `root-*`: `shiplane and 7 plugins\n * v0.1.0` at that version, `shiplane v0.2.0 and 7 plugins` with each plugin at whichever it moved to.\n */\nconst FAMILY =\n /(?:: |, | and )(\\S+?)(?: v(\\S+?))? and \\d+ (?:plugins?|more [a-z ]+?)(?: v(\\S+?))?(?=,| and | \\(#\\d+\\)$|$)/g;\nconst inFamily = (app: string, version: string, subject: string) =>\n [...subject.matchAll(FAMILY)].some(([, root, rootVersion, shared]) => {\n if (!root) return false;\n if (app === root) return (rootVersion ?? shared) === version;\n return app.startsWith(`${root}-`) && (shared === undefined || shared === version);\n });\n\nconst familyRelease = (app: string, subject: string) => {\n const root = /^chore\\(([^)]+)\\): release v\\d/.exec(subject)?.[1];\n return root !== undefined && root !== \"release\" && app.startsWith(`${root}-`);\n};\n\n// Older titles named versions without the v (\"chore(release): api 0.0.3 brings ...\"): both count.\nexport const cameWithRelease = ({ app, version, commit }: TagCandidate) => {\n const exact = `${literal(version)}(?![\\\\w.])`;\n return (\n new RegExp(`^chore\\\\(${literal(app)}\\\\): release v${exact}`).test(commit.subject) ||\n // A family's release names its root alone: each `root-*` came with it, at whatever version.\n familyRelease(app, commit.subject) ||\n (commit.subject.startsWith(\"chore(release):\") &&\n (new RegExp(`(?:: |, | and )${literal(app)} v?${exact}`).test(commit.subject) ||\n // An early release titled by its count alone: the commit that changed the version is it.\n /^chore\\(release\\): \\d+ (?:(?:web |mobile )?apps?|packages?|services?|tools?)(?: \\(#\\d+\\))?$/.test(\n commit.subject,\n ) ||\n inFamily(app, version, commit.subject)))\n );\n};\n\n/** The tags and release notes still missing for the versions releases brought. */\nexport const releaseTags = (\n candidates: TagCandidate[],\n tags: Set<string>,\n notes: Set<string>,\n format: string = DEFAULT_TAG_FORMAT,\n): ReleaseTag[] =>\n candidates\n .filter((candidate) => candidate.first === true || cameWithRelease(candidate))\n .flatMap(({ app, version, commit }) => {\n const tag = tagName(app, version, format);\n const needsTag = !tags.has(tag);\n const needsNotes = !notes.has(tag);\n return needsTag || needsNotes\n ? [{ app, version, tag, sha: commit.sha, needsTag, needsNotes }]\n : [];\n });\n\n/** One version's section of a changesets CHANGELOG.md, used as its release notes. */\nexport const changelogSection = (changelog: string, version: string) => {\n const section = changelog.split(`\\n## ${version}\\n`)[1]?.split(\"\\n## \")[0]?.trim();\n return section || `No changelog entry for ${version}.`;\n};\n","import type { Environment } from \"./environment\";\n\nexport type ReleaseIntent = \"build\" | \"update\" | \"submit\";\n\nexport interface GitPosition {\n branch: string;\n head: string;\n /** origin/main after a fetch. */\n originMain: string;\n}\n\nexport type SourceResult = { allowed: true } | { allowed: false; why: \"not-main\" | \"behind-main\" };\n\n/**\n * A binary ships what it was built from, so builds start from main as it is on origin. Preview\n * updates may come from a branch for testers; production updates only from main.\n */\nexport const releaseSource = (\n intent: ReleaseIntent,\n channel: Environment,\n { branch, head, originMain }: GitPosition,\n): SourceResult => {\n const needsMain = intent === \"build\" || (intent === \"update\" && channel === \"production\");\n if (!needsMain) return { allowed: true };\n if (branch !== \"main\") return { allowed: false, why: \"not-main\" };\n if (head !== originMain) return { allowed: false, why: \"behind-main\" };\n return { allowed: true };\n};\n\n/** Where `pnpm shiplane` goes: --channel when given, preview under --yes or with no terminal, else asked. */\nexport const channelChoice = ({\n flag,\n yes,\n interactive,\n}: {\n flag: Environment | undefined;\n yes: boolean;\n interactive: boolean;\n}): Environment | null => flag ?? (yes || !interactive ? \"preview\" : null);\n\n/** Production never runs a step nobody confirmed. */\nexport const yesAllowed = (channel: Environment, yes: boolean) =>\n !(yes && channel === \"production\");\n","import type { BumpLevel } from \"./changes\";\n\nconst toParts = (version: string) =>\n version.split(\".\").map((part) => Number.parseInt(part, 10) || 0);\n\n/** Negative, zero or positive, like a sort comparator: \"0.1.10\" is after \"0.1.9\". */\nexport const compareVersions = (left: string, right: string): number => {\n const leftParts = toParts(left);\n const rightParts = toParts(right);\n const length = Math.max(leftParts.length, rightParts.length);\n\n for (let index = 0; index < length; index += 1) {\n const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);\n if (difference !== 0) return difference;\n }\n\n return 0;\n};\n\nexport const nextPatch = (version: string) => {\n const [major = 0, minor = 0, patch = 0] = version.split(\".\").map(Number);\n return `${major}.${minor}.${patch + 1}`;\n};\n\n/** The version one bump of `level` after `version`. */\nexport const nextVersion = (version: string, level: BumpLevel) => {\n const [major = 0, minor = 0] = version.split(\".\").map(Number);\n if (level === \"major\") return `${major + 1}.0.0`;\n if (level === \"minor\") return `${major}.${minor + 1}.0`;\n return nextPatch(version);\n};\n","/** A unit as changesets know it: its name here, its package name there. */\nexport interface UnitRef {\n name: string;\n packageName: string;\n}\n\nexport type BumpType = \"major\" | \"minor\" | \"patch\" | \"none\";\n\n/** A bump that moves a version. */\nexport type BumpLevel = Exclude<BumpType, \"none\">;\n\n/** One changeset, as `changeset status --output` lists it. */\nexport interface PlannedChangeset {\n id: string;\n summary: string;\n releases: { name: string; type: BumpType }[];\n}\n\n/** One package's version move, as `changeset status --output` lists it. */\nexport interface PlannedRelease {\n name: string;\n type: BumpType;\n oldVersion: string;\n newVersion: string;\n /** Empty when the package only moves because a workspace dependency did. */\n changesets: string[];\n}\n\nexport interface StatusPlan {\n changesets: PlannedChangeset[];\n releases: PlannedRelease[];\n}\n\nexport interface AppBump {\n /** The unit's name. */\n app: string;\n from: string;\n to: string;\n /** What the app's users get: the summaries of the changesets naming it. */\n notes: string[];\n /** The workspace packages it moves with, when no changeset names it. */\n movedWith: string[];\n}\n\n/** The units a release moves, in `units` order, each with its notes or the packages it moves with. */\nexport const appBumps = (\n { changesets, releases }: StatusPlan,\n dependencies: Record<string, string[]>,\n units: readonly UnitRef[],\n): AppBump[] => {\n const moving = new Set(releases.map(({ name }) => name));\n return units.flatMap(({ name: app, packageName }) => {\n const release = releases.find(({ name }) => name === packageName);\n if (!release) return [];\n const notes = changesets\n .filter(({ id }) => release.changesets.includes(id))\n .map(({ summary }) => summary);\n const movedWith =\n notes.length > 0 ? [] : (dependencies[release.name] ?? []).filter((dep) => moving.has(dep));\n return [{ app, from: release.oldVersion, to: release.newVersion, notes, movedWith }];\n });\n};\n\n/** How many internal packages a release moves: they get changelogs, nothing ships. */\nexport const packageBumps = ({ releases }: StatusPlan, units: readonly UnitRef[]) =>\n releases.filter(({ name }) => !units.some(({ packageName }) => packageName === name)).length;\n\n/**\n * Holding an app back keeps its lines pending, with any package line they came with so the package\n * does not drag the held app along. The picked apps' lines ship under the same summary.\n */\nexport const splitChangesets = (\n changesets: PlannedChangeset[],\n held: readonly string[],\n units: readonly UnitRef[],\n) => {\n const packageOf = (name: string) => units.find((unit) => unit.name === name)?.packageName;\n const heldNames = new Set(held.map(packageOf));\n const isUnit = (name: string) => units.some(({ packageName }) => packageName === name);\n return changesets.reduce<{ ships: PlannedChangeset[]; waits: PlannedChangeset[] }>(\n (split, changeset) => {\n if (!changeset.releases.some(({ name }) => heldNames.has(name))) {\n return { ...split, ships: [...split.ships, changeset] };\n }\n const picked = changeset.releases.filter(({ name }) => isUnit(name) && !heldNames.has(name));\n const waiting = changeset.releases.filter(\n ({ name }) => !picked.some((line) => line.name === name),\n );\n return {\n ships:\n picked.length > 0 ? [...split.ships, { ...changeset, releases: picked }] : split.ships,\n waits: [...split.waits, { ...changeset, releases: waiting }],\n };\n },\n { ships: [], waits: [] },\n );\n};\n\n/** The units a changeset file releases, read from its frontmatter. */\nexport const changesetApps = (text: string, units: readonly UnitRef[]): string[] => {\n const frontmatter = text.split(\"---\")[1] ?? \"\";\n return units\n .filter(({ packageName }) => frontmatter.includes(`\"${packageName}\":`))\n .map(({ name }) => name);\n};\n","import type { Environment } from \"./environment\";\n\n/** The run name the deploy workflows set, so the Actions list says which version went where. */\nexport const deployRunTitle = (tag: string, environment: Environment) =>\n `Deploy ${tag} to ${environment}`;\n\nexport type DeployState = \"none\" | \"running\" | \"done\";\n\n// INACTIVE: a later deploy to the same environment superseded a successful one.\nconst DEPLOYED = new Set([\"SUCCESS\", \"ACTIVE\", \"INACTIVE\"]);\nconst DEPLOYING = new Set([\"IN_PROGRESS\", \"QUEUED\", \"PENDING\", \"WAITING\"]);\n\n/** One version on one environment, from the states of its GitHub deployments. */\nexport const deployState = (states: string[]): DeployState => {\n if (states.some((state) => DEPLOYED.has(state))) return \"done\";\n return states.some((state) => DEPLOYING.has(state)) ? \"running\" : \"none\";\n};\n\nexport type WebShip = \"deploy\" | \"deploying\" | \"shipped\" | \"not-on-preview\";\n\n/** What one web app's tagged version still needs on an environment. */\nexport const webShip = ({\n environment,\n run,\n onPreview,\n}: {\n environment: Environment;\n /** Its deploy on that environment: none yet, queued or waiting on the approval gate, or done. */\n run: DeployState;\n onPreview: boolean;\n}): WebShip => {\n if (run === \"done\") return \"shipped\";\n if (run === \"running\") return \"deploying\";\n if (environment === \"production\" && !onPreview) return \"not-on-preview\";\n return \"deploy\";\n};\n\n/** Whether a diff only moves version files: the code is still the code a release named. */\nexport const onlyVersionFiles = (files: string[], versionFiles: ReadonlySet<string>) =>\n files.every((file) => versionFiles.has(file));\n\nexport type DeployPath = \"github\" | \"local\";\n\n/** How this run deploys: --via when given, GitHub Actions under --yes, otherwise asked (null). */\nexport const deployVia = ({ via, yes }: { via: DeployPath | undefined; yes: boolean }) =>\n via ?? (yes ? (\"github\" as const) : null);\n\nexport interface ShipItem {\n /** The unit's name. */\n app: string;\n tag: string;\n /** An EAS build, an over-the-air update, or a web deploy. */\n kind: \"build\" | \"update\" | \"deploy\";\n}\n\n/** An EAS build runs on EAS whichever way: only updates and web deploys have a path to pick. */\nexport const needsPath = (items: ShipItem[]) => items.some(({ kind }) => kind !== \"build\");\n\n/** This machine builds its checkout, so it ships only while that is the tagged code. */\nexport const shipsFrom = (\n path: DeployPath,\n { sinceTagOnlyVersionFiles }: { sinceTagOnlyVersionFiles: boolean },\n) => path === \"github\" || sinceTagOnlyVersionFiles;\n","export interface RunOptions {\n cwd?: string;\n env?: Record<string, string>;\n input?: string;\n}\n\nexport interface ShellResult {\n status: number;\n stdout: string;\n stderr: string;\n}\n\n/** Every vendor tool this CLI drives (git, gh, eas, flyctl, wrangler) goes through here. */\nexport interface Shell {\n /** Runs and captures its output; a non-zero exit is a result, never an error. */\n capture: (command: string, args: readonly string[], options?: RunOptions) => Promise<ShellResult>;\n /** Runs in the person's terminal with its output shown; resolves with the exit status. */\n attach: (command: string, args: readonly string[], options?: RunOptions) => Promise<number>;\n /** A variable of this process's environment, such as a token a command needs. */\n env: (name: string) => string | undefined;\n}\n\n/** A command that exited non-zero, carrying all it printed so a failure can show why. */\nexport class CommandFailed extends Error {\n readonly output: string;\n\n constructor(message: string, output: string) {\n super(message);\n this.name = \"CommandFailed\";\n this.output = output;\n }\n}\n","import type { ShipItem } from \"./deploys\";\n\n// Minutes a private repository's plan includes each month, and how GitHub weighs each runner.\nconst INCLUDED_MINUTES: Record<string, number> = { free: 2000, team: 3000, enterprise: 50000 };\nconst MINUTE_WEIGHT: Record<string, number> = { actions_windows: 2, actions_macos: 10 };\n\nexport interface ActionsMinutes {\n used: number;\n included: number;\n left: number;\n}\n\n/** This month's Actions minutes against the plan's allowance, from GitHub's usage summary. */\nexport const actionsMinutes = (\n plan: string,\n usage: { sku: string; grossQuantity: number; unitType: string }[],\n): ActionsMinutes | null => {\n const included = INCLUDED_MINUTES[plan];\n if (!included) return null;\n const used = Math.round(\n usage\n .filter(({ unitType }) => unitType === \"minutes\")\n .reduce((sum, { sku, grossQuantity }) => sum + grossQuantity * (MINUTE_WEIGHT[sku] ?? 1), 0),\n );\n return { used, included, left: Math.max(0, included - used) };\n};\n\nexport interface MinutesBudget {\n tone: \"green\" | \"yellow\" | \"red\";\n title: string;\n /** What is left, with what this release will spend shaded in. */\n bar: string;\n amount: string;\n pace: string;\n /** The status chip: enough, running short, or about to run out. */\n status: string;\n /** What is left after this release, or null when it spends nothing on GitHub. */\n after: string | null;\n}\n\nconst LOW_MINUTES = 100;\n\nconst STATUS: Record<MinutesBudget[\"tone\"], string> = {\n green: \"● enough minutes this month\",\n yellow: \"● running short this month\",\n red: \"● about to run out: deploy from this machine\",\n};\n\n/**\n * The minutes as the deploy question draws them: a bar of what is left, what this release spends,\n * and where this month ends if the pace so far holds. GitHub resets the allowance on the 1st, UTC.\n */\nexport const minutesBudget = (\n budget: ActionsMinutes,\n now: Date,\n width = 30,\n spend = 0,\n): MinutesBudget => {\n const { used, included, left } = budget;\n const start = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1);\n const end = Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1);\n const elapsed = Math.max((now.getTime() - start) / (end - start), 1 / (31 * 24));\n const projected = Math.round(used / elapsed) + spend;\n const leftAfter = Math.max(0, left - spend);\n const month = (format: Intl.DateTimeFormatOptions) =>\n new Date(start).toLocaleDateString(\"en-US\", { ...format, timeZone: \"UTC\" });\n const lastDay = new Date(end - 1).getUTCDate();\n const filled = Math.round((left / included) * width);\n const filledAfter = Math.round((leftAfter / included) * width);\n const number = (value: number) => value.toLocaleString(\"en-US\");\n const tone: MinutesBudget[\"tone\"] =\n leftAfter < LOW_MINUTES\n ? \"red\"\n : leftAfter / included < 0.5 || projected > included\n ? \"yellow\"\n : \"green\";\n const pace = `At this pace${spend > 0 ? \", with this release,\" : \"\"} about ${number(projected)} used by ${month({ month: \"long\" })} ${lastDay}`;\n return {\n tone,\n title: `GitHub Actions minutes · ${month({ month: \"long\", year: \"numeric\" })}`,\n bar: `${\"█\".repeat(filledAfter)}${\"▒\".repeat(filled - filledAfter)}${\"░\".repeat(width - filled)}`,\n amount: `${number(left)} of ${number(included)} left · ${Math.round((used / included) * 100)}% used`,\n pace:\n projected > included\n ? `${pace}, over the ${number(included)} included: prefer this machine.`\n : `${pace}, within the ${number(included)} included.`,\n status: STATUS[tone],\n after:\n spend > 0\n ? `This release: about ${spend} min on GitHub, about ${number(leftAfter)} left after it`\n : null,\n };\n};\n\n/** Minutes GitHub bills for a run: each job rounds up to the minute; unfinished jobs are skipped. */\nexport const billedMinutes = (jobs: { startedAt: string | null; completedAt: string | null }[]) =>\n jobs.reduce((sum, { startedAt, completedAt }) => {\n if (!startedAt || !completedAt) return sum;\n const seconds = (Date.parse(completedAt) - Date.parse(startedAt)) / 1000;\n return sum + Math.max(1, Math.ceil(seconds / 60));\n }, 0);\n\n// A deploy with no measured run and no typical figure: about what a small web deploy bills.\nconst FALLBACK_MINUTES = 5;\n\n/**\n * What the GitHub path costs for these items: each workflow's recent runs when measured, typical\n * figures otherwise. An EAS build runs on EAS and costs no Actions minutes.\n */\nexport const deployEstimate = (\n items: ShipItem[],\n measured: Partial<Record<string, number[]>>,\n typical: Record<string, number>,\n) => {\n const lines = items\n .filter(({ kind }) => kind !== \"build\")\n .map(({ app }) => {\n const runs = measured[app] ?? [];\n return runs.length > 0\n ? { app, minutes: Math.ceil(runs.reduce((a, b) => a + b, 0) / runs.length), measured: true }\n : { app, minutes: typical[app] ?? FALLBACK_MINUTES, measured: false };\n });\n return { total: lines.reduce((sum, { minutes }) => sum + minutes, 0), lines };\n};\n"],"mappings":";;;;;AAKA,MAAM,sBAAsB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,SAAS;AAC5F,MAAM,0BAA0B,EAAE,OAAO,EACvC,YAAY,EACT,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EA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E;GAAK,SAAS,QAAQ,QAAQ;GAAkB,UAAU;GAAO;GACvE;AACJ,QAAO;EAAE,OAAO,MAAM,QAAQ,KAAK,EAAE,cAAc,MAAM,SAAS,EAAE;EAAE;EAAO"}
|
package/dist/display-IqkJ6uCw.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
//#region src/domain/display.ts
|
|
2
|
-
const MOODS = [
|
|
3
|
-
"thinking",
|
|
4
|
-
"working",
|
|
5
|
-
"waiting",
|
|
6
|
-
"happy",
|
|
7
|
-
"worried",
|
|
8
|
-
"resting"
|
|
9
|
-
];
|
|
10
|
-
const UP = "/\\/\\/";
|
|
11
|
-
const DOWN = "\\/\\/\\";
|
|
12
|
-
const FRAMES = {
|
|
13
|
-
thinking: [
|
|
14
|
-
`${UP}(•ω•) ? `,
|
|
15
|
-
`${UP}(•ω•) ?`,
|
|
16
|
-
`${DOWN}(•ω•) ? `,
|
|
17
|
-
`${DOWN}(•ω•) `
|
|
18
|
-
],
|
|
19
|
-
working: [
|
|
20
|
-
`${UP}(•ω•)/ `,
|
|
21
|
-
`${UP}(•ω•)- `,
|
|
22
|
-
`${DOWN}(•ω•)\\ `,
|
|
23
|
-
`${DOWN}(•ω•)| `
|
|
24
|
-
],
|
|
25
|
-
waiting: [
|
|
26
|
-
`${UP}(-ω-) z `,
|
|
27
|
-
`${UP}(-ω-) zz`,
|
|
28
|
-
`${UP}(•ω•) `,
|
|
29
|
-
`${UP}(-ω-) zZ`
|
|
30
|
-
],
|
|
31
|
-
happy: [
|
|
32
|
-
`${UP}(^ω^) ✦ `,
|
|
33
|
-
`${DOWN}(^ω^) ✧ `,
|
|
34
|
-
`${UP}(^ω^)✦ ✧`,
|
|
35
|
-
`${DOWN}(^ω^) ✧ `
|
|
36
|
-
],
|
|
37
|
-
worried: [`${UP}(°ω°) ; `, `${DOWN}(°ω°) ;;`],
|
|
38
|
-
resting: [`${UP}(-ω-) zZ`, `${UP}(-ω-) z`]
|
|
39
|
-
};
|
|
40
|
-
/** `done` of `total` as a bar `width` characters wide. */
|
|
41
|
-
const progressBar = (done, total, width) => {
|
|
42
|
-
const filled = total <= 0 ? width : Math.round(width * Math.min(done, total) / total);
|
|
43
|
-
return `${"█".repeat(filled)}${"░".repeat(width - filled)}`;
|
|
44
|
-
};
|
|
45
|
-
const columns = (text) => [...text].length;
|
|
46
|
-
const pad = (text, width) => text + " ".repeat(Math.max(0, width - columns(text)));
|
|
47
|
-
/** Any mascot as a drawing: frames merged over the hedgehog's, a function sampled for its width. */
|
|
48
|
-
const drawingOf = (mascot) => {
|
|
49
|
-
if (typeof mascot === "function") {
|
|
50
|
-
const sample = MOODS.flatMap((mood) => [
|
|
51
|
-
0,
|
|
52
|
-
1,
|
|
53
|
-
2,
|
|
54
|
-
3
|
|
55
|
-
].map((tick) => columns(mascot({
|
|
56
|
-
mood,
|
|
57
|
-
tick,
|
|
58
|
-
label: ""
|
|
59
|
-
}))));
|
|
60
|
-
const width = Math.max(0, ...sample);
|
|
61
|
-
return {
|
|
62
|
-
hedgehog: false,
|
|
63
|
-
width,
|
|
64
|
-
frames: () => 4,
|
|
65
|
-
draw: (moment) => pad(mascot(moment), width)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
const own = mascot === true ? {} : mascot;
|
|
69
|
-
const frames = Object.fromEntries(MOODS.map((mood) => {
|
|
70
|
-
const given = own[mood];
|
|
71
|
-
return [mood, given && given.length > 0 ? given : FRAMES[mood]];
|
|
72
|
-
}));
|
|
73
|
-
const width = Math.max(...Object.values(frames).flat().map(columns));
|
|
74
|
-
return {
|
|
75
|
-
hedgehog: mascot === true,
|
|
76
|
-
width,
|
|
77
|
-
frames: (mood) => frames[mood].length,
|
|
78
|
-
draw: ({ mood, tick }) => pad(frames[mood][tick % frames[mood].length] ?? "", width)
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
/** A flag wins over the config, which wins over the default: verbose, with the mascot. */
|
|
82
|
-
const resolveDisplay = (config, flags, terminal) => {
|
|
83
|
-
const verbose = flags.verbose ?? config.verbose ?? true;
|
|
84
|
-
const configured = config.mascot ?? true;
|
|
85
|
-
const chosen = flags.mascot === void 0 ? configured : flags.mascot !== false && (configured === false ? true : configured);
|
|
86
|
-
const mascot = chosen === false ? null : drawingOf(chosen);
|
|
87
|
-
return {
|
|
88
|
-
verbose,
|
|
89
|
-
mascot,
|
|
90
|
-
motion: mascot !== null && terminal.tty && !terminal.ci && !terminal.noMotion
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
//#endregion
|
|
94
|
-
export { resolveDisplay as n, progressBar as t };
|
|
95
|
-
|
|
96
|
-
//# sourceMappingURL=display-IqkJ6uCw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"display-IqkJ6uCw.js","names":[],"sources":["../src/domain/display.ts"],"sourcesContent":["export const MOODS = [\"thinking\", \"working\", \"waiting\", \"happy\", \"worried\", \"resting\"] as const;\n\n/** What the mascot shows beside the release: reading, running, waiting on a person, done, failed, idle. */\nexport type Mood = (typeof MOODS)[number];\n\n// Spines that rise and fall, a face, then what he holds: every frame is 13 characters wide.\nconst UP = \"/\\\\/\\\\/\";\nconst DOWN = \"\\\\/\\\\/\\\\\";\n\nconst FRAMES: Record<Mood, readonly string[]> = {\n thinking: [`${UP}(•ω•) ? `, `${UP}(•ω•) ?`, `${DOWN}(•ω•) ? `, `${DOWN}(•ω•) `],\n working: [`${UP}(•ω•)/ `, `${UP}(•ω•)- `, `${DOWN}(•ω•)\\\\ `, `${DOWN}(•ω•)| `],\n waiting: [`${UP}(-ω-) z `, `${UP}(-ω-) zz`, `${UP}(•ω•) `, `${UP}(-ω-) zZ`],\n happy: [`${UP}(^ω^) ✦ `, `${DOWN}(^ω^) ✧ `, `${UP}(^ω^)✦ ✧`, `${DOWN}(^ω^) ✧ `],\n worried: [`${UP}(°ω°) ; `, `${DOWN}(°ω°) ;;`],\n resting: [`${UP}(-ω-) zZ`, `${UP}(-ω-) z`],\n};\n\nexport const mascotFrames = (mood: Mood) => FRAMES[mood];\n\n/** The mascot at a tick of his animation, looping. */\nexport const mascotFrame = (mood: Mood, tick: number) => {\n const frames = FRAMES[mood];\n return frames[tick % frames.length] ?? \"\";\n};\n\n/** `done` of `total` as a bar `width` characters wide. */\nexport const progressBar = (done: number, total: number, width: number) => {\n const filled = total <= 0 ? width : Math.round((width * Math.min(done, total)) / total);\n return `${\"█\".repeat(filled)}${\"░\".repeat(width - filled)}`;\n};\n\n/** What is happening when the mascot is drawn. */\nexport interface MascotMoment {\n mood: Mood;\n /** Its animation frame, from 0; always 0 when motion is off. */\n tick: number;\n /** What runs right now, such as \"build 3 apps\" or \"deploy api@1.2.0 to production\". */\n label: string;\n}\n\n/**\n * A mascot of your own: frames per mood, looped as it animates, or a function drawing each moment.\n * Plain text: shiplane colours it by mood, pads it to one width, and takes any mood a set of frames\n * leaves out from the hedgehog.\n */\nexport type Mascot = Partial<Record<Mood, readonly string[]>> | ((moment: MascotMoment) => string);\n\n/** A mascot ready to draw: every mood, one width. */\nexport interface MascotDrawing {\n /** True for the built-in hedgehog, coloured part by part. */\n readonly hedgehog: boolean;\n /** Columns every frame takes. */\n readonly width: number;\n /** How many frames a mood loops through. */\n frames: (mood: Mood) => number;\n draw: (moment: MascotMoment) => string;\n}\n\nconst columns = (text: string) => [...text].length;\nconst pad = (text: string, width: number) => text + \" \".repeat(Math.max(0, width - columns(text)));\n\n/** Any mascot as a drawing: frames merged over the hedgehog's, a function sampled for its width. */\nexport const drawingOf = (mascot: Mascot | true): MascotDrawing => {\n if (typeof mascot === \"function\") {\n const sample = MOODS.flatMap((mood) =>\n [0, 1, 2, 3].map((tick) => columns(mascot({ mood, tick, label: \"\" }))),\n );\n const width = Math.max(0, ...sample);\n return {\n hedgehog: false,\n width,\n frames: () => 4,\n draw: (moment) => pad(mascot(moment), width),\n };\n }\n const own = mascot === true ? {} : mascot;\n const frames = Object.fromEntries(\n MOODS.map((mood) => {\n const given = own[mood];\n return [mood, given && given.length > 0 ? given : FRAMES[mood]];\n }),\n ) as Record<Mood, readonly string[]>;\n const width = Math.max(...Object.values(frames).flat().map(columns));\n return {\n hedgehog: mascot === true,\n width,\n frames: (mood) => frames[mood].length,\n draw: ({ mood, tick }) => pad(frames[mood][tick % frames[mood].length] ?? \"\", width),\n };\n};\n\n/** How much the release says while it runs, as `shiplane.config.ts` or a flag asks. */\nexport interface DisplayChoice {\n /** Says each thing it reads and runs, with a progress bar. */\n verbose?: boolean;\n /** The mascot beside what is happening: the hedgehog (true), none (false), or your own. */\n mascot?: boolean | Mascot;\n}\n\nexport interface Display {\n verbose: boolean;\n /** The mascot to draw, or null for none. */\n mascot: MascotDrawing | null;\n /** The mascot animates: only in a terminal, never in a CI log or under NO_MOTION. */\n motion: boolean;\n}\n\n/** A flag wins over the config, which wins over the default: verbose, with the mascot. */\nexport const resolveDisplay = (\n config: DisplayChoice,\n flags: DisplayChoice,\n terminal: { tty: boolean; ci: boolean; noMotion: boolean },\n): Display => {\n const verbose = flags.verbose ?? config.verbose ?? true;\n // A flag turns it on or off; which mascot comes from the config, the hedgehog when it says none.\n const configured = config.mascot ?? true;\n const chosen =\n flags.mascot === undefined\n ? configured\n : flags.mascot !== false && (configured === false ? true : configured);\n const mascot = chosen === false ? null : drawingOf(chosen);\n return {\n verbose,\n mascot,\n motion: mascot !== null && terminal.tty && !terminal.ci && !terminal.noMotion,\n };\n};\n"],"mappings":";AAAA,MAAa,QAAQ;CAAC;CAAY;CAAW;CAAW;CAAS;CAAW;CAAU;AAMtF,MAAM,KAAK;AACX,MAAM,OAAO;AAEb,MAAM,SAA0C;CAC9C,UAAU;EAAC,GAAG,GAAG;EAAW,GAAG,GAAG;EAAW,GAAG,KAAK;EAAW,GAAG,KAAK;EAAU;CAClF,SAAS;EAAC,GAAG,GAAG;EAAW,GAAG,GAAG;EAAW,GAAG,KAAK;EAAY,GAAG,KAAK;EAAU;CAClF,SAAS;EAAC,GAAG,GAAG;EAAW,GAAG,GAAG;EAAW,G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