@stav-ai/cli 0.1.5 → 0.1.7
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 +26 -5
- package/dist/adapters/adapters.json +5 -0
- package/dist/adapters/hermes-managed/config.yaml +26 -0
- package/dist/adapters/index.js +119 -16
- package/dist/cli.js +5 -2
- package/dist/launch.js +14 -8
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ npx @stav-ai/cli launch dsh -- "run the tests"
|
|
|
11
11
|
npx @stav-ai/cli launch kilo
|
|
12
12
|
npx @stav-ai/cli launch copilot
|
|
13
13
|
npx @stav-ai/cli launch pi
|
|
14
|
+
npx @stav-ai/cli launch hermes
|
|
14
15
|
```
|
|
15
16
|
|
|
16
17
|
Always use the scoped name `@stav-ai/cli`. The unscoped `stav` package on npm
|
|
@@ -25,19 +26,22 @@ is not ours.
|
|
|
25
26
|
| `stav whoami` | Who you are, and which workspace |
|
|
26
27
|
| `stav workspace [<slug>]` | Show your workspaces, or choose one |
|
|
27
28
|
| `stav apps` | The apps this CLI can launch |
|
|
28
|
-
| `stav launch <app> [--model <id>] [--workspace <slug>] [--yes] [-- <app arguments>]` | Start an app on Stav |
|
|
29
|
+
| `stav launch <app> [--model <id>] [--workspace <slug>] [--yes] [--verbose] [-- <app arguments>]` | Start an app on Stav |
|
|
29
30
|
|
|
30
31
|
It launches **Claude Code** (`claude`), **Codex** (`codex`),
|
|
31
32
|
**DeepSeek Harness** (`dsh`), **Kilo Code** (`kilo`), the
|
|
32
|
-
**GitHub Copilot CLI** (`copilot`)
|
|
33
|
-
not installed, it offers to install it with
|
|
34
|
-
only if you say yes
|
|
33
|
+
**GitHub Copilot CLI** (`copilot`), **pi** (`pi`) and **Hermes Agent**
|
|
34
|
+
(`hermes`). If the app is not installed, it offers to install it with
|
|
35
|
+
`npm install -g` and does so only if you say yes (Hermes Agent is not on
|
|
36
|
+
npm: the CLI says where its installer is). With `--yes`, or with no terminal, it installs
|
|
35
37
|
nothing and prints the command instead.
|
|
36
38
|
|
|
37
39
|
## What `stav launch` does
|
|
38
40
|
|
|
39
41
|
1. Checks the app can be launched, and that your workspace has credits.
|
|
40
|
-
2. Shows what it will do, and asks once
|
|
42
|
+
2. Shows what it will do, and asks once: the workspace, the key, the model
|
|
43
|
+
and any warning about the app. `--verbose` shows every setting it gives
|
|
44
|
+
the app.
|
|
41
45
|
3. Makes an API key for the app, or uses the one it saved last time:
|
|
42
46
|
- a personal key, under your workspace's key policy; if that policy
|
|
43
47
|
refuses it and you are an owner or admin, a workspace key instead;
|
|
@@ -95,6 +99,23 @@ nothing and prints the command instead.
|
|
|
95
99
|
the model writes without asking. For one task without the chat screen,
|
|
96
100
|
give `-p "<task>"` after `--`.
|
|
97
101
|
|
|
102
|
+
Hermes Agent runs every turn in a background process that keeps the key it
|
|
103
|
+
started with, and reads a key saved in `~/.hermes/.env` before the
|
|
104
|
+
environment. So the CLI starts Hermes with a home of its own in
|
|
105
|
+
`~/.stav/hermes` (`HERMES_HOME`), one folder per API key, so a launch for
|
|
106
|
+
another workspace never uses the key of one still open; a new key starts an
|
|
107
|
+
empty folder. Sessions, memory
|
|
108
|
+
and skills there are kept apart from your own Hermes, and `~/.hermes` is
|
|
109
|
+
not read or changed.
|
|
110
|
+
Hermes takes the provider from a settings folder that ships with the CLI
|
|
111
|
+
(`HERMES_MANAGED_DIR`). That file holds no key and no address: every value
|
|
112
|
+
comes from the environment, and the key is only in `STAV_HERMES_API_KEY`.
|
|
113
|
+
The same file turns off the update check at GitHub and the free web search
|
|
114
|
+
fallback. Hermes runs the commands the model writes; those it does not
|
|
115
|
+
judge dangerous run without asking, and they can read
|
|
116
|
+
`STAV_HERMES_API_KEY` from their environment. For one task without the chat screen,
|
|
117
|
+
give `-z "<task>"` after `--`; then every command runs without asking.
|
|
118
|
+
|
|
98
119
|
The key is kept in your operating system's keychain, or in a file only you
|
|
99
120
|
can read when there is no keychain. Never in your project folder.
|
|
100
121
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# The Hermes Agent settings for `stav launch hermes-agent`.
|
|
2
|
+
#
|
|
3
|
+
# The Stav CLI points Hermes at this folder with HERMES_MANAGED_DIR (Hermes's
|
|
4
|
+
# administrator overlay, laid over its own config.yaml). Hermes expands each
|
|
5
|
+
# ${VAR} from the environment of the process only, so every value comes from
|
|
6
|
+
# what the CLI sets for this run. No secret is written here: the key is read
|
|
7
|
+
# from STAV_HERMES_API_KEY through key_env.
|
|
8
|
+
model:
|
|
9
|
+
provider: custom:stav-cli
|
|
10
|
+
default: ${STAV_HERMES_MODEL}
|
|
11
|
+
providers:
|
|
12
|
+
stav-cli:
|
|
13
|
+
api: ${STAV_HERMES_BASE_URL}
|
|
14
|
+
key_env: STAV_HERMES_API_KEY
|
|
15
|
+
transport: chat_completions
|
|
16
|
+
# Traffic that would not go through Stav: the daily update check at GitHub and
|
|
17
|
+
# the free third-party web search fallback.
|
|
18
|
+
updates:
|
|
19
|
+
check: false
|
|
20
|
+
web:
|
|
21
|
+
keyless_fallback: false
|
|
22
|
+
# Hermes runs each turn in a background process that keeps the key and model
|
|
23
|
+
# it started with. Let it end soon after the last window closes, so the next
|
|
24
|
+
# launch starts one with its own values.
|
|
25
|
+
gateway:
|
|
26
|
+
unmanaged_idle_exit_seconds: 5
|
package/dist/adapters/index.js
CHANGED
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
* provider from KILO_CONFIG_CONTENT, the GitHub Copilot CLI from its
|
|
12
12
|
* COPILOT_PROVIDER_* variables, and pi from a fixed provider extension
|
|
13
13
|
* shipped with the CLI (pi-stav-provider.js) whose values all come from the
|
|
14
|
-
* environment
|
|
14
|
+
* environment, and Hermes Agent from a fixed overlay folder shipped with the
|
|
15
|
+
* CLI (hermes-managed/), in a Hermes home of its own. The key goes only into the child's
|
|
15
16
|
* environment, never into its arguments or a file (R-20).
|
|
16
17
|
*
|
|
17
18
|
* adapters.json is byte-identical to the Stav API's
|
|
18
19
|
* app/services/launch_recipes/adapters.json (the admin endpoint checks
|
|
19
20
|
* recipes against it; a lockstep test pins the copy).
|
|
20
21
|
*/
|
|
22
|
+
import { createHash } from 'node:crypto';
|
|
21
23
|
import { promises as fs } from 'node:fs';
|
|
22
24
|
import os from 'node:os';
|
|
23
25
|
import path from 'node:path';
|
|
@@ -77,6 +79,7 @@ const claudeCode = {
|
|
|
77
79
|
: contextWindow === undefined && claudeNeedsWindow(model)
|
|
78
80
|
? ["CLAUDE_CODE_MAX_CONTEXT_TOKENS=<the model's largest context window in your workspace, read from Stav; a long chat then sends more tokens per turn before it is compacted>"]
|
|
79
81
|
: [];
|
|
82
|
+
const modelLine = model ? `model ${model}` : "Claude Code's own default model";
|
|
80
83
|
return {
|
|
81
84
|
program: 'claude',
|
|
82
85
|
args: [],
|
|
@@ -91,9 +94,10 @@ const claudeCode = {
|
|
|
91
94
|
describe: [
|
|
92
95
|
`ANTHROPIC_BASE_URL=${gatewayUrl}`,
|
|
93
96
|
'ANTHROPIC_AUTH_TOKEN=<the key, in the environment only>',
|
|
94
|
-
|
|
97
|
+
modelLine,
|
|
95
98
|
...describeWindow,
|
|
96
99
|
],
|
|
100
|
+
brief: [modelLine],
|
|
97
101
|
};
|
|
98
102
|
},
|
|
99
103
|
async conflicts(home = os.homedir(), cwd = process.cwd()) {
|
|
@@ -146,6 +150,7 @@ const codex = {
|
|
|
146
150
|
];
|
|
147
151
|
if (model)
|
|
148
152
|
args.push('-m', model);
|
|
153
|
+
const modelLine = model ? `model ${model}` : "Codex's own default model";
|
|
149
154
|
return {
|
|
150
155
|
program: 'codex',
|
|
151
156
|
args,
|
|
@@ -154,8 +159,9 @@ const codex = {
|
|
|
154
159
|
describe: [
|
|
155
160
|
`a "stav" model provider at ${base}, for this run only (your ~/.codex/config.toml is not changed)`,
|
|
156
161
|
'STAV_API_KEY=<the key, in the environment only>',
|
|
157
|
-
|
|
162
|
+
modelLine,
|
|
158
163
|
],
|
|
164
|
+
brief: [modelLine],
|
|
159
165
|
};
|
|
160
166
|
},
|
|
161
167
|
};
|
|
@@ -197,6 +203,9 @@ const deepseekHarness = {
|
|
|
197
203
|
: contextWindow === undefined && namedModel(model)
|
|
198
204
|
? "the model's largest context window in your workspace, read from Stav"
|
|
199
205
|
: `dsh's own context window guess (${DSH_DEFAULT_CONTEXT_WINDOW} tokens)`;
|
|
206
|
+
const modelLine = model ? `model ${model}` : 'model auto (your workspace\'s default Router)';
|
|
207
|
+
const noteLine = "note: dsh runs the commands the model writes without asking; DeepSeek's own SAFETY.md says to run it in a container or VM";
|
|
208
|
+
const taskLine = 'give the task after --, for example: stav launch deepseek-harness -- "run the tests"';
|
|
200
209
|
return {
|
|
201
210
|
program: 'dsh',
|
|
202
211
|
args: ['--profile', 'headless', '--patch', DSH_PATCH_FILE],
|
|
@@ -213,13 +222,14 @@ const deepseekHarness = {
|
|
|
213
222
|
describe: [
|
|
214
223
|
`the one-shot command dsh --profile headless, with a "stav-cli" model provider at ${base} for this run only (your ~/.dsh is not changed)`,
|
|
215
224
|
'STAV_DSH_API_KEY=<the key, in the environment only>',
|
|
216
|
-
|
|
225
|
+
modelLine,
|
|
217
226
|
describeWindow,
|
|
218
227
|
`at most ${DSH_MAX_TOKENS} output tokens per call`,
|
|
219
228
|
'DSH_TELEMETRY_MODE=DISABLED (no feedback uploads to DeepSeek)',
|
|
220
|
-
|
|
221
|
-
|
|
229
|
+
noteLine,
|
|
230
|
+
taskLine,
|
|
222
231
|
],
|
|
232
|
+
brief: [modelLine, noteLine, taskLine],
|
|
223
233
|
};
|
|
224
234
|
},
|
|
225
235
|
};
|
|
@@ -339,6 +349,9 @@ const kiloCode = {
|
|
|
339
349
|
: contextWindow === undefined && namedModel(model)
|
|
340
350
|
? "the model's largest context window in your workspace, read from Stav"
|
|
341
351
|
: `a context window of ${KILO_DEFAULT_CONTEXT} tokens (Kilo Code compacts the chat by it)`;
|
|
352
|
+
const modelLine = model ? `model ${model}` : "model auto (your workspace's default Router)";
|
|
353
|
+
const agentLine = 'an agent in your Kilo config with a model of its own stops with "Model not found" for this run: Stav is the only provider';
|
|
354
|
+
const noteLine = 'note: Kilo Code runs commands and edits files. It asks before most shell commands, unless your Kilo config allows them (Kilo writes bash: allow into a config file that existed before its first start)';
|
|
342
355
|
return {
|
|
343
356
|
program: 'kilo',
|
|
344
357
|
args: [],
|
|
@@ -354,15 +367,16 @@ const kiloCode = {
|
|
|
354
367
|
describe: [
|
|
355
368
|
`Kilo Code with a "${KILO_PROVIDER}" provider at ${base} as its only provider, for this run only (your ~/.config/kilo is not changed)`,
|
|
356
369
|
'STAV_KILO_API_KEY=<the key, in the environment only>',
|
|
357
|
-
|
|
370
|
+
modelLine,
|
|
358
371
|
describeWindow,
|
|
359
372
|
describePicker(picker.models, picker.dropped, ctx, '/models'),
|
|
360
373
|
`at most ${KILO_MAX_OUTPUT} output tokens per call`,
|
|
361
374
|
'KILO_TELEMETRY_LEVEL=off, KILO_DISABLE_SESSION_INGEST=1, KILO_DISABLE_SHARE=1 (no usage data or session uploads to Kilo)',
|
|
362
|
-
|
|
363
|
-
|
|
375
|
+
noteLine,
|
|
376
|
+
agentLine,
|
|
364
377
|
'run one task without the chat screen after --, for example: stav launch kilo-code -- run "fix the failing test". kilo run refuses the shell commands it would ask about; add --auto after run to allow them without asking',
|
|
365
378
|
],
|
|
379
|
+
brief: [modelLine, noteLine, agentLine],
|
|
366
380
|
};
|
|
367
381
|
},
|
|
368
382
|
};
|
|
@@ -401,6 +415,10 @@ const githubCopilot = {
|
|
|
401
415
|
};
|
|
402
416
|
if (routed)
|
|
403
417
|
env.COPILOT_PROVIDER_WIRE_MODEL = id;
|
|
418
|
+
const modelLine = routed
|
|
419
|
+
? `model ${id}${model ? '' : " (your workspace's default Router)"}, given to the CLI as ${COPILOT_ROUTER_MODEL}`
|
|
420
|
+
: `model ${id}`;
|
|
421
|
+
const noteLine = 'note: the Copilot CLI runs commands and edits files. It asks first unless you pass --allow-all-tools (COPILOT_ALLOW_ALL from your shell is removed for this run)';
|
|
404
422
|
return {
|
|
405
423
|
program: 'copilot',
|
|
406
424
|
args: [],
|
|
@@ -427,13 +445,12 @@ const githubCopilot = {
|
|
|
427
445
|
describe: [
|
|
428
446
|
`the Copilot CLI with Stav at ${base} as its model provider, for this run only (no provider settings are written to ~/.copilot)`,
|
|
429
447
|
'COPILOT_PROVIDER_API_KEY=<the key, in the environment only>',
|
|
430
|
-
|
|
431
|
-
? `model ${id}${model ? '' : " (your workspace's default Router)"}, given to the CLI as ${COPILOT_ROUTER_MODEL}`
|
|
432
|
-
: `model ${id}`,
|
|
448
|
+
modelLine,
|
|
433
449
|
'COPILOT_OFFLINE=true (no GitHub sign-in, telemetry, web tools, GitHub MCP server or auto-update)',
|
|
434
|
-
|
|
450
|
+
noteLine,
|
|
435
451
|
'run one task without the chat screen after --, for example: stav launch github-copilot -- -p "fix the failing test". -p cannot ask, so it refuses edits and commands; add --allow-tool or --allow-all-tools after the task to allow them without asking',
|
|
436
452
|
],
|
|
453
|
+
brief: [modelLine, noteLine],
|
|
437
454
|
};
|
|
438
455
|
},
|
|
439
456
|
};
|
|
@@ -473,6 +490,8 @@ const pi = {
|
|
|
473
490
|
: contextWindow === undefined && namedModel(model)
|
|
474
491
|
? "the model's largest context window in your workspace, read from Stav"
|
|
475
492
|
: `a context window of ${PI_DEFAULT_CONTEXT} tokens (pi compacts the chat by it)`;
|
|
493
|
+
const modelLine = model ? `model ${model}` : "model auto (your workspace's default Router)";
|
|
494
|
+
const noteLine = 'note: pi runs the commands the model writes without asking, and those commands can read STAV_PI_API_KEY from their environment; run it in a folder or container where that is safe';
|
|
476
495
|
return {
|
|
477
496
|
program: 'pi',
|
|
478
497
|
args: ['--extension', PI_EXTENSION_FILE, '--provider', PI_PROVIDER, '--model', id],
|
|
@@ -490,14 +509,15 @@ const pi = {
|
|
|
490
509
|
describe: [
|
|
491
510
|
`pi with a "${PI_PROVIDER}" provider at ${base}, loaded from a file that ships with the Stav CLI, for this run only (no provider settings are written to ~/.pi/agent)`,
|
|
492
511
|
'STAV_PI_API_KEY=<the key, in the environment only>',
|
|
493
|
-
|
|
512
|
+
modelLine,
|
|
494
513
|
describeWindow,
|
|
495
514
|
describePicker(picker.models, picker.dropped, ctx, '/model'),
|
|
496
515
|
`at most ${PI_MAX_TOKENS} output tokens per call`,
|
|
497
516
|
'PI_OFFLINE=1 (no model catalogue refresh or update check at pi.dev)',
|
|
498
|
-
|
|
517
|
+
noteLine,
|
|
499
518
|
'run one task without the chat screen after --, for example: stav launch pi -- -p "fix the failing test"',
|
|
500
519
|
],
|
|
520
|
+
brief: [modelLine, noteLine],
|
|
501
521
|
};
|
|
502
522
|
},
|
|
503
523
|
async conflicts(home = os.homedir(), cwd = process.cwd(), env = process.env, appArgs = []) {
|
|
@@ -535,13 +555,96 @@ const pi = {
|
|
|
535
555
|
return null;
|
|
536
556
|
},
|
|
537
557
|
};
|
|
538
|
-
|
|
558
|
+
/** The folder Hermes reads its fixed overlay from; built next to this module (npm run build copies it). */
|
|
559
|
+
export const HERMES_MANAGED_DIR = fileURLToPath(new URL('./hermes-managed/', import.meta.url));
|
|
560
|
+
/** The provider id in that overlay; one only the CLI uses. */
|
|
561
|
+
export const HERMES_PROVIDER = 'stav-cli';
|
|
562
|
+
/** The folder that holds the Hermes homes of every launch. */
|
|
563
|
+
export function hermesHomes(home = os.homedir()) {
|
|
564
|
+
return path.join(home, '.stav', 'hermes');
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* The Hermes home a launch uses: its own, never the person's ~/.hermes, and
|
|
568
|
+
* one per key. Hermes runs every turn in a background process that reads the
|
|
569
|
+
* key from its own environment and from <home>/.env, which wins over the
|
|
570
|
+
* environment. Into the person's home, a launch would use a key saved there
|
|
571
|
+
* or the key of a Hermes window already open; into one shared home, a launch
|
|
572
|
+
* for another workspace would use the key of a launch still open, and bill
|
|
573
|
+
* the wrong workspace (checked with Hermes 0.23.5). The folder name is a
|
|
574
|
+
* short hash of the key, never the key.
|
|
575
|
+
*/
|
|
576
|
+
export function hermesHome(key, home = os.homedir()) {
|
|
577
|
+
return path.join(hermesHomes(home), createHash('sha256').update(key).digest('hex').slice(0, 16));
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Variables that would send this run somewhere else, or change what the
|
|
581
|
+
* overlay sets: another provider, base URL or model, a remote gateway, a
|
|
582
|
+
* profile, or a mode that skips the config or the command approvals. Also
|
|
583
|
+
* STAV_API_KEY: Hermes would take it as the key for any api.stav.ai address.
|
|
584
|
+
*/
|
|
585
|
+
export const HERMES_UNSET = [
|
|
586
|
+
'STAV_API_KEY',
|
|
587
|
+
'OPENAI_BASE_URL', 'OPENAI_API_KEY',
|
|
588
|
+
'CUSTOM_BASE_URL', 'CUSTOM_API_KEY',
|
|
589
|
+
'OPENROUTER_BASE_URL', 'OPENROUTER_API_KEY',
|
|
590
|
+
'HERMES_INFERENCE_PROVIDER', 'HERMES_INFERENCE_MODEL', 'HERMES_MODEL',
|
|
591
|
+
'HERMES_TUI_PROVIDER', 'HERMES_TUI_GATEWAY_URL', 'HERMES_PROFILE',
|
|
592
|
+
'HERMES_YOLO_MODE', 'HERMES_SAFE_MODE', 'HERMES_IGNORE_USER_CONFIG', 'HERMES_ACCEPT_HOOKS',
|
|
593
|
+
];
|
|
594
|
+
const hermesAgent = {
|
|
595
|
+
name: 'hermes-agent',
|
|
596
|
+
apps: ['hermes-agent'],
|
|
597
|
+
displayName: 'Hermes Agent',
|
|
598
|
+
program: 'hermes',
|
|
599
|
+
// Hermes reads GET /v1/models for each model's context window.
|
|
600
|
+
scopes: ['inference:chat', 'inference:models'],
|
|
601
|
+
plan({ gatewayUrl, key, model }) {
|
|
602
|
+
// Hermes takes this run's provider from the overlay in HERMES_MANAGED_DIR,
|
|
603
|
+
// whose values all come from the STAV_HERMES_* variables, and keeps its
|
|
604
|
+
// state in a home of its own (checked with Hermes 0.23.5). It reads each
|
|
605
|
+
// model's context window from Stav itself. The provider and model are
|
|
606
|
+
// also given as arguments: a second window shares the first one's
|
|
607
|
+
// background process, which would otherwise keep the first one's model.
|
|
608
|
+
// With no model, "auto" (the workspace's default Router), never Hermes's
|
|
609
|
+
// own default.
|
|
610
|
+
const base = `${gatewayUrl}/v1`;
|
|
611
|
+
const id = model ?? 'auto';
|
|
612
|
+
const home = hermesHome(key);
|
|
613
|
+
const modelLine = model ? `model ${model}` : "model auto (your workspace's default Router)";
|
|
614
|
+
const noteLine = 'note: Hermes runs the commands the model writes. Commands it does not judge dangerous run without asking, and with -z every command runs without asking. Those commands can read STAV_HERMES_API_KEY from their environment; run it in a folder or container where that is safe';
|
|
615
|
+
return {
|
|
616
|
+
program: 'hermes',
|
|
617
|
+
args: ['--provider', `custom:${HERMES_PROVIDER}`, '-m', id],
|
|
618
|
+
env: {
|
|
619
|
+
HERMES_HOME: home,
|
|
620
|
+
HERMES_MANAGED_DIR,
|
|
621
|
+
STAV_HERMES_API_KEY: key,
|
|
622
|
+
STAV_HERMES_BASE_URL: base,
|
|
623
|
+
STAV_HERMES_MODEL: id,
|
|
624
|
+
},
|
|
625
|
+
unset: [...HERMES_UNSET],
|
|
626
|
+
describe: [
|
|
627
|
+
`Hermes Agent with a "${HERMES_PROVIDER}" provider at ${base}, set by a file that ships with the Stav CLI, for this run only`,
|
|
628
|
+
`a Hermes home of its own in ${hermesHomes()}, one folder per API key (a new key starts an empty one): sessions, memory and skills there are kept apart from your own Hermes, and ~/.hermes is not read or changed`,
|
|
629
|
+
'STAV_HERMES_API_KEY=<the key, in the environment only>',
|
|
630
|
+
modelLine,
|
|
631
|
+
"Hermes reads each model's context window from Stav",
|
|
632
|
+
'no update check at GitHub and no free third-party web search fallback (both would go around Stav)',
|
|
633
|
+
noteLine,
|
|
634
|
+
'run one task without the chat screen after --, for example: stav launch hermes-agent -- -z "fix the failing test"',
|
|
635
|
+
],
|
|
636
|
+
brief: [modelLine, noteLine],
|
|
637
|
+
};
|
|
638
|
+
},
|
|
639
|
+
};
|
|
640
|
+
export const ADAPTERS = [claudeCode, codex, deepseekHarness, kiloCode, githubCopilot, pi, hermesAgent];
|
|
539
641
|
/** Names a person may type for an app (DECIDE-APPS-P: `claude` → claude-code). */
|
|
540
642
|
export const ALIASES = {
|
|
541
643
|
claude: 'claude-code',
|
|
542
644
|
dsh: 'deepseek-harness',
|
|
543
645
|
kilo: 'kilo-code',
|
|
544
646
|
copilot: 'github-copilot',
|
|
647
|
+
hermes: 'hermes-agent',
|
|
545
648
|
};
|
|
546
649
|
export function resolveApp(name) {
|
|
547
650
|
const n = name.trim().toLowerCase();
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* stav login | logout | whoami
|
|
6
6
|
* stav workspace [<slug>]
|
|
7
7
|
* stav apps
|
|
8
|
-
* stav launch <app> [--model <id>] [--workspace <slug>] [--yes] [-- <app arguments>]
|
|
8
|
+
* stav launch <app> [--model <id>] [--workspace <slug>] [--yes] [--verbose] [-- <app arguments>]
|
|
9
9
|
*
|
|
10
10
|
* No telemetry (spec B.9).
|
|
11
11
|
*/
|
|
@@ -35,6 +35,7 @@ Launch options:
|
|
|
35
35
|
--model <id> The model, e.g. zai-org/glm-5-2 (default: the app's Stav default)
|
|
36
36
|
--workspace <slug> The workspace to use for this run
|
|
37
37
|
--yes Do not ask before making the key
|
|
38
|
+
--verbose Show every setting before starting the app
|
|
38
39
|
|
|
39
40
|
Environment:
|
|
40
41
|
STAV_API_KEY Use this key; no sign-in and no key is made
|
|
@@ -46,6 +47,7 @@ Examples:
|
|
|
46
47
|
stav launch kilo
|
|
47
48
|
stav launch copilot -- -p "fix the failing test"
|
|
48
49
|
stav launch pi
|
|
50
|
+
stav launch hermes -- -z "fix the failing test"
|
|
49
51
|
`;
|
|
50
52
|
// Every line goes through terminalText: much of it is text from the Stav API.
|
|
51
53
|
const out = (line = '') => process.stdout.write(`${terminalText(line)}\n`);
|
|
@@ -61,6 +63,7 @@ async function main(argv) {
|
|
|
61
63
|
model: { type: 'string' },
|
|
62
64
|
workspace: { type: 'string' },
|
|
63
65
|
yes: { type: 'boolean', short: 'y' },
|
|
66
|
+
verbose: { type: 'boolean' },
|
|
64
67
|
'forget-keys': { type: 'boolean' },
|
|
65
68
|
help: { type: 'boolean', short: 'h' },
|
|
66
69
|
version: { type: 'boolean', short: 'v' },
|
|
@@ -191,7 +194,7 @@ async function main(argv) {
|
|
|
191
194
|
platform: process.platform,
|
|
192
195
|
cwd: process.cwd(),
|
|
193
196
|
};
|
|
194
|
-
return launch({ app, model: values.model, workspace: values.workspace, yes: values.yes, appArgs }, deps);
|
|
197
|
+
return launch({ app, model: values.model, workspace: values.workspace, yes: values.yes, verbose: values.verbose, appArgs }, deps);
|
|
195
198
|
}
|
|
196
199
|
default:
|
|
197
200
|
err(`Unknown command "${command}".\n`);
|
package/dist/launch.js
CHANGED
|
@@ -26,7 +26,11 @@ export const INSTALL_PACKAGE = {
|
|
|
26
26
|
copilot: '@github/copilot',
|
|
27
27
|
pi: '@earendil-works/pi-coding-agent',
|
|
28
28
|
};
|
|
29
|
-
export const INSTALL_HINT =
|
|
29
|
+
export const INSTALL_HINT = {
|
|
30
|
+
...Object.fromEntries(Object.entries(INSTALL_PACKAGE).map(([program, pkg]) => [program, `npm install -g ${pkg}`])),
|
|
31
|
+
// Not on npm: Hermes installs with its own installer, so the CLI only says where.
|
|
32
|
+
hermes: 'its installer, see https://hermes-agent.nousresearch.com/docs/getting-started/quickstart',
|
|
33
|
+
};
|
|
30
34
|
/**
|
|
31
35
|
* Everything that can refuse runs first; only then, if the app is missing,
|
|
32
36
|
* is the install offered, so a yes never installs an app for a launch that
|
|
@@ -213,35 +217,37 @@ export async function settleKey(plan, d) {
|
|
|
213
217
|
}
|
|
214
218
|
return made.full_key;
|
|
215
219
|
}
|
|
216
|
-
export function describePlan(plan, launch, appArgs, storeKind = 'keychain') {
|
|
220
|
+
export function describePlan(plan, launch, appArgs, storeKind = 'keychain', verbose = false) {
|
|
217
221
|
const lines = [];
|
|
218
222
|
if (plan.workspace)
|
|
219
223
|
lines.push(`Workspace: ${plan.workspace.name}`);
|
|
224
|
+
const keep = storeKind === 'keychain'
|
|
225
|
+
? 'keep it in your keychain (never in this folder)'
|
|
226
|
+
: 'keep it in a file only you can read (no keychain here; never in this folder)';
|
|
220
227
|
if ('create' in plan.key) {
|
|
221
228
|
// A Stav that does not yet limit personal keys makes this key with
|
|
222
229
|
// full access, so this is said before the question, not after.
|
|
223
|
-
lines.push(`Make a personal API key "${plan.key.name}"
|
|
230
|
+
lines.push(`Make a personal API key "${plan.key.name}" with access to ${plan.adapter.scopes.join(', ')} only, and ${keep} for next time. If Stav cannot limit personal keys yet, the key has full access to your workspace.`);
|
|
224
231
|
if (plan.key.orWorkspaceKey) {
|
|
225
232
|
lines.push(`If ${plan.workspace.name} does not allow personal keys, make a workspace API key with the same name and access instead.`);
|
|
226
233
|
}
|
|
227
|
-
lines.push(storeKind === 'keychain'
|
|
228
|
-
? 'Keep it in your keychain (never in this folder), and use it next time.'
|
|
229
|
-
: 'Keep it in a file only you can read (no keychain here; never in this folder), and use it next time.');
|
|
230
234
|
}
|
|
231
235
|
else {
|
|
232
236
|
lines.push(plan.key.source === 'env' ? 'Use the key in STAV_API_KEY.' : `Use your saved ${plan.adapter.displayName} key.`);
|
|
233
237
|
}
|
|
234
238
|
lines.push(`Start ${plan.adapter.displayName} (${plan.programPath}) with:`);
|
|
235
|
-
for (const l of launch.describe)
|
|
239
|
+
for (const l of verbose ? launch.describe : launch.brief)
|
|
236
240
|
lines.push(` ${l}`);
|
|
237
241
|
if (appArgs.length)
|
|
238
242
|
lines.push(` your arguments: ${appArgs.join(' ')}`);
|
|
243
|
+
if (!verbose)
|
|
244
|
+
lines.push('Add --verbose to see every setting.');
|
|
239
245
|
return lines;
|
|
240
246
|
}
|
|
241
247
|
export async function launch(opts, d) {
|
|
242
248
|
const plan = await planLaunch(opts, d);
|
|
243
249
|
const preview = plan.adapter.plan({ gatewayUrl: d.cfg.gatewayUrl, key: '<key>', model: plan.model });
|
|
244
|
-
for (const line of describePlan(plan, preview, opts.appArgs, d.store.kind))
|
|
250
|
+
for (const line of describePlan(plan, preview, opts.appArgs, d.store.kind, opts.verbose))
|
|
245
251
|
d.log(line);
|
|
246
252
|
const changes = 'create' in plan.key;
|
|
247
253
|
if (!opts.yes) {
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The CLI's own version. Kept equal to package.json by units.test.ts ("VERSION matches package.json"). */
|
|
2
|
-
export const VERSION = '0.1.
|
|
2
|
+
export const VERSION = '0.1.7';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stav-ai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Run your coding agent on Stav: sign in, get a key for the app, and start it pointed at the Stav gateway.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"node": ">=22"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsc -p tsconfig.build.json && node --input-type=module -e \"import { copyFileSync } from 'node:fs'; copyFileSync('src/adapters/deepseek-harness.patch.yml', 'dist/adapters/deepseek-harness.patch.yml'); copyFileSync('src/adapters/pi-stav-provider.js', 'dist/adapters/pi-stav-provider.js')\"",
|
|
18
|
+
"build": "tsc -p tsconfig.build.json && node --input-type=module -e \"import { copyFileSync, mkdirSync } from 'node:fs'; copyFileSync('src/adapters/deepseek-harness.patch.yml', 'dist/adapters/deepseek-harness.patch.yml'); copyFileSync('src/adapters/pi-stav-provider.js', 'dist/adapters/pi-stav-provider.js'); mkdirSync('dist/adapters/hermes-managed', { recursive: true }); copyFileSync('src/adapters/hermes-managed/config.yaml', 'dist/adapters/hermes-managed/config.yaml')\"",
|
|
19
19
|
"prepack": "npm run build",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
21
|
"test": "tsx --test 'src/**/*.test.ts'",
|