@dataworks-technology/cli 1.2.0 → 1.4.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 (56) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +16 -0
  3. package/README.md +85 -2
  4. package/bin/mcp.js +9 -0
  5. package/bin/postinstall.js +23 -0
  6. package/dist/commands/agents/install.d.ts +17 -0
  7. package/dist/commands/agents/install.d.ts.map +1 -0
  8. package/dist/commands/agents/install.js +57 -0
  9. package/dist/commands/agents/install.js.map +1 -0
  10. package/dist/commands/agents/reminder.d.ts +16 -0
  11. package/dist/commands/agents/reminder.d.ts.map +1 -0
  12. package/dist/commands/agents/reminder.js +45 -0
  13. package/dist/commands/agents/reminder.js.map +1 -0
  14. package/dist/commands/commands.d.ts.map +1 -1
  15. package/dist/commands/commands.js +2 -0
  16. package/dist/commands/commands.js.map +1 -1
  17. package/dist/generated/metrics.d.ts +15 -0
  18. package/dist/generated/metrics.d.ts.map +1 -0
  19. package/dist/generated/metrics.js +131 -0
  20. package/dist/generated/metrics.js.map +1 -0
  21. package/dist/lib/agent-install.d.ts +24 -0
  22. package/dist/lib/agent-install.d.ts.map +1 -0
  23. package/dist/lib/agent-install.js +196 -0
  24. package/dist/lib/agent-install.js.map +1 -0
  25. package/dist/lib/agent-reminder.d.ts +17 -0
  26. package/dist/lib/agent-reminder.d.ts.map +1 -0
  27. package/dist/lib/agent-reminder.js +81 -0
  28. package/dist/lib/agent-reminder.js.map +1 -0
  29. package/dist/lib/command.d.ts +1 -0
  30. package/dist/lib/command.d.ts.map +1 -1
  31. package/dist/lib/command.js +5 -0
  32. package/dist/lib/command.js.map +1 -1
  33. package/dist/lib/metric-names.d.ts +29 -0
  34. package/dist/lib/metric-names.d.ts.map +1 -0
  35. package/dist/lib/metric-names.js +171 -0
  36. package/dist/lib/metric-names.js.map +1 -0
  37. package/dist/lib/query-metrics.d.ts +73 -0
  38. package/dist/lib/query-metrics.d.ts.map +1 -0
  39. package/dist/lib/query-metrics.js +374 -0
  40. package/dist/lib/query-metrics.js.map +1 -0
  41. package/dist/mcp/main.d.ts +2 -0
  42. package/dist/mcp/main.d.ts.map +1 -0
  43. package/dist/mcp/main.js +7 -0
  44. package/dist/mcp/main.js.map +1 -0
  45. package/dist/mcp/server.d.ts +85 -0
  46. package/dist/mcp/server.d.ts.map +1 -0
  47. package/dist/mcp/server.js +248 -0
  48. package/dist/mcp/server.js.map +1 -0
  49. package/oclif.manifest.json +872 -759
  50. package/package.json +22 -8
  51. package/plugins/dataworks/.claude-plugin/plugin.json +10 -0
  52. package/plugins/dataworks/.codex-plugin/plugin.json +27 -0
  53. package/plugins/dataworks/.mcp.json +8 -0
  54. package/plugins/dataworks/skills/query-dataworks-metrics/SKILL.md +70 -0
  55. package/plugins/dataworks/skills/query-dataworks-metrics/agents/openai.yaml +13 -0
  56. package/skills/dataworks-cli/SKILL.md +18 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataworks-technology/cli",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "The official command-line interface for the Dataworks Data Engine",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -11,12 +11,16 @@
11
11
  "homepage": "https://github.com/Dataworks-Technology/Dataworks-CLI#readme",
12
12
  "bugs": "https://github.com/Dataworks-Technology/Dataworks-CLI/issues",
13
13
  "bin": {
14
- "dw": "./bin/run.js"
14
+ "dw": "./bin/run.js",
15
+ "dw-mcp": "./bin/mcp.js"
15
16
  },
