Step 21: Lock/unlock toggle commands.

garden/lock.go: Lock() and Unlock() toggle the locked flag on
existing tracked entries. Errors on untracked paths. Persists
to manifest.

cmd/sgard/lock.go: sgard lock <path>..., sgard unlock <path>...

6 tests: lock/unlock existing entry, persistence, error on untracked,
checkpoint behavior changes after lock, status changes between
drifted and modified after unlock.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 11:07:40 -07:00
parent 0cf81ab6a1
commit d2bba75365
5 changed files with 293 additions and 6 deletions

View File

@@ -226,10 +226,9 @@ Depends on Steps 17, 18.
### Step 21: Lock/Unlock Toggle Commands
- [ ] `garden/garden.go`: `Lock(paths []string) error` — set `locked: true` on existing entries
- [ ] `garden/garden.go`: `Unlock(paths []string) error` — set `locked: false` on existing entries
- [ ] `cmd/sgard/lock.go`: `sgard lock <path>...`, `sgard unlock <path>...`
- [ ] Tests: lock existing entry, unlock it, verify behavior changes
- [x] `garden/lock.go`: `Lock(paths)`, `Unlock(paths)` — toggle locked flag on existing entries
- [x] `cmd/sgard/lock.go`: `sgard lock <path>...`, `sgard unlock <path>...`
- [x] Tests: lock/unlock existing entry, persist, error on untracked, checkpoint/status behavior changes (6 tests)
### Step 22: Shell Completion