3.5 KiB
3.5 KiB
Dotfile Theme Manager TODO
Stage 0: Initialize the Project
- Create base structure:
src/main.rssrc/cli.rssrc/theme.rssrc/state.rssrc/apply.rstests/
- Add crates:
clap,anyhow,thiserror,serde,serde_json,dirs,shellexpand,chrono,tempfile.
- Wire a basic CLI with subcommands:
list,status,apply <theme>,backup,rollback.
- Exit criteria:
cargo buildandcargo run -- --helpwork.
Stage 1: Theme Discovery + Path Mapping
- Decide the themes root:
- start with
~/dotfiles/themes.
- start with
- Implement theme discovery from subdirectory names under the themes root.
- Define the mapping rule:
- the path inside a theme maps directly onto
$HOME.
- the path inside a theme maps directly onto
- Add
listcommand to print available themes. - Exit criteria:
- Non-theme entries are ignored.
listshows valid themes.
Stage 2: State Tracking
- Create
state.jsonmodel:active_theme,applied_at,entries.
- Add read/write helpers in
state.rs. - Implement
statuscommand:- active theme
- last apply time
- missing/broken link detection (optional for now).
- Exit criteria:
statusworks before and after apply.
Stage 3: Dry-Run Planner
- Build planner in
apply.rs:- recursively enumerate files in the selected theme
- resolve source absolute paths
- map each theme-relative path onto
$HOME - produce action list (
CreateLink,BackupExisting,Replace,Skip).
- Add
apply <theme> --dry-run. - Print exactly what would happen.
- Exit criteria:
- dry-run output is deterministic and readable.
Stage 4: Real Apply with Safety
- Implement apply execution:
- ensure parent dirs exist
- backup conflicting targets to
~/.config/theme-manager/backups/<timestamp>/... - create symlinks (Unix first).
- If any step fails:
- rollback changed targets from backups.
- Only write
state.jsonafter full success. - Exit criteria:
- Switching themes works.
- Partial failure restores previous state.
Stage 5: Rollback Command
- Implement
rollbackto restore most recent backup set. - Restore target files and clear/update state.
- Exit criteria:
- Manual rollback works after a bad apply.
Stage 6: Force Mode + Conflict Policy
- Add
--forcefor replacing unmanaged files. - Default behavior without
--force:- refuse overwrite of unknown real files.
- Add clear conflict messages with target path.
- Exit criteria:
- Safe by default; force is explicit.
Stage 7: Tests (Required Before v0.1)
- Unit tests:
- theme discovery
- path mapping
- planner decisions
- state serialization/deserialization.
- Integration tests (
tests/withtempfile):- apply from empty state
- switch dracula -> catppuccin
- conflict without
--force - rollback on simulated failure.
- Exit criteria:
cargo testgreen.
Stage 8: UX Polish
- Improve CLI output:
- summary counts (
created,replaced,backed_up,skipped).
- summary counts (
- Add
--verbose. - Add
--jsonoutput for scripting (optional). - Exit criteria:
- command output is clear and actionable.
Stage 9: Release Readiness
- Add README examples and directory layout.
- Add a sample theme tree under
examples/or in README docs. - Add
cargo clippy -- -D warningsandcargo fmt --checkin CI. - Tag
v0.1.0.
Suggested Strict Order
- Stage 0
- Stage 1
- Stage 3
- Stage 4
- Stage 2
- Stage 5
- Stage 6
- Stage 7
- Stage 8
- Stage 9