@zookanalytics/agent-env 0.6.0 → 0.7.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 +124 -15
- 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.0",
|
|
46
46
|
description: "CLI for creating isolated, AI-ready development environments",
|
|
47
47
|
type: "module",
|
|
48
48
|
bin: {
|
|
@@ -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,35 @@ 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 instance
|
|
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
|
+
instance="\${base##*-}"
|
|
2000
|
+
[[ "\${instance}" != "\${base}" ]] && echo "\${instance}"
|
|
2001
|
+
done | sort -u
|
|
1972
2002
|
fi
|
|
1973
2003
|
}
|
|
1974
2004
|
|
|
@@ -1986,28 +2016,48 @@ _agent_env_completions() {
|
|
|
1986
2016
|
|
|
1987
2017
|
# Complete based on command
|
|
1988
2018
|
case "\${prev}" in
|
|
1989
|
-
|
|
1990
|
-
|
|
2019
|
+
attach|purpose)
|
|
2020
|
+
local instances
|
|
2021
|
+
instances="$(_agent_env_instances)"
|
|
2022
|
+
COMPREPLY=($(compgen -W "--repo \${instances}" -- "\${cur}"))
|
|
1991
2023
|
return 0
|
|
1992
2024
|
;;
|
|
1993
2025
|
create)
|
|
1994
|
-
COMPREPLY=($(compgen -W "--repo --attach" -- "\${cur}"))
|
|
2026
|
+
COMPREPLY=($(compgen -W "--repo --purpose --attach" -- "\${cur}"))
|
|
1995
2027
|
return 0
|
|
1996
2028
|
;;
|
|
1997
2029
|
list|ps)
|
|
1998
|
-
COMPREPLY=($(compgen -W "--json" -- "\${cur}"))
|
|
2030
|
+
COMPREPLY=($(compgen -W "--json --repo" -- "\${cur}"))
|
|
2031
|
+
return 0
|
|
2032
|
+
;;
|
|
2033
|
+
rebuild)
|
|
2034
|
+
local instances
|
|
2035
|
+
instances="$(_agent_env_instances)"
|
|
2036
|
+
COMPREPLY=($(compgen -W "--force --yes --no-pull --use-cache --repo \${instances}" -- "\${cur}"))
|
|
1999
2037
|
return 0
|
|
2000
2038
|
;;
|
|
2001
2039
|
remove)
|
|
2002
2040
|
local instances
|
|
2003
2041
|
instances="$(_agent_env_instances)"
|
|
2004
|
-
COMPREPLY=($(compgen -W "--force \${instances}" -- "\${cur}"))
|
|
2042
|
+
COMPREPLY=($(compgen -W "--force --repo \${instances}" -- "\${cur}"))
|
|
2043
|
+
return 0
|
|
2044
|
+
;;
|
|
2045
|
+
repos)
|
|
2046
|
+
COMPREPLY=($(compgen -W "--json" -- "\${cur}"))
|
|
2047
|
+
return 0
|
|
2048
|
+
;;
|
|
2049
|
+
tmux-status)
|
|
2050
|
+
# no arguments or options
|
|
2005
2051
|
return 0
|
|
2006
2052
|
;;
|
|
2007
2053
|
completion)
|
|
2008
2054
|
COMPREPLY=($(compgen -W "bash zsh" -- "\${cur}"))
|
|
2009
2055
|
return 0
|
|
2010
2056
|
;;
|
|
2057
|
+
--repo)
|
|
2058
|
+
COMPREPLY=($(compgen -W "$(_agent_env_repos)" -- "\${cur}"))
|
|
2059
|
+
return 0
|
|
2060
|
+
;;
|
|
2011
2061
|
esac
|
|
2012
2062
|
|
|
2013
2063
|
return 0
|
|
@@ -2021,20 +2071,48 @@ function generateZshCompletion() {
|
|
|
2021
2071
|
"list:List all instances",
|
|
2022
2072
|
"ps:List all instances (alias)",
|
|
2023
2073
|
"attach:Attach to an instance tmux session",
|
|
2074
|
+
"rebuild:Rebuild an instance container",
|
|
2024
2075
|
"remove:Remove an instance",
|
|
2076
|
+
"repos:List tracked repositories",
|
|
2025
2077
|
"purpose:Get or set instance purpose",
|
|
2078
|
+
"tmux-status:Show tmux status bar info",
|
|
2026
2079
|
"completion:Generate shell completion script"
|
|
2027
2080
|
];
|
|
2028
2081
|
return `#compdef agent-env
|
|
2029
2082
|
# agent-env zsh completion script
|
|
2030
2083
|
# Install: eval "$(agent-env completion zsh)"
|
|
2031
2084
|
|
|
2085
|
+
_agent_env_repos() {
|
|
2086
|
+
local ws_dir=~/.agent-env/workspaces
|
|
2087
|
+
local -a repos
|
|
2088
|
+
local entry base repo
|
|
2089
|
+
if [[ -d "\${ws_dir}" ]]; then
|
|
2090
|
+
for entry in "\${ws_dir}"/*/; do
|
|
2091
|
+
[[ -d "\${entry}" ]] || continue
|
|
2092
|
+
base="\${entry%/}"
|
|
2093
|
+
base="\${base##*/}"
|
|
2094
|
+
repo="\${base%-*}"
|
|
2095
|
+
[[ "\${repo}" != "\${base}" ]] && repos+=("\${repo}")
|
|
2096
|
+
done
|
|
2097
|
+
fi
|
|
2098
|
+
repos=(\${(u)repos})
|
|
2099
|
+
_describe 'repo' repos
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2032
2102
|
_agent_env_instances() {
|
|
2033
2103
|
local ws_dir=~/.agent-env/workspaces
|
|
2034
2104
|
local -a instances
|
|
2105
|
+
local entry base instance
|
|
2035
2106
|
if [[ -d "\${ws_dir}" ]]; then
|
|
2036
|
-
|
|
2107
|
+
for entry in "\${ws_dir}"/*/; do
|
|
2108
|
+
[[ -d "\${entry}" ]] || continue
|
|
2109
|
+
base="\${entry%/}"
|
|
2110
|
+
base="\${base##*/}"
|
|
2111
|
+
instance="\${base##*-}"
|
|
2112
|
+
[[ "\${instance}" != "\${base}" ]] && instances+=("\${instance}")
|
|
2113
|
+
done
|
|
2037
2114
|
fi
|
|
2115
|
+
instances=(\${(u)instances})
|
|
2038
2116
|
_describe 'instance' instances
|
|
2039
2117
|
}
|
|
2040
2118
|
|
|
@@ -2057,22 +2135,42 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2057
2135
|
args)
|
|
2058
2136
|
case $words[1] in
|
|
2059
2137
|
attach|purpose)
|
|
2060
|
-
|
|
2138
|
+
_arguments \\
|
|
2139
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2140
|
+
'1:instance:_agent_env_instances'
|
|
2061
2141
|
;;
|
|
2062
2142
|
create)
|
|
2063
2143
|
_arguments \\
|
|
2064
2144
|
'--repo[Repository URL]:url:' \\
|
|
2145
|
+
'--purpose[Set instance purpose]:text:' \\
|
|
2065
2146
|
'--attach[Attach after creation]'
|
|
2066
2147
|
;;
|
|
2067
2148
|
list|ps)
|
|
2068
2149
|
_arguments \\
|
|
2069
|
-
'--json[Output as JSON]'
|
|
2150
|
+
'--json[Output as JSON]' \\
|
|
2151
|
+
'--repo[Filter by repo slug]:slug:_agent_env_repos'
|
|
2152
|
+
;;
|
|
2153
|
+
rebuild)
|
|
2154
|
+
_arguments \\
|
|
2155
|
+
'--force[Rebuild running container]' \\
|
|
2156
|
+
'--yes[Skip confirmation prompt]' \\
|
|
2157
|
+
'--no-pull[Skip pulling fresh images]' \\
|
|
2158
|
+
'--use-cache[Allow Docker layer cache]' \\
|
|
2159
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2160
|
+
'1:instance:_agent_env_instances'
|
|
2070
2161
|
;;
|
|
2071
2162
|
remove)
|
|
2072
2163
|
_arguments \\
|
|
2073
2164
|
'--force[Force removal]' \\
|
|
2165
|
+
'--repo[Repo slug to scope lookup]:slug:_agent_env_repos' \\
|
|
2074
2166
|
'1:instance:_agent_env_instances'
|
|
2075
2167
|
;;
|
|
2168
|
+
repos)
|
|
2169
|
+
_arguments \\
|
|
2170
|
+
'--json[Output as JSON]'
|
|
2171
|
+
;;
|
|
2172
|
+
tmux-status)
|
|
2173
|
+
;;
|
|
2076
2174
|
completion)
|
|
2077
2175
|
_describe 'shell' '(bash zsh)'
|
|
2078
2176
|
;;
|
|
@@ -2081,7 +2179,7 @@ ${commandDescriptions.map((desc) => ` '${desc}'`).join("\n")}
|
|
|
2081
2179
|
esac
|
|
2082
2180
|
}
|
|
2083
2181
|
|
|
2084
|
-
_agent_env`;
|
|
2182
|
+
compdef _agent_env agent-env`;
|
|
2085
2183
|
}
|
|
2086
2184
|
|
|
2087
2185
|
// src/commands/completion.ts
|
|
@@ -3711,7 +3809,7 @@ Purpose for ${name}:`);
|
|
|
3711
3809
|
var __dirname = dirname3(fileURLToPath2(import.meta.url));
|
|
3712
3810
|
var isLinked = existsSync(resolve(__dirname, "..", "..", "..", "pnpm-workspace.yaml"));
|
|
3713
3811
|
var version = package_default.version + (isLinked ? "+local" : "");
|
|
3714
|
-
program.name("agent-env").description("CLI for creating isolated, AI-ready development environments").version(version);
|
|
3812
|
+
program.name("agent-env").description("CLI for creating isolated, AI-ready development environments").version(version).allowExcessArguments(true);
|
|
3715
3813
|
program.addCommand(createCommand);
|
|
3716
3814
|
program.addCommand(listCommand);
|
|
3717
3815
|
program.addCommand(attachCommand);
|
|
@@ -3722,6 +3820,17 @@ program.addCommand(reposCommand);
|
|
|
3722
3820
|
program.addCommand(tmuxStatusCommand);
|
|
3723
3821
|
program.addCommand(completionCommand);
|
|
3724
3822
|
program.action(async () => {
|
|
3823
|
+
if (program.args.length > 0) {
|
|
3824
|
+
const unknown = program.args[0];
|
|
3825
|
+
const available = program.commands.map((c) => c.name());
|
|
3826
|
+
const matches = available.filter((c) => c.startsWith(unknown));
|
|
3827
|
+
const suggestion = matches.length > 0 ? `Did you mean ${matches.map((m) => `"${m}"`).join(" or ")}?` : `Available commands: ${available.join(", ")}`;
|
|
3828
|
+
console.error(
|
|
3829
|
+
formatError(createError("UNKNOWN_COMMAND", `Unknown command "${unknown}".`, suggestion))
|
|
3830
|
+
);
|
|
3831
|
+
process.exitCode = 1;
|
|
3832
|
+
return;
|
|
3833
|
+
}
|
|
3725
3834
|
if (!process.stdin.isTTY) {
|
|
3726
3835
|
program.help();
|
|
3727
3836
|
return;
|