Skip to content

feat: add gitbun vscode extension scaffold - #24

Merged
nirvik34 merged 3 commits into
nirvik34:mainfrom
sanrishi:feat/vscode-extension
May 19, 2026
Merged

feat: add gitbun vscode extension scaffold#24
nirvik34 merged 3 commits into
nirvik34:mainfrom
sanrishi:feat/vscode-extension

Conversation

@sanrishi

@sanrishi sanrishi commented May 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #9

Description

Implements the first-party VSCode extension for Gitbun as described in #9.

What's included

  • CLI bridge (src/gitbun.ts) that spawns npx gitbun, pipes n\n to skip the interactive prompt, strips ANSI codes, and extracts the clean commit message
  • Native VSCode Git API integration to detect staged changes before invoking CLI
  • Progress notification shown while AI generates the message
  • Generated message injected directly into the Source Control input box
  • Keybinding: Ctrl+Shift+G G (Mac: Cmd+Shift+G G)
  • Output channel Gitbun for debug logging
  • Cross-platform support (Windows npx.cmd handled)
  • No duplicate AI logic — reuses existing Gitbun CLI entirely

Type of change

  • New feature (non-breaking change which adds functionality)

GSSoC '26 Contribution Details

  • level:advanced
  • I have been assigned to this issue by a maintainer.

How Has This Been Tested?

  • npm run lint passes without errors

Manually verified the extension compiles cleanly with npm run compile. Unit tests for VSCode extensions require the Extension Development Host which cannot run in CI without additional setup — this is a known VSCode extension testing limitation.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

Summary by CodeRabbit

  • New Features

    • Introduced a new VS Code extension for Gitbun that generates commit messages automatically.
    • Added a command with configurable keybindings (Windows/Linux and macOS) to generate and insert commit messages into the Git commit input box.
    • Validates Git repository and staged changes before generating messages.
  • Documentation

    • Added README with extension features, requirements, and settings guidance.
    • Added CHANGELOG to track release notes.

Review Change Stack

@vercel

vercel Bot commented May 18, 2026

Copy link
Copy Markdown

@sanrishi is attempting to deploy a commit to the nirvik34's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@sanrishi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 53 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 010b78fa-55cb-4f50-8167-db3fc192d768

📥 Commits

Reviewing files that changed from the base of the PR and between 97ee5ae and 5e4ce1f.

📒 Files selected for processing (5)
  • gitbun-vscode/README.md
  • gitbun-vscode/package.json
  • gitbun-vscode/src/extension.ts
  • gitbun-vscode/src/gitbun.ts
  • gitbun-vscode/vsc-extension-quickstart.md

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid enum value. Expected 'chill' | 'assertive', received 'professional' at "reviews.profile"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

This PR establishes the first VS Code extension for gitbun. It defines the extension manifest, integrates the external gitbun CLI via a wrapper, implements the activation handler and command logic to validate prerequisites and inject commit messages into the Git UI, includes test configuration and a sample test, and provides repository setup and developer documentation.

Changes

VS Code Extension for Gitbun

Layer / File(s) Summary
Project Configuration & Build Setup
package.json, tsconfig.json, eslint.config.mjs, .vscode-test.mjs
Extension manifest declares the gitbun.generateCommit command with Windows/Linux and macOS keybindings, VS Code engine requirement, and activation event. TypeScript and ESLint configurations, plus test runner setup, define the development environment.
Gitbun CLI Integration
src/gitbun.ts
Exports generateCommitMessage(cwd) that spawns gitbun via npx, buffers output, strips ANSI sequences, parses the commit message up to the "Accept commit?" prompt, detects "not installed" errors, and resolves with the extracted message or rejects with descriptive errors.
Extension Activation & Command Implementation
src/extension.ts
The activate function creates an output channel, registers the gitbun.generateCommit command handler, validates workspace/repository/staged changes prerequisites, calls generateCommitMessage under a progress UI, injects the result into the Git input box, and logs success or error to the output channel.
Testing Suite
src/test/extension.test.ts
Mocha-style test module with a sample assertion validating the test framework integration.
Repository Configuration & Documentation
.gitignore, .vscodeignore, README.md, CHANGELOG.md, vsc-extension-quickstart.md
Git and packaging ignore patterns exclude build artifacts, source files, and test outputs. README covers features, requirements, and settings. Changelog and quickstart guide document the initial release and extension development workflow.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 New extension hops into view,
Gitbun's AI now right in your editor's hue,
One command, staged changes, a message so bright,
Commit with flair, every time feels just right! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add gitbun vscode extension scaffold' directly and accurately summarizes the main change: adding the foundation files and structure for a VSCode extension for Gitbun.
Linked Issues check ✅ Passed All core objectives from issue #9 are addressed: commit message generation (#9), preview/edit capability (#9), staged change detection (#9), .smartcommitrc support (#9), CLI reuse (#9), and VSCode API usage (#9).
Out of Scope Changes check ✅ Passed All changes are directly related to scaffolding the VSCode extension and implementing the requirements from issue #9; no unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gitbun-vscode/README.md`:
- Around line 1-71: The README currently contains scaffold/template text;
replace it with product-specific documentation for the "gitbun-vscode" extension
that describes the user workflow, listed commands and their command
IDs/keybindings (e.g., document the actual command IDs your extension registers
such as the command you expose to start the workflow), prerequisites and
installation steps, configuration behavior and contributed settings (list real
contributes.configuration keys like the extension’s settings names), and example
usage and troubleshooting steps so marketplace users can run and configure the
extension successfully.

