Skip to content

Conversation

@principle-lgtm
Copy link

Overview

This PR converts gemini-cli from npm to bun as the primary package manager on the gemini-cli-bun branch.

Changes

Package Management

  • ✅ Replaced all npm run commands with bun run
  • ✅ Replaced npx with bunx
  • ✅ Replaced npm ci with bun install --frozen-lockfile
  • ✅ Updated workspace commands to use bun
  • ✅ Removed package-lock.json
  • ✅ Added bun.lock

Documentation Updates

  • README.md: Updated installation instructions to prioritize bun
    • Added bunx as primary execution method
    • Added bun install as primary global install method
    • Kept npm as alternative option
  • docs/get-started/installation.md: Updated all installation examples
  • docs/local-development.md: Updated telemetry commands
  • CONTRIBUTING.md: Updated all development workflow commands

Script Updates

  • packages/vscode-ide-companion/package.json: Updated all scripts to use bun
  • packages/vscode-ide-companion/scripts/generate-notices.js:
    • Added support for bun.lock/bun.lockb
    • Falls back gracefully when bun.lock is detected
    • Maintains compatibility with package-lock.json

Files Modified

  • package.json
  • README.md
  • CONTRIBUTING.md
  • docs/get-started/installation.md
  • docs/local-development.md
  • packages/vscode-ide-companion/package.json
  • packages/vscode-ide-companion/scripts/generate-notices.js

Files Removed

  • package-lock.json

Files Added

  • bun.lock

Testing

  • ✅ Dependencies install successfully with bun
  • ✅ Scripts updated to use bun commands
  • ⚠️ Note: generate-notices.js has limited bun.lock support (uses direct dependencies only when bun.lock is detected)

Benefits

  • Faster package installation and script execution
  • Better performance with bun's native speed
  • Maintains backward compatibility (npm still works as fallback)

Next Steps

  • Review and test the changes
  • Consider implementing full bun.lock parsing in generate-notices.js if needed
  • Update CI/CD workflows to use bun (if applicable)

## Overview
Converted gemini-cli package manager from npm to bun on branch gemini-cli-bun.

## Changes

### Package Management
- Replaced all `npm run` commands with `bun run`
- Replaced `npx` with `bunx`
- Replaced `npm ci` with `bun install --frozen-lockfile`
- Updated workspace commands to use bun
- Removed package-lock.json
- Added bun.lock

### Documentation Updates
- **README.md**: Updated installation instructions to prioritize bun
- **docs/get-started/installation.md**: Updated all installation examples
- **docs/local-development.md**: Updated telemetry commands
- **CONTRIBUTING.md**: Updated all development workflow commands

### Script Updates
- **packages/vscode-ide-companion/package.json**: Updated all scripts to use bun
- **packages/vscode-ide-companion/scripts/generate-notices.js**: Added support for bun.lock

## Files Modified
- package.json
- README.md
- CONTRIBUTING.md
- docs/get-started/installation.md
- docs/local-development.md
- packages/vscode-ide-companion/package.json
- packages/vscode-ide-companion/scripts/generate-notices.js

## Files Removed
- package-lock.json

## Files Added
- bun.lock
@gemini-code-assist
Copy link

Summary of Changes

Hello @principle-lgtm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aims to enhance the gemini-cli project's performance and efficiency by transitioning its primary package management system from npm to Bun. This change is expected to result in faster dependency installation and script execution, contributing to a more streamlined development experience, while ensuring backward compatibility for existing npm users.

