@datarails-ai/dr-cli 1.6.135 → 1.6.137

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "cliVersion": "1.6.135",
3
+ "cliVersion": "1.6.137",
4
4
  "_contract": "Resolve a command path through `aliases` (canonical prefix + alias segment -> canonical path) before any lookup. A path listed in `pendingCommands`, or whose first segment is a key of `pending`, is UNDECIDED, not unrestricted: fail closed or skip it, and never read a path's absence from `commands` as 'no requirement'. An entry carrying `denied` is UNAVAILABLE to any AGENT-SCOPED credential — one whose `scopes` claim carries at least one `resource:action` entry; a claim that is absent, empty, capability-only or wholly unparseable is UNRESTRICTED, and this mark does not apply to it — whatever else that entry says: it is not a ceiling and it is not always-available, its `denied.reason` says why and `denied.until` names the ticket that lifts it, and the absence of `requires` on it must NEVER be read as 'no requirement'. Only an entry in `commands` with an empty `requires` means always-available.",
5
5
  "commands": {
6
6
  "login": {
@@ -1031,6 +1031,14 @@
1031
1031
  }
1032
1032
  ]
1033
1033
  },
1034
+ "reports update": {
1035
+ "requires": [
1036
+ {
1037
+ "resource": "tables",
1038
+ "action": "write"
1039
+ }
1040
+ ]
1041
+ },
1034
1042
  "reports delete": {
1035
1043
  "requires": [
1036
1044
  {
@@ -1127,6 +1135,14 @@
1127
1135
  }
1128
1136
  ]
1129
1137
  },
1138
+ "metrics create driver": {
1139
+ "requires": [
1140
+ {
1141
+ "resource": "metrics",
1142
+ "action": "write"
1143
+ }
1144
+ ]
1145
+ },
1130
1146
  "metrics categories list": {
1131
1147
  "requires": [
1132
1148
  {
@@ -1303,6 +1319,78 @@
1303
1319
  }
1304
1320
  ]
1305
1321
  },
