@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataworks-technology/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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,7 +31,7 @@
|
|
|
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 .",
|
|
@@ -37,9 +41,11 @@
|
|
|
37
41
|
"lint": "tsc --noEmit",
|
|
38
42
|
"typecheck": "tsc --noEmit",
|
|
39
43
|
"maintain:sdk": "bun scripts/maintenance/update-sdk.ts",
|
|
44
|
+
"postinstall": "node ./bin/postinstall.js",
|
|
40
45
|
"prepack": "bun run build && bun run test",
|
|
41
46
|
"prepare": "husky",
|
|
42
47
|
"smoke:litellm": "bun scripts/maintenance/smoke-agent.ts",
|
|
48
|
+
"sync:plugin-version": "bun scripts/sync-plugin-version.ts",
|
|
43
49
|
"test": "vitest run",
|
|
44
50
|
"test:watch": "vitest"
|
|
45
51
|
},
|
|
@@ -49,6 +55,17 @@
|
|
|
49
55
|
"commands": "./dist/commands",
|
|
50
56
|
"helpClass": "./dist/help.js",
|
|
51
57
|
"topicSeparator": " ",
|
|
58
|
+
"topics": {
|
|
59
|
+
"agents": {
|
|
60
|
+
"description": "Install Dataworks skills and tools for supported AI coding agents"
|
|
61
|
+
},
|
|
62
|
+
"tenant": {
|
|
63
|
+
"description": "List available tenants or select the tenant used by subsequent commands"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"plugins": [
|
|
67
|
+
"@oclif/plugin-autocomplete"
|
|
68
|
+
],
|
|
52
69
|
"additionalHelpFlags": [
|
|
53
70
|
"-h"
|
|
54
71
|
]
|
|
@@ -56,10 +73,13 @@
|
|
|
56
73
|
"dependencies": {
|
|
57
74
|
"@apollo/client": "4.2.1",
|
|
58
75
|
"@dataworks-technology/data": "0.6.1",
|
|
76
|
+
"@modelcontextprotocol/sdk": "1.30.0",
|
|
59
77
|
"@napi-rs/keyring": "1.3.0",
|
|
60
78
|
"@oclif/core": "4.13.3",
|
|
79
|
+
"@oclif/plugin-autocomplete": "3.2.50",
|
|
61
80
|
"aws-appsync-subscription-link": "4.0.3",
|
|
62
|
-
"graphql": "16.14.1"
|
|
81
|
+
"graphql": "16.14.1",
|
|
82
|
+
"zod": "4.4.3"
|
|
63
83
|
},
|
|
64
84
|
"devDependencies": {
|
|
65
85
|
"@commitlint/cli": "19.8.1",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dataworks",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Query athlete metrics from Dataworks using the authenticated local CLI session.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Dataworks Technology"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/Dataworks-Technology/Dataworks-CLI",
|
|
9
|
+
"repository": "https://github.com/Dataworks-Technology/Dataworks-CLI",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"dataworks",
|
|
13
|
+
"metrics",
|
|
14
|
+
"sport",
|
|
15
|
+
"data-explorer"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dataworks",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Query athlete metrics from Dataworks using the authenticated local CLI session.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Dataworks Technology",
|
|
7
|
+
"url": "https://dataworks.live/"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Dataworks-Technology/Dataworks-CLI",
|
|
10
|
+
"repository": "https://github.com/Dataworks-Technology/Dataworks-CLI",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"dataworks",
|
|
14
|
+
"metrics",
|
|
15
|
+
"sport",
|
|
16
|
+
"data-explorer"
|
|
17
|
+
],
|
|
18
|
+
"skills": "./skills/",
|
|
19
|
+
"mcpServers": "./.mcp.json",
|
|
20
|
+
"interface": {
|
|
21
|
+
"displayName": "Dataworks",
|
|
22
|
+
"shortDescription": "Query athlete metrics safely",
|
|
23
|
+
"longDescription": "Resolve athletes and return normalized GPS, heart-rate, and other Dataworks metric values through one read-only tool.",
|
|
24
|
+
"developerName": "Dataworks Technology",
|
|
25
|
+
"category": "Data",
|
|
26
|
+
"capabilities": [
|
|
27
|
+
"Read"
|
|
28
|
+
],
|
|
29
|
+
"websiteURL": "https://dataworks.live/",
|
|
30
|
+
"defaultPrompt": [
|
|
31
|
+
"Give me the last 30 GPS values for James Haigh",
|
|
32
|
+
"Show the latest heart rate for athlete ID X",
|
|
33
|
+
"Query speed values for this athlete since noon"
|
|
34
|
+
],
|
|
35
|
+
"brandColor": "#111827"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
- Pass the user's metric wording directly. The tool understands GPS/location and
|
|
20
|
+
heart-rate/HR/BPM aliases, plus common speed, altitude, cadence, power, and
|
|
21
|
+
timing names.
|
|
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 an unknown custom metric, pass its exact name and explicit
|
|
28
|
+
`metric_category`.
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
|
|
32
|
+
- “Give me the last 30 GPS values for James Haigh” → `athlete_name: "James
|
|
33
|
+
Haigh"`, `metric: "GPS"`, `limit: 30`, `order: "newest"`.
|
|
34
|
+
- “Latest heart rate for athlete ID X” → `athlete_id: "X"`, `metric: "heart
|
|
35
|
+
rate"`, `limit: 1`.
|
|
36
|
+
- “Cadence for Sam since noon” → `athlete_name: "Sam"`, `metric: "cadence"`,
|
|
37
|
+
`from: <the unambiguous ISO 8601 time requested>`.
|
|
38
|
+
|
|
39
|
+
## Handle results
|
|
40
|
+
|
|
41
|
+
Use `structuredContent`, not the human summary. Report the resolved athlete ID,
|
|
42
|
+
environment, tenant, canonical metric, order, and returned count. GPS rows include
|
|
43
|
+
decoded `position.latitude` and `position.longitude`; heart-rate values are
|
|
44
|
+
numeric with unit `bpm` when the source value is valid.
|
|
45
|
+
|
|
46
|
+
If the tool reports `ATHLETE_AMBIGUOUS`, present its candidates and ask the user
|
|
47
|
+
to choose. For `AUTH_REQUIRED` or `TENANT_REQUIRED`, follow the recovery command
|
|
48
|
+
in the error and retry. 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
|
|
@@ -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,13 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dataworks-cli
|
|
3
|
-
description: Route
|
|
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
|
|
7
7
|
|
|
8
|
-
Use `dw` as the operational interface for
|
|
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,9 +23,10 @@ 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
|
-
- Tenant discovery and persistence: `dw tenant select ...`
|
|
29
|
+
- Tenant discovery and persistence: `dw tenant list` and `dw tenant select ...`
|
|
22
30
|
- Metric ingestion: `dw ingest`
|
|
23
31
|
- Realtime events: `dw events subscribe`
|
|
24
32
|
- Datasource errors: `dw report-error`
|
|
@@ -28,19 +36,26 @@ can perform the action.
|
|
|
28
36
|
|
|
29
37
|
## Authenticate and select a tenant
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
`
|
|
39
|
+
Inspect the current session first with `dw auth status --json`. Log in only when
|
|
40
|
+
needed, using either `dw auth login --environment uat` or
|
|
41
|
+
`dw auth login --environment live`. If a browser cannot open, add
|
|
42
|
+
`--no-browser`, show the authorization URL, and let the human complete login.
|
|
43
|
+
Never emit a placeholder command containing `uat|live`; select one exact value
|
|
44
|
+
from the request or current profile, or ask which environment to use.
|
|
45
|
+
Never print, log, or write `DW_PASSWORD`, `DW_SESSION_JSON`, tokens,
|
|
46
|
+
authorization headers, API keys, or credential-store contents.
|
|
34
47
|
|
|
35
|
-
Use `dw tenant
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
explicit one-command override.
|
|
48
|
+
Use `dw tenant list --json` to list authorized tenants and identify the current
|
|
49
|
+
selection, `dw tenant select` for interactive selection, or
|
|
50
|
+
`dw tenant select <id>` for a direct selection. The selected tenant persists for
|
|
51
|
+
subsequent commands. Use `--tenant` only for an explicit one-command override.
|
|
39
52
|
|
|
40
53
|
## Execute safely
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
Always add `--json` when an agent runs a command that emits data; never parse the
|
|
56
|
+
default human-readable tables. Finite results use a stable `{data,meta}` JSON
|
|
57
|
+
envelope. With `--json`, subscriptions emit NDJSON; process each line
|
|
58
|
+
incrementally.
|
|
44
59
|
|
|
45
60
|
Before any mutation:
|
|
46
61
|
|
|
@@ -50,8 +65,107 @@ Before any mutation:
|
|
|
50
65
|
3. Add `--yes` only after approval. Never infer approval from the presence of
|
|
51
66
|
credentials.
|
|
52
67
|
|
|
68
|
+
Apply this mutation workflow only when command help exposes `--dry-run` and
|
|
69
|
+
`--yes`. Never invent behavior flags for built-in commands.
|
|
70
|
+
|
|
53
71
|
For bulk ingest, default to strict validation. Use `--best-effort` only when
|
|
54
72
|
dropping invalid metrics is acceptable, and report every dropped item.
|
|
55
73
|
|
|
56
|
-
Report
|
|
57
|
-
the result
|
|
74
|
+
Report a sanitized command, the selected environment and tenant when relevant,
|
|
75
|
+
and the result. Omit or redact payload values, personal data, session material,
|
|
76
|
+
and other sensitive values.
|
|
77
|
+
|
|
78
|
+
## Ingest metrics
|
|
79
|
+
|
|
80
|
+
Resolve omitted context before ingesting:
|
|
81
|
+
|
|
82
|
+
1. Use `dw data event list --all --json` to identify the event.
|
|
83
|
+
2. Use `dw data dataset-datasource list --all --json` to identify the
|
|
84
|
+
dataset-datasource and inspect its configured metrics.
|
|
85
|
+
3. If a name or description matches multiple resources, ask the human to choose;
|
|
86
|
+
never guess an ID.
|
|
87
|
+
4. Use the current Unix timestamp only when the user means "now". Otherwise ask
|
|
88
|
+
for or preserve the requested timestamp.
|
|
89
|
+
|
|
90
|
+
Each metric requires `athletePublicId`, `metric`, `value`, and a positive integer
|
|
91
|
+
`timestamp`. Pass a JSON array, a `{ "metrics": [...] }` object, `@file`, or `-`
|
|
92
|
+
for standard input. For example, after resolving the event and
|
|
93
|
+
dataset-datasource, ingest a heart rate of 120 for athlete `athlete-X` with:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
dw ingest --event event-123 --dataset-datasource ds-456 --metrics '[{"athletePublicId":"athlete-X","metric":"heartrate","value":120,"timestamp":1700000000}]' --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Strict validation is the default and sends nothing if any metric is invalid. Add
|
|
100
|
+
`--best-effort` only when the human accepts partial ingestion.
|
|
101
|
+
|
|
102
|
+
`dw ingest` supports neither `--dry-run` nor `--yes`; never add them. It sends
|
|
103
|
+
data immediately after validation. Do not add a `unit` property: use the metric
|
|
104
|
+
configured on the dataset-datasource and pass the numeric BPM as `value`. If the
|
|
105
|
+
target is Live, show the resolved event, dataset-datasource, athlete, metric,
|
|
106
|
+
value, and timestamp and obtain confirmation before running the command.
|
|
107
|
+
|
|
108
|
+
## Subscribe to realtime metrics
|
|
109
|
+
|
|
110
|
+
Use channel shape
|
|
111
|
+
`dataworks/<dataset-datasource-id>/<event-id>/<metric-or-*>`. A leading slash is
|
|
112
|
+
optional. Use `*` to receive all metrics or a metric name to narrow the stream:
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
dw events subscribe --channel dataworks/1/1/* --json
|
|
116
|
+
dw events subscribe --channel dataworks/1/1/heartrate --json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Subscriptions are long-running. Press `Ctrl+C` once to close the WebSocket and
|
|
120
|
+
return to the shell; do not leave orphaned subscription processes.
|
|
121
|
+
|
|
122
|
+
## Query Data Explorer
|
|
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
|
+
|
|
132
|
+
Use `dw data data-explorer execute --help` to inspect the installed contract.
|
|
133
|
+
Data Explorer queries require a JSON array of lowercase `columns` and a metric
|
|
134
|
+
category. Use `METRICS_TYPE_A` for GPS/position/timing metrics,
|
|
135
|
+
`METRICS_TYPE_B` for speed/altitude/cadence, and `METRICS_TYPE_C` for heart
|
|
136
|
+
rate/power/zones. The base columns are `timestamp`,
|
|
137
|
+
`datasetdatasourcepublicid`, `eventpublicid`, `athletepublicid`, `metric`, and
|
|
138
|
+
`current`. Prefer a reusable `--input @file` for complex filters; use individual
|
|
139
|
+
flags for simple queries:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
dw data data-explorer execute --columns '["timestamp","athletepublicid","metric","current"]' --metric-category METRICS_TYPE_A --limit 30 --order-by timestamp --order-direction DESC --json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Pass `--filter-rules` as an AWSJSON string shaped like
|
|
146
|
+
`{"combinator":"and","rules":[{"field":"metric","operator":"in","value":"latlong"}]}`.
|
|
147
|
+
Each rule contains `field`, `operator`, and string `value`; comma-separate
|
|
148
|
+
multiple values for `in`.
|
|
149
|
+
|
|
150
|
+
For a request such as "the last 30 GPS values for James Haigh":
|
|
151
|
+
|
|
152
|
+
1. Run `dw data athlete list --all --json` and match the name case-insensitively.
|
|
153
|
+
2. Require one exact athlete match; ask if multiple athletes match.
|
|
154
|
+
3. Use `dw data data-explorer execute`; do not substitute a guessed generated
|
|
155
|
+
command or raw GraphQL while this command is available.
|
|
156
|
+
4. Use GPS metric `latlong` in `METRICS_TYPE_A`. Filter on both `metric` and
|
|
157
|
+
lowercase `athletepublicid`, order by `timestamp` descending, and limit to 30. For athlete `athlete-123`, run:
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
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
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
5. Replace `athlete-123` with the resolved public ID and run the query with
|
|
164
|
+
`--json`. If status is `RUNNING` with a `queryExecutionId`, repeat the same
|
|
165
|
+
command with `--query-execution-id <id>` until it completes.
|
|
166
|
+
6. Return the 30 values in timestamp order and retain the athlete ID used in the
|
|
167
|
+
result summary. The `rows` field is AWSJSON: decode JSON until it is an array.
|
|
168
|
+
Interpret each `current` value as a `latitude:longitude` string.
|
|
169
|
+
|
|
170
|
+
Do not guess an athlete, event, dataset-datasource, or tenant ID. Resolve IDs
|
|
171
|
+
with CLI list commands and ask only when multiple resources match.
|