@tiens.nguyen/gu-cli 1.0.939 → 1.0.940

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.
Files changed (64) hide show
  1. package/README.md +17 -7
  2. package/agent-deps-preflight.mjs +1 -1
  3. package/autocompact.mjs +2 -2
  4. package/browser-bridge.mjs +2 -2
  5. package/browser-chrome.mjs +2 -2
  6. package/browser-command.mjs +4 -4
  7. package/browser-extension/README.md +6 -6
  8. package/clear-logs.mjs +3 -3
  9. package/clear-state.mjs +3 -3
  10. package/cli-token.mjs +8 -8
  11. package/client-expert-api.mjs +9 -9
  12. package/client-expert-run.mjs +7 -7
  13. package/client-expert-setup.mjs +4 -4
  14. package/command-allow.mjs +1 -1
  15. package/conversation-archive.mjs +2 -2
  16. package/credential-recovery.mjs +1 -1
  17. package/daemon-control.mjs +4 -4
  18. package/device-login.mjs +3 -3
  19. package/free-model.mjs +1 -1
  20. package/full-log-command.mjs +1 -1
  21. package/gonext_agent_chat.py +71 -71
  22. package/gu-cli.mjs +29 -28
  23. package/gu-home-move.mjs +193 -0
  24. package/gu-repl.mjs +54 -51
  25. package/gu_browser.py +3 -3
  26. package/gu_free_budget.py +2 -2
  27. package/gu_gif.py +1 -1
  28. package/gu_hooks.py +1 -1
  29. package/gu_turn_notes.py +2 -2
  30. package/hooks-config.mjs +4 -4
  31. package/image-paste.mjs +8 -8
  32. package/install-path.mjs +1 -1
  33. package/log-level.mjs +1 -1
  34. package/log-policy.mjs +1 -1
  35. package/lsp-host.mjs +2 -2
  36. package/lsp-registry.mjs +9 -9
  37. package/mcp-command.mjs +1 -1
  38. package/mcp-config.mjs +5 -5
  39. package/model-doctor.mjs +10 -10
  40. package/mongo-mac.mjs +2 -2
  41. package/mongo-windows.mjs +3 -3
  42. package/package.json +2 -1
  43. package/platform-tools.mjs +3 -3
  44. package/poll-errors.mjs +2 -2
  45. package/prompt_scaffold_check.py +1 -1
  46. package/proxy-store.mjs +1 -1
  47. package/python-unix.mjs +6 -6
  48. package/python-windows.mjs +1 -1
  49. package/rag-selftest.mjs +2 -2
  50. package/resume-memory.mjs +1 -1
  51. package/scripts/image-paste-check.mjs +1 -1
  52. package/setup-fixes.mjs +4 -4
  53. package/shell-details.mjs +2 -2
  54. package/skill-install.mjs +9 -9
  55. package/skill-package.mjs +10 -10
  56. package/skill-source.mjs +4 -4
  57. package/skills-copy.mjs +15 -15
  58. package/skills.mjs +4 -4
  59. package/support-bundle.mjs +6 -6
  60. package/support-report.mjs +5 -5
  61. package/terminal-layout.mjs +1 -1
  62. package/turn-notes.mjs +2 -2
  63. package/version-check.mjs +1 -1
  64. package/workspace-revert.mjs +2 -2
