Skip to content

♻️ Unify external tool invocations behind shared ExternalTool trait#117

Merged
renardeinside merged 4 commits intomainfrom
factor/external-tools-rework
Feb 21, 2026
Merged

♻️ Unify external tool invocations behind shared ExternalTool trait#117
renardeinside merged 4 commits intomainfrom
factor/external-tools-rework

Conversation

@renardeinside
Copy link
Copy Markdown
Collaborator

Summary

  • Introduces a shared ExternalTool trait and crates/core/src/external/ module with per-tool implementations (Uv, UvTool, Bun, Git, Gh, DatabricksCli)
  • Replaces ad-hoc UvCommand, BunCommand, ApxCommand structs and raw Command::new() calls across ~20 files with consistent abstractions
  • Adds CommandOutput value type and CommandError enum (via thiserror) replacing repeated stdout/stderr destructuring and ad-hoc error strings
  • Merges duplicate get_databricks_sdk_version() / get_databricks_sdk_version_for_project() into a single function with optional project_dir parameter

Changes

Area Before After
Command abstraction Independent UvCommand/BunCommand/ApxCommand + raw Command::new() Shared ExternalTool trait + per-tool structs
Error handling Mix of Result<_, String>, FeedbackError, raw status checks CommandError enum with NotFound, Spawn, Failed, Timeout variants
Output handling String::from_utf8_lossy(&output.stdout) repeated 15+ times CommandOutput with .check() and .into_stdout() helpers
Git operations (init.rs) 5x Command::new("git") + helper functions Git struct with init(), add(), commit(), is_inside_work_tree()
Databricks CLI (MCP) 170-line monolithic handler DatabricksCli::apps_logs() + thin handler
SDK version check Two near-identical functions Single get_databricks_sdk_version(project_dir: Option<&Path>)

New files

  • crates/core/src/external/mod.rsCommandOutput, CommandError, ExternalTool trait, run_command/run_command_sync
  • crates/core/src/external/uv.rsUv, UvTool, ApxTool
  • crates/core/src/external/bun.rsBun
  • crates/core/src/external/git.rsGit
  • crates/core/src/external/gh.rsGh
  • crates/core/src/external/databricks.rsDatabricksCli, AppsLogsArgs, AppsLogsResult

Test plan

  • cargo build --workspace — compiles cleanly
  • cargo clippy --workspace — no warnings
  • cargo test --workspace — all 337 tests pass
  • cargo fmt --all -- --check — formatted

🤖 Generated with Claude Code

@renardeinside renardeinside merged commit 1335351 into main Feb 21, 2026
3 checks passed
@renardeinside renardeinside deleted the factor/external-tools-rework branch February 21, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant