octwin-cli 0.8.6 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,43 @@ Format: [Keep a Changelog](https://keepachangelog.com/) — newest first, bucket
5
5
  **Added · Changed · Deprecated · Removed · Fixed · Security**. The platform-wide view lives in the
6
6
  repo root [`CHANGELOG.md`](../../CHANGELOG.md); this file is the CLI-only cut that ships with the package.
7
7
 
8
+ ## [0.8.7] - 2026-09-06
9
+
10
+ ### Added
11
+ - **`validate` now reads a map's KEYS, not only its values.** The declaration walker reported four
12
+ things — an unknown key, a missing `required` key, a wrong scalar type, a value outside a closed
13
+ `enum` — and every one of them is about a VALUE. But a map's keys carry meaning in several
14
+ declarations (`roles.yaml` grant resources and verbs, `xrm.yaml` entity names), and those keys had
15
+ no check at all. Rule 5 replays `propertyNames` — both the `enum` and the `pattern` form.
16
+
17
+ This is why publishing the RBAC vocabulary was worth doing. A pack author wrote `case:` where the
18
+ grant key is `record.case`, passed offline `validate` clean, and learned the truth one bad guess at
19
+ a time from `--remote` round-trips. They gave up on custom RBAC over it. The check now says
20
+ `not a valid key here — must be one of "record.case", …` before a deploy is attempted.
21
+
22
+ It stays inside the file's false-positive rule because it is a **faithful replay**: the same `enum`
23
+ membership and the same JS regex engine Zod itself runs, over a pattern the platform generated. A
24
+ pattern this engine cannot compile is treated like a combinator — walk away, do not guess.
25
+
26
+ Verified 2026-09-06 against the shipped binary: across all 23 marketplace packs rule 5 reports
27
+ **nothing**, with 10 of the 12 pulled declaration schemas carrying `propertyNames` (so the silence
28
+ is a result, not an unexercised branch). A deliberately broken key is caught on both branches — a
29
+ role named `Regional-Agent` against `^[a-z][a-z0-9_]*$`, and a grant key `case:` against an enum
30
+ vocabulary — each naming the file, the path and the rule it broke.
31
+
32
+ ### Fixed
33
+ - **`deploy` had stopped printing its seed counts entirely.** `printDeploySuccess` read
34
+ `r.summary.records` / `.updated` / `.images` / `.rules` / `.failed`, but the deploy route's
35
+ `summary` is a run-log **string** (`"clinic v1.2.0 — {…}"`), not an object. So every field was
36
+ `undefined`, `parts` stayed empty, and the `if (parts.length)` guard turned *"I am reading the
37
+ wrong field"* into *"there was nothing to say"* — the block printed nothing and looked like a
38
+ deploy that simply seeded no rows. The counts have been on `r.seeded`, keyed by seed kind, and
39
+ `printSeedCounts` already renders them (filtering zeros, which is what makes a partial seed
40
+ legible). The dead block is gone and `printSeedCounts` is called instead.
41
+
42
+ Same shape as the bug 0.8.6 fixed in `validate`: *no data* and *no problem* rendering identically.
43
+ Two independent places in this CLI reached it within one week.
44
+
8
45
  ## [0.8.6] - 2026-09-04
9
46
 
10
47
  ### Changed
package/dist/index.js CHANGED
@@ -1557,25 +1557,11 @@ function printDeploySuccess(id, version, t, r, listing, problems = 0) {
1557
1557
  : `✓ Deployed ${id}@${version} and installed onto ${targetLabel(t)}`);
1558
1558
  if (r?.warning)
1559
1559
  console.log(` ⚠ ${r.warning}`);
1560
- const s = r?.summary;
1561
- if (s) {
1562
- const parts = [];
1563
- if (s.records != null)
1564
- parts.push(`${s.records} record(s) created`);
1565
- if (s.updated)
1566
- parts.push(`${s.updated} updated`);
1567
- if (s.images)
1568
- parts.push(`${s.images} image(s) generated`);
1569
- if (s.rules)
1570
- parts.push(`${s.rules} availability rule(s)`);
1571
- // A count of rows that threw. The seed keeps going past a bad row now, so a
1572
- // partial seed is a real outcome and has to be said out loud — the alternative
1573
- // reads as a complete one with fewer records than the author wrote.
1574
- if (s.failed)
1575
- parts.push(`${s.failed} row(s) FAILED`);
1576
- if (parts.length)
1577
- console.log(` Seeded: ${parts.join(', ')}`);
1578
- }
1560
+ // This read `r.summary.records` / `.rules` / `.failed` and had been DEAD: the deploy route's
1561
+ // `summary` is a run-log STRING (`"clinic v1.2.0 — {…}"`), so every field was undefined and the
1562
+ // block printed nothing. The counts live on `r.seeded`, keyed by seed kind, and `printSeedCounts`
1563
+ // already renders them — filtering zeros, which is what makes a partial seed legible.
1564
+ printSeedCounts(r?.seeded);
1579
1565
  // A redeploy rebuilds the pack's tools, and suspended flow runs live with them.
1580
1566
  // Say so: otherwise the next tap on a card rendered before the deploy comes back
1581
1567
  // stale and reads like a flow bug.
@@ -1626,7 +1612,7 @@ async function cmdSeed(flags) {
1626
1612
  if (stepErrors.length) {
1627
1613
  // A kind failed but the rest ran — the reconcile softens each step. Say which,
1628
1614
  // and exit non-zero so a scripted `seed && chat` doesn't read as clean.
1629
- console.error(`
1615
+ console.error(`
1630
1616
  ⚠ ${stepErrors.length} step${stepErrors.length === 1 ? '' : 's'} failed — data may be incomplete:`);
1631
1617
  for (const e of stepErrors)
1632
1618
  console.error(` • ${e}`);
@@ -4984,372 +4970,372 @@ async function cmdUsage(flags) {
4984
4970
  console.log('\nThis is MODEL spend. WhatsApp/Meta message billing is operator-only — not reachable by an API token.');
4985
4971
  }
4986
4972
  function help() {
4987
- console.log(`octwin ${VERSION} — Octwin external-pack developer CLI (by CEQUENS)
4988
-
4989
- octwin --version # print the CLI version (+ any upgrade notice)
4990
- octwin init <dir> [--id my-pack] [--description "..."] [--display-name "..."]
4991
- octwin validate [--dir .] [--remote] [--require-kb] # --remote runs the platform's FULL schema check + lint (all errors at once)
4992
- octwin login --url <platformUrl> --token oct_… # a deploy token from the console
4993
- octwin whoami [--url <url>] [--tenant <slug>] # verify the token works
4994
- octwin projects [--archived] [--json] # the --project slugs this token can name
4995
- octwin deploy [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>] [--seed]
4996
- [--request-listing | --withdraw-listing] # public marketplace — opt-in, see: octwin help deploy
4997
- octwin status [<packId>] [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>]
4998
- octwin pull <packId> [--dir <out>] [--version <v>] [--force] # write a DEPLOYED pack's source back to disk (the inverse of deploy)
4999
- octwin records [entity] [id] # inspect the pack's XRM data (needs a records:read token)
5000
- octwin work [recordId] [--queues] [--unrouted] [--json] # inspect the work inbox (worked records) + timelines
5001
- # --queues: per-queue open counts + an UNROUTED warning · --unrouted: only the items in no queue
5002
- octwin logs [conversationId] [--as <handle>] [--json] # list conversations / show one's event timeline
5003
- octwin chat "message" [--as <handle>] [--tap <tap-id>] [--media <file|id>] [--json] # drive a turn (+ send media) + print every render
5004
- octwin media generate "<prompt>" [--out <file.png>] [--json] # AI-generate an image → MEDIA- handle (needs media:generate scope)
5005
- octwin agents [packId::agentId] [--prompt] [--json] # effective model/memory + WHICH layer won; --prompt = the resolved system prompt
5006
- octwin orders [reference_id] [--status s] [--payment p] [--json] # the orders a conversation produced + money + payment state
5007
- octwin analytics [entity] [--funnel|--overview|--milestones|--trends|--cost] [--stage <id>] # stage conversion for any pipelined entity
5008
- octwin catalog [--readiness] [--json] # commerce products + stock + the WhatsApp catalog binding
5009
- octwin scheduling [--slots <resourceRecordId>] [--from YYYY-MM-DD] [--days n] # engine state / computed slots
5010
- octwin automation [campaigns] [--json] # the jobs your declarations produced + health, last result each
5011
- octwin integrations [--json] # declared connections BESIDE what is configured (the silent-never-fires check)
5012
- octwin integrations deliveries [<id>] | events # the outbound delivery log / inbound events
5013
- octwin journeys [journeyId] [--funnel|--overview|--goals|--trends|--cost|--definition] [--stage <id>]
5014
- octwin performance [--detail] [--json] # the project's business indicators (value/conversion/duration)
5015
- octwin usage [--json] # model calls, tokens and cost (project if pinned, else workspace)
5016
- octwin platform-kb [pull] [--if-stale|--check] [--dir .] [--url <url>] # no token needed
5017
- octwin test [--dir .] # = validate --remote (the full platform check)
5018
- octwin feedback [--dir .] # submit this pack's FEEDBACK.md to the platform team
5019
- octwin memos [--all] [--json] # read the platform's replies + notices (a reply to your feedback lands here)
5020
-
5021
- Writes — exercise the state your pack creates (each needs the matching :write scope):
5022
- octwin records create <entity> --set field=value … # also: patch <id> --entity <e>, stage <id> --to <s>, note <id> "…"
5023
- octwin records tasks | task complete <taskId> [--outcome done|cancelled]
5024
- octwin work assign <id> --to user:<uuid>|none | note <id> "…" | stage <id> --to <stage>
5025
- octwin work decide <id> --action <a> [--param k=v] [--dry-run] # --dry-run previews, commits nothing
5026
- octwin orders transition <ref> --to <status> | refund <ref> --force
5027
- octwin catalog availability <sku> --to "in stock" | stock <sku> [--set-on-hand n]
5028
- octwin scheduling rules --resource <id> | rule add|rm | exception add|rm
5029
- octwin agents set <packId::agentId> [--model m] [--enable-tool t] [--disable-tool t]
5030
- octwin automation run <jobId> | pause <jobId> | resume <jobId> | send <campaignId>
5031
- octwin integrations test <key> # a LIVE call to the connection's health: operation
5032
- octwin integrations retry|cancel|send-now <deliveryId>
5033
- (octwin integrations preflight <key> needs only integrations:read — it makes no call)
5034
-
5035
- Multi-turn: the platform keeps ONE open conversation per --as handle — consecutive
5036
- \`octwin chat --as <h>\` calls continue the same conversation; press a rendered
5037
- button/row with \`--tap "<tap-id>"\` (chat prints every tap id).
5038
- Get a deploy token: console → your workspace → Settings → API tokens → Generate (tick records:read to inspect data).
5039
- octwin platform-kb pull → writes the platform capability reference into .octwin/platform-kb/ (for the octwin-pack skill).
5040
- Config (deploy): flags > env (PACK_PLATFORM_URL/PACK_TENANT/PACK_PROJECT/PACK_TOKEN) > saved login (\`octwin login\` sets the default target).
4973
+ console.log(`octwin ${VERSION} — Octwin external-pack developer CLI (by CEQUENS)
4974
+
4975
+ octwin --version # print the CLI version (+ any upgrade notice)
4976
+ octwin init <dir> [--id my-pack] [--description "..."] [--display-name "..."]
4977
+ octwin validate [--dir .] [--remote] [--require-kb] # --remote runs the platform's FULL schema check + lint (all errors at once)
4978
+ octwin login --url <platformUrl> --token oct_… # a deploy token from the console
4979
+ octwin whoami [--url <url>] [--tenant <slug>] # verify the token works
4980
+ octwin projects [--archived] [--json] # the --project slugs this token can name
4981
+ octwin deploy [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>] [--seed]
4982
+ [--request-listing | --withdraw-listing] # public marketplace — opt-in, see: octwin help deploy
4983
+ octwin status [<packId>] [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>]
4984
+ octwin pull <packId> [--dir <out>] [--version <v>] [--force] # write a DEPLOYED pack's source back to disk (the inverse of deploy)
4985
+ octwin records [entity] [id] # inspect the pack's XRM data (needs a records:read token)
4986
+ octwin work [recordId] [--queues] [--unrouted] [--json] # inspect the work inbox (worked records) + timelines
4987
+ # --queues: per-queue open counts + an UNROUTED warning · --unrouted: only the items in no queue
4988
+ octwin logs [conversationId] [--as <handle>] [--json] # list conversations / show one's event timeline
4989
+ octwin chat "message" [--as <handle>] [--tap <tap-id>] [--media <file|id>] [--json] # drive a turn (+ send media) + print every render
4990
+ octwin media generate "<prompt>" [--out <file.png>] [--json] # AI-generate an image → MEDIA- handle (needs media:generate scope)
4991
+ octwin agents [packId::agentId] [--prompt] [--json] # effective model/memory + WHICH layer won; --prompt = the resolved system prompt
4992
+ octwin orders [reference_id] [--status s] [--payment p] [--json] # the orders a conversation produced + money + payment state
4993
+ octwin analytics [entity] [--funnel|--overview|--milestones|--trends|--cost] [--stage <id>] # stage conversion for any pipelined entity
4994
+ octwin catalog [--readiness] [--json] # commerce products + stock + the WhatsApp catalog binding
4995
+ octwin scheduling [--slots <resourceRecordId>] [--from YYYY-MM-DD] [--days n] # engine state / computed slots
4996
+ octwin automation [campaigns] [--json] # the jobs your declarations produced + health, last result each
4997
+ octwin integrations [--json] # declared connections BESIDE what is configured (the silent-never-fires check)
4998
+ octwin integrations deliveries [<id>] | events # the outbound delivery log / inbound events
4999
+ octwin journeys [journeyId] [--funnel|--overview|--goals|--trends|--cost|--definition] [--stage <id>]
5000
+ octwin performance [--detail] [--json] # the project's business indicators (value/conversion/duration)
5001
+ octwin usage [--json] # model calls, tokens and cost (project if pinned, else workspace)
5002
+ octwin platform-kb [pull] [--if-stale|--check] [--dir .] [--url <url>] # no token needed
5003
+ octwin test [--dir .] # = validate --remote (the full platform check)
5004
+ octwin feedback [--dir .] # submit this pack's FEEDBACK.md to the platform team
5005
+ octwin memos [--all] [--json] # read the platform's replies + notices (a reply to your feedback lands here)
5006
+
5007
+ Writes — exercise the state your pack creates (each needs the matching :write scope):
5008
+ octwin records create <entity> --set field=value … # also: patch <id> --entity <e>, stage <id> --to <s>, note <id> "…"
5009
+ octwin records tasks | task complete <taskId> [--outcome done|cancelled]
5010
+ octwin work assign <id> --to user:<uuid>|none | note <id> "…" | stage <id> --to <stage>
5011
+ octwin work decide <id> --action <a> [--param k=v] [--dry-run] # --dry-run previews, commits nothing
5012
+ octwin orders transition <ref> --to <status> | refund <ref> --force
5013
+ octwin catalog availability <sku> --to "in stock" | stock <sku> [--set-on-hand n]
5014
+ octwin scheduling rules --resource <id> | rule add|rm | exception add|rm
5015
+ octwin agents set <packId::agentId> [--model m] [--enable-tool t] [--disable-tool t]
5016
+ octwin automation run <jobId> | pause <jobId> | resume <jobId> | send <campaignId>
5017
+ octwin integrations test <key> # a LIVE call to the connection's health: operation
5018
+ octwin integrations retry|cancel|send-now <deliveryId>
5019
+ (octwin integrations preflight <key> needs only integrations:read — it makes no call)
5020
+
5021
+ Multi-turn: the platform keeps ONE open conversation per --as handle — consecutive
5022
+ \`octwin chat --as <h>\` calls continue the same conversation; press a rendered
5023
+ button/row with \`--tap "<tap-id>"\` (chat prints every tap id).
5024
+ Get a deploy token: console → your workspace → Settings → API tokens → Generate (tick records:read to inspect data).
5025
+ octwin platform-kb pull → writes the platform capability reference into .octwin/platform-kb/ (for the octwin-pack skill).
5026
+ Config (deploy): flags > env (PACK_PLATFORM_URL/PACK_TENANT/PACK_PROJECT/PACK_TOKEN) > saved login (\`octwin login\` sets the default target).
5041
5027
  Per-command usage: octwin <command> --help`);
5042
5028
  }
5043
5029
  /** Per-subcommand usage — printed for `octwin <cmd> --help|-h` BEFORE any
5044
5030
  * network/auth work (a --help that 401s is worse than no help at all). */
5045
5031
  const COMMAND_HELP = {
5046
- init: `octwin init <dir> [--id my-pack] [--description "..."] [--display-name "..."]
5032
+ init: `octwin init <dir> [--id my-pack] [--description "..."] [--display-name "..."]
5047
5033
  Scaffold a pure-YAML starter pack into <dir>.`,
5048
- validate: `octwin validate [--dir .] [--remote] [--require-kb] [--strict-primitives]
5049
- Offline structural check, plus two checks driven by the pulled capability
5050
- reference (render-intent fields, primitive arguments). Those two SKIP when the
5051
- reference is missing — the run says so, and --require-kb turns the skip into a
5052
- failure for CI. --remote additionally runs the platform's FULL manifest +
5053
- flow-DSL validation and its flow lint (all errors at once) — same check as deploy.
5054
- --strict-primitives (with --remote) additionally type-checks LITERAL args:
5055
- values against each primitive's declared input schema; expression strings
5034
+ validate: `octwin validate [--dir .] [--remote] [--require-kb] [--strict-primitives]
5035
+ Offline structural check, plus two checks driven by the pulled capability
5036
+ reference (render-intent fields, primitive arguments). Those two SKIP when the
5037
+ reference is missing — the run says so, and --require-kb turns the skip into a
5038
+ failure for CI. --remote additionally runs the platform's FULL manifest +
5039
+ flow-DSL validation and its flow lint (all errors at once) — same check as deploy.
5040
+ --strict-primitives (with --remote) additionally type-checks LITERAL args:
5041
+ values against each primitive's declared input schema; expression strings
5056
5042
  ('$found.id', '{$t(…)}') are always exempt.`,
5057
- login: `octwin login --url <platformUrl> --token oct_…
5058
- Save a deploy token (console → Settings → API tokens) for that platform url,
5059
- make that url the DEFAULT deploy target for every later command, and echo the
5043
+ login: `octwin login --url <platformUrl> --token oct_…
5044
+ Save a deploy token (console → Settings → API tokens) for that platform url,
5045
+ make that url the DEFAULT deploy target for every later command, and echo the
5060
5046
  workspace + project pin + scopes the token reaches.`,
5061
- whoami: `octwin whoami [--url <url>] [--tenant <slug>]
5047
+ whoami: `octwin whoami [--url <url>] [--tenant <slug>]
5062
5048
  Verify the resolved token authenticates against the tenant.`,
5063
- projects: `octwin projects [--archived] [--json]
5064
- List the workspace's projects — the slugs every --project flag takes, with the
5065
- plan's project cap. --archived includes archived ones. A pack:deploy token
5066
- reaches this (it names a project in every other command).
5067
-
5068
- octwin projects create "<name>" [--slug <slug>] [--pack <packId>]
5069
- Create a project. The URL slug is derived from the name unless --slug pins one.
5070
- --pack installs an ALREADY-published pack; the usual next step is instead
5071
- \`octwin deploy --project <slug>\`, which publishes this working tree and installs it.
5072
-
5073
- octwin projects rm <slug> [--yes]
5074
- HARD delete — the project and everything cascading from it (conversations,
5075
- contacts, records, installs). No undo, and not the same as archiving.
5076
- WITHOUT --yes it only previews what would be destroyed, so the dry run is the
5077
- default. Together these make a disposable end-to-end environment:
5078
- octwin projects create "Scratch" && octwin deploy --project scratch --seed
5079
- octwin chat "hi" --project scratch
5080
- octwin projects rm scratch --yes
5049
+ projects: `octwin projects [--archived] [--json]
5050
+ List the workspace's projects — the slugs every --project flag takes, with the
5051
+ plan's project cap. --archived includes archived ones. A pack:deploy token
5052
+ reaches this (it names a project in every other command).
5053
+
5054
+ octwin projects create "<name>" [--slug <slug>] [--pack <packId>]
5055
+ Create a project. The URL slug is derived from the name unless --slug pins one.
5056
+ --pack installs an ALREADY-published pack; the usual next step is instead
5057
+ \`octwin deploy --project <slug>\`, which publishes this working tree and installs it.
5058
+
5059
+ octwin projects rm <slug> [--yes]
5060
+ HARD delete — the project and everything cascading from it (conversations,
5061
+ contacts, records, installs). No undo, and not the same as archiving.
5062
+ WITHOUT --yes it only previews what would be destroyed, so the dry run is the
5063
+ default. Together these make a disposable end-to-end environment:
5064
+ octwin projects create "Scratch" && octwin deploy --project scratch --seed
5065
+ octwin chat "hi" --project scratch
5066
+ octwin projects rm scratch --yes
5081
5067
  Both verbs need the \`projects:write\` scope — a pack:deploy token does NOT confer it.`,
5082
- deploy: `octwin deploy [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>] [--seed]
5083
- [--request-listing | --withdraw-listing]
5084
- Upload the pack bundle, validate server-side, install onto the project.
5085
- --seed additionally applies the pack's demo seed (streams progress).
5086
-
5087
- A plain deploy says NOTHING about the public marketplace — it is a test loop, so it
5088
- neither asks for a listing nor gives one up. The marketplace flags are opt-in:
5089
-
5090
- --request-listing ask an operator to review this pack for the public marketplace
5091
- (the pre-signup storefront at /packs). Requires 'public: true'
5092
- under 'listing:' in manifest.yaml — the manifest states that the
5093
- pack is a product, the flag is you choosing to ask.
5094
- --withdraw-listing retract the request, including an approved listing.
5095
-
5096
- An approval covers the CONTENT it was made against, so a later deploy that changes the
5068
+ deploy: `octwin deploy [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>] [--seed]
5069
+ [--request-listing | --withdraw-listing]
5070
+ Upload the pack bundle, validate server-side, install onto the project.
5071
+ --seed additionally applies the pack's demo seed (streams progress).
5072
+
5073
+ A plain deploy says NOTHING about the public marketplace — it is a test loop, so it
5074
+ neither asks for a listing nor gives one up. The marketplace flags are opt-in:
5075
+
5076
+ --request-listing ask an operator to review this pack for the public marketplace
5077
+ (the pre-signup storefront at /packs). Requires 'public: true'
5078
+ under 'listing:' in manifest.yaml — the manifest states that the
5079
+ pack is a product, the flag is you choosing to ask.
5080
+ --withdraw-listing retract the request, including an approved listing.
5081
+
5082
+ An approval covers the CONTENT it was made against, so a later deploy that changes the
5097
5083
  pack returns it to the review queue on its own — no flag needed, and the CLI says so.`,
5098
- seed: `octwin seed [--pack <packId>]
5099
- Apply the pack's demo/reference data to the project it is installed on, without
5100
- redeploying: xrm \`demo:\` records + scheduling availability, the commerce catalog,
5101
- and the demo operator topology. Reports what each kind produced.
5102
- Idempotent and safe to re-run — records upsert, and existing media is REUSED rather
5103
- than regenerated, so a second pass costs nothing. --pack is only needed when a
5084
+ seed: `octwin seed [--pack <packId>]
5085
+ Apply the pack's demo/reference data to the project it is installed on, without
5086
+ redeploying: xrm \`demo:\` records + scheduling availability, the commerce catalog,
5087
+ and the demo operator topology. Reports what each kind produced.
5088
+ Idempotent and safe to re-run — records upsert, and existing media is REUSED rather
5089
+ than regenerated, so a second pass costs nothing. --pack is only needed when a
5104
5090
  project somehow runs more than one.`,
5105
- status: `octwin status [<packId>] [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>]
5106
- Show installed vs live version + the flow list for this pack.
5107
- The pack id is read from manifest.yaml and QUALIFIED with your workspace slug
5108
- (a manifest declares a bare name; the owner is attached when you publish). Pass
5109
- <packId> explicitly to skip that lookup — \`octwin agents\` and \`octwin projects\`
5091
+ status: `octwin status [<packId>] [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>]
5092
+ Show installed vs live version + the flow list for this pack.
5093
+ The pack id is read from manifest.yaml and QUALIFIED with your workspace slug
5094
+ (a manifest declares a bare name; the owner is attached when you publish). Pass
5095
+ <packId> explicitly to skip that lookup — \`octwin agents\` and \`octwin projects\`
5110
5096
  both print the qualified form.`,
5111
- records: `octwin records [entity] [id] [--limit 50] [--offset n]
5112
- Inspect the pack's XRM data. No args = list entities. Worked records (cases,
5113
- tickets, anything routed to a queue) read best through \`octwin work\`.
5114
-
5115
- WRITES (need \`records:write\`; every one is re-checked by RBAC on the record):
5116
- octwin records create <entity> --set field=value [--set …] [--stage s] [--contact <id>]
5117
- octwin records patch <recordId> --entity <entity> --set field=value
5118
- octwin records stage <recordId> --to <stage> [--note "..."]
5119
- octwin records note <recordId> "the note text"
5120
- octwin records tasks # open follow-up tasks (\`tasks\` plan feature)
5121
- octwin records task complete <taskId> [--outcome done|cancelled] [--note "..."]
5122
-
5123
- --set coerces JSON scalars: \`--set rating=4.5\` sends a number, \`--set x=null\`
5124
- sends null. Use --fields-json '{"a":{"b":1}}' for anything nested.
5125
- \`patch\` needs --entity even though it has an id: the route resolves the field
5126
- validator from it. A leading \`create/patch/stage/note/tasks/task\` is read as a
5097
+ records: `octwin records [entity] [id] [--limit 50] [--offset n]
5098
+ Inspect the pack's XRM data. No args = list entities. Worked records (cases,
5099
+ tickets, anything routed to a queue) read best through \`octwin work\`.
5100
+
5101
+ WRITES (need \`records:write\`; every one is re-checked by RBAC on the record):
5102
+ octwin records create <entity> --set field=value [--set …] [--stage s] [--contact <id>]
5103
+ octwin records patch <recordId> --entity <entity> --set field=value
5104
+ octwin records stage <recordId> --to <stage> [--note "..."]
5105
+ octwin records note <recordId> "the note text"
5106
+ octwin records tasks # open follow-up tasks (\`tasks\` plan feature)
5107
+ octwin records task complete <taskId> [--outcome done|cancelled] [--note "..."]
5108
+
5109
+ --set coerces JSON scalars: \`--set rating=4.5\` sends a number, \`--set x=null\`
5110
+ sends null. Use --fields-json '{"a":{"b":1}}' for anything nested.
5111
+ \`patch\` needs --entity even though it has an id: the route resolves the field
5112
+ validator from it. A leading \`create/patch/stage/note/tasks/task\` is read as a
5127
5113
  VERB — to list an entity actually named one of those, use \`--entity <name>\`.`,
5128
- work: `octwin work [recordId] [--queues] [--unrouted] [--limit 50] [--offset n] [--json]
5129
- Inspect the work inbox — every entity the pack declares worked (cases, orders
5130
- needing review, applications, …): the inbox, one item + its timeline
5131
- (+ applicable actions), or --queues for queue keys + open counts.
5132
-
5133
- WRITES (need \`work:write\`; \`stage\` needs \`records:write\`):
5134
- octwin work assign <recordId> --to user:<uuid>|team:<uuid>|none
5135
- octwin work note <recordId> "the note text"
5136
- octwin work stage <recordId> --to <stage> [--note "..."]
5137
- octwin work decide <recordId> --action <action> [--param k=v] [--note "..."] [--dry-run]
5138
-
5139
- \`decide\` applies one of the entity's declared operator actions — \`octwin work <id>\`
5140
- lists them with their params. --dry-run previews the customer-facing copy and the
5141
- resulting stage WITHOUT committing (that route needs only \`work:read\`).
5114
+ work: `octwin work [recordId] [--queues] [--unrouted] [--limit 50] [--offset n] [--json]
5115
+ Inspect the work inbox — every entity the pack declares worked (cases, orders
5116
+ needing review, applications, …): the inbox, one item + its timeline
5117
+ (+ applicable actions), or --queues for queue keys + open counts.
5118
+
5119
+ WRITES (need \`work:write\`; \`stage\` needs \`records:write\`):
5120
+ octwin work assign <recordId> --to user:<uuid>|team:<uuid>|none
5121
+ octwin work note <recordId> "the note text"
5122
+ octwin work stage <recordId> --to <stage> [--note "..."]
5123
+ octwin work decide <recordId> --action <action> [--param k=v] [--note "..."] [--dry-run]
5124
+
5125
+ \`decide\` applies one of the entity's declared operator actions — \`octwin work <id>\`
5126
+ lists them with their params. --dry-run previews the customer-facing copy and the
5127
+ resulting stage WITHOUT committing (that route needs only \`work:read\`).
5142
5128
  \`stage\` is the XRM records verb (one transition spelling platform-wide).`,
5143
- logs: `octwin logs [conversationId] [--as <handle>] [--json]
5144
- No id = recent conversations (handle, status, last activity; --as filters).
5145
- With id = the full event timeline including what each turn rendered.
5129
+ logs: `octwin logs [conversationId] [--as <handle>] [--json]
5130
+ No id = recent conversations (handle, status, last activity; --as filters).
5131
+ With id = the full event timeline including what each turn rendered.
5146
5132
  --json = raw events (verbatim payloads).`,
5147
- pull: `octwin pull <packId> [--dir <out>] [--version <v>] [--force]
5148
- Write a DEPLOYED pack's source back to disk — the inverse of deploy.
5149
- A pack pushed with 'octwin deploy' lives on the platform as an artifact the
5150
- runtime serves but nothing hands back, so its only source copy is the machine
5151
- that pushed it. Pull it, fix it, redeploy it.
5152
- Defaults to the version installed on the target project; --version overrides.
5153
- --dir defaults to ./<packId>; a non-empty dir needs --force.
5154
- The pulled dir redeploys where it came from — the target is your saved login.
5133
+ pull: `octwin pull <packId> [--dir <out>] [--version <v>] [--force]
5134
+ Write a DEPLOYED pack's source back to disk — the inverse of deploy.
5135
+ A pack pushed with 'octwin deploy' lives on the platform as an artifact the
5136
+ runtime serves but nothing hands back, so its only source copy is the machine
5137
+ that pushed it. Pull it, fix it, redeploy it.
5138
+ Defaults to the version installed on the target project; --version overrides.
5139
+ --dir defaults to ./<packId>; a non-empty dir needs --force.
5140
+ The pulled dir redeploys where it came from — the target is your saved login.
5155
5141
  You may pull a pack your tenant OWNS (deployed); an operator token pulls any.`,
5156
- chat: `octwin chat "message" [--as <handle>] [--tap <tap-id>] [--media <file|id>] [--json]
5157
- octwin chat --script <file> [--as <handle>] [--json]
5158
- Drive ONE turn through the dev web channel and print every render with its
5159
- tap ids. Same --as handle = same conversation (multi-turn works).
5160
- --tap presses a rendered button/list row instead of sending text.
5161
- --media uploads a local file (or a media id from 'media generate --json') as
5162
- an image/document/audio inbound — any "message" rides as its caption; feeds a
5163
- running media-collect flow (e.g. activate-app).
5164
- --json dumps the raw SSE envelopes for the turn.
5165
-
5166
- --script drives a WHOLE conversation from a file, ONE TURN PER LINE, in one
5167
- process over one connection — waiting for each turn to settle before sending
5168
- the next. Use this for any multi-step flow: chaining shell invocations races
5169
- the agent loop, because a turn ends on a quiet gap that can arrive while the
5170
- server is still working (the symptom is placeholder-filled fields or a second
5171
- workflow run). Blank lines and # comments are skipped:
5172
-
5173
- # book an appointment end to end
5174
- احجز موعد
5175
- tap:t:invoke:book-appointment:doctor_id=D1
5176
- media:./licence.jpg | here is my licence
5142
+ chat: `octwin chat "message" [--as <handle>] [--tap <tap-id>] [--media <file|id>] [--json]
5143
+ octwin chat --script <file> [--as <handle>] [--json]
5144
+ Drive ONE turn through the dev web channel and print every render with its
5145
+ tap ids. Same --as handle = same conversation (multi-turn works).
5146
+ --tap presses a rendered button/list row instead of sending text.
5147
+ --media uploads a local file (or a media id from 'media generate --json') as
5148
+ an image/document/audio inbound — any "message" rides as its caption; feeds a
5149
+ running media-collect flow (e.g. activate-app).
5150
+ --json dumps the raw SSE envelopes for the turn.
5151
+
5152
+ --script drives a WHOLE conversation from a file, ONE TURN PER LINE, in one
5153
+ process over one connection — waiting for each turn to settle before sending
5154
+ the next. Use this for any multi-step flow: chaining shell invocations races
5155
+ the agent loop, because a turn ends on a quiet gap that can arrive while the
5156
+ server is still working (the symptom is placeholder-filled fields or a second
5157
+ workflow run). Blank lines and # comments are skipped:
5158
+
5159
+ # book an appointment end to end
5160
+ احجز موعد
5161
+ tap:t:invoke:book-appointment:doctor_id=D1
5162
+ media:./licence.jpg | here is my licence
5177
5163
  tap:t:resume:book-appointment:run_id=R1;_ctl_approved=true`,
5178
- media: `octwin media generate "<prompt>" [--out <file.png>] [--json]
5179
- AI-generate an image (needs a media:generate-scoped token), store it as a
5180
- public asset, and print its MEDIA- handle + serve URL. --out downloads the
5181
- bytes (WhatsApp renders only .png/.jpg); --json emits { media_id, url, mime,
5164
+ media: `octwin media generate "<prompt>" [--out <file.png>] [--json]
5165
+ AI-generate an image (needs a media:generate-scoped token), store it as a
5166
+ public asset, and print its MEDIA- handle + serve URL. --out downloads the
5167
+ bytes (WhatsApp renders only .png/.jpg); --json emits { media_id, url, mime,
5182
5168
  bytes }. Pair with 'octwin chat --media' to drive media flows.`,
5183
- agents: `octwin agents [packId::agentId] [--prompt] [--json]
5184
- No args = the roster with each agent's EFFECTIVE model and which layer set it.
5185
- With an agent = every governed setting (model / memory.last_messages /
5186
- working_memory) plus the layer that won — an operator PLATFORM default can
5187
- override what your manifest declares, and this is where you see that.
5188
- --prompt = the exact system prompt the LLM sees for this project (pack
5189
- instructions + platform protocol + any project overlay). Needs agents:read.
5190
- The agent ref is the compound \`<packId>::<agentId>\` key or the override-row UUID.
5191
-
5192
- WRITES (need \`agents:write\`):
5193
- octwin agents set <ref> [--model <m>] [--enabled true|false] [--overlay "..."|none]
5194
- [--enable-tool <toolId>] [--disable-tool <toolId>]
5195
-
5196
- Only what you pass is changed. Tool flags read-modify-write \`config_json.tools\`
5197
- so a sibling decision isn't dropped; absent = enabled. A workspace that hides model
5169
+ agents: `octwin agents [packId::agentId] [--prompt] [--json]
5170
+ No args = the roster with each agent's EFFECTIVE model and which layer set it.
5171
+ With an agent = every governed setting (model / memory.last_messages /
5172
+ working_memory) plus the layer that won — an operator PLATFORM default can
5173
+ override what your manifest declares, and this is where you see that.
5174
+ --prompt = the exact system prompt the LLM sees for this project (pack
5175
+ instructions + platform protocol + any project overlay). Needs agents:read.
5176
+ The agent ref is the compound \`<packId>::<agentId>\` key or the override-row UUID.
5177
+
5178
+ WRITES (need \`agents:write\`):
5179
+ octwin agents set <ref> [--model <m>] [--enabled true|false] [--overlay "..."|none]
5180
+ [--enable-tool <toolId>] [--disable-tool <toolId>]
5181
+
5182
+ Only what you pass is changed. Tool flags read-modify-write \`config_json.tools\`
5183
+ so a sibling decision isn't dropped; absent = enabled. A workspace that hides model
5198
5184
  ids refuses --model with a 403 — the platform default governs there.`,
5199
- orders: `octwin orders [reference_id] [--status s] [--payment p] [--limit 50] [--json]
5200
- No args = the order list (#number, status/payment, total, contact). With a
5201
- reference_id = line items, the subtotal/tax/shipping/discount/total breakdown,
5202
- payment_ref, and the allowed status transitions. Needs orders:read + the
5203
- \`orders\` plan feature. Note: the forward payment lifecycle is webhook-owned,
5204
- so \`pending\` on a gateway-less workspace is expected, not a bug.
5205
-
5206
- WRITES (need \`orders:write\`):
5207
- octwin orders transition <reference_id> --to <status>
5208
- octwin orders refund <reference_id> [--reason "..."] [--mark-returned] --force
5209
-
5210
- Refund is irreversible and moves money, hence --force. The route answers 200 even
5211
- when the GATEWAY refuses, so the CLI reads the gateway verdict and exits non-zero
5212
- on a refusal rather than reporting a refund that never happened. Only a payment in
5185
+ orders: `octwin orders [reference_id] [--status s] [--payment p] [--limit 50] [--json]
5186
+ No args = the order list (#number, status/payment, total, contact). With a
5187
+ reference_id = line items, the subtotal/tax/shipping/discount/total breakdown,
5188
+ payment_ref, and the allowed status transitions. Needs orders:read + the
5189
+ \`orders\` plan feature. Note: the forward payment lifecycle is webhook-owned,
5190
+ so \`pending\` on a gateway-less workspace is expected, not a bug.
5191
+
5192
+ WRITES (need \`orders:write\`):
5193
+ octwin orders transition <reference_id> --to <status>
5194
+ octwin orders refund <reference_id> [--reason "..."] [--mark-returned] --force
5195
+
5196
+ Refund is irreversible and moves money, hence --force. The route answers 200 even
5197
+ when the GATEWAY refuses, so the CLI reads the gateway verdict and exits non-zero
5198
+ on a refusal rather than reporting a refund that never happened. Only a payment in
5213
5199
  \`captured\` state can be refunded; \`payment_status\` is never settable directly.`,
5214
- analytics: `octwin analytics [entity] [--funnel|--overview|--milestones|--trends|--cost] [--stage <id>] [--json]
5215
- No args = the entities that carry a \`pipeline:\` (a funnel needs stages).
5216
- With an entity = stage-by-stage conversion (default --funnel) over the last 30
5217
- days. --stage <id> lists the records CURRENTLY at a stage (a live snapshot, not
5200
+ analytics: `octwin analytics [entity] [--funnel|--overview|--milestones|--trends|--cost] [--stage <id>] [--json]
5201
+ No args = the entities that carry a \`pipeline:\` (a funnel needs stages).
5202
+ With an entity = stage-by-stage conversion (default --funnel) over the last 30
5203
+ days. --stage <id> lists the records CURRENTLY at a stage (a live snapshot, not
5218
5204
  range-filtered). Needs records:read + a \`view\` grant on \`record.<entity>\`.`,
5219
- catalog: `octwin catalog [--readiness] [--json]
5220
- The commerce \`product\` records + price, availability, stock (null = not
5221
- inventory-tracked) and the WhatsApp catalog binding. --readiness runs the Meta
5222
- Graph checklist (LIVE Graph calls; needs a bound access token). Needs
5223
- catalog:read + the \`catalog\` plan feature.
5224
-
5225
- WRITES (need \`catalog:write\`):
5226
- octwin catalog availability <retailerId> --to "in stock"|"out of stock"|…
5227
- octwin catalog stock <retailerId> [--set-on-hand <n>]
5228
-
5229
- \`stock\` with no --set-on-hand READS it; \`null\` means the SKU is not
5230
- inventory-tracked (always sellable), which is different from 0. Lowering on_hand
5231
- below the units already reserved for open carts is refused. Creating/deleting
5205
+ catalog: `octwin catalog [--readiness] [--json]
5206
+ The commerce \`product\` records + price, availability, stock (null = not
5207
+ inventory-tracked) and the WhatsApp catalog binding. --readiness runs the Meta
5208
+ Graph checklist (LIVE Graph calls; needs a bound access token). Needs
5209
+ catalog:read + the \`catalog\` plan feature.
5210
+
5211
+ WRITES (need \`catalog:write\`):
5212
+ octwin catalog availability <retailerId> --to "in stock"|"out of stock"|…
5213
+ octwin catalog stock <retailerId> [--set-on-hand <n>]
5214
+
5215
+ \`stock\` with no --set-on-hand READS it; \`null\` means the SKU is not
5216
+ inventory-tracked (always sellable), which is different from 0. Lowering on_hand
5217
+ below the units already reserved for open carts is refused. Creating/deleting
5232
5218
  products and the Meta catalog binding/sync stay in the console.`,
5233
- scheduling: `octwin scheduling [--slots <resourceRecordId>] [--from YYYY-MM-DD] [--days n] [--json]
5234
- No args = the engine state (bookable resource types, upcoming slots, booked
5235
- seats). --slots <recordId> computes the slots for one bookable resource
5236
- (occupancy included; --days is clamped to 1-31 server-side) — the way to verify
5237
- the availability rules a \`deploy --seed\` created. Needs scheduling:read.
5238
-
5239
- RULES (list needs scheduling:read; add/rm need scheduling:write):
5240
- octwin scheduling rules --resource <resourceRecordId>
5241
- octwin scheduling rule add --resource <id> --dow 1 --start 09:00 --end 17:00
5242
- [--slot-minutes 30] [--capacity 1]
5243
- octwin scheduling rule rm <ruleId>
5244
- octwin scheduling exception add --resource <id> --date YYYY-MM-DD --kind closed|extra
5245
- [--start 09:00 --end 13:00]
5246
- octwin scheduling exception rm <exceptionId>
5247
-
5248
- --dow is 0-6, 0 = Sunday. \`rules\` is how you find an id to remove, and
5219
+ scheduling: `octwin scheduling [--slots <resourceRecordId>] [--from YYYY-MM-DD] [--days n] [--json]
5220
+ No args = the engine state (bookable resource types, upcoming slots, booked
5221
+ seats). --slots <recordId> computes the slots for one bookable resource
5222
+ (occupancy included; --days is clamped to 1-31 server-side) — the way to verify
5223
+ the availability rules a \`deploy --seed\` created. Needs scheduling:read.
5224
+
5225
+ RULES (list needs scheduling:read; add/rm need scheduling:write):
5226
+ octwin scheduling rules --resource <resourceRecordId>
5227
+ octwin scheduling rule add --resource <id> --dow 1 --start 09:00 --end 17:00
5228
+ [--slot-minutes 30] [--capacity 1]
5229
+ octwin scheduling rule rm <ruleId>
5230
+ octwin scheduling exception add --resource <id> --date YYYY-MM-DD --kind closed|extra
5231
+ [--start 09:00 --end 13:00]
5232
+ octwin scheduling exception rm <exceptionId>
5233
+
5234
+ --dow is 0-6, 0 = Sunday. \`rules\` is how you find an id to remove, and
5249
5235
  \`--slots\` is how you check what a rule actually produces.`,
5250
- automation: `octwin automation [campaigns] [--limit n] [--offset n] [--json]
5251
- No args = every job the pack's automation declaration produced, with its status,
5252
- interval and LAST RESULT (matched / acted / errors), under a health line whose
5253
- counts come from SQL rather than from filtering the page — the job list is capped
5254
- server-side, so a client-side count would depend on the cap. Needs automation:read.
5255
-
5256
- Jobs are DERIVED from declarations. There is no \`create\`: no automation block in
5257
- the pack means no jobs, and \`octwin deploy\` is what installs them.
5258
-
5259
- WRITES (automation:write):
5260
- octwin automation run <jobId> # run once, now — prints matched/acted/errors
5261
- octwin automation pause|resume <jobId>
5262
- octwin automation send <campaignId> # enqueue a campaign; enqueued != delivered
5263
-
5264
- <jobId> is the \`key\` the list shows (its uuid works too). The routes themselves
5265
- accept only a uuid — the CLI resolves the key for you, and names the keys that do
5266
- exist when it cannot. A 403 on a write can be an RBAC grant gap rather than a
5236
+ automation: `octwin automation [campaigns] [--limit n] [--offset n] [--json]
5237
+ No args = every job the pack's automation declaration produced, with its status,
5238
+ interval and LAST RESULT (matched / acted / errors), under a health line whose
5239
+ counts come from SQL rather than from filtering the page — the job list is capped
5240
+ server-side, so a client-side count would depend on the cap. Needs automation:read.
5241
+
5242
+ Jobs are DERIVED from declarations. There is no \`create\`: no automation block in
5243
+ the pack means no jobs, and \`octwin deploy\` is what installs them.
5244
+
5245
+ WRITES (automation:write):
5246
+ octwin automation run <jobId> # run once, now — prints matched/acted/errors
5247
+ octwin automation pause|resume <jobId>
5248
+ octwin automation send <campaignId> # enqueue a campaign; enqueued != delivered
5249
+
5250
+ <jobId> is the \`key\` the list shows (its uuid works too). The routes themselves
5251
+ accept only a uuid — the CLI resolves the key for you, and names the keys that do
5252
+ exist when it cannot. A 403 on a write can be an RBAC grant gap rather than a
5267
5253
  missing scope: the action is re-checked against the job.`,
5268
- integrations: `octwin integrations [--json]
5269
- What the pack DECLARES beside what is actually CONFIGURED, in one view — because a
5270
- connection that is declared and never configured is the commonest reason an
5271
- integration silently never fires, and neither list alone can show it. Flags the
5272
- gap explicitly. Needs integrations:read.
5273
-
5274
- DIAGNOSE ONE CONNECTION:
5275
- octwin integrations preflight <key> # every check, with a fix hint. Makes NO
5276
- # outbound call — needs only integrations:read
5277
- octwin integrations test <key> # a LIVE call to its health: operation
5278
- # (integrations:write). Exits 1 when it fails.
5279
-
5280
- THE DELIVERY LOG:
5281
- octwin integrations deliveries [--status s] [--operation id] [--limit n]
5282
- octwin integrations deliveries <id> # + the redacted request/response snapshots
5283
- octwin integrations retry|cancel|send-now <id> # integrations:write
5284
- octwin integrations events # INBOUND events (what arrived at your webhook)
5285
-
5286
- retry/cancel answer 409 when the delivery is in the wrong state; the message
5254
+ integrations: `octwin integrations [--json]
5255
+ What the pack DECLARES beside what is actually CONFIGURED, in one view — because a
5256
+ connection that is declared and never configured is the commonest reason an
5257
+ integration silently never fires, and neither list alone can show it. Flags the
5258
+ gap explicitly. Needs integrations:read.
5259
+
5260
+ DIAGNOSE ONE CONNECTION:
5261
+ octwin integrations preflight <key> # every check, with a fix hint. Makes NO
5262
+ # outbound call — needs only integrations:read
5263
+ octwin integrations test <key> # a LIVE call to its health: operation
5264
+ # (integrations:write). Exits 1 when it fails.
5265
+
5266
+ THE DELIVERY LOG:
5267
+ octwin integrations deliveries [--status s] [--operation id] [--limit n]
5268
+ octwin integrations deliveries <id> # + the redacted request/response snapshots
5269
+ octwin integrations retry|cancel|send-now <id> # integrations:write
5270
+ octwin integrations events # INBOUND events (what arrived at your webhook)
5271
+
5272
+ retry/cancel answer 409 when the delivery is in the wrong state; the message
5287
5273
  carries the rule.`,
5288
- journeys: `octwin journeys [journeyId] [--funnel|--overview|--goals|--trends|--cost|--definition]
5289
- [--stage <stageId>] [--limit n] [--json]
5290
- No args = the journeys the pack declares. With an id, one of six views —
5291
- --funnel (default) stage-by-stage reach and drop-off · --overview entered vs
5292
- converted plus the biggest drop-off · --goals completions, contacts, value and
5293
- p50 time · --trends per-bucket activity · --cost tokens and dollars per goal ·
5294
- --definition what was DECLARED, unmeasured (the one view that works with no
5295
- traffic). Needs journeys:read.
5296
-
5297
- --stage <stageId> lists the runs sitting at a stage right now (a live snapshot,
5298
- not the funnel's cumulative reached counts).
5299
-
5300
- Same flag grammar as \`octwin analytics\` on purpose: a journey funnel and an
5301
- entity funnel are the same question about different subjects. Journeys carry RBAC
5302
- on top of the scope, so an empty answer can be a missing \`view\` grant rather
5274
+ journeys: `octwin journeys [journeyId] [--funnel|--overview|--goals|--trends|--cost|--definition]
5275
+ [--stage <stageId>] [--limit n] [--json]
5276
+ No args = the journeys the pack declares. With an id, one of six views —
5277
+ --funnel (default) stage-by-stage reach and drop-off · --overview entered vs
5278
+ converted plus the biggest drop-off · --goals completions, contacts, value and
5279
+ p50 time · --trends per-bucket activity · --cost tokens and dollars per goal ·
5280
+ --definition what was DECLARED, unmeasured (the one view that works with no
5281
+ traffic). Needs journeys:read.
5282
+
5283
+ --stage <stageId> lists the runs sitting at a stage right now (a live snapshot,
5284
+ not the funnel's cumulative reached counts).
5285
+
5286
+ Same flag grammar as \`octwin analytics\` on purpose: a journey funnel and an
5287
+ entity funnel are the same question about different subjects. Journeys carry RBAC
5288
+ on top of the scope, so an empty answer can be a missing \`view\` grant rather
5303
5289
  than missing data — the output says which causes are possible.`,
5304
- performance: `octwin performance [--detail] [--json]
5305
- The project's business indicators — value produced, conversion, duration — each
5306
- with its delta against the previous window and a \`why\` naming the declaration it
5307
- came from. --detail adds the per-indicator breakdown.
5308
-
5309
- Needs records:read, NOT a performance scope (there is none), so a read-only token
5310
- already reaches it. Indicators are DERIVED: a pack that declares no journey goal
5290
+ performance: `octwin performance [--detail] [--json]
5291
+ The project's business indicators — value produced, conversion, duration — each
5292
+ with its delta against the previous window and a \`why\` naming the declaration it
5293
+ came from. --detail adds the per-indicator breakdown.
5294
+
5295
+ Needs records:read, NOT a performance scope (there is none), so a read-only token
5296
+ already reaches it. Indicators are DERIVED: a pack that declares no journey goal
5311
5297
  value and no pipelined entity produces none, which is a different thing from zero.`,
5312
- usage: `octwin usage [--json]
5313
- Model calls, tokens and cost for the resolved scope — project when one is pinned
5314
- or passed with --project, otherwise the whole workspace. Broken down by model,
5315
- kind, agent and channel.
5316
-
5317
- Needs no particular scope: any valid token reaches it.
5318
-
5319
- This is MODEL spend only. WhatsApp/Meta message billing is operator-only and
5298
+ usage: `octwin usage [--json]
5299
+ Model calls, tokens and cost for the resolved scope — project when one is pinned
5300
+ or passed with --project, otherwise the whole workspace. Broken down by model,
5301
+ kind, agent and channel.
5302
+
5303
+ Needs no particular scope: any valid token reaches it.
5304
+
5305
+ This is MODEL spend only. WhatsApp/Meta message billing is operator-only and
5320
5306
  deliberately outside the token scope registry — no API token can read it.`,
5321
- 'platform-kb': `octwin platform-kb [pull] [--if-stale] [--check] [--dir .] [--url <url>] [--token <t>]
5322
- Pull the platform capability reference (markdown + JSON catalogs) into
5323
- .octwin/platform-kb/ for the octwin-pack authoring skill, plus three maps:
5324
- INDEX.md (the corpus) · SYMBOLS.md (every name -> its file; grep this) ·
5325
- OUTLINE.md (every heading with its line number).
5326
-
5327
- NO TOKEN NEEDED — the reference is platform stdlib and is served anonymously,
5328
- and this command never sends one. --token is accepted and ignored, so an older
5329
- script that passes it keeps working.
5330
-
5331
- --if-stale poll the platform's content_hash first and skip the download when
5332
- nothing changed. Cheap enough to run at the start of every session.
5333
- --check report only, write nothing. Exit 0 = current, 2 = stale or never
5334
- pulled, 1 = could not tell (offline / no reference served). For
5307
+ 'platform-kb': `octwin platform-kb [pull] [--if-stale] [--check] [--dir .] [--url <url>] [--token <t>]
5308
+ Pull the platform capability reference (markdown + JSON catalogs) into
5309
+ .octwin/platform-kb/ for the octwin-pack authoring skill, plus three maps:
5310
+ INDEX.md (the corpus) · SYMBOLS.md (every name -> its file; grep this) ·
5311
+ OUTLINE.md (every heading with its line number).
5312
+
5313
+ NO TOKEN NEEDED — the reference is platform stdlib and is served anonymously,
5314
+ and this command never sends one. --token is accepted and ignored, so an older
5315
+ script that passes it keeps working.
5316
+
5317
+ --if-stale poll the platform's content_hash first and skip the download when
5318
+ nothing changed. Cheap enough to run at the start of every session.
5319
+ --check report only, write nothing. Exit 0 = current, 2 = stale or never
5320
+ pulled, 1 = could not tell (offline / no reference served). For
5335
5321
  scripts and agent loops that want to branch without parsing prose.`,
5336
- test: `octwin test [--dir .]
5322
+ test: `octwin test [--dir .]
5337
5323
  Alias for \`octwin validate --remote\` — the full platform check.`,
5338
- memos: `octwin memos [--all] [--json]
5339
- Read what the platform has told you: a REPLY to a report you sent with
5340
- \`octwin feedback\`, or a NOTICE published to every author (a new capability,
5341
- a deprecation, a breaking change). Bodies are printed in full.
5342
- Reading marks them read, so the reminder stops. --all re-reads history and
5343
- acks nothing. --json to branch on \`severity\`
5324
+ memos: `octwin memos [--all] [--json]
5325
+ Read what the platform has told you: a REPLY to a report you sent with
5326
+ \`octwin feedback\`, or a NOTICE published to every author (a new capability,
5327
+ a deprecation, a breaking change). Bodies are printed in full.
5328
+ Reading marks them read, so the reminder stops. --all re-reads history and
5329
+ acks nothing. --json to branch on \`severity\`
5344
5330
  (info | action_required | breaking).`,
5345
- feedback: `octwin feedback [--dir .]
5346
- Submit this pack's FEEDBACK.md to the platform team.
5347
- The octwin-pack skill writes that file in its last step — findings grouped by
5348
- owner (A · CLI, B · Platform, C · Skill/KB). This delivers it instead of asking
5349
- you to paste it into a chat.
5350
- Attaches the pack id + version from manifest.yaml, this CLI's version, and the
5351
- content_hash of the capability reference in .octwin/platform-kb/ — triage needs
5352
- the last two to tell "the platform is wrong" from "that was already fixed" or
5331
+ feedback: `octwin feedback [--dir .]
5332
+ Submit this pack's FEEDBACK.md to the platform team.
5333
+ The octwin-pack skill writes that file in its last step — findings grouped by
5334
+ owner (A · CLI, B · Platform, C · Skill/KB). This delivers it instead of asking
5335
+ you to paste it into a chat.
5336
+ Attaches the pack id + version from manifest.yaml, this CLI's version, and the
5337
+ content_hash of the capability reference in .octwin/platform-kb/ — triage needs
5338
+ the last two to tell "the platform is wrong" from "that was already fixed" or
5353
5339
  "you were reading a stale reference". Needs the \`pack:deploy\` scope.`,
5354
5340
  };
5355
5341
  async function main() {
@@ -17,11 +17,18 @@
17
17
  * checks that were catching real bugs. So the rule is: **report only what is
18
18
  * unambiguous, and walk away from anything else.**
19
19
  *
20
- * It reports exactly four things:
20
+ * It reports exactly five things:
21
21
  * 1. a key not in `properties` where `additionalProperties: false`
22
22
  * 2. a missing `required` key
23
23
  * 3. a scalar whose `type` is plainly wrong
24
24
  * 4. a value outside a closed `enum`
25
+ * 5. a map KEY outside `propertyNames` (`enum` or `pattern`)
26
+ *
27
+ * Rule 5 was added 2026-09-06 and is the reason the RBAC vocabulary is worth publishing at all: a
28
+ * map's keys carry meaning in `roles.yaml` (grant resource keys, verb keys), and reading only
29
+ * VALUES meant an author could not learn about a bad key until `--remote`. It is safe under the
30
+ * false-positive rule above because it is a faithful replay — the same enum membership and the same
31
+ * regex engine the platform's own Zod runs.
25
32
  *
26
33
  * It STOPS DESCENDING (reports nothing at all for that subtree) at any node
27
34
  * carrying `anyOf` / `oneOf` / `allOf` / `not`, at an unresolvable `$ref`, and at
@@ -142,6 +149,48 @@ function walk(value, schema, path, defs, out, file, depth) {
142
149
  const obj = value;
143
150
  const props = isObj(schema.properties) ? schema.properties : undefined;
144
151
  const addl = schema.additionalProperties;
152
+ // 5. KEY vocabulary — `propertyNames` on a map schema.
153
+ //
154
+ // The fifth rule, and the one this file existed without for its whole life. A map's KEYS carry
155
+ // meaning in three declarations (`roles.yaml` grants and verbs, `xrm.yaml` entity names), and the
156
+ // walker read only values — so a pack author following `craft/manifest.md` wrote `case:` where
157
+ // the key is `record.case`, passed offline `validate`, and learned the truth from a `--remote`
158
+ // round-trip that reported one bad guess at a time. They abandoned custom RBAC over it.
159
+ //
160
+ // Safe to report because it is a FAITHFUL REPLAY: the same `enum` membership and the same JS
161
+ // regex engine Zod itself runs, over a pattern the platform generated. A false positive would
162
+ // require the published schema to disagree with the platform that published it.
163
+ const names = isObj(schema.propertyNames) ? schema.propertyNames : undefined;
164
+ if (names) {
165
+ const allowed = Array.isArray(names.enum) ? names.enum : undefined;
166
+ const pattern = typeof names.pattern === 'string' ? names.pattern : undefined;
167
+ let re;
168
+ // A pattern the local engine cannot compile is out of subset, exactly like a combinator —
169
+ // walk away rather than guess. (JSON Schema permits ECMA-262; this IS that engine, so in
170
+ // practice only a future dialect change lands here.)
171
+ if (pattern) {
172
+ try {
173
+ re = new RegExp(pattern);
174
+ }
175
+ catch {
176
+ re = undefined;
177
+ }
178
+ }
179
+ for (const k of Object.keys(obj)) {
180
+ if (allowed && !allowed.includes(k)) {
181
+ out.push({
182
+ file, path: path ? `${path}.${k}` : k,
183
+ message: `not a valid key here — must be one of ${allowed.map(e => JSON.stringify(e)).join(', ')}`,
184
+ });
185
+ }
186
+ else if (re && !re.test(k)) {
187
+ out.push({
188
+ file, path: path ? `${path}.${k}` : k,
189
+ message: `not a valid key here — it must match ${pattern}`,
190
+ });
191
+ }
192
+ }
193
+ }
145
194
  // A map schema (`additionalProperties: <schema>`, no `properties`) — every
146
195
  // value shares one shape. This is how `entities:` and `agents:` are declared.
147
196
  if (!props && isObj(addl)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octwin-cli",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "description": "Octwin external-pack developer CLI (by CEQUENS) — scaffold, validate, deploy, and check pure-YAML packs on your tenant.",
5
5
  "type": "module",
6
6
  "bin": {