1322
+ "metrics driver get": {
1323
+ "requires": [
1324
+ {
1325
+ "resource": "metrics",
1326
+ "action": "read"
1327
+ }
1328
+ ]
1329
+ },
1330
+ "metrics driver set": {
1331
+ "requires": [
1332
+ {
1333
+ "resource": "metrics",
1334
+ "action": "write"
1335
+ }
1336
+ ]
1337
+ },
1338
+ "metrics driver delete": {
1339
+ "requires": [
1340
+ {
1341
+ "resource": "metrics",
1342
+ "action": "destructive"
1343
+ }
1344
+ ]
1345
+ },
1346
+ "metrics driver values get": {
1347
+ "requires": [
1348
+ {
1349
+ "resource": "metrics",
1350
+ "action": "read"
1351
+ }
1352
+ ]
1353
+ },
1354
+ "metrics driver values set": {
1355
+ "requires": [
1356
+ {
1357
+ "resource": "metrics",
1358
+ "action": "write"
1359
+ }
1360
+ ]
1361
+ },
1362
+ "metrics calculations list": {
1363
+ "requires": [
1364
+ {
1365
+ "resource": "metrics",
1366
+ "action": "read"
1367
+ }
1368
+ ]
1369
+ },
1370
+ "metrics calculations add": {
1371
+ "requires": [
1372
+ {
1373
+ "resource": "metrics",
1374
+ "action": "write"
1375
+ }
1376
+ ]
1377
+ },
1378
+ "metrics calculations remove": {
1379
+ "requires": [
1380
+ {
1381
+ "resource": "metrics",
1382
+ "action": "write"
1383
+ }
1384
+ ]
1385
+ },
1386
+ "metrics what-if": {
1387
+ "requires": [
1388
+ {
1389
+ "resource": "metrics",
1390
+ "action": "read"
1391
+ }
1392
+ ]
1393
+ },
1306
1394
  "fx set-posting": {
1307
1395
  "requires": [
1308
1396
  {
@@ -234,7 +234,8 @@ area's gotchas.
234
234
 
235
235
  **Metrics (KPIs) & functions** → [reference/metrics.md](reference/metrics.md)
236
236
  - `metrics list|get|data|drilldown`
237
- - `metrics create base|calc`, `metrics update|delete`
237
+ - `metrics create base|calc|driver`, `metrics update|delete`
238
+ - `metrics driver get|set|delete`, `metrics driver values get|set`, `metrics calculations list|add|remove`, `metrics what-if`: drivers, scenario-bound formulas and what-if runs, addressed per scenario context (`--scenario` / `--cycle` / `--planning-scenario`, matched exactly)
238
239
  - `metrics re-aggregate` — rebuild pre-aggregated metric values (targeted ids, or `--all` org-wide); add `--wait [--timeout <s>]` on targeted ids to block until done (exits non-zero on failure/timeout)
239
240
  - `metrics migrate` — org-wide metrics+dimensions migration (V1→V2 backfill; `--dry-run` first)
240
241
  - `metrics categories list|get|create|update|delete`
@@ -271,7 +272,7 @@ area's gotchas.
271
272
  default so results match the product UI; `--no-dashboard-context` computes
272
273
  from the widget's own settings only.
273
274
  - `storyboards list|get|slides|prepare|delete`
274
- - `reports list|get|clone|delete`
275
+ - `reports list|get|clone|update|delete` — `update <id>` edits a Financials (Report Builder) report: `--payload-file` (payload keys, or `reports get --json` output), `--name`, `--option k=v`, `--date-picker-preset`; dry-run unless `--confirm`
275
276
  - `extables list|get|clone|delete`
276
277
 
277
278
  **Budget Builder (Budget management templates)** → [reference/budget-builder.md](reference/budget-builder.md)
@@ -20,7 +20,13 @@ Commands:
20
20
  - `budget-builder add-row` — validate, then merge the row and rebuild
21
21
  (`--out-file` writes the updated definition for a later `save`).
22
22
  - `budget-builder save --payload-file <f>` — persist to Budget management
23
- (new template → `id: -1` in the payload).
23
+ (new template → `id: -1` in the payload). On large-report orgs the server
24
+ answers 409 while a worker saves; the CLI polls with the returned
25
+ cache_key for up to `--timeout <ms>` (default 60000). On timeout, check
26
+ `dr reports list` before re-running save — a second save creates a
27
+ second report.
28
+ - `reports update` refuses budget reports (it edits Financials reports
29
+ only).
24
30
  - `documents split create|list|status|undo` — split a saved budget file into
25
31
  per-dimension-value child files (see
26
32
  [reference/filebox-documents.md](filebox-documents.md) for the documents
@@ -104,6 +104,30 @@ Flag off: `folders list` shows no tree and says the flag is off; every write 404
104
104
  - `storyboards list|get|slides`; `storyboards prepare`, `storyboards delete`
105
105
  (two-step confirm).
106
106
  - `reports list|get`; `reports clone`, `reports delete` (two-step confirm).
107
+ - `reports update <id>` — edit a **Financials** (Report Builder) report.
108
+ Budget reports are refused (the CLI cannot edit them in place).
109
+ - Inputs: `--payload-file <f>` (a JSON object of payload keys, or the
110
+ whole `reports get <id> --json` output — its `.payload` is used),
111
+ `--name`, `--option k=v` (repeatable, merged into the stored `options`),
112
+ `--date-picker-preset today|yesterday|this_month|prev_month`.
113
+ - The server merges the body over the stored payload: a top-level key
114
+ REPLACES the stored one (`rows`, `cols`, `options`, … are whole values).
115
+ The CLI sends only keys whose value differs from the stored report.
116
+ - Dry-run by default (prints the changed keys); `--confirm` sends the PUT.
117
+ Relay the dry-run to the user before confirming.
118
+ - Keep `document_data` / `report_space_data` / `workflow_data` OUT of the
119
+ payload file unless the user asks to link a file: the platform stores
120
+ them and regenerates the linked file on every later save. The CLI warns
121
+ when the file sets one.
122
+ - Exits non-zero when the server saved the report but returned
123
+ `generated_report_details.error`.
124
+ - Large reports: see "Large-report writes" below.
125
+ - **Large-report writes** (`reports update`, `budget-builder save`): on orgs
126
+ with large-reports support the server answers 409 `{cache_key}` while a
127
+ worker runs the write, and the CLI re-sends the same request with that
128
+ key for up to `--timeout <ms>` (default 60000). On timeout the write may
129
+ still land — check `reports get <id>` (update) or `reports list` (save)
130
+ before retrying; a second `save` creates a second report.
107
131
  - `extables list|get`; `extables clone`, `extables delete` (two-step confirm).
108
132
  To inject an ExTable's data into a raw `.xlsx`, that's `documents add-extables`
109
133
  (see reference/filebox-documents.md), **not** an `extables` subcommand.
@@ -10,8 +10,9 @@
10
10
  field (`--json | jq '.presented_formula'` returns null; read
11
11
  `.configuration.presented_formula`).
12
12
  - `metrics data --id <id> --scenario Actuals --from 2026-01-01 --to 2026-12-31` —
13
- the KPI value over a range. `--scenario` / `--cycle` are repeatable and also
14
- accept comma-separated values (e.g. `Actuals,Budget`) to pull several at once.
13
+ the KPI value over a range. `--scenario` / `--cycle` / `--planning-scenario` are
14
+ repeatable and also accept comma-separated values (e.g. `Actuals,Budget`) to
15
+ pull several at once.
15
16
  - `--period <day|month|quarter|year>` (default `month`) sets the grain of the
16
17
  returned buckets.
17
18
  - `--agg <DEFAULT|MTD|QTD|YTD|MTG|QTG|YTG>` (default `DEFAULT`) sets how each
@@ -109,6 +110,66 @@ Required: `--name`, `--template <id>`, `--value-field <id>`, `--date-field <id>`
109
110
  order-independent and de-duplicated. A failed id doesn't abort the batch: each
110
111
  outcome is reported and the command exits non-zero if any delete failed.
111
112
 
113
+ ## Drivers, scenario calculations, what-if
114
+
115
+ Planning-model commands. The server gates them behind the
116
+ `scenario_bound_calculations` flag and a planning product (budget or forecast
117
+ cycle management). When either is off it answers 400/403/405 with a message,
118
+ and the CLI prints that message unchanged.
119
+
120
+ **Scenario context.** `driver …` and `calculations add|remove` address one
121
+ context with `--scenario <name>` (default `Actuals`), `--cycle <label>` and
122
+ `--planning-scenario <name>`. All three are free-text names and must match
123
+ exactly. A context never inherits from another one, so a driver set under
124
+ `Budget` is a different row from the `Actuals` one.
125
+
126
+ - `metrics create driver --name <n> [--description] [--category <id>]
127
+ [--dimensions <ids>]` creates a DRIVER metric. It has no table, value or
128
+ date field and no formula.
129
+ - `metrics driver get <id> [ctx]` shows the definition: unit, additive,
130
+ baseline, min, max and grain dimension. When the context has no driver the
131
+ command exits non-zero with "no driver for metric … in context …".
132
+ - `metrics driver set <id> [ctx] [--unit <s>] [--additive | --non-additive]
133
+ [--baseline <n|null>] [--min <n|null>] [--max <n|null>]
134
+ [--grain-dimension <dimId|null>]` creates the context's row if it is
135
+ missing. Only the flags you pass are sent, and omitted fields keep their
136
+ stored values. `null` clears baseline, min, max or grain, and `--unit ""`
137
+ clears the unit. The command refuses to run with no field flag. The server
138
+ rejects min > max, and it refuses a grain change while values exist.
139
+ - `metrics driver delete <id> [ctx]` deletes the context's driver and all of
140
+ its values. It uses the two-step confirm, and the token is bound to the
141
+ context.
142
+ - `metrics driver values get <id> [ctx]` prints a MEMBER / PERIOD / VALUE
143
+ table, with `(default)` for a member's null-period default.
144
+ - `metrics driver values set <id> [ctx] --file <grid.csv|grid.json>`
145
+ **replaces the whole grid**: any cell not in the file is deleted. The CSV
146
+ header is `member,period,value`. Period is `YYYY-MM` or `YYYY-MM-01`, or
147
+ empty for the member's default. An empty value means null. Member is empty
148
+ when the driver has no grain. A JSON file is `{"values": [...]}` or a bare
149
+ array. The CLI checks the 20,000-cell cap and duplicate (member, period)
150
+ cells before sending. The driver must already exist for the context, so run
151
+ `driver set` first.
152
+ - `metrics calculations list <id>` lists the scenario-bound formulas of a CALC
153
+ metric. `calculations add <id> [ctx] --formula "[A] * [B]"` uses the same
154
+ syntax as `create calc`. It reads the list, appends the new formula, and
155
+ writes the full list back. If the context already has a formula it refuses,
156
+ unless you pass `--replace`. `calculations remove <id> [ctx]` uses the
157
+ two-step confirm, and the plan shows the formula being removed. Only CALC
158
+ metrics accept calculations. The server rejects duplicate contexts and
159
+ formula loops.
160
+ - `metrics what-if --formula "[Headcount] * [Avg Salary]" [--driver
161
+ Headcount=15]… [--driver-file overrides.json] [--reference-month YYYY-MM]
162
+ [--time-aggregation SUM|AVG|EOP] [--dimension <dimName>]…` evaluates the
163
+ formula over the 3 months ending at the reference month (default: the
164
+ current month). The overrides apply to this call only and nothing is saved.
165
+ It prints the combined result, then one contribution block per overridden
166
+ driver. The driver file maps each driver name to
167
+ `{"baseline_value": n|null, "values": [{member, period, value}]}`. A
168
+ `--driver` flag overrides that driver's baseline from the file. The limit is
169
+ 20 drivers. The server ignores a driver that is not an operand of the
170
+ formula, so the CLI prints a warning on stderr for any driver name that
171
+ does not appear in the formula.
172
+
112
173
  ## Re-aggregate (`metrics re-aggregate`)
113
174
 
114
175
  Manually trigger the semantic-layer pipeline that rebuilds pre-aggregated
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-cli",
3
- "version": "1.6.135",
3
+ "version": "1.6.137",
4
4
  "description": "Datarails CLI",
5
5
  "type": "module",
6
6
  "engines": {
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@datarails-ai/dr-appspace-cli": "0.12.13",
20
+ "@datarails-ai/dr-appspace-cli": "0.12.14",
21
21
  "@modelcontextprotocol/sdk": "^1.29.0",
22
22
  "@napi-rs/keyring": "^1.3.0",
23
23
  "commander": "^12.1.0",