shiplane 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,8 +45,24 @@ const expandPatterns = (from, patterns) => {
45
45
  };
46
46
  //#endregion
47
47
  //#region src/domain/tags.ts
48
+ /** Tag formats a config can name instead of writing one out. */
49
+ const TAG_FORMATS = {
50
+ /** `api@1.2.0`: one tag per unit, as changesets tags a monorepo. */
51
+ package: "{name}@{version}",
52
+ /**
53
+ * `my-plugin--v1.2.0`: an agent plugin's tag. Claude Code resolves versions from it; Gemini CLI and
54
+ * Codex install from any tag, so one tag serves all three.
55
+ */
56
+ plugin: "{name}--v{version}",
57
+ /** `v1.2.0`: a repository that releases one unit, the most common tag there is. */
58
+ single: "v{version}",
59
+ /** `api/v1.2.0`: a tag per folder, as Go requires for a module below the repository root. */
60
+ module: "{name}/v{version}"
61
+ };
48
62
  /** How a tag names a unit's version unless the config says otherwise. */
49
- const DEFAULT_TAG_FORMAT = "{name}@{version}";
63
+ const DEFAULT_TAG_FORMAT = TAG_FORMATS.package;
64
+ /** A format's name resolved to the format; anything else is a format already. */
65
+ const tagFormatNamed = (format) => Object.hasOwn(TAG_FORMATS, format) ? TAG_FORMATS[format] : format;
50
66
  /** A unit's tag for a version, through a format like `v{version}` or `{name}--v{version}`. */
51
67
  const tagName = (app, version, format = DEFAULT_TAG_FORMAT) => format.replaceAll("{name}", app).replaceAll("{version}", version);
52
68
  /**
@@ -350,6 +366,6 @@ const deployEstimate = (items, measured, typical) => {
350
366
  };
351
367
  };
352
368
  //#endregion
353
- export { changelogSection as C, tagName as D, releaseTags as E, expandPatterns as O, cameWithRelease as S, isReleaseSubject 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 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, firstRelease as w, DEFAULT_TAG_FORMAT as x, releaseSource as y };
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 };
354
370
 
355
- //# sourceMappingURL=budget-BqtW-Ekk.js.map
371
+ //# sourceMappingURL=budget-CTjB1v-Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget-CTjB1v-Z.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 = 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 = 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 = 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","const 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","import { isReleaseSubject } from \"./tags\";\nimport { nextPatch } from \"./versions\";\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/** 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\nexport interface UnreleasedApp {\n /** The unit's name. */\n app: string;\n version: string;\n /** Subjects of the commits that touched it since its current version, newest first. */\n commits: string[];\n}\n\n/** Apps that changed since their current version came out, with no changeset to ship it. */\nexport const unreleasedApps = (\n history: UnreleasedApp[],\n named: ReadonlySet<string>,\n): UnreleasedApp[] =>\n history\n .map((entry) => ({\n ...entry,\n commits: entry.commits.filter((subject) => !isReleaseSubject(subject)),\n }))\n .filter(({ app, commits }) => commits.length > 0 && !named.has(app));\n\nconst USER_FACING = /^(feat|fix|perf)(\\(.+?\\))?!?:/;\n\n// Commit subjects here are written as user value already: drop the type, scope and PR number.\nconst asSentence = (subject: string) => {\n const text = subject\n .replace(/^\\w+(\\(.+?\\))?!?:\\s*/, \"\")\n .replace(/\\s*\\(#\\d+\\)$/, \"\")\n .trim();\n const sentence = `${text.charAt(0).toUpperCase()}${text.slice(1)}`;\n return /[.!?]$/.test(sentence) ? sentence : `${sentence}.`;\n};\n\n/**\n * The patch changesets the release writes for an unreleased app the person picked: one changelog\n * line per feature or fix since its release, or its latest commit when there are only chores.\n */\nexport const unreleasedChangesets = (\n { name: app, packageName }: UnitRef,\n version: string,\n commits: string[],\n): PlannedChangeset[] => {\n const userFacing = commits.filter((commit) => USER_FACING.test(commit));\n const lines = userFacing.length > 0 ? userFacing : commits.slice(0, 1);\n return lines.map((subject, index) => ({\n id: `${app}-${nextPatch(version)}-${index + 1}`,\n releases: [{ name: packageName, type: \"patch\" }],\n summary: asSentence(subject),\n }));\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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AAQ,OAAO;EAC/F,QAAQ,GAAG,OAAO,KAAK,CAAC,MAAM,OAAO,SAAS,CAAC,UAAU,KAAK,MAAO,OAAO,WAAY,IAAI,CAAC;EAC7F,MACE,YAAY,WACR,GAAG,KAAK,aAAa,OAAO,SAAS,CAAC,mCACtC,GAAG,KAAK,eAAe,OAAO,SAAS,CAAC;EAC9C,QAAQ,OAAO;EACf,OACE,QAAQ,IACJ,uBAAuB,MAAM,wBAAwB,OAAO,UAAU,CAAC,kBACvE;EACP;;;AAIH,MAAa,iBAAiB,SAC5B,KAAK,QAAQ,KAAK,EAAE,WAAW,kBAAkB;AAC/C,KAAI,CAAC,aAAa,CAAC,YAAa,QAAO;CACvC,MAAM,WAAW,KAAK,MAAM,YAAY,GAAG,KAAK,MAAM,UAAU,IAAI;AACpE,QAAO,MAAM,KAAK,IAAI,GAAG,KAAK,KAAK,UAAU,GAAG,CAAC;GAChD,EAAE;AAGP,MAAM,mBAAmB;;;;;AAMzB,MAAa,kBACX,OACA,UACA,YACG;CACH,MAAM,QAAQ,MACX,QAAQ,EAAE,WAAW,SAAS,QAAQ,CACtC,KAAK,EAAE,UAAU;EAChB,MAAM,OAAO,SAAS,QAAQ,EAAE;AAChC,SAAO,KAAK,SAAS,IACjB;GAAE;GAAK,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-YTZXH_Hh.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-Bo7hpUT3.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";
@@ -9,6 +9,35 @@ declare const perEnv: <Value extends z.ZodType>(value: Value) => z.ZodUnion<read
9
9
  }, z.core.$strict>]>;
