@zookanalytics/agent-env 0.6.0 → 0.7.1
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 +123 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -42,7 +42,7 @@ import React3 from "react";
|
|
|
42
42
|
// package.json
|
|
43
43
|
var package_default = {
|
|
44
44
|
name: "@zookanalytics/agent-env",
|
|
45
|
-
version: "0.
|
|
45
|
+
version: "0.7.1",
|
|
46
46
|
description: "CLI for creating isolated, AI-ready development environments",
|
|
47
47
|
type: "module",
|
|
48
48
|
bin: {
|
|
@@ -603,7 +603,7 @@ var defaultMergeDeps = { readFile: readFile2, writeFile: writeFile2, rename, acc
|
|
|
603
603
|
var STATUS_BAR_JSON_FILENAME = "statusBar.json";
|
|
604
604
|
var LABEL_LIFECYCLE_CMDS = {
|
|
605
605
|
postCreateCommand: "/usr/local/bin/post-create.sh",
|
|
606
|
-
postStartCommand: "sudo /usr/local/bin/start-sshd.sh; tmux new-session -d -s main 2>/dev/null || true"
|
|
606
|
+
postStartCommand: "sudo /usr/local/bin/start-sshd.sh; tmux new-session -d -s main 2>/dev/null || true; : > /tmp/install-shared-skills.log; /usr/local/bin/install-shared-skills.sh >> /tmp/install-shared-skills.log 2>&1 || true"
|
|
607
607
|
};
|
|
608
608
|
var COMPOSABLE_LIFECYCLE_CMDS = [
|
|
609
609
|
"postCreateCommand",
|
|
@@ -1928,8 +1928,18 @@ var attachCommand = new Command("attach").description("Attach to an instance's t
|
|
|
1928
1928
|
import { Command as Command2 } from "commander";
|
|
1929
1929
|
|
|
1930
1930
|
// src/lib/completion.ts
|
|
1931
|
-
var COMMANDS = [
|
|
1932
|
-
|
|
1931
|
+
var COMMANDS = [
|
|
1932
|
+
"create",
|
|
1933
|
+
"list",
|
|
1934
|
+
"ps",
|
|
1935
|
+
"attach",
|
|
1936
|
+
"rebuild",
|
|
1937
|
+
"remove",
|
|
1938
|
+
"repos",
|
|
1939
|
+
"purpose",
|
|
1940
|
+
"tmux-status",
|
|
1941
|
+
"completion"
|
|
1942
|
+
];
|
|
1933
1943
|
function generateCompletionScript(shell) {
|
|
1934
1944
|
switch (shell) {
|
|
1935
1945
|
case "bash":
|
|
@@ -1960,15 +1970,34 @@ function getInstallInstructions() {
|
|
|
1960
1970
|
}
|
|
1961
1971
|
function generateBashCompletion() {
|
|
1962
1972
|
const commandList = COMMANDS.join(" ");
|
|
1963
|
-
const instanceCommandList = INSTANCE_COMMANDS.join("|");
|
|
1964
1973
|
return `#!/usr/bin/env bash
|
|
1965
1974
|
# agent-env bash completion script
|
|
1966
1975
|
# Install: eval "$(agent-env completion bash)"
|
|
1967
1976
|
|
|
1977
|
+
_agent_env_repos() {
|
|
1978
|
+
local ws_dir=~/.agent-env/workspaces
|
|
1979
|
+
local entry base repo
|
|
1980
|
+
if [[ -d "\${ws_dir}" ]]; then
|
|
1981
|
+
for entry in "\${ws_dir}"/*/; do
|
|
1982
|
+
[[ -d "\${entry}" ]] || continue
|
|
1983
|
+
base="\${entry%/}"
|
|
1984
|
+
base="\${base##*/}"
|
|
1985
|
+
repo="\${base%-*}"
|
|
1986
|
+
[[ "\${repo}" != "\${base}" ]] && echo "\${repo}"
|
|
1987
|
+
done | sort -u
|
|
1988
|
+
fi
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1968
1991
|
_agent_env_instances() {
|
|
1969
1992
|
local ws_dir=~/.agent-env/workspaces
|
|
1993
|
+
local entry base
|
|
1970
1994
|
if [[ -d "\${ws_dir}" ]]; then
|
|
1971
|
-
|
|
1995
|
+
for entry in "\${ws_dir}"/*/; do
|
|
1996
|
+
[[ -d "\${entry}" ]] || continue
|
|
1997
|
+
base="\${entry%/}"
|
|
1998
|
+
base="\${base##*/}"
|
|
1999
|
+
echo "\${base}"
|
|
2000
|
+
done | sort -u
|
|
1972
2001
|
fi
|
|
1973
2002
|
}
|
|
1974
2003
|
|
|
@@ -1986,28 +2015,48 @@ _agent_env_completions() {
|
|
|
1986
2015
|
|
|
1987
2016
|
# Complete based on command
|
|
1988
2017
|
case "\${prev}" in
|
|
1989
|
-
|
|
1990
|
-
|
|
2018
|
+
attach|purpose)
|
|
2019
|
+
local instances
|
|
2020
|
+
instances="$(_agent_env_instances)"
|
|
2021
|
+
COMPREPLY=($(compgen -W "--repo \${instances}" -- "\${cur}"))
|
|
1991
2022
|
return 0
|
|
1992
2023
|
;;
|
|
1993
2024
|
create)
|
|
1994
|
-
COMPREPLY=($(compgen -W "--repo --attach" -- "\${cur}"))
|
|
2025
|
+
COMPREPLY=($(compgen -W "--repo --purpose --attach" -- "\${cur}"))
|
|
1995
2026
|
return 0
|
|
1996
2027
|
;;
|
|
1997
2028
|
list|ps)
|
|
1998
|
-
COMPREPLY=($(compgen -W "--json" -- "\${cur}"))
|
|
2029
|
+
COMPREPLY=($(compgen -W "--json --repo" -- "\${cur}"))
|
|
2030
|
+
return 0
|
|
2031
|
+
;;
|
|
2032
|
+
rebuild)
|
|
2033
|
+
local instances
|
|
2034
|
+
instances="$(_agent_env_instances)"
|
|
2035
|
+
COMPREPLY=($(compgen -W "--force --yes --no-pull --use-cache --repo \${instances}" -- "\${cur}"))
|
|
1999
2036
|
return 0
|
|
2000
2037
|
;;
|
|
2001
2038
|
remove)
|
|
2002
2039
|
local instances
|
|
2003
2040
|
instances="$(_agent_env_instances)"
|
|
2004
|
-
COMPREPLY=($(compgen -W "--force \${instances}" -- "\${cur}"))
|
|
2041
|
+
COMPREPLY=($(compgen -W "--force --repo \${instances}" -- "\${cur}"))
|
|
2042
|
+
return 0
|
|
2043
|
+
;;
|
|
2044
|
+
repos)
|
|
2045
|
+
COMPREPLY=($(compgen -W "--json" -- "\${cur}"))
|
|
2046
|
+
return 0
|
|
2047
|
+
;;
|
|
2048
|
+
tmux-status)
|
|
2049
|
+
# no arguments or options
|
|
2005
2050
|
return 0
|
|
2006
2051
|
;;
|
|
2007
2052
|
completion)
|
|
2008
2053
|
COMPREPLY=($(compgen -W "bash zsh" -- "\${cur}"))
|
|
2009
2054
|
return 0
|
|
2010
2055
|
;;
|
|
2056
|
+
--repo)
|
|
2057
|
+
COMPREPLY=($(compgen -W "$(_agent_env_repos)" -- "\${cur}"))
|
|
2058
|
+
return 0
|
|
2059
|
+
;;
|
|
2011
2060
|
esac
|
|
2012
2061
|
|
|
2013
2062
|
return 0
|
|
@@ -2021,20 +2070,47 @@ function generateZshCompletion() {
|
|
|
2021
2070
|
"list:List all instances",
|
|
2022
2071
|
"ps:List all instances (alias)",
|
|
2023
2072
|
"attach:Attach to an instance tmux session",
|
|
2073
|
+
"rebuild:Rebuild an instance container",
|
|
2024
2074
|
"remove:Remove an instance",
|
|
2075
|
+
"repos:List tracked repositories",
|
|
2025
2076
|
"purpose:Get or set instance purpose",
|
|
2077
|
+
"tmux-status:Show tmux status bar info",
|
|
2026
2078
|
"completion:Generate shell completion script"
|
|
2027
2079
|
];
|
|
2028
2080
|
return `#compdef agent-env
|
|
2029
2081
|
# agent-env zsh completion script
|
|
2030
2082
|
# Install: eval "$(agent-env completion zsh)"
|
|
2031
2083
|
|
|
2084
|
+
_agent_env_repos() {
|
|
2085
|
+
local ws_dir=~/.agent-env/workspaces
|
|
2086
|
+
local -a repos
|
|
2087
|
+
local entry base repo
|
|
2088
|
+
if [[ -d "\${ws_dir}" ]]; then
|
|
2089
|
+
for entry in "\${ws_dir}"/*/; do
|
|
2090
|
+
[[ -d "\${entry}" ]] || continue
|
|
2091
|
+
base="\${entry%/}"
|
|
2092
|
+
base="\${base##*/}"
|
|
2093
|
+
repo="\${base%-*}"
|
|
2094
|
+
[[ "\${repo}" != "\${base}" ]] && repos+=("\${repo}")
|
|
2095
|
+
done
|
|
2096
|
+
fi
|
|
2097
|
+
repos=(\${(u)repos})
|
|
2098
|
+
_describe 'repo' repos
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2032
2101
|
_agent_env_instances() {
|
|
2033
2102
|
local ws_dir=~/.agent-env/workspaces
|
|
2034
2103
|
local -a instances
|
|
2104
|
+
local entry base
|
|
2035
2105
|
if [[ -d "\${ws_dir}" ]]; then
|
|
2036
|
-
|
|
2106
|
+
for entry in "\${ws_dir}"/*/; do
|
|
2107
|
+
[[ -d "\${entry}" ]] || continue
|
|
2108
|
+
base="\${entry%/}"
|
|
2109
|
+
base="\${base##*/}"
|
|
2110
|
+
instances+=("\${base}")
|
|
2111
|
+
done
|
|
2037
2112
|
fi
|
|
2113
|
+
instances=(\${(u)instances})
|
|
2038
2114
|
_describe 'instance' instances
|
|
2039
2115
|
}
|
|
2040
2116
|
|
|
@@ -2057,22 +2133,42 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2057
2133
|
args)
|
|
2058
2134
|
case $words[1] in
|
|
2059
2135
|
attach|purpose)
|
|
2060
|
-
|
|
2136
|
+
_arguments \\
|
|
2137
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2138
|
+
'1:instance:_agent_env_instances'
|
|
2061
2139
|
;;
|
|
2062
2140
|
create)
|
|
2063
2141
|
_arguments \\
|
|
2064
2142
|
'--repo[Repository URL]:url:' \\
|
|
2143
|
+
'--purpose[Set instance purpose]:text:' \\
|
|
2065
2144
|
'--attach[Attach after creation]'
|
|
2066
2145
|
;;
|
|
2067
2146
|
list|ps)
|
|
2068
2147
|
_arguments \\
|
|
2069
|
-
'--json[Output as JSON]'
|
|
2148
|
+
'--json[Output as JSON]' \\
|
|
2149
|
+
'--repo[Filter by repo slug]:slug:_agent_env_repos'
|
|
2150
|
+
;;
|
|
2151
|
+
rebuild)
|
|
2152
|
+
_arguments \\
|
|
2153
|
+
'--force[Rebuild running container]' \\
|
|
2154
|
+
'--yes[Skip confirmation prompt]' \\
|
|
2155
|
+
'--no-pull[Skip pulling fresh images]' \\
|
|
2156
|
+
'--use-cache[Allow Docker layer cache]' \\
|
|
2157
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2158
|
+
'1:instance:_agent_env_instances'
|
|
2070
2159
|
;;
|
|
2071
2160
|
remove)
|
|
2072
2161
|
_arguments \\
|
|
2073
2162
|
'--force[Force removal]' \\
|
|
2163
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2074
2164
|
'1:instance:_agent_env_instances'
|
|
2075
2165
|
;;
|
|
2166
|
+
repos)
|
|
2167
|
+
_arguments \\
|
|
2168
|
+
'--json[Output as JSON]'
|
|
2169
|
+
;;
|
|
2170
|
+
tmux-status)
|
|
2171
|
+
;;
|
|
2076
2172
|
completion)
|
|
2077
2173
|
_describe 'shell' '(bash zsh)'
|
|
2078
2174
|
;;
|
|
@@ -2081,7 +2177,7 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2081
2177
|
esac
|
|
2082
2178
|
}
|
|
2083
2179
|
|
|
2084
|
-
_agent_env`;
|
|
2180
|
+
compdef _agent_env agent-env`;
|
|
2085
2181
|
}
|
|
2086
2182
|
|
|
2087
2183
|
// src/commands/completion.ts
|
|
@@ -3711,7 +3807,7 @@ Purpose for ${name}:`);
|
|
|
3711
3807
|
var __dirname = dirname3(fileURLToPath2(import.meta.url));
|
|
3712
3808
|
var isLinked = existsSync(resolve(__dirname, "..", "..", "..", "pnpm-workspace.yaml"));
|
|
3713
3809
|
var version = package_default.version + (isLinked ? "+local" : "");
|
|
3714
|
-
program.name("agent-env").description("CLI for creating isolated, AI-ready development environments").version(version);
|
|
3810
|
+
program.name("agent-env").description("CLI for creating isolated, AI-ready development environments").version(version).allowExcessArguments(true);
|
|
3715
3811
|
program.addCommand(createCommand);
|
|
3716
3812
|
program.addCommand(listCommand);
|
|
3717
3813
|
program.addCommand(attachCommand);
|
|
@@ -3722,6 +3818,17 @@ program.addCommand(reposCommand);
|
|
|
3722
3818
|
program.addCommand(tmuxStatusCommand);
|
|
3723
3819
|
program.addCommand(completionCommand);
|
|
3724
3820
|
program.action(async () => {
|
|
3821
|
+
if (program.args.length > 0) {
|
|
3822
|
+
const unknown = program.args[0];
|
|
3823
|
+
const available = program.commands.map((c) => c.name());
|
|
3824
|
+
const matches = available.filter((c) => c.startsWith(unknown));
|
|
3825
|
+
const suggestion = matches.length > 0 ? `Did you mean ${matches.map((m) => `"${m}"`).join(" or ")}?` : `Available commands: ${available.join(", ")}`;
|
|
3826
|
+
console.error(
|
|
3827
|
+
formatError(createError("UNKNOWN_COMMAND", `Unknown command "${unknown}".`, suggestion))
|
|
3828
|
+
);
|
|
3829
|
+
process.exitCode = 1;
|
|
3830
|
+
return;
|
|
3831
|
+
}
|
|
3725
3832
|
if (!process.stdin.isTTY) {
|
|
3726
3833
|
program.help();
|
|
3727
3834
|
return;
|