20b6335f33
bootstrap() accepts optional varStore parameter. When provided, all builtin schema aliases are written via varStore.set(). Also registers previously missing @ocas/integer, @ocas/boolean, and @ocas/null. Fixes #17
454 lines
12 KiB
Plaintext
454 lines
12 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 [--home <path>] [--json] <command> [args]
|
|
|
|
All JSON commands emit a { type, value } envelope. The type is the hash of the
|
|
command's @ocas/output/* schema (shown in parentheses); pipe any envelope into
|
|
\`render -p\` to render its value (ocas_ref hashes are expanded).
|
|
|
|
Commands:
|
|
put <type-hash> <file.json|--pipe> Store node, print envelope (value=hash) (@ocas/output/put)
|
|
get <hash> Print node as envelope (@ocas/output/get)
|
|
has <hash> Print envelope (value=boolean) (@ocas/output/has)
|
|
verify <hash> Verify integrity + schema (value=ok/corrupted/invalid) (@ocas/output/verify)
|
|
refs <hash> List direct ocas_ref edges (@ocas/output/refs)
|
|
walk <hash> [--format tree] Recursive traversal (@ocas/output/walk)
|
|
hash <type-hash> <file.json|--pipe> Compute hash without storing (@ocas/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[]) (@ocas/output/list)
|
|
list-meta List meta-schema hashes (value=string[]) (@ocas/output/list-meta)
|
|
list-schema List all schema hashes (value=string[]) (@ocas/output/list-schema)
|
|
var set <name> <hash> [--tag <tag>...] Create/update a variable (@ocas/output/var-set)
|
|
var get <name> --schema <hash> Get a variable by name + schema (@ocas/output/var-get)
|
|
var delete <name> [--schema <hash>] Delete variable(s) (@ocas/output/var-delete)
|
|
var list [prefix] [--schema <hash>] [--tag <tag>...] List variables (@ocas/output/var-list)
|
|
var tag <name> --schema <hash> <operations...> Modify tags/labels (@ocas/output/var-tag)
|
|
template set <schema-hash> <file> | --inline <text> Set template for schema (@ocas/output/template-set)
|
|
template get <schema-hash> Get template content (value=string) (@ocas/output/template-get)
|
|
template list List all templates (@ocas/output/template-list)
|
|
template delete <schema-hash> Delete template for schema (@ocas/output/template-delete)
|
|
gc Run garbage collection (@ocas/output/gc)
|
|
|
|
Flags:
|
|
--home <path> Store directory (default: $OCAS_HOME or ~/.ocas)
|
|
--var-db <path> Variable database path (default: <store>/variables.db)
|
|
--json Compact JSON output
|
|
--render, -r Render output inline (equivalent to | ocas render -p)
|
|
--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": "0Q5EMYK4SYSS9",
|
|
"value": {
|
|
"labels": [],
|
|
"name": "myapp/config",
|
|
"schema": "FRBAB1BF0ZBCS",
|
|
"tags": {},
|
|
"value": "9W3MGR3184QYE",
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`Phase 3: Variable System 3.2 var get returns variable 1`] = `
|
|
{
|
|
"type": "7C75FQT98KKQD",
|
|
"value": {
|
|
"labels": [],
|
|
"name": "myapp/config",
|
|
"schema": "FRBAB1BF0ZBCS",
|
|
"tags": {},
|
|
"value": "9W3MGR3184QYE",
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`Phase 3: Variable System 3.3 var list shows all variables 1`] = `
|
|
{
|
|
"type": "AF0XACGXHPMC1",
|
|
"value": [
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/schema",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "CTS5P6RD8HMCS",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/string",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7VQ43ZSJTEWA7",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/number",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "BEAZQGKVXMZT8",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/integer",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "B26JM4PBHPAFK",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/boolean",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "1AVHCXEJVDCPP",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/bool",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "1AVHCXEJVDCPP",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/object",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "944RT37WX1PQ5",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/array",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "D45CW047XS17Y",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/null",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "8E33KAS0HMAZ7",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/put",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "4ZHWK21APCFZ5",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/get",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "FB4K0SXG68ZFS",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/has",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "FHXQQZMVHW924",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/hash",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "1B24CBF95Q5G6",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/verify",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "52HEFB52BD0GF",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/refs",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "2TKP4RGBJ4V43",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/walk",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "4HG6MD3XG5H5C",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/list",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "CTCEXSNPWMAQQ",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/list-meta",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "0V41JBWK72HS3",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/list-schema",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "AW24Q8BKXQYTE",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-set",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "0Q5EMYK4SYSS9",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-get",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7C75FQT98KKQD",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-delete",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "C3MYPR5RGQFZT",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-tag",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "9103EYRMM949A",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-list",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "AF0XACGXHPMC1",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/template-set",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "BJDHPAE4Q8TXM",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/template-get",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "0B0HBHZGYHR84",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/template-list",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "8917JQTD1R5JF",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/template-delete",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "BY7BGZJND3N7R",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/gc",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7KHZTY010988K",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "myapp/config",
|
|
"schema": "FRBAB1BF0ZBCS",
|
|
"tags": {},
|
|
"value": "9W3MGR3184QYE",
|
|
},
|
|
],
|
|
}
|
|
`;
|
|
|
|
exports[`Phase 3: Variable System 3.4 var list prefix filters by prefix 1`] = `
|
|
{
|
|
"type": "AF0XACGXHPMC1",
|
|
"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": "0Q5EMYK4SYSS9",
|
|
"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": "9103EYRMM949A",
|
|
"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": "AF0XACGXHPMC1",
|
|
"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": "AF0XACGXHPMC1",
|
|
"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": "9103EYRMM949A",
|
|
"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": "C3MYPR5RGQFZT",
|
|
"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": "BJDHPAE4Q8TXM",
|
|
"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": "8917JQTD1R5JF",
|
|
"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"`;
|