@dataworks-technology/cli 1.4.0 → 1.5.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 (37) hide show
  1. package/README.md +35 -2
  2. package/bin/postinstall.js +21 -1
  3. package/dist/commands/agents/install.d.ts +1 -0
  4. package/dist/commands/agents/install.d.ts.map +1 -1
  5. package/dist/commands/agents/install.js +14 -4
  6. package/dist/commands/agents/install.js.map +1 -1
  7. package/dist/lib/agent-install.d.ts +23 -0
  8. package/dist/lib/agent-install.d.ts.map +1 -1
  9. package/dist/lib/agent-install.js +51 -3
  10. package/dist/lib/agent-install.js.map +1 -1
  11. package/dist/lib/agent-reminder.d.ts +24 -2
  12. package/dist/lib/agent-reminder.d.ts.map +1 -1
  13. package/dist/lib/agent-reminder.js +56 -10
  14. package/dist/lib/agent-reminder.js.map +1 -1
  15. package/dist/lib/command.js +1 -1
  16. package/dist/lib/command.js.map +1 -1
  17. package/dist/lib/discover.d.ts +54 -0
  18. package/dist/lib/discover.d.ts.map +1 -0
  19. package/dist/lib/discover.js +129 -0
  20. package/dist/lib/discover.js.map +1 -0
  21. package/dist/lib/graphql-transport.d.ts +24 -0
  22. package/dist/lib/graphql-transport.d.ts.map +1 -1
  23. package/dist/lib/graphql-transport.js +36 -3
  24. package/dist/lib/graphql-transport.js.map +1 -1
  25. package/dist/lib/query-metrics.d.ts +2 -1
  26. package/dist/lib/query-metrics.d.ts.map +1 -1
  27. package/dist/lib/query-metrics.js +25 -15
  28. package/dist/lib/query-metrics.js.map +1 -1
  29. package/dist/mcp/server.d.ts +8 -3
  30. package/dist/mcp/server.d.ts.map +1 -1
  31. package/dist/mcp/server.js +182 -35
  32. package/dist/mcp/server.js.map +1 -1
  33. package/oclif.manifest.json +115 -105
  34. package/package.json +1 -1
  35. package/plugins/dataworks/.claude-plugin/plugin.json +1 -1
  36. package/plugins/dataworks/.codex-plugin/plugin.json +1 -1
  37. package/plugins/dataworks/skills/query-dataworks-metrics/SKILL.md +33 -9
@@ -189,6 +189,10 @@
189
189
  {
190
190
  "description": "Replace a stale Dataworks marketplace registration",
191
191
  "command": "dw agents install codex --force"
192
+ },
193
+ {
194
+ "description": "Update clients that already have Dataworks, and skip the rest",
195
+ "command": "dw agents install --refresh"
192
196
  }
193
197
  ],
194
198
  "flags": {
@@ -198,6 +202,12 @@
198
202
  "allowNo": false,
199
203
  "type": "boolean"
200
204
  },
205
+ "refresh": {
206
+ "description": "Only update clients that already have Dataworks installed; configure nothing new",
207
+ "name": "refresh",
208
+ "allowNo": false,
209
+ "type": "boolean"
210
+ },
201
211
  "json": {
202
212
  "description": "Emit stable JSON output",
203
213
  "name": "json",
@@ -3732,24 +3742,10 @@
3732
3742
  "update.js"
3733
3743
  ]
3734
3744
  },
