Skip to content

fix: consolidate all config/data paths to ~/.codecora/cora-code/ - #512

Merged
ajianaz merged 1 commit into
developfrom
fix/consolidate-paths-511
Aug 6, 2026
Merged

fix: consolidate all config/data paths to ~/.codecora/cora-code/#512
ajianaz merged 1 commit into
developfrom
fix/consolidate-paths-511

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

What

Unify all scattered config/data paths into a single directory: ~/.codecora/cora-code/

Before (3+ locations):

~/.cora/                          ← config.yaml, auth.toml
~/.cache/cora/reviews/            ← review cache
~/.codecora/cora-code/            ← graph DB, update cache (already correct)

After (single location):

~/.codecora/cora-code/
├── config.yaml                   ← (was ~/.cora/config.yaml)
├── auth.toml                     ← (was ~/.cora/auth.toml)
├── cora.db                       ← (already here)
├── update-cache.json             ← (already here)
└── cache/
    └── reviews/                  ← (was ~/.cache/cora/reviews/)

Why

Issue #511: Data scattered across 3+ locations is confusing for users, complicates backups, and fragments the directory structure. The ~/.codecora/cora-code/ path already existed for graph DB + update cache — this PR makes it the single home for ALL cora-code data.

How

  1. cora_dir() in loader.rs: now returns data_dir::cora_data_dir() instead of ~/.cora/
  2. cache_dir() in cache.rs: now returns cora_data_dir().join("cache/reviews") instead of ~/.cache/cora/reviews/
  3. Auto-migration: On first call to each function, checks for legacy paths and migrates:
    • config.yaml, auth.toml, config.tomlcopied (not moved — user can safely delete old files)
    • Cache .json files → moved (rename, since cache is ephemeral)
    • Old .migrated marker also copied to prevent TOML→YAML re-migration
  4. Idempotent: .migrated-to-codecora marker file prevents re-running
  5. Safe: migration failures are logged but do not crash the app

Testing

  • cargo build — clean
  • cargo test — 22/22 pass (16 unit + 6 config)
  • cargo clippy — 0 warnings
  • cargo fmt --check — clean
  • Pre-commit cora review — passed

Related Issues

Fixes #511

Checklist

  • Code follows project style (cargo fmt)
  • No clippy warnings
  • All tests pass
  • Self-reviewed
  • Migration is backward compatible (old files preserved)
  • Migration is idempotent (marker file)

- cora_dir() now returns ~/.codecora/cora-code/ (was ~/.cora/)
- cache_dir() now returns ~/.codecora/cora-code/cache/reviews/ (was ~/.cache/cora/reviews/)
- Auto-migration from legacy paths on first run (config.yaml, auth.toml, cache files)
- Migration is idempotent (.migrated-to-codecora marker)
- Old files preserved (copy, not move) for user safety
- Updated all user-facing strings and doc comments
@ajianaz
ajianaz merged commit 6398f84 into develop Aug 6, 2026
13 checks passed
@ajianaz
ajianaz deleted the fix/consolidate-paths-511 branch August 6, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

consolidate: unify all config/data paths to ~/.codecora/cora-code/

1 participant