@reelout/core 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/analyzer.js CHANGED
@@ -1,4 +1,4 @@
1
- import { h as resolvePackageTag, lt as deriveTransitionReleases, m as propagateDependencyUpdates, p as readPackageHistory, s as version, ut as deriveChangeReleases } from "./workflow-BolfadM0.js";
1
+ import { _ as resolvePackageTag, dt as deriveTransitionReleases, ft as deriveChangeReleases, g as propagateDependencyUpdates, h as readPackageHistory, l as version } from "./workflow-BkjKac2I.js";
2
2
  // src/analyzer.ts
3
3
  /**
4
4
  * Built-in plugin that inspects repository history and produces release plans for packages.
package/dist/builder.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as generateGitTagName, Ut as bumpVersion, d as buildReleaseNotes, g as resolvePackageStableTag, p as readPackageHistory, s as version, zt as isSameReleaseCycle } from "./workflow-BolfadM0.js";
1
+ import { M as generateGitTagName, Ut as isSameReleaseCycle, h as readPackageHistory, l as version, p as buildReleaseNotes, qt as bumpVersion, v as resolvePackageStableTag } from "./workflow-BkjKac2I.js";
2
2
  import { t as formatError } from "./formatError-BMsun8Wi.js";
3
3
  import { colors } from "consola/utils";
4
4
  // src/builder.ts
package/dist/changelog.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as HookPriority, c as writeChangelog, f as buildChangelog, h as resolvePackageTag, s as version, v as discoverPackageTag } from "./workflow-BolfadM0.js";
1
+ import { _ as resolvePackageTag, b as discoverPackageTag, l as version, m as buildChangelog, s as HookPriority, u as writeChangelog } from "./workflow-BkjKac2I.js";
2
2
  import { t as formatError } from "./formatError-BMsun8Wi.js";
3
3
  import { colors } from "consola/utils";
4
4
  // src/changelog.ts
package/dist/index.js CHANGED
@@ -1,23 +1,8 @@
1
- import { $ as getCurrentGitCommit, A as generateGitTagName, At as buildTrailerPattern, B as getGitConfigValue, Bt as deriveReleaseType, C as extractPlainText, Ct as isClass, D as getLatestGitTag, Dt as execCommand, E as isGitTagConnected, Et as execGit, F as readGitFile, Ft as RELEASE_HOOK_NAMES, G as GIT_REL_FLAGS, H as readParsedGitHistory, Ht as deriveCommitReleaseType, I as resolveGitRepository, It as SEMVER_REGEX, J as resolveGitRevision, K as detectGitRelationship, L as pushGitChanges, Lt as promotePrereleaseVersions, M as isGitTagPresent, Mt as DEFAULT_CHANGELOG_FILE, N as deleteGitTag, Nt as DEV_NULL, O as getGitTagMessage, Ot as compact, P as createGitTag, Pt as GIT_TRAILER_RELEASE_AGENT, Q as countGitHistory, R as getGitRemote, Rt as isStableVersion, S as extractSemVer, St as isMatch, T as isGitTagExact, Tt as formatFile, U as readGitHistory, Ut as bumpVersion, V as restoreFullGitHistory, Vt as pickPriorityReleaseType, W as mergeGitHistory, Wt as extractVersionQualifier, X as withShallowLock, Y as isGitAncestor, Z as isGitShallowRepository, _ as filterPackages, _t as findReleaseRule, a as HookPriority, at as TTLCache, b as extractLatestVersion, bt as unique, c as writeChangelog, ct as getCurrentGitBranch, d as buildReleaseNotes, dt as packageContainsCommit, et as getParsedGitCommit, f as buildChangelog, ft as resolveVersionQualifier, g as resolvePackageStableTag, gt as isSemVer, h as resolvePackageTag, ht as isSemVerGitTag, i as HookManager, it as parseGitCommit, j as ensureGitTag, jt as ALL_FILES, k as getCurrentGitTag, kt as isDefined, l as prependChangelog, lt as deriveTransitionReleases, m as propagateDependencyUpdates, mt as sanitizePrereleaseLabel, n as printReleaseReport, nt as GIT_PRETTY_FORMAT, o as generateReleaseCommitMessage, ot as extractMentions, p as readPackageHistory, pt as resolveReleaseChannel, q as expandGitHistory, r as generateReleaseReport, rt as parseGitPrettyFormat, st as createGitCommit, t as executeReleaseWorkflow, tt as GIT_PRETTY_FIELD_SEPARATOR, u as extractPreviousVersion, ut as deriveChangeReleases, v as discoverPackageTag, vt as createPlugin, w as buildDependencyGraph, wt as interpolate, x as iterateChangelogVersions, xt as readJson, y as verifyPackageTag, yt as writeJson, z as ensureGitUserConfig, zt as isSameReleaseCycle } from "./workflow-BolfadM0.js";
1
+ import { $ as isGitShallowRepository, A as getGitTagMessage, At as execGit, B as getGitRemote, Bt as SEMVER_REGEX, C as iterateChangelogVersions, Ct as readJson, D as isGitTagExact, Dt as isTruthyString, E as buildDependencyGraph, Et as isClass, F as deleteGitTag, Ft as ALL_FILES, G as readGitHistory, Gt as pickPriorityReleaseType, H as getGitConfigValue, Ht as isStableVersion, I as createGitTag, It as DEFAULT_CHANGELOG_FILE, J as detectGitRelationship, Jt as extractVersionQualifier, K as mergeGitHistory, Kt as deriveCommitReleaseType, L as readGitFile, Lt as DEV_NULL, M as generateGitTagName, Mt as compact, N as ensureGitTag, Nt as isDefined, O as isGitTagConnected, Ot as interpolate, P as isGitTagPresent, Pt as buildTrailerPattern, Q as withShallowLock, R as resolveGitRepository, Rt as GIT_TRAILER_RELEASE_AGENT, S as extractLatestVersion, St as unique, T as extractPlainText, Tt as isGitHubActions, U as restoreFullGitHistory, Ut as isSameReleaseCycle, V as ensureGitUserConfig, Vt as promotePrereleaseVersions, W as readParsedGitHistory, Wt as deriveReleaseType, X as resolveGitRevision, Y as expandGitHistory, Z as isGitAncestor, _ as resolvePackageTag, _t as isSemVerGitTag, a as appendReleaseReportSummary, at as parseGitPrettyFormat, b as discoverPackageTag, bt as createPlugin, c as generateReleaseCommitMessage, ct as extractMentions, d as prependChangelog, dt as deriveTransitionReleases, et as countGitHistory, f as extractPreviousVersion, ft as deriveChangeReleases, g as propagateDependencyUpdates, gt as sanitizePrereleaseLabel, h as readPackageHistory, ht as resolveReleaseChannel, i as generateReleaseReport, it as GIT_PRETTY_FORMAT, j as getCurrentGitTag, jt as execCommand, k as getLatestGitTag, kt as formatFile, lt as createGitCommit, m as buildChangelog, mt as resolveVersionQualifier, n as printReleaseReportAnnotation, nt as getParsedGitCommit, o as HookManager, ot as parseGitCommit, p as buildReleaseNotes, pt as packageContainsCommit, q as GIT_REL_FLAGS, qt as bumpVersion, r as printReleaseReport, rt as GIT_PRETTY_FIELD_SEPARATOR, s as HookPriority, st as TTLCache, t as executeReleaseWorkflow, tt as getCurrentGitCommit, u as writeChangelog, ut as getCurrentGitBranch, v as resolvePackageStableTag, vt as isSemVer, w as extractSemVer, wt as isMatch, x as verifyPackageTag, xt as writeJson, y as filterPackages, yt as findReleaseRule, z as pushGitChanges, zt as RELEASE_HOOK_NAMES } from "./workflow-BkjKac2I.js";
2
2
  import { t as formatError } from "./formatError-BMsun8Wi.js";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
5
  import { pathToFileURL } from "node:url";
6
- // src/util/isTruthyString.ts
7
- /**
8
- * Determine whether a string value represents a truthy boolean.
9
- *
10
- * Trims leading and trailing whitespace and coerces the target string to
11
- * lowercase. Evaluates the string as truthy if it equals `'true'` or `'1'`.
12
- *
13
- * @param value The raw string to evaluate
14
- * @returns `true` if `value` normalizes to `'true'` or `'1'`, otherwise `false`
15
- */
16
- function isTruthyString(value) {
17
- if (!value) return false;
18
- const normalized = value.toLowerCase().trim();
19
- return normalized === "true" || normalized === "1";
20
- }
21
6
  // src/util/isCI.ts
