@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/gu-repl.mjs CHANGED
@@ -7,7 +7,7 @@
7
7
  * $ gu
8
8
  *
9
9
  * It offers to register the CURRENT folder as an agent workspace (with a trust prompt
10
- * that maps to --allow-run), authenticates with the worker key from ~/.gonext/worker.env
10
+ * that maps to --allow-run), authenticates with the worker key from ~/.gu/worker.env
11
11
  * (the same file `gu-cli set` / the Wizard write), and loops on a `>> `
12
12
  * prompt. Each question is ENQUEUED as a normal agent_chat job (models/budgets/RAG
13
13
  * resolved from your user settings by POST /api/worker/agent-ask) and executed by the
@@ -15,7 +15,7 @@
15
15
  * logs, exactly like a web question. The REPL polls the job and streams the persisted
16
16
  * chunks live into the terminal.
17
17
  *
18
- * Conversation history is saved to ~/.gonext/sessions/<hash-of-folder-path>.json after
18
+ * Conversation history is saved to ~/.gu/sessions/<hash-of-folder-path>.json after
19
19
  * every turn and reloaded on the next `gu` in the SAME folder — so closing the
20
20
  * terminal and coming back later still has context (e.g. "continue" after an
21
21
  * interrupted investigation actually resumes it). /new clears it.
@@ -24,8 +24,9 @@
24
24
  * Commands: /exit /model /new /help Ctrl-C stops following the current run.
25
25
  */
26
26
  import { RELAUNCHED } from "./gu-relaunch.mjs"; // FIRST: may replace this process (#358)
27
+ import { moveProjectToGu } from "./gu-home-move.mjs"; // GH #582: moves the old home folder to ~/.gu once, before anything uses it
27
28
  import { installInternalLabel } from "./cli-token.mjs";
28
- installInternalLabel(); // our own machines only (GU_INTERNAL_LABEL / ~/.gonext/internal-label): label gucli.com requests
29
+ installInternalLabel(); // our own machines only (GU_INTERNAL_LABEL / ~/.gu/internal-label): label gucli.com requests
29
30
  import { readFile, mkdir, writeFile, unlink, rename } from "node:fs/promises";
30
31
  import { readStepTokens, readTurnCache } from "./step-tokens.mjs";
31
32
  import { snapshotInput, restoreInput, replaceStoppedQuestion, restoredQuestionLetGo, stopNoteLines } from "./turn-stop.mjs";
@@ -233,6 +234,8 @@ import {
233
234
  zoneResizePlan,
234
235
  blockClosedPad,
235
236
  } from "./terminal-viewport.mjs";
237
+ // GH #582: a project that still has gu's old folder gets it renamed to ./.gu, once.
238
+ if (process.env.GU_NO_HOME_MOVE !== "1") for (const l of moveProjectToGu()) process.stderr.write(` ${l}\n`);
236
239
 
237
240
  const DIR = dirname(fileURLToPath(import.meta.url));
238
241
 
@@ -258,9 +261,9 @@ setInterval(() => {
258
261
  /* try again next time */
259
262
  }
260
263
  }, 20_000).unref();
261
- const ENV_FILE = join(homedir(), ".gonext", "worker.env");
262
- const WS_FILE = join(homedir(), ".gonext", "workspaces.json");
263
- const SESSIONS_DIR = join(homedir(), ".gonext", "sessions");
264
+ const ENV_FILE = join(homedir(), ".gu", "worker.env");
265
+ const WS_FILE = join(homedir(), ".gu", "workspaces.json");
266
+ const SESSIONS_DIR = join(homedir(), ".gu", "sessions");
264
267
 
265
268
  // Through paint() so NO_COLOR / GU_ACCENT=off / TERM=dumb turn ALL of them off, not only the
266
269
  // accent (task #29 bug B1 — red '-' rows stayed red under NO_COLOR).
@@ -697,7 +700,7 @@ if (cliVerdict.kind === "run") {
697
700
  " gu doctor|login|set # models / account (same as `gu-cli …`)\n" +
698
701
  " gu rag # is RAG working? tests the embedder end-to-end\n\n" +
699
702
  " -v, --verbose show RAG index-file activity in the bottom bar (each shard written)\n" +
700
- " --log log this run in detail (~/.gonext/worker.log). Without it only starts,\n" +
703
+ " --log log this run in detail (~/.gu/worker.log). Without it only starts,\n" +
701
704
  " stops and errors are logged. Ends when this gu closes.\n" +
702
705
  " --color colour the live thought, the thinking spinner and its playful word.\n" +
703
706
  " Without it they are plain white.\n" +
@@ -707,13 +710,13 @@ if (cliVerdict.kind === "run") {
707
710
  " client / MLX host / private). Without it, a first install is\n" +
708
711
  " private by default — the whole stack on this machine.\n" +
709
712
  " -h, --help this help\n\n" +
710
- "Auth comes from ~/.gonext/worker.env; models/budgets/RAG come from your web Settings.\n" +
713
+ "Auth comes from ~/.gu/worker.env; models/budgets/RAG come from your web Settings.\n" +
711
714
  "Inside the REPL: /exit · /model · /new · /help — Ctrl-C stops following a turn.\n" +
712
715
  "Questions are enqueued like web questions and executed by the RUNNING\n" +
713
716
  "gu-cli daemon — its terminal shows the full [gu-agent] logs.\n" +
714
- "Conversation history is saved per-folder in ~/.gonext/sessions and resumed next time\n" +
717
+ "Conversation history is saved per-folder in ~/.gu/sessions and resumed next time\n" +
715
718
  "you run `gu` in the same folder; /new starts a new conversation and keeps the old one\n" +
716
- "in ~/.gonext/sessions/archive."
719
+ "in ~/.gu/sessions/archive."
717
720
  );
718
721
  process.exit(0);
719
722
  }
