@dataworks-technology/cli 1.1.0 → 1.2.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.
Files changed (59) hide show
  1. package/README.md +105 -12
  2. package/dist/commands/auth/login.d.ts.map +1 -1
  3. package/dist/commands/auth/login.js +1 -1
  4. package/dist/commands/auth/login.js.map +1 -1
  5. package/dist/commands/commands.d.ts.map +1 -1
  6. package/dist/commands/commands.js +2 -0
  7. package/dist/commands/commands.js.map +1 -1
  8. package/dist/commands/events/subscribe.d.ts +7 -1
  9. package/dist/commands/events/subscribe.d.ts.map +1 -1
  10. package/dist/commands/events/subscribe.js +56 -3
  11. package/dist/commands/events/subscribe.js.map +1 -1
  12. package/dist/commands/ingest.d.ts +31 -3
  13. package/dist/commands/ingest.d.ts.map +1 -1
  14. package/dist/commands/ingest.js +69 -9
  15. package/dist/commands/ingest.js.map +1 -1
  16. package/dist/commands/tenant/list.d.ts +13 -0
  17. package/dist/commands/tenant/list.d.ts.map +1 -0
  18. package/dist/commands/tenant/list.js +45 -0
  19. package/dist/commands/tenant/list.js.map +1 -0
  20. package/dist/commands/tenant/select.d.ts.map +1 -1
  21. package/dist/commands/tenant/select.js +12 -5
  22. package/dist/commands/tenant/select.js.map +1 -1
  23. package/dist/generated/operations.d.ts +46 -4
  24. package/dist/generated/operations.d.ts.map +1 -1
  25. package/dist/generated/operations.js +39 -11
  26. package/dist/generated/operations.js.map +1 -1
  27. package/dist/help.js +4 -4
  28. package/dist/help.js.map +1 -1
  29. package/dist/lib/browser-auth.d.ts +1 -0
  30. package/dist/lib/browser-auth.d.ts.map +1 -1
  31. package/dist/lib/browser-auth.js +58 -4
  32. package/dist/lib/browser-auth.js.map +1 -1
  33. package/dist/lib/cognito.d.ts +2 -0
  34. package/dist/lib/cognito.d.ts.map +1 -1
  35. package/dist/lib/cognito.js +38 -9
  36. package/dist/lib/cognito.js.map +1 -1
  37. package/dist/lib/http-transport.d.ts.map +1 -1
  38. package/dist/lib/http-transport.js +31 -8
  39. package/dist/lib/http-transport.js.map +1 -1
  40. package/dist/lib/operation-command.d.ts.map +1 -1
  41. package/dist/lib/operation-command.js +15 -3
  42. package/dist/lib/operation-command.js.map +1 -1
  43. package/dist/lib/operation-types.d.ts +4 -0
  44. package/dist/lib/operation-types.d.ts.map +1 -1
  45. package/dist/lib/output.d.ts.map +1 -1
  46. package/dist/lib/output.js +47 -6
  47. package/dist/lib/output.js.map +1 -1
  48. package/dist/lib/raw-graphql-command.d.ts.map +1 -1
  49. package/dist/lib/raw-graphql-command.js +4 -2
  50. package/dist/lib/raw-graphql-command.js.map +1 -1
  51. package/dist/lib/tenants.d.ts +1 -1
  52. package/dist/lib/tenants.d.ts.map +1 -1
  53. package/dist/lib/tenants.js +5 -1
  54. package/dist/lib/tenants.js.map +1 -1
  55. package/oclif.manifest.json +1694 -1612
  56. package/package.json +10 -1
  57. package/schema/operation-overrides.json +49 -0
  58. package/skills/dataworks-cli/SKILL.md +111 -13
  59. package/skills/dataworks-cli/agents/openai.yaml +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataworks-technology/cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "The official command-line interface for the Dataworks Data Engine",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,6 +49,14 @@
49
49
  "commands": "./dist/commands",
50
50
  "helpClass": "./dist/help.js",
51
51
  "topicSeparator": " ",
52
+ "topics": {
53
+ "tenant": {
54
+ "description": "List available tenants or select the tenant used by subsequent commands"
55
+ }
56
+ },
57
+ "plugins": [
58
+ "@oclif/plugin-autocomplete"
59
+ ],
52
60
  "additionalHelpFlags": [
53
61
  "-h"
54
62
  ]
