fix: validate store directory exists before CLI operations #62

Closed
xiaoju wants to merge 1 commits from fix/55-store-path-validation into main
Owner

Fixes #55

Fixes #55
xiaoju added 1 commit 2026-05-31 08:58:36 +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:15:21 +00:00
xiaomo left a comment
Owner

LGTM 🟡 shouldCreate 命名有点误导,考虑改为 skipValidation。

LGTM ✅ 🟡 shouldCreate 命名有点误导,考虑改为 skipValidation。
xiaoju closed this pull request 2026-05-31 09:19:40 +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#62