@thingd/cli 0.47.1 → 0.47.3

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":"AA4zDA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CvD"}
1
+ {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAy1DA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CvD"}
@@ -1591,29 +1591,52 @@ async function handleConnect(node) {
1591
1591
  draw();
1592
1592
  }
1593
1593
  catch {
1594
- viewerLines = [pc.yellow("Could not fetch cloud instances."), pc.dim("Enter the MCP URL manually.")];
1594
+ viewerLines = [
1595
+ pc.yellow("Could not fetch cloud instances."),
1596
+ pc.dim("Enter the MCP URL manually."),
1597
+ ];
1595
1598
  draw();
1596
1599
  }
1597
1600
  }
1598
1601
  }
1599
1602
  if (selectedDriver === "native" || selectedDriver === "cloud") {
1600
1603
  const cloudCfg = selectedDriver === "cloud" ? readCloudConfig() : null;
1601
- const defaultUrl = cloudCfg?.url ?? "https://api.thingd.cloud";
1604
+ const baseUrl = cloudCfg?.url ?? "https://api.thingd.cloud";
1605
+ const isCloudWithConfig = selectedDriver === "cloud" && cloudCfg?.token;
1602
1606
  openForm(`Connect to ${selectedDriver}`, [
1603
1607
  ...(selectedDriver === "cloud"
1604
- ? [
1605
- {
1606
- id: "url",
1607
- label: "MCP URL (get from thingd.cloud dashboard)",
1608
- value: `${defaultUrl}/mcp/<project>/<instance>`,
1609
- },
1610
- {
1611
- id: "token",
1612
- label: "Bearer Token (optional)",
1613
- isSecret: true,
1614
- value: cloudCfg?.token ?? "",
1615
- },
1616
- ]
1608
+ ? isCloudWithConfig
1609
+ ? [
1610
+ {
1611
+ id: "project",
1612
+ label: "Cloud Project (slug)",
1613
+ value: "",
1614
+ },
1615
+ {
1616
+ id: "instance",
1617
+ label: "Cloud Instance (slug)",
1618
+ value: "",
1619
+ },
1620
+ {
1621
+ id: "token",
1622
+ label: "Bearer Token (optional)",
1623
+ isSecret: true,
1624
+ value: cloudCfg?.token ?? "",
1625
+ },
1626
+ ]
1627
+ : [
1628
+ {
1629
+ id: "url",
1630
+ label: "MCP URL (from thingd.cloud dashboard)",
1631
+ value: "",
1632
+ },
1633
+ {
1634
+ id: "token",
1635
+ label: "Bearer Token (optional)",
1636
+ isSecret: true,
1637
+ value: cloudCfg?.token ?? "",
1638
+ },
1639
+ ]
1617
1640
  : [
1618
1641
  {
1619
1642
  id: "path",
@@ -1622,8 +1645,20 @@ async function handleConnect(node) {
1622
1645
  },
1623
1646
  ]),
1624
1647
  ], async (vals) => {
1625
- const resolvedPath = selectedDriver === "cloud" ? vals.url || "" : vals.path || "";
1626
- await connectToDriver(selectedDriver, resolvedPath, selectedDriver === "cloud" ? resolvedPath : undefined, vals.token);
1648
+ let mcpUrl;
1649
+ if (selectedDriver === "cloud") {
1650
+ if (isCloudWithConfig) {
1651
+ // Construct URL from project + instance slugs
1652
+ mcpUrl = `${baseUrl}/mcp/${encodeURIComponent(vals.project || "")}/${encodeURIComponent(vals.instance || "")}`;
1653
+ }
1654
+ else {
1655
+ mcpUrl = vals.url || "";
1656
+ }
1657
+ await connectToDriver(selectedDriver, mcpUrl, mcpUrl, vals.token);
1658
+ }
1659
+ else {
1660
+ await connectToDriver(selectedDriver, vals.path || "", undefined, undefined);
1661
+ }
1627
1662
  });
1628
1663
  }
1629
1664
  else {
@@ -28,17 +28,17 @@ async function request(config, path, opts = {}) {
28
28
  return res.json();
29
29
  }
30
30
  export async function getMe(config) {
31
- return request(config, "/api/users/me");
31
+ return request(config, "/users/me");
32
32
  }
33
33
  export async function listProjects(config) {
34
- return request(config, "/api/projects");
34
+ return request(config, "/projects");
35
35
  }
36
36
  export async function createProject(config, name, organizationId) {
37
37
  const body = { name };
38
38
  if (organizationId) {
39
39
  body.organizationId = organizationId;
40
40
  }
41
- return request(config, "/api/projects", { method: "POST", body });
41
+ return request(config, "/projects", { method: "POST", body });
42
42
  }
43
43
  export async function listInstances(config, projectId) {
44
44
  return request(config, `/api/projects/${projectId}/instances`);
@@ -57,10 +57,10 @@ export async function createApiKey(config, projectId, name) {
57
57
  }
58
58
  // ── Organization API ─────────────────────────────────────────────────
59
59
  export async function createOrganization(config, name) {
60
- return request(config, "/api/organizations", { method: "POST", body: { name } });
60
+ return request(config, "/organizations", { method: "POST", body: { name } });
61
61
  }
62
62
  export async function listOrganizations(config) {
63
- return request(config, "/api/organizations");
63
+ return request(config, "/organizations");
64
64
  }
65
65
  export async function getOrganization(config, orgId) {
66
66
  return request(config, `/api/organizations/${orgId}`);
@@ -94,8 +94,8 @@ async function requestUnauthenticated(apiUrl, path, body) {
94
94
  return res.json();
95
95
  }
96
96
  export async function startCliAuth(config) {
97
- return requestUnauthenticated(config.url ?? DEFAULT_API_URL, "/api/auth/cli/start", {});
97
+ return requestUnauthenticated(config.url ?? DEFAULT_API_URL, "/auth/cli/start", {});
98
98
  }
99
99
  export async function pollCliAuth(config, code) {
100
- return requestUnauthenticated(config.url ?? DEFAULT_API_URL, "/api/auth/cli/poll", { code });
100
+ return requestUnauthenticated(config.url ?? DEFAULT_API_URL, "/auth/cli/poll", { code });
101
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thingd/cli",
3
- "version": "0.47.1",
3
+ "version": "0.47.3",
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.1"
48
+ "@thingd/sdk": "0.47.3"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=24.0.0"