@tikoci/centrs 0.1.3 → 0.1.6
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 +348 -0
- package/GLOSSARY.txt +252 -0
- package/LICENSE +21 -0
- package/README.md +44 -12
- package/commands/AGENTS.md +14 -5
- package/commands/api/AGENTS.md +13 -1
- package/commands/api/README.md +56 -26
- package/commands/api/examples.md +46 -1
- package/commands/btest/README.md +21 -32
- package/commands/check/README.md +6 -1
- package/commands/discover/README.md +5 -11
- package/commands/execute/README.md +77 -36
- package/commands/execute/examples.md +120 -10
- package/commands/explain/README.md +2756 -0
- package/commands/explain/examples.md +702 -0
- package/commands/mcp/README.md +7 -4
- package/commands/mcp/examples.md +2 -2
- package/commands/retrieve/README.md +25 -27
- package/commands/retrieve/examples.md +16 -0
- package/commands/terminal/examples.md +7 -1
- package/commands/transfer/README.md +28 -20
- package/commands/transfer/examples.md +29 -0
- package/docs/CLI.md +353 -0
- package/docs/CONSTITUTION.md +138 -30
- package/docs/MATRIX.md +92 -18
- package/docs/errors/README.md +3 -0
- package/docs/errors/quickchr/machine-not-found.md +22 -0
- package/docs/errors/quickchr/machine-stopped.md +20 -0
- package/docs/errors/quickchr/package-unavailable.md +27 -0
- package/docs/errors/quickchr/unsupported-via.md +35 -0
- package/docs/errors/quickchr/unsupported.md +35 -0
- package/docs/errors/routeros/version-unsupported.md +26 -0
- package/docs/errors/transport/provider-trust.md +29 -0
- package/docs/errors/usage/stdin-ignored.md +28 -0
- package/docs/errors/validation/syntax.md +29 -4
- package/docs/errors/validation/unknown-attribute.md +37 -4
- package/package.json +56 -10
- package/src/api-fanout.ts +46 -18
- package/src/api.ts +351 -121
- package/src/cli/api.ts +26 -7
- package/src/cli/btest.ts +19 -3
- package/src/cli/execute.ts +25 -6
- package/src/cli/explain.ts +503 -0
- package/src/cli/retrieve.ts +33 -1
- package/src/cli/selection.ts +71 -11
- package/src/cli/settings.ts +2 -2
- package/src/cli/terminal.ts +1 -1
- package/src/cli/transfer.ts +23 -6
- package/src/cli.ts +15 -2
- package/src/core/envelope.ts +58 -2
- package/src/core/error-catalog.ts +42 -1
- package/src/core/execute-command.ts +148 -0
- package/src/core/inspect.ts +36 -4
- package/src/core/preflight.ts +306 -0
- package/src/core/routeros-string.ts +24 -0
- package/src/core/version.ts +4 -0
- package/src/core/yaml.ts +86 -0
- package/src/errors.ts +1 -0
- package/src/execute-fanout.ts +47 -18
- package/src/execute.ts +339 -307
- package/src/explain/arg-tokens.ts +151 -0
- package/src/explain/args.ts +1749 -0
- package/src/explain/blocks.ts +175 -0
- package/src/explain/brace-slots.ts +143 -0
- package/src/explain/brace-tokens.ts +39 -0
- package/src/explain/catalog.ts +1343 -0
- package/src/explain/coordinates.ts +488 -0
- package/src/explain/defects.ts +218 -0
- package/src/explain/escape-tokens.ts +77 -0
- package/src/explain/highlight-projection.ts +308 -0
- package/src/explain/is-known-menu.ts +17 -0
- package/src/explain/menus.ts +668 -0
- package/src/explain/operator-tokens.ts +316 -0
- package/src/explain/operators.ts +465 -0
- package/src/explain/path-tokens.ts +150 -0
- package/src/explain/pathresolve.ts +1569 -0
- package/src/explain/quoted-string.ts +331 -0
- package/src/explain/scope-brace.ts +461 -0
- package/src/explain/segment.ts +1165 -0
- package/src/explain/separator.ts +187 -0
- package/src/explain/split-owner.ts +194 -0
- package/src/explain/string-tokens.ts +77 -0
- package/src/explain/symbol-values.ts +556 -0
- package/src/explain/symbols.ts +1617 -0
- package/src/explain/token-ranges.ts +72 -0
- package/src/explain/transport.ts +514 -0
- package/src/explain/value-tokens.ts +83 -0
- package/src/explain/values.ts +357 -0
- package/src/explain/verbs.ts +64 -0
- package/src/explain/verbsplit.ts +955 -0
- package/src/explain/write.ts +856 -0
- package/src/explain.ts +2602 -0
- package/src/index.ts +225 -6
- package/src/mcp/server.ts +2 -1
- package/src/offline-gate.ts +148 -0
- package/src/protocols/mac-telnet-console.ts +61 -17
- package/src/resolver/facts.ts +1 -1
- package/src/resolver/index.ts +23 -4
- package/src/resolver/quickchr-provider.ts +597 -0
- package/src/resolver/selection.ts +99 -12
- package/src/resolver/service-endpoint.ts +155 -0
- package/src/resolver/target.ts +1 -1
- package/src/retrieve-fanout.ts +27 -13
- package/src/retrieve.ts +82 -77
- package/src/settings.ts +2 -1
- package/src/transfer-fanout.ts +43 -26
- package/src/transfer.ts +88 -45
package/commands/mcp/README.md
CHANGED
|
@@ -80,8 +80,8 @@ benchmarked RouterOS agent support. Load-bearing findings that shape this design
|
|
|
80
80
|
rejected. RouterOS 7.23 no longer reproduces that exact `blackhole=yes` case,
|
|
81
81
|
but the lesson stands: schema-presence is not parser-acceptance.
|
|
82
82
|
`:put [:parse "<cmd>"]` runs the real parser, and centrs runs **both** `:parse`
|
|
83
|
-
and `/console/inspect`, so the MCP exposes validation as a
|
|
84
|
-
**dry-run** tool (`centrs_validate`) that never mutates.
|
|
83
|
+
and `/console/inspect request=child`, so the MCP exposes validation as a
|
|
84
|
+
first-class **dry-run** tool (`centrs_validate`) that never mutates.
|
|
85
85
|
- **Stateful intents need device-validate-before-apply.** Gold using
|
|
86
86
|
`interface=ether2` fails on a CHR exposing only `ether1`. Pair `execute` with
|
|
87
87
|
cheap readback (`retrieve`).
|
|
@@ -104,7 +104,7 @@ benchmarked RouterOS agent support. Load-bearing findings that shape this design
|
|
|
104
104
|
| Tool | Core mapping | Reads/Writes | Target source |
|
|
105
105
|
| ---- | ------------ | ------------ | ------------- |
|
|
106
106
|
| `centrs_explain` | `canonicalizeExecuteCommand` | offline, none | none (string only) |
|
|
107
|
-
| `centrs_validate` | execute validation only
|
|
107
|
+
| `centrs_validate` | execute validation only, **no run**: offline analysis, then the device stage — `:put [:parse ...]` alone over ssh/mac-telnet, `:parse` + `/console/inspect` for structured REST/native | read-only | CDB |
|
|
108
108
|
| `centrs_retrieve` | `retrieve` / `retrieveGroup` | read-only | CDB |
|
|
109
109
|
| `centrs_execute` | `execute` | read or write | CDB |
|
|
110
110
|
| `centrs_devices` | `devices` (`list`/`show`/`groups`/`add`/`edit`/`set`/`remove`) | CDB read/write | CDB file |
|
|
@@ -118,7 +118,10 @@ benchmarked RouterOS agent support. Load-bearing findings that shape this design
|
|
|
118
118
|
- `centrs_validate` is the headline distilled from the bench: a dry-run that runs
|
|
119
119
|
the real parser plus schema inspection against a registered target and returns
|
|
120
120
|
the validation envelope **without executing**. Use it to reject schema-invalid
|
|
121
|
-
commands before any write.
|
|
121
|
+
commands before any write. It shares `execute`'s two-stage gate (constitution:
|
|
122
|
+
validation is the product, GH#354), so a syntax fault comes back from the
|
|
123
|
+
offline stage with a byte span and without contacting the target at all, and
|
|
124
|
+
`meta.validation.stages[]` says which stage spoke.
|
|
122
125
|
- `centrs_retrieve` mirrors `retrieve`, including attribute projection,
|
|
123
126
|
`listAttributes`, and `group` fanout.
|
|
124
127
|
- `centrs_execute` mirrors `execute`. Read-shaped commands run subject only to
|
package/commands/mcp/examples.md
CHANGED
|
@@ -65,8 +65,8 @@ matters for the bench gold-bug in example 4.
|
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
Envelope: `ok: false`, `error.code = "validation/unknown-attribute"` — the
|
|
68
|
-
`/console/inspect` semantic gate rejects the unknown attribute and
|
|
69
|
-
created**. This proves the validate tool fails closed on bad input.
|
|
68
|
+
`/console/inspect request=child` semantic gate rejects the unknown attribute and
|
|
69
|
+
**no route is created**. This proves the validate tool fails closed on bad input.
|
|
70
70
|
|
|
71
71
|
> Bench note: the bench's original gold-bug command
|
|
72
72
|
> `/ip/route/add dst-address=10.99.0.0/24 blackhole=yes` (where `/console/inspect`
|
|
@@ -43,37 +43,32 @@ centrs retrieve <router> snmp <oid|MIB name> [flags]
|
|
|
43
43
|
|
|
44
44
|
## Flags
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Implemented flags are generated from the CLI metadata into
|
|
47
|
+
[`docs/CLI.md` → retrieve](../../docs/CLI.md#retrieve); this file does not
|
|
48
|
+
duplicate that table. Behavior notes the generated reference cannot carry:
|
|
49
|
+
|
|
50
|
+
- `--format json` (shortcut `--json`): set `CENTRS_FORMAT=json` to make the
|
|
51
|
+
structured envelope the default. `--format yaml` renders the same envelope.
|
|
52
|
+
- `--port`: native-api defaults to 8728; `--port 8729` selects TLS `api-ssl`.
|
|
53
|
+
- `--query`/`--filter` are RouterOS **row** filters and always return an
|
|
54
|
+
array (see Synopsis); `--where` filters *which devices* fan out, not rows.
|
|
55
|
+
- `--all-attributes` conflicts with `--attribute(s)` (see Validation).
|
|
56
|
+
- `--quickchr` resolves host/port/auth from the live `@tikoci/quickchr`
|
|
57
|
+
(0.4.5+, optional dependency) descriptor, bypassing CDB/env resolution for
|
|
58
|
+
those fields.
|
|
59
|
+
|
|
60
|
+
### Designed, not implemented
|
|
61
|
+
|
|
62
|
+
Spec-tier flags with no implementation yet — today they fail as unknown flags:
|
|
63
|
+
|
|
64
|
+
| Flag | Designed behavior |
|
|
47
65
|
| ----------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
48
|
-
| `--attribute <name>` | Project a single attribute. Repeatable, or comma-separated. |
|
|
49
|
-
| `--attributes <a,b,c>` | Alias for `--attribute` with comma-separated input. |
|
|
50
|
-
| `--all-attributes` | Equivalent to RouterOS `details=true`. Mutually exclusive with `--attribute(s)`. |
|
|
51
|
-
| `--list-attributes` (alias `--list`) | Return the available attribute names for the path. No `print`/`get` is run. |
|
|
52
66
|
| `--once` | Bounded single read of a monitor-style menu (RouterOS `once`): returns **one** envelope and never follows. Open-ended follow is `api … --stream`. See constitution: protocol selection. |
|
|
53
|
-
| `--
|
|
54
|
-
| `--filter <expr>` | RouterOS row filter; same `.query` mapping and not-implemented handling as `--query`. |
|
|
55
|
-
| `--where <attr>=<value>` | Device-class selector: fan out across CDB records whose stored fact/comment-kv matches (e.g. `--where board=RB5009`). Repeatable (AND). Filters *which devices*, not RouterOS rows. See constitution: target selection. |
|
|
56
|
-
| `--max-bytes <n>` | Byte budget for the rendered payload. If the response would exceed it, centrs truncates to fit, keeps `ok: true`, and adds a warning + `meta.truncated`. Not an error. (Renamed from `--max-results`; the legacy flag still parses until the code split lands.) |
|
|
67
|
+
| `--max-bytes <n>` | Byte budget for the rendered payload. If the response would exceed it, centrs truncates to fit, keeps `ok: true`, and adds a warning + `meta.truncated`. Not an error. (Will replace the implemented `--max-results`, which fails instead of truncating.) |
|
|
57
68
|
| `--max-rows <n>` | Maximum row count for list reads. Excess rows are clipped; `ok: true` with a warning + `meta.truncated`. |
|
|
58
|
-
| `--
|
|
59
|
-
| `--format json` (alias `--json`) | Structured JSON envelope (set `CENTRS_FORMAT=json` to make it the default). |
|
|
60
|
-
| `--format yaml` (alias `--yaml`) | YAML rendering of the same envelope. |
|
|
61
|
-
| `--resolve <none\|arp>` | Resolve a MAC-address target to an IP via the host ARP cache. Default `none`. |
|
|
62
|
-
| `--via <protocol>` | Pin the transport (`rest-api` default, or `native-api`). No silent downgrade. See constitution: protocol selection. |
|
|
63
|
-
| `--validate=false` | Escape hatch; default is `true`. See constitution: validation is the product. |
|
|
64
|
-
| `--timeout <ms>` | Request timeout. REST: ≤ 60000. native-api allows longer. |
|
|
65
|
-
| `--username` (alias `--user`, `-u`) / `--password` | Override CDB-resolved or env credentials. |
|
|
66
|
-
| `--host <host\|url>` | Override the resolved host or base URL for the target. |
|
|
67
|
-
| `--port <n>` | Override the transport port. native-api defaults to 8728 (TLS api-ssl when `--port 8729`).|
|
|
68
|
-
| `--cdb-file` / `--cdb-password` | Override CDB file location / decrypt password. |
|
|
69
|
+
| `--yaml` | Shortcut for `--format yaml`. |
|
|
69
70
|
| `--ros-version <version>` | SNMP MIB lookup only: pin the MikroTik MIB version to cache/download. |
|
|
70
71
|
| `--ros-channel <channel>` | SNMP MIB lookup only: `stable`, `long-term`, `testing`, or `development`; default `stable`. |
|
|
71
|
-
| `--group <name>` | Fan out across every CDB target in WinBox group `<name>`. Repeatable, and combinable with `<router>` positionals plus `--all`/`--default`; the union is de-duped by CDB record index. See **Target selection**. |
|
|
72
|
-
| `--all` | Fan out across every CDB record (excludes the reserved `__default__`). See **Target selection**. |
|
|
73
|
-
| `--default` | Select the reserved `__default__` record. See **Target selection**. |
|
|
74
|
-
| `--near <lat>,<lon>,<radius>` | Geo selector: fan out across CDB records whose GPS is within the great-circle radius (units `m`/`km`/`mi`/`ft`; bare = km). Lat-first. Union predicate; geo-less devices never match. See **Target selection**. |
|
|
75
|
-
| `--bbox <south>,<west>,<north>,<east>` | Geo selector: fan out across CDB records whose GPS is inside the lat-first bounding box. Union predicate. See **Target selection**. |
|
|
76
|
-
| `--concurrency <n>` | Max in-flight targets during fanout (integer ≥ 1). Defaults are transport-aware: `rest-api` 8, `native-api` 4. Rejected with `usage/invalid-concurrency` otherwise. |
|
|
77
72
|
|
|
78
73
|
## Validation
|
|
79
74
|
|
|
@@ -157,7 +152,10 @@ granular **0/2/1 exit code** are all normative in
|
|
|
157
152
|
[`docs/CONSTITUTION.md` → Target selection grammar](../../docs/CONSTITUTION.md#target-selection-grammar).
|
|
158
153
|
The boundary is intent-keyed: a plain single-positional `retrieve <router> <path>`
|
|
159
154
|
stays the single-target envelope; a selector flag or a second positional target
|
|
160
|
-
switches to fan-out.
|
|
155
|
+
switches to fan-out. `--quickchr <name>` (the named-live-provider) behaves like a
|
|
156
|
+
lone positional: one flag stays single-target, repeating it fans out, and mixing
|
|
157
|
+
it with positionals or CDB selectors is `usage/conflicting-flags` (constitution:
|
|
158
|
+
resolution providers).
|
|
161
159
|
|
|
162
160
|
retrieve-specific behavior on top of the shared engine:
|
|
163
161
|
|
|
@@ -335,3 +335,19 @@ centrs retrieve $A /system/resource --attribute bogus-attr --via native-api --po
|
|
|
335
335
|
```bash
|
|
336
336
|
centrs retrieve $A /system/resource --via native-api --port $API_PORT --username wrong --password wrong
|
|
337
337
|
```
|
|
338
|
+
|
|
339
|
+
## quickchr targets (#134)
|
|
340
|
+
|
|
341
|
+
`$NAME` is the machine name of a running quickchr-managed CHR
|
|
342
|
+
(`quickchr list`). No `$R`/`$U`/`$P` — host/port/auth come from the live
|
|
343
|
+
descriptor. Covered by `test/integration/quickchr-target.test.ts`.
|
|
344
|
+
|
|
345
|
+
### Q1. `--quickchr <name>` resolves the VM's REST endpoint
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
centrs retrieve --quickchr $NAME /system/resource --json
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Envelope: `ok: true`, `meta.via=rest-api` (normal default; quickchr does not
|
|
352
|
+
change protocol selection), `meta.target.source.kind=provider`,
|
|
353
|
+
`meta.target.identity=$NAME`, no `recordIndex` (the CDB was never consulted).
|
|
@@ -42,6 +42,9 @@ printf '/system/identity/print\n' | centrs terminal $MAC --via mac-telnet --host
|
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
stdout contains the device identity (cross-checked against REST). Exit code `0`.
|
|
45
|
+
RouterOS 7.23.6/7.24.3/7.25beta4 print a one-property menu's value one
|
|
46
|
+
character per line (GH#352), so the comparison collapses `print` column
|
|
47
|
+
wrapping on both sides rather than asserting the device's layout.
|
|
45
48
|
|
|
46
49
|
### T2. `--via rest-api` has no terminal capability
|
|
47
50
|
|
|
@@ -99,7 +102,10 @@ analog of T4** (a piped subprocess stdin cannot be a TTY), not in CI.
|
|
|
99
102
|
printf '/system/identity/print\n/quit\n' | centrs terminal 127.0.0.1 --via ssh --port $SSH_PORT --username $U --ssh-key $KEY --insecure
|
|
100
103
|
```
|
|
101
104
|
|
|
102
|
-
stdout contains the device identity (cross-checked against REST).
|
|
105
|
+
stdout contains the device identity (cross-checked against REST).
|
|
106
|
+
RouterOS 7.23.6/7.24.3/7.25beta4 print a one-property menu's value one
|
|
107
|
+
character per line (GH#352), so the comparison collapses `print` column
|
|
108
|
+
wrapping on both sides rather than asserting the device's layout. centrs returns
|
|
103
109
|
ssh's exit code (a no-PTY console closed by EOF can exit non-zero — that is the
|
|
104
110
|
device/ssh's result, not a centrs failure; a clean `/quit` from a real TTY exits
|
|
105
111
|
`0`).
|
|
@@ -154,27 +154,35 @@ is an explicit `--via scp` escape hatch. The reason is capability, not taste:
|
|
|
154
154
|
|
|
155
155
|
## Flags
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
Implemented flags are generated from the CLI metadata into
|
|
158
|
+
[`docs/CLI.md` → transfer](../../docs/CLI.md#transfer); this file does not
|
|
159
|
+
duplicate that table. Behavior notes the generated reference cannot carry:
|
|
160
|
+
|
|
161
|
+
- `--force`/`--overwrite` applies to the destination side (the local file for
|
|
162
|
+
`download`, the remote file for `upload`); the default refuses an existing
|
|
163
|
+
target with `usage/target-exists` (see *Validation*).
|
|
164
|
+
- `--verify` details and the sftp size caveat are in *Integrity*.
|
|
165
|
+
- `--timeout`: `rest`/`native` are per-request ≤ 60000 ms (a chunked read is
|
|
166
|
+
many short requests, each capped); `sftp` accepts longer for a single large
|
|
167
|
+
transfer.
|
|
168
|
+
- `--ssh-key` is the same `sshKey` setting as `terminal`/`execute`
|
|
169
|
+
(`CENTRS_SSH_KEY`, CDB `ssh-key=`); when unset, the ssh-agent /
|
|
170
|
+
`~/.ssh/config` is used. See `commands/terminal/README.md`.
|
|
171
|
+
- `--insecure` adds a `transport/insecure-trust` warning (constitution:
|
|
172
|
+
transport trust).
|
|
173
|
+
- `--quickchr` resolves host/port/auth from the live `@tikoci/quickchr`
|
|
174
|
+
(0.4.5+, optional dependency) descriptor. `--via sftp` additionally
|
|
175
|
+
requires the descriptor's SSH endpoint to advertise a batch-capable auth
|
|
176
|
+
mode, else `quickchr/unsupported-via` (never a password prompt).
|
|
177
|
+
|
|
178
|
+
### Designed, not implemented
|
|
179
|
+
|
|
180
|
+
Spec-tier flags with no implementation yet — today they fail as unknown flags:
|
|
181
|
+
|
|
182
|
+
| Flag | Designed behavior |
|
|
183
|
+
| ---- | ----------------- |
|
|
166
184
|
| `--advertise-host <host>` / `--advertise-port <n>` / `--bind <addr>` | `fetch` only *(deferred)*: the host/IP/port centrs advertises in the fetch URL and the local bind address. Default: auto-detect the local IP on the route to the router; ephemeral port; single-use random URL token. |
|
|
167
|
-
| `--resolve <none\|arp>` |
|
|
168
|
-
| `--format text` (default) | Human summary: method, bytes, duration, verified. Errors print `[code] summary` + `Fix:` lines. |
|
|
169
|
-
| `--format json` (alias `--json`) / `--format yaml` (alias `--yaml`) | Structured envelope. `CENTRS_FORMAT=json` makes JSON the default. |
|
|
170
|
-
| `--validate=false` | Escape hatch; default `true`. See constitution: validation is the product. |
|
|
171
|
-
| `--timeout <ms>` | Request timeout. `rest`/`native` per-request ≤ 60000 (a chunked read is many short requests, each capped); `sftp`/`scp`/`fetch` accept longer for a single large transfer. |
|
|
172
|
-
| `--username` / `--password` | Override CDB-resolved or env credentials. |
|
|
173
|
-
| `--host <host\|url>` / `--port <n>` | Override the resolved host / transport port. |
|
|
174
|
-
| `--ssh-key <path>` | `sftp` (and future `scp`): explicit private-key path. Same `sshKey` setting as `terminal`/`execute` (`CENTRS_SSH_KEY`, CDB `ssh-key=`). When unset, the ssh-agent / `~/.ssh/config` is used. See `commands/terminal/README.md`. |
|
|
175
|
-
| `--insecure` | Accept a self-signed TLS cert (`https`/`api-ssl`) or a new SSH host key (TOFU). Default verifies; see constitution: transport trust. Adds a `transport/insecure-trust` warning. |
|
|
176
|
-
| `--cdb-file` / `--cdb-password` | Override CDB file location / decrypt password. |
|
|
177
|
-
| `--group <name>` / `--where <attr>=<value>` / `--near <lat>,<lon>,<radius>` / `--bbox <south>,<west>,<north>,<east>` / `--all` / `--default` / `--concurrency <n>` | Fan out across CDB targets (e.g. push one firmware file to a fleet). Same selector grammar and per-target envelope as `retrieve`/`execute` (constitution: target selection). `--near`/`--bbox` select by device GPS (lat-first). `download` fan-out requires `--out-dir`; `remove`/`mkdir`/`copy`/`upload` fan out directly and are `--yes`-gated. See **Target selection**. |
|
|
185
|
+
| `--resolve <none\|arp>` | Resolve a MAC-address target to an IP via the host ARP cache. Default `none`. |
|
|
178
186
|
|
|
179
187
|
## Target selection
|
|
180
188
|
|
|
@@ -432,3 +432,32 @@ centrs transfer $R upload $SRC centrs-up.txt --via ftp --username $U --password
|
|
|
432
432
|
Envelope: `ok: false`, the error reports the protocol is gated (the cleartext-FTP
|
|
433
433
|
opt-in is absent). When `ALLOW_UNSAFE_PROTOCOLS=ftp` is set but the method is not
|
|
434
434
|
yet built, it is `usage/not-implemented` instead.
|
|
435
|
+
|
|
436
|
+
## quickchr targets (#134)
|
|
437
|
+
|
|
438
|
+
`$NAME` is the machine name of a running quickchr-managed CHR. Host/port/auth
|
|
439
|
+
come from the live descriptor. Covered by
|
|
440
|
+
`test/integration/quickchr-target.test.ts`.
|
|
441
|
+
|
|
442
|
+
### Q1. `list` over the descriptor's REST service
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
centrs transfer --quickchr $NAME list --json
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Envelope: `ok: true`, `meta.target.source.kind=provider`.
|
|
449
|
+
|
|
450
|
+
### Q2. `--via sftp` gates on the SSH endpoint's batch auth
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
centrs transfer --quickchr $NAME list --via sftp --json
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
When the descriptor's SSH endpoint advertises a **usable** batch-capable auth
|
|
457
|
+
mode (`agent-or-config`, or `private-key` together with a verified
|
|
458
|
+
`privateKeyPath` — a bare `private-key` mode with no path does not count), the
|
|
459
|
+
list succeeds over sftp: `meta.via=sftp`, `meta.target.source.kind=provider`,
|
|
460
|
+
`meta.settings.insecure` provider-sourced, and the key path (when one is
|
|
461
|
+
handed over) carried as a provider-sourced `sshKey`. Otherwise the envelope is
|
|
462
|
+
`ok: false` with `error.code=quickchr/unsupported-via` and exit code 1 — a
|
|
463
|
+
typed gate, **never** a password prompt and never a silent fallback to REST.
|
package/docs/CLI.md
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# centrs CLI reference
|
|
2
|
+
|
|
3
|
+
<!-- GENERATED FILE — do not edit. Regenerate with `bun run docs:cli`. -->
|
|
4
|
+
<!-- Source of truth: the CliCommandMetadata objects in src/cli/*.ts -->
|
|
5
|
+
|
|
6
|
+
Every flag below is generated from the same metadata that renders
|
|
7
|
+
`centrs <command> --help`; CI fails when this file and the metadata drift
|
|
8
|
+
(`bun run docs:cli --check`). Behavior, examples, and designed-but-not-yet
|
|
9
|
+
implemented flags live in each command's `commands/<name>/README.md`.
|
|
10
|
+
|
|
11
|
+
| Command | Summary |
|
|
12
|
+
| ------- | ------- |
|
|
13
|
+
| [`retrieve`](#retrieve) | Read RouterOS values through the shared core using the selected protocol. |
|
|
14
|
+
| [`execute`](#execute) | Run a RouterOS read or write command via native API, REST, or mac-telnet. |
|
|
15
|
+
| [`api`](#api) | Structured RouterOS API passthrough (gh-api style) over REST or native API. |
|
|
16
|
+
| [`transfer`](#transfer) | Copy files to/from a RouterOS device and manage device files (rest/native/sftp). |
|
|
17
|
+
| [`terminal`](#terminal) | Open an interactive RouterOS console (ssh or mac-telnet). |
|
|
18
|
+
| [`explain`](#explain) | Analyze a RouterOS command offline: canonical form, structure, and syntax diagnostics. |
|
|
19
|
+
| [`devices`](#devices) | Inspect and mutate the CDB-backed device registry. `devices` is the only command that writes the CDB. |
|
|
20
|
+
| [`discover`](#discover) | Discover RouterOS neighbors over MNDP and optionally save them into the CDB. |
|
|
21
|
+
| [`btest`](#btest) | Run MikroTik's bandwidth test as a client or server (peer measurement). |
|
|
22
|
+
| [`mcp`](#mcp) | Start the centrs MCP server (stdio) — scoped RouterOS tools gated by the CDB allowlist. |
|
|
23
|
+
| [`settings`](#settings) | Manage centrs's own global preferences (`centrs.env`) and inspect the `__default__` CDB record. |
|
|
24
|
+
|
|
25
|
+
## retrieve
|
|
26
|
+
|
|
27
|
+
Read RouterOS values through the shared core using the selected protocol.
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Usage: centrs retrieve <target> <routeros-path> [flags] | centrs retrieve <target...> <routeros-path> [flags] | centrs retrieve --group <name> <routeros-path> [flags]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Flag | Value | Description |
|
|
34
|
+
| ---- | ----- | ----------- |
|
|
35
|
+
| `--via` | `<protocol>` | Pin the protocol selector. Defaults to `rest-api` for retrieve. |
|
|
36
|
+
| `--group` | `<name>` | Fan out across every CDB record in the group (repeatable; de-duped by record index). |
|
|
37
|
+
| `--where` | `<attr>`=`<value>` | Device-class selector over CDB facts + core fields (repeatable, AND-combined). |
|
|
38
|
+
| `--near` | `<lat>`,`<lon>`,`<radius>` | Geo selector: devices whose GPS is within radius (m/km/mi/ft; bare number = km). Lat-first. |
|
|
39
|
+
| `--bbox` | `<south>`,`<west>`,`<north>`,`<east>` | Geo selector: devices whose GPS is inside the lat-first bounding box. |
|
|
40
|
+
| `--all` | | Fan out across every CDB record (excludes `__default__`). |
|
|
41
|
+
| `--default` | | Select the reserved `__default__` record. |
|
|
42
|
+
| `--quickchr` | `<name>` | Target a running quickchr-managed CHR VM by name (repeatable; fans out when repeated). Exclusive of positional targets and CDB selectors; conflicts with direct connection overrides (--host/--port/--username/--password, and --ssh-key where the command has it). |
|
|
43
|
+
| `--concurrency` | `<n>` | Max in-flight targets during fan-out (transport-aware default: rest-api 8, native-api 4). |
|
|
44
|
+
| `--host` | <host\|url> | Override the resolved host or base URL for the target. |
|
|
45
|
+
| `--port` | `<port>` | Override the resolved management port. |
|
|
46
|
+
| `--username / --user / -u` | `<name>` | RouterOS username (aliases `--user`, `-u`). Falls back to `CENTRS_USERNAME`. |
|
|
47
|
+
| `--password` | `<secret>` | RouterOS password. Falls back to `CENTRS_PASSWORD`. |
|
|
48
|
+
| `--timeout` | <ms\|5s> | Operation timeout. REST currently rejects values above 60s. |
|
|
49
|
+
| `--attribute` | `<name>` | Project one attribute. May be repeated. |
|
|
50
|
+
| `--attributes` | `<a,b>` | Project a comma-separated attribute list. |
|
|
51
|
+
| `--all-attributes` | | Request the RouterOS detail/all-attributes shape. |
|
|
52
|
+
| `--list-attributes / --list` | | List inspect-derived attributes without running the data call. |
|
|
53
|
+
| `--query / --filter` | `<expr>` | RouterOS-side row filter (maps to `.query`). Not implemented yet — returns `validation/not-implemented`. |
|
|
54
|
+
| `--format` | <text\|json\|yaml> | Output format for the CLI response. Defaults to text; use --json or --format json for the structured envelope. |
|
|
55
|
+
| `--json` | | Shortcut for `--format json`. |
|
|
56
|
+
| `--max-results` | `<bytes>` | Fail instead of printing output larger than the given byte budget. |
|
|
57
|
+
| `--cdb-file` | `<path>` | Read target credentials from a WinBox CDB file. |
|
|
58
|
+
| `--cdb-password` | `<password>` | Decrypt an encrypted WinBox CDB file. |
|
|
59
|
+
| `--resolve` | <none\|arp> | Resolve a MAC-address target to an IP via the host ARP cache (default none). |
|
|
60
|
+
| `--validate / --no-validate` | | Enable or disable inspect-backed preflight validation. |
|
|
61
|
+
| `--verbose` | | Show resolved setting sources in text output. |
|
|
62
|
+
|
|
63
|
+
## execute
|
|
64
|
+
|
|
65
|
+
Run a RouterOS read or write command via native API, REST, or mac-telnet.
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
Usage: centrs execute <target> <command> [flags] | centrs execute <target...> -- <command> [flags] | centrs execute --group <name> <command> [flags]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
| Flag | Value | Description |
|
|
72
|
+
| ---- | ----- | ----------- |
|
|
73
|
+
| `--via` | <native-api\|rest-api\|mac-telnet> | Pin the protocol selector; no silent downgrade when set. A bare MAC target defaults to mac-telnet. |
|
|
74
|
+
| `--group` | `<name>` | Fan out across every CDB record in the group (repeatable; de-duped by record index). |
|
|
75
|
+
| `--where` | `<attr>`=`<value>` | Device-class selector over CDB facts + core fields (repeatable, AND-combined). |
|
|
76
|
+
| `--near` | `<lat>`,`<lon>`,`<radius>` | Geo selector: devices whose GPS is within radius (m/km/mi/ft; bare number = km). Lat-first. |
|
|
77
|
+
| `--bbox` | `<south>`,`<west>`,`<north>`,`<east>` | Geo selector: devices whose GPS is inside the lat-first bounding box. |
|
|
78
|
+
| `--all` | | Fan out across every CDB record (excludes `__default__`). |
|
|
79
|
+
| `--default` | | Select the reserved `__default__` record. |
|
|
80
|
+
| `--quickchr` | `<name>` | Target a running quickchr-managed CHR VM by name (repeatable; fans out when repeated). Exclusive of positional targets and CDB selectors; conflicts with direct connection overrides (--host/--port/--username/--password, and --ssh-key where the command has it). |
|
|
81
|
+
| `--concurrency` | `<n>` | Max in-flight targets during fan-out (transport-aware default: rest-api 8, native-api 4). |
|
|
82
|
+
| `--host` | <host\|url> | Override the resolved host or base URL for the target. |
|
|
83
|
+
| `--port` | `<port>` | Override the resolved management port. |
|
|
84
|
+
| `--username / --user / -u` | `<name>` | RouterOS username (aliases `--user`, `-u`). Falls back to `CENTRS_USERNAME`. |
|
|
85
|
+
| `--password` | `<secret>` | RouterOS password. Falls back to `CENTRS_PASSWORD`. |
|
|
86
|
+
| `--ssh-key` | `<path>` | `--via ssh`: explicit private-key path. Falls back to `CENTRS_SSH_KEY` / the `ssh-agent`. |
|
|
87
|
+
| `--insecure` | | Disable SSH host-key verification (`--via ssh`: accepts changed/impersonated keys, not just new) or accept a self-signed `api-ssl` TLS cert. Default verifies. |
|
|
88
|
+
| `--cdb-file` | `<path>` | Read target credentials from a WinBox CDB file. |
|
|
89
|
+
| `--cdb-password` | `<password>` | Decrypt an encrypted WinBox CDB file. |
|
|
90
|
+
| `--resolve` | <none\|arp> | Resolve a MAC-address target to an IP via the host ARP cache (default none). |
|
|
91
|
+
| `--timeout` | `<duration>` | Per-request timeout (for REST, max 60s). |
|
|
92
|
+
| `--validate / --no-validate` | | Run RouterOS :parse and /console/inspect validation before execution (default true; `--validate=false` also accepted). |
|
|
93
|
+
| `--yes` | | Confirm write-shaped add/set/remove commands in non-interactive runs. |
|
|
94
|
+
| `--max-results` | `<bytes>` | Fail if the rendered envelope exceeds this byte budget. |
|
|
95
|
+
| `--format` | <text\|json\|yaml> | Output format for the CLI response. Defaults to text; use --json or --format json for the structured envelope. |
|
|
96
|
+
| `--json` | | Shortcut for `--format json`. |
|
|
97
|
+
| `--verbose` | | Include additional context in text output. |
|
|
98
|
+
| `--` | | End centrs option parsing: every following token is the literal RouterOS command, even flag-shaped ones (e.g. `-- /interface print where disabled=yes`). |
|
|
99
|
+
|
|
100
|
+
## api
|
|
101
|
+
|
|
102
|
+
Structured RouterOS API passthrough (gh-api style) over REST or native API.
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
Usage: centrs api <router> <endpoint> [flags]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Flag | Value | Description |
|
|
109
|
+
| ---- | ----- | ----------- |
|
|
110
|
+
| `-X / --method` | `<verb>` | HTTP method, default GET (case-insensitive). GET→print, PUT→add, PATCH→set, DELETE→remove, POST→run. |
|
|
111
|
+
| `-f / --field` | `<key=value>` | Body field, repeatable; assembled into the JSON body (verbatim string values). |
|
|
112
|
+
| `-d / --data` | `<json>` | Raw JSON request body. Conflicts with `-f` / `--input`. |
|
|
113
|
+
| `--input` | <file\|-> | Read the raw JSON body from a file or stdin (`-`). |
|
|
114
|
+
| `--query / --filter` | `<expr>` | RouterOS-side row filter, AND-combined, repeatable: name=value, name!=value, name>value, name<value, name. |
|
|
115
|
+
| `--raw-query` | `<word>` | Verbatim RouterOS query word (repeatable) for OR / absence / stack expressions. |
|
|
116
|
+
| `--attribute / --proplist` | `<a,b>` | Property projection → `.proplist`. |
|
|
117
|
+
| `--raw` | | Strip the envelope; emit bare RouterOS JSON. Defaults `--validate` to false (an explicit `--validate=true` still runs the gate); does not imply `--yes`. |
|
|
118
|
+
| `--yes` | | Confirm a mutating (non-read) request in non-interactive runs. |
|
|
119
|
+
| `--stream / --listen` | | Follow changes as an NDJSON envelope stream (native-api only; the `/listen` endpoint infers it). Ends with a summary envelope. |
|
|
120
|
+
| `--count` | `<n>` | Stop a `--stream` after N change frames. |
|
|
121
|
+
| `--duration` | `<dur>` | Stop a `--stream` after this wall-clock window (e.g. `5s`). |
|
|
122
|
+
| `--via` | <rest-api\|native-api> | Pin the transport; no silent downgrade. Default rest-api. |
|
|
123
|
+
| `--group` | `<name>` | Fan out across every CDB record in the group (repeatable; de-duped by record index). |
|
|
124
|
+
| `--where` | `<attr>`=`<value>` | Device-class selector over CDB facts + core fields (repeatable, AND-combined). |
|
|
125
|
+
| `--near` | `<lat>`,`<lon>`,`<radius>` | Geo selector: devices whose GPS is within radius (m/km/mi/ft; bare number = km). Lat-first. |
|
|
126
|
+
| `--bbox` | `<south>`,`<west>`,`<north>`,`<east>` | Geo selector: devices whose GPS is inside the lat-first bounding box. |
|
|
127
|
+
| `--all` | | Fan out across every CDB record (excludes `__default__`). |
|
|
128
|
+
| `--default` | | Select the reserved `__default__` record. |
|
|
129
|
+
| `--quickchr` | `<name>` | Target a running quickchr-managed CHR VM by name (repeatable; fans out when repeated). Exclusive of positional targets and CDB selectors; conflicts with direct connection overrides (--host/--port/--username/--password, and --ssh-key where the command has it). |
|
|
130
|
+
| `--concurrency` | `<n>` | Max in-flight targets during fan-out (transport-aware default: rest-api 8, native-api 4). |
|
|
131
|
+
| `--host` | <host\|url> | Override the resolved host or base URL for the target. |
|
|
132
|
+
| `--port` | `<port>` | Override the resolved management port. |
|
|
133
|
+
| `--username / --user / -u` | `<name>` | RouterOS username. Falls back to `CENTRS_USERNAME`. |
|
|
134
|
+
| `--password` | `<secret>` | RouterOS password. Falls back to `CENTRS_PASSWORD`. |
|
|
135
|
+
| `--insecure` | | Accept a self-signed `api-ssl`/REST TLS cert. Default verifies. |
|
|
136
|
+
| `--cdb-file` | `<path>` | Read target credentials from a WinBox CDB file. |
|
|
137
|
+
| `--cdb-password` | `<password>` | Decrypt an encrypted WinBox CDB file. |
|
|
138
|
+
| `--resolve` | <none\|arp> | Resolve a MAC-address target to an IP via the host ARP cache (default none). |
|
|
139
|
+
| `--timeout` | `<duration>` | Per-request timeout (for REST, max 60s). |
|
|
140
|
+
| `--validate / --no-validate` | | Run `/console/inspect` validation before the request (default true; `--validate=false` also accepted). |
|
|
141
|
+
| `--format` | <json\|yaml\|text> | Output format. Defaults to json for api; `CENTRS_FORMAT` overrides. |
|
|
142
|
+
| `--json` | | Shortcut for `--format json`. |
|
|
143
|
+
| `--verbose` | | Include additional context in text output. |
|
|
144
|
+
|
|
145
|
+
## transfer
|
|
146
|
+
|
|
147
|
+
Copy files to/from a RouterOS device and manage device files (rest/native/sftp).
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
Usage: centrs transfer <router> upload <local> [remote] | download <remote> [local] | list [path] | remove <remote> | mkdir <remote> | copy <src> <dst> [flags]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Flag | Value | Description |
|
|
154
|
+
| ---- | ----- | ----------- |
|
|
155
|
+
| `--via` | `<method>` | Pin the method: rest, native, or sftp (large transfers); scp/fetch/ftp are not built yet. Auto picks the cheapest by size/direction. |
|
|
156
|
+
| `--ssh-key` | `<path>` | sftp only: explicit private-key path. Falls back to CENTRS_SSH_KEY / the ssh-agent. |
|
|
157
|
+
| `--insecure` | | Accept a self-signed TLS cert (https/api-ssl) or a new SSH host key. Default verifies. |
|
|
158
|
+
| `--force / --overwrite` | | Replace an existing destination. Default refuses it. |
|
|
159
|
+
| `--group` | `<name>` | Fan out across every CDB record in the group (repeatable; de-duped by record index). |
|
|
160
|
+
| `--where` | `<attr>`=`<value>` | Device-class selector over CDB facts + core fields (repeatable, AND-combined). |
|
|
161
|
+
| `--near` | `<lat>`,`<lon>`,`<radius>` | Geo selector: devices whose GPS is within radius (m/km/mi/ft; bare number = km). Lat-first. |
|
|
162
|
+
| `--bbox` | `<south>`,`<west>`,`<north>`,`<east>` | Geo selector: devices whose GPS is inside the lat-first bounding box. |
|
|
163
|
+
| `--all` | | Fan out across every CDB record (excludes `__default__`). |
|
|
164
|
+
| `--default` | | Select the reserved `__default__` record. |
|
|
165
|
+
| `--quickchr` | `<name>` | Target a running quickchr-managed CHR VM by name (repeatable; fans out when repeated). Exclusive of positional targets and CDB selectors; conflicts with direct connection overrides (--host/--port/--username/--password, and --ssh-key where the command has it). |
|
|
166
|
+
| `--concurrency` | `<n>` | Max in-flight targets during fan-out (transport-aware default: rest-api 8, native-api 4). |
|
|
167
|
+
| `--out-dir` | `<dir>` | `download` fan-out only: write one file per target into `<dir>`, named by CDB identity. Required when downloading across a selection. |
|
|
168
|
+
| `--yes` | | Confirm a mutating fan-out (upload/remove/mkdir/copy) across multiple routers in non-interactive runs. |
|
|
169
|
+
| `--verify / --no-verify` | <size\|checksum\|off> | Post-transfer integrity check. Default size; `--no-verify` skips. |
|
|
170
|
+
| `--type` | <file\|directory\|disk\|package> | list filter: RouterOS /file row type. |
|
|
171
|
+
| `--name` | `<glob>` | list filter: file-name glob. |
|
|
172
|
+
| `--host` | <host\|url> | Override the resolved host or base URL. |
|
|
173
|
+
| `--port` | `<port>` | Override the resolved management port. |
|
|
174
|
+
| `--username / --user / -u` | `<name>` | RouterOS username (aliases --user, -u). Falls back to CENTRS_USERNAME. |
|
|
175
|
+
| `--password` | `<secret>` | RouterOS password. Falls back to CENTRS_PASSWORD. |
|
|
176
|
+
| `--timeout` | <ms\|5s> | Operation timeout. REST rejects values above 60s. |
|
|
177
|
+
| `--format` | <text\|json\|yaml> | Output format. Defaults to text; --json / --yaml shortcuts. |
|
|
178
|
+
| `--json` | | Shortcut for --format json. |
|
|
179
|
+
| `--yaml` | | Shortcut for --format yaml. |
|
|
180
|
+
| `--cdb-file` | `<path>` | Read target credentials from a WinBox CDB file. |
|
|
181
|
+
| `--cdb-password` | `<password>` | Decrypt an encrypted WinBox CDB file. |
|
|
182
|
+
| `--validate / --no-validate` | | Enable or disable the existence-probe preflight. |
|
|
183
|
+
| `--verbose` | | Show the resolved transport in text output. |
|
|
184
|
+
|
|
185
|
+
## terminal
|
|
186
|
+
|
|
187
|
+
Open an interactive RouterOS console (ssh or mac-telnet).
|
|
188
|
+
|
|
189
|
+
```text
|
|
190
|
+
Usage: centrs terminal <router> [flags]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
| Flag | Value | Description |
|
|
194
|
+
| ---- | ----- | ----------- |
|
|
195
|
+
| `--via` | `<method>` | Transport: `ssh` (host target, default) or `mac-telnet` (MAC target, default for a MAC). rest/native have no terminal capability. |
|
|
196
|
+
| `--host` | `<host>` | Override the target host (ssh) / UDP delivery host (mac-telnet, default L2 broadcast). |
|
|
197
|
+
| `--port` | `<port>` | Override the port: ssh default 22, mac-telnet default 20561. |
|
|
198
|
+
| `--username / --user / -u` | `<name>` | RouterOS username (aliases --user, -u). Falls back to CENTRS_USERNAME. |
|
|
199
|
+
| `--password` | `<secret>` | RouterOS password. Falls back to CENTRS_PASSWORD. |
|
|
200
|
+
| `--source-mac` | `<mac>` | mac-telnet: explicit in-packet source MAC (overrides egress resolution). |
|
|
201
|
+
| `--ssh-key` | `<path>` | `--via ssh`: explicit private-key path. Falls back to `CENTRS_SSH_KEY` / the `ssh-agent`. |
|
|
202
|
+
| `--insecure` | | `--via ssh`: disable host-key verification (accepts changed/impersonated keys). Default verifies. |
|
|
203
|
+
| `--cdb-file` | `<path>` | Read target credentials from a WinBox CDB file. |
|
|
204
|
+
| `--cdb-password` | `<password>` | Decrypt an encrypted WinBox CDB file. |
|
|
205
|
+
| `--resolve` | <none\|arp> | `--via ssh` only: turn a MAC target into an IP. CDB-first; `arp` opts into the host ARP cache (default none). The mac-telnet default ignores it. |
|
|
206
|
+
| `--format` | <text\|json\|yaml> | Error-envelope format on failure. --json / --yaml shortcuts. |
|
|
207
|
+
| `--json` | | Shortcut for --format json. |
|
|
208
|
+
| `--yaml` | | Shortcut for --format yaml. |
|
|
209
|
+
| `--verbose` | | Verbose error output. |
|
|
210
|
+
|
|
211
|
+
## explain
|
|
212
|
+
|
|
213
|
+
Analyze a RouterOS command offline: canonical form, structure, and syntax diagnostics.
|
|
214
|
+
|
|
215
|
+
```text
|
|
216
|
+
Usage: centrs explain '<input>' [flags]
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
| Flag | Value | Description |
|
|
220
|
+
| ---- | ----- | ----------- |
|
|
221
|
+
| `--file` | `<path>` | Read the input from a file instead of the positional (`-` reads stdin). Piped stdin is used automatically when no input positional is given. |
|
|
222
|
+
| `--fail-on` | <error\|warning\|never> | Exit 2 when the verdict reaches this severity. Default `error`; an ambiguous or unknown statement is a warning, never an error. |
|
|
223
|
+
| `--complete` | | Continuation candidates at the cursor. Live evidence — offline emits a tip and enumerates nothing. |
|
|
224
|
+
| `--schema` | | Path enumeration (verbs, args, types, enums). Live evidence — offline emits a tip and enumerates nothing. |
|
|
225
|
+
| `--curl` | | Render a ready-to-edit REST curl for statements covered by a runtime-tested mapping rule. |
|
|
226
|
+
| `--tokens` | | Emit the total, gapless token partition behind `data.tokens[]` (every byte not claimed by an analyzer is `unclassified`). |
|
|
227
|
+
| `--format` | <text\|json\|yaml> | Output format for the CLI response. |
|
|
228
|
+
| `--json` | | Shortcut for `--format json`. |
|
|
229
|
+
| `--yaml` | | Shortcut for `--format yaml`. |
|
|
230
|
+
| `--verbose` | | Verbose error output. |
|
|
231
|
+
|
|
232
|
+
## devices
|
|
233
|
+
|
|
234
|
+
Inspect and mutate the CDB-backed device registry. `devices` is the only command that writes the CDB.
|
|
235
|
+
|
|
236
|
+
```text
|
|
237
|
+
Usage: centrs devices <list|show|groups|add|edit|set|remove> [args] [flags]
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
| Flag | Value | Description |
|
|
241
|
+
| ---- | ----- | ----------- |
|
|
242
|
+
| `--cdb-file` | `<path>` | Override the resolved CDB path (default `~/.config/tikoci/winbox.cdb`). |
|
|
243
|
+
| `--cdb-password` | `<secret>` | Decrypt an encrypted CDB. Falls back to `CENTRS_CDB_PASSWORD`. Also used to re-encrypt on writes. |
|
|
244
|
+
| `--via` | `<protocol>` | Resolve and report the protocol source for provenance examples; no network IO is performed. |
|
|
245
|
+
| `--group` | `<name>` | `list` filter / `add`,`edit` first-class group field for the target entry. |
|
|
246
|
+
| `--where` | `<attr=value>` | `list` only — repeatable device-class filter over CDB facts (AND-combined), e.g. `--where lat=37.7749`. |
|
|
247
|
+
| `--near` | `<lat>`,`<lon>`,`<radius>` | `list` only — GPS filter: devices within radius (m/km/mi/ft; bare number = km). Lat-first. |
|
|
248
|
+
| `--bbox` | `<south>`,`<west>`,`<north>`,`<east>` | `list` only — GPS filter: devices inside the lat-first bounding box. |
|
|
249
|
+
| `--members` | | `groups` only — expand each group's membership. |
|
|
250
|
+
| `--explain` | | `show` only — include the raw `WinBoxCdbRecord` in `data.record`. |
|
|
251
|
+
| `--match` | <user=…\|target=…\|record-type> | `show` — disambiguate when `<router>` matches several records: `user=<name>`, `target=<addr>`, or a record-type token. |
|
|
252
|
+
| `--user` | `<name>` | `add`,`set` — first-class CDB user field. |
|
|
253
|
+
| `--password` | `<secret>` | `add`,`set` — first-class CDB password field. |
|
|
254
|
+
| `--profile` | `<name>` | `add`,`set` — named WinBox profile (Workspace). |
|
|
255
|
+
| `--profile-none` | | `add`,`set` — write the WinBox `<none>` profile sentinel. |
|
|
256
|
+
| `--profile-own` | | `add`,`set` — write the WinBox `<own>` profile sentinel. |
|
|
257
|
+
| `--session` | `<name>` | `add`,`set` — first-class CDB session field. |
|
|
258
|
+
| `--comment` | `<text>` | `add` only — base free-form comment (may include kv-soup). |
|
|
259
|
+
| `--record-type` | <macTarget\|ipAdmin\|ipUser\|romonNeighbor\|romonTarget> | `add` only — record type (default `ipAdmin`). |
|
|
260
|
+
| `--lat / --latitude` | `<deg>` | `add`,`set` — latitude in decimal degrees (-90..90); a comment-kv fact, paired with --lon. |
|
|
261
|
+
| `--lon / --lng / --longitude / --long` | `<deg>` | `add`,`set` — longitude in decimal degrees (-180..180); a comment-kv fact, paired with --lat. |
|
|
262
|
+
| `--altitude / --alt / --ele / --elevation` | `<meters>` | `add`,`set` — altitude in meters (may be negative); a comment-kv fact. |
|
|
263
|
+
| `--altitude-type / --alt-type` | <MSL\|AGL> | `add`,`set` — vertical datum for --altitude (default MSL); case-insensitive. |
|
|
264
|
+
| `--gps` | `<lat>`,`<lon>`[,`<altitude>`[,`<altitude-type>`]] | `add`,`set` — combined lat,lon[,altitude[,altitude-type]] convenience (lat-first; missing altitude-type defaults MSL). |
|
|
265
|
+
| `--force` | | `add` only — overwrite the existing (target, user) entry. |
|
|
266
|
+
| `--strict` | | `add`,`set` — reject unknown comment kv keys instead of warning. |
|
|
267
|
+
| `--format` | <text\|json\|yaml> | Output format for the CLI response. |
|
|
268
|
+
| `--json` | | Shortcut for `--format json`. |
|
|
269
|
+
|
|
270
|
+
## discover
|
|
271
|
+
|
|
272
|
+
Discover RouterOS neighbors over MNDP and optionally save them into the CDB.
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
Usage: centrs discover [--timeout 15s] [--save] [flags]
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
| Flag | Value | Description |
|
|
279
|
+
| ---- | ----- | ----------- |
|
|
280
|
+
| `--timeout` | <ms\|15s> | Listen window before results are returned. Default 15s. |
|
|
281
|
+
| `--save` | | Persist discovered neighbors into the CDB (`group=discovered`, `source=mndp`). |
|
|
282
|
+
| `--group` | `<name>` | `--save` group for new entries. Default `discovered`. |
|
|
283
|
+
| `--port` | `<port>` | UDP port to bind for MNDP. Default 5678. |
|
|
284
|
+
| `--cdb-file` | `<path>` | `--save` CDB path override (default `~/.config/tikoci/winbox.cdb`). |
|
|
285
|
+
| `--cdb-password` | `<secret>` | `--save` password for an encrypted CDB. Used to decrypt the existing CDB and re-encrypt on write. |
|
|
286
|
+
| `--format` | <text\|json\|yaml> | Output format for the CLI response. |
|
|
287
|
+
| `--json` | | Shortcut for `--format json`. |
|
|
288
|
+
|
|
289
|
+
## btest
|
|
290
|
+
|
|
291
|
+
Run MikroTik's bandwidth test as a client or server (peer measurement).
|
|
292
|
+
|
|
293
|
+
```text
|
|
294
|
+
Usage: centrs btest <client <router>|server> [flags]
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
| Flag | Value | Description |
|
|
298
|
+
| ---- | ----- | ----------- |
|
|
299
|
+
| `--protocol` | <udp\|tcp> | (client) Transport. Default udp. |
|
|
300
|
+
| `--direction` | <receive\|transmit\|both> | (client) Test direction. Default receive. |
|
|
301
|
+
| `--duration` | `<dur>` | Bound the run (e.g. 15s). Omit for open-ended (Ctrl-C). |
|
|
302
|
+
| `--interval` | `<dur>` | Report cadence (20ms..5s). Default 1s. |
|
|
303
|
+
| `--connection-count` | `<n>` | (client, TCP only) Parallel TCP data connections (1..255). |
|
|
304
|
+
| `--local-udp-tx-size` | `<n>` | (client, UDP only) Client→server packet size (28..64000). |
|
|
305
|
+
| `--remote-udp-tx-size` | `<n>` | (client, UDP only) Server→client packet size (28..64000). |
|
|
306
|
+
| `--local-tx-speed` | `<bps>` | (client) Cap on client→server rate (e.g. 100M). |
|
|
307
|
+
| `--remote-tx-speed` | `<bps>` | (client) Cap on server→client rate (e.g. 100M). |
|
|
308
|
+
| `--random-data` | | (client) Incompressible payload. |
|
|
309
|
+
| `--nat-mode` | | (client, UDP only) Originate an outbound datagram first so server→client data can traverse NAT. Automatic when the test receives. |
|
|
310
|
+
| `--authenticate / --no-authenticate` | | (server) Require EC-SRP5 auth. Default true; `--authenticate=false` also accepted. |
|
|
311
|
+
| `--bind` | `<addr>` | (server) Listen address. Default 127.0.0.1. |
|
|
312
|
+
| `--allocate-udp-ports-from` | `<n>` | (server) Base of the UDP data-port range. Default 2001. |
|
|
313
|
+
| `--max-sessions` | `<n>` | (server) Concurrent test cap (1..1000). Default 100. |
|
|
314
|
+
| `--user / --username / -u` | `<name>` | Credential (aliases --username, -u; falls back to CDB / CENTRS_USERNAME). |
|
|
315
|
+
| `--password` | `<secret>` | Credential (falls back to CDB / CENTRS_PASSWORD). |
|
|
316
|
+
| `--port` | `<port>` | Control port. Default 2000. |
|
|
317
|
+
| `--cdb-file` | `<path>` | (client) Read target credentials from a WinBox CDB file. |
|
|
318
|
+
| `--cdb-password` | `<password>` | (client) Decrypt an encrypted WinBox CDB file. |
|
|
319
|
+
| `--format` | <text\|csv\|json\|yaml> | Output format. Default text. |
|
|
320
|
+
| `--csv` | | Shortcut for `--format csv`. |
|
|
321
|
+
|
|
322
|
+
## mcp
|
|
323
|
+
|
|
324
|
+
Start the centrs MCP server (stdio) — scoped RouterOS tools gated by the CDB allowlist.
|
|
325
|
+
|
|
326
|
+
```text
|
|
327
|
+
Usage: centrs mcp [start] [--cdb-file <path>] [--allow-adhoc-targets]
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
| Flag | Value | Description |
|
|
331
|
+
| ---- | ----- | ----------- |
|
|
332
|
+
| `--cdb-file` | `<path>` | CDB allowlist path (default `~/.config/tikoci/winbox.cdb`, or CENTRS_CDB_FILE). |
|
|
333
|
+
| `--cdb-password` | `<password>` | Decrypt password for an encrypted CDB (or CENTRS_CDB_PASSWORD). |
|
|
334
|
+
| `--allow-adhoc-targets` | | Reserved unsafe escape hatch for future inline targets; current tools still use CDB-only targets. |
|
|
335
|
+
| `--help` | | Show this help. |
|
|
336
|
+
|
|
337
|
+
## settings
|
|
338
|
+
|
|
339
|
+
Manage centrs's own global preferences (`centrs.env`) and inspect the `__default__` CDB record.
|
|
340
|
+
|
|
341
|
+
```text
|
|
342
|
+
Usage: centrs settings [print|get|set|reset] [args] [flags]
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
| Flag | Value | Description |
|
|
346
|
+
| ---- | ----- | ----------- |
|
|
347
|
+
| `--all` | | `print` only — also list unrecognized CENTRS_* lines found in the file. |
|
|
348
|
+
| `--cdb-file` | `<path>` | `print` only — CDB to probe for the `__default__` record summary (falls back to normal CDB resolution; never centrs.env). |
|
|
349
|
+
| `--cdb-password` | `<secret>` | `print` only — decrypt password for the probed CDB. |
|
|
350
|
+
| `--skip-env-file` | | `print` only — note that other commands in this environment would not see centrs.env (settings itself always reads the real file). |
|
|
351
|
+
| `--format` | <text\|json\|yaml> | Output format for the CLI response. |
|
|
352
|
+
| `--json` | | Shortcut for `--format json`. |
|
|
353
|
+
| `--help` | | Show this help. |
|