@scalequality/cli 0.3.2 → 0.4.0

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 CHANGED
@@ -4,37 +4,87 @@ Run the ScaleQuality AI Workspace coding engine on your own machine, in your
4
4
  repository folders. The conversation stays in the browser; the files, the
5
5
  commands and the git working tree stay on your computer.
6
6
 
7
- ## Connect this computer (recommended)
7
+ ## Connect this computer
8
8
 
9
9
  ```bash
10
10
  npx @scalequality/cli login # prints a code; confirm it in ScaleQuality
11
- npx @scalequality/cli add ~/code/app # a folder the AI Workspace may use
12
- npx @scalequality/cli up # keep the computer connected
11
+ npx @scalequality/cli add ~/code/app # a folder the AI Workspace may use (or pick it in the browser)
13
12
  ```
14
13
 
15
14
  `login` prints a code and an address (`<ScaleQuality>/devices?code=XXXX-XXXX`).
16
15
  Open it while signed in to ScaleQuality and confirm the code; the computer is
17
- then yours, in that organization, and `login` goes on running `up`. Only
18
- confirm a code you started yourself.
16
+ then yours, in that organization. Only confirm a code you started yourself.
17
+
18
+ Right after that, `login` installs a **background service** that keeps the
19
+ computer connected, also after a restart. There is nothing to keep open.
19
20
 
20
21
  | Command | What it does |
21
22
  |---------|--------------|
22
- | `scalequality login [--api URL] [--name NAME] [--no-up]` | Connects this computer (device code, like signing in to a TV app). |
23
- | `scalequality up [--api URL] [--verbose]` | Keeps it connected: sessions started in the AI Workspace run here, in your folders. Ctrl+C disconnects. |
23
+ | `scalequality login [--api URL] [--name NAME]` | Connects this computer (device code, like signing in to a TV app) and installs the background service. |
24
24
  | `scalequality add [PATH]` | Adds a folder (default: the current one). Only folders inside your home folder, never the home folder itself. |
25
- | `scalequality logout [--api URL]` | Disconnects this computer in ScaleQuality and deletes the local credential. |
25
+ | `scalequality service status` | Whether the service is installed and running, what it runs and where it logs. |
26
+ | `scalequality service logs [--lines N]` | The last lines of its log (default 100). |
27
+ | `scalequality service install` | Installs it again, or updates it to the version you run. |
28
+ | `scalequality service start` | Starts it again (the same as `install`), for example after it stopped. |
29
+ | `scalequality service uninstall` | Stops and removes it. The computer stays paired but is not connected until you install it again. |
30
+ | `scalequality logout [--api URL]` | Stops and removes the service, disconnects this computer in ScaleQuality and deletes the local credential. |
31
+
32
+ Every command takes `--api URL` for another ScaleQuality address (for example
33
+ `https://staging.scalequality.io`); each address has its own credential and its
34
+ own service.
35
+
36
+ ### What runs in the background
37
+
38
+ `login` copies this package and its dependencies to
39
+ `~/.scalequality/cli/<version>/` (hard links when the disk allows, so it takes
40
+ no extra space) and registers a per-user service that runs
41
+ `node ~/.scalequality/cli/<version>/node_modules/@scalequality/cli/bin/scalequality.mjs up --service`
42
+ at logon. It never runs from the npx cache, and nothing needs administrator
43
+ rights:
44
+
45
+ | System | Service | Log |
46
+ |--------|---------|-----|
47
+ | macOS | LaunchAgent `~/Library/LaunchAgents/io.scalequality.cli.plist` (RunAtLoad, restarted if it stops unexpectedly), loaded with `launchctl bootstrap gui/<uid>` | `~/Library/Logs/ScaleQuality/scalequality.log` |
48
+ | Linux | systemd user unit `~/.config/systemd/user/scalequality.service` (`Restart=on-failure`) | `~/.local/state/scalequality/logs/scalequality.log` |
49
+ | Windows | Task at logon `ScaleQuality\CLI` (or, where a task cannot be created, a launcher in your Startup folder), started hidden | `%LOCALAPPDATA%\ScaleQuality\Logs\scalequality.log` |
50
+
51
+ On Linux the user service runs while you are logged in; `login` tells you when
52
+ `loginctl enable-linger $USER` is needed to keep it connected after you log out.
53
+ For another address, the names carry its host (for example
54
+ `io.scalequality.cli.staging-scalequality-io-1a2b3c`). The service gets the
55
+ `PATH` you had when you ran `login`, so sessions find git, npm and your
56
+ toolchains; run `scalequality service install` again after changing them.
57
+
58
+ Where a service cannot be installed (a device management profile blocks login
59
+ items, a Linux machine without a systemd user session), `login` says why and
60
+ keeps the computer connected in that terminal instead; keep it open.
61
+
62
+ ### How to disconnect
63
+
64
+ - `scalequality logout`: removes the service and the CLI copy, disconnects the
65
+ computer and deletes the credential.
66
+ - **Disconnect** in the AI Workspace: the service notices at its next poll,
67
+ deletes the credential, removes its own definition and stops.
68
+ - `scalequality service uninstall`: only stops and removes the service (the
69
+ computer stays paired).
26
70
 
