Changes:
1. openStore() now async, auto-creates directory and bootstraps
2. Removed shouldCreate parameter and validateStoreExists()
3. All openStore() calls now awaited
4. Deleted init and bootstrap commands
5. Removed Issue #55 store validation tests (superseded by auto-bootstrap)
6. Enhanced error handling in openStore() for permission/path issues
7. Updated e2e snapshots after fixing missed await in cmdRender
Bootstrap is idempotent. Core tests using createMemoryStore() unaffected.
Fixes#73
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Strip volatile fields (timestamp, created, updated) from JSON before
snapshotting using a stripVolatile helper
- Remove toMatchSnapshot() from test 2.1 to avoid embedding machine-
specific tmp paths in the snapshot; use toContain assertions instead
- Replace GC count snapshot with structural shape assertions so counts
don't need to match exact phase-history state
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Convert 46 e2e-check workflow scenarios to fast bun test snapshot tests.
7 describe phases share a single mkdtempSync store; hashes are deterministic
so cross-phase data dependencies work without re-creating data.
Closes#66
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
- 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>
ajv strict mode requires explicit type: object when properties/required
are used. All three workflow YAMLs had this missing, causing frontmatter
validation to fail with:
strict mode: missing type "object" for keyword "required"
Also added frontmatter output example in e2e-check.yaml procedure to
prevent agents from outputting bugs as plain strings instead of objects.
Applied tester feedback to fix 5 test failures:
1. Updated error message format from "Node not found" to "CAS node not found"
for consistency with existing tests in variable-store.test.ts and var.test.ts
2. Fixed CLI tests R9 and R10 to use bootstrap() directly instead of
non-existent "types" command. Added imports for bootstrap and createFsStore.
3. Fixed render test 6.5 to pass actual schema Hash instead of entire
bootstrap object (Record<string, Hash>)
4. Updated test expectations in render.test.ts (tests 1.5, 10.1, 10.2) to
match new error message format
All 390 tests now pass. Core functionality verified:
- Missing root hash detection working correctly
- CLI exits with code 1 on missing hash
- Error message includes hash: "CAS node not found: <hash>"
- Nested nodes still render as cas: references (preserved behavior)
- Resolution decay behavior preserved
Fixes#53
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add schema validation to the `json-cas put` command to ensure data
integrity. The CLI now validates the payload against the specified
schema before storing, and exits with a non-zero code and descriptive
error message if validation fails.
Changes:
- Add schema existence check in cmdPut()
- Add payload validation before storing
- Exit with error code 1 on validation failure
- Provide helpful error messages indicating the file and schema
- Add comprehensive test suite with 16 test scenarios covering:
- Valid data (regression tests)
- Type mismatches (new validation)
- Schema errors (edge cases)
- Integration with existing features
- Error message quality
The hash command continues to work without validation (dry-run
consistency), and schema put continues to use its own validation.
Fixes#50
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When rendering a non-existent hash, the CLI now exits with code 1 and
displays an error message instead of silently outputting "cas:<hash>"
with exit code 0.
Changes:
- Updated CasNodeNotFoundError constructor signature to store hash
- Added root hash existence check in render() and renderAsync()
- Updated CLI error handling to catch CasNodeNotFoundError
- Added comprehensive test suite for missing hash error handling
- Updated existing incorrect tests (R2 and test 1.5)
The fix distinguishes between:
- Root hash (user-requested): Must exist or throw error
- Nested hash (during traversal): Renders as cas: reference (existing behavior)
- Resolution below epsilon: Renders as cas: reference (existing behavior)
Fixes#53
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes#54
The `json-cas schema put` command now catches SchemaValidationError
and displays a clean error message instead of showing a raw stack trace.
Changes:
- Import SchemaValidationError from @uncaged/json-cas
- Wrap putSchema() call in try-catch in cmdSchemaPut
- Catch SchemaValidationError specifically and call die(e.message)
- Add 5 comprehensive tests for invalid schema error handling
Test cases:
1. Invalid JSON Schema type value
2. Unknown schema keys
3. Invalid nested schema
4. Non-object root schema
5. Valid schema regression test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
In-memory rendering of { type, value } envelopes without store writes.
Store is optional and read-only (for expanding nested cas_ref references).
CLI: ucas render --pipe/-p reads JSON from stdin.
Core: renderDirect(typeHash, value, store?, options?) for programmatic use.
Fixes#48
1. Deduplicate RenderOptions type
- Remove duplicate definition from liquid-render.ts
- Import from render.ts instead (canonical location)
2. Remove unused _globalDecay parameter
- Remove from renderNode function signature
- Update all call sites
3. Fix test numbering gaps
- Suite 4: Renumber 4.4→4.2, 4.5→4.3
- Suite 7→6: Renumber 7.1→6.1, 7.2→6.2, 7.4→6.3
- Suite 8→7: Renumber all 8.x→7.x tests
- Suite 10→8: Renumber 10.1→8.1
- Result: consecutive suite numbering (1-8)
4. CLI test status: All 95 tests pass (no pre-existing failures found)
Fixes#46
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integrates LiquidJS template rendering into the CLI render command.
When a template is registered for a node's schema type via the variable
system (@ucas/template/text/<schema-hash>), the CLI will use the template
for rendering. Otherwise, it falls back to YAML output.
Changes:
- Modified cmdRender in index.ts to use renderAsync with variable store
- Added Suite 6: CLI Integration with Templates (5 comprehensive tests)
- Fixed template file format: templates must be JSON-encoded strings
- Removed unused render import from index.ts
- Renamed unused globalDecay parameter in liquid-render.ts
Test coverage increased from 336 to 341 tests, all passing.
Fixes#40
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes reviewer feedback:
1. Fixed TypeScript strict mode error where ctx.engine was possibly null
- Refactored to pass store/varStore/globalDecay directly to createLiquidEngine
- Eliminated RenderContext type that caused circular dependency
- Engine is now properly typed as Liquid (non-nullable)
2. Removed dynamic imports from production code
- Changed render.ts to use static import of renderWithTemplate
- Changed hasTemplate to use static import of putSchema
- Complies with CLAUDE.md convention against dynamic imports
All tests pass (336 tests), build succeeds with no TypeScript errors,
lint checks pass with only 1 minor warning about unused parameter
(which is actually used in recursive calls).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement ucas template subcommands for managing template storage:
- template set <schema-hash> <file> | --inline <text>: Store template text in CAS
- template get <schema-hash>: Retrieve template as raw text
- template list: List all templates with preview
- template delete <schema-hash>: Delete template variable binding
Templates are stored as plain text under @string schema and bound to
variables using the naming pattern @ucas/template/text/<schema-hash>.
Fixes#38
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>