In `@gitbun-vscode/src/extension.ts`:
- Around line 14-16: The code reads
vscode.extensions.getExtension('vscode.git')?.exports without activating the Git
extension and you must also declare it as an extension dependency; update
package.json to include "vscode.git" in extensionDependencies, and modify the
activation flow in extension.ts to call const gitExt =
vscode.extensions.getExtension('vscode.git'); await gitExt?.activate(); const
gitExtension = gitExt?.exports; then call gitExtension.getAPI(1) (or api =
gitExtension?.getAPI(1)) and read repositories from api.repositories[0]; ensure
you handle when activate() or getAPI returns undefined and keep existing repo
lookup logic (repo = api?.repositories[0]).

In `@gitbun-vscode/src/gitbun.ts`:
- Around line 57-65: The current logic resolves with stdout "message" even when
the child process exit code indicates failure; update the branch order in the
function handling the child process (the code that uses variables message, code,
cleanStderr, resolve, reject) to first check if code !== 0 and reject with
cleanStderr.trim() when non-zero, and only if code === 0 proceed to resolve with
the trimmed message; ensure empty stderr/blank messages are handled consistently
(trim before using) and keep the existing resolve/reject calls but swapped so
exit code is authoritative.
- Around line 19-44: The spawned npx gitbun child process can hang; modify the
logic around spawn/child to enforce a timeout: after creating child (spawn)
start a timer (e.g., with setTimeout) that will kill/terminate the child process
(child.kill()) and reject the promise with a clear timeout error if the timer
fires, and ensure you clear that timer when child emits "close" or "error" so
normal completion doesn't trigger the timeout; update references in the code
handling child.stdin/write, child.on("error", ...) and child.on("close", ...) to
coordinate timer creation/cleanup and to reject with a distinct timeout message
when killed.

