Step 2: Add manifest package with YAML data model and persistence.

Implements Manifest and Entry structs with YAML tags, New() constructor,
Load(path) for reading, and Save(path) with atomic write (temp file +
rename). Tests cover round-trip serialization, atomic save cleanup,
entry type invariants, nonexistent file error, and empty manifest.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 21:24:56 -07:00
parent 6cadda01a8
commit 7a3d78d741
4 changed files with 328 additions and 6 deletions

View File

@@ -18,13 +18,13 @@ Remove old C++ source files and set up the Go project.
*Can be done in parallel with Step 3.*
- [ ] `manifest/manifest.go`: `Manifest` and `Entry` structs with YAML tags
- [x] `manifest/manifest.go`: `Manifest` and `Entry` structs with YAML tags
- Entry types: `file`, `directory`, `link`
- Mode as string type to avoid YAML octal coercion
- Per-file `updated` timestamp
- [ ] `manifest/manifest.go`: `Load(path)` and `Save(path)` functions
- [x] `manifest/manifest.go`: `Load(path)` and `Save(path)` functions
- Save uses atomic write (write to `.tmp`, rename)
- [ ] `manifest/manifest_test.go`: round-trip marshal/unmarshal, atomic save, entry type validation
- [x] `manifest/manifest_test.go`: round-trip marshal/unmarshal, atomic save, entry type validation
## Step 3: Store Package