27
71
  The credential is stored in `~/.scalequality/credentials.json`, readable only
28
72
  by you (mode 0600), one entry per ScaleQuality address; ScaleQuality keeps only
29
73
  its hash. It opens only this computer's queue: each session gets its own
30
- one-time secret, and no repository token is ever sent to your computer. You can
31
- also disconnect the computer from the AI Workspace.
74
+ one-time secret, and no repository token is ever sent to your computer.
32
75
 
33
- While `up` runs, the AI Workspace can:
76
+ ### What the AI Workspace can do while the computer is connected
34
77
 
35
78
  - start a session in one of your folders (at most 3 at once);
36
79
  - add a folder you pick there (it is checked here: it must exist, be inside
37
80
  your home folder and not be the home folder);
81
+ - show you your folders to pick one, only while the folder picker is open in
82
+ the browser: the subfolders of one folder of your home at a time (no files,
83
+ no hidden or system folders, links only while they stay inside the home) and
84
+ suggestions (git repositories under `~/GIT`, `~/code`, `~/projects`,
85
+ `~/Developer` and similar folders, 3 levels down, plus the folders of your
86
+ Claude Code and Codex conversations). Only folder names, their paths and the
87
+ `origin` remote of repositories are sent, without any user or password;
38
88
  - list your Claude Code (`~/.claude/projects`) and Codex (`~/.codex/sessions`)
39
89
  conversations, and import the ones you choose. Secrets (cloud keys, provider
40
90
  tokens, private keys, JWTs, connection strings, `password=`-style values) are
@@ -42,14 +92,14 @@ While `up` runs, the AI Workspace can:
42
92
  without them. Only text is imported; tool results are left out and each tool
43
93
  call becomes a one-line summary.
44
94
 
45
- ### What `up` counts to suggest an import
95
+ ### What the service counts to suggest an import
46
96
 
47
- When `up` starts, and then at most once every 6 hours while it runs, it counts
97
+ When the service starts, and then at most once every 6 hours while it runs, it counts
48
98
  the Claude Code and Codex conversations on this computer, so the AI Workspace
49
99
  can offer to import them. It reads the same files the import list reads
50
100
  (`~/.claude/projects/*/*.jsonl`, or `CLAUDE_CONFIG_DIR`; `~/.codex/sessions/**/rollout-*.jsonl`,
51
101
  or `CODEX_HOME`), at most the 500 most recent, each only up to its first
52
- message, and prints one line such as:
102
+ message, and writes one line to its log, such as:
53
103
 
