@reelout/core 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/HookDispatcher-B_TrMRLU.js +236 -0
  2. package/dist/HookDispatcher-B_TrMRLU.js.map +1 -0
  3. package/dist/analyzer.js +12 -3
  4. package/dist/analyzer.js.map +1 -1
  5. package/dist/buildChangelog-CkytKypk.js +187 -0
  6. package/dist/buildChangelog-CkytKypk.js.map +1 -0
  7. package/dist/buildReleaseNotes-Dk4bEclG.js +141 -0
  8. package/dist/buildReleaseNotes-Dk4bEclG.js.map +1 -0
  9. package/dist/builder.js +14 -6
  10. package/dist/builder.js.map +1 -1
  11. package/dist/changelog.js +17 -6
  12. package/dist/changelog.js.map +1 -1
  13. package/dist/index.js +1297 -20
  14. package/dist/index.js.map +1 -1
  15. package/dist/package-la-hLPRR.js +884 -0
  16. package/dist/package-la-hLPRR.js.map +1 -0
  17. package/dist/propagateDependencyUpdates-xcPvP5SP.js +306 -0
  18. package/dist/propagateDependencyUpdates-xcPvP5SP.js.map +1 -0
  19. package/dist/readPackageHistory-6dC72rZk.js +133 -0
  20. package/dist/readPackageHistory-6dC72rZk.js.map +1 -0
  21. package/dist/resolvePackageTag-2ldvH7PC.js +30 -0
  22. package/dist/resolvePackageTag-2ldvH7PC.js.map +1 -0
  23. package/dist/types.js +0 -1
  24. package/package.json +15 -3
  25. package/src/analyzer.ts +7 -2
  26. package/src/builder.ts +12 -3
  27. package/src/changelog.ts +17 -6
  28. package/src/config/resolvePlugin.ts +1 -1
  29. package/src/git/commit/getParsedGitCommit.ts +4 -1
  30. package/src/git/commit/parseGitCommit.ts +27 -2
  31. package/src/git/commit/parseGitPrettyFormat.ts +4 -1
  32. package/src/git/history/expandGitHistory.ts +17 -3
  33. package/src/git/history/readParsedGitHistory.ts +8 -2
  34. package/src/git/repository/isGitShallowRepository.ts +2 -1
  35. package/src/git/tag/ensureGitTag.ts +35 -3
  36. package/src/plugin/createHostReleasePlugin.ts +255 -0
  37. package/src/plugin/index.ts +1 -0
  38. package/src/types.ts +1 -0
  39. package/src/util/captureCommandOutput.ts +140 -0
  40. package/src/util/execCommand.ts +9 -0
  41. package/src/util/formatFile.ts +12 -3
  42. package/src/util/index.ts +1 -0
  43. package/src/util/interpolate.ts +5 -3
  44. package/src/util/isQuietEnvironment.ts +19 -13
  45. package/src/workflow/analysis/propagateDependencyUpdates.ts +1 -0
  46. package/src/workflow/changelog/buildChangelog.ts +27 -4
  47. package/src/workflow/changelog/buildReleaseNotes.ts +1 -1
  48. package/src/workflow/changelog/index.ts +0 -1
  49. package/src/workflow/changelog/prependChangelog.ts +5 -2
  50. package/src/workflow/changelog/writeChangelog.ts +5 -2
  51. package/src/workflow/commit/generateReleaseCommitMessage.ts +1 -1
  52. package/src/workflow/discovery/discoverPackageTag.ts +5 -2
  53. package/src/workflow/discovery/resolvePackageStableTag.ts +12 -7
  54. package/src/workflow/discovery/resolvePackageTag.ts +5 -2
  55. package/src/workflow/discovery/sortPackages.ts +5 -4
  56. package/src/workflow/discovery/verifyPackageTag.ts +6 -3
  57. package/src/workflow/report/printReleaseReport.ts +6 -1
  58. package/src/workflow/version/bumpVersion.ts +0 -1
  59. package/src/workflow/version/index.ts +0 -1
  60. package/dist/formatError-BMsun8Wi.js +0 -22
  61. package/dist/formatError-BMsun8Wi.js.map +0 -1
  62. package/dist/types-la_KkjCS.js +0 -1
  63. package/dist/workflow-Cqg6rLVB.js +0 -2936
  64. package/dist/workflow-Cqg6rLVB.js.map +0 -1
  65. package/src/workflow/changelog/extractPreviousVersion.ts +0 -77
  66. package/src/workflow/version/promotePrereleaseVersions.ts +0 -51