@@ -723,7 +726,7 @@ if (cliVerdict.kind === "run") {
723
726
  // the job stream. It now drives a real, streamable signal.
724
727
  const REPL_VERBOSE = argv.includes("-v") || argv.includes("--verbose");
725
728
  // --log (task #352): THIS RUN logs in detail. By default the worker writes only starts, stops and
726
- // errors; a run started with --log takes a lease (its pid, in ~/.gonext/log-detail.json) that the
729
+ // errors; a run started with --log takes a lease (its pid, in ~/.gu/log-detail.json) that the
727
730
  // worker reads, and gives it back on exit. Per run by the owner's rule — nothing is saved, and a
728
731
  // run that is killed leaves a lease for a dead process, which is no lease.
729
732
  const REPL_LOG = argv.includes("--log");
@@ -749,7 +752,7 @@ if (REPL_LOG) {
749
752
  const ll = await import("./log-level.mjs");
750
753
  await ll.takeLease().catch(() => {});
751
754
  process.on("exit", () => ll.releaseLeaseSync());
752
- console.log(dim(" --log: detailed logging is on for this run (~/.gonext/worker.log); back to minimal when gu closes."));
755
+ console.log(dim(" --log: detailed logging is on for this run (~/.gu/worker.log); back to minimal when gu closes."));
753
756
  }
754
757
 
755
758
  // WHAT THE INSTALL DID, FIRST (GH #557 follow-up): npm hides postinstall output, so gu says what
@@ -793,14 +796,14 @@ if (REPL_VERBOSE) {
793
796
  process.env.GONEXT_REPL_VERBOSE = "1";
794
797
  }
795
798
 
796
- // ---------- auth: worker key + API base from ~/.gonext/worker.env ----------
799
+ // ---------- auth: worker key + API base from ~/.gu/worker.env ----------
797
800
  dotenv.config({ path: ENV_FILE });
798
801
  dotenv.config();
799
802
  let workerKey = String(process.env.GONEXT_WORKER_KEY ?? "").trim();
800
803
  let apiBase = String(process.env.GONEXT_API_BASE ?? "").trim().replace(/\/+$/, "");
801
804
 
802
805
  /**
803
- * Re-read ~/.gonext/worker.env into this process.
806
+ * Re-read ~/.gu/worker.env into this process.
804
807
  *
805
808
  * Client Expert setup WRITES that file mid-run, so without this the very first session after
806
809
  * setup still holds the values it started with — the banner and every request would describe
@@ -1147,11 +1150,11 @@ const COMMANDS = [
1147
1150
  { name: "/new", desc: "start a new conversation in this folder — the old one is kept (archived); the folder's settings stay" },
1148
1151
  { name: "/hooks", usage: "/hooks [list|approve|unapprove]", desc: "hooks: commands gu runs on onStart, onAsk, onToolDone, onTurnEnd — list them, approve this project's" },
1149
1152
  { name: "/mcp", usage: "/mcp [list|tools|add|remove|enable|disable|approve|allow|disallow|reconnect]", desc: "MCP servers: see which connect, add one (asks step by step), choose which tools run without asking" },
1150
- { name: "/switch-skill", usage: "/switch-skill [claude|gu]", desc: "whose skills, MCP servers and hooks this folder uses — Claude Code's (.claude) or gu's own (.gonext)" },
1153
+ { name: "/switch-skill", usage: "/switch-skill [claude|gu]", desc: "whose skills, MCP servers and hooks this folder uses — Claude Code's (.claude) or gu's own (.gu)" },
1151
1154
  { name: "/resume", desc: "carry on the last unfinished task in this folder — Claude Code's or gu's — from where it stopped (memory skill)" },
1152
1155
  { name: "/skill-pack", usage: "/skill-pack <name> [--out <file>] [--runtime <dir>]", desc: "pack a skill (gu's or Claude's) with its MCP servers, hooks and code into one zip for another machine" },
1153
1156
  { name: "/skill-install", usage: "/skill-install <zip|folder> [--gu] [--claude] [--dry-run]", desc: "install a packed skill for gu and Claude Code (whichever is set up here)" },
1154
- { name: "/skills-copy-to-claude", usage: "/skills-copy-to-claude [--dry-run] [name…]", desc: "copy gu's skills (.gonext) into Claude Code's folders (.claude), renamed to Claude's names, with their MCP servers" },
1157
+ { name: "/skills-copy-to-claude", usage: "/skills-copy-to-claude [--dry-run] [name…]", desc: "copy gu's skills (.gu) into Claude Code's folders (.claude), renamed to Claude's names, with their MCP servers" },
1155
1158
  { name: "/help", desc: "list these commands" },
1156
1159
  { name: "/exit", aliases: ["/quit"], desc: "quit" },
1157
1160
  ];
@@ -1159,8 +1162,8 @@ const COMMANDS = [
1159
1162
  // terminal-layout.mjs — their handlers are below, above the unknown-command guard. Not
1160
1163
  // imported here: nothing in the REPL reads the list, the tests do (task #153).
1161
1164
  const COMMAND_NAMES = COMMANDS.flatMap((c) => [c.name, ...(c.aliases ?? [])]);
1162
- // SKILLS ARE COMMANDS TOO (task #269): each ~/.gonext/skills/<name>/SKILL.md (and this folder's
1163
- // .gonext/skills) is /<name>, in Tab-completion and /help like any other. Scanned from disk — kept
1165
+ // SKILLS ARE COMMANDS TOO (task #269): each ~/.gu/skills/<name>/SKILL.md (and this folder's
1166
+ // .gu/skills) is /<name>, in Tab-completion and /help like any other. Scanned from disk — kept
1164
1167
  // for 2s only, because the overlay asks on every keystroke — so a skill added, edited or DELETED
1165
1168
  // while gu runs shows up (or quietly disappears) without a restart. A built-in name always wins.
1166
1169
  let _skillScan = { at: 0, skills: [] };
@@ -1915,7 +1918,7 @@ if (TITLE_ON) {
1915
1918
  }
1916
1919
 
1917
1920
  // ---------- language servers (GH #539/#540) --------------------------------------------------
1918
- // The choices live in ~/.gonext/lsp-state.json (the offer and /lsp write it); the worker's host
1921
+ // The choices live in ~/.gu/lsp-state.json (the offer and /lsp write it); the worker's host
1919
1922
  // (lsp-host.mjs) reads it, runs the servers, and says what is running on /status.
1920
1923
  const loadLspState = () => {
1921
1924
  try {
@@ -2071,7 +2074,7 @@ async function autocompactCommand(arg) {
2071
2074
  // ---------- the next message, suggested (GH #536) -------------------------------------------
2072
2075
  // After SOME turns the empty input shows a dim suggestion; Tab puts it in the input. See
2073
2076
  // next-suggestion.mjs for when (two gates: cheap rules, then the coder answering NONE or a reply).
2074
- const SUGGESTIONS_FILE = join(homedir(), ".gonext", "prompt-suggestions");
2077
+ const SUGGESTIONS_FILE = join(homedir(), ".gu", "prompt-suggestions");
2075
2078
  let suggestionsOn = (() => {
2076
2079
  try {
2077
2080
  return suggestionsOnFromFile(readFileSync(SUGGESTIONS_FILE, "utf8"));
@@ -2335,7 +2338,7 @@ function showImageNotice(text) {
2335
2338
  }
2336
2339
  /**
2337
2340
  * Images go to the coding model when it takes them: Claude, Kimi K3 (image-capable-coders.json), and
2338
- * since GH #528 every model the cloud list marks `images: true` — read from ~/.gonext/image-models.json
2341
+ * since GH #528 every model the cloud list marks `images: true` — read from ~/.gu/image-models.json
2339
2342
  * at start, refreshed with the cloud token table (refreshLimitsUpdate).
2340
2343
  */
2341
2344
  loadCloudImageCoders();
@@ -2961,7 +2964,7 @@ async function refreshAvailableUpdates() {
2961
2964
  const { readdir } = await import("node:fs/promises");
2962
2965
  const { existsSync } = await import("node:fs");
2963
2966
  const { pickUsableVersion } = await import("./version-check.mjs");
2964
- const base = join(homedir(), ".gonext", "api");
2967
+ const base = join(homedir(), ".gu", "api");
2965
2968
  const dirs = await readdir(base).catch(() => []);
2966
2969
  apiRunning = pickUsableVersion(dirs, (v) =>
2967
2970
  existsSync(join(base, v, "node_modules", "mongodb", "package.json"))
@@ -3028,7 +3031,7 @@ async function refreshCliToken() {
3028
3031
  tokenNotice = null; // no key (none embedded, GU_CLI_TOKEN_PUBLIC_KEY empty): nothing to check against
3029
3032
  return;
3030
3033
  }
3031
- const dir = join(homedir(), ".gonext");
3034
+ const dir = join(homedir(), ".gu");
3032
3035
  const mode = isClientExpert() ? "expert" : "client";
3033
3036
  const site = ct.siteUrl();
3034
3037
  let state = await ct.readState(dir);
@@ -3094,7 +3097,7 @@ const TOKEN_TICK_MS = 60 * 60 * 1000;
3094
3097
 
3095
3098
  // The last in-app CLI update attempt (task #21): lets the next start say WHY an update did not
3096
3099
  // take effect instead of offering the very same update again, forever.
3097
- const UPDATE_ATTEMPT_FILE = join(homedir(), ".gonext", "last-cli-update.json");
3100
+ const UPDATE_ATTEMPT_FILE = join(homedir(), ".gu", "last-cli-update.json");
3098
3101
  function readUpdateAttempt() {
3099
3102
  try { return JSON.parse(readFileSync(UPDATE_ATTEMPT_FILE, "utf8")); } catch { return null; }
3100
3103
  }
@@ -8499,8 +8502,8 @@ function sayWrapped(text, paint = (s) => s, hang = " ") {
8499
8502
  }
8500
8503
  /**
8501
8504
  * /switch-skill — whose skills, MCP servers and hooks THIS FOLDER uses (task #325): Claude Code's,
8502
- * read where Claude keeps them (~/.claude, ./.claude, ~/.claude.json), or gu's own (~/.gonext,
8503
- * ./.gonext). One choice for all three — a skill names its MCP server's tools and the hooks feed
8505
+ * read where Claude keeps them (~/.claude, ./.claude, ~/.claude.json), or gu's own (~/.gu,
8506
+ * ./.gu). One choice for all three — a skill names its MCP server's tools and the hooks feed
8504
8507
  * the same database, so they only make sense together. Stored in the folder's session file, which
8505
8508
  * the worker reads for every turn (skill-source.mjs): it holds from the next question, no restart.
8506
8509
  */
@@ -8508,7 +8511,7 @@ async function runSwitchSkillCommand(line) {
8508
8511
  const cwd = resolve(process.cwd());
8509
8512
  const current = readSkillSource(cwd);
8510
8513
  const arg = (line.trim().split(/\s+/)[1] ?? "").toLowerCase();
8511
- const where = (src) => (src === "claude" ? "~/.claude, ./.claude, ~/.claude.json" : "~/.gonext, ./.gonext");
8514
+ const where = (src) => (src === "claude" ? "~/.claude, ./.claude, ~/.claude.json" : "~/.gu, ./.gu");
8512
8515
  let pick = "";
8513
8516
  console.log("");
8514
8517
  if (arg) {
@@ -8714,7 +8717,7 @@ async function runSkillInstallCommand(line) {
8714
8717
 
8715
8718
  /**
8716
8719
  * /skills-copy-to-claude [--dry-run] [name…] — gu's skills into Claude Code's folders (#241):
8717
- * ~/.gonext/skills → ~/.claude/skills and ./.gonext/skills → ./.claude/skills, "gu-" names become
8720
+ * ~/.gu/skills → ~/.claude/skills and ./.gu/skills → ./.claude/skills, "gu-" names become
8718
8721
  * "claude-", and a skill's MCP server goes into ~/.claude.json (skills-copy.mjs). Shows the plan,
8719
8722
  * then asks; a Claude skill that differs is kept unless the user picks "replace" (backed up).
8720
8723
  */
@@ -8738,7 +8741,7 @@ async function runSkillsCopyCommand(line) {
8738
8741
  for (const w of plan.warnings) say(yellow(w));
8739
8742
  if (plan.missing.length) say(yellow(`gu has no skill named ${plan.missing.join(", ")}`));
8740
8743
  if (!plan.items.length) {
8741
- say(dim("gu has no skills to copy — ~/.gonext/skills and ./.gonext/skills have none.\n"));
8744
+ say(dim("gu has no skills to copy — ~/.gu/skills and ./.gu/skills have none.\n"));
8742
8745
  return;
8743
8746
  }
8744
8747
  const word = { new: accent("new"), same: dim("already there"), differs: yellow("Claude's differs") };
@@ -8751,7 +8754,7 @@ async function runSkillsCopyCommand(line) {
8751
8754
  say(dim(` MCP server ${s.name} → ~/.claude.json${s.scope === "local" ? " (this folder)" : ""} `) + word[s.status]);
8752
8755
  }
8753
8756
  if (it.guLines.length) {
8754
- say(yellow(` SKILL.md line${it.guLines.length === 1 ? "" : "s"} ${it.guLines.join(", ")} still name${it.guLines.length === 1 ? "s" : ""} ~/.gonext — check the copy`));
8757
+ say(yellow(` SKILL.md line${it.guLines.length === 1 ? "" : "s"} ${it.guLines.join(", ")} still name${it.guLines.length === 1 ? "s" : ""} ~/.gu — check the copy`));
8755
8758
  }
8756
8759
  }
8757
8760
  const todo = plan.items.filter((i) => i.status !== "same" || i.servers.some((s) => s.status !== "same"));
@@ -9130,7 +9133,7 @@ async function applyTransferDoc(value, opts = {}) {
9130
9133
  ...opts,
9131
9134
  api: replPresetApi(),
9132
9135
  io: replPresetIo,
9133
- backupDir: join(homedir(), ".gonext", "preset-backups"),
9136
+ backupDir: join(homedir(), ".gu", "preset-backups"),
9134
9137
  host: hostname(),
9135
9138
  });
9136
9139
  if (result?.applied) await refreshAfterPresetApply(value, opts.codingDefault, result);
@@ -9216,7 +9219,7 @@ async function bannerAccount(settingsEmail = "") {
9216
9219
  try {
9217
9220
  const ct = await import("./cli-token.mjs");
9218
9221
  const pk = ct.publicKey();
9219
- const state = pk ? await ct.readState(join(homedir(), ".gonext")) : { token: "" };
9222
+ const state = pk ? await ct.readState(join(homedir(), ".gu")) : { token: "" };
9220
9223
  const check = state.token ? ct.verifyCliToken(state.token, pk) : { ok: false };
9221
9224
  return ct.accountLine({ payload: check.ok ? check.payload : null, settingsEmail });
9222
9225
  } catch {
@@ -9359,7 +9362,7 @@ async function noteTurnCost(inputTokens, breakdown, coder = null) {
9359
9362
  // ---------------------------------------------------------------------------------------------
9360
9363
  let freeModel = null; // the saved state (free-model.mjs), or null = no free model on this computer
9361
9364
  let freeModelNoticed = ""; // the level already shown this month, so a notice is said once
9362
- const freeModelDir = () => join(homedir(), ".gonext");
9365
+ const freeModelDir = () => join(homedir(), ".gu");
9363
9366
 
9364
9367
  async function freeModelHostedBase() {
9365
9368
  const { DEFAULT_API_BASE } = await import("./device-login.mjs");
@@ -9436,7 +9439,7 @@ async function freeModelAtStart() {
9436
9439
  // Ask even with no saved state (GH #440/#442): a code redeemed while the server had no free model, or on
9437
9440
  // another computer, gets its model here without a second /voucher. Quiet unless there is one to set up.
9438
9441
  const ct = await import("./cli-token.mjs");
9439
- const st = await ct.readState(join(homedir(), ".gonext"));
9442
+ const st = await ct.readState(join(homedir(), ".gu"));
9440
9443
  if (st?.token) await setUpFreeModel({ token: st.token });
9441
9444
  } catch {
9442
9445
  /* the free model is never worth a failed start */
@@ -9468,7 +9471,7 @@ async function noteFreeModelTurn(inputTokens, breakdown, outputTokens, coder, au
9468
9471
  console.log(GUTTER + (n.level === "ok" ? dim(n.text) : yellow(n.text)) + "\n");
9469
9472
  }
9470
9473
  const ct = await import("./cli-token.mjs");
9471
- const st = await ct.readState(join(homedir(), ".gonext"));
9474
+ const st = await ct.readState(join(homedir(), ".gu"));
9472
9475
  void fm.reportSpend({ hostedBase: await freeModelHostedBase(), token: st?.token, state: freeModel });
9473
9476
  } catch {
9474
9477
  /* counting is never worth a broken prompt */
@@ -9489,7 +9492,7 @@ async function runVoucherCommand(line = "/voucher") {
9489
9492
  }
9490
9493
  const ct = await import("./cli-token.mjs");
9491
9494
  const pk = ct.publicKey();
9492
- const dir = join(homedir(), ".gonext");
9495
+ const dir = join(homedir(), ".gu");
9493
9496
  const state = await ct.readState(dir);
9494
9497
  const { DEFAULT_API_BASE } = await import("./device-login.mjs");
9495
9498
  const device = await ct.thisDevice({ instanceId: myInstanceId || "" }).catch(() => null);
@@ -9711,12 +9714,12 @@ async function runPricesUpdate({ tables: given = null, quiet = false } = {}) {
9711
9714
  // "OUTPUT TOKEN LIMITS UPDATED <date>": the cloud token table (GET /api/model-limits, Mongo
9712
9715
  // "model_limits", pushed by the Deploy app's "Push token table to cloud" button) is checked at
9713
9716
  // start and hourly beside the version and price checks. When its updatedAt is newer than the one
9714
- // this machine last saw (~/.gonext/model-limits-seen.json), a clickable item joins the notice
9717
+ // this machine last saw (~/.gu/model-limits-seen.json), a clickable item joins the notice
9715
9718
  // row. Nothing needs applying: the worker reads the cloud table on every run. The click lists
9716
9719
  // what changed and marks it seen.
9717
9720
  // ---------------------------------------------------------------------------------------------
9718
9721
  let limitsUpdate = null; // { updatedAt, label, rows } while unseen changes wait
9719
- const limitsSeenFile = () => join(homedir(), ".gonext", "model-limits-seen.json");
9722
+ const limitsSeenFile = () => join(homedir(), ".gu", "model-limits-seen.json");
9720
9723
 
9721
9724
  async function readLimitsSeen() {
9722
9725
  try {
@@ -9774,7 +9777,7 @@ async function refreshLimitsUpdate() {
9774
9777
  async function markLimitsSeen(updatedAt) {
9775
9778
  try {
9776
9779
  const { mkdir, writeFile } = await import("node:fs/promises");
9777
- await mkdir(join(homedir(), ".gonext"), { recursive: true });
9780
+ await mkdir(join(homedir(), ".gu"), { recursive: true });
9778
9781
  await writeFile(limitsSeenFile(), JSON.stringify({ seenAt: updatedAt }) + "\n");
9779
9782
  } catch {
9780
9783
  /* not remembering only means the notice comes back */
@@ -9908,7 +9911,7 @@ async function runClearLogs() {
9908
9911
  const cl = await import("./clear-logs.mjs");
9909
9912
  const { LOCAL_API_PORT } = await import("./client-expert-api.mjs");
9910
9913
  const width = Math.max(20, process.stdout.columns || 80);
9911
- console.log("\n" + GUTTER + dim("Measuring ~/.gonext…"));
9914
+ console.log("\n" + GUTTER + dim("Measuring ~/.gu…"));
9912
9915
  // Which API version is ANSWERING decides what "old" means — ask it, do not infer it.
9913
9916
  const runningVersion = await fetch(`http://127.0.0.1:${LOCAL_API_PORT}/api/health`, { signal: AbortSignal.timeout(2000) })
9914
9917
  .then((r) => r.json())
@@ -11090,7 +11093,7 @@ const OTHER_AGENTS_MS = 20000;
11090
11093
 
11091
11094
  /**
11092
11095
  * BACKGROUND SHELLS (task #360, GitHub #140). The agent leaves a long command — a 7-minute build —
11093
- * running instead of killing it at its deadline, and records it in ~/.gonext/shells.json. Read
11096
+ * running instead of killing it at its deadline, and records it in ~/.gu/shells.json. Read
11094
11097
  * here once a second (a local file, no API), so the notice row can say it is still running and
11095
11098
  * a click can show it. Repaints only when the row's text changes.
11096
11099
  */
@@ -11237,7 +11240,7 @@ async function browserCleanup() {
11237
11240
  stopBridge();
11238
11241
  await new Promise((res) => setTimeout(res, 300));
11239
11242
  const gone = removeLocalFiles();
11240
- if (gone.length) out(accent(`✓ Deleted ${gone.length} of gu's file(s) in ~/.gonext.`));
11243
+ if (gone.length) out(accent(`✓ Deleted ${gone.length} of gu's file(s) in ~/.gu.`));
11241
11244
  const still = [...findDevInstalls().filter((f) => !(devConnected && f.id === st.id)).map((f) => `${f.browser} — ${f.profile}`), ...localLeftovers()];
11242
11245
  out(still.length ? yellow(`Still there: ${still.join(", ")}`) : accent("✓ The developer install is gone. Install the Chrome Web Store copy, then /browser."));
11243
11246
  out();
@@ -12294,11 +12297,11 @@ const COMPACT_PREFIX = "__COMPACT__::";
12294
12297
  // save the file on this computer. Allow = S3 is now set up AND passed its test.
12295
12298
  const S3SETUP_PREFIX = "__S3SETUP__::";
12296
12299
  // An MCP tool about to run for the first time (task #269): "<server>\t<tool>\t<args preview>".
12297
- // "Always" writes an allow rule to ~/.gonext/mcp.json — the agent re-reads that file before every
12300
+ // "Always" writes an allow rule to ~/.gu/mcp.json — the agent re-reads that file before every
12298
12301
  // call, so it counts from the next call of this same turn, and for every turn after.
12299
12302
  const MCPTOOL_PREFIX = "__MCPTOOL__::";
12300
12303
  // The agent's first use of the browser in a turn (#150): "<folder>\t<what it is about to do>".
12301
- // "Always" puts the folder on ~/.gonext/browser-allow.json, which the agent reads before asking.
12304
+ // "Always" puts the folder on ~/.gu/browser-allow.json, which the agent reads before asking.
12302
12305
  const BROWSER_PREFIX = "__BROWSER__::";
12303
12306
  // GH #540: the agent edited a file whose language has a server gu could use — offer it.
12304
12307
  const LSP_PREFIX = "__LSP__::";
@@ -12377,7 +12380,7 @@ async function approvalPrompt(command) {
12377
12380
  ? " It is already on this computer — nothing to download."
12378
12381
  : lang.tool
12379
12382
  ? ` gu runs \`${lang.tool.what}\` (${size || lang.size}). It is open source (${lang.licence}).`
12380
- : ` gu installs it from npm (${size || lang.size}, into ~/.gonext/lsp — no admin rights). It is open source (${lang.licence}).`;
12383
+ : ` gu installs it from npm (${size || lang.size}, into ~/.gu/lsp — no admin rights). It is open source (${lang.licence}).`;
12381
12384
  process.stdout.write(
12382
12385
  // GH #554: on the gutter like every other line of the turn — it sat two columns to the left.
12383
12386
  "\n" + GUTTER + accent(`${name} code intelligence`) + dim(` (no answer in ${LSP_OFFER_MS / 1000}s = not now)`) + "\n" +
@@ -13110,7 +13113,7 @@ async function tryStartLocalApi() {
13110
13113
  const ce = await import("./client-expert-api.mjs");
13111
13114
  if ((await ce.probeLocalApi()).ok) return true;
13112
13115
  const { readdir } = await import("node:fs/promises");
13113
- const base = join(homedir(), ".gonext", "api");
13116
+ const base = join(homedir(), ".gu", "api");
13114
13117
  const versions = (await readdir(base).catch(() => [])).sort((a, b) =>
13115
13118
  a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" })
13116
13119
  );
@@ -13368,7 +13371,7 @@ function announceScaffold() {
13368
13371
  async function ensureTokenForTurn() {
13369
13372
  if (!isClientExpert()) return true;
13370
13373
  const ct = await import("./cli-token.mjs");
13371
- const dir = join(homedir(), ".gonext");
13374
+ const dir = join(homedir(), ".gu");
13372
13375
  const state = await ct.readState(dir);
13373
13376
  if (!ct.turnNeedsToken({ privateMode: true, token: state.token })) return true;
13374
13377
  // The FALLBACK (#314): the token is normally settled at the first ">>" (askTokenAtStart); this
@@ -13495,7 +13498,7 @@ async function askTokenAtStart() {
13495
13498
  // The background refresh started at launch renews and WRITES the token: let it finish, or it
13496
13499
  // could overwrite a token pasted here with the old one — and its answer is the freshest anyway.
13497
13500
  await startupTokenRefresh?.catch(() => undefined);
13498
- const dir = join(homedir(), ".gonext");
13501
+ const dir = join(homedir(), ".gu");
13499
13502
  const state = await ct.readState(dir);
13500
13503
  if (ct.turnNeedsToken({ privateMode: true, token: state.token })) {
13501
13504
  await askForCliToken(ct, dir);
@@ -15974,7 +15977,7 @@ async function main() {
15974
15977
  dim(`${API_CALL_TIMEOUT_MS / 1000}s, so the API is running and stuck` + (onGudb ? "." : " —")) +
15975
15978
  dim(onGudb ? "\n Check, in this order:" : "\n usually on MongoDB. Check, in this order:") +
15976
15979
  dim("\n gu-cli api status does it answer at all?") +
15977
- dim("\n ~/.gonext/local-api.log what it was doing when it stopped answering") +
15980
+ dim("\n ~/.gu/local-api.log what it was doing when it stopped answering") +
15978
15981
  (onGudb ? "" : dim("\n is mongod running? the API waits on it and never times out itself")) +
15979
15982
  dim("\n Then restart it: gu-cli api stop && gu-cli api start\n")
15980
15983
  );
@@ -15997,7 +16000,7 @@ async function main() {
15997
16000
  started
15998
16001
  ? dim(" Started it — run `gu` again.\n")
15999
16002
  : dim(" Start it with: gu-cli api start") +
16000
- dim("\n If that fails, check MongoDB is running and see ~/.gonext/local-api.log\n")
16003
+ dim("\n If that fails, check MongoDB is running and see ~/.gu/local-api.log\n")
16001
16004
  );
16002
16005
  }
16003
16006
  } else if (err?.code === "KEY_REJECTED") {
@@ -16670,7 +16673,7 @@ async function main() {
16670
16673
  const bv = await import("./budget-view.mjs");
16671
16674
  const ct = await import("./cli-token.mjs");
16672
16675
  const { DEFAULT_API_BASE } = await import("./device-login.mjs");
16673
- const state = await ct.readState(join(homedir(), ".gonext"));
16676
+ const state = await ct.readState(join(homedir(), ".gu"));
16674
16677
  const result = await bv.fetchProvidersBudget({
16675
16678
  apiBase,
16676
16679
  workerKey,
package/gu_browser.py CHANGED
@@ -30,7 +30,7 @@ _EXT_MISS = {"at": 0}
30
30
 
31
31
 
32
32
  def data_dir():
33
- return os.path.join(os.path.expanduser("~"), ".gonext")
33
+ return os.path.join(os.path.expanduser("~"), ".gu")
34
34
 
35
35
 
36
36
  def state_path():
@@ -44,7 +44,7 @@ def seen_path():
44
44
 
45
45
 
46
46
  def extension_dir():
47
- """The folder the user loads into Chrome. A fixed place under ~/.gonext, not the npm package:
47
+ """The folder the user loads into Chrome. A fixed place under ~/.gu, not the npm package:
48
48
  an update moves the package, and Chrome would lose an unpacked extension loaded from there."""
49
49
  return os.environ.get("GU_BROWSER_EXT_DIR") or os.path.join(data_dir(), "browser-extension")
50
50
 
@@ -168,7 +168,7 @@ def install_text(reason="not connected"):
168
168
  return (f"BROWSER NOT AVAILABLE — {reason}. This is a problem in gu's own browser bridge, NOT a "
169
169
  "missing or broken Chrome: do NOT install, reinstall, move or delete any browser. STOP "
170
170
  "and tell the user, with that error: update gu (npm install -g @tiens.nguyen/gu-cli@latest), "
171
- "restart it, and ask again; the bridge's log is ~/.gonext/browser-bridge.log.")
171
+ "restart it, and ask again; the bridge's log is ~/.gu/browser-bridge.log.")
172
172
  no_chrome = "no chrome found" in str(reason).lower()
173
173
  if last_seen().get("installType") == "normal" and not no_chrome:
174
174
  # The Chrome Web Store copy is installed: never point at the developer folder again (#145).
package/gu_free_budget.py CHANGED
@@ -3,7 +3,7 @@
3
3
  gu used to check the free model's allowance only at the START of a turn and count the turn's spend only
4
4
  at its END — so a long turn ran on, well past the allowance, and usually ended in a confusing error.
5
5
 
6
- Now the agent reads what is left (~/.gonext/free-model.json, which gu writes; it never holds the key),
6
+ Now the agent reads what is left (~/.gu/free-model.json, which gu writes; it never holds the key),
7
7
  adds up what THIS turn has spent after every step, and PAUSES before the step that would not fit:
8
8
  the step that ran stays finished (no half-written file), and the turn ends with a plain message the
9
9
  user can act on, then "continue".
@@ -19,7 +19,7 @@ import math
19
19
  import os
20
20
  import time
21
21
 
22
- STATE_FILE = os.path.join("~", ".gonext", "free-model.json")
22
+ STATE_FILE = os.path.join("~", ".gu", "free-model.json")
23
23
 
24
24
 
25
25
  def _whole(n) -> int:
package/gu_gif.py CHANGED
@@ -17,7 +17,7 @@ HOLD_MS = 1800 # the first and last frames, so it starts and ends steadily
17
17
 
18
18
 
19
19
  def recordings_dir(home=None):
20
- return os.path.join(home or os.path.expanduser("~"), ".gonext", "recordings")
20
+ return os.path.join(home or os.path.expanduser("~"), ".gu", "recordings")
21
21
 
22
22
 
23
23
  def gif_name(label="", now=None):
package/gu_hooks.py CHANGED
@@ -249,7 +249,7 @@ class HookRunner:
249
249
  # ---- onStart: once per session ---------------------------------------------------------------
250
250
 
251
251
  def _state_path() -> str:
252
- return os.path.join(os.path.expanduser("~"), ".gonext", "hooks-state.json")
252
+ return os.path.join(os.path.expanduser("~"), ".gu", "hooks-state.json")
253
253
 
254
254
 
255
255
  def is_new_session(cwd: str, session_id: str, path: str | None = None) -> bool:
package/gu_turn_notes.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """NOTES TYPED DURING A TURN, read by the running agent at its next step (GH #506).
2
2
 
3
- gu writes what the user typed while a turn runs to ~/.gonext/turn-notes/<jobId>.jsonl. The agent's
3
+ gu writes what the user typed while a turn runs to ~/.gu/turn-notes/<jobId>.jsonl. The agent's
4
4
  step callback TAKES the file (rename, then read) after a step and adds the notes to that step's
5
5
  observations — the newest text of the conversation, not yet sent to the model. So the prompt is only
6
6
  APPENDED to: the system prompt, the tool reference and every earlier step stay byte-identical, and
@@ -25,7 +25,7 @@ NOTE_TAIL = ("Answer it FIRST, in one short line, with say(\"...\") — what you
25
25
 
26
26
 
27
27
  def notes_dir() -> str:
28
- return os.path.join(os.path.expanduser("~"), ".gonext", "turn-notes")
28
+ return os.path.join(os.path.expanduser("~"), ".gu", "turn-notes")
29
29
 
30
30
 
31
31
  def _safe(job_id: str) -> str:
package/hooks-config.mjs CHANGED
@@ -2,8 +2,8 @@
2
2
  * HOOKS — commands gu runs at fixed moments of a turn (task #270). Where they are set, and which
3
3
  * ones a turn gets.
4
4
  *
5
- * ~/.gonext/settings.json yours, every folder
6
- * <project>/.gonext/settings.json this project's — run only once you approve them here
5
+ * ~/.gu/settings.json yours, every folder
6
+ * <project>/.gu/settings.json this project's — run only once you approve them here
7
7
  *
8
8
  * { "hooks": { "<event>": [ { "matcher": "edit_file|create_file",
9
9
  * "hooks": [ { "type": "command", "command": "python3",
@@ -31,7 +31,7 @@
31
31
  * What gu cannot honour is SAID, never skipped in silence: an event gu has no moment for
32
32
  * (PreToolUse — a guard someone may be relying on), a hook that is not a command, a hook limited by
33
33
  * an `if` rule gu cannot evaluate. Read-only: gu never writes Claude's settings files; the approval
34
- * of a project's hooks is still kept in ~/.gonext/settings.json.
34
+ * of a project's hooks is still kept in ~/.gu/settings.json.
35
35
  *
36
36
  * THE SESSION. onStart fires on the first turn of a gu session. The terminal writes a new session
37
37
  * id into the folder's session file when it starts (and on /reset); sessionForTurn reads it back so
@@ -163,7 +163,7 @@ export function hooksFingerprint(hooks) {
163
163
 
164
164
  /** How each source's files are NAMED to the user (labels in messages — not paths to open). */
165
165
  const FILE_LABELS = {
166
- gu: { user: "~/.gonext/settings.json", project: ".gonext/settings.json", shown: "./.gonext/settings.json" },
166
+ gu: { user: "~/.gu/settings.json", project: ".gu/settings.json", shown: "./.gu/settings.json" },
167
167
  claude: { user: "~/.claude/settings.json", project: ".claude/settings.json", shown: "./.claude/settings.json" },
168
168
  };
169
169
 
package/image-paste.mjs CHANGED
@@ -9,9 +9,9 @@ import { readFileSync } from "node:fs";
9
9
  *
10
10
  * How it reaches the model. The API passes the message TEXT and nothing else, so the image rides
11
11
  * in the text as a marker: the input shows "[Image #1]" (like "[Pasted text #1]"), and the line
12
- * that is sent carries "[Image #1: /Users/…/.gonext/images/…png]". The agent reads the file,
12
+ * that is sent carries "[Image #1: /Users/…/.gu/images/…png]". The agent reads the file,
13
13
  * attaches it to the request, and puts "[Image #1]" back in the text it shows the model. Files
14
- * are copied into ~/.gonext/images first; the agent reads images from there and nowhere else.
14
+ * are copied into ~/.gu/images first; the agent reads images from there and nowhere else.
15
15
  *
16
16
  * Two ways in:
17
17
  * · a key that reads the clipboard's image (a copied screenshot). Terminals paste only text, so
@@ -64,7 +64,7 @@ function fileImageKind(path) {
64
64
 
65
65
  const NOT_AN_IMAGE = "that file is not an image (png, jpg, gif or webp)";
66
66
 
67
- export const imagesDir = (home = homedir()) => join(home, ".gonext", "images");
67
+ export const imagesDir = (home = homedir()) => join(home, ".gu", "images");
68
68
 
69
69
  /**
70
70
  * WHICH CODERS MAY BE SENT IMAGES (#284, #316): the list in image-capable-coders.json, shared with
@@ -90,10 +90,10 @@ export function cloudImageCoders(rows) {
90
90
  }
91
91
 
92
92
  /**
93
- * The cloud list this gu last read, kept in ~/.gonext/image-models.json so a start without network
93
+ * The cloud list this gu last read, kept in ~/.gu/image-models.json so a start without network
94
94
  * still knows it — and so the agent (gonext_agent_chat.py) reads the very same list.
95
95
  */
96
- export const imageModelsFile = (home = homedir()) => join(home, ".gonext", "image-models.json");
96
+ export const imageModelsFile = (home = homedir()) => join(home, ".gu", "image-models.json");
97
97
  let cloudCoders = [];
98
98
  export function setCloudImageCoders(list) {
99
99
  cloudCoders = Array.isArray(list) ? list.filter((c) => c && c.host && c.exact) : [];
@@ -125,7 +125,7 @@ export function coderTakesImagesFor(url, model = "", coders = [...IMAGE_CODERS,
125
125
  export function saveCloudImageCoders(rows, home = homedir()) {
126
126
  const coders = cloudImageCoders(rows);
127
127
  try {
128
- mkdirSync(join(home, ".gonext"), { recursive: true });
128
+ mkdirSync(join(home, ".gu"), { recursive: true });
129
129
  writeFileSync(imageModelsFile(home), JSON.stringify({ savedAt: new Date().toISOString(), coders }, null, 1) + "\n");
130
130
  } catch {
131
131
  /* not saved: this session still uses it */
@@ -207,7 +207,7 @@ function newImagePath(ext, home) {
207
207
  return join(dir, `${stamp}-${Math.random().toString(36).slice(2, 8)}${ext}`);
208
208
  }
209
209
 
210
- /** Copy an image file into ~/.gonext/images. → { path } or { error }. */
210
+ /** Copy an image file into ~/.gu/images. → { path } or { error }. */
211
211
  export function storeImageFile(src, { home = homedir() } = {}) {
212
212
  let size = 0;
213
213
  try {
@@ -258,7 +258,7 @@ export function clipboardImageCommand(dest, platform = process.platform) {
258
258
  return { cmd: "sh", args: ["-c", `(wl-paste --type image/png 2>/dev/null || xclip -selection clipboard -t image/png -o 2>/dev/null) > '${dest.replace(/'/g, "'\\''")}' && [ -s '${dest.replace(/'/g, "'\\''")}' ]`] };
259
259
  }
260
260
 
261
- /** Save the clipboard's image into ~/.gonext/images. → { path } | { error } | { none: true }. */
261
+ /** Save the clipboard's image into ~/.gu/images. → { path } | { error } | { none: true }. */
262
262
  export function clipboardImageToFile({ home = homedir(), platform = process.platform, run = spawnSync } = {}) {
263
263
  const dest = newImagePath(".png", home);
264
264
  const { cmd, args } = clipboardImageCommand(dest, platform);
package/install-path.mjs CHANGED
@@ -127,7 +127,7 @@ export function addPathBlock({ dir, home = realUserHome() }) {
127
127
  return { wrote, already, targets };
128
128
  }
129
129
 
130
- /** Under `sudo npm i -g` a file written into ~/.gonext would be root's: gu could not delete it. */
130
+ /** Under `sudo npm i -g` a file written into ~/.gu would be root's: gu could not delete it. */
131
131
  // A function DECLARATION: main() runs at the top of this file, before any `const` below exists.
132
132
  function underSudo() {
133
133
  return Boolean(process.env.SUDO_UID && process.getuid && process.getuid() === 0);
package/log-level.mjs CHANGED
@@ -26,7 +26,7 @@ import { readFileSync, unlinkSync } from "node:fs";
26
26
  import { homedir } from "node:os";
27
27
  import { join } from "node:path";
28
28
 
29
- export const LEASE_FILE = join(homedir(), ".gonext", "log-detail.json");
29
+ export const LEASE_FILE = join(homedir(), ".gu", "log-detail.json");
30
30
 
31
31
  /** Is that process still running? (signal 0 asks without sending anything.) */
32
32
  export function pidAlive(pid) {
package/log-policy.mjs CHANGED
@@ -19,7 +19,7 @@ import { copyFile, readdir, readFile, rename, stat, truncate, unlink, writeFile
19
19
  import { homedir } from "node:os";
20
20
  import { join } from "node:path";
21
21
 
22
- export const POLICY_FILE = join(homedir(), ".gonext", "log-policy.json");
22
+ export const POLICY_FILE = join(homedir(), ".gu", "log-policy.json");
23
23
  export const REFRESH_MS = 5 * 60_000;
24
24
  export const ROTATE = { maxBytes: 20 * 1024 * 1024, keep: 3 };
25
25
  export const RUN_LOGS = { maxAgeMs: 7 * 86_400_000, maxFiles: 200 };