shiplane 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -150,6 +150,13 @@ const nextPatch = (version) => {
150
150
  const [major = 0, minor = 0, patch = 0] = version.split(".").map(Number);
151
151
  return `${major}.${minor}.${patch + 1}`;
152
152
  };
153
+ /** The version one bump of `level` after `version`. */
154
+ const nextVersion = (version, level) => {
155
+ const [major = 0, minor = 0] = version.split(".").map(Number);
156
+ if (level === "major") return `${major + 1}.0.0`;
157
+ if (level === "minor") return `${major}.${minor + 1}.0`;
158
+ return nextPatch(version);
159
+ };
153
160
  //#endregion
154
161
  //#region src/domain/changes.ts
155
162
  /** The units a release moves, in `units` order, each with its notes or the packages it moves with. */
@@ -206,32 +213,6 @@ const changesetApps = (text, units) => {
206
213
  const frontmatter = text.split("---")[1] ?? "";
207
214
  return units.filter(({ packageName }) => frontmatter.includes(`"${packageName}":`)).map(({ name }) => name);
208
215
  };
209
- /** Apps that changed since their current version came out, with no changeset to ship it. */
210
- const unreleasedApps = (history, named) => history.map((entry) => ({
211
- ...entry,
212
- commits: entry.commits.filter((subject) => !isReleaseSubject(subject))
213
- })).filter(({ app, commits }) => commits.length > 0 && !named.has(app));
214
- const USER_FACING = /^(feat|fix|perf)(\(.+?\))?!?:/;
215
- const asSentence = (subject) => {
216
- const text = subject.replace(/^\w+(\(.+?\))?!?:\s*/, "").replace(/\s*\(#\d+\)$/, "").trim();
217
- const sentence = `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
218
- return /[.!?]$/.test(sentence) ? sentence : `${sentence}.`;
219
- };
220
- /**
221
- * The patch changesets the release writes for an unreleased app the person picked: one changelog
222
- * line per feature or fix since its release, or its latest commit when there are only chores.
223
- */
224
- const unreleasedChangesets = ({ name: app, packageName }, version, commits) => {
225
- const userFacing = commits.filter((commit) => USER_FACING.test(commit));
226
- return (userFacing.length > 0 ? userFacing : commits.slice(0, 1)).map((subject, index) => ({
227
- id: `${app}-${nextPatch(version)}-${index + 1}`,
228
- releases: [{
229
- name: packageName,
230
- type: "patch"
231
- }],
232
- summary: asSentence(subject)
233
- }));
234
- };
235
216
  //#endregion
236
217
  //#region src/domain/deploys.ts
237
218
  /** The run name the deploy workflows set, so the Actions list says which version went where. */
@@ -366,6 +347,6 @@ const deployEstimate = (items, measured, typical) => {
366
347
  };
367
348
  };
368
349
  //#endregion
369
- export { expandPatterns as A, cameWithRelease as C, releaseTags as D, isReleaseSubject as E, tagFormatNamed as O, TAG_FORMATS as S, firstRelease as T, compareVersions as _, CommandFailed as a, yesAllowed as b, onlyVersionFiles as c, appBumps as d, changesetApps as f, unreleasedChangesets as g, unreleasedApps as h, minutesBudget as i, workspacePatterns as j, tagName as k, shipsFrom as l, splitChangesets as m, billedMinutes as n, deployRunTitle as o, packageBumps as p, deployEstimate as r, deployState as s, actionsMinutes as t, webShip as u, nextPatch as v, changelogSection as w, DEFAULT_TAG_FORMAT as x, releaseSource as y };
350
+ export { workspacePatterns as A, changelogSection as C, tagFormatNamed as D, releaseTags as E, tagName as O, cameWithRelease as S, isReleaseSubject as T, nextVersion as _, CommandFailed as a, DEFAULT_TAG_FORMAT as b, onlyVersionFiles as c, appBumps as d, changesetApps as f, nextPatch as g, compareVersions as h, minutesBudget as i, expandPatterns as k, shipsFrom as l, splitChangesets as m, billedMinutes as n, deployRunTitle as o, packageBumps as p, deployEstimate as r, deployState as s, actionsMinutes as t, webShip as u, releaseSource as v, firstRelease as w, TAG_FORMATS as x, yesAllowed as y };
370
351
 
371
- //# sourceMappingURL=budget-CTjB1v-Z.js.map
352
+ //# sourceMappingURL=budget-BTnKtGF6.js.map
@@ -0,0 +1 @@
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,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K,SAAS,KAAK,KAAK,KAAK,QAAQ,GAAG,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,OAAO;GAAE,UAAU;GAAM,GAC1F;GAAE;GAAK,SAAS,QAAQ,QAAQ;GAAkB,UAAU;GAAO;GACvE;AACJ,QAAO;EAAE,OAAO,MAAM,QAAQ,KAAK,EAAE,cAAc,MAAM,SAAS,EAAE;EAAE;EAAO"}
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as shellServerHosting } from "./shell-server-hosting.adapter-DobfDqFm.js";
3
- import { C as refreshEditorSchema, D as nodeFiles, E as keysAt, T as ENVIRONMENTS, _ as loadRelease, a as releaseToPreview, b as initRelease, c as promote, d as pickScope, f as openReleasePr, g as findConfig, h as docsFor, i as setup, l as shipTo, m as newAdapter, n as systemShell, o as missingTags, p as prepareRelease, r as liveLine, s as tagRelease, t as readStatus, u as planShips, v as addUnit, x as doctor, y as removeUnit } from "./readStatus-DmT61axf.js";
3
+ import { C as refreshEditorSchema, D as keysAt, E as ENVIRONMENTS, O as nodeFiles, _ as loadRelease, a as releaseToPreview, b as initRelease, c as promote, d as pickScope, f as openReleasePr, g as findConfig, h as docsFor, i as setup, l as shipTo, m as newAdapter, n as systemShell, o as missingTags, p as prepareRelease, r as liveLine, s as tagRelease, t as readStatus, u as planShips, v as addUnit, w as environmentLabel, x as doctor, y as removeUnit } from "./readStatus-Dd_pBt-6.js";
4
4
  import { n as resolveDisplay, t as progressBar } from "./display-IqkJ6uCw.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { z } from "zod";
@@ -383,7 +383,7 @@ const NEXT = {
383
383
  ship: "tag what was versioned and ship it: shiplane"
384
384
  };
385
385
  /** The next step as a person reads it; a ship with nothing pending anywhere is nothing to do. */
386
- const nextLabel = ({ next, units, untagged }) => next.step === "ship" && untagged.length === 0 && !units.some(({ pending }) => pending) ? "nothing to release: queue a change with pnpm changeset" : NEXT[next.step] ?? "";
386
+ const nextLabel = ({ next, units, untagged }, nextChange) => next.step === "ship" && untagged.length === 0 && !units.some(({ pending }) => pending) ? `nothing to release: queue a change with ${nextChange}` : NEXT[next.step] ?? "";
387
387
  /** `shiplane status`: where every unit stands on an environment, and what to run next. Reads only. */
388
388
  const statusCommand = async (context, { environment, json }) => {
389
389
  const status = await readStatus(context, environment);
@@ -393,7 +393,8 @@ const statusCommand = async (context, { environment, json }) => {
393
393
  }
394
394
  const dot = paint("dim", "·");
395
395
  out();
396
- out(` ${paint("bold", "Release status")} ${dot} ${environment}`);
396
+ const label = environmentLabel(context, [], environment);
397
+ out(` ${paint("bold", "Release status")} ${dot} ${label}`);
397
398
  out();
398
399
  const width = Math.max(8, ...status.units.map(({ unit }) => unit.length)) + 2;
399
400
  out(paint("dim", ` ${"Unit".padEnd(width)}${"Version".padEnd(12)}${"Target".padEnd(18)}Where it stands`));
@@ -404,7 +405,7 @@ const statusCommand = async (context, { environment, json }) => {
404
405
  status.releasePrs.forEach(({ url }) => out(`\n ${paint("cyan", "Release PR")} ${url}`));
405
406
  if (status.untagged.length > 0) out(` ${paint("yellow", "Untagged")} ${status.untagged.map(({ tag }) => tag).join(", ")}`);
406
407
  out();
407
- out(`${paint(["bold", "green"], "→ Next:")} ${nextLabel(status)}`);
408
+ out(`${paint(["bold", "green"], "→ Next:")} ${nextLabel(status, context.services.versioning.nextChange)}`);
408
409
  out();
409
410
  };
410
411
  //#endregion
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":["sleep"],"sources":["../src/adapters/terminal/terminal-progress.adapter.ts","../src/adapters/terminal/terminal.adapter.ts","../src/cli/plugins.ts","../src/cli/compose.ts","../src/cli/findRoot.ts","../src/cli/output.ts","../src/cli/pluginsCommand.ts","../src/cli/statusCommand.ts","../src/cli/main.ts","../src/cli.ts"],"sourcesContent":["import { styleText } from \"node:util\";\n\nimport type { Display, MascotDrawing, MascotMoment, Mood } from \"../../domain/display\";\nimport type { Progress, StepPlace } from \"../../ports/terminal.port\";\nimport { progressBar } from \"../../domain/display\";\nimport { liveLine } from \"./live-line\";\n\n/**\n * The mascot in colour: red when worried, green when happy. The hedgehog is coloured part by part,\n * spines, face, then what he holds; any other mascot as a whole.\n */\nexport const paintMascot = (mascot: MascotDrawing, moment: MascotMoment) => {\n const { mood } = moment;\n const text = mascot.draw(moment);\n if (mood === \"worried\") return styleText(\"red\", text);\n if (!mascot.hedgehog) return mood === \"happy\" ? styleText(\"green\", text) : text;\n const frame = [...text];\n const face = frame.slice(5, 10).join(\"\");\n return `${styleText(\"yellow\", frame.slice(0, 5).join(\"\"))}${styleText(mood === \"happy\" ? [\"bold\", \"green\"] : \"bold\", face)}${styleText(\"cyan\", frame.slice(10).join(\"\"))}`;\n};\n\nconst elapsed = (since: number) => {\n const seconds = Math.round((Date.now() - since) / 1000);\n return seconds < 60\n ? `${seconds}s`\n : `${Math.floor(seconds / 60)}m ${String(seconds % 60).padStart(2, \"0\")}s`;\n};\n\n/** Cuts `text` to what the terminal shows on one line, so redrawing it in place stays clean. */\nconst fit = (text: string, taken: number) => {\n const room = Math.max(20, (process.stdout.columns || 100) - taken);\n return text.length > room ? `${text.slice(0, room - 1)}…` : text;\n};\n\nconst counterOf = (step?: StepPlace) => (step ? `${step.index + 1}/${step.total} ` : \"\");\n\n/**\n * Progress in a terminal. Verbose: the journey bar, what it reads, each step redrawn in place with\n * its time, the mascot beside it. Not verbose: only each step's name, as before. A CI log or a pipe\n * gets plain lines, never a redraw.\n */\nexport const terminalProgress = (display: Display, inPlace: boolean): Progress => {\n const mascot = (mood: Mood, tick: number, label = \"\") =>\n display.mascot\n ? `${paintMascot(display.mascot, { mood, tick: display.motion ? tick : 0, label })} `\n : \"\";\n const taken = (step?: StepPlace) =>\n 2 + (display.mascot ? display.mascot.width + 1 : 0) + counterOf(step).length + 8;\n\n const during = async <T>(\n label: string,\n mood: Mood,\n work: () => Promise<T>,\n step?: StepPlace,\n ): Promise<T> => {\n const counter = styleText(\"dim\", counterOf(step));\n if (!display.verbose) {\n if (step) {\n liveLine.above(\"\");\n liveLine.above(styleText([\"bold\", \"cyan\"], `▶ ${label}`));\n }\n return work();\n }\n const text = fit(label, taken(step));\n if (!inPlace || liveLine.busy) {\n liveLine.above(` ${mascot(mood, 0, label)}${counter}${text}`);\n return work();\n }\n const started = Date.now();\n const time = () => styleText(\"dim\", elapsed(started));\n const drawing = display.mascot;\n liveLine.show(\n {\n ...(drawing\n ? {\n frames: Array.from({ length: display.motion ? drawing.frames(mood) : 1 }, (_, tick) =>\n paintMascot(drawing, { mood, tick, label }),\n ),\n }\n : {}),\n text: `${counter}${text}`,\n suffix: time,\n },\n true,\n );\n try {\n const result = await work();\n liveLine.finish(` ${styleText(\"green\", \"✓\")}`, `${counter}${text} ${time()}`);\n return result;\n } catch (error) {\n liveLine.finish(` ${styleText(\"red\", \"✗\")}`, `${counter}${text} ${time()}`);\n throw error;\n }\n };\n\n return {\n stage: (stages, index) => {\n if (!display.verbose) return;\n const bar = styleText(\"green\", progressBar(index + 1, stages.length, 18));\n liveLine.above(\"\");\n liveLine.above(\n ` ${bar} ${styleText(\"dim\", `${index + 1}/${stages.length}`)} ${styleText(\"bold\", stages[index] ?? \"\")}`,\n );\n },\n during,\n say: (mood, text) =>\n liveLine.above(display.mascot ? ` ${mascot(mood, 0, text)}${text}` : text),\n };\n};\n","import { emitKeypressEvents } from \"node:readline\";\nimport { createInterface } from \"node:readline/promises\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\nimport { styleText } from \"node:util\";\nimport type { Option } from \"@clack/prompts\";\nimport { confirm, isCancel, multiselect, select, text } from \"@clack/prompts\";\n\nimport type { Display } from \"../../domain/display\";\nimport type { Choice, Clock, Output, Prompter } from \"../../ports/terminal.port\";\nimport { liveLine } from \"./live-line\";\nimport { paintMascot } from \"./terminal-progress.adapter\";\n\nexport const terminalOutput: Output = {\n line: (line = \"\") => liveLine.above(line),\n};\n\n/** Whether this process runs inside a GitHub Actions job. */\n\nexport const onGitHubActions = () => process.env.GITHUB_ACTIONS === \"true\";\n\nexport const systemClock: Clock = {\n now: () => new Date(),\n sleep: async (ms) => {\n await sleep(ms);\n },\n};\n\nconst FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\n/** A spinner, or the mascot waiting, on one line until a listed key is pressed or `ms` pass. Ctrl-C ends the process. */\nconst waitForKey = (display: Display, label: string, ms: number, keys: readonly string[]) =>\n new Promise<string | null>((resolve) => {\n const startedAt = Date.now();\n let frame = 0;\n const draw = () => {\n const seconds = Math.round((Date.now() - startedAt) / 1000);\n const tick = frame++;\n const glyph = display.mascot\n ? paintMascot(display.mascot, {\n mood: \"waiting\",\n tick: display.motion ? Math.floor(tick / 5) : 0,\n label,\n })\n : styleText(\"cyan\", FRAMES[tick % FRAMES.length] ?? \"\");\n process.stdout.write(`\\r ${glyph} ${label} ${styleText(\"dim\", `${seconds}s`)}`);\n };\n const timer = setInterval(draw, 80);\n const finish = (key: string | null) => {\n clearInterval(timer);\n clearTimeout(timeout);\n process.stdin.off(\"keypress\", onKey);\n process.stdin.setRawMode(false);\n process.stdin.pause();\n process.stdout.write(\"\\r\\u001B[2K\");\n resolve(key);\n };\n const onKey = (_text: string, key: { name?: string; ctrl?: boolean } | undefined) => {\n if (key?.ctrl && key.name === \"c\") {\n finish(null);\n process.stdout.write(\n `${styleText(\"dim\", \" Stopped waiting. release picks up right here.\")}\\n`,\n );\n process.exit(130);\n }\n if (key?.name && keys.includes(key.name)) finish(key.name);\n };\n const timeout = setTimeout(() => finish(null), ms);\n emitKeypressEvents(process.stdin);\n process.stdin.setRawMode(true);\n process.stdin.resume();\n process.stdin.on(\"keypress\", onKey);\n });\n\n// clack types an option per primitive value; a Choice has the same fields.\nconst asOptions = <Value extends string>(choices: Choice<Value>[]) =>\n choices as unknown as Option<Value>[];\n\nconst orNull = <Value>(answer: Value | symbol): Value | null => (isCancel(answer) ? null : answer);\n\nconst NO_MASCOT: Display = { verbose: false, mascot: null, motion: false };\n\n/** Questions through @clack/prompts, each owning the terminal; without one, every answer is no. */\nexport const terminalPrompter = (display: Display = NO_MASCOT): Prompter => {\n const interactive = Boolean(process.stdin.isTTY);\n const hold = <T>(work: () => Promise<T>) => liveLine.hold(work);\n return {\n interactive,\n confirm: (question, initial = false) =>\n hold(\n async () =>\n interactive &&\n orNull(await confirm({ message: question, initialValue: initial })) === true,\n ),\n typed: (question, word) =>\n hold(async () => {\n if (!interactive) return false;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await prompt.question(`${styleText(\"bold\", question)} `);\n prompt.close();\n return answer.trim() === word;\n }),\n select: (message, choices, initial) =>\n hold(async () =>\n interactive\n ? orNull(await select({ message, options: asOptions(choices), initialValue: initial }))\n : null,\n ),\n multiselect: (message, choices, initial) =>\n hold(async () =>\n interactive\n ? orNull(\n await multiselect({\n message,\n options: asOptions(choices),\n initialValues: initial,\n required: false,\n }),\n )\n : null,\n ),\n text: (message, initial) =>\n hold(async () =>\n interactive ? orNull(await text({ message, initialValue: initial })) : null,\n ),\n waitForKey: (label, ms, keys) =>\n hold(async () => {\n if (interactive) return waitForKey(display, label, ms, keys);\n await sleep(ms);\n return null;\n }),\n };\n};\n","import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { AnyDeliveryAdapter } from \"../modules/suggest\";\nimport { shellServerHosting } from \"../adapters/server-hosting/shell-server-hosting.adapter\";\n\n/** A plugin's own word on what init may offer: `\"shiplane\": { \"adapters\": [\"flyServerHosting\"] }`. */\ninterface PluginManifest {\n shiplane?: { adapters?: string[] };\n}\n\nconst readJson = (file: string): unknown => JSON.parse(fs.readFileSync(file, \"utf8\"));\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\n/**\n * The delivery adapters init can offer: the built-in shell adapter, then each one a plugin this\n * repository depends on names in its package.json. A plugin that does not load is skipped.\n */\nexport const installedAdapters = async (root: string): Promise<AnyDeliveryAdapter[]> => {\n const manifestFile = path.join(root, \"package.json\");\n if (!fs.existsSync(manifestFile)) return [shellServerHosting()];\n const manifest = readJson(manifestFile) as Record<string, Record<string, string> | undefined>;\n const names = Object.keys({ ...manifest.dependencies, ...manifest.devDependencies });\n const require = createRequire(manifestFile);\n const found = await Promise.all(\n names.map(async (name): Promise<AnyDeliveryAdapter[]> => {\n try {\n const own = readJson(require.resolve(`${name}/package.json`)) as PluginManifest;\n const factories = own.shiplane?.adapters ?? [];\n if (factories.length === 0) return [];\n const loaded: unknown = await import(pathToFileURL(require.resolve(name)).href);\n if (!isRecord(loaded)) return [];\n return factories.flatMap((factory) => {\n const make = loaded[factory];\n return typeof make === \"function\" ? [make() as AnyDeliveryAdapter] : [];\n });\n } catch {\n return [];\n }\n }),\n );\n return [...found.flat(), shellServerHosting()];\n};\n","import type { Release } from \"../application/config/loadRelease\";\nimport type { ReleaseContext, Services } from \"../application/context\";\nimport type { SetupContext } from \"../application/setupContext\";\nimport type { DisplayChoice } from \"../domain/display\";\nimport type { Open } from \"../modules/module\";\nimport type { Shell } from \"../ports/shell.port\";\nimport type { Output, Progress, Prompter } from \"../ports/terminal.port\";\nimport { nodeFiles } from \"../adapters/files/node-files.adapter\";\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\nimport { terminalProgress } from \"../adapters/terminal/terminal-progress.adapter\";\nimport {\n onGitHubActions,\n systemClock,\n terminalOutput,\n terminalPrompter,\n} from \"../adapters/terminal/terminal.adapter\";\nimport { loadRelease } from \"../application/config/loadRelease\";\nimport { resolveDisplay } from \"../domain/display\";\nimport { installedAdapters } from \"./plugins\";\n\n/** Creates each port the flow runs on, for this repository. */\nexport const composeServices = (release: Release, open: Open): Services => ({\n sourceControl: open(release.flow.sourceControl),\n codeHost: open(release.flow.codeHost),\n ciPipeline: open(release.flow.ciPipeline),\n versioning: open(release.flow.versioning),\n});\n\n/** Ports created on demand, in this repository, through this shell. */\nexport const opener =\n (root: string, shell: Shell): Open =>\n (adapter) =>\n adapter.create({ root, shell });\n\n/** What a run may take instead of this machine's: a scripted person, a recorded terminal or shell. */\nexport interface ContextIo {\n prompter?: Prompter;\n output?: Output;\n progress?: Progress;\n shell?: Shell;\n /** Where `shiplane` resolves from inside the config. */\n aliases?: Record<string, string>;\n /** What setup runs on instead of this machine's: files, adapters, the release loader. */\n setup?: Partial<SetupContext>;\n}\n\n/** A context wired to this machine: its shell, its terminal, its clock, unless `io` says otherwise. */\nexport const composeContext = (\n release: Release,\n { yes, display: flags }: { yes: boolean; display: DisplayChoice },\n io: ContextIo = {},\n): ReleaseContext => {\n const ci = onGitHubActions() || systemShell.env(\"CI\") === \"true\";\n const tty = Boolean(process.stdout.isTTY);\n const display = resolveDisplay(release.display ?? {}, flags, {\n tty,\n ci,\n noMotion: Boolean(systemShell.env(\"NO_MOTION\")),\n });\n const shell = io.shell ?? systemShell;\n const output = io.output ?? terminalOutput;\n const open = opener(release.root, shell);\n return {\n release,\n load: () => loadRelease(release.root, { aliases: io.aliases }),\n services: composeServices(release, open),\n open,\n prompter: io.prompter ?? terminalPrompter(display),\n output,\n progress: io.progress ?? terminalProgress(display, tty && !ci),\n clock: systemClock,\n shell,\n options: { yes, ci: onGitHubActions() },\n };\n};\n\n/** What init, add, doctor and the rest need: the repository on disk and the adapters installed. */\nexport const composeSetup = async (\n root: string,\n io: Partial<SetupContext> = {},\n): Promise<SetupContext> => {\n const ci = onGitHubActions() || systemShell.env(\"CI\") === \"true\";\n const tty = Boolean(process.stdout.isTTY);\n const display = resolveDisplay(\n {},\n { mascot: false },\n {\n tty,\n ci,\n noMotion: Boolean(systemShell.env(\"NO_MOTION\")),\n },\n );\n return {\n root,\n files: nodeFiles(root),\n shell: systemShell,\n prompter: terminalPrompter(),\n output: terminalOutput,\n adapters: io.adapters ?? (await installedAdapters(root)),\n load: () => loadRelease(root),\n progress: terminalProgress(display, tty && !ci),\n compose: (release) => composeContext(release, { yes: true, display: { mascot: false } }),\n ...io,\n };\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findConfig } from \"../application/config/loadRelease\";\n\n/** The nearest folder up from here with a release config, else the git root, else here. */\nexport const findRoot = (from: string): string => {\n const ancestors = (dir: string): string[] => {\n const parent = path.dirname(dir);\n return parent === dir ? [dir] : [dir, ...ancestors(parent)];\n };\n const chain = ancestors(path.resolve(from));\n return (\n chain.find((dir) => findConfig(dir)) ??\n chain.find((dir) => fs.existsSync(path.join(dir, \".git\"))) ??\n path.resolve(from)\n );\n};\n","import { styleText } from \"node:util\";\n\nimport type { ConfigProblem } from \"../application/config/problem\";\n\ntype Style = Parameters<typeof styleText>[0];\n\nexport const paint = (style: Style, text: string) => styleText(style, text);\n\nexport const out = (line = \"\") => process.stdout.write(`${line}\\n`);\n\n/** Problems as `file:line message`, each hint on the line below. */\nexport const printProblems = (problems: readonly ConfigProblem[]) => {\n problems.forEach(({ file, line, message, hint }) => {\n const where = line === undefined ? file : `${file}:${line}`;\n out(`${paint(\"red\", \"✗\")} ${paint(\"bold\", where)} ${message}`);\n if (hint) out(` ${paint(\"dim\", hint)}`);\n });\n};\n","import type { Release } from \"../application/config/loadRelease\";\nimport { keysAt } from \"../application/config/unitSchema\";\nimport { out, paint } from \"./output\";\n\n/** `shiplane plugins`: the flow's adapters, the modules in release order with their apps, the features. */\nexport const pluginsCommand = (release: Release, { json }: { json: boolean }) => {\n const { flow } = release;\n const ports = {\n sourceControl: flow.sourceControl.name,\n codeHost: flow.codeHost.name,\n ciPipeline: flow.ciPipeline.name,\n versioning: flow.versioning.name,\n };\n const modules = release.modules.map(({ name, kind, provider, settings }) => ({\n name,\n kind,\n provider,\n keys: keysAt(settings, []),\n apps: release.units.filter(({ module }) => module === name).map(({ name: app }) => app),\n }));\n const features = release.features.map(({ name, adapters }) => ({\n name,\n uses: adapters.map((adapter) => adapter.name),\n }));\n if (json) {\n out(JSON.stringify({ flow: ports, modules, features }, null, 2));\n return;\n }\n const width =\n Math.max(\n 14,\n ...modules.map(({ name }) => name.length),\n ...features.map(({ name }) => name.length),\n ) + 2;\n const section = (title: string) => {\n out();\n out(paint(\"bold\", title));\n out();\n };\n section(\"Flow in shiplane.config.ts\");\n Object.entries(ports).forEach(([port, name]) => out(` ${port.padEnd(width)}${name}`));\n section(\"Modules, in release order\");\n modules.forEach(({ name, provider, keys, apps }) => {\n const used = apps.length > 0 ? `used by ${apps.join(\", \")}` : paint(\"dim\", \"no app names it\");\n out(` ${name.padEnd(width)}${provider} ${paint(\"dim\", keys.join(\", \") || \"no options\")}`);\n out(` ${\" \".repeat(width)}${used}`);\n });\n section(\"Features, after the ship\");\n if (features.length === 0) out(` ${paint(\"dim\", \"none\")}`);\n features.forEach(({ name, uses }) =>\n out(` ${name.padEnd(width)}${paint(\"dim\", `uses ${uses.join(\", \")}`)}`),\n );\n out();\n};\n","import type { ReleaseContext } from \"../application/context\";\nimport type { Environment } from \"../domain/environment\";\nimport { readStatus } from \"../application/readStatus\";\nimport { out, paint } from \"./output\";\n\nconst NEXT: Record<string, string> = {\n \"release-pr\": \"open the release PR: shiplane\",\n \"wait-merge\": \"merge the release PR, then: shiplane\",\n ship: \"tag what was versioned and ship it: shiplane\",\n};\n\n/** The next step as a person reads it; a ship with nothing pending anywhere is nothing to do. */\nexport const nextLabel = ({\n next,\n units,\n untagged,\n}: {\n next: { step: string };\n units: readonly { pending: boolean }[];\n untagged: readonly unknown[];\n}) =>\n next.step === \"ship\" && untagged.length === 0 && !units.some(({ pending }) => pending)\n ? \"nothing to release: queue a change with pnpm changeset\"\n : (NEXT[next.step] ?? \"\");\n\n/** `shiplane status`: where every unit stands on an environment, and what to run next. Reads only. */\nexport const statusCommand = async (\n context: ReleaseContext,\n { environment, json }: { environment: Environment; json: boolean },\n) => {\n const status = await readStatus(context, environment);\n if (json) {\n out(JSON.stringify(status, null, 2));\n return;\n }\n const dot = paint(\"dim\", \"·\");\n out();\n out(` ${paint(\"bold\", \"Release status\")} ${dot} ${environment}`);\n out();\n const width = Math.max(8, ...status.units.map(({ unit }) => unit.length)) + 2;\n out(\n paint(\n \"dim\",\n ` ${\"Unit\".padEnd(width)}${\"Version\".padEnd(12)}${\"Target\".padEnd(18)}Where it stands`,\n ),\n );\n status.units.forEach(({ unit, version, target, pending, hint }) => {\n const mark = pending ? paint(\"yellow\", \"↑\") : paint(\"dim\", \"·\");\n out(` ${unit.padEnd(width)}${version.padEnd(12)}${target.padEnd(18)}${mark} ${hint}`);\n });\n status.releasePrs.forEach(({ url }) => out(`\\n ${paint(\"cyan\", \"Release PR\")} ${url}`));\n if (status.untagged.length > 0) {\n out(` ${paint(\"yellow\", \"Untagged\")} ${status.untagged.map(({ tag }) => tag).join(\", \")}`);\n }\n out();\n out(`${paint([\"bold\", \"green\"], \"→ Next:\")} ${nextLabel(status)}`);\n out();\n};\n","import { parseArgs } from \"node:util\";\nimport { z } from \"zod\";\n\nimport type { ReleaseContext } from \"../application/context\";\nimport type { ContextIo } from \"./compose\";\nimport { nodeFiles } from \"../adapters/files/node-files.adapter\";\nimport { addUnit, removeUnit } from \"../application/addUnit\";\nimport { loadRelease } from \"../application/config/loadRelease\";\nimport { docsFor } from \"../application/docsFor\";\nimport { doctor } from \"../application/doctor\";\nimport { initRelease } from \"../application/initRelease\";\nimport { newAdapter } from \"../application/newAdapter\";\nimport { openReleasePr } from \"../application/openReleasePr\";\nimport { pickScope } from \"../application/pickScope\";\nimport { planShips } from \"../application/planShips\";\nimport { prepareRelease } from \"../application/prepareRelease\";\nimport { promote } from \"../application/promote\";\nimport { releaseToPreview } from \"../application/releaseToPreview\";\nimport { setup } from \"../application/setup\";\nimport { CONFIG_FILE, refreshEditorSchema } from \"../application/setupFiles\";\nimport { shipTo } from \"../application/ship\";\nimport { missingTags, tagRelease } from \"../application/tagRelease\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { composeContext, composeSetup } from \"./compose\";\nimport { findRoot } from \"./findRoot\";\nimport { out, paint, printProblems } from \"./output\";\nimport { pluginsCommand } from \"./pluginsCommand\";\nimport { statusCommand } from \"./statusCommand\";\n\nconst HELP = `${paint(\"bold\", \"shiplane\")}: detect what changed, version it, trigger each app's deploy.\n\n shiplane the next step to preview: release PR, merge, tags, ship\n shiplane promote production, from what preview runs (--channel production too)\n shiplane status [--json] where every unit stands, and what to run next\n shiplane version open the release PR for what is pending\n shiplane tag tag merged versions and publish their release notes\n shiplane ship [unit...] trigger each tagged unit's deploy, then return\n shiplane plan every command a ship would run, run nothing\n shiplane plugins [--json] the flow, the modules in release order and who uses each, the features\n\n shiplane setup [--yes] set up or check releases: asks only what it can't tell, rehearses, then writes\n shiplane init [--yes|--blank] the older setup: a unit file per app, then doctor\n shiplane add <folder> init's questions for one folder\n shiplane remove <unit> stop shipping a unit; it stays versioned\n shiplane doctor check the config, tools and sign-ins, offer each fix\n shiplane adapter new <name> scaffold a server hosting adapter, its contract test and its module\n shiplane docs <name> every key a module's or an adapter's unit files take\n shiplane help this\n\n --channel preview|production where status reads (preview by default)\n --via github|local ship through GitHub Actions or this machine, without asking\n --yes answer yes to every question (never on production)\n --verbose / --no-verbose say each thing it reads and runs, with a progress bar (on by default)\n --mascot / --no-mascot the mascot beside it, still in CI or under NO_MOTION=1 (on by default)\n Both defaults live in shiplane.config.ts: display: { verbose, mascot }\n`;\n\n/** The CLI as a person runs it, from its arguments and folder; resolves to its exit code. */\nexport const runCli = async (argv: string[], cwd: string, io: ContextIo = {}): Promise<number> => {\n const { values, positionals } = parseArgs({\n args: argv,\n allowPositionals: true,\n allowNegative: true,\n options: {\n verbose: { type: \"boolean\" },\n mascot: { type: \"boolean\" },\n json: { type: \"boolean\", default: false },\n yes: { type: \"boolean\", short: \"y\", default: false },\n channel: { type: \"string\", default: \"preview\" },\n via: { type: \"string\" },\n blank: { type: \"boolean\", default: false },\n },\n });\n\n const [command = \"next\", ...units] = positionals;\n const environment = z.enum(ENVIRONMENTS).parse(values.channel);\n const via = values.via === undefined ? undefined : z.enum([\"github\", \"local\"]).parse(values.via);\n\n const commands: Record<string, (context: ReleaseContext) => Promise<boolean | void>> = {\n next: (context) =>\n environment === \"preview\" ? releaseToPreview(context) : promote(context, via),\n promote: (context) => promote(context, via),\n status: (context) => statusCommand(context, { environment, json: values.json }),\n version: async (context) => {\n const picked = await pickScope(context, \"preview\");\n if (!picked || picked.scope.size === 0) return true;\n return (await openReleasePr(context, await prepareRelease(context, picked.scope))) !== null;\n },\n tag: async (context) => tagRelease(context, await missingTags(context)),\n ship: (context) =>\n shipTo(context, environment, { via, ...(units.length > 0 ? { scope: new Set(units) } : {}) }),\n plan: (context) => planShips(context, environment),\n plugins: (context) => Promise.resolve(pluginsCommand(context.release, { json: values.json })),\n };\n\n const [first = \"\"] = units;\n const setupCommands: Record<\n string,\n (context: Awaited<ReturnType<typeof composeSetup>>) => Promise<boolean>\n > = {\n setup: (context) => setup(context, { yes: values.yes }),\n init: (context) => {\n if (values.blank) return initRelease(context, { yes: values.yes, blank: true });\n out(paint(\"dim\", \"init is now shiplane setup\"));\n return setup(context, { yes: values.yes });\n },\n add: (context) => addUnit(context, first),\n remove: (context) => removeUnit(context, first),\n doctor: (context) => doctor(context),\n adapter: (context) => {\n if (first === \"new\" && units[1]) return newAdapter(context, units[1]);\n out(`${paint(\"red\", \"✗\")} shiplane adapter new <name>`);\n return Promise.resolve(false);\n },\n docs: (context) => docsFor(context, first),\n };\n\n const root = findRoot(cwd);\n const files = io.setup?.files ?? nodeFiles(root);\n const firstRun = command === \"next\" && !files.exists(CONFIG_FILE);\n const run = commands[command];\n const setUp = setupCommands[firstRun ? \"setup\" : command];\n if (setUp) return (await setUp(await composeSetup(root, io.setup))) ? 0 : 1;\n if (command === \"help\") {\n out(HELP);\n return 0;\n }\n if (!run) {\n out(`${paint(\"red\", \"✗\")} no command \"${command}\"`);\n out(HELP);\n return 1;\n }\n const release = await loadRelease(root, { aliases: io.aliases });\n if (release.problems.length > 0) {\n printProblems(release.problems);\n return 2;\n }\n (release.renames ?? []).forEach(({ from, to }) =>\n out(`${paint(\"yellow\", \"!\")} rename ${from} to ${to}: the old name still works for now`),\n );\n refreshEditorSchema(nodeFiles(release.root), release);\n const context = composeContext(\n release,\n { yes: values.yes, display: { verbose: values.verbose, mascot: values.mascot } },\n io,\n );\n return (await run(context)) === false ? 1 : 0;\n};\n","#!/usr/bin/env node\nimport { runCli } from \"./cli/main\";\n\nprocess.exitCode = await runCli(process.argv.slice(2), process.cwd());\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,MAAa,eAAe,QAAuB,WAAyB;CAC1E,MAAM,EAAE,SAAS;CACjB,MAAM,OAAO,OAAO,KAAK,OAAO;AAChC,KAAI,SAAS,UAAW,QAAO,UAAU,OAAO,KAAK;AACrD,KAAI,CAAC,OAAO,SAAU,QAAO,SAAS,UAAU,UAAU,SAAS,KAAK,GAAG;CAC3E,MAAM,QAAQ,CAAC,GAAG,KAAK;CACvB,MAAM,OAAO,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG;AACxC,QAAO,GAAG,UAAU,UAAU,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,GAAG,UAAU,SAAS,UAAU,CAAC,QAAQ,QAAQ,GAAG,QAAQ,KAAK,GAAG,UAAU,QAAQ,MAAM,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC;;AAG1K,MAAM,WAAW,UAAkB;CACjC,MAAM,UAAU,KAAK,OAAO,KAAK,KAAK,GAAG,SAAS,IAAK;AACvD,QAAO,UAAU,KACb,GAAG,QAAQ,KACX,GAAG,KAAK,MAAM,UAAU,GAAG,CAAC,IAAI,OAAO,UAAU,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;;;AAI5E,MAAM,OAAO,MAAc,UAAkB;CAC3C,MAAM,OAAO,KAAK,IAAI,KAAK,QAAQ,OAAO,WAAW,OAAO,MAAM;AAClE,QAAO,KAAK,SAAS,OAAO,GAAG,KAAK,MAAM,GAAG,OAAO,EAAE,CAAC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AAQ,OAAO;GAAQ;EAAE,EAChF,GAEuB,CAAC,KAAM,QAAQ,IAAI;;;;AC/I9C,QAAQ,WAAW,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE,EAAE,QAAQ,KAAK,CAAC"}
1
+ {"version":3,"file":"cli.js","names":["sleep"],"sources":["../src/adapters/terminal/terminal-progress.adapter.ts","../src/adapters/terminal/terminal.adapter.ts","../src/cli/plugins.ts","../src/cli/compose.ts","../src/cli/findRoot.ts","../src/cli/output.ts","../src/cli/pluginsCommand.ts","../src/cli/statusCommand.ts","../src/cli/main.ts","../src/cli.ts"],"sourcesContent":["import { styleText } from \"node:util\";\n\nimport type { Display, MascotDrawing, MascotMoment, Mood } from \"../../domain/display\";\nimport type { Progress, StepPlace } from \"../../ports/terminal.port\";\nimport { progressBar } from \"../../domain/display\";\nimport { liveLine } from \"./live-line\";\n\n/**\n * The mascot in colour: red when worried, green when happy. The hedgehog is coloured part by part,\n * spines, face, then what he holds; any other mascot as a whole.\n */\nexport const paintMascot = (mascot: MascotDrawing, moment: MascotMoment) => {\n const { mood } = moment;\n const text = mascot.draw(moment);\n if (mood === \"worried\") return styleText(\"red\", text);\n if (!mascot.hedgehog) return mood === \"happy\" ? styleText(\"green\", text) : text;\n const frame = [...text];\n const face = frame.slice(5, 10).join(\"\");\n return `${styleText(\"yellow\", frame.slice(0, 5).join(\"\"))}${styleText(mood === \"happy\" ? [\"bold\", \"green\"] : \"bold\", face)}${styleText(\"cyan\", frame.slice(10).join(\"\"))}`;\n};\n\nconst elapsed = (since: number) => {\n const seconds = Math.round((Date.now() - since) / 1000);\n return seconds < 60\n ? `${seconds}s`\n : `${Math.floor(seconds / 60)}m ${String(seconds % 60).padStart(2, \"0\")}s`;\n};\n\n/** Cuts `text` to what the terminal shows on one line, so redrawing it in place stays clean. */\nconst fit = (text: string, taken: number) => {\n const room = Math.max(20, (process.stdout.columns || 100) - taken);\n return text.length > room ? `${text.slice(0, room - 1)}…` : text;\n};\n\nconst counterOf = (step?: StepPlace) => (step ? `${step.index + 1}/${step.total} ` : \"\");\n\n/**\n * Progress in a terminal. Verbose: the journey bar, what it reads, each step redrawn in place with\n * its time, the mascot beside it. Not verbose: only each step's name, as before. A CI log or a pipe\n * gets plain lines, never a redraw.\n */\nexport const terminalProgress = (display: Display, inPlace: boolean): Progress => {\n const mascot = (mood: Mood, tick: number, label = \"\") =>\n display.mascot\n ? `${paintMascot(display.mascot, { mood, tick: display.motion ? tick : 0, label })} `\n : \"\";\n const taken = (step?: StepPlace) =>\n 2 + (display.mascot ? display.mascot.width + 1 : 0) + counterOf(step).length + 8;\n\n const during = async <T>(\n label: string,\n mood: Mood,\n work: () => Promise<T>,\n step?: StepPlace,\n ): Promise<T> => {\n const counter = styleText(\"dim\", counterOf(step));\n if (!display.verbose) {\n if (step) {\n liveLine.above(\"\");\n liveLine.above(styleText([\"bold\", \"cyan\"], `▶ ${label}`));\n }\n return work();\n }\n const text = fit(label, taken(step));\n if (!inPlace || liveLine.busy) {\n liveLine.above(` ${mascot(mood, 0, label)}${counter}${text}`);\n return work();\n }\n const started = Date.now();\n const time = () => styleText(\"dim\", elapsed(started));\n const drawing = display.mascot;\n liveLine.show(\n {\n ...(drawing\n ? {\n frames: Array.from({ length: display.motion ? drawing.frames(mood) : 1 }, (_, tick) =>\n paintMascot(drawing, { mood, tick, label }),\n ),\n }\n : {}),\n text: `${counter}${text}`,\n suffix: time,\n },\n true,\n );\n try {\n const result = await work();\n liveLine.finish(` ${styleText(\"green\", \"✓\")}`, `${counter}${text} ${time()}`);\n return result;\n } catch (error) {\n liveLine.finish(` ${styleText(\"red\", \"✗\")}`, `${counter}${text} ${time()}`);\n throw error;\n }\n };\n\n return {\n stage: (stages, index) => {\n if (!display.verbose) return;\n const bar = styleText(\"green\", progressBar(index + 1, stages.length, 18));\n liveLine.above(\"\");\n liveLine.above(\n ` ${bar} ${styleText(\"dim\", `${index + 1}/${stages.length}`)} ${styleText(\"bold\", stages[index] ?? \"\")}`,\n );\n },\n during,\n say: (mood, text) =>\n liveLine.above(display.mascot ? ` ${mascot(mood, 0, text)}${text}` : text),\n };\n};\n","import { emitKeypressEvents } from \"node:readline\";\nimport { createInterface } from \"node:readline/promises\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\nimport { styleText } from \"node:util\";\nimport type { Option } from \"@clack/prompts\";\nimport { confirm, isCancel, multiselect, select, text } from \"@clack/prompts\";\n\nimport type { Display } from \"../../domain/display\";\nimport type { Choice, Clock, Output, Prompter } from \"../../ports/terminal.port\";\nimport { liveLine } from \"./live-line\";\nimport { paintMascot } from \"./terminal-progress.adapter\";\n\nexport const terminalOutput: Output = {\n line: (line = \"\") => liveLine.above(line),\n};\n\n/** Whether this process runs inside a GitHub Actions job. */\n\nexport const onGitHubActions = () => process.env.GITHUB_ACTIONS === \"true\";\n\nexport const systemClock: Clock = {\n now: () => new Date(),\n sleep: async (ms) => {\n await sleep(ms);\n },\n};\n\nconst FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\n/** A spinner, or the mascot waiting, on one line until a listed key is pressed or `ms` pass. Ctrl-C ends the process. */\nconst waitForKey = (display: Display, label: string, ms: number, keys: readonly string[]) =>\n new Promise<string | null>((resolve) => {\n const startedAt = Date.now();\n let frame = 0;\n const draw = () => {\n const seconds = Math.round((Date.now() - startedAt) / 1000);\n const tick = frame++;\n const glyph = display.mascot\n ? paintMascot(display.mascot, {\n mood: \"waiting\",\n tick: display.motion ? Math.floor(tick / 5) : 0,\n label,\n })\n : styleText(\"cyan\", FRAMES[tick % FRAMES.length] ?? \"\");\n process.stdout.write(`\\r ${glyph} ${label} ${styleText(\"dim\", `${seconds}s`)}`);\n };\n const timer = setInterval(draw, 80);\n const finish = (key: string | null) => {\n clearInterval(timer);\n clearTimeout(timeout);\n process.stdin.off(\"keypress\", onKey);\n process.stdin.setRawMode(false);\n process.stdin.pause();\n process.stdout.write(\"\\r\\u001B[2K\");\n resolve(key);\n };\n const onKey = (_text: string, key: { name?: string; ctrl?: boolean } | undefined) => {\n if (key?.ctrl && key.name === \"c\") {\n finish(null);\n process.stdout.write(\n `${styleText(\"dim\", \" Stopped waiting. release picks up right here.\")}\\n`,\n );\n process.exit(130);\n }\n if (key?.name && keys.includes(key.name)) finish(key.name);\n };\n const timeout = setTimeout(() => finish(null), ms);\n emitKeypressEvents(process.stdin);\n process.stdin.setRawMode(true);\n process.stdin.resume();\n process.stdin.on(\"keypress\", onKey);\n });\n\n// clack types an option per primitive value; a Choice has the same fields.\nconst asOptions = <Value extends string>(choices: Choice<Value>[]) =>\n choices as unknown as Option<Value>[];\n\nconst orNull = <Value>(answer: Value | symbol): Value | null => (isCancel(answer) ? null : answer);\n\nconst NO_MASCOT: Display = { verbose: false, mascot: null, motion: false };\n\n/** Questions through @clack/prompts, each owning the terminal; without one, every answer is no. */\nexport const terminalPrompter = (display: Display = NO_MASCOT): Prompter => {\n const interactive = Boolean(process.stdin.isTTY);\n const hold = <T>(work: () => Promise<T>) => liveLine.hold(work);\n return {\n interactive,\n confirm: (question, initial = false) =>\n hold(\n async () =>\n interactive &&\n orNull(await confirm({ message: question, initialValue: initial })) === true,\n ),\n typed: (question, word) =>\n hold(async () => {\n if (!interactive) return false;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await prompt.question(`${styleText(\"bold\", question)} `);\n prompt.close();\n return answer.trim() === word;\n }),\n select: (message, choices, initial) =>\n hold(async () =>\n interactive\n ? orNull(await select({ message, options: asOptions(choices), initialValue: initial }))\n : null,\n ),\n multiselect: (message, choices, initial) =>\n hold(async () =>\n interactive\n ? orNull(\n await multiselect({\n message,\n options: asOptions(choices),\n initialValues: initial,\n required: false,\n }),\n )\n : null,\n ),\n text: (message, initial) =>\n hold(async () =>\n interactive ? orNull(await text({ message, initialValue: initial })) : null,\n ),\n waitForKey: (label, ms, keys) =>\n hold(async () => {\n if (interactive) return waitForKey(display, label, ms, keys);\n await sleep(ms);\n return null;\n }),\n };\n};\n","import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { AnyDeliveryAdapter } from \"../modules/suggest\";\nimport { shellServerHosting } from \"../adapters/server-hosting/shell-server-hosting.adapter\";\n\n/** A plugin's own word on what init may offer: `\"shiplane\": { \"adapters\": [\"flyServerHosting\"] }`. */\ninterface PluginManifest {\n shiplane?: { adapters?: string[] };\n}\n\nconst readJson = (file: string): unknown => JSON.parse(fs.readFileSync(file, \"utf8\"));\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\n/**\n * The delivery adapters init can offer: the built-in shell adapter, then each one a plugin this\n * repository depends on names in its package.json. A plugin that does not load is skipped.\n */\nexport const installedAdapters = async (root: string): Promise<AnyDeliveryAdapter[]> => {\n const manifestFile = path.join(root, \"package.json\");\n if (!fs.existsSync(manifestFile)) return [shellServerHosting()];\n const manifest = readJson(manifestFile) as Record<string, Record<string, string> | undefined>;\n const names = Object.keys({ ...manifest.dependencies, ...manifest.devDependencies });\n const require = createRequire(manifestFile);\n const found = await Promise.all(\n names.map(async (name): Promise<AnyDeliveryAdapter[]> => {\n try {\n const own = readJson(require.resolve(`${name}/package.json`)) as PluginManifest;\n const factories = own.shiplane?.adapters ?? [];\n if (factories.length === 0) return [];\n const loaded: unknown = await import(pathToFileURL(require.resolve(name)).href);\n if (!isRecord(loaded)) return [];\n return factories.flatMap((factory) => {\n const make = loaded[factory];\n return typeof make === \"function\" ? [make() as AnyDeliveryAdapter] : [];\n });\n } catch {\n return [];\n }\n }),\n );\n return [...found.flat(), shellServerHosting()];\n};\n","import type { Release } from \"../application/config/loadRelease\";\nimport type { ReleaseContext, Services } from \"../application/context\";\nimport type { SetupContext } from \"../application/setupContext\";\nimport type { DisplayChoice } from \"../domain/display\";\nimport type { Open } from \"../modules/module\";\nimport type { Shell } from \"../ports/shell.port\";\nimport type { Output, Progress, Prompter } from \"../ports/terminal.port\";\nimport { nodeFiles } from \"../adapters/files/node-files.adapter\";\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\nimport { terminalProgress } from \"../adapters/terminal/terminal-progress.adapter\";\nimport {\n onGitHubActions,\n systemClock,\n terminalOutput,\n terminalPrompter,\n} from \"../adapters/terminal/terminal.adapter\";\nimport { loadRelease } from \"../application/config/loadRelease\";\nimport { resolveDisplay } from \"../domain/display\";\nimport { installedAdapters } from \"./plugins\";\n\n/** Creates each port the flow runs on, for this repository. */\nexport const composeServices = (release: Release, open: Open): Services => ({\n sourceControl: open(release.flow.sourceControl),\n codeHost: open(release.flow.codeHost),\n ciPipeline: open(release.flow.ciPipeline),\n versioning: open(release.flow.versioning),\n});\n\n/** Ports created on demand, in this repository, through this shell. */\nexport const opener =\n (root: string, shell: Shell): Open =>\n (adapter) =>\n adapter.create({ root, shell });\n\n/** What a run may take instead of this machine's: a scripted person, a recorded terminal or shell. */\nexport interface ContextIo {\n prompter?: Prompter;\n output?: Output;\n progress?: Progress;\n shell?: Shell;\n /** Where `shiplane` resolves from inside the config. */\n aliases?: Record<string, string>;\n /** What setup runs on instead of this machine's: files, adapters, the release loader. */\n setup?: Partial<SetupContext>;\n}\n\n/** A context wired to this machine: its shell, its terminal, its clock, unless `io` says otherwise. */\nexport const composeContext = (\n release: Release,\n { yes, display: flags }: { yes: boolean; display: DisplayChoice },\n io: ContextIo = {},\n): ReleaseContext => {\n const ci = onGitHubActions() || systemShell.env(\"CI\") === \"true\";\n const tty = Boolean(process.stdout.isTTY);\n const display = resolveDisplay(release.display ?? {}, flags, {\n tty,\n ci,\n noMotion: Boolean(systemShell.env(\"NO_MOTION\")),\n });\n const shell = io.shell ?? systemShell;\n const output = io.output ?? terminalOutput;\n const open = opener(release.root, shell);\n return {\n release,\n load: () => loadRelease(release.root, { aliases: io.aliases }),\n services: composeServices(release, open),\n open,\n prompter: io.prompter ?? terminalPrompter(display),\n output,\n progress: io.progress ?? terminalProgress(display, tty && !ci),\n clock: systemClock,\n shell,\n options: { yes, ci: onGitHubActions() },\n };\n};\n\n/** What init, add, doctor and the rest need: the repository on disk and the adapters installed. */\nexport const composeSetup = async (\n root: string,\n io: Partial<SetupContext> = {},\n): Promise<SetupContext> => {\n const ci = onGitHubActions() || systemShell.env(\"CI\") === \"true\";\n const tty = Boolean(process.stdout.isTTY);\n const display = resolveDisplay(\n {},\n { mascot: false },\n {\n tty,\n ci,\n noMotion: Boolean(systemShell.env(\"NO_MOTION\")),\n },\n );\n return {\n root,\n files: nodeFiles(root),\n shell: systemShell,\n prompter: terminalPrompter(),\n output: terminalOutput,\n adapters: io.adapters ?? (await installedAdapters(root)),\n load: () => loadRelease(root),\n progress: terminalProgress(display, tty && !ci),\n compose: (release) => composeContext(release, { yes: true, display: { mascot: false } }),\n ...io,\n };\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findConfig } from \"../application/config/loadRelease\";\n\n/** The nearest folder up from here with a release config, else the git root, else here. */\nexport const findRoot = (from: string): string => {\n const ancestors = (dir: string): string[] => {\n const parent = path.dirname(dir);\n return parent === dir ? [dir] : [dir, ...ancestors(parent)];\n };\n const chain = ancestors(path.resolve(from));\n return (\n chain.find((dir) => findConfig(dir)) ??\n chain.find((dir) => fs.existsSync(path.join(dir, \".git\"))) ??\n path.resolve(from)\n );\n};\n","import { styleText } from \"node:util\";\n\nimport type { ConfigProblem } from \"../application/config/problem\";\n\ntype Style = Parameters<typeof styleText>[0];\n\nexport const paint = (style: Style, text: string) => styleText(style, text);\n\nexport const out = (line = \"\") => process.stdout.write(`${line}\\n`);\n\n/** Problems as `file:line message`, each hint on the line below. */\nexport const printProblems = (problems: readonly ConfigProblem[]) => {\n problems.forEach(({ file, line, message, hint }) => {\n const where = line === undefined ? file : `${file}:${line}`;\n out(`${paint(\"red\", \"✗\")} ${paint(\"bold\", where)} ${message}`);\n if (hint) out(` ${paint(\"dim\", hint)}`);\n });\n};\n","import type { Release } from \"../application/config/loadRelease\";\nimport { keysAt } from \"../application/config/unitSchema\";\nimport { out, paint } from \"./output\";\n\n/** `shiplane plugins`: the flow's adapters, the modules in release order with their apps, the features. */\nexport const pluginsCommand = (release: Release, { json }: { json: boolean }) => {\n const { flow } = release;\n const ports = {\n sourceControl: flow.sourceControl.name,\n codeHost: flow.codeHost.name,\n ciPipeline: flow.ciPipeline.name,\n versioning: flow.versioning.name,\n };\n const modules = release.modules.map(({ name, kind, provider, settings }) => ({\n name,\n kind,\n provider,\n keys: keysAt(settings, []),\n apps: release.units.filter(({ module }) => module === name).map(({ name: app }) => app),\n }));\n const features = release.features.map(({ name, adapters }) => ({\n name,\n uses: adapters.map((adapter) => adapter.name),\n }));\n if (json) {\n out(JSON.stringify({ flow: ports, modules, features }, null, 2));\n return;\n }\n const width =\n Math.max(\n 14,\n ...modules.map(({ name }) => name.length),\n ...features.map(({ name }) => name.length),\n ) + 2;\n const section = (title: string) => {\n out();\n out(paint(\"bold\", title));\n out();\n };\n section(\"Flow in shiplane.config.ts\");\n Object.entries(ports).forEach(([port, name]) => out(` ${port.padEnd(width)}${name}`));\n section(\"Modules, in release order\");\n modules.forEach(({ name, provider, keys, apps }) => {\n const used = apps.length > 0 ? `used by ${apps.join(\", \")}` : paint(\"dim\", \"no app names it\");\n out(` ${name.padEnd(width)}${provider} ${paint(\"dim\", keys.join(\", \") || \"no options\")}`);\n out(` ${\" \".repeat(width)}${used}`);\n });\n section(\"Features, after the ship\");\n if (features.length === 0) out(` ${paint(\"dim\", \"none\")}`);\n features.forEach(({ name, uses }) =>\n out(` ${name.padEnd(width)}${paint(\"dim\", `uses ${uses.join(\", \")}`)}`),\n );\n out();\n};\n","import type { ReleaseContext } from \"../application/context\";\nimport type { Environment } from \"../domain/environment\";\nimport { readStatus } from \"../application/readStatus\";\nimport { environmentLabel } from \"../application/targets\";\nimport { out, paint } from \"./output\";\n\nconst NEXT: Record<string, string> = {\n \"release-pr\": \"open the release PR: shiplane\",\n \"wait-merge\": \"merge the release PR, then: shiplane\",\n ship: \"tag what was versioned and ship it: shiplane\",\n};\n\n/** The next step as a person reads it; a ship with nothing pending anywhere is nothing to do. */\nexport const nextLabel = (\n {\n next,\n units,\n untagged,\n }: {\n next: { step: string };\n units: readonly { pending: boolean }[];\n untagged: readonly unknown[];\n },\n nextChange: string,\n) =>\n next.step === \"ship\" && untagged.length === 0 && !units.some(({ pending }) => pending)\n ? `nothing to release: queue a change with ${nextChange}`\n : (NEXT[next.step] ?? \"\");\n\n/** `shiplane status`: where every unit stands on an environment, and what to run next. Reads only. */\nexport const statusCommand = async (\n context: ReleaseContext,\n { environment, json }: { environment: Environment; json: boolean },\n) => {\n const status = await readStatus(context, environment);\n if (json) {\n out(JSON.stringify(status, null, 2));\n return;\n }\n const dot = paint(\"dim\", \"·\");\n out();\n const label = environmentLabel(context, [], environment);\n out(` ${paint(\"bold\", \"Release status\")} ${dot} ${label}`);\n out();\n const width = Math.max(8, ...status.units.map(({ unit }) => unit.length)) + 2;\n out(\n paint(\n \"dim\",\n ` ${\"Unit\".padEnd(width)}${\"Version\".padEnd(12)}${\"Target\".padEnd(18)}Where it stands`,\n ),\n );\n status.units.forEach(({ unit, version, target, pending, hint }) => {\n const mark = pending ? paint(\"yellow\", \"↑\") : paint(\"dim\", \"·\");\n out(` ${unit.padEnd(width)}${version.padEnd(12)}${target.padEnd(18)}${mark} ${hint}`);\n });\n status.releasePrs.forEach(({ url }) => out(`\\n ${paint(\"cyan\", \"Release PR\")} ${url}`));\n if (status.untagged.length > 0) {\n out(` ${paint(\"yellow\", \"Untagged\")} ${status.untagged.map(({ tag }) => tag).join(\", \")}`);\n }\n out();\n out(\n `${paint([\"bold\", \"green\"], \"→ Next:\")} ${nextLabel(status, context.services.versioning.nextChange)}`,\n );\n out();\n};\n","import { parseArgs } from \"node:util\";\nimport { z } from \"zod\";\n\nimport type { ReleaseContext } from \"../application/context\";\nimport type { ContextIo } from \"./compose\";\nimport { nodeFiles } from \"../adapters/files/node-files.adapter\";\nimport { addUnit, removeUnit } from \"../application/addUnit\";\nimport { loadRelease } from \"../application/config/loadRelease\";\nimport { docsFor } from \"../application/docsFor\";\nimport { doctor } from \"../application/doctor\";\nimport { initRelease } from \"../application/initRelease\";\nimport { newAdapter } from \"../application/newAdapter\";\nimport { openReleasePr } from \"../application/openReleasePr\";\nimport { pickScope } from \"../application/pickScope\";\nimport { planShips } from \"../application/planShips\";\nimport { prepareRelease } from \"../application/prepareRelease\";\nimport { promote } from \"../application/promote\";\nimport { releaseToPreview } from \"../application/releaseToPreview\";\nimport { setup } from \"../application/setup\";\nimport { CONFIG_FILE, refreshEditorSchema } from \"../application/setupFiles\";\nimport { shipTo } from \"../application/ship\";\nimport { missingTags, tagRelease } from \"../application/tagRelease\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { composeContext, composeSetup } from \"./compose\";\nimport { findRoot } from \"./findRoot\";\nimport { out, paint, printProblems } from \"./output\";\nimport { pluginsCommand } from \"./pluginsCommand\";\nimport { statusCommand } from \"./statusCommand\";\n\nconst HELP = `${paint(\"bold\", \"shiplane\")}: detect what changed, version it, trigger each app's deploy.\n\n shiplane the next step to preview: release PR, merge, tags, ship\n shiplane promote production, from what preview runs (--channel production too)\n shiplane status [--json] where every unit stands, and what to run next\n shiplane version open the release PR for what is pending\n shiplane tag tag merged versions and publish their release notes\n shiplane ship [unit...] trigger each tagged unit's deploy, then return\n shiplane plan every command a ship would run, run nothing\n shiplane plugins [--json] the flow, the modules in release order and who uses each, the features\n\n shiplane setup [--yes] set up or check releases: asks only what it can't tell, rehearses, then writes\n shiplane init [--yes|--blank] the older setup: a unit file per app, then doctor\n shiplane add <folder> init's questions for one folder\n shiplane remove <unit> stop shipping a unit; it stays versioned\n shiplane doctor check the config, tools and sign-ins, offer each fix\n shiplane adapter new <name> scaffold a server hosting adapter, its contract test and its module\n shiplane docs <name> every key a module's or an adapter's unit files take\n shiplane help this\n\n --channel preview|production where status reads (preview by default)\n --via github|local ship through GitHub Actions or this machine, without asking\n --yes answer yes to every question (never on production)\n --verbose / --no-verbose say each thing it reads and runs, with a progress bar (on by default)\n --mascot / --no-mascot the mascot beside it, still in CI or under NO_MOTION=1 (on by default)\n Both defaults live in shiplane.config.ts: display: { verbose, mascot }\n`;\n\n/** The CLI as a person runs it, from its arguments and folder; resolves to its exit code. */\nexport const runCli = async (argv: string[], cwd: string, io: ContextIo = {}): Promise<number> => {\n const { values, positionals } = parseArgs({\n args: argv,\n allowPositionals: true,\n allowNegative: true,\n options: {\n verbose: { type: \"boolean\" },\n mascot: { type: \"boolean\" },\n json: { type: \"boolean\", default: false },\n yes: { type: \"boolean\", short: \"y\", default: false },\n channel: { type: \"string\", default: \"preview\" },\n via: { type: \"string\" },\n blank: { type: \"boolean\", default: false },\n },\n });\n\n const [command = \"next\", ...units] = positionals;\n const environment = z.enum(ENVIRONMENTS).parse(values.channel);\n const via = values.via === undefined ? undefined : z.enum([\"github\", \"local\"]).parse(values.via);\n\n const commands: Record<string, (context: ReleaseContext) => Promise<boolean | void>> = {\n next: (context) =>\n environment === \"preview\" ? releaseToPreview(context) : promote(context, via),\n promote: (context) => promote(context, via),\n status: (context) => statusCommand(context, { environment, json: values.json }),\n version: async (context) => {\n const picked = await pickScope(context, \"preview\");\n if (!picked || picked.scope.size === 0) return true;\n return (await openReleasePr(context, await prepareRelease(context, picked.scope))) !== null;\n },\n tag: async (context) => tagRelease(context, await missingTags(context)),\n ship: (context) =>\n shipTo(context, environment, { via, ...(units.length > 0 ? { scope: new Set(units) } : {}) }),\n plan: (context) => planShips(context, environment),\n plugins: (context) => Promise.resolve(pluginsCommand(context.release, { json: values.json })),\n };\n\n const [first = \"\"] = units;\n const setupCommands: Record<\n string,\n (context: Awaited<ReturnType<typeof composeSetup>>) => Promise<boolean>\n > = {\n setup: (context) => setup(context, { yes: values.yes }),\n init: (context) => {\n if (values.blank) return initRelease(context, { yes: values.yes, blank: true });\n out(paint(\"dim\", \"init is now shiplane setup\"));\n return setup(context, { yes: values.yes });\n },\n add: (context) => addUnit(context, first),\n remove: (context) => removeUnit(context, first),\n doctor: (context) => doctor(context),\n adapter: (context) => {\n if (first === \"new\" && units[1]) return newAdapter(context, units[1]);\n out(`${paint(\"red\", \"✗\")} shiplane adapter new <name>`);\n return Promise.resolve(false);\n },\n docs: (context) => docsFor(context, first),\n };\n\n const root = findRoot(cwd);\n const files = io.setup?.files ?? nodeFiles(root);\n const firstRun = command === \"next\" && !files.exists(CONFIG_FILE);\n const run = commands[command];\n const setUp = setupCommands[firstRun ? \"setup\" : command];\n if (setUp) return (await setUp(await composeSetup(root, io.setup))) ? 0 : 1;\n if (command === \"help\") {\n out(HELP);\n return 0;\n }\n if (!run) {\n out(`${paint(\"red\", \"✗\")} no command \"${command}\"`);\n out(HELP);\n return 1;\n }\n const release = await loadRelease(root, { aliases: io.aliases });\n if (release.problems.length > 0) {\n printProblems(release.problems);\n return 2;\n }\n (release.renames ?? []).forEach(({ from, to }) =>\n out(`${paint(\"yellow\", \"!\")} rename ${from} to ${to}: the old name still works for now`),\n );\n refreshEditorSchema(nodeFiles(release.root), release);\n const context = composeContext(\n release,\n { yes: values.yes, display: { verbose: values.verbose, mascot: values.mascot } },\n io,\n );\n return (await run(context)) === false ? 1 : 0;\n};\n","#!/usr/bin/env node\nimport { runCli } from \"./cli/main\";\n\nprocess.exitCode = await runCli(process.argv.slice(2), process.cwd());\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,MAAa,eAAe,QAAuB,WAAyB;CAC1E,MAAM,EAAE,SAAS;CACjB,MAAM,OAAO,OAAO,KAAK,OAAO;AAChC,KAAI,SAAS,UAAW,QAAO,UAAU,OAAO,KAAK;AACrD,KAAI,CAAC,OAAO,SAAU,QAAO,SAAS,UAAU,UAAU,SAAS,KAAK,GAAG;CAC3E,MAAM,QAAQ,CAAC,GAAG,KAAK;CACvB,MAAM,OAAO,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG;AACxC,QAAO,GAAG,UAAU,UAAU,MAAM,MAAM,G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,MAAM,MAAM,aAAa,MAAM,GAAG,MAAM,CAAC,GAAI,IAAI;AAC1E,KAAI,YAAY,QAAQ;AACtB,MAAI,KAAK;AACT,SAAO;;AAET,KAAI,CAAC,KAAK;AACR,MAAI,GAAG,MAAM,OAAO,IAAI,CAAC,gBAAgB,QAAQ,GAAG;AACpD,MAAI,KAAK;AACT,SAAO;;CAET,MAAM,UAAU,MAAM,YAAY,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;AAChE,KAAI,QAAQ,SAAS,SAAS,GAAG;AAC/B,gBAAc,QAAQ,SAAS;AAC/B,SAAO;;AAET,EAAC,QAAQ,WAAW,EAAE,EAAE,SAAS,EAAE,MAAM,SACvC,IAAI,GAAG,MAAM,UAAU,IAAI,CAAC,WAAW,KAAK,MAAM,GAAG,oCAAoC,CAC1F;AACD,qBAAoB,UAAU,QAAQ,KAAK,EAAE,QAAQ;AAMrD,QAAQ,MAAM,IALE,eACd,SACA;EAAE,KAAK,OAAO;EAAK,SAAS;GAAE,SAAS,OAAO;GAAS,QAAQ,OAAO;GAAQ;EAAE,EAChF,GAEuB,CAAC,KAAM,QAAQ,IAAI;;;;AC/I9C,QAAQ,WAAW,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE,EAAE,QAAQ,KAAK,CAAC"}
@@ -1,4 +1,4 @@
1
- import { I as CiPipelinePort, L as CodeHostPort, O as SourceControlPort, X as Approval, Y as DecidedBy, a as VersioningPort, c as DeliveryAdapter, ct as ReleaseUnit, d as DecideContext, f as Decision, g as JobInput, h as Job, i as MobileDistributionPort, l as ServiceAdapter, lt as DisplayChoice, m as Health, mt as Environment, n as ServerHostingPort, o as Adapter, r as PackageRegistryPort, t as StaticHostingPort, tt as AppBump, v as Requirement, x as VersionContribution, y as Resolved } from "./static-hosting.port-mknLsxwR.js";
1
+ import { I as CiPipelinePort, L as CodeHostPort, O as SourceControlPort, X as Approval, Y as DecidedBy, a as VersioningPort, c as DeliveryAdapter, ct as ReleaseUnit, d as DecideContext, f as Decision, g as JobInput, h as Job, i as MobileDistributionPort, l as ServiceAdapter, lt as DisplayChoice, m as Health, mt as Environment, n as ServerHostingPort, o as Adapter, r as PackageRegistryPort, t as StaticHostingPort, tt as AppBump, v as Requirement, x as VersionContribution, y as Resolved } from "./static-hosting.port-DaIJfr1x.js";
2
2
  import { z, z as z$1 } from "zod";
3
3
 
4
4
  //#region src/application/config/perEnv.d.ts
@@ -145,11 +145,6 @@ interface ReleaseConfig {
145
145
  * How a tag names a version: `"package"` (`{name}@{version}`, the default), `"plugin"` (`{name}--v{version}`), `"single"` (`v{version}`, one unit only), `"module"` (`{name}/v{version}`), or a format of your own.
146
146
  */
147
147
  tag?: TagFormatName | (string & {});
148
- /**
149
- * A unit whose folder changed with no changeset naming it: `"ignore"` (the default, as changesets
150
- * does) leaves it, `"release"` offers it with a changelog from its commits.
151
- */
152
- commitsWithoutChangeset?: "release" | "ignore";
153
148
  /** How much the release says while it runs; `--verbose` and `--mascot` (or `--no-…`) override. */
154
149
  display?: DisplayChoice;
155
150
  }
@@ -252,4 +247,4 @@ type ShellServerHostingAdapter = DeliveryAdapter<ServerHostingPort>;
252
247
  declare const shellServerHosting: () => ShellServerHostingAdapter;
253
248
  //#endregion
254
249
  export { perEnv as A, DEFAULT_TAG_FORMAT as C, isReleaseSubject as D, TagFormatName as E, tagName as O, Shipped as S, TAG_FORMATS as T, Feature as _, mobileApp as a, ReleaseFlow as b, backendService as c, definePackageRegistry as d, defineServerHosting as f, AfterShipContext as g, defineRelease as h, publishedPackage as i, PerEnv as k, releaseFlow as l, ReleaseConfig as m, shellServerHosting as n, internalTool as o, defineStaticHosting as p, webApp as r, agentPlugin as s, z$1 as t, defineMobileDistribution as u, FollowUp as v, ReleaseTag as w, ReleaseModule as x, Open as y };
255
- //# sourceMappingURL=index-Cb8R0RIA.d.ts.map
250
+ //# sourceMappingURL=index-CxyLUqKJ.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { I as CiPipelinePort, L as CodeHostPort, O as SourceControlPort, a as VersioningPort, c as DeliveryAdapter, ct as ReleaseUnit, dt as MascotMoment, i as MobileDistributionPort, l as ServiceAdapter, mt as Environment, n as ServerHostingPort, o as Adapter, r as PackageRegistryPort, s as AdapterContext, t as StaticHostingPort, ut as Mascot } from "./static-hosting.port-mknLsxwR.js";
2
- import { A as perEnv, _ as Feature, a as mobileApp, b as ReleaseFlow, c as backendService, d as definePackageRegistry, f as defineServerHosting, h as defineRelease, i as publishedPackage, k as PerEnv, l as releaseFlow, m as ReleaseConfig, n as shellServerHosting, o as internalTool, p as defineStaticHosting, r as webApp, s as agentPlugin, t as z, u as defineMobileDistribution, x as ReleaseModule } from "./index-Cb8R0RIA.js";
1
+ import { I as CiPipelinePort, L as CodeHostPort, O as SourceControlPort, a as VersioningPort, c as DeliveryAdapter, ct as ReleaseUnit, dt as MascotMoment, i as MobileDistributionPort, l as ServiceAdapter, mt as Environment, n as ServerHostingPort, o as Adapter, r as PackageRegistryPort, s as AdapterContext, t as StaticHostingPort, ut as Mascot } from "./static-hosting.port-DaIJfr1x.js";
2
+ import { A as perEnv, _ as Feature, a as mobileApp, b as ReleaseFlow, c as backendService, d as definePackageRegistry, f as defineServerHosting, h as defineRelease, i as publishedPackage, k as PerEnv, l as releaseFlow, m as ReleaseConfig, n as shellServerHosting, o as internalTool, p as defineStaticHosting, r as webApp, s as agentPlugin, t as z, u as defineMobileDistribution, x as ReleaseModule } from "./index-CxyLUqKJ.js";
3
3
  export { Adapter, AdapterContext, CiPipelinePort, CodeHostPort, DeliveryAdapter, Environment, Feature, Mascot, MascotMoment, MobileDistributionPort, PackageRegistryPort, PerEnv, ReleaseConfig, ReleaseFlow, ReleaseModule, ReleaseUnit, ServerHostingPort, ServiceAdapter, SourceControlPort, StaticHostingPort, VersioningPort, agentPlugin, backendService, defineMobileDistribution, definePackageRegistry, defineRelease, defineServerHosting, defineStaticHosting, internalTool, mobileApp, perEnv, publishedPackage, releaseFlow, shellServerHosting, webApp, z };
package/dist/memory.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { c as ciPipelineFake, d as codeHostFake, i as serverHostingFake, n as mobileDistributionFake, o as versioningFake, p as sourceControlFake, r as staticHostingFake, t as packageRegistryFake } from "./package-registry.fake-CC37ptzf.js";
1
+ import { c as ciPipelineFake, d as codeHostFake, i as serverHostingFake, n as mobileDistributionFake, o as versioningFake, p as sourceControlFake, r as staticHostingFake, t as packageRegistryFake } from "./package-registry.fake-DOI4N4yu.js";
2
2
  export { ciPipelineFake as ciPipelineMemory, codeHostFake as codeHostMemory, mobileDistributionFake as mobileDistributionMemory, packageRegistryFake as packageRegistryMemory, serverHostingFake as serverHostingMemory, sourceControlFake as sourceControlMemory, staticHostingFake as staticHostingMemory, versioningFake as versioningMemory };
package/dist/memory.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as versioningFake, c as sourceControlFake, i as serverHostingFake, n as mobileDistributionFake, o as ciPipelineFake, r as staticHostingFake, s as codeHostFake, t as packageRegistryFake } from "./package-registry.fake-Ciqc4ujx.js";
1
+ import { a as versioningFake, c as sourceControlFake, i as serverHostingFake, n as mobileDistributionFake, o as ciPipelineFake, r as staticHostingFake, s as codeHostFake, t as packageRegistryFake } from "./package-registry.fake-D6e0c_iA.js";
2
2
  export { ciPipelineFake as ciPipelineMemory, codeHostFake as codeHostMemory, mobileDistributionFake as mobileDistributionMemory, packageRegistryFake as packageRegistryMemory, serverHostingFake as serverHostingMemory, sourceControlFake as sourceControlMemory, staticHostingFake as staticHostingMemory, versioningFake as versioningMemory };
@@ -13,7 +13,6 @@ var SourceControlFake = class {
13
13
  clean: true,
14
14
  tags: {},
15
15
  versionCommits: {},
16
- subjects: {},
17
16
  files: {},
18
17
  diffs: {},
19
18
  commits: {},
@@ -47,7 +46,6 @@ var SourceControlFake = class {
47
46
  isClean = () => Promise.resolve(this.state.clean);
48
47
  tagCommit = (tag) => Promise.resolve(this.state.tags[tag] ?? null);
49
48
  versionCommit = (dir, _manifest, version) => Promise.resolve(this.state.versionCommits[`${dir}@${version}`] ?? null);
50
- subjectsSince = (sha, dir) => Promise.resolve(this.state.subjects[`${sha}:${dir}`] ?? []);
51
49
  changedFiles = () => Promise.resolve(this.state.changed);
52
50
  diffNames = (from, to) => Promise.resolve(this.state.diffs[`${from}..${to}`] ?? []);
53
51
  commitsBetween = (from, to) => Promise.resolve(this.state.commits[`${from}..${to}`] ?? []);
@@ -352,13 +350,14 @@ var VersioningFake = class {
352
350
  return this;
353
351
  }
354
352
  pending = () => Promise.resolve(this.state.pending);
355
- plan = (added, held) => Promise.resolve(this.state.plan(added, held));
353
+ plan = (added, held, ceiling) => Promise.resolve(this.state.plan(added, held, ceiling));
356
354
  dependencies = () => Promise.resolve(this.state.dependencies);
357
355
  folders = () => Promise.resolve(this.state.folders);
358
- apply = (added, held) => {
356
+ apply = (added, held, ceiling) => {
359
357
  this.applied.push({
360
358
  added,
361
- held
359
+ held,
360
+ ceiling
362
361
  });
363
362
  return Promise.resolve();
364
363
  };
@@ -370,6 +369,7 @@ var VersioningFake = class {
370
369
  }];
371
370
  return Promise.resolve();
372
371
  };
372
+ nextChange = "pnpm changeset";
373
373
  changesetFile = (id) => `.changeset/${id}.md`;
374
374
  changelogFile = (dir) => `${dir}/CHANGELOG.md`;
375
375
  };
@@ -630,4 +630,4 @@ const packageRegistryFake = (fake = new PackageRegistryFake()) => ({
630
630
  //#endregion
631
631
  export { versioningFake as a, sourceControlFake as c, serverHostingFake as i, mobileDistributionFake as n, ciPipelineFake as o, staticHostingFake as r, codeHostFake as s, packageRegistryFake as t };
632
632
 
633
- //# sourceMappingURL=package-registry.fake-Ciqc4ujx.js.map
633
+ //# sourceMappingURL=package-registry.fake-D6e0c_iA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-registry.fake-D6e0c_iA.js","names":[],"sources":["../src/adapters/source-control/__fakes__/source-control.fake.ts","../src/adapters/code-host/__fakes__/code-host.fake.ts","../src/adapters/ci-pipeline/__fakes__/ci-pipeline.fake.ts","../src/adapters/versioning/__fakes__/versioning.fake.ts","../src/adapters/server-hosting/__fakes__/server-hosting.fake.ts","../src/adapters/static-hosting/__fakes__/static-hosting.fake.ts","../src/adapters/mobile-distribution/__fakes__/mobile-distribution.fake.ts","../src/adapters/package-registry/__fakes__/package-registry.fake.ts"],"sourcesContent":["import type { GitPosition } from \"../../../domain/governance\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { SourceControlPort } from \"../../../ports/source-control.port\";\n\ninterface SourceState {\n position: GitPosition;\n clean: boolean;\n /** Tag name → the commit it points at. */\n tags: Record<string, string>;\n /** `<dir>@<version>` → the commit that brought that version. */\n versionCommits: Record<string, { sha: string; subject: string }>;\n /** `<ref>:<file>` → its text at that ref. */\n files: Record<string, string>;\n /** `<from>..<to>` → the files that differ. */\n diffs: Record<string, string[]>;\n /** `<from>..<to>` → the commits after `from` up to `to`, newest first. */\n commits: Record<string, { subject: string; files: string[] }[]>;\n changed: string[];\n}\n\nexport type SourceEvent =\n | { type: \"branch\"; name: string }\n | { type: \"switch\"; branch: string }\n | { type: \"commit\"; files: string[]; title: string; body?: string }\n | { type: \"push\"; branch: string }\n | { type: \"pull\" }\n | { type: \"tag\"; name: string; sha: string; message: string }\n | { type: \"push-tags\"; names: string[] }\n | { type: \"discard\"; files: string[] }\n | { type: \"delete-branch\"; name: string }\n | { type: \"delete-remote\"; branch: string }\n | { type: \"delete-tag\"; name: string };\n\n/** A repository held in memory: seed what it contains, read back what it received. */\nexport class SourceControlFake implements SourceControlPort {\n private state: SourceState = {\n position: { branch: \"main\", head: \"head\", originMain: \"head\" },\n clean: true,\n tags: {},\n versionCommits: {},\n files: {},\n diffs: {},\n commits: {},\n changed: [],\n };\n\n readonly received: SourceEvent[] = [];\n private failures: { type: SourceEvent[\"type\"]; nth: number; error: Error }[] = [];\n\n seed(state: Partial<SourceState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n /** The `nth` call of this kind throws `error`, after it is recorded. */\n failAt(type: SourceEvent[\"type\"], nth: number, error: Error) {\n this.failures.push({ type, nth, error });\n return this;\n }\n\n private record(event: SourceEvent) {\n this.received.push(event);\n const count = this.received.filter(({ type }) => type === event.type).length;\n const failure = this.failures.find(({ type, nth }) => type === event.type && nth === count);\n return failure ? Promise.reject(failure.error) : Promise.resolve();\n }\n\n position = () => Promise.resolve(this.state.position);\n isClean = () => Promise.resolve(this.state.clean);\n tagCommit = (tag: string) => Promise.resolve(this.state.tags[tag] ?? null);\n versionCommit = (dir: string, _manifest: string, version: string) =>\n Promise.resolve(this.state.versionCommits[`${dir}@${version}`] ?? null);\n changedFiles = () => Promise.resolve(this.state.changed);\n diffNames = (from: string, to: string) =>\n Promise.resolve(this.state.diffs[`${from}..${to}`] ?? []);\n commitsBetween = (from: string, to: string) =>\n Promise.resolve(this.state.commits[`${from}..${to}`] ?? []);\n fileAt = (ref: string, file: string) =>\n Promise.resolve(this.state.files[`${ref}:${file}`] ?? null);\n tags = () => Promise.resolve(new Set(Object.keys(this.state.tags)));\n\n createBranch = async (name: string) => {\n await this.record({ type: \"branch\", name });\n this.state.position = { ...this.state.position, branch: name };\n };\n\n switchTo = async (branch: string) => {\n await this.record({ type: \"switch\", branch });\n this.state.position = { ...this.state.position, branch };\n };\n\n commit = async (\n files: string[],\n title: string,\n body?: string,\n { skipHooks = false }: { skipHooks?: boolean } = {},\n ) => {\n await this.record({ type: \"commit\", files, title, body, ...(skipHooks ? { skipHooks } : {}) });\n this.state.changed = this.state.changed.filter((file) => !files.includes(file));\n };\n\n push = (branch: string) => this.record({ type: \"push\", branch });\n\n pull = () => this.record({ type: \"pull\" });\n\n tag = async (name: string, sha: string, message: string) => {\n await this.record({ type: \"tag\", name, sha, message });\n this.state.tags[name] = sha;\n };\n\n pushTags = (names: string[]) => this.record({ type: \"push-tags\", names });\n\n discard = async (files: string[]) => {\n await this.record({ type: \"discard\", files });\n this.state.changed = this.state.changed.filter((file) => !files.includes(file));\n };\n\n deleteBranch = (name: string) => this.record({ type: \"delete-branch\", name });\n\n deleteRemoteBranch = (branch: string) => this.record({ type: \"delete-remote\", branch });\n\n deleteTag = async (name: string) => {\n await this.record({ type: \"delete-tag\", name });\n this.state.tags = Object.fromEntries(\n Object.entries(this.state.tags).filter(([tag]) => tag !== name),\n );\n };\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const sourceControlFake = (\n fake = new SourceControlFake(),\n): ServiceAdapter<SourceControlPort> & { fake: SourceControlFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import type { Environment } from \"../../../domain/environment\";\nimport type { IssueRef, LinkedPr } from \"../../../domain/issues\";\nimport type { MergeMethod, MergeMethods, OpenPr } from \"../../../domain/releasePr\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { CodeHostPort, Deploy } from \"../../../ports/code-host.port\";\nimport { issueName } from \"../../../domain/issues\";\n\ninterface HostState {\n openPrs: { branch: string; pr: OpenPr }[];\n /** States a pull request goes through, one per poll; the last one stays. */\n prStates: Record<number, (\"OPEN\" | \"MERGED\" | \"CLOSED\")[]>;\n /** The merge methods the repository allows, and the one its pull request page preselects. */\n merges: MergeMethods;\n releasedTags: string[];\n deployments: Deploy[];\n nextPrNumber: number;\n /** Merged pull requests by number, as a release reads their linked issues. */\n pullRequests: Record<number, LinkedPr>;\n /** `owner/name#123` → the text of its comments. */\n comments: Record<string, string[]>;\n}\n\nexport type HostEvent =\n | {\n type: \"pr\";\n pr: OpenPr;\n base: string;\n head: string;\n title: string;\n body: string;\n label: string;\n }\n | { type: \"merge\"; pr: OpenPr; method: MergeMethod }\n | { type: \"close\"; pr: OpenPr; comment: string }\n | { type: \"release\"; tag: string; notes: string; latest: boolean }\n | { type: \"record\"; ref: string; environment: Environment }\n | { type: \"comment\"; issue: string; body: string };\n\n/** A code host held in memory: seed its pull requests and deploys, read back what it received. */\nexport class CodeHostFake implements CodeHostPort {\n private state: HostState = {\n openPrs: [],\n prStates: {},\n merges: { allowed: [\"--squash\", \"--merge\", \"--rebase\"], preselected: \"--squash\" },\n releasedTags: [],\n deployments: [],\n nextPrNumber: 1800,\n pullRequests: {},\n comments: {},\n };\n\n readonly received: HostEvent[] = [];\n /** Each pull request number, once per state check. */\n readonly polled: number[] = [];\n /** Each batched read of pull requests or comments, in order. */\n readonly reads: (\"pull-requests\" | \"comments\")[] = [];\n\n seed(state: Partial<HostState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n openPrsFrom = (branchPrefix: string) =>\n Promise.resolve(\n this.state.openPrs\n .filter(({ branch }) => branch.startsWith(branchPrefix))\n .map(({ pr }) => pr),\n );\n\n private createError: Error | null = null;\n\n /** Every pull request open throws `error`. */\n failCreate(error: Error) {\n this.createError = error;\n return this;\n }\n\n createPr = (pr: { base: string; head: string; title: string; body: string; label: string }) => {\n if (this.createError) return Promise.reject(this.createError);\n const number = this.state.nextPrNumber++;\n const created = {\n number,\n url: `https://github.com/acme/repo/pull/${number}`,\n head: `sha-${number}`,\n };\n this.received.push({ type: \"pr\", pr: created, ...pr });\n this.state.openPrs.push({ branch: pr.head, pr: created });\n return Promise.resolve(created);\n };\n\n private closeError: Error | null = null;\n\n /** Every pull request close throws `error`. */\n failClose(error: Error) {\n this.closeError = error;\n return this;\n }\n\n closePr = (pr: OpenPr, comment: string) => {\n if (this.closeError) return Promise.reject(this.closeError);\n this.received.push({ type: \"close\", pr, comment });\n this.state.openPrs = this.state.openPrs.filter((open) => open.pr.number !== pr.number);\n this.state.prStates[pr.number] = [\"CLOSED\"];\n return Promise.resolve();\n };\n\n prState = (pr: OpenPr) => {\n this.polled.push(pr.number);\n const states = this.state.prStates[pr.number] ?? [\"OPEN\"];\n const [state = \"OPEN\", ...rest] = states;\n if (rest.length > 0) this.state.prStates[pr.number] = rest;\n return Promise.resolve(state);\n };\n\n mergeMethods = () => Promise.resolve(this.state.merges);\n\n merge = (pr: OpenPr, method: MergeMethod) => {\n this.received.push({ type: \"merge\", pr, method });\n this.state.prStates[pr.number] = [\"MERGED\"];\n return Promise.resolve();\n };\n\n showDiff = () => Promise.resolve();\n openInBrowser = () => Promise.resolve();\n releasedTags = () => Promise.resolve(new Set(this.state.releasedTags));\n\n private releaseError: Error | null = null;\n\n /** Every release notes publish throws `error`. */\n failRelease(error: Error) {\n this.releaseError = error;\n return this;\n }\n\n createRelease = (tag: string, notes: string, latest: boolean) => {\n if (this.releaseError) return Promise.reject(this.releaseError);\n this.received.push({ type: \"release\", tag, notes, latest });\n this.state.releasedTags.push(tag);\n return Promise.resolve();\n };\n\n deployments = () => Promise.resolve(this.state.deployments);\n\n recordDeployment = (ref: string, environment: Environment) => {\n this.received.push({ type: \"record\", ref, environment });\n this.state.deployments.push({ title: `Deploy ${ref} to ${environment}`, state: \"done\" });\n return Promise.resolve();\n };\n\n pullRequests = (numbers: readonly number[]) => {\n this.reads.push(\"pull-requests\");\n const missing = numbers.find((number) => !this.state.pullRequests[number]);\n if (missing !== undefined) return Promise.reject(new Error(`no pull request #${missing}`));\n return Promise.resolve(numbers.flatMap((number) => this.state.pullRequests[number] ?? []));\n };\n\n comments = (on: readonly IssueRef[]) => {\n this.reads.push(\"comments\");\n return Promise.resolve(on.map((ref) => this.state.comments[issueName(ref)] ?? []));\n };\n\n private commentError: Error | null = null;\n\n /** Every comment throws `error`. */\n failComment(error: Error) {\n this.commentError = error;\n return this;\n }\n\n comment = (on: IssueRef, body: string) => {\n if (this.commentError) return Promise.reject(this.commentError);\n this.received.push({ type: \"comment\", issue: issueName(on), body });\n this.state.comments[issueName(on)] = [...(this.state.comments[issueName(on)] ?? []), body];\n return Promise.resolve();\n };\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const codeHostFake = (\n fake = new CodeHostFake(),\n): ServiceAdapter<CodeHostPort> & { fake: CodeHostFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import type { ActionsMinutes } from \"../../../domain/budget\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { CiPipelinePort } from \"../../../ports/ci-pipeline.port\";\nimport type { Deploy } from \"../../../ports/code-host.port\";\n\ninterface PipelineState {\n workflowRuns: Record<string, Deploy[]>;\n minutes: ActionsMinutes | null;\n measured: Record<string, number[]>;\n}\n\nexport interface Dispatched {\n type: \"dispatch\";\n workflow: string;\n ref: string;\n inputs: Record<string, string>;\n}\n\n/** A CI pipeline held in memory: seed its runs and minutes, read back what was dispatched. */\nexport class CiPipelineFake implements CiPipelinePort {\n private state: PipelineState = { workflowRuns: {}, minutes: null, measured: {} };\n\n readonly received: Dispatched[] = [];\n\n constructor(readonly shipWorkflow = \"ship.yml\") {}\n\n seed(state: Partial<PipelineState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n workflowRuns = (workflow: string) => Promise.resolve(this.state.workflowRuns[workflow] ?? []);\n\n dispatch = (workflow: string, ref: string, inputs: Record<string, string>) => {\n this.received.push({ type: \"dispatch\", workflow, ref, inputs });\n return Promise.resolve();\n };\n\n minutes = () => Promise.resolve(this.state.minutes);\n measuredMinutes = (workflow: string) => Promise.resolve(this.state.measured[workflow] ?? []);\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const ciPipelineFake = (\n fake = new CiPipelineFake(),\n): ServiceAdapter<CiPipelinePort> & { fake: CiPipelineFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import type { BumpLevel, PlannedChangeset, StatusPlan } from \"../../../domain/changes\";\nimport type { ServiceAdapter } from \"../../../ports/adapter.port\";\nimport type { VersioningPort } from \"../../../ports/versioning.port\";\n\n/** A changeset as its file reads: one `\"package\": bump` line each, then the summary. */\nconst changesetText = ({ releases, summary }: PlannedChangeset) =>\n `---\\n${releases.map(({ name, type }) => `\"${name}\": ${type}`).join(\"\\n\")}\\n---\\n\\n${summary}\\n`;\n\ntype PlanOf = (\n added: PlannedChangeset[],\n held: PlannedChangeset[],\n ceiling?: BumpLevel,\n) => StatusPlan;\n\ninterface VersioningState {\n pending: { id: string; text: string }[];\n /** What `changeset status` would answer, given what the release adds, holds back and caps. */\n plan: PlanOf;\n dependencies: Record<string, string[]>;\n folders: Record<string, string>;\n}\n\n/** Versioning held in memory: seed the pending changes and the plan, read back what it received. */\nexport class VersioningFake implements VersioningPort {\n private state: VersioningState = {\n pending: [],\n plan: () => ({ changesets: [], releases: [] }),\n dependencies: {},\n folders: {},\n };\n\n readonly applied: {\n added: PlannedChangeset[];\n held: PlannedChangeset[];\n ceiling?: BumpLevel;\n }[] = [];\n readonly written: PlannedChangeset[] = [];\n\n seed(state: Partial<VersioningState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n pending = () => Promise.resolve(this.state.pending);\n plan = (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) =>\n Promise.resolve(this.state.plan(added, held, ceiling));\n dependencies = () => Promise.resolve(this.state.dependencies);\n folders = () => Promise.resolve(this.state.folders);\n\n apply = (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) => {\n this.applied.push({ added, held, ceiling });\n return Promise.resolve();\n };\n\n write = (changeset: PlannedChangeset) => {\n this.written.push(changeset);\n this.state.pending = [\n ...this.state.pending.filter(({ id }) => id !== changeset.id),\n { id: changeset.id, text: changesetText(changeset) },\n ];\n return Promise.resolve();\n };\n\n nextChange = \"pnpm changeset\";\n\n changesetFile = (id: string) => `.changeset/${id}.md`;\n changelogFile = (dir: string) => `${dir}/CHANGELOG.md`;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const versioningFake = (\n fake = new VersioningFake(),\n): ServiceAdapter<VersioningPort> & { fake: VersioningFake } => ({\n name: \"fake\",\n create: () => fake,\n fake,\n});\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type { Job, JobInput, Requirement } from \"../../../ports/delivery.port\";\nimport type { ServerHostingPort } from \"../../../ports/server-hosting.port\";\nimport { perEnv } from \"../../../application/config/perEnv\";\n\nconst ServerSettings = z.object({\n service: z.string().describe(\"The service it deploys\"),\n url: perEnv(z.string()).optional().describe(\"Where it answers, for other apps to read\"),\n});\n\nconst Resolved = z.object({ service: z.string() });\n\n/** A deploy a module asked for. */\nexport interface Asked {\n tag: string;\n environment: Environment;\n service: string;\n}\n\n/** A server host held in memory: it deploys nothing, and records each deploy it was asked for. */\nexport class ServerHostingFake implements ServerHostingPort {\n readonly capability = \"server-hosting\";\n\n private needs: Requirement[] = [];\n readonly received: Asked[] = [];\n\n /** What doctor checks for each app it ships. */\n seed({ requirements }: { requirements: Requirement[] }) {\n this.needs = requirements;\n return this;\n }\n\n describe = ({ options }: JobInput<Record<string, unknown>>) =>\n `${Resolved.parse(options).service} (fake)`;\n\n jobs = ({ tag, environment, options }: JobInput<Record<string, unknown>>): Job[] => {\n const { service } = Resolved.parse(options);\n this.received.push({ tag, environment, service });\n return [\n {\n label: `deploy ${tag} to ${service} (fake)`,\n local: [{ command: \"echo\", args: [\"deploy\", service, tag] }],\n ci: { ref: tag },\n record: true,\n },\n ];\n };\n\n requirements = () => this.needs;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const serverHostingFake = (\n fake = new ServerHostingFake(),\n): DeliveryAdapter<ServerHostingPort> & { fake: ServerHostingFake } => ({\n name: \"fake\",\n capability: \"server-hosting\",\n settings: ServerSettings,\n typicalMinutes: 1,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type { Job, JobInput, Requirement } from \"../../../ports/delivery.port\";\nimport type { StaticHostingPort } from \"../../../ports/static-hosting.port\";\n\nconst StaticSettings = z.object({\n site: z.string().describe(\"The site it uploads to\"),\n});\n\n/** An upload a module asked for. */\nexport interface Asked {\n tag: string;\n environment: Environment;\n site: string;\n}\n\n/** A static host held in memory: it uploads nothing, and records each upload it was asked for. */\nexport class StaticHostingFake implements StaticHostingPort {\n readonly capability = \"static-hosting\";\n\n private needs: Requirement[] = [];\n readonly received: Asked[] = [];\n\n /** What doctor checks for each app it ships. */\n seed({ requirements }: { requirements: Requirement[] }) {\n this.needs = requirements;\n return this;\n }\n\n describe = ({ options, environment }: JobInput<Record<string, unknown>>) =>\n `${StaticSettings.parse(options).site} (fake, ${environment})`;\n\n jobs = ({ tag, environment, options }: JobInput<Record<string, unknown>>): Job[] => {\n const { site } = StaticSettings.parse(options);\n this.received.push({ tag, environment, site });\n return [\n {\n label: `build ${tag} and upload it to ${site} (fake)`,\n local: [{ command: \"echo\", args: [\"upload\", site, tag] }],\n ci: { ref: tag },\n record: true,\n },\n ];\n };\n\n requirements = () => this.needs;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const staticHostingFake = (\n fake = new StaticHostingFake(),\n): DeliveryAdapter<StaticHostingPort> & { fake: StaticHostingFake } => ({\n name: \"fake\",\n capability: \"static-hosting\",\n settings: StaticSettings,\n typicalMinutes: 1,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type {\n DecideContext,\n Decision,\n Health,\n Job,\n JobInput,\n Requirement,\n} from \"../../../ports/delivery.port\";\nimport type { MobileDistributionPort } from \"../../../ports/mobile-distribution.port\";\n\nconst MobileSettings = z.object({\n app: z.string().describe(\"The app it ships to the stores and over the air\"),\n});\n\nconst DECIDED_BY = {\n platform: \"the fake platform\",\n choice: \"update or nothing\",\n check: \"shiplane status\",\n};\n\ninterface MobileState {\n /** The version each environment runs. */\n live: Partial<Record<Environment, string>>;\n /** How each tag does where it runs. */\n health: Record<string, Health>;\n requirements: Requirement[];\n}\n\n/** What a module asked of it. */\nexport interface Asked {\n stage: \"jobs\" | \"decide\" | \"health\" | \"inspect\";\n tag: string;\n environment: Environment;\n}\n\n/**\n * A mobile platform held in memory: seed what each environment runs and how a tag does; a version\n * not live yet ships as an update.\n */\nexport class MobileDistributionFake implements MobileDistributionPort {\n readonly capability = \"mobile-distribution\";\n\n private state: MobileState = { live: {}, health: {}, requirements: [] };\n readonly received: Asked[] = [];\n\n seed(state: Partial<MobileState>) {\n this.state = { ...this.state, ...state };\n return this;\n }\n\n private ask(stage: Asked[\"stage\"], { tag, environment }: JobInput<Record<string, unknown>>) {\n this.received.push({ stage, tag, environment });\n }\n\n describe = ({ options, environment }: JobInput<Record<string, unknown>>) =>\n `${MobileSettings.parse(options).app} on ${environment} (fake)`;\n\n jobs = (input: JobInput<Record<string, unknown>>): Job[] => {\n this.ask(\"jobs\", input);\n const { tag, environment, options } = input;\n const { app } = MobileSettings.parse(options);\n return [\n {\n label: `publish ${tag} to ${app} on ${environment} (fake)`,\n local: [{ command: \"echo\", args: [\"update\", app, tag] }],\n ci: { ref: tag },\n },\n ];\n };\n\n decide = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n this.ask(\"decide\", input);\n const { unit, environment } = input;\n const decision: Decision =\n this.state.live[environment] === unit.version\n ? { action: \"none\", status: `${unit.name} ${unit.version} is on ${environment}` }\n : { action: \"ship\", kind: \"update\", jobs: this.jobs(input) };\n return Promise.resolve(decision);\n };\n\n health = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n this.ask(\"health\", input);\n return Promise.resolve(this.state.health[input.tag] ?? null);\n };\n\n inspect = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n this.ask(\"inspect\", input);\n return Promise.resolve({ live: this.state.live[input.environment] ?? null });\n };\n\n requirements = () => this.state.requirements;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const mobileDistributionFake = (\n fake = new MobileDistributionFake(),\n): DeliveryAdapter<MobileDistributionPort> & { fake: MobileDistributionFake } => ({\n name: \"fake\",\n capability: \"mobile-distribution\",\n settings: MobileSettings,\n typicalMinutes: 1,\n decidedBy: DECIDED_BY,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n","import { z } from \"zod\";\n\nimport type { Environment } from \"../../../domain/environment\";\nimport type { DeliveryAdapter } from \"../../../ports/adapter.port\";\nimport type {\n DecideContext,\n Decision,\n Job,\n JobInput,\n Requirement,\n} from \"../../../ports/delivery.port\";\nimport type { PackageRegistryPort } from \"../../../ports/package-registry.port\";\n\nconst PackageSettings = z.object({\n tag: z.string().default(\"latest\").describe(\"The dist-tag a release moves\"),\n});\n\n/** What a module asked of it. */\nexport interface Asked {\n stage: \"jobs\" | \"decide\";\n tag: string;\n environment: Environment;\n}\n\n/** A package registry held in memory: seed what is published, a version not there yet publishes. */\nexport class PackageRegistryFake implements PackageRegistryPort {\n readonly capability = \"package-registry\";\n\n /** `<package>@<version>` already published. */\n private published = new Set<string>();\n private needs: Requirement[] = [];\n readonly received: Asked[] = [];\n\n seed({\n published = [],\n requirements = [],\n }: {\n published?: string[];\n requirements?: Requirement[];\n }) {\n this.published = new Set(published);\n this.needs = requirements;\n return this;\n }\n\n describe = ({ unit, options }: JobInput<Record<string, unknown>>) =>\n `${unit.packageName} (fake, ${PackageSettings.parse(options).tag})`;\n\n jobs = ({ unit, tag, environment, options }: JobInput<Record<string, unknown>>): Job[] => {\n this.received.push({ stage: \"jobs\", tag, environment });\n return [\n {\n label: `publish ${unit.packageName}@${unit.version} under ${PackageSettings.parse(options).tag} (fake)`,\n local: [{ command: \"echo\", args: [\"publish\", unit.packageName, unit.version] }],\n },\n ];\n };\n\n decide = (_context: DecideContext, input: JobInput<Record<string, unknown>>) => {\n const { unit, tag, environment } = input;\n this.received.push({ stage: \"decide\", tag, environment });\n const decision: Decision = this.published.has(`${unit.packageName}@${unit.version}`)\n ? { action: \"none\", status: `${unit.packageName}@${unit.version} is published` }\n : { action: \"ship\", kind: \"publish\", jobs: this.jobs(input) };\n return Promise.resolve(decision);\n };\n\n live = (_context: DecideContext, { unit }: JobInput<Record<string, unknown>>) =>\n Promise.resolve(this.published.has(`${unit.packageName}@${unit.version}`));\n\n requirements = () => this.needs;\n}\n\n/** The Fake as a config holds an adapter; `.fake` is what a test seeds and reads. */\nexport const packageRegistryFake = (\n fake = new PackageRegistryFake(),\n): DeliveryAdapter<PackageRegistryPort> & { fake: PackageRegistryFake } => ({\n name: \"fake\",\n capability: \"package-registry\",\n settings: PackageSettings,\n typicalMinutes: 1,\n requirements: () => fake.requirements(),\n create: () => fake,\n fake,\n});\n"],"mappings":";;;;;AAkCA,IAAa,oBAAb,MAA4D;CAC1D,QAA6B;EAC3B,UAAU;GAAE,QAAQ;GAAQ,MAAM;GAAQ,YAAY;GAAQ;EAC9D,OAAO;EACP,MAAM,EAAE;EACR,gBAAgB,EAAE;EAClB,OAAO,EAAE;EACT,OAAO,EAAE;EACT,SAAS,EAAE;EACX,SAAS,EAAE;EACZ;CAED,WAAmC,EAAE;CACrC,WAA+E,EAAE;CAEjF,KAAK,OAA6B;AAChC,OAAK,QAAQ;GAAE,GAAG,KAAK;GAAO,GAAG;GAAO;AACxC,SAAO;;;CAIT,OAAO,MAA2B,KAAa,OAAc;AAC3D,OAAK,SAAS,KAAK;GAAE;GAAM;GAAK;GAAO,CAAC;AACxC,SAAO;;CAGT,OAAe,OAAoB;AACjC,OAAK,SAAS,KAAK,MAAM;EACzB,MAAM,QAAQ,KAAK,SAAS,QAAQ,EAAE,WAAW,SAAS,MAAM,KAAK,CAAC;EACtE,MAAM,UAAU,KAAK,SAAS,MAAM,EAAE,MAAM,UAAU,SAAS,MAAM,QAAQ,QAAQ,MAAM;AAC3F,SAAO,UAAU,QAAQ,OAAO,QAAQ,MAAM,GAAG,QAAQ,SAAS;;CAGpE,iBAAiB,QAAQ,QAAQ,KAAK,MAAM,SAAS;CACrD,gBAAgB,QAAQ,QAAQ,KAAK,MAAM,MAAM;CACjD,aAAa,QAAgB,QAAQ,QAAQ,KAAK,MAAM,KAAK,QAAQ,KAAK;CAC1E,iBAAiB,KAAa,WAAmB,YAC/C,Q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