ca334692b7
Multiple --tag flags AND together. Tag format: key:value for tags, bare name for labels. Without --tag, existing behavior is preserved. Fixes #54
471 lines
13 KiB
Plaintext
471 lines
13 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!": Name must follow @scope/name format (e.g. @myapp/config)"`;
|
|
|
|
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-name> [--tag <tag>...] List hashes for a type, optionally filtered by tags (@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)
|
|
tag <target> <tag>... Apply tags/labels to a target (@ocas/output/tag)
|
|
untag <target> <tag>... Remove tags/labels from a target (@ocas/output/untag)
|
|
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 history <name> [--schema <hash>] Show value history (LRU) (@ocas/output/var-history)
|
|
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)
|
|
--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)
|
|
|
|
Agent: If you have not installed the ocas skill for this version (0.1.2), run \`ocas prompt setup\` and follow the instructions."
|
|
`;
|
|
|
|
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": "F5RRJTXP8Z99D",
|
|
"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": "@myapp/config",
|
|
"schema": "FRBAB1BF0ZBCS",
|
|
"tags": {},
|
|
"value": "9W3MGR3184QYE",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/array",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "D45CW047XS17Y",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/bool",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "1AVHCXEJVDCPP",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/boolean",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "1AVHCXEJVDCPP",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/integer",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "B26JM4PBHPAFK",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/null",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "8E33KAS0HMAZ7",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/number",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "BEAZQGKVXMZT8",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/object",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "944RT37WX1PQ5",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/gc",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7KHZTY010988K",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/get",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7V5G8E2VW8B2G",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/has",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "FHXQQZMVHW924",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/hash",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "1B24CBF95Q5G6",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/list",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7BWZ3JKKMSH4N",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/list-meta",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "1WQ7C0EV8QGA4",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/list-schema",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7FYGS2KQ3REM9",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/put",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "4ZHWK21APCFZ5",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/refs",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "2TKP4RGBJ4V43",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/tag",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "CPSWA9TB2JMWP",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/template-delete",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "BY7BGZJND3N7R",
|
|
},
|
|
{
|
|
"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-set",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "BJDHPAE4Q8TXM",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/untag",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "BPEQMRQNJK80Z",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-delete",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "C3MYPR5RGQFZT",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-get",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "F5RRJTXP8Z99D",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-history",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "EVZJS80TRFKE1",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-list",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "AF0XACGXHPMC1",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/var-set",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "0Q5EMYK4SYSS9",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/verify",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "52HEFB52BD0GF",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/output/walk",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "4HG6MD3XG5H5C",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/schema",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "CTS5P6RD8HMCS",
|
|
},
|
|
{
|
|
"labels": [],
|
|
"name": "@ocas/string",
|
|
"schema": "CTS5P6RD8HMCS",
|
|
"tags": {},
|
|
"value": "7VQ43ZSJTEWA7",
|
|
},
|
|
],
|
|
}
|
|
`;
|
|
|
|
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 set with tag and label adds them 1`] = `
|
|
{
|
|
"type": "0Q5EMYK4SYSS9",
|
|
"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 set without label removes it 1`] = `
|
|
{
|
|
"type": "0Q5EMYK4SYSS9",
|
|
"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"`;
|