@thinger-io/cli 0.2.2 → 0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0] - 2026-10-16
4
+
5
+ ### Added
6
+
7
+ - `thinger dashboard dev [url]`: develop a dashboard app on its own dev
8
+ server (ng serve, Vite…) against a real server: a link with a temporary
9
+ token opens the local app as a standalone page whose SDK calls the server
10
+ directly.
11
+ - `thinger dashboard publish [dir]`: upload the build to a public storage
12
+ and point dashboards at it (`--to`, repeatable; `--prune`, `--bump`,
13
+ `--preview`, `--no-point`). Both read their settings from `thinger.json`.
14
+ - `thinger dashboard init <dir>`: a new dashboard app from a template of
15
+ `@thinger-io/dashboard-sdk` (React or Angular, TypeScript), with its
16
+ `thinger.json` and an `AGENTS.md`; `--ci` adds a GitHub workflow.
17
+ - Publish and dev warn when the app's SDK needs a newer server, a newer SDK
18
+ is on npm, or a page loads the deprecated script build.
19
+ - MCP tools `thinger_dashboard_init` and `thinger_dashboard_dev` (25
20
+ tools): the same for agents, which open the dev link with their browser
21
+ tools.
22
+ - `THINGER_TOKEN` (an access token) and `THINGER_SERVER` replace the saved
23
+ profile in every command and the MCP server (CI), unless `--profile` or
24
+ `THINGER_PROFILE` names one; `thinger login` warns while `THINGER_TOKEN`
25
+ is set.
26
+
27
+ ### Changed
28
+
29
+ - Requires `@thinger-io/cli-core` 0.4.0.
30
+ - The guides for agents (`thinger_doc_read`: concepts, product code, server
31
+ administration, the dashboard SDK reference and types) ship with the CLI
32
+ and the SDK package instead of coming from the server, which stops
33
+ serving `/sdk/`. Same ids; what needs a newer server says "since Thinger
34
+ X".
35
+ - Preview links no longer come with a layout check link: the server
36
+ retires `/sdk/preview.html`.
37
+
38
+ ## [0.2.3] - 2026-10-14
39
+
40
+ ### Changed
41
+
42
+ - `@thinger-io/cli-core` 0.3.0: `thinger_resource_call` gains the
43
+ `alarm_instance` action `stats` (how many instances there are in each
44
+ state); actions check their parent and id; `resource_list` pages lists
45
+ answered whole from any `index`. The tools are the same 23.
46
+
3
47
  ## [0.2.2] - 2026-10-12
4
48
 
5
49
  ### Changed
