@conveno/cli 0.2.0-rc.7 → 0.2.0-rc.9

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.
@@ -1,21 +1,21 @@
1
- import { execFile } from "node:child_process";
1
+ import { execFile, spawnSync } from "node:child_process";
2
2
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { delimiter, join, win32 } from "node:path";
5
5
  import { createInterface } from "node:readline";
6
6
  import { fileURLToPath } from "node:url";
7
- import { n as antigravityAdapter } from "./dist-D9Gu-mQm.js";
8
- import { a as opencodeAdapter, c as claudeAdapter, o as cursorAdapter, r as readAllStdin, s as copilotAdapter } from "./hook-entry-BXmSN--S.js";
9
- import { t as codexAdapter } from "./dist-DOGlDbRb.js";
10
- import { t as grokAdapter } from "./dist-Dd31Fg0h.js";
7
+ import { n as antigravityAdapter } from "./dist-BjdBeCHy.js";
8
+ import { a as opencodeAdapter, c as claudeAdapter, o as cursorAdapter, r as readAllStdin, s as copilotAdapter } from "./hook-entry-BTJK7aO0.js";
9
+ import { t as codexAdapter } from "./dist-MK-cK1JY.js";
10
+ import { t as grokAdapter } from "./dist-DaIpdMke.js";
11
11
  import { t as createTheme } from "./dist-BRjg9CLd.js";
12
- import { n as connect$1 } from "./dist-ftx5RNCp.js";
13
- import { C as claimSpawnRecord, Ct as realSpawnDeps, Dn as array, En as _enum, F as detectRepo, K as formatInbox, Kt as validateRename, Lt as spawnSession, Nn as string, On as boolean, Xt as CLI_KINDS, _ as attachAcpSession, b as baseName, ct as parsePs1ShimTarget, f as SpawnError, in as OWNER_SESSION_ID, j as dataDir, jn as number, jt as resolveWindowsCommand, ln as SessionId, o as HEARTBEAT_INTERVAL_MS, pt as planSpawn, r as ConvenoError, rn as MessageId, s as NOT_FROM_USER_NOTICE, sn as RpcErrorCode, st as parseCmdShimTarget, u as SPAWN_CLIS, vt as readAncestry, yt as readCommandLine } from "./dist-D2hMvcZu.js";
14
- import "./dist-iFaY42Bs.js";
12
+ import { n as connect$1 } from "./dist-D_O_JLLq.js";
13
+ import { Dt as readCommandLine, Et as readAncestry, Gt as spawnSession, In as _enum, Ln as array, P as dataDir, R as detectRepo, Rn as boolean, S as baseName, T as claimSpawnRecord, Un as string, Vn as number, Y as formatInbox, an as CLI_KINDS, at as launcherText, f as SpawnError, fn as MessageId, gn as RpcErrorCode, ht as parsePs1ShimTarget, it as launcherPath, jt as realSpawnDeps, lt as needsQuoting, mt as parseCmdShimTarget, o as HEARTBEAT_INTERVAL_MS, pn as OWNER_SESSION_ID, r as ConvenoError, s as NOT_FROM_USER_NOTICE, tn as validateRename, u as SPAWN_CLIS, xt as planSpawn, y as attachAcpSession, yn as SessionId, zt as resolveWindowsCommand } from "./dist-STNJjbNH.js";
14
+ import "./dist-CVdpCNJo.js";
15
15
  import { access } from "node:fs/promises";
16
16
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
17
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
18
- // ../daemon/dist/server-Da4eFZ5j.js
18
+ // ../daemon/dist/server-Bw6tm8hc.js
19
19
  /** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
20
20
  function defaultIsAlive(pid) {
21
21
  try {
@@ -28,7 +28,7 @@ function defaultIsAlive(pid) {
28
28
  `${OWNER_SESSION_ID}`;
29
29
  SessionId.parse("0".repeat(26));
30
30
  // ../mcp/dist/index.js
31
- const SERVER_VERSION = "0.2.0-rc.7";
31
+ const SERVER_VERSION = "0.2.0-rc.9";
32
32
  const ok = (text) => ({ content: [{
33
33
  type: "text",
34
34
  text
@@ -564,6 +564,13 @@ function windowsConvenoIsThisInstall(env, binPath, io = defaultShimIo) {
564
564
  const shim = found && /\.(cmd|bat)$/i.test(found) ? found : findPs1(env, io);
565
565
  return shim !== void 0 && shimPointsAt(shim, binPath, io);
566
566
  }
567
+ /** Windows: is there a `conveno.cmd` next to the `conveno` shim PATH finds. */
568
+ function windowsCmdShimOnPath(env, io = defaultShimIo) {
569
+ const found = resolveWindowsCommand("conveno", env, io.isFile);
570
+ if (found && /\.(cmd|bat)$/i.test(found)) return true;
571
+ const ps1 = findPs1(env, io);
572
+ return ps1 !== void 0 && io.isFile(win32.join(win32.dirname(ps1), "conveno.cmd"));
573
+ }
567
574
  // src/runtime.ts
