@xevy/cli 0.1.22 → 0.1.23
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 +8 -1
- package/bin/xevy.mjs +87 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,11 @@ xevy dev xevy/xevyai # start or resume your personal project session
|
|
|
63
63
|
|
|
64
64
|
That's it — you're set up. The sections below are reference for when you need more detail.
|
|
65
65
|
|
|
66
|
+
Every `xevy` launch checks the hosted package manifest. When an existing global
|
|
67
|
+
skills installation is older, Xevy updates those skills before opening pi. A
|
|
68
|
+
network or package-registry failure leaves the installed skills in place and
|
|
69
|
+
continues the launch with a warning.
|
|
70
|
+
|
|
66
71
|
## Upgrading
|
|
67
72
|
|
|
68
73
|
Keep the Xevy extensions and SDLC skills current (run after Xevy releases):
|
|
@@ -132,7 +137,9 @@ via `@xevy/skills`; your saved API key is left untouched. These commands accept
|
|
|
132
137
|
## `xevy`
|
|
133
138
|
|
|
134
139
|
Opens pi, loading `~/.xevy/extensions` via `pi -e …` (pi also auto-loads the
|
|
135
|
-
global dir, so core + model + MCP come along).
|
|
140
|
+
global dir, so core + model + MCP come along). Before pi starts, Xevy checks the
|
|
141
|
+
installed skills version and applies an available skills-only update. Extra
|
|
142
|
+
arguments are forwarded to pi:
|
|
136
143
|
|
|
137
144
|
```bash
|
|
138
145
|
xevy # interactive pi session with Xevy
|
package/bin/xevy.mjs
CHANGED
|
@@ -40,6 +40,7 @@ const PI_BIN = isWindows ? "pi.cmd" : "pi";
|
|
|
40
40
|
const XEVY_EXTENSIONS_DIR = path.join(os.homedir(), ".xevy", "extensions");
|
|
41
41
|
const XEVY_EXTENSION_FILE = "xevy.ts";
|
|
42
42
|
const API_KEY_PREFIX = "xevy_pk_";
|
|
43
|
+
const SKILLS_UPDATE_CHECK_TIMEOUT_MS = 3_000;
|
|
43
44
|
|
|
44
45
|
// Credentials file the xevy.ts extension reads (baseUrl + token).
|
|
45
46
|
const CREDENTIALS_DIR = path.join(
|
|
@@ -47,6 +48,7 @@ const CREDENTIALS_DIR = path.join(
|
|
|
47
48
|
"xevy",
|
|
48
49
|
);
|
|
49
50
|
const CREDENTIALS_FILE = path.join(CREDENTIALS_DIR, "credentials");
|
|
51
|
+
const SKILLS_INSTALL_STAMP_FILE = path.join(CREDENTIALS_DIR, "skills-package.json");
|
|
50
52
|
|
|
51
53
|
// pi's global extensions dir — core + model + MCP are installed here so they
|
|
52
54
|
// load in every pi session.
|
|
@@ -273,17 +275,24 @@ function ensurePi() {
|
|
|
273
275
|
// the MCP install here targets external coding agents and does not conflict
|
|
274
276
|
// with pi. Non-fatal: core pi setup has already succeeded, so an integration
|
|
275
277
|
// hiccup warns with the manual command instead of aborting.
|
|
276
|
-
function installAgentIntegration(base, agents, packageCommand) {
|
|
278
|
+
function installAgentIntegration(base, agents, packageCommand, options = {}) {
|
|
277
279
|
const args = ["--yes", "@xevy/skills", packageCommand, "-y"];
|
|
280
|
+
if (options.skillsOnly) args.push("--skills-only");
|
|
281
|
+
if (options.manifest) args.push("--manifest");
|
|
278
282
|
if (base !== DEFAULT_BASE) args.push("--base", base);
|
|
279
283
|
for (const agent of agents) args.push("-a", agent);
|
|
280
|
-
const
|
|
284
|
+
const integrationLabel = options.skillsOnly ? "coding-agent skills" : "coding-agent skills + MCP";
|
|
285
|
+
const label = `npx @xevy/skills ${packageCommand} (${integrationLabel})`;
|
|
281
286
|
console.log(`→ ${label}`);
|
|
282
287
|
const command = isWindows ? "npx.cmd" : "npx";
|
|
283
288
|
const r = spawnSync(command, args, { stdio: "inherit", shell: isWindows, env: process.env });
|
|
284
289
|
if (r.error || r.status !== 0) {
|
|
285
290
|
console.warn(`⚠ Could not configure coding agents (${r.error ? r.error.message : `exit ${r.status}`}).`);
|
|
286
|
-
console.warn(
|
|
291
|
+
console.warn(
|
|
292
|
+
options.skillsOnly
|
|
293
|
+
? " Retry later with: npx @xevy/skills update -y --skills-only"
|
|
294
|
+
: " Configure them later with: npx @xevy/skills -y",
|
|
295
|
+
);
|
|
287
296
|
return false;
|
|
288
297
|
}
|
|
289
298
|
return true;
|
|
@@ -359,6 +368,73 @@ function readStoredCredentials() {
|
|
|
359
368
|
return { baseUrl: null, token: null };
|
|
360
369
|
}
|
|
361
370
|
|
|
371
|
+
function readSkillsInstallStamp() {
|
|
372
|
+
try {
|
|
373
|
+
if (!fs.existsSync(SKILLS_INSTALL_STAMP_FILE)) return null;
|
|
374
|
+
const stamp = JSON.parse(fs.readFileSync(SKILLS_INSTALL_STAMP_FILE, "utf-8"));
|
|
375
|
+
const version = typeof stamp?.version === "string" ? stamp.version.trim() : "";
|
|
376
|
+
if (!/^\d+\.\d+\.\d+$/.test(version)) return null;
|
|
377
|
+
const agents = Array.isArray(stamp.agents)
|
|
378
|
+
? stamp.agents
|
|
379
|
+
.map((agent) => typeof agent === "string" ? agent.trim() : "")
|
|
380
|
+
.filter(Boolean)
|
|
381
|
+
: [];
|
|
382
|
+
return { version, agents: [...new Set(agents)] };
|
|
383
|
+
} catch {
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function comparePackageVersions(left, right) {
|
|
389
|
+
const leftParts = left.split(".").map(Number);
|
|
390
|
+
const rightParts = right.split(".").map(Number);
|
|
391
|
+
for (let index = 0; index < 3; index += 1) {
|
|
392
|
+
const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);
|
|
393
|
+
if (difference !== 0) return difference > 0 ? 1 : -1;
|
|
394
|
+
}
|
|
395
|
+
return 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async function updateOutdatedSkillsBeforeOpen(base) {
|
|
399
|
+
const stamp = readSkillsInstallStamp();
|
|
400
|
+
// Respect component-based setup: opening Xevy updates an existing skills
|
|
401
|
+
// installation and does not silently install skills a user omitted.
|
|
402
|
+
if (!stamp) return;
|
|
403
|
+
|
|
404
|
+
let latestVersion;
|
|
405
|
+
try {
|
|
406
|
+
const response = await fetch(`${base}/api/agent-packages`, {
|
|
407
|
+
headers: { accept: "application/json" },
|
|
408
|
+
signal: AbortSignal.timeout(SKILLS_UPDATE_CHECK_TIMEOUT_MS),
|
|
409
|
+
});
|
|
410
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
411
|
+
const manifest = await response.json();
|
|
412
|
+
latestVersion = String(manifest?.skills?.version || "").trim();
|
|
413
|
+
if (!/^\d+\.\d+\.\d+$/.test(latestVersion)) {
|
|
414
|
+
throw new Error("manifest returned an invalid skills version");
|
|
415
|
+
}
|
|
416
|
+
} catch (error) {
|
|
417
|
+
console.warn(
|
|
418
|
+
`⚠ Could not check Xevy skill updates (${error instanceof Error ? error.message : String(error)}). Opening with the installed skills.`,
|
|
419
|
+
);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (comparePackageVersions(latestVersion, stamp.version) <= 0) return;
|
|
424
|
+
|
|
425
|
+
console.log(`↻ Updating Xevy skills ${stamp.version} → ${latestVersion} before launch…`);
|
|
426
|
+
const agents = stamp.agents.length > 0 ? stamp.agents : DEFAULT_AGENTS;
|
|
427
|
+
const updated = installAgentIntegration(base, agents, "update", {
|
|
428
|
+
skillsOnly: true,
|
|
429
|
+
manifest: true,
|
|
430
|
+
});
|
|
431
|
+
if (updated) {
|
|
432
|
+
console.log(`✓ Xevy skills updated to ${latestVersion}.`);
|
|
433
|
+
} else {
|
|
434
|
+
console.warn(" Opening Xevy with the installed skills; run `xevy update` to retry.");
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
362
438
|
/** Return the stored xevy_pk_ token from the credentials file, or null. */
|
|
363
439
|
function readStoredToken() {
|
|
364
440
|
return readStoredCredentials().token;
|
|
@@ -626,7 +702,7 @@ function check(opts) {
|
|
|
626
702
|
process.exit(r.status ?? (r.error ? 1 : 0));
|
|
627
703
|
}
|
|
628
704
|
|
|
629
|
-
function open(opts) {
|
|
705
|
+
async function open(opts) {
|
|
630
706
|
if (!hasPi()) {
|
|
631
707
|
die("pi is not installed. Run `xevy setup` first.");
|
|
632
708
|
}
|
|
@@ -641,13 +717,19 @@ function open(opts) {
|
|
|
641
717
|
die(`No Xevy extensions in ${XEVY_EXTENSIONS_DIR}. Run \`xevy setup\` first.`);
|
|
642
718
|
}
|
|
643
719
|
|
|
720
|
+
const storedBase = readStoredCredentials().baseUrl;
|
|
721
|
+
const updateBase = (
|
|
722
|
+
process.env.XEVY_BASE?.trim() || storedBase || opts.base
|
|
723
|
+
).replace(/\/+$/, "");
|
|
724
|
+
await updateOutdatedSkillsBeforeOpen(updateBase);
|
|
725
|
+
|
|
644
726
|
const piArgs = [];
|
|
645
727
|
for (const f of files) piArgs.push("-e", f);
|
|
646
728
|
piArgs.push(...opts.piArgs);
|
|
647
729
|
|
|
648
730
|
const r = spawnSync(PI_BIN, piArgs, { stdio: "inherit", shell: isWindows, env: process.env });
|
|
649
731
|
if (r.error) die(r.error.message);
|
|
650
|
-
process.
|
|
732
|
+
process.exitCode = r.status ?? 0;
|
|
651
733
|
}
|
|
652
734
|
|
|
653
735
|
async function dev(opts) {
|
package/package.json
CHANGED