The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
fix(scripts): detect modern bun.lock, ignore stray root lockfiles
Farda Karimov4da4c7802f02
diff --git a/.gitignore b/.gitignoreindex 826994d33..f344e035e 100644--- a/.gitignore+++ b/.gitignore@@ -99,6 +99,11 @@ ecc2/target/# Generated lock files in tool subdirectories.opencode/package-lock.json.opencode/node_modules/++# yarn is the canonical package manager for this repo (see package.json+# "packageManager"); ignore stray lockfiles from running another manager locally+/bun.lock+/bun.lockbassets/images/security/badrudi-exploit.mp4.aider*diff --git a/scripts/lib/package-manager.js b/scripts/lib/package-manager.jsindex 5f9b497fd..def3870b0 100644--- a/scripts/lib/package-manager.js+++ b/scripts/lib/package-manager.js@@ -43,7 +43,10 @@ const PACKAGE_MANAGERS = {},bun: {name: 'bun',- lockFile: 'bun.lockb',+ lockFile: 'bun.lock',+ // Bun switched its default lockfile from the binary bun.lockb to the+ // text-based bun.lock. Keep recognizing the legacy file too.+ lockFileAliases: ['bun.lockb'],installCmd: 'bun install',runCmd: 'bun run',execCmd: 'bunx',@@ -92,9 +95,9 @@ function saveConfig(config) {function detectFromLockFile(projectDir = process.cwd()) {for (const pmName of DETECTION_PRIORITY) {const pm = PACKAGE_MANAGERS[pmName];- const lockFilePath = path.join(projectDir, pm.lockFile);+ const lockFileNames = [pm.lockFile, ...(pm.lockFileAliases || [])];- if (fs.existsSync(lockFilePath)) {+ if (lockFileNames.some(lockFileName => fs.existsSync(path.join(projectDir, lockFileName)))) {return pmName;}}diff --git a/tests/lib/package-manager.test.js b/tests/lib/package-manager.test.jsindex ebe5922e4..0a00caabd 100644--- a/tests/lib/package-manager.test.js+++ b/tests/lib/package-manager.test.js@@ -131,7 +131,7 @@ function runTests() {})) passed++;else failed++;- if (test('detects bun from bun.lockb', () => {+ if (test('detects bun from bun.lockb (legacy binary lockfile)', () => {const testDir = createTestDir();try {fs.writeFileSync(path.join(testDir, 'bun.lockb'), '');@@ -143,6 +143,18 @@ function runTests() {})) passed++;else failed++;+ if (test('detects bun from bun.lock (modern text lockfile)', () => {+ const testDir = createTestDir();+ try {+ fs.writeFileSync(path.join(testDir, 'bun.lock'), '');+ const result = pm.detectFromLockFile(testDir);+ assert.strictEqual(result, 'bun');+ } finally {+ cleanupTestDir(testDir);+ }+ })) passed++;+ else failed++;+if (test('returns null when no lock file exists', () => {const testDir = createTestDir();try {