@thinger-io/cli-core 0.4.2 → 0.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.
- package/CHANGELOG.md +195 -0
- package/README.md +82 -31
- package/lib/bucket-export.js +91 -0
- package/lib/cli.js +106 -50
- package/lib/commands/_shared.js +89 -1
- package/lib/commands/api.js +90 -0
- package/lib/commands/arguments.js +62 -0
- package/lib/commands/bucket.js +52 -44
- package/lib/commands/dashboard.js +5 -2
- package/lib/commands/data.js +539 -0
- package/lib/commands/device.js +128 -241
- package/lib/commands/grammar.js +279 -0
- package/lib/commands/product.js +104 -214
- package/lib/commands/profile.js +1 -0
- package/lib/commands/resources.js +975 -0
- package/lib/dashboard-init.js +4 -3
- package/lib/dashboard.js +10 -2
- package/lib/mcp/catalog.js +301 -63
- package/lib/mcp/core-types.js +36 -0
- package/lib/mcp/helpers.js +23 -2
- package/lib/mcp/naming.js +20 -0
- package/lib/mcp/registry.js +18 -67
- package/lib/mcp/resource-hooks.js +19 -5
- package/lib/mcp/server.js +43 -11
- package/lib/mcp/tools-resource.js +1232 -330
- package/lib/mcp/types/bucket-data.js +151 -0
- package/lib/mcp/{tools-dashboards.js → types/dashboard-apps.js} +99 -37
- package/lib/mcp/types/device-resource.js +117 -0
- package/lib/mcp/types/doc.js +35 -0
- package/lib/mcp/types/plugin-call.js +75 -0
- package/lib/mcp/types/product-api.js +44 -0
- package/lib/mcp/types/profile.js +37 -0
- package/lib/mcp/types/storage-file.js +170 -0
- package/lib/openapi.js +18 -0
- package/lib/product-apply.js +121 -0
- package/lib/raw-api.js +111 -0
- package/lib/storage.js +41 -13
- package/lib/tokens.js +16 -2
- package/package.json +1 -1
- package/lib/mcp/tools-buckets.js +0 -130
- package/lib/mcp/tools-devices.js +0 -134
- package/lib/mcp/tools-misc.js +0 -48
- package/lib/mcp/tools-plugins.js +0 -63
- package/lib/mcp/tools-products.js +0 -52
- package/lib/mcp/tools-storage.js +0 -173
package/lib/dashboard-init.js
CHANGED
|
@@ -10,7 +10,7 @@ import { checkDestination, destinationContext, manifestName } from './dashboard.
|
|
|
10
10
|
import { SDK_PACKAGE } from './dashboard-sdk.js';
|
|
11
11
|
import { inputError } from './errors.js';
|
|
12
12
|
import { identity } from './identity.js';
|
|
13
|
-
import {
|
|
13
|
+
import { opRef } from './mcp/naming.js';
|
|
14
14
|
import { extractTgz } from './tgz.js';
|
|
15
15
|
|
|
16
16
|
const run = promisify(exec);
|
|
@@ -194,8 +194,9 @@ its own as a standalone page.
|
|
|
194
194
|
2. \`${cli} dashboard dev\` gives a link that opens the local app against the Thinger server, with
|
|
195
195
|
a temporary token and the context in ${manifestName()} (\`dev\`). Open it in a browser: the
|
|
196
196
|
app gets real data, reloads on every change, and its errors are in the browser console.
|
|
197
|
-
Agents: the MCP
|
|
198
|
-
tools.
|
|
197
|
+
Agents: the MCP call \`${opRef('dashboard', 'dev')}\` gives the same link; open it with
|
|
198
|
+
browser tools.
|
|
199
|
+
|
|
199
200
|
3. \`npm run build\`, then \`${cli} dashboard publish\`: it uploads \`${buildDir}\` and points the
|
|
200
201
|
destinations in ${manifestName()} at it.
|
|
201
202
|
|
package/lib/dashboard.js
CHANGED
|
@@ -166,7 +166,7 @@ export async function uploadFiles(storage, files, user) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/** Paths of every file in a storage (empty when it has none yet). */
|
|
169
|
-
async function listFiles(storage, user) {
|
|
169
|
+
export async function listFiles(storage, user) {
|
|
170
170
|
try {
|
|
171
171
|
const res = await api.get(`${v1(user)}/storages/${storage}/files`);
|
|
172
172
|
return (Array.isArray(res.data) ? res.data : [])
|
|
@@ -207,9 +207,17 @@ export function checkDestination(d) {
|
|
|
207
207
|
if (!d.dashboard === !(d.type || d.id)) {
|
|
208
208
|
throw inputError('a destination is either {dashboard} or {type, id}');
|
|
209
209
|
}
|
|
210
|
+
if (d.type === 'dashboard') {
|
|
211
|
+
throw inputError(
|
|
212
|
+
`a dashboard of the dashboards collection is {"dashboard": "${d.id ?? '<id>'}"}, not {type, id}`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
210
215
|
if (d.type && !TARGETS[d.type]) {
|
|
211
|
-
throw inputError(
|
|
216
|
+
throw inputError(
|
|
217
|
+
`type must be one of ${DASHBOARD_TARGETS.join(', ')} (a dashboard of the collection is {"dashboard": "<id>"})`,
|
|
218
|
+
);
|
|
212
219
|
}
|
|
220
|
+
|
|
213
221
|
const id = d.dashboard || d.id;
|
|
214
222
|
if (!id || !ID_RE.test(id)) throw inputError(`invalid id: "${id ?? ''}"`);
|
|
215
223
|
if (
|