@xevy/cli 0.1.21 → 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 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). Extra arguments are forwarded to pi:
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
@@ -634,7 +634,7 @@ function sessionSummary(context, session, base, writeLine) {
634
634
  writeLine(` Branch ${session.branch || session.config?.branch || "unknown"}`);
635
635
  writeLine(` Status ${session.status}`);
636
636
  writeLine(` Expires ${session.expiresAt || "server-managed"}`);
637
- writeLine("\nNative Pi terminal · press Ctrl+] to detach and leave it running\n");
637
+ writeLine("\nXevy terminal · press Ctrl+] to detach and leave it running\n");
638
638
  }
639
639
 
640
640
  async function attachNativeTerminal({
@@ -705,7 +705,7 @@ async function attachNativeTerminal({
705
705
  if (detachAt > 0 && socket.readyState === WebSocketImpl.OPEN) {
706
706
  socket.send(value.subarray(0, detachAt), { binary: true });
707
707
  }
708
- output.write("\r\nDetached. Pi and the Dev Session are still running.\r\n");
708
+ output.write("\r\nDetached. Xevy and the Dev Session are still running.\r\n");
709
709
  if (reattachHint) output.write(`${reattachHint}\r\n`);
710
710
  socket.close(1000, "client_detach");
711
711
  finish(null, { reason: "detached", code: 1000, durationMs: Date.now() - connectedAt });
@@ -785,7 +785,7 @@ async function attachNativeTerminalOnce({
785
785
  let attempts = 0;
786
786
  try {
787
787
  while (!signal?.aborted) {
788
- status.update(attempts === 0 ? "Starting remote Pi terminal…" : "Terminal is not ready yet · retrying…");
788
+ status.update(attempts === 0 ? "Starting remote Xevy terminal…" : "Terminal is not ready yet · retrying…");
789
789
  try {
790
790
  const result = await attachNativeTerminal({
791
791
  api,
@@ -795,7 +795,7 @@ async function attachNativeTerminalOnce({
795
795
  output,
796
796
  signal,
797
797
  reattachHint,
798
- onReady: () => status.succeed("Pi terminal ready"),
798
+ onReady: () => status.succeed("Xevy terminal ready"),
799
799
  WebSocketImpl,
800
800
  });
801
801
  if (result?.reason === "detached") return;
@@ -803,7 +803,7 @@ async function attachNativeTerminalOnce({
803
803
  // The attachment ended on its own; say why and leave the session up.
804
804
  writeLine(result?.reason === "transport-lost"
805
805
  ? "\nConnection to the Dev Session terminal was lost. The Dev Session is still running."
806
- : "\nPi exited. The Dev Session is still running.");
806
+ : "\nXevy exited. The Dev Session is still running.");
807
807
  if (reattachHint) writeLine(reattachHint);
808
808
  return;
809
809
  } catch (error) {
@@ -811,7 +811,7 @@ async function attachNativeTerminalOnce({
811
811
  if (error instanceof DevSessionApiError && ![409, 502, 503, 504].includes(error.status)) throw error;
812
812
  attempts += 1;
813
813
  if (attempts >= TERMINAL_START_ATTEMPT_LIMIT) {
814
- throw new Error("The remote Pi terminal never became ready. The Dev Session remains active; check its logs and rerun `xevy dev` after correcting the startup error.");
814
+ throw new Error("The remote Xevy terminal never became ready. The Dev Session remains active; check its logs and rerun `xevy dev` after correcting the startup error.");
815
815
  }
816
816
  status.update("Terminal is not ready yet · retrying…");
817
817
  await sleep(Math.min(500 * 2 ** (attempts - 1), TERMINAL_START_MAX_DELAY_MS), signal);
@@ -1106,7 +1106,7 @@ export async function runDevSession(options) {
1106
1106
  }
1107
1107
 
1108
1108
  if (context.kind === "personal") {
1109
- writeLine("Attached successfully. Rerun in an interactive terminal to open Pi.");
1109
+ writeLine("Attached successfully. Rerun in an interactive terminal to open Xevy.");
1110
1110
  return { task: null, project: context.project, session, detached: true };
1111
1111
  }
1112
1112
 
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.
@@ -136,10 +138,10 @@ function devUsage() {
136
138
 
137
139
  Connects this terminal to a remote Dev Session. The reserved task/ prefix
138
140
  selects task work; a workspace/project target starts or resumes your personal
139
- project session. Pi runs inside the isolated remote workspace.
141
+ project session. Xevy runs inside the isolated remote workspace.
140
142
 
141
143
  Terminal control:
142
- Ctrl+] Detach without stopping Pi or the Dev Session
144
+ Ctrl+] Detach without stopping Xevy or the Dev Session
143
145
 
144
146
  Credentials:
145
147
  XEVY_API_KEY takes precedence over ~/.config/xevy/credentials.
@@ -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 label = `npx @xevy/skills ${packageCommand} (coding-agent skills + MCP)`;
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(" Configure them later with: npx @xevy/skills -y");
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;
@@ -437,7 +513,7 @@ async function resolveSetupComponents(opts) {
437
513
 
438
514
  console.log("What would you like to set up?");
439
515
  console.log(" 1. Credentials Store or replace your Xevy API key");
440
- console.log(" 2. Pi Install pi and the Xevy pi extensions");
516
+ console.log(" 2. Agent Install the Xevy coding agent and its extensions");
441
517
  console.log(" 3. Skills Install Xevy skills for coding agents");
442
518
  console.log(" 4. MCP Configure Xevy MCP for coding agents");
443
519
  const answer = await promptLine(
@@ -508,7 +584,7 @@ async function setup(opts) {
508
584
  ) {
509
585
  components.unshift("credentials");
510
586
  console.log(
511
- "→ Added credentials because Pi and the Codex MCP bridge require a Xevy API key.",
587
+ "→ Added credentials because the Xevy agent and the Codex MCP bridge require a Xevy API key.",
512
588
  );
513
589
  }
514
590
 
@@ -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.exit(r.status ?? 0);
732
+ process.exitCode = r.status ?? 0;
651
733
  }
652
734
 
653
735
  async function dev(opts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xevy/cli",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Xevy CLI — connect to remote Dev Sessions, configure credentials, pi, coding-agent skills, and MCP, and keep integrations current.",
5
5
  "type": "module",
6
6
  "keywords": [