Эх сурвалжийг харах

feat: default OAuth config for claude.com, merge UI polish rendering

Yeachan-Heo 2 сар өмнө
parent
commit
a9ac7e5bb8

+ 5 - 0
.claude.json

@@ -0,0 +1,5 @@
+{
+  "permissions": {
+    "defaultMode": "dontAsk"
+  }
+}

+ 3 - 0
.gitignore

@@ -2,3 +2,6 @@ __pycache__/
 archive/
 .omx/
 .clawd-agents/
+# Claude Code local artifacts
+.claude/settings.local.json
+.claude/sessions/

+ 21 - 0
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.

+ 1 - 0
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}

+ 1 - 0
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}

+ 1 - 0
rust/.claude/sessions/session-1775013221875.json

@@ -0,0 +1 @@
+{"messages":[],"version":1}

+ 17 - 12
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",
-    "status": "in_progress"
+    "content": "Architecture & dependency analysis",
+    "activeForm": "Complete",
+    "status": "completed"
+  },
+  {
+    "content": "Runtime crate deep analysis",
+    "activeForm": "Complete",
+    "status": "completed"
   },
   {
-    "content": "Phase 1.1-1.2: Status bar with live HUD and token counter",
-    "activeForm": "Awaiting Phase 0",
-    "status": "pending"
+    "content": "CLI & Tools analysis",
+    "activeForm": "Complete",
+    "status": "completed"
   },
   {
-    "content": "Phase 2.4: Remove artificial 8ms stream delay",
-    "activeForm": "Awaiting Phase 0",
-    "status": "pending"
+    "content": "Code quality verification",
+    "activeForm": "Complete",
+    "status": "completed"
   },
   {
-    "content": "Phase 3.1: Collapsible tool output",
-    "activeForm": "Awaiting Phase 0",
-    "status": "pending"
+    "content": "Synthesize findings into unified report",
+    "activeForm": "Writing report",
+    "status": "in_progress"
   }
 ]

+ 18 - 7
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<dyn std::error::Error>> {
     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()?;