10
10
  type PerEnv<Value> = Value | Record<Environment, Value>;
11
11
  //#endregion
12
+ //#region src/domain/tags.d.ts
13
+ /** Tag formats a config can name instead of writing one out. */
14
+ declare const TAG_FORMATS: {
15
+ /** `api@1.2.0`: one tag per unit, as changesets tags a monorepo. */readonly package: "{name}@{version}";
16
+ /**
17
+ * `my-plugin--v1.2.0`: an agent plugin's tag. Claude Code resolves versions from it; Gemini CLI and
18
+ * Codex install from any tag, so one tag serves all three.
19
+ */
20
+ readonly plugin: "{name}--v{version}"; /** `v1.2.0`: a repository that releases one unit, the most common tag there is. */
21
+ readonly single: "v{version}"; /** `api/v1.2.0`: a tag per folder, as Go requires for a module below the repository root. */
22
+ readonly module: "{name}/v{version}";
23
+ };
24
+ type TagFormatName = keyof typeof TAG_FORMATS;
25
+ /** How a tag names a unit's version unless the config says otherwise. */
26
+ declare const DEFAULT_TAG_FORMAT: "{name}@{version}";
27
+ /** A unit's tag for a version, through a format like `v{version}` or `{name}--v{version}`. */
28
+ declare const tagName: (app: string, version: string, format?: "{name}@{version}") => string;
29
+ interface ReleaseTag {
30
+ /** The unit's name. */
31
+ app: string;
32
+ version: string;
33
+ tag: string;
34
+ sha: string;
35
+ needsTag: boolean;
36
+ needsNotes: boolean;
37
+ }
38
+ /** A release pull request's subject: `chore(api): release v0.0.4`, or `chore(release): ...` for several. */
39
+ declare const isReleaseSubject: (subject: string) => boolean;
40
+ //#endregion
12
41
  //#region src/modules/module.d.ts
13
42
  /** What a module's per-app stages are told: the app, its tag, its settings for that environment. */
14
43
  type AppInput = JobInput<Record<string, unknown>>;
@@ -112,8 +141,10 @@ interface ReleaseConfig {
112
141
  modules: ReleaseModule[];
113
142
  /** What happens around a release, after the ship, in this order. */
114
143
  features?: Feature[];
115
- /** How a tag names a version: `{name}@{version}` when absent, or e.g. `v{version}`, `{name}--v{version}`. */
116
- tag?: string;
144
+ /**
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
+ */
147
+ tag?: TagFormatName | (string & {});
117
148
  /**
118
149
  * A unit whose folder changed with no changeset naming it: `"ignore"` (the default, as changesets
119
150
  * does) leaves it, `"release"` offers it with a changelog from its commits.
@@ -210,5 +241,5 @@ declare const webApp: ({
210
241
  type ShellServerHostingAdapter = DeliveryAdapter<ServerHostingPort>;
211
242
  declare const shellServerHosting: () => ShellServerHostingAdapter;
212
243
  //#endregion
213
- export { perEnv as C, PerEnv as S, FollowUp as _, mobileApp as a, ReleaseModule as b, releaseFlow as c, defineServerHosting as d, defineStaticHosting as f, Feature as g, AfterShipContext as h, publishedPackage as i, defineMobileDistribution as l, defineRelease as m, shellServerHosting as n, internalTool as o, ReleaseConfig as p, webApp as r, backendService as s, z$1 as t, definePackageRegistry as u, Open as v, Shipped as x, ReleaseFlow as y };
214
- //# sourceMappingURL=index-D4qsXAis.d.ts.map
244
+ export { ReleaseTag as C, tagName as D, isReleaseSubject as E, PerEnv as O, DEFAULT_TAG_FORMAT as S, TagFormatName as T, FollowUp as _, mobileApp as a, ReleaseModule as b, releaseFlow as c, defineServerHosting as d, defineStaticHosting as f, Feature as g, AfterShipContext as h, publishedPackage as i, perEnv as k, defineMobileDistribution as l, defineRelease as m, shellServerHosting as n, internalTool as o, ReleaseConfig as p, webApp as r, backendService as s, z$1 as t, definePackageRegistry as u, Open as v, TAG_FORMATS as w, Shipped as x, ReleaseFlow as y };
245
+ //# sourceMappingURL=index-oKnmZ8qV.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
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 { C as perEnv, S as PerEnv, a as mobileApp, b as ReleaseModule, c as releaseFlow, d as defineServerHosting, f as defineStaticHosting, g as Feature, i as publishedPackage, l as defineMobileDistribution, m as defineRelease, n as shellServerHosting, o as internalTool, p as ReleaseConfig, r as webApp, s as backendService, t as z, u as definePackageRegistry, y as ReleaseFlow } from "./index-D4qsXAis.js";
2
+ import { O as PerEnv, a as mobileApp, b as ReleaseModule, c as releaseFlow, d as defineServerHosting, f as defineStaticHosting, g as Feature, i as publishedPackage, k as perEnv, l as defineMobileDistribution, m as defineRelease, n as shellServerHosting, o as internalTool, p as ReleaseConfig, r as webApp, s as backendService, t as z, u as definePackageRegistry, y as ReleaseFlow } from "./index-oKnmZ8qV.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, backendService, defineMobileDistribution, definePackageRegistry, defineRelease, defineServerHosting, defineStaticHosting, internalTool, mobileApp, perEnv, publishedPackage, releaseFlow, shellServerHosting, webApp, z };
package/dist/plugin.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { A as releaseSource, B as LinkedPr, F as ShellResult, I as CiPipelinePort, J as onlyVersionFiles, K as deployRunTitle, L as CodeHostPort, M as CommandFailed, O as SourceControlPort, P as Shell, R as Deploy, U as actionsMinutes, V as issueName, W as billedMinutes, _ as Refusal, a as VersioningPort, b as VersionChoice, c as DeliveryAdapter, ct as ReleaseUnit, d as DecideContext, dt as MascotMoment, f as Decision, g as JobInput, h as Job, i as MobileDistributionPort, j as yesAllowed, k as GitPosition, l as ServiceAdapter, m as Health, mt as Environment, n as ServerHostingPort, nt as PlannedChangeset, o as Adapter, ot as appBumps, pt as progressBar, q as deployState, r as PackageRegistryPort, rt as StatusPlan, s as AdapterContext, t as StaticHostingPort, tt as AppBump, u as Command, ut as Mascot, v as Requirement, y as Resolved, z as IssueRef } from "./static-hosting.port-mknLsxwR.js";
2
- import { C as perEnv, S as PerEnv, _ as FollowUp, a as mobileApp, b as ReleaseModule, c as releaseFlow, d as defineServerHosting, f as defineStaticHosting, g as Feature, h as AfterShipContext, i as publishedPackage, l as defineMobileDistribution, m as defineRelease, n as shellServerHosting, o as internalTool, p as ReleaseConfig, r as webApp, s as backendService, t as z, u as definePackageRegistry, x as Shipped, y as ReleaseFlow } from "./index-D4qsXAis.js";
3
- import { i as tagName, r as isReleaseSubject, t as DEFAULT_TAG_FORMAT } from "./tags-Bn3JrgPI.js";
2
+ import { D as tagName, E as isReleaseSubject, O as PerEnv, S as DEFAULT_TAG_FORMAT, T as TagFormatName, _ as FollowUp, a as mobileApp, b as ReleaseModule, c as releaseFlow, d as defineServerHosting, f as defineStaticHosting, g as Feature, h as AfterShipContext, i as publishedPackage, k as perEnv, l as defineMobileDistribution, m as defineRelease, n as shellServerHosting, o as internalTool, p as ReleaseConfig, r as webApp, s as backendService, t as z, u as definePackageRegistry, w as TAG_FORMATS, x as Shipped, y as ReleaseFlow } from "./index-oKnmZ8qV.js";
4
3
 
5
4
  //#region src/domain/versions.d.ts
6
5
  /** Negative, zero or positive, like a sort comparator: "0.1.10" is after "0.1.9". */
@@ -20,5 +19,5 @@ declare const workspacePatterns: (from: string | WorkspaceReader) => string[];
20
19
  /** Folders matching `dir/*` or an exact path, sorted. Negations and deeper globs are skipped. */
21
20
  declare const expandPatterns: (from: string | WorkspaceReader, patterns: readonly string[]) => string[];
22
21
  //#endregion
23
- export { Adapter, AdapterContext, type AfterShipContext, type AppBump, CiPipelinePort, CodeHostPort, type Command, CommandFailed, DEFAULT_TAG_FORMAT, type DecideContext, type Decision, DeliveryAdapter, type Deploy, Environment, Feature, type FollowUp, type GitPosition, type Health, type IssueRef, type Job, type JobInput, type LinkedPr, Mascot, MascotMoment, MobileDistributionPort, PackageRegistryPort, PerEnv, type PlannedChangeset, type Refusal, ReleaseConfig, ReleaseFlow, ReleaseModule, ReleaseUnit, type Requirement, type Resolved, ServerHostingPort, ServiceAdapter, type Shell, type ShellResult, type Shipped, SourceControlPort, StaticHostingPort, type StatusPlan, type VersionChoice, VersioningPort, actionsMinutes, appBumps, backendService, billedMinutes, compareVersions, defineMobileDistribution, definePackageRegistry, defineRelease, defineServerHosting, defineStaticHosting, deployRunTitle, deployState, expandPatterns, internalTool, isReleaseSubject, issueName, mobileApp, nextPatch, onlyVersionFiles, perEnv, progressBar, publishedPackage, releaseFlow, releaseSource, shellServerHosting, tagName, webApp, workspacePatterns, yesAllowed, z };
22
+ export { Adapter, AdapterContext, type AfterShipContext, type AppBump, CiPipelinePort, CodeHostPort, type Command, CommandFailed, DEFAULT_TAG_FORMAT, type DecideContext, type Decision, DeliveryAdapter, type Deploy, Environment, Feature, type FollowUp, type GitPosition, type Health, type IssueRef, type Job, type JobInput, type LinkedPr, Mascot, MascotMoment, MobileDistributionPort, PackageRegistryPort, PerEnv, type PlannedChangeset, type Refusal, ReleaseConfig, ReleaseFlow, ReleaseModule, ReleaseUnit, type Requirement, type Resolved, ServerHostingPort, ServiceAdapter, type Shell, type ShellResult, type Shipped, SourceControlPort, StaticHostingPort, type StatusPlan, TAG_FORMATS, type TagFormatName, type VersionChoice, VersioningPort, actionsMinutes, appBumps, backendService, billedMinutes, compareVersions, defineMobileDistribution, definePackageRegistry, defineRelease, defineServerHosting, defineStaticHosting, deployRunTitle, deployState, expandPatterns, internalTool, isReleaseSubject, issueName, mobileApp, nextPatch, onlyVersionFiles, perEnv, progressBar, publishedPackage, releaseFlow, releaseSource, shellServerHosting, tagName, webApp, workspacePatterns, yesAllowed, z };
24
23
  //# sourceMappingURL=plugin.d.ts.map
package/dist/plugin.js CHANGED
@@ -2,7 +2,7 @@ import { t as perEnv } from "./perEnv-B7AiYnW_.js";
2
2
  import { n as internalTool, r as defineRelease, t as z } from "./src-CGASfBy2.js";
3
3
  import { a as defineStaticHosting, i as defineServerHosting, n as defineMobileDistribution, r as definePackageRegistry, t as shellServerHosting } from "./shell-server-hosting.adapter-DobfDqFm.js";
4
4
  import { a as releaseFlow, i as backendService, n as publishedPackage, r as mobileApp, t as webApp } from "./web-app.module-6KrXIU7j.js";
5
- import { D as tagName, O as expandPatterns, T as isReleaseSubject, _ as compareVersions, a as CommandFailed, b as yesAllowed, c as onlyVersionFiles, d as appBumps, k as workspacePatterns, n as billedMinutes, o as deployRunTitle, s as deployState, t as actionsMinutes, v as nextPatch, x as DEFAULT_TAG_FORMAT, y as releaseSource } from "./budget-BqtW-Ekk.js";
5
+ import { A as expandPatterns, E as isReleaseSubject, S as TAG_FORMATS, _ as compareVersions, a as CommandFailed, b as yesAllowed, c as onlyVersionFiles, d as appBumps, j as workspacePatterns, k as tagName, n as billedMinutes, o as deployRunTitle, s as deployState, t as actionsMinutes, v as nextPatch, x as DEFAULT_TAG_FORMAT, y as releaseSource } from "./budget-CTjB1v-Z.js";
6
6
  import { t as progressBar } from "./display-IqkJ6uCw.js";
7
7
  import { t as issueName } from "./issues-TcWtMTv5.js";
8
- export { CommandFailed, DEFAULT_TAG_FORMAT, actionsMinutes, appBumps, backendService, billedMinutes, compareVersions, defineMobileDistribution, definePackageRegistry, defineRelease, defineServerHosting, defineStaticHosting, deployRunTitle, deployState, expandPatterns, internalTool, isReleaseSubject, issueName, mobileApp, nextPatch, onlyVersionFiles, perEnv, progressBar, publishedPackage, releaseFlow, releaseSource, shellServerHosting, tagName, webApp, workspacePatterns, yesAllowed, z };
8
+ export { CommandFailed, DEFAULT_TAG_FORMAT, TAG_FORMATS, actionsMinutes, appBumps, backendService, billedMinutes, compareVersions, defineMobileDistribution, definePackageRegistry, defineRelease, defineServerHosting, defineStaticHosting, deployRunTitle, deployState, expandPatterns, internalTool, isReleaseSubject, issueName, mobileApp, nextPatch, onlyVersionFiles, perEnv, progressBar, publishedPackage, releaseFlow, releaseSource, shellServerHosting, tagName, webApp, workspacePatterns, yesAllowed, z };
@@ -1,5 +1,5 @@
1
1
  import { a as releaseFlow, i as backendService, n as publishedPackage, r as mobileApp, t as webApp } from "./web-app.module-6KrXIU7j.js";
2
- import { C as changelogSection, D as tagName, E as releaseTags, O as expandPatterns, S as cameWithRelease, a as CommandFailed, c as onlyVersionFiles, d as appBumps, f as changesetApps, g as unreleasedChangesets, h as unreleasedApps, i as minutesBudget, k as workspacePatterns, l as shipsFrom, m as splitChangesets, o as deployRunTitle, p as packageBumps, r as deployEstimate, u as webShip, w as firstRelease, x as DEFAULT_TAG_FORMAT, y as releaseSource } from "./budget-BqtW-Ekk.js";
2
+ import { A as expandPatterns, C as cameWithRelease, D as releaseTags, O as tagFormatNamed, S as TAG_FORMATS, T as firstRelease, a as CommandFailed, c as onlyVersionFiles, d as appBumps, f as changesetApps, g as unreleasedChangesets, h as unreleasedApps, i as minutesBudget, j as workspacePatterns, k as tagName, l as shipsFrom, m as splitChangesets, o as deployRunTitle, p as packageBumps, r as deployEstimate, u as webShip, w as changelogSection, x as DEFAULT_TAG_FORMAT, y as releaseSource } from "./budget-CTjB1v-Z.js";
3
3
  import { z } from "zod";
4
4
  import { styleText } from "node:util";
5
5
  import fs from "node:fs";
@@ -1119,8 +1119,12 @@ const checkModules = (modules, features) => {
1119
1119
  };
1120
1120
  const tagFormatOf = (tag) => {
1121
1121
  if (tag === void 0) return DEFAULT_TAG_FORMAT;
1122
- if (typeof tag !== "string" || !tag.includes("{version}")) throw new Error("tag must name the version, such as tag: \"v{version}\"");
1123
- return tag;
1122
+ const format = typeof tag === "string" ? tagFormatNamed(tag) : void 0;
1123
+ if (!format?.includes("{version}")) {
1124
+ const names = Object.keys(TAG_FORMATS).map((name) => `"${name}"`).join(", ");
1125
+ throw new Error(`tag is one of ${names}, or a format naming the version, such as "v{version}"`);
1126
+ }
1127
+ return format;
1124
1128
  };
1125
1129
  const releasesCommitsOf = (choice) => {
1126
1130
  if (choice === void 0 || choice === "ignore") return false;
@@ -1259,6 +1263,11 @@ const loadRelease = async (root, options = {}) => {
1259
1263
  problems.push(...referenceProblems(entry, ordered));
1260
1264
  entry.unit.after = [...new Set(referencesIn(entry.unit.options).map(({ unit }) => unit))].filter((name) => name !== entry.unit.name && ordered.some(({ unit }) => unit.name === name));
1261
1265
  });
1266
+ if (ordered.length > 1 && !config.tagFormat.includes("{name}")) problems.push({
1267
+ file: path.basename(configFile),
1268
+ message: `tag "${config.tagFormat}" names no unit, so ${ordered.length} units would share each tag`,
1269
+ hint: "add {name} to the format, such as \"{name}--v{version}\", or release one unit"
1270
+ });
1262
1271
  return {
1263
1272
  root,
1264
1273
  flow: config.flow,
@@ -2723,7 +2732,7 @@ const shipTo = async (context, environment, { scope, via }) => {
2723
2732
  environment
2724
2733
  })));
