Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions AGENTS.md

This file was deleted.

52 changes: 0 additions & 52 deletions CODEX_EXECUTION_GUIDE.md

This file was deleted.

45 changes: 0 additions & 45 deletions HARNESS_CHECKLIST.md

This file was deleted.

171 changes: 113 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,117 @@
# Portable Coder
# Portable Claude Code

Portable multi-provider coding CLI launcher with harness-first planning.
A portable Claude Code launcher you can copy to any Windows computer or flash drive and run without a system-wide install.

## Current Status
- Planning control-plane is established (`AGENTS.md`, `HARNESS_CHECKLIST.md`, `docs/*`).
- Active plan: `docs/exec-plans/active/EP-001-portable-coder-foundation-and-multi-provider-mvp.md`.
- MVP launcher exists: `scripts/pcoder` / `scripts/pcoder.cmd`.
- MVP platform scope is currently Windows-first.
- Windows target hosts: Windows 11, Server 2016, Server 2022, Server 2025.
- MVP tool scope is Codex + Claude only.
- WSL is optional when present, but not required.
- Primary Linux backend for Windows MVP is bundled QEMU VM.
- VM policy is try hardware acceleration first, then auto fallback to portable software mode.
## What it does

- Launches [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI with your local filesystem accessible
- Stores OAuth credentials portably inside the repo's `state/` folder (no registry or system config pollution)
- On Windows: runs Claude Code inside a bundled QEMU Linux VM (no WSL required)
- Supports API key mode if you prefer to skip OAuth

## Requirements

- **Node.js** — either bundled in `runtime/node/` or installed on the host
- **Claude Code** — either installed globally (`npm install -g @anthropic-ai/claude-code`) or bundled in `runtime/`
- **Windows VM mode only**: QEMU runtime (download with `pcoder runtime bootstrap`)

## Quick Start
1. Bootstrap runtime payload (Windows): `scripts/runtime/windows/bootstrap-runtime.cmd`
- Optional launcher path: `scripts/pcoder runtime bootstrap`
- Optional URL overrides: `PCODER_QEMU_INSTALLER_URL`, `PCODER_QEMU_SHA512_URL`, `PCODER_UBUNTU_IMAGE_URL`
2. Run onboarding once: `scripts/pcoder setup --init`.
3. Choose auth modes as needed:
- OAuth: `scripts/pcoder setup --codex-auth oauth --claude-auth oauth`
- API keys: `scripts/pcoder setup --codex-auth api --claude-auth api`
4. Inject required env vars only for API mode (`OPENAI_API_KEY` and/or `ANTHROPIC_AUTH_TOKEN`).
5. Run `scripts/pcoder doctor`.
6. Launch in VM mode (Windows): `scripts/pcoder run <tool> --mode linux-portable`.
7. Use `--no-sync-back` if you do not want VM changes copied back automatically.

On Windows, `pcoder run` defaults to `--mode linux-portable`.

Auth management:
- `scripts/pcoder auth status`
- `scripts/pcoder auth login codex`
- `scripts/pcoder auth login claude`
- `scripts/pcoder auth logout codex`
- `scripts/pcoder auth logout claude`

Windows smoke test:
- `scripts/runtime/windows/smoke-check.cmd`

## CI
- GitHub Actions workflow: `.github/workflows/ci.yml`
- Runner target: Blacksmith runner label `blacksmith-2vcpu-ubuntu-2404`

## Claude PR Runner
- Workflow: `.github/workflows/claude-pr-runner.yml`
- Trigger: mention `@claude` in PR comments/reviews (or run manually via `workflow_dispatch`)
- Runner target: Blacksmith runner label `blacksmith-2vcpu-ubuntu-2404`
- Configure one auth secret:
- `ANTHROPIC_API_KEY` (API key mode), or
- `CLAUDE_CODE_OAUTH_TOKEN` (OAuth mode)

Supported tool IDs:
- `codex`
- `claude`

## Planning Workflow
Read in order:
1. `AGENTS.md`
2. `HARNESS_CHECKLIST.md`
3. `docs/PLANS.md`
4. active ExecPlan in `docs/exec-plans/active/`

### First time

```bat
REM 1. Initialize settings (creates state/settings.json)
scripts\pcoder setup --init

REM 2. Log in with your Anthropic account (OAuth - credentials stay portable)
scripts\pcoder auth login

REM 3. Check everything looks good
scripts\pcoder doctor
```

### Launch Claude Code

```bat
REM Launch in current directory
scripts\pcoder

REM Launch in a specific project
scripts\pcoder run --project C:\path\to\my-project

REM Pass args directly to claude
scripts\pcoder -- --help
```

### API key mode (skip OAuth)

```bat
REM Switch to API key mode
scripts\pcoder setup --claude-auth api

REM Set your key before launching
set ANTHROPIC_API_KEY=sk-ant-...
scripts\pcoder
```

## Windows: VM vs Host-Native

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.

**VM mode (default on Windows)**
```bat
REM Bootstrap the VM runtime first (one-time download)
scripts\pcoder runtime bootstrap

REM Then just run normally
scripts\pcoder
```

**Host-native mode** (if claude is installed directly on Windows)
```bat
scripts\pcoder setup --windows-mode host-native
scripts\pcoder
```

## Commands

| Command | Description |
|---|---|
| `pcoder` | Launch Claude Code in current directory |
| `pcoder doctor` | Check environment health |
| `pcoder setup --init` | Initialize settings |
| `pcoder setup --show` | Show current settings |
| `pcoder setup --claude-auth <oauth|api>` | Change auth mode |
| `pcoder setup --windows-mode <linux-portable|host-native>` | Change Windows run mode |
| `pcoder auth status` | Show auth status |
| `pcoder auth login` | Log in via OAuth |
| `pcoder auth logout` | Log out |
| `pcoder runtime probe` | Show available runtimes |
| `pcoder runtime bootstrap` | Download Windows VM runtime (QEMU + Ubuntu) |
| `pcoder run [--project <path>] [--mode <mode>] [-- <claude args>]` | Run with options |

## File Layout

```
PortableCoder/
scripts/
pcoder.cmd <- Windows launcher (double-click or run from cmd)
pcoder <- Linux/macOS launcher
pcoder.cjs <- Main launcher logic (Node.js)
runtime/windows/ <- Windows VM helper scripts
runtime/
node/ <- (optional) bundled Node.js
linux/ <- VM image and SSH key (after bootstrap)
qemu/ <- QEMU binaries (after bootstrap)
state/
settings.json <- Your settings (auto-created)
auth/ <- Portable OAuth credentials (stays with the drive)
profiles/
profiles.json <- Anthropic profile config
```

## Portability Notes

- Copy the entire `PortableCoder/` folder to a flash drive or another machine and it works
- OAuth credentials are stored in `state/auth/` so they travel with the folder
- No registry writes, no system PATH changes, no admin rights required (VM mode may need Hyper-V or software TCG fallback)
58 changes: 0 additions & 58 deletions docs/ARCHITECTURE.md

This file was deleted.

Loading
Loading