@scalequality/cli 0.1.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 +96 -0
- package/bin/scalequality.mjs +50 -0
- package/dist/connect.build.json +5 -0
- package/dist/connect.cjs +6273 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @scalequality/cli
|
|
2
|
+
|
|
3
|
+
Run the ScaleQuality AI Workspace coding engine on your own machine, in your
|
|
4
|
+
repository folder. The conversation stays in the browser; the files, the
|
|
5
|
+
commands and the git working tree stay on your computer.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd path/to/your/repository
|
|
9
|
+
npx @scalequality/cli connect <code>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Get the command, with its code, in the AI Workspace: choose **Use a folder on
|
|
13
|
+
your computer**. The code opens only that session; treat it like a password.
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
|
|
17
|
+
| Flag | Default | Meaning |
|
|
18
|
+
|------|---------|---------|
|
|
19
|
+
| `--dir PATH` | current folder | The repository folder to work in |
|
|
20
|
+
| `--api URL` | `https://app.scalequality.io` | ScaleQuality address (for example `https://staging.scalequality.io`) |
|
|
21
|
+
| `--verbose` | off | Also print diagnostic logs |
|
|
22
|
+
|
|
23
|
+
Requires Node.js 18 or newer and git. The folder must be the root of a git
|
|
24
|
+
repository; the CLI never runs `git init`, clones or fetches for you.
|
|
25
|
+
|
|
26
|
+
## What runs where
|
|
27
|
+
|
|
28
|
+
On your machine:
|
|
29
|
+
|
|
30
|
+
- the coding engine (Claude Agent SDK), reading and editing files **only inside
|
|
31
|
+
the folder**;
|
|
32
|
+
- the commands it wants to run, **each one after you allow it** in the
|
|
33
|
+
terminal;
|
|
34
|
+
- the diff of your folder against `HEAD` at connect time, which is what the
|
|
35
|
+
browser shows and what a pull request carries.
|
|
36
|
+
|
|
37
|
+
In ScaleQuality:
|
|
38
|
+
|
|
39
|
+
- the session, the conversation and every approval card;
|
|
40
|
+
- the model, through the ScaleQuality AI gateway of your organization;
|
|
41
|
+
- ScaleQuality tools (measurements, findings, agents);
|
|
42
|
+
- pull requests: the changed files are sent to ScaleQuality, which opens the
|
|
43
|
+
pull request with your organization's repository connection after you approve
|
|
44
|
+
it in the browser. Your machine never needs a provider token and never pushes.
|
|
45
|
+
|
|
46
|
+
Measuring uncommitted local changes (`measure_change`) runs only in the cloud
|
|
47
|
+
workspace, where the scanners are; open a pull request to have the change
|
|
48
|
+
measured.
|
|
49
|
+
|
|
50
|
+
The engine never pushes, never changes git remotes or credentials, and cannot
|
|
51
|
+
read credential stores such as `~/.ssh`, `~/.aws`, `~/.netrc`, your home
|
|
52
|
+
`.npmrc` or the system keychain. Your shell environment is not passed through:
|
|
53
|
+
only a fixed list of variables (PATH, HOME, locale, toolchain locations, proxies
|
|
54
|
+
and CA settings) reaches the engine and its commands.
|
|
55
|
+
|
|
56
|
+
## Permission prompts
|
|
57
|
+
|
|
58
|
+
Before any command runs you see it in the terminal:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
The workspace wants to run a command in /home/you/repo
|
|
62
|
+
model's description: Run the tests
|
|
63
|
+
$ npm test
|
|
64
|
+
y run once a always allow this exact command in this folder n deny
|
|
65
|
+
>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `y` runs it once.
|
|
69
|
+
- `a` allows that exact command, in this folder, until you disconnect.
|
|
70
|
+
- `n` denies it; you can type a reason, which the model receives.
|
|
71
|
+
|
|
72
|
+
Pressing Enter alone never approves. File edits are not asked: they are shown
|
|
73
|
+
in the browser as they happen, and each file can be discarded there.
|
|
74
|
+
|
|
75
|
+
## Stopping
|
|
76
|
+
|
|
77
|
+
- `Ctrl+C` once stops the current request (a pending command is denied).
|
|
78
|
+
- `Ctrl+C` again disconnects, after saving the session's checkpoint. Your
|
|
79
|
+
folder keeps every change.
|
|
80
|
+
- Closing the session in the browser also ends the command.
|
|
81
|
+
|
|
82
|
+
## For maintainers
|
|
83
|
+
|
|
84
|
+
`dist/connect.cjs` is built in the ScaleQuality ai-governance service from
|
|
85
|
+
`src/main/workspace-connect.ts`:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# in scalequality-ai-governance-service
|
|
89
|
+
npm run build:cli # -> dist-cli/connect.cjs
|
|
90
|
+
# here (scalequality-cli/connect)
|
|
91
|
+
npm run sync # copies it into dist/, or: npm run sync -- --from <dist-cli folder>
|
|
92
|
+
npm test
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`sync` refuses a bundle built for a different `@anthropic-ai/claude-agent-sdk`
|
|
96
|
+
version than the one in `package.json`.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ScaleQuality CLI. The engine of `connect` is built in the ScaleQuality
|
|
3
|
+
// ai-governance service (src/main/workspace-connect.ts) and copied into
|
|
4
|
+
// dist/connect.cjs by `npm run sync`.
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
|
|
9
|
+
const require = createRequire(import.meta.url)
|
|
10
|
+
const pkg = JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8'))
|
|
11
|
+
const engine = fileURLToPath(new URL('../dist/connect.cjs', import.meta.url))
|
|
12
|
+
|
|
13
|
+
const HELP = `ScaleQuality CLI ${pkg.version}
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
scalequality connect <code> [--api URL] [--dir PATH]
|
|
17
|
+
Work on this repository folder from the ScaleQuality AI Workspace.
|
|
18
|
+
Get the command with its code in the AI Workspace: "Use a folder on your computer".
|
|
19
|
+
scalequality --help
|
|
20
|
+
scalequality --version
|
|
21
|
+
|
|
22
|
+
Run "scalequality connect --help" for the options of connect.`
|
|
23
|
+
|
|
24
|
+
const [command] = process.argv.slice(2)
|
|
25
|
+
|
|
26
|
+
if (!command || command === '--help' || command === '-h' || command === 'help') {
|
|
27
|
+
process.stdout.write(`${HELP}\n`)
|
|
28
|
+
process.exit(command ? 0 : 2)
|
|
29
|
+
}
|
|
30
|
+
if (command === '--version' || command === '-v' || command === 'version') {
|
|
31
|
+
process.stdout.write(`${pkg.version}\n`)
|
|
32
|
+
process.exit(0)
|
|
33
|
+
}
|
|
34
|
+
if (command !== 'connect') {
|
|
35
|
+
process.stderr.write(`Unknown command: ${command}\n\n${HELP}\n`)
|
|
36
|
+
process.exit(2)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const major = Number(process.versions.node.split('.')[0])
|
|
40
|
+
if (major < 18) {
|
|
41
|
+
process.stderr.write(`ScaleQuality CLI needs Node.js 18 or newer (this is ${process.versions.node}).\n`)
|
|
42
|
+
process.exit(1)
|
|
43
|
+
}
|
|
44
|
+
if (!existsSync(engine)) {
|
|
45
|
+
process.stderr.write('This installation of @scalequality/cli is incomplete (dist/connect.cjs is missing). Reinstall it, or run npm run sync in a checkout.\n')
|
|
46
|
+
process.exit(1)
|
|
47
|
+
}
|
|
48
|
+
process.env.SCALEQUALITY_CLI_VERSION = pkg.version
|
|
49
|
+
// The engine reads process.argv itself: [node, this file, 'connect', <code>, ...options].
|
|
50
|
+
require(engine)
|