Distill generic patterns from work code and push to your personal GitHub.
Work code contains company-specific naming, business logic, and credentials — but the underlying programming patterns are yours. cdst uses Claude Code to generalize your code and push it to a personal repository with one command.
cdst push src/services/acme-payment-api.ts
- Reads the source file
- Claude Code generalizes the code (removes company names, credentials, business logic)
- Shows you the result for review
- Pushes to your personal GitHub repository via the Contents API
Before (work code):
import { AcmeAuthClient } from "../auth/acme-auth";
export async function callPaymentAPI(orderId: string, amount: number) {
const auth = new AcmeAuthClient(process.env.ACME_SECRET_KEY!);
// ... company-specific implementation
}After (generalized):
/**
* Fetch wrapper with retry and exponential backoff.
*/
export async function fetchWithRetry(
url: string,
options: RequestInit & { maxRetries?: number }
): Promise<Response> {
// ... generic pattern
}- Claude Code installed and authenticated
- GitHub Personal Access Token with
reposcope - Node.js 20+
# Install
pnpm install
pnpm build
pnpm link --global
# Configure
cdst init# Preview generalized code without pushing
cdst preview <file>
# Generalize and push to your personal repo
cdst push <file>
# Push with custom commit message
cdst push <file> -m "Add retry utility"
# Push to a custom path in the repo
cdst push <file> --path "libraries/http"
# Re-push a previously pushed file
cdst push <file> --force
# View configuration
cdst config --list
# Update a config value
cdst config defaultTargetPath librariesStored at ~/.codedistill/config.json:
| Key | Description | Default |
|---|---|---|
githubToken |
GitHub Personal Access Token | — |
githubRepo |
Target repo (owner/repo) |
— |
defaultBranch |
Branch to push to | main |
defaultTargetPath |
Base path in repo | snippets |
your-repo/
└── snippets/
├── patterns/
│ └── retry-with-backoff.ts
├── utils/
│ └── deep-merge.ts
├── middleware/
│ └── jwt-auth-middleware.ts
└── hooks/
└── use-debounced-search.ts
Categories are suggested by AI: patterns, utils, data-structures, algorithms, api-integration, middleware, hooks, components, testing, config, other.
MIT