@thingd/cli 0.47.0 → 0.47.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAyyDA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CvD"}
1
+ {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AA4zDA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CvD"}
@@ -6,6 +6,7 @@ import * as path from "node:path";
6
6
  import readline from "node:readline";
7
7
  import { ThingD } from "@thingd/sdk";
8
8
  import pc from "picocolors";
9
+ import { listInstances, listProjects } from "./lib/cloud-api.js";
9
10
  import { readCloudConfig } from "./lib/cloud-config.js";
10
11
  import { logoText } from "./logo.js";
11
12
  // ── Helpers ──────────────────────────────────────────────────────────
@@ -1562,30 +1563,49 @@ async function handleConnect(node) {
1562
1563
  return;
1563
1564
  }
1564
1565
  const selectedDriver = node.ref.driver;
1565
- // Cloud with saved credentials — skip form
1566
+ // Cloud with saved credentials — fetch projects/instances and connect
1566
1567
  if (selectedDriver === "cloud") {
1567
1568
  const cloudCfg = readCloudConfig();
1568
1569
  if (cloudCfg?.token && cloudCfg?.url) {
1569
1570
  try {
1570
- await connectToDriver("cloud", cloudCfg.url, cloudCfg.url, cloudCfg.token);
1571
+ const { projects } = await listProjects(cloudCfg);
1572
+ for (const project of projects) {
1573
+ try {
1574
+ const { instances } = await listInstances(cloudCfg, project.id);
1575
+ if (instances.length > 0) {
1576
+ const instance = instances[0];
1577
+ if (instance?.mcpUrl) {
1578
+ await connectToDriver("cloud", instance.mcpUrl, instance.mcpUrl, cloudCfg.token);
1579
+ return;
1580
+ }
1581
+ }
1582
+ }
1583
+ catch {
1584
+ // Try next project
1585
+ }
1586
+ }
1587
+ viewerLines = [
1588
+ pc.yellow("No cloud instances found."),
1589
+ pc.dim("Create one at https://thingd.cloud, or enter the MCP URL manually."),
1590
+ ];
1591
+ draw();
1571
1592
  }
1572
- catch (err) {
1573
- const errMsg = err instanceof Error ? err.message : String(err);
1574
- viewerLines = [pc.red(`Failed to connect: ${errMsg}`)];
1593
+ catch {
1594
+ viewerLines = [pc.yellow("Could not fetch cloud instances."), pc.dim("Enter the MCP URL manually.")];
1575
1595
  draw();
1576
1596
  }
1577
- return;
1578
1597
  }
1579
1598
  }
1580
1599
  if (selectedDriver === "native" || selectedDriver === "cloud") {
1581
1600
  const cloudCfg = selectedDriver === "cloud" ? readCloudConfig() : null;
1601
+ const defaultUrl = cloudCfg?.url ?? "https://api.thingd.cloud";
1582
1602
  openForm(`Connect to ${selectedDriver}`, [
1583
1603
  ...(selectedDriver === "cloud"
1584
1604
  ? [
1585
1605
  {
1586
1606
  id: "url",
1587
- label: "Cloud URL",
1588
- value: cloudCfg?.url ?? "http://localhost:3000",
1607
+ label: "MCP URL (get from thingd.cloud dashboard)",
1608
+ value: `${defaultUrl}/mcp/<project>/<instance>`,
1589
1609
  },
1590
1610
  {
1591
1611
  id: "token",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thingd/cli",
3
- "version": "0.47.0",
3
+ "version": "0.47.1",
4
4
  "description": "CLI, Interactive TUI Dashboard, and MCP server for thingd — a fast object-first data engine for applications and AI agents.",
5
5
  "type": "module",
6
6
  "homepage": "https://engine.thingd.cloud",
@@ -45,7 +45,7 @@
45
45
  "cli-table3": "^0.6.5",
46
46
  "picocolors": "^1.1.1",
47
47
  "zod": "^4.4.3",
48
- "@thingd/sdk": "0.47.0"
48
+ "@thingd/sdk": "0.47.1"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=24.0.0"