Conversation
…rror - Replace mri dependency with built-in node:util parseArgs for CLI flags - Make CLI flags lazy via getter functions (getIsDryRun, getIsVerbose, getIsCI) - Convert runIfNotDry from frozen const to dynamic function - Remove module-level side-effect logging block - Add ReleaseError class with printReleaseError for structured error output - Make exitWithError throw ReleaseError instead of calling process.exit(1) - Add withErrorBoundary at entry point to catch ReleaseError and exit - Fix discoverWorkspacePackages to return err() instead of exitWithError - Update isCI call sites to use getIsCI()
- Extract resolveAutoVersion from calculateVersionUpdates (pure, no IO) - Extract computeDependencyRange from updateDependency (pure, no IO) - Extract filterGlobalCommits from getGlobalCommitsPerPackage (pure, no IO) - Wire extracted functions into production callers - Export fileMatchesPackageFolder, isGlobalCommit, findCommitRange, DEPENDENCY_FILES - Export getDependencyUpdates for internal use - Fix console.warn to logger.warn in checkoutBranch
- Delete unused src/core/result-helpers.ts - Remove @effect/language-service plugin from tsconfig.json - Unexport dead functions: createPackageTag, pushTag, getPackageMetadata, formatCommitLine, dryRun, getDependencyUpdates - Unexport dead types: CommitStatusState, CommitStatusOptions, UpsertPullRequestOptions, UpsertReleaseOptions, GitHubRelease, NPMError, NPMPackageMetadata, FormattedUnknownError, VersionOverride, VersionOverrides - Remove unused GlobalCommitMode type and getIsForce function
…tering - Add tests for formatUnknownError, ReleaseError, exitWithError, printReleaseError - Add tests for getIsCI with various env configurations - Add tests for resolveAutoVersion with commits, overrides, and edge cases - Add tests for computeDependencyRange (workspace:*, peer deps, regular deps) - Add tests for filterGlobalCommits, fileMatchesPackageFolder, isGlobalCommit, findCommitRange, and DEPENDENCY_FILES - Fix test helper: add missing githubClient, access, combinePrereleaseIntoFirstStable - Fix unresolved import in test/core/types.test.ts
Remove all Effect-TS references and document current architecture: plain TypeScript with Result<T,E> pattern, ReleaseError thrown at workflow level and caught at entry boundary, lazy CLI flags via node:util parseArgs, and extracted pure testable functions.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughLarge-scale migration from Effect-TS architecture to plain TypeScript with Result-based error handling. Introduces pure, testable helper functions (resolveAutoVersion, computeDependencyRange, etc.), new ReleaseError class with centralized boundary handling, lazy CLI flag parsing via node:util, and reduces public API surface for internal types while expanding utilities for external testing. Changes
Sequence DiagramsequenceDiagram
participant CLI as CLI Entry<br/>(src/index.ts)
participant Boundary as Error Boundary<br/>(withErrorBoundary)
participant Ops as Release Operations<br/>(verify/prepare/publish)
participant Core as Core Modules<br/>(git/npm/github)
participant ErrorHandler as Error Handler<br/>(printReleaseError)
CLI->>CLI: Parse CLI flags lazily<br/>(getIsDryRun, getIsVerbose, getIsCI)
CLI->>Boundary: Wrap operation execution
Boundary->>Ops: Execute release scripts
Ops->>Core: Call core functions<br/>(may return Result or throw)
alt Operation Success
Core-->>Ops: Result.ok(value)
Ops-->>Boundary: Complete successfully
Boundary-->>CLI: Return control
else Operation Fails
Core-->>Ops: Result.err(error) or throw
Ops-->>Boundary: ReleaseError thrown
Boundary->>ErrorHandler: Catch ReleaseError
ErrorHandler->>ErrorHandler: Format error with<br/>message, hint, cause, stack
ErrorHandler-->>CLI: Print to stderr + exit
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~70 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR performs a broad cleanup/refactor of the release-scripts codebase: it removes mri in favor of node:util’s parseArgs, introduces a ReleaseError-based error flow, extracts/test-drives several pure versioning helpers, and updates documentation to reflect the current non-Effect architecture.
Changes:
- Refactor CLI flag parsing (
mri→parseArgs) and adjust logging/dry-run behavior. - Introduce
ReleaseError+ entrypoint error boundary; refactor error handling paths to be testable. - Extract and add tests for pure versioning/commit-filtering helpers (dependency ranges, global commit filtering, dependent bumps).
Reviewed changes
Copilot reviewed 23 out of 25 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tsconfig.json |
Removes TS language-service plugin config. |
src/shared/utils.ts |
Replaces mri with parseArgs; makes CI/verbose/dry-run checks lazy getters. |
src/shared/errors.ts |
Adds ReleaseError, printReleaseError, and changes exitWithError to throw. |
src/index.ts |
Adds an error boundary to catch ReleaseError and exit consistently. |
src/versioning/version.ts |
Extracts resolveAutoVersion and computeDependencyRange; refactors CI gating. |
src/versioning/commits.ts |
Exports commit classification helpers and introduces filterGlobalCommits. |
src/core/workspace.ts |
Switches missing-package handling from process-exit to Result error return. |
src/core/git.ts |
Routes unexpected checkout output through logger.warn; unexports some helpers. |
src/core/npm.ts |
Unexports internal types/helpers (e.g. getPackageMetadata). |
src/core/github.ts |
Narrows exported surface by making several types internal. |
src/operations/changelog-format.ts |
Makes formatCommitLine internal to the module. |
src/core/result-helpers.ts |
Removes dead helper module. |
src/shared/types.ts |
Removes dead GlobalCommitMode export. |
test/** |
Adds coverage for errors/utils/version resolution/dependency ranges/global commits/package graph/dependent bumps. |
AGENTS.md |
Rewrites documentation to match current architecture and module layout. |
package.json / pnpm-lock.yaml |
Removes mri dependency. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const determinedBump = determineHighestBump(allCommits); | ||
| const effectiveBump = override?.type || determinedBump; | ||
| const autoVersion = getNextVersion(pkg.version, determinedBump); | ||
| const resolvedVersion = override?.version || autoVersion; |
| const globalCommits = commits.filter((commit) => { | ||
| const files = commitFilesMap.get(commit.shortHash); | ||
| return files ? isGlobalCommit(workspaceRoot, files, packagePaths) : false; | ||
| }); |
| export function findCommitRange(packageCommits: Map<string, GitCommit[]>): { oldest: string; newest: string } | null { | ||
| let oldestCommit: string | null = null; | ||
| let newestCommit: string | null = null; | ||
|
|
| function parseCLIFlags(): { dry: boolean; verbose: boolean; force: boolean } { | ||
| const { values } = parseArgs({ | ||
| args: process.argv.slice(2), | ||
| options: { | ||
| dry: { type: "boolean", short: "d", default: false }, |
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores