@quantis-ai/gary 0.1.0 → 0.2.1
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 +58 -12
- package/bin/gary.js +5 -2
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
# gary CLI
|
|
2
2
|
|
|
3
|
-
Connects a person's Linux or
|
|
4
|
-
there
|
|
5
|
-
connection; nothing ever connects in to the
|
|
3
|
+
Connects a person's Linux, macOS or Windows computer to their Gary. Their Garys work in the directories they share
|
|
4
|
+
there (list, search, read and write files, run commands and git), and in a computer of their own that `gary` runs on
|
|
5
|
+
the machine in Docker. Like `cloudflared`, it dials out and holds one connection; nothing ever connects in to the
|
|
6
|
+
computer.
|
|
6
7
|
|
|
7
8
|
```bash
|
|
8
9
|
npm install -g @quantis-ai/gary # or: curl -fsSL https://chat.getquantis.com/cli/install.sh | bash
|
|
9
|
-
gary install # signs in, starts the service
|
|
10
|
+
gary install # signs in, starts the service and Gary's computer
|
|
10
11
|
gary dir add ~/projects # share a directory (--read-only to only read)
|
|
11
12
|
gary status
|
|
12
13
|
```
|
|
13
14
|
|
|
15
|
+
On Windows, in PowerShell:
|
|
16
|
+
|
|
17
|
+
```powershell
|
|
18
|
+
irm https://chat.getquantis.com/cli/install.ps1 | iex
|
|
19
|
+
```
|
|
20
|
+
|
|
14
21
|
| Command | What it does |
|
|
15
22
|
|---|---|
|
|
16
|
-
| `gary install` | Copies gary to `~/.local/bin`, signs in if needed, and runs it in the background: a systemd user unit on Linux (lingering on, so it keeps running after logout), a launchd agent on macOS |
|
|
23
|
+
| `gary install` | Copies gary to `~/.local/bin`, signs in if needed, and runs it in the background: a systemd user unit on Linux (lingering on, so it keeps running after logout), a launchd agent on macOS, a Scheduled Task at logon on Windows. Starts Gary's computer when Docker is installed; warns and carries on when it isn't |
|
|
17
24
|
| `gary login` | Signs this computer in: prints a link to open where you're signed in to Gary, and waits for you to approve it |
|
|
18
|
-
| `gary status` | Signed in or not, connected or not (and why not), and the directories shared |
|
|
25
|
+
| `gary status` | Signed in or not, connected or not (and why not, in QUANTIS's own words when it refuses the account), Gary's computer (running, stopped, image not downloaded, or no Docker; its image and version; whether a newer gary or image is out), and the directories shared |
|
|
19
26
|
| `gary dir add [path]` | Shares a directory, this one by default. `--read-only`: Gary can read it, not change it or run commands in it. `--name`: what Gary calls it |
|
|
20
27
|
| `gary dir list` / `gary dir remove <path\|name>` | The directories shared; stop sharing one |
|
|
21
28
|
| `gary tasks` | What your Garys did on this computer (newest last), and the commands running now; `gary tasks stop <id>` stops one |
|
|
22
|
-
| `gary
|
|
29
|
+
| `gary update` | Installs the newest gary (when installed by the script; with npm it says the two commands to run), downloads the newest image of Gary's computer, and starts the computer again on it. Its files are kept. Running it again changes nothing |
|
|
30
|
+
| `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` |
|
|
23
31
|
|
|
24
32
|
## How it works
|
|
25
33
|
|
|
@@ -32,12 +40,28 @@ answers inside the shared directories. Approvals, audit and limits are the bridg
|
|
|
32
40
|
written in a `.git` folder.
|
|
33
41
|
- A write names the version it replaces, so a file changed since Gary read it isn't overwritten; the replaced bytes
|
|
34
42
|
are kept 30 days in `~/.local/state/gary/undo/`.
|
|
35
|
-
- Commands run `bash -lc` as you, in a shared directory, in their own process group,
|
|
36
|
-
(120 s by default, 600 s at most). Gary asks you before each one.
|
|
43
|
+
- Commands run `bash -lc` as you (Windows PowerShell on Windows), in a shared directory, in their own process group,
|
|
44
|
+
killed whole at their time limit (120 s by default, 600 s at most). Gary asks you before each one.
|
|
37
45
|
- git runs without a shell, hooks off, at the shared directory's top, under the same rule the platform checks
|
|
38
46
|
(`gitrule_test.go` holds the daemon to the platform's own answers).
|
|
39
47
|
- What Gary did is logged on this computer only, in `~/.local/state/gary/activity.jsonl`, commands' text included.
|
|
40
48
|
|
|
49
|
+
## Gary's computer
|
|
50
|
+
|
|
51
|
+
A Docker container, `gary-computer`, from QUANTIS's image `ahartpence/gary` at this gary's version. It gives a Gary a
|
|
52
|
+
computer and browser of its own on the person's machine, apart from the person's files.
|
|
53
|
+
|
|
54
|
+
- Needs Docker: Docker Desktop on macOS and Windows, Docker Engine on Linux. Without it `gary install` prints a
|
|
55
|
+
warning that says what to download, and finishes; everything else works.
|
|
56
|
+
- Its home is the Docker volume `gary-home` (`/home` in the container), kept when the container is made again.
|
|
57
|
+
- It sees nothing of the person's but the directories shared with `gary dir add`, each at `/shared/<name>`, read-only
|
|
58
|
+
when shared read-only. Sharing or unsharing a directory starts the computer again so it sees the change.
|
|
59
|
+
- No port is published and nothing connects in. Gary reaches it through the daemon, which runs each op there with
|
|
60
|
+
`docker exec` as an ordinary user, never root.
|
|
61
|
+
- To Gary it is the folder `computer`: the same list, search, read, write, exec and git as a shared directory, held
|
|
62
|
+
inside Gary's own home there. A command there is ended whole at its time limit.
|
|
63
|
+
- `GARY_IMAGE` runs another image (a local build); `gary update` gets the newest.
|
|
64
|
+
|
|
41
65
|
## Files
|
|
42
66
|
|
|
43
67
|
| Path | What |
|
|
@@ -45,11 +69,15 @@ answers inside the shared directories. Approvals, audit and limits are the bridg
|
|
|
45
69
|
| `~/.config/gary/config.json` | This computer's name and id, and the directories shared |
|
|
46
70
|
| `~/.config/gary/credentials.json` | This computer's token (mode 0600). It reaches only the bridge; forget the computer on Gary's Computer sheet to revoke it |
|
|
47
71
|
| `~/.local/state/gary/` | The control socket, the activity log, undo copies, and on macOS the daemon's log |
|
|
72
|
+
| Docker volume `gary-home` | The files in Gary's computer |
|
|
73
|
+
|
|
74
|
+
On Windows the first two are in `%APPDATA%\gary`, the third is `%LOCALAPPDATA%\gary`, and the binary is
|
|
75
|
+
`%LOCALAPPDATA%\Programs\gary\gary.exe`.
|
|
48
76
|
|
|
49
77
|
## npm
|
|
50
78
|
|
|
51
79
|
`@quantis-ai/gary` is the `gary` command (a few lines of Node that run the binary); `@quantis-ai/gary-<os>-<arch>`
|
|
52
|
-
holds each platform's binary, and npm installs only the one whose `os` and `cpu` match, as esbuild's packages do.
|
|
80
|
+
(`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.
|
|
53
81
|
`gary install` copies the binary the service runs to `~/.local/share/gary/` (not on PATH, so it doesn't shadow npm's
|
|
54
82
|
`gary`); after `npm update -g @quantis-ai/gary`, run `gary install` again, and `gary status` says when the service
|
|
55
83
|
still runs an older version.
|
|
@@ -58,12 +86,30 @@ still runs an older version.
|
|
|
58
86
|
make dist VERSION=0.1.0 && node npm/build.js 0.1.0 # npm/out/0.1.0/*.tgz, nothing published
|
|
59
87
|
```
|
|
60
88
|
|
|
89
|
+
### Releasing
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
make release 0.2.1 # or: make release VERSION=0.2.1
|
|
93
|
+
DRY_RUN=1 make release 0.2.1 # everything but the publishing (npm publish --dry-run)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`make release` (`npm/release.sh`) checks the tree is clean, HEAD is on `origin/main` and you're signed in to npm,
|
|
97
|
+
runs `make test`, builds `dist/` and the npm packages, checks this computer's binary says the version, then publishes
|
|
98
|
+
the six platform packages and `@quantis-ai/gary` last, so the main package never names one that isn't there. npm asks
|
|
99
|
+
for 2FA on each. A package already on npm at that version is skipped, so after a refused 2FA, run the same command
|
|
100
|
+
again and it carries on. `ALLOW_UNMERGED=1` releases a commit that isn't on `origin/main` yet. It doesn't publish the
|
|
101
|
+
image of Gary's computer (`ahartpence/gary`, from the gary repo); without a tag for the version the CLI uses `:latest`.
|
|
102
|
+
|
|
61
103
|
## Building
|
|
62
104
|
|
|
63
105
|
```bash
|
|
64
|
-
make test # go vet, and the tests with the race detector
|
|
65
|
-
make dist VERSION=0.1.0 # dist/0.1.0/gary-{linux,darwin}-{amd64,arm64}, checksums.txt
|
|
106
|
+
make test # go vet (for Windows too), and the tests with the race detector
|
|
107
|
+
make dist VERSION=0.1.0 # dist/0.1.0/gary-{linux,darwin,windows}-{amd64,arm64}, checksums.txt, version.txt, install.sh, install.ps1
|
|
66
108
|
GARY_SERVER=http://127.0.0.1:18300 ./gary login # against a local dev portal
|
|
67
109
|
```
|
|
68
110
|
|
|
111
|
+
No test runs Docker: the tests put a stand-in where the `docker` program would be, by hand and never through `PATH`,
|
|
112
|
+
and run the container's helper (`computer_helper.py`) with this machine's `python3` against a temp folder. Nothing
|
|
113
|
+
here runs on Windows; `make test` only checks that the Windows build compiles and vets.
|
|
114
|
+
|
|
69
115
|
Prior art: exeora (github.com/leynier/exeora), for the shape of the connection. None of its code is used.
|
package/bin/gary.js
CHANGED
|
@@ -11,18 +11,21 @@ const platforms = {
|
|
|
11
11
|
"darwin-x64": "@quantis-ai/gary-darwin-x64",
|
|
12
12
|
"linux-arm64": "@quantis-ai/gary-linux-arm64",
|
|
13
13
|
"linux-x64": "@quantis-ai/gary-linux-x64",
|
|
14
|
+
"win32-arm64": "@quantis-ai/gary-win32-arm64",
|
|
15
|
+
"win32-x64": "@quantis-ai/gary-win32-x64",
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
const key = `${process.platform}-${process.arch}`;
|
|
17
19
|
const pkg = platforms[key];
|
|
18
20
|
if (!pkg) {
|
|
19
|
-
console.error(`gary runs on Linux and
|
|
21
|
+
console.error(`gary runs on Linux, macOS and Windows (x64 and arm64), not ${key}.`);
|
|
20
22
|
process.exit(1);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
let bin;
|
|
24
26
|
try {
|
|
25
|
-
|
|
27
|
+
const file = process.platform === "win32" ? "gary.exe" : "gary";
|
|
28
|
+
bin = path.join(path.dirname(require.resolve(`${pkg}/package.json`)), "bin", file);
|
|
26
29
|
} catch {
|
|
27
30
|
console.error(
|
|
28
31
|
`gary: ${pkg} isn't installed. npm skips it when optional dependencies are turned off ` +
|
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.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://docs.getquantis.com",
|
|
7
7
|
"author": "QUANTIS",
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
"node": ">=18"
|
|
17
17
|
},
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"@quantis-ai/gary-darwin-arm64": "0.1
|
|
20
|
-
"@quantis-ai/gary-darwin-x64": "0.1
|
|
21
|
-
"@quantis-ai/gary-linux-arm64": "0.1
|
|
22
|
-
"@quantis-ai/gary-linux-x64": "0.1
|
|
19
|
+
"@quantis-ai/gary-darwin-arm64": "0.2.1",
|
|
20
|
+
"@quantis-ai/gary-darwin-x64": "0.2.1",
|
|
21
|
+
"@quantis-ai/gary-linux-arm64": "0.2.1",
|
|
22
|
+
"@quantis-ai/gary-linux-x64": "0.2.1",
|
|
23
|
+
"@quantis-ai/gary-win32-arm64": "0.2.1",
|
|
24
|
+
"@quantis-ai/gary-win32-x64": "0.2.1"
|
|
23
25
|
}
|
|
24
26
|
}
|