CLI Reference
Installation
Srcpack runs without global install:
npx srcpack [command] [options]bunx srcpack [command] [options]pnpm dlx srcpack [command] [options]yarn dlx srcpack [command] [options]Or install as a dev dependency:
npm install -D srcpackbun add -D srcpackpnpm add -D srcpackyarn add -D srcpackCommands
srcpack (default)
Bundle all configured bundles and upload if configured.
npx srcpackbunx srcpackpnpm dlx srcpackyarn dlx srcpackWith specific bundles:
npx srcpack web apibunx srcpack web apipnpm dlx srcpack web apiyarn dlx srcpack web apiChanged files only:
npx srcpack --staged # staged changes
npx srcpack --dirty # staged + unstaged + untracked
npx srcpack --since main # everything you changed since mainThese build a one-off bundle from the current change set and need no config file — handy for handing a work-in-progress to an LLM. The bundle is named after the flag (.srcpack/staged.txt), other bundles in outDir are left alone, and nothing is written when there are no changes.
Ad-hoc bundles stay local: they are never uploaded, even with Google Drive configured. Declare a named bundle to publish changes.
For a permanent version with review instructions attached, put a git source in your config instead.
srcpack init
Create a srcpack.config.ts interactively.
npx srcpack initbunx srcpack initpnpm dlx srcpack inityarn dlx srcpack initDetects your project structure and suggests bundle configurations.
srcpack login
Authenticate with Google Drive for uploads.
npx srcpack loginbunx srcpack loginpnpm dlx srcpack loginyarn dlx srcpack loginOpens a browser to authorize access. Tokens are stored in ~/.config/srcpack/credentials.json, readable only by you.
Options
| Option | Description |
|---|---|
--staged | Bundle staged changes only |
--dirty | Bundle staged, unstaged, and untracked changes |
--since <rev> | Bundle changes since <rev> |
--dry-run | Preview bundles without writing files |
--emptyOutDir | Empty the output directory before writing |
--no-emptyOutDir | Keep what is already in the output directory |
--no-upload | Bundle only, skip upload |
-h, --help | Show help |
-v, --version | Show version |
An unrecognized option is an error, not a no-op — --no-uplaod would otherwise upload, and --dry-rnu would write.
Examples
Preview without writing
npx srcpack --dry-runbunx srcpack --dry-runpnpm dlx srcpack --dry-runyarn dlx srcpack --dry-runOutput:
web 3 files 842 lines
src/api/routes.ts
src/index.ts
src/utils/helpers.ts
docs 1 file 96 lines
README.md
Dry run: 2 bundles, 4 files, 938 linesEach bundle lists the files it would contain, so you can check the shape of a pattern before anything is written; outDir is left alone too. A bundle that declares linear still calls the API — the counts are what it would produce right now, which it can't know offline.
Bundle without upload
npx srcpack --no-uploadbunx srcpack --no-uploadpnpm dlx srcpack --no-uploadyarn dlx srcpack --no-uploadExit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Error (config, IO, etc) |
Config File Locations
Srcpack searches for config in order:
srcpack.config.tssrcpack.config.mtssrcpack.config.jssrcpackfield inpackage.json
Searches from current directory up to filesystem root.
srcpack init writes .ts in an ESM project and .mts otherwise — see Configuration.