16
17
  "files": [
17
18
  ".github/.assets",
19
+ ".agents/plugins/marketplace.json",
20
+ ".claude-plugin/marketplace.json",
18
21
  "bin",
19
22
  "dist",
23
+ "plugins",
20
24
  "schema",
21
25
  "skills",
22
26
  "oclif.manifest.json",
@@ -27,21 +31,25 @@
27
31
  "node": ">=22"
28
32
  },
29
33
  "scripts": {
30
- "build": "bun run generate && tsc -p tsconfig.build.json && node node_modules/oclif/bin/run.js manifest",
34
+ "build": "bun run sync:plugin-version && bun run generate && tsc -p tsconfig.build.json && node node_modules/oclif/bin/run.js manifest",
31
35
  "commands": "node ./bin/run.js commands --json",
32
36
  "dev": "node --import tsx ./bin/dev.js",
33
37
  "format": "prettier --write .",
34
38
  "format:check": "prettier --check .",
35
- "generate": "bun scripts/generate-commands.ts",
36
- "generate:check": "bun scripts/generate-commands.ts --check",
39
+ "generate": "bun scripts/generate-commands.ts && bun scripts/generate-metrics.ts",
40
+ "generate:check": "bun scripts/generate-commands.ts --check && bun scripts/generate-metrics.ts --check",
37
41
  "lint": "tsc --noEmit",
38
- "typecheck": "tsc --noEmit",
39
42
  "maintain:sdk": "bun scripts/maintenance/update-sdk.ts",
43
+ "postinstall": "node ./bin/postinstall.js",
44
+ "preinstall": "if [ -f scripts/get-sdk-authtoken.ts ]; then bun scripts/get-sdk-authtoken.ts ./; fi",
40
45
  "prepack": "bun run build && bun run test",
41
46
  "prepare": "husky",
47
+ "sdk": "bun scripts/get-sdk-authtoken.ts ./",
42
48
  "smoke:litellm": "bun scripts/maintenance/smoke-agent.ts",
49
+ "sync:plugin-version": "bun scripts/sync-plugin-version.ts",
43
50
  "test": "vitest run",
44
- "test:watch": "vitest"
51
+ "test:watch": "vitest",
52
+ "typecheck": "tsc --noEmit"
45
53
  },
