@datarails-ai/dr-cli 1.6.162 → 1.6.164

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.162",
3
+ "cliVersion": "1.6.164",
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": {
@@ -4665,6 +4665,74 @@
4665
4665
  }
4666
4666
  ]
4667
4667
  },
4668
+ "template-library list": {
4669
+ "requires": [
4670
+ {
4671
+ "resource": "tables",
4672
+ "action": "read"
4673
+ }
4674
+ ]
4675
+ },
4676
+ "template-library get": {
4677
+ "requires": [
4678
+ {
4679
+ "resource": "tables",
4680
+ "action": "read"
4681
+ }
4682
+ ]
4683
+ },
4684
+ "template-library add": {
4685
+ "requires": [
4686
+ {
4687
+ "resource": "tables",
4688
+ "action": "write"
4689
+ },
4690
+ {
4691
+ "resource": "fileboxes",
4692
+ "action": "read"
4693
+ }
4694
+ ]
4695
+ },
4696
+ "template-library update": {
4697
+ "requires": [
4698
+ {
4699
+ "resource": "tables",
4700
+ "action": "destructive"
4701
+ }
4702
+ ]
4703
+ },
4704
+ "template-library publish": {
4705
+ "requires": [
4706
+ {
4707
+ "resource": "tables",
4708
+ "action": "destructive"
4709
+ }
4710
+ ]
4711
+ },
4712
+ "template-library unpublish": {
4713
+ "requires": [
4714
+ {
4715
+ "resource": "tables",
4716
+ "action": "write"
4717
+ }
4718
+ ]
4719
+ },
4720
+ "template-library archive": {
4721
+ "requires": [
4722
+ {
4723
+ "resource": "tables",
4724
+ "action": "destructive"
4725
+ }
4726
+ ]
4727
+ },
4728
+ "template-library restore": {
4729
+ "requires": [
4730
+ {
4731
+ "resource": "tables",
4732
+ "action": "write"
4733
+ }
4734
+ ]
4735
+ },
4668
4736
  "calendars audit list": {
4669
4737
  "requires": [
4670
4738
  {
@@ -376,6 +376,10 @@ area's gotchas.
376
376
  - `multi-product product-content list`
377
377
  - `multi-product org-products list|set` — `set` has replace semantics; two-step confirm gated
378
378
 
379
+ **Template Library catalog** → [reference/template-library.md](reference/template-library.md)
380
+ - `template-library list|get` — every entry (published/draft/archived); `get` lists the tables and fields (system names) the file reads
381
+ - Every write runs only as org `template.library-new` on `US`: `add <filebox_id>` (a filebox of that org), `update <id>` fills in description/type/industry/tags/`--image pink|purple|yellow`, `publish|unpublish|archive|restore <id>` — all two-step confirm with the token bound to the planned values, `publish` word-gated on prod
382
+
379
383
  **Legacy RH_CONFIG inspection (read-only)** → [reference/rh-config.md](reference/rh-config.md)
380
384
  - `rh_config config|tables|download <bucket-id>` — inspect / download the bucket's config workbook (the Excel with the `RH_Config` sheet that the legacy parser reads).
381
385
  - _`rh_config download` is broken (its endpoint rejects the JWT and it saves the login HTML page). Download instead with `filebox download <document> --doc-version <id>`, using `id` + `document` from `rh_config config <bucket-id> --json`._
@@ -686,6 +690,7 @@ Each also names the relevant Help Center (KB) folder for customer-facing docs.
686
690
  - [reference/cash.md](reference/cash.md) — Cash module
687
691
  - [reference/spend-control.md](reference/spend-control.md) — Spend Control module
688
692
  - [reference/multi-product.md](reference/multi-product.md) — product-content catalog + per-org assignment (replace-semantics PUT)
693
+ - [reference/template-library.md](reference/template-library.md) — Template Library catalog: add, card metadata, image, publish/archive
689
694
  - [reference/desk.md](reference/desk.md) — Desk: outbound-email onboarding (SMTP app password + SendGrid domain auth) and ticket creation
690
695
  - [reference/rh-config.md](reference/rh-config.md) — legacy RH_CONFIG inspection (read-only)
691
696
  - [reference/admin.md](reference/admin.md) — users, orgs, devices, feature flags, semantic tables, fx, kb, mcp, skill
@@ -0,0 +1,81 @@
1
+ # `dr template-library` — the Template Library catalog
2
+
3
+ The Template Library (left nav → Template Library, `/templates-library`) is a
4
+ server-wide catalog of best-practice fileboxes customers can import. Each entry
5
+ points at a filebox in the **source org** and carries the card a customer sees:
6
+ description, report type, industry, tags and image. The admin screen behind it
7
+ is Library management, `api/report_library/management`.
8
+
9
+ **Source org:** every write (`add`, `update`, `publish`, `unpublish`, `archive`,
10
+ `restore`) runs only as org `template.library-new` on `US`. The commands check the
11
+ identity's JWT (`organization_domain`) and the server, and refuse anything else
12
+ before sending a request. The server itself accepts these writes from any
13
+ authenticated user, so this check is the only guard today. Work as that org:
14
+
15
+ ```
16
+ dr login-as support@template.library-new --server US
17
+ ```
18
+
19
+ ## Subcommands
20
+
21
+ All take `--server` and `--account`. Every write is a two-step confirm: the first
22
+ run prints the plan (old -> new values) and a token, the second run with
23
+ `--confirm-token` applies it. The token is bound to the server, account and values
24
+ planned: changing a flag, the image, or the content of `--description-file`
25
+ between the two runs voids it.
26
+
27
+ - `list [--status all|published|draft|archived] [--json]` — every entry with
28
+ its filebox, status, type, industry, image (`pink|purple|yellow|custom|none`)
29
+ and download count. → `GET /api/report_library/management`
30
+ - `get <id> [--json]` — one entry, plus the tables and fields its file reads with
31
+ their system names (`Financials {financials}`, `Amount {amount}`). These are what
32
+ a customer's import must map. There is no per-id GET; this filters the list.
33
+ - `add <filebox_id> [card flags]` — register a filebox as a **draft** entry. The
34
+ filebox must be in the org's own filebox list (the server would accept any org's
35
+ id, a filebox shared from another org included, so `add` checks it first and shows
36
+ its file name in the plan). Posts
37
+ `{document_id}` (exactly what the UI's "Add to template library" sends), then
38
+ writes any card flags with the update call; if that second step fails, the error
39
+ names the new entry so you can finish it with `update`. The server maps the file's tables
40
+ and fields in the background; check with `get` a little later. Refuses a
41
+ filebox that is already an entry. → `GET /api/documents/v2`, `GET /api/documents/<id>/versions/latestid` (+ the
42
+ version, for the file name), `POST …/management`, `PUT …/management/<id>`
43
+ - `update <id> [card flags] [--creator <user_id>]` — fill in or change the card.
44
+ Only the flags you pass are sent. `--creator` must be one of the org's users
45
+ (`GET /api/organizations/contacts`, the UI picker's list). Editing a **published** entry changes the card
46
+ every customer org sees, so it is Tier A like `publish` (a token planned while the
47
+ entry was a draft does not confirm it). → `PUT /api/report_library/management/<id>`
48
+ - `publish <id> [--image <color>]` — offer the entry to every customer org on the
49
+ server. Refused when archived or when it has no image (pass `--image`). Warns
50
+ about an empty description, type, industry or tags. Tier A: on production it
51
+ also needs the word typed in the confirmation dialog.
52
+ - `unpublish <id>`, `archive <id>` (refused while published), `restore <id>`. A change
53
+ to the state an entry is already in (publishing a published entry, restoring one
54
+ that is not archived) is refused rather than confirmed as a no-op.
55
+
56
+ `update` and the state commands refuse an entry whose `domain` is not
57
+ `template.library-new`: the server would change another org's entry by id.
58
+
59
+ Card flags (`add` and `update`):
60
+
61
+ | Flag | Field | Notes |
62
+ | --- | --- | --- |
63
+ | `--description <text>` / `--description-file <path>` | `description` | one or the other; the file at most 64 KiB |
64
+ | `--type <text>` | `report_type` | in use: Financial Planning, Financial Reporting, Headcount Planning, Strategic Reporting; at most 100 characters |
65
+ | `--industry <text>` | `industry` | `General` for cross-industry; at most 100 characters |
66
+ | `--tags <csv>` | `tags` | replaces the list (duplicates dropped); `""` clears it |
67
+ | `--image pink\|purple\|yellow` | `report_image` | multipart upload of the bundled library image; no other image is accepted |
68
+
69
+ ## Typical flow
70
+
71
+ ```
72
+ dr template-library add 626287 --server US --account support@template.library-new \
73
+ --type "Financial Reporting" --industry Construction \
74
+ --tags "WIP, Job Costing, Backlog" --description-file card.txt --image purple
75
+ # re-run with the printed --confirm-token
76
+ dr template-library get <new id> --server US --account support@template.library-new
77
+ dr template-library publish <new id> --server US --account support@template.library-new
78
+ ```
79
+
80
+ Before publishing, check that `get` lists every table and field the file uses with a
81
+ system name: a field without one cannot be mapped during a customer's import.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-cli",
3
- "version": "1.6.162",
3
+ "version": "1.6.164",
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.30",
20
+ "@datarails-ai/dr-appspace-cli": "0.12.32",
21
21
  "@modelcontextprotocol/sdk": "^1.29.0",
22
22
  "@napi-rs/keyring": "^1.3.0",
23
23
  "commander": "^12.1.0",