Skip to content

Conversation

@AmanVarshney01
Copy link
Owner

@AmanVarshney01 AmanVarshney01 commented Dec 19, 2025

Summary by CodeRabbit

  • Chores
    • Streamlined version bumping process with improved GitHub PR integration for releases, including pre-flight validation and optional auto-merge functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
create-better-t-stack-web Ready Ready Preview, Comment Dec 19, 2025 7:29am
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

The version bump script is enhanced to implement a GitHub PR-driven release workflow, replacing a simple console message with a multi-step process that includes git state validation, branch creation, package updates, build execution, PR creation, and optional auto-merge automation.

Changes

Cohort / File(s) Change Summary
Version Bump Script Workflow
scripts/bump-version.ts
Adds complete GitHub PR release workflow with pre-checks (uncommitted changes validation), branch orchestration (checkout main, pull, create release branch), multi-file version updates, build steps, git commit/push, PR creation via GitHub API, and optional auto-merge confirmation with user prompts

Sequence Diagram

sequenceDiagram actor User participant Script as Bump Script participant Git as Git/GitHub participant Build as Build System participant GitHub as GitHub API User->>Script: Trigger bump version Script->>Git: Check uncommitted changes alt Changes exist Script->>User: Confirm to proceed User-->>Script: Accept/Abort end Script->>Git: Checkout main & pull Script->>Git: Create release branch Script->>Script: Update package.json files Script->>Build: npm/bun install Script->>Build: npm/bun build Script->>Git: Commit changes Script->>Git: Push release branch Script->>GitHub: Create PR GitHub-->>Script: PR created Script->>User: Offer auto-merge option User-->>Script: Enable/Skip auto-merge alt Auto-merge enabled Script->>GitHub: Enable auto-merge on PR end Script->>User: Display next steps 
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Dense, multi-step workflow logic with user interactions and error handling paths
  • Git operations, API calls, and build system orchestration require careful validation
  • User confirmation prompts and auto-merge option flow need thorough testing scenarios
  • Branch management and PR creation logic should be verified for edge cases
  • Package.json updates and build/install steps need verification across the workflow

Poem

🐰 A script that hops through PR's delight,
With branches formed and merges tight,
Confirmations asked, the auto-merge glows,
While building versions through each proposed code flow! 🚀✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the bump version script to create a PR instead of immediate release.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-bump-version

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AmanVarshney01 AmanVarshney01 merged commit 4cdf5e2 into main Dec 19, 2025
3 of 4 checks passed
@AmanVarshney01 AmanVarshney01 deleted the update-bump-version branch December 19, 2025 07:31
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
scripts/bump-version.ts (3)

1-2: Consider using Bun.file instead of node:fs/promises.

Per the coding guidelines, prefer Bun.file over node:fs readFile/writeFile methods for file operations.

🔎 Proposed refactor using Bun.file
-import { readFile, writeFile } from "node:fs/promises"; import { join } from "node:path";

Then update file operations throughout the file:

// Reading files const packageJson = JSON.parse(await Bun.file(CLI_PACKAGE_JSON_PATH).text()); // Writing files await Bun.write(CLI_PACKAGE_JSON_PATH, `${JSON.stringify(packageJson, null, 2)}\n`);

Based on learnings and coding guidelines, Bun.file is the preferred approach for this repository.


10-10: Remove explicit return type.

Per coding guidelines, TypeScript files should not use explicit return types.

🔎 Proposed fix
-async function main(): Promise<void> { +async function main() {

88-93: Consider user experience when switching branches.

The script switches to main and creates a new branch without warning the user. While the uncommitted changes check prevents data loss, if the user is currently on a feature branch, they may be surprised by the branch switch.

Consider adding a confirmation or informing the user before switching:

const currentBranch = (await $`git branch --show-current`.text()).trim(); if (currentBranch !== "main") { console.log(`\n⚠️ You are currently on branch '${currentBranch}'. Switching to main...`); }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1f475 and ff52b5a.

📒 Files selected for processing (1)
  • scripts/bump-version.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)

Define functions using the standard function declaration syntax, not arrow functions

Files:

  • scripts/bump-version.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)

**/*.{ts,tsx}: Use TypeScript type aliases instead of interface declarations
Do not use explicit return types

Files:

  • scripts/bump-version.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

**/*.{ts,tsx,js,jsx}: Use bun <file> instead of node <file> or ts-node <file> for running TypeScript/JavaScript files
Bun automatically loads .env files, so don't use the dotenv package
Use Bun.serve() which supports WebSockets, HTTPS, and routes instead of express
Use bun:sqlite module for SQLite instead of better-sqlite3
Use Bun.redis for Redis instead of ioredis
Use Bun.sql for Postgres instead of pg or postgres.js
Use built-in WebSocket instead of the ws package
Prefer Bun.file over node:fs readFile/writeFile methods
Use Bun.$ template literal syntax instead of execa for shell command execution
Import .css files directly in TypeScript/JavaScript files; Bun's CSS bundler will handle bundling
Run server with bun --hot <file> to enable hot reloading during development

