@zookanalytics/agent-env 0.10.0 → 0.11.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 +81 -22
- 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);
|
|
@@ -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.11.0",
|
|
61
61
|
description: "CLI for creating isolated, AI-ready development environments",
|
|
62
62
|
type: "module",
|
|
63
63
|
bin: {
|
|
@@ -2142,6 +2142,7 @@ var COMMANDS = [
|
|
|
2142
2142
|
"list",
|
|
2143
2143
|
"ps",
|
|
2144
2144
|
"attach",
|
|
2145
|
+
"path",
|
|
2145
2146
|
"rebuild",
|
|
2146
2147
|
"remove",
|
|
2147
2148
|
"repos",
|
|
@@ -2224,7 +2225,7 @@ _agent_env_completions() {
|
|
|
2224
2225
|
|
|
2225
2226
|
# Complete based on command
|
|
2226
2227
|
case "\${prev}" in
|
|
2227
|
-
attach|purpose)
|
|
2228
|
+
attach|path|purpose)
|
|
2228
2229
|
local instances
|
|
2229
2230
|
instances="$(_agent_env_instances)"
|
|
2230
2231
|
COMPREPLY=($(compgen -W "--repo \${instances}" -- "\${cur}"))
|
|
@@ -2271,7 +2272,32 @@ _agent_env_completions() {
|
|
|
2271
2272
|
return 0
|
|
2272
2273
|
}
|
|
2273
2274
|
|
|
2274
|
-
complete -F _agent_env_completions agent-env
|
|
2275
|
+
complete -F _agent_env_completions agent-env
|
|
2276
|
+
|
|
2277
|
+
# aecd: cd into an instance's host directory
|
|
2278
|
+
aecd() {
|
|
2279
|
+
local dir
|
|
2280
|
+
dir="$(agent-env path "$@")" || return 1
|
|
2281
|
+
cd "\${dir}" || return 1
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
_aecd_completions() {
|
|
2285
|
+
local cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
2286
|
+
local prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
2287
|
+
local i has_repo=0
|
|
2288
|
+
for ((i=1; i < COMP_CWORD; i++)); do
|
|
2289
|
+
[[ "\${COMP_WORDS[i]}" == "--repo" ]] && has_repo=1 && break
|
|
2290
|
+
done
|
|
2291
|
+
if [[ "\${prev}" == "--repo" ]]; then
|
|
2292
|
+
COMPREPLY=($(compgen -W "$(_agent_env_repos)" -- "\${cur}"))
|
|
2293
|
+
elif [[ "\${cur}" == -* && \${has_repo} -eq 0 ]]; then
|
|
2294
|
+
COMPREPLY=($(compgen -W "--repo" -- "\${cur}"))
|
|
2295
|
+
else
|
|
2296
|
+
COMPREPLY=($(compgen -W "$(_agent_env_instances)" -- "\${cur}"))
|
|
2297
|
+
fi
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
complete -F _aecd_completions aecd`;
|
|
2275
2301
|
}
|
|
2276
2302
|
function generateZshCompletion() {
|
|
2277
2303
|
const commandDescriptions = [
|
|
@@ -2279,6 +2305,7 @@ function generateZshCompletion() {
|
|
|
2279
2305
|
"list:List all instances",
|
|
2280
2306
|
"ps:List all instances (alias)",
|
|
2281
2307
|
"attach:Attach to an instance tmux session",
|
|
2308
|
+
"path:Print host directory path for an instance",
|
|
2282
2309
|
"rebuild:Rebuild an instance container",
|
|
2283
2310
|
"remove:Remove an instance",
|
|
2284
2311
|
"repos:List tracked repositories",
|
|
@@ -2341,7 +2368,7 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2341
2368
|
;;
|
|
2342
2369
|
args)
|
|
2343
2370
|
case $words[1] in
|
|
2344
|
-
attach|purpose)
|
|
2371
|
+
attach|path|purpose)
|
|
2345
2372
|
_arguments \\
|
|
2346
2373
|
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2347
2374
|
'1:instance:_agent_env_instances'
|
|
@@ -2386,7 +2413,23 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2386
2413
|
esac
|
|
2387
2414
|
}
|
|
2388
2415
|
|
|
2389
|
-
compdef _agent_env agent-env
|
|
2416
|
+
compdef _agent_env agent-env
|
|
2417
|
+
|
|
2418
|
+
# aecd: cd into an instance's host directory
|
|
2419
|
+
# Note: requires eval installation (not fpath autoload) for the function to be available
|
|
2420
|
+
aecd() {
|
|
2421
|
+
local dir
|
|
2422
|
+
dir="$(agent-env path "$@")" || return 1
|
|
2423
|
+
cd "\${dir}" || return 1
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
_aecd() {
|
|
2427
|
+
_arguments \\
|
|
2428
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2429
|
+
'1:instance:_agent_env_instances'
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
compdef _aecd aecd`;
|
|
2390
2433
|
}
|
|
2391
2434
|
|
|
2392
2435
|
// src/commands/completion.ts
|
|
@@ -3511,13 +3554,28 @@ var onCommand = new Command6("on").description("Open the interactive menu for an
|
|
|
3511
3554
|
await launchActionLoop(workspaceName, menuDeps, repoSlug);
|
|
3512
3555
|
});
|
|
3513
3556
|
|
|
3514
|
-
// src/commands/
|
|
3557
|
+
// src/commands/path.ts
|
|
3515
3558
|
import { Command as Command7 } from "commander";
|
|
3559
|
+
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) => {
|
|
3560
|
+
const repoSlug = await resolveRepoOrExit({ repo: options.repo, cwd: process.cwd() });
|
|
3561
|
+
const result = await resolveInstance(name, repoSlug);
|
|
3562
|
+
if (!result.found) {
|
|
3563
|
+
const { code, message, suggestion } = result.error;
|
|
3564
|
+
console.error(formatError(createError(code, message, suggestion)));
|
|
3565
|
+
process.exit(1);
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
const wsPath = getWorkspacePathByName(result.workspaceName);
|
|
3569
|
+
console.log(wsPath.root);
|
|
3570
|
+
});
|
|
3571
|
+
|
|
3572
|
+
// src/commands/purpose.ts
|
|
3573
|
+
import { Command as Command8 } from "commander";
|
|
3516
3574
|
var defaultPurposeCommandDeps = {
|
|
3517
3575
|
isInsideContainer
|
|
3518
3576
|
};
|
|
3519
3577
|
function createPurposeCommand(deps = defaultPurposeCommandDeps) {
|
|
3520
|
-
return new
|
|
3578
|
+
return new Command8("purpose").description(
|
|
3521
3579
|
"Get or set the purpose/label for an instance. Inside a container: no instance name needed (agent-env purpose [value])"
|
|
3522
3580
|
).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
3581
|
if (deps.isInsideContainer()) {
|
|
@@ -3592,7 +3650,7 @@ function handleSetResult(result) {
|
|
|
3592
3650
|
|
|
3593
3651
|
// src/commands/rebuild.ts
|
|
3594
3652
|
import chalk from "chalk";
|
|
3595
|
-
import { Command as
|
|
3653
|
+
import { Command as Command9 } from "commander";
|
|
3596
3654
|
import { createInterface } from "readline";
|
|
3597
3655
|
function promptForConfirmation(instanceName) {
|
|
3598
3656
|
return new Promise((resolve2) => {
|
|
@@ -3615,7 +3673,7 @@ Any active sessions will be lost. Continue? (y/N) `,
|
|
|
3615
3673
|
});
|
|
3616
3674
|
});
|
|
3617
3675
|
}
|
|
3618
|
-
var rebuildCommand = new
|
|
3676
|
+
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
3677
|
async (name, options) => {
|
|
3620
3678
|
const deps = createRebuildDefaultDeps();
|
|
3621
3679
|
const repoSlug = await resolveRepoOrExit({ repo: options.repo, cwd: process.cwd() });
|
|
@@ -3668,7 +3726,7 @@ var rebuildCommand = new Command8("rebuild").description("Rebuild an instance by
|
|
|
3668
3726
|
|
|
3669
3727
|
// src/commands/remove.ts
|
|
3670
3728
|
import chalk3 from "chalk";
|
|
3671
|
-
import { Command as
|
|
3729
|
+
import { Command as Command10 } from "commander";
|
|
3672
3730
|
import { createInterface as createInterface2 } from "readline";
|
|
3673
3731
|
|
|
3674
3732
|
// src/lib/audit-log.ts
|
|
@@ -3987,7 +4045,7 @@ async function resolveConfirmation(name, options) {
|
|
|
3987
4045
|
}
|
|
3988
4046
|
return "typed-name";
|
|
3989
4047
|
}
|
|
3990
|
-
var removeCommand = new
|
|
4048
|
+
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
4049
|
"--yes",
|
|
3992
4050
|
"Skip confirmation prompt for --force (DANGEROUS: skips all safety prompts, for scripts only)"
|
|
3993
4051
|
).action(async (name, options) => {
|
|
@@ -4050,8 +4108,8 @@ var removeCommand = new Command9("remove").description("Remove an instance with
|
|
|
4050
4108
|
});
|
|
4051
4109
|
|
|
4052
4110
|
// src/commands/repos.ts
|
|
4053
|
-
import { Command as
|
|
4054
|
-
var reposCommand = new
|
|
4111
|
+
import { Command as Command11 } from "commander";
|
|
4112
|
+
var reposCommand = new Command11("repos").description("List tracked repositories").option("--json", "Output in JSON format").action(async (options) => {
|
|
4055
4113
|
const result = await listRepos();
|
|
4056
4114
|
if (!result.ok) {
|
|
4057
4115
|
const error = createError(
|
|
@@ -4102,7 +4160,7 @@ var reposCommand = new Command10("repos").description("List tracked repositories
|
|
|
4102
4160
|
});
|
|
4103
4161
|
|
|
4104
4162
|
// src/commands/setup-audio.ts
|
|
4105
|
-
import { Command as
|
|
4163
|
+
import { Command as Command12 } from "commander";
|
|
4106
4164
|
import { copyFile, mkdir as mkdir11, readFile as readFile12, writeFile as writeFile10, access as access5 } from "fs/promises";
|
|
4107
4165
|
import { homedir as homedir9, platform } from "os";
|
|
4108
4166
|
|
|
@@ -4208,7 +4266,7 @@ function createDefaultSetupAudioDeps() {
|
|
|
4208
4266
|
access: (path) => access5(path)
|
|
4209
4267
|
};
|
|
4210
4268
|
}
|
|
4211
|
-
var setupAudioCommand = new
|
|
4269
|
+
var setupAudioCommand = new Command12("setup-audio").description("Configure macOS PulseAudio for audio passthrough to containers").action(async () => {
|
|
4212
4270
|
const deps = createDefaultSetupAudioDeps();
|
|
4213
4271
|
const result = await setupAudio(deps);
|
|
4214
4272
|
if (!result.ok) {
|
|
@@ -4228,7 +4286,7 @@ var setupAudioCommand = new Command11("setup-audio").description("Configure macO
|
|
|
4228
4286
|
});
|
|
4229
4287
|
|
|
4230
4288
|
// src/commands/tmux-restore.ts
|
|
4231
|
-
import { Command as
|
|
4289
|
+
import { Command as Command13 } from "commander";
|
|
4232
4290
|
import { execSync } from "child_process";
|
|
4233
4291
|
import { join as join12 } from "path";
|
|
4234
4292
|
|
|
@@ -4348,7 +4406,7 @@ async function executeTmuxRestore() {
|
|
|
4348
4406
|
}
|
|
4349
4407
|
}
|
|
4350
4408
|
}
|
|
4351
|
-
var tmuxRestoreCommand = new
|
|
4409
|
+
var tmuxRestoreCommand = new Command13("tmux-restore").description("Restore tmux session state from saved state (container only)").action(async () => {
|
|
4352
4410
|
try {
|
|
4353
4411
|
await executeTmuxRestore();
|
|
4354
4412
|
} catch {
|
|
@@ -4356,7 +4414,7 @@ var tmuxRestoreCommand = new Command12("tmux-restore").description("Restore tmux
|
|
|
4356
4414
|
});
|
|
4357
4415
|
|
|
4358
4416
|
// src/commands/tmux-save.ts
|
|
4359
|
-
import { Command as
|
|
4417
|
+
import { Command as Command14 } from "commander";
|
|
4360
4418
|
import { execSync as execSync2 } from "child_process";
|
|
4361
4419
|
import { unlink as unlink2 } from "fs/promises";
|
|
4362
4420
|
import { join as join13 } from "path";
|
|
@@ -4434,7 +4492,7 @@ async function executeTmuxSave() {
|
|
|
4434
4492
|
const pruned = pruneStaleEntries(panesState, activePaneIds);
|
|
4435
4493
|
await writePanesState(panesPath, pruned);
|
|
4436
4494
|
}
|
|
4437
|
-
var tmuxSaveCommand = new
|
|
4495
|
+
var tmuxSaveCommand = new Command14("tmux-save").description("Save current tmux session state for persistence across rebuilds (container only)").action(async () => {
|
|
4438
4496
|
try {
|
|
4439
4497
|
await executeTmuxSave();
|
|
4440
4498
|
} catch {
|
|
@@ -4442,7 +4500,7 @@ var tmuxSaveCommand = new Command13("tmux-save").description("Save current tmux
|
|
|
4442
4500
|
});
|
|
4443
4501
|
|
|
4444
4502
|
// src/commands/tmux-status.ts
|
|
4445
|
-
import { Command as
|
|
4503
|
+
import { Command as Command15 } from "commander";
|
|
4446
4504
|
|
|
4447
4505
|
// src/lib/tmux-status.ts
|
|
4448
4506
|
import { readFile as readFile14 } from "fs/promises";
|
|
@@ -4483,7 +4541,7 @@ var defaultDeps3 = {
|
|
|
4483
4541
|
statePath: CONTAINER_STATE_PATH
|
|
4484
4542
|
};
|
|
4485
4543
|
function createTmuxStatusCommand(deps = defaultDeps3) {
|
|
4486
|
-
return new
|
|
4544
|
+
return new Command15("tmux-status").description("Output formatted instance status for tmux status bar (container only)").action(async () => {
|
|
4487
4545
|
if (!deps.isInsideContainer()) {
|
|
4488
4546
|
console.log("?");
|
|
4489
4547
|
return;
|
|
@@ -4598,6 +4656,7 @@ program.name("agent-env").description("CLI for creating isolated, AI-ready devel
|
|
|
4598
4656
|
program.addCommand(createCommand);
|
|
4599
4657
|
program.addCommand(listCommand);
|
|
4600
4658
|
program.addCommand(attachCommand);
|
|
4659
|
+
program.addCommand(pathCommand);
|
|
4601
4660
|
program.addCommand(codeCommand);
|
|
4602
4661
|
program.addCommand(rebuildCommand);
|
|
4603
4662
|
program.addCommand(removeCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zookanalytics/agent-env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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",
|