2725
2734
  if (runs.length > 0) output.line(` ${paint("cyan", "gh run list --limit 5")}`);
2726
- output.line(` ${paint("cyan", `shiplane status --channel ${environment}`)}`);
2735
+ if (going.some(({ module }) => module.kind !== "published-package")) output.line(` ${paint("cyan", `shiplane status --channel ${environment}`)}`);
2727
2736
  output.line();
2728
2737
  return !stuck;
2729
2738
  };
@@ -3786,4 +3795,4 @@ const readStatus = async (context, environment) => {
3786
3795
  //#endregion
3787
3796
  export { refreshEditorSchema as C, nodeFiles as D, keysAt as E, CONFIG_FILE as S, ENVIRONMENTS as T, loadRelease as _, releaseToPreview as a, initRelease as b, promote as c, pickScope as d, openReleasePr as f, findConfig as g, docsFor as h, setup as i, shipTo as l, newAdapter as m, systemShell as n, missingTags as o, prepareRelease as p, liveLine as r, tagRelease as s, readStatus as t, planShips as u, addUnit as v, optionsFor as w, doctor as x, removeUnit as y };
3788
3797
 
3789
- //# sourceMappingURL=readStatus-YTZXH_Hh.js.map
3798
+ //# sourceMappingURL=readStatus-Bo7hpUT3.js.map