Files:

  • scripts/bump-version.ts
**/*.{ts,tsx,js,jsx,css}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

Use bun build <file> instead of webpack or esbuild for bundling TypeScript, JavaScript, and CSS files

Files:

  • scripts/bump-version.ts
**/*.{html,tsx,ts,jsx,js}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

Use HTML imports with Bun.serve() for frontend instead of Vite

Files:

  • scripts/bump-version.ts
🧠 Learnings (4)
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR Repo: AmanVarshney01/create-better-t-stack PR: 0 File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0 Timestamp: 2025-12-03T07:48:26.419Z Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs` readFile/writeFile methods 

Applied to files:

  • scripts/bump-version.ts
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR Repo: AmanVarshney01/create-better-t-stack PR: 0 File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0 Timestamp: 2025-12-03T07:48:26.419Z Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` 

Applied to files:

  • scripts/bump-version.ts
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR Repo: AmanVarshney01/create-better-t-stack PR: 0 File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0 Timestamp: 2025-12-03T07:48:26.419Z Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution 

Applied to files:

  • scripts/bump-version.ts
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR Repo: AmanVarshney01/create-better-t-stack PR: 0 File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0 Timestamp: 2025-12-03T07:48:26.419Z Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` 

Applied to files:

  • scripts/bump-version.ts
🔇 Additional comments (3)
scripts/bump-version.ts (3)

77-82: Good addition: Pre-flight check for uncommitted changes.

This prevents accidentally losing work or creating commits with unintended changes. The check is well-placed before any git operations begin.


119-134: PR creation workflow looks good.

The PR creation with a descriptive body and automatic branch setup is well-structured. The template literal for the PR body is clean and informative.


148-159: Dynamic step numbering and cleanup are well-handled.

Good attention to detail with the conditional step numbering based on auto-merge selection, and cleaning up by switching back to main at the end.

Comment on lines +137 to +146
const shouldAutoMerge = await confirm({
message: "Enable auto-merge? (PR will merge automatically when tests pass)",
initialValue: true,
});

if (shouldAutoMerge) {
console.log(`\n🔄 Enabling auto-merge...`);
await $`gh pr merge ${branchName} --auto --squash --delete-branch`;
console.log(`✅ Auto-merge enabled. PR will merge automatically when tests pass.`);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Handle user cancellation from confirm prompt.

The confirm function from @clack/prompts returns a symbol (isCancel) when the user cancels (Ctrl+C). The current code doesn't handle this case, which could lead to unexpected behavior.

🔎 Proposed fix
+import { confirm, isCancel, select, text } from "@clack/prompts";

Then update the confirm handling:

 const shouldAutoMerge = await confirm({ message: "Enable auto-merge? (PR will merge automatically when tests pass)", initialValue: true, }); + if (isCancel(shouldAutoMerge)) { + console.log("\n⚠️ Skipping auto-merge setup."); + } else if (shouldAutoMerge) { - if (shouldAutoMerge) { console.log(`\n🔄 Enabling auto-merge...`); await $`gh pr merge ${branchName} --auto --squash --delete-branch`; console.log(`✅ Auto-merge enabled. PR will merge automatically when tests pass.`); }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In scripts/bump-version.ts around lines 137 to 146, the confirm() result from @clack/prompts can return the cancel symbol (isCancel) when the user aborts; update the code to import or reference isCancel from @clack/prompts, check if shouldAutoMerge === isCancel right after the confirm call, and if so print a cancellation message and exit/return early (or treat as a negative response) to avoid continuing with enabling auto-merge; otherwise proceed with the existing true/false handling. 
Comment on lines +151 to +156
if (!shouldAutoMerge) {
console.log(` 2. Merge the PR manually`);
}
console.log(
` ${shouldAutoMerge ? "2" : "3"}. The release workflow will automatically publish to NPM`,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Minor logic issue with step numbering when cancelled.

If shouldAutoMerge is a cancel symbol (not handled currently), the step numbering logic using ternary operator may not behave as expected since a symbol is truthy.

This is related to the cancel handling issue above. Once you handle the cancel case with isCancel, consider using a boolean variable to track the actual state:

const autoMergeEnabled = !isCancel(shouldAutoMerge) && shouldAutoMerge; // Then use autoMergeEnabled for the step numbering
🤖 Prompt for AI Agents
In scripts/bump-version.ts around lines 151 to 156, the ternary-based step numbering treats a cancel Symbol as truthy and misnumbers steps; compute a boolean (e.g., autoMergeEnabled = !isCancel(shouldAutoMerge) && Boolean(shouldAutoMerge)) after handling cancel, then use that boolean for the conditional console.logs and the step number expression so cancel is treated as disabled and numbering remains correct. 
@coderabbitai coderabbitai bot mentioned this pull request Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants