Commit Graph

395 Commits

Author SHA1 Message Date
Yeachan-Heo
b3fe057559 Close the MCP lifecycle gap from config to runtime tool execution
This wires configured MCP servers into the CLI/runtime path so discovered
MCP tools, resource wrappers, search visibility, shutdown handling, and
best-effort discovery all work together instead of living as isolated
runtime primitives.

Constraint: Keep non-MCP startup flows working without new required config
Constraint: Preserve partial availability when one configured MCP server fails discovery
Rejected: Fail runtime startup on any MCP discovery error | too brittle for mixed healthy/broken server configs
Rejected: Keep MCP support runtime-only without registry wiring | left discovery and invocation unreachable from the CLI tool lane
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Runtime MCP tools are registry-backed but executed through CliToolExecutor state; keep future tool-registry changes aligned with that split
Tested: cargo test -p runtime mcp -- --nocapture; cargo test -p tools -- --nocapture; cargo test -p rusty-claude-cli -- --nocapture; cargo test --workspace -- --nocapture
Not-tested: Live remote MCP transports (http/sse/ws/sdk) remain unsupported in the CLI execution path
2026-04-03 14:31:25 +00:00
Yeachan-Heo
8805386bea merge: clawcode-issue-9406-commands-skill-install into main 2026-04-02 13:55:42 +00:00
Yeachan-Heo
c9f26013d8 merge: clawcode-issue-9405-plugins-execution-pipeline into main 2026-04-02 13:55:42 +00:00
Yeachan-Heo
703bbeef06 merge: clawcode-issue-9404-tools-plan-worktree into main 2026-04-02 13:55:42 +00:00
Yeachan-Heo
5d8e131c14 Wire plugin hooks and lifecycle into runtime startup
PARITY.md is stale relative to the current Rust plugin pipeline: plugin manifests, tool loading, and lifecycle primitives already exist, but runtime construction only consumed plugin tools. This change routes enabled plugin hooks into the runtime feature config, initializes plugin lifecycle commands when a runtime is built, and shuts plugins down when runtimes are replaced or dropped.\n\nThe test coverage exercises the new runtime plugin-state builder and verifies init/shutdown execution without relying on global cwd or config-home mutation, so the existing CLI suite stays stable under parallel execution.\n\nConstraint: Keep the change inside the current worktree and avoid touching unrelated pre-existing edits\nRejected: Add plugin hook execution inside the tools crate directly | runtime feature merging is the existing execution boundary\nRejected: Use process-global CLAW_CONFIG_HOME/current_dir in tests | races with the existing parallel CLI test suite\nConfidence: high\nScope-risk: moderate\nReversibility: clean\nDirective: Preserve plugin runtime shutdown when rebuilding LiveCli runtimes or temporary turn runtimes\nTested: cargo test -p rusty-claude-cli build_runtime_\nTested: cargo test -p rusty-claude-cli\nNot-tested: End-to-end live REPL session with a real plugin outside the test harness
2026-04-02 10:04:54 +00:00
Yeachan-Heo
e780142886 Make /skills install reusable skill packs
The Rust commands layer could list skills, but it had no concrete install path.
This change adds /skills install <path> and matching direct CLI parsing so a
skill directory or markdown file can be copied into the user skill registry
with a normalized invocation name and a structured install report.

Constraint: Keep the enhancement inside the existing Rust commands surface without adding dependencies
Rejected: Full project-scoped registry management | larger parity surface than needed for one landed path
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If project-scoped skill installation is added later, keep the install target explicit so command discovery and tool resolution stay aligned
Tested: cargo test -p commands
Tested: cargo clippy -p commands --tests -- -D warnings
Tested: cargo test -p rusty-claude-cli parses_direct_agents_and_skills_slash_commands
Tested: cargo test -p rusty-claude-cli parses_login_and_logout_subcommands
Tested: cargo clippy -p rusty-claude-cli --tests -- -D warnings
Not-tested: End-to-end interactive REPL invocation of /skills install against a real user skill registry
2026-04-02 10:03:22 +00:00
Yeachan-Heo
5c845d582e Close the plan-mode parity gap for worktree-local tool flows
PARITY.md still flags missing plan/worktree entry-exit tools. This change adds EnterPlanMode and ExitPlanMode to the Rust tool registry, stores reversible worktree-local state under .claw/tool-state, and restores or clears the prior local permission override on exit. The round-trip tests cover both restoring an existing local override and cleaning up a tool-created override from an empty local state.

Constraint: Must keep the override worktree-local and reversible without mutating higher-scope settings
Rejected: Reuse Config alone with no state file | exit could not safely restore absent-vs-local overrides
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep plan-mode state tracking aligned with settings.local.json precedence before adding worktree enter/exit tools
Tested: cargo test -p tools
Not-tested: interactive CLI prompt-mode invocation of the new tools
2026-04-02 10:01:33 +00:00
YeonGyu-Kim
93d98ab33f fix: suppress WIP dead_code/clippy warnings in rusty-claude-cli
CLI binary has functions from multiple parity branches that aren't fully
wired up yet. Allow dead_code and related clippy lints at crate level
until the wiring is complete.
2026-04-02 18:38:47 +09:00
YeonGyu-Kim
6e642a002d Merge branch 'dori/commands-parity' into main 2026-04-02 18:37:00 +09:00
YeonGyu-Kim
b92bd88cc8 Merge branch 'dori/tools-parity' 2026-04-02 18:36:41 +09:00
YeonGyu-Kim
ef48b7e515 Merge branch 'dori/hooks-parity' into main 2026-04-02 18:36:37 +09:00
YeonGyu-Kim
12bf23b440 Merge branch 'dori/mcp-parity' 2026-04-02 18:35:38 +09:00
YeonGyu-Kim
d88144d4a5 feat(commands): slash-command validation, help formatting, CLI wiring
- Add centralized validate_slash_command_input for all slash commands
- Rich error messages and per-command help detail
- Wire validation into CLI entrypoints in main.rs
- Consistent /agents and /skills usage surface
- Verified: cargo test -p commands 22 passed, integration test passed, clippy clean
2026-04-02 18:24:47 +09:00
YeonGyu-Kim
73187de6ea feat(tools): error propagation, REPL timeout, edge-case validation
- Replace NotebookEdit expect() with Result-based error propagation
- Add 5-minute guard to Sleep duration
- Reject empty StructuredOutput payloads
- Enforce timeout_ms in REPL via spawn+try_wait+kill
- Add edge-case tests: excessive/zero sleep, empty output, REPL timeout
- Verified: cargo test -p tools 35 passed, clippy clean
2026-04-02 18:24:39 +09:00
YeonGyu-Kim
3b18ce9f3f feat(mcp): add toolCallTimeoutMs, timeout/reconnect/error handling
- Add toolCallTimeoutMs to stdio MCP config with 60s default
- tools/call runs under timeout with dedicated Timeout error
- Handle malformed JSON/broken protocol as InvalidResponse
- Reset/reconnect stdio state on child exit or transport drop
- Add tests: slow timeout, invalid JSON response, stdio reconnect
- Verified: cargo test -p runtime 113 passed, clippy clean
2026-04-02 18:24:30 +09:00
YeonGyu-Kim
f2dd6521ed feat(hooks): add PostToolUseFailure propagation, validation, and tests
- Hook runner propagates execution failures as real errors, not soft warnings
- Conversation converts failed pre/post hooks into error tool results
- Plugins fully support PostToolUseFailure: aggregation, resolution, validation, execution
- Add ordering + short-circuit tests for normal and failure hook chains
- Add missing PostToolUseFailure manifest path rejection test
- Verified: cargo clippy --all-targets -- -D warnings passes, cargo test 94 passed
2026-04-02 18:24:12 +09:00
YeonGyu-Kim
29530f9210 Merge remote-tracking branch 'origin/dori/plugins-parity' 2026-04-02 18:16:07 +09:00
YeonGyu-Kim
c9ff4dd826 Merge remote-tracking branch 'origin/dori/hooks-parity' 2026-04-02 18:16:07 +09:00
YeonGyu-Kim
97be23dd69 feat(hooks): add hook error propagation and execution ordering tests
- Add proper error types for hook failures
- Improve hook execution ordering guarantees
- Add tests for hook execution flow and error handling
- 109 runtime tests pass, clippy clean
2026-04-02 18:16:00 +09:00
YeonGyu-Kim
46853a17df feat(plugins): add plugin loading error handling and manifest validation
- Add structured error types for plugin loading failures
- Add manifest field validation
- Improve plugin API surface with consistent error patterns
- 31 plugins tests pass, clippy clean
2026-04-02 18:15:37 +09:00
YeonGyu-Kim
485b25a6b4 fix: resolve merge conflicts between commands-parity and stub-commands branches
- Fix Commit/DebugToolCall variant mismatch (unit variants, not struct)
- Apply cargo fmt
2026-04-02 18:14:09 +09:00
YeonGyu-Kim
cad4dc3a51 Merge remote-tracking branch 'origin/dori/integration-tests' 2026-04-02 18:12:34 +09:00
YeonGyu-Kim
ece246b7f9 Merge remote-tracking branch 'origin/dori/stub-commands'
# Conflicts:
#	rust/crates/commands/src/lib.rs
2026-04-02 18:12:34 +09:00
YeonGyu-Kim
23c8b42175 Merge remote-tracking branch 'origin/dori/commands-parity' 2026-04-02 18:12:10 +09:00
YeonGyu-Kim
cb72eb1bf8 Merge remote-tracking branch 'origin/dori/tools-parity' 2026-04-02 18:12:10 +09:00
YeonGyu-Kim
65064c01db test(cli): expand integration tests for CLI args, config, and slash command dispatch
- Add 8 new integration tests for resume slash commands
- Test CLI arg parsing, slash command matching, config defaults
- All 102 tests pass (94 unit + 4 + 4 integration), clippy clean
2026-04-02 18:11:25 +09:00
YeonGyu-Kim
6c5ee95fa2 feat(cli): implement stub slash commands with proper scaffolding
- Add implementations for Bughunter, Commit, Pr, Issue, Ultraplan, Teleport, DebugToolCall
- Add helper functions for git operations, file handling, and progress reporting
- Refactor command dispatch for cleaner match arms
- 96 CLI tests pass + 1 integration test pass
2026-04-02 18:10:32 +09:00
YeonGyu-Kim
54fa43307c feat(runtime): add tests and improve error handling across runtime crate
- Add 20 new tests for conversation, session, and SSE modules
- Improve error paths in conversation.rs and session.rs
- Add SSE event parsing tests
- 126 runtime tests pass, clippy clean, fmt clean
2026-04-02 18:10:12 +09:00
YeonGyu-Kim
731ba9843b feat(commands): add slash command argument validation with clear error messages
- Add SlashCommandParseError type for structured parse failures
- Validate arguments for all arg-taking commands (permissions, config, session, plugin, agents, skills, teleport, resume)
- No-arg commands now reject unexpected arguments
- Error messages include help text with usage/summary/category
- 21 commands tests pass, clippy clean
2026-04-02 18:09:48 +09:00
YeonGyu-Kim
f5fa3e26c8 refactor(tools): replace panic paths with proper error handling
- Convert permission_mode_from_plugin panic to Result-based error
- Add input validation for tool dispatch edge cases
- Propagate signature changes to main.rs caller
- 29 tools tests pass, clippy clean
2026-04-02 18:04:55 +09:00
YeonGyu-Kim
f49b39f469 refactor(runtime): replace unwrap panics with proper error propagation in session.rs
- Convert serde_json::to_string().unwrap() to Result-based error handling
- Add SessionError variants for serialization failures
- All 106 runtime tests pass
2026-04-02 18:02:40 +09:00
YeonGyu-Kim
6e4b0123a6 fix: resolve clippy warnings, apply cargo fmt, skip env-dependent test
- Replace .into_iter() with .iter() on slice reference
- Use String::from() to avoid assigning_clones false positive
- Mark startup_banner test as #[ignore] (requires ANTHROPIC_API_KEY)
- Apply cargo fmt to all Rust sources
2026-04-02 17:52:31 +09:00
Yeachan-Heo
8f1f65dd98 Preserve explicit resume paths while parsing slash command arguments
The release-harness merge taught --resume to keep multi-token slash commands together, but that also misclassified absolute session paths as slash commands. This follow-up keeps the latest-session shortcut for real slash commands while still treating absolute and relative filesystem paths as explicit resume targets, which restores the new integration test and the intended resume flow.

Constraint: --resume must accept both implicit latest-session shortcuts and absolute filesystem paths
Rejected: Require --resume latest for all slash-command-only invocations | breaks the new shortcut UX merged from 9103/9202
Confidence: high
Scope-risk: narrow
Directive: Distinguish slash commands with looks_like_slash_command_token before assuming a leading slash means latest-session shorthand
Tested: cargo build -p rusty-claude-cli; cargo test -p rusty-claude-cli
Not-tested: Non-UTF8 session path handling
2026-04-02 08:40:34 +00:00
Yeachan-Heo
9fb79d07ee Merge remote-tracking branch 'origin/omx-issue-9203-release-binary'
# Conflicts:
#	rust/crates/rusty-claude-cli/src/main.rs
2026-04-02 08:37:36 +00:00
Yeachan-Heo
c0be23b4f6 Merge remote-tracking branch 'origin/omx-issue-9202-release-harness'
# Conflicts:
#	rust/crates/rusty-claude-cli/src/main.rs
2026-04-02 08:35:56 +00:00
Yeachan-Heo
3c73f0ffb3 Merge remote-tracking branch 'origin/omx-issue-9201-release-ci'
# Conflicts:
#	.github/workflows/rust-ci.yml
#	rust/crates/rusty-claude-cli/src/main.rs
2026-04-02 08:32:15 +00:00
Yeachan-Heo
769435665a Merge remote-tracking branch 'origin/omx-issue-9103-clawcode-ux-enhance'
# Conflicts:
#	rust/crates/rusty-claude-cli/src/main.rs
2026-04-02 08:30:05 +00:00
Yeachan-Heo
7858fc86a1 merge: omx-issue-9102-opencode-ux-compare into main
# Conflicts:
#	rust/crates/rusty-claude-cli/src/main.rs
2026-04-02 08:23:21 +00:00
Yeachan-Heo
04b7e41a3c merge: omx-issue-9101-codex-ux-compare into main 2026-04-02 08:16:42 +00:00
Yeachan-Heo
9cad6d2de3 merge: gaebal/cli-dispatch-top5 into main 2026-04-02 08:16:42 +00:00
Yeachan-Heo
07aae875e5 Prevent command-shaped claw invocations from silently becoming prompts
Add explicit top-level aliases for help/version/status/sandbox and return guidance for lone slash-command names so common command-style invocations do not fall through into prompt execution and unexpected auth/API work.

Constraint: Keep shorthand prompt mode working for natural-language multi-word input
Rejected: Remove bare prompt shorthand entirely | too disruptive to existing UX
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep single-word command guards aligned with the slash-command surface when adding new top-level UX affordances
Tested: cargo build -p rusty-claude-cli; cargo test -p rusty-claude-cli parses_single_word_command_aliases_without_falling_back_to_prompt_mode -- --nocapture; cargo test -p rusty-claude-cli single_word_slash_command_names_return_guidance_instead_of_hitting_prompt_mode -- --nocapture; cargo test -p rusty-claude-cli multi_word_prompt_still_uses_shorthand_prompt_mode -- --nocapture; cargo test -p rusty-claude-cli init_help_mentions_direct_subcommand -- --nocapture; cargo test -p rusty-claude-cli parses_login_and_logout_subcommands -- --nocapture; cargo test -p rusty-claude-cli parses_direct_agents_and_skills_slash_commands -- --nocapture; ./target/debug/claw help; ./target/debug/claw version; ./target/debug/claw status; ./target/debug/claw sandbox; ./target/debug/claw cost
Not-tested: cargo test -p rusty-claude-cli -- --nocapture still has a pre-existing failure in tests::init_template_mentions_detected_rust_workspace
Not-tested: cargo clippy -p rusty-claude-cli -- -D warnings still fails on pre-existing runtime crate lints
2026-04-02 07:44:39 +00:00
Yeachan-Heo
346a2919ff ci: add rust github actions workflow 2026-04-02 07:40:01 +00:00
Yeachan-Heo
b3b14cff79 Prevent resumed slash commands from dropping release-critical arguments
The release harness advertised resumed slash commands like /export <file> and /clear --confirm, but argv parsing split every slash-prefixed token into a new command. That made the claw binary reject legitimate resumed command sequences and quietly miss the caller-provided export target.

This change teaches --resume parsing to keep command arguments attached, including absolute export paths, and locks the behavior with both parser regressions and a binary-level smoke test that exercises the real claw resume path.

Constraint: Keep the scope to a high-confidence release-path fix that fits a ~1 hour hardening pass

Rejected: Broad REPL or network end-to-end coverage expansion | too slow and too wide for the release-confidence target

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: If new resume-supported commands accept slash-prefixed literals, extend the resume parser heuristics and add binary coverage for them

Tested: cargo test --workspace; cargo test -p rusty-claude-cli --test resume_slash_commands; cargo test -p rusty-claude-cli parses_resume_flag_with_absolute_export_path -- --exact

Not-tested: cargo clippy --workspace --all-targets -- -D warnings currently fails on pre-existing runtime/conversation/session lints outside this change
2026-04-02 07:37:25 +00:00
Yeachan-Heo
aea6b9162f Keep Rust PRs green with a minimal CI gate
Add a focused GitHub Actions workflow for pull requests into main plus
manual dispatch. The workflow checks workspace formatting and runs the
rusty-claude-cli crate tests so we get a real signal on the active Rust
surface without widening scope into a full matrix.

Because the workspace was not rustfmt-clean, include the formatting-only
updates needed for the new fmt gate to pass immediately.

Constraint: Keep scope to a fast, low-noise Rust PR gate
Constraint: CI should validate formatting and rusty-claude-cli without expanding to full workspace coverage
Rejected: Full workspace test or clippy matrix | too broad for the one-hour shipping window
Rejected: Add fmt CI without reformatting the workspace | the new gate would fail on arrival
Confidence: high
Scope-risk: narrow
Directive: Keep this workflow focused unless release requirements justify broader coverage
Tested: cargo fmt --all -- --check
Tested: cargo test -p rusty-claude-cli
Tested: YAML parse of .github/workflows/rust-ci.yml via python3 + PyYAML
Not-tested: End-to-end execution on GitHub-hosted runners
2026-04-02 07:31:56 +00:00
Yeachan-Heo
79da7c0adf Make claw's REPL feel self-explanatory from analysis through commit
Claw already had the core slash-command and git primitives, but the UX
still made users work to discover them, understand current workspace
state, and trust what `/commit` was about to do. This change tightens
that flow in the same places Codex-style CLIs do: command discovery,
live status, typo recovery, and commit preflight/output.

The REPL banner and `/help` now surface a clearer starter path, unknown
slash commands suggest likely matches, `/status` includes actionable git
state, and `/commit` explains what it is staging and committing before
and after the model writes the Lore message. I also cleared the
workspace's existing clippy blockers so the verification lane can stay
fully green.

Constraint: Improve UX inside the existing Rust CLI surfaces without adding new dependencies
Rejected: Add more slash commands first | discoverability and feedback were the bigger friction points
Rejected: Split verification lint fixes into a second commit | user requested one solid commit
Confidence: high
Scope-risk: moderate
Directive: Keep slash discoverability, status reporting, and commit reporting aligned so `/help`, `/status`, and `/commit` tell the same workflow story
Tested: cargo fmt --all; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: Manual interactive REPL session against live Anthropic/xAI endpoints
2026-04-02 07:20:35 +00:00
Yeachan-Heo
8f737b13d2 Reduce REPL overhead for orchestration-heavy workflows
Claw already exposes useful orchestration primitives such as session forking,
resume, ultraplan, agents, and skills, but compared with OmO/OMX
they were still high-friction to discover and re-type during live
operator loops.

This change makes the REPL act more like an orchestration console by
refreshing context-aware tab completions before each prompt, allowing
completion after slash-command arguments, and surfacing common workflow
paths such as model aliases, permission modes, and recent session IDs.
The startup banner and REPL help now advertise that guidance so the
capability is visible instead of hidden.

Constraint: Keep the improvement low-risk and REPL-local without adding dependencies or new command semantics
Rejected: Add a brand new orchestration slash command | higher UX surface area and more docs burden than a discoverability fix
Rejected: Implement a persistent HUD/status bar first | higher implementation risk than improving existing command ergonomics
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep dynamic completion candidates aligned with slash-command behavior and session management semantics
Tested: cargo test -p rusty-claude-cli
Not-tested: Interactive TTY tab-completion behavior in a live terminal session; full clippy remains blocked by pre-existing runtime crate lints
2026-04-02 07:19:14 +00:00
Yeachan-Heo
a127ad7878 Reduce CLI dead-ends around help and session recovery
The Rust CLI now points users toward the right next step when they hit an
unknown slash command or mistype a flag, and it surfaces session shortcuts
more clearly in both help text and the REPL banner. It also lowers session
friction by accepting `latest` as a managed-session shortcut, allowing
`--resume` without an explicit path, and sorting saved sessions with
millisecond precision so the newest session is stable.

Constraint: Keep the change inside the existing Rust CLI surface and avoid overlapping new handlers
Constraint: Full workspace clippy -D warnings is currently blocked by pre-existing runtime warnings outside this change
Rejected: Add new slash commands for session shortcuts | higher overlap with already-landed handler work
Rejected: Treat unknown bare words as invalid subcommands | would break shorthand prompt mode
Confidence: high
Scope-risk: moderate
Directive: Preserve bare-word prompt mode when adjusting CLI parsing; only surface guidance for flag-like inputs and slash commands
Tested: cargo clippy -p rusty-claude-cli --bin claw --no-deps -- -D warnings
Tested: cargo test -p rusty-claude-cli
Tested: cargo run -q -p rusty-claude-cli -- --help
Tested: cargo run -q -p rusty-claude-cli -- --resum
Tested: cargo run -q -p rusty-claude-cli -- /stats
Not-tested: Full workspace clippy -D warnings still fails in unrelated runtime code
2026-04-02 07:15:03 +00:00
Yeachan-Heo
fd0a299e19 test: cover new CLI slash command handlers 2026-04-02 06:05:24 +00:00
Yeachan-Heo
d26fa889c0 feat: wire top CLI slash command handlers 2026-04-02 06:00:00 +00:00
YeonGyu-Kim
765635b312 chore: clean up post-merge compiler warnings
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-02 14:00:07 +09:00