@quantis-ai/gary 0.3.1 → 0.3.2

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 (3) hide show
  1. package/README.md +6 -3
  2. package/bin/gary.js +23 -2
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -30,7 +30,7 @@ irm https://chat.getquantis.com/cli/install.ps1 | iex
30
30
  | `gary computer add` | Makes Gary's computer here and starts it: downloads the image gary pins when it isn't here. Needs Docker |
31
31
  | `gary computer update` | Downloads the image of Gary's computer that gary pins and starts the computer again on it. Its files are kept. Running it again changes nothing |
32
32
  | `gary computer remove` | Stops Gary's computer here and removes it; `gary setup` won't make it again until `gary computer add`. Its files stay in the Docker volume `gary-home` unless `--delete-home`. Refused while Gary runs a command in it, unless `--force` |
33
- | `gary update` | Installs the newest gary (when installed by the script; with npm it says the two commands to run). It leaves Gary's computer alone, and says when the computer is behind the new gary's image |
33
+ | `gary update` | Installs the newest gary: its own download when installed by the script; installed from npm, with the package manager it was installed by (npm, pnpm or bun are run; for yarn and Volta it says the command). It leaves Gary's computer alone, and says when the computer is behind the new gary's image |
34
34
  | `gary logout` / `gary uninstall` | Sign this computer out; stop the service and Gary's computer and remove them. The computer's files stay in the Docker volume `gary-home` unless `--delete-home` |
35
35
 
36
36
  ## How it works
@@ -83,8 +83,11 @@ On Windows the first two are in `%APPDATA%\gary`, the third is `%LOCALAPPDATA%\g
83
83
  `@quantis-ai/gary` is the `gary` command (a few lines of Node that run the binary); `@quantis-ai/gary-<os>-<arch>`
84
84
  (`darwin`, `linux` and `win32`, each `arm64` and `x64`) holds each platform's binary, and npm installs only the one whose `os` and `cpu` match, as esbuild's packages do.
85
85
  `gary setup` copies the binary the service runs to `~/.local/share/gary/` (not on PATH, so it doesn't shadow npm's
86
- `gary`); after `npm update -g @quantis-ai/gary`, run `gary setup` again, and `gary status` says when the service
87
- still runs an older version.
86
+ `gary`). `gary update` works as Codex's and Gemini CLI's updates do: the launcher tells which package manager the
87
+ install belongs to by where it is, and gary runs that one's command (`npm install -g`, `pnpm add -g`, `bun add -g`
88
+ of `@quantis-ai/gary@<newest>`), then refreshes that copy once the `gary` command starts the new version. It runs
89
+ nothing when the npm on PATH belongs to another Node (it would install a second gary), and says the command instead.
90
+ After updating by hand, run `gary setup` again; `gary status` says when the service still runs an older version.
88
91
 
89
92
  ```bash
90
93
  make dist VERSION=0.1.0 && node npm/build.js 0.1.0 # npm/out/0.1.0/*.tgz, nothing published
package/bin/gary.js CHANGED
@@ -34,8 +34,29 @@ try {
34
34
  process.exit(1);
35
35
  }
36
36
 
37
- // GARY_NPM tells `gary setup` it came from npm, so it says how to update.
38
- const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit", env: { ...process.env, GARY_NPM: "1" } });
37
+ // Which package manager this install belongs to, told by where it is (as Gemini CLI and Codex do): each keeps
38
+ // its global packages in a place of its own. `gary update` runs that one's command.
39
+ function packageManager() {
40
+ const where = [__dirname, path.resolve(process.argv[1] || "")].map((p) => p.replace(/\\/g, "/"));
41
+ const has = (...parts) => where.some((p) => parts.some((part) => p.includes(part)));
42
+ if (has("/_npx/", "/pnpm/dlx/", "/.bun/install/cache/")) return "npx";
43
+ if (has("/.volta/", "/Volta/")) return "volta";
44
+ if (has("/node_modules/.pnpm/", "/pnpm/global/")) return "pnpm";
45
+ if (has("/install/global/node_modules/")) return "bun"; // <BUN_INSTALL>/install/global, ~/.bun unless moved
46
+ if (has("/.yarn/global/", "/yarn/global/")) return "yarn";
47
+ return "npm";
48
+ }
49
+
50
+ // GARY_NPM tells gary it came from a package manager, GARY_PACKAGE_MANAGER which one, and GARY_NPM_LAUNCHER and
51
+ // GARY_NODE how it was started, so `gary update` finds the binary the update put in.
52
+ const env = {
53
+ ...process.env,
54
+ GARY_NPM: "1",
55
+ GARY_PACKAGE_MANAGER: packageManager(),
56
+ GARY_NPM_LAUNCHER: path.resolve(process.argv[1] || __filename),
57
+ GARY_NODE: process.execPath,
58
+ };
59
+ const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit", env });
39
60
  if (r.error) {
40
61
  console.error(`gary: ${r.error.message}`);
41
62
  process.exit(1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quantis-ai/gary",
3
3
  "description": "Connects this computer to your Gary, so your Garys can work in the directories you share here.",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://docs.getquantis.com",
7
7
  "author": "QUANTIS",
@@ -16,11 +16,11 @@
16
16
  "node": ">=18"
17
17
  },
18
18
  "optionalDependencies": {
19
- "@quantis-ai/gary-darwin-arm64": "0.3.1",
20
- "@quantis-ai/gary-darwin-x64": "0.3.1",
21
- "@quantis-ai/gary-linux-arm64": "0.3.1",
22
- "@quantis-ai/gary-linux-x64": "0.3.1",
23
- "@quantis-ai/gary-win32-arm64": "0.3.1",
24
- "@quantis-ai/gary-win32-x64": "0.3.1"
19
+ "@quantis-ai/gary-darwin-arm64": "0.3.2",
20
+ "@quantis-ai/gary-darwin-x64": "0.3.2",
21
+ "@quantis-ai/gary-linux-arm64": "0.3.2",
22
+ "@quantis-ai/gary-linux-x64": "0.3.2",
23
+ "@quantis-ai/gary-win32-arm64": "0.3.2",
24
+ "@quantis-ai/gary-win32-x64": "0.3.2"
25
25
  }
26
26
  }