relacher 0.0.6 → 0.0.7-rc.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 (56) hide show
  1. package/lib-types/builder/cargo.d.ts +1 -1
  2. package/lib-types/builder/paths.d.ts +4 -0
  3. package/lib-types/builder/pnpm.d.ts +0 -9
  4. package/lib-types/builder/shared.d.ts +29 -17
  5. package/lib-types/index.d.ts +2 -0
  6. package/lib-types/init.d.ts +0 -5
  7. package/lib-types/lockfile.d.ts +9 -4
  8. package/lib-types/orchestrator.d.ts +44 -0
  9. package/lib-types/prepare.d.ts +1 -1
  10. package/lib-types/run.d.ts +0 -7
  11. package/lib-types/types.d.ts +23 -28
  12. package/lib-types/updater/builder.d.ts +2 -0
  13. package/lib-types/updater/changelog.d.ts +5 -1
  14. package/lib-types/updater/json.d.ts +1 -1
  15. package/lib-types/updater/proxy.d.ts +4 -0
  16. package/lib-types/updater/yaml.d.ts +1 -1
  17. package/lib-types/vcs/commit.d.ts +3 -0
  18. package/lib-types/vcs/common.d.ts +9 -0
  19. package/lib-types/vcs/git.d.ts +5 -6
  20. package/lib-types/vcs/index.d.ts +18 -5
  21. package/lib-types/vcs/jj.d.ts +4 -8
  22. package/lib-types/versioning/index.d.ts +3 -19
  23. package/lib-types/versioning/rc-version-manager.d.ts +4 -11
  24. package/lib-types/versioning/semver.d.ts +13 -0
  25. package/lib-types/versioning/utils.d.ts +3 -1
  26. package/lib-types/versioning/vcs-version-manager.d.ts +21 -3
  27. package/lib-types/workspace/paths.d.ts +4 -0
  28. package/package.json +6 -6
  29. package/src/builder/cargo.ts +101 -131
  30. package/src/builder/paths.ts +46 -0
  31. package/src/builder/pnpm.ts +67 -115
  32. package/src/builder/shared.ts +136 -94
  33. package/src/display/print.ts +6 -50
  34. package/src/index.ts +2 -0
  35. package/src/init.ts +10 -24
  36. package/src/lockfile.ts +50 -9
  37. package/src/orchestrator.ts +178 -0
  38. package/src/prepare.ts +72 -87
  39. package/src/run.ts +5 -29
  40. package/src/types.ts +22 -24
  41. package/src/updater/builder.ts +44 -41
  42. package/src/updater/changelog.ts +53 -3
  43. package/src/updater/json.ts +9 -40
  44. package/src/updater/proxy.ts +30 -0
  45. package/src/updater/yaml.ts +5 -34
  46. package/src/vcs/commit.ts +38 -0
  47. package/src/vcs/common.ts +67 -0
  48. package/src/vcs/git.ts +86 -107
  49. package/src/vcs/index.ts +27 -8
  50. package/src/vcs/jj.ts +90 -131
  51. package/src/versioning/index.ts +3 -31
  52. package/src/versioning/rc-version-manager.ts +33 -100
  53. package/src/versioning/semver.ts +75 -0
  54. package/src/versioning/utils.ts +7 -15
  55. package/src/versioning/vcs-version-manager.ts +78 -86
  56. package/src/workspace/paths.ts +46 -0
@@ -1,4 +1,4 @@
1
1
  import { type PackageList } from './shared';
2
2
  export interface CargoBuilderOptions {
3
3
  }
4
- export declare function loadCargoDeps(cwd: string, options?: CargoBuilderOptions): PackageList;
4
+ export declare function loadCargoDeps(cwd: string, _options?: CargoBuilderOptions): PackageList;
@@ -0,0 +1,4 @@
1
+ import type { PackageConfig } from '../types';
2
+ export declare function normalizePosixPath(filePath: string): string;
3
+ export declare function toPosixRelative(fromDir: string, targetPath: string): string;
4
+ export declare function getNestedExcludedPaths(currentPkg: PackageConfig, allPackages: PackageConfig[]): string[];
@@ -1,13 +1,4 @@
1
1
  import { type PackageList } from './shared';