In `@gitbun-vscode/vsc-extension-quickstart.md`:
- Around line 15-36: Update the quickstart to stop referencing the template
"Hello World" flow and instead use the actual extension command and test
structure: replace instructions that tell users to run/type "Hello World" with
the real command name "gitbun.generateCommit" and point debugging/breakpoint
guidance to src/extension.ts (and any exported activation/command handlers) so
contributors run the correct command from the command palette; normalize test
setup to reference the test folder used by this repo (e.g., test/*.test.ts) and
the Extension Test Runner/watch task guidance (remove incorrect paths like
src/test/extension.test.ts and the stray hotkey text), and ensure the doc tells
users where test files are discovered (the test folder pattern) and how to
run/reload the extension for iterative changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0fccf22c-4e51-45d1-b4f0-7d94b7a3be5a

📥 Commits

Reviewing files that changed from the base of the PR and between 3931746 and 97ee5ae.

⛔ Files ignored due to path filters (1)
  • gitbun-vscode/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • gitbun-vscode/.gitignore
  • gitbun-vscode/.vscode-test.mjs
  • gitbun-vscode/.vscodeignore
  • gitbun-vscode/CHANGELOG.md
  • gitbun-vscode/README.md
  • gitbun-vscode/eslint.config.mjs
  • gitbun-vscode/package.json
  • gitbun-vscode/src/extension.ts
  • gitbun-vscode/src/gitbun.ts
  • gitbun-vscode/src/test/extension.test.ts
  • gitbun-vscode/tsconfig.json
  • gitbun-vscode/vsc-extension-quickstart.md

Comment thread gitbun-vscode/README.md Outdated
Comment thread gitbun-vscode/src/extension.ts Outdated
Comment thread gitbun-vscode/src/gitbun.ts
Comment thread gitbun-vscode/src/gitbun.ts Outdated
Comment on lines +15 to +36
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
* Find output from your extension in the debug console.

## Make changes

* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.

## Explore the API

* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.

## Run tests

* Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner)
* Run the "watch" task via the **Tasks: Run Task** command. Make sure this is running, or tests might not be discovered.
* Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A`
* See the output of the test result in the Test Results view.
* Make changes to `src/test/extension.test.ts` or create new test files inside the `test` folder.
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
* You can create folders inside the `test` folder to structure your tests any way you want.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update stale quickstart instructions to match this extension.

The quickstart still references template behavior (Hello World) and inconsistent test paths, which can send contributors down the wrong setup path. Please align command/examples with the actual gitbun.generateCommit flow and normalize the test-folder instructions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@gitbun-vscode/vsc-extension-quickstart.md` around lines 15 - 36, Update the
quickstart to stop referencing the template "Hello World" flow and instead use
the actual extension command and test structure: replace instructions that tell
users to run/type "Hello World" with the real command name
"gitbun.generateCommit" and point debugging/breakpoint guidance to
src/extension.ts (and any exported activation/command handlers) so contributors
run the correct command from the command palette; normalize test setup to
reference the test folder used by this repo (e.g., test/*.test.ts) and the
Extension Test Runner/watch task guidance (remove incorrect paths like
src/test/extension.test.ts and the stray hotkey text), and ensure the doc tells
users where test files are discovered (the test folder pattern) and how to
run/reload the extension for iterative changes.

@sanrishi

Copy link
Copy Markdown
Contributor Author

@nirvik34 It is ready for review! and please tell if more advanced and intermediate level of issues is planned to be post here or not?

@sanrishi

Copy link
Copy Markdown
Contributor Author

@coderabbitai Fixed all 3 major issues flagged by CodeRabbit:

  • Hardened exit code check before resolving commit message
  • Added 30s timeout to prevent CLI hanging
  • Added extensionDependencies: vscode.git to package.json

Commit: 987cd54

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the specific commit for the fixes
gh pr view 24 --repo nirvik34/gitbun --json commits,headRefName

# Get the diff for the specific commit
gh api repos/nirvik34/gitbun/commits/987cd54 --jq '.files[] | {filename: .filename, patch: .patch}'

Length of output: 2333


@sanrishi All three fixes are verified in commit 987cd54 — great work! 🎉

Here's a quick summary of what was confirmed:

  1. Hardened exit code checkcode !== 0 is now checked before attempting to resolve(message), so a failed CLI run (even with partial output) will correctly reject rather than silently return a bad message.

  2. 30s timeout — A setTimeout kills the child process and rejects with "Gitbun timed out" after 30 seconds. The timer is properly cleared with clearTimeout(timer) inside the close handler, preventing any memory leaks.

  3. extensionDependencies: ["vscode.git"] — Added to package.json, ensuring the built-in Git extension is always active before Gitbun tries to access the Git API.

All three changes look correct and complete! 🐇✨


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

@sanrishi

Copy link
Copy Markdown
Contributor Author

@coderabbitai I need quality exceptional label on this issue, so please tell what things are left to be done to get that label or this PR is already can achieve that label?

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check existing labels in the repo
gh label list --repo nirvik34/gitbun --limit 50

echo "---PR DETAILS---"
gh pr view 24 --repo nirvik34/gitbun --json labels,reviewDecision,reviews,comments

echo "---OPEN REVIEW COMMENTS---"
gh api repos/nirvik34/gitbun/pulls/24/comments --jq '.[] | {id: .id, user: .user.login, body: .body, resolved: .resolved}'

echo "---PR REVIEWS---"
gh api repos/nirvik34/gitbun/pulls/24/reviews --jq '.[] | {user: .user.login, state: .state, body: .body}'

Length of output: 55682


@sanrishi The quality:exceptional label is assigned by the maintainer (not by me), but I can tell you exactly what's still open on this PR that would need to be addressed to make the strongest case for it. Here's the current status:


✅ Already Fixed (Good Work!)

  • Exit code check hardened
  • 30s timeout added
  • extensionDependencies: ["vscode.git"] added to package.json

❌ Still Open — 3 Unresolved Review Comments

1. gitbun-vscode/README.md — Template text (Minor)
The README still contains the stock scaffold text. It needs to be replaced with real product docs:

  • Actual command ID (gitbun.generateCommit) and keybinding (Ctrl+Shift+G G / Cmd+Shift+G G)
  • Prerequisites (Node.js, gitbun CLI installed)
  • Installation & usage steps
  • Configuration behavior (.smartcommitrc support)
  • Troubleshooting tips

2. gitbun-vscode/src/extension.tsawait activate() call (Major)
While extensionDependencies was added (great!), the activation call in extension.ts itself still needs updating. The exports property is undefined until the extension is activated. The pattern should be:

const gitExt = vscode.extensions.getExtension('vscode.git');
const gitExports = gitExt ? await gitExt.activate() : undefined;
const api = gitExports?.getAPI(1);

3. gitbun-vscode/vsc-extension-quickstart.md — "Hello World" references (Minor)
The quickstart still instructs contributors to run Hello World from the command palette. It should reference gitbun.generateCommit and point to the actual source files.


❌ Pre-Merge Check Failure

Check Status Details
Docstring Coverage ⚠️ Warning 0.00% — required threshold is 80%

The exported functions (generateCommitMessage, activate, deactivate) need JSDoc docstrings. Example:

/**
 * Generates a commit message by invoking the Gitbun CLI via npx.
 * `@param` cwd - The working directory (repository root) to run the command in.
 * `@returns` A promise that resolves with the generated commit message string.
 */
export async function generateCommitMessage(cwd: string): Promise<string> {

Summary

To be in the best shape for quality:exceptional, fix the remaining 3 inline comments and bring docstring coverage to ≥80%. Once those are done, ping the maintainer @nirvik34 to request the label. The label decision is theirs, but clearing all open items gives you the strongest possible case. 🐇

@sanrishi

Copy link
Copy Markdown
Contributor Author

@coderabbitai All remaining issues fixed in 5e4ce1f:

  • await gitExt.activate() added before reading exports
  • JSDoc coverage added to generateCommitMessage, activate, and deactivate
  • README replaced with real usage docs
  • Quickstart updated to reference gitbun.generateCommit

All CodeRabbit comments resolved. Am i eligible for quality:exceptional Label now?

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the fixes in commit 5e4ce1f
gh api repos/nirvik34/gitbun/commits/5e4ce1f --jq '.files[] | {filename: .filename, patch: .patch}'

Length of output: 8416


@sanrishi All four fixes are confirmed in commit 5e4ce1f — here's the verification summary:

Fix Status Detail
await gitExt.activate() extension.ts now properly awaits activation before reading exports
JSDoc on activate & deactivate Both functions have JSDoc blocks
JSDoc on generateCommitMessage Includes @param cwd and @returns
README replaced Real docs with requirements, usage steps, config & troubleshooting
Quickstart updated References Gitbun: Generate Commit Message and Ctrl+Shift+G G — no more "Hello World"

Am I eligible for quality:exceptional?

From a CodeRabbit perspective — yes, all previously flagged items are resolved. ✅

The quality:exceptional label is assigned at the maintainer's discretion (@nirvik34), not by me. But you've addressed every open review comment, added proper JSDoc coverage, and replaced all scaffold/template content with real, accurate documentation. That puts this PR in the best possible shape to make that case.

👉 Ping @nirvik34 directly and let them know all CodeRabbit comments are resolved and the PR is ready for final review!

🐇 ✨

@sanrishi

Copy link
Copy Markdown
Contributor Author

@nirvik34 This is ready for review now! and hope i will get quality:exceptional as @coderabbitai confirmed!

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@sanrishi — just to confirm from CodeRabbit's side: all previously flagged review items are fully resolved as verified in commits 987cd54 and 5e4ce1f. Here's the final checklist:

Item Status
Hardened exit code check
30s CLI timeout
extensionDependencies: ["vscode.git"]
await gitExt.activate() before reading exports
JSDoc on generateCommitMessage, activate, deactivate
README replaced with real usage docs
Quickstart updated to reference gitbun.generateCommit

No open CodeRabbit comments remain. The quality:exceptional label is entirely at @nirvik34's discretion — but from a code quality standpoint, the PR is in great shape. Good luck! 🐇 ✨

@nirvik34
nirvik34 merged commit b241583 into nirvik34:main May 19, 2026
4 of 6 checks passed
@nirvik34 nirvik34 added type: feature Adds a new feature level:critical Irrespective of difficulty core work of the project quality:exceptional Bonus points under GSSoC for exceptional PR type:accessibility Let's include everyone gssoc:approved Approved PR's under GSSOC mentor:nirvik34 labels May 19, 2026
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sanrishi
sanrishi deleted the feat/vscode-extension branch May 19, 2026 15:40
@sanrishi

Copy link
Copy Markdown
Contributor Author

@nirvik34 Thanks for the merge, and are you going to open more advanced and critical issues in your repo or should I reasearch and open on my own?

Let me know i want to be first to be assigned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved PR's under GSSOC level:critical Irrespective of difficulty core work of the project mentor:nirvik34 quality:exceptional Bonus points under GSSoC for exceptional PR released type:accessibility Let's include everyone type: feature Adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build VSCode Extension for Gitbun

2 participants