From a9ac7e5bb800bec6090f4494948d2ecb2624bb0f Mon Sep 17 00:00:00 2001 From: Yeachan-Heo Date: Wed, 1 Apr 2026 03:20:26 +0000 Subject: [PATCH] feat: default OAuth config for claude.com, merge UI polish rendering --- .claude.json | 5 +++ .gitignore | 3 ++ CLAUDE.md | 21 ++++++++++ .../sessions/session-1775012674485.json | 1 + .../sessions/session-1775012687059.json | 1 + .../sessions/session-1775013221875.json | 1 + rust/.clawd-todos.json | 39 +++++++++++-------- rust/crates/rusty-claude-cli/src/main.rs | 25 ++++++++---- 8 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 .claude.json create mode 100644 CLAUDE.md create mode 100644 rust/.claude/sessions/session-1775012674485.json create mode 100644 rust/.claude/sessions/session-1775012687059.json create mode 100644 rust/.claude/sessions/session-1775013221875.json diff --git a/.claude.json b/.claude.json new file mode 100644 index 0000000..e0e4c18 --- /dev/null +++ b/.claude.json @@ -0,0 +1,5 @@ +{ + "permissions": { + "defaultMode": "dontAsk" + } +} diff --git a/.gitignore b/.gitignore index 324ae1d..cfa4cf3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ __pycache__/ archive/ .omx/ .clawd-agents/ +# Claude Code local artifacts +.claude/settings.local.json +.claude/sessions/ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..d56da6e --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,21 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Detected stack +- Languages: Rust. +- Frameworks: none detected from the supported starter markers. + +## Verification +- Run Rust verification from `rust/`: `cargo fmt`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test --workspace` +- `src/` and `tests/` are both present; update both surfaces together when behavior changes. + +## Repository shape +- `rust/` contains the Rust workspace and active CLI/runtime implementation. +- `src/` contains source files that should stay consistent with generated guidance and tests. +- `tests/` contains validation surfaces that should be reviewed alongside code changes. + +## Working agreement +- Prefer small, reviewable changes and keep generated bootstrap files aligned with actual repo workflows. +- Keep shared defaults in `.claude.json`; reserve `.claude/settings.local.json` for machine-local overrides. +- Do not overwrite existing `CLAUDE.md` content automatically; update it intentionally when repo workflows change. diff --git a/rust/.claude/sessions/session-1775012674485.json b/rust/.claude/sessions/session-1775012674485.json new file mode 100644 index 0000000..7c66d08 --- /dev/null +++ b/rust/.claude/sessions/session-1775012674485.json @@ -0,0 +1 @@ +{"messages":[{"blocks":[{"text":"clear","type":"text"}],"role":"user"},{"blocks":[{"text":"\n\nI've cleared the conversation. How can I help you today?","type":"text"}],"role":"assistant","usage":{"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":4272,"output_tokens":17}}],"version":1} \ No newline at end of file diff --git a/rust/.claude/sessions/session-1775012687059.json b/rust/.claude/sessions/session-1775012687059.json new file mode 100644 index 0000000..df02aaa --- /dev/null +++ b/rust/.claude/sessions/session-1775012687059.json @@ -0,0 +1 @@ +{"messages":[{"blocks":[{"text":"exit","type":"text"}],"role":"user"},{"blocks":[{"text":"\n\nGoodbye! 👋","type":"text"}],"role":"assistant","usage":{"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":4272,"output_tokens":10}}],"version":1} \ No newline at end of file diff --git a/rust/.claude/sessions/session-1775013221875.json b/rust/.claude/sessions/session-1775013221875.json new file mode 100644 index 0000000..d45e491 --- /dev/null +++ b/rust/.claude/sessions/session-1775013221875.json @@ -0,0 +1 @@ +{"messages":[],"version":1} \ No newline at end of file diff --git a/rust/.clawd-todos.json b/rust/.clawd-todos.json index 4474dca..18efc90 100644 --- a/rust/.clawd-todos.json +++ b/rust/.clawd-todos.json @@ -1,22 +1,27 @@ [ { - "content": "Phase 0: Structural Cleanup — spawn 4 agents for 0.1-0.4", - "activeForm": "Executing Phase 0: Structural Cleanup via sub-agents", + "content": "Architecture & dependency analysis", + "activeForm": "Complete", + "status": "completed" + }, + { + "content": "Runtime crate deep analysis", + "activeForm": "Complete", + "status": "completed" + }, + { + "content": "CLI & Tools analysis", + "activeForm": "Complete", + "status": "completed" + }, + { + "content": "Code quality verification", + "activeForm": "Complete", + "status": "completed" + }, + { + "content": "Synthesize findings into unified report", + "activeForm": "Writing report", "status": "in_progress" - }, - { - "content": "Phase 1.1-1.2: Status bar with live HUD and token counter", - "activeForm": "Awaiting Phase 0", - "status": "pending" - }, - { - "content": "Phase 2.4: Remove artificial 8ms stream delay", - "activeForm": "Awaiting Phase 0", - "status": "pending" - }, - { - "content": "Phase 3.1: Collapsible tool output", - "activeForm": "Awaiting Phase 0", - "status": "pending" } ] \ No newline at end of file diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 0e9c8cf..c17e401 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -28,7 +28,7 @@ use runtime::{ parse_oauth_callback_request_target, save_oauth_credentials, ApiClient, ApiRequest, AssistantEvent, CompactionConfig, ConfigLoader, ConfigSource, ContentBlock, ConversationMessage, ConversationRuntime, MessageRole, OAuthAuthorizationRequest, - OAuthTokenExchangeRequest, PermissionMode, PermissionPolicy, ProjectContext, RuntimeError, + OAuthConfig, OAuthTokenExchangeRequest, PermissionMode, PermissionPolicy, ProjectContext, RuntimeError, Session, TokenUsage, ToolError, ToolExecutor, UsageTracker, }; use serde_json::json; @@ -428,15 +428,26 @@ fn print_bootstrap_plan() { } } +fn default_oauth_config() -> OAuthConfig { + OAuthConfig { + client_id: String::from("9d1c250a-e61b-44d9-88ed-5944d1962f5e"), + authorize_url: String::from("https://platform.claude.com/oauth/authorize"), + token_url: String::from("https://platform.claude.com/v1/oauth/token"), + callback_port: None, + manual_redirect_url: None, + scopes: vec![ + String::from("user:profile"), + String::from("user:inference"), + String::from("user:sessions:claude_code"), + ], + } +} + fn run_login() -> Result<(), Box> { let cwd = env::current_dir()?; let config = ConfigLoader::default_for(&cwd).load()?; - let oauth = config.oauth().ok_or_else(|| { - io::Error::new( - io::ErrorKind::NotFound, - "OAuth config is missing. Add settings.oauth.clientId/authorizeUrl/tokenUrl first.", - ) - })?; + let default_oauth = default_oauth_config(); + let oauth = config.oauth().unwrap_or(&default_oauth); let callback_port = oauth.callback_port.unwrap_or(DEFAULT_OAUTH_CALLBACK_PORT); let redirect_uri = runtime::loopback_redirect_uri(callback_port); let pkce = generate_pkce_pair()?;