2
- /**
3
- * Loads a single project package configuration from package.json.
4
- */
5
2
  export declare function pnpmProject(cwd: string): PackageList;
6
- /**
7
- * Parses pnpm-workspace.yaml to identify target members and versioning topologies.
8
- */
9
3
  export declare function pnpmWorkspace(cwd: string): PackageList;
10
- /**
11
- * Auto-detects whether the workspace configuration exists, reverting to single packages.
12
- */
13
4
  export declare function loadPnpmDeps(cwd: string): PackageList;
@@ -1,34 +1,46 @@
1
- import type { PackageConfig } from '../types';
2
- import type { UpdateAction, VersionFallback } from '../updater';
1
+ import type { ChangelogContext, PackageConfig } from '../types';
2
+ import { type UpdateAction, type VersionFallback } from '../updater';
3
3
  export interface PackageListError {
4
4
  name: string;
5
5
  message: string;
6
6
  }
7
- export interface PackageList extends Array<PackageConfig> {
8
- /** Internal array storing any validation/scoping errors */
7
+ export declare class PackageList extends Array<PackageConfig> {
9
8
  errors: PackageListError[];
10
- /** Merges another list or array of configs into this one, inheriting any errors */
11
- append(configs: PackageConfig[]): this;
12
- /** Attaches update actions (e.g. file replacements, changelogs) to a specific package */
9
+ static create(configs?: PackageConfig[]): PackageList;
10
+ append(newConfigs: PackageConfig[] | PackageList): this;
13
11
  onPackageBump(name: string, ...actions: UpdateAction[]): this;
14
- /** Attaches update actions to ALL packages currently in the list */
15
12
  onAllPackages(...actions: UpdateAction[]): this;
13
+ group(groupName: string, ...packageNames: string[]): this;
16
14
  /**
17
- * Couples two packages together so that if one bumps, the other bumps to the exact same version.
18
- * Useful for tightly integrated monorepo packages (e.g. core & cli).
15
+ * Couples two or more packages together so they share the exact same version bump.
16
+ * Supports: `.couple('a', 'b')` or `.couple(['a', 'b'], ['c', 'd'])`.
19
17
  */
20
- couple(a: string, b: string): this;
21
- /** Validates that the provided packages exist in the current scope */
18
+ couple(...args: [string, string] | [string[]]): this;
19
+ /**
20
+ * Automatically adds a CHANGELOG.md update action to each package's directory.
21
+ */
22
+ withChangelogs(options?: {
23
+ only?: string[];
24
+ exclude?: string[];
25
+ template?: (ctx: ChangelogContext) => string;
26
+ }): this;
27
+ /**
28
+ * Attaches a workspace-wide root CHANGELOG.md that captures all changes across packages.
29
+ */
30
+ withRootChangelog(options?: {
31
+ github?: string;
32
+ path?: string;
33
+ template?: (ctx: ChangelogContext) => string;
34
+ }): this;
35
+ /**
36
+ * Declaratively syncs a package version to any file on disk (e.g. `flake.nix`, `README.md`).
37
+ */
38
+ syncVersion(packageName: string, filePath: string, pattern?: string | RegExp, replaceTemplate?: string): this;
22
39
  assertFound(...names: string[]): this;
23
- /** Adds dependency linkages, enforcing that the target dependency is already in scope */
24
40
  addDepsOn(pkgName: string, dependsOn: string | string[]): this;
25
- /** Removes the specified packages from the list entirely */
26
41
  ignore(...names: string[]): this;
27
- /** Removes ALL packages from the list EXCEPT the specified ones */
28
42
  only(...names: string[]): this;
29
- /** Adds custom file paths to watch for changes that should trigger a bump for this package */
30
43
  addWatchFiles(pkgName: string, paths: string | string[]): this;
31
- /** Overrides the fallback strategy used if the package has no previously published tags */
32
44
  setVersionFallback(pkgName: string, fallback: VersionFallback): this;
33
45
  }
34
46
  export declare function createPackageList(configs?: PackageConfig[]): PackageList;
@@ -8,3 +8,5 @@ export * from './updater';
8
8
  export * from './versioning';
9
9
  export * from './lockfile';
10
10
  export * from './init';
11
+ export * from './workspace/paths';
12
+ export * from './orchestrator';
@@ -1,11 +1,6 @@
1
1
  import { Effect } from 'effect';
2
2
  import type { PackageConfig } from './types';
3
3
  import { type VcsProvider } from './vcs';
4
- /**
5
- * Initializes the `.relacher.lock` file if it does not exist.
6
- * It resolves the version using each package's `versionFallback`,
7
- * creates the lockfile, and commits it to establish the baseline.
8
- */
9
4
  export declare function init(packages: PackageConfig[], options?: {
10
5
  cwd?: string;
11
6
  }): Effect.Effect<void, Error, VcsProvider>;
@@ -1,10 +1,15 @@
1
+ import { Effect } from 'effect';
1
2
  import type { DependencyUpdateReport } from './types';
3
+ import type { VcsError, VcsProvider } from './vcs';
4
+ export interface LockfilePackageEntry {
5
+ version: string;
6
+ lastStableVersion?: string;
7
+ }
2
8
  export interface LockfileData {
3
- packages: Record<string, {
4
- version: string;
5
- lastStableVersion?: string;
6
- }>;
9
+ packages: Record<string, LockfilePackageEntry>;
7
10
  }
11
+ export declare const LOCKFILE_NAME = ".relacher.lock";
8
12
  export declare function readLockfile(cwd: string): LockfileData;
9
13
  export declare function writeLockfile(cwd: string, data: LockfileData): void;
10
14
  export declare function updateLockfile(cwd: string, reports: DependencyUpdateReport[]): void;
15
+ export declare function findLastReleaseCommit(vcs: VcsProvider, packageName: string, currentVersion: string): Effect.Effect<string | null, VcsError>;
@@ -0,0 +1,44 @@
1
+ import { type PackageList } from './builder';
2
+ import type { PreparedUpdate } from './types';
3
+ import { type VcsProvider } from './vcs';
4
+ import { type CascadeRules, type SizePatterns } from './versioning';
5
+ export interface RelacherConfig {
6
+ /** Project root directory. Defaults to `process.cwd()` */
7
+ cwd?: string;
8
+ /** Discovered packages list */
9
+ packages: PackageList;
10
+ /** VCS Provider: 'git', 'jj', or custom VcsProvider. Defaults to auto-detection */
11
+ vcs?: 'git' | 'jj' | VcsProvider;
12
+ /** Custom RC identifier (default: 'rc') */
13
+ rcIdentifier?: string;
14
+ /** Custom Conventional Commit patterns */
15
+ sizes?: SizePatterns;
16
+ /** Dependency bump cascade rules */
17
+ cascade?: CascadeRules;
18
+ /** Exclude nested watch paths from parent bumps (default: true) */
19
+ excludeNestedWatches?: boolean;
20
+ /** Custom commit title callback */
21
+ commitTitle?: (bumps: Record<string, string>, defaultTitle: string) => string;
22
+ }
23
+ export declare function createRelacher(config: RelacherConfig): {
24
+ vcs: VcsProvider;
25
+ /**
26
+ * Initializes `.relacher.lock` and creates the baseline commit.
27
+ */
28
+ init(): Promise<void>;
29
+ /**
30
+ * Previews and calculates pending version bumps without writing changes.
31
+ */
32
+ prepare(options?: {
33
+ mode?: "release" | "pre-release";
34
+ }): Promise<PreparedUpdate>;
35
+ /**
36
+ * Writes planned updates to disk and commits via VCS.
37
+ */
38
+ run(prepared: PreparedUpdate): Promise<void>;
39
+ /**
40
+ * Full interactive CLI entry point.
41
+ * Handles arguments, preflight logs, confirmation prompts, dry-runs, and execution.
42
+ */
43
+ cli(argv?: string[]): Promise<void>;
44
+ };
@@ -1,5 +1,5 @@
1
1
  import { Effect } from 'effect';
2
- import type { Commit, PackageConfig, DependencyUpdateReport, IntermediateReport, PrepareOptions, PreparedUpdate } from './types';
2
+ import type { Commit, DependencyUpdateReport, IntermediateReport, PackageConfig, PreparedUpdate, PrepareOptions } from './types';
3
3
  import type { UpdateAction, UpdateActionResolved } from './updater';
4
4
  import { type VersionManager } from './versioning';
5
5
  import type { BumpSize } from './versioning/types';
@@ -1,16 +1,9 @@
1
1
  import { Effect } from 'effect';
2
2
  import type { DependencyUpdateReport, PreparedUpdate } from './types';
3
3
  import { type VcsProvider } from './vcs';
4
- /**
5
- * Builds the multi-line commit message showcasing version bumps, included commits,
6
- * cascade triggers, and first-release indicators.
7
- */
8
4
  export declare function generateCommitMessage(reports: DependencyUpdateReport[], options?: {
9
5
  commitTitle?: (defaultTitle: string, bumps: Record<string, string>) => string;
10
6
  }): string | null;
11
- /**
12
- * Applies calculated updates to files on disk, stages, commits, and tags using the VcsProvider from context.
13
- */
14
7
  export declare function run(prepared: PreparedUpdate, options: {
15
8
  cwd: string;
16
9
  commitTitle?: (defaultTitle: string, bumps: Record<string, string>) => string;
@@ -19,10 +19,13 @@ export interface ChangelogContext {
19
19
  }
20
20
  export interface PackageConfig {
21
21
  name: string;
22
+ manifestPath?: string;
22
23
  watch?: string[];
23
24
  updates: UpdateAction[];
24
25
  versionFallback?: VersionFallback;
25
26
  depends?: string[];
27
+ coupled?: string[];
28
+ group?: string;
26
29
  }
27
30
  export interface PrepareOptions {
28
31
  cwd?: string;
@@ -32,42 +35,34 @@ export interface DependencyError {
32
35
  name: string;
33
36
  message: string;
34
37
  }
35
- export type PreparedUpdate = {
36
- isEmpty: boolean;
37
- deps: DependencyUpdateReport[];
38
- isDirty?: boolean;
39
- } & ({
40
- isInvalid: true;
41
- errors: DependencyError[];
42
- } | {
43
- isInvalid: false;
44
- });
45
- export interface DependencyUpdateReport {
46
- name: string;
47
- currentVersion: string;
48
- lastStableVersion?: string | null;
49
- newVersion: string;
50
- bump: BumpSize;
51
- originalBump?: BumpSize;
52
- commits: Commit[];
53
- commitsSincePreRelease?: Commit[];
54
- updates: UpdateActionResolved[];
55
- depends?: string[];
56
- skipTag?: boolean;
57
- isErroneous?: boolean;
58
- isFirstRelease?: boolean;
59
- }
60
- export interface IntermediateReport {
38
+ export interface BaseReport<TUpdates> {
61
39
  name: string;
62
40
  currentVersion: string;
63
41
  newVersion: string;
64
- bump: BumpSize;
65
42
  lastStableVersion?: string | null;
43
+ bump: BumpSize;
66
44
  originalBump?: BumpSize;
67
45
  commits: Commit[];
68
46
  commitsSincePreRelease?: Commit[];
69
- updates: UpdateAction[];
47
+ updates: TUpdates;
70
48
  depends: string[];
49
+ coupled?: string[];
50
+ group?: string;
71
51
  isErroneous?: boolean;
72
52
  isFirstRelease?: boolean;
73
53
  }
54
+ export type IntermediateReport = BaseReport<UpdateAction[]>;
55
+ export interface DependencyUpdateReport extends BaseReport<UpdateActionResolved[]> {
56
+ skipTag?: boolean;
57
+ }
58
+ export type PreparedUpdate = {
59
+ isEmpty: boolean;
60
+ deps: DependencyUpdateReport[];
61
+ isDirty?: boolean;
62
+ } & ({
63
+ isInvalid: true;
64
+ errors: DependencyError[];
65
+ } | {
66
+ isInvalid: false;
67
+ errors?: DependencyError[];
68
+ });
@@ -4,6 +4,7 @@ export type UpdateActionOptions = {
4
4
  newVersion: string;
5
5
  globalCommits: Commit[];
6
6
  crateCommits: Commit[];
7
+ commitsSincePreRelease?: Commit[];
7
8
  };
8
9
  export interface UpdateActionResolved {
9
10
  kind: string;
@@ -20,6 +21,7 @@ export interface UpdateAction {
20
21
  params: any;
21
22
  prepare(data: UpdateActionOptions): UpdateActionResolved;
22
23
  skipIf(fn: (cwd: string) => boolean): this;
24
+ shouldSkip(cwd: string): boolean;
23
25
  _skipIf(cwd: string): boolean;
24
26
  }
25
27
  export interface VersionFallback {
@@ -1,7 +1,11 @@
1
- import { type ChangelogContext } from '../types';
1
+ import type { ChangelogContext } from '../types';
2
2
  export type ChangelogUpdateParams = {
3
3
  global?: boolean;
4
4
  template?: (ctx: ChangelogContext) => string;
5
5
  };
6
6
  export declare const changelogUpdate: (targetPath: string, params: Pick<import("./builder").UpdateAction, "onlyOn" | "required"> & ChangelogUpdateParams) => import("./builder").UpdateAction;
7
7
  export declare function defaultChangelogTemplate({ version, date, commits }: ChangelogContext): string;
8
+ /**
9
+ * Built-in Conventional Commits template with GitHub links and scoped categorization.
10
+ */
11
+ export declare function githubChangelogTemplate(repo: string): ({ version, date, commits }: ChangelogContext) => string;
@@ -1,5 +1,5 @@
1
1
  import type { DependencyUpdateReport } from '../types';
2
- import { type VersionFallback } from '.';
2
+ import { type VersionFallback } from './builder';
3
3
  export type JsonFallbackParams = {
4
4
  path: string;
5
5
  read: (parsed: any) => string | null | undefined;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Shared recursive Proxy generator tracking modified property paths on target objects.
3
+ */
4
+ export declare function createMutationProxy(obj: any, currentPath: string[] | undefined, onSet: (path: string[], value: any) => void): any;
@@ -1,5 +1,5 @@
1
1
  import type { DependencyUpdateReport } from '../types';
2
- import { type VersionFallback } from '.';
2
+ import { type VersionFallback } from './builder';
3
3
  export type YamlFallbackParams = {
4
4
  path: string;
5
5
  read: (parsed: any) => string | null | undefined;
@@ -0,0 +1,3 @@
1
+ import type { Commit } from '../types';
2
+ export declare function parseCommit(hash: string, author: string, date: string, message: string): Commit;
3
+ export declare function parseCommitLine(line: string): Commit | null;
@@ -0,0 +1,9 @@
1
+ export declare function isInsideGitWorkTree(cwd: string): boolean;
2
+ export declare function isGitTracked(filePath: string, cwd: string): boolean;
3
+ export declare function isInsideJjWorkTree(cwd: string): boolean;
4
+ export declare function isJjTracked(filePath: string, cwd: string): boolean;
5
+ /**
6
+ * Centrally verifies if a given path is tracked by VCS without shell interpolation.
7
+ * If the workspace is not inside any VCS repository, defaults to true.
8
+ */
9
+ export declare function isPathTrackedSync(absolutePath: string, workspaceRoot: string): boolean;
@@ -1,10 +1,9 @@
1
1
  import { Effect, Layer } from 'effect';
2
2
  import type { Commit } from '../types';
3
- import { type VcsProvider } from './index';
4
- export declare function runGit(cmd: string, cwd: string): Effect.Effect<string, never>;
5
- export declare function getGitCommits(name: string, watch: string[], lastCommit: string | null, cwd: string, exclude?: string[]): Effect.Effect<Commit[], never>;
6
- export declare function getGitHeadCommit(cwd: string): Effect.Effect<string, never>;
7
- export declare function findGitLastReleaseCommit(packageName: string, currentVersion: string, cwd: string): Effect.Effect<string | null, never>;
8
- export declare function isGitDirty(cwd: string): Effect.Effect<boolean, never>;
3
+ import { VcsError, type VcsProvider } from './index';
4
+ export declare function runGit(cmdOrArgs: string | string[], cwd: string): Effect.Effect<string, VcsError>;
5
+ export declare function isGitTrackedSync(filePath: string, cwd: string): boolean;
6
+ export declare function parseGitLogOutput(output: string): Commit[];
7
+ export declare function getGitCommits(watch: string[], lastCommit: string | null, cwd: string, exclude?: string[]): Effect.Effect<Commit[], VcsError>;
9
8
  export declare function makeGitVcsProvider(cwd: string): VcsProvider;
10
9
  export declare const GitVcsProviderLive: (cwd: string) => Layer.Layer<VcsProvider, never, never>;
@@ -1,12 +1,25 @@
1
1
  import { Context, type Effect } from 'effect';
2
2
  import type { Commit } from '../types';
3
+ declare const VcsError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
4
+ readonly _tag: "VcsError";
5
+ } & Readonly<A>;
6
+ export declare class VcsError extends VcsError_base<{
7
+ readonly message: string;
8
+ readonly command?: string;
9
+ readonly cause?: unknown;
10
+ }> {
11
+ }
3
12
  export interface VcsProvider {
4
- readonly getCommits: (name: string, watch: string[], lastCommit: string | null, exclude?: string[]) => Effect.Effect<Commit[], Error>;
5
- readonly getHeadCommit: () => Effect.Effect<string, Error>;
6
- readonly findLastReleaseCommit: (packageName: string, currentVersion: string) => Effect.Effect<string | null, Error>;
7
- readonly commit: (message: string) => Effect.Effect<void, Error>;
8
- readonly isDirty: () => Effect.Effect<boolean, Error>;
13
+ readonly getCommits: (watch: string[], lastCommit: string | null, exclude?: string[]) => Effect.Effect<Commit[], VcsError>;
14
+ readonly getHeadCommit: () => Effect.Effect<string, VcsError>;
15
+ readonly commit: (message: string) => Effect.Effect<void, VcsError>;
16
+ readonly isDirty: () => Effect.Effect<boolean, VcsError>;
17
+ readonly findLastReleaseCommit?: (packageName: string, currentVersion: string) => Effect.Effect<string | null, VcsError>;
18
+ readonly getFileAtCommit?: (filePath: string, commitHash: string) => Effect.Effect<string | null, VcsError>;
19
+ readonly getFileHistoryCommits?: (filePath: string) => Effect.Effect<string[], VcsError>;
20
+ readonly isTracked?: (filePath: string) => Effect.Effect<boolean, VcsError>;
9
21
  }
10
22
  export declare const VcsProviderService: Context.Service<VcsProvider, VcsProvider>;
11
23
  export * from './git';
12
24
  export * from './jj';
25
+ export * from './common';
@@ -1,12 +1,8 @@
1
1
  import { Effect, Layer } from 'effect';
2
2
  import type { Commit } from '../types';
3
- import { type VcsProvider } from './index';
4
- export declare function runJj(cmd: string, cwd: string, opts?: {
5
- withStdio: boolean;
6
- }): Effect.Effect<string, never>;
7
- export declare function getJjCommits(name: string, watch: string[], lastCommit: string | null, cwd: string, exclude?: string[]): Effect.Effect<Commit[], never>;
8
- export declare function getJjHeadCommit(cwd: string): Effect.Effect<string, never>;
9
- export declare function findJjLastReleaseCommit(packageName: string, currentVersion: string, cwd: string): Effect.Effect<string | null, never>;
10
- export declare function isJjDirty(cwd: string): Effect.Effect<boolean, never>;
3
+ import { VcsError, type VcsProvider } from './index';
4
+ export declare function runJj(cmdOrArgs: string | string[], cwd: string): Effect.Effect<string, VcsError>;
5
+ export declare function isJjTrackedSync(filePath: string, cwd: string): boolean;
6
+ export declare function getJjCommits(watch: string[], lastCommit: string | null, cwd: string, exclude?: string[]): Effect.Effect<Commit[], VcsError>;
11
7
  export declare function makeJjVcsProvider(cwd: string): VcsProvider;
12
8
  export declare const JjVcsProviderLive: (cwd: string) => Layer.Layer<VcsProvider, never, never>;
@@ -1,21 +1,5 @@
1
- import { Context, Effect } from 'effect';
2
- import type { Commit, PackageConfig, IntermediateReport } from '../types';
3
- import type { BumpSize } from './types';
4
- export interface VersionManager {
5
- readonly isRCMode: boolean;
6
- readonly tagPrereleases: boolean;
7
- readonly getCurrentVersion: (dep: PackageConfig, cwd: string) => Effect.Effect<{
8
- version: string | null;
9
- isFallback: boolean;
10
- lastStableVersion?: string | null;
11
- }, Error>;
12
- readonly getCommits: (dep: PackageConfig, excludePaths: string[], cwd: string) => Effect.Effect<Commit[], Error>;
13
- readonly evaluateCommitsBump: (commits: Commit[]) => BumpSize;
14
- readonly propagateBumps: (sorted: IntermediateReport[]) => void;
15
- readonly propagateCoupledBumps: (sorted: IntermediateReport[]) => void;
16
- readonly bumpVersion: (currentVersion: string, size: BumpSize) => string;
17
- readonly shouldTag: (version: string) => boolean;
18
- }
19
- export declare const VersionManagerService: Context.Service<VersionManager, VersionManager>;
1
+ export * from './types';
2
+ export * from './utils';
3
+ export * from './default-data';
20
4
  export * from './vcs-version-manager';
21
5
  export * from './rc-version-manager';
@@ -1,19 +1,12 @@
1
1
  import { Layer } from 'effect';
2
2
  import { type VcsProvider } from '../vcs';
3
3
  import type { CascadeRules, SizePatterns } from './types';
4
- type RcVersionManagerOptions = {
4
+ export interface RcVersionManagerOptions {
5
5
  sizes?: SizePatterns;
6
6
  cascade?: CascadeRules;
7
7
  rcIdentifier?: string;
8
8
  upgradeReady?: boolean;
9
9
  tagPrereleases?: boolean;
10
- };
11
- export declare const makeRCVersionManager: (vcs: VcsProvider, options?: RcVersionManagerOptions) => import(".").VersionManager;
12
- export declare const RCVersionManagerLive: (options?: {
13
- sizes?: SizePatterns;
14
- cascade?: CascadeRules;
15
- rcIdentifier?: string;
16
- upgradeReady?: boolean;
17
- tagPrereleases?: boolean;
18
- }) => Layer.Layer<import(".").VersionManager, never, VcsProvider>;
19
- export {};
10
+ }
11
+ export declare const makeRCVersionManager: (vcs: VcsProvider, options?: RcVersionManagerOptions) => import("./vcs-version-manager").VersionManager;
12
+ export declare const RCVersionManagerLive: (options?: RcVersionManagerOptions) => Layer.Layer<import("./vcs-version-manager").VersionManager, never, VcsProvider>;
@@ -0,0 +1,13 @@
1
+ export interface ParsedSemVer {
2
+ major: number;
3
+ minor: number;
4
+ patch: number;
5
+ prerelease?: string;
6
+ prereleaseId?: string;
7
+ prereleaseNum?: number;
8
+ }
9
+ export declare function parseSemVer(version: string): ParsedSemVer | null;
10
+ export declare function formatSemVer(semver: ParsedSemVer): string;
11
+ export declare function isVersionGreater(v1: string, v2: string): boolean;
12
+ export declare function bumpStableVersion(version: string, size: 'major' | 'minor' | 'patch'): string;
13
+ export declare function inferLastStableVersion(version: string): string;
@@ -1,3 +1,5 @@
1
- import type { BumpSize, SizePatterns } from "./types";
1
+ import { inferLastStableVersion, isVersionGreater, parseSemVer } from './semver';
2
+ import type { BumpSize, SizePatterns } from './types';
3
+ export { inferLastStableVersion, isVersionGreater, parseSemVer };
2
4
  export declare const matchBumpSize: (message: string, sizes: SizePatterns) => BumpSize;
3
5
  export declare const defaultBumpVersion: (version: string, size: BumpSize) => string;
@@ -1,14 +1,32 @@
1
- import { Layer } from 'effect';
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import { type LockfileData } from '../lockfile';
3
+ import type { Commit, IntermediateReport, PackageConfig } from '../types';
2
4
  import { type VcsProvider } from '../vcs';
3
5
  import type { BumpSize, CascadeRules, SizePatterns } from './types';
6
+ export interface VersionManager {
7
+ readonly isRCMode: boolean;
8
+ readonly tagPrereleases: boolean;
9
+ readonly getCurrentVersion: (dep: PackageConfig, cachedLockfile: LockfileData, cwd: string) => {
10
+ version: string | null;
11
+ isFallback: boolean;
12
+ lastStableVersion?: string | null;
13
+ };
14
+ readonly getCommits: (dep: PackageConfig, cachedLockfile: LockfileData, excludePaths: string[], cwd: string) => Effect.Effect<Commit[], Error>;
15
+ readonly evaluateCommitsBump: (commits: Commit[]) => BumpSize;
16
+ readonly propagateBumps: (sorted: IntermediateReport[]) => void;
17
+ readonly propagateCoupledBumps: (sorted: IntermediateReport[]) => void;
18
+ readonly bumpVersion: (currentVersion: string, size: BumpSize) => string;
19
+ readonly shouldTag: (version: string) => boolean;
20
+ }
21
+ export declare const VersionManagerService: Context.Service<VersionManager, VersionManager>;
4
22
  export declare const makeVcsVersionManager: (vcs: VcsProvider, options?: {
5
23
  sizes?: SizePatterns;
6
24
  cascade?: CascadeRules;
7
25
  bumpVersionImpl?: (version: string, size: BumpSize) => string;
8
26
  isRCMode?: boolean;
9
27
  tagPrereleases?: boolean;
10
- }) => import(".").VersionManager;
28
+ }) => VersionManager;
11
29
  export declare const VcsVersionManagerLive: (options?: {
12
30
  sizes?: SizePatterns;
13
31
  cascade?: CascadeRules;
14
- }) => Layer.Layer<import(".").VersionManager, never, VcsProvider>;
32
+ }) => Layer.Layer<VersionManager, never, VcsProvider>;
@@ -0,0 +1,4 @@
1
+ import type { PackageConfig } from '../types';
2
+ export declare function normalizePosixPath(filePath: string): string;
3
+ export declare function toPosixRelative(fromDir: string, targetPath: string): string;
4
+ export declare function getNestedExcludedPaths(currentPkg: PackageConfig, allPackages: PackageConfig[]): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relacher",
3
- "version": "0.0.6",
3
+ "version": "0.0.7-rc.0",
4
4
  "description": "Scriptable release orchestration library for monorepos",
5
5
  "type": "module",
6
6
  "private": false,
@@ -43,12 +43,12 @@
43
43
  "LICENSE"
44
44
  ],
45
45
  "scripts": {
46
- "ts:build": "tsc -p tsconfig.build.json",
47
- "ts:watch": "tsc --noEmit --incremental --preserveWatchOutput --pretty --watch",
46
+ "ts.build": "tsc -p tsconfig.build.json",
47
+ "ts.watch": "tsc --noEmit --incremental --preserveWatchOutput --pretty --watch",
48
48
  "lint": "oxlint",
49
- "lint:fix": "oxlint --fix",
50
- "lint:watch": "oxlint --watch",
51
- "prepublishOnly": "bun run ts:build"
49
+ "lint.fix": "oxlint --fix",
50
+ "lint.watch": "oxlint --watch",
51
+ "prepublishOnly": "bun run ts.build"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/bun": "latest",