@tiens.nguyen/gu-cli 1.0.938 → 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.
- package/README.md +17 -7
- package/agent-deps-preflight.mjs +1 -1
- package/autocompact.mjs +2 -2
- package/browser-bridge.mjs +2 -2
- package/browser-chrome.mjs +2 -2
- package/browser-command.mjs +4 -4
- package/browser-extension/README.md +6 -6
- package/clear-logs.mjs +3 -3
- package/clear-state.mjs +3 -3
- package/cli-token.mjs +8 -8
- package/client-expert-api.mjs +9 -9
- package/client-expert-run.mjs +7 -7
- package/client-expert-setup.mjs +4 -4
- package/command-allow.mjs +1 -1
- package/conversation-archive.mjs +2 -2
- package/credential-recovery.mjs +1 -1
- package/daemon-control.mjs +4 -4
- package/device-login.mjs +3 -3
- package/free-model.mjs +35 -3
- package/full-log-command.mjs +1 -1
- package/gonext_agent_chat.py +72 -72
- package/gu-cli.mjs +29 -28
- package/gu-home-move.mjs +193 -0
- package/gu-repl.mjs +72 -54
- package/gu_browser.py +3 -3
- package/gu_free_budget.py +11 -9
- package/gu_gif.py +1 -1
- package/gu_hooks.py +1 -1
- package/gu_mcp.py +22 -2
- package/gu_turn_notes.py +2 -2
- package/hooks-config.mjs +4 -4
- package/image-paste.mjs +8 -8
- package/install-path.mjs +1 -1
- package/log-level.mjs +1 -1
- package/log-policy.mjs +1 -1
- package/lsp-host.mjs +2 -2
- package/lsp-registry.mjs +9 -9
- package/mcp-command.mjs +1 -1
- package/mcp-config.mjs +5 -5
- package/model-doctor.mjs +10 -10
- package/mongo-mac.mjs +2 -2
- package/mongo-windows.mjs +3 -3
- package/package.json +2 -1
- package/platform-tools.mjs +3 -3
- package/poll-errors.mjs +2 -2
- package/prompt_scaffold_check.py +1 -1
- package/proxy-store.mjs +1 -1
- package/python-unix.mjs +6 -6
- package/python-windows.mjs +1 -1
- package/rag-selftest.mjs +2 -2
- package/resume-memory.mjs +1 -1
- package/scripts/image-paste-check.mjs +1 -1
- package/setup-fixes.mjs +4 -4
- package/shell-details.mjs +2 -2
- package/skill-install.mjs +9 -9
- package/skill-package.mjs +10 -10
- package/skill-source.mjs +4 -4
- package/skills-copy.mjs +15 -15
- package/skills.mjs +4 -4
- package/support-bundle.mjs +6 -6
- package/support-report.mjs +5 -5
- package/terminal-layout.mjs +1 -1
- package/turn-notes.mjs +2 -2
- package/version-check.mjs +1 -1
- package/workspace-revert.mjs +2 -2
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
|
-
* ~/.
|
|
6
|
-
* <project>/.
|
|
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 ~/.
|
|
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: "~/.
|
|
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/…/.
|
|
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 ~/.
|
|
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, ".
|
|
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 ~/.
|
|
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, ".
|
|
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, ".
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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(), ".
|
|
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(), ".
|
|
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 };
|
package/lsp-host.mjs
CHANGED
|
@@ -130,7 +130,7 @@ export class LspHost {
|
|
|
130
130
|
return entry;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
/** Install a server into ~/.
|
|
133
|
+
/** Install a server into ~/.gu/lsp (npm), once at a time per language. */
|
|
134
134
|
install(lang) {
|
|
135
135
|
if (this.installing.has(installKey(lang))) return this.installing.get(installKey(lang));
|
|
136
136
|
const { cmd, args } = installCommand(lang, this.home);
|
|
@@ -329,7 +329,7 @@ export class LspHost {
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
/**
|
|
332
|
-
* Serve a host on 127.0.0.1 (a free port) and write where to reach it to ~/.
|
|
332
|
+
* Serve a host on 127.0.0.1 (a free port) and write where to reach it to ~/.gu/lsp-host.json.
|
|
333
333
|
* → { url, token, host, close }.
|
|
334
334
|
*/
|
|
335
335
|
export async function serveLspHost({ home, log = () => {}, host = new LspHost({ home, log }) } = {}) {
|
package/lsp-registry.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* see the table's `licence`). Claude Code's plugins are the same idea — a few lines saying which
|
|
10
10
|
* program serves which file types — without the install: gu offers to install it, with consent.
|
|
11
11
|
*
|
|
12
|
-
* The user's choices are ~/.
|
|
12
|
+
* The user's choices are ~/.gu/lsp-state.json, written by the terminal (the offer, /lsp) and
|
|
13
13
|
* read by the worker's host (lsp-host.mjs):
|
|
14
14
|
* { "languages": { "<id>": "on" | "off" | "never" }, "neverAsk": false, "ignored": 0 }
|
|
15
15
|
*/
|
|
@@ -260,12 +260,12 @@ export const LSP_LANGUAGES = BUILTIN_LANGUAGES;
|
|
|
260
260
|
* <workspace>/.gu/lsp.json this project, gu's file
|
|
261
261
|
* <workspace>/.lsp.json this project, Claude Code's plugin file (a team that set it up for
|
|
262
262
|
* Claude Code gets the same servers in gu)
|
|
263
|
-
* ~/.
|
|
263
|
+
* ~/.gu/lsp.json every project on this computer
|
|
264
264
|
* Each holds either Claude Code's shape — { "<id>": { command, args, extensionToLanguage, env,
|
|
265
265
|
* initializationOptions, settings, startupTimeout, … } } — or the same map under "lspServers".
|
|
266
266
|
*/
|
|
267
267
|
export const customLspFiles = (home, workspace) =>
|
|
268
|
-
[workspace && join(workspace, ".gu", "lsp.json"), workspace && join(workspace, ".lsp.json"), home && join(home, ".
|
|
268
|
+
[workspace && join(workspace, ".gu", "lsp.json"), workspace && join(workspace, ".lsp.json"), home && join(home, ".gu", "lsp.json")].filter(Boolean);
|
|
269
269
|
|
|
270
270
|
const ID_RE = /^[A-Za-z0-9][\w.-]{0,40}$/;
|
|
271
271
|
|
|
@@ -355,9 +355,9 @@ export function languageFor(file, langs = BUILTIN_LANGUAGES) {
|
|
|
355
355
|
export const lspExtensions = (langs = BUILTIN_LANGUAGES) => [...new Set(langs.flatMap((l) => Object.keys(l.exts)))];
|
|
356
356
|
|
|
357
357
|
/** Where gu installs npm servers: its own folder, no admin rights, nothing global. */
|
|
358
|
-
export const lspInstallDir = (home) => join(home, ".
|
|
359
|
-
export const lspStatePath = (home) => join(home, ".
|
|
360
|
-
export const lspHostPath = (home) => join(home, ".
|
|
358
|
+
export const lspInstallDir = (home) => join(home, ".gu", "lsp");
|
|
359
|
+
export const lspStatePath = (home) => join(home, ".gu", "lsp-state.json");
|
|
360
|
+
export const lspHostPath = (home) => join(home, ".gu", "lsp-host.json");
|
|
361
361
|
|
|
362
362
|
// ---------------------------------------------------------------------------------------------
|
|
363
363
|
// the user's choices
|
|
@@ -408,7 +408,7 @@ export function applyOfferAnswer(state, id, choice) {
|
|
|
408
408
|
|
|
409
409
|
/** The offer's rows, the first highlighted. Swift needs no download, so it is "turn on". */
|
|
410
410
|
export function offerRows(lang, { needsInstall }) {
|
|
411
|
-
const install = lang.tool ? `Yes, install ${lang.server} (${lang.tool.what})` : `Yes, install ${lang.server} (${lang.size}, into ~/.
|
|
411
|
+
const install = lang.tool ? `Yes, install ${lang.server} (${lang.tool.what})` : `Yes, install ${lang.server} (${lang.size}, into ~/.gu/lsp)`;
|
|
412
412
|
return [
|
|
413
413
|
needsInstall ? install : "Yes, turn it on",
|
|
414
414
|
"Not now",
|
|
@@ -450,7 +450,7 @@ export function xcodeDeveloperDir({ exists = existsSync, selected = "" } = {}) {
|
|
|
450
450
|
|
|
451
451
|
/**
|
|
452
452
|
* How to start a language's server here → { cmd, args, env } or null (not installed).
|
|
453
|
-
* Order: gu's own install (~/.
|
|
453
|
+
* Order: gu's own install (~/.gu/lsp), then PATH; Swift on macOS through xcrun with the Xcode
|
|
454
454
|
* picked above.
|
|
455
455
|
*/
|
|
456
456
|
export function resolveServer(lang, { home, platform = process.platform, env = process.env, run = execFileSync, exists = existsSync } = {}) {
|
|
@@ -494,7 +494,7 @@ export function resolveServer(lang, { home, platform = process.platform, env = p
|
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
|
-
* Can gu install this language's server itself? npm ones always (into ~/.
|
|
497
|
+
* Can gu install this language's server itself? npm ones always (into ~/.gu/lsp); Go and Rust
|
|
498
498
|
* when their own tool (`go`, `rustup`) is on this computer. Swift and C/C++ come with their toolchain.
|
|
499
499
|
*/
|
|
500
500
|
export function canInstall(lang, { env = process.env, platform = process.platform } = {}) {
|
package/mcp-command.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* list every server, whether it connects, how many tools (the default)
|
|
5
5
|
* tools <name> that server's tools
|
|
6
6
|
* add … `claude mcp add`'s shape; `/mcp add` alone asks step by step
|
|
7
|
-
* remove <name> from your ~/.
|
|
7
|
+
* remove <name> from your ~/.gu/mcp.json
|
|
8
8
|
* enable|disable <name> keep it configured, stop starting it
|
|
9
9
|
* approve|unapprove <name> a project's .mcp.json server, for this folder
|
|
10
10
|
* allow <name> [tool] its tools run without asking (all, or one)
|
package/mcp-config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP SERVERS — where they are configured, and who may call their tools (task #269).
|
|
3
3
|
*
|
|
4
|
-
* ~/.
|
|
4
|
+
* ~/.gu/mcp.json yours: { mcpServers, disabled, permissions: { allow, deny }, approvedProjects }
|
|
5
5
|
* <project>/.mcp.json the project's — Claude Code's own file and format, so one file serves both
|
|
6
6
|
*
|
|
7
7
|
* The shapes are Claude Code's: `mcpServers: { name: { type: "stdio", command, args, env } }`, and
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* as untrusted, and a hostile server would simply claim it.
|
|
20
20
|
*
|
|
21
21
|
* CLAUDE CODE'S SERVERS (#325). A folder that chose "Claude's skills" (/switch-skill) takes YOUR
|
|
22
|
-
* servers from Claude Code's own file instead of ~/.
|
|
22
|
+
* servers from Claude Code's own file instead of ~/.gu/mcp.json:
|
|
23
23
|
* ~/.claude.json projects["<this folder>"].mcpServers (Claude's "local" scope — this folder only)
|
|
24
24
|
* ~/.claude.json mcpServers (Claude's "user" scope — every folder)
|
|
25
25
|
* The project's .mcp.json is the same file either way. Yours still win over the project's. gu's own
|
|
26
26
|
* bookkeeping — disabled, the allow/deny rules, which project servers you approved — stays in
|
|
27
|
-
* ~/.
|
|
27
|
+
* ~/.gu/mcp.json whichever source is chosen: Claude Code's file has no place for it, and gu
|
|
28
28
|
* reads Claude's setup without Claude ever having to read gu's.
|
|
29
29
|
*
|
|
30
30
|
* ~/.claude.json IS CLAUDE CODE'S WHOLE STATE FILE, not a config file of ours. It is only written
|
|
@@ -43,7 +43,7 @@ import { resolveSkillSource } from "./skill-source.mjs";
|
|
|
43
43
|
export const SERVER_NAME_RE = /^[A-Za-z0-9_-]{1,64}$/;
|
|
44
44
|
|
|
45
45
|
export function userConfigPath(home = homedir()) {
|
|
46
|
-
return join(home, ".
|
|
46
|
+
return join(home, ".gu", "mcp.json");
|
|
47
47
|
}
|
|
48
48
|
export function projectConfigPath(cwd) {
|
|
49
49
|
return join(cwd, ".mcp.json");
|
|
@@ -122,7 +122,7 @@ export function updateClaudeConfig(mutate, home = homedir()) {
|
|
|
122
122
|
return raw;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
/** Write ~/.
|
|
125
|
+
/** Write ~/.gu/mcp.json atomically: a crash mid-write leaves the old file, never half of one. */
|
|
126
126
|
function writeUserRaw(raw, home) {
|
|
127
127
|
const file = userConfigPath(home);
|
|
128
128
|
mkdirSync(dirname(file), { recursive: true });
|
package/model-doctor.mjs
CHANGED
|
@@ -42,7 +42,7 @@ const EMBED_SCRIPT = fileURLToPath(new URL("./gonext_mlx_embed.py", import.meta.
|
|
|
42
42
|
function python3Bin() {
|
|
43
43
|
const explicit = (process.env.GONEXT_PROBE_PYTHON ?? process.env.GONEXT_MLX_LM_PYTHON ?? "").trim();
|
|
44
44
|
if (explicit) return explicit;
|
|
45
|
-
// gu's OWN environment, when it has one (~/.
|
|
45
|
+
// gu's OWN environment, when it has one (~/.gu/venv): the agent's packages were installed INTO it, so a new
|
|
46
46
|
// process must look there, not in the system Python — or it asks to install them at every start (GH #308).
|
|
47
47
|
const own = ownVenvPython();
|
|
48
48
|
if (own) return own;
|
|
@@ -95,7 +95,7 @@ export function resolvePythonPath() {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Persist that interpreter into ~/.
|
|
98
|
+
* Persist that interpreter into ~/.gu/worker.env as GONEXT_PROBE_PYTHON, so every future
|
|
99
99
|
* daemon uses it regardless of the PATH it happens to start with. Merges — never rewrites the
|
|
100
100
|
* file from scratch. Returns the path written, or "" when nothing needed doing.
|
|
101
101
|
*/
|
|
@@ -153,7 +153,7 @@ export function isPipMissing(output) {
|
|
|
153
153
|
/** How long one pip run may take before gu stops waiting (GU_PIP_TIMEOUT_MS overrides; a slow line needs more). */
|
|
154
154
|
export const PIP_TIMEOUT_MS = Number(process.env.GU_PIP_TIMEOUT_MS ?? "") || 600_000;
|
|
155
155
|
/** Where a pip run's whole output is kept, so a failure can be read afterwards. */
|
|
156
|
-
export const PIP_LOG_FILE = join(homedir(), ".
|
|
156
|
+
export const PIP_LOG_FILE = join(homedir(), ".gu", "pip-install.log");
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Run pip once. Resolves { code, err, timedOut } — never rejects, so the caller owns the policy.
|
|
@@ -223,7 +223,7 @@ function runPip(python, pkgs, extraArgs = [], { log = () => {}, timeoutMs = PIP_
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
|
-
* A private virtualenv at ~/.
|
|
226
|
+
* A private virtualenv at ~/.gu/venv, created on demand. → its python, or "".
|
|
227
227
|
*
|
|
228
228
|
* THE RIGHT ANSWER TO PEP 668, and the machinery for it already existed: the daemon's
|
|
229
229
|
* interpreter is pinned through GONEXT_PROBE_PYTHON precisely so the packages and the process
|
|
@@ -287,7 +287,7 @@ async function pipInstall(pkgs, log) {
|
|
|
287
287
|
return venvPy;
|
|
288
288
|
};
|
|
289
289
|
|
|
290
|
-
// WINDOWS: gu's OWN environment (~/.
|
|
290
|
+
// WINDOWS: gu's OWN environment (~/.gu/venv) from the start. The system Python is somebody else's: writing
|
|
291
291
|
// into it needs an administrator, can clash with their packages, and cannot be undone with one folder delete.
|
|
292
292
|
// (GU_PIP_SYSTEM=1 keeps the old behaviour.)
|
|
293
293
|
if (process.platform === "win32" && process.env.GU_PIP_SYSTEM !== "1") {
|
|
@@ -349,7 +349,7 @@ export function chatRamWarningLines(repo, totalBytes) {
|
|
|
349
349
|
return out;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
const DIR = join(homedir(), ".
|
|
352
|
+
const DIR = join(homedir(), ".gu");
|
|
353
353
|
export const MODEL_PID_FILE = join(DIR, "model.pid");
|
|
354
354
|
export const MODEL_LOG_FILE = join(DIR, "model.log");
|
|
355
355
|
const EMBED_PID_FILE = join(DIR, "embed.pid");
|
|
@@ -854,7 +854,7 @@ export async function testEmbeddings(baseUrl, model, { timeoutMs = 20000 } = {})
|
|
|
854
854
|
*/
|
|
855
855
|
export async function listLocalRagIndexes() {
|
|
856
856
|
const { readdir, readFile: rf, stat: st } = await import("node:fs/promises");
|
|
857
|
-
const root = join(homedir(), ".
|
|
857
|
+
const root = join(homedir(), ".gu", "rag");
|
|
858
858
|
const out = [];
|
|
859
859
|
let folders = [];
|
|
860
860
|
try {
|
|
@@ -1410,9 +1410,9 @@ export async function ensureSkillsLibs({ log, confirm, agreed = [], pip = pipIns
|
|
|
1410
1410
|
|
|
1411
1411
|
/** npm packages the docx and pptx skills `require()`; they were documented as preinstalled but nothing installed them. */
|
|
1412
1412
|
export const SKILLS_NODE_PACKAGES = ["docx", "pptxgenjs"];
|
|
1413
|
-
/** Where they go: ~/.
|
|
1413
|
+
/** Where they go: ~/.gu/node-libs/node_modules (the agent shell gets it as NODE_PATH). */
|
|
1414
1414
|
export function skillsNodeDir() {
|
|
1415
|
-
return join(homedir(), ".
|
|
1415
|
+
return join(homedir(), ".gu", "node-libs");
|
|
1416
1416
|
}
|
|
1417
1417
|
function npmInstallInto(dir, pkgs) {
|
|
1418
1418
|
const win = platform() === "win32";
|
|
@@ -1476,7 +1476,7 @@ export async function ensureAgentDeps({ log, confirm, modelHost = canHostMlxMode
|
|
|
1476
1476
|
if (!usable.ok && build && (await confirm(pu.pythonOfferText(usable, build), true))) {
|
|
1477
1477
|
log(` Installing Python ${pu.PYTHON_UNIX.version} …`);
|
|
1478
1478
|
const r = await (installPython ?? pu.installPythonUnix)({ build, log });
|
|
1479
|
-
if (r.ok) log(` ✓ Python ${pu.PYTHON_UNIX.version} installed for your user (~/.
|
|
1479
|
+
if (r.ok) log(` ✓ Python ${pu.PYTHON_UNIX.version} installed for your user (~/.gu/python)`);
|
|
1480
1480
|
else log(yellow(` could not install Python: ${r.error ?? "unknown error"}`));
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
package/mongo-mac.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 8.0.5 is the last release built for older Macs (minos 10.14 on Intel, 11.0 on Apple Silicon).
|
|
8
8
|
*
|
|
9
9
|
* So on those Macs gu runs its own mongod 8.0.5, like the Windows one (#210): no Homebrew, no
|
|
10
|
-
* service, no sudo. Everything lives under ~/.
|
|
10
|
+
* service, no sudo. Everything lives under ~/.gu/mongodb and goes away with that folder:
|
|
11
11
|
* bin/mongod data/ mongod.log launch.log version.txt
|
|
12
12
|
*
|
|
13
13
|
* The .tgz is gzip, so unlike the Windows zip one file cannot be fetched on its own: the whole
|
|
@@ -58,7 +58,7 @@ export function macNeedsOwnMongo(major) {
|
|
|
58
58
|
|
|
59
59
|
/** Where gu keeps its own mongod on a Mac — the same layout as Windows. `home` for tests. */
|
|
60
60
|
export function mongoMacPaths(home = homedir()) {
|
|
61
|
-
const dir = join(home, ".
|
|
61
|
+
const dir = join(home, ".gu", "mongodb");
|
|
62
62
|
return {
|
|
63
63
|
dir,
|
|
64
64
|
exe: join(dir, "bin", "mongod"),
|
package/mongo-windows.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* MB). The server answers HTTP Range requests (checked: 206, accept-ranges: bytes), so this
|
|
8
8
|
* module reads the zip's central directory over the wire and downloads ONLY the mongod.exe entry.
|
|
9
9
|
*
|
|
10
|
-
* Everything lives under ~/.
|
|
10
|
+
* Everything lives under ~/.gu/mongodb — no service, no admin, removed by deleting the folder:
|
|
11
11
|
* bin/mongod.exe data/ mongod.log launch.log
|
|
12
12
|
*
|
|
13
13
|
* Pure parts (zip parsing, paths, the command line) are separate from the network and process
|
|
@@ -25,7 +25,7 @@ export const MONGO_WIN_ZIP_URL = `https://fastdl.mongodb.org/windows/mongodb-win
|
|
|
25
25
|
|
|
26
26
|
/** Where gu keeps its own mongod. `home` is injectable for tests. */
|
|
27
27
|
export function mongoWinPaths(home = homedir()) {
|
|
28
|
-
const dir = join(home, ".
|
|
28
|
+
const dir = join(home, ".gu", "mongodb");
|
|
29
29
|
return {
|
|
30
30
|
dir,
|
|
31
31
|
exe: join(dir, "bin", "mongod.exe"),
|
|
@@ -285,7 +285,7 @@ export function vcRedistInstalled(code) {
|
|
|
285
285
|
* started with `-Verb RunAs` (one Windows permission prompt); a non-elevated child_process could not ask.
|
|
286
286
|
* → { ok, code, error? }. `download` and `run` are injectable so tests never touch the net or the machine.
|
|
287
287
|
*/
|
|
288
|
-
export async function installVcRuntime({ dir = join(homedir(), ".
|
|
288
|
+
export async function installVcRuntime({ dir = join(homedir(), ".gu"), fetchFn = fetch, run = null } = {}) {
|
|
289
289
|
const exe = join(dir, "vc_redist.x64.exe");
|
|
290
290
|
try {
|
|
291
291
|
await mkdir(dir, { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gu-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.940",
|
|
4
4
|
"description": "gu: the coding agent in your terminal. It reads your repo, makes the change and runs the tests, with your own models (Ollama or any OpenAI-compatible provider). Free installs keep the agent, its API and its database on your machine. macOS, Linux and Windows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -156,6 +156,7 @@
|
|
|
156
156
|
"hints.mjs",
|
|
157
157
|
"terminal-title.mjs",
|
|
158
158
|
"gu-relaunch.mjs",
|
|
159
|
+
"gu-home-move.mjs",
|
|
159
160
|
"server-keys.mjs",
|
|
160
161
|
"add-server.mjs",
|
|
161
162
|
"powershell-alias.mjs",
|
package/platform-tools.mjs
CHANGED
|
@@ -225,13 +225,13 @@ let _python = null;
|
|
|
225
225
|
* Cached: otherwise this probes a subprocess on every job.
|
|
226
226
|
*/
|
|
227
227
|
/**
|
|
228
|
-
* The interpreter of gu's own private virtualenv (~/.
|
|
228
|
+
* The interpreter of gu's own private virtualenv (~/.gu/venv), or "" when there is none. Pure apart from one
|
|
229
229
|
* file check. The agent's packages are installed INTO it on Windows (GH #308), so everything that runs the agent —
|
|
230
230
|
* the terminal's checks AND the background worker — must look there, whatever worker.env did or did not pin.
|
|
231
231
|
*/
|
|
232
232
|
export function ownVenvPython(home = homedir(), exists = existsSync, platform = process.platform) {
|
|
233
233
|
const win = platform === "win32";
|
|
234
|
-
const py = join(home, ".
|
|
234
|
+
const py = join(home, ".gu", "venv", win ? "Scripts" : "bin", win ? "python.exe" : "python");
|
|
235
235
|
return exists(py) ? py : "";
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -581,7 +581,7 @@ export async function spawnSurviving({ cmd, args = [], cwd, env = {}, logFile, t
|
|
|
581
581
|
|
|
582
582
|
// THE SCHEDULER'S ENVIRONMENT IS NOT YOURS. A task launched this way starts with a minimal
|
|
583
583
|
// environment — no USERPROFILE among it — so `os.homedir()` does not resolve to the user's
|
|
584
|
-
// profile and anything that reads ~/.
|
|
584
|
+
// profile and anything that reads ~/.gu (worker.env, the sessions, the RAG index) fails.
|
|
585
585
|
// The daemon exited 1 that way, silently, with "Last Result: 1" the only trace.
|
|
586
586
|
//
|
|
587
587
|
// Carried EXPLICITLY, and only these: passing the whole of process.env is what put names cmd
|
package/poll-errors.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Friendly poll-failure reporting for the worker daemon.
|
|
2
2
|
//
|
|
3
3
|
// The poll loop runs every ~500ms, so a failure that lasts (an API outage, a rotated key)
|
|
4
|
-
// used to fill ~/.
|
|
4
|
+
// used to fill ~/.gu/worker.log with THOUSANDS of identical 4-line stack traces — which
|
|
5
5
|
// says nothing about what's wrong or whether the user can fix it. This turns each failure
|
|
6
6
|
// into ONE plain sentence plus an actionable hint, and collapses repeats of the same failure
|
|
7
7
|
// into a periodic "still failing" line.
|
|
@@ -53,7 +53,7 @@ export function describePollError(err, { apiBase = "the API" } = {}) {
|
|
|
53
53
|
return {
|
|
54
54
|
key: "api-404",
|
|
55
55
|
line: `${apiBase} has no /api/worker/jobs/next endpoint (404).`,
|
|
56
|
-
hint: "The API base URL may point at the wrong deployment — check GONEXT_API_BASE in ~/.
|
|
56
|
+
hint: "The API base URL may point at the wrong deployment — check GONEXT_API_BASE in ~/.gu/worker.env.",
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
if (status >= 500) {
|
package/prompt_scaffold_check.py
CHANGED
|
@@ -18,7 +18,7 @@ import sys
|
|
|
18
18
|
# A scaffold YOU put here wins over the database version, on this machine only. gu never WRITES this
|
|
19
19
|
# file — the scaffold stays off users' disks unless they put it there themselves — so it is an
|
|
20
20
|
# override for trying a wording before inserting it into production, not a cache.
|
|
21
|
-
LOCAL_SCAFFOLD_PATH = os.path.join(os.path.expanduser("~"), ".
|
|
21
|
+
LOCAL_SCAFFOLD_PATH = os.path.join(os.path.expanduser("~"), ".gu", "prompt-scaffolds", "code-agent.txt")
|
|
22
22
|
# How the file is NAMED in anything a person reads: never its location. Asked for: "dont say out loud
|
|
23
23
|
# where is the location of the scaffold file … not say anything". The deploy app's own Commands
|
|
24
24
|
# window is the one place the path is written down, for its owner.
|
package/proxy-store.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { homedir } from "node:os";
|
|
|
17
17
|
import { join } from "node:path";
|
|
18
18
|
import { normalizeProxy } from "./proxy-config.mjs";
|
|
19
19
|
|
|
20
|
-
const GONEXT_DIR = join(homedir(), ".
|
|
20
|
+
const GONEXT_DIR = join(homedir(), ".gu");
|
|
21
21
|
export const PROXY_FILE = join(GONEXT_DIR, "proxy.json");
|
|
22
22
|
|
|
23
23
|
/**
|
package/python-unix.mjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* package). On all three the agent could not run, and gu could only say "install Python".
|
|
8
8
|
*
|
|
9
9
|
* Like the Windows path (python-windows.mjs: python.org, for this user), gu now offers to bring its own: a standalone
|
|
10
|
-
* CPython build (python-build-standalone — the builds uv and others install), unpacked into ~/.
|
|
11
|
-
* administrator, no sudo, nothing outside ~/.
|
|
10
|
+
* CPython build (python-build-standalone — the builds uv and others install), unpacked into ~/.gu/python. No
|
|
11
|
+
* administrator, no sudo, nothing outside ~/.gu. The archive is checked against a SHA-256 pinned HERE, so a changed
|
|
12
12
|
* file on the server is refused, never run. Bump the release on purpose, with its four hashes.
|
|
13
13
|
*
|
|
14
14
|
* Pure parts are separate; the download and the shell are injected so tests never fetch or unpack anything.
|
|
@@ -75,7 +75,7 @@ export function pythonOfferText(usable, build) {
|
|
|
75
75
|
usable.why === "no-venv" ? `this computer's Python ${usable.version} cannot make gu's own environment (no venv)` :
|
|
76
76
|
"this computer has none gu can use";
|
|
77
77
|
return `The agent runs on Python 3.10 or newer, and ${have}. Install Python ${PYTHON_UNIX.version} for your user only? ` +
|
|
78
|
-
`(about ${build.mb} MB, into ~/.
|
|
78
|
+
`(about ${build.mb} MB, into ~/.gu/python; no password, nothing system-wide)`;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
const sh = (file, args) =>
|
|
@@ -84,10 +84,10 @@ const sh = (file, args) =>
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Download, check, unpack, and make gu's own environment (~/.
|
|
88
|
-
* An older ~/.
|
|
87
|
+
* Download, check, unpack, and make gu's own environment (~/.gu/venv) from it. → { ok, python?, error? }
|
|
88
|
+
* An older ~/.gu/venv (made from a Python the agent cannot use) is moved aside, never deleted.
|
|
89
89
|
*/
|
|
90
|
-
export async function installPythonUnix({ dir = join(homedir(), ".
|
|
90
|
+
export async function installPythonUnix({ dir = join(homedir(), ".gu"), build = pythonBuildFor(), fetchFn = fetch, run = sh, log = () => {} } = {}) {
|
|
91
91
|
if (!build) return { ok: false, error: "there is no standalone Python build for this computer" };
|
|
92
92
|
const archive = join(dir, build.name);
|
|
93
93
|
try {
|
package/python-windows.mjs
CHANGED
|
@@ -66,7 +66,7 @@ export function pythonInstallerEnv(env = process.env) {
|
|
|
66
66
|
* Download, verify, install. → { ok, folders?, error? }. `fetchFn` and `run` (file → { code }) are injectable.
|
|
67
67
|
* On success the process PATH is updated so the very next `py -3` in this run finds it.
|
|
68
68
|
*/
|
|
69
|
-
export async function installPythonWindows({ dir = join(homedir(), ".
|
|
69
|
+
export async function installPythonWindows({ dir = join(homedir(), ".gu"), version = PYTHON_WIN_VERSION, fetchFn = fetch, run = null, env = process.env } = {}) {
|
|
70
70
|
const file = join(dir, `python-${version}-amd64.exe`);
|
|
71
71
|
try {
|
|
72
72
|
await mkdir(dir, { recursive: true });
|
package/rag-selftest.mjs
CHANGED
|
@@ -107,7 +107,7 @@ export function cosine(a, b) {
|
|
|
107
107
|
|
|
108
108
|
/** Read the API base + worker key exactly as the CLI does. */
|
|
109
109
|
async function workerEnv() {
|
|
110
|
-
const txt = await readFile(join(homedir(), ".
|
|
110
|
+
const txt = await readFile(join(homedir(), ".gu", "worker.env"), "utf8").catch(() => "");
|
|
111
111
|
const get = (k) => (new RegExp(`^${k}=(.*)$`, "m").exec(txt)?.[1] ?? "").trim();
|
|
112
112
|
return { apiBase: get("GONEXT_API_BASE").replace(/\/+$/, ""), key: get("GONEXT_WORKER_KEY") };
|
|
113
113
|
}
|
|
@@ -135,7 +135,7 @@ export async function runRagSelfTest({ onStep = () => {} } = {}) {
|
|
|
135
135
|
|
|
136
136
|
await step("read the embedder from this machine's settings", async () => {
|
|
137
137
|
const { apiBase, key } = await workerEnv();
|
|
138
|
-
if (!apiBase || !key) throw new Error("no ~/.
|
|
138
|
+
if (!apiBase || !key) throw new Error("no ~/.gu/worker.env — run `gu` first");
|
|
139
139
|
const res = await fetch(`${apiBase}/api/worker/settings`, {
|
|
140
140
|
headers: { "X-Worker-Key": key },
|
|
141
141
|
signal: AbortSignal.timeout(10_000),
|
package/resume-memory.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export function findMemoryCli({ cwd = process.cwd(), home = homedir(), hooksFor
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
for (const dir of [join(home, ".
|
|
36
|
+
for (const dir of [join(home, ".gu", "skill-runtime", SKILL), join(home, ".claude", "skill-runtime", SKILL), join(home, ".claude", "memory")]) {
|
|
37
37
|
const cli = join(dir, "memory_cli.py");
|
|
38
38
|
if (existsSync(cli)) {return { python: pythonFor(cli), cli };}
|
|
39
39
|
}
|
|
@@ -50,7 +50,7 @@ writeFileSync(shot, PNG);
|
|
|
50
50
|
const spelled = process.platform === "win32" ? `"${shot}"` : shot.replace(/ /g, "\\ ");
|
|
51
51
|
check("a dropped path with spaces is recognised", imagePathFromPaste(spelled) === shot, `${spelled} → ${imagePathFromPaste(spelled)}`);
|
|
52
52
|
|
|
53
|
-
// 2. It is copied into ~/.
|
|
53
|
+
// 2. It is copied into ~/.gu/images.
|
|
54
54
|
const stored = storeImageFile(shot);
|
|
55
55
|
if (stored.path) made.push(stored.path);
|
|
56
56
|
check("copied into the images folder", Boolean(stored.path?.startsWith(imagesDir())) && isPng(stored.path), stored.path ?? stored.error);
|
package/setup-fixes.mjs
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Runs from three places, all with the same words:
|
|
17
17
|
* 1. npm's postinstall (install-path.mjs) — npm hides its output, so what it did is also saved
|
|
18
|
-
* to ~/.
|
|
18
|
+
* to ~/.gu/setup-done.json and gu says it at its next start;
|
|
19
19
|
* 2. gu's first start on a computer — npm 11.21+ can skip install scripts entirely, so gu checks
|
|
20
|
-
* once itself (marker ~/.
|
|
20
|
+
* once itself (marker ~/.gu/setup-checked);
|
|
21
21
|
* 3. the Windows installer (install.ps1), which has its own PowerShell copy of these steps.
|
|
22
22
|
*
|
|
23
23
|
* Never fails anything: a step that cannot be done is reported with the command to do it by hand.
|
|
@@ -27,8 +27,8 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
|
|
|
27
27
|
import { homedir } from "node:os";
|
|
28
28
|
import { dirname, join } from "node:path";
|
|
29
29
|
|
|
30
|
-
export const NOTES_FILE = (home = homedir()) => join(home, ".
|
|
31
|
-
export const CHECKED_FILE = (home = homedir()) => join(home, ".
|
|
30
|
+
export const NOTES_FILE = (home = homedir()) => join(home, ".gu", "setup-done.json");
|
|
31
|
+
export const CHECKED_FILE = (home = homedir()) => join(home, ".gu", "setup-checked");
|
|
32
32
|
|
|
33
33
|
export const UNDO_POLICY = "Set-ExecutionPolicy -Scope CurrentUser Undefined";
|
|
34
34
|
|
package/shell-details.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// BACKGROUND SHELLS IN THE TERMINAL (task #360, GitHub #140) — Claude Code's "Shell details".
|
|
2
2
|
//
|
|
3
3
|
// The agent hands a long command (a 7-minute `fastlane ios beta`) off to the background instead
|
|
4
|
-
// of killing it at its deadline, and records it in ~/.
|
|
4
|
+
// of killing it at its deadline, and records it in ~/.gu/shells.json (gonext_agent_chat.py,
|
|
5
5
|
// BACKGROUND SHELLS). This module is the terminal's half: it reads that file, says on the bottom
|
|
6
6
|
// notice row that something is still running (a click target, like the other notice controls),
|
|
7
7
|
// and renders the details view — Status, Runtime, Command, Output — the way Claude Code does.
|
|
@@ -19,7 +19,7 @@ import { procStart } from "./proc-identity.mjs";
|
|
|
19
19
|
|
|
20
20
|
export { procStart };
|
|
21
21
|
|
|
22
|
-
export const shellsPath = (home = homedir()) => join(home, ".
|
|
22
|
+
export const shellsPath = (home = homedir()) => join(home, ".gu", "shells.json");
|
|
23
23
|
|
|
24
24
|
export function readShells(path = shellsPath()) {
|
|
25
25
|
try {
|