@tryglen/cli 0.5.1 → 0.6.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/README.md +3 -3
- package/dist/_utils/agents-table.d.ts +10 -0
- package/dist/_utils/agents-table.js +26 -0
- package/dist/_utils/agents-table.js.map +1 -0
- package/dist/_utils/cli-error.d.ts +11 -0
- package/dist/_utils/cli-error.js +24 -0
- package/dist/_utils/cli-error.js.map +1 -0
- package/dist/_utils/codex-app-server.js +4 -1
- package/dist/_utils/codex-app-server.js.map +1 -1
- package/dist/_utils/config.js +3 -1
- package/dist/_utils/config.js.map +1 -1
- package/dist/_utils/credentials.d.ts +1 -1
- package/dist/_utils/credentials.js +8 -3
- package/dist/_utils/credentials.js.map +1 -1
- package/dist/_utils/find-bin.d.ts +6 -0
- package/dist/_utils/find-bin.js +85 -0
- package/dist/_utils/find-bin.js.map +1 -0
- package/dist/_utils/http.d.ts +10 -3
- package/dist/_utils/http.js +56 -5
- package/dist/_utils/http.js.map +1 -1
- package/dist/_utils/loopback-server.d.ts +1 -1
- package/dist/_utils/loopback-server.js +17 -2
- package/dist/_utils/loopback-server.js.map +1 -1
- package/dist/_utils/open-browser.js +3 -0
- package/dist/_utils/open-browser.js.map +1 -1
- package/dist/_utils/plugin-status.d.ts +4 -0
- package/dist/_utils/plugin-status.js +23 -0
- package/dist/_utils/plugin-status.js.map +1 -0
- package/dist/_utils/run-bin.d.ts +13 -0
- package/dist/_utils/run-bin.js +51 -0
- package/dist/_utils/run-bin.js.map +1 -0
- package/dist/_utils/state-line.js +3 -1
- package/dist/_utils/state-line.js.map +1 -1
- package/dist/_utils/state.d.ts +1 -1
- package/dist/_utils/state.js +8 -2
- package/dist/_utils/state.js.map +1 -1
- package/dist/_utils/update.d.ts +20 -2
- package/dist/_utils/update.js +111 -15
- package/dist/_utils/update.js.map +1 -1
- package/dist/_utils/version.js +12 -1
- package/dist/_utils/version.js.map +1 -1
- package/dist/_utils/which.d.ts +3 -2
- package/dist/_utils/which.js +5 -12
- package/dist/_utils/which.js.map +1 -1
- package/dist/bin.js +44 -22
- package/dist/bin.js.map +1 -1
- package/dist/commands/doctor.d.ts +6 -3
- package/dist/commands/doctor.js +68 -54
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/incognito.d.ts +2 -1
- package/dist/commands/incognito.js +16 -4
- package/dist/commands/incognito.js.map +1 -1
- package/dist/commands/ingest.d.ts +1 -5
- package/dist/commands/ingest.js +47 -16
- package/dist/commands/ingest.js.map +1 -1
- package/dist/commands/install.d.ts +5 -1
- package/dist/commands/install.js +121 -81
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/login.d.ts +2 -1
- package/dist/commands/login.js +41 -10
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +2 -1
- package/dist/commands/logout.js +20 -5
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/onboard.d.ts +2 -1
- package/dist/commands/onboard.js +7 -3
- package/dist/commands/onboard.js.map +1 -1
- package/dist/commands/org.d.ts +3 -2
- package/dist/commands/org.js +40 -9
- package/dist/commands/org.js.map +1 -1
- package/dist/commands/search.d.ts +2 -4
- package/dist/commands/search.js +25 -16
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/session-start.d.ts +6 -3
- package/dist/commands/session-start.js +16 -6
- package/dist/commands/session-start.js.map +1 -1
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/statusline.d.ts +7 -5
- package/dist/commands/statusline.js +18 -8
- package/dist/commands/statusline.js.map +1 -1
- package/dist/commands/uninstall.d.ts +2 -1
- package/dist/commands/uninstall.js +8 -3
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts +10 -3
- package/dist/commands/update.js +111 -12
- package/dist/commands/update.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/org.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import prompts from "prompts";
|
|
2
|
+
import { causeOf, cliErr } from "../_utils/cli-error.js";
|
|
2
3
|
import { config } from "../_utils/config.js";
|
|
3
4
|
import { readCredentials } from "../_utils/credentials.js";
|
|
4
5
|
import { buildGlenHeaders } from "../_utils/glen-headers.js";
|
|
5
|
-
import { httpJson } from "../_utils/http.js";
|
|
6
|
+
import { httpJson, networkRemedy } from "../_utils/http.js";
|
|
6
7
|
import { err, ok } from "../_utils/result.js";
|
|
7
|
-
import { readState, writeState } from "../_utils/state.js";
|
|
8
|
+
import { readState, statePath, writeState } from "../_utils/state.js";
|
|
8
9
|
import { cliVersion } from "../_utils/version.js";
|
|
9
10
|
const fetchOrgs = async () => {
|
|
10
11
|
const creds = await readCredentials();
|
|
11
12
|
if (!creds)
|
|
12
|
-
return err("
|
|
13
|
+
return err(cliErr({ what: "not connected", remedy: "run `glen login` first" }));
|
|
13
14
|
const state = await readState();
|
|
14
15
|
const res = await httpJson(config.listOrgsUrl, {
|
|
15
16
|
method: "POST",
|
|
@@ -21,14 +22,28 @@ const fetchOrgs = async () => {
|
|
|
21
22
|
timeoutMs: config.listOrgsTimeoutMs,
|
|
22
23
|
});
|
|
23
24
|
if (!res.ok)
|
|
24
|
-
return err(
|
|
25
|
+
return err(cliErr({
|
|
26
|
+
what: "could not reach glen",
|
|
27
|
+
why: res.error.detail,
|
|
28
|
+
remedy: networkRemedy(res.error),
|
|
29
|
+
}));
|
|
25
30
|
if (res.value.status === 401 || res.value.status === 403)
|
|
26
|
-
return err(
|
|
31
|
+
return err(cliErr({
|
|
32
|
+
what: "your session lost its organization",
|
|
33
|
+
remedy: "run `glen login` to reconnect",
|
|
34
|
+
}));
|
|
27
35
|
if (!res.value.isOk)
|
|
28
|
-
return err(
|
|
36
|
+
return err(cliErr({
|
|
37
|
+
what: `glen returned HTTP ${res.value.status}`,
|
|
38
|
+
why: res.value.rawText.slice(0, 200) || `HTTP ${res.value.status}`,
|
|
39
|
+
remedy: "try again in a minute — if it persists, check https://tryglen.com/status",
|
|
40
|
+
}));
|
|
29
41
|
const orgs = res.value.json?.orgs;
|
|
30
42
|
if (!orgs)
|
|
31
|
-
return err(
|
|
43
|
+
return err(cliErr({
|
|
44
|
+
what: "unexpected response from glen",
|
|
45
|
+
remedy: "update the CLI (`glen update`) and retry",
|
|
46
|
+
}));
|
|
32
47
|
return ok(orgs);
|
|
33
48
|
};
|
|
34
49
|
const applySwitch = async (target) => {
|
|
@@ -40,7 +55,12 @@ const applySwitch = async (target) => {
|
|
|
40
55
|
incognito: current?.incognito ?? false,
|
|
41
56
|
});
|
|
42
57
|
if (!w.ok)
|
|
43
|
-
return err(
|
|
58
|
+
return err(cliErr({
|
|
59
|
+
what: "could not save org selection",
|
|
60
|
+
why: causeOf(w.error),
|
|
61
|
+
path: statePath(),
|
|
62
|
+
remedy: "check ownership of ~/.glen (e.g. `sudo chown -R $USER ~/.glen`) and retry",
|
|
63
|
+
}));
|
|
44
64
|
process.stdout.write(`🏔️ Active organization is now ${target.name} (${target.slug}).\n`);
|
|
45
65
|
return ok(undefined);
|
|
46
66
|
};
|
|
@@ -53,13 +73,24 @@ const orgList = async () => {
|
|
|
53
73
|
return ok(undefined);
|
|
54
74
|
};
|
|
55
75
|
const orgSwitch = async (slug) => {
|
|
76
|
+
// No slug + no TTY: the interactive picker would hang (or silently no-op) —
|
|
77
|
+
// fail fast with the scripted alternative before any network call.
|
|
78
|
+
if (!slug && !process.stdin.isTTY)
|
|
79
|
+
return err(cliErr({
|
|
80
|
+
what: "no organization specified",
|
|
81
|
+
remedy: "non-interactive shell — pass a slug: glen org switch <slug> (see `glen org list`)",
|
|
82
|
+
}));
|
|
56
83
|
const orgs = await fetchOrgs();
|
|
57
84
|
if (!orgs.ok)
|
|
58
85
|
return orgs;
|
|
59
86
|
if (slug) {
|
|
60
87
|
const target = orgs.value.find((o) => o.slug === slug || o.orgId === slug);
|
|
61
88
|
if (!target)
|
|
62
|
-
return err(
|
|
89
|
+
return err(cliErr({
|
|
90
|
+
what: `no organization "${slug}"`,
|
|
91
|
+
why: `available: ${orgs.value.map((o) => o.slug).join(", ")}`,
|
|
92
|
+
remedy: "run `glen org list` and pass one of the listed slugs",
|
|
93
|
+
}));
|
|
63
94
|
return applySwitch(target);
|
|
64
95
|
}
|
|
65
96
|
const response = await prompts({
|
package/dist/commands/org.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAiB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAe,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlD,MAAM,SAAS,GAAG,KAAK,IAAsC,EAAE;IAC7D,MAAM,KAAK,GAAG,MAAM,eAAe,EAAE,CAAC;IACtC,IAAI,CAAC,KAAK;QACR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,EAAE,QAAQ;QACd,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,wBAAwB;QACjC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9B,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,GAAG;YAC9B,KAAK,EAAE,CAAC;SACT,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,CAAC,GAAG,CACf,CAAC,EACD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CACtC;KACF,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;IACxC,OAAO,WAAW,CAAC,QAAQ,CAAC,GAAU,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
+
import { type CliError } from "../_utils/cli-error.js";
|
|
1
2
|
import { type Result } from "../_utils/result.js";
|
|
2
|
-
declare const search: (query: string) => Promise<Result<void,
|
|
3
|
-
code: number;
|
|
4
|
-
message: string;
|
|
5
|
-
}>>;
|
|
3
|
+
declare const search: (query: string) => Promise<Result<void, CliError>>;
|
|
6
4
|
export { search };
|
package/dist/commands/search.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { cliErr } from "../_utils/cli-error.js";
|
|
1
2
|
import { config } from "../_utils/config.js";
|
|
2
3
|
import { readCredentials } from "../_utils/credentials.js";
|
|
3
4
|
import { gitContext } from "../_utils/git-context.js";
|
|
4
5
|
import { buildGlenHeaders } from "../_utils/glen-headers.js";
|
|
5
|
-
import { httpJson } from "../_utils/http.js";
|
|
6
|
+
import { httpJson, networkRemedy } from "../_utils/http.js";
|
|
6
7
|
import { err, ok } from "../_utils/result.js";
|
|
7
8
|
import { readState } from "../_utils/state.js";
|
|
8
9
|
import { handle426AndReexec, maybeSpawnBackgroundUpdate, } from "../_utils/update.js";
|
|
@@ -10,10 +11,13 @@ import { cliVersion } from "../_utils/version.js";
|
|
|
10
11
|
const search = async (query) => {
|
|
11
12
|
void maybeSpawnBackgroundUpdate();
|
|
12
13
|
if (!query.trim())
|
|
13
|
-
return err({
|
|
14
|
+
return err(cliErr({
|
|
15
|
+
what: "missing search query",
|
|
16
|
+
remedy: 'usage: glen search "<query>"',
|
|
17
|
+
}));
|
|
14
18
|
const creds = await readCredentials();
|
|
15
19
|
if (!creds)
|
|
16
|
-
return err({
|
|
20
|
+
return err(cliErr({ what: "not connected", remedy: "run `glen login` first" }));
|
|
17
21
|
const state = await readState();
|
|
18
22
|
// Assemble additionalContext for search. Apply the empty-context rule: only
|
|
19
23
|
// include when we have at least one non-empty group.
|
|
@@ -34,27 +38,32 @@ const search = async (query) => {
|
|
|
34
38
|
timeoutMs: config.searchTimeoutMs,
|
|
35
39
|
});
|
|
36
40
|
if (!res.ok)
|
|
37
|
-
return err({
|
|
41
|
+
return err(cliErr({
|
|
42
|
+
what: "glen search failed",
|
|
43
|
+
why: res.error.detail,
|
|
44
|
+
remedy: networkRemedy(res.error),
|
|
45
|
+
}));
|
|
38
46
|
if (res.value.status === 426)
|
|
39
47
|
handle426AndReexec(process.argv.slice(2));
|
|
40
48
|
if (res.value.status === 401 || res.value.status === 403) {
|
|
41
49
|
if (res.value.rawText.includes("no active organization")) {
|
|
42
|
-
return err({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
50
|
+
return err(cliErr({
|
|
51
|
+
what: "no active organization",
|
|
52
|
+
remedy: "run `glen org switch`",
|
|
53
|
+
}));
|
|
46
54
|
}
|
|
47
55
|
// Don't clear credentials — a concurrent `glen login` may have just saved a fresh key.
|
|
48
|
-
return err({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
56
|
+
return err(cliErr({
|
|
57
|
+
what: "your connection expired",
|
|
58
|
+
remedy: "run `glen login` to reconnect",
|
|
59
|
+
}));
|
|
52
60
|
}
|
|
53
61
|
if (!res.value.isOk)
|
|
54
|
-
return err({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
return err(cliErr({
|
|
63
|
+
what: `glen search failed (HTTP ${res.value.status})`,
|
|
64
|
+
why: res.value.rawText.slice(0, 200) || `HTTP ${res.value.status}`,
|
|
65
|
+
remedy: "try again in a minute — if it persists, check https://tryglen.com/status",
|
|
66
|
+
}));
|
|
58
67
|
const context = res.value.json?.context;
|
|
59
68
|
process.stdout.write(typeof context === "string" && context.trim()
|
|
60
69
|
? `${context}\n`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAe,GAAG,EAAE,EAAE,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C,EAAE,GAAG,CAAC,IAAI,QAAQ,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE;YAClE,MAAM,EACJ,0EAA0E;SAC7E,CAAC,CACH,CAAC;IAEJ,MAAM,OAAO,GAAI,GAAG,CAAC,KAAK,CAAC,IAAuC,EAAE,OAAO,CAAC;IAC5E,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE;QAC3C,CAAC,CAAC,GAAG,OAAO,IAAI;QAChB,CAAC,CAAC,kDAAkD,CACvD,CAAC;IACF,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
* Behavior:
|
|
9
9
|
* 1. Spawn a detached `glen doctor --auto` (background maintenance; never blocks).
|
|
10
10
|
* 2. Read stdin (SessionStart event JSON, parsed defensively — tolerate garbage).
|
|
11
|
-
* 3. Read local session state.
|
|
11
|
+
* 3. Read local credentials + session state.
|
|
12
12
|
* 4. Write ONE JSON object to stdout:
|
|
13
|
-
* - state
|
|
13
|
+
* - creds + state → hookSpecificOutput.additionalContext = formatStateLine(state)
|
|
14
14
|
* + systemMessage at top level when incognito is ON
|
|
15
|
-
* - no
|
|
15
|
+
* - no creds → "[glen] not set up on this machine — ask the user whether
|
|
16
|
+
* to set up glen, then use the glen-setup skill."
|
|
17
|
+
* - creds, no org → "[glen] no org selected — ask the user whether to set up
|
|
18
|
+
* glen, then use the glen-setup skill."
|
|
16
19
|
* 5. Always exit 0 — this hook must never block a session.
|
|
17
20
|
*/
|
|
18
21
|
declare const sessionStart: () => Promise<void>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { readCredentials } from "../_utils/credentials.js";
|
|
2
3
|
import { formatStateLine } from "../_utils/state-line.js";
|
|
3
4
|
import { readState } from "../_utils/state.js";
|
|
4
5
|
// Reads stdin defensively (SessionStart hook event — parse lenient; may be empty
|
|
5
6
|
// or invalid and we must still work).
|
|
6
7
|
const readStdin = async () => {
|
|
8
|
+
if (process.stdin.isTTY)
|
|
9
|
+
return ""; // manual run in a terminal — don't hang
|
|
7
10
|
const chunks = [];
|
|
8
11
|
for await (const chunk of process.stdin)
|
|
9
12
|
chunks.push(chunk);
|
|
@@ -34,11 +37,14 @@ const spawnDoctorAuto = () => {
|
|
|
34
37
|
* Behavior:
|
|
35
38
|
* 1. Spawn a detached `glen doctor --auto` (background maintenance; never blocks).
|
|
36
39
|
* 2. Read stdin (SessionStart event JSON, parsed defensively — tolerate garbage).
|
|
37
|
-
* 3. Read local session state.
|
|
40
|
+
* 3. Read local credentials + session state.
|
|
38
41
|
* 4. Write ONE JSON object to stdout:
|
|
39
|
-
* - state
|
|
42
|
+
* - creds + state → hookSpecificOutput.additionalContext = formatStateLine(state)
|
|
40
43
|
* + systemMessage at top level when incognito is ON
|
|
41
|
-
* - no
|
|
44
|
+
* - no creds → "[glen] not set up on this machine — ask the user whether
|
|
45
|
+
* to set up glen, then use the glen-setup skill."
|
|
46
|
+
* - creds, no org → "[glen] no org selected — ask the user whether to set up
|
|
47
|
+
* glen, then use the glen-setup skill."
|
|
42
48
|
* 5. Always exit 0 — this hook must never block a session.
|
|
43
49
|
*/
|
|
44
50
|
const sessionStart = async () => {
|
|
@@ -53,10 +59,14 @@ const sessionStart = async () => {
|
|
|
53
59
|
catch {
|
|
54
60
|
// Tolerate stdin errors — the hook must always produce output.
|
|
55
61
|
}
|
|
62
|
+
const credentials = await readCredentials();
|
|
56
63
|
const state = await readState();
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
const noOrgHint = "[glen] no org selected — ask the user whether to set up glen, then use the glen-setup skill.";
|
|
65
|
+
const additionalContext = !credentials
|
|
66
|
+
? "[glen] not set up on this machine — ask the user whether to set up glen, then use the glen-setup skill."
|
|
67
|
+
: state
|
|
68
|
+
? (formatStateLine(state) ?? noOrgHint)
|
|
69
|
+
: noOrgHint;
|
|
60
70
|
const output = {
|
|
61
71
|
hookSpecificOutput: {
|
|
62
72
|
hookEventName: "SessionStart",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../src/commands/session-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,iFAAiF;AACjF,sCAAsC;AACtC,MAAM,SAAS,GAAG,KAAK,IAAqB,EAAE;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,2EAA2E;AAC3E,+EAA+E;AAC/E,4EAA4E;AAC5E,MAAM,eAAe,GAAG,GAAS,EAAE;IACjC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,KAAK,CACb,OAAO,CAAC,QAAQ,EAChB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAC/C,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CACpC,CAAC;QACF,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACjB,iBAAiB;QACnB,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,KAAK,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,0DAA0D;IAC5D,CAAC;AACH,CAAC,C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;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,YAAY,GAAG,KAAK,IAAmB,EAAE;IAC7C,wEAAwE;IACxE,wEAAwE;IACxE,8BAA8B;IAC9B,eAAe,EAAE,CAAC;IAElB,8DAA8D;IAC9D,IAAI,CAAC;QACH,MAAM,SAAS,EAAE,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,+DAA+D;IACjE,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;IAC5C,MAAM,KAAK,GAAG,MAAM,SAAS,EAAE,CAAC;IAEhC,MAAM,SAAS,GACb,8FAA8F,CAAC;IACjG,MAAM,iBAAiB,GAAG,CAAC,WAAW;QACpC,CAAC,CAAC,yGAAyG;QAC3G,CAAC,CAAC,KAAK;YACL,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC;YACvC,CAAC,CAAC,SAAS,CAAC;IAUhB,MAAM,MAAM,GAAuB;QACjC,kBAAkB,EAAE;YAClB,aAAa,EAAE,cAAc;YAC7B,iBAAiB;SAClB;QACD,GAAG,CAAC,KAAK,EAAE,SAAS;YAClB,CAAC,CAAC;gBACE,aAAa,EACX,uFAAuF;aAC1F;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAe,E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AAC,KAAK,CAClB,UAAU,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAChH,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC3E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* `glen statusline` — called by the agent's status-line hook.
|
|
3
3
|
*
|
|
4
4
|
* Reads stdin (Claude Code statusline JSON payload; parsed defensively, currently
|
|
5
|
-
* unused — reserved for future enrichment). Reads local
|
|
6
|
-
* single line to stdout and always exits 0 so it never breaks
|
|
5
|
+
* unused — reserved for future enrichment). Reads local credentials + session
|
|
6
|
+
* state. Outputs a single line to stdout and always exits 0 so it never breaks
|
|
7
|
+
* the host UI.
|
|
7
8
|
*
|
|
8
|
-
* Output:
|
|
9
|
-
*
|
|
10
|
-
* no
|
|
9
|
+
* Output (org slugs are auto-generated — the NAME is the human-meaningful field):
|
|
10
|
+
* creds + state → 🏔️ <name|slug|id>[ · 🕶️ incognito]
|
|
11
|
+
* no creds → 🏔️ glen — not connected · ask me to "set up glen"
|
|
12
|
+
* creds, no org → 🏔️ glen — no org selected · ask me to "set up glen"
|
|
11
13
|
*/
|
|
12
14
|
declare const statusline: () => Promise<void>;
|
|
13
15
|
export { statusline };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { readCredentials } from "../_utils/credentials.js";
|
|
1
2
|
import { readState } from "../_utils/state.js";
|
|
2
3
|
// Reads stdin defensively (Claude Code statusline JSON — parse lenient, v1 ignores fields).
|
|
3
4
|
const readStdin = async () => {
|
|
5
|
+
if (process.stdin.isTTY)
|
|
6
|
+
return ""; // manual run in a terminal — don't hang
|
|
4
7
|
const chunks = [];
|
|
5
8
|
for await (const chunk of process.stdin)
|
|
6
9
|
chunks.push(chunk);
|
|
@@ -10,12 +13,14 @@ const readStdin = async () => {
|
|
|
10
13
|
* `glen statusline` — called by the agent's status-line hook.
|
|
11
14
|
*
|
|
12
15
|
* Reads stdin (Claude Code statusline JSON payload; parsed defensively, currently
|
|
13
|
-
* unused — reserved for future enrichment). Reads local
|
|
14
|
-
* single line to stdout and always exits 0 so it never breaks
|
|
16
|
+
* unused — reserved for future enrichment). Reads local credentials + session
|
|
17
|
+
* state. Outputs a single line to stdout and always exits 0 so it never breaks
|
|
18
|
+
* the host UI.
|
|
15
19
|
*
|
|
16
|
-
* Output:
|
|
17
|
-
*
|
|
18
|
-
* no
|
|
20
|
+
* Output (org slugs are auto-generated — the NAME is the human-meaningful field):
|
|
21
|
+
* creds + state → 🏔️ <name|slug|id>[ · 🕶️ incognito]
|
|
22
|
+
* no creds → 🏔️ glen — not connected · ask me to "set up glen"
|
|
23
|
+
* creds, no org → 🏔️ glen — no org selected · ask me to "set up glen"
|
|
19
24
|
*/
|
|
20
25
|
const statusline = async () => {
|
|
21
26
|
// Drain stdin before doing anything else (hook may pipe data to us).
|
|
@@ -25,12 +30,17 @@ const statusline = async () => {
|
|
|
25
30
|
catch {
|
|
26
31
|
// Ignore stdin errors — the statusline must always produce output.
|
|
27
32
|
}
|
|
33
|
+
const credentials = await readCredentials();
|
|
28
34
|
const state = await readState();
|
|
29
35
|
const line = (() => {
|
|
36
|
+
if (!credentials)
|
|
37
|
+
return '🏔️ glen — not connected · ask me to "set up glen"';
|
|
30
38
|
if (!state)
|
|
31
|
-
return
|
|
32
|
-
const
|
|
33
|
-
return state.incognito
|
|
39
|
+
return '🏔️ glen — no org selected · ask me to "set up glen"';
|
|
40
|
+
const orgDisplay = state.activeOrgName ?? state.activeOrgSlug ?? state.activeOrgId;
|
|
41
|
+
return state.incognito
|
|
42
|
+
? `🏔️ ${orgDisplay} · 🕶️ incognito`
|
|
43
|
+
: `🏔️ ${orgDisplay}`;
|
|
34
44
|
})();
|
|
35
45
|
process.stdout.write(line);
|
|
36
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusline.js","sourceRoot":"","sources":["../../src/commands/statusline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,4FAA4F;AAC5F,MAAM,SAAS,GAAG,KAAK,IAAqB,EAAE;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"statusline.js","sourceRoot":"","sources":["../../src/commands/statusline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,4FAA4F;AAC5F,MAAM,SAAS,GAAG,KAAK,IAAqB,EAAE;IAC5C,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC,CAAC,wCAAwC;IAC5E,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,GAAG,KAAK,IAAmB,EAAE;IAC3C,qEAAqE;IACrE,IAAI,CAAC;QACH,MAAM,SAAS,EAAE,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;IACrE,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;IAC5C,MAAM,KAAK,GAAG,MAAM,SAAS,EAAE,CAAC;IAEhC,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE;QACjB,IAAI,CAAC,WAAW;YAAE,OAAO,oDAAoD,CAAC;QAC9E,IAAI,CAAC,KAAK;YAAE,OAAO,sDAAsD,CAAC;QAC1E,MAAM,UAAU,GACd,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,WAAW,CAAC;QAClE,OAAO,KAAK,CAAC,SAAS;YACpB,CAAC,CAAC,OAAO,UAAU,kBAAkB;YACrC,CAAC,CAAC,OAAO,UAAU,EAAE,CAAC;IAC1B,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CliError } from "../_utils/cli-error.js";
|
|
1
2
|
import { type Result } from "../_utils/result.js";
|
|
2
3
|
/**
|
|
3
4
|
* `glen uninstall`
|
|
@@ -7,5 +8,5 @@ import { type Result } from "../_utils/result.js";
|
|
|
7
8
|
* blocks, clears the install marker. Other tools' hooks are untouched.
|
|
8
9
|
* Plugin removal itself stays with the agents' own CLIs (printed below).
|
|
9
10
|
*/
|
|
10
|
-
declare const uninstall: () => Promise<Result<void,
|
|
11
|
+
declare const uninstall: () => Promise<Result<void, CliError>>;
|
|
11
12
|
export { uninstall };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { cliErr } from "../_utils/cli-error.js";
|
|
1
2
|
import { isCodexHooksInstalled, uninstallCodexHooks, } from "../_utils/codex-hooks-setup.js";
|
|
2
|
-
import { ok } from "../_utils/result.js";
|
|
3
|
+
import { err, ok } from "../_utils/result.js";
|
|
3
4
|
import { isInstalled } from "../_utils/which.js";
|
|
4
5
|
/**
|
|
5
6
|
* `glen uninstall`
|
|
@@ -16,8 +17,12 @@ const uninstall = async () => {
|
|
|
16
17
|
process.stdout.write(" Removing glen hooks from Codex's user config layer... ");
|
|
17
18
|
const r = await uninstallCodexHooks();
|
|
18
19
|
if (!r.ok) {
|
|
19
|
-
process.stdout.write(
|
|
20
|
-
return
|
|
20
|
+
process.stdout.write("✗\n");
|
|
21
|
+
return err(cliErr({
|
|
22
|
+
what: "could not remove codex hooks",
|
|
23
|
+
why: r.error,
|
|
24
|
+
remedy: "re-run `glen uninstall`; if it persists remove the glen entries from ~/.codex/hooks.json manually",
|
|
25
|
+
}));
|
|
21
26
|
}
|
|
22
27
|
process.stdout.write("✓\n");
|
|
23
28
|
process.stdout.write(" Note: Codex trust keys are positional — if other tools registered\n" +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAe,EAAE,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAe,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAA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AAM,CAAC,KAAK,CAClB,wFAAwF,CACzF,CAAC;IACF,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { type CliError } from "../_utils/cli-error.js";
|
|
1
2
|
import { type Result } from "../_utils/result.js";
|
|
2
3
|
/**
|
|
3
|
-
* `glen update` —
|
|
4
|
-
*
|
|
4
|
+
* `glen update` — converge: self-update the CLI (npm-global installs), then
|
|
5
|
+
* run the update steps for every agent whose glen plugin is already
|
|
6
|
+
* installed, then re-verify the codex user-layer hooks.
|
|
7
|
+
*
|
|
8
|
+
* The plugin section intentionally runs in the OLD-version process after a
|
|
9
|
+
* self-update — the plugin update commands are stable agent CLIs, and
|
|
10
|
+
* re-exec'ing mid-command would lose the printed context. A failed
|
|
11
|
+
* self-update returns immediately, skipping the plugin section.
|
|
5
12
|
*/
|
|
6
|
-
declare const update: () => Promise<Result<void,
|
|
13
|
+
declare const update: () => Promise<Result<void, CliError>>;
|
|
7
14
|
export { update };
|
package/dist/commands/update.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AGENTS } from "../_utils/agents-table.js";
|
|
2
|
+
import { cliErr } from "../_utils/cli-error.js";
|
|
3
|
+
import { installCodexHooks, isCodexHooksInstalled, } from "../_utils/codex-hooks-setup.js";
|
|
4
|
+
import { findBin } from "../_utils/find-bin.js";
|
|
5
|
+
import { glenPluginStatus } from "../_utils/plugin-status.js";
|
|
6
|
+
import { err, ok } from "../_utils/result.js";
|
|
7
|
+
import { runBin } from "../_utils/run-bin.js";
|
|
8
|
+
import { fetchLatest, isNpmGlobalInstall, lockPath, newer, runSelfUpdate, } from "../_utils/update.js";
|
|
3
9
|
import { cliVersion } from "../_utils/version.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
// Step label: last two args make a readable name ("update glen@glen",
|
|
11
|
+
// "marketplace upgrade glen") — same convention as install.ts.
|
|
12
|
+
const stepLabel = (step) => step.slice(1).join(" ");
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// CLI self-update — same logic + CliError mappings as before. Non-error
|
|
15
|
+
// outcomes (registry unreachable, already current, not npm-global) are info,
|
|
16
|
+
// not failures; a failed self-update IS a failure: it returns a CliError
|
|
17
|
+
// (locked / npm-failed) that bin.ts prints via formatCliError and exits 1.
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
const updateCli = async () => {
|
|
9
20
|
process.stdout.write(`Current version: ${cliVersion}\n`);
|
|
10
21
|
const latest = await fetchLatest();
|
|
11
22
|
if (!latest) {
|
|
@@ -13,7 +24,9 @@ const update = async () => {
|
|
|
13
24
|
return ok(undefined);
|
|
14
25
|
}
|
|
15
26
|
process.stdout.write(`Latest version: ${latest}\n`);
|
|
16
|
-
|
|
27
|
+
// `newer` (not `===`) — a locally-newer dev build must not "update"
|
|
28
|
+
// (downgrade) to the older registry version.
|
|
29
|
+
if (!newer(latest, cliVersion)) {
|
|
17
30
|
process.stdout.write("Already up to date.\n");
|
|
18
31
|
return ok(undefined);
|
|
19
32
|
}
|
|
@@ -23,12 +36,98 @@ const update = async () => {
|
|
|
23
36
|
}
|
|
24
37
|
process.stdout.write(`Updating to v${latest}...\n`);
|
|
25
38
|
const updated = runSelfUpdate();
|
|
26
|
-
if (updated) {
|
|
27
|
-
|
|
39
|
+
if (!updated.ok) {
|
|
40
|
+
if (updated.reason === "locked") {
|
|
41
|
+
return err(cliErr({
|
|
42
|
+
what: "another update appears to be in progress",
|
|
43
|
+
path: lockPath(),
|
|
44
|
+
remedy: `if no update is running, delete the lock dir and retry: rm -rf ${lockPath()}`,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
return err(cliErr({
|
|
48
|
+
what: "npm install failed",
|
|
49
|
+
...(updated.stderrTail ? { why: updated.stderrTail } : {}),
|
|
50
|
+
remedy: "run `npm i -g @tryglen/cli@latest` manually",
|
|
51
|
+
}));
|
|
28
52
|
}
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
process.stdout.write(`Updated to v${latest}.\n`);
|
|
54
|
+
return ok(undefined);
|
|
55
|
+
};
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Plugin converge — runs an agent's updateSteps when (and only when) the glen
|
|
58
|
+
// plugin is already installed for it. `glen update` NEVER installs a plugin;
|
|
59
|
+
// that's `glen install`'s job.
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
const updateAgentPlugin = (agent, resolvedBin) => {
|
|
62
|
+
process.stdout.write(` Updating ${agent.name} plugin:\n`);
|
|
63
|
+
const results = [];
|
|
64
|
+
for (const step of agent.updateSteps) {
|
|
65
|
+
const label = stepLabel(step);
|
|
66
|
+
const r = runBin(resolvedBin, step);
|
|
67
|
+
if (r.ok) {
|
|
68
|
+
process.stdout.write(` ${label}... ✓\n`);
|
|
69
|
+
results.push(true);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const cause = r.error.stderrTail || r.error.spawnError || `exit ${r.error.code}`;
|
|
73
|
+
process.stdout.write(` ${label}... ✗ ${cause}\n`);
|
|
74
|
+
process.stdout.write(` → run \`${agent.bin} ${step.join(" ")}\` manually to see the full error\n`);
|
|
75
|
+
results.push(false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return results;
|
|
79
|
+
};
|
|
80
|
+
// Re-verify the codex user-layer hooks, but only when the install marker says
|
|
81
|
+
// glen registered them before — Claude-only users never get codex config
|
|
82
|
+
// written. installCodexHooks is idempotent (re-merge + re-trust).
|
|
83
|
+
const reverifyCodexHooks = async () => {
|
|
84
|
+
if (!(await isCodexHooksInstalled()))
|
|
85
|
+
return [];
|
|
86
|
+
const r = await installCodexHooks();
|
|
87
|
+
if (r.ok) {
|
|
88
|
+
if (!r.value.trusted) {
|
|
89
|
+
// Registered but untrusted hooks are silently skipped by Codex — surface
|
|
90
|
+
// it as a warning with the manual re-trust step.
|
|
91
|
+
process.stdout.write(" codex hooks: ⚠ registered but not trusted — open Codex, run /hooks, and trust the glen hooks\n");
|
|
92
|
+
return [false];
|
|
93
|
+
}
|
|
94
|
+
process.stdout.write(" codex hooks: ✓ re-verified\n");
|
|
95
|
+
return [true];
|
|
31
96
|
}
|
|
97
|
+
process.stdout.write(` codex hooks: ✗ ${r.error}\n → run \`glen install --agent codex\`\n`);
|
|
98
|
+
return [false];
|
|
99
|
+
};
|
|
100
|
+
const updatePlugins = async () => {
|
|
101
|
+
const results = [];
|
|
102
|
+
for (const agent of AGENTS) {
|
|
103
|
+
const resolvedBin = findBin(agent.bin);
|
|
104
|
+
if (resolvedBin === null || glenPluginStatus(agent.bin) !== "installed") {
|
|
105
|
+
process.stdout.write(` ${agent.bin}: skipped (plugin not installed)\n`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
results.push(...updateAgentPlugin(agent, resolvedBin));
|
|
109
|
+
}
|
|
110
|
+
results.push(...(await reverifyCodexHooks()));
|
|
111
|
+
process.stdout.write(results.every(Boolean)
|
|
112
|
+
? "\nEverything up to date.\n"
|
|
113
|
+
: "\nDone, with warnings above — fix them before relying on glen memory.\n");
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* `glen update` — converge: self-update the CLI (npm-global installs), then
|
|
117
|
+
* run the update steps for every agent whose glen plugin is already
|
|
118
|
+
* installed, then re-verify the codex user-layer hooks.
|
|
119
|
+
*
|
|
120
|
+
* The plugin section intentionally runs in the OLD-version process after a
|
|
121
|
+
* self-update — the plugin update commands are stable agent CLIs, and
|
|
122
|
+
* re-exec'ing mid-command would lose the printed context. A failed
|
|
123
|
+
* self-update returns immediately, skipping the plugin section.
|
|
124
|
+
*/
|
|
125
|
+
const update = async () => {
|
|
126
|
+
const self = await updateCli();
|
|
127
|
+
if (!self.ok)
|
|
128
|
+
return self;
|
|
129
|
+
process.stdout.write("\n");
|
|
130
|
+
await updatePlugins();
|
|
32
131
|
return ok(undefined);
|
|
33
132
|
};
|
|
34
133
|
export { update };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAiB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAe,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,sEAAsE;AACtE,+DAA+D;AAC/D,MAAM,SAAS,GAAG,CAAC,IAAuB,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/E,8EAA8E;AAC9E,wEAAwE;AACxE,6EAA6E;AAC7E,yEAAyE;AACzE,2EAA2E;AAC3E,8EAA8E;AAC9E,MAAM,SAAS,GAAG,KAAK,IAAqC,EAAE;IAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,UAAU,IAAI,CAAC,CAAC;IAEzD,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