@@ -3,6 +3,7 @@
3
3
 
4
4
  import { DEFAULT_CHANGELOG_FILE } from '#config'
5
5
  import type { ReleasePlan } from '#types'
6
+ import type { ConsolaInstance } from 'consola/core'
6
7
  import path from 'node:path'
7
8
  import { prependChangelog } from './prependChangelog'
8
9
 
@@ -11,17 +12,19 @@ import { prependChangelog } from './prependChangelog'
11
12
  *
12
13
  * @param cwd Repository working directory
13
14
  * @param plan Release plan containing package and changelog content
15
+ * @param logger Optional logger that receives formatting failures
14
16
  * @returns Promise that resolves when the changelog file has been written
15
17
  */
16
18
  export async function writeChangelog(
17
19
  cwd: string,
18
- plan: ReleasePlan
20
+ plan: ReleasePlan,
21
+ logger?: ConsolaInstance
19
22
  ): Promise<void> {
20
23
  if (plan.release?.changelog) {
21
24
  const changelogFile = plan.package.changelogFile || DEFAULT_CHANGELOG_FILE
22
25
 
23
26
  const filePath = path.join(cwd, plan.package.location, changelogFile)
24
27
 
25
- await prependChangelog(filePath, plan.release.changelog)
28
+ await prependChangelog(filePath, plan.release.changelog, logger)
26
29
  }
27
30
  }
@@ -4,7 +4,7 @@
4
4
  import { GIT_TRAILER_RELEASE_AGENT } from '#config'
5
5
  import { mergeGitHistory } from '#git'
6
6
  import type { GitCommit, GitCommitType, ReleasePlan } from '#types'
7
- import { version } from '../../../package.json'
7
+ import { version } from '../../../package.json' with { type: 'json' }
8
8
 
