@datarails-ai/dr-cli 0.0.1-locked → 1.6.70

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.
Files changed (58) hide show
  1. package/README.md +608 -0
  2. package/dist/chunk-DWMCBGQH.js +242 -0
  3. package/dist/cli.js +64468 -0
  4. package/dist/kb-6UWI7Q32.js +21 -0
  5. package/dist/scopes-map.json +4412 -0
  6. package/dist/skills/connector-sandbox/SKILL.md +95 -0
  7. package/dist/skills/datarails-connect-workato/SKILL.md +140 -0
  8. package/dist/skills/datarails-connectors-onboard-connector/SKILL.md +813 -0
  9. package/dist/skills/dr-cli/SKILL.md +659 -0
  10. package/dist/skills/dr-cli/reference/admin.md +796 -0
  11. package/dist/skills/dr-cli/reference/budget-builder.md +151 -0
  12. package/dist/skills/dr-cli/reference/calc-vals.md +73 -0
  13. package/dist/skills/dr-cli/reference/calcmodels.md +76 -0
  14. package/dist/skills/dr-cli/reference/cash.md +61 -0
  15. package/dist/skills/dr-cli/reference/dashboards-widgets.md +85 -0
  16. package/dist/skills/dr-cli/reference/datamappers.md +150 -0
  17. package/dist/skills/dr-cli/reference/desk.md +472 -0
  18. package/dist/skills/dr-cli/reference/filebox-documents.md +373 -0
  19. package/dist/skills/dr-cli/reference/forecast.md +51 -0
  20. package/dist/skills/dr-cli/reference/integrations.md +57 -0
  21. package/dist/skills/dr-cli/reference/lookups.md +168 -0
  22. package/dist/skills/dr-cli/reference/metrics.md +512 -0
  23. package/dist/skills/dr-cli/reference/multi-product.md +180 -0
  24. package/dist/skills/dr-cli/reference/reconciliation-mec.md +76 -0
  25. package/dist/skills/dr-cli/reference/rh-config.md +84 -0
  26. package/dist/skills/dr-cli/reference/safety.md +143 -0
  27. package/dist/skills/dr-cli/reference/spend-control.md +206 -0
  28. package/dist/skills/dr-cli/reference/templates.md +163 -0
  29. package/dist/skills/dr-cli/reference/workflows.md +137 -0
  30. package/dist/skills/dr-error-enrichment/SKILL.md +80 -0
  31. package/dist/skills/dr-error-enrichment/reference/core.md +257 -0
  32. package/dist/skills/dr-error-enrichment/reference/groundcover.md +84 -0
  33. package/dist/skills/dr-error-enrichment/reference/jira-bugs.md +219 -0
  34. package/dist/skills/dr-error-enrichment/reference/safety-backup.md +122 -0
  35. package/dist/skills/dr-error-enrichment-author/SKILL.md +219 -0
  36. package/dist/skills/dr-error-enrichment-improve/SKILL.md +218 -0
  37. package/dist/skills/dr-error-enrichment-maintain/SKILL.md +237 -0
  38. package/dist/skills/dr-error-enrichment-reconcile/SKILL.md +167 -0
  39. package/dist/skills/dr-filebox-api-setup/SKILL.md +170 -0
  40. package/dist/skills/dr-switch-user/SKILL.md +395 -0
  41. package/dist/skills/dr-validate/SKILL.md +392 -0
  42. package/dist/skills/dr-validate/report-template.html +950 -0
  43. package/dist/skills/fx-conversion-matrix/SKILL.md +763 -0
  44. package/dist/skills/fx-conversion-matrix/scripts/_args.mjs +52 -0
  45. package/dist/skills/fx-conversion-matrix/scripts/_xlsx.mjs +241 -0
  46. package/dist/skills/fx-conversion-matrix/scripts/build-matrix.mjs +366 -0
  47. package/dist/skills/fx-conversion-matrix/scripts/gen-mappers.mjs +171 -0
  48. package/dist/skills/fx-conversion-matrix/scripts/rates-to-xlsx.mjs +172 -0
  49. package/dist/skills/fx-onboard/SKILL.md +325 -0
  50. package/dist/skills/mec-table-validation/SKILL.md +383 -0
  51. package/dist/skills/plugins.json +24 -0
  52. package/dist/skills/validate-workato-migration/SKILL.md +167 -0
  53. package/dist/skills/validate-workato-migration/reference/gotchas.md +16 -0
  54. package/dist/skills/validate-workato-migration/reference/staging-orgs.md +26 -0
  55. package/dist/skills/validate-workato-migration/scripts/compare_files.py +255 -0
  56. package/dist/zendeskKb-JPSHVOPH.js +243 -0
  57. package/package.json +56 -9
  58. package/scripts/postinstall.mjs +91 -0
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: connector-sandbox
3
+ description: Use when running or testing a Datarails connector locally in the sandbox / dev fix-and-test loop — "run fmp_fx locally", "test this connector against dev", "sandbox the connector", "why does the connector return no rows", "see the connector's output as a CSV" — before publishing. Wraps dr connectors dev-fetch + dev-run.sh and resolves the dev IDs for you.
4
+ ---
5
+
6
+ # Connector Local Sandbox
7
+
8
+ Run a connector's LOCAL working-tree code against REAL dev config + creds and see the vendor
9
+ output as a local CSV — no publish→trigger cycle. Read-only: nothing lands in a filebox.
10
+
11
+ Two commands: `dr connectors dev-fetch` (dr-cli — pulls dev config+creds into a run dir) →
12
+ `scripts/dev-run.sh` (dr-connectors-runner — runs one hook in the flavor Docker image, writes
13
+ `output.csv`). Full design/README: `dr-connectors-runner/README.md` → "Local fix-and-test loop".
14
+
15
+ ## Prerequisites (check first, in order)
16
+
17
+ 1. On the corporate **VPN** (the connectors control-plane is VPN-only).
18
+ 2. **Docker** running, and **AcrPull** works: `docker pull datarailsdev.azurecr.io/connectors-runner-base:latest`.
19
+ 3. `dr` logged in to the dev account that owns the connector (see resolution below).
20
+ 4. **Windows: run `dev-run.sh` under WSL2** (it needs Docker Desktop's `/mnt/c` bind mounts +
21
+ `host.docker.internal`). The `dr connectors dev-fetch` step runs fine in normal PowerShell.
22
+
23
+ ## Step 1 — Gather 3 inputs from the user
24
+
25
+ Ask (via AskUserQuestion or plainly): **connector/vendor name** (e.g. `fmp_fx`), **server**
26
+ (default `DEV`), **account** (if unsure, run `dr whoami --server DEV` — it lists stored accounts).
27
+ Optional: `--hook` (default `fetch`), `--tag` (default `latest`). **Period (`--from/--to`):** required
28
+ when the connector's query needs a period and the data-query stores none (check `.config.query` in
29
+ step 2.4 — many connectors raise a hard error without a window); omit only if the connector doesn't
30
+ use one.
31
+
32
+ ## Step 2 — Resolve the runtime IDs (REQUIRED SUB-SKILL: dr-cli). NEVER guess IDs from memory.
33
+
34
+ The connector name is all you need; resolve the rest live. All reads — no confirmation needed.
35
+
36
+ 1. **Paths + account/org** — the connector lives at
37
+ `C:\codegithub\dr-connectors\dev\<orgId>_(<email>)\<vendor>\`. Glob for the `<vendor>` dir to get
38
+ `connections\<vendor>.py` + `dataqueries\<vendor>.py` (the `--connection`/`--query` paths) and the
39
+ org email. The dev account is usually `support@<email>` from that dir name (confirm in step 3).
40
+ 2. **Datasource id** — `dr integrations list --server <S> --account <A> --json`; pick the item whose
41
+ `name` contains the vendor and `type.name == "DatarailsConnector"` → its `id` (this is
42
+ `--datasource`).
43
+ - **Credentials:** `dev-fetch` passes the datasource's ENTIRE `config` through as the connector's
44
+ credentials — mirroring the production secret backend (`MonolithSecretBackend` returns
45
+ `ds["config"]` verbatim). So any auth shape works for any org: apikey, OAuth
46
+ `clientId`/`clientSecret`, service-account JSON, etc. — no per-field
47
+ allow-list. It only fails fast if the datasource has an empty/missing `config`.
48
+ 3. **Filebox + document id** — `dr filebox list --server <S> --account <A> --json`; find the
49
+ connector's target filebox → its `uuid` (the dev-fetch positional arg) and numeric `id` (this is
50
+ `--document-id`). Names can be ambiguous, so **confirm via step 4**.
51
+ 4. **Cross-check (disambiguates the filebox AND validates the wiring)** —
52
+ `dr filebox dq get <documentId> --server <S> --account <A> --json`: its `.connection` must equal
53
+ the datasource id from step 2, and `.config` holds `objectType`/`type`/`query`. If `.connection`
54
+ doesn't match, you picked the wrong filebox — try another.
55
+
56
+ ## Step 3 — Show resolved values, let the user confirm or override
57
+
58
+ Print a table: account, datasource id, filebox uuid, document id, connection path, query path, hook,
59
+ tag. Ask the user to confirm or override any value before running. Do NOT run until confirmed.
60
+
61
+ ## Step 4 — Run
62
+
63
+ ```bash
64
+ # fetch (dr-cli; PowerShell is fine)
65
+ dr connectors dev-fetch <fileboxUuid> --server <S> --account <A> \
66
+ --datasource <dsId> --document-id <docId> \
67
+ --connection "<path\to\connections\vendor.py>" --query "<path\to\dataqueries\vendor.py>" \
68
+ [--from <YYYY-MM-DD> --to <YYYY-MM-DD>] -o ./dev-run/<vendor>
69
+
70
+ # run (dr-connectors-runner; WSL2 on Windows) — <run_dir> is the SAME dir as -o above
71
+ ./scripts/dev-run.sh <run_dir> --hook <hook> --tag <tag>
72
+ ```
73
+
74
+ Expect `flavor=<f> image=… hook=<h>`, a `HookResult` verdict `ok`, and `<run_dir>/output.csv` with
75
+ real rows. The fix-and-test loop: edit `connection.py`/`query.py`, re-run ONLY `dev-run.sh` (no
76
+ re-fetch).
77
+
78
+ ## Interpreting failures
79
+
80
+ | Symptom | Meaning |
81
+ |---|---|
82
+ | `verdict: retry`, error mentions a missing credential key (e.g. `'apikey'`, `'clientId'`) | `dev-fetch` forwards the whole datasource `config`, so the key the connector's `connect()` reads simply isn't stored on the datasource — inspect `dr integrations get <dsId> --show-secrets` and check it against what `connect()` expects. |
83
+ | `datasource N has an empty/missing config` | The datasource has no `config` at all — nothing to use as credentials. Fix the datasource in the monolith first. |
84
+ | `verdict: retry`, error mentions `'objectType'` | The data_query fields aren't under `config` — check `dr filebox dq get <docId> --json`. |
85
+ | TLS / `self signed certificate` on `dr connectors …` | VPN is inspecting TLS — set `NODE_EXTRA_CA_CERTS=<gateway-ca.pem>`. Never `NODE_TLS_REJECT_UNAUTHORIZED=0`. |
86
+ | `connection refused` to the creds stub | Not on WSL2 / `host.docker.internal` unreachable — see Prereq 4. |
87
+ | `no such image` / manifest unknown | The flavor image tag isn't in ACR — try `--tag sha-<7digits>` of a deployed runner. |
88
+
89
+ ## Common mistakes
90
+
91
+ - Guessing the filebox/datasource/document id (or trusting a memory note) instead of resolving live —
92
+ always run step 2 + the step-4 cross-check.
93
+ - Running `dev-run.sh` from PowerShell on Windows (bind-mount/host.docker.internal breakage) — use WSL2.
94
+ - Forgetting `--account` on a multi-identity server (the read commands error and list the options).
95
+ - `secrets.json` in the run dir holds a real dev apikey — it's gitignored + chmod 600; never print or commit it.
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: datarails-connect-workato
3
+ description: Use when inspecting Datarails' Workato account from a terminal or script via the REST API — verifying the token, listing the parent workspace's recipes/connections, enumerating the 800+ embedded customer workspaces (managed_users), or drilling into one customer's connections/recipes/jobs to see what's syncing and why a recipe failed. Mentions of `WORKATO_API`, `wrkaus-`, `www.workato.com/api`, "workato recipe/connection", "managed user", "embedded customer workspace", "which customers are on workato", "why did the recipe fail", or a customer name whose bank/ERP feed runs on Workato all trigger this. READ-ONLY: only `GET` is permitted; the token is a live OEM admin key, so this skill never issues `POST`/`PUT`/`PATCH`/`DELETE`.
4
+ ---
5
+
6
+ # Datarails Workato REST Access
7
+
8
+ ## Overview
9
+
10
+ Datarails runs an **OEM / embedded** Workato account. The `WORKATO_API` token authenticates as the **parent workspace** ("Datarails Admin", `csintegrations@datarails.com`), which owns a handful of internal recipes **and** ~800 **managed_users** — one embedded Workato workspace per customer (their bank/ERP → Datarails feeds).
11
+
12
+ | Concept | What it is |
13
+ |---|---|
14
+ | **Parent workspace** | The account the token belongs to. `GET /users/me`, `GET /recipes`, `GET /connections` operate here. |
15
+ | **managed_user** | An embedded customer sub-workspace. Inspect via `GET /managed_users/{id}/...`. |
16
+
17
+ ## Auth
18
+
19
+ | Field | Value |
20
+ |---|---|
21
+ | Base URL (US) | `https://www.workato.com/api` |
22
+ | Base URL (EU) | `https://app.eu.workato.com/api` |
23
+ | Header | `Authorization: Bearer $WORKATO_API` |
24
+ | Env var | `WORKATO_API` — a Workato API-client token. Prefix **`wrkaus-`** = **US** datacenter (use the US base URL); a `wrkeu-`-style prefix would mean EU. |
25
+ | Validate | `curl.exe -sS "https://www.workato.com/api/users/me" -H "Authorization: Bearer $env:WORKATO_API" -w "\nHTTP %{http_code}\n"` → `200` + account JSON. (Drop `-w` when piping into `jq` — the trailing `HTTP 200` text is not JSON and breaks the parse.) |
26
+
27
+ `/users/me` returns the parent identity: `id`, `email`, `recipes_count`, `plan_id` (`oem_tbp_yearly`), billing period. Use `recipes_count` as the source of truth when paginating recipes.
28
+
29
+ ### Windows gotcha — `curl` is NOT curl (critical)
30
+
31
+ In **Windows PowerShell 5.1, `curl` is an alias for `Invoke-WebRequest`**, which does not understand `-H`, `-sS`, or `-w`. **Always call `curl.exe`** explicitly, or use `Invoke-RestMethod` natively. The Bash tool has real `curl`.
32
+
33
+ ```powershell
34
+ # PowerShell — real curl:
35
+ curl.exe -sS "https://www.workato.com/api/users/me" -H "Authorization: Bearer $env:WORKATO_API"
36
+ # or native, returns parsed objects:
37
+ Invoke-RestMethod "https://www.workato.com/api/users/me" -Headers @{ Authorization = "Bearer $($env:WORKATO_API)" }
38
+ ```
39
+ ```bash
40
+ # Bash tool:
41
+ curl -sS "https://www.workato.com/api/users/me" -H "Authorization: Bearer $WORKATO_API"
42
+ ```
43
+
44
+ ### Transient 401 — retry before concluding the token is bad
45
+
46
+ A **valid** token intermittently returns `401 Unauthorized` (empty body) and then `200` on the **identical** request seconds later. Before declaring the credential dead: confirm the env var is intact (length ~850, starts `wrkaus-`, no whitespace/newline) and **retry 2–3×**. A persistent 401 with a clean token = expired/revoked/wrong-datacenter.
47
+
48
+ ## Quick reference (verified endpoints)
49
+
50
+ All `GET`. Auth header on every call. Base = `https://www.workato.com/api`.
51
+
52
+ | Endpoint | Returns |
53
+ |---|---|
54
+ | `GET /users/me` | Parent identity: `id`, `email`, `recipes_count`, `plan_id`, billing period. |
55
+ | `GET /recipes?per_page=100&page=N` | Parent recipes. Each: `id`, `name`, `running`, `job_succeeded_count`, `job_failed_count`, `last_run_at`, `applications`. |
56
+ | `GET /connections?per_page=100` | Parent connections: `id`, `name`, `provider`, `authorization_status`. |
57
+ | `GET /managed_users?per_page=100&page=N` | Embedded customer workspaces: `id`, `name`, `external_id`, `plan_id`. Paginate — there are ~800. |
58
+ | `GET /managed_users/{id}` | One customer: `team_name`, `plan_id`, `task_count`, `active_connection_count`, `active_recipe_count`, `time_zone`, notification emails. |
59
+ | `GET /managed_users/{id}/connections` | That customer's connections (same shape as parent; `.result` array). |
60
+ | `GET /managed_users/{id}/recipes?per_page=100` | That customer's recipes (`.result` array). |
61
+ | `GET /managed_users/{id}/properties?prefix=<p>` | That customer's **environment properties** as `{"result":{"<key>":"<value>"}}`. `prefix` is **required** (omitting it → HTTP 400 `Missing parameter prefix`); it's a starts-with match on the key, so `prefix=<Vendor>` returns every `<Vendor> *` property. **This is where recipe `account_property` pills resolve — including credentials** (API keys, account numbers, tokens a recipe reads via `_dp('{"pill_type":"account_property","property_name":"<key>"}')`). |
62
+
63
+ ### Environment properties = where recipe credentials live
64
+
65
+ When a recipe's REST step sends a header like `Ocp-Apim-Subscription-Key: #{_dp('{"pill_type":"account_property","property_name":"<Vendor> API Key"}')}`, the value is **not** in the recipe code or the connection JSON — it's an **environment property** on that managed_user. Read it with the properties endpoint above (managed-user-scoped, `prefix` required):
66
+
67
+ ```bash
68
+ WK="https://www.workato.com/api"; AUTH="Authorization: Bearer $WORKATO_API"; MU=<managed_user_id>
69
+ curl -sS "$WK/managed_users/$MU/properties?prefix=<Vendor>" -H "$AUTH" \
70
+ | jq '.result' # -> {"<Vendor> Account Number":"…","<Vendor> API Key":"…"}
71
+ ```
72
+
73
+ - The `prefix` is the fastest way to enumerate a vendor's props — pass the property-name stem the recipe uses.
74
+ - **The parent-scoped forms return `{}` — they do not work for a managed_user's props:** `GET /properties?prefix=<p>` (parent's own props only) and `GET /properties?managed_user_id={id}&prefix=<p>` (verified `{}`, `managed_user_id` is ignored). Always use the `/managed_users/{id}/properties` path.
75
+ - Still `GET`, so read-only-safe — but these values are **live customer secrets**. Never echo, log, or commit them; pipe straight into the consuming command (e.g. build a datasource payload in the same shell call) and reference via a variable only. See the READ-ONLY / secrecy rules below.
76
+
77
+ **List envelopes differ per endpoint** (verified) — never assume. Use the universal idiom **`(.items? // .result? // .)`** (the `?` matters: `.result` on a bare array is a *hard error*, not a catchable null):
78
+
79
+ | Endpoint | Array lives under |
80
+ |---|---|
81
+ | `/recipes` | `.items` (`{count, items, page, per_page}`) |
82
+ | `/connections` | **bare array** |
83
+ | `/managed_users` | `.result` |
84
+ | `/managed_users/{id}/recipes` | `.result` (`{count, page, per_page, result}`) |
85
+ | `/managed_users/{id}/connections` | `.result` |
86
+
87
+ Managed-user plan_ids seen: `oem_enterprise` (majority), `oem_enterprise_files`, `oem_enterprise_ai`, `datarails_plus`.
88
+
89
+ **Endpoints that 404** (don't exist / wrong path): `GET /managed_users/{id}/usage`, `GET /managed_users/{id}/member_instances`.
90
+
91
+ ## Pagination — dedupe by `id`
92
+
93
+ The `page` parameter is **1-based**; `page=0` can re-return page 1 and inflate counts with duplicates. Always **dedupe by `id`** and cross-check against `recipes_count` from `/users/me`. Stop when a page returns `< per_page` items.
94
+
95
+ ## Recipes helper (curl + jq)
96
+
97
+ ```bash
98
+ WK="https://www.workato.com/api"; AUTH="Authorization: Bearer $WORKATO_API"
99
+
100
+ # Parent recipes, one line each, most-run first (note .items envelope):
101
+ curl -sS "$WK/recipes?per_page=100&page=1" -H "$AUTH" \
102
+ | jq -r '(.items? // .result? // .) | unique_by(.id) | sort_by(-.job_succeeded_count)[]
103
+ | "\(.id)\t\(if .running then "RUN" else "off" end)\t\(.job_succeeded_count)ok/\(.job_failed_count)fail\t\(.name)"'
104
+
105
+ # Find a customer workspace by name:
106
+ curl -sS "$WK/managed_users?per_page=100&page=1" -H "$AUTH" \
107
+ | jq -r '(.items? // .result? // .)[] | select(.name|test("Ares";"i")) | "\(.id)\t\(.plan_id)\t\(.name)"'
108
+
109
+ # One customer's connections + recipes (swap in the id):
110
+ ID=8109205
111
+ curl -sS "$WK/managed_users/$ID" -H "$AUTH" | jq '{team_name,plan_id,task_count,active_connection_count,active_recipe_count}'
112
+ curl -sS "$WK/managed_users/$ID/connections" -H "$AUTH" | jq -r '(.items? // .result? // .)[] | "\(.name)\t\(.provider)\t\(.authorization_status // "UNAUTHORIZED")"'
113
+ curl -sS "$WK/managed_users/$ID/recipes?per_page=100" -H "$AUTH" | jq -r '(.items? // .result? // .)[] | "\(if .running then "RUN" else "off" end)\t\(.job_succeeded_count)ok/\(.job_failed_count)fail\t\(.name)"'
114
+ ```
115
+
116
+ `authorization_status`: `success` = wired; `null` = placeholder connection whose creds were never entered (common for the "ADD CLIENT ... CREDENTIALS" / SFTP stubs). A recipe with a nonzero `job_failed_count` is the first place to look when a customer's feed is stale.
117
+
118
+ ## Common mistakes
119
+
120
+ | Symptom | Cause | Fix |
121
+ |---|---|---|
122
+ | `-H`/`-w` errors, HTML output in PowerShell | `curl` aliased to `Invoke-WebRequest` | Call `curl.exe`, or use `Invoke-RestMethod`. |
123
+ | `401 Unauthorized`, empty body, token looks fine | Transient Workato auth hiccup | Retry 2–3×; a clean token usually succeeds on retry. |
124
+ | `401` persists with a verified token | Expired/revoked or wrong datacenter | Regenerate in Workato admin → API clients; confirm `wrkaus-` → US base URL. |
125
+ | Recipe count looks doubled (e.g. "231" when `/users/me` says 131) | `page=0` re-returned page 1 | Dedupe by `id`; page is 1-based; trust `recipes_count`. |
126
+ | `404` on `/managed_users/{id}/usage` or `/member_instances` | Those paths don't exist | Use `/managed_users/{id}` for counts; `/connections` and `/recipes` for detail. |
127
+ | `jq: Cannot iterate` | Endpoint returned a bare array, not `{result:[]}` | Handle both: `(.result // .)`. |
128
+
129
+ ## READ-ONLY — hard rule
130
+
131
+ **This skill is strictly read-only. Only `GET` requests are permitted.** `WORKATO_API` is a **live OEM admin credential** with reach into 800+ customer workspaces, and any write is outward-facing — it can start/stop a customer's recipes, break a connection, or create/delete a managed_user, disrupting live financial data feeds.
132
+
133
+ **Never issue `POST`, `PUT`, `PATCH`, or `DELETE` under this skill.** No exceptions:
134
+ - Not "just to restart a failed recipe."
135
+ - Not "just to re-authorize a connection."
136
+ - Not because the user's phrasing implies a fix.
137
+
138
+ If a task genuinely needs a write, **stop and surface it to the user as an explicit, separate request** — do not perform it as part of this skill. Describe what the write would do and let the user decide and run it deliberately.
139
+
140
+ **Secrecy:** Never echo, commit, or paste the token into a web tool — reference it only as `$WORKATO_API`; when confirming it's set, log only length + first ~6 chars (`wrkaus`).