package/README.md CHANGED
@@ -4,9 +4,9 @@ A command-line tool for any [Thinger.io](https://thinger.io) server, and an
4
4
  MCP server that lets AI assistants (Claude Code, Claude Desktop, Cursor…)
5
5
  operate it with the permissions of your token.
6
6
 
7
- - **CLI** — devices, products, buckets and profiles from a shell, with
8
- `--json` output for scripts.
9
- - **MCP server** — `thinger mcp` serves 23 `thinger_*` tools over
7
+ - **CLI** — devices, products, buckets, dashboard apps and profiles from a
8
+ shell, with `--json` output for scripts.
9
+ - **MCP server** — `thinger mcp` serves 25 `thinger_*` tools over
10
10
  stdio.
11
11
 
12
12
  Both share the same profiles and API layer: sign in once, use either.
@@ -58,6 +58,11 @@ THINGER_PROFILE=staging thinger device list
58
58
  `-u, --user <account>` addresses another account on the same server when
59
59
  your profile has admin rights.
60
60
 
61
+ `THINGER_TOKEN` (an access token) and `THINGER_SERVER` stand for a profile
62
+ in every command and in the MCP server, for CI: they replace the saved
63
+ profile unless `--profile` or `THINGER_PROFILE` names one, and
64
+ `thinger login` warns while `THINGER_TOKEN` is set.
65
+
61
66
  ## Commands
62
67
 
63
68
  ```bash
@@ -84,6 +89,96 @@ thinger bucket read <bucket> [-d device] [-n 10] [-m minutes] [--agg 5m --agg-ty
84
89
  Every command takes `-j, --json` and then prints `{ ok, data }` or
85
90
  `{ ok: false, error: { message, code } }`.
86
91
 
92
+ ## Dashboard apps
93
+
94
+ Custom dashboards are web apps (React, Angular…) built on the dashboard SDK,
95
+ [`@thinger-io/dashboard-sdk`](https://www.npmjs.com/package/@thinger-io/dashboard-sdk).
96
+ Create one from a template, develop it on its own dev server against a real
97
+ server, and publish it when it works:
98
+
99
+ ```bash
100
+ thinger dashboard init greenhouse --to device:gh_01 # --template angular, --ci, --install
101
+ cd greenhouse && npm install
102
+ npm run dev # Angular: npm start. Leave it running
103
+ thinger dashboard dev --open # in another terminal
104
+ npm run build && thinger dashboard publish
105
+ ```
106
+
107
+ `dashboard init` copies a template of the SDK package (`react` by default,
108
+ `angular`) from its latest release on npm (offline, the copy the CLI
109
+ installs; `--from` takes another version or tag, or a folder or .tgz of it) into a new
110
+ folder, with the SDK as a dependency, a `thinger.json` for the commands
111
+ below (storage `app_<folder>_<random>` unless `--storage`), and an `AGENTS.md`
112
+ (with a `CLAUDE.md` pointing at it) with the rules of the console's frame
113
+ for the agents that work on it. `--ci` adds a GitHub workflow that
114
+ publishes it.
115
+
116
+ `dashboard dev` prints (or opens) a link to your local app that runs it as a
117
+ standalone page against the server, in the context you pick (`--device`,
118
+ `--product`, `--asset-type`, `--asset-group`, `--project`, or
119
+ `--to device:<id>`; by default the first destination in `thinger.json`):
120
+ the SDK calls the server directly with a temporary token with full access
121
+ to your account (to the project with `--project`; 8 h, `--hours`; the next
122
+ link for the same project replaces it), so writes are real. The url must
123
+ be on this machine (localhost) unless you pass `--allow-remote`: the link
124
+ carries that token. Your dev server
125
+ keeps reloading the app and the browser's tools show its errors. The app
126
+ bundles the dashboard SDK, so its dev server needs no proxy, and the SDK
127
+ takes the server from the link.
128
+
129
+ Outside the console's sandboxed iframe, localStorage, cookies and a `<base>`
130
+ tag work: don't rely on them, they fail once published.
131
+
132
+ `dashboard publish` uploads the build folder to a public storage and points
133
+ the destinations at it (`dashboard:<id>`, `device:<id>`, `product:<id>`,
134
+ `asset_type:<id>`, `asset_group:<id>`, `project:<id>`; repeat `--to` for
135
+ several). `--preview` adds standalone review links with a read-only token.
136
+ Both commands warn when the app's SDK needs a newer server than the
137
+ profile's, when a newer SDK is on npm, or when the page loads the
138
+ deprecated script build (`thinger-dashboard.js`).
139
+
140
+ A `thinger.json` next to the app keeps the settings of these commands, so
141
+ they run without arguments (`dev.context` defaults to the first
142
+ destination's; `dev.route` and `dev.hours` are optional too):
143
+
144
+ ```json
145
+ {
146
+ "dashboard": {
147
+ "dir": "dist",
148
+ "storage": "app_greenhouse",
149
+ "prune": true,
150
+ "to": [{ "type": "device", "id": "gh_01", "route": "/" }],
151
+ "dev": { "url": "http://localhost:5173/" }
152
+ }
153
+ }
154
+ ```
155
+
156
+ To publish from CI, set the repository variable `THINGER_SERVER` and the
157
+ secret `THINGER_TOKEN` (an access token allowed to write storages and
158
+ dashboards, or the resources' `dashboard` property); `dashboard init --ci`
159
+ writes this workflow:
160
+
161
+ ```yaml
162
+ # .github/workflows/dashboard.yml
163
+ name: Publish dashboard
164
+ on:
165
+ push:
166
+ branches: [main]
167
+ jobs:
168
+ publish:
169
+ runs-on: ubuntu-latest
170
+ steps:
171
+ - uses: actions/checkout@v4
172
+ - uses: actions/setup-node@v4
173
+ with:
174
+ node-version: 22
175
+ - run: npm ci && npm run build
176
+ - run: npx -y @thinger-io/cli dashboard publish
177
+ env:
178
+ THINGER_SERVER: ${{ vars.THINGER_SERVER }}
179
+ THINGER_TOKEN: ${{ secrets.THINGER_TOKEN }}
180
+ ```
181
+
87
182
  ## MCP server
88
183
 
89
184
  ```bash
@@ -108,9 +203,12 @@ Tools:
108
203
  actions, read from the server's own API description.
109
204
  - `thinger_bucket_data_read` / `_write`, `thinger_device_resource_list` /
110
205
  `_call`, `thinger_device_data_send`, `thinger_device_overview`,
111
- `thinger_product_resource_call`, `thinger_storage_file_list` / `_read` /
112
- `_write` / `_delete`, `thinger_dashboard_publish`, `thinger_doc_read`,
113
- `thinger_profile_list`.
206
+ `thinger_product_resource_call`, `thinger_plugin_call`,
207
+ `thinger_storage_file_list` / `_read` / `_write` / `_delete`,
208
+ `thinger_dashboard_init` / `_dev` / `_publish`, `thinger_doc_read`,
209
+ `thinger_profile_list`. `thinger_dashboard_dev` gives an agent the dev
210
+ link above: with browser tools it opens the app, reads its console and
211
+ iterates, then publishes it once.
114
212
 
115
213
  Every tool takes an optional `profile`, and most an optional `user`.
116
214
 
package/lib/identity.js CHANGED
@@ -14,8 +14,9 @@ export const thingerIdentity = {
14
14
  name: 'thinger',
15
15
  displayName: 'Thinger.io',
16
16
  description:
17
- 'CLI for Thinger.io servers — devices, products, buckets, with an MCP server for AI clients',
17
+ 'CLI for Thinger.io servers — devices, products, buckets, dashboard apps, with an MCP server for AI clients',
18
18
  configDir: 'thinger-cli',
19
+ npmPackage: '@thinger-io/cli',
19
20
  envPrefix: 'THINGER',
20
21
  token: { id: 'thinger_cli', name: 'Thinger CLI' },
21
22
  // No OAuth client ships with Thinger servers yet: the browser login asks
@@ -28,9 +29,9 @@ export const thingerIdentity = {
28
29
  /** Server-level guidance sent to MCP clients on `initialize`. */
29
30
  export const mcpInstructions = `Tools to operate a Thinger.io IoT server with the permissions of the token stored in the CLI profile.
30
31
 
31
- - Server resources (devices, products, buckets, dashboards, tokens, alarms, properties…) are reached through thinger_resource_list / _get / _create / _update / _delete / _clone with a \`type\`. Start with thinger_resource_describe without arguments: it lists the types and, on servers that publish it, explains the platform's concepts (which data source fits each need, recipes). With a type it gives its fields and examples: call it before writing one for the first time.
32
+ - Server resources (devices, products, buckets, dashboards, tokens, alarms, properties…) are reached through thinger_resource_list / _get / _create / _update / _delete / _clone with a \`type\`. Start with thinger_resource_describe without arguments: it lists the types and explains the platform's concepts (which data source fits each need, recipes). With a type it gives its fields and examples: call it before writing one for the first time.
32
33
  - List before acting to discover ids (thinger_resource_list with type "device", "product", "bucket"…); never guess them.
33
34
  - Device resources (the API a connected device's firmware exposes) are a different thing: thinger_device_resource_list / thinger_device_resource_call.
34
- - Custom dashboards are HTML apps using the server's dashboard SDK: publish them with thinger_dashboard_publish (thinger_resource_describe type "dashboard" has the SDK reference).
35
+ - Custom dashboards are web apps built on the dashboard SDK, the npm package @thinger-io/dashboard-sdk (reference: thinger_resource_describe type "dashboard", or thinger_doc_read id "dashboard-sdk"). Start them with thinger_dashboard_init (a TypeScript project from a template of the SDK), develop them on their own dev server with thinger_dashboard_dev (start the dev server first; the link opens the local app against the server with a temporary token: open it with browser tools to see it and read its console), then build and publish the build folder once with thinger_dashboard_publish.
35
36
  - Every tool takes an optional \`profile\` (another configured server, see thinger_profile_list) and most take \`user\` (another account, admin only).
36
37
  - Destructive tools (delete, overwrite) act immediately: confirm with the user first.`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@thinger-io/cli",
3
- "version": "0.2.2",
4
- "description": "CLI for Thinger.io servers — devices, products, buckets — with an MCP server for AI clients",
3
+ "version": "0.3.0",
4
+ "description": "CLI for Thinger.io servers — devices, products, buckets, dashboard apps — with an MCP server for AI clients",
5
5
  "main": "bin/thinger.js",
6
6
  "bin": {
7
7
  "thinger": "bin/thinger.js"
@@ -38,7 +38,7 @@
38
38
  "author": "Thinger.io",
39
39
  "license": "MIT",
40
40
  "dependencies": {
41
- "@thinger-io/cli-core": "^0.2.0"
41
+ "@thinger-io/cli-core": "^0.4.0"
42
42
  },
43
43
  "type": "module",
44
44
  "engines": {