@reelout/core 0.5.3 → 0.7.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.
Files changed (44) hide show
  1. package/dist/analyzer.js +23 -6
  2. package/dist/analyzer.js.map +1 -1
  3. package/dist/builder.js +2 -2
  4. package/dist/builder.js.map +1 -1
  5. package/dist/changelog.js +1 -1
  6. package/dist/index.js +2 -22
  7. package/dist/index.js.map +1 -1
  8. package/dist/{workflow-CxxvBV04.js → workflow-BolfadM0.js} +135 -136
  9. package/dist/workflow-BolfadM0.js.map +1 -0
  10. package/package.json +1 -1
  11. package/src/analyzer.ts +45 -12
  12. package/src/builder.ts +2 -2
  13. package/src/git/history/index.ts +2 -2
  14. package/src/git/history/{showGitHistory.ts → readGitHistory.ts} +3 -3
  15. package/src/git/history/{showParsedGitHistory.ts → readParsedGitHistory.ts} +6 -6
  16. package/src/git/tag/generateGitTagName.ts +1 -0
  17. package/src/git/tag/index.ts +1 -1
  18. package/src/git/tag/{isGitTagPointed.ts → isGitTagExact.ts} +1 -1
  19. package/src/types.ts +1 -0
  20. package/src/util/isMatch.ts +11 -7
  21. package/src/workflow/analysis/deriveChangeReleases.ts +3 -3
  22. package/src/workflow/analysis/deriveTransitionReleases.ts +1 -1
  23. package/src/workflow/analysis/index.ts +2 -4
  24. package/src/workflow/analysis/{isCommitForPackage.ts → packageContainsCommit.ts} +4 -1
  25. package/src/workflow/analysis/readPackageHistory.ts +53 -0
  26. package/src/workflow/{committing → commit}/index.ts +0 -1
  27. package/src/workflow/discovery/filterPackages.ts +27 -0
  28. package/src/workflow/discovery/index.ts +1 -0
  29. package/src/workflow/discovery/verifyPackageTag.ts +2 -2
  30. package/src/workflow/index.ts +2 -2
  31. package/src/workflow/{versioning/determineReleaseType.ts → version/deriveCommitReleaseType.ts} +2 -2
  32. package/src/workflow/{versioning → version}/deriveReleaseType.ts +2 -2
  33. package/src/workflow/{versioning → version}/index.ts +2 -1
  34. package/dist/workflow-CxxvBV04.js.map +0 -1
  35. package/src/workflow/analysis/sliceUnreleased.ts +0 -36
  36. package/src/workflow/analysis/streamPackageCommits.ts +0 -34
  37. package/src/workflow/committing/isReleaseCommit.ts +0 -56
  38. /package/src/workflow/{committing → commit}/generateReleaseCommitMessage.ts +0 -0
  39. /package/src/workflow/{versioning → version}/bumpVersion.ts +0 -0
  40. /package/src/workflow/{versioning → version}/extractVersionQualifier.ts +0 -0
  41. /package/src/workflow/{versioning → version}/isSameReleaseCycle.ts +0 -0
  42. /package/src/workflow/{versioning → version}/isStableVersion.ts +0 -0
  43. /package/src/workflow/{versioning → version}/pickPriorityReleaseType.ts +0 -0
  44. /package/src/workflow/{analysis → version}/promotePrereleaseVersions.ts +0 -0
@@ -9,5 +9,5 @@ export * from './getCurrentGitTag'
9
9
  export * from './getGitTagMessage'
10
10
  export * from './getLatestGitTag'
11
11
  export * from './isGitTagConnected'
12
- export * from './isGitTagPointed'
12
+ export * from './isGitTagExact'
13
13
  export * from './isGitTagPresent'
@@ -11,7 +11,7 @@ import { execGit } from '#util'
11
11
  * @param commit Commit hash to compare against
12
12
  * @returns `true` when the tag points at `commit`, otherwise `false`
13
13
  */
