@scalequality/cli 0.3.3 → 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,33 +4,76 @@ 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
@@ -49,14 +92,14 @@ While `up` runs, the AI Workspace can:
49
92
  without them. Only text is imported; tool results are left out and each tool
50
93
  call becomes a one-line summary.
51
94
 
52
- ### What `up` counts to suggest an import
95
+ ### What the service counts to suggest an import
53
96
 
54
- 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
55
98
  the Claude Code and Codex conversations on this computer, so the AI Workspace
56
99
  can offer to import them. It reads the same files the import list reads
57
100
  (`~/.claude/projects/*/*.jsonl`, or `CLAUDE_CONFIG_DIR`; `~/.codex/sessions/**/rollout-*.jsonl`,
58
101
  or `CODEX_HOME`), at most the 500 most recent, each only up to its first
59
- message, and prints one line such as:
102
+ message, and writes one line to its log, such as:
60
103
 
61
104
  ```
62
105
  Found 28 Claude Code and 11 Codex conversations on this computer. You can import them from the browser.
@@ -71,30 +114,14 @@ A Claude Code conversation continued on the same computer and folder resumes
71
114
  from its own transcript: a copy without secrets is written into the engine's
72
115
  folder (`~/.scalequality/workspace`); the original file is never changed.
73
116
 
74
- Every command a session wants to run is confirmed in the terminal where `up`
75
- runs, one question at a time. Without a terminal (for example, `up` started in
76
- the background) those commands are denied.
77
-
78
- ## One session with a code
79
-
80
- ```bash
81
- cd path/to/your/repository
82
- npx @scalequality/cli connect <code>
83
- ```
84
-
85
- Get the command, with its code, in the AI Workspace: choose **Use a folder on
86
- your computer**. The code opens only that session; treat it like a password. No
87
- login is needed.
117
+ ## One session with a code (older screens)
88
118
 
89
- 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.
90
123
 
91
- | Flag | Default | Meaning |
92
- |------|---------|---------|
93
- | `--dir PATH` | current folder | The repository folder to work in |
94
- | `--api URL` | `https://app.scalequality.io` | ScaleQuality address (for example `https://staging.scalequality.io`) |
95
- | `--verbose` | off | Also print diagnostic logs |
96
-
97
- 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
98
125
  repository; the CLI never runs `git init`, clones or fetches for you.
99
126
 
100
127
  ## What runs where
@@ -103,8 +130,8 @@ On your machine:
103
130
 
104
131
  - the coding engine (Claude Agent SDK), reading and editing files **only inside
105
132
  the folder**;
106
- - the commands it wants to run, **each one after you allow it** in the
107
- 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);
108
135
  - the diff of your folder against `HEAD` at connect time, which is what the
109
136
  browser shows and what a pull request carries.
110
137
 
@@ -127,32 +154,39 @@ read credential stores such as `~/.ssh`, `~/.aws`, `~/.netrc`, your home
127
154
  only a fixed list of variables (PATH, HOME, locale, toolchain locations, proxies
128
155
  and CA settings) reaches the engine and its commands.
129
156
 
130
- ## Permission prompts
131
-
132
- Before any command runs you see it in the terminal:
133
-
134
- ```
135
- The workspace wants to run a command in /home/you/repo
136
- model's description: Run the tests
137
- $ npm test
138
- y run once a always allow this exact command in this folder n deny
139
- >
140
- ```
141
-
142
- - `y` runs it once.
143
- - `a` allows that exact command, in this folder, until you disconnect.
144
- - `n` denies it; you can type a reason, which the model receives.
145
-
146
- Pressing Enter alone never approves. File edits are not asked: they are shown
147
- in the browser as they happen, and each file can be discarded there.
148
-
149
- ## Stopping
150
-
151
- - `connect`: `Ctrl+C` once stops the current request (a pending command is
152
- denied); `Ctrl+C` again disconnects, after saving the session's checkpoint.
153
- - `up`: `Ctrl+C` saves every running session and disconnects the computer.
154
- - Your folder keeps every change. Closing the session in the browser also
155
- 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.
156
190
 
157
191
  ## For maintainers
158
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": "08314a95264b9909caa6a812f0bba154465f35fb82a3ffb541fdaeb5c3b95ee5",
4
- "sourceCommit": "982edf3dc5d3c2e1473b4f13d0695caaed4eeaed"
3
+ "sha256": "e6387aaa87dedbc6a119b7f0d9a10690acc966a76b5453a6f573efdc051f8c46",
4
+ "sourceCommit": "e37bac1d879b18a3094b9fdc9d813efa1f115280"
5
5
  }