subto 9.0.2 → 9.0.4
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 +253 -18
- package/dist/package/index.js +2 -2
- package/index.js +54 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,43 +1,278 @@
|
|
|
1
1
|
# Subto CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`subto` is the command-line client for Subto.One. It can:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- store your Subto API key locally
|
|
6
|
+
- request and poll remote website scans
|
|
7
|
+
- show your current account summary
|
|
8
|
+
- start a local interactive assistant for scan results
|
|
9
|
+
- upload sampled project files to the server for scanning
|
|
10
|
+
- run local AI analysis on a project without uploading it
|
|
11
|
+
- store a local OpenRouter key for local AI analysis
|
|
12
|
+
- push an AI key to a running server's internal endpoint
|
|
13
|
+
- fetch video diagnostics for a scan
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
6
18
|
npm install -g subto
|
|
7
19
|
```
|
|
8
20
|
|
|
9
|
-
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
subto login
|
|
25
|
+
subto account
|
|
26
|
+
subto scan https://example.com
|
|
27
|
+
subto scan https://example.com --wait
|
|
28
|
+
subto chat
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Global options
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
-V, --version
|
|
35
|
+
-v, --verbose
|
|
36
|
+
--debug
|
|
37
|
+
--chat
|
|
38
|
+
--no-auto-skip
|
|
39
|
+
--skip-prompt-ms <n>
|
|
40
|
+
--skip-countdown-ms <n>
|
|
41
|
+
--skip-force-ms <n>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `--verbose` prints extra HTTP logging.
|
|
45
|
+
- `--debug` prints request and response debugging details.
|
|
46
|
+
- `--chat` starts the interactive assistant without requiring a subcommand.
|
|
47
|
+
- `--no-auto-skip` and the `--skip-*` flags control the external-API auto-skip behavior used while polling scans.
|
|
48
|
+
|
|
49
|
+
## Commands
|
|
50
|
+
|
|
51
|
+
### `subto login`
|
|
52
|
+
|
|
53
|
+
Stores your Subto API key in `~/.subto/config.json`.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
subto login
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `subto account`
|
|
60
|
+
|
|
61
|
+
Shows your current account summary.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
subto account
|
|
65
|
+
subto account --json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Output includes:
|
|
69
|
+
|
|
70
|
+
- account name
|
|
71
|
+
- email
|
|
72
|
+
- account id
|
|
73
|
+
- API call count
|
|
74
|
+
- scan count
|
|
75
|
+
- member-since date
|
|
76
|
+
|
|
77
|
+
### `subto scan <url>`
|
|
10
78
|
|
|
79
|
+
Requests a remote scan for a URL via the Subto API.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
subto scan https://example.com
|
|
83
|
+
subto scan https://example.com --wait
|
|
84
|
+
subto scan https://example.com --no-wait
|
|
85
|
+
subto scan https://example.com --json
|
|
86
|
+
subto scan https://example.com --chat
|
|
11
87
|
```
|
|
12
|
-
|
|
13
|
-
|
|
88
|
+
|
|
89
|
+
Options:
|
|
90
|
+
|
|
91
|
+
- `--json` prints the raw JSON response.
|
|
92
|
+
- `--wait` polls until the scan finishes and prints progress.
|
|
93
|
+
- `--no-wait` returns immediately instead of polling.
|
|
94
|
+
- `--chat` opens the local interactive assistant after the scan completes.
|
|
95
|
+
|
|
96
|
+
If the server returns HTML instead of JSON, the CLI attempts to recover the `scanId` automatically. If it cannot, it saves the HTML response to a temporary file for inspection.
|
|
97
|
+
|
|
98
|
+
### `subto scan upload [dir]`
|
|
99
|
+
|
|
100
|
+
Uploads sampled files from a directory to the server and starts a scan.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
subto scan upload
|
|
104
|
+
subto scan upload .
|
|
105
|
+
subto scan upload ./my-project --wait
|
|
14
106
|
```
|
|
15
107
|
|
|
16
|
-
|
|
108
|
+
Options:
|
|
17
109
|
|
|
18
|
-
|
|
19
|
-
-----------------
|
|
110
|
+
- `--wait` polls until the remote analysis completes.
|
|
20
111
|
|
|
21
|
-
|
|
112
|
+
Behavior:
|
|
22
113
|
|
|
23
|
-
-
|
|
114
|
+
- respects `.subtoignore`
|
|
115
|
+
- always ignores `.env`
|
|
116
|
+
- uploads sampled snippets rather than full large files
|
|
117
|
+
- returns an `uploadId` and `scanId`
|
|
24
118
|
|
|
25
|
-
|
|
119
|
+
### `subto chat [scanId]`
|
|
26
120
|
|
|
27
|
-
|
|
28
|
-
- One pattern per line.
|
|
29
|
-
- Lines starting with `#` are comments.
|
|
30
|
-
- Patterns may be folder names (e.g. `node_modules`), file globs/partials (e.g. `*.lock`), or specific files (`secret.txt`). The uploader uses simple matching: exact token, prefix, contains `/token`, or endsWith token. Examples:
|
|
121
|
+
Starts the local interactive assistant for a scan.
|
|
31
122
|
|
|
123
|
+
```bash
|
|
124
|
+
subto chat
|
|
125
|
+
subto chat <scanId>
|
|
126
|
+
subto --chat
|
|
32
127
|
```
|
|
128
|
+
|
|
129
|
+
If you do not provide a `scanId`, the CLI prompts for either:
|
|
130
|
+
|
|
131
|
+
- a scan id
|
|
132
|
+
- a path to a JSON file containing saved scan data
|
|
133
|
+
|
|
134
|
+
The assistant can answer simple questions locally, and it will use a configured AI provider when one is available.
|
|
135
|
+
|
|
136
|
+
### `subto upload [dir]`
|
|
137
|
+
|
|
138
|
+
Runs local AI analysis on sampled project files without uploading them to the Subto server.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
subto upload
|
|
142
|
+
subto upload .
|
|
143
|
+
subto upload ./project --max-files 300 --max-bytes 5242880
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Options:
|
|
147
|
+
|
|
148
|
+
- `--max-files <n>` limits the number of files included.
|
|
149
|
+
- `--max-bytes <n>` limits the total bytes included.
|
|
150
|
+
|
|
151
|
+
Behavior:
|
|
152
|
+
|
|
153
|
+
- respects `.subtoignore`
|
|
154
|
+
- always ignores `.env`
|
|
155
|
+
- samples small files fully and large files partially
|
|
156
|
+
- sends only the generated prompt and file snippets to the configured AI provider
|
|
157
|
+
|
|
158
|
+
### `subto upload key [key]`
|
|
159
|
+
|
|
160
|
+
Stores a local OpenRouter API key and model in `~/.subto/config.json` for local AI analysis.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
subto upload key
|
|
164
|
+
subto upload key <openrouter-api-key>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
If no key is provided, the CLI prompts for one interactively, then prompts for a model.
|
|
168
|
+
|
|
169
|
+
### `subto server-set-ai-key [key]`
|
|
170
|
+
|
|
171
|
+
Pushes an AI provider key to a running server using the internal `/internal/set-ai-key` endpoint.
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
subto server-set-ai-key <key> --secret <internal-secret>
|
|
175
|
+
subto server-set-ai-key --server https://subto.one --secret <internal-secret>
|
|
176
|
+
subto server-set-ai-key --provider openai --model gpt-4o-mini --secret <internal-secret>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Options:
|
|
180
|
+
|
|
181
|
+
- `--server <url>` overrides the server host base.
|
|
182
|
+
- `--secret <secret>` sends the internal task secret header.
|
|
183
|
+
- `--provider <provider>` chooses `openrouter` or `openai`.
|
|
184
|
+
- `--model <model>` sets the requested model id.
|
|
185
|
+
|
|
186
|
+
If you omit the key argument, the CLI tries to use a locally stored key.
|
|
187
|
+
|
|
188
|
+
### `subto diag video <scanId>`
|
|
189
|
+
|
|
190
|
+
Fetches server-side video diagnostics for a scan and prints a summary.
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
subto diag video <scanId>
|
|
194
|
+
subto diag video <scanId> --server https://subto.one
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Options:
|
|
198
|
+
|
|
199
|
+
- `--server <url>` overrides the server host base.
|
|
200
|
+
|
|
201
|
+
## Configuration
|
|
202
|
+
|
|
203
|
+
The CLI stores local configuration in:
|
|
204
|
+
|
|
205
|
+
```text
|
|
206
|
+
~/.subto/config.json
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
This can include:
|
|
210
|
+
|
|
211
|
+
- your Subto API key
|
|
212
|
+
- a local OpenRouter key
|
|
213
|
+
- a local OpenRouter model
|
|
214
|
+
|
|
215
|
+
## Environment variables
|
|
216
|
+
|
|
217
|
+
### Subto endpoint
|
|
218
|
+
|
|
219
|
+
- `SUBTO_API_BASE_URL`
|
|
220
|
+
|
|
221
|
+
Accepted forms:
|
|
222
|
+
|
|
223
|
+
- `https://subto.one`
|
|
224
|
+
- `https://subto.one/`
|
|
225
|
+
- `https://subto.one/api/v1`
|
|
226
|
+
- `https://subto.one/api/v1/`
|
|
227
|
+
|
|
228
|
+
### Local AI analysis
|
|
229
|
+
|
|
230
|
+
- `OPENAI_API_KEY`
|
|
231
|
+
- `AI_API_KEY`
|
|
232
|
+
- `OPENROUTER_API_KEY`
|
|
233
|
+
- `AI_MODEL`
|
|
234
|
+
- `OPENAI_MODEL`
|
|
235
|
+
- `OPENROUTER_MODEL`
|
|
236
|
+
|
|
237
|
+
Provider behavior:
|
|
238
|
+
|
|
239
|
+
- the CLI prefers `OPENAI_API_KEY` or `AI_API_KEY` first
|
|
240
|
+
- if those are not set, it falls back to `OPENROUTER_API_KEY`
|
|
241
|
+
- if no environment key is set, it also checks `~/.subto/config.json` for a saved OpenRouter key
|
|
242
|
+
|
|
243
|
+
### Internal server key push
|
|
244
|
+
|
|
245
|
+
- `INTERNAL_TASK_SECRET`
|
|
246
|
+
- `X_INTERNAL_TASK_SECRET`
|
|
247
|
+
|
|
248
|
+
## `.subtoignore`
|
|
249
|
+
|
|
250
|
+
The upload commands support a `.subtoignore` file.
|
|
251
|
+
|
|
252
|
+
Rules:
|
|
253
|
+
|
|
254
|
+
- one pattern per line
|
|
255
|
+
- lines starting with `#` are comments
|
|
256
|
+
- `.env` is always ignored even if it is not listed
|
|
257
|
+
- matching is simple path matching, not full gitignore semantics
|
|
258
|
+
|
|
259
|
+
Examples:
|
|
260
|
+
|
|
261
|
+
```text
|
|
33
262
|
# ignore node modules and build artifacts
|
|
34
263
|
node_modules
|
|
35
264
|
dist
|
|
36
265
|
*.lock
|
|
37
|
-
|
|
266
|
+
|
|
267
|
+
# ignore a specific file
|
|
38
268
|
secret.txt
|
|
39
269
|
```
|
|
40
270
|
|
|
41
|
-
|
|
271
|
+
## Notes
|
|
272
|
+
|
|
273
|
+
- The CLI will also try to load `.env` from the CLI directory, the current working directory, and your home directory when `dotenv` is available.
|
|
274
|
+
- This package is a production CLI and intentionally omits development instructions.
|
|
275
|
+
|
|
276
|
+
## Security
|
|
42
277
|
|
|
43
|
-
|
|
278
|
+
Do not commit secrets. If sensitive keys are accidentally present, rotate them immediately. The local analysis flow attempts not to print secret values directly; it reports their presence and recommends remediation instead.
|
package/dist/package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const chalk = (_chalk && _chalk.default) ? _chalk.default : _chalk;
|
|
|
11
11
|
const CONFIG_DIR = path.join(os.homedir(), '.subto');
|
|
12
12
|
const CONFIG_PATH = path.join(CONFIG_DIR, 'config.json');
|
|
13
13
|
const DEFAULT_API_BASE = 'https://subto.one';
|
|
14
|
-
const CLIENT_META = { name: 'subto-cli', version: '9.0.
|
|
14
|
+
const CLIENT_META = { name: 'subto-cli', version: '9.0.3' };
|
|
15
15
|
|
|
16
16
|
function configFilePath() { return CONFIG_PATH; }
|
|
17
17
|
|
|
@@ -167,7 +167,7 @@ function printAccountSummary(payload) {
|
|
|
167
167
|
|
|
168
168
|
async function run(argv) {
|
|
169
169
|
const program = new Command();
|
|
170
|
-
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '9.0.
|
|
170
|
+
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '9.0.3');
|
|
171
171
|
|
|
172
172
|
program.command('login').description('Store your API key in ~/.subto/config.json').action(async () => {
|
|
173
173
|
try {
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const chalk = (_chalk && _chalk.default) ? _chalk.default : _chalk;
|
|
|
11
11
|
const CONFIG_DIR = path.join(os.homedir(), '.subto');
|
|
12
12
|
const CONFIG_PATH = path.join(CONFIG_DIR, 'config.json');
|
|
13
13
|
const DEFAULT_API_BASE = 'https://subto.one/api/v1';
|
|
14
|
-
const CLIENT_META = { name: 'subto-cli', version: '9.0.
|
|
14
|
+
const CLIENT_META = { name: 'subto-cli', version: '9.0.3' };
|
|
15
15
|
const cp = require('child_process');
|
|
16
16
|
|
|
17
17
|
// Normalize SUBTO API base so callers can set either
|
|
@@ -612,7 +612,59 @@ async function startChatREPL(scanData){
|
|
|
612
612
|
|
|
613
613
|
async function run(argv) {
|
|
614
614
|
const program = new Command();
|
|
615
|
-
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '9.0.
|
|
615
|
+
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '9.0.3');
|
|
616
|
+
program.addHelpText('after', `
|
|
617
|
+
|
|
618
|
+
Common commands:
|
|
619
|
+
subto login
|
|
620
|
+
Store your Subto API key in ~/.subto/config.json.
|
|
621
|
+
|
|
622
|
+
subto account
|
|
623
|
+
subto account --json
|
|
624
|
+
Show your account name, email, API call count, scan count, and member-since date.
|
|
625
|
+
|
|
626
|
+
subto scan <url>
|
|
627
|
+
subto scan <url> --wait
|
|
628
|
+
subto scan <url> --no-wait
|
|
629
|
+
subto scan <url> --json
|
|
630
|
+
subto scan <url> --chat
|
|
631
|
+
Request a remote scan for a URL. Polling happens automatically when the server queues the scan unless you pass --no-wait.
|
|
632
|
+
|
|
633
|
+
subto scan upload [dir]
|
|
634
|
+
subto scan upload [dir] --wait
|
|
635
|
+
Upload sampled files from a directory to the server and create a scan. Respects .subtoignore and always ignores .env.
|
|
636
|
+
|
|
637
|
+
subto chat [scanId]
|
|
638
|
+
subto --chat
|
|
639
|
+
Start the local interactive assistant for an existing scan, or prompt for a scan id / JSON file.
|
|
640
|
+
|
|
641
|
+
subto upload [dir]
|
|
642
|
+
subto upload [dir] --max-files 300 --max-bytes 5242880
|
|
643
|
+
Run local AI analysis on sampled project files without uploading them to the Subto server.
|
|
644
|
+
|
|
645
|
+
subto upload key
|
|
646
|
+
subto upload key <openrouter-api-key>
|
|
647
|
+
Store a local OpenRouter key and model in ~/.subto/config.json for local AI analysis.
|
|
648
|
+
|
|
649
|
+
subto server-set-ai-key [key] --secret <internal-secret>
|
|
650
|
+
Push an AI provider key to a running server via /internal/set-ai-key.
|
|
651
|
+
|
|
652
|
+
subto diag video <scanId>
|
|
653
|
+
Fetch server-side video debug details for a scan and print a summary.
|
|
654
|
+
|
|
655
|
+
Environment:
|
|
656
|
+
SUBTO_API_BASE_URL Override the API base. Accepts either a host URL or an /api/v1 URL.
|
|
657
|
+
OPENAI_API_KEY Use OpenAI for local AI analysis.
|
|
658
|
+
AI_API_KEY Alternate name for OPENAI_API_KEY.
|
|
659
|
+
OPENROUTER_API_KEY Use OpenRouter for local AI analysis.
|
|
660
|
+
AI_MODEL Override the model used for local AI analysis.
|
|
661
|
+
INTERNAL_TASK_SECRET Default secret for subto server-set-ai-key.
|
|
662
|
+
|
|
663
|
+
Notes:
|
|
664
|
+
- The CLI stores config in ~/.subto/config.json.
|
|
665
|
+
- The CLI will also load .env from the CLI directory, the current working directory, and your home directory when dotenv is available.
|
|
666
|
+
- Use subto help <command> for command-specific usage.
|
|
667
|
+
`);
|
|
616
668
|
program.option('-v, --verbose', 'Show verbose HTTP logs');
|
|
617
669
|
program.option('--debug', 'Show debug HTTP headers and responses');
|
|
618
670
|
program.option('--chat', 'Start local AI assistant (no command required)');
|