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/src/__snapshots__/e2e.test.ts.snap
T
xiaoju ca4fe8c3ac feat: P3 JSON Schema support — not, contains, propertyNames, metadata (#82)
Add 8 new schema keywords:

Combinators (with collectRefs support):
- not: negation schema
- contains: array must contain matching item

Constraints:
- propertyNames: constrain object key names

Metadata (no collectRefs impact):
- examples, readOnly, writeOnly, deprecated, $comment

Total supported keywords: 40 (of ~45 commonly used).
Only $ref/$defs/$id/$schema remain unsupported (P4, deferred).

516 tests, 0 fail.

Closes #82
2026-06-01 02:31:59 +00:00

290 lines
8.4 KiB
Plaintext

// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
exports[`Phase 1: CAS Core 1.6 get returns node JSON (snapshot) 1`] = `
{
"type": "CE40D09H75NFZ",
"value": {
"payload": {
"age": 30,
"name": "Alice",
},
"type": "8WAZV39SD724T",
},
}
`;
exports[`Phase 1: CAS Core 1.9 verify returns ok for valid node 1`] = `
{
"type": "BZ31JDDWX2AWH",
"value": "ok",
}
`;
exports[`Phase 1: CAS Core 1.10 refs lists direct references (snapshot) 1`] = `
"{
"type": "DG8SAB75PV9P7",
"value": []
}"
`;
exports[`Phase 1: CAS Core 1.11 walk shows traversal tree (snapshot) 1`] = `
"{
"type": "EVHG7Q7FK83H0",
"value": [
"6KZ930XYK2MHB"
]
}"
`;
exports[`Phase 2: Schema Validation 2.3 put against non-existent schema hash fails 1`] = `"Schema not found: AAAAAAAAAAAAA"`;
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"`;
exports[`Phase 5: Render 5.1 render fills payload variables 1`] = `"Hello Alice!"`;
exports[`Phase 5: Render 5.2 render --resolution with different value 1`] = `"Hello Alice!"`;
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)
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)"
`;