package/skill-source.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WHOSE SKILLS THIS FOLDER USES — gu's or Claude Code's (task #325, /switch-skill).
3
3
  *
4
- * "gu" ~/.gonext and <project>/.gonext (the default; a folder that never chose)
4
+ * "gu" ~/.gu and <project>/.gu (the default; a folder that never chose)
5
5
  * "claude" ~/.claude and <project>/.claude Claude Code's own files, read where they are
6
6
  *
7
7
  * One choice covers skills, MCP servers and hooks, because they depend on each other: a skill names
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * ONE-WAY. gu reads Claude Code's setup; Claude Code is never expected to read gu's. So nothing of
12
12
  * gu's own is written into Claude's files: which project servers and hooks you approved, and the
13
- * allow rules, stay in ~/.gonext whichever source is chosen.
13
+ * allow rules, stay in ~/.gu whichever source is chosen.
14
14
  *
15
15
  * PER FOLDER, IN THE FOLDER'S SESSION FILE. The terminal writes it; the worker — a different
16
16
  * process, which builds each turn's skills, servers and hooks — reads the same file. Every reader
@@ -30,7 +30,7 @@ export const SKILL_SOURCE_KEY = "skillSource";
30
30
  export const normalizeSkillSource = (v) => (v === "claude" ? "claude" : DEFAULT_SKILL_SOURCE);
31
31
 
32
32
  /** The folder each source keeps its files in — under the home directory and under the project. */
33
- export const sourceDirName = (source) => (normalizeSkillSource(source) === "claude" ? ".claude" : ".gonext");
33
+ export const sourceDirName = (source) => (normalizeSkillSource(source) === "claude" ? ".claude" : ".gu");
34
34
 
35
35
  /** What a picker and a status line call it. */
36
36
  export const sourceLabel = (source) => (normalizeSkillSource(source) === "claude" ? "Claude's skills" : "gu's skills");
@@ -38,7 +38,7 @@ export const sourceLabel = (source) => (normalizeSkillSource(source) === "claude
38
38
  /** The terminal's per-folder session file — the same name gu-repl.mjs uses. */
39
39
  export function sessionFileFor(cwd, home = homedir()) {
40
40
  const hash = createHash("sha256").update(String(cwd)).digest("hex").slice(0, 32);
41
- return join(home, ".gonext", "sessions", `${hash}.json`);
41
+ return join(home, ".gu", "sessions", `${hash}.json`);
42
42
  }
43
43
 
44
44
  /**
package/skills-copy.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * /skills-copy-to-claude — copy gu's skills into Claude Code's folders, under Claude's names (#241).
3
3
  *
4
- * ~/.gonext/skills/<name>/ → ~/.claude/skills/<claude-name>/
5
- * <project>/.gonext/skills/<name>/ → <project>/.claude/skills/<claude-name>/
6
- * the skill's MCP server in ~/.gonext/mcp.json → ~/.claude.json
4
+ * ~/.gu/skills/<name>/ → ~/.claude/skills/<claude-name>/
5
+ * <project>/.gu/skills/<name>/ → <project>/.claude/skills/<claude-name>/
6
+ * the skill's MCP server in ~/.gu/mcp.json → ~/.claude.json
7
7
  * (user scope for a home skill, projects["<folder>"] for a project skill)
8
8
  *
9
9
  * The web-v2 Skills page's installer (#208, src/skills/email/install.mjs) puts a skill's files into
10
- * ~/.gonext/skills/<name>/ and its MCP server into ~/.gonext/mcp.json. This is the same move in the
10
+ * ~/.gu/skills/<name>/ and its MCP server into ~/.gu/mcp.json. This is the same move in the
11
11
  * other direction, so a skill set up for gu also works in Claude Code.
12
12
  *
13
13
  * NAMES. gu's own skills start with "gu-" where Claude's start with "claude-" (the memory skill is
@@ -15,12 +15,12 @@
15
15
  * becomes "claude-" in the folder name, the frontmatter `name:` and the text. Other names stay.
16
16
  *
17
17
  * TEXT. Only SKILL.md is rewritten, and only what is certain: paths into the skill's own folder
18
- * (they now point at the copy) and the old name. Other mentions of .gonext (gu's memory CLI, say)
18
+ * (they now point at the copy) and the old name. Other mentions of .gu (gu's memory CLI, say)
19
19
  * may have no Claude equivalent, so they are left as they are and REPORTED, never guessed.
20
20
  *
21
- * A COPY. Nothing under ~/.gonext changes. Claude's file ~/.claude.json is changed only through
21
+ * A COPY. Nothing under ~/.gu changes. Claude's file ~/.claude.json is changed only through
22
22
  * updateClaudeConfig, and only its mcpServers. A Claude skill that differs is kept unless the user
23
- * chose "replace"; a replaced folder goes to ~/.gonext/skills-copy-backups/<time>/, never next to
23
+ * chose "replace"; a replaced folder goes to ~/.gu/skills-copy-backups/<time>/, never next to
24
24
  * the others in .claude/skills, where Claude would load it as a second skill.
25
25
  */
26
26
  import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -41,12 +41,12 @@ const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
41
41
 
42
42
  /**
43
43
  * SKILL.md for Claude: its own-folder paths and its old name rewritten. → { text, guLines }
44
- * guLines = line numbers (1-based) that still mention .gonext after the rewrite — for the user to check.
44
+ * guLines = line numbers (1-based) that still mention .gu after the rewrite — for the user to check.
45
45
  */
46
46
  export function rewriteSkillText(text, { from, to }) {
47
47
  let out = String(text);
48
- // ".gonext/skills/<from>" in any form (~/, $HOME/, an absolute home, ./, Windows backslashes).
49
- const pathRe = new RegExp(`\\.gonext([\\\\/])skills\\1${escapeRe(from)}(?![a-z0-9-])`, "g");
48
+ // ".gu/skills/<from>" in any form (~/, $HOME/, an absolute home, ./, Windows backslashes).
49
+ const pathRe = new RegExp(`\\.gu([\\\\/])skills\\1${escapeRe(from)}(?![a-z0-9-])`, "g");
50
50
  out = out.replace(pathRe, (_m, s) => `.claude${s}skills${s}${to}`);
51
51
  if (to !== from) {
52
52
  // The name itself: in the frontmatter, as /<name>, in use_skill("<name>")…
@@ -55,7 +55,7 @@ export function rewriteSkillText(text, { from, to }) {
55
55
  }
56
56
  const guLines = out
57
57
  .split("\n")
58
- .map((l, i) => (/\.gonext\b/.test(l) ? i + 1 : 0))
58
+ .map((l, i) => (/\.gu\b/.test(l) ? i + 1 : 0))
59
59
  .filter(Boolean);
60
60
  return { text: out, guLines };
61
61
  }
@@ -140,14 +140,14 @@ const sameJson = (a, b) => JSON.stringify(a) === JSON.stringify(b);
140
140
  * warnings, missing: names asked for that gu does not have }
141
141
  */
142
142
  export function planSkillsCopy({ cwd = process.cwd(), home = homedir(), names = [], platform = process.platform } = {}) {
143
- const dirs = [{ scope: "user", from: join(home, ".gonext", "skills"), to: join(home, ".claude", "skills") }];
143
+ const dirs = [{ scope: "user", from: join(home, ".gu", "skills"), to: join(home, ".claude", "skills") }];
144
144
  if (cwd && resolve(cwd) !== resolve(home)) {
145
- dirs.push({ scope: "project", from: join(cwd, ".gonext", "skills"), to: join(cwd, ".claude", "skills") });
145
+ dirs.push({ scope: "project", from: join(cwd, ".gu", "skills"), to: join(cwd, ".claude", "skills") });
146
146
  }
147
147
  const gu = readUserConfig(home);
148
148
  const claude = readClaudeServers({ cwd, home });
149
149
  const warnings = [];
150
- if (gu.error) warnings.push(`~/.gonext/mcp.json is ${gu.error} — no MCP servers are copied with the skills`);
150
+ if (gu.error) warnings.push(`~/.gu/mcp.json is ${gu.error} — no MCP servers are copied with the skills`);
151
151
  if (claude.error) warnings.push(`~/.claude.json is ${claude.error} — no MCP servers can be copied into it`);
152
152
 
153
153
  const wanted = new Set(names.map((n) => String(n).replace(/^\//, "")));
@@ -216,7 +216,7 @@ function moveDir(from, to) {
216
216
  */
217
217
  export function applySkillsCopy(plan, { replace = false, cwd = process.cwd(), home = homedir(), now = new Date() } = {}) {
218
218
  const stamp = now.toISOString().replace(/[:.]/g, "-");
219
- const backupRoot = join(home, ".gonext", BACKUP_DIR_NAME, stamp);
219
+ const backupRoot = join(home, ".gu", BACKUP_DIR_NAME, stamp);
220
220
  const done = [];
221
221
  const servers = [];
222
222
  const errors = [];
package/skills.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * SKILLS — folders with a SKILL.md, the way Claude Code does them (task #269).
3
3
  *
4
- * ~/.gonext/skills/<name>/SKILL.md yours, every folder
5
- * <project>/.gonext/skills/<name>/SKILL.md this project only
4
+ * ~/.gu/skills/<name>/SKILL.md yours, every folder
5
+ * <project>/.gu/skills/<name>/SKILL.md this project only
6
6
  *
7
7
  * …or Claude Code's own, when the folder chose them with /switch-skill (#325, skill-source.mjs):
8
8
  * ~/.claude/skills/<name>/SKILL.md and <project>/.claude/skills/<name>/SKILL.md
@@ -37,9 +37,9 @@ export const SKILL_NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
37
37
 
38
38
  /**
39
39
  * CORE SKILLS (GH #344): skills that ship INSIDE the package, <package>/skills/core/<name>/SKILL.md.
40
- * They are read from there on every scan and never copied into ~/.gonext/skills, so `npm i -g`
40
+ * They are read from there on every scan and never copied into ~/.gu/skills, so `npm i -g`
41
41
  * is enough (no postinstall to fail under --ignore-scripts), an upgrade upgrades them, and
42
- * `rm -rf ~/.gonext/skills` cannot remove them. They belong to gu, not to a skills folder, so they
42
+ * `rm -rf ~/.gu/skills` cannot remove them. They belong to gu, not to a skills folder, so they
43
43
  * load whichever source /switch-skill chose.
44
44
  *
45
45
  * ORDER: project < core < yours. A personal skill with a core skill's name replaces it, visibly
@@ -10,7 +10,7 @@
10
10
  * list, never by a sweep: conversations (sessions/), keys (worker.env) and RAG data are not
11
11
  * logs and never go. Also the Windows installer's log and the newest npm debug logs that
12
12
  * mention gu, because an install that failed has no gu logs at all.
13
- * 2. zipFiles — one .zip in ~/.gonext/support/, owner-only. Pure JS: no `zip`/`tar` on PATH needed.
13
+ * 2. zipFiles — one .zip in ~/.gu/support/, owner-only. Pure JS: no `zip`/`tar` on PATH needed.
14
14
  * 3. sendSupportRequest — POST /api/support/requests (the same queue the web Support page fills)
15
15
  * → a GU-XXXXXX reference and a one-time upload key, then the zip to …/:ref/logs.
16
16
  * 4. When sending fails, the zip stays and supportFallbackLines says where to email it.
@@ -31,7 +31,7 @@ export const SUPPORT_EMAIL = "tien@getmarsic.cc";
31
31
  /** The hosted API — the one device login and the free token use (device-login.mjs DEFAULT_API_BASE). */
32
32
  export const SUPPORT_API_BASE = "https://chat-api-v2.gucli.com";
33
33
  export const SUPPORT_DIR = "support";
34
- /** Old bundles kept in ~/.gonext/support — they are ours to remove, and each holds logs. */
34
+ /** Old bundles kept in ~/.gu/support — they are ours to remove, and each holds logs. */
35
35
  export const KEEP_BUNDLES = 5;
36
36
 
37
37
  export const LIMITS = {
@@ -106,7 +106,7 @@ export function npmLogDirs({ home = homedir(), env = process.env } = {}) {
106
106
  * of a gu install, the newest run logs, then rotations. → [{ name, path }] (name = path in the zip).
107
107
  */
108
108
  export async function listSupportSources({ home = homedir(), env = process.env, tmp = tmpdir(), limits = LIMITS } = {}) {
109
- const root = join(home, ".gonext");
109
+ const root = join(home, ".gu");
110
110
  const out = [];
111
111
  let names = [];
112
112
  try {
@@ -245,7 +245,7 @@ const stamp = (d) => d.toISOString().replace(/[-:]/g, "").replace("T", "-").slic
245
245
 
246
246
  /**
247
247
  * Build the bundle: the health report + the masked logs, zipped, saved owner-only in
248
- * ~/.gonext/support/. Shrinks the per-file cut until the zip fits what the API takes.
248
+ * ~/.gu/support/. Shrinks the per-file cut until the zip fits what the API takes.
249
249
  * → { file, bytes, zip, files: [{ name, size, cut }], skipped, reportLines }
250
250
  */
251
251
  export async function prepareSupportBundle(opts = {}) {
@@ -275,7 +275,7 @@ export async function prepareSupportBundle(opts = {}) {
275
275
  if (zip.length <= limits.zip || perFile < 16 * 1024) break;
276
276
  perFile = Math.floor(perFile / 2);
277
277
  }
278
- const dir = join(home, ".gonext", SUPPORT_DIR);
278
+ const dir = join(home, ".gu", SUPPORT_DIR);
279
279
  await mkdir(dir, { recursive: true });
280
280
  const file = join(dir, `gu-support-${stamp(now)}.zip`);
281
281
  await writeFile(file, built.zip, { mode: 0o600 });
@@ -367,7 +367,7 @@ export function supportFallbackLines({ ref = "", file = "", why = "" } = {}) {
367
367
  export async function defaultReplyEmail({ home = homedir(), env = process.env, token = null } = {}) {
368
368
  try {
369
369
  const ct = token ?? (await import("./cli-token.mjs"));
370
- const st = await ct.readState(join(home, ".gonext"));
370
+ const st = await ct.readState(join(home, ".gu"));
371
371
  if (!st?.token) return "";
372
372
  const check = ct.verifyCliToken(st.token, ct.publicKey(env));
373
373
  return check.ok && ct.isEmail(check.payload?.email) ? String(check.payload.email).trim() : "";
@@ -52,7 +52,7 @@ export async function buildSupportReport({
52
52
  api = null, // the client-expert-api module, injectable
53
53
  run = null, // the client-expert-run module, injectable
54
54
  } = {}) {
55
- const dir = join(home, ".gonext");
55
+ const dir = join(home, ".gu");
56
56
  const out = [];
57
57
  const section = (t) => out.push("", `== ${t} ==`);
58
58
  const line = (l) => out.push(l);
@@ -130,7 +130,7 @@ export async function buildSupportReport({
130
130
  }
131
131
  });
132
132
 
133
- section("Files in ~/.gonext");
133
+ section("Files in ~/.gu");
134
134
  await safe("files", async () => {
135
135
  const names = (await readdir(dir).catch(() => [])).sort();
136
136
  if (!names.length) line("(folder is empty or absent — a totally fresh install)");
@@ -150,12 +150,12 @@ export async function buildSupportReport({
150
150
  return out.map(redactReport);
151
151
  }
152
152
 
153
- /** Build, write ~/.gonext/support-report.txt (owner-only) and return { lines, file }. */
153
+ /** Build, write ~/.gu/support-report.txt (owner-only) and return { lines, file }. */
154
154
  export async function writeSupportReport(opts = {}) {
155
155
  const home = opts.home ?? homedir();
156
156
  const lines = await buildSupportReport(opts);
157
- const file = join(home, ".gonext", SUPPORT_REPORT_FILE);
158
- await mkdir(join(home, ".gonext"), { recursive: true });
157
+ const file = join(home, ".gu", SUPPORT_REPORT_FILE);
158
+ await mkdir(join(home, ".gu"), { recursive: true });
159
159
  await writeFile(file, lines.join("\n") + "\n", { encoding: "utf8", mode: 0o600 });
160
160
  return { lines, file };
161
161
  }
@@ -1821,7 +1821,7 @@ export function workspaceScopeWarning(cwd, home) {
1821
1821
  * answerable without a terminal.
1822
1822
  */
1823
1823
  export const RAG_STORAGE = [
1824
- { id: "local", label: "local", note: "on this machine only (~/.gonext) — no AWS keys needed" },
1824
+ { id: "local", label: "local", note: "on this machine only (~/.gu) — no AWS keys needed" },
1825
1825
  { id: "cloud", label: "cloud", note: "on your S3 bucket only — same index as the web app; needs RAG AWS keys" },
1826
1826
  { id: "both", label: "local + cloud", note: "local is read; each shard also mirrored to S3 — needs RAG AWS keys" },
1827
1827
  ];
package/turn-notes.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // NOTES FOR THE RUNNING TURN (GH #506, shown like chat messages since #514).
2
2
  //
3
3
  // Enter during a turn used to QUEUE the question for after the turn (#429). Now it is written to
4
- // ~/.gonext/turn-notes/<jobId>.jsonl, and the agent (gu_turn_notes.py) adds it after its current
4
+ // ~/.gu/turn-notes/<jobId>.jsonl, and the agent (gu_turn_notes.py) adds it after its current
5
5
  // step's result, so the model reads it at its NEXT step — appended at the end of the conversation,
6
6
  // which keeps the prompt cache. A note the agent did not take by the end of the turn (the turn was
7
7
  // a plain reply, or ended on that very step) is taken back here and runs as the next question.
@@ -11,7 +11,7 @@ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renam
11
11
  import { homedir } from "node:os";
12
12
  import { join } from "node:path";
13
13
 
14
- export const notesDir = (home = homedir()) => join(home, ".gonext", "turn-notes");
14
+ export const notesDir = (home = homedir()) => join(home, ".gu", "turn-notes");
15
15
  const safe = (jobId) => String(jobId ?? "").replace(/[^A-Za-z0-9_-]/g, "").slice(0, 80);
16
16
  export const notesPath = (jobId, home) => join(notesDir(home), `${safe(jobId)}.jsonl`);
17
17
 
package/version-check.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * TWO THINGS GO STALE INDEPENDENTLY (task #181) and neither was ever checked:
5
5
  * · the CLI — @tiens.nguyen/gu-cli on npm
6
- * · the API — the Client Expert package on S3, per ~/.gonext/api/<version>/
6
+ * · the API — the Client Expert package on S3, per ~/.gu/api/<version>/
7
7
  *
8
8
  * They share nothing but the question. The CLI's answer means "restart gu"; the API's means
9
9
  * "restart the local API, dropping whatever it was serving". So only the COMPARISON lives here,
@@ -2,7 +2,7 @@
2
2
  * UNDO AN AGENT RUN'S FILE CHANGES — shared by `gu-cli workspace revert` and the terminal's /undo
3
3
  * (task #302).
4
4
  *
5
- * Every agent run keeps ~/.gonext/workspace-backups/<runId>/: a copy of each file taken before its
5
+ * Every agent run keeps ~/.gu/workspace-backups/<runId>/: a copy of each file taken before its
6
6
  * FIRST edit in that run, and manifest.json listing every change (gonext_agent_chat.py
7
7
  * _ws_snapshot / _ws_record_change). Undo puts the ORIGINAL state back.
8
8
  *
@@ -18,7 +18,7 @@ import { copyFile, readFile, rmdir, unlink } from "node:fs/promises";
18
18
  import { homedir } from "node:os";
19
19
  import { join } from "node:path";
20
20
 
21
- export const BACKUPS_ROOT = join(homedir(), ".gonext", "workspace-backups");
21
+ export const BACKUPS_ROOT = join(homedir(), ".gu", "workspace-backups");
22
22
 
23
23
  /** The manifest's changes → one step per path, from its earliest entry. Pure. */
24
24
  export function planRevert(changes) {