Documentation
¶
Overview ¶
Package bundle walks an on-disk OPS/ tree and produces a flat list of (stack, scope, name, txcl, mock_req, mock_res) records suitable for POSTing to the admin /v1/ops/import endpoint.
Path conventions accepted by the walker, where every leaf is `<name>.txcl` and each scope directory may hold any number of them (parallel rules at the same stage):
OPS/<stack>/<scope>/<name>.txcl OPS/<stack>/<scope>_<DESCRIPTION>/<name>.txcl
The scope dir is the integer prefix; an optional `_DESCRIPTION` suffix is for human readability and is ignored by the chassis. Leading zeros are stripped (`0100` and `100` both mean scope 100).
Examples:
OPS/website/100/resonator.txcl -> stack=website, scope=100, name=resonator OPS/website/0100_SETUP/init.txcl -> stack=website, scope=100, name=init OPS/website/0100_SETUP/audit.txcl -> stack=website, scope=100, name=audit (parallel rule) OPS/website/canary/0100_SETUP/init.txcl -> stack=website/canary, scope=100, name=init
Optional sibling files `mock-request.json` and `mock-response.json` in the same scope directory attach to *all* rules at that scope. (Per-rule mocks can come later if there's demand.)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SystemSegment ¶
SystemSegment splits a stack name whose first path segment is a `_`-prefixed chassis-local tenant (e.g. "_sys/boot" -> slug="_sys", rest="boot"). ok is false for ordinary application stacks and for a bare "_slug" with no stack under it. This is the single discriminator between the two load paths: `_*` stacks are loaded locally/trusted by the chassis (chassis/sysops); everything else is an application stack pushed through the admin API.
Types ¶
type Op ¶
type Op struct {
Stack string `json:"stack"`
Scope int `json:"scope"`
Name string `json:"name"`
Txcl string `json:"txcl"`
MockReq string `json:"mock_req,omitempty"`
MockRes string `json:"mock_res,omitempty"`
// SourcePath is the absolute path to the .txcl file. Set by Walk for
// diagnostic purposes; not serialized into the wire format.
SourcePath string `json:"-"`
}
Op is one row in a bundle. Mirrors the admin/ops.go OpRecord shape.
func Walk ¶
Walk discovers application rules under <root>/OPS/ on the local filesystem. `_`-prefixed system stacks (e.g. OPS/_sys/...) are excluded — they are loaded locally by the chassis, never pushed via the admin API, so every CLI/apply caller transparently skips them. Returns an empty slice (not an error) when OPS/ is missing.