Highlights

  • Package Manager Transition: The project has been migrated from npm to Bun as the primary package manager. This includes replacing npm run with bun run, npx with bunx, and npm ci with bun install --frozen-lockfile across all relevant scripts and commands.
  • Documentation Updates: All user-facing and developer documentation, including README.md, CONTRIBUTING.md, docs/get-started/installation.md, and docs/local-development.md, has been updated to reflect the new Bun-centric workflow, while retaining npm as an alternative option where applicable.
  • Script and Lockfile Management: The package.json scripts have been updated to utilize Bun commands. The package-lock.json file has been removed, and a bun.lock file has been added. The generate-notices.js script now includes support for bun.lock and bun.lockb, gracefully falling back to package-lock.json if present, though with limited dependency analysis for Bun lockfiles currently.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully converts the project from npm to bun as the package manager. The changes are comprehensive, covering package management commands, documentation, and scripts. The update to generate-notices.js to handle bun.lock is a good temporary solution. I've found one area for improvement in generate-notices.js regarding the mixed use of synchronous and asynchronous file system operations, for which I've provided suggestions to improve consistency and adhere to best practices.

*/

import fs from 'node:fs/promises';
import fsSync from 'node:fs';

Choose a reason for hiding this comment

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

high

To maintain consistency with the asynchronous nature of this script, it's better to avoid mixing synchronous (fsSync) and asynchronous (fs/promises) file system operations. I'll suggest an asynchronous approach for checking file existence in another comment, which will make this import unnecessary.

Comment on lines +149 to +162
if (fsSync.existsSync(bunLockPath) || fsSync.existsSync(bunLockPathAlt)) {
// bun.lockb/bun.lock is binary/text, skip parsing for now
// TODO: Implement bun.lock parsing or use bun's API
console.warn('Warning: bun.lock detected but not yet supported. Skipping dependency analysis.');
packageLockJson = {}; // Empty object to prevent errors
} else if (fsSync.existsSync(packageLockJsonPath)) {
const packageLockJsonContent = await fs.readFile(
packageLockJsonPath,
'utf-8',
);
packageLockJson = JSON.parse(packageLockJsonContent);
} else {
throw new Error('Neither bun.lock/bun.lockb nor package-lock.json found. Please run "bun install" or "npm install" first.');
}

Choose a reason for hiding this comment

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

high

Using synchronous file system calls like fsSync.existsSync in an async function can block the event loop and is generally not recommended. Let's refactor this to use asynchronous checks for better consistency and to follow best practices. We can perform the file existence checks in parallel for better performance.

Suggested change
if (fsSync.existsSync(bunLockPath) || fsSync.existsSync(bunLockPathAlt)) {
// bun.lockb/bun.lock is binary/text, skip parsing for now
// TODO: Implement bun.lock parsing or use bun's API
console.warn('Warning: bun.lock detected but not yet supported. Skipping dependency analysis.');
packageLockJson = {}; // Empty object to prevent errors
} else if (fsSync.existsSync(packageLockJsonPath)) {
const packageLockJsonContent = await fs.readFile(
packageLockJsonPath,
'utf-8',
);
packageLockJson = JSON.parse(packageLockJsonContent);
} else {
throw new Error('Neither bun.lock/bun.lockb nor package-lock.json found. Please run "bun install" or "npm install" first.');
}
const [bunLockExists, bunLockAltExists, packageLockExists] = await Promise.all([
fs.stat(bunLockPath).then(() => true, () => false),
fs.stat(bunLockPathAlt).then(() => true, () => false),
fs.stat(packageLockJsonPath).then(() => true, () => false),
]);
if (bunLockExists || bunLockAltExists) {
// bun.lockb/bun.lock is binary/text, skip parsing for now
// TODO: Implement bun.lock parsing or use bun's API
console.warn('Warning: bun.lock detected but not yet supported. Skipping dependency analysis.');
packageLockJson = {}; // Empty object to prevent errors
} else if (packageLockExists) {
const packageLockJsonContent = await fs.readFile(
packageLockJsonPath,
'utf-8',
);
packageLockJson = JSON.parse(packageLockJsonContent);
} else {
throw new Error('Neither bun.lock/bun.lockb nor package-lock.json found. Please run "bun install" or "npm install" first.');
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants