Feature 23/project relative paths #79

Merged
noe.trevino merged 21 commits from feature-23/project-relative-paths into nightly 2026-05-01 00:33:32 -05:00
Owner

Checklist

  • Read CONTRIBUTING.md
  • Ran tests (./scripts/test) locally
  • Formatted with Stylua
  • Added tests if necessary
  • Updated documentation(inline to source code) if applicable
  • Updated README.md if applicable

Summary

Breaking change!

Project-relative paths and cross-project safety (#23, #75)

  • New haunt.project module owns root + branch + project ID detection. Project ID falls back through: git root commit hash → repo top-level path → cwd. Storage filename is sha256(project_id | branch) so forks/clones of the same project resolve to the same file across machines.
  • New v2 storage format: paths are stored relative to project root. Files outside the project (e.g. ~/.config/nvim/init.lua while you're in another repo) are flagged absolute=true and pass through unchanged.
  • v1 → v2 auto-migration on plugin entry. The legacy file is renamed to <old>.v1.bak (never deleted, might wanna do that yourself). :HauntMigrate is exposed for explicit re-runs, incase things go wrong.
  • The store now stamps the project_id, project_root, and storage_path it loaded from. Saves always write to the stamped path, so a :cd mid-session no longer redirects writes into a different project's file (root cause of the duplicate-JSON-files in #75).
  • tests/cross_project_spec.lua covers the project-crossing scenarios; tests/migration_spec.lua covers v1 → v2 round-trips.

Extmark Line Sync

  • No more async writes, only write on VimPreLeave.
  • Before saving, we sync up with the ext marks

Issues

Closes: #23
Closes: #72

AI Disclosure

Tests were written by AI, code was reviewed by it before pushing

## Checklist - [x] Read `CONTRIBUTING.md` - [x] Ran tests (`./scripts/test`) locally - [x] Formatted with Stylua - [x] Added tests if necessary - [x] Updated documentation(inline to source code) if applicable - [x] Updated `README.md` if applicable ## Summary <!-- What does this PR change and/or fix? --> <strong>Breaking change!</strong> ### Project-relative paths and cross-project safety (#23, #75) - New `haunt.project` module owns root + branch + project ID detection. Project ID falls back through: git root commit hash → repo top-level path → cwd. Storage filename is `sha256(project_id | branch)` so forks/clones of the same project resolve to the same file across machines. - New v2 storage format: paths are stored relative to project root. Files outside the project (e.g. `~/.config/nvim/init.lua` while you're in another repo) are flagged `absolute=true` and pass through unchanged. - v1 → v2 auto-migration on plugin entry. The legacy file is renamed to `<old>.v1.bak` (never deleted, might wanna do that yourself). `:HauntMigrate` is exposed for explicit re-runs, incase things go wrong. - The store now stamps the `project_id`, `project_root`, and `storage_path` it loaded from. Saves always write to the stamped path, so a `:cd` mid-session no longer redirects writes into a different project's file (root cause of the duplicate-JSON-files in #75). - `tests/cross_project_spec.lua` covers the project-crossing scenarios; `tests/migration_spec.lua` covers v1 → v2 round-trips. ### Extmark Line Sync - No more async writes, only write on `VimPreLeave`. - Before saving, we sync up with the ext marks ## Issues Closes: #23 Closes: #72 #### AI Disclosure Tests were written by AI, code was reviewed by it before pushing
Sign in to join this conversation.
No description provided.