54
104
  ```
55
105
  Found 28 Claude Code and 11 Codex conversations on this computer. You can import them from the browser.
@@ -64,30 +114,14 @@ A Claude Code conversation continued on the same computer and folder resumes
64
114
  from its own transcript: a copy without secrets is written into the engine's
65
115
  folder (`~/.scalequality/workspace`); the original file is never changed.
66
116
 
67
- Every command a session wants to run is confirmed in the terminal where `up`
68
- runs, one question at a time. Without a terminal (for example, `up` started in
69
- the background) those commands are denied.
70
-
71
- ## One session with a code
72
-
73
- ```bash
74
- cd path/to/your/repository
75
- npx @scalequality/cli connect <code>
76
- ```
77
-
78
- Get the command, with its code, in the AI Workspace: choose **Use a folder on
79
- your computer**. The code opens only that session; treat it like a password. No
80
- login is needed.
117
+ ## One session with a code (older screens)
81
118
 
82
- Options:
119
+ `scalequality connect <code>` still works for a one-time code from an older AI
120
+ Workspace screen: it runs one session in the current folder (`--dir PATH`,
121
+ `--api URL`, `--verbose`) and ends when you press Ctrl+C twice. It is not listed
122
+ in the help: `login` replaces it.
83
123
 
84
- | Flag | Default | Meaning |
85
- |------|---------|---------|
86
- | `--dir PATH` | current folder | The repository folder to work in |
87
- | `--api URL` | `https://app.scalequality.io` | ScaleQuality address (for example `https://staging.scalequality.io`) |
88
- | `--verbose` | off | Also print diagnostic logs |
89
-
90
- Requires Node.js 18 or newer and git. The folder must be the root of a git
124
+ Requires Node.js 18 or newer and git. A folder must be the root of a git
91
125
  repository; the CLI never runs `git init`, clones or fetches for you.
92
126
 
93
127
  ## What runs where
@@ -96,8 +130,8 @@ On your machine:
96
130
 
97
131
  - the coding engine (Claude Agent SDK), reading and editing files **only inside
98
132
  the folder**;
99
- - the commands it wants to run, **each one after you allow it** in the
100
- terminal;
133
+ - the commands it wants to run, **each one after you approve it in the
134
+ browser** (or after an "always allow" rule you created covers it);
101
135
  - the diff of your folder against `HEAD` at connect time, which is what the
102
136
  browser shows and what a pull request carries.
103
137
 
@@ -120,32 +154,39 @@ read credential stores such as `~/.ssh`, `~/.aws`, `~/.netrc`, your home
120
154
  only a fixed list of variables (PATH, HOME, locale, toolchain locations, proxies
121
155
  and CA settings) reaches the engine and its commands.
122
156
 
123
- ## Permission prompts
124
-
125
- Before any command runs you see it in the terminal:
126
-
127
- ```
128
- The workspace wants to run a command in /home/you/repo
129
- model's description: Run the tests
130
- $ npm test
131
- y run once a always allow this exact command in this folder n deny
132
- >
133
- ```
134
-
135
- - `y` runs it once.
136
- - `a` allows that exact command, in this folder, until you disconnect.
137
- - `n` denies it; you can type a reason, which the model receives.
138
-
139
- Pressing Enter alone never approves. File edits are not asked: they are shown
140
- in the browser as they happen, and each file can be discarded there.
141
-
142
- ## Stopping
143
-
144
- - `connect`: `Ctrl+C` once stops the current request (a pending command is
145
- denied); `Ctrl+C` again disconnects, after saving the session's checkpoint.
146
- - `up`: `Ctrl+C` saves every running session and disconnects the computer.
147
- - Your folder keeps every change. Closing the session in the browser also
148
- ends it here.
157
+ ## Approving commands
158
+
159
+ Before any command runs on your computer, the AI Workspace shows an approval
160
+ card in the browser with the command, the folder, why it asks and a suggested
161
+ rule:
162
+
163
+ - **Run once** runs it this time.
164
+ - **Always allow** stores a rule for this computer and folder, either the exact
165
+ command or a prefix such as `npm test*`, and runs it. A prefix never covers
166
+ anything chained, piped, substituted or redirected after it (`npm test && …`
167
+ is asked again), and never a shell, `sudo`, `npx` or inline code.
168
+ - **Deny** tells the model it did not run.
169
+
170
+ Publishing (`git push`, remotes, `gh`, `npm publish`, image pushes), remote
171
+ shells and copies, cloud and infrastructure CLIs and credential reads are never
172
+ remembered: each run is asked again, and what the workspace policy denies is
173
+ never offered at all. Rules are listed and deleted in the AI Workspace; a
174
+ deleted rule stops applying in running sessions right away.
175
+
176
+ A card nobody answers in 10 minutes is withdrawn and the command does not run;
177
+ stopping the request in the browser withdraws it too. File edits are not asked:
178
+ they show in the browser as they happen, and each file can be discarded there.
179
+
180
+ ## Troubleshooting
181
+
182
+ - `scalequality service status` and `scalequality service logs`.
183
+ - `scalequality up --verbose` runs the same loop in the terminal, with
184
+ diagnostic lines. It does not start while the service runs; stop the service
185
+ first (`scalequality service uninstall`, then `scalequality service install`
186
+ afterwards).
187
+ - Ctrl+C in `up`, or stopping the service, saves every running session first.
188
+ Your folder keeps every change; closing the session in the browser also ends
189
+ it on the computer.
149
190
 
