chore: prep Claude Code integration#2
Conversation
- Enhance CLAUDE.md with detailed build/test/style instructions and full crate-level repository map - Create .claude/settings.json with shared tool permissions (allow cargo/git commands, deny destructive operations) - Update .claude.json to use allowEdits permission mode - Add claude/** branch pattern to CI workflow triggers so Claude Code branches get CI feedback - Expand .gitignore for editor artifacts, OS files, and Rust target/ - Fix all pre-existing cargo fmt and clippy pedantic warnings across the workspace (Rust 1.94 catches) https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
There was a problem hiding this comment.
Code Review
This pull request focuses on repository configuration, documentation updates, and extensive code cleanup across the Rust workspace. Key changes include updating .claude.json and CLAUDE.md with detailed project structure and build instructions, adding a global permissions file for tool execution, and applying various Clippy-recommended refactorings such as using let-else and std::io::Error::other. A potential regression was identified in rust/crates/commands/src/lib.rs where a large set of slash commands was removed from the 'Tools' category, which may negatively impact help documentation and UI categorization.
I am having trouble creating individual review comments. Click here to see my feedback.
rust/crates/commands/src/lib.rs (1823-1831)
The removal of this large block of slash commands from the Tools category in slash_command_category appears to be a regression. These commands (including core functionality like diff, commit, test, build, run, and format) will no longer be correctly categorized in the help system or UI. If these commands are still supported by the CLI, they should retain their categorization to ensure a consistent user experience in the help output.
The mock server returned `{}` for the count_tokens call, which failed
deserialization — silently skipping the preflight check and causing the
test to hang for ~7 minutes waiting on a response that never came.
Provide a valid `{"input_tokens":200000}` mock response so the
preflight correctly detects the oversized request and returns
ContextWindowExceeded without making the actual send_message call.
https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
There was a problem hiding this comment.
Pull request overview
Prepares the repo for Claude Code integration by adding shared Claude configuration/docs and ensuring CI runs on claude/** branches, alongside a workspace-wide formatting/clippy cleanup.
Changes:
- Add Claude Code repo guidance (
CLAUDE.md) and shared permissions/config (.claude/settings.json,.claude.json). - Update Rust CI workflow to include
claude/**branch pushes. - Apply rustfmt/clippy-driven refactors and minor lint annotations across several Rust crates.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
rust/crates/tools/src/lib.rs |
Minor refactors/formatting in tool execution and provider fallback logic. |
rust/crates/rusty-claude-cli/src/render.rs |
Small rendering/doc tweaks + clippy allowance and string-building changes. |
rust/crates/rusty-claude-cli/src/main.rs |
Refactors for formatting/clippy and small ergonomics improvements. |
rust/crates/runtime/src/worker_boot.rs |
Minor refactor around state-file emission + test formatting. |
rust/crates/runtime/src/session.rs |
Modernize error construction + improve test assertion formatting. |
rust/crates/runtime/src/session_control.rs |
Add #[must_use] to session handle creation. |
rust/crates/runtime/src/prompt.rs |
Formatting-only changes in tests. |
rust/crates/runtime/src/mcp_server.rs |
Formatting-only change in test handler closure. |
rust/crates/runtime/src/lib.rs |
Reorder re-exports for consistency. |
rust/crates/runtime/src/config.rs |
Formatting-only change in trusted roots parsing. |
rust/crates/commands/src/lib.rs |
Simplify slash-command category mapping + minor string formatting refactor. |
rust/crates/api/src/providers/openai_compat.rs |
Formatting-only refactors. |
rust/crates/api/src/providers/anthropic.rs |
Formatting-only refactors + small control-flow simplification. |
rust/crates/api/src/http_client.rs |
Add clippy allow for similar_names. |
CLAUDE.md |
New/expanded guidance for Claude Code usage and repo commands/conventions. |
.gitignore |
Ignore Rust target/ and common editor/OS artifacts. |
.github/workflows/rust-ci.yml |
Add claude/** branch pattern to push trigger. |
.claude/settings.json |
New shared Claude tool permission allow/deny list. |
.claude.json |
Switch default permissions mode and set working directory to rust. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
commands: update /session help assertion to match current spec that includes the |delete <session-id> [--force] option. plugins: use non-login shell (sh -c) for inline hook commands instead of sh -lc, which sourced profile scripts that polluted stdout. Also tolerate BrokenPipe when writing the JSON payload to hook stdin — hooks are not required to consume their input. https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot, why is this unchecked in the PR descriptions? Is it implemented? CI runs on this claude/** branch confirming the new trigger works |
|
@copilot, why is this failing checks |
|
@copilot, why is this failing? failing checks |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… issues Agent-Logs-Url: https://github.com/badMade/claw-code/sessions/95bffa47-ee77-4262-b333-7cd80d90b534 Co-authored-by: badMade <106821302+badMade@users.noreply.github.com>
Agent-Logs-Url: https://github.com/badMade/claw-code/sessions/95bffa47-ee77-4262-b333-7cd80d90b534 Co-authored-by: badMade <106821302+badMade@users.noreply.github.com>
The CI check item was unchecked because this was a
The 3 failing tests were pre-existing (stale test expectations, not caused by the clippy/fmt changes in this PR). Fixed in d9664f9:
All 156 unit tests now pass. |
The checkbox was unchecked because it was aspirational — CI hadn't triggered on the
The 3 failures were all pre-existing bugs in
All three are fixed in commit d9664f9. |
Same fixes as plugins/hooks.rs — use sh -c instead of sh -lc so login profile scripts don't pollute hook stdout, and ignore BrokenPipe when writing the JSON payload to hook stdin since hooks may exit before consuming input. https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
Use sh -c instead of sh -lc for both plugins and runtime hook runners. Login shell initialization scripts (e.g. nvm) pollute stdout, which corrupts hook output capture and causes test failures in CI. Also tolerate BrokenPipe when writing JSON payload to hook stdin in runtime hooks, since hooks may exit before consuming input. https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
|
@claude make this fix The job is failing because --compact mode still prints non-compact UI output (spinner/progress + tool-call “frames” with ANSI cursor sequences) to stdout, so the tests that assert stdout contains only the final assistant text fail. From the failing assertions in rust/crates/rusty-claude-cli/tests/compact_output.rs (ref c9f3651): compact_flag_streaming_text_only_emits_final_message_text expects stdout to be exactly:
not created at all, or Rust
Rust write only the final assistant text to stdout All interactive / TUI-ish output → stderr Rust Why this matches the failure spinner text (⠋ 🦀 Thinking...) Once compact mode routes/omits those UI paths and prints only the final assistant text, both tests in compact_output.rs will pass, and the cargo test --workspace job in .github/workflows/rust-ci.yml (ref c9f365...) should go green. |
The compact flag was being discarded (`compact: _`) in the CliAction::Prompt match arm and hardcoded to `false`, so --compact mode was never activated. This caused the compact_output integration tests to fail because the full interactive UI (spinner, tool-call details, ANSI sequences) was written to stdout instead of only the final assistant text. https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
… config Root causes of CI failures: 1. All shell execution (`sh -lc`) used login shells, causing nvm init to pollute stdout with "nvm" text. Changed to `sh -c` in bash executor, sandbox launcher, plugin lifecycle, REPL runtime, and command_exists. 2. Git test helpers inherited global git config (e.g. commit.gpgsign) from CI runners, causing `git commit` to fail with exit 128. Added GIT_CONFIG_NOSYSTEM=1 and GIT_CONFIG_GLOBAL=/dev/null to isolate test repos from system/user configuration. https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
… mock Three fixes for CI test failures: 1. Skip read_piped_stdin() when a CLI prompt is provided, so that stdin remains available for interactive permission approval prompts. Previously read_piped_stdin consumed all of stdin (including the "y" answer) before the permission prompter could read it. 2. Handle /v1/messages/count_tokens in the mock Anthropic service with a stub JSON response instead of treating it as a scenario request. The client now makes preflight token-counting calls that were inflating the captured request count from 21 to 42. 3. Use workspace_fingerprint in the resume_latest integration test so session files are written to the correct fingerprinted subdirectory that SessionStore::from_cwd expects. https://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY
Summary
CLAUDE.mdwith detailed build/test commands, crate-by-crate repo map, code style conventions, and CI docs.claude/settings.jsonwith shared team tool permissions (allow cargo/git, deny destructive ops).claude.jsonto useallowEditspermission modeclaude/**branch pattern to CI workflow so Claude Code branches get CI feedback.gitignorefor editor artifacts, OS files, andtarget/cargo fmtandclippywarnings across the workspace (Rust 1.94 pedantic catches)Test plan
cargo fmt --all --checkpassescargo clippy --workspace --all-targets -- -D warningspassesmain)claude/**branch confirming the new trigger workshttps://claude.ai/code/session_01HZSVJyyV6aweGbT8YkN6nY