@zookanalytics/agent-env 0.10.0 → 0.12.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.
- package/dist/cli.js +322 -127
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ function createExecutor(executor = execa) {
|
|
|
25
25
|
if (onLine) {
|
|
26
26
|
const sub = subprocess;
|
|
27
27
|
const handleChunk = (chunk) => {
|
|
28
|
-
for (const line of chunk.toString().split(
|
|
28
|
+
for (const line of chunk.toString().split(/\r?\n|\r/)) {
|
|
29
29
|
const trimmed = line.trim();
|
|
30
30
|
if (trimmed)
|
|
31
31
|
onLine(trimmed);
|
|
@@ -49,7 +49,7 @@ var execute = createExecutor();
|
|
|
49
49
|
import { program } from "commander";
|
|
50
50
|
import { render as render3 } from "ink";
|
|
51
51
|
import { existsSync } from "fs";
|
|
52
|
-
import { homedir as
|
|
52
|
+
import { homedir as homedir11 } from "os";
|
|
53
53
|
import { dirname as dirname5, join as join14, resolve } from "path";
|
|
54
54
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
55
55
|
import React4 from "react";
|
|
@@ -57,7 +57,7 @@ import React4 from "react";
|
|
|
57
57
|
// package.json
|
|
58
58
|
var package_default = {
|
|
59
59
|
name: "@zookanalytics/agent-env",
|
|
60
|
-
version: "0.
|
|
60
|
+
version: "0.12.0",
|
|
61
61
|
description: "CLI for creating isolated, AI-ready development environments",
|
|
62
62
|
type: "module",
|
|
63
63
|
bin: {
|
|
@@ -1918,6 +1918,7 @@ async function attachInstance(instanceName, deps, onContainerStarting, onAttachi
|
|
|
1918
1918
|
}
|
|
1919
1919
|
|
|
1920
1920
|
// src/lib/command-helpers.ts
|
|
1921
|
+
import { createInterface } from "readline";
|
|
1921
1922
|
async function resolveRepoOrExit(opts) {
|
|
1922
1923
|
const executor = createExecutor();
|
|
1923
1924
|
const repoResult = await resolveRepo(opts, executor);
|
|
@@ -1934,6 +1935,22 @@ async function resolveRepoOrExit(opts) {
|
|
|
1934
1935
|
}
|
|
1935
1936
|
return void 0;
|
|
1936
1937
|
}
|
|
1938
|
+
function promptForConfirmation(message) {
|
|
1939
|
+
return new Promise((resolve2) => {
|
|
1940
|
+
const rl = createInterface({
|
|
1941
|
+
input: process.stdin,
|
|
1942
|
+
output: process.stderr
|
|
1943
|
+
});
|
|
1944
|
+
rl.question(message, (answer) => {
|
|
1945
|
+
rl.close();
|
|
1946
|
+
resolve2(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
1947
|
+
});
|
|
1948
|
+
rl.on("SIGINT", () => {
|
|
1949
|
+
rl.close();
|
|
1950
|
+
resolve2(false);
|
|
1951
|
+
});
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1937
1954
|
|
|
1938
1955
|
// src/commands/attach.ts
|
|
1939
1956
|
var attachCommand = new Command("attach").description("Attach to an instance's tmux session").argument("<name>", "Instance name to attach to").option("--repo <slug>", "Repo slug or URL to scope instance lookup").action(async (name, options) => {
|
|
@@ -2137,24 +2154,20 @@ var codeCommand = new Command2("code").description("Open an instance in VS Code
|
|
|
2137
2154
|
import { Command as Command3 } from "commander";
|
|
2138
2155
|
|
|
2139
2156
|
// src/lib/completion.ts
|
|
2140
|
-
var
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
"tmux-status",
|
|
2150
|
-
"completion"
|
|
2151
|
-
];
|
|
2152
|
-
function generateCompletionScript(shell) {
|
|
2157
|
+
var COMPLETION_EXCLUDED_COMMANDS = /* @__PURE__ */ new Set(["tmux-save", "tmux-restore", "setup-audio"]);
|
|
2158
|
+
function extractCompletionCommands(program2, excluded = COMPLETION_EXCLUDED_COMMANDS) {
|
|
2159
|
+
return program2.commands.filter((cmd) => !excluded.has(cmd.name())).map((cmd) => ({
|
|
2160
|
+
name: cmd.name(),
|
|
2161
|
+
description: cmd.description().split("\n")[0],
|
|
2162
|
+
aliases: cmd.aliases()
|
|
2163
|
+
}));
|
|
2164
|
+
}
|
|
2165
|
+
function generateCompletionScript(shell, commands) {
|
|
2153
2166
|
switch (shell) {
|
|
2154
2167
|
case "bash":
|
|
2155
|
-
return generateBashCompletion();
|
|
2168
|
+
return generateBashCompletion(commands);
|
|
2156
2169
|
case "zsh":
|
|
2157
|
-
return generateZshCompletion();
|
|
2170
|
+
return generateZshCompletion(commands);
|
|
2158
2171
|
}
|
|
2159
2172
|
}
|
|
2160
2173
|
function isValidShell(shell) {
|
|
@@ -2177,8 +2190,9 @@ function getInstallInstructions() {
|
|
|
2177
2190
|
# Or save to a file (ensure fpath includes the directory):
|
|
2178
2191
|
agent-env completion zsh > ~/.zsh/completions/_agent-env`;
|
|
2179
2192
|
}
|
|
2180
|
-
function generateBashCompletion() {
|
|
2181
|
-
const
|
|
2193
|
+
function generateBashCompletion(commands) {
|
|
2194
|
+
const allNames = commands.flatMap((c) => [c.name, ...c.aliases]);
|
|
2195
|
+
const commandList = allNames.join(" ");
|
|
2182
2196
|
return `#!/usr/bin/env bash
|
|
2183
2197
|
# agent-env bash completion script
|
|
2184
2198
|
# Install: eval "$(agent-env completion bash)"
|
|
@@ -2224,7 +2238,7 @@ _agent_env_completions() {
|
|
|
2224
2238
|
|
|
2225
2239
|
# Complete based on command
|
|
2226
2240
|
case "\${prev}" in
|
|
2227
|
-
attach|purpose)
|
|
2241
|
+
on|code|attach|path|purpose)
|
|
2228
2242
|
local instances
|
|
2229
2243
|
instances="$(_agent_env_instances)"
|
|
2230
2244
|
COMPREPLY=($(compgen -W "--repo \${instances}" -- "\${cur}"))
|
|
@@ -2244,6 +2258,12 @@ _agent_env_completions() {
|
|
|
2244
2258
|
COMPREPLY=($(compgen -W "--force --yes --no-pull --use-cache --repo \${instances}" -- "\${cur}"))
|
|
2245
2259
|
return 0
|
|
2246
2260
|
;;
|
|
2261
|
+
shutdown)
|
|
2262
|
+
local instances
|
|
2263
|
+
instances="$(_agent_env_instances)"
|
|
2264
|
+
COMPREPLY=($(compgen -W "--yes --repo \${instances}" -- "\${cur}"))
|
|
2265
|
+
return 0
|
|
2266
|
+
;;
|
|
2247
2267
|
remove)
|
|
2248
2268
|
local instances
|
|
2249
2269
|
instances="$(_agent_env_instances)"
|
|
@@ -2271,21 +2291,43 @@ _agent_env_completions() {
|
|
|
2271
2291
|
return 0
|
|
2272
2292
|
}
|
|
2273
2293
|
|
|
2274
|
-
complete -F _agent_env_completions agent-env
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2294
|
+
complete -F _agent_env_completions agent-env
|
|
2295
|
+
|
|
2296
|
+
# aecd: cd into an instance's host directory
|
|
2297
|
+
aecd() {
|
|
2298
|
+
local dir
|
|
2299
|
+
dir="$(agent-env path "$@")" || return 1
|
|
2300
|
+
cd "\${dir}" || return 1
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
_aecd_completions() {
|
|
2304
|
+
local cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
2305
|
+
local prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
2306
|
+
local i has_repo=0
|
|
2307
|
+
for ((i=1; i < COMP_CWORD; i++)); do
|
|
2308
|
+
[[ "\${COMP_WORDS[i]}" == "--repo" ]] && has_repo=1 && break
|
|
2309
|
+
done
|
|
2310
|
+
if [[ "\${prev}" == "--repo" ]]; then
|
|
2311
|
+
COMPREPLY=($(compgen -W "$(_agent_env_repos)" -- "\${cur}"))
|
|
2312
|
+
elif [[ "\${cur}" == -* && \${has_repo} -eq 0 ]]; then
|
|
2313
|
+
COMPREPLY=($(compgen -W "--repo" -- "\${cur}"))
|
|
2314
|
+
else
|
|
2315
|
+
COMPREPLY=($(compgen -W "$(_agent_env_instances)" -- "\${cur}"))
|
|
2316
|
+
fi
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
complete -F _aecd_completions aecd`;
|
|
2320
|
+
}
|
|
2321
|
+
function generateZshCompletion(commands) {
|
|
2322
|
+
const zshEscape = (s) => s.replace(/'/g, "'\\''");
|
|
2323
|
+
const commandDescriptions = commands.flatMap((cmd) => {
|
|
2324
|
+
const desc = zshEscape(cmd.description);
|
|
2325
|
+
const entries = [`${cmd.name}:${desc}`];
|
|
2326
|
+
for (const alias of cmd.aliases) {
|
|
2327
|
+
entries.push(`${alias}:${desc} (alias)`);
|
|
2328
|
+
}
|
|
2329
|
+
return entries;
|
|
2330
|
+
});
|
|
2289
2331
|
return `#compdef agent-env
|
|
2290
2332
|
# agent-env zsh completion script
|
|
2291
2333
|
# Install: eval "$(agent-env completion zsh)"
|
|
@@ -2341,7 +2383,7 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2341
2383
|
;;
|
|
2342
2384
|
args)
|
|
2343
2385
|
case $words[1] in
|
|
2344
|
-
attach|purpose)
|
|
2386
|
+
on|code|attach|path|purpose)
|
|
2345
2387
|
_arguments \\
|
|
2346
2388
|
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2347
2389
|
'1:instance:_agent_env_instances'
|
|
@@ -2366,6 +2408,12 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2366
2408
|
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2367
2409
|
'1:instance:_agent_env_instances'
|
|
2368
2410
|
;;
|
|
2411
|
+
shutdown)
|
|
2412
|
+
_arguments \\
|
|
2413
|
+
'--yes[Skip confirmation prompt]' \\
|
|
2414
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2415
|
+
'1:instance:_agent_env_instances'
|
|
2416
|
+
;;
|
|
2369
2417
|
remove)
|
|
2370
2418
|
_arguments \\
|
|
2371
2419
|
'--force[Force removal]' \\
|
|
@@ -2386,13 +2434,29 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2386
2434
|
esac
|
|
2387
2435
|
}
|
|
2388
2436
|
|
|
2389
|
-
compdef _agent_env agent-env
|
|
2437
|
+
compdef _agent_env agent-env
|
|
2438
|
+
|
|
2439
|
+
# aecd: cd into an instance's host directory
|
|
2440
|
+
# Note: requires eval installation (not fpath autoload) for the function to be available
|
|
2441
|
+
aecd() {
|
|
2442
|
+
local dir
|
|
2443
|
+
dir="$(agent-env path "$@")" || return 1
|
|
2444
|
+
cd "\${dir}" || return 1
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
_aecd() {
|
|
2448
|
+
_arguments \\
|
|
2449
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2450
|
+
'1:instance:_agent_env_instances'
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
compdef _aecd aecd`;
|
|
2390
2454
|
}
|
|
2391
2455
|
|
|
2392
2456
|
// src/commands/completion.ts
|
|
2393
2457
|
var completionCommand = new Command3("completion").description(`Generate shell completion script for bash or zsh
|
|
2394
2458
|
|
|
2395
|
-
${getInstallInstructions()}`).argument("<shell>", "Shell type (bash or zsh)").action((shell)
|
|
2459
|
+
${getInstallInstructions()}`).argument("<shell>", "Shell type (bash or zsh)").action(function(shell) {
|
|
2396
2460
|
if (!isValidShell(shell)) {
|
|
2397
2461
|
const error = createError(
|
|
2398
2462
|
"UNSUPPORTED_SHELL",
|
|
@@ -2402,7 +2466,8 @@ ${getInstallInstructions()}`).argument("<shell>", "Shell type (bash or zsh)").ac
|
|
|
2402
2466
|
console.error(formatError(error));
|
|
2403
2467
|
process.exit(1);
|
|
2404
2468
|
}
|
|
2405
|
-
const
|
|
2469
|
+
const commands = this.parent ? extractCompletionCommands(this.parent) : [];
|
|
2470
|
+
const script = generateCompletionScript(shell, commands);
|
|
2406
2471
|
console.log(script);
|
|
2407
2472
|
});
|
|
2408
2473
|
|
|
@@ -3026,6 +3091,17 @@ async function launchActionLoop(workspaceName, deps, repoSlug) {
|
|
|
3026
3091
|
if (action === "exit") {
|
|
3027
3092
|
break;
|
|
3028
3093
|
}
|
|
3094
|
+
if (action === "shutdown") {
|
|
3095
|
+
const shutdownResult = await deps.shutdownInstance(workspaceName, repoSlug);
|
|
3096
|
+
if (!shutdownResult.ok) {
|
|
3097
|
+
if (shutdownResult.error) {
|
|
3098
|
+
const { code, message, suggestion } = shutdownResult.error;
|
|
3099
|
+
console.error(formatError(createError(code, message, suggestion)));
|
|
3100
|
+
}
|
|
3101
|
+
continue;
|
|
3102
|
+
}
|
|
3103
|
+
break;
|
|
3104
|
+
}
|
|
3029
3105
|
let result;
|
|
3030
3106
|
switch (action) {
|
|
3031
3107
|
case "attach":
|
|
@@ -3111,6 +3187,7 @@ var ACTION_OPTIONS = [
|
|
|
3111
3187
|
{ label: "\u{1F680} Attach to session", value: "attach" },
|
|
3112
3188
|
{ label: "\u{1F4BB} Open in VS Code", value: "code" },
|
|
3113
3189
|
{ label: "\u{1F6E0} Rebuild container", value: "rebuild" },
|
|
3190
|
+
{ label: "\u23F9 Shutdown container", value: "shutdown" },
|
|
3114
3191
|
{ label: "\u{1F4DD} Set Purpose", value: "set-purpose" },
|
|
3115
3192
|
{ label: "\u{1F6AA} Exit", value: "exit" }
|
|
3116
3193
|
];
|
|
@@ -3141,7 +3218,14 @@ function InteractiveMenu({
|
|
|
3141
3218
|
}
|
|
3142
3219
|
return /* @__PURE__ */ jsxs3(Box2, { flexDirection: "column", children: [
|
|
3143
3220
|
/* @__PURE__ */ jsx3(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsx3(Text3, { bold: true, children: headerParts.join(" \xB7 ") }) }),
|
|
3144
|
-
mode === "actions" ? /* @__PURE__ */ jsx3(
|
|
3221
|
+
mode === "actions" ? /* @__PURE__ */ jsx3(
|
|
3222
|
+
Select,
|
|
3223
|
+
{
|
|
3224
|
+
options: ACTION_OPTIONS,
|
|
3225
|
+
onChange: handleActionChange,
|
|
3226
|
+
visibleOptionCount: ACTION_OPTIONS.length
|
|
3227
|
+
}
|
|
3228
|
+
) : /* @__PURE__ */ jsx3(PurposeInput, { onSubmit: handlePurposeSubmit, onCancel: handlePurposeCancel })
|
|
3145
3229
|
] });
|
|
3146
3230
|
}
|
|
3147
3231
|
|
|
@@ -3160,6 +3244,29 @@ import {
|
|
|
3160
3244
|
} from "fs/promises";
|
|
3161
3245
|
import { homedir as homedir6 } from "os";
|
|
3162
3246
|
import { join as join9 } from "path";
|
|
3247
|
+
|
|
3248
|
+
// src/lib/tmux-utils.ts
|
|
3249
|
+
async function saveTmuxState(containerName, deps) {
|
|
3250
|
+
try {
|
|
3251
|
+
const result = await deps.executor(
|
|
3252
|
+
"docker",
|
|
3253
|
+
["exec", containerName, "bash", "-lc", "agent-env tmux-save"],
|
|
3254
|
+
{ timeout: 3e4 }
|
|
3255
|
+
);
|
|
3256
|
+
if (result.ok) {
|
|
3257
|
+
deps.logger?.info("Saved tmux session state");
|
|
3258
|
+
return true;
|
|
3259
|
+
} else {
|
|
3260
|
+
deps.logger?.warn("Could not save tmux session state (non-fatal)");
|
|
3261
|
+
return false;
|
|
3262
|
+
}
|
|
3263
|
+
} catch {
|
|
3264
|
+
deps.logger?.warn("Could not save tmux session state (non-fatal)");
|
|
3265
|
+
return false;
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
// src/lib/rebuild-instance.ts
|
|
3163
3270
|
function createRebuildDefaultDeps() {
|
|
3164
3271
|
const executor = createExecutor();
|
|
3165
3272
|
return {
|
|
@@ -3284,20 +3391,6 @@ async function executePullStep(wsRoot, pull, deps) {
|
|
|
3284
3391
|
}
|
|
3285
3392
|
return { ok: true, hasDockerfile };
|
|
3286
3393
|
}
|
|
3287
|
-
async function saveTmuxState(containerName, deps) {
|
|
3288
|
-
const result = await deps.executor("docker", [
|
|
3289
|
-
"exec",
|
|
3290
|
-
containerName,
|
|
3291
|
-
"bash",
|
|
3292
|
-
"-lc",
|
|
3293
|
-
"agent-env tmux-save"
|
|
3294
|
-
]);
|
|
3295
|
-
if (result.ok) {
|
|
3296
|
-
deps.logger?.info("Saved tmux session state");
|
|
3297
|
-
} else {
|
|
3298
|
-
deps.logger?.warn("Could not save tmux session state (non-fatal)");
|
|
3299
|
-
}
|
|
3300
|
-
}
|
|
3301
3394
|
async function teardownContainer(containerName, container, statusResult) {
|
|
3302
3395
|
if (!statusResult.ok || statusResult.status === "not-found") {
|
|
3303
3396
|
return { ok: true };
|
|
@@ -3414,6 +3507,63 @@ async function rebuildInstance(instanceName, deps, options, repoSlug) {
|
|
|
3414
3507
|
};
|
|
3415
3508
|
}
|
|
3416
3509
|
|
|
3510
|
+
// src/lib/shutdown-instance.ts
|
|
3511
|
+
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";
|
|
3512
|
+
import { homedir as homedir7 } from "os";
|
|
3513
|
+
function createShutdownDefaultDeps() {
|
|
3514
|
+
const executor = createExecutor();
|
|
3515
|
+
return {
|
|
3516
|
+
executor,
|
|
3517
|
+
container: createContainerLifecycle(executor),
|
|
3518
|
+
workspaceFsDeps: { mkdir: mkdir9, readdir: readdir8, stat: stat8, homedir: homedir7 },
|
|
3519
|
+
stateFsDeps: { readFile: readFile11, writeFile: writeFile10, rename: rename8, mkdir: mkdir9, appendFile: appendFile7 },
|
|
3520
|
+
logger: { warn: (msg) => console.warn(msg), info: (msg) => console.info(msg) }
|
|
3521
|
+
};
|
|
3522
|
+
}
|
|
3523
|
+
async function shutdownInstance(instanceName, deps, repoSlug) {
|
|
3524
|
+
const lookup = await resolveInstance(instanceName, repoSlug, {
|
|
3525
|
+
fsDeps: deps.workspaceFsDeps,
|
|
3526
|
+
readFile: deps.stateFsDeps.readFile
|
|
3527
|
+
});
|
|
3528
|
+
if (!lookup.found) {
|
|
3529
|
+
return { ok: false, error: lookup.error };
|
|
3530
|
+
}
|
|
3531
|
+
const wsPath = getWorkspacePathByName(lookup.workspaceName, deps.workspaceFsDeps);
|
|
3532
|
+
const state = await readState(wsPath, deps.stateFsDeps);
|
|
3533
|
+
const containerName = state.containerName;
|
|
3534
|
+
const dockerAvailable = await deps.container.isDockerAvailable();
|
|
3535
|
+
if (!dockerAvailable) {
|
|
3536
|
+
return {
|
|
3537
|
+
ok: false,
|
|
3538
|
+
error: {
|
|
3539
|
+
code: "ORBSTACK_REQUIRED",
|
|
3540
|
+
message: "Docker is not available. OrbStack or Docker Desktop must be running.",
|
|
3541
|
+
suggestion: "Start OrbStack or Docker Desktop, then try again."
|
|
3542
|
+
}
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3545
|
+
const statusResult = await deps.container.containerStatus(containerName);
|
|
3546
|
+
if (!statusResult.ok) {
|
|
3547
|
+
return { ok: false, error: statusResult.error };
|
|
3548
|
+
}
|
|
3549
|
+
if (statusResult.status !== "running") {
|
|
3550
|
+
return {
|
|
3551
|
+
ok: false,
|
|
3552
|
+
error: {
|
|
3553
|
+
code: "CONTAINER_NOT_RUNNING",
|
|
3554
|
+
message: `Container '${containerName}' is not running`,
|
|
3555
|
+
suggestion: "The instance is already stopped."
|
|
3556
|
+
}
|
|
3557
|
+
};
|
|
3558
|
+
}
|
|
3559
|
+
const tmuxSaved = await saveTmuxState(containerName, deps);
|
|
3560
|
+
const stopResult = await deps.container.containerStop(containerName);
|
|
3561
|
+
if (!stopResult.ok) {
|
|
3562
|
+
return { ok: false, error: stopResult.error };
|
|
3563
|
+
}
|
|
3564
|
+
return { ok: true, containerName, tmuxSaved };
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3417
3567
|
// src/lib/menu-deps.ts
|
|
3418
3568
|
function buildMenuDeps() {
|
|
3419
3569
|
return {
|
|
@@ -3457,6 +3607,16 @@ function buildMenuDeps() {
|
|
|
3457
3607
|
throw err;
|
|
3458
3608
|
});
|
|
3459
3609
|
},
|
|
3610
|
+
shutdownInstance: (wsName, slug) => {
|
|
3611
|
+
const deps = createShutdownDefaultDeps();
|
|
3612
|
+
console.log(`Shutting down instance '${wsName}'...`);
|
|
3613
|
+
return shutdownInstance(wsName, deps, slug).then((result) => {
|
|
3614
|
+
if (result.ok) {
|
|
3615
|
+
console.log(`\x1B[32m\u2713\x1B[0m Instance '${wsName}' shut down`);
|
|
3616
|
+
}
|
|
3617
|
+
return result;
|
|
3618
|
+
});
|
|
3619
|
+
},
|
|
3460
3620
|
setPurpose: (wsName, value, slug) => {
|
|
3461
3621
|
const deps = createPurposeDefaultDeps();
|
|
3462
3622
|
return setPurpose(wsName, value, deps, slug);
|
|
@@ -3511,13 +3671,28 @@ var onCommand = new Command6("on").description("Open the interactive menu for an
|
|
|
3511
3671
|
await launchActionLoop(workspaceName, menuDeps, repoSlug);
|
|
3512
3672
|
});
|
|
3513
3673
|
|
|
3514
|
-
// src/commands/
|
|
3674
|
+
// src/commands/path.ts
|
|
3515
3675
|
import { Command as Command7 } from "commander";
|
|
3676
|
+
var pathCommand = new Command7("path").description("Print the host directory path for an instance").argument("<name>", "Instance name").option("--repo <slug>", "Repo slug or URL to scope instance lookup").action(async (name, options) => {
|
|
3677
|
+
const repoSlug = await resolveRepoOrExit({ repo: options.repo, cwd: process.cwd() });
|
|
3678
|
+
const result = await resolveInstance(name, repoSlug);
|
|
3679
|
+
if (!result.found) {
|
|
3680
|
+
const { code, message, suggestion } = result.error;
|
|
3681
|
+
console.error(formatError(createError(code, message, suggestion)));
|
|
3682
|
+
process.exit(1);
|
|
3683
|
+
return;
|
|
3684
|
+
}
|
|
3685
|
+
const wsPath = getWorkspacePathByName(result.workspaceName);
|
|
3686
|
+
console.log(wsPath.root);
|
|
3687
|
+
});
|
|
3688
|
+
|
|
3689
|
+
// src/commands/purpose.ts
|
|
3690
|
+
import { Command as Command8 } from "commander";
|
|
3516
3691
|
var defaultPurposeCommandDeps = {
|
|
3517
3692
|
isInsideContainer
|
|
3518
3693
|
};
|
|
3519
3694
|
function createPurposeCommand(deps = defaultPurposeCommandDeps) {
|
|
3520
|
-
return new
|
|
3695
|
+
return new Command8("purpose").description(
|
|
3521
3696
|
"Get or set the purpose/label for an instance. Inside a container: no instance name needed (agent-env purpose [value])"
|
|
3522
3697
|
).argument("[nameOrValue]", "Instance name (host) or purpose value (container)").argument("[value]", "New purpose value (omit to get current, empty string to clear)").option("--repo <slug>", "Repo slug or URL to scope instance lookup (host mode only)").action(async (nameOrValue, value, options) => {
|
|
3523
3698
|
if (deps.isInsideContainer()) {
|
|
@@ -3592,36 +3767,18 @@ function handleSetResult(result) {
|
|
|
3592
3767
|
|
|
3593
3768
|
// src/commands/rebuild.ts
|
|
3594
3769
|
import chalk from "chalk";
|
|
3595
|
-
import { Command as
|
|
3596
|
-
|
|
3597
|
-
function promptForConfirmation(instanceName) {
|
|
3598
|
-
return new Promise((resolve2) => {
|
|
3599
|
-
const rl = createInterface({
|
|
3600
|
-
input: process.stdin,
|
|
3601
|
-
output: process.stderr
|
|
3602
|
-
});
|
|
3603
|
-
rl.question(
|
|
3604
|
-
`
|
|
3605
|
-
${chalk.yellow("Warning:")} Rebuilding '${instanceName}' will destroy the current container and create a new one.
|
|
3606
|
-
Any active sessions will be lost. Continue? (y/N) `,
|
|
3607
|
-
(answer) => {
|
|
3608
|
-
rl.close();
|
|
3609
|
-
resolve2(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
3610
|
-
}
|
|
3611
|
-
);
|
|
3612
|
-
rl.on("SIGINT", () => {
|
|
3613
|
-
rl.close();
|
|
3614
|
-
resolve2(false);
|
|
3615
|
-
});
|
|
3616
|
-
});
|
|
3617
|
-
}
|
|
3618
|
-
var rebuildCommand = new Command8("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(
|
|
3770
|
+
import { Command as Command9 } from "commander";
|
|
3771
|
+
var rebuildCommand = new Command9("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(
|
|
3619
3772
|
async (name, options) => {
|
|
3620
3773
|
const deps = createRebuildDefaultDeps();
|
|
3621
3774
|
const repoSlug = await resolveRepoOrExit({ repo: options.repo, cwd: process.cwd() });
|
|
3622
3775
|
let confirmed = false;
|
|
3623
3776
|
if (!options.yes && !options.force && process.stdin.isTTY) {
|
|
3624
|
-
confirmed = await promptForConfirmation(
|
|
3777
|
+
confirmed = await promptForConfirmation(
|
|
3778
|
+
`
|
|
3779
|
+
${chalk.yellow("Warning:")} Rebuilding '${name}' will destroy the current container and create a new one.
|
|
3780
|
+
Any active sessions will be lost. Continue? (y/N) `
|
|
3781
|
+
);
|
|
3625
3782
|
if (!confirmed) {
|
|
3626
3783
|
console.log("Rebuild cancelled");
|
|
3627
3784
|
return;
|
|
@@ -3668,15 +3825,15 @@ var rebuildCommand = new Command8("rebuild").description("Rebuild an instance by
|
|
|
3668
3825
|
|
|
3669
3826
|
// src/commands/remove.ts
|
|
3670
3827
|
import chalk3 from "chalk";
|
|
3671
|
-
import { Command as
|
|
3828
|
+
import { Command as Command10 } from "commander";
|
|
3672
3829
|
import { createInterface as createInterface2 } from "readline";
|
|
3673
3830
|
|
|
3674
3831
|
// src/lib/audit-log.ts
|
|
3675
|
-
import { appendFile as
|
|
3676
|
-
import { homedir as
|
|
3832
|
+
import { appendFile as appendFile8, mkdir as mkdir10 } from "fs/promises";
|
|
3833
|
+
import { homedir as homedir8 } from "os";
|
|
3677
3834
|
import { join as join10 } from "path";
|
|
3678
3835
|
function createAuditLogDefaultDeps() {
|
|
3679
|
-
return { appendFile:
|
|
3836
|
+
return { appendFile: appendFile8, mkdir: mkdir10, homedir: homedir8 };
|
|
3680
3837
|
}
|
|
3681
3838
|
function getAuditLogPath(deps) {
|
|
3682
3839
|
return join10(deps.homedir(), AGENT_ENV_DIR, "audit.log");
|
|
@@ -3698,16 +3855,16 @@ function createAuditEntry(instanceName, gitState, confirmationMethod) {
|
|
|
3698
3855
|
}
|
|
3699
3856
|
|
|
3700
3857
|
// src/lib/remove-instance.ts
|
|
3701
|
-
import { mkdir as
|
|
3702
|
-
import { homedir as
|
|
3858
|
+
import { mkdir as mkdir11, readdir as readdir9, readFile as readFile12, rm as rm4, stat as stat9 } from "fs/promises";
|
|
3859
|
+
import { homedir as homedir9 } from "os";
|
|
3703
3860
|
function createRemoveDefaultDeps() {
|
|
3704
3861
|
const executor = createExecutor();
|
|
3705
3862
|
return {
|
|
3706
3863
|
executor,
|
|
3707
3864
|
container: createContainerLifecycle(executor),
|
|
3708
3865
|
gitDetector: createGitStateDetector(executor),
|
|
3709
|
-
workspaceFsDeps: { mkdir:
|
|
3710
|
-
stateFsDeps: { readFile:
|
|
3866
|
+
workspaceFsDeps: { mkdir: mkdir11, readdir: readdir9, stat: stat9, homedir: homedir9 },
|
|
3867
|
+
stateFsDeps: { readFile: readFile12 },
|
|
3711
3868
|
deleteFsDeps: { rm: rm4 }
|
|
3712
3869
|
};
|
|
3713
3870
|
}
|
|
@@ -3987,7 +4144,7 @@ async function resolveConfirmation(name, options) {
|
|
|
3987
4144
|
}
|
|
3988
4145
|
return "typed-name";
|
|
3989
4146
|
}
|
|
3990
|
-
var removeCommand = new
|
|
4147
|
+
var removeCommand = new Command10("remove").description("Remove an instance with safety checks").argument("<name>", "Instance name to remove").option("--repo <slug>", "Repo slug or URL to scope instance lookup").option("--force", "Force removal, bypassing safety checks").option(
|
|
3991
4148
|
"--yes",
|
|
3992
4149
|
"Skip confirmation prompt for --force (DANGEROUS: skips all safety prompts, for scripts only)"
|
|
3993
4150
|
).action(async (name, options) => {
|
|
@@ -4050,8 +4207,8 @@ var removeCommand = new Command9("remove").description("Remove an instance with
|
|
|
4050
4207
|
});
|
|
4051
4208
|
|
|
4052
4209
|
// src/commands/repos.ts
|
|
4053
|
-
import { Command as
|
|
4054
|
-
var reposCommand = new
|
|
4210
|
+
import { Command as Command11 } from "commander";
|
|
4211
|
+
var reposCommand = new Command11("repos").description("List tracked repositories").option("--json", "Output in JSON format").action(async (options) => {
|
|
4055
4212
|
const result = await listRepos();
|
|
4056
4213
|
if (!result.ok) {
|
|
4057
4214
|
const error = createError(
|
|
@@ -4102,9 +4259,9 @@ var reposCommand = new Command10("repos").description("List tracked repositories
|
|
|
4102
4259
|
});
|
|
4103
4260
|
|
|
4104
4261
|
// src/commands/setup-audio.ts
|
|
4105
|
-
import { Command as
|
|
4106
|
-
import { copyFile, mkdir as
|
|
4107
|
-
import { homedir as
|
|
4262
|
+
import { Command as Command12 } from "commander";
|
|
4263
|
+
import { copyFile, mkdir as mkdir12, readFile as readFile13, writeFile as writeFile11, access as access5 } from "fs/promises";
|
|
4264
|
+
import { homedir as homedir10, platform } from "os";
|
|
4108
4265
|
|
|
4109
4266
|
// src/lib/setup-audio.ts
|
|
4110
4267
|
async function setupAudio(deps) {
|
|
@@ -4199,16 +4356,16 @@ function createDefaultSetupAudioDeps() {
|
|
|
4199
4356
|
const exec = createExecutor();
|
|
4200
4357
|
return {
|
|
4201
4358
|
platform: platform(),
|
|
4202
|
-
homeDir:
|
|
4359
|
+
homeDir: homedir10(),
|
|
4203
4360
|
execute: exec,
|
|
4204
|
-
readFile: (path, encoding) =>
|
|
4205
|
-
writeFile: (path, content, encoding) =>
|
|
4361
|
+
readFile: (path, encoding) => readFile13(path, encoding),
|
|
4362
|
+
writeFile: (path, content, encoding) => writeFile11(path, content, encoding),
|
|
4206
4363
|
copyFile,
|
|
4207
|
-
mkdir: (path, opts) =>
|
|
4364
|
+
mkdir: (path, opts) => mkdir12(path, opts),
|
|
4208
4365
|
access: (path) => access5(path)
|
|
4209
4366
|
};
|
|
4210
4367
|
}
|
|
4211
|
-
var setupAudioCommand = new
|
|
4368
|
+
var setupAudioCommand = new Command12("setup-audio").description("Configure macOS PulseAudio for audio passthrough to containers").action(async () => {
|
|
4212
4369
|
const deps = createDefaultSetupAudioDeps();
|
|
4213
4370
|
const result = await setupAudio(deps);
|
|
4214
4371
|
if (!result.ok) {
|
|
@@ -4227,17 +4384,53 @@ var setupAudioCommand = new Command11("setup-audio").description("Configure macO
|
|
|
4227
4384
|
);
|
|
4228
4385
|
});
|
|
4229
4386
|
|
|
4387
|
+
// src/commands/shutdown.ts
|
|
4388
|
+
import chalk4 from "chalk";
|
|
4389
|
+
import { Command as Command13 } from "commander";
|
|
4390
|
+
var shutdownCommand = new Command13("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) => {
|
|
4391
|
+
const repoSlug = await resolveRepoOrExit({ repo: options.repo, cwd: process.cwd() });
|
|
4392
|
+
if (!options.yes && process.stdin.isTTY) {
|
|
4393
|
+
const confirmed = await promptForConfirmation(
|
|
4394
|
+
`
|
|
4395
|
+
Shutdown '${name}'? This will stop the container. (y/N) `
|
|
4396
|
+
);
|
|
4397
|
+
if (!confirmed) {
|
|
4398
|
+
console.log("Shutdown cancelled");
|
|
4399
|
+
return;
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
console.log(`Shutting down instance '${name}'...`);
|
|
4403
|
+
const deps = createShutdownDefaultDeps();
|
|
4404
|
+
try {
|
|
4405
|
+
const result = await shutdownInstance(name, deps, repoSlug);
|
|
4406
|
+
if (!result.ok) {
|
|
4407
|
+
const { code, message, suggestion } = result.error;
|
|
4408
|
+
console.error(formatError(createError(code, message, suggestion)));
|
|
4409
|
+
process.exit(1);
|
|
4410
|
+
return;
|
|
4411
|
+
}
|
|
4412
|
+
console.log(`${chalk4.green("\u2713")} Instance '${name}' shut down`);
|
|
4413
|
+
if (result.tmuxSaved) {
|
|
4414
|
+
console.log(" Tmux session state saved");
|
|
4415
|
+
}
|
|
4416
|
+
} catch (err) {
|
|
4417
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
4418
|
+
console.error(formatError(createError("SHUTDOWN_ERROR", message)));
|
|
4419
|
+
process.exit(1);
|
|
4420
|
+
}
|
|
4421
|
+
});
|
|
4422
|
+
|
|
4230
4423
|
// src/commands/tmux-restore.ts
|
|
4231
|
-
import { Command as
|
|
4424
|
+
import { Command as Command14 } from "commander";
|
|
4232
4425
|
import { execSync } from "child_process";
|
|
4233
4426
|
import { join as join12 } from "path";
|
|
4234
4427
|
|
|
4235
4428
|
// src/lib/tmux-session.ts
|
|
4236
|
-
import { readFile as
|
|
4429
|
+
import { readFile as readFile14, writeFile as writeFile12, rename as rename9, mkdir as mkdir13 } from "fs/promises";
|
|
4237
4430
|
import { dirname as dirname3, join as join11 } from "path";
|
|
4238
4431
|
async function readPanesState(path) {
|
|
4239
4432
|
try {
|
|
4240
|
-
const content = await
|
|
4433
|
+
const content = await readFile14(path, "utf-8");
|
|
4241
4434
|
const parsed = JSON.parse(content);
|
|
4242
4435
|
if (typeof parsed === "object" && parsed !== null && parsed.version === 1) {
|
|
4243
4436
|
return parsed;
|
|
@@ -4248,14 +4441,14 @@ async function readPanesState(path) {
|
|
|
4248
4441
|
}
|
|
4249
4442
|
}
|
|
4250
4443
|
async function writePanesState(path, state) {
|
|
4251
|
-
await
|
|
4444
|
+
await mkdir13(dirname3(path), { recursive: true });
|
|
4252
4445
|
const tmpPath = path + ".tmp";
|
|
4253
|
-
await
|
|
4254
|
-
await
|
|
4446
|
+
await writeFile12(tmpPath, JSON.stringify(state), "utf-8");
|
|
4447
|
+
await rename9(tmpPath, path);
|
|
4255
4448
|
}
|
|
4256
4449
|
async function readSessionState(path) {
|
|
4257
4450
|
try {
|
|
4258
|
-
const content = await
|
|
4451
|
+
const content = await readFile14(path, "utf-8");
|
|
4259
4452
|
const parsed = JSON.parse(content);
|
|
4260
4453
|
if (typeof parsed === "object" && parsed !== null && parsed.version === 1 && Array.isArray(parsed.windows)) {
|
|
4261
4454
|
return parsed;
|
|
@@ -4266,10 +4459,10 @@ async function readSessionState(path) {
|
|
|
4266
4459
|
}
|
|
4267
4460
|
}
|
|
4268
4461
|
async function writeSessionState(path, state) {
|
|
4269
|
-
await
|
|
4462
|
+
await mkdir13(dirname3(path), { recursive: true });
|
|
4270
4463
|
const tmpPath = path + ".tmp";
|
|
4271
|
-
await
|
|
4272
|
-
await
|
|
4464
|
+
await writeFile12(tmpPath, JSON.stringify(state, null, 2), "utf-8");
|
|
4465
|
+
await rename9(tmpPath, path);
|
|
4273
4466
|
}
|
|
4274
4467
|
function pruneStaleEntries(state, activePaneIds) {
|
|
4275
4468
|
const pruned = { version: 1 };
|
|
@@ -4348,7 +4541,7 @@ async function executeTmuxRestore() {
|
|
|
4348
4541
|
}
|
|
4349
4542
|
}
|
|
4350
4543
|
}
|
|
4351
|
-
var tmuxRestoreCommand = new
|
|
4544
|
+
var tmuxRestoreCommand = new Command14("tmux-restore").description("Restore tmux session state from saved state (container only)").action(async () => {
|
|
4352
4545
|
try {
|
|
4353
4546
|
await executeTmuxRestore();
|
|
4354
4547
|
} catch {
|
|
@@ -4356,7 +4549,7 @@ var tmuxRestoreCommand = new Command12("tmux-restore").description("Restore tmux
|
|
|
4356
4549
|
});
|
|
4357
4550
|
|
|
4358
4551
|
// src/commands/tmux-save.ts
|
|
4359
|
-
import { Command as
|
|
4552
|
+
import { Command as Command15 } from "commander";
|
|
4360
4553
|
import { execSync as execSync2 } from "child_process";
|
|
4361
4554
|
import { unlink as unlink2 } from "fs/promises";
|
|
4362
4555
|
import { join as join13 } from "path";
|
|
@@ -4434,7 +4627,7 @@ async function executeTmuxSave() {
|
|
|
4434
4627
|
const pruned = pruneStaleEntries(panesState, activePaneIds);
|
|
4435
4628
|
await writePanesState(panesPath, pruned);
|
|
4436
4629
|
}
|
|
4437
|
-
var tmuxSaveCommand = new
|
|
4630
|
+
var tmuxSaveCommand = new Command15("tmux-save").description("Save current tmux session state for persistence across rebuilds (container only)").action(async () => {
|
|
4438
4631
|
try {
|
|
4439
4632
|
await executeTmuxSave();
|
|
4440
4633
|
} catch {
|
|
@@ -4442,12 +4635,12 @@ var tmuxSaveCommand = new Command13("tmux-save").description("Save current tmux
|
|
|
4442
4635
|
});
|
|
4443
4636
|
|
|
4444
4637
|
// src/commands/tmux-status.ts
|
|
4445
|
-
import { Command as
|
|
4638
|
+
import { Command as Command16 } from "commander";
|
|
4446
4639
|
|
|
4447
4640
|
// src/lib/tmux-status.ts
|
|
4448
|
-
import { readFile as
|
|
4641
|
+
import { readFile as readFile15 } from "fs/promises";
|
|
4449
4642
|
var MAX_PURPOSE_DISPLAY_LEN = 40;
|
|
4450
|
-
var defaultDeps2 = { readFile:
|
|
4643
|
+
var defaultDeps2 = { readFile: readFile15 };
|
|
4451
4644
|
function formatTmuxStatus(instance, purpose) {
|
|
4452
4645
|
if (!instance) return "?";
|
|
4453
4646
|
if (!purpose) return instance;
|
|
@@ -4483,7 +4676,7 @@ var defaultDeps3 = {
|
|
|
4483
4676
|
statePath: CONTAINER_STATE_PATH
|
|
4484
4677
|
};
|
|
4485
4678
|
function createTmuxStatusCommand(deps = defaultDeps3) {
|
|
4486
|
-
return new
|
|
4679
|
+
return new Command16("tmux-status").description("Output formatted instance status for tmux status bar (container only)").action(async () => {
|
|
4487
4680
|
if (!deps.isInsideContainer()) {
|
|
4488
4681
|
console.log("?");
|
|
4489
4682
|
return;
|
|
@@ -4495,7 +4688,7 @@ function createTmuxStatusCommand(deps = defaultDeps3) {
|
|
|
4495
4688
|
var tmuxStatusCommand = createTmuxStatusCommand();
|
|
4496
4689
|
|
|
4497
4690
|
// src/lib/update-check.ts
|
|
4498
|
-
import
|
|
4691
|
+
import chalk5 from "chalk";
|
|
4499
4692
|
import * as fs from "fs/promises";
|
|
4500
4693
|
import { dirname as dirname4 } from "path";
|
|
4501
4694
|
function normaliseVersion(version2) {
|
|
@@ -4554,8 +4747,8 @@ async function fetchLatestVersion(packageName, fetchFn) {
|
|
|
4554
4747
|
}
|
|
4555
4748
|
function formatUpdateMessage(currentVersion, latestVersion, packageName) {
|
|
4556
4749
|
const normCurrent = normaliseVersion(currentVersion);
|
|
4557
|
-
const line1 =
|
|
4558
|
-
const line2 =
|
|
4750
|
+
const line1 = chalk5.yellow(`Update available: ${normCurrent} -> ${latestVersion}`);
|
|
4751
|
+
const line2 = chalk5.cyan(`Run: pnpm add -g ${packageName}`);
|
|
4559
4752
|
return `${line1}
|
|
4560
4753
|
${line2}`;
|
|
4561
4754
|
}
|
|
@@ -4566,13 +4759,13 @@ async function checkForUpdate(opts) {
|
|
|
4566
4759
|
cachePath,
|
|
4567
4760
|
cacheTtlMs,
|
|
4568
4761
|
fetchFn = fetch,
|
|
4569
|
-
readFile:
|
|
4570
|
-
writeFile:
|
|
4571
|
-
mkdir:
|
|
4762
|
+
readFile: readFile17 = (p, enc) => fs.readFile(p, enc),
|
|
4763
|
+
writeFile: writeFile14 = (p, d, enc) => fs.writeFile(p, d, enc),
|
|
4764
|
+
mkdir: mkdir15 = (p, o) => fs.mkdir(p, o),
|
|
4572
4765
|
now = () => Date.now()
|
|
4573
4766
|
} = opts;
|
|
4574
4767
|
const currentTime = now();
|
|
4575
|
-
const cache = await readCache(cachePath,
|
|
4768
|
+
const cache = await readCache(cachePath, readFile17);
|
|
4576
4769
|
let latestVersion = null;
|
|
4577
4770
|
const isCacheFresh = cache !== null && currentTime - cache.lastCheck < cacheTtlMs;
|
|
4578
4771
|
if (isCacheFresh) {
|
|
@@ -4580,7 +4773,7 @@ async function checkForUpdate(opts) {
|
|
|
4580
4773
|
} else {
|
|
4581
4774
|
latestVersion = await fetchLatestVersion(packageName, fetchFn);
|
|
4582
4775
|
if (latestVersion !== null) {
|
|
4583
|
-
await writeCache(cachePath, { lastCheck: currentTime, latestVersion },
|
|
4776
|
+
await writeCache(cachePath, { lastCheck: currentTime, latestVersion }, mkdir15, writeFile14);
|
|
4584
4777
|
}
|
|
4585
4778
|
}
|
|
4586
4779
|
if (latestVersion !== null && isNewerVersion(currentVersion, latestVersion)) {
|
|
@@ -4598,8 +4791,10 @@ program.name("agent-env").description("CLI for creating isolated, AI-ready devel
|
|
|
4598
4791
|
program.addCommand(createCommand);
|
|
4599
4792
|
program.addCommand(listCommand);
|
|
4600
4793
|
program.addCommand(attachCommand);
|
|
4794
|
+
program.addCommand(pathCommand);
|
|
4601
4795
|
program.addCommand(codeCommand);
|
|
4602
4796
|
program.addCommand(rebuildCommand);
|
|
4797
|
+
program.addCommand(shutdownCommand);
|
|
4603
4798
|
program.addCommand(removeCommand);
|
|
4604
4799
|
program.addCommand(purposeCommand);
|
|
4605
4800
|
program.addCommand(onCommand);
|
|
@@ -4667,7 +4862,7 @@ var shouldCheck = !!process.stderr.isTTY && !isInsideContainer() && !isLinked &&
|
|
|
4667
4862
|
var updateCheckPromise = shouldCheck ? checkForUpdate({
|
|
4668
4863
|
currentVersion: package_default.version,
|
|
4669
4864
|
packageName: package_default.name,
|
|
4670
|
-
cachePath: join14(
|
|
4865
|
+
cachePath: join14(homedir11(), ".agent-env", "update-check.json"),
|
|
4671
4866
|
cacheTtlMs: 36e5
|
|
4672
4867
|
}) : Promise.resolve(null);
|
|
4673
4868
|
async function main() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zookanalytics/agent-env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "CLI for creating isolated, AI-ready development environments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ink-testing-library": "^4.0.0",
|
|
44
44
|
"tsup": "^8.5.1",
|
|
45
45
|
"tsx": "^4.21.0",
|
|
46
|
-
"@zookanalytics/shared": "0.1.
|
|
46
|
+
"@zookanalytics/shared": "0.1.1"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"dev": "tsx src/cli.ts",
|