feat(cli+sdk): consolidate default paths under ~/.config/loseit#72
Merged
Conversation
Move backup root and trash file under ~/.config/loseit/ so they sit
next to config.yaml and the auth token. Previously they followed XDG
strictly (backup + trash in ~/.local/share/loseit/, config in
~/.config/loseit/), but having two directories per app for ~3 files
is friction without benefit on a single-user workstation.
New defaults:
~/.config/loseit/
config.yaml
token
backup/ <- was ~/.local/share/loseit/backup/
trash.jsonl <- was ~/.local/share/loseit/trash.jsonl
Overridable two ways (in addition to the existing --root / --trash-file
flags):
- $LOSEIT_BACKUP_ROOT (backup, restore-backup)
- $LOSEIT_TRASH_FILE (delete, restore-trash)
Documented in --help via typer's envvar= mechanism, so --help also
shows "[env var: LOSEIT_BACKUP_ROOT]" beside each flag.
Spec doc + README updated to match. Existing backups under
~/.local/share/loseit/backup/ are NOT migrated automatically; users
can either rerun "loseit backup" against the new default (resume-safe)
or move the directory manually.
phitoduck
added a commit
that referenced
this pull request
Jun 13, 2026
Two ruff failures kept CI red on main after the delete-safeguards merge (PR #62) and the path-consolidation merge (PR #72): - UP035: src/lose_it/backup/_upsert.py imported Iterable from typing. Pyupgrade rule says use collections.abc.Iterable. - I001: after the swap, the import block became un-sorted. Both fixed; ruff check is now clean. Tests stay at 276/276.
phitoduck
added a commit
that referenced
this pull request
Jun 13, 2026
Two ruff failures kept CI red on main after the delete-safeguards merge (PR #62) and the path-consolidation merge (PR #72): - UP035: src/lose_it/backup/_upsert.py imported Iterable from typing. Pyupgrade rule says use collections.abc.Iterable. - I001: after the swap, the import block became un-sorted. Both fixed; ruff check is now clean. Tests stay at 276/276.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move backup root + trash file under
~/.config/loseit/so they sit next toconfig.yamland the auth token. Previously they followed XDG strictly (backup + trash in~/.local/share/loseit/, config in~/.config/loseit/), which split ~3 files across two top-level directories for no real benefit on a single-user workstation.New defaults
Override mechanisms (in addition to existing CLI flags)
LOSEIT_BACKUP_ROOT--rootLOSEIT_TRASH_FILE--trash-fileTyper's
envvar=mechanism makes--helpself-documenting:Verification
Smoke-tested all four paths:
Full unit suite: 276/276 green (4 tests had hard-coded
~/.local/share/loseit/path expectations; updated to match).What this does NOT do
~/.local/share/loseit/backup/stay where they are. Users can:loseit backupagainst the new default (resume-safe, just refetches the missing year-dirs); ormv ~/.local/share/loseit/backup ~/.config/loseit/backupto keep the existing archive.~/.local/share/loseit/trash.jsonlis also left in place. Users who want to keep the old trash history:mv ~/.local/share/loseit/trash.jsonl ~/.config/loseit/trash.jsonl.Test plan
--helptext mentions the new env vars.loseit backup --dry-runand confirms the printedroot:is under~/.config/loseit/backup.