Skip to main content

Building

Development​

Run the CLI directly from source:

pnpm start

Or with arguments:

node src/index.js --url "..." --no-headless

Single-file executable​

SCW-AI can be compiled into a standalone binary using Bun:

pnpm build

This runs:

bun build src/index.js --compile --outfile bin/scw-ai --external typescript

The resulting bin/scw-ai is a self-contained ~60MB executable that includes the Bun runtime and all dependencies. It can be distributed and run without requiring Node.js or pnpm on the target machine.

note

The --external typescript flag is required because Puppeteer's dependency tree includes an optional TypeScript import via cosmiconfig that isn't needed at runtime.

Cross-compilation​

Bun supports cross-compilation targets:

# Linux x64
bun build src/index.js --compile --outfile bin/scw-ai-linux --target=bun-linux-x64 --external typescript

# Linux ARM
bun build src/index.js --compile --outfile bin/scw-ai-linux-arm --target=bun-linux-arm64 --external typescript
caution

Puppeteer downloads a platform-specific Chromium binary on first run. When distributing the compiled executable, the target machine still needs a compatible Chromium/Chrome installation, or you must set the PUPPETEER_EXECUTABLE_PATH environment variable.

Project structure​

scw-ai/
├── src/
│ └── index.js # Main CLI source (single file)
├── bin/
│ └── scw-ai # Compiled binary (after pnpm build)
├── website/ # Docusaurus documentation site
├── .env.example # Environment variable template
├── .gitignore
├── package.json
└── pnpm-lock.yaml