--- name: repomix description: Pack a codebase into a single AI-friendly file using the repomix CLI. Use when the user asks to bundle, snapshot, or export a repository (local or remote) for an LLM, count a repo's token size, or generate a compressed code overview. metadata: tool: repomix install: npx --- ## What I do Run the `repomix` CLI to merge a repository into one structured file with a file summary, directory tree, and per-file contents. Output is safe to feed to LLMs: secretlint strips files matching known credential patterns, and `.gitignore`/`.ignore`/`.repomixignore` are respected automatically. ## When to use me - "Pack this repo", "bundle the codebase", "make a snapshot for an LLM" - Estimating how many tokens a repo costs before sending it somewhere - Getting a compressed structural overview of a large codebase - Packing a remote GitHub repo without cloning it ## Setup No install required; `npx` fetches and caches it: ```bash npx -y repomix@latest --version # verify, ~1.18+ ``` ## Common invocations ```bash # Pack current repo (writes ./repomix-output.xml) npx -y repomix # Pack a specific directory or glob selection npx -y repomix path/to/dir npx -y repomix --include "src/**/*.ts,*.md" --ignore "**/*.test.ts" # Output to stdout (pipe or capture) instead of a file npx -y repomix --stdout # Other output formats npx -y repomix --style markdown|json|plain -o out.md # Compressed structural overview (tree-sitter, drops function bodies) npx -y repomix --compress # Remote repo (no clone needed); branch/tag/commit via --remote-branch npx -y repomix --remote user/repo # Token budget guard: non-zero exit if output exceeds N tokens npx -y repomix --token-budget 100000 # Show per-file token counts before committing to a full pack npx -y repomix --token-count-tree ``` ## Workflow 1. For large repos, run `--token-count-tree` first to see the size picture. 2. Choose scope: full pack, `--include` globs, or `--compress` for structure-only. 3. Write output to `/tmp/opencode/repomix-output.xml` (or `--stdout`) rather than the repo root, unless the user wants it in the project. 4. Read the generated file (or sections of it) to answer the user's question; cite `file:line` from the original paths shown in the output. ## Notes - Default output file is `repomix-output.xml` in the working directory; use `-o` to change it. - `--split-output 2mb` splits huge packs into numbered parts. - `--include-logs` / `--include-diffs` add git history and working-tree diffs to the pack. - Security check runs by default; only skip with `--no-security-check` if the user explicitly asks. - Config: a project may have `repomix.config.json`; `npx -y repomix --init` creates one. - Alternative integrations exist (`repomix --mcp` for an MCP server, `--skill-generate` to emit a per-repo context skill) — prefer this CLI skill unless the user asks for those.