3735
- "data:data-explorer:execute": {
3745
+ "data:composable-engine-type:get": {
3736
3746
  "aliases": [],
3737
3747
  "args": {},
3738
- "description": "Query Data Explorer metrics with explicit columns, optional filters, ordering, aggregation, and row limits.",
3739
- "examples": [
3740
- {
3741
- "description": "Run a complete query from a reusable input file",
3742
- "command": "dw data data-explorer execute --input @data-explorer-query.json --json"
3743
- },
3744
- {
3745
- "description": "Return the latest 30 rows from a metric category",
3746
- "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"
3747
- },
3748
- {
3749
- "description": "Return the latest 30 GPS positions for one athlete",
3750
- "command": "dw data data-explorer execute --input @gps-query.json --json"
3751
- }
3752
- ],
3748
+ "description": "Run the getComposableEngineType GraphQL query",
3753
3749
  "flags": {
3754
3750
  "input": {
3755
3751
  "description": "Input JSON, @file, or - for stdin",
@@ -3791,72 +3787,9 @@
3791
3787
  "allowNo": false,
3792
3788
  "type": "boolean"
3793
3789
  },
3794
- "aggregate": {
3795
- "description": "GraphQL aggregate",
3796
- "name": "aggregate",
3797
- "hasDynamicHelp": false,
3798
- "multiple": false,
3799
- "type": "option"
3800
- },
3801
- "aggregate-field": {
3802
- "description": "GraphQL aggregateField",
3803
- "name": "aggregate-field",
3804
- "hasDynamicHelp": false,
3805
- "multiple": false,
3806
- "type": "option"
3807
- },
3808
- "columns": {
3809
- "description": "Required JSON array of category columns; base columns are timestamp, datasetdatasourcepublicid, eventpublicid, athletepublicid, metric, and current",
3810
- "name": "columns",
3811
- "hasDynamicHelp": false,
3812
- "multiple": false,
3813
- "type": "option"
3814
- },
3815
- "filter-rules": {
3816
- "description": "AWSJSON string shaped as {combinator,rules:[{field,operator,value}]}; operators include =, !=, >, <, >=, <=, contains, and in",
3817
- "name": "filter-rules",
3818
- "hasDynamicHelp": false,
3819
- "multiple": false,
3820
- "type": "option"
3821
- },
3822
- "group-by": {
3823
- "description": "GraphQL groupBy",
3824
- "name": "group-by",
3825
- "hasDynamicHelp": false,
3826
- "multiple": false,
3827
- "type": "option"
3828
- },
3829
- "limit": {
3830
- "description": "Maximum number of rows to return",
3831
- "name": "limit",
3832
- "hasDynamicHelp": false,
3833
- "multiple": false,
3834
- "type": "option"
3835
- },
3836
- "metric-category": {
3837
- "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",
3838
- "name": "metric-category",
3839
- "hasDynamicHelp": false,
3840
- "multiple": false,
3841
- "type": "option"
3842
- },
3843
- "order-by": {
3844
- "description": "Column used to order rows",
3845
- "name": "order-by",
3846
- "hasDynamicHelp": false,
3847
- "multiple": false,
3848
- "type": "option"
3849
- },
3850
- "order-direction": {
3851
- "description": "Sort direction: ASC or DESC",
3852
- "name": "order-direction",
3853
- "hasDynamicHelp": false,
3854
- "multiple": false,
3855
- "type": "option"
3856
- },
3857
- "query-execution-id": {
3858
- "description": "Existing asynchronous query execution ID to poll",
3859
- "name": "query-execution-id",
3790
+ "public-id": {
3791
+ "description": "GraphQL publicId",
3792
+ "name": "public-id",
3860
3793
  "hasDynamicHelp": false,
3861
3794
  "multiple": false,
3862
3795
  "type": "option"
@@ -3864,7 +3797,7 @@
3864
3797
  },
3865
3798
  "hasDynamicHelp": false,
3866
3799
  "hiddenAliases": [],
3867
- "id": "data:data-explorer:execute",
3800
+ "id": "data:composable-engine-type:get",
3868
3801
  "pluginAlias": "@dataworks-technology/cli",
3869
3802
  "pluginName": "@dataworks-technology/cli",
3870
3803
  "pluginType": "core",
@@ -3874,14 +3807,14 @@
3874
3807
  "dist",
3875
3808
  "commands",
3876
3809
  "data",
3877
- "data-explorer",
3878
- "execute.js"
3810
+ "composable-engine-type",
3811
+ "get.js"
3879
3812
  ]
3880
3813
  },
3881
- "data:composable-engine-type:get": {
3814
+ "data:composable-engine-type:list": {
3882
3815
  "aliases": [],
3883
3816
  "args": {},
3884
- "description": "Run the getComposableEngineType GraphQL query",
3817
+ "description": "Run the listComposableEngineTypes GraphQL query",
3885
3818
  "flags": {
3886
3819
  "input": {
3887
3820
  "description": "Input JSON, @file, or - for stdin",
@@ -3923,9 +3856,23 @@
3923
3856
  "allowNo": false,
3924
3857
  "type": "boolean"
3925
3858
  },
3926
- "public-id": {
3927
- "description": "GraphQL publicId",
3928
- "name": "public-id",
3859
+ "filter": {
3860
+ "description": "GraphQL filter",
3861
+ "name": "filter",
3862
+ "hasDynamicHelp": false,
3863
+ "multiple": false,
3864
+ "type": "option"
3865
+ },
3866
+ "limit": {
3867
+ "description": "GraphQL limit",
3868
+ "name": "limit",
3869
+ "hasDynamicHelp": false,
3870
+ "multiple": false,
3871
+ "type": "option"
3872
+ },
3873
+ "next-token": {
3874
+ "description": "GraphQL nextToken",
3875
+ "name": "next-token",
3929
3876
  "hasDynamicHelp": false,
3930
3877
  "multiple": false,
3931
3878
  "type": "option"
@@ -3933,7 +3880,7 @@
3933
3880
  },
3934
3881
  "hasDynamicHelp": false,
3935
3882
  "hiddenAliases": [],
3936
- "id": "data:composable-engine-type:get",
3883
+ "id": "data:composable-engine-type:list",
3937
3884
  "pluginAlias": "@dataworks-technology/cli",
3938
3885
  "pluginName": "@dataworks-technology/cli",
3939
3886
  "pluginType": "core",
@@ -3944,13 +3891,27 @@
3944
3891
  "commands",
3945
3892
  "data",
3946
3893
  "composable-engine-type",
3947
- "get.js"
3894
+ "list.js"
3948
3895
  ]
3949
3896
  },
3950
- "data:composable-engine-type:list": {
3897
+ "data:data-explorer:execute": {
3951
3898
  "aliases": [],
3952
3899
  "args": {},
3953
- "description": "Run the listComposableEngineTypes GraphQL query",
3900
+ "description": "Query Data Explorer metrics with explicit columns, optional filters, ordering, aggregation, and row limits.",
3901
+ "examples": [
3902
+ {
3903
+ "description": "Run a complete query from a reusable input file",
3904
+ "command": "dw data data-explorer execute --input @data-explorer-query.json --json"
3905
+ },
3906
+ {
3907
+ "description": "Return the latest 30 rows from a metric category",
3908
+ "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"
3909
+ },
3910
+ {
3911
+ "description": "Return the latest 30 GPS positions for one athlete",
3912
+ "command": "dw data data-explorer execute --input @gps-query.json --json"
3913
+ }
3914
+ ],
3954
3915
  "flags": {
3955
3916
  "input": {
3956
3917
  "description": "Input JSON, @file, or - for stdin",
@@ -3992,23 +3953,72 @@
3992
3953
  "allowNo": false,
3993
3954
  "type": "boolean"
3994
3955
  },
3995
- "filter": {
3996
- "description": "GraphQL filter",
3997
- "name": "filter",
3956
+ "aggregate": {
3957
+ "description": "GraphQL aggregate",
3958
+ "name": "aggregate",
3959
+ "hasDynamicHelp": false,
3960
+ "multiple": false,
3961
+ "type": "option"
3962
+ },
3963
+ "aggregate-field": {
3964
+ "description": "GraphQL aggregateField",
3965
+ "name": "aggregate-field",
3966
+ "hasDynamicHelp": false,
3967
+ "multiple": false,
3968
+ "type": "option"
3969
+ },
3970
+ "columns": {
3971
+ "description": "Required JSON array of category columns; base columns are timestamp, datasetdatasourcepublicid, eventpublicid, athletepublicid, metric, and current",
3972
+ "name": "columns",
3973
+ "hasDynamicHelp": false,
3974
+ "multiple": false,
3975
+ "type": "option"
3976
+ },
3977
+ "filter-rules": {
3978
+ "description": "AWSJSON string shaped as {combinator,rules:[{field,operator,value}]}; operators include =, !=, >, <, >=, <=, contains, and in",
3979
+ "name": "filter-rules",
3980
+ "hasDynamicHelp": false,
3981
+ "multiple": false,
3982
+ "type": "option"
3983
+ },
3984
+ "group-by": {
3985
+ "description": "GraphQL groupBy",
3986
+ "name": "group-by",
3998
3987
  "hasDynamicHelp": false,
3999
3988
  "multiple": false,
4000
3989
  "type": "option"
4001
3990
  },
4002
3991
  "limit": {
4003
- "description": "GraphQL limit",
3992
+ "description": "Maximum number of rows to return",
4004
3993
  "name": "limit",
4005
3994
  "hasDynamicHelp": false,
4006
3995
  "multiple": false,
4007
3996
  "type": "option"
4008
3997
  },
4009
- "next-token": {
4010
- "description": "GraphQL nextToken",
4011
- "name": "next-token",
3998
+ "metric-category": {
3999
+ "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",
4000
+ "name": "metric-category",
4001
+ "hasDynamicHelp": false,
4002
+ "multiple": false,
4003
+ "type": "option"
4004
+ },
4005
+ "order-by": {
4006
+ "description": "Column used to order rows",
4007
+ "name": "order-by",
4008
+ "hasDynamicHelp": false,
4009
+ "multiple": false,
4010
+ "type": "option"
4011
+ },
4012
+ "order-direction": {
4013
+ "description": "Sort direction: ASC or DESC",
4014
+ "name": "order-direction",
4015
+ "hasDynamicHelp": false,
4016
+ "multiple": false,
4017
+ "type": "option"
4018
+ },
4019
+ "query-execution-id": {
4020
+ "description": "Existing asynchronous query execution ID to poll",
4021
+ "name": "query-execution-id",
4012
4022
  "hasDynamicHelp": false,
4013
4023
  "multiple": false,
4014
4024
  "type": "option"
@@ -4016,7 +4026,7 @@
4016
4026
  },
4017
4027
  "hasDynamicHelp": false,
4018
4028
  "hiddenAliases": [],
4019
- "id": "data:composable-engine-type:list",
4029
+ "id": "data:data-explorer:execute",
4020
4030
  "pluginAlias": "@dataworks-technology/cli",
4021
4031
  "pluginName": "@dataworks-technology/cli",
4022
4032
  "pluginType": "core",
@@ -4026,8 +4036,8 @@
4026
4036
  "dist",
4027
4037
  "commands",
4028
4038
  "data",
4029
- "composable-engine-type",
4030
- "list.js"
4039
+ "data-explorer",
4040
+ "execute.js"
4031
4041
  ]
4032
4042
  },
4033
4043
  "data:dataset:create": {
@@ -11709,5 +11719,5 @@
11709
11719
  ]
11710
11720
  }
11711
11721
  },
11712
- "version": "1.4.0"
11722
+ "version": "1.5.0"
11713
11723
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataworks-technology/cli",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "The official command-line interface for the Dataworks Data Engine",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataworks",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Query athlete metrics from Dataworks using the authenticated local CLI session.",
5
5
  "author": { "name": "Dataworks Technology" },
6
6
  "homepage": "https://github.com/Dataworks-Technology/Dataworks-CLI",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataworks",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Query athlete metrics from Dataworks using the authenticated local CLI session.",
5
5
  "author": { "name": "Dataworks Technology", "url": "https://dataworks.live/" },
6
6
  "homepage": "https://github.com/Dataworks-Technology/Dataworks-CLI",
@@ -1,12 +1,15 @@
1
1
  ---
2
2
  name: query-dataworks-metrics
3
- description: Query historical Dataworks athlete metrics such as GPS, heart rate, speed, altitude, cadence, power, timing, or custom metrics. Use when a user asks for latest, last, recent, or time-bounded metric values for an athlete by ID or name.
3
+ description: Query historical Dataworks metrics such as GPS, heart rate, speed, altitude, cadence, power, timing, or custom metrics, for one athlete or across a whole event. Use when a user asks for latest, last, recent, or time-bounded metric values, or needs to find an athlete or event ID.
4
4
  ---
5
5
 
6
6
  # Query Dataworks metrics
7
7
 
8
- Use the `query_metrics` tool. It is read-only and uses the current authenticated
9
- `dw` session and selected tenant.
8
+ Three read-only tools use the current authenticated `dw` session and tenant:
9
+
10
+ - `query_metrics` — metric values, scoped to an athlete, an event, or a datasource.
11
+ - `list_athletes` — find an athlete ID, or confirm someone is not in this tenant.
12
+ - `list_events` — find an event ID for a race.
10
13
 
11
14
  If `query_metrics` is unavailable, tell the user to run `dw agents install`
12
15
  once in their terminal, then start a new Codex thread or run `/reload-plugins`
@@ -14,16 +17,23 @@ in Claude Code. Do not substitute raw GraphQL or guess that setup succeeded.
14
17
 
15
18
  ## Construct the request
16
19
 
17
- - Pass `athlete_id` when the user provides a Dataworks athlete public ID.
18
- - Otherwise pass `athlete_name`; let the tool resolve it and surface ambiguity.
20
+ - Scope every query. Pass at least one of `athlete_id`, `athlete_name`,
21
+ `event_id`, or `dataset_datasource_id`; the tool refuses an unscoped query
22
+ rather than sweeping the tenant.
23
+ - For a question about a person, pass `athlete_id` when the user gives an ID,
24
+ otherwise `athlete_name` and let the tool resolve it.
25
+ - For a question about a race or feed — "the latest heart rate at T100 San
26
+ Francisco" — omit the athlete entirely and pass `event_id`. Do not invent an
27
+ athlete to satisfy the call. Rows still carry `athlete_id` per value.
19
28
  - Map the user's wording onto a canonical metric name from the catalogue below.
20
29
  Case, spaces, hyphens and underscores are ignored, so "Heart Rate" resolves to
21
30
  `heartrate`. Do not invent a metric name.
22
31
  - Default to `limit: 30` and `order: newest` only when the user did not specify
23
32
  a count or order.
24
33
  - Preserve explicit `from` and `to` times as ISO 8601 date-times.
25
- - Pass `event_id`, `dataset_datasource_id`, or `tenant_id` only when explicitly
26
- supplied or already resolved. Never guess an ID.
34
+ - Never guess or infer an ID. Resolve one with `list_athletes` or `list_events`,
35
+ or use an ID the user supplied. An ID inferred from a shared prefix, a naming
36
+ pattern, or a row count is a guess: say you could not resolve it instead.
27
37
  - For a genuinely custom metric absent from the catalogue, pass its exact name
28
38
  and an explicit `metric_category`.
29
39
 
@@ -55,6 +65,9 @@ Haigh"`, `metric: "GPS"`, `limit: 30`, `order: "newest"`.
55
65
  `metric: "heartrate"`, then take the maximum over the returned rows.
56
66
  - “Cadence for Sam since noon” → `athlete_name: "Sam"`, `metric: "cadence"`,
57
67
  `from: <the unambiguous ISO 8601 time requested>`.
68
+ - “Latest 10 heart rate values for T100 San Francisco” → `list_events` with
69
+ `search: "T100 San Francisco"` to get the ID, then `query_metrics` with
70
+ `event_id: <that ID>`, `metric: "heartrate"`, `limit: 10`, and no athlete.
58
71
 
59
72
  ## Handle results
60
73
 
@@ -63,8 +76,19 @@ environment, tenant, canonical metric, order, and returned count. GPS rows inclu
63
76
  decoded `position.latitude` and `position.longitude`; heart-rate values are
64
77
  numeric with unit `bpm` when the source value is valid.
65
78
 
66
- If the tool reports `ATHLETE_AMBIGUOUS`, present its candidates and ask the user
67
- to choose. For `AUTH_REQUIRED` or `TENANT_REQUIRED`, follow the recovery command
79
+ Every error carries a `recovery` field. Follow it rather than improvising, and
80
+ never fall back to raw GraphQL or `dw data ...` to work around a failure.
81
+
82
+ - `ATHLETE_AMBIGUOUS` — present the candidates and ask the user to choose.
83
+ - `ATHLETE_NOT_FOUND` — the athlete is not in this tenant. Do not retry with
84
+ name variations. Call `list_athletes` once to check, then tell the user.
85
+ - `QUERY_SCOPE_REQUIRED` — add an athlete, `event_id`, or
86
+ `dataset_datasource_id`.
87
+ - `METRIC_CATEGORY_REQUIRED` — retry with one of the returned `suggestions`.
88
+
89
+ If `list_events` returns `unavailable: true`, the event API returned nothing for
90
+ this session. That is a permissions problem, not proof that no events exist.
91
+ Report it and stop; do not identify an event by any other route. For `AUTH_REQUIRED` or `TENANT_REQUIRED`, follow the recovery command
68
92
  in the error and retry. For `METRIC_CATEGORY_REQUIRED`, the error's `suggestions`
69
93
  list the closest canonical names — retry with one rather than asking the user to
70
94
  spell the metric. Never expose credentials or session material.