This repository is a source checkout of Claude Code that runs directly with Bun. It is organized for direct development: application code lives under src/, operational scripts live under scripts/, and repository docs live under docs/.
- Bun installed and on your
PATH(latest stable is recommended). - API access: Anthropic (
claude login) or OpenRouter (see below).
.
├── docs/ Maintainer and architecture notes
├── public/ Static assets
├── scripts/ Local automation and code generation
└── src/ Application source
Key source areas:
src/entrypoints/: Bun entrypoints and SDK-facing contractssrc/cli/: CLI transport and command wiringsrc/commands/: command implementationssrc/components/: Ink UI componentssrc/services/: integrations and orchestrationsrc/tools/: tool implementations and promptssrc/utils/: shared infrastructure and helpers
See docs/architecture.md for the source tree map.
-
Clone the repo and
cdinto it:git clone https://github.com/ashish200729/claude-code.git cd claude-code -
Install dependencies:
bun install
-
Start the CLI from source (from this directory, or via a global link):
bun src/entrypoints/cli.tsx
Optional: a global
ashishcodecommand (same CLI asbun src/entrypoints/cli.tsx, with a few extra env vars for parallel tool execution):bun link --global ashishcode
Backward-compatible local alias:
claude-local
There is no separate production build for day-to-day use: the entrypoint is src/entrypoints/cli.tsx. The shipped product is a different package; here you run the repo directly.
bun run cli
node scripts/emit-core-types.mjs
node scripts/emit-control-types.mjsMinimal smoke check:
bun run cli --help- Fork the repository.
- Clone your fork.
- Run
bun install. - Start the CLI with
bun run cli. - Make changes inside
src/and keep repository-level scripts and docs in sync when entrypoints move.
The key is stored in Claude Code’s global config: ~/.claude.json → env, together with the flag that routes traffic to OpenRouter.
Pick one approach (the binary is named claude in --help; from source use bun src/entrypoints/cli.tsx, ashishcode, or claude-local):
# pass the key as an argument
bun src/entrypoints/cli.tsx auth openrouter set sk-or-v1-...
# or use OPENROUTER_API_KEY if it is already exported in your shell
bun src/entrypoints/cli.tsx auth openrouter set
# or pipe from stdin (handy for secrets)
echo "$OPENROUTER_API_KEY" | bun src/entrypoints/cli.tsx auth openrouter set --stdinAfter a successful run, new sessions default to OpenRouter (OPENROUTER_API_KEY and CLAUDE_CODE_USE_OPENROUTER=1 are written to config).
bun src/entrypoints/cli.tsx --api-provider anthropicbun src/entrypoints/cli.tsx auth openrouter clear(This only clears what is stored in ~/.claude.json — not a key you export manually in the shell.)
| Variable | Purpose |
|---|---|
OPENROUTER_BASE_URL |
Defaults to https://openrouter.ai/api |
OPENROUTER_HTTP_REFERER |
HTTP Referer for OpenRouter |
OPENROUTER_APP_TITLE |
App title sent to OpenRouter |
In an interactive session:
/model— opens the interactive model picker./model sonnet,/model opus,/model haiku, etc. — set the model by alias when your account/org allows it./model default— revert to the default from your settings.
You can also pass a full model id for the active provider — with OpenRouter, ids look like their catalog (anthropic/claude-sonnet-4.6, openai/gpt-4o, …). What actually works depends on OpenRouter and any org allowlist.
From the shell (before the REPL):
bun src/entrypoints/cli.tsx --api-provider openrouter --model anthropic/claude-sonnet-4.6bun installbun src/entrypoints/cli.tsx auth openrouter set <key>(orclaude loginfor Anthropic)bun src/entrypoints/cli.tsx→ use/modelinside the session to switch models
If something fails, confirm bun --version works and your key is valid for OpenRouter.
Local release checks:
bun run test:release
bun run cli --help
npm pack --dry-runPublish the public package:
npm login
npm publish --access publicInstall globally after publish:
npm i -g ashishcode
ashishcodeThis package runs the source CLI through Bun, so Bun must be installed on the target machine.