This repository has been archived on 2026-06-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
json-cas/packages/cli-json-cas/tests/__snapshots__/edge-cases.test.ts.snap
T
xiaoju 55144d0e4a feat: add list-meta and list-schema commands with persistent meta index
Adds Store.listMeta() and Store.listSchemas() to expose meta-schema
discovery, backed by an in-memory metaSet (memory store) and a
persistent _index/_meta file (FS store). Surfaces both via new
json-cas list-meta and list-schema CLI commands wrapped in
@output/list-meta and @output/list-schema envelope schemas.

The FS store migrates from existing nodes when _meta is absent
(scanning self-referencing nodes) and preserves _meta on subsequent
opens. delete() removes affected hashes from the meta index and
persists the change.

Closes #90

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-01 05:10:25 +00:00

250 lines
7.7 KiB
Plaintext

// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
exports[`Phase 7: Edge Cases 7.1 get non-existent hash errors gracefully 1`] = `"Node not found: AAAAAAAAAAAAA"`;
exports[`Phase 7: Edge Cases 7.3 var set empty name errors 1`] = `"Usage: json-cas var set <name> <hash> [--tag <tag>...]"`;
exports[`Phase 7: Edge Cases 7.4 var set name with invalid chars errors 1`] = `"Error: Invalid variable name "invalid name!": Segment "invalid name!" contains invalid characters (only @, a-z, A-Z, 0-9, ., _, - allowed)"`;
exports[`Phase 7: Edge Cases 7.5 no subcommand shows help text 1`] = `
"Usage: json-cas [--store <path>] [--json] <command> [args]
All JSON commands emit a { type, value } envelope. The type is the hash of the
command's @output/* schema (shown in parentheses); pipe any envelope into
\`render -p\` to render its value (cas_ref hashes are expanded).
Commands:
put <type-hash> <file.json|--pipe> Store node, print envelope (value=hash) (@output/put)
get <hash> Print node as envelope (@output/get)
has <hash> Print envelope (value=boolean) (@output/has)
verify <hash> Verify integrity + schema (value=ok/corrupted/invalid) (@output/verify)
refs <hash> List direct cas_ref edges (@output/refs)
walk <hash> [--format tree] Recursive traversal (@output/walk)
hash <type-hash> <file.json|--pipe> Compute hash without storing (@output/hash)
render <hash> [options] Render node as text with resolution decay (raw output)
render --pipe/-p [options] Render { type, value } from stdin (raw output)
list --type <hash-or-alias> List hashes for a type (value=string[]) (@output/list)
list-meta List meta-schema hashes (value=string[]) (@output/list-meta)
list-schema List all schema hashes (value=string[]) (@output/list-schema)
var set <name> <hash> [--tag <tag>...] Create/update a variable (@output/var-set)
var get <name> --schema <hash> Get a variable by name + schema (@output/var-get)
var delete <name> [--schema <hash>] Delete variable(s) (@output/var-delete)
var list [prefix] [--schema <hash>] [--tag <tag>...] List variables (@output/var-list)
var tag <name> --schema <hash> <operations...> Modify tags/labels (@output/var-tag)
template set <schema-hash> <file> | --inline <text> Set template for schema (@output/template-set)
template get <schema-hash> Get template content (value=string) (@output/template-get)
template list List all templates (@output/template-list)
template delete <schema-hash> Delete template for schema (@output/template-delete)
gc Run garbage collection (@output/gc)
Flags:
--store <path> Store directory (default: ~/.uncaged/json-cas)
--var-db <path> Variable database path (default: <store>/variables.db)
--json Compact JSON output
--schema <hash> Schema hash filter for var get/delete/tag/list
--tag <tag> Tag/label (can be repeated): key:value (tag), name (label), :name (delete)
--inline <text> Inline text content for template set
--resolution <n> Initial resolution for render (default: 1.0)
--decay <n> Decay factor for render (default: 0.5)
--epsilon <n> Cutoff threshold for render (default: 0.01)
--pipe, -p Read from stdin (put/hash: raw JSON payload; render: { type, value } envelope)"
`;
exports[`Phase 3: Variable System 3.1 var set creates variable 1`] = `
{
"type": "5KVHSESSX7N96",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {},
"value": "6KZ930XYK2MHB",
},
}
`;
exports[`Phase 3: Variable System 3.2 var get returns variable 1`] = `
{
"type": "7D4R2MJ1EYF08",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {},
"value": "6KZ930XYK2MHB",
},
}
`;
exports[`Phase 3: Variable System 3.3 var list shows all variables 1`] = `
{
"type": "E8158M25YNR9M",
"value": [
{
"labels": [],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {},
"value": "6KZ930XYK2MHB",
},
],
}
`;
exports[`Phase 3: Variable System 3.4 var list prefix filters by prefix 1`] = `
{
"type": "E8158M25YNR9M",
"value": [
{
"labels": [],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {},
"value": "6KZ930XYK2MHB",
},
],
}
`;
exports[`Phase 3: Variable System 3.5 var set upsert updates existing variable 1`] = `
{
"type": "5KVHSESSX7N96",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {},
"value": "AE80669JYG4K2",
},
}
`;
exports[`Phase 3: Variable System 3.6 var tag adds kv tag and label 1`] = `
{
"type": "2WX4XRYSACRWR",
"value": {
"labels": [
"important",
],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {
"env": "prod",
},
"value": "6KZ930XYK2MHB",
},
}
`;
exports[`Phase 3: Variable System 3.7 var list --tag env:prod filters by kv tag 1`] = `
{
"type": "E8158M25YNR9M",
"value": [
{
"labels": [
"important",
],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {
"env": "prod",
},
"value": "6KZ930XYK2MHB",
},
],
}
`;
exports[`Phase 3: Variable System 3.8 var list --tag important filters by label 1`] = `
{
"type": "E8158M25YNR9M",
"value": [
{
"labels": [
"important",
],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {
"env": "prod",
},
"value": "6KZ930XYK2MHB",
},
],
}
`;
exports[`Phase 3: Variable System 3.9 var tag remove deletes label 1`] = `
{
"type": "2WX4XRYSACRWR",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {
"env": "prod",
},
"value": "6KZ930XYK2MHB",
},
}
`;
exports[`Phase 3: Variable System 3.10 var delete removes variable 1`] = `
{
"type": "F89626QEK09YY",
"value": [
{
"labels": [],
"name": "myapp/config",
"schema": "8WAZV39SD724T",
"tags": {
"env": "prod",
},
"value": "6KZ930XYK2MHB",
},
],
}
`;
exports[`Phase 3: Variable System 3.11 var get deleted variable returns not found 1`] = `"Error: Variable not found: name=myapp/config, schema=8WAZV39SD724T"`;
exports[`Phase 4: Template System 4.1 template set registers template 1`] = `
{
"type": "A8RGY9B1JSCDJ",
"value": {
"contentHash": "0359SHMP7VBFD",
"schemaHash": "8WAZV39SD724T",
},
}
`;
exports[`Phase 4: Template System 4.2 template get returns template text 1`] = `
{
"type": "64FP3TWKK69YH",
"value": "Name: {{ payload.name }}, Age: {{ payload.age }}",
}
`;
exports[`Phase 4: Template System 4.3 template list shows registered templates 1`] = `
{
"type": "BE20H482GBNM3",
"value": [
{
"contentHash": "0359SHMP7VBFD",
"schemaHash": "8WAZV39SD724T",
},
],
}
`;
exports[`Phase 4: Template System 4.4 template delete removes template 1`] = `
{
"type": "0FXB2GS8Y9R1R",
"value": {
"deleted": true,
},
}
`;
exports[`Phase 4: Template System 4.5 template get deleted template returns not found 1`] = `"Error: Template not found for schema: 8WAZV39SD724T"`;