150
191
  ## For maintainers
151
192
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- // ScaleQuality CLI. The engine of every command (connect, login, up, add,
3
- // logout) is built in the ScaleQuality ai-governance service
2
+ // ScaleQuality CLI. The engine of every command (login, add, service, logout,
3
+ // and the unlisted up and connect) is built in the ScaleQuality ai-governance service
4
4
  // (src/main/workspace-connect.ts) and copied into dist/connect.cjs by `npm run sync`.
5
5
  import { createRequire } from 'node:module'
6
6
  import { existsSync, readFileSync } from 'node:fs'
@@ -15,23 +15,25 @@ const HELP = `ScaleQuality CLI ${pkg.version}
15
15
  Usage:
16
16
  scalequality login [--api URL] [--name NAME]
17
17
  Connect this computer to your ScaleQuality account (you confirm a code in
18
- ScaleQuality), then keep it connected.
19
- scalequality up [--api URL]
20
- Keep this computer connected: the AI Workspace can run sessions in the
21
- folders you added and import your Claude Code and Codex conversations.
18
+ ScaleQuality). It then installs a background service that keeps this
19
+ computer connected, also after a restart.
22
20
  scalequality add [PATH]
23
21
  Add a folder (default: the current one) for the AI Workspace to use.
22
+ scalequality service <install|uninstall|status|logs>
23
+ The background service: reinstall it, remove it, see whether it runs,
24
+ read its log.
24
25
  scalequality logout [--api URL]
25
- Disconnect this computer and delete its local credential.
26
- scalequality connect <code> [--api URL] [--dir PATH]
27
- Work on this repository folder for one session, with a code from the AI
28
- Workspace ("Use a folder on your computer"). No login needed.
26
+ Stop and remove the background service, disconnect this computer and
27
+ delete its local credential.
29
28
  scalequality --help
30
29
  scalequality --version
31
30
 
32
- Run "scalequality <command> --help" for the options of a command.`
31
+ Commands the AI Workspace wants to run on this computer are approved in the
32
+ browser. Run "scalequality <command> --help" for the options of a command.`
33
33
 
34
- const COMMANDS = new Set(['connect', 'login', 'up', 'add', 'logout'])
34
+ // `up` (the loop the service runs, for troubleshooting) and `connect <code>`
35
+ // (one session by one-time code, kept for older screens) work but are not listed.
36
+ const COMMANDS = new Set(['connect', 'login', 'up', 'add', 'logout', 'service'])
35
37
  const [command] = process.argv.slice(2)
36
38
 
37
39
  if (!command || command === '--help' || command === '-h' || command === 'help') {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "sdkVersion": "0.3.281",
3
- "sha256": "a1f9403a8d595fc75180ebd2f750f879c1cf850f4fbf38052c281d8dbaa365a8",
4
- "sourceCommit": "2fdc9d6a48aaaf04ae5ae83702dcf30b64bfe628"
3
+ "sha256": "e6387aaa87dedbc6a119b7f0d9a10690acc966a76b5453a6f573efdc051f8c46",
4
+ "sourceCommit": "e37bac1d879b18a3094b9fdc9d813efa1f115280"
5
5
  }