---
name: "Split io/fs.rs into submodules"
---

# Refactor 416: Split io/fs.rs into submodules

## Current State

- TBD

## Desired State

Refactor the monolithic server/src/io/fs.rs (2007 lines) into focused submodules within an fs/ directory.

## Acceptance Criteria

- [ ] scaffold.rs contains scaffold_story_kit, write_file_if_missing, write_script_if_missing, write_story_kit_gitignore, append_root_gitignore_entries, detect_components_toml, detect_script_test, generate_project_toml and their unit tests
- [ ] project.rs contains open_project, close_project, get_current_project, get_known_projects, forget_known_project, ensure_project_root_with_story_kit, validate_project_path and their unit tests
- [ ] files.rs contains read_file, write_file, list_directory, list_project_files, FileEntry, create_directory_absolute and their unit tests
- [ ] paths.rs contains resolve_cli_path, resolve_path, resolve_path_impl, find_story_kit_root, get_home_directory and their unit tests
- [ ] preferences.rs contains get_model_preference, set_model_preference and their unit tests
- [ ] mod.rs re-exports all public types and functions
- [ ] Unit tests live in their respective module files
- [ ] No public API changes — all existing imports continue to work

## Out of Scope

- TBD
