|
1 | | -# Portable Coder |
| 1 | +# Portable Claude Code |
2 | 2 |
|
3 | | -Portable multi-provider coding CLI launcher with harness-first planning. |
| 3 | +A portable Claude Code launcher you can copy to any Windows computer or flash drive and run without a system-wide install. |
4 | 4 |
|
5 | | -## Current Status |
6 | | -- Planning control-plane is established (`AGENTS.md`, `HARNESS_CHECKLIST.md`, `docs/*`). |
7 | | -- Active plan: `docs/exec-plans/active/EP-001-portable-coder-foundation-and-multi-provider-mvp.md`. |
8 | | -- MVP launcher exists: `scripts/pcoder` / `scripts/pcoder.cmd`. |
9 | | -- MVP platform scope is currently Windows-first. |
10 | | -- Windows target hosts: Windows 11, Server 2016, Server 2022, Server 2025. |
11 | | -- MVP tool scope is Codex + Claude only. |
12 | | -- WSL is optional when present, but not required. |
13 | | -- Primary Linux backend for Windows MVP is bundled QEMU VM. |
14 | | -- VM policy is try hardware acceleration first, then auto fallback to portable software mode. |
| 5 | +## What it does |
| 6 | + |
| 7 | +- Launches [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI with your local filesystem accessible |
| 8 | +- Stores OAuth credentials portably inside the repo's `state/` folder (no registry or system config pollution) |
| 9 | +- On Windows: runs Claude Code inside a bundled QEMU Linux VM (no WSL required) |
| 10 | +- Supports API key mode if you prefer to skip OAuth |
| 11 | + |
| 12 | +## Requirements |
| 13 | + |
| 14 | +- **Node.js** — either bundled in `runtime/node/` or installed on the host |
| 15 | +- **Claude Code** — either installed globally (`npm install -g @anthropic-ai/claude-code`) or bundled in `runtime/` |
| 16 | +- **Windows VM mode only**: QEMU runtime (download with `pcoder runtime bootstrap`) |
15 | 17 |
|
16 | 18 | ## Quick Start |
17 | | -1. Bootstrap runtime payload (Windows): `scripts/runtime/windows/bootstrap-runtime.cmd` |
18 | | - - Optional launcher path: `scripts/pcoder runtime bootstrap` |
19 | | - - Optional URL overrides: `PCODER_QEMU_INSTALLER_URL`, `PCODER_QEMU_SHA512_URL`, `PCODER_UBUNTU_IMAGE_URL` |
20 | | -2. Run onboarding once: `scripts/pcoder setup --init`. |
21 | | -3. Choose auth modes as needed: |
22 | | - - OAuth: `scripts/pcoder setup --codex-auth oauth --claude-auth oauth` |
23 | | - - API keys: `scripts/pcoder setup --codex-auth api --claude-auth api` |
24 | | -4. Inject required env vars only for API mode (`OPENAI_API_KEY` and/or `ANTHROPIC_AUTH_TOKEN`). |
25 | | -5. Run `scripts/pcoder doctor`. |
26 | | -6. Launch in VM mode (Windows): `scripts/pcoder run <tool> --mode linux-portable`. |
27 | | -7. Use `--no-sync-back` if you do not want VM changes copied back automatically. |
28 | | - |
29 | | -On Windows, `pcoder run` defaults to `--mode linux-portable`. |
30 | | - |
31 | | -Auth management: |
32 | | -- `scripts/pcoder auth status` |
33 | | -- `scripts/pcoder auth login codex` |
34 | | -- `scripts/pcoder auth login claude` |
35 | | -- `scripts/pcoder auth logout codex` |
36 | | -- `scripts/pcoder auth logout claude` |
37 | | - |
38 | | -Windows smoke test: |
39 | | -- `scripts/runtime/windows/smoke-check.cmd` |
40 | | - |
41 | | -## CI |
42 | | -- GitHub Actions workflow: `.github/workflows/ci.yml` |
43 | | -- Runner target: Blacksmith runner label `blacksmith-2vcpu-ubuntu-2404` |
44 | | - |
45 | | -## Claude PR Runner |
46 | | -- Workflow: `.github/workflows/claude-pr-runner.yml` |
47 | | -- Trigger: mention `@claude` in PR comments/reviews (or run manually via `workflow_dispatch`) |
48 | | -- Runner target: Blacksmith runner label `blacksmith-2vcpu-ubuntu-2404` |
49 | | -- Configure one auth secret: |
50 | | - - `ANTHROPIC_API_KEY` (API key mode), or |
51 | | - - `CLAUDE_CODE_OAUTH_TOKEN` (OAuth mode) |
52 | | - |
53 | | -Supported tool IDs: |
54 | | -- `codex` |
55 | | -- `claude` |
56 | | - |
57 | | -## Planning Workflow |
58 | | -Read in order: |
59 | | -1. `AGENTS.md` |
60 | | -2. `HARNESS_CHECKLIST.md` |
61 | | -3. `docs/PLANS.md` |
62 | | -4. active ExecPlan in `docs/exec-plans/active/` |
| 19 | + |
| 20 | +### First time |
| 21 | + |
| 22 | +```bat |
| 23 | +REM 1. Initialize settings (creates state/settings.json) |
| 24 | +scripts\pcoder setup --init |
| 25 | +
|
| 26 | +REM 2. Log in with your Anthropic account (OAuth - credentials stay portable) |
| 27 | +scripts\pcoder auth login |
| 28 | +
|
| 29 | +REM 3. Check everything looks good |
| 30 | +scripts\pcoder doctor |
| 31 | +``` |
| 32 | + |
| 33 | +### Launch Claude Code |
| 34 | + |
| 35 | +```bat |
| 36 | +REM Launch in current directory |
| 37 | +scripts\pcoder |
| 38 | +
|
| 39 | +REM Launch in a specific project |
| 40 | +scripts\pcoder run --project C:\path\to\my-project |
| 41 | +
|
| 42 | +REM Pass args directly to claude |
| 43 | +scripts\pcoder -- --help |
| 44 | +``` |
| 45 | + |
| 46 | +### API key mode (skip OAuth) |
| 47 | + |
| 48 | +```bat |
| 49 | +REM Switch to API key mode |
| 50 | +scripts\pcoder setup --claude-auth api |
| 51 | +
|
| 52 | +REM Set your key before launching |
| 53 | +set ANTHROPIC_API_KEY=sk-ant-... |
| 54 | +scripts\pcoder |
| 55 | +``` |
| 56 | + |
| 57 | +## Windows: VM vs Host-Native |
| 58 | + |
| 59 | +By default on Windows, Claude runs inside a bundled portable Linux VM (QEMU). This gives full Linux compatibility without requiring WSL or any host configuration. |
| 60 | + |
| 61 | +**VM mode (default on Windows)** |
| 62 | +```bat |
| 63 | +REM Bootstrap the VM runtime first (one-time download) |
| 64 | +scripts\pcoder runtime bootstrap |
| 65 | +
|
| 66 | +REM Then just run normally |
| 67 | +scripts\pcoder |
| 68 | +``` |
| 69 | + |
| 70 | +**Host-native mode** (if claude is installed directly on Windows) |
| 71 | +```bat |
| 72 | +scripts\pcoder setup --windows-mode host-native |
| 73 | +scripts\pcoder |
| 74 | +``` |
| 75 | + |
| 76 | +## Commands |
| 77 | + |
| 78 | +| Command | Description | |
| 79 | +|---|---| |
| 80 | +| `pcoder` | Launch Claude Code in current directory | |
| 81 | +| `pcoder doctor` | Check environment health | |
| 82 | +| `pcoder setup --init` | Initialize settings | |
| 83 | +| `pcoder setup --show` | Show current settings | |
| 84 | +| `pcoder setup --claude-auth <oauth|api>` | Change auth mode | |
| 85 | +| `pcoder setup --windows-mode <linux-portable|host-native>` | Change Windows run mode | |
| 86 | +| `pcoder auth status` | Show auth status | |
| 87 | +| `pcoder auth login` | Log in via OAuth | |
| 88 | +| `pcoder auth logout` | Log out | |
| 89 | +| `pcoder runtime probe` | Show available runtimes | |
| 90 | +| `pcoder runtime bootstrap` | Download Windows VM runtime (QEMU + Ubuntu) | |
| 91 | +| `pcoder run [--project <path>] [--mode <mode>] [-- <claude args>]` | Run with options | |
| 92 | + |
| 93 | +## File Layout |
| 94 | + |
| 95 | +``` |
| 96 | +PortableCoder/ |
| 97 | + scripts/ |
| 98 | + pcoder.cmd <- Windows launcher (double-click or run from cmd) |
| 99 | + pcoder <- Linux/macOS launcher |
| 100 | + pcoder.cjs <- Main launcher logic (Node.js) |
| 101 | + runtime/windows/ <- Windows VM helper scripts |
| 102 | + runtime/ |
| 103 | + node/ <- (optional) bundled Node.js |
| 104 | + linux/ <- VM image and SSH key (after bootstrap) |
| 105 | + qemu/ <- QEMU binaries (after bootstrap) |
| 106 | + state/ |
| 107 | + settings.json <- Your settings (auto-created) |
| 108 | + auth/ <- Portable OAuth credentials (stays with the drive) |
| 109 | +profiles/ |
| 110 | + profiles.json <- Anthropic profile config |
| 111 | +``` |
| 112 | + |
| 113 | +## Portability Notes |
| 114 | + |
| 115 | +- Copy the entire `PortableCoder/` folder to a flash drive or another machine and it works |
| 116 | +- OAuth credentials are stored in `state/auth/` so they travel with the folder |
| 117 | +- No registry writes, no system PATH changes, no admin rights required (VM mode may need Hyper-V or software TCG fallback) |
0 commit comments