@gobi-ai/cli 0.6.16 → 0.6.18
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/commands/update.js +73 -0
- package/dist/main.js +3 -1
- package/package.json +1 -1
- package/skills/gobi/SKILL.md +4 -2
- package/skills/gobi/references/update.md +11 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const { version: currentVersion } = require("../../package.json");
|
|
5
|
+
async function fetchLatestVersion() {
|
|
6
|
+
const res = await fetch("https://registry.npmjs.org/@gobi-ai/cli/latest");
|
|
7
|
+
if (!res.ok) {
|
|
8
|
+
throw new Error(`Failed to check for updates: HTTP ${res.status}`);
|
|
9
|
+
}
|
|
10
|
+
const data = (await res.json());
|
|
11
|
+
return data.version;
|
|
12
|
+
}
|
|
13
|
+
function detectInstallMethod() {
|
|
14
|
+
try {
|
|
15
|
+
const gobiBin = execSync("which gobi", { encoding: "utf-8" }).trim();
|
|
16
|
+
if (gobiBin.includes("/Cellar/") || gobiBin.includes("/homebrew/")) {
|
|
17
|
+
return "brew";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// ignore
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const npmGlobalDir = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
25
|
+
const gobiBin = execSync("which gobi", { encoding: "utf-8" }).trim();
|
|
26
|
+
if (gobiBin.includes(npmGlobalDir.replace("/lib/node_modules", ""))) {
|
|
27
|
+
return "npm";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// ignore
|
|
32
|
+
}
|
|
33
|
+
return "npm"; // default to npm
|
|
34
|
+
}
|
|
35
|
+
export function registerUpdateCommand(program) {
|
|
36
|
+
program
|
|
37
|
+
.command("update")
|
|
38
|
+
.description("Update gobi-cli to the latest version.")
|
|
39
|
+
.option("--check", "Only check for updates without installing")
|
|
40
|
+
.action(async (opts) => {
|
|
41
|
+
const latestVersion = await fetchLatestVersion();
|
|
42
|
+
if (currentVersion === latestVersion) {
|
|
43
|
+
console.log(`Already up to date (v${currentVersion}).`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
console.log(`Current version: v${currentVersion}`);
|
|
47
|
+
console.log(`Latest version: v${latestVersion}`);
|
|
48
|
+
if (opts.check) {
|
|
49
|
+
console.log("\nRun 'gobi update' to install the latest version.");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const method = detectInstallMethod();
|
|
53
|
+
console.log(`\nUpdating via ${method}...`);
|
|
54
|
+
try {
|
|
55
|
+
if (method === "brew") {
|
|
56
|
+
execSync("brew upgrade gobi", { stdio: "inherit" });
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
execSync("npm install -g @gobi-ai/cli@latest", {
|
|
60
|
+
stdio: "inherit",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
console.log(`\nSuccessfully updated to v${latestVersion}.`);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
console.error("\nUpdate failed. Try manually:\n" +
|
|
67
|
+
(method === "brew"
|
|
68
|
+
? " brew upgrade gobi"
|
|
69
|
+
: " npm install -g @gobi-ai/cli@latest"));
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -9,9 +9,10 @@ import { registerBrainCommand } from "./commands/brain.js";
|
|
|
9
9
|
import { registerSessionsCommand } from "./commands/sessions.js";
|
|
10
10
|
import { registerSenseCommand } from "./commands/sense.js";
|
|
11
11
|
import { registerSyncCommand } from "./commands/sync.js";
|
|
12
|
+
import { registerUpdateCommand } from "./commands/update.js";
|
|
12
13
|
const require = createRequire(import.meta.url);
|
|
13
14
|
const { version } = require("../package.json");
|
|
14
|
-
const SKIP_BANNER_COMMANDS = new Set(["auth", "init"]);
|
|
15
|
+
const SKIP_BANNER_COMMANDS = new Set(["auth", "init", "update"]);
|
|
15
16
|
function shouldShowBanner() {
|
|
16
17
|
const args = process.argv.slice(2);
|
|
17
18
|
if (args.length === 0)
|
|
@@ -34,6 +35,7 @@ export async function cli() {
|
|
|
34
35
|
registerSessionsCommand(program);
|
|
35
36
|
registerSenseCommand(program);
|
|
36
37
|
registerSyncCommand(program);
|
|
38
|
+
registerUpdateCommand(program);
|
|
37
39
|
// Propagate helpWidth to all subcommands
|
|
38
40
|
const helpWidth = process.stdout.columns || 200;
|
|
39
41
|
for (const cmd of program.commands) {
|
package/package.json
CHANGED
package/skills/gobi/SKILL.md
CHANGED
|
@@ -10,12 +10,12 @@ description: >-
|
|
|
10
10
|
allowed-tools: Bash(gobi:*)
|
|
11
11
|
metadata:
|
|
12
12
|
author: gobi-ai
|
|
13
|
-
version: "0.6.
|
|
13
|
+
version: "0.6.18"
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# gobi-cli
|
|
17
17
|
|
|
18
|
-
A CLI client for the Gobi collaborative knowledge platform (v0.6.
|
|
18
|
+
A CLI client for the Gobi collaborative knowledge platform (v0.6.18).
|
|
19
19
|
|
|
20
20
|
## Prerequisites
|
|
21
21
|
|
|
@@ -171,6 +171,7 @@ Note: `--space-slug` is not available on other `brain` subcommands or on `sessio
|
|
|
171
171
|
- `gobi sense activities` — Fetch activity records within a time range.
|
|
172
172
|
- `gobi sense transcriptions` — Fetch transcription records within a time range.
|
|
173
173
|
- `gobi sync` — Sync local vault files with Gobi Webdrive.
|
|
174
|
+
- `gobi update` — Update gobi-cli to the latest version.
|
|
174
175
|
|
|
175
176
|
## Reference Documentation
|
|
176
177
|
|
|
@@ -181,6 +182,7 @@ Note: `--space-slug` is not available on other `brain` subcommands or on `sessio
|
|
|
181
182
|
- [gobi session](references/session.md)
|
|
182
183
|
- [gobi sense](references/sense.md)
|
|
183
184
|
- [gobi sync](references/sync.md)
|
|
185
|
+
- [gobi update](references/update.md)
|
|
184
186
|
|
|
185
187
|
## Discovering Options
|
|
186
188
|
|