13 Commits

Author SHA1 Message Date
xiaoju 72f85c9077 feat: implement LiquidJS template rendering integration
Integrates LiquidJS as the template engine for CAS node rendering with
custom {% render %} tag supporting recursive rendering with resolution
decay. Templates are discovered via variables under
@ucas/template/text/<type-hash>. When ucas render <hash> is invoked,
the system queries for a registered template; if found, uses LiquidJS;
otherwise falls back to Phase 3's default YAML renderer.

Key features:
- Custom {% render %} tag with recursive CAS node rendering
- Decay priority chain: template decay > CLI --decay > default 0.5
- Context variables: resolution, epsilon, hash, payload, type, timestamp
- Graceful fallback: No template → YAML rendering (Phase 3)
- Zero breaking changes: All Phase 3 tests still pass
- Template discovery via @ucas/template/text/<type-hash> variables

Implementation:
- New file: packages/json-cas/src/liquid-render.ts — LiquidJS integration
- Modified: packages/json-cas/src/render.ts — Template lookup + YAML fallback
- New file: packages/json-cas/src/liquid-render.test.ts — 32 comprehensive tests
- Dependency: liquidjs npm package
- CLI: No changes needed (transparent integration)

All tests pass (336 tests), build succeeds, lint checks pass.

Closes #40

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-31 06:05:44 +00:00
xiaoju cf716c5115 feat: implement RFC-20 Phase 1 variable CRUD operations
Add a complete variable system for json-cas that provides mutable named
bindings to immutable CAS nodes.

Features:
- ULID-based variable identifiers (26-char Crockford Base32)
- Hierarchical scope validation (must end with /)
- Schema validation on update (prevents type mismatches)
- SQLite persistence (~/.uncaged/json-cas/variables.db)
- CLI commands: var create, get, update, delete

Implementation:
- Core types in variable.ts (Variable, VariableId)
- VariableStore class with SQLite backend
- Custom error types (VariableNotFoundError, SchemaMismatchError, etc.)
- Comprehensive unit tests (16 tests)
- CLI integration tests (12 tests)
- All outputs use JSON format

Test coverage:
- Variable creation with scope validation
- CRUD operations (create, read, update, delete)
- Schema consistency enforcement
- Error handling for all edge cases
- Full lifecycle integration tests

All tests pass (158 total), build clean, lint clean.

Fixes #21

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-30 05:57:05 +00:00
xiaoju 98dc91e848 Revert "chore: normalize to bun monorepo conventions"
This reverts commit 064c9afa1e.
2026-05-29 04:45:50 +00:00
xiaoju 064c9afa1e chore: normalize to bun monorepo conventions
CI / check (push) Failing after 43s
Applied monorepo normalization:
- Updated TypeScript to use composite project references with NodeNext
- Configured Biome for linting and formatting
- Standardized package.json metadata across all packages
- Set up changesets for version management and npm publishing
- Added vitest test infrastructure to all packages
- Created Gitea Actions CI pipeline
- Added solve-issue workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-29 04:39:36 +00:00
xiaoju 1ea058a7a6 chore: update lockfile after package cleanup
Remove references to deleted json-cas-workflow package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-29 01:55:12 +00:00
xiaomo 0706307e85 fix: align all packages to 0.5.0 and restore workspace:^ deps
- All @uncaged/* packages → 0.5.0 (fixed versioning per changesets config)
- Restore workspace:^ for internal deps (was broken to ^0.3.0/^0.4.0)
- Regenerate bun.lock (removes duplicate npm registry entries)
2026-05-25 04:05:17 +00:00
xiaoju 054d78296a feat!: self-validating meta-schema for putSchema
Replace bootstrap payload with a JSON Schema meta-schema describing
our supported schema subset. putSchema now validates input schemas
against the meta-schema before storing, rejecting invalid schemas
with SchemaValidationError.

- bootstrap.ts: self-describing meta-schema (type, properties, required,
  additionalProperties, anyOf, items, format, title, enum, const, description)
- schema.ts: recursive isValidSchema(), SchemaValidationError class
- index.ts: export SchemaValidationError
- package.json: bump 0.4.0 → 1.0.0 (breaking change)

BREAKING CHANGE: meta-schema hash changed, old CAS data invalid.

Fixes #15
2026-05-25 03:51:43 +00:00
xiaoju 55b4a0a219 chore: add changesets, set version 0.1.0
小橘 <xiaoju@shazhou.work>
2026-05-18 02:48:58 +00:00
xiaoju 5d2af0e08a feat: workflow schema registration (@uncaged/json-cas-workflow)
- 11 JSON Schemas: agent, role-schema, role, workflow, thread-start,
  thread-step, thread-end, content, react-session, react-turn, react-tool-call
- registerWorkflowSchemas(store) → type hash map
- TypeScript types for all schema payloads
- Fixed core: AJV cas_ref format, collectRefs for anyOf/items/additionalProperties
- 43 new tests (107 total), biome clean

Closes uncaged/json-cas#7
小橘 <xiaoju@shazhou.work>
2026-05-18 02:10:19 +00:00
xiaoju 1ff719bf8b feat: Phase 4 — CLI (@uncaged/cli-json-cas)
- Full CLI: init, bootstrap, schema (put/get/list/validate),
  put, get, has, verify, list, refs, walk, hash, cat
- --store flag, --json compact output, --format tree
- biome override: noConsole off for CLI package
- 64 tests passing

Closes #6
小橘 <xiaoju@shazhou.work>
2026-05-17 09:37:27 +00:00
xiaoju 49b1d5d665 feat: Phase 3 — filesystem backend (@uncaged/json-cas-fs)
- createFsStore(dir) implementing Store interface
- CBOR binary blob storage with atomic writes (tmp+rename)
- Auto-create directory, idempotent put
- 15 new tests (64 total), biome clean

Closes #5
小橘 <xiaoju@shazhou.work>
2026-05-17 09:31:04 +00:00
xiaoju 913419981c feat: Phase 2 — schema system (JSON Schema + cas_ref + traversal)
- putSchema/getSchema for storing JSON Schemas as CAS nodes
- validate() with AJV for payload validation against schema
- refs() extracts cas_ref fields from schema for DAG edges
- walk() BFS traversal with cycle detection
- Bootstrap meta-schema self-reference verified
- 49 tests passing, biome clean

Closes #4
小橘 <xiaoju@shazhou.work>
2026-05-17 09:27:46 +00:00
xiaoju 9aac38238a feat: Phase 1 — core primitives (hash + CBOR + memory store)
- CBOR deterministic encoding (cborg, RFC 8949 §4.2)
- XXH64 → 13-char Crockford Base32 hashing
- createMemoryStore() with idempotent put
- verify() integrity check
- bootstrap() self-referencing meta-schema seed
- 23 tests passing, biome clean

Closes #3
小橘 <xiaoju@shazhou.work>
2026-05-17 09:23:05 +00:00