14
- export async function isGitTagPointed(
14
+ export async function isGitTagExact(
15
15
  cwd: string,
16
16
  tag: string,
17
17
  commit: string
package/src/types.ts CHANGED
@@ -159,6 +159,7 @@ export interface ReleaseContext<P extends Package = Package> {
159
159
  author: GitAuthor
160
160
  classifier: CommitClassifier
161
161
  rules: ResolvedReleaseRule[]
162
+ filter: string[]
162
163
  type: ReleaseTypeHint
163
164
  versionQualifier: string | undefined
164
165
  releaseChannel: string | undefined
@@ -6,8 +6,9 @@ import { minimatch } from 'minimatch'
6
6
  /**
7
7
  * Determine whether a target string matches glob patterns.
8
8
  *
9
- * Matches positive and negative glob patterns using dotfile support. Automatically
10
- * expands a single negative pattern by prepending a global wildcard match.
9
+ * Matches positive and negative glob patterns using dotfile support.
10
+ * Negation-only patterns are expanded with a catch-all pattern so they match
11
+ * every named target the patterns do not exclude.
11
12
  *
12
13
  * @param target Target string to evaluate against glob patterns
13
14
  * @param patterns Single glob pattern or list of patterns to evaluate
@@ -18,11 +19,14 @@ export function isMatch(
18
19
  patterns: string | readonly string[]
19
20
  ): boolean {
20
21
  if (typeof patterns === 'string') {
21
- if (patterns.startsWith('!')) {
22
- patterns = ['**/*', patterns]
23
- } else {
24
- patterns = [patterns]
25
- }
22
+ patterns = [patterns]
23
+ }
24
+
25
+ if (
26
+ patterns.length > 0 &&
27
+ patterns.every((pattern) => pattern.startsWith('!'))
28
+ ) {
29
+ patterns = ['**/*', ...patterns]
26
30
  }
27
31
 
28
32
  const positives: string[] = []
@@ -7,8 +7,8 @@ import type {
7
7
  ReleasePlan,
8
8
  ReleaseTypeHint,
9
9
  } from '#types'
10
- import { deriveReleaseType, pickPriorityReleaseType } from '../versioning'
11
- import { isCommitForPackage } from './isCommitForPackage'
10
+ import { deriveReleaseType, pickPriorityReleaseType } from '../version'
11
+ import { packageContainsCommit } from './packageContainsCommit'
12
12
 
13
13
  /**
14
14
  * Analyze commit history to update release plans for packages.
@@ -34,7 +34,7 @@ export async function deriveChangeReleases(
34
34
  ): Promise<ReleasePlan[]> {
35
35
  for await (const commit of history) {
36
36
  plans = plans.map((plan): ReleasePlan => {
37
- if (!isCommitForPackage(plan.package, commit)) {
37
+ if (!packageContainsCommit(plan.package, commit)) {
38
38
  return plan
39
39
  }
40
40
 
@@ -8,7 +8,7 @@ import type {
8
8
  VersionTransition,
9
9
  } from '#types'
10
10
  import semver from 'semver'
11
- import { extractVersionQualifier } from '../versioning/extractVersionQualifier'
11
+ import { extractVersionQualifier } from '../version/extractVersionQualifier'
12
12
 
13
13
  /**
14
14
  * Derive transition release types for release plans based on version qualifiers.
@@ -3,8 +3,6 @@
3
3
 
4
4
  export * from './deriveChangeReleases'
5
5
  export * from './deriveTransitionReleases'
6
- export * from './isCommitForPackage'
7
- export * from './promotePrereleaseVersions'
6
+ export * from './packageContainsCommit'
8
7
  export * from './propagateDependencyUpdates'
9
- export * from './sliceUnreleased'
10
- export * from './streamPackageCommits'
8
+ export * from './readPackageHistory'
@@ -13,7 +13,10 @@ import path from 'node:path'
13
13
  * @param commit Parsed commit containing changed file paths
14
14
  * @returns `true` if any changed file matches the package pattern
15
15
  */
16
- export function isCommitForPackage(pkg: Package, commit: GitCommit): boolean {
16
+ export function packageContainsCommit(
17
+ pkg: Package,
18
+ commit: GitCommit
19
+ ): boolean {
17
20
  return commit.files.some((file) => {
18
21
  const { location } = pkg
19
22
  const files = pkg.files || path.join(location, ALL_FILES)
@@ -0,0 +1,53 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 Fai
3
+
4
+ import { readParsedGitHistory, type ReadGitHistoryOptions } from '#git'
5
+ import type { GitCommit, Package } from '#types'
6
+ import { unique } from '#util'
7
+ import { packageContainsCommit } from './packageContainsCommit'
8
+
9
+ const LITERAL_PATH = /^[^*?[\]{}!+@]*$/
10
+
11
+ /**
12
+ * Yield commits from git history associated with a package.
13
+ *
14
+ * Filters git commit history to yield only entries relevant to the target
15
+ * `pkg` directory. When the package file pattern is a list, plain file
16
+ * entries are added to the git path filter alongside the package directory
17
+ * (duplicates removed), so commits touching extra package files (for example
18
+ * the pnpm workspace manifest) are included. Only entries without glob or
19
+ * pattern metacharacters (wildcards, braces, and the extglob or negation
20
+ * characters used by package file patterns) are passed to git, because git
21
+ * pathspecs would interpret those characters differently. Pattern-like
22
+ * entries are left to `packageContainsCommit`, which matches them with the
23
+ * package's own file-pattern semantics.
24
+ *
25
+ * @param cwd Path to the working directory for git commands
26
+ * @param pkg Package configuration containing the target directory
27
+ * @param options Options for parsing and filtering git history
28
+ * @yields Commits belonging to the specified package
29
+ */
30
+ export async function* readPackageHistory(
31
+ cwd: string,
32
+ pkg: Package,
33
+ options: ReadGitHistoryOptions = {}
34
+ ): AsyncGenerator<GitCommit> {
35
+ options = { ...options }
36
+
37
+ if (!options.filePath) {
38
+ if (Array.isArray(pkg.files)) {
39
+ options.filePath = unique([
40
+ pkg.location,
41
+ ...pkg.files.filter((file) => LITERAL_PATH.test(file)),
42
+ ])
43
+ } else {
44
+ options.filePath = pkg.location
45
+ }
46
+ }
47
+
48
+ for await (const commit of readParsedGitHistory(cwd, options)) {
49
+ if (packageContainsCommit(pkg, commit)) {
50
+ yield commit
51
+ }
52
+ }
53
+ }
@@ -2,4 +2,3 @@
2
2
  // Copyright (c) 2026 Fai
3
3
 
4
4
  export * from './generateReleaseCommitMessage'
5
- export * from './isReleaseCommit'
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 Fai
3
+
4
+ import type { Package } from '#types'
5
+ import { isMatch } from '#util'
6
+
7
+ /**
8
+ * Filter packages by name patterns.
9
+ *
10
+ * Keeps the packages whose names match `patterns`, scoping a release run to
11
+ * a subset of the discovered workspace. Returns a copy of every package when
12
+ * `patterns` is empty.
13
+ *
14
+ * @param packages Workspace packages to filter
15
+ * @param patterns Minimatch patterns to match package names against
16
+ * @returns Packages whose names match the patterns
17
+ */
18
+ export function filterPackages(
19
+ packages: readonly Package[],
20
+ patterns: readonly string[]
21
+ ): Package[] {
22
+ if (patterns.length === 0) {
23
+ return [...packages]
24
+ }
25
+
26
+ return packages.filter((pkg) => isMatch(pkg.name ?? '', patterns))
27
+ }
@@ -3,6 +3,7 @@
3
3
 
4
4
  export * from './buildDependencyGraph'
5
5
  export * from './discoverPackageTag'
6
+ export * from './filterPackages'
6
7
  export * from './resolvePackageStableTag'
7
8
  export * from './resolvePackageTag'
8
9
  export * from './sortPackages'
@@ -8,7 +8,7 @@ import {
8
8
  isGitTagConnected,
9
9
  } from '#git'
10
10
  import type { GitCommit, Package } from '#types'
11
- import { isCommitForPackage } from '../analysis/isCommitForPackage'
11
+ import { packageContainsCommit } from '../analysis/packageContainsCommit'
12
12
 
13
13
  /**
14
14
  * Verify a Git tag against package specifications and repository history.
@@ -39,7 +39,7 @@ export async function verifyPackageTag(
39
39
  return false
40
40
  }
41
41
 
42
- if (!isCommitForPackage(pkg, tagCommit)) {
42
+ if (!packageContainsCommit(pkg, tagCommit)) {
43
43
  return false
44
44
  }
45
45
 
@@ -3,8 +3,8 @@
3
3
 
4
4
  export * from './analysis'
5
5
  export * from './changelog'
6
- export * from './committing'
6
+ export * from './commit'
7
7
  export * from './discovery'
8
8
  export * from './executeReleaseWorkflow'
9
9
  export * from './report'
10
- export * from './versioning'
10
+ export * from './version'
@@ -5,7 +5,7 @@ import type { CommitClassifier, GitCommit, ReleaseType } from '#types'
5
5
  import semver from 'semver'
6
6
 
7
7
  /**
8
- * Determine the release type for a single commit.
8
+ * Derive the release type for a single commit.
9
9
  *
10
10
  * Returns `'minor'` for a commit marked as a breaking change while the
11
11
  * supplied `version` is zero-major (`0.y.z`), and `'major'` otherwise, since
@@ -19,7 +19,7 @@ import semver from 'semver'
19
19
  * @param version Current package version used to adjust zero-major breaking releases
20
20
  * @returns `ReleaseType` string, or `null` when no matching rule applies
21
21
  */
22
- export function determineReleaseType(
22
+ export function deriveCommitReleaseType(
23
23
  classifier: CommitClassifier,
24
24
  commit: GitCommit,
25
25
  version?: string | null | undefined
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) 2026 Fai
3
3
 
4
4
  import type { CommitClassifier, ReleasePlan, ReleaseType } from '#types'
5
- import { determineReleaseType } from './determineReleaseType'
5
+ import { deriveCommitReleaseType } from './deriveCommitReleaseType'
6
6
  import { pickPriorityReleaseType } from './pickPriorityReleaseType'
7
7
 
8
8
  /**
@@ -27,7 +27,7 @@ export function deriveReleaseType(
27
27
  for (const commit of plan.history) {
28
28
  releaseType = pickPriorityReleaseType(
29
29
  releaseType,
30
- determineReleaseType(classifier, commit, plan.package.version)
30
+ deriveCommitReleaseType(classifier, commit, plan.package.version)
31
31
  )
32
32
  }
33
33
 
@@ -2,9 +2,10 @@
2
2
  // Copyright (c) 2026 Fai
3
3
 
4
4
  export * from './bumpVersion'
5
+ export * from './deriveCommitReleaseType'
5
6
  export * from './deriveReleaseType'
6
- export * from './determineReleaseType'
7
7
  export * from './extractVersionQualifier'
8
8
  export * from './isSameReleaseCycle'
9
9
  export * from './isStableVersion'
10
10
  export * from './pickPriorityReleaseType'
11
+ export * from './promotePrereleaseVersions'