@zookanalytics/agent-env 0.13.0 → 0.14.0

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.
Files changed (2) hide show
  1. package/dist/cli.js +419 -185
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -49,15 +49,15 @@ var execute = createExecutor();
49
49
  import { program } from "commander";
50
50
  import { render as render3 } from "ink";
51
51
  import { existsSync as existsSync2 } from "fs";
52
- import { homedir as homedir12 } from "os";
53
- import { dirname as dirname5, join as join15, resolve } from "path";
52
+ import { homedir as homedir13 } from "os";
53
+ import { dirname as dirname5, join as join16, resolve } from "path";
54
54
  import { fileURLToPath as fileURLToPath2 } from "url";
55
- import React4 from "react";
55
+ import React5 from "react";
56
56
 
57
57
  // package.json
58
58
  var package_default = {
59
59
  name: "@zookanalytics/agent-env",
60
- version: "0.13.0",
60
+ version: "0.14.0",
61
61
  description: "CLI for creating isolated, AI-ready development environments",
62
62
  type: "module",
63
63
  bin: {
@@ -3204,6 +3204,195 @@ var listCommand = new Command6("list").alias("ps").description("List all instanc
3204
3204
  // src/commands/on.ts
3205
3205
  import { Command as Command7 } from "commander";
3206
3206
 
3207
+ // src/lib/version-drift.ts
3208
+ import { spawnSync as spawnSync2 } from "child_process";
3209
+ import { access as access4, constants as constants2 } from "fs/promises";
3210
+ import { homedir as homedir7 } from "os";
3211
+ import { join as join10 } from "path";
3212
+
3213
+ // src/lib/update-check.ts
3214
+ import chalk from "chalk";
3215
+ import * as fs from "fs/promises";
3216
+ import { dirname as dirname3 } from "path";
3217
+ function normaliseVersion(version2) {
3218
+ const withoutBuild = version2.split("+")[0];
3219
+ const withoutPre = withoutBuild.split("-")[0];
3220
+ return withoutPre;
3221
+ }
3222
+ function isNewerVersion(current, registry) {
3223
+ const normCurrent = normaliseVersion(current);
3224
+ const normRegistry = normaliseVersion(registry);
3225
+ const currentParts = normCurrent.split(".").map(Number);
3226
+ const registryParts = normRegistry.split(".").map(Number);
3227
+ const len = Math.max(currentParts.length, registryParts.length);
3228
+ for (let i = 0; i < len; i++) {
3229
+ const c = currentParts[i] ?? 0;
3230
+ const r = registryParts[i] ?? 0;
3231
+ if (r > c) return true;
3232
+ if (r < c) return false;
3233
+ }
3234
+ return false;
3235
+ }
3236
+ async function readCache(cachePath, readFileFn) {
3237
+ try {
3238
+ const raw = await readFileFn(cachePath, "utf-8");
3239
+ const parsed = JSON.parse(raw);
3240
+ if (parsed !== null && typeof parsed === "object" && "lastCheck" in parsed && "latestVersion" in parsed && typeof parsed.lastCheck === "number" && typeof parsed.latestVersion === "string") {
3241
+ return parsed;
3242
+ }
3243
+ return null;
3244
+ } catch {
3245
+ return null;
3246
+ }
3247
+ }
3248
+ async function writeCache(cachePath, data, mkdirFn, writeFileFn) {
3249
+ try {
3250
+ await mkdirFn(dirname3(cachePath), { recursive: true });
3251
+ await writeFileFn(cachePath, JSON.stringify(data), "utf-8");
3252
+ } catch {
3253
+ }
3254
+ }
3255
+ async function fetchLatestVersion(packageName, fetchFn) {
3256
+ try {
3257
+ const url = `https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`;
3258
+ const response = await fetchFn(url, {
3259
+ headers: { Accept: "application/json" },
3260
+ signal: AbortSignal.timeout(5e3)
3261
+ });
3262
+ const json = await response.json();
3263
+ if (json !== null && typeof json === "object" && "version" in json && typeof json.version === "string") {
3264
+ return json.version;
3265
+ }
3266
+ return null;
3267
+ } catch {
3268
+ return null;
3269
+ }
3270
+ }
3271
+ function formatUpdateMessage(currentVersion, latestVersion, packageName) {
3272
+ const normCurrent = normaliseVersion(currentVersion);
3273
+ const line1 = chalk.yellow(`Update available: ${normCurrent} -> ${latestVersion}`);
3274
+ const line2 = chalk.cyan(`Run: pnpm add -g ${packageName}`);
3275
+ return `${line1}
3276
+ ${line2}`;
3277
+ }
3278
+ async function checkForUpdate(opts) {
3279
+ const {
3280
+ currentVersion,
3281
+ packageName,
3282
+ cachePath,
3283
+ cacheTtlMs,
3284
+ fetchFn = fetch,
3285
+ readFile: readFile17 = (p, enc) => fs.readFile(p, enc),
3286
+ writeFile: writeFile14 = (p, d, enc) => fs.writeFile(p, d, enc),
3287
+ mkdir: mkdir15 = (p, o) => fs.mkdir(p, o),
3288
+ now = () => Date.now()
3289
+ } = opts;
3290
+ const currentTime = now();
3291
+ const cache = await readCache(cachePath, readFile17);
3292
+ let latestVersion = null;
3293
+ const isCacheFresh = cache !== null && currentTime - cache.lastCheck < cacheTtlMs;
3294
+ if (isCacheFresh) {
3295
+ latestVersion = cache.latestVersion;
3296
+ } else {
3297
+ latestVersion = await fetchLatestVersion(packageName, fetchFn);
3298
+ if (latestVersion !== null) {
3299
+ await writeCache(cachePath, { lastCheck: currentTime, latestVersion }, mkdir15, writeFile14);
3300
+ }
3301
+ }
3302
+ if (latestVersion !== null && isNewerVersion(currentVersion, latestVersion)) {
3303
+ return formatUpdateMessage(currentVersion, latestVersion, packageName);
3304
+ }
3305
+ return null;
3306
+ }
3307
+
3308
+ // src/lib/version-drift.ts
3309
+ function normaliseVersion2(version2) {
3310
+ return version2.split("+")[0].split("-")[0];
3311
+ }
3312
+ function isNewerVersion2(running, installed) {
3313
+ const r = normaliseVersion2(running).split(".").map(Number);
3314
+ const i = normaliseVersion2(installed).split(".").map(Number);
3315
+ const len = Math.max(r.length, i.length);
3316
+ for (let j = 0; j < len; j++) {
3317
+ const rv = r[j] ?? 0;
3318
+ const iv = i[j] ?? 0;
3319
+ if (iv > rv) return true;
3320
+ if (iv < rv) return false;
3321
+ }
3322
+ return false;
3323
+ }
3324
+ function getInstalledVersion(deps = {}) {
3325
+ const spawn = deps.spawn ?? spawnSync2;
3326
+ try {
3327
+ const result = spawn("agent-env", ["--version"], {
3328
+ encoding: "utf-8",
3329
+ timeout: 5e3,
3330
+ stdio: ["ignore", "pipe", "ignore"]
3331
+ });
3332
+ if (result.status !== 0 || typeof result.stdout !== "string") {
3333
+ return null;
3334
+ }
3335
+ const version2 = result.stdout.trim();
3336
+ return /^\d+\.\d+\.\d+/.test(version2) ? version2 : null;
3337
+ } catch {
3338
+ return null;
3339
+ }
3340
+ }
3341
+ async function isPackagePathStale(deps = {}) {
3342
+ const { access: accessFn = access4, getBaselinePath = getBaselineConfigPath } = deps;
3343
+ try {
3344
+ await accessFn(join10(getBaselinePath(), "devcontainer.json"), constants2.F_OK);
3345
+ return false;
3346
+ } catch {
3347
+ return true;
3348
+ }
3349
+ }
3350
+ var UPDATE_CHECK_CACHE_PATH = join10(homedir7(), ".agent-env", "update-check.json");
3351
+ var UPDATE_CHECK_CACHE_TTL_MS = 36e5;
3352
+ async function fetchUpdateMessageFromRegistry(force = false) {
3353
+ try {
3354
+ return await checkForUpdate({
3355
+ currentVersion: package_default.version,
3356
+ packageName: package_default.name,
3357
+ cachePath: UPDATE_CHECK_CACHE_PATH,
3358
+ cacheTtlMs: force ? 0 : UPDATE_CHECK_CACHE_TTL_MS
3359
+ });
3360
+ } catch {
3361
+ return null;
3362
+ }
3363
+ }
3364
+ async function detectDriftState(deps = {}, options = {}) {
3365
+ const {
3366
+ isPackagePathStale: probe = isPackagePathStale,
3367
+ fetchUpdateMessage = (force) => fetchUpdateMessageFromRegistry(force),
3368
+ getInstalledVersion: resolveInstalled = getInstalledVersion
3369
+ } = deps;
3370
+ const installedVersion = resolveInstalled();
3371
+ const [packageMoved, updateMessage] = await Promise.all([
3372
+ probe(),
3373
+ fetchUpdateMessage(options.forceRefresh ?? false)
3374
+ ]);
3375
+ return {
3376
+ packageMoved,
3377
+ updateMessage,
3378
+ installedVersion,
3379
+ currentVersion: package_default.version
3380
+ };
3381
+ }
3382
+ function getCurrentVersion() {
3383
+ return package_default.version;
3384
+ }
3385
+ function restartMenu({ workspaceName, repoSlug }, deps = {}) {
3386
+ const spawn = deps.spawn ?? spawnSync2;
3387
+ const exit = deps.exit ?? ((code) => process.exit(code));
3388
+ const args = ["on", workspaceName];
3389
+ if (repoSlug) {
3390
+ args.push("--repo", repoSlug);
3391
+ }
3392
+ const result = spawn("agent-env", args, { stdio: "inherit" });
3393
+ exit(result.status ?? 1);
3394
+ }
3395
+
3207
3396
  // src/lib/interactive-menu.ts
3208
3397
  async function launchActionLoop(workspaceName, deps, repoSlug) {
3209
3398
  while (true) {
@@ -3213,6 +3402,10 @@ async function launchActionLoop(workspaceName, deps, repoSlug) {
3213
3402
  if (action === "exit") {
3214
3403
  break;
3215
3404
  }
3405
+ if (action === "restart") {
3406
+ restartMenu({ workspaceName, repoSlug });
3407
+ continue;
3408
+ }
3216
3409
  if (action === "shutdown") {
3217
3410
  const shutdownResult = await deps.shutdownInstance(workspaceName, repoSlug);
3218
3411
  if (!shutdownResult.ok) {
@@ -3238,6 +3431,9 @@ async function launchActionLoop(workspaceName, deps, repoSlug) {
3238
3431
  case "set-purpose":
3239
3432
  result = await deps.setPurpose(workspaceName, purposeValue ?? "", repoSlug);
3240
3433
  break;
3434
+ case "check-updates":
3435
+ result = await deps.checkForUpdates();
3436
+ break;
3241
3437
  }
3242
3438
  if (!result.ok && result.error) {
3243
3439
  const { code, message, suggestion } = result.error;
@@ -3267,7 +3463,10 @@ async function launchInstancePicker(deps) {
3267
3463
 
3268
3464
  // src/lib/menu-deps.ts
3269
3465
  import { render as render2 } from "ink";
3270
- import React3 from "react";
3466
+ import React4 from "react";
3467
+
3468
+ // src/components/MenuContainer.tsx
3469
+ import { useEffect, useState as useState2 } from "react";
3271
3470
 
3272
3471
  // src/components/InteractiveMenu.tsx
3273
3472
  import { Select, TextInput } from "@inkjs/ui";
@@ -3305,18 +3504,66 @@ function PurposeInput({
3305
3504
  /* @__PURE__ */ jsx3(TextInput, { placeholder: "Enter purpose...", onSubmit })
3306
3505
  ] });
3307
3506
  }
3308
- var ACTION_OPTIONS = [
3507
+ var BASE_ACTION_OPTIONS = [
3309
3508
  { label: "\u{1F680} Attach to session", value: "attach" },
3310
3509
  { label: "\u{1F4BB} Open in VS Code", value: "code" },
3311
3510
  { label: "\u{1F6E0} Rebuild container", value: "rebuild" },
3312
3511
  { label: "\u23F9 Shutdown container", value: "shutdown" },
3313
- { label: "\u{1F4DD} Set Purpose", value: "set-purpose" },
3314
- { label: "\u{1F6AA} Exit", value: "exit" }
3512
+ { label: "\u{1F4DD} Set Purpose", value: "set-purpose" }
3315
3513
  ];
3514
+ var EXIT_OPTION = { label: "\u{1F6AA} Exit", value: "exit" };
3515
+ var RESTART_REQUIRED_OPTION = {
3516
+ label: "\u267B\uFE0F Restart menu (required \u2014 agent-env was upgraded)",
3517
+ value: "restart"
3518
+ };
3519
+ var CHECK_FOR_UPDATES_OPTION = {
3520
+ label: "\u{1F504} Check for updates",
3521
+ value: "check-updates"
3522
+ };
3523
+ function hasNewerInstall(driftState) {
3524
+ if (!driftState?.installedVersion) return false;
3525
+ return isNewerVersion2(driftState.currentVersion, driftState.installedVersion);
3526
+ }
3527
+ function buildActionOptions(driftState) {
3528
+ if (driftState?.packageMoved) {
3529
+ return [RESTART_REQUIRED_OPTION, ...BASE_ACTION_OPTIONS, EXIT_OPTION];
3530
+ }
3531
+ if (driftState && hasNewerInstall(driftState)) {
3532
+ const label = `\u267B\uFE0F Restart menu (v${driftState.installedVersion} installed)`;
3533
+ return [{ label, value: "restart" }, ...BASE_ACTION_OPTIONS, EXIT_OPTION];
3534
+ }
3535
+ if (driftState?.updateMessage) {
3536
+ return [...BASE_ACTION_OPTIONS, CHECK_FOR_UPDATES_OPTION, EXIT_OPTION];
3537
+ }
3538
+ if (driftState) {
3539
+ return [...BASE_ACTION_OPTIONS, CHECK_FOR_UPDATES_OPTION, EXIT_OPTION];
3540
+ }
3541
+ return [...BASE_ACTION_OPTIONS, EXIT_OPTION];
3542
+ }
3543
+ function DriftBanner({ driftState }) {
3544
+ if (driftState.packageMoved) {
3545
+ return /* @__PURE__ */ jsxs3(Box2, { marginBottom: 1, flexDirection: "column", children: [
3546
+ /* @__PURE__ */ jsx3(Text3, { color: "red", bold: true, children: "\u26A0 agent-env was upgraded since this menu started." }),
3547
+ /* @__PURE__ */ jsx3(Text3, { color: "red", children: "Rebuild and other commands will fail until you restart the menu." })
3548
+ ] });
3549
+ }
3550
+ if (hasNewerInstall(driftState)) {
3551
+ return /* @__PURE__ */ jsx3(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsxs3(Text3, { color: "yellow", children: [
3552
+ "agent-env v",
3553
+ driftState.installedVersion,
3554
+ " is installed \u2014 restart to use it"
3555
+ ] }) });
3556
+ }
3557
+ if (driftState.updateMessage) {
3558
+ return /* @__PURE__ */ jsx3(Box2, { marginBottom: 1, flexDirection: "column", children: /* @__PURE__ */ jsx3(Text3, { color: "yellow", children: driftState.updateMessage }) });
3559
+ }
3560
+ return null;
3561
+ }
3316
3562
  function InteractiveMenu({
3317
3563
  instanceInfo,
3318
3564
  onAction,
3319
- onSetPurpose
3565
+ onSetPurpose,
3566
+ driftState
3320
3567
  }) {
3321
3568
  const [mode, setMode] = useState("actions");
3322
3569
  const { name, status, repoSlug, purpose } = instanceInfo;
@@ -3338,34 +3585,89 @@ function InteractiveMenu({
3338
3585
  if (purpose !== null) {
3339
3586
  headerParts.push(purpose);
3340
3587
  }
3588
+ const actionOptions = buildActionOptions(driftState);
3341
3589
  return /* @__PURE__ */ jsxs3(Box2, { flexDirection: "column", children: [
3590
+ driftState ? /* @__PURE__ */ jsx3(DriftBanner, { driftState }) : null,
3342
3591
  /* @__PURE__ */ jsx3(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsx3(Text3, { bold: true, children: headerParts.join(" \xB7 ") }) }),
3343
3592
  mode === "actions" ? /* @__PURE__ */ jsx3(
3344
3593
  Select,
3345
3594
  {
3346
- options: ACTION_OPTIONS,
3595
+ options: actionOptions,
3347
3596
  onChange: handleActionChange,
3348
- visibleOptionCount: ACTION_OPTIONS.length
3597
+ visibleOptionCount: actionOptions.length
3349
3598
  }
3350
3599
  ) : /* @__PURE__ */ jsx3(PurposeInput, { onSubmit: handlePurposeSubmit, onCancel: handlePurposeCancel })
3351
3600
  ] });
3352
3601
  }
3353
3602
 
3603
+ // src/components/MenuContainer.tsx
3604
+ import { jsx as jsx4 } from "react/jsx-runtime";
3605
+ var DRIFT_POLL_INTERVAL_MS = 10 * 60 * 1e3;
3606
+ function makeNeutralDriftState() {
3607
+ return {
3608
+ packageMoved: false,
3609
+ updateMessage: null,
3610
+ installedVersion: null,
3611
+ currentVersion: getCurrentVersion()
3612
+ };
3613
+ }
3614
+ function MenuContainer({
3615
+ instanceInfo,
3616
+ onAction,
3617
+ onSetPurpose,
3618
+ initialDriftState,
3619
+ detectDriftStateFn = detectDriftState,
3620
+ pollIntervalMs = DRIFT_POLL_INTERVAL_MS
3621
+ }) {
3622
+ const [driftState, setDriftState] = useState2(
3623
+ initialDriftState ?? makeNeutralDriftState()
3624
+ );
3625
+ useEffect(() => {
3626
+ let cancelled = false;
3627
+ const runProbe = async () => {
3628
+ try {
3629
+ const next = await detectDriftStateFn();
3630
+ if (!cancelled) {
3631
+ setDriftState(next);
3632
+ }
3633
+ } catch {
3634
+ }
3635
+ };
3636
+ void runProbe();
3637
+ const handle = setInterval(() => {
3638
+ void runProbe();
3639
+ }, pollIntervalMs);
3640
+ return () => {
3641
+ cancelled = true;
3642
+ clearInterval(handle);
3643
+ };
3644
+ }, [detectDriftStateFn, pollIntervalMs]);
3645
+ return /* @__PURE__ */ jsx4(
3646
+ InteractiveMenu,
3647
+ {
3648
+ instanceInfo,
3649
+ onAction,
3650
+ onSetPurpose,
3651
+ driftState
3652
+ }
3653
+ );
3654
+ }
3655
+
3354
3656
  // src/lib/rebuild-instance.ts
3355
3657
  import {
3356
- access as access4,
3658
+ access as access5,
3357
3659
  cp as cp3,
3358
- mkdir as mkdir8,
3660
+ mkdir as mkdir9,
3359
3661
  readdir as readdir7,
3360
- readFile as readFile10,
3662
+ readFile as readFile11,
3361
3663
  rename as rename7,
3362
3664
  rm as rm3,
3363
3665
  stat as stat7,
3364
- writeFile as writeFile9,
3666
+ writeFile as writeFile10,
3365
3667
  appendFile as appendFile6
3366
3668
  } from "fs/promises";
3367
- import { homedir as homedir7 } from "os";
3368
- import { join as join10 } from "path";
3669
+ import { homedir as homedir8 } from "os";
3670
+ import { join as join11 } from "path";
3369
3671
 
3370
3672
  // src/lib/tmux-utils.ts
3371
3673
  async function saveTmuxState(containerName, deps) {
@@ -3394,10 +3696,10 @@ function createRebuildDefaultDeps() {
3394
3696
  return {
3395
3697
  executor,
3396
3698
  container: createContainerLifecycle(executor),
3397
- workspaceFsDeps: { mkdir: mkdir8, readdir: readdir7, stat: stat7, homedir: homedir7 },
3398
- stateFsDeps: { readFile: readFile10, writeFile: writeFile9, rename: rename7, mkdir: mkdir8, appendFile: appendFile6 },
3399
- devcontainerFsDeps: { cp: cp3, mkdir: mkdir8, readdir: readdir7, readFile: readFile10, stat: stat7, writeFile: writeFile9 },
3400
- mergeDeps: { readFile: readFile10, writeFile: writeFile9, rename: rename7, access: access4 },
3699
+ workspaceFsDeps: { mkdir: mkdir9, readdir: readdir7, stat: stat7, homedir: homedir8 },
3700
+ stateFsDeps: { readFile: readFile11, writeFile: writeFile10, rename: rename7, mkdir: mkdir9, appendFile: appendFile6 },
3701
+ devcontainerFsDeps: { cp: cp3, mkdir: mkdir9, readdir: readdir7, readFile: readFile11, stat: stat7, writeFile: writeFile10 },
3702
+ mergeDeps: { readFile: readFile11, writeFile: writeFile10, rename: rename7, access: access5 },
3401
3703
  rm: rm3,
3402
3704
  rename: rename7,
3403
3705
  logger: { warn: (msg) => console.warn(msg), info: (msg) => console.info(msg) }
@@ -3429,7 +3731,7 @@ async function refreshMergedConfig(wsRoot, containerName, wsName, repoSlug, purp
3429
3731
  }
3430
3732
  const merged = mergeDevcontainerConfigs(managed, repoConfig);
3431
3733
  await copyManagedAssets(wsRoot, deps.devcontainerFsDeps);
3432
- const configPath = join10(wsRoot, AGENT_ENV_DIR, "devcontainer.json");
3734
+ const configPath = join11(wsRoot, AGENT_ENV_DIR, "devcontainer.json");
3433
3735
  await writeGeneratedConfig(configPath, merged, deps.mergeDeps);
3434
3736
  return { ok: true, repoConfigDetected: repoConfig !== void 0 };
3435
3737
  } catch (err) {
@@ -3529,7 +3831,7 @@ async function teardownContainer(containerName, container, statusResult) {
3529
3831
  return { ok: true };
3530
3832
  }
3531
3833
  async function startAndDiscoverContainer(wsPath, containerName, purpose, buildNoCache, container, onProgress) {
3532
- const configPath = join10(wsPath.root, AGENT_ENV_DIR, "devcontainer.json");
3834
+ const configPath = join11(wsPath.root, AGENT_ENV_DIR, "devcontainer.json");
3533
3835
  const containerResult = await container.devcontainerUp(wsPath.root, containerName, {
3534
3836
  buildNoCache,
3535
3837
  remoteEnv: { AGENT_INSTANCE: wsPath.name, AGENT_ENV_PURPOSE: purpose },
@@ -3632,15 +3934,15 @@ async function rebuildInstance(instanceName, deps, options, repoSlug) {
3632
3934
  }
3633
3935
 
3634
3936
  // src/lib/shutdown-instance.ts
3635
- import { appendFile as appendFile7, mkdir as mkdir9, readdir as readdir8, readFile as readFile11, rename as rename8, stat as stat8, writeFile as writeFile10 } from "fs/promises";
3636
- import { homedir as homedir8 } from "os";
3937
+ import { appendFile as appendFile7, mkdir as mkdir10, readdir as readdir8, readFile as readFile12, rename as rename8, stat as stat8, writeFile as writeFile11 } from "fs/promises";
3938
+ import { homedir as homedir9 } from "os";
3637
3939
  function createShutdownDefaultDeps() {
3638
3940
  const executor = createExecutor();
3639
3941
  return {
3640
3942
  executor,
3641
3943
  container: createContainerLifecycle(executor),
3642
- workspaceFsDeps: { mkdir: mkdir9, readdir: readdir8, stat: stat8, homedir: homedir8 },
3643
- stateFsDeps: { readFile: readFile11, writeFile: writeFile10, rename: rename8, mkdir: mkdir9, appendFile: appendFile7 },
3944
+ workspaceFsDeps: { mkdir: mkdir10, readdir: readdir8, stat: stat8, homedir: homedir9 },
3945
+ stateFsDeps: { readFile: readFile12, writeFile: writeFile11, rename: rename8, mkdir: mkdir10, appendFile: appendFile7 },
3644
3946
  logger: { warn: (msg) => console.warn(msg), info: (msg) => console.info(msg) }
3645
3947
  };
3646
3948
  }
@@ -3714,22 +4016,30 @@ function buildMenuDeps() {
3714
4016
  slug
3715
4017
  );
3716
4018
  },
3717
- rebuildInstance: (wsName, slug) => {
4019
+ rebuildInstance: async (wsName, slug) => {
4020
+ if (await isPackagePathStale()) {
4021
+ return {
4022
+ ok: false,
4023
+ error: {
4024
+ code: "VERSION_DRIFT",
4025
+ message: "agent-env was upgraded since this menu started.",
4026
+ suggestion: 'Pick "Restart menu" from the menu to reload with the new version.'
4027
+ }
4028
+ };
4029
+ }
3718
4030
  const rebuildDeps = createRebuildDefaultDeps();
3719
4031
  const progress = createProgressLine();
3720
4032
  console.log(`Rebuilding instance '${wsName}'...`);
3721
- return rebuildInstance(
3722
- wsName,
3723
- rebuildDeps,
3724
- { force: true, onProgress: progress.update },
3725
- slug
3726
- ).then((result) => {
3727
- progress.clear();
3728
- return result;
3729
- }).catch((err) => {
4033
+ try {
4034
+ return await rebuildInstance(
4035
+ wsName,
4036
+ rebuildDeps,
4037
+ { force: true, onProgress: progress.update },
4038
+ slug
4039
+ );
4040
+ } finally {
3730
4041
  progress.clear();
3731
- throw err;
3732
- });
4042
+ }
3733
4043
  },
3734
4044
  shutdownInstance: (wsName, slug) => {
3735
4045
  const deps = createShutdownDefaultDeps();
@@ -3745,11 +4055,30 @@ function buildMenuDeps() {
3745
4055
  const deps = createPurposeDefaultDeps();
3746
4056
  return setPurpose(wsName, value, deps, slug);
3747
4057
  },
4058
+ checkForUpdates: async () => {
4059
+ console.log("Checking for updates...");
4060
+ const state = await detectDriftState({}, { forceRefresh: true });
4061
+ const current = getCurrentVersion();
4062
+ if (state.packageMoved) {
4063
+ console.log(
4064
+ '\x1B[31m\u26A0 agent-env was upgraded since this menu started \u2014 pick "Restart menu" to reload.\x1B[0m'
4065
+ );
4066
+ } else if (state.installedVersion && isNewerVersion2(current, state.installedVersion)) {
4067
+ console.log(
4068
+ `\x1B[33magent-env v${state.installedVersion} is installed \u2014 pick "Restart menu" to use it.\x1B[0m`
4069
+ );
4070
+ } else if (state.updateMessage) {
4071
+ console.log(state.updateMessage);
4072
+ } else {
4073
+ console.log(`\x1B[32m\u2713\x1B[0m agent-env ${current} is up to date`);
4074
+ }
4075
+ return { ok: true };
4076
+ },
3748
4077
  getInstanceInfo: (wsName) => getInstanceInfo(wsName),
3749
4078
  renderMenu: (instanceInfo) => {
3750
4079
  return new Promise((resolve2) => {
3751
4080
  const { unmount, waitUntilExit } = render2(
3752
- React3.createElement(InteractiveMenu, {
4081
+ React4.createElement(MenuContainer, {
3753
4082
  instanceInfo,
3754
4083
  onAction: (action) => {
3755
4084
  unmount();
@@ -3890,7 +4219,7 @@ function handleSetResult(result) {
3890
4219
  }
3891
4220
 
3892
4221
  // src/commands/rebuild.ts
3893
- import chalk from "chalk";
4222
+ import chalk2 from "chalk";
3894
4223
  import { Command as Command10 } from "commander";
3895
4224
  var rebuildCommand = new Command10("rebuild").description("Rebuild an instance by recreating its container").argument("<name>", "Instance name to rebuild").option("--force", "Rebuild even if the container is currently running").option("--yes", "Skip confirmation prompt").option("--no-pull", "Skip pulling fresh base images").option("--use-cache", "Allow Docker build layer cache reuse").option("--repo <slug>", "Repo slug or URL to scope instance lookup").action(
3896
4225
  async (name, options) => {
@@ -3900,7 +4229,7 @@ var rebuildCommand = new Command10("rebuild").description("Rebuild an instance b
3900
4229
  if (!options.yes && !options.force && process.stdin.isTTY) {
3901
4230
  confirmed = await promptForConfirmation(
3902
4231
  `
3903
- ${chalk.yellow("Warning:")} Rebuilding '${name}' will destroy the current container and create a new one.
4232
+ ${chalk2.yellow("Warning:")} Rebuilding '${name}' will destroy the current container and create a new one.
3904
4233
  Any active sessions will be lost. Continue? (y/N) `
3905
4234
  );
3906
4235
  if (!confirmed) {
@@ -3928,10 +4257,10 @@ Any active sessions will be lost. Continue? (y/N) `
3928
4257
  if (result.error.code === "CONTAINER_RUNNING") {
3929
4258
  console.error("");
3930
4259
  console.error(
3931
- chalk.yellow("Container is currently running.") + " Active sessions will be terminated during rebuild."
4260
+ chalk2.yellow("Container is currently running.") + " Active sessions will be terminated during rebuild."
3932
4261
  );
3933
4262
  console.error("");
3934
- console.error(`Use ${chalk.bold("--force")} to rebuild anyway.`);
4263
+ console.error(`Use ${chalk2.bold("--force")} to rebuild anyway.`);
3935
4264
  } else {
3936
4265
  const { code, message, suggestion } = result.error;
3937
4266
  console.error(formatError(createError(code, message, suggestion)));
@@ -3948,23 +4277,23 @@ Any active sessions will be lost. Continue? (y/N) `
3948
4277
  );
3949
4278
 
3950
4279
  // src/commands/remove.ts
3951
- import chalk3 from "chalk";
4280
+ import chalk4 from "chalk";
3952
4281
  import { Command as Command11 } from "commander";
3953
4282
  import { createInterface as createInterface2 } from "readline";
3954
4283
 
3955
4284
  // src/lib/audit-log.ts
3956
- import { appendFile as appendFile8, mkdir as mkdir10 } from "fs/promises";
3957
- import { homedir as homedir9 } from "os";
3958
- import { join as join11 } from "path";
4285
+ import { appendFile as appendFile8, mkdir as mkdir11 } from "fs/promises";
4286
+ import { homedir as homedir10 } from "os";
4287
+ import { join as join12 } from "path";
3959
4288
  function createAuditLogDefaultDeps() {
3960
- return { appendFile: appendFile8, mkdir: mkdir10, homedir: homedir9 };
4289
+ return { appendFile: appendFile8, mkdir: mkdir11, homedir: homedir10 };
3961
4290
  }
3962
4291
  function getAuditLogPath(deps) {
3963
- return join11(deps.homedir(), AGENT_ENV_DIR, "audit.log");
4292
+ return join12(deps.homedir(), AGENT_ENV_DIR, "audit.log");
3964
4293
  }
3965
4294
  async function writeAuditLogEntry(entry, deps = createAuditLogDefaultDeps()) {
3966
4295
  const logPath = getAuditLogPath(deps);
3967
- await deps.mkdir(join11(deps.homedir(), AGENT_ENV_DIR), { recursive: true });
4296
+ await deps.mkdir(join12(deps.homedir(), AGENT_ENV_DIR), { recursive: true });
3968
4297
  const line = JSON.stringify(entry) + "\n";
3969
4298
  await deps.appendFile(logPath, line, "utf-8");
3970
4299
  }
@@ -3979,16 +4308,16 @@ function createAuditEntry(instanceName, gitState, confirmationMethod) {
3979
4308
  }
3980
4309
 
3981
4310
  // src/lib/remove-instance.ts
3982
- import { mkdir as mkdir11, readdir as readdir9, readFile as readFile12, rm as rm4, stat as stat9 } from "fs/promises";
3983
- import { homedir as homedir10 } from "os";
4311
+ import { mkdir as mkdir12, readdir as readdir9, readFile as readFile13, rm as rm4, stat as stat9 } from "fs/promises";
4312
+ import { homedir as homedir11 } from "os";
3984
4313
  function createRemoveDefaultDeps() {
3985
4314
  const executor = createExecutor();
3986
4315
  return {
3987
4316
  executor,
3988
4317
  container: createContainerLifecycle(executor),
3989
4318
  gitDetector: createGitStateDetector(executor),
3990
- workspaceFsDeps: { mkdir: mkdir11, readdir: readdir9, stat: stat9, homedir: homedir10 },
3991
- stateFsDeps: { readFile: readFile12 },
4319
+ workspaceFsDeps: { mkdir: mkdir12, readdir: readdir9, stat: stat9, homedir: homedir11 },
4320
+ stateFsDeps: { readFile: readFile13 },
3992
4321
  deleteFsDeps: { rm: rm4 }
3993
4322
  };
3994
4323
  }
@@ -4135,7 +4464,7 @@ async function removeInstance(instanceName, deps, force = false, repoSlug) {
4135
4464
  }
4136
4465
 
4137
4466
  // src/lib/safety-report.ts
4138
- import chalk2 from "chalk";
4467
+ import chalk3 from "chalk";
4139
4468
  var BLOCKER_NEVER_PUSHED = "never pushed";
4140
4469
  var BLOCKER_DETACHED_HEAD = "detached HEAD";
4141
4470
  function classifyBlocker(blocker) {
@@ -4188,19 +4517,19 @@ function formatSafetyReport(instanceName, blockers, gitState) {
4188
4517
  message: blocker
4189
4518
  }));
4190
4519
  for (const item of items) {
4191
- const prefix = item.severity === "Danger" ? chalk2.red("[Danger]") : chalk2.yellow("[Warning]");
4520
+ const prefix = item.severity === "Danger" ? chalk3.red("[Danger]") : chalk3.yellow("[Warning]");
4192
4521
  lines.push(` ${prefix} ${item.message}`);
4193
4522
  }
4194
4523
  const suggestions = getSuggestions(gitState);
4195
4524
  if (suggestions.length > 0) {
4196
4525
  lines.push("");
4197
- lines.push(chalk2.bold("Suggestions:"));
4526
+ lines.push(chalk3.bold("Suggestions:"));
4198
4527
  for (const suggestion of suggestions) {
4199
4528
  lines.push(` - ${suggestion}`);
4200
4529
  }
4201
4530
  }
4202
4531
  lines.push("");
4203
- lines.push(chalk2.gray("Or use --force to bypass safety checks (data loss is permanent)."));
4532
+ lines.push(chalk3.gray("Or use --force to bypass safety checks (data loss is permanent)."));
4204
4533
  return lines.join("\n");
4205
4534
  }
4206
4535
 
@@ -4239,12 +4568,12 @@ async function writeAuditLog(name, gitState, confirmationMethod) {
4239
4568
  }
4240
4569
  function showForceWarning(name, blockers, gitState) {
4241
4570
  console.error("");
4242
- console.error(chalk3.red.bold("\u26A0\uFE0F WARNING: Force removing with unsaved work"));
4571
+ console.error(chalk4.red.bold("\u26A0\uFE0F WARNING: Force removing with unsaved work"));
4243
4572
  console.error("");
4244
4573
  console.error(
4245
4574
  formatSafetyReport(name, blockers, gitState).replace(
4246
4575
  /Or use --force.*/,
4247
- chalk3.red("This data will be PERMANENTLY DELETED.")
4576
+ chalk4.red("This data will be PERMANENTLY DELETED.")
4248
4577
  )
4249
4578
  );
4250
4579
  }
@@ -4255,7 +4584,7 @@ async function resolveConfirmation(name, options) {
4255
4584
  if (!process.stdin.isTTY) {
4256
4585
  console.error("");
4257
4586
  console.error(
4258
- chalk3.red(
4587
+ chalk4.red(
4259
4588
  "Cannot prompt for confirmation in non-interactive mode. Use --yes to skip confirmation."
4260
4589
  )
4261
4590
  );
@@ -4384,8 +4713,8 @@ var reposCommand = new Command12("repos").description("List tracked repositories
4384
4713
 
4385
4714
  // src/commands/setup-audio.ts
4386
4715
  import { Command as Command13 } from "commander";
4387
- import { copyFile, mkdir as mkdir12, readFile as readFile13, writeFile as writeFile11, access as access5 } from "fs/promises";
4388
- import { homedir as homedir11, platform } from "os";
4716
+ import { copyFile, mkdir as mkdir13, readFile as readFile14, writeFile as writeFile12, access as access6 } from "fs/promises";
4717
+ import { homedir as homedir12, platform } from "os";
4389
4718
 
4390
4719
  // src/lib/setup-audio.ts
4391
4720
  async function setupAudio(deps) {
@@ -4480,13 +4809,13 @@ function createDefaultSetupAudioDeps() {
4480
4809
  const exec = createExecutor();
4481
4810
  return {
4482
4811
  platform: platform(),
4483
- homeDir: homedir11(),
4812
+ homeDir: homedir12(),
4484
4813
  execute: exec,
4485
- readFile: (path, encoding) => readFile13(path, encoding),
4486
- writeFile: (path, content, encoding) => writeFile11(path, content, encoding),
4814
+ readFile: (path, encoding) => readFile14(path, encoding),
4815
+ writeFile: (path, content, encoding) => writeFile12(path, content, encoding),
4487
4816
  copyFile,
4488
- mkdir: (path, opts) => mkdir12(path, opts),
4489
- access: (path) => access5(path)
4817
+ mkdir: (path, opts) => mkdir13(path, opts),
4818
+ access: (path) => access6(path)
4490
4819
  };
4491
4820
  }
4492
4821
  var setupAudioCommand = new Command13("setup-audio").description("Configure macOS PulseAudio for audio passthrough to containers").action(async () => {
@@ -4509,7 +4838,7 @@ var setupAudioCommand = new Command13("setup-audio").description("Configure macO
4509
4838
  });
4510
4839
 
4511
4840
  // src/commands/shutdown.ts
4512
- import chalk4 from "chalk";
4841
+ import chalk5 from "chalk";
4513
4842
  import { Command as Command14 } from "commander";
4514
4843
  var shutdownCommand = new Command14("shutdown").description("Gracefully shut down an instance (save tmux state, stop container)").argument("<name>", "Instance name to shut down").option("--yes", "Skip confirmation prompt").option("--repo <slug>", "Repo slug or URL to scope instance lookup").action(async (name, options) => {
4515
4844
  const repoSlug = await resolveRepoOrExit({ repo: options.repo, cwd: process.cwd() });
@@ -4533,7 +4862,7 @@ Shutdown '${name}'? This will stop the container. (y/N) `
4533
4862
  process.exit(1);
4534
4863
  return;
4535
4864
  }
4536
- console.log(`${chalk4.green("\u2713")} Instance '${name}' shut down`);
4865
+ console.log(`${chalk5.green("\u2713")} Instance '${name}' shut down`);
4537
4866
  if (result.tmuxSaved) {
4538
4867
  console.log(" Tmux session state saved");
4539
4868
  }
@@ -4547,14 +4876,14 @@ Shutdown '${name}'? This will stop the container. (y/N) `
4547
4876
  // src/commands/tmux-restore.ts
4548
4877
  import { Command as Command15 } from "commander";
4549
4878
  import { execSync } from "child_process";
4550
- import { join as join13 } from "path";
4879
+ import { join as join14 } from "path";
4551
4880
 
4552
4881
  // src/lib/tmux-session.ts
4553
- import { readFile as readFile14, writeFile as writeFile12, rename as rename9, mkdir as mkdir13 } from "fs/promises";
4554
- import { dirname as dirname3, join as join12 } from "path";
4882
+ import { readFile as readFile15, writeFile as writeFile13, rename as rename9, mkdir as mkdir14 } from "fs/promises";
4883
+ import { dirname as dirname4, join as join13 } from "path";
4555
4884
  async function readPanesState(path) {
4556
4885
  try {
4557
- const content = await readFile14(path, "utf-8");
4886
+ const content = await readFile15(path, "utf-8");
4558
4887
  const parsed = JSON.parse(content);
4559
4888
  if (typeof parsed === "object" && parsed !== null && parsed.version === 1) {
4560
4889
  return parsed;
@@ -4565,14 +4894,14 @@ async function readPanesState(path) {
4565
4894
  }
4566
4895
  }
4567
4896
  async function writePanesState(path, state) {
4568
- await mkdir13(dirname3(path), { recursive: true });
4897
+ await mkdir14(dirname4(path), { recursive: true });
4569
4898
  const tmpPath = path + ".tmp";
4570
- await writeFile12(tmpPath, JSON.stringify(state), "utf-8");
4899
+ await writeFile13(tmpPath, JSON.stringify(state), "utf-8");
4571
4900
  await rename9(tmpPath, path);
4572
4901
  }
4573
4902
  async function readSessionState(path) {
4574
4903
  try {
4575
- const content = await readFile14(path, "utf-8");
4904
+ const content = await readFile15(path, "utf-8");
4576
4905
  const parsed = JSON.parse(content);
4577
4906
  if (typeof parsed === "object" && parsed !== null && parsed.version === 1 && Array.isArray(parsed.windows)) {
4578
4907
  return parsed;
@@ -4583,9 +4912,9 @@ async function readSessionState(path) {
4583
4912
  }
4584
4913
  }
4585
4914
  async function writeSessionState(path, state) {
4586
- await mkdir13(dirname3(path), { recursive: true });
4915
+ await mkdir14(dirname4(path), { recursive: true });
4587
4916
  const tmpPath = path + ".tmp";
4588
- await writeFile12(tmpPath, JSON.stringify(state, null, 2), "utf-8");
4917
+ await writeFile13(tmpPath, JSON.stringify(state, null, 2), "utf-8");
4589
4918
  await rename9(tmpPath, path);
4590
4919
  }
4591
4920
  function pruneStaleEntries(state, activePaneIds) {
@@ -4602,7 +4931,7 @@ function pruneStaleEntries(state, activePaneIds) {
4602
4931
  function resolveTmuxStateDir(agentInstance) {
4603
4932
  const instance = agentInstance || process.env.AGENT_INSTANCE;
4604
4933
  if (!instance) return null;
4605
- return join12("/shared-data/instance", instance, "tmux");
4934
+ return join13("/shared-data/instance", instance, "tmux");
4606
4935
  }
4607
4936
 
4608
4937
  // src/commands/tmux-restore.ts
@@ -4638,7 +4967,7 @@ function ensureTmuxSession(savedName) {
4638
4967
  async function executeTmuxRestore() {
4639
4968
  const stateDir = resolveTmuxStateDir();
4640
4969
  if (!stateDir) return;
4641
- const sessionState = await readSessionState(join13(stateDir, "session.json"));
4970
+ const sessionState = await readSessionState(join14(stateDir, "session.json"));
4642
4971
  if (!sessionState) return;
4643
4972
  const sessionName = ensureTmuxSession(sessionState.tmux_session);
4644
4973
  const quotedSession = shellQuote(sessionName);
@@ -4676,11 +5005,11 @@ var tmuxRestoreCommand = new Command15("tmux-restore").description("Restore tmux
4676
5005
  import { Command as Command16 } from "commander";
4677
5006
  import { execSync as execSync2 } from "child_process";
4678
5007
  import { unlink as unlink2 } from "fs/promises";
4679
- import { join as join14 } from "path";
5008
+ import { join as join15 } from "path";
4680
5009
  async function executeTmuxSave() {
4681
5010
  const stateDir = resolveTmuxStateDir();
4682
5011
  if (!stateDir) return;
4683
- const sessionPath = join14(stateDir, "session.json");
5012
+ const sessionPath = join15(stateDir, "session.json");
4684
5013
  let tmuxOutput;
4685
5014
  try {
4686
5015
  tmuxOutput = execSync2(
@@ -4708,7 +5037,7 @@ async function executeTmuxSave() {
4708
5037
  });
4709
5038
  return;
4710
5039
  }
4711
- const panesPath = join14(stateDir, "claude-sessions.json");
5040
+ const panesPath = join15(stateDir, "claude-sessions.json");
4712
5041
  const panesState = await readPanesState(panesPath);
4713
5042
  let activeWindow = 1;
4714
5043
  try {
@@ -4762,9 +5091,9 @@ var tmuxSaveCommand = new Command16("tmux-save").description("Save current tmux
4762
5091
  import { Command as Command17 } from "commander";
4763
5092
 
4764
5093
  // src/lib/tmux-status.ts
4765
- import { readFile as readFile15 } from "fs/promises";
5094
+ import { readFile as readFile16 } from "fs/promises";
4766
5095
  var MAX_PURPOSE_DISPLAY_LEN = 40;
4767
- var defaultDeps3 = { readFile: readFile15 };
5096
+ var defaultDeps3 = { readFile: readFile16 };
4768
5097
  function formatTmuxStatus(instance, purpose) {
4769
5098
  if (!instance) return "?";
4770
5099
  if (!purpose) return instance;
@@ -4811,101 +5140,6 @@ function createTmuxStatusCommand(deps = defaultDeps4) {
4811
5140
  }
4812
5141
  var tmuxStatusCommand = createTmuxStatusCommand();
4813
5142
 
4814
- // src/lib/update-check.ts
4815
- import chalk5 from "chalk";
4816
- import * as fs from "fs/promises";
4817
- import { dirname as dirname4 } from "path";
4818
- function normaliseVersion(version2) {
4819
- const withoutBuild = version2.split("+")[0];
4820
- const withoutPre = withoutBuild.split("-")[0];
4821
- return withoutPre;
4822
- }
4823
- function isNewerVersion(current, registry) {
4824
- const normCurrent = normaliseVersion(current);
4825
- const normRegistry = normaliseVersion(registry);
4826
- const currentParts = normCurrent.split(".").map(Number);
4827
- const registryParts = normRegistry.split(".").map(Number);
4828
- const len = Math.max(currentParts.length, registryParts.length);
4829
- for (let i = 0; i < len; i++) {
4830
- const c = currentParts[i] ?? 0;
4831
- const r = registryParts[i] ?? 0;
4832
- if (r > c) return true;
4833
- if (r < c) return false;
4834
- }
4835
- return false;
4836
- }
4837
- async function readCache(cachePath, readFileFn) {
4838
- try {
4839
- const raw = await readFileFn(cachePath, "utf-8");
4840
- const parsed = JSON.parse(raw);
4841
- if (parsed !== null && typeof parsed === "object" && "lastCheck" in parsed && "latestVersion" in parsed && typeof parsed.lastCheck === "number" && typeof parsed.latestVersion === "string") {
4842
- return parsed;
4843
- }
4844
- return null;
4845
- } catch {
4846
- return null;
4847
- }
4848
- }
4849
- async function writeCache(cachePath, data, mkdirFn, writeFileFn) {
4850
- try {
4851
- await mkdirFn(dirname4(cachePath), { recursive: true });
4852
- await writeFileFn(cachePath, JSON.stringify(data), "utf-8");
4853
- } catch {
4854
- }
4855
- }
4856
- async function fetchLatestVersion(packageName, fetchFn) {
4857
- try {
4858
- const url = `https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`;
4859
- const response = await fetchFn(url, {
4860
- headers: { Accept: "application/json" },
4861
- signal: AbortSignal.timeout(5e3)
4862
- });
4863
- const json = await response.json();
4864
- if (json !== null && typeof json === "object" && "version" in json && typeof json.version === "string") {
4865
- return json.version;
4866
- }
4867
- return null;
4868
- } catch {
4869
- return null;
4870
- }
4871
- }
4872
- function formatUpdateMessage(currentVersion, latestVersion, packageName) {
4873
- const normCurrent = normaliseVersion(currentVersion);
4874
- const line1 = chalk5.yellow(`Update available: ${normCurrent} -> ${latestVersion}`);
4875
- const line2 = chalk5.cyan(`Run: pnpm add -g ${packageName}`);
4876
- return `${line1}
4877
- ${line2}`;
4878
- }
4879
- async function checkForUpdate(opts) {
4880
- const {
4881
- currentVersion,
4882
- packageName,
4883
- cachePath,
4884
- cacheTtlMs,
4885
- fetchFn = fetch,
4886
- readFile: readFile17 = (p, enc) => fs.readFile(p, enc),
4887
- writeFile: writeFile14 = (p, d, enc) => fs.writeFile(p, d, enc),
4888
- mkdir: mkdir15 = (p, o) => fs.mkdir(p, o),
4889
- now = () => Date.now()
4890
- } = opts;
4891
- const currentTime = now();
4892
- const cache = await readCache(cachePath, readFile17);
4893
- let latestVersion = null;
4894
- const isCacheFresh = cache !== null && currentTime - cache.lastCheck < cacheTtlMs;
4895
- if (isCacheFresh) {
4896
- latestVersion = cache.latestVersion;
4897
- } else {
4898
- latestVersion = await fetchLatestVersion(packageName, fetchFn);
4899
- if (latestVersion !== null) {
4900
- await writeCache(cachePath, { lastCheck: currentTime, latestVersion }, mkdir15, writeFile14);
4901
- }
4902
- }
4903
- if (latestVersion !== null && isNewerVersion(currentVersion, latestVersion)) {
4904
- return formatUpdateMessage(currentVersion, latestVersion, packageName);
4905
- }
4906
- return null;
4907
- }
4908
-
4909
5143
  // src/cli.ts
4910
5144
  var __dirname = dirname5(fileURLToPath2(import.meta.url));
4911
5145
  var isLinked = existsSync2(resolve(__dirname, "..", "..", "..", "pnpm-workspace.yaml"));
@@ -4960,8 +5194,8 @@ program.action(async () => {
4960
5194
  value: inst.name
4961
5195
  }));
4962
5196
  const { unmount } = render3(
4963
- React4.createElement(() => {
4964
- return React4.createElement(Select2, {
5197
+ React5.createElement(() => {
5198
+ return React5.createElement(Select2, {
4965
5199
  options,
4966
5200
  onChange: (value) => {
4967
5201
  unmount();
@@ -4987,7 +5221,7 @@ var shouldCheck = !!process.stderr.isTTY && !isInsideContainer() && !isLinked &&
4987
5221
  var updateCheckPromise = shouldCheck ? checkForUpdate({
4988
5222
  currentVersion: package_default.version,
4989
5223
  packageName: package_default.name,
4990
- cachePath: join15(homedir12(), ".agent-env", "update-check.json"),
5224
+ cachePath: join16(homedir13(), ".agent-env", "update-check.json"),
4991
5225
  cacheTtlMs: 36e5
4992
5226
  }) : Promise.resolve(null);
4993
5227
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zookanalytics/agent-env",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "CLI for creating isolated, AI-ready development environments",
5
5
  "type": "module",
6
6
  "bin": {