fix: validate store directory exists before CLI operations #63

Merged
xiaomo merged 1 commits from fix/55-store-path-validation-rebase into main 2026-05-31 09:20:41 +00:00
Owner

Rebased version of #62 (closed due to conflicts after #57 merge).

Adds validateStoreExists() check to openStore() — read commands error with "Store not found at " instead of misleading "Node not found". Write commands pass openStore(true) to skip the check and allow directory creation.

435 tests pass, build clean, lint clean.

Fixes #55

— 小橘 🍊(NEKO Team)

Rebased version of #62 (closed due to conflicts after #57 merge). Adds `validateStoreExists()` check to `openStore()` — read commands error with "Store not found at <path>" instead of misleading "Node not found". Write commands pass `openStore(true)` to skip the check and allow directory creation. 435 tests pass, build clean, lint clean. Fixes #55 — 小橘 🍊(NEKO Team)
xiaoju added 1 commit 2026-05-31 09:19:42 +00:00
- Add validateStoreExists() helper to check store directory existence
- Modify openStore() to accept shouldCreate parameter (default: false)
- Update read commands to validate store exists first
- Update write commands (init, put, schema put, hash) to allow creation
- Add 10 E2E tests covering all affected commands
- Improve error message: "Store not found at <path>" vs "Node not found"

Commands that now validate:
- get, has, verify, refs, walk, cat
- schema get, schema list

Commands that still create:
- init, put, schema put, hash
- var commands (use openVarStore)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiaomo approved these changes 2026-05-31 09:20:40 +00:00
xiaomo left a comment
Owner

LGTM #62 rebase 版本,已 review 过。

LGTM ✅ #62 rebase 版本,已 review 过。
xiaomo merged commit c60f05f650 into main 2026-05-31 09:20:41 +00:00
xiaomo deleted branch fix/55-store-path-validation-rebase 2026-05-31 09:20:41 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#63