Files
ocas/packages/cli/tests/__snapshots__/edge-cases.test.ts.snap
T
xiaoju 1edb09a8b0 feat: rebrand json-cas → OCAS (Object Content Addressable Store)
- Rename packages: @uncaged/json-cas → @ocas/core, @uncaged/json-cas-fs → @ocas/fs, @uncaged/cli-json-cas → @ocas/cli
- Rename dirs: packages/json-cas → core, json-cas-fs → fs, cli-json-cas → cli
- CLI binary: ocas (removed json-cas and ucas aliases)
- Default store: ~/.ocas (was ~/.uncaged/json-cas)
- Update all imports, tsconfig, biome, docs, tests, snapshots
- Changeset config targets @ocas org and shazhou-ww/ocas GitHub

Closes #3, Closes #4, Closes #5, Closes #6, Closes #7
2026-06-01 06:21:56 +00:00

250 lines
7.6 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: ocas 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: ocas [--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: ~/.ocas)
--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": "50CG6QYD1FY8J",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {},
"value": "9W3MGR3184QYE",
},
}
`;
exports[`Phase 3: Variable System 3.2 var get returns variable 1`] = `
{
"type": "DSXYC9DNCYAK0",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {},
"value": "9W3MGR3184QYE",
},
}
`;
exports[`Phase 3: Variable System 3.3 var list shows all variables 1`] = `
{
"type": "8F5ENFRC57Y7H",
"value": [
{
"labels": [],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {},
"value": "9W3MGR3184QYE",
},
],
}
`;
exports[`Phase 3: Variable System 3.4 var list prefix filters by prefix 1`] = `
{
"type": "8F5ENFRC57Y7H",
"value": [
{
"labels": [],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {},
"value": "9W3MGR3184QYE",
},
],
}
`;
exports[`Phase 3: Variable System 3.5 var set upsert updates existing variable 1`] = `
{
"type": "50CG6QYD1FY8J",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {},
"value": "A6QPKJAFR68NP",
},
}
`;
exports[`Phase 3: Variable System 3.6 var tag adds kv tag and label 1`] = `
{
"type": "6D1HG60NTZY87",
"value": {
"labels": [
"important",
],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {
"env": "prod",
},
"value": "9W3MGR3184QYE",
},
}
`;
exports[`Phase 3: Variable System 3.7 var list --tag env:prod filters by kv tag 1`] = `
{
"type": "8F5ENFRC57Y7H",
"value": [
{
"labels": [
"important",
],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {
"env": "prod",
},
"value": "9W3MGR3184QYE",
},
],
}
`;
exports[`Phase 3: Variable System 3.8 var list --tag important filters by label 1`] = `
{
"type": "8F5ENFRC57Y7H",
"value": [
{
"labels": [
"important",
],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {
"env": "prod",
},
"value": "9W3MGR3184QYE",
},
],
}
`;
exports[`Phase 3: Variable System 3.9 var tag remove deletes label 1`] = `
{
"type": "6D1HG60NTZY87",
"value": {
"labels": [],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {
"env": "prod",
},
"value": "9W3MGR3184QYE",
},
}
`;
exports[`Phase 3: Variable System 3.10 var delete removes variable 1`] = `
{
"type": "25VAMSJT0X51K",
"value": [
{
"labels": [],
"name": "myapp/config",
"schema": "FRBAB1BF0ZBCS",
"tags": {
"env": "prod",
},
"value": "9W3MGR3184QYE",
},
],
}
`;
exports[`Phase 3: Variable System 3.11 var get deleted variable returns not found 1`] = `"Error: Variable not found: name=myapp/config, schema=FRBAB1BF0ZBCS"`;
exports[`Phase 4: Template System 4.1 template set registers template 1`] = `
{
"type": "7R13JNSN53R67",
"value": {
"contentHash": "6WW8WNB38GTTP",
"schemaHash": "FRBAB1BF0ZBCS",
},
}
`;
exports[`Phase 4: Template System 4.2 template get returns template text 1`] = `
{
"type": "0B0HBHZGYHR84",
"value": "Name: {{ payload.name }}, Age: {{ payload.age }}",
}
`;
exports[`Phase 4: Template System 4.3 template list shows registered templates 1`] = `
{
"type": "5GE3Y0EQS0HP4",
"value": [
{
"contentHash": "6WW8WNB38GTTP",
"schemaHash": "FRBAB1BF0ZBCS",
},
],
}
`;
exports[`Phase 4: Template System 4.4 template delete removes template 1`] = `
{
"type": "BY7BGZJND3N7R",
"value": {
"deleted": true,
},
}
`;
exports[`Phase 4: Template System 4.5 template get deleted template returns not found 1`] = `"Error: Template not found for schema: FRBAB1BF0ZBCS"`;