Skip to content

Worktree setup runs npm install in Bun projects (missing bun.lock detection) #52

@skytect

Description

@skytect
Human NoteRAPID is leaving package-lock.jsons around in my bun project
Version6.0.0
Skillstart-set (worktree creation)

Bug Description

detectPackageManager() in src/lib/worktree.cjs (line 70-76) checks for pnpm-lock.yaml, yarn.lock, and package-lock.json, but does not check for bun.lock or bun.lockb. When a Bun project has no matching lock file, it falls through to the package.json-only case and runs npm install, which creates a spurious package-lock.json in every worktree.

// Current detection order (line 70-76):
function detectPackageManager(dir) {
  if (fs.existsSync(path.join(dir, 'pnpm-lock.yaml'))) return { manager: 'pnpm', command: 'pnpm install' };
  if (fs.existsSync(path.join(dir, 'yarn.lock'))) return { manager: 'yarn', command: 'yarn install' };
  if (fs.existsSync(path.join(dir, 'package-lock.json'))) return { manager: 'npm', command: 'npm ci' };
  if (fs.existsSync(path.join(dir, 'package.json'))) return { manager: 'npm', command: 'npm install' };
  return { manager: null, command: null };
}

Steps to Reproduce

  1. Create a Bun monorepo project with bun.lock (no package-lock.json, no yarn.lock, no pnpm-lock.yaml)
  2. Run /rapid:start-set to create a worktree
  3. Observe package-lock.json appearing in the worktree

Root Cause / Suggested Fix

Add Bun detection before the npm fallback:

if (fs.existsSync(path.join(dir, 'bun.lock')) || fs.existsSync(path.join(dir, 'bun.lockb')))
  return { manager: 'bun', command: 'bun install' };

Could also check the packageManager field in package.json as a secondary signal (e.g., "packageManager": "bun@1.3.11").

Workaround

Manually delete package-lock.json from each worktree after creation, or add package-lock.json to .gitignore.

Related Issues

None found.

Co-Authored-By: Claude Opus 4.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-authoredIssue was written with AI assistancebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions