Crate split: layer the engine crate (helpers down, adapters up, seams 1-3)

Closed
AF
2d ago
+10507-9195

Crate split, steps 2 and 4 (seams 1-3): the single agent-file-tools crate is reorganized into layers so it can later be cut into separate crates. No behaviour changes.

  • Shared helpers and types move down to the lowest layer that uses them (path identity, progress reporting, storage paths, task types, gh-shim constants, inspect categories); tool adapters move up out of the index layer.
  • The shell command parser is its own shell-layer module (bash_parse), so permission and policy code no longer depends on the rewrite layer.
  • Seam 1: the index layer reads the runtime through a narrow IndexHost and ReadPolicy instead of AppContext; parent-folder search adapters that own a context move to parent_search.
  • Seam 2: a narrow ToolLauncher interface replaces the formatter's dependency on the sandbox spawner.
  • Seam 3: dead-code fact helpers and TODO marker parsing move into the parser layer. Stored index records stay byte-identical (golden test), so no repository re-indexes.

Upward imports inside the crate: 151 edges / 629 references before, 95 / 272 now. The branch is rebased on main after #1426; conflicts with the loading-repository search and the first-search wait kept main's behaviour at the moved paths.


Summary by cubic

Reorganizes agent-file-tools into layered modules so it can later be split into separate crates, without behavior changes. Adds a search-quality slice descriptor that pins module-move coverage for ranking-fenced paths.

Layering

  • Shared helpers (path identity, progress, storage paths, task types, gh-shim constants, inspect categories) move to the lowest layer that uses them; tool adapters move up out of the index layer.
  • The shell command parser becomes its own bash_parse module, so permission and policy no longer depend on the rewrite layer.
  • Stored index records stay byte-identical (golden test), so no re-indexes are needed.
  • Upward imports drop from 151 edges / 629 references to 95 / 272.

Seams

  • The index layer reads the runtime through narrow IndexHost and ReadPolicy interfaces instead of AppContext; parent-folder search adapters with a context move to parent_search.
  • A ToolLauncher interface replaces the formatter's dependency on the sandbox spawner.
  • Dead-code fact helpers and TODO marker parsing move into the parser layer.