mirror of
https://github.com/lWolvesl/claw-code.git
synced 2026-04-02 15:51:51 +08:00
Add runtime OAuth primitives for PKCE generation, authorization URL building, token exchange request shaping, and refresh request shaping. Wire the API client to a real auth-source abstraction so future OAuth tokens can flow into Anthropic requests without bespoke header code. This keeps the slice bounded to foundations: no browser flow, callback listener, or token persistence. The API client still behaves compatibly for current API-key users while gaining explicit bearer-token and combined auth modeling. Constraint: Must keep the slice minimal and real while preserving current API client behavior Constraint: Repo verification requires fmt, tests, and clippy to pass cleanly Rejected: Implement full OAuth browser/listener flow now | too broad for the current parity-unblocking slice Rejected: Keep auth handling as ad hoc env reads only | blocks reuse by future OAuth integration paths Confidence: high Scope-risk: moderate Reversibility: clean Directive: Extend OAuth behavior by composing these request/auth primitives before adding session or storage orchestration Tested: cargo fmt --all; cargo clippy -p runtime -p api --all-targets -- -D warnings; cargo test -p runtime; cargo test -p api --tests Not-tested: live OAuth token exchange; callback listener flow; workspace-wide tests outside runtime/api
Rust port foundation
This directory contains the first compatibility-first Rust foundation for a drop-in Claude Code CLI replacement.
Current milestone
This initial milestone focuses on harness-first scaffolding, not full feature parity:
- a Cargo workspace aligned to major upstream seams
- a placeholder CLI crate (
rusty-claude-cli) - runtime, command, and tool registry skeleton crates
- a
compat-harnesscrate that reads the upstream TypeScript sources in../src/ - tests that prove upstream manifests/bootstrap hints can be extracted from the leaked TypeScript codebase
Workspace layout
rust/
├── Cargo.toml
├── README.md
├── crates/
│ ├── rusty-claude-cli/
│ ├── runtime/
│ ├── commands/
│ ├── tools/
│ └── compat-harness/
└── tests/
How to use
From this directory:
cargo fmt --all
cargo check --workspace
cargo test --workspace
cargo run -p rusty-claude-cli -- --help
cargo run -p rusty-claude-cli -- dump-manifests
cargo run -p rusty-claude-cli -- bootstrap-plan
Design notes
The shape follows the PRD's harness-first recommendation:
- Extract observable upstream command/tool/bootstrap facts first.
- Keep Rust module boundaries recognizable.
- Grow runtime compatibility behind proof artifacts.
- Document explicit gaps instead of implying drop-in parity too early.
Relationship to the root README
The repository root README explains the leaked TypeScript codebase. This document tracks the Rust replacement effort that lives in rust/.