Skip to main content

Module local

Module local 

Source
Expand description

LocalExecutor — reference ToolExecutor backed by the local filesystem (tokio::fs) and process table (tokio::process), openspec change sdk-split-local-sandbox (design decision 1/6: local editing mode, the default).

Behavior mirrors the daemon’s tool implementations (theway-daemon/src/tools/{read,write,bash,ls,grep,find,git}.rs):

  • read_file reads UTF-8 text; write_file overwrites and creates missing parent directories (like the write tool).
  • run_command spawns argv[0] with argv[1..] in cwd, capturing stdout and stderr concurrently (wait_with_output drains both pipes, so a full stderr pipe cannot deadlock the wait, per the bash tool’s concurrency invariant). On timeout the child is killed (kill_on_drop backstop, like the bash tool) and the call returns CommandOutput { exit_code: -1 } — it never hangs and never leaves the child running.
  • list_dir lists entry names sorted alphabetically, dotfiles included, no recursive walk (like the ls tool).
  • grep / find walk with the ignore crate honoring .gitignore / hidden-file filters and result caps (like the grep / find tools).
  • git shells out to the system git binary in the executor’s repository context (LocalExecutor::cwd), like the git tool.

Relative paths are resolved against LocalExecutor::cwd (the process working directory by default), so an executor built with LocalExecutor::with_cwd stays deterministic regardless of the caller’s process cwd.

Structs§

LocalExecutor
Reference ToolExecutor for local editing mode: local filesystem + process table. Cheap to construct, stateless apart from the repository context path, safe to share as Arc<dyn ToolExecutor>.