Getting Started
Bundle your codebase into LLM-optimized context files. Get precise, grounded answers from ChatGPT, Claude, Gemini, and other AI tools.
Prerequisites
- Node.js 22.18+ or Bun
- A codebase you want to share with AI
Quick Start
npx srcpack initbunx srcpack initpnpm dlx srcpack inityarn dlx srcpack initThis creates a srcpack.config.ts file with bundles based on your project structure.
Then run:
npx srcpackbunx srcpackpnpm dlx srcpackyarn dlx srcpackYour bundles are now in .srcpack/ — ready to upload to any AI chat.
Your First Bundle
Create srcpack.config.ts in your project root:
import { defineConfig } from "srcpack";
export default defineConfig({
bundles: {
app: "src/**/*",
},
});Run the bundle command and you'll see:
app 12 files 240 lines → .srcpack/app.txt
Bundled: 1 bundle, 12 files, 240 linesUnderstanding the Output
Srcpack generates an indexed bundle optimized for AI consumption:
# Index (3 files)
# [1] src/api.ts L7-L67 (61 lines)
# [2] src/index.ts L69-L110 (42 lines)
# [3] src/utils.ts L112-L158 (47 lines)
#==> [1] src/api.ts <==
export async function fetchBoard() {
...
#==> [2] src/index.ts <==
import { utils } from "./utils";
...Why this format matters:
- Numbered index — AI can reference
[2] src/utils.tsin responses - Line numbers — Answers include exact locations like
L43-L89 #prefix — Safe to paste inside markdown code blocks
When you ask "How does the auth flow work?", AI responds with:
The auth flow starts in
[3] src/api.ts:L92where...
Using with AI
- Open ChatGPT, Claude, or your preferred AI
- Upload
.srcpack/app.txtor paste its contents - Ask questions about your code
Example prompts:
- "Explain how the main entry point works"
- "Find where errors are handled"
- "What would break if I renamed the
Usertype?"
The AI answers are grounded in your actual code, with file and line references.
Configuration Patterns
Multiple Bundles
Split your codebase into semantic domains:
export default defineConfig({
bundles: {
web: "apps/web/**/*",
api: "apps/api/**/*",
shared: "packages/shared/**/*",
},
});Exclusions
Use ! prefix to exclude patterns:
export default defineConfig({
bundles: {
api: ["src/**/*", "!src/**/*.test.ts", "!src/**/*.spec.ts"],
},
});Custom Output Path
export default defineConfig({
bundles: {
docs: {
include: "docs/**/*.md",
outfile: "~/Downloads/docs-bundle.txt",
},
},
});Review Bundle
Bundle what you changed instead of a fixed set of paths:
export default defineConfig({
bundles: {
review: {
include: ["git:staged", "!bun.lock"],
prompt: "Review these changes for correctness.",
},
},
});See Git sources for git:dirty, git:main, and the rest.
Code and Tickets Together
A bundle can include Linear issues next to your code, so the LLM sees both the intent and the implementation:
export default defineConfig({
bundles: {
planning: {
include: ["src/**/*.ts", "docs/**/*.md"],
linear: { team: "ENG", project: "Roadmap" },
prompt: "Which roadmap items are already implemented?",
},
},
});Each issue becomes its own indexed entry (linear/issues/ENG-123.md). Set LINEAR_API_KEY in your environment first — see Linear issues.
CLI Reference
npx srcpack # Bundle all
npx srcpack web api # Bundle specific bundles only
npx srcpack --staged # Bundle staged changes (no config needed)
npx srcpack --dry-run # Preview without writing
npx srcpack --no-upload # Skip upload even if configuredbunx srcpack # Bundle all
bunx srcpack web api # Bundle specific bundles only
bunx srcpack --staged # Bundle staged changes (no config needed)
bunx srcpack --dry-run # Preview without writing
bunx srcpack --no-upload # Skip upload even if configuredpnpm dlx srcpack # Bundle all
pnpm dlx srcpack web api # Bundle specific bundles only
pnpm dlx srcpack --staged # Bundle staged changes (no config needed)
pnpm dlx srcpack --dry-run # Preview without writing
pnpm dlx srcpack --no-upload # Skip upload even if configuredyarn dlx srcpack # Bundle all
yarn dlx srcpack web api # Bundle specific bundles only
yarn dlx srcpack --staged # Bundle staged changes (no config needed)
yarn dlx srcpack --dry-run # Preview without writing
yarn dlx srcpack --no-upload # Skip upload even if configuredNext Steps
- Configuration Reference — All options explained
- Google Drive Upload — Auto-sync bundles to the cloud
- CLI Reference — Full command documentation
- Discord — Questions and discussion