@dataworks-technology/cli 1.1.0 → 1.3.0
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/.agents/plugins/marketplace.json +20 -0
- package/.claude-plugin/marketplace.json +16 -0
- package/README.md +174 -12
- package/bin/mcp.js +9 -0
- package/bin/postinstall.js +23 -0
- package/dist/commands/agents/install.d.ts +17 -0
- package/dist/commands/agents/install.d.ts.map +1 -0
- package/dist/commands/agents/install.js +57 -0
- package/dist/commands/agents/install.js.map +1 -0
- package/dist/commands/agents/reminder.d.ts +16 -0
- package/dist/commands/agents/reminder.d.ts.map +1 -0
- package/dist/commands/agents/reminder.js +45 -0
- package/dist/commands/agents/reminder.js.map +1 -0
- package/dist/commands/auth/login.d.ts.map +1 -1
- package/dist/commands/auth/login.js +1 -1
- package/dist/commands/auth/login.js.map +1 -1
- package/dist/commands/commands.d.ts.map +1 -1
- package/dist/commands/commands.js +4 -0
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/events/subscribe.d.ts +7 -1
- package/dist/commands/events/subscribe.d.ts.map +1 -1
- package/dist/commands/events/subscribe.js +56 -3
- package/dist/commands/events/subscribe.js.map +1 -1
- package/dist/commands/ingest.d.ts +31 -3
- package/dist/commands/ingest.d.ts.map +1 -1
- package/dist/commands/ingest.js +69 -9
- package/dist/commands/ingest.js.map +1 -1
- package/dist/commands/tenant/list.d.ts +13 -0
- package/dist/commands/tenant/list.d.ts.map +1 -0
- package/dist/commands/tenant/list.js +45 -0
- package/dist/commands/tenant/list.js.map +1 -0
- package/dist/commands/tenant/select.d.ts.map +1 -1
- package/dist/commands/tenant/select.js +12 -5
- package/dist/commands/tenant/select.js.map +1 -1
- package/dist/generated/operations.d.ts +46 -4
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +39 -11
- package/dist/generated/operations.js.map +1 -1
- package/dist/help.js +4 -4
- package/dist/help.js.map +1 -1
- package/dist/lib/agent-install.d.ts +24 -0
- package/dist/lib/agent-install.d.ts.map +1 -0
- package/dist/lib/agent-install.js +196 -0
- package/dist/lib/agent-install.js.map +1 -0
- package/dist/lib/agent-reminder.d.ts +17 -0
- package/dist/lib/agent-reminder.d.ts.map +1 -0
- package/dist/lib/agent-reminder.js +81 -0
- package/dist/lib/agent-reminder.js.map +1 -0
- package/dist/lib/browser-auth.d.ts +1 -0
- package/dist/lib/browser-auth.d.ts.map +1 -1
- package/dist/lib/browser-auth.js +58 -4
- package/dist/lib/browser-auth.js.map +1 -1
- package/dist/lib/cognito.d.ts +2 -0
- package/dist/lib/cognito.d.ts.map +1 -1
- package/dist/lib/cognito.js +38 -9
- package/dist/lib/cognito.js.map +1 -1
- package/dist/lib/command.d.ts +1 -0
- package/dist/lib/command.d.ts.map +1 -1
- package/dist/lib/command.js +5 -0
- package/dist/lib/command.js.map +1 -1
- package/dist/lib/http-transport.d.ts.map +1 -1
- package/dist/lib/http-transport.js +31 -8
- package/dist/lib/http-transport.js.map +1 -1
- package/dist/lib/operation-command.d.ts.map +1 -1
- package/dist/lib/operation-command.js +15 -3
- package/dist/lib/operation-command.js.map +1 -1
- package/dist/lib/operation-types.d.ts +4 -0
- package/dist/lib/operation-types.d.ts.map +1 -1
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +47 -6
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/query-metrics.d.ts +72 -0
- package/dist/lib/query-metrics.d.ts.map +1 -0
- package/dist/lib/query-metrics.js +383 -0
- package/dist/lib/query-metrics.js.map +1 -0
- package/dist/lib/raw-graphql-command.d.ts.map +1 -1
- package/dist/lib/raw-graphql-command.js +4 -2
- package/dist/lib/raw-graphql-command.js.map +1 -1
- package/dist/lib/tenants.d.ts +1 -1
- package/dist/lib/tenants.d.ts.map +1 -1
- package/dist/lib/tenants.js +5 -1
- package/dist/lib/tenants.js.map +1 -1
- package/dist/mcp/main.d.ts +2 -0
- package/dist/mcp/main.d.ts.map +1 -0
- package/dist/mcp/main.js +7 -0
- package/dist/mcp/main.js.map +1 -0
- package/dist/mcp/server.d.ts +85 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +235 -0
- package/dist/mcp/server.js.map +1 -0
- package/oclif.manifest.json +1026 -831
- package/package.json +24 -4
- package/plugins/dataworks/.claude-plugin/plugin.json +17 -0
- package/plugins/dataworks/.codex-plugin/plugin.json +37 -0
- package/plugins/dataworks/.mcp.json +8 -0
- package/plugins/dataworks/skills/query-dataworks-metrics/SKILL.md +48 -0
- package/plugins/dataworks/skills/query-dataworks-metrics/agents/openai.yaml +13 -0
- package/schema/operation-overrides.json +49 -0
- package/skills/dataworks-cli/SKILL.md +129 -15
- package/skills/dataworks-cli/agents/openai.yaml +4 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dataworks-cli",
|
|
3
|
+
"interface": {
|
|
4
|
+
"displayName": "Dataworks CLI"
|
|
5
|
+
},
|
|
6
|
+
"plugins": [
|
|
7
|
+
{
|
|
8
|
+
"name": "dataworks",
|
|
9
|
+
"source": {
|
|
10
|
+
"source": "local",
|
|
11
|
+
"path": "./plugins/dataworks"
|
|
12
|
+
},
|
|
13
|
+
"policy": {
|
|
14
|
+
"installation": "AVAILABLE",
|
|
15
|
+
"authentication": "ON_INSTALL"
|
|
16
|
+
},
|
|
17
|
+
"category": "Data"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dataworks-cli",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "Dataworks Technology"
|
|
5
|
+
},
|
|
6
|
+
"metadata": {
|
|
7
|
+
"description": "Official Dataworks CLI integrations for Claude Code"
|
|
8
|
+
},
|
|
9
|
+
"plugins": [
|
|
10
|
+
{
|
|
11
|
+
"name": "dataworks",
|
|
12
|
+
"source": "./plugins/dataworks",
|
|
13
|
+
"description": "Query Dataworks athlete metrics using the authenticated local CLI session"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
package/README.md
CHANGED
|
@@ -22,14 +22,16 @@ The `dw` binary turns the public GraphQL contract published by `@dataworks-techn
|
|
|
22
22
|
|
|
23
23
|
| Command | Description |
|
|
24
24
|
| --------------------- | ----------------------------------------------------------- |
|
|
25
|
+
| `dw agents install` | Install the Dataworks skill and MCP tools for AI agents |
|
|
25
26
|
| `dw auth ...` | Log in, log out, and inspect the active UAT or Live session |
|
|
27
|
+
| `dw autocomplete` | Install shell completion for commands and flags |
|
|
26
28
|
| `dw data ...` | Run schema-derived queries, mutations, and subscriptions |
|
|
27
29
|
| `dw ingest` | Send athlete metrics to the Data Engine ingest endpoint |
|
|
28
30
|
| `dw events subscribe` | Subscribe to AppSync Events channels |
|
|
29
31
|
| `dw graphql ...` | Run raw GraphQL queries, mutations, and subscriptions |
|
|
30
32
|
| `dw report-error` | Report a datasource error |
|
|
31
|
-
| `dw tenant
|
|
32
|
-
| `dw commands` | Print the complete
|
|
33
|
+
| `dw tenant ...` | List or select the tenant used by subsequent commands |
|
|
34
|
+
| `dw commands` | Print the complete command inventory |
|
|
33
35
|
|
|
34
36
|
---
|
|
35
37
|
|
|
@@ -41,7 +43,7 @@ The `dw` binary turns the public GraphQL contract published by `@dataworks-techn
|
|
|
41
43
|
|
|
42
44
|
---
|
|
43
45
|
|
|
44
|
-
##
|
|
46
|
+
## Quickstart
|
|
45
47
|
|
|
46
48
|
1. **Install the CLI:**
|
|
47
49
|
|
|
@@ -54,7 +56,7 @@ The `dw` binary turns the public GraphQL contract published by `@dataworks-techn
|
|
|
54
56
|
|
|
55
57
|
```sh
|
|
56
58
|
dw auth login --environment uat
|
|
57
|
-
dw auth status
|
|
59
|
+
dw auth status
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
The CLI opens Dataworks Managed Login in your browser and never receives your password. Sessions are stored in the operating-system credential store, never in the Dataworks config file. If a browser cannot be opened automatically, pass `--no-browser` and visit the displayed URL on the same computer. Headless jobs can provide a protected `DW_SESSION_JSON` secret instead.
|
|
@@ -63,33 +65,116 @@ The `dw` binary turns the public GraphQL contract published by `@dataworks-techn
|
|
|
63
65
|
`--client-id`, `DW_UAT_CLIENT_ID`, `DW_LIVE_CLIENT_ID`, or `DW_CLIENT_ID` when
|
|
64
66
|
testing a different app client.
|
|
65
67
|
|
|
66
|
-
3. **
|
|
67
|
-
|
|
68
|
+
3. **List and select a tenant.** The selection is saved to your local profile
|
|
69
|
+
and used by subsequent commands.
|
|
68
70
|
|
|
69
71
|
```bash
|
|
72
|
+
dw tenant list
|
|
70
73
|
dw tenant select
|
|
71
74
|
dw tenant select tenant-123
|
|
72
75
|
```
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
`dw tenant list` shows the friendly name, ID, and current selection. Agents
|
|
78
|
+
and scripts should use `dw tenant list --json`.
|
|
76
79
|
|
|
77
80
|
4. **Discover and run commands:**
|
|
78
81
|
|
|
79
82
|
```sh
|
|
80
|
-
dw commands
|
|
81
|
-
dw data athlete list
|
|
83
|
+
dw commands
|
|
84
|
+
dw data athlete list
|
|
82
85
|
dw data athlete create --name "Ada" --date-of-birth 1992-01-01
|
|
83
86
|
```
|
|
84
87
|
|
|
85
88
|
Generated command documentation is available in [`docs/commands`](./docs/commands/README.md).
|
|
86
89
|
|
|
90
|
+
5. **Enable Dataworks in Codex or Claude Code:**
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
dw agents install
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This detects supported clients and installs the complete Dataworks plugin:
|
|
97
|
+
the metric-query skill plus its read-only `query_metrics` MCP server. Start a
|
|
98
|
+
new Codex thread after installation. In Claude Code, run `/reload-plugins` or
|
|
99
|
+
start a new session. To configure only one client, use
|
|
100
|
+
`dw agents install codex` or `dw agents install claude-code`.
|
|
101
|
+
|
|
102
|
+
Until setup is completed, interactive CLI use prints this reminder at most
|
|
103
|
+
once every 24 hours. It never appears with `--json`. Permanently hide it with
|
|
104
|
+
`dw agents reminder disable`, restore it with `dw agents reminder enable`, or
|
|
105
|
+
set `DW_NO_AGENT_REMINDER=1` for a single process or automation environment.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Bash autocomplete
|
|
110
|
+
|
|
111
|
+
Generate the completion cache and print the one-time Bash setup instructions:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
dw autocomplete bash
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Global npm installs and upgrades run this command automatically. It prepares the
|
|
118
|
+
latest completion cache and prints the setup instruction, but does not edit your
|
|
119
|
+
shell startup files. If npm cannot access the shell cache, installation still
|
|
120
|
+
succeeds and you can retry with `dw autocomplete bash`.
|
|
121
|
+
|
|
122
|
+
After following the displayed instruction and reloading Bash, press Tab to
|
|
123
|
+
complete `dw` command names and flags. Run `dw autocomplete --refresh-cache`
|
|
124
|
+
after installing a release that adds commands.
|
|
125
|
+
|
|
126
|
+
## AI agent metric queries
|
|
127
|
+
|
|
128
|
+
The package includes a focused, read-only MCP server with one tool:
|
|
129
|
+
`query_metrics`. It uses the same OS-backed login session and selected tenant as
|
|
130
|
+
`dw`, resolves an athlete by exact ID or unique name, maps common metric aliases,
|
|
131
|
+
polls asynchronous Data Explorer queries, and returns normalized structured
|
|
132
|
+
rows. GPS values include decoded latitude and longitude; heart-rate values use
|
|
133
|
+
numeric BPM when valid.
|
|
134
|
+
|
|
135
|
+
The simplest setup for Codex and Claude Code is:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
dw agents install
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The command is safe to rerun after upgrades. It installs or updates the complete
|
|
142
|
+
Dataworks plugin for each detected client and reports the reload or restart step.
|
|
143
|
+
If an old marketplace registration points to a different CLI installation, rerun
|
|
144
|
+
with `--force`.
|
|
145
|
+
|
|
146
|
+
Successful setup automatically disables the periodic CLI reminder. To opt out
|
|
147
|
+
without installing an agent integration, run `dw agents reminder disable`.
|
|
148
|
+
|
|
149
|
+
Other MCP clients can launch the installed `dw-mcp` binary directly:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"mcpServers": {
|
|
154
|
+
"dataworks": {
|
|
155
|
+
"command": "dw-mcp",
|
|
156
|
+
"args": []
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The npm package ships a cross-compatible Codex and Claude Code plugin at
|
|
163
|
+
`plugins/dataworks`. Its focused skill turns requests such as “give me the last
|
|
164
|
+
30 GPS values for James Haigh” into a `query_metrics` call. The tool accepts
|
|
165
|
+
exactly one of `athlete_id` or `athlete_name`, plus `metric`; optional inputs are
|
|
166
|
+
`limit`, `order`, `from`, `to`, `event_id`, `dataset_datasource_id`,
|
|
167
|
+
`tenant_id`, `metric_category`, and `timeout_ms`.
|
|
168
|
+
|
|
169
|
+
The server never performs mutations. If name resolution is ambiguous, it
|
|
170
|
+
returns candidates and requires an explicit athlete ID rather than guessing.
|
|
171
|
+
|
|
87
172
|
---
|
|
88
173
|
|
|
89
174
|
## Output and Safety
|
|
90
175
|
|
|
91
|
-
- Commands
|
|
92
|
-
-
|
|
176
|
+
- Commands render human-readable tables by default.
|
|
177
|
+
- Pass `--json` for scripts and agents. Finite results use a stable `{data,meta}` envelope; subscriptions and other streams emit newline-delimited JSON (NDJSON).
|
|
93
178
|
- Generated mutations support `--dry-run --json` to render a request without sending it.
|
|
94
179
|
- Destructive mutations and all Live mutations require confirmation; non-interactive callers must pass `--yes`.
|
|
95
180
|
- Passwords, tokens, authorization headers, secrets, and API keys are redacted from structured output.
|
|
@@ -106,6 +191,83 @@ dw data athlete delete --public-id athlete-123 --yes
|
|
|
106
191
|
dw graphql query --document @query.graphql --variables @variables.json --json
|
|
107
192
|
```
|
|
108
193
|
|
|
194
|
+
### Ingest metrics
|
|
195
|
+
|
|
196
|
+
`dw ingest` validates and sends athlete metrics to an event and
|
|
197
|
+
dataset-datasource. Each metric requires `athletePublicId`, `metric`, `value`,
|
|
198
|
+
and a positive integer `timestamp`. Pass either an inline JSON array, a
|
|
199
|
+
`{ "metrics": [...] }` object, `@filename`, or `-` to read JSON from standard
|
|
200
|
+
input.
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
# Inline JSON
|
|
204
|
+
dw ingest --event event-123 --dataset-datasource ds-456 --metrics '[{"athletePublicId":"ath-1","metric":"heartrate_calculated","value":172,"timestamp":1700000000}]'
|
|
205
|
+
|
|
206
|
+
# File input; strict validation rejects the whole batch if any metric is invalid
|
|
207
|
+
dw ingest --event event-123 --dataset-datasource ds-456 --metrics @metrics.json
|
|
208
|
+
|
|
209
|
+
# Send valid metrics, report dropped invalid metrics, and return stable JSON
|
|
210
|
+
dw ingest --event event-123 --dataset-datasource ds-456 --metrics @metrics.json --best-effort --json
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Subscribe to realtime events
|
|
214
|
+
|
|
215
|
+
Realtime metric channels use
|
|
216
|
+
`dataworks/<dataset-datasource-id>/<event-id>/<metric-or-*>`. Use `*` to watch
|
|
217
|
+
every metric for that dataset-datasource/event pair or a metric name to narrow
|
|
218
|
+
the stream. A leading `/` is optional. Human output is tabular; add `--json` for
|
|
219
|
+
NDJSON.
|
|
220
|
+
|
|
221
|
+
Press `Ctrl+C` once to close the WebSocket subscription and return to the
|
|
222
|
+
shell.
|
|
223
|
+
|
|
224
|
+
```sh
|
|
225
|
+
# Watch all metrics for dataset-datasource 1 and event 1
|
|
226
|
+
dw events subscribe --channel dataworks/1/1/*
|
|
227
|
+
|
|
228
|
+
# Watch only heart-rate metrics as NDJSON
|
|
229
|
+
dw events subscribe --channel dataworks/1/1/heartrate --json
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Query Data Explorer
|
|
233
|
+
|
|
234
|
+
`dw data data-explorer execute` queries metric storage with an explicit column
|
|
235
|
+
list and metric category. Optional fields support Data Explorer filter rules,
|
|
236
|
+
aggregation, grouping, ordering, limits, and polling an asynchronous
|
|
237
|
+
`queryExecutionId`. The category must be `METRICS_TYPE_A`, `METRICS_TYPE_B`, or
|
|
238
|
+
`METRICS_TYPE_C`; `--columns` is a JSON array.
|
|
239
|
+
|
|
240
|
+
```sh
|
|
241
|
+
# Keep a filtered GPS query in a reusable JSON file
|
|
242
|
+
dw data data-explorer execute --input @gps-query.json --json
|
|
243
|
+
|
|
244
|
+
# Return the latest 30 GPS positions for one athlete
|
|
245
|
+
dw data data-explorer execute --columns '["timestamp","athletepublicid","current"]' --metric-category METRICS_TYPE_A --filter-rules '{"combinator":"and","rules":[{"field":"metric","operator":"in","value":"latlong"},{"field":"athletepublicid","operator":"in","value":"athlete-123"}]}' --limit 30 --order-by timestamp --order-direction DESC --json
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The corresponding `gps-query.json` contains the same fields without CLI flag
|
|
249
|
+
conversion:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"columns": ["timestamp", "athletepublicid", "metric", "current"],
|
|
254
|
+
"metricCategory": "METRICS_TYPE_A",
|
|
255
|
+
"filterRules": "{\"combinator\":\"and\",\"rules\":[{\"field\":\"metric\",\"operator\":\"in\",\"value\":\"latlong\"},{\"field\":\"athletepublicid\",\"operator\":\"in\",\"value\":\"athlete-123\"}]}",
|
|
256
|
+
"limit": 30,
|
|
257
|
+
"orderBy": "timestamp",
|
|
258
|
+
"orderDirection": "DESC"
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
`filterRules` is an AWSJSON string containing a top-level `combinator` and a
|
|
263
|
+
`rules` array. Each rule has `field`, `operator`, and string `value`; supported
|
|
264
|
+
operators include `=`, `!=`, `>`, `<`, `>=`, `<=`, `contains`, and `in`.
|
|
265
|
+
Multiple values for `in` are comma-separated. GPS is metric `latlong` in
|
|
266
|
+
`METRICS_TYPE_A`; the `current` value is a `latitude:longitude` string. Run
|
|
267
|
+
`dw data data-explorer execute --help` for the complete flag list and examples.
|
|
268
|
+
In `--json` output, `rows` is AWSJSON and may need JSON-decoding until it becomes
|
|
269
|
+
an array; default table output performs that decoding for humans.
|
|
270
|
+
|
|
109
271
|
---
|
|
110
272
|
|
|
111
273
|
## Common Commands
|
package/bin/mcp.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runDataworksMcpServer } from "../dist/mcp/main.js";
|
|
3
|
+
|
|
4
|
+
runDataworksMcpServer().catch((error) => {
|
|
5
|
+
process.stderr.write(
|
|
6
|
+
`Dataworks MCP server failed: ${error instanceof Error ? error.message : String(error)}\n`,
|
|
7
|
+
);
|
|
8
|
+
process.exitCode = 1;
|
|
9
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
// npm runs postinstall for both first-time global installs and global upgrades.
|
|
6
|
+
// Avoid writing shell caches when this package is only a project dependency.
|
|
7
|
+
if (
|
|
8
|
+
process.env.npm_config_global === "true" ||
|
|
9
|
+
process.env.npm_config_location === "global"
|
|
10
|
+
) {
|
|
11
|
+
const runPath = fileURLToPath(new URL("./run.js", import.meta.url));
|
|
12
|
+
const result = spawnSync(process.execPath, [runPath, "autocomplete", "bash"], {
|
|
13
|
+
stdio: "inherit",
|
|
14
|
+
});
|
|
15
|
+
if (result.error || result.status !== 0) {
|
|
16
|
+
process.stderr.write(
|
|
17
|
+
"Dataworks CLI installed, but Bash autocomplete setup could not be prepared. Run `dw autocomplete bash` to retry.\n",
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
process.stdout.write(
|
|
21
|
+
"To use Dataworks from Codex or Claude Code, run `dw agents install` once.\n",
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataworksCommand } from "../../lib/command.js";
|
|
2
|
+
export default class AgentsInstall extends DataworksCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: {
|
|
5
|
+
description: string;
|
|
6
|
+
command: string;
|
|
7
|
+
}[];
|
|
8
|
+
static args: {
|
|
9
|
+
client: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/agents/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AASxD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,gBAAgB;IACzD,OAAgB,WAAW,SAC2D;IACtF,OAAgB,QAAQ;;;QAiBtB;IACF,OAAgB,IAAI;;MAMlB;IACF,OAAgB,KAAK;;;MAKnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4BlC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Args, Flags } from "@oclif/core";
|
|
2
|
+
import { DataworksCommand } from "../../lib/command.js";
|
|
3
|
+
import { installAgentIntegration, supportedAgentClients, } from "../../lib/agent-install.js";
|
|
4
|
+
import { writeResult } from "../../lib/output.js";
|
|
5
|
+
import { configureAgentReminder } from "../../lib/agent-reminder.js";
|
|
6
|
+
export default class AgentsInstall extends DataworksCommand {
|
|
7
|
+
static description = "Install the Dataworks skill and query_metrics MCP server for Codex or Claude Code";
|
|
8
|
+
static examples = [
|
|
9
|
+
{
|
|
10
|
+
description: "Set up every supported agent client found on this machine",
|
|
11
|
+
command: "dw agents install",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
description: "Set up Codex only",
|
|
15
|
+
command: "dw agents install codex",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
description: "Set up Claude Code only",
|
|
19
|
+
command: "dw agents install claude-code",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
description: "Replace a stale Dataworks marketplace registration",
|
|
23
|
+
command: "dw agents install codex --force",
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
static args = {
|
|
27
|
+
client: Args.string({
|
|
28
|
+
description: "Agent client to configure; omit to detect and configure both",
|
|
29
|
+
options: ["codex", "claude-code"],
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
static flags = {
|
|
34
|
+
force: Flags.boolean({
|
|
35
|
+
description: "Replace an existing Dataworks marketplace registration",
|
|
36
|
+
}),
|
|
37
|
+
json: Flags.boolean({ description: "Emit stable JSON output" }),
|
|
38
|
+
};
|
|
39
|
+
async run() {
|
|
40
|
+
const { args, flags } = await this.parse(AgentsInstall);
|
|
41
|
+
const clients = args.client ? [args.client] : supportedAgentClients;
|
|
42
|
+
const results = clients.map((client) => installAgentIntegration(client, { force: flags.force }));
|
|
43
|
+
if (results.some(({ status }) => status === "installed" || status === "updated")) {
|
|
44
|
+
await configureAgentReminder("configured");
|
|
45
|
+
}
|
|
46
|
+
writeResult({ integrations: results }, {
|
|
47
|
+
json: flags.json,
|
|
48
|
+
meta: {
|
|
49
|
+
restartRequired: results.some(({ status }) => status === "installed" || status === "updated"),
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
if (results.every(({ status }) => status === "unavailable" || status === "failed")) {
|
|
53
|
+
process.exitCode = 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/agents/install.ts"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AAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAqB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC;QACnF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACrC,uBAAuB,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CACxD,CAAC;QACF,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,SAAS,CAAC,EAAE,CAAC;YACjF,MAAM,sBAAsB,CAAC,YAAY,CAAC,CAAC;QAC7C,CAAC;QAED,WAAW,CACT,EAAE,YAAY,EAAE,OAAO,EAAE,EACzB;YACE,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE;gBACJ,eAAe,EAAE,OAAO,CAAC,IAAI,CAC3B,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,SAAS,CAC/D;aACF;SACF,CACF,CAAC;QAEF,IACE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,aAAa,IAAI,MAAM,KAAK,QAAQ,CAAC,EAC9E,CAAC;YACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataworksCommand } from "../../lib/command.js";
|
|
2
|
+
export default class AgentsReminder extends DataworksCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: {
|
|
5
|
+
description: string;
|
|
6
|
+
command: string;
|
|
7
|
+
}[];
|
|
8
|
+
static args: {
|
|
9
|
+
action: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=reminder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder.d.ts","sourceRoot":"","sources":["../../../src/commands/agents/reminder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AASxD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,gBAAgB;IAC1D,OAAgB,WAAW,SACwC;IACnE,OAAgB,QAAQ;;;QAatB;IACF,OAAgB,IAAI;;MAMlB;IACF,OAAgB,KAAK;;MAEnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiBlC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Args, Flags } from "@oclif/core";
|
|
2
|
+
import { DataworksCommand } from "../../lib/command.js";
|
|
3
|
+
import { configureAgentReminder, readAgentReminderPreferences, } from "../../lib/agent-reminder.js";
|
|
4
|
+
import { writeResult } from "../../lib/output.js";
|
|
5
|
+
export default class AgentsReminder extends DataworksCommand {
|
|
6
|
+
static description = "Inspect, disable, or enable the Dataworks agent setup reminder";
|
|
7
|
+
static examples = [
|
|
8
|
+
{
|
|
9
|
+
description: "Permanently hide the agent setup reminder",
|
|
10
|
+
command: "dw agents reminder disable",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
description: "Show the reminder again when setup is incomplete",
|
|
14
|
+
command: "dw agents reminder enable",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
description: "Inspect the current reminder state",
|
|
18
|
+
command: "dw agents reminder status --json",
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
static args = {
|
|
22
|
+
action: Args.string({
|
|
23
|
+
description: "Reminder action",
|
|
24
|
+
options: ["status", "disable", "enable"],
|
|
25
|
+
default: "status",
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
static flags = {
|
|
29
|
+
json: Flags.boolean({ description: "Emit stable JSON output" }),
|
|
30
|
+
};
|
|
31
|
+
async run() {
|
|
32
|
+
const { args, flags } = await this.parse(AgentsReminder);
|
|
33
|
+
const action = args.action;
|
|
34
|
+
const reminder = action === "status"
|
|
35
|
+
? await readAgentReminderPreferences()
|
|
36
|
+
: await configureAgentReminder(action);
|
|
37
|
+
writeResult({
|
|
38
|
+
reminder: {
|
|
39
|
+
...reminder,
|
|
40
|
+
enabled: !reminder.disabled && !reminder.configured,
|
|
41
|
+
},
|
|
42
|
+
}, { json: flags.json });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=reminder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder.js","sourceRoot":"","sources":["../../../src/commands/agents/reminder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,gBAAgB;IAC1D,MAAM,CAAU,WAAW,GACzB,gEAAgE,CAAC;IACnE,MAAM,CAAU,QAAQ,GAAG;QACzB;YACE,WAAW,EAAE,2CAA2C;YACxD,OAAO,EAAE,4BAA4B;SACtC;QACD;YACE,WAAW,EAAE,kDAAkD;YAC/D,OAAO,EAAE,2BAA2B;SACrC;QACD;YACE,WAAW,EAAE,oCAAoC;YACjD,OAAO,EAAE,kCAAkC;SAC5C;KACF,CAAC;IACF,MAAM,CAAU,IAAI,GAAG;QACrB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;YAClB,WAAW,EAAE,iBAAiB;YAC9B,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;YACxC,OAAO,EAAE,QAAQ;SAClB,CAAC;KACH,CAAC;IACF,MAAM,CAAU,KAAK,GAAG;QACtB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;KAChE,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAwB,CAAC;QAC7C,MAAM,QAAQ,GACZ,MAAM,KAAK,QAAQ;YACjB,CAAC,CAAC,MAAM,4BAA4B,EAAE;YACtC,CAAC,CAAC,MAAM,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC3C,WAAW,CACT;YACE,QAAQ,EAAE;gBACR,GAAG,QAAQ;gBACX,OAAO,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,UAAU;aACpD;SACF,EACD,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CACrB,CAAC;IACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAUxD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,gBAAgB;IACrD,OAAgB,WAAW,SAA2D;IACtF,OAAgB,QAAQ;;;QAStB;IACF,OAAgB,KAAK;;;;;MAUnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAUxD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,gBAAgB;IACrD,OAAgB,WAAW,SAA2D;IACtF,OAAgB,QAAQ;;;QAStB;IACF,OAAgB,KAAK;;;;;MAUnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAqClC"}
|
|
@@ -37,7 +37,7 @@ export default class AuthLogin extends DataworksCommand {
|
|
|
37
37
|
if (!environment && process.stdin.isTTY)
|
|
38
38
|
environment = await prompt("Environment (uat/live)");
|
|
39
39
|
if (!environment || !isEnvironment(environment)) {
|
|
40
|
-
throw new CliError("Specify --environment uat
|
|
40
|
+
throw new CliError("Specify either --environment uat or --environment live", "ENVIRONMENT_REQUIRED", 2);
|
|
41
41
|
}
|
|
42
42
|
const config = resolveEnvironment(environment, flags["client-id"]);
|
|
43
43
|
const session = await loginWithBrowser(config, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,gBAAgB;IACrD,MAAM,CAAU,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1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/commands/commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/commands/commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAsBrD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,gBAAgB;IACpD,OAAgB,WAAW,SACgC;IAC3D,OAAgB,KAAK;;MAEnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiBlC"}
|
|
@@ -3,9 +3,12 @@ import { DataworksCommand } from "../lib/command.js";
|
|
|
3
3
|
import { operations } from "../generated/operations.js";
|
|
4
4
|
import { writeResult } from "../lib/output.js";
|
|
5
5
|
const builtIns = [
|
|
6
|
+
"agents install",
|
|
7
|
+
"agents reminder",
|
|
6
8
|
"auth login",
|
|
7
9
|
"auth logout",
|
|
8
10
|
"auth status",
|
|
11
|
+
"autocomplete",
|
|
9
12
|
"commands",
|
|
10
13
|
"events subscribe",
|
|
11
14
|
"graphql mutate",
|
|
@@ -13,6 +16,7 @@ const builtIns = [
|
|
|
13
16
|
"graphql subscribe",
|
|
14
17
|
"ingest",
|
|
15
18
|
"report-error",
|
|
19
|
+
"tenant list",
|
|
16
20
|
"tenant select",
|
|
17
21
|
];
|
|
18
22
|
export default class Commands extends DataworksCommand {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/commands/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,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ChB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,EAAE,cAAc,EAAE,UAAU,CAAC,MAAM,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { DataworksCommand } from "../../lib/command.js";
|
|
2
|
+
import { CliError } from "../../lib/errors.js";
|
|
3
|
+
export declare function channelRequiredError(): CliError;
|
|
2
4
|
export default class EventsSubscribe extends DataworksCommand {
|
|
3
5
|
static description: string;
|
|
6
|
+
static examples: {
|
|
7
|
+
description: string;
|
|
8
|
+
command: string;
|
|
9
|
+
}[];
|
|
4
10
|
static flags: {
|
|
5
11
|
"api-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
-
channel: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
channel: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
13
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
14
|
};
|
|
9
15
|
run(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../../src/commands/events/subscribe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../../src/commands/events/subscribe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI/C,wBAAgB,oBAAoB,IAAI,QAAQ,CAqC/C;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,gBAAgB;IAC3D,OAAgB,WAAW,SACgE;IAC3F,OAAgB,QAAQ;;;QAatB;IACF,OAAgB,KAAK;;;;MAOnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CASlC"}
|
|
@@ -2,16 +2,69 @@ import { Flags } from "@oclif/core";
|
|
|
2
2
|
import { DataworksCommand } from "../../lib/command.js";
|
|
3
3
|
import { subscribeEvents } from "../../lib/http-transport.js";
|
|
4
4
|
import { writeResult } from "../../lib/output.js";
|
|
5
|
+
import { CliError } from "../../lib/errors.js";
|
|
6
|
+
const channelExamples = ["dataworks/1/1/*", "dataworks/1/1/heartrate"];
|
|
7
|
+
export function channelRequiredError() {
|
|
8
|
+
const examples = [
|
|
9
|
+
`dw events subscribe --channel ${channelExamples[0]}`,
|
|
10
|
+
`dw events subscribe --channel ${channelExamples[1]}`,
|
|
11
|
+
`dw events subscribe --channel ${channelExamples[1]} --json`,
|
|
12
|
+
];
|
|
13
|
+
return new CliError([
|
|
14
|
+
"Missing required flag --channel.",
|
|
15
|
+
"",
|
|
16
|
+
"Channel format:",
|
|
17
|
+
" dataworks/<dataset-datasource-id>/<event-id>/<metric-or-*>",
|
|
18
|
+
"",
|
|
19
|
+
"Examples:",
|
|
20
|
+
...examples.map((example) => ` ${example}`),
|
|
21
|
+
"",
|
|
22
|
+
"Use * for all metrics, a metric name such as heartrate to filter, and --json for NDJSON output.",
|
|
23
|
+
"A leading slash is optional.",
|
|
24
|
+
"",
|
|
25
|
+
"More help: dw events subscribe --help",
|
|
26
|
+
].join("\n"), "ARGUMENT_REQUIRED", 2, {
|
|
27
|
+
command: "dw events subscribe",
|
|
28
|
+
requiredArguments: [
|
|
29
|
+
{
|
|
30
|
+
flag: "--channel",
|
|
31
|
+
type: "channel path",
|
|
32
|
+
description: "dataworks/<dataset-datasource-id>/<event-id>/<metric-or-*>",
|
|
33
|
+
example: channelExamples[0],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
examples,
|
|
37
|
+
help: "dw events subscribe --help",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
5
40
|
export default class EventsSubscribe extends DataworksCommand {
|
|
6
|
-
static description = "Subscribe to
|
|
41
|
+
static description = "Subscribe to live Dataworks metrics on an AppSync Events channel; press Ctrl+C to stop";
|
|
42
|
+
static examples = [
|
|
43
|
+
{
|
|
44
|
+
description: "Watch all metrics for dataset-datasource 1 and event 1 as tables",
|
|
45
|
+
command: `dw events subscribe --channel ${channelExamples[0]}`,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
description: "Watch only heart-rate metrics",
|
|
49
|
+
command: `dw events subscribe --channel ${channelExamples[1]}`,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
description: "Emit heart-rate events as NDJSON for scripts and agents",
|
|
53
|
+
command: `dw events subscribe --channel ${channelExamples[1]} --json`,
|
|
54
|
+
},
|
|
55
|
+
];
|
|
7
56
|
static flags = {
|
|
8
57
|
"api-key": Flags.string({ description: "AppSync Events API key" }),
|
|
9
|
-
channel: Flags.string({
|
|
58
|
+
channel: Flags.string({
|
|
59
|
+
description: "Channel: dataworks/<dataset-datasource-id>/<event-id>/<metric-or-*>",
|
|
60
|
+
}),
|
|
10
61
|
json: Flags.boolean({ description: "Emit NDJSON events" }),
|
|
11
62
|
};
|
|
12
63
|
async run() {
|
|
13
64
|
const { flags } = await this.parse(EventsSubscribe);
|
|
14
|
-
|
|
65
|
+
if (!flags.channel)
|
|
66
|
+
throw channelRequiredError();
|
|
67
|
+
await subscribeEvents(flags.channel, (data) => writeResult(data, { json: flags.json, stream: true }), flags["api-key"]);
|
|
15
68
|
}
|
|
16
69
|
}
|
|
17
70
|
//# sourceMappingURL=subscribe.js.map
|