22
7
  /**
23
8
  * Determine whether the current process is running in a CI environment.
@@ -191,6 +176,6 @@ function sortPackages(packages) {
191
176
  }
192
177
  return packageNodes.toSorted((a, b) => b.level - a.level).map((node) => node.package);
193
178
  }
194
- export { ALL_FILES, DEFAULT_CHANGELOG_FILE, DEV_NULL, GIT_PRETTY_FIELD_SEPARATOR, GIT_PRETTY_FORMAT, GIT_REL_FLAGS, GIT_TRAILER_RELEASE_AGENT, HookManager, HookPriority, RELEASE_HOOK_NAMES, SEMVER_REGEX, TTLCache, buildChangelog, buildDependencyGraph, buildReleaseNotes, buildTrailerPattern, bumpVersion, compact, countGitHistory, createGitCommit, createGitTag, createPlugin, deleteGitTag, deriveChangeReleases, deriveCommitReleaseType, deriveReleaseType, deriveTransitionReleases, detectGitRelationship, discoverPackageTag, ensureGitTag, ensureGitUserConfig, execCommand, execGit, executeReleaseWorkflow, expandGitHistory, extractLatestVersion, extractMentions, extractPlainText, extractPreviousVersion, extractSemVer, extractVersionQualifier, filterPackages, findReleaseRule, formatError, formatFile, generateGitTagName, generateReleaseCommitMessage, generateReleaseReport, getCurrentGitBranch, getCurrentGitCommit, getCurrentGitTag, getGitConfigValue, getGitRemote, getGitTagMessage, getLatestGitTag, getParsedGitCommit, interpolate, isCI, isClass, isDefined, isGitAncestor, isGitShallowRepository, isGitTagConnected, isGitTagExact, isGitTagPresent, isMatch, isQuietEnvironment, isSameReleaseCycle, isSemVer, isSemVerGitTag, isStableVersion, isTruthyString, iterateChangelogVersions, mergeGitHistory, normalizeCommitFilter, normalizeReleaseRule, normalizeWorkspace, packageContainsCommit, parseGitCommit, parseGitPrettyFormat, pickPriorityReleaseType, prependChangelog, printReleaseReport, promotePrereleaseVersions, propagateDependencyUpdates, pushGitChanges, readGitFile, readGitHistory, readJson, readPackageHistory, readParsedGitHistory, resolveGitRepository, resolveGitRevision, resolvePackageStableTag, resolvePackageTag, resolvePlugin, resolveReleaseChannel, resolveVersionQualifier, restoreFullGitHistory, sanitizePrereleaseLabel, sortPackages, unique, verifyPackageTag, withShallowLock, writeChangelog, writeJson };
179
+ export { ALL_FILES, DEFAULT_CHANGELOG_FILE, DEV_NULL, GIT_PRETTY_FIELD_SEPARATOR, GIT_PRETTY_FORMAT, GIT_REL_FLAGS, GIT_TRAILER_RELEASE_AGENT, HookManager, HookPriority, RELEASE_HOOK_NAMES, SEMVER_REGEX, TTLCache, appendReleaseReportSummary, buildChangelog, buildDependencyGraph, buildReleaseNotes, buildTrailerPattern, bumpVersion, compact, countGitHistory, createGitCommit, createGitTag, createPlugin, deleteGitTag, deriveChangeReleases, deriveCommitReleaseType, deriveReleaseType, deriveTransitionReleases, detectGitRelationship, discoverPackageTag, ensureGitTag, ensureGitUserConfig, execCommand, execGit, executeReleaseWorkflow, expandGitHistory, extractLatestVersion, extractMentions, extractPlainText, extractPreviousVersion, extractSemVer, extractVersionQualifier, filterPackages, findReleaseRule, formatError, formatFile, generateGitTagName, generateReleaseCommitMessage, generateReleaseReport, getCurrentGitBranch, getCurrentGitCommit, getCurrentGitTag, getGitConfigValue, getGitRemote, getGitTagMessage, getLatestGitTag, getParsedGitCommit, interpolate, isCI, isClass, isDefined, isGitAncestor, isGitHubActions, isGitShallowRepository, isGitTagConnected, isGitTagExact, isGitTagPresent, isMatch, isQuietEnvironment, isSameReleaseCycle, isSemVer, isSemVerGitTag, isStableVersion, isTruthyString, iterateChangelogVersions, mergeGitHistory, normalizeCommitFilter, normalizeReleaseRule, normalizeWorkspace, packageContainsCommit, parseGitCommit, parseGitPrettyFormat, pickPriorityReleaseType, prependChangelog, printReleaseReport, printReleaseReportAnnotation, promotePrereleaseVersions, propagateDependencyUpdates, pushGitChanges, readGitFile, readGitHistory, readJson, readPackageHistory, readParsedGitHistory, resolveGitRepository, resolveGitRevision, resolvePackageStableTag, resolvePackageTag, resolvePlugin, resolveReleaseChannel, resolveVersionQualifier, restoreFullGitHistory, sanitizePrereleaseLabel, sortPackages, unique, verifyPackageTag, withShallowLock, writeChangelog, writeJson };
195
180
 
196
181
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/util/isTruthyString.ts","../src/util/isCI.ts","../src/util/isQuietEnvironment.ts","../src/config/normalizeCommitFilter.ts","../src/config/normalizeReleaseRule.ts","../src/config/normalizeWorkspace.ts","../src/config/resolvePlugin.ts","../src/workflow/discovery/sortPackages.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\n/**\n * Determine whether a string value represents a truthy boolean.\n *\n * Trims leading and trailing whitespace and coerces the target string to\n * lowercase. Evaluates the string as truthy if it equals `'true'` or `'1'`.\n *\n * @param value The raw string to evaluate\n * @returns `true` if `value` normalizes to `'true'` or `'1'`, otherwise `false`\n */\nexport function isTruthyString(value: string | undefined): boolean {\n if (!value) return false\n\n const normalized = value.toLowerCase().trim()\n\n return normalized === 'true' || normalized === '1'\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport { isTruthyString } from './isTruthyString'\n\n/**\n * Determine whether the current process is running in a CI environment.\n *\n * Checks if the `CI` environment variable is set to a truthy value. Ignores\n * provider-specific variables such as `GITHUB_ACTIONS` to keep detection\n * generic.\n *\n * @param env Readonly process environment variables object\n * @returns `true` if `env.CI` normalizes to a truthy string, otherwise `false`\n */\nexport function isCI(env: Readonly<NodeJS.ProcessEnv>): boolean {\n return isTruthyString(env.CI)\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseContext } from '../types'\nimport { isCI } from './isCI'\n\n/**\n * Determine whether the current run should stay quiet about verbose output.\n *\n * A run is quiet when nothing will keep what it prints: no terminal is attached\n * for a human, and no CI provider is recording a job log. A plain pipe outside\n * of CI — an agent sandbox, a script capturing output, a detached daemon — only\n * accumulates noise, so verbose output should be withheld and left to\n * `execCommand` for error reporting instead.\n *\n * CI is deliberately *not* quiet even though its streams are not TTYs: the\n * provider persists the job log, so the output does reach someone. A caller\n * that wants output from a pipe in a non-CI environment can set `CI=1` as an\n * escape hatch.\n *\n * The verdict is per environment, not per stream, so a redirected stdout inside\n * an interactive terminal still counts as quiet.\n *\n * @param context Release context carrying the destination stream and environment\n * @returns `true` when no TTY is attached and the run is not part of CI\n */\nexport function isQuietEnvironment(\n context: Pick<ReleaseContext, 'env' | 'stdout'>\n): boolean {\n if (isCI(context.env)) return false\n\n const stream = context.stdout as NodeJS.WriteStream | undefined\n\n return stream?.isTTY !== true\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { CommitClassifier, ReleaseConfig, ReleaseType } from '#types'\n\n/**\n * Normalize a commit classifier into a consistent function.\n *\n * Accepts `null`/`undefined` (returns no-op classifier), a function classifier,\n * or a config object mapping commit types to release types. Returns a classifier\n * function that maps commits to their corresponding release types.\n *\n * @param classifier Commit classifier config, function, or falsy value\n * @returns Normalized classifier function\n */\nexport function normalizeCommitFilter(\n classifier: ReleaseConfig['classifier'] | null | undefined\n): CommitClassifier {\n if (classifier == null) {\n return () => null\n }\n\n if (typeof classifier === 'function') {\n return classifier\n }\n\n const map = new Map(\n Object.entries(classifier).flatMap(([releaseType, commitTypes]) => {\n return commitTypes.map((commitType) => [\n commitType,\n releaseType as ReleaseType,\n ])\n })\n )\n\n return (commit) => (commit.type ? map.get(commit.type) : null)\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseRule, ResolvedReleaseRule } from '#types'\nimport { sanitizePrereleaseLabel } from './sanitizePrereleaseLabel'\n\n/**\n * Normalize a release rule input into a resolved release rule object.\n *\n * Converts `string` shorthand inputs into structured rule objects with sanitized\n * labels. Resolves `versionQualifier` and `releaseChannel` against `pattern`.\n * Returns `null` if `rule` is invalid, falsy, or missing `pattern`.\n *\n * @param rule Raw release rule input, `string` shorthand, or falsy value\n * @returns Resolved `ResolvedReleaseRule` object, or `null` if `rule` is invalid\n */\nexport function normalizeReleaseRule(\n rule: ReleaseRule | string | false | null | undefined\n): ResolvedReleaseRule | null {\n if (typeof rule === 'string') {\n rule = {\n pattern: rule,\n qualifier: sanitizePrereleaseLabel(rule),\n channel: sanitizePrereleaseLabel(rule),\n }\n }\n\n if (typeof rule !== 'object' || rule == null) {\n return null\n }\n\n const { pattern } = rule\n\n if (pattern == null) {\n return null\n }\n\n return {\n type: rule.type,\n pattern,\n versionQualifier: resolveRuleValue(rule.qualifier, pattern),\n releaseChannel: resolveRuleValue(rule.channel, pattern),\n }\n}\n\n/**\n * Resolve a rule property value from an explicit `string` or pattern fallback.\n *\n * @param value Explicit `string` value, `boolean` flag, or `undefined`\n * @param pattern Fallback pattern string used when `value` is `true`\n * @returns Resolved `string` value or `undefined`\n */\nfunction resolveRuleValue(\n value: string | boolean | undefined,\n pattern: string\n): string | undefined {\n if (typeof value === 'string') {\n return value\n }\n\n if (value) {\n return sanitizePrereleaseLabel(pattern)\n }\n\n return undefined\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { Workspace } from '#types'\nimport path from 'node:path'\n\n/**\n * Normalize and validate workspace configuration for a repository.\n *\n * Resolves the workspace entry directory relative to `cwd` and normalizes\n * the path representation. Returns a workspace object with normalized `entry`\n * and optional workspace members.\n *\n * @param cwd Repository working directory\n * @param workspace Partial workspace configuration (optional)\n * @returns Normalized workspace object\n */\nexport function normalizeWorkspace(\n cwd: string,\n workspace?: {\n entry?: string | null | undefined\n members?: readonly string[] | null | undefined\n }\n): Workspace {\n let entry = workspace?.entry || '.'\n const members = workspace?.members ?? null\n\n entry = path.normalize(path.relative(cwd, path.resolve(cwd, entry)))\n\n return {\n entry,\n members,\n }\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type {\n ReleasePlugin,\n ReleasePluginDefinition,\n ReleasePluginFactory,\n ReleasePluginTuple,\n} from '#types'\nimport { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\n/**\n * Resolve a release plugin definition into a factory tuple or plugin object.\n *\n * Handles string module specifiers by dynamically importing the package relative\n * to `cwd`. Unwraps ES module default exports, array configurations containing\n * options, function factories, and direct plugin objects.\n *\n * @param cwd The working directory path used to resolve string specifiers\n * @param plugin The plugin name, path, tuple configuration, or plugin object\n * @returns A factory tuple, plugin object, or null if resolution fails\n */\nexport async function resolvePlugin(\n cwd: string,\n plugin: unknown\n): Promise<ReleasePluginDefinition | ReleasePluginTuple | null> {\n let options: unknown\n\n if (Array.isArray(plugin)) {\n ;[plugin, options] = plugin\n }\n\n if (typeof plugin === 'string') {\n const require = createRequire(pathToFileURL(cwd))\n plugin = await import(require.resolve(plugin))\n }\n\n if (plugin != null && typeof plugin === 'object' && 'default' in plugin) {\n plugin = plugin.default\n }\n\n if (typeof plugin === 'function') {\n return [plugin as ReleasePluginFactory, options]\n }\n\n if (\n plugin != null &&\n typeof plugin === 'object' &&\n Object.hasOwn(plugin, 'name') &&\n typeof (plugin as ReleasePlugin).name === 'string'\n ) {\n return plugin as ReleasePlugin\n }\n\n return null\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { Package } from '#types'\n\ninterface PackageNode {\n package: Package\n level: number\n}\n\n/**\n * Sort workspace packages topologically based on their dependency graphs.\n *\n * Deepest dependents are placed first in the resulting array, ensuring that\n * a package always precedes its own dependencies. Ties and circular dependencies\n * are resolved deterministically using an alphabetical sort on the package directory (`dir`).\n *\n * @param packages The workspace packages to sort.\n * @returns A new array of packages sorted by dependency depth and directory path.\n */\nexport function sortPackages(packages: readonly Package[]): Package[] {\n const packageNodes: PackageNode[] = []\n const packageMap = new Map<string, PackageNode>()\n\n for (const pkg of packages.toSorted((a, b) =>\n a.location.localeCompare(b.location)\n )) {\n const node: PackageNode = {\n package: pkg,\n level: -1,\n }\n\n packageNodes.push(node)\n\n if (pkg.name) {\n packageMap.set(pkg.name, node)\n }\n }\n\n for (const node of packageNodes) {\n visit(node)\n }\n\n function visit(\n node: PackageNode,\n level = 0,\n visited = new Set<PackageNode>()\n ): void {\n if (node.level >= level) {\n return\n }\n\n if (visited.has(node)) {\n return\n }\n\n visited.add(node)\n\n for (const depName of node.package.dependencies) {\n const depNode = packageMap.get(depName)\n\n if (depNode && depNode !== node) {\n visit(depNode, level + 1, visited)\n }\n }\n\n node.level = level\n }\n\n const sorted = packageNodes\n .toSorted((a, b) => b.level - a.level)\n .map((node) => node.package)\n\n return sorted\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA,SAAgB,eAAe,OAAoC;CACjE,IAAI,CAAC,OAAO,OAAO;CAEnB,MAAM,aAAa,MAAM,YAAY,CAAC,CAAC,KAAK;CAE5C,OAAO,eAAe,UAAU,eAAe;AACjD;;;;;;;;;;;;ACHA,SAAgB,KAAK,KAA2C;CAC9D,OAAO,eAAe,IAAI,EAAE;AAC9B;;;;;;;;;;;;;;;;;;;;;;ACSA,SAAgB,mBACd,SACS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izeCommitFilter.ts","../src/config/normalizeReleaseRule.ts","../src/config/normalizeWorkspace.ts","../src/config/resolvePlugin.ts","../src/workflow/discovery/sortPackages.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport { isTruthyString } from './isTruthyString'\n\n/**\n * Determine whether the current process is running in a CI environment.\n *\n * Checks if the `CI` environment variable is set to a truthy value. Ignores\n * provider-specific variables such as `GITHUB_ACTIONS` to keep detection\n * generic.\n *\n * @param env Readonly process environment variables object\n * @returns `true` if `env.CI` normalizes to a truthy string, otherwise `false`\n */\nexport function isCI(env: Readonly<NodeJS.ProcessEnv>): boolean {\n return isTruthyString(env.CI)\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseContext } from '../types'\nimport { isCI } from './isCI'\n\n/**\n * Determine whether the current run should stay quiet about verbose output.\n *\n * A run is quiet when nothing will keep what it prints: no terminal is attached\n * for a human, and no CI provider is recording a job log. A plain pipe outside\n * of CI — an agent sandbox, a script capturing output, a detached daemon — only\n * accumulates noise, so verbose output should be withheld and left to\n * `execCommand` for error reporting instead.\n *\n * CI is deliberately *not* quiet even though its streams are not TTYs: the\n * provider persists the job log, so the output does reach someone. A caller\n * that wants output from a pipe in a non-CI environment can set `CI=1` as an\n * escape hatch.\n *\n * The verdict is per environment, not per stream, so a redirected stdout inside\n * an interactive terminal still counts as quiet.\n *\n * @param context Release context carrying the destination stream and environment\n * @returns `true` when no TTY is attached and the run is not part of CI\n */\nexport function isQuietEnvironment(\n context: Pick<ReleaseContext, 'env' | 'stdout'>\n): boolean {\n if (isCI(context.env)) return false\n\n const stream = context.stdout as NodeJS.WriteStream | undefined\n\n return stream?.isTTY !== true\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { CommitClassifier, ReleaseConfig, ReleaseType } from '#types'\n\n/**\n * Normalize a commit classifier into a consistent function.\n *\n * Accepts `null`/`undefined` (returns no-op classifier), a function classifier,\n * or a config object mapping commit types to release types. Returns a classifier\n * function that maps commits to their corresponding release types.\n *\n * @param classifier Commit classifier config, function, or falsy value\n * @returns Normalized classifier function\n */\nexport function normalizeCommitFilter(\n classifier: ReleaseConfig['classifier'] | null | undefined\n): CommitClassifier {\n if (classifier == null) {\n return () => null\n }\n\n if (typeof classifier === 'function') {\n return classifier\n }\n\n const map = new Map(\n Object.entries(classifier).flatMap(([releaseType, commitTypes]) => {\n return commitTypes.map((commitType) => [\n commitType,\n releaseType as ReleaseType,\n ])\n })\n )\n\n return (commit) => (commit.type ? map.get(commit.type) : null)\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseRule, ResolvedReleaseRule } from '#types'\nimport { sanitizePrereleaseLabel } from './sanitizePrereleaseLabel'\n\n/**\n * Normalize a release rule input into a resolved release rule object.\n *\n * Converts `string` shorthand inputs into structured rule objects with sanitized\n * labels. Resolves `versionQualifier` and `releaseChannel` against `pattern`.\n * Returns `null` if `rule` is invalid, falsy, or missing `pattern`.\n *\n * @param rule Raw release rule input, `string` shorthand, or falsy value\n * @returns Resolved `ResolvedReleaseRule` object, or `null` if `rule` is invalid\n */\nexport function normalizeReleaseRule(\n rule: ReleaseRule | string | false | null | undefined\n): ResolvedReleaseRule | null {\n if (typeof rule === 'string') {\n rule = {\n pattern: rule,\n qualifier: sanitizePrereleaseLabel(rule),\n channel: sanitizePrereleaseLabel(rule),\n }\n }\n\n if (typeof rule !== 'object' || rule == null) {\n return null\n }\n\n const { pattern } = rule\n\n if (pattern == null) {\n return null\n }\n\n return {\n type: rule.type,\n pattern,\n versionQualifier: resolveRuleValue(rule.qualifier, pattern),\n releaseChannel: resolveRuleValue(rule.channel, pattern),\n }\n}\n\n/**\n * Resolve a rule property value from an explicit `string` or pattern fallback.\n *\n * @param value Explicit `string` value, `boolean` flag, or `undefined`\n * @param pattern Fallback pattern string used when `value` is `true`\n * @returns Resolved `string` value or `undefined`\n */\nfunction resolveRuleValue(\n value: string | boolean | undefined,\n pattern: string\n): string | undefined {\n if (typeof value === 'string') {\n return value\n }\n\n if (value) {\n return sanitizePrereleaseLabel(pattern)\n }\n\n return undefined\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { Workspace } from '#types'\nimport path from 'node:path'\n\n/**\n * Normalize and validate workspace configuration for a repository.\n *\n * Resolves the workspace entry directory relative to `cwd` and normalizes\n * the path representation. Returns a workspace object with normalized `entry`\n * and optional workspace members.\n *\n * @param cwd Repository working directory\n * @param workspace Partial workspace configuration (optional)\n * @returns Normalized workspace object\n */\nexport function normalizeWorkspace(\n cwd: string,\n workspace?: {\n entry?: string | null | undefined\n members?: readonly string[] | null | undefined\n }\n): Workspace {\n let entry = workspace?.entry || '.'\n const members = workspace?.members ?? null\n\n entry = path.normalize(path.relative(cwd, path.resolve(cwd, entry)))\n\n return {\n entry,\n members,\n }\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type {\n ReleasePlugin,\n ReleasePluginDefinition,\n ReleasePluginFactory,\n ReleasePluginTuple,\n} from '#types'\nimport { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\n/**\n * Resolve a release plugin definition into a factory tuple or plugin object.\n *\n * Handles string module specifiers by dynamically importing the package relative\n * to `cwd`. Unwraps ES module default exports, array configurations containing\n * options, function factories, and direct plugin objects.\n *\n * @param cwd The working directory path used to resolve string specifiers\n * @param plugin The plugin name, path, tuple configuration, or plugin object\n * @returns A factory tuple, plugin object, or null if resolution fails\n */\nexport async function resolvePlugin(\n cwd: string,\n plugin: unknown\n): Promise<ReleasePluginDefinition | ReleasePluginTuple | null> {\n let options: unknown\n\n if (Array.isArray(plugin)) {\n ;[plugin, options] = plugin\n }\n\n if (typeof plugin === 'string') {\n const require = createRequire(pathToFileURL(cwd))\n plugin = await import(require.resolve(plugin))\n }\n\n if (plugin != null && typeof plugin === 'object' && 'default' in plugin) {\n plugin = plugin.default\n }\n\n if (typeof plugin === 'function') {\n return [plugin as ReleasePluginFactory, options]\n }\n\n if (\n plugin != null &&\n typeof plugin === 'object' &&\n Object.hasOwn(plugin, 'name') &&\n typeof (plugin as ReleasePlugin).name === 'string'\n ) {\n return plugin as ReleasePlugin\n }\n\n return null\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { Package } from '#types'\n\ninterface PackageNode {\n package: Package\n level: number\n}\n\n/**\n * Sort workspace packages topologically based on their dependency graphs.\n *\n * Deepest dependents are placed first in the resulting array, ensuring that\n * a package always precedes its own dependencies. Ties and circular dependencies\n * are resolved deterministically using an alphabetical sort on the package directory (`dir`).\n *\n * @param packages The workspace packages to sort.\n * @returns A new array of packages sorted by dependency depth and directory path.\n */\nexport function sortPackages(packages: readonly Package[]): Package[] {\n const packageNodes: PackageNode[] = []\n const packageMap = new Map<string, PackageNode>()\n\n for (const pkg of packages.toSorted((a, b) =>\n a.location.localeCompare(b.location)\n )) {\n const node: PackageNode = {\n package: pkg,\n level: -1,\n }\n\n packageNodes.push(node)\n\n if (pkg.name) {\n packageMap.set(pkg.name, node)\n }\n }\n\n for (const node of packageNodes) {\n visit(node)\n }\n\n function visit(\n node: PackageNode,\n level = 0,\n visited = new Set<PackageNode>()\n ): void {\n if (node.level >= level) {\n return\n }\n\n if (visited.has(node)) {\n return\n }\n\n visited.add(node)\n\n for (const depName of node.package.dependencies) {\n const depNode = packageMap.get(depName)\n\n if (depNode && depNode !== node) {\n visit(depNode, level + 1, visited)\n }\n }\n\n node.level = level\n }\n\n const sorted = packageNodes\n .toSorted((a, b) => b.level - a.level)\n .map((node) => node.package)\n\n return sorted\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAgB,KAAK,KAA2C;CAC9D,OAAO,eAAe,IAAI,EAAE;AAC9B;;;;;;;;;;;;;;;;;;;;;;ACSA,SAAgB,mBACd,SACS;CACT,IAAI,KAAK,QAAQ,GAAG,GAAG,OAAO;CAI9B,OAFe,QAAQ,QA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c,GAAG,CACzB,CAAA,CAAQ,QAAQ,MAAM;CAG9C,IAAI,UAAU,QAAQ,OAAO,WAAW,YAAY,aAAa,QAC/D,SAAS,OAAO;CAGlB,IAAI,OAAO,WAAW,YACpB,OAAO,CAAC,QAAgC,OAAO;CAGjD,IACE,UAAU,QACV,OAAO,WAAW,YAClB,OAAO,OAAO,QAAQ,MAAM,KAC5B,OAAQ,OAAyB,SAAS,UAE1C,OAAO;CAGT,OAAO;AACT;;;;;;;;;;;;ACpCA,SAAgB,aAAa,UAAyC;CACpE,MAAM,eAA8B,CAAC;CACrC,MAAM,6BAAa,IAAI,IAAyB;CAEhD,KAAK,MAAM,OAAO,SAAS,UAAU,GAAG,MACtC,EAAE,SAAS,cAAc,EAAE,QAAQ,CACrC,GAAG;EACD,MAAM,OAAoB;GACxB,SAAS;GACT,OAAO;EACT;EAEA,aAAa,KAAK,IAAI;EAEtB,IAAI,IAAI,MACN,WAAW,IAAI,IAAI,MAAM,IAAI;CAEjC;CAEA,KAAK,MAAM,QAAQ,cACjB,MAAM,IAAI;CAGZ,SAAS,MACP,MACA,QAAQ,GACR,0BAAU,IAAI,IAAiB,GACzB;EACN,IAAI,KAAK,SAAS,OAChB;EAGF,IAAI,QAAQ,IAAI,IAAI,GAClB;EAGF,QAAQ,IAAI,IAAI;EAEhB,KAAK,MAAM,WAAW,KAAK,QAAQ,cAAc;GAC/C,MAAM,UAAU,WAAW,IAAI,OAAO;GAEtC,IAAI,WAAW,YAAY,MACzB,MAAM,SAAS,QAAQ,GAAG,OAAO;EAErC;EAEA,KAAK,QAAQ;CACf;CAMA,OAJe,aACZ,UAAU,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CACrC,KAAK,SAAS,KAAK,OAEf;AACT"}
@@ -14,6 +14,7 @@ import assert from "node:assert";
14
14
  import createPreset from "conventional-changelog-conventionalcommits";
15
15
  import { writeChangelogString } from "conventional-changelog-writer";
16
16
  import { toMarkdown } from "mdast-util-to-markdown";
17
+ import { appendFileSync } from "node:fs";
17
18
  // src/workflow/version/extractVersionQualifier.ts
18
19
  /**
19
20
  * Extract the version qualifier string from a parsed `SemVer` instance.
@@ -549,6 +550,21 @@ function interpolate(template, data) {
549
550
  }
550
551
  return result;
551
552
  }
553
+ // src/util/isTruthyString.ts
554
+ /**
555
+ * Determine whether a string value represents a truthy boolean.
556
+ *
557
+ * Trims leading and trailing whitespace and coerces the target string to
558
+ * lowercase. Evaluates the string as truthy if it equals `'true'` or `'1'`.
559
+ *
560
+ * @param value The raw string to evaluate
561
+ * @returns `true` if `value` normalizes to `'true'` or `'1'`, otherwise `false`
562
+ */
563
+ function isTruthyString(value) {
564
+ if (!value) return false;
565
+ const normalized = value.toLowerCase().trim();
566
+ return normalized === "true" || normalized === "1";
567
+ }
552
568
  // src/util/isClass.ts
553
569
  /**
554
570
  * Determine whether a given value is a constructible class.
@@ -571,6 +587,20 @@ function isClass(func) {
571
587
  if (!descriptor || descriptor.writable) return false;
572
588
  return /^class\s/.test(Function.prototype.toString.call(func));
573
589
  }
590
+ // src/util/isGitHubActions.ts
591
+ /**
592
+ * Determine whether the current process runs on a GitHub Actions runner.
593
+ *
594
+ * Checks if the `GITHUB_ACTIONS` environment variable is set to a truthy
595
+ * value. Gates GitHub Actions-specific reporting such as job summaries and
596
+ * annotations.
597
+ *
598
+ * @param env Readonly process environment variables object
599
+ * @returns `true` if `env.GITHUB_ACTIONS` normalizes to a truthy string, otherwise `false`
600
+ */
601
+ function isGitHubActions(env) {
602
+ return isTruthyString(env.GITHUB_ACTIONS);
603
+ }
574
604
  // src/util/isMatch.ts
575
605
  /**
576
606
  * Determine whether a target string matches glob patterns.
@@ -2354,7 +2384,7 @@ async function writeChangelog(cwd, plan) {
2354
2384
  }
2355
2385
  }
2356
2386
  // package.json
2357
- var version = "0.6.0";
2387
+ var version = "0.8.0";
2358
2388
  // src/workflow/commit/generateReleaseCommitMessage.ts
2359
2389
  var NOTABLE_TYPES = [
2360
2390
  "feat",
@@ -2497,22 +2527,111 @@ var HookManager = class {
2497
2527
  return await dispatch(0, context);
2498
2528
  }
2499
2529
  };
2530
+ // src/workflow/report/resolveErrorMessage.ts
2531
+ /**
2532
+ * Resolve a displayable message from an unknown error value.
2533
+ *
2534
+ * Normalizes `Error` instances to their `message` and passes string values
2535
+ * through unchanged. Returns `null` for any other shape so callers can fall
2536
+ * back to a generic message.
2537
+ *
2538
+ * @param error Unknown error value carried on a release outcome
2539
+ * @returns The resolved error message, or `null` when none can be resolved
2540
+ */
2541
+ function resolveErrorMessage(error) {
2542
+ if (Error.isError(error)) return error.message;
2543
+ return typeof error === "string" ? error : null;
2544
+ }
2545
+ var FALLBACK_ERROR_MESSAGE = "An unexpected error occurred during the release process.";
2546
+ /**
2547
+ * Resolve a displayable failure message from a release outcome.
2548
+ *
2549
+ * Normalizes the outcome error to its message and falls back to a generic
2550
+ * message when the error carries no displayable content.
2551
+ *
2552
+ * @param outcome Failure outcome whose error is rendered
2553
+ * @returns The resolved error message, or the fallback message
2554
+ */
2555
+ function resolveOutcomeErrorMessage(outcome) {
2556
+ return resolveErrorMessage(outcome.error) || FALLBACK_ERROR_MESSAGE;
2557
+ }
2558
+ // src/workflow/report/appendReleaseReportSummary.ts
2559
+ var STATUS_LABELS = {
2560
+ success: "Success",
2561
+ failure: "Failure"
2562
+ };
2563
+ /**
2564
+ * Append a Markdown release report to the GitHub Actions job summary.
2565
+ *
2566
+ * Detects a GitHub Actions runner through the `GITHUB_ACTIONS` environment
2567
+ * variable and appends the rendered `report` to the file referenced by
2568
+ * `GITHUB_STEP_SUMMARY`, so GitHub displays it on the run summary page. Does
2569
+ * nothing outside GitHub Actions or when no summary file is configured, and
2570
+ * logs a warning instead of throwing when the summary file cannot be written.
2571
+ *
2572
+ * @param logger Logger instance for reporting summary write failures
2573
+ * @param env Readonly process environment variables object
2574
+ * @param report Release report containing outcome and package details
2575
+ */
2576
+ function appendReleaseReportSummary(logger, env, report) {
2577
+ if (!isGitHubActions(env)) return;
2578
+ const filePath = env.GITHUB_STEP_SUMMARY;
2579
+ if (!filePath) return;
2580
+ try {
2581
+ appendFileSync(filePath, `\n${formatReleaseReportSummary(report)}`);
2582
+ } catch (error) {
2583
+ logger.warn(`GitHub Actions job summary could not be written to "${filePath}": ${error instanceof Error ? error.message : error}`);
2584
+ }
2585
+ }
2586
+ var formatPackageLabel = (plan) => {
2587
+ if (plan.package.name) return `\`${plan.package.name}\``;
2588
+ return `\`${plan.package.location}\``;
2589
+ };
2590
+ var formatReleaseReportSummary = (report) => {
2591
+ const lines = ["## ReelOut Release Report", ""];
2592
+ if (report.outcome) lines.push(`**Status:** ${STATUS_LABELS[report.outcome.status]}`, "");
2593
+ if (report.outcome?.status === "failure") {
2594
+ const message = resolveOutcomeErrorMessage(report.outcome);
2595
+ lines.push(...message.split("\n").map((line) => `> ${line}`), "");
2596
+ return lines.join("\n");
2597
+ }
2598
+ if (report.plans.length === 0) {
2599
+ lines.push("No packages are scheduled for release.", "");
2600
+ return lines.join("\n");
2601
+ }
2602
+ const plans = report.plans.toSorted((a, b) => (a.package.name || "").localeCompare(b.package.name || ""));
2603
+ lines.push("| Package | Version | Type | Tag |", "| --- | --- | --- | --- |");
2604
+ for (const plan of plans) {
2605
+ const version = `\`${plan.release.version}\` ← \`${plan.package.version}\``;
2606
+ lines.push([
2607
+ `| ${formatPackageLabel(plan)}`,
2608
+ version,
2609
+ plan.release.type,
2610
+ plan.release.tag ? `\`${plan.release.tag}\`` : ""
2611
+ ].join(" | ") + " |");
2612
+ }
2613
+ lines.push("");
2614
+ for (const plan of plans) {
2615
+ const changelog = plan.release.changelog?.trim();
2616
+ if (!changelog) continue;
2617
+ lines.push("<details>", `<summary>${formatPackageLabel(plan)} ${plan.release.version}</summary>`, "", changelog, "", "</details>", "");
2618
+ }
2619
+ return lines.join("\n");
2620
+ };
2500
2621
  // src/workflow/report/generateReleaseReport.ts
2501
2622
  /**
2502
2623
  * Generate a structured release report from the current workflow state.
2503
2624
  *
2504
2625
  * Extracts state information from `context` and organizes it into a report
2505
- * containing workflow status, release plans, and package metadata. Omits
2506
- * unversioned release plans from the finalized output.
2626
+ * containing the terminal release outcome, release plans, and package
2627
+ * metadata. Omits unversioned release plans from the finalized output.
2507
2628
  *
2508
2629
  * @param context Release execution context containing workflow state and plans
2509
2630
  * @returns Structured release report object containing workflow results
2510
2631
  */
2511
2632
  function generateReleaseReport(context) {
2512
2633
  return {
2513
- status: context.status,
2514
- phase: context.phase,
2515
- error: Error.isError(context.error) ? context.error.message : typeof context.error === "string" ? context.error : null,
2634
+ outcome: context.outcome,
2516
2635
  packages: context.packages.map((pkg) => ({
2517
2636
  location: pkg.location,
2518
2637
  name: pkg.name,
@@ -2543,22 +2662,22 @@ function generateReleaseReport(context) {
2543
2662
  /**
2544
2663
  * Print a formatted release report to the logger.
2545
2664
  *
2546
- * Logs workflow `status` and details for planned package releases. Displays
2547
- * package names, directories, and version changes on success, or outputs the
2548
- * error message on failure.
2665
+ * Logs the terminal outcome status and details for planned package releases.
2666
+ * Displays package names, directories, and version changes on success, or
2667
+ * outputs the error message on failure.
2549
2668
  *
2550
2669
  * @param logger Logger instance for outputting messages
2551
- * @param report Release report containing status and package details
2670
+ * @param report Release report containing outcome and package details
2552
2671
  */
2553
2672
  function printReleaseReport(logger, report) {
2554
- if (report.status) {
2673
+ if (report.outcome) {
2555
2674
  const statusLabel = {
2556
2675
  success: colors.green("SUCCESS"),
2557
2676
  failure: colors.red("FAILURE")
2558
- }[report.status];
2677
+ }[report.outcome.status];
2559
2678
  logger.info(`Status: ${statusLabel}`);
2560
2679
  }
2561
- if (report.status === "failure") return logger.error(["Release complete:", colors.red(report.error || "An unexpected error occurred during the release process.")].join(" "));
2680
+ if (report.outcome?.status === "failure") return logger.error(["Release complete:", colors.red(resolveOutcomeErrorMessage(report.outcome))].join(" "));
2562
2681
  if (report.plans.length === 0) return logger.info(["Release complete:", colors.yellow("No packages are scheduled for release.")].join(" "));
2563
2682
  const header = [
2564
2683
  "Release complete:",
@@ -2580,78 +2699,187 @@ function printReleaseReport(logger, report) {
2580
2699
  }).join("\n\n");
2581
2700
  logger.info(`${header}\n\n${list}\n`);
2582
2701
  }
2702
+ // src/workflow/report/printReleaseReportAnnotation.ts
2703
+ /**
2704
+ * Print a GitHub Actions error annotation for a failed release.
2705
+ *
2706
+ * Detects a GitHub Actions runner through the `GITHUB_ACTIONS` environment
2707
+ * variable and writes a `::error` workflow command carrying the failure
2708
+ * reason to `stdout`, so GitHub surfaces the failure as an annotation on the
2709
+ * run page. Does nothing outside GitHub Actions or when the release did not
2710
+ * fail.
2711
+ *
2712
+ * @param env Readonly process environment variables object
2713
+ * @param stdout Writable stream receiving the annotation command
2714
+ * @param report Release report containing outcome and failure details
2715
+ */
2716
+ function printReleaseReportAnnotation(env, stdout, report) {
2717
+ if (!isGitHubActions(env) || report.outcome?.status !== "failure") return;
2718
+ const message = formatAnnotationMessage(resolveOutcomeErrorMessage(report.outcome));
2719
+ stdout.write(`::error title=Release failed::${message}\n`);
2720
+ }
2721
+ var formatAnnotationMessage = (message) => message.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
2583
2722
  // src/workflow/executeReleaseWorkflow.ts
2584
2723
  /**
2724
+ * Register a plugin's hook handler on the workflow hook manager.
2725
+ *
2726
+ * Normalizes the plugin's hook entry into a handler and priority, wraps the
2727
+ * handler in shared timing and logging middleware, and registers it under
2728
+ * the registration's hook name. When `onHandlerError` is provided, a thrown
2729
+ * handler error is passed to it and the middleware chain continues so later
2730
+ * handlers still run; without it the wrapper attributes the failure to the
2731
+ * current hook and plugin on `context.outcome` before rethrowing.
2732
+ *
2733
+ * @param manager Hook manager receiving the wrapped handler
2734
+ * @param registration Plugin hook registration carrying the error strategy
2735
+ */
2736
+ function registerPluginHook(manager, registration) {
2737
+ const { hookName, plugin } = registration;
2738
+ let hook = plugin[hookName];
2739
+ if (typeof hook === "function") hook = { handler: hook };
2740
+ const handler = hook?.handler;
2741
+ const priority = hook?.priority;
2742
+ if (!handler) return;
2743
+ manager.on(hookName, async (context, next) => {
2744
+ const current = {
2745
+ hook: hookName,
2746
+ plugin: plugin.name
2747
+ };
2748
+ const label = `${colors.gray(`[${current.hook}]`)} ${current.plugin}`;
2749
+ let startedLogging = false;
2750
+ let hasError = false;
2751
+ startedLogging = true;
2752
+ context.logger.start(label);
2753
+ const currentFrame = { startTime: performance.now() };
2754
+ const nextFrame = { duration: 0 };
2755
+ const runNext = async () => {
2756
+ const startTime = performance.now();
2757
+ try {
2758
+ return await next(context);
2759
+ } finally {
2760
+ nextFrame.duration = performance.now() - startTime;
2761
+ }
2762
+ };
2763
+ try {
2764
+ return await handler.call(plugin, context, runNext);
2765
+ } catch (err) {
2766
+ hasError = true;
2767
+ if (registration.onHandlerError) {
2768
+ registration.onHandlerError(err);
2769
+ return await runNext();
2770
+ }
2771
+ context.outcome ??= {
2772
+ status: "failure",
2773
+ error: err,
2774
+ phase: current
2775
+ };
2776
+ throw err;
2777
+ } finally {
2778
+ if (startedLogging) {
2779
+ const duration = performance.now() - currentFrame.startTime - nextFrame.duration;
2780
+ const message = [label, (duration >= 5e3 ? colors.yellow : colors.cyan)(`${(duration / 1e3).toFixed(2)}s`)].join(" ");
2781
+ if (hasError) context.logger.error(message);
2782
+ else context.logger.success(message);
2783
+ }
2784
+ }
2785
+ }, priority);
2786
+ }
2787
+ /**
2788
+ * Throw a cancellation error when the context abort signal has fired.
2789
+ *
2790
+ * Wraps the underlying `AbortError` so the workflow reports a readable
2791
+ * cancellation instead of a bare DOM exception.
2792
+ *
2793
+ * @param context Release execution context carrying the optional abort signal
2794
+ * @throws If the context abort signal has already fired
2795
+ */
2796
+ function throwIfCancelled(context) {
2797
+ const signal = context.signal;
2798
+ if (!signal?.aborted) return;
2799
+ try {
2800
+ signal.throwIfAborted();
2801
+ } catch (err) {
2802
+ throw new Error("Release cancelled.", { cause: err });
2803
+ }
2804
+ }
2805
+ /**
2585
2806
  * Execute the complete release workflow across all configured plugins.
2586
2807
  *
2587
2808
  * Runs each lifecycle phase sequentially, dispatching plugin hooks in onion
2588
- * order based on declared priority. Logs hook execution timing for non-silent
2589
- * runs and prints a release report upon completion or failure.
2809
+ * order based on declared priority, and checks the abort signal before each
2810
+ * phase. Emits the `finalize` hook on every terminal outcome so plugins can
2811
+ * send notifications and clean up: when a phase hook throws, plugin rollbacks
2812
+ * run while the error unwinds, then every `finalize` handler runs with the
2813
+ * failure recorded on `context.outcome`. When a `finalize` handler throws,
2814
+ * the remaining handlers still run: on a failed workflow each failure is
2815
+ * logged as a warning after the report, while on a successful workflow the
2816
+ * first failure fails the release. Failures in `finalize` never mask the
2817
+ * original workflow error.
2590
2818
  *
2591
2819
  * @param context Release execution context containing runtime options and logger
2592
2820
  * @param plugins List of release plugins to execute
2593
- * @returns Promise that resolves when all workflow phases complete
2594
- * @throws If any lifecycle hook execution fails
2821
+ * @returns Promise that resolves when all phases and `finalize` handlers
2822
+ * complete
2823
+ * @throws If a lifecycle hook fails, the workflow is cancelled, or a finalize
2824
+ * handler fails on an otherwise successful workflow
2595
2825
  */
2596
2826
  async function executeReleaseWorkflow(context, plugins) {
2827
+ const phaseHookNames = RELEASE_HOOK_NAMES.filter((name) => name !== "finalize");
2828
+ context.outcome = null;
2829
+ const manager = new HookManager();
2830
+ for (const hookName of phaseHookNames) for (const plugin of plugins) registerPluginHook(manager, {
2831
+ hookName,
2832
+ plugin
2833
+ });
2834
+ const dispatch = async (index, context) => {
2835
+ const hook = phaseHookNames[index];
2836
+ if (!hook) return;
2837
+ throwIfCancelled(context);
2838
+ return await manager.emit(hook, context, (context) => dispatch(index + 1, context));
2839
+ };
2597
2840
  try {
2598
- context.status = null;
2599
- context.error = null;
2600
- const manager = new HookManager();
2601
- for (const hookName of RELEASE_HOOK_NAMES) for (const plugin of plugins) {
2602
- let hook = plugin[hookName];
2603
- if (typeof hook === "function") hook = { handler: hook };
2604
- const handler = hook?.handler;
2605
- const priority = hook?.priority;
2606
- if (handler) manager.on(hookName, async (context, next) => {
2607
- const current = context.phase = {
2608
- hook: hookName,
2609
- plugin: plugin.name
2610
- };
2611
- const label = `${colors.gray(`[${current.hook}]`)} ${current.plugin}`;
2612
- let startedLogging = false;
2613
- let hasError = false;
2614
- startedLogging = true;
2615
- context.logger.start(label);
2616
- const currentFrame = { startTime: performance.now() };
2617
- const nextFrame = { duration: 0 };
2618
- try {
2619
- return await handler.call(plugin, context, async () => {
2620
- const startTime = performance.now();
2621
- try {
2622
- return await next(context);
2623
- } finally {
2624
- nextFrame.duration = performance.now() - startTime;
2625
- }
2626
- });
2627
- } catch (err) {
2628
- hasError = true;
2629
- throw err;
2630
- } finally {
2631
- if (startedLogging) {
2632
- const duration = performance.now() - currentFrame.startTime - nextFrame.duration;
2633
- const message = [label, (duration >= 5e3 ? colors.yellow : colors.cyan)(`${(duration / 1e3).toFixed(2)}s`)].join(" ");
2634
- if (hasError) context.logger.error(message);
2635
- else context.logger.success(message);
2636
- }
2637
- }
2638
- }, priority);
2639
- }
2640
- const dispatch = async (index, context) => {
2641
- const hook = RELEASE_HOOK_NAMES[index];
2642
- if (!hook) return;
2643
- return await manager.emit(hook, context, (context) => dispatch(index + 1, context));
2644
- };
2645
2841
  await dispatch(0, context);
2646
- context.status = "success";
2842
+ context.outcome = {
2843
+ status: "success",
2844
+ error: null,
2845
+ phase: null
2846
+ };
2647
2847
  } catch (err) {
2648
- context.status = "failure";
2649
- context.error = err;
2650
- throw err;
2651
- } finally {
2652
- printReleaseReport(context.logger, generateReleaseReport(context));
2848
+ context.outcome ??= {
2849
+ status: "failure",
2850
+ error: err,
2851
+ phase: null
2852
+ };
2853
+ }
2854
+ const finalizeFailures = [];
2855
+ for (const plugin of plugins) registerPluginHook(manager, {
2856
+ hookName: "finalize",
2857
+ plugin,
2858
+ onHandlerError: (error) => finalizeFailures.push({
2859
+ plugin: plugin.name,
2860
+ error
2861
+ })
2862
+ });
2863
+ await manager.emit("finalize", context);
2864
+ const [firstFinalizeFailure] = finalizeFailures;
2865
+ if (context.outcome.status === "success" && firstFinalizeFailure) context.outcome = {
2866
+ status: "failure",
2867
+ error: firstFinalizeFailure.error,
2868
+ phase: {
2869
+ hook: "finalize",
2870
+ plugin: firstFinalizeFailure.plugin
2871
+ }
2872
+ };
2873
+ const report = generateReleaseReport(context);
2874
+ printReleaseReport(context.logger, report);
2875
+ appendReleaseReportSummary(context.logger, context.env, report);
2876
+ printReleaseReportAnnotation(context.env, context.stdout, report);
2877
+ for (const failure of finalizeFailures) {
2878
+ if (failure.error === context.outcome.error) continue;
2879
+ context.logger.warn(`Plugin "${failure.plugin}" could not finalize: ${failure.error instanceof Error ? failure.error.message : String(failure.error)}`);
2653
2880
  }
2881
+ if (context.outcome.status === "failure") throw context.outcome.error;
2654
2882
  }
2655
- export { getCurrentGitCommit as $, generateGitTagName as A, buildTrailerPattern as At, getGitConfigValue as B, deriveReleaseType as Bt, extractPlainText as C, isClass as Ct, getLatestGitTag as D, execCommand as Dt, isGitTagConnected as E, execGit as Et, readGitFile as F, RELEASE_HOOK_NAMES as Ft, GIT_REL_FLAGS as G, readParsedGitHistory as H, deriveCommitReleaseType as Ht, resolveGitRepository as I, SEMVER_REGEX as It, resolveGitRevision as J, detectGitRelationship as K, pushGitChanges as L, promotePrereleaseVersions as Lt, isGitTagPresent as M, DEFAULT_CHANGELOG_FILE as Mt, deleteGitTag as N, DEV_NULL as Nt, getGitTagMessage as O, compact as Ot, createGitTag as P, GIT_TRAILER_RELEASE_AGENT as Pt, countGitHistory as Q, getGitRemote as R, isStableVersion as Rt, extractSemVer as S, isMatch as St, isGitTagExact as T, formatFile as Tt, readGitHistory as U, bumpVersion as Ut, restoreFullGitHistory as V, pickPriorityReleaseType as Vt, mergeGitHistory as W, extractVersionQualifier as Wt, withShallowLock as X, isGitAncestor as Y, isGitShallowRepository as Z, filterPackages as _, findReleaseRule as _t, HookPriority as a, TTLCache as at, extractLatestVersion as b, unique as bt, writeChangelog as c, getCurrentGitBranch as ct, buildReleaseNotes as d, packageContainsCommit as dt, getParsedGitCommit as et, buildChangelog as f, resolveVersionQualifier as ft, resolvePackageStableTag as g, isSemVer as gt, resolvePackageTag as h, isSemVerGitTag as ht, HookManager as i, parseGitCommit as it, ensureGitTag as j, ALL_FILES as jt, getCurrentGitTag as k, isDefined as kt, prependChangelog as l, deriveTransitionReleases as lt, propagateDependencyUpdates as m, sanitizePrereleaseLabel as mt, printReleaseReport as n, GIT_PRETTY_FORMAT as nt, generateReleaseCommitMessage as o, extractMentions as ot, readPackageHistory as p, resolveReleaseChannel as pt, expandGitHistory as q, generateReleaseReport as r, parseGitPrettyFormat as rt, version as s, createGitCommit as st, executeReleaseWorkflow as t, GIT_PRETTY_FIELD_SEPARATOR as tt, extractPreviousVersion as u, deriveChangeReleases as ut, discoverPackageTag as v, createPlugin as vt, buildDependencyGraph as w, interpolate as wt, iterateChangelogVersions as x, readJson as xt, verifyPackageTag as y, writeJson as yt, ensureGitUserConfig as z, isSameReleaseCycle as zt };
2883
+ export { isGitShallowRepository as $, getGitTagMessage as A, execGit as At, getGitRemote as B, SEMVER_REGEX as Bt, iterateChangelogVersions as C, readJson as Ct, isGitTagExact as D, isTruthyString as Dt, buildDependencyGraph as E, isClass as Et, deleteGitTag as F, ALL_FILES as Ft, readGitHistory as G, pickPriorityReleaseType as Gt, getGitConfigValue as H, isStableVersion as Ht, createGitTag as I, DEFAULT_CHANGELOG_FILE as It, detectGitRelationship as J, extractVersionQualifier as Jt, mergeGitHistory as K, deriveCommitReleaseType as Kt, readGitFile as L, DEV_NULL as Lt, generateGitTagName as M, compact as Mt, ensureGitTag as N, isDefined as Nt, isGitTagConnected as O, interpolate as Ot, isGitTagPresent as P, buildTrailerPattern as Pt, withShallowLock as Q, resolveGitRepository as R, GIT_TRAILER_RELEASE_AGENT as Rt, extractLatestVersion as S, unique as St, extractPlainText as T, isGitHubActions as Tt, restoreFullGitHistory as U, isSameReleaseCycle as Ut, ensureGitUserConfig as V, promotePrereleaseVersions as Vt, readParsedGitHistory as W, deriveReleaseType as Wt, resolveGitRevision as X, expandGitHistory as Y, isGitAncestor as Z, resolvePackageTag as _, isSemVerGitTag as _t, appendReleaseReportSummary as a, parseGitPrettyFormat as at, discoverPackageTag as b, createPlugin as bt, generateReleaseCommitMessage as c, extractMentions as ct, prependChangelog as d, deriveTransitionReleases as dt, countGitHistory as et, extractPreviousVersion as f, deriveChangeReleases as ft, propagateDependencyUpdates as g, sanitizePrereleaseLabel as gt, readPackageHistory as h, resolveReleaseChannel as ht, generateReleaseReport as i, GIT_PRETTY_FORMAT as it, getCurrentGitTag as j, execCommand as jt, getLatestGitTag as k, formatFile as kt, version as l, createGitCommit as lt, buildChangelog as m, resolveVersionQualifier as mt, printReleaseReportAnnotation as n, getParsedGitCommit as nt, HookManager as o, parseGitCommit as ot, buildReleaseNotes as p, packageContainsCommit as pt, GIT_REL_FLAGS as q, bumpVersion as qt, printReleaseReport as r, GIT_PRETTY_FIELD_SEPARATOR as rt, HookPriority as s, TTLCache as st, executeReleaseWorkflow as t, getCurrentGitCommit as tt, writeChangelog as u, getCurrentGitBranch as ut, resolvePackageStableTag as v, isSemVer as vt, extractSemVer as w, isMatch as wt, verifyPackageTag as x, writeJson as xt, filterPackages as y, findReleaseRule as yt, pushGitChanges as z, RELEASE_HOOK_NAMES as zt };
2656
2884
 
2657
- //# sourceMappingURL=workflow-BolfadM0.js.map
2885
+ //# sourceMappingURL=workflow-BkjKac2I.js.map