-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathagentbox.completion
More file actions
96 lines (88 loc) · 3.13 KB
/
agentbox.completion
File metadata and controls
96 lines (88 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Shell completion for agentbox
# Supports both bash and zsh
_agentbox_complete() {
local cur prev words cword
local -a opts agent_types
# Initialize completion for bash
if type _init_completion >/dev/null 2>&1; then
_init_completion || return
fi
opts=(
-v
--verbose
--docker
-s
--use-stash
-a
--agent
--no-autostart
--dangerously-skip-permissions
--no-git-worktree
--mount
--block-folder
--image
--privileged
--mount-docker-socket
--refresh-cache
--keep-container
--no-devcontainer
--help
-h
)
agent_types=(claude-code qwen-code opencode-ai cursor)
# Completing options or branch name
if [[ "${cur}" == -* ]]; then
# Completing options
COMPREPLY=($(compgen -W "${opts[*]}" -- "${cur}"))
elif [[ "${prev}" == "--agent" || "${prev}" == "-a" ]]; then
# Completing agent type
COMPREPLY=($(compgen -W "${agent_types[*]}" -- "${cur}"))
elif [[ "${prev}" == "--image" ]]; then
# Offer file paths (Containerfile/Dockerfile) as completions
COMPREPLY=($(compgen -f -- "${cur}"))
compopt -o filenames 2>/dev/null
elif [[ "${prev}" == "--mount" ]]; then
# Completing mount spec — offer file/directory path completion
COMPREPLY=($(compgen -f -- "${cur}"))
compopt -o filenames 2>/dev/null
elif [[ "${prev}" == "--block-folder" ]]; then
# Completing blocked folder — offer directory path completion
COMPREPLY=($(compgen -d -- "${cur}"))
compopt -o filenames 2>/dev/null
else
# Completing branch name or options
COMPREPLY=($(compgen -W "${opts[*]}" -- "${cur}"))
fi
}
# Bash completion
if type complete >/dev/null 2>&1; then
complete -F _agentbox_complete agentbox
fi
# Zsh completion
if type compdef >/dev/null 2>&1; then
_agentbox_zsh() {
local context state state_descr line
typeset -A opt_args
local -a agent_types
agent_types=(claude-code qwen-code opencode-ai cursor)
_arguments \
'(-v --verbose)'{-v,--verbose}'[Verbose output]' \
'--docker[Use docker even if podman is available]' \
'(-s --use-stash)'{-s,--use-stash}'[Stash current changes and apply to new worktree]' \
'(-a --agent)'{-a,--agent}'[Agent type]:agent type:('"${agent_types[*]}"')' \
'--no-autostart[Do not launch the agent CLI automatically]' \
'--dangerously-skip-permissions[Run agent in yolo mode]' \
'--no-git-worktree[Run without git, mount current directory]' \
'--refresh-cache[Remove cached agent install and reinstall]' \
'--privileged[Run container in privileged mode (enables Docker-in-Docker)]' \
'--mount-docker-socket[Mount host docker/podman socket into container at /var/run/docker.sock]' \
'--keep-container[Do not remove the container on exit]' \
'--no-devcontainer[Skip automatic devcontainer.json detection]' \
'--image[Use custom container image or Containerfile (glibc+bash required)]:image or file:_files' \
'*--mount[Mount host path into container]:mount spec:_files' \
'*--block-folder[Hide a directory from the agent]:folder:_directories' \
':branch name:' \
&& return
}
compdef _agentbox_zsh agentbox
fi