code-combiner
v1.0.0
Published
Extract and combine repository code into a single AI-optimized markdown file
Maintainers
Readme
code-combiner
Turn any codebase into a single, AI-ready markdown file.
code-combiner scans your repository, intelligently strips noise (comments, blank lines, boilerplate), and produces a clean snapshot optimized for feeding into AI tools like ChatGPT, Claude, Gemini, or any LLM. It uses tree-sitter for precise AST-based code processing across 14 languages, and includes smart features like templates, dependency-aware focus, file prioritization, diff mode, dry-run preview, and automatic project detection.
Table of Contents
- Why?
- Install
- Quick Start
- Features
- Output Format
- Smart Features
- Configuration File
- CLI Reference
- Supported Languages
- Examples
- How It Works
- License
Why?
When working with AI coding assistants, you often need to share your codebase for context. Copying files one by one is tedious, and dumping raw code wastes tokens on comments, imports, and boilerplate. code-combiner solves this by:
- Producing a single file you can paste into any AI chat
- Stripping comments, collapsing imports, and removing blank lines to reduce tokens
- Prioritizing important files (entry points, routes, models) so the AI sees architecture first
- Auto-detecting your project stack so the AI understands context immediately
- Supporting templates so common workflows are a single command
- Supporting diff mode so you only share what changed for PR reviews
Install
Global install (recommended)
npm install -g code-combinerThen use it anywhere:
code-combinerWithout installing
npx code-combinerVerify installation
code-combiner --versionSet up templates for your project
cd ~/projects/my-app
code-combiner initThis detects your project type and generates a .codecombiner.yml with relevant templates. See Templates for details.
Quick Start
The simplest workflow: cd into your project and copy it to clipboard.
cd ~/projects/my-app
code-combiner --copyThat's it. Open your AI chat and paste. The output includes:
- A context brief (project stack, languages, description)
- A directory tree
- Every source file, stripped of noise, with syntax highlighting
- A generation stamp with file count and token total
Common one-liners
# Copy entire project to clipboard
code-combiner --copy
# Save to file
code-combiner -o snapshot.md
# Copy with a question embedded
code-combiner --copy -p "Why is the login endpoint returning 403?"
# Use a template
code-combiner --use review --copy
# Preview before running (no processing, instant)
code-combiner --dry-run
# Only files changed vs main branch
code-combiner --diff main --copy
# Only TypeScript files
code-combiner -i "**/*.ts" --copy
# Focus on one area, get signatures for the rest
code-combiner --focus src/api --copyFeatures
Copy to Clipboard
The --copy flag copies the output directly to your clipboard. No file created, no stdout — just copy and paste.
code-combiner --copy📂 Scanning files...
Found 42 files
⚙ Initializing parser...
🔧 Processing code...
📋 Copied to clipboard! Paste it wherever you need.
📊 Summary:
Files: 42 included, 0 skipped
Tokens: 28.5k (saved 8.2k, 22.3% reduction)
Parsing: 35 tree-sitter, 7 regex
Cost: GPT-4o: ~$0.071 | Claude Sonnet: ~$0.086 | Claude Opus: ~$0.428You can combine --copy with -o to get both:
# Save to file AND copy to clipboard
code-combiner -o snapshot.md --copyWorks on macOS (pbcopy), Linux (xclip/xsel), and Windows (clip).
Embed a Prompt
Use -p or --prompt to embed a question at the very top of the output. When you paste into an AI chat, your question is already there.
code-combiner --copy -p "Find the bug causing duplicate API calls in the checkout flow"The output will start with:
# Project: my-app
> **Prompt**: Find the bug causing duplicate API calls in the checkout flow
> **Project Context**
> E-commerce platform built with Next.js
> **Stack**: Next.js, React, Prisma, Tailwind CSS
> **Languages**: TypeScript (48 files, 72%) | JSON (8 files, 12%)...More examples:
# Code review
code-combiner --diff main --copy -p "Review this PR for security issues"
# Architecture question
code-combiner --copy -p "How would you refactor the auth module to support OAuth?"
# Bug investigation
code-combiner --focus src/payments --copy -p "The Stripe webhook is firing twice"Templates
Templates let you save common workflows as named presets. Instead of typing long commands, you use one name.
Initialize templates
Run init in your project root to auto-generate templates based on your project type:
code-combiner init✅ Created .codecombiner.yml
Detected project: Next.js
Generated 6 templates
Quick start:
code-combiner templates List all templates
code-combiner --use review Use the review template
code-combiner --copy Copy entire projectThe init command detects your project type and generates relevant templates:
| Project Type | Templates Generated |
|-------------|-------------------|
| Next.js | frontend, api-routes, types, review, quick |
| React | frontend, state, review, quick |
| Vue.js / Nuxt | frontend, state, review, quick |
| Svelte | frontend, review, quick |
| Angular | frontend, services, review, quick |
| Express / Fastify / Koa / Hono | backend, models, types, review, quick |
| NestJS | backend, models, review, quick |
| Django | backend, models, review, quick |
| FastAPI / Flask | backend, models, review, quick |
| Rails | backend, frontend, review, quick |
| Go | backend, models, review, quick |
| Rust | backend, models, review, quick |
| Generic | backend, frontend, types, review, quick |
List available templates
code-combiner templates📋 Available templates:
review
PR review — only changed files with a review prompt
[diff: main | prompt: "Review this PR for bugs, security issues, and code..."]
quick
Quick architecture overview — signatures only, capped tokens
[signatures only | max tokens: 30,000 | prompt: "Give me a high-level overview of this project's ar..."]
frontend
Frontend components, pages, and hooks
[include: 8 patterns | exclude: 3 patterns]
api-routes
API routes and server-side logic
[include: 5 patterns | exclude: 2 patterns]
types
Type definitions and schemas
[include: 4 patterns]
Usage: code-combiner --use <template> [--copy] [-p "..."]Use a template
# Use the review template (diffs against main, includes review prompt)
code-combiner --use review --copy
# Use the quick template (signatures only, 30k token cap)
code-combiner --use quick --copy
# Use the frontend template (only frontend code)
code-combiner --use frontend --copy
# Use a template but override the prompt
code-combiner --use review -p "Focus on the auth changes specifically"
# Use a template but add extra excludes
code-combiner --use backend -e "src/legacy/**"CLI flags always override template values. Template values override project defaults.
What's inside a template
Templates can set any combination of options. Here's what the generated .codecombiner.yml looks like:
# Project-level defaults (apply to every run)
exclude:
- "**/*.test.*"
- "**/*.spec.*"
- "**/__tests__/**"
- "**/__mocks__/**"
stripComments: true
collapseImports: true
stripEmptyLines: true
# Named templates
templates:
review:
description: "PR review — only changed files with a review prompt"
diff: main
prompt: "Review this PR for bugs, security issues, and code quality. Suggest improvements."
quick:
description: "Quick architecture overview — signatures only, capped tokens"
signaturesOnly: true
maxTokens: 30000
prompt: "Give me a high-level overview of this project's architecture."
frontend:
description: "Frontend components, pages, and hooks"
include:
- "src/components/**"
- "src/app/**"
- "src/pages/**"
- "src/hooks/**"
exclude:
- "**/*.test.*"
- "**/*.stories.*"
api-routes:
description: "API routes and server-side logic"
include:
- "src/app/api/**"
- "pages/api/**"
- "src/lib/**"
- "src/services/**"
exclude:
- "**/*.test.*"
types:
description: "Type definitions and schemas"
include:
- "**/*.d.ts"
- "src/types/**"
- "src/models/**"
- "prisma/schema.prisma"Custom templates
You can add your own templates to the same file:
templates:
# ... generated templates above ...
auth:
description: "Authentication and authorization code"
focus:
- src/auth
- src/middleware/auth
prompt: "Analyze the auth implementation for security vulnerabilities"
database:
description: "Database layer and migrations"
include:
- "src/models/**"
- "src/db/**"
- "prisma/**"
- "**/migrations/**"
minimal:
description: "Absolute minimum context"
signaturesOnly: true
maxTokens: 15000
exclude:
- "**/*.test.*"
- "**/*.css"
- "**/*.json"Merge precedence
Settings are merged in this order (last wins):
DEFAULT_CONFIG < project defaults (.codecombiner.yml root) < template < CLI flags- Exclude and focus arrays are merged across all layers (combined, not replaced)
- Include is replaced (last one set wins, since it's an allowlist)
- All other settings: last layer wins
Dry Run
Use --dry-run to preview what would be included without actually processing any files. It's instant — no tree-sitter initialization, no parsing.
code-combiner --dry-run📂 Scanning files...
Found 42 files
🔍 Dry run preview
Exclude: **/*.test.*, **/*.spec.*, **/__tests__/**, **/__mocks__/**
Files (42):
src/index.ts 1.2KB ~280 tokens (entry point)
package.json 1.8KB ~420 tokens
tsconfig.json 0.5KB ~143 tokens
src/api/users.ts 3.4KB ~890 tokens (route/controller)
src/api/auth.ts 2.8KB ~720 tokens (route/controller)
src/models/user.ts 1.1KB ~310 tokens (model/type)
...
─────────────────────────────────
Total files: 42
Total size: 187.3KB
Est. tokens: ~48.2k (before stripping)
Est. after strip: ~36.2k–41.0k (15-25% reduction typical)
Languages: typescript: 35, json: 3, yaml: 2, css: 2Combine with templates or filters to preview the effect:
# Preview what the review template would include
code-combiner --use review --dry-run
# Preview with a filter
code-combiner -i "**/*.ts" --dry-run
# Preview with a token budget (warns if it'll be exceeded)
code-combiner --max-tokens 30000 --dry-runIf the estimated output exceeds your --max-tokens budget, dry-run shows a warning:
⚠ Estimated output may exceed token budget (30.0k). Some files will be truncated.This is useful for large repos where you want to tune your filters before waiting for a full run.
Focus Mode
Use -f or --focus to get full code for specific files or directories. Everything else is reduced to signatures only (function names, class declarations, type definitions — no implementation bodies).
# Focus on one file
code-combiner --focus src/api/users.ts --copy
# Focus on a directory
code-combiner --focus src/api --copy
# Focus on multiple paths
code-combiner --focus src/api src/models --copyWhat happens: src/api/users.ts gets full code. Files it imports (types, models, utils) are auto-detected via the dependency graph and also get full code. Everything else gets signatures only.
The output marks each file clearly:
## src/api/users.ts _(focused)_
... full code ...
## src/models/user.ts _(dependency, model/type)_
... full code (auto-included because users.ts imports it) ...
## src/utils/logger.ts _(utility, signatures only)_
... only function signatures, no bodies ...This is extremely useful when you want the AI to focus on one area but still have project-wide context.
Diff Mode
Use -d or --diff to only include files that changed since a branch, tag, or commit. Perfect for PR reviews.
# Files changed vs main branch
code-combiner --diff main --copy
# Files changed vs a specific commit
code-combiner --diff HEAD~5 --copy
# Files changed vs a tag
code-combiner --diff v1.2.0 --copyThe output includes a diff summary:
> **Diff mode**: comparing against `main`
> **12 files changed**: 3 added, 8 modified, 1 deleted
> **Deleted files**: src/old-helper.tsCombine with --prompt for PR reviews:
code-combiner --diff main --copy -p "Review this PR. Check for bugs, security issues, and suggest improvements."Or just use the review template which does this automatically:
code-combiner --use review --copyDiff mode also picks up uncommitted and staged changes, so it works even before you commit.
Signatures Only
Use -s or --signatures-only for maximum compression. Strips all function/method bodies and only keeps the API surface: function signatures, class declarations, type definitions, and exports.
code-combiner -s --copyA file like this:
export async function getUser(id: string): Promise<User> {
const user = await db.users.findById(id);
if (!user) throw new NotFoundError("User not found");
return sanitizeUser(user);
}
export async function deleteUser(id: string): Promise<void> {
await db.users.delete(id);
await cache.invalidate(`user:${id}`);
await eventBus.emit("user.deleted", { id });
}Becomes:
export async function getUser(id: string): Promise<User> { /* ... */ }
export async function deleteUser(id: string): Promise<void> { /* ... */ }This gives the AI a map of your entire codebase without the implementation details. Great for architecture questions or when you need to fit a large project into a smaller context window.
Or use the quick template which combines signatures-only with a 30k token cap:
code-combiner --use quick --copyInclude / Exclude Filters
Include only specific file types
Use -i or --include to only scan files matching specific glob patterns:
# Only TypeScript files
code-combiner -i "**/*.ts" --copy
# Only TypeScript and JavaScript
code-combiner -i "**/*.ts" "**/*.js" --copy
# Only files in src/
code-combiner -i "src/**/*" --copy
# Only Python files
code-combiner -i "**/*.py" --copyExclude patterns
Use -e or --exclude to skip files matching patterns:
# Skip test files
code-combiner -e "**/*.test.*" "**/*.spec.*" --copy
# Skip a specific directory
code-combiner -e "src/legacy/**" --copy
# Skip migrations
code-combiner -e "**/migrations/**" --copy
# Combine include and exclude
code-combiner -i "**/*.ts" -e "**/*.test.ts" --copyWhat's excluded by default
You don't need to manually exclude common noise. These are always skipped:
node_modules/,.git/,dist/,build/,out/,.next/__pycache__/,.venv/,venv/,target/,vendor/- Lock files (
package-lock.json,yarn.lock,Cargo.lock, etc.) - Binary files (images, fonts, executables, archives)
- Source maps (
*.map), minified files (*.min.js,*.min.css) - Secrets (
.env,*.pem,*.key) - IDE files (
.idea/,.vscode/) - Generated code (files with
@generated,DO NOT EDITmarkers)
Token Budget
Use -t or --max-tokens to cap the output size. Files are included in priority order (entry points first) until the budget is reached.
# Cap at 50k tokens (fits in most AI context windows)
code-combiner --max-tokens 50000 --copy
# Cap at 100k tokens
code-combiner -t 100000 -o snapshot.mdWhen the budget is exceeded, remaining files are marked:
## src/utils/helpers.ts
// [TRUNCATED: token budget exceeded]Because files are prioritized by importance (entry points > routes > models > utils > tests), your most important code always makes it in first.
Use --dry-run to preview whether your budget is sufficient before running:
code-combiner --max-tokens 50000 --dry-runOutput Format
Here's what the output looks like:
# Project: my-app
> **Prompt**: How should I refactor the auth module?
> **Project Context**
> A REST API for user management
> **Stack**: Express, Prisma, Jest, Docker
> **Languages**: TypeScript (24 files, 80%) | JSON (3 files, 10%) | YAML (2 files, 7%)
> **Package manager**: npm
> **Total files scanned**: 29
## Directory Structure
├── src/
│ ├── api/
│ │ ├── auth.ts
│ │ └── users.ts
│ ├── models/
│ │ └── user.ts
│ ├── middleware/
│ │ └── auth-guard.ts
│ └── index.ts
├── package.json
└── tsconfig.json
## src/index.ts _(entry point)_
```typescript
import express from "express";
import { authRouter } from "./api/auth";
import { usersRouter } from "./api/users";
const app = express();
app.use("/auth", authRouter);
app.use("/users", usersRouter);
app.listen(3000);
```
## src/api/auth.ts _(route/controller)_
```typescript
import { Router } from "express";
...
```
## src/models/user.ts _(model/type)_
```typescript
export interface User {
id: string;
email: string;
...
}
```
---
_Generated by code-combiner on 2026-03-31 | 29 files | 12.4k tokens_Key things to notice:
- Prompt appears at the top so the AI sees it first
- Context brief tells the AI what stack/languages are used
- Directory tree gives structural overview
- Files are ordered by importance, not alphabetically
- Tier labels like
_(entry point)_,_(route/controller)_,_(model/type)_help the AI understand each file's role - Generation stamp at the bottom with date, file count, and token total
- Stats are terminal-only — shown in stderr after the run, not in the output (saves tokens)
Smart Features
Project Context Brief
Every output automatically includes a context block at the top. This is generated by analyzing your project files — no configuration needed.
It detects:
- 50+ frameworks and tools: Next.js, React, Vue, Svelte, Angular, Express, NestJS, FastAPI, Django, Rails, Gin, Prisma, Tailwind, Docker, Terraform, and many more
- Languages: with file counts and percentages
- Package manager: npm, yarn, pnpm, bun, cargo, pip, poetry, bundler, go modules
- Project description: from
package.json,Cargo.toml, orpyproject.toml
Example output:
> **Project Context**
> Real-time collaborative editor
> **Stack**: Next.js, React, Prisma, Tailwind CSS, Jest, Docker
> **Languages**: TypeScript (48 files, 72%) | JSON (8 files, 12%) | CSS (5 files, 8%) | YAML (3 files, 4%)
> **Package manager**: pnpm
> **Total files scanned**: 66File Prioritization
Files are ordered by architectural importance, not alphabetically. This matters because AI models weight earlier content more heavily.
The ordering is:
| Priority | Category | Examples |
|----------|----------|---------|
| 1 | Entry points | index.ts, main.ts, app.ts, server.ts |
| 2 | Root config | package.json, tsconfig.json, Cargo.toml |
| 3 | Routes / Controllers | routes/, controllers/, api/, pages/ |
| 4 | Models / Types / Schemas | models/, types/, schemas/, .d.ts |
| 5 | Services / Core logic | services/, core/, lib/ |
| 6 | Middleware | middleware/, plugins/, guards/ |
| 7 | Components / Views | components/, views/, screens/ |
| 8 | Hooks | hooks/, composables/, use* |
| 9 | Utilities | utils/, helpers/, shared/ |
| 10 | Tests | tests/, __tests__/, *.test.*, *.spec.* |
Focused files (--focus) always appear first regardless of tier.
Dependency Graph
When you use --focus, code-combiner parses import/require statements across your project to build a dependency graph. Files imported by your focused files automatically get full code instead of signatures.
code-combiner --focus src/api/users.ts --copyIf users.ts imports ../models/user.ts and ../utils/db.ts, those files get full code too. The output marks them:
## src/api/users.ts _(focused)_ --> full code
## src/models/user.ts _(dependency)_ --> full code (auto-included)
## src/utils/db.ts _(dependency)_ --> full code (auto-included)
## src/api/auth.ts _(signatures only)_ --> signatures only (not a dependency)Supports imports in: JavaScript, TypeScript, Python, Go, Rust, C, C++.
Generated Code Detection
Automatically skips auto-generated files to avoid wasting tokens. Detection happens in two ways:
Path-based (instant, no file read):
*.generated.*,__generated__/prisma/client,.prisma/client*.pb.go,*_pb2.py,*.pb.ts(protobuf)graphql/generatedswagger-output,openapi-gen- Numbered migration files
Content-based (reads first 512 bytes):
@generatedDO NOT EDIT/DO NOT MODIFYauto-generated/Auto-generatedCode generated by/Generated byThis file is generated
Comment Stripping
Comments are stripped by default using tree-sitter AST parsing (precise) or regex fallback (for unsupported languages).
Tree-sitter handles all comment types correctly:
- Single-line:
//,# - Multi-line:
/* ... */ - Doc comments:
/** ... */,/// ...,""" ... """ - HTML comments:
<!-- ... -->
To keep comments:
code-combiner --keep-comments --copyImport Collapsing
Long import blocks are collapsed by default. The first 2 imports are kept, the rest are summarized:
Before:
import { Router } from "express";
import { z } from "zod";
import { db } from "../db";
import { auth } from "../middleware/auth";
import { validate } from "../middleware/validate";
import { logger } from "../utils/logger";
import { cache } from "../utils/cache";After:
import { Router } from "express";
import { z } from "zod";
// ... 5 more importsTo keep all imports:
code-combiner --keep-imports --copyConfiguration File
For project-level settings, create .codecombiner.yml in your project root. The fastest way is to run code-combiner init which auto-generates it with templates for your project type.
You can also create it manually:
# Project-level defaults (apply to every run)
exclude:
- "**/*.test.*"
- "**/*.spec.*"
- "**/__tests__/**"
- "**/__mocks__/**"
stripComments: true
collapseImports: true
stripEmptyLines: true
respectGitignore: true
showTree: true
# Named templates (see Templates section)
templates:
review:
description: "PR review — only changed files with a review prompt"
diff: main
prompt: "Review this PR for bugs and security issues."
quick:
description: "Quick architecture overview"
signaturesOnly: true
maxTokens: 30000
backend:
description: "Backend code only"
include:
- "src/api/**"
- "src/models/**"
- "src/services/**"
exclude:
- "**/*.test.*"Also supports .codecombiner.yaml, .codecombiner.json, and codecombiner.config.js.
CLI flags always override template values, which override project defaults.
CLI Reference
Main command
code-combiner [options] [directory]| Flag | Short | Description | Default |
|------|-------|-------------|---------|
| --output <file> | -o | Write output to a file | stdout |
| --copy | | Copy output to clipboard (suppresses stdout) | off |
| --prompt <text> | -p | Embed a prompt/question at the top | none |
| --use <template> | -u | Use a named template from .codecombiner.yml | none |
| --diff <ref> | -d | Only include files changed since ref | off |
| --dry-run | | Preview files and tokens without processing | off |
| --focus <paths...> | -f | Full detail for these paths, signatures for rest | none |
| --signatures-only | -s | Only include function/class signatures | off |
| --max-tokens <n> | -t | Maximum token budget | unlimited |
| --include <globs...> | -i | Only include files matching these globs | all files |
| --exclude <globs...> | -e | Additional patterns to exclude | none |
| --keep-comments | | Keep comments in output | stripped |
| --keep-imports | | Keep all import statements | collapsed |
| --keep-empty-lines | | Keep blank lines as-is | collapsed |
| --skip-tree | | Omit directory tree from output | shown |
| --skip-stats | | Omit stats from terminal output | shown |
| --skip-gitignore | | Ignore .gitignore rules | respected |
| --version | -V | Print version | |
| --help | -h | Show help | |
Subcommands
| Command | Description |
|---------|-------------|
| code-combiner init [directory] | Generate .codecombiner.yml with smart defaults and templates. Use --force to overwrite existing. |
| code-combiner templates [directory] | List available templates from .codecombiner.yml with descriptions and details. |
Supported Languages
Tree-sitter (AST-based, precise)
JavaScript, TypeScript, TSX, Python, Go, Rust, Java, C, C++, Ruby, PHP, C#, Swift, Kotlin
Regex fallback (pattern-based)
All other file types with recognized extensions: Bash, JSON, YAML, TOML, HTML, CSS, SCSS, SQL, Markdown, GraphQL, HCL, Lua, Scala, Elixir, Erlang, Haskell, Clojure, Dart, Vue, Svelte, and more.
Examples
Daily workflow: paste codebase into AI chat
cd ~/projects/my-app
code-combiner --copyOpen ChatGPT/Claude/Gemini, paste, ask your question.
Ask a specific question about your code
code-combiner --copy -p "Why is the WebSocket connection dropping after 30 seconds?"Review a PR before merging
# Using the review template (simplest)
code-combiner --use review --copy
# Or manually
code-combiner --diff main --copy -p "Review this PR for bugs, edge cases, and security issues"Get a quick architecture overview
# Using the quick template (simplest)
code-combiner --use quick --copy
# Or manually
code-combiner -s --copy -p "Explain the architecture of this project"Investigate a bug in one area
code-combiner --focus src/payments --copy -p "The Stripe webhook fires twice for subscription renewals"Preview before running on a large repo
# See what would be included
code-combiner --dry-run
# Preview with a template
code-combiner --use backend --dry-run
# Preview with a token budget
code-combiner --max-tokens 50000 --dry-runShare only the backend code
# Using a template
code-combiner --use backend --copy
# Or manually
code-combiner -i "src/api/**" "src/models/**" "src/services/**" --copyShare only Python files, skip tests
code-combiner -i "**/*.py" -e "**/*test*" --copySave a snapshot for later
code-combiner -o snapshots/$(date +%Y%m%d).mdFit a large project into a small context window
code-combiner -s --max-tokens 50000 --copyReview changes from the last 3 commits
code-combiner --diff HEAD~3 --copy -p "Anything I missed in these changes?"Compare against a release tag
code-combiner --diff v2.0.0 -o changelog-review.mdFull verbose output (keep everything)
code-combiner --keep-comments --keep-imports --keep-empty-lines -o full-snapshot.mdSet up a new project
cd ~/projects/new-app
code-combiner init
code-combiner templates
code-combiner --use quick --copyHow It Works
code-combiner processes your codebase in 5 stages:
1. Scan
Walks the directory tree, applying filters:
- Respects
.gitignore(including nested ones in subdirectories) - Applies built-in exclusions (node_modules, binaries, lock files, etc.)
- Applies your
--include/--excludepatterns - Skips generated code (path patterns + content markers)
- Skips files > 1MB
2. Detect
Analyzes the project to generate a context brief:
- Reads
package.json,Cargo.toml,pyproject.toml,Gemfile,go.modfor dependencies - Matches against 50+ known framework signatures
- Counts languages and file distribution
- Extracts project description
3. Prioritize
Sorts files by architectural importance:
- Entry points and config files first
- Routes, models, services in the middle
- Utilities and tests last
- Focused files always at the top
4. Parse
Processes each file through tree-sitter or regex:
- Tree-sitter (14 languages): Parses into an AST, walks nodes, removes comment nodes, collapses import nodes, and optionally strips function/method bodies for signatures-only mode
- Regex fallback: Pattern-matches common comment styles (
//,#,/* */,<!-- -->) and import patterns - Collapses 3+ consecutive blank lines into 1
5. Format
Assembles the final markdown:
- Project header with prompt (if provided)
- Auto-generated context brief
- Diff summary (if in diff mode)
- Directory tree
- Code blocks per file with path headers, language tags, and tier labels
- Generation stamp with date, file count, and token total
Stats (token count, savings, estimated cost) are printed to the terminal after the run — not in the output itself, to save tokens.
License
MIT