46
54
  "oclif": {
47
55
  "bin": "dw",
@@ -50,6 +58,9 @@
50
58
  "helpClass": "./dist/help.js",
51
59
  "topicSeparator": " ",
52
60
  "topics": {
61
+ "agents": {
62
+ "description": "Install Dataworks skills and tools for supported AI coding agents"
63
+ },
53
64
  "tenant": {
54
65
  "description": "List available tenants or select the tenant used by subsequent commands"
55
66
  }
@@ -64,15 +75,18 @@
64
75
  "dependencies": {
65
76
  "@apollo/client": "4.2.1",
66
77
  "@dataworks-technology/data": "0.6.1",
78
+ "@modelcontextprotocol/sdk": "1.30.0",
67
79
  "@napi-rs/keyring": "1.3.0",
68
80
  "@oclif/core": "4.13.3",
69
81
  "@oclif/plugin-autocomplete": "3.2.50",
70
82
  "aws-appsync-subscription-link": "4.0.3",
71
- "graphql": "16.14.1"
83
+ "graphql": "16.14.1",
84
+ "zod": "4.4.3"
72
85
  },
73
86
  "devDependencies": {
74
87
  "@commitlint/cli": "19.8.1",
75
88
  "@commitlint/config-conventional": "19.8.1",
89
+ "@dataworks/sdk": "3.5.0",
76
90
  "@types/node": "22.18.0",
77
91
  "husky": "9.1.7",
78
92
  "lint-staged": "16.1.5",
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "dataworks",
3
+ "version": "1.4.0",
4
+ "description": "Query athlete metrics from Dataworks using the authenticated local CLI session.",
5
+ "author": { "name": "Dataworks Technology" },
6
+ "homepage": "https://github.com/Dataworks-Technology/Dataworks-CLI",
7
+ "repository": "https://github.com/Dataworks-Technology/Dataworks-CLI",
8
+ "license": "MIT",
9
+ "keywords": ["dataworks", "metrics", "sport", "data-explorer"]
10
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "dataworks",
3
+ "version": "1.4.0",
4
+ "description": "Query athlete metrics from Dataworks using the authenticated local CLI session.",
5
+ "author": { "name": "Dataworks Technology", "url": "https://dataworks.live/" },
6
+ "homepage": "https://github.com/Dataworks-Technology/Dataworks-CLI",
7
+ "repository": "https://github.com/Dataworks-Technology/Dataworks-CLI",
8
+ "license": "MIT",
9
+ "keywords": ["dataworks", "metrics", "sport", "data-explorer"],
10
+ "skills": "./skills/",
11
+ "mcpServers": "./.mcp.json",
12
+ "interface": {
13
+ "displayName": "Dataworks",
14
+ "shortDescription": "Query athlete metrics safely",
15
+ "longDescription": "Resolve athletes and return normalized GPS, heart-rate, and other Dataworks metric values through one read-only tool.",
16
+ "developerName": "Dataworks Technology",
17
+ "category": "Data",
18
+ "capabilities": ["Read"],
19
+ "websiteURL": "https://dataworks.live/",
20
+ "defaultPrompt": [
21
+ "Give me the last 30 GPS values for James Haigh",
22
+ "Show the latest heart rate for athlete ID X",
23
+ "Query speed values for this athlete since noon"
24
+ ],
25
+ "brandColor": "#111827"
26
+ }
27
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "dataworks": {
4
+ "command": "dw-mcp",
5
+ "args": []
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,70 @@
1
+ ---
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.
4
+ ---
5
+
6
+ # Query Dataworks metrics
7
+
8
+ Use the `query_metrics` tool. It is read-only and uses the current authenticated
9
+ `dw` session and selected tenant.
10
+
11
+ If `query_metrics` is unavailable, tell the user to run `dw agents install`
12
+ once in their terminal, then start a new Codex thread or run `/reload-plugins`
13
+ in Claude Code. Do not substitute raw GraphQL or guess that setup succeeded.
14
+
15
+ ## Construct the request
16
+
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.
19
+ - Map the user's wording onto a canonical metric name from the catalogue below.
20
+ Case, spaces, hyphens and underscores are ignored, so "Heart Rate" resolves to
21
+ `heartrate`. Do not invent a metric name.
22
+ - Default to `limit: 30` and `order: newest` only when the user did not specify
23
+ a count or order.
24
+ - 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.
27
+ - For a genuinely custom metric absent from the catalogue, pass its exact name
28
+ and an explicit `metric_category`.
29
+
30
+ ## Metric catalogue
31
+
32
+ Canonical names, grouped by Data Explorer category. This list is generated from
33
+ `@dataworks/sdk`, the same source the Console's Data Explorer uses.
34
+
35
+ <!-- generated:metrics start -->
36
+
37
+ - **METRICS_TYPE_A** — `latlong`, `net-time`, `checkpoint-time`, `leg-time`, `sub-time`, `checkpoint`, `segment`, `distance`, `distance-swim`, `distance-bike`, `distance-run`, `lap`, `sector`, `status`, `is-drafting`, `total-drafting-seconds`, `heading-degrees`, `yoyo-count`
38
+ - **METRICS_TYPE_B** — `speed`, `location-speed`, `altitude`, `cadence-cycling`, `cadence`, `active-energy-burned`, `horizontal-accuracy`, `gap-to-leader`, `gap-to-ahead`, `time-to-leader`, `rank`, `speed-bike`, `pace`, `pace-swim`, `pace-run`
39
+ - **METRICS_TYPE_C** — `heartrate`, `power`, `power-cycling`, `pwr_instant`
40
+ <!-- generated:metrics end -->
41
+
42
+ Aliases also accepted: `gps`/`location`/`position` → `latlong`;
43
+ `hr`/`bpm`/`pulse` → `heartrate`; `watts` → `power`; `rpm` → `cadence`;
44
+ `elevation` → `altitude`; `calories` → `active-energy-burned`;
45
+ `placing` → `rank`.
46
+
47
+ There is no `timing` metric — use `net-time`, `checkpoint-time`, `leg-time`, or
48
+ `sub-time`.
49
+
50
+ Examples:
51
+
52
+ - “Give me the last 30 GPS values for James Haigh” → `athlete_name: "James
53
+ Haigh"`, `metric: "GPS"`, `limit: 30`, `order: "newest"`.
54
+ - “Tell me James Haigh's maximum heart rate” → `athlete_name: "James Haigh"`,
55
+ `metric: "heartrate"`, then take the maximum over the returned rows.
56
+ - “Cadence for Sam since noon” → `athlete_name: "Sam"`, `metric: "cadence"`,
57
+ `from: <the unambiguous ISO 8601 time requested>`.
58
+
59
+ ## Handle results
60
+
61
+ Use `structuredContent`, not the human summary. Report the resolved athlete ID,
62
+ environment, tenant, canonical metric, order, and returned count. GPS rows include
63
+ decoded `position.latitude` and `position.longitude`; heart-rate values are
64
+ numeric with unit `bpm` when the source value is valid.
65
+
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
68
+ in the error and retry. For `METRIC_CATEGORY_REQUIRED`, the error's `suggestions`
69
+ list the closest canonical names — retry with one rather than asking the user to
70
+ spell the metric. Never expose credentials or session material.
@@ -0,0 +1,13 @@
1
+ interface:
2
+ display_name: "Query Dataworks metrics"
3
+ short_description: "Query athlete metrics by name or ID"
4
+ default_prompt: "Use $query-dataworks-metrics to give me the last 30 GPS values for James Haigh."
5
+
6
+ dependencies:
7
+ tools:
8
+ - type: "mcp"
9
+ value: "dataworks"
10
+ description: "Read-only Dataworks metric query server"
11
+
12
+ policy:
13
+ allow_implicit_invocation: true
@@ -5,9 +5,16 @@ description: Route operational requests to inspect, query, create, update, delet
5
5
 
6
6
  # Dataworks CLI
7
7
 
8
- Use `dw` as the operational interface for every Dataworks action. Do not call a
8
+ Use `dw` as the operational interface for Dataworks actions. When the
9
+ `query_metrics` tool is available, use it for historical athlete metric requests;
10
+ it is the read-only, CLI-authenticated interface over Data Explorer. Do not call a
9
11
  Dataworks HTTP or GraphQL endpoint directly, or use an SDK instead, when the CLI
10
- can perform the action.
12
+ or this tool can perform the action.
13
+
14
+ If a request needs `query_metrics` but the tool is unavailable, tell the user to
15
+ run `dw agents install` once, then start a new Codex thread or run
16
+ `/reload-plugins` in Claude Code. Do not claim the MCP server is registered until
17
+ the restarted or reloaded agent exposes the tool.
11
18
 
12
19
  ## Route the request
13
20
 
@@ -16,6 +23,7 @@ can perform the action.
16
23
  2. Run `dw commands --json` to discover the installed command contract.
17
24
  3. Run `dw <command> --help` before constructing the exact call.
18
25
  4. Prefer the narrowest matching command:
26
+ - Historical athlete metrics: `query_metrics` when available
19
27
  - Data Engine entities: `dw data ...`
20
28
  - Authentication and session state: `dw auth ...`
21
29
  - Tenant discovery and persistence: `dw tenant list` and `dw tenant select ...`
@@ -113,6 +121,14 @@ return to the shell; do not leave orphaned subscription processes.
113
121
 
114
122
  ## Query Data Explorer
115
123
 
124
+ Prefer `query_metrics` for requests framed in human terms, such as “the last 30
125
+ GPS values for James Haigh” or “the latest heart rate for athlete ID X”. Pass
126
+ exactly one of `athlete_name` and `athlete_id`. The tool resolves names without
127
+ guessing, infers common metric categories, polls asynchronous queries, decodes
128
+ AWSJSON, and returns normalized structured rows. Use the raw command workflow
129
+ below only when the tool is unavailable or the request needs unsupported advanced
130
+ Data Explorer fields or aggregation.
131
+
116
132
  Use `dw data data-explorer execute --help` to inspect the installed contract.
117
133
  Data Explorer queries require a JSON array of lowercase `columns` and a metric
118
134
  category. Use `METRICS_TYPE_A` for GPS/position/timing metrics,