9
9
  const NOTABLE_TYPES: readonly GitCommitType[] = [
10
10
  'feat',
@@ -8,6 +8,7 @@ import {
8
8
  readGitFile,
9
9
  resolveGitRevision,
10
10
  } from '#git'
11
+ import type { EnsureGitTagOptions } from '#git'
11
12
  import type { Package, Tag } from '#types'
12
13
  import { readFile } from 'node:fs/promises'
13
14
  import path from 'node:path'
@@ -24,11 +25,13 @@ import { verifyPackageTag } from './verifyPackageTag'
24
25
  *
25
26
  * @param cwd The current working directory
26
27
  * @param pkg The package configuration object
28
+ * @param options Dry-run and logging guards for the local tag cleanup
27
29
  * @returns The validated `Tag` object or null if validation fails
28
30
  */
29
31
  export async function discoverPackageTag(
30
32
  cwd: string,
31
- pkg: Package
33
+ pkg: Package,
34
+ options?: EnsureGitTagOptions
32
35
  ): Promise<Tag | null> {
33
36
  if (pkg.tag) {
34
37
  return pkg.tag
@@ -64,7 +67,7 @@ export async function discoverPackageTag(
64
67
  return null
65
68
  }
66
69
 
67
- if (!(await verifyPackageTag(cwd, pkg, expectedTagName))) {
70
+ if (!(await verifyPackageTag(cwd, pkg, expectedTagName, options))) {
68
71
  return null
69
72
  }
70
73
 
@@ -3,8 +3,8 @@
3
3
 
4
4
  import { DEFAULT_CHANGELOG_FILE } from '#config'
5
5
  import { generateGitTagName, getGitTagMessage } from '#git'
6
+ import type { EnsureGitTagOptions } from '#git'
6
7
  import type { Package, Tag } from '#types'
7
- import assert from 'node:assert'
8
8
  import { readFile } from 'node:fs/promises'
9
9
  import path from 'node:path'
10
10
  import semver from 'semver'
@@ -18,15 +18,21 @@ import { verifyPackageTag } from './verifyPackageTag'
18
18
  * semver order. Ignores prerelease versions unless transitioning across major
19
19
  * or prerelease boundaries, and verifies that the matching Git tag exists.
20
20
  *
21
+ * Stable releases below `1.0.0` are only considered when the preceding
22
+ * version was a prerelease, so a repository with exclusively 0.x releases
23
+ * resolves to no stable tag.
24
+ *
21
25
  * @param cwd Absolute path to the root working directory
22
26
  * @param pkg Package configuration object
27
+ * @param options Dry-run and logging guards for the local tag cleanup
23
28
  * @returns Verified tag metadata object or `null` if no stable tag is resolved
24
29
  * @throws If a version is invalid, versions are not in strict descending
25
30
  * order, or the corresponding Git tag is missing
26
31
  */
27
32
  export async function resolvePackageStableTag(
28
33
  cwd: string,
29
- pkg: Package
34
+ pkg: Package,
35
+ options?: EnsureGitTagOptions
30
36
  ): Promise<Tag | null> {
31
37
  const changelogFile = pkg.changelogFile || DEFAULT_CHANGELOG_FILE
32
38
 
@@ -51,10 +57,9 @@ export async function resolvePackageStableTag(
51
57
  for (const version of iterateChangelogVersions(changelogContent)) {
52
58
  const currentVersion = semver.parse(version)
53
59
 
54
- assert(
55
- currentVersion,
56
- `Version "${version}" is not a valid semantic version.`
57
- )
60
+ if (!currentVersion) {
61
+ throw new Error(`Version "${version}" is not a valid semantic version.`)
62
+ }
58
63
 
59
64
  if (precedingVersion && semver.gte(currentVersion, precedingVersion)) {
60
65
  throw new Error(
@@ -69,7 +74,7 @@ export async function resolvePackageStableTag(
69
74
  ) {
70
75
  const tagName = generateGitTagName(pkg.entry, pkg.name, version)
71
76
 
72
- if (!(await verifyPackageTag(cwd, pkg, tagName))) {
77
+ if (!(await verifyPackageTag(cwd, pkg, tagName, options))) {
73
78
  throw new Error(
74
79
  `Git tag "${tagName}" is not associated with package "${pkg.name ?? ''}" in directory "${pkg.location}".`
75
80
  )
@@ -2,6 +2,7 @@
2
2
  // Copyright (c) 2026 Fai
3
3
 
4
4
  import { generateGitTagName, getGitTagMessage } from '#git'
5
+ import type { EnsureGitTagOptions } from '#git'
5
6
  import type { Package, Tag } from '#types'
6
7
  import { verifyPackageTag } from './verifyPackageTag'
7
8
 
@@ -14,11 +15,13 @@ import { verifyPackageTag } from './verifyPackageTag'
14
15
  *
15
16
  * @param cwd Repository working directory
16
17
  * @param pkg Package descriptor containing version and location context
18
+ * @param options Dry-run and logging guards for the local tag cleanup
17
19
  * @returns A promise resolving to the tag metadata or null when not found
18
20
  */
19
21
  export async function resolvePackageTag(
20
22
  cwd: string,
21
- pkg: Package
23
+ pkg: Package,
24
+ options?: EnsureGitTagOptions
22
25
  ): Promise<Tag | null> {
23
26
  if (pkg.tag) {
24
27
  return pkg.tag
@@ -34,7 +37,7 @@ export async function resolvePackageTag(
34
37
  return null
35
38
  }
36
39
 
37
- if (await verifyPackageTag(cwd, pkg, expectedTagName)) {
40
+ if (await verifyPackageTag(cwd, pkg, expectedTagName, options)) {
38
41
  return {
39
42
  name: expectedTagName,
40
43
  message: await getGitTagMessage(cwd, expectedTagName),
@@ -11,12 +11,13 @@ interface PackageNode {
11
11
  /**
12
12
  * Sort workspace packages topologically based on their dependency graphs.
13
13
  *
14
- * Deepest dependents are placed first in the resulting array, ensuring that
15
- * a package always precedes its own dependencies. Ties and circular dependencies
16
- * are resolved deterministically using an alphabetical sort on the package directory (`dir`).
14
+ * Deepest dependencies are placed first in the resulting array, ensuring that
15
+ * a package always follows its own dependencies. Ties and circular dependencies
16
+ * are resolved deterministically using an alphabetical sort on the package
17
+ * location (`location`).
17
18
  *
18
19
  * @param packages The workspace packages to sort.
19
- * @returns A new array of packages sorted by dependency depth and directory path.
20
+ * @returns A new array of packages sorted by dependency depth and location.
20
21
  */
21
22
  export function sortPackages(packages: readonly Package[]): Package[] {
22
23
  const packageNodes: PackageNode[] = []
@@ -7,6 +7,7 @@ import {
7
7
  getParsedGitCommit,
8
8
  isGitTagConnected,
9
9
  } from '#git'
10
+ import type { EnsureGitTagOptions } from '#git'
10
11
  import type { GitCommit, Package } from '#types'
11
12
  import { packageContainsCommit } from '../analysis/packageContainsCommit'
12
13
 
@@ -20,14 +21,16 @@ import { packageContainsCommit } from '../analysis/packageContainsCommit'
20
21
  * @param cwd Repository working directory path
21
22
  * @param pkg Package descriptor containing version and location context
22
23
  * @param tagName Name of the Git tag to verify
24
+ * @param options Dry-run and logging guards for the local tag cleanup
23
25
  * @returns True if the tag is valid and connected; otherwise, false
24
26
  */
25
27
  export async function verifyPackageTag(
26
28
  cwd: string,
27
29
  pkg: Package,
28
- tagName: string
30
+ tagName: string,
31
+ options?: EnsureGitTagOptions
29
32
  ): Promise<boolean> {
30
- await ensureGitTag(cwd, tagName)
33
+ await ensureGitTag(cwd, tagName, options)
31
34
 
32
35
  const tagRef = `refs/tags/${tagName}`
33
36
 
@@ -43,7 +46,7 @@ export async function verifyPackageTag(
43
46
  return false
44
47
  }
45
48
 
46
- await expandGitHistory(cwd, { until: tagRef })
49
+ await expandGitHistory(cwd, { until: tagRef, logger: options?.logger })
47
50
 
48
51
  return isGitTagConnected(cwd, tagName)
49
52
  }
@@ -74,7 +74,12 @@ export function printReleaseReport(
74
74
 
75
75
  version = ` ${version} `
76
76
 
77
- const type = plan.release.type && colors.gray(` ${plan.release.type} `)
77
+ // `Release.type` is non-optional on the type level, but report data built
78
+ // by hooks and tests can reach this view without a derived type, so the
79
+ // guard keeps the report readable instead of printing "undefined".
80
+ const type = plan.release.type
81
+ ? colors.gray(` ${plan.release.type} `)
82
+ : undefined
78
83
 
79
84
  const summary = [
80
85
  name,
@@ -7,7 +7,6 @@ import { extractVersionQualifier } from './extractVersionQualifier'
7
7
 
8
8
  export interface BumpVersionOptions {
9
9
  version: string
10
- private?: boolean | undefined
11
10
  release: ReleaseType | null | undefined
12
11
  identifier?: string | null | undefined
13
12
  transition?: VersionTransition | null | undefined
@@ -8,4 +8,3 @@ export * from './extractVersionQualifier'
8
8
  export * from './isSameReleaseCycle'
9
9
  export * from './isStableVersion'
10
10
  export * from './pickPriorityReleaseType'
11
- export * from './promotePrereleaseVersions'
@@ -1,22 +0,0 @@
1
- // src/util/formatError.ts
2
- /**
3
- * Normalize an unknown thrown value for logging or display.
4
- *
5
- * - If `err` is an `Error`, returns its `message` string.
6
- * - Otherwise returns the original `err` value unchanged (may be a string,
7
- * object, number, `null`, or `undefined`).
8
- *
9
- * This function intentionally does not coerce non-Error values to strings so
10
- * callers can decide how to render structured values.
11
- *
12
- * @param err The thrown value to normalize
13
- * @returns The error message when `err` is an `Error`, otherwise the original value
14
- */
15
- function formatError(err) {
16
- if (Error.isError(err)) return err.message;
17
- if (typeof err === "string") return err;
18
- return err;
19
- }
20
- export { formatError as t };
21
-
22
- //# sourceMappingURL=formatError-BMsun8Wi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatError-BMsun8Wi.js","names":[],"sources":["../src/util/formatError.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\n/**\n * Normalize an unknown thrown value for logging or display.\n *\n * - If `err` is an `Error`, returns its `message` string.\n * - Otherwise returns the original `err` value unchanged (may be a string,\n * object, number, `null`, or `undefined`).\n *\n * This function intentionally does not coerce non-Error values to strings so\n * callers can decide how to render structured values.\n *\n * @param err The thrown value to normalize\n * @returns The error message when `err` is an `Error`, otherwise the original value\n */\nexport function formatError<T>(err: T): T | string {\n if (Error.isError(err)) return err.message\n if (typeof err === 'string') return err\n return err\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,SAAgB,YAAe,KAAoB;CACjD,IAAI,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI;CACnC,IAAI,OAAO,QAAQ,UAAU,OAAO;CACpC,OAAO;AACT"}
@@ -1 +0,0 @@
1
- export {};