thingd-cli 0.13.0 → 0.14.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/dist/install.d.ts.map +1 -1
- package/dist/install.js +55 -22
- package/package.json +2 -2
package/dist/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAwB7C,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA4JnE"}
|
package/dist/install.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { homedir, platform } from "node:os";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { createInterface } from "node:readline/promises";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
5
6
|
import pc from "picocolors";
|
|
6
7
|
import { defaultThingdDbPath, ensureThingdDir } from "./paths.js";
|
|
7
8
|
async function askQuestion(query) {
|
|
@@ -174,9 +175,26 @@ function findGlobalBinPath() {
|
|
|
174
175
|
return null;
|
|
175
176
|
}
|
|
176
177
|
function resolveCliPath() {
|
|
178
|
+
try {
|
|
179
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
180
|
+
const dir = dirname(currentFile);
|
|
181
|
+
// In compiled dist folder: dist/install.js -> dist/index.js
|
|
182
|
+
let candidate = join(dir, "index.js");
|
|
183
|
+
if (existsSync(candidate)) {
|
|
184
|
+
return realpathSync(candidate);
|
|
185
|
+
}
|
|
186
|
+
// In dev src folder: src/install.ts -> src/index.ts
|
|
187
|
+
candidate = join(dir, "index.ts");
|
|
188
|
+
if (existsSync(candidate)) {
|
|
189
|
+
return realpathSync(candidate);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
// Ignore and fallback
|
|
194
|
+
}
|
|
177
195
|
const scriptPath = process.argv[1];
|
|
178
196
|
if (!scriptPath) {
|
|
179
|
-
throw new Error("Could not detect thingd CLI path
|
|
197
|
+
throw new Error("Could not detect thingd CLI path.");
|
|
180
198
|
}
|
|
181
199
|
try {
|
|
182
200
|
return realpathSync(resolve(scriptPath));
|
|
@@ -241,32 +259,47 @@ function updateClaudeDesktopConfig(config) {
|
|
|
241
259
|
}
|
|
242
260
|
}
|
|
243
261
|
function updateAntigravityConfig(config) {
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
262
|
+
const candidates = [
|
|
263
|
+
join(homedir(), ".gemini", "config", "mcp_config.json"),
|
|
264
|
+
join(homedir(), ".gemini", "antigravity-ide", "mcp_config.json"),
|
|
265
|
+
];
|
|
266
|
+
let updatedAny = false;
|
|
267
|
+
const pathsUpdated = [];
|
|
268
|
+
let lastError = null;
|
|
269
|
+
for (const configPath of candidates) {
|
|
270
|
+
const dir = dirname(configPath);
|
|
271
|
+
if (existsSync(dir)) {
|
|
272
|
+
try {
|
|
273
|
+
let existing = {};
|
|
274
|
+
if (existsSync(configPath)) {
|
|
275
|
+
const raw = readFileSync(configPath, "utf-8").trim();
|
|
276
|
+
if (raw) {
|
|
277
|
+
existing = JSON.parse(raw);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const mcpServers = (existing.mcpServers ?? {});
|
|
281
|
+
mcpServers.thingd = config;
|
|
282
|
+
existing.mcpServers = mcpServers;
|
|
283
|
+
writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}\n`, "utf-8");
|
|
284
|
+
updatedAny = true;
|
|
285
|
+
pathsUpdated.push(configPath);
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
258
289
|
}
|
|
259
290
|
}
|
|
260
|
-
const mcpServers = (existing.mcpServers ?? {});
|
|
261
|
-
mcpServers.thingd = config;
|
|
262
|
-
existing.mcpServers = mcpServers;
|
|
263
|
-
writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}\n`, "utf-8");
|
|
264
|
-
return { updated: true, path: configPath };
|
|
265
291
|
}
|
|
266
|
-
|
|
292
|
+
if (updatedAny) {
|
|
293
|
+
return { updated: true, path: pathsUpdated.join(" & ") };
|
|
294
|
+
}
|
|
295
|
+
if (lastError) {
|
|
267
296
|
return {
|
|
268
297
|
skipped: true,
|
|
269
|
-
reason: `Failed to update config: ${
|
|
298
|
+
reason: `Failed to update config: ${lastError.message}`,
|
|
270
299
|
};
|
|
271
300
|
}
|
|
301
|
+
return {
|
|
302
|
+
skipped: true,
|
|
303
|
+
reason: `Antigravity directory not found in ${candidates.map((c) => dirname(c)).join(" or ")}.`,
|
|
304
|
+
};
|
|
272
305
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thingd-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Command-line interface, Interactive TUI Dashboard, and MCP server for thingd.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Sayan Mohsin",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"cli-table3": "^0.6.5",
|
|
34
34
|
"picocolors": "^1.1.1",
|
|
35
35
|
"zod": "^4.4.3",
|
|
36
|
-
"thingd": "0.
|
|
36
|
+
"thingd": "0.14.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=20"
|