refactor(tools): wire filesystem tools to new use cases, drop broken ones

Updates alfred/agent/tools/filesystem.py to use the five free-function
use cases introduced in the previous commit:

  - list_folder            -> list_dir_use_case(Path(path), roots)
  - create_directory (new) -> create_dir_use_case(Path(path), roots)
  - move_media             -> move_file_use_case(src, dst, roots)
  - move_to_destination    -> create_dir_use_case(dst.parent) + move_file

A module-level _load_directory_roots() helper reads memory once per
call and builds the DirectoryRoots VO; missing roots produce an
explicit 'roots_not_configured' error.

Tools whose backing code was moved to *_OLD files are removed entirely
rather than left broken: manage_subtitles, set_path_for_folder,
create_seed_links, and the four resolve_*_destination tools. They will
come back when the matching application/domain code is rebuilt later
on this branch.

alfred/agent/tools/__init__.py shrinks accordingly. find_media_imdb_id
(already broken before this branch — name not exported by tools.api)
is dropped from the package re-exports so the package imports cleanly
again.
This commit is contained in:
2026-05-26 19:46:49 +02:00
parent 2df7843d8b
commit 42fa6139ed
3 changed files with 151 additions and 135 deletions
+19
View File
@@ -34,6 +34,15 @@ callers).
and returns a frozen `<Op>Response` DTO. Roots are now injected, not
pulled from the global memory singleton.
- **Agent tool wrappers partially re-wired** to the new use cases.
`list_folder` now delegates to `list_dir_use_case`; `move_media`
to `move_file_use_case`; `move_to_destination` chains
`create_dir_use_case` + `move_file_use_case`; a new
`create_directory` tool wraps `create_dir_use_case`. Roots are
loaded once via a module-level `_load_directory_roots()` helper
that reads the persisted memory (no more per-call singleton
reads inside the use cases themselves).
### Removed
- `FileManager` / `MediaOrganizer` / `create_folder` / `move` from the
@@ -46,6 +55,16 @@ callers).
of `alfred.application.filesystem`. Same `_OLD` rename treatment.
This intentionally breaks current tool wrappers and tests downstream
— re-wiring is the next chunk of work on this branch.
- **Agent tools dropped during the refactor** (to be reintroduced
when the matching domain/application code lands):
`manage_subtitles`, `set_path_for_folder`, `create_seed_links`,
`resolve_season_destination`, `resolve_episode_destination`,
`resolve_movie_destination`, `resolve_series_destination`.
Their wrappers are removed from `alfred.agent.tools.filesystem`;
`alfred.agent.tools.__init__` now re-exports only what still
imports cleanly. `find_media_imdb_id` (already broken before this
branch — name no longer exported by `tools.api`) was also dropped
from the package re-exports.
### Added