@tiens.nguyen/gu-cli 1.0.693 → 1.0.694

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 (2) hide show
  1. package/install-path.mjs +18 -0
  2. package/package.json +1 -1
package/install-path.mjs CHANGED
@@ -66,6 +66,15 @@ function main() {
66
66
  if (process.env.CI) return; // no user shell to help in CI
67
67
  const prefix = process.env.npm_config_prefix;
68
68
  if (!prefix) return; // not an npm install context
69
+ // A LOCAL install (`npm install @tiens.nguyen/gu-cli` inside a project) must NEVER
70
+ // write to the user's shell rc — `gu` lives in ./node_modules/.bin there, which
71
+ // does not belong on a global PATH. npm sets npm_config_global=true for `-g`;
72
+ // some npm versions omit it, so also bail when the prefix sits inside a
73
+ // project's node_modules tree.
74
+ if (process.env.npm_config_global !== "true") {
75
+ if (resolve(prefix).split("/").includes("node_modules")) return; // local install
76
+ if (process.env.npm_config_global === "false") return; // explicitly local
77
+ }
69
78
  const binDir = join(prefix, "bin");
70
79
  if (resolve(binDir).startsWith(resolve(tmpdir()))) return; // preflight's throwaway prefix
71
80
 
@@ -114,6 +123,15 @@ function rcFilesFor(home) {
114
123
  if (existsSync(bashrc)) out.push(bashrc);
115
124
  } else {
116
125
  out.push(bashrc);
126
+ // Interactive bash reads .bashrc, but a LOGIN bash (SSH console, some terminal
127
+ // emulators) reads .bash_profile / .profile instead and NEVER sources .bashrc.
128
+ // Update whichever of those the user already has so `gu` survives an SSH login
129
+ // too — but don't seed them, or bash would start preferring a file we created
130
+ // over the user's real login config.
131
+ const bashProfile = join(home, ".bash_profile");
132
+ const profile = join(home, ".profile");
133
+ if (existsSync(bashProfile)) out.push(bashProfile);
134
+ else if (existsSync(profile)) out.push(profile);
117
135
  if (existsSync(zshrc)) out.push(zshrc);
118
136
  }
119
137
  return out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gu-cli",
3
- "version": "1.0.693",
3
+ "version": "1.0.694",
4
4
  "description": "Gu CLI — the gu terminal plus the local worker that runs agent / OCR / PDF / embedding jobs on your Mac (Ollama / MLX / OpenAI-compatible).",
5
5
  "type": "module",
6
6
  "license": "MIT",