568
575
  /**
569
576
  * Path of the daemon's entry script: `daemon.js`, built next to `bin.js` in this package's dist.
@@ -602,6 +609,56 @@ function pathConvenoIsThisInstall(env, binPath, platform, shimIo) {
602
609
  function convenoCommand(env, platform, binPath = cliBinPath(), nodePath = process.execPath, shimIo) {
603
610
  return pathConvenoIsThisInstall(env, binPath, platform, shimIo) ? ["conveno"] : [nodePath, binPath];
604
611
  }
612
+ /** The 8.3 short form of a Windows path, or the path itself when it cannot be read. */
613
+ function windowsShortPath(path, run = (c) => spawnSync("cmd", [
614
+ "/d",
615
+ "/c",
616
+ c
617
+ ], {
618
+ encoding: "utf8",
619
+ windowsHide: true,
620
+ windowsVerbatimArguments: true
621
+ }).stdout ?? "", exists = existsSync) {
622
+ let head = path;
623
+ const tail = [];
624
+ while (!exists(head)) {
625
+ const up = win32.dirname(head);
626
+ if (up === head) return path;
627
+ tail.unshift(win32.basename(head));
628
+ head = up;
629
+ }
630
+ try {
631
+ const short = run(`for %I in ("${head}") do @echo %~sI`).trim();
632
+ return short ? win32.join(short, ...tail) : path;
633
+ } catch {
634
+ return path;
635
+ }
636
+ }
637
+ const isAscii = (s) => /^[\x20-\x7e]*$/.test(s);
638
+ /** The launcher script for this install, and how the PATH `conveno` relates to it. */
639
+ function convenoLauncher(env, platform, dir, binPath = cliBinPath(), nodePath = process.execPath, shimIo, home = homedir(), shortPath = windowsShortPath) {
640
+ const onPath = pathConvenoIsThisInstall(env, binPath, platform, shimIo);
641
+ const win = platform === "win32";
642
+ const plain = (p) => !needsQuoting(win ? p.replace(/\\/g, "/") : p);
643
+ let path = launcherPath(platform, dir, home);
644
+ if (win && !plain(path)) path = shortPath(path);
645
+ let node = nodePath;
646
+ let bin = binPath;
647
+ let ascii = true;
648
+ if (win) {
649
+ const short = (p) => isAscii(p) ? p : shortPath(p);
650
+ node = short(node);
651
+ bin = short(bin);
652
+ ascii = isAscii(node) && isAscii(bin);
653
+ }
654
+ return {
655
+ path,
656
+ ...!plain(path) || !ascii ? { spaced: true } : {},
657
+ text: launcherText(platform, node, bin),
658
+ onPath,
659
+ cmdShim: platform === "win32" && onPath && windowsCmdShimOnPath(env, shimIo)
660
+ };
661
+ }
605
662
  function exec(cmd, args) {
606
663
  const plan = planSpawn(cmd, args);
607
664
  return new Promise((resolve, reject) => {
@@ -667,16 +724,18 @@ function createRuntimeCtx() {
667
724
  const platform = process.platform;
668
725
  const theme = createTheme();
669
726
  const daemonEntry = resolveDaemonEntry();
727
+ const dir = dataDir(platform, env, home);
670
728
  return {
671
729
  home,
672
730
  platform,
673
731
  cwd: process.cwd(),
674
732
  env,
675
- dataDir: dataDir(platform, env, home),
733
+ dataDir: dir,
676
734
  ...daemonEntry ? { daemonEntry } : {},
677
735
  conveno: {
678
736
  command: convenoCommand(env, platform),
679
- bin: cliBinPath()
737
+ bin: cliBinPath(),
738
+ launcher: convenoLauncher(env, platform, dir, void 0, void 0, void 0, home)
680
739
  },
681
740
  adapters: [
682
741
  claudeAdapter,
@@ -710,4 +769,4 @@ function createRuntimeCtx() {
710
769
  hookTimeoutMs: 2e3
711
770
  };
712
771
  }
713
- export { ask, cliBinPath, convenoCommand, createRuntimeCtx, pathConvenoIsThisInstall, promptLine, resolveDaemonEntry };
772
+ export { ask, cliBinPath, convenoCommand, convenoLauncher, createRuntimeCtx, pathConvenoIsThisInstall, promptLine, resolveDaemonEntry, windowsShortPath };