@thingd/cli 0.51.3 → 0.51.4

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":"AAkiEA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoDvD"}
1
+ {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAmkEA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoDvD"}
@@ -234,7 +234,9 @@ async function fetchResourcesFallback() {
234
234
  const listed = await db.listQueues();
235
235
  queues = (listed ?? []).sort();
236
236
  }
237
- catch {
237
+ catch (err) {
238
+ const msg = err instanceof Error ? err.message : String(err);
239
+ cloudError = cloudError ?? `Failed to load queues: ${msg}`;
238
240
  queues = [];
239
241
  }
240
242
  // Link count
@@ -740,6 +742,9 @@ async function loadContent(node) {
740
742
  content += ` ${pc.dim("Writes".padEnd(14))} ${pc.cyan(wLine)} ${pc.cyan(String(currentWrite).padEnd(4))} ${pc.dim(`w/s`)}\n`;
741
743
  content += ` ${pc.dim("Appends".padEnd(14))} ${pc.green(apLine)} ${pc.green(String(currentAppend).padEnd(4))} ${pc.dim(`e/s`)}\n\n`;
742
744
  content += ` ${pc.dim("Shortcuts:")} ${pc.bold("[c]")} Create ${pc.bold("[r]")} Refresh ${pc.bold("[/]")} Search\n`;
745
+ if (cloudError) {
746
+ content += `\n ${pc.yellow("⚠")} ${pc.dim(cloudError)}\n`;
747
+ }
743
748
  }
744
749
  else if (node.type === "category") {
745
750
  content = pc.dim("Expand to browse items.");
@@ -1253,34 +1258,61 @@ async function handleInfo() {
1253
1258
  const baseUrl = dbPath.startsWith("thingd://")
1254
1259
  ? `http://${dbPath.slice("thingd://".length)}`
1255
1260
  : dbPath;
1256
- const urlObj = new URL(baseUrl);
1257
- if (urlObj.pathname === "/mcp") {
1258
- urlObj.pathname = "/";
1259
- }
1261
+ const apiRoot = baseUrl.replace(/\/+$/, "");
1260
1262
  const fetchJson = async (p) => {
1261
- const u = new URL(p, urlObj.toString());
1263
+ const u = `${apiRoot}${p}`;
1262
1264
  const headers = {};
1263
1265
  if (authToken) {
1264
1266
  headers.Authorization = `Bearer ${authToken}`;
1265
1267
  }
1266
1268
  const res = await fetch(u, { headers });
1269
+ const json = await res.json();
1267
1270
  if (!res.ok) {
1268
- throw new Error(`HTTP ${res.status}`);
1271
+ const detail = json?.error?.detail ?? json?.error?.message ?? `HTTP ${res.status}`;
1272
+ throw new Error(`${res.status}: ${detail}`);
1269
1273
  }
1270
- return res.json();
1274
+ return json;
1271
1275
  };
1272
- const health = await fetchJson("/healthz");
1273
- const cluster = await fetchJson("/cluster/status");
1274
- lines.push("");
1275
- lines.push(` ${pc.bold("Cloud Health")}`);
1276
- lines.push(...JSON.stringify(health, null, 2)
1277
- .split("\n")
1278
- .map((l) => ` ${pc.dim(l)}`));
1276
+ // Health check
1277
+ let healthError = null;
1278
+ let health = null;
1279
+ try {
1280
+ health = await fetchJson("/v1/health");
1281
+ }
1282
+ catch (err) {
1283
+ healthError = err instanceof Error ? err.message : String(err);
1284
+ }
1285
+ // Collections check
1286
+ let collectionsResult = null;
1287
+ if (!healthError) {
1288
+ try {
1289
+ const colResp = await fetchJson("/v1/collections");
1290
+ collectionsResult = colResp?.data ?? null;
1291
+ }
1292
+ catch {
1293
+ // collections endpoint may not be available on all setups
1294
+ }
1295
+ }
1279
1296
  lines.push("");
1280
- lines.push(` ${pc.bold("Cloud Cluster")}`);
1281
- lines.push(...JSON.stringify(cluster, null, 2)
1282
- .split("\n")
1283
- .map((l) => ` ${pc.dim(l)}`));
1297
+ lines.push(` ${pc.bold("Cloud REST API")}`);
1298
+ if (healthError) {
1299
+ lines.push(` ${pc.red("Health check failed:")} ${healthError}`);
1300
+ lines.push(` ${pc.dim("API URL:")} ${apiRoot}/v1/...`);
1301
+ lines.push(` ${pc.dim("Auth:")} ${authToken ? pc.green("Bearer token set") : pc.red("No token")}`);
1302
+ }
1303
+ else {
1304
+ const h = health;
1305
+ const status = h?.data?.status ?? h?.status ?? "ok";
1306
+ lines.push(` ${pc.dim("Status:")} ${pc.green(String(status))}`);
1307
+ lines.push(` ${pc.dim("Collections:")} ${collectionsResult ? pc.cyan(String(collectionsResult.length)) : pc.yellow("unknown")}`);
1308
+ if (collectionsResult && collectionsResult.length > 0) {
1309
+ lines.push(` ${pc.dim("Names:")} ${collectionsResult.join(", ")}`);
1310
+ }
1311
+ }
1312
+ if (cloudError) {
1313
+ lines.push("");
1314
+ lines.push(` ${pc.yellow("⚠ Recent error:")} ${cloudError}`);
1315
+ }
1284
1316
  }
1285
1317
  catch (err) {
1286
1318
  const errMsg = err instanceof Error ? err.message : String(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thingd/cli",
3
- "version": "0.51.3",
3
+ "version": "0.51.4",
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.51.3"
48
+ "@thingd/sdk": "0.51.4"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=24.0.0"