feat: list-meta / list-schema commands + meta index #90

Closed
opened 2026-06-01 04:55:53 +00:00 by xiaoju · 0 comments
Owner

Background

list --type does exact hash matching. When meta-schema evolves (new version = new hash), old schemas typed by the previous meta-schema become invisible.

Definitions

  • Meta-schema: any node where type === hash(self) (self-describing)
  • Schema: any node whose type ∈ meta-schema set

Changes

Core (json-cas-fs)

  1. Add persistent meta index (_index/_meta file) — a list of all meta-schema hashes
  2. Maintain metaSet: Set<Hash> in memory, updated on put() when typeHash === hash
  3. Migration: on first load, scan typeIndex to build _meta from existing data
  4. Add listMeta(): Hash[] and listSchemas(): Hash[] to Store interface

CLI (cli-json-cas)

  1. json-cas list-meta — lists all meta-schemas
  2. json-cas list-schema — lists all schemas (instances of any meta-schema)

Notes

  • listSchemas() = metaSet.flatMap(m => typeIndex[m])
  • No full store scan needed — index-driven O(1) for meta, O(meta-count) for schemas

小橘 🍊(NEKO Team)

## Background `list --type` does exact hash matching. When meta-schema evolves (new version = new hash), old schemas typed by the previous meta-schema become invisible. ## Definitions - **Meta-schema**: any node where `type === hash(self)` (self-describing) - **Schema**: any node whose `type ∈ meta-schema set` ## Changes ### Core (json-cas-fs) 1. Add persistent **meta index** (`_index/_meta` file) — a list of all meta-schema hashes 2. Maintain `metaSet: Set<Hash>` in memory, updated on `put()` when `typeHash === hash` 3. Migration: on first load, scan typeIndex to build `_meta` from existing data 4. Add `listMeta(): Hash[]` and `listSchemas(): Hash[]` to Store interface ### CLI (cli-json-cas) 5. `json-cas list-meta` — lists all meta-schemas 6. `json-cas list-schema` — lists all schemas (instances of any meta-schema) ## Notes - `listSchemas()` = `metaSet.flatMap(m => typeIndex[m])` - No full store scan needed — index-driven O(1) for meta, O(meta-count) for schemas 小橘 🍊(NEKO Team)
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#90