@@ -58,6 +66,7 @@
58
66
  "@dataworks-technology/data": "0.6.1",
59
67
  "@napi-rs/keyring": "1.3.0",
60
68
  "@oclif/core": "4.13.3",
69
+ "@oclif/plugin-autocomplete": "3.2.50",
61
70
  "aws-appsync-subscription-link": "4.0.3",
62
71
  "graphql": "16.14.1"
63
72
  },
@@ -8,6 +8,55 @@
8
8
  "onAdaptorLogEventNoSession": "data adaptor-log-event watch-no-session",
9
9
  "onAdaptorStatusChangeAll": "data adaptor-status watch-all"
10
10
  },
11
+ "operations": {
12
+ "executeDataExplorerQuery": {
13
+ "description": "Query Data Explorer metrics with explicit columns, optional filters, ordering, aggregation, and row limits.",
14
+ "arguments": {
15
+ "columns": {
16
+ "description": "Required JSON array of category columns; base columns are timestamp, datasetdatasourcepublicid, eventpublicid, athletepublicid, metric, and current",
17
+ "example": "[\"timestamp\",\"athletepublicid\",\"metric\",\"current\"]"
18
+ },
19
+ "filterRules": {
20
+ "description": "AWSJSON string shaped as {combinator,rules:[{field,operator,value}]}; operators include =, !=, >, <, >=, <=, contains, and in",
21
+ "example": "{\"combinator\":\"and\",\"rules\":[{\"field\":\"metric\",\"operator\":\"in\",\"value\":\"latlong\"}]}"
22
+ },
23
+ "limit": {
24
+ "description": "Maximum number of rows to return",
25
+ "example": "30"
26
+ },
27
+ "metricCategory": {
28
+ "description": "Metric category: METRICS_TYPE_A for GPS/position/timing, METRICS_TYPE_B for speed/altitude/cadence, or METRICS_TYPE_C for heart rate/power/zones",
29
+ "example": "METRICS_TYPE_A"
30
+ },
31
+ "orderBy": {
32
+ "description": "Column used to order rows",
33
+ "example": "timestamp"
34
+ },
35
+ "orderDirection": {
36
+ "description": "Sort direction: ASC or DESC",
37
+ "example": "DESC"
38
+ },
39
+ "queryExecutionId": {
40
+ "description": "Existing asynchronous query execution ID to poll",
41
+ "example": "query-execution-123"
42
+ }
43
+ },
44
+ "examples": [
45
+ {
46
+ "description": "Run a complete query from a reusable input file",
47
+ "command": "dw data data-explorer execute --input @data-explorer-query.json --json"
48
+ },
49
+ {
50
+ "description": "Return the latest 30 rows from a metric category",
51
+ "command": "dw data data-explorer execute --columns '[\"timestamp\",\"athletepublicid\",\"metric\",\"current\"]' --metric-category METRICS_TYPE_A --limit 30 --order-by timestamp --order-direction DESC --json"
52
+ },
53
+ {
54
+ "description": "Return the latest 30 GPS positions for one athlete",
55
+ "command": "dw data data-explorer execute --input @gps-query.json --json"
56
+ }
57
+ ]
58
+ }
59
+ },
11
60
  "mutations": {
12
61
  "archiveEventFiles": "destructive",
13
62
  "captureStory": "standard",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dataworks-cli
3
- description: Route every request to inspect, query, create, update, delete, ingest, monitor, subscribe to, or otherwise act on Dataworks through the `dw` CLI. Use whenever a user asks for any action involving Dataworks data, tenants, authentication, the Data Engine API, events, adaptors, datasets, or related resources.
3
+ description: Route operational requests to inspect, query, create, update, delete, ingest, monitor, subscribe to, or otherwise act on the Dataworks platform through the `dw` CLI. Use for Dataworks data, tenants, authentication, Data Engine API operations, events, adaptors, datasets, and related platform resources. Do not use for developing, testing, documenting, packaging, or releasing the CLI itself.
4
4
  ---
5
5
 
6
6
  # Dataworks CLI
@@ -18,7 +18,7 @@ can perform the action.
18
18
  4. Prefer the narrowest matching command:
19
19
  - Data Engine entities: `dw data ...`
20
20
  - Authentication and session state: `dw auth ...`
21
- - Tenant discovery and persistence: `dw tenant select ...`
21
+ - Tenant discovery and persistence: `dw tenant list` and `dw tenant select ...`
22
22
  - Metric ingestion: `dw ingest`
23
23
  - Realtime events: `dw events subscribe`
24
24
  - Datasource errors: `dw report-error`
@@ -28,19 +28,26 @@ can perform the action.
28
28
 
29
29
  ## Authenticate and select a tenant
30
30
 
31
- Authenticate with `dw auth login --environment uat|live` and inspect the session
32
- with `dw auth status --json`. Never print, log, or write `DW_PASSWORD`,
33
- `DW_SESSION_JSON`, tokens, or API keys.
31
+ Inspect the current session first with `dw auth status --json`. Log in only when
32
+ needed, using either `dw auth login --environment uat` or
33
+ `dw auth login --environment live`. If a browser cannot open, add
34
+ `--no-browser`, show the authorization URL, and let the human complete login.
35
+ Never emit a placeholder command containing `uat|live`; select one exact value
36
+ from the request or current profile, or ask which environment to use.
37
+ Never print, log, or write `DW_PASSWORD`, `DW_SESSION_JSON`, tokens,
38
+ authorization headers, API keys, or credential-store contents.
34
39
 
35
- Use `dw tenant select --json` to list authorized tenants, `dw tenant select` for
36
- interactive selection, or `dw tenant select <id>` for a direct selection. The
37
- selected tenant persists for subsequent commands. Use `--tenant` only for an
38
- explicit one-command override.
40
+ Use `dw tenant list --json` to list authorized tenants and identify the current
41
+ selection, `dw tenant select` for interactive selection, or
42
+ `dw tenant select <id>` for a direct selection. The selected tenant persists for
43
+ subsequent commands. Use `--tenant` only for an explicit one-command override.
39
44
 
40
45
  ## Execute safely
41
46
 
42
- Use `--json` for finite machine-readable results. Treat subscription output as
43
- NDJSON and process it incrementally.
47
+ Always add `--json` when an agent runs a command that emits data; never parse the
48
+ default human-readable tables. Finite results use a stable `{data,meta}` JSON
49
+ envelope. With `--json`, subscriptions emit NDJSON; process each line
50
+ incrementally.
44
51
 
45
52
  Before any mutation:
46
53
 
@@ -50,8 +57,99 @@ Before any mutation:
50
57
  3. Add `--yes` only after approval. Never infer approval from the presence of
51
58
  credentials.
52
59
 
60
+ Apply this mutation workflow only when command help exposes `--dry-run` and
61
+ `--yes`. Never invent behavior flags for built-in commands.
62
+
53
63
  For bulk ingest, default to strict validation. Use `--best-effort` only when
54
64
  dropping invalid metrics is acceptable, and report every dropped item.
55
65
 
56
- Report the command used, the selected environment and tenant when relevant, and
57
- the result without exposing credentials or unredacted sensitive values.
66
+ Report a sanitized command, the selected environment and tenant when relevant,
67
+ and the result. Omit or redact payload values, personal data, session material,
68
+ and other sensitive values.
69
+
70
+ ## Ingest metrics
71
+
72
+ Resolve omitted context before ingesting:
73
+
74
+ 1. Use `dw data event list --all --json` to identify the event.
75
+ 2. Use `dw data dataset-datasource list --all --json` to identify the
76
+ dataset-datasource and inspect its configured metrics.
77
+ 3. If a name or description matches multiple resources, ask the human to choose;
78
+ never guess an ID.
79
+ 4. Use the current Unix timestamp only when the user means "now". Otherwise ask
80
+ for or preserve the requested timestamp.
81
+
82
+ Each metric requires `athletePublicId`, `metric`, `value`, and a positive integer
83
+ `timestamp`. Pass a JSON array, a `{ "metrics": [...] }` object, `@file`, or `-`
84
+ for standard input. For example, after resolving the event and
85
+ dataset-datasource, ingest a heart rate of 120 for athlete `athlete-X` with:
86
+
87
+ ```sh
88
+ dw ingest --event event-123 --dataset-datasource ds-456 --metrics '[{"athletePublicId":"athlete-X","metric":"heartrate","value":120,"timestamp":1700000000}]' --json
89
+ ```
90
+
91
+ Strict validation is the default and sends nothing if any metric is invalid. Add
92
+ `--best-effort` only when the human accepts partial ingestion.
93
+
94
+ `dw ingest` supports neither `--dry-run` nor `--yes`; never add them. It sends
95
+ data immediately after validation. Do not add a `unit` property: use the metric
96
+ configured on the dataset-datasource and pass the numeric BPM as `value`. If the
97
+ target is Live, show the resolved event, dataset-datasource, athlete, metric,
98
+ value, and timestamp and obtain confirmation before running the command.
99
+
100
+ ## Subscribe to realtime metrics
101
+
102
+ Use channel shape
103
+ `dataworks/<dataset-datasource-id>/<event-id>/<metric-or-*>`. A leading slash is
104
+ optional. Use `*` to receive all metrics or a metric name to narrow the stream:
105
+
106
+ ```sh
107
+ dw events subscribe --channel dataworks/1/1/* --json
108
+ dw events subscribe --channel dataworks/1/1/heartrate --json
109
+ ```
110
+
111
+ Subscriptions are long-running. Press `Ctrl+C` once to close the WebSocket and
112
+ return to the shell; do not leave orphaned subscription processes.
113
+
114
+ ## Query Data Explorer
115
+
116
+ Use `dw data data-explorer execute --help` to inspect the installed contract.
117
+ Data Explorer queries require a JSON array of lowercase `columns` and a metric
118
+ category. Use `METRICS_TYPE_A` for GPS/position/timing metrics,
119
+ `METRICS_TYPE_B` for speed/altitude/cadence, and `METRICS_TYPE_C` for heart
120
+ rate/power/zones. The base columns are `timestamp`,
121
+ `datasetdatasourcepublicid`, `eventpublicid`, `athletepublicid`, `metric`, and
122
+ `current`. Prefer a reusable `--input @file` for complex filters; use individual
123
+ flags for simple queries:
124
+
125
+ ```sh
126
+ dw data data-explorer execute --columns '["timestamp","athletepublicid","metric","current"]' --metric-category METRICS_TYPE_A --limit 30 --order-by timestamp --order-direction DESC --json
127
+ ```
128
+
129
+ Pass `--filter-rules` as an AWSJSON string shaped like
130
+ `{"combinator":"and","rules":[{"field":"metric","operator":"in","value":"latlong"}]}`.
131
+ Each rule contains `field`, `operator`, and string `value`; comma-separate
132
+ multiple values for `in`.
133
+
134
+ For a request such as "the last 30 GPS values for James Haigh":
135
+
136
+ 1. Run `dw data athlete list --all --json` and match the name case-insensitively.
137
+ 2. Require one exact athlete match; ask if multiple athletes match.
138
+ 3. Use `dw data data-explorer execute`; do not substitute a guessed generated
139
+ command or raw GraphQL while this command is available.
140
+ 4. Use GPS metric `latlong` in `METRICS_TYPE_A`. Filter on both `metric` and
141
+ lowercase `athletepublicid`, order by `timestamp` descending, and limit to 30. For athlete `athlete-123`, run:
142
+
143
+ ```sh
144
+ 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
145
+ ```
146
+
147
+ 5. Replace `athlete-123` with the resolved public ID and run the query with
148
+ `--json`. If status is `RUNNING` with a `queryExecutionId`, repeat the same
149
+ command with `--query-execution-id <id>` until it completes.
150
+ 6. Return the 30 values in timestamp order and retain the athlete ID used in the
151
+ result summary. The `rows` field is AWSJSON: decode JSON until it is an array.
152
+ Interpret each `current` value as a `latitude:longitude` string.
153
+
154
+ Do not guess an athlete, event, dataset-datasource, or tenant ID. Resolve IDs
155
+ with CLI list commands and ask only when multiple resources match.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Dataworks CLI"
3
+ short_description: "Operate Dataworks safely through the dw CLI"
4
+ default_prompt: "Use $dataworks-cli to inspect or operate Dataworks through the dw CLI."