Add npm package for bd with native binaries (bd-febc)
Implements @beads/bd npm package for easy installation in Node.js environments, especially Claude Code for Web. Features: - Automatic platform-specific binary download during postinstall - CLI wrapper that invokes native bd binary - Full feature parity with standalone bd - Works with SessionStart hooks for auto-installation Package structure: - bin/bd.js: Node.js CLI wrapper - scripts/postinstall.js: Downloads correct binary from GitHub releases - scripts/test.js: Verification tests - Comprehensive documentation (6 guides) Published to npm: https://www.npmjs.com/package/@beads/bd Benefits vs WASM: - Full SQLite support (no custom VFS) - Better performance (native vs WASM) - Simpler implementation and maintenance - All commands work identically Closes bd-febc, bd-be7a, bd-e2e6, bd-f282, bd-87a0, bd-b54c 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
29
npm-package/scripts/test.js
Executable file
29
npm-package/scripts/test.js
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
function runTests() {
|
||||
console.log('Testing bd installation...\n');
|
||||
|
||||
const bdPath = path.join(__dirname, '..', 'bin', 'bd.js');
|
||||
|
||||
try {
|
||||
// Test 1: Version check
|
||||
console.log('Test 1: Checking bd version...');
|
||||
const version = execSync(`node "${bdPath}" version`, { encoding: 'utf8' });
|
||||
console.log(`✓ Version check passed: ${version.trim()}\n`);
|
||||
|
||||
// Test 2: Help command
|
||||
console.log('Test 2: Checking bd help...');
|
||||
execSync(`node "${bdPath}" --help`, { stdio: 'pipe' });
|
||||
console.log('✓ Help command passed\n');
|
||||
|
||||
console.log('✓ All tests passed!');
|
||||
} catch (err) {
|
||||
console.error('✗ Tests failed:', err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
runTests();
|
||||
Reference in New Issue
Block a user