@xevy/cli 0.1.8 → 0.1.10
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 +62 -25
- package/bin/xevy.mjs +296 -61
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -41,16 +41,16 @@ npm install -g @xevy/cli
|
|
|
41
41
|
xevy setup
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Choose exactly what to configure, or press Enter to install everything:
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
- **Credentials** — store or replace the API key in `~/.config/xevy/credentials`.
|
|
47
|
+
- **Pi** — install pi and its Xevy extensions.
|
|
48
|
+
- **Skills** — install Xevy SDLC skills for selected coding agents.
|
|
49
|
+
- **MCP** — configure Xevy MCP for selected coding agents.
|
|
50
|
+
|
|
51
|
+
Codex uses a local API-key bridge, so it does not depend on expiring OAuth
|
|
52
|
+
refresh state. Claude Code, Cursor, and other remote clients continue to use
|
|
53
|
+
OAuth.
|
|
54
54
|
|
|
55
55
|
### 5. Start working
|
|
56
56
|
|
|
@@ -66,7 +66,7 @@ That's it — you're set up. The sections below are reference for when you need
|
|
|
66
66
|
Keep the Xevy extensions and SDLC skills current (run after Xevy releases):
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
xevy check #
|
|
69
|
+
xevy check # newer skills or missing coding-agent targets?
|
|
70
70
|
xevy update # refresh the pi extensions + the SDLC skills
|
|
71
71
|
```
|
|
72
72
|
|
|
@@ -78,19 +78,40 @@ npm update -g @xevy/cli # or re-run: npm install -g @xevy/cli
|
|
|
78
78
|
|
|
79
79
|
## `xevy setup`
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
`xevy setup` presents a component selector. Press Enter for all components, or
|
|
82
|
+
choose any combination of credentials, Pi, skills, and MCP. The matching
|
|
83
|
+
non-interactive flags are:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
xevy setup --credentials
|
|
87
|
+
xevy setup --pi
|
|
88
|
+
xevy setup --skills --agent cursor
|
|
89
|
+
xevy setup --mcp --agent codex
|
|
90
|
+
xevy setup --component skills --component mcp --agent claude-code
|
|
91
|
+
xevy setup --all --yes
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For a first non-interactive install, provide the key through
|
|
95
|
+
`XEVY_API_KEY=xevy_pk_… xevy setup --all --yes`; the value is stored without
|
|
96
|
+
being printed.
|
|
97
|
+
|
|
98
|
+
The components perform these actions:
|
|
99
|
+
|
|
100
|
+
1. **Pi** installs the agent if needed and installs the Xevy extensions:
|
|
83
101
|
- **`xevy-core.ts`** (shared UI + setup/context), **`xevy-model.ts`** (the
|
|
84
102
|
`xevy/*` models), and **`xevy-mcp.ts`** (the MCP→pi tool bridge) into pi's
|
|
85
103
|
**global** dir `~/.pi/agent/extensions/`, so they load in *every* pi session.
|
|
86
104
|
- **`xevy.ts`** (tools + workflow commands) into **`~/.xevy/extensions/`**.
|
|
87
|
-
|
|
105
|
+
2. **Credentials** asks for your API key (reuses an already-saved one if present) and prints a
|
|
88
106
|
**direct link to the API-keys tab** to generate one, then stores it in
|
|
89
107
|
`~/.config/xevy/credentials` (mode `600`, never printed).
|
|
90
|
-
|
|
91
|
-
(delegates to `@xevy/skills`
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
3. **Skills/MCP** installs the Xevy SDLC skills and/or MCP server configuration
|
|
109
|
+
for Cursor, Claude Code, and Codex by default (delegates to `@xevy/skills`). Pi keeps its
|
|
110
|
+
extension-backed MCP connection, so the coding-agent configuration does not
|
|
111
|
+
conflict with Pi.
|
|
112
|
+
|
|
113
|
+
If Pi or Codex MCP is selected without an existing API key, setup automatically
|
|
114
|
+
adds the credentials component before making changes.
|
|
94
115
|
|
|
95
116
|
The API-keys link opens **Settings → Profile → API keys** directly:
|
|
96
117
|
`https://xevy.ai/settings?section=profile&tab=api`.
|
|
@@ -99,11 +120,12 @@ The API-keys link opens **Settings → Profile → API keys** directly:
|
|
|
99
120
|
|
|
100
121
|
```bash
|
|
101
122
|
xevy update # re-download the pi extensions + update the SDLC skills
|
|
102
|
-
xevy check # report
|
|
123
|
+
xevy check # report skill updates or missing agent targets (exit 2 = update needed)
|
|
103
124
|
```
|
|
104
125
|
|
|
105
|
-
`update` refreshes the extensions from the server and the skills
|
|
106
|
-
your saved API key is left untouched.
|
|
126
|
+
`update` refreshes the extensions from the server and the skills + MCP configuration
|
|
127
|
+
via `@xevy/skills`; your saved API key is left untouched. These commands accept
|
|
128
|
+
`--base <url>` for self-hosted hosts and repeatable `--agent <name>` overrides.
|
|
107
129
|
|
|
108
130
|
## `xevy`
|
|
109
131
|
|
|
@@ -119,17 +141,32 @@ xevy "summarise this repo" # forwards the prompt to pi
|
|
|
119
141
|
|
|
120
142
|
```
|
|
121
143
|
--base <url> Xevy host (default: XEVY_BASE or https://xevy.ai)
|
|
144
|
+
-a, --agent <name> Coding-agent target (repeatable; default: cursor, claude-code, codex)
|
|
145
|
+
-c, --component setup component: credentials, pi, skills, or mcp (repeatable)
|
|
146
|
+
--credentials setup credentials only (composable with other component flags)
|
|
147
|
+
--pi setup Pi only
|
|
148
|
+
--skills setup skills only
|
|
149
|
+
--mcp setup MCP only
|
|
150
|
+
--all setup every component
|
|
151
|
+
-y, --yes non-interactive; defaults to all components and agents
|
|
122
152
|
-v, --version Print the CLI version
|
|
123
153
|
-h, --help Show help
|
|
124
154
|
```
|
|
125
155
|
|
|
126
156
|
## Skills & MCP for other agents
|
|
127
157
|
|
|
128
|
-
`xevy setup`
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
158
|
+
`xevy setup` installs the Xevy **SDLC skills and MCP server** for **Cursor, Claude
|
|
159
|
+
Code, and Codex** by default. Target any identifier supported by
|
|
160
|
+
[`skills`](https://github.com/vercel-labs/skills#supported-agents) and `add-mcp` with
|
|
161
|
+
repeatable flags, for example `xevy setup -a windsurf -a codex`.
|
|
162
|
+
|
|
163
|
+
Codex is configured with a stable local stdio bridge that reads the revocable API
|
|
164
|
+
key from `~/.config/xevy/credentials`; restart Codex or open a new session after
|
|
165
|
+
setup. It does not require `codex mcp login xevy`. In Claude Code, run `/mcp` and
|
|
166
|
+
authenticate `xevy`. In Cursor, use Settings → MCP → `xevy` → Connect. Other
|
|
167
|
+
clients expose an equivalent MCP connect/OAuth action.
|
|
168
|
+
|
|
169
|
+
You can also run the sibling package directly:
|
|
133
170
|
|
|
134
171
|
```bash
|
|
135
172
|
npx @xevy/skills mcp # register the Xevy MCP server, global by default
|
package/bin/xevy.mjs
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @xevy/cli — the `xevy` command.
|
|
4
4
|
*
|
|
5
|
-
* xevy setup
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* xevy update Refresh the pi extensions + the Xevy SDLC skills.
|
|
10
|
-
* xevy check Report whether newer Xevy SDLC skills are available.
|
|
5
|
+
* xevy setup Choose and configure credentials, pi extensions, agent skills,
|
|
6
|
+
* and MCP integrations independently.
|
|
7
|
+
* xevy update Refresh the pi extensions + coding-agent integration.
|
|
8
|
+
* xevy check Report skill updates or missing coding-agent targets.
|
|
11
9
|
* xevy Open pi with the Xevy extensions.
|
|
12
10
|
*
|
|
13
11
|
* `xevy setup` fetches the extensions from the server and asks for an API key
|
|
@@ -25,6 +23,8 @@ const here = path.dirname(fileURLToPath(import.meta.url));
|
|
|
25
23
|
const pkgRoot = path.resolve(here, "..");
|
|
26
24
|
|
|
27
25
|
const DEFAULT_BASE = "https://xevy.ai";
|
|
26
|
+
const DEFAULT_AGENTS = ["cursor", "claude-code", "codex"];
|
|
27
|
+
const SETUP_COMPONENTS = ["credentials", "pi", "skills", "mcp"];
|
|
28
28
|
const isWindows = process.platform === "win32";
|
|
29
29
|
|
|
30
30
|
const PI_PACKAGE = "@mariozechner/pi-coding-agent";
|
|
@@ -52,6 +52,10 @@ function apiKeysUrl(base) {
|
|
|
52
52
|
return `${base}/settings?section=profile&tab=api`;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
function configuredAgentLabel(agents) {
|
|
56
|
+
return agents.length > 0 ? agents.join(", ") : "Cursor, Claude Code, Codex";
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
function readCliVersion() {
|
|
56
60
|
try {
|
|
57
61
|
const pkg = JSON.parse(fs.readFileSync(path.join(pkgRoot, "package.json"), "utf-8"));
|
|
@@ -66,21 +70,46 @@ function die(msg) {
|
|
|
66
70
|
process.exit(1);
|
|
67
71
|
}
|
|
68
72
|
|
|
73
|
+
function validateBaseUrl(base) {
|
|
74
|
+
let parsed;
|
|
75
|
+
try {
|
|
76
|
+
parsed = new URL(base);
|
|
77
|
+
} catch {
|
|
78
|
+
die(`Invalid Xevy base URL: ${base}`);
|
|
79
|
+
}
|
|
80
|
+
const local = ["localhost", "127.0.0.1", "::1"].includes(parsed.hostname);
|
|
81
|
+
if (parsed.protocol !== "https:" && !(local && parsed.protocol === "http:")) {
|
|
82
|
+
die("The Xevy base URL must use HTTPS (HTTP is allowed only for localhost).");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
69
86
|
function usage() {
|
|
70
87
|
console.log(`Xevy CLI
|
|
71
88
|
|
|
72
89
|
xevy Open pi with the Xevy extensions in ~/.xevy/extensions
|
|
73
|
-
xevy setup [
|
|
74
|
-
xevy update [--base u] Refresh the pi extensions +
|
|
75
|
-
xevy check [--base u] Report
|
|
90
|
+
xevy setup [options] Choose credentials, pi, skills, and MCP setup
|
|
91
|
+
xevy update [--base u] Refresh the pi extensions + coding-agent skills/MCP
|
|
92
|
+
xevy check [--base u] Report skill updates or missing coding-agent targets
|
|
76
93
|
|
|
77
94
|
Options:
|
|
78
95
|
--base <url> Xevy host (default: XEVY_BASE or ${DEFAULT_BASE})
|
|
96
|
+
-a, --agent <name> Target any supported coding agent (repeatable)
|
|
97
|
+
Default: cursor, claude-code, codex
|
|
98
|
+
-c, --component <name> setup: credentials, pi, skills, or mcp (repeatable)
|
|
99
|
+
--credentials setup: store or replace the Xevy API key
|
|
100
|
+
--pi setup: install pi and the Xevy pi extensions
|
|
101
|
+
--skills setup: install Xevy agent skills
|
|
102
|
+
--mcp setup: configure Xevy MCP
|
|
103
|
+
--all setup: select every component
|
|
104
|
+
-y, --yes Non-interactive; defaults to all components and agents
|
|
79
105
|
-v, --version Print the CLI version
|
|
80
106
|
-h, --help Show this help
|
|
81
107
|
|
|
82
108
|
Examples:
|
|
83
|
-
npx @xevy/cli setup
|
|
109
|
+
npx @xevy/cli setup # interactive selector
|
|
110
|
+
npx @xevy/cli setup --component mcp -a codex
|
|
111
|
+
npx @xevy/cli setup --credentials --mcp -a codex
|
|
112
|
+
npx @xevy/cli setup --all -y
|
|
84
113
|
npx @xevy/cli update
|
|
85
114
|
npx @xevy/cli
|
|
86
115
|
|
|
@@ -102,7 +131,16 @@ function parseArgv(argv) {
|
|
|
102
131
|
|
|
103
132
|
if (first === "setup" || first === "update" || first === "check") {
|
|
104
133
|
const command = args.shift();
|
|
105
|
-
const opts = {
|
|
134
|
+
const opts = {
|
|
135
|
+
command,
|
|
136
|
+
base,
|
|
137
|
+
agents: [],
|
|
138
|
+
agentsExplicit: false,
|
|
139
|
+
components: [],
|
|
140
|
+
componentsExplicit: false,
|
|
141
|
+
yes: false,
|
|
142
|
+
piArgs: [],
|
|
143
|
+
};
|
|
106
144
|
while (args.length > 0) {
|
|
107
145
|
const a = args.shift();
|
|
108
146
|
if (a === "--base") {
|
|
@@ -111,8 +149,42 @@ function parseArgv(argv) {
|
|
|
111
149
|
opts.base = v.replace(/\/$/, "");
|
|
112
150
|
continue;
|
|
113
151
|
}
|
|
152
|
+
if (a === "-a" || a === "--agent") {
|
|
153
|
+
const v = args.shift();
|
|
154
|
+
if (!v) die("Missing value for --agent");
|
|
155
|
+
if (!opts.agents.includes(v)) opts.agents.push(v);
|
|
156
|
+
opts.agentsExplicit = true;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (a === "-y" || a === "--yes") {
|
|
160
|
+
opts.yes = true;
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (a === "--all") {
|
|
164
|
+
if (command !== "setup") die("`--all` is only supported by `xevy setup`.");
|
|
165
|
+
opts.components = [...SETUP_COMPONENTS];
|
|
166
|
+
opts.componentsExplicit = true;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (a === "-c" || a === "--component") {
|
|
170
|
+
if (command !== "setup") {
|
|
171
|
+
die("`--component` is only supported by `xevy setup`.");
|
|
172
|
+
}
|
|
173
|
+
const v = args.shift();
|
|
174
|
+
if (!v) die("Missing value for --component");
|
|
175
|
+
addSetupComponent(opts, v);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (["--credentials", "--pi", "--skills", "--mcp"].includes(a)) {
|
|
179
|
+
if (command !== "setup") {
|
|
180
|
+
die(`\`${a}\` is only supported by \`xevy setup\`.`);
|
|
181
|
+
}
|
|
182
|
+
addSetupComponent(opts, a.slice(2));
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
114
185
|
die(`Unknown option for \`xevy ${command}\`: ${a}. Try \`xevy --help\`.`);
|
|
115
186
|
}
|
|
187
|
+
validateBaseUrl(opts.base);
|
|
116
188
|
return opts;
|
|
117
189
|
}
|
|
118
190
|
|
|
@@ -120,6 +192,17 @@ function parseArgv(argv) {
|
|
|
120
192
|
return { command: "open", base, piArgs: args };
|
|
121
193
|
}
|
|
122
194
|
|
|
195
|
+
function addSetupComponent(opts, component) {
|
|
196
|
+
const normalized = String(component).trim().toLowerCase();
|
|
197
|
+
if (!SETUP_COMPONENTS.includes(normalized)) {
|
|
198
|
+
die(
|
|
199
|
+
`Unknown setup component '${component}'. Choose: ${SETUP_COMPONENTS.join(", ")}.`,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
if (!opts.components.includes(normalized)) opts.components.push(normalized);
|
|
203
|
+
opts.componentsExplicit = true;
|
|
204
|
+
}
|
|
205
|
+
|
|
123
206
|
function run(cmd, args, { label } = {}) {
|
|
124
207
|
const title = label || [cmd, ...args].join(" ");
|
|
125
208
|
console.log(`→ ${title}`);
|
|
@@ -147,21 +230,22 @@ function ensurePi() {
|
|
|
147
230
|
}
|
|
148
231
|
}
|
|
149
232
|
|
|
150
|
-
// Install the Xevy
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
function
|
|
156
|
-
const args = ["--yes", "@xevy/skills",
|
|
233
|
+
// Install/update the portable Xevy skills and MCP configuration through the
|
|
234
|
+
// published @xevy/skills package. pi keeps its own extension-backed MCP path;
|
|
235
|
+
// the MCP install here targets external coding agents and does not conflict
|
|
236
|
+
// with pi. Non-fatal: core pi setup has already succeeded, so an integration
|
|
237
|
+
// hiccup warns with the manual command instead of aborting.
|
|
238
|
+
function installAgentIntegration(base, agents, packageCommand) {
|
|
239
|
+
const args = ["--yes", "@xevy/skills", packageCommand, "-y"];
|
|
157
240
|
if (base !== DEFAULT_BASE) args.push("--base", base);
|
|
158
|
-
const
|
|
241
|
+
for (const agent of agents) args.push("-a", agent);
|
|
242
|
+
const label = `npx @xevy/skills ${packageCommand} (coding-agent skills + MCP)`;
|
|
159
243
|
console.log(`→ ${label}`);
|
|
160
244
|
const command = isWindows ? "npx.cmd" : "npx";
|
|
161
245
|
const r = spawnSync(command, args, { stdio: "inherit", shell: isWindows, env: process.env });
|
|
162
246
|
if (r.error || r.status !== 0) {
|
|
163
|
-
console.warn(`⚠ Could not
|
|
164
|
-
console.warn("
|
|
247
|
+
console.warn(`⚠ Could not configure coding agents (${r.error ? r.error.message : `exit ${r.status}`}).`);
|
|
248
|
+
console.warn(" Configure them later with: npx @xevy/skills -y");
|
|
165
249
|
return false;
|
|
166
250
|
}
|
|
167
251
|
return true;
|
|
@@ -240,6 +324,32 @@ function readStoredToken() {
|
|
|
240
324
|
return null;
|
|
241
325
|
}
|
|
242
326
|
|
|
327
|
+
function readEnvironmentToken() {
|
|
328
|
+
const token = String(process.env.XEVY_API_KEY || "").trim();
|
|
329
|
+
return token.startsWith(API_KEY_PREFIX) ? token : null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
async function validateApiKey(base, token) {
|
|
333
|
+
let response;
|
|
334
|
+
try {
|
|
335
|
+
response = await fetch(`${base}/api/auth/me`, {
|
|
336
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
337
|
+
signal: AbortSignal.timeout(10_000),
|
|
338
|
+
});
|
|
339
|
+
} catch (error) {
|
|
340
|
+
die(
|
|
341
|
+
`Could not validate the Xevy API key: ${
|
|
342
|
+
error instanceof Error ? error.message : String(error)
|
|
343
|
+
}`,
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
if (response.status === 401 || response.status === 403) return false;
|
|
347
|
+
if (!response.ok) {
|
|
348
|
+
die(`Could not validate the Xevy API key (HTTP ${response.status}).`);
|
|
349
|
+
}
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
|
|
243
353
|
function isYes(answer, defaultYes = true) {
|
|
244
354
|
const a = String(answer || "").trim().toLowerCase();
|
|
245
355
|
if (!a) return defaultYes;
|
|
@@ -258,6 +368,62 @@ async function promptNewApiKey(base) {
|
|
|
258
368
|
return token;
|
|
259
369
|
}
|
|
260
370
|
|
|
371
|
+
function parseNumberedSelection(answer, choices, label) {
|
|
372
|
+
const selected = [];
|
|
373
|
+
const values = String(answer || "")
|
|
374
|
+
.toLowerCase()
|
|
375
|
+
.split(/[,\s]+/)
|
|
376
|
+
.filter(Boolean);
|
|
377
|
+
for (const value of values) {
|
|
378
|
+
const numeric = Number.parseInt(value, 10);
|
|
379
|
+
const choice =
|
|
380
|
+
Number.isInteger(numeric) && String(numeric) === value
|
|
381
|
+
? choices[numeric - 1]
|
|
382
|
+
: choices.find((candidate) => candidate === value);
|
|
383
|
+
if (!choice) {
|
|
384
|
+
die(`Unknown ${label} '${value}'. Choose from: ${choices.join(", ")}.`);
|
|
385
|
+
}
|
|
386
|
+
if (!selected.includes(choice)) selected.push(choice);
|
|
387
|
+
}
|
|
388
|
+
return selected;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async function resolveSetupComponents(opts) {
|
|
392
|
+
if (opts.componentsExplicit) return [...opts.components];
|
|
393
|
+
if (opts.yes || !process.stdin.isTTY) return [...SETUP_COMPONENTS];
|
|
394
|
+
|
|
395
|
+
console.log("What would you like to set up?");
|
|
396
|
+
console.log(" 1. Credentials Store or replace your Xevy API key");
|
|
397
|
+
console.log(" 2. Pi Install pi and the Xevy pi extensions");
|
|
398
|
+
console.log(" 3. Skills Install Xevy skills for coding agents");
|
|
399
|
+
console.log(" 4. MCP Configure Xevy MCP for coding agents");
|
|
400
|
+
const answer = await promptLine(
|
|
401
|
+
"Choose numbers or names, comma-separated [Enter = all]: ",
|
|
402
|
+
);
|
|
403
|
+
return answer
|
|
404
|
+
? parseNumberedSelection(answer, SETUP_COMPONENTS, "component")
|
|
405
|
+
: [...SETUP_COMPONENTS];
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async function resolveSetupAgents(opts, components) {
|
|
409
|
+
if (!components.some((component) => component === "skills" || component === "mcp")) {
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
if (opts.agentsExplicit) return [...opts.agents];
|
|
413
|
+
if (opts.yes || !process.stdin.isTTY) return [...DEFAULT_AGENTS];
|
|
414
|
+
|
|
415
|
+
console.log("\nWhich coding agents should be configured?");
|
|
416
|
+
console.log(" 1. Cursor");
|
|
417
|
+
console.log(" 2. Claude Code");
|
|
418
|
+
console.log(" 3. Codex");
|
|
419
|
+
const answer = await promptLine(
|
|
420
|
+
"Choose numbers or names, comma-separated [Enter = all]: ",
|
|
421
|
+
);
|
|
422
|
+
return answer
|
|
423
|
+
? parseNumberedSelection(answer, DEFAULT_AGENTS, "agent")
|
|
424
|
+
: [...DEFAULT_AGENTS];
|
|
425
|
+
}
|
|
426
|
+
|
|
261
427
|
// Download all four Xevy pi extensions to their install dirs. Shared by `setup`
|
|
262
428
|
// and `update` so the two never drift.
|
|
263
429
|
// • xevy-core.ts → pi's GLOBAL extensions dir (shared base: ask_question
|
|
@@ -278,70 +444,139 @@ async function downloadAllExtensions(base) {
|
|
|
278
444
|
}
|
|
279
445
|
|
|
280
446
|
async function setup(opts) {
|
|
281
|
-
console.log("Setting up Xevy
|
|
447
|
+
console.log("Setting up Xevy\n");
|
|
282
448
|
|
|
283
|
-
|
|
284
|
-
|
|
449
|
+
try {
|
|
450
|
+
const components = await resolveSetupComponents(opts);
|
|
451
|
+
const agents = await resolveSetupAgents(opts, components);
|
|
452
|
+
const needsApiKey =
|
|
453
|
+
components.includes("pi") ||
|
|
454
|
+
(components.includes("mcp") && agents.includes("codex"));
|
|
455
|
+
const existing = readStoredToken();
|
|
456
|
+
const existingIsValid =
|
|
457
|
+
existing && (needsApiKey || components.includes("credentials"))
|
|
458
|
+
? await validateApiKey(opts.base, existing)
|
|
459
|
+
: Boolean(existing);
|
|
460
|
+
|
|
461
|
+
if (
|
|
462
|
+
needsApiKey &&
|
|
463
|
+
!existingIsValid &&
|
|
464
|
+
!components.includes("credentials")
|
|
465
|
+
) {
|
|
466
|
+
components.unshift("credentials");
|
|
467
|
+
console.log(
|
|
468
|
+
"→ Added credentials because Pi and the Codex MCP bridge require a Xevy API key.",
|
|
469
|
+
);
|
|
470
|
+
}
|
|
285
471
|
|
|
286
|
-
|
|
287
|
-
|
|
472
|
+
if (components.includes("credentials")) {
|
|
473
|
+
let token;
|
|
474
|
+
if (existing && !existingIsValid) {
|
|
475
|
+
console.log("→ The stored Xevy API key is no longer valid for this host.");
|
|
476
|
+
}
|
|
477
|
+
if (existingIsValid && opts.yes) {
|
|
478
|
+
token = existing;
|
|
479
|
+
} else if (!existingIsValid && opts.yes) {
|
|
480
|
+
token = readEnvironmentToken();
|
|
481
|
+
if (!token) {
|
|
482
|
+
die(
|
|
483
|
+
"Non-interactive credential setup needs a valid XEVY_API_KEY.",
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
} else if (existingIsValid) {
|
|
487
|
+
const reuse = await promptLine(
|
|
488
|
+
`An API key is already saved (…${existing.slice(-4)}). Reuse it? [Y/n]: `,
|
|
489
|
+
);
|
|
490
|
+
token = isYes(reuse) ? existing : await promptNewApiKey(opts.base);
|
|
491
|
+
} else {
|
|
492
|
+
token = await promptNewApiKey(opts.base);
|
|
493
|
+
}
|
|
494
|
+
if (!(await validateApiKey(opts.base, token))) {
|
|
495
|
+
die(
|
|
496
|
+
`That API key was rejected by ${opts.base}. Create a new key and rerun the credentials component.`,
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
writeCredentials(opts.base, token);
|
|
500
|
+
console.log(`✓ API key stored at ${CREDENTIALS_FILE} (key not shown).`);
|
|
501
|
+
}
|
|
288
502
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const reuse = await promptLine(`An API key is already saved (…${existing.slice(-4)}). Reuse it? [Y/n]: `);
|
|
294
|
-
token = isYes(reuse) ? existing : await promptNewApiKey(opts.base);
|
|
295
|
-
} else {
|
|
296
|
-
token = await promptNewApiKey(opts.base);
|
|
297
|
-
}
|
|
298
|
-
closePrompts();
|
|
299
|
-
writeCredentials(opts.base, token);
|
|
300
|
-
console.log(`✓ API key stored at ${CREDENTIALS_FILE} (key not shown).`);
|
|
503
|
+
if (components.includes("pi")) {
|
|
504
|
+
ensurePi();
|
|
505
|
+
await downloadAllExtensions(opts.base);
|
|
506
|
+
}
|
|
301
507
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
508
|
+
let agentIntegrationOk = true;
|
|
509
|
+
const installsSkills = components.includes("skills");
|
|
510
|
+
const installsMcp = components.includes("mcp");
|
|
511
|
+
if (installsSkills || installsMcp) {
|
|
512
|
+
const packageCommand =
|
|
513
|
+
installsSkills && installsMcp
|
|
514
|
+
? "install"
|
|
515
|
+
: installsSkills
|
|
516
|
+
? "skills"
|
|
517
|
+
: "mcp";
|
|
518
|
+
agentIntegrationOk = installAgentIntegration(
|
|
519
|
+
opts.base,
|
|
520
|
+
agents,
|
|
521
|
+
packageCommand,
|
|
522
|
+
);
|
|
523
|
+
}
|
|
305
524
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
525
|
+
console.log("\n✓ Selected setup complete.");
|
|
526
|
+
if (components.includes("pi")) {
|
|
527
|
+
console.log(
|
|
528
|
+
" • Xevy models and MCP tools are available in pi; run `xevy` to open it.",
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
if (installsSkills || installsMcp) {
|
|
532
|
+
console.log(
|
|
533
|
+
agentIntegrationOk
|
|
534
|
+
? ` • ${[
|
|
535
|
+
installsSkills ? "skills" : "",
|
|
536
|
+
installsMcp ? "MCP" : "",
|
|
537
|
+
]
|
|
538
|
+
.filter(Boolean)
|
|
539
|
+
.join(" + ")} configured for ${configuredAgentLabel(agents)}.`
|
|
540
|
+
: " • Coding-agent integration was not configured; rerun the selected component to retry.",
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
console.log(` • Components: ${components.join(", ")}`);
|
|
544
|
+
console.log(" • Keep current with `xevy check` / `xevy update`.");
|
|
545
|
+
if (opts.base !== DEFAULT_BASE) console.log(` • Host: ${opts.base}`);
|
|
546
|
+
if (!agentIntegrationOk) process.exitCode = 1;
|
|
547
|
+
} finally {
|
|
548
|
+
closePrompts();
|
|
549
|
+
}
|
|
316
550
|
}
|
|
317
551
|
|
|
318
|
-
// `xevy update` — refresh the pi extensions
|
|
319
|
-
//
|
|
320
|
-
//
|
|
552
|
+
// `xevy update` — refresh the pi extensions and portable coding-agent
|
|
553
|
+
// integration. @xevy/skills remains the source of truth; the API key is left
|
|
554
|
+
// as-is.
|
|
321
555
|
async function update(opts) {
|
|
322
556
|
console.log("Updating Xevy\n");
|
|
323
557
|
|
|
324
558
|
// 1. Re-download the pi extensions (they carry the date-stamped versions).
|
|
325
559
|
await downloadAllExtensions(opts.base);
|
|
326
560
|
|
|
327
|
-
// 2. Skills via @xevy/skills
|
|
328
|
-
const
|
|
561
|
+
// 2. Skills + MCP via @xevy/skills.
|
|
562
|
+
const agentIntegrationOk = installAgentIntegration(opts.base, opts.agents, "update");
|
|
329
563
|
|
|
330
564
|
console.log("\n✓ Update complete.");
|
|
331
565
|
console.log(" • Xevy pi extensions refreshed.");
|
|
332
566
|
console.log(
|
|
333
|
-
|
|
334
|
-
? " •
|
|
335
|
-
: " •
|
|
567
|
+
agentIntegrationOk
|
|
568
|
+
? " • Coding-agent skills + MCP updated."
|
|
569
|
+
: " • Coding-agent integration NOT updated — run `npx @xevy/skills update -y` manually.",
|
|
336
570
|
);
|
|
337
571
|
if (opts.base !== DEFAULT_BASE) console.log(` • Host: ${opts.base}`);
|
|
338
572
|
}
|
|
339
573
|
|
|
340
|
-
// `xevy check` — is a newer
|
|
341
|
-
// @xevy/skills
|
|
574
|
+
// `xevy check` — is a newer skills version available, or is a requested agent
|
|
575
|
+
// target missing? Delegates to @xevy/skills (install stamp + npm/manifest).
|
|
342
576
|
function check(opts) {
|
|
343
577
|
const args = ["--yes", "@xevy/skills", "check"];
|
|
344
578
|
if (opts.base !== DEFAULT_BASE) args.push("--base", opts.base);
|
|
579
|
+
for (const agent of opts.agents) args.push("-a", agent);
|
|
345
580
|
const command = isWindows ? "npx.cmd" : "npx";
|
|
346
581
|
const r = spawnSync(command, args, { stdio: "inherit", shell: isWindows, env: process.env });
|
|
347
582
|
// Preserve @xevy/skills' exit code (0 = current, 2 = update available, …).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xevy/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Xevy CLI —
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"description": "Xevy CLI — modular setup for credentials, pi, coding-agent skills, and MCP; update/check keep integrations current; xevy opens pi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"xevy",
|