oasr 0.5.1__py3-none-any.whl → 0.6.0__py3-none-any.whl
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.
- agents/base.py +17 -3
- agents/claude.py +12 -2
- agents/codex.py +12 -2
- agents/copilot.py +12 -2
- agents/opencode.py +12 -2
- cli.py +8 -2
- commands/completion.py +345 -0
- commands/config.py +284 -37
- commands/exec.py +21 -1
- commands/profile.py +84 -0
- commands/update.py +89 -7
- completions/__init__.py +1 -0
- completions/bash.sh +210 -0
- completions/fish.fish +134 -0
- completions/powershell.ps1 +184 -0
- completions/zsh.sh +285 -0
- config/__init__.py +11 -0
- config/defaults.py +4 -21
- config/schema.py +3 -29
- {oasr-0.5.1.dist-info → oasr-0.6.0.dist-info}/METADATA +51 -21
- {oasr-0.5.1.dist-info → oasr-0.6.0.dist-info}/RECORD +34 -20
- policy/defaults.py +3 -19
- policy/profile.py +5 -7
- profiles/__init__.py +23 -0
- profiles/builtins.py +63 -0
- profiles/loader.py +74 -0
- profiles/paths.py +22 -0
- profiles/registry.py +19 -0
- profiles/summary.py +23 -0
- profiles/validation.py +34 -0
- {oasr-0.5.1.dist-info → oasr-0.6.0.dist-info}/WHEEL +0 -0
- {oasr-0.5.1.dist-info → oasr-0.6.0.dist-info}/entry_points.txt +0 -0
- {oasr-0.5.1.dist-info → oasr-0.6.0.dist-info}/licenses/LICENSE +0 -0
- {oasr-0.5.1.dist-info → oasr-0.6.0.dist-info}/licenses/NOTICE +0 -0
completions/bash.sh
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# oasr completion for bash
|
|
2
|
+
# This file provides tab completion for the oasr command in bash.
|
|
3
|
+
#
|
|
4
|
+
# Installation:
|
|
5
|
+
# Run: oasr completion install
|
|
6
|
+
# Or manually: source this file in your ~/.bashrc
|
|
7
|
+
|
|
8
|
+
_oasr_skills() {
|
|
9
|
+
# Get skill names from registry
|
|
10
|
+
local skills
|
|
11
|
+
skills=$(oasr registry list --quiet 2>/dev/null | grep "^ -" | sed 's/^ - //' | awk '{print $1}')
|
|
12
|
+
COMPREPLY=($(compgen -W "$skills" -- "${COMP_WORDS[COMP_CWORD]}"))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_oasr_agents() {
|
|
16
|
+
# Known agent names
|
|
17
|
+
COMPREPLY=($(compgen -W "codex copilot claude opencode" -- "${COMP_WORDS[COMP_CWORD]}"))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_oasr_profiles() {
|
|
21
|
+
# Get profile names from config
|
|
22
|
+
local profiles
|
|
23
|
+
profiles=$(oasr config profiles --names 2>/dev/null)
|
|
24
|
+
COMPREPLY=($(compgen -W "$profiles" -- "${COMP_WORDS[COMP_CWORD]}"))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_oasr_config_keys() {
|
|
28
|
+
# Common config keys
|
|
29
|
+
COMPREPLY=($(compgen -W "agent profile oasr.default_profile adapter.default_targets validation.strict validation.reference_max_lines oasr.completions" -- "${COMP_WORDS[COMP_CWORD]}"))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_oasr_completion_shells() {
|
|
33
|
+
COMPREPLY=($(compgen -W "bash zsh fish powershell install uninstall" -- "${COMP_WORDS[COMP_CWORD]}"))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_oasr() {
|
|
37
|
+
local cur prev words cword
|
|
38
|
+
_init_completion || return
|
|
39
|
+
|
|
40
|
+
# Top-level commands
|
|
41
|
+
if [ $COMP_CWORD -eq 1 ]; then
|
|
42
|
+
COMPREPLY=($(compgen -W "registry diff sync config profile clone exec use find validate clean adapter update info help completion" -- "$cur"))
|
|
43
|
+
return 0
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Get the main command
|
|
47
|
+
local command="${COMP_WORDS[1]}"
|
|
48
|
+
|
|
49
|
+
case "$command" in
|
|
50
|
+
exec)
|
|
51
|
+
case "$prev" in
|
|
52
|
+
--agent)
|
|
53
|
+
_oasr_agents
|
|
54
|
+
return 0
|
|
55
|
+
;;
|
|
56
|
+
--profile)
|
|
57
|
+
_oasr_profiles
|
|
58
|
+
return 0
|
|
59
|
+
;;
|
|
60
|
+
--agent-flags)
|
|
61
|
+
# No completion for agent flags
|
|
62
|
+
return 0
|
|
63
|
+
;;
|
|
64
|
+
-p|--prompt)
|
|
65
|
+
# File completion for prompt
|
|
66
|
+
_filedir
|
|
67
|
+
return 0
|
|
68
|
+
;;
|
|
69
|
+
*)
|
|
70
|
+
# Complete skill names and flags
|
|
71
|
+
if [[ "$cur" == -* ]]; then
|
|
72
|
+
COMPREPLY=($(compgen -W "--agent --profile --agent-flags -y --yes --confirm -p --prompt --unsafe" -- "$cur"))
|
|
73
|
+
else
|
|
74
|
+
_oasr_skills
|
|
75
|
+
fi
|
|
76
|
+
return 0
|
|
77
|
+
;;
|
|
78
|
+
esac
|
|
79
|
+
;;
|
|
80
|
+
|
|
81
|
+
clone)
|
|
82
|
+
case "$prev" in
|
|
83
|
+
-t|--target)
|
|
84
|
+
# Directory completion
|
|
85
|
+
_filedir -d
|
|
86
|
+
return 0
|
|
87
|
+
;;
|
|
88
|
+
*)
|
|
89
|
+
if [[ "$cur" == -* ]]; then
|
|
90
|
+
COMPREPLY=($(compgen -W "-t --target" -- "$cur"))
|
|
91
|
+
else
|
|
92
|
+
_oasr_skills
|
|
93
|
+
fi
|
|
94
|
+
return 0
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
;;
|
|
98
|
+
|
|
99
|
+
info|validate)
|
|
100
|
+
if [[ "$cur" == -* ]]; then
|
|
101
|
+
case "$command" in
|
|
102
|
+
info)
|
|
103
|
+
COMPREPLY=($(compgen -W "--files" -- "$cur"))
|
|
104
|
+
;;
|
|
105
|
+
esac
|
|
106
|
+
else
|
|
107
|
+
_oasr_skills
|
|
108
|
+
fi
|
|
109
|
+
return 0
|
|
110
|
+
;;
|
|
111
|
+
|
|
112
|
+
config)
|
|
113
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
|
114
|
+
COMPREPLY=($(compgen -W "set get list agent validation adapter oasr profiles man validate path" -- "$cur"))
|
|
115
|
+
return 0
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
local subcommand="${COMP_WORDS[2]}"
|
|
119
|
+
case "$subcommand" in
|
|
120
|
+
set|get)
|
|
121
|
+
if [ $COMP_CWORD -eq 3 ]; then
|
|
122
|
+
_oasr_config_keys
|
|
123
|
+
elif [ $COMP_CWORD -eq 4 ] && [ "$subcommand" = "set" ]; then
|
|
124
|
+
# Value completion based on key
|
|
125
|
+
local key="${COMP_WORDS[3]}"
|
|
126
|
+
case "$key" in
|
|
127
|
+
agent)
|
|
128
|
+
_oasr_agents
|
|
129
|
+
;;
|
|
130
|
+
profile|oasr.default_profile)
|
|
131
|
+
_oasr_profiles
|
|
132
|
+
;;
|
|
133
|
+
validation.strict|oasr.completions)
|
|
134
|
+
COMPREPLY=($(compgen -W "true false" -- "$cur"))
|
|
135
|
+
;;
|
|
136
|
+
adapter.default_targets)
|
|
137
|
+
return 0
|
|
138
|
+
;;
|
|
139
|
+
validation.reference_max_lines)
|
|
140
|
+
return 0
|
|
141
|
+
;;
|
|
142
|
+
esac
|
|
143
|
+
fi
|
|
144
|
+
return 0
|
|
145
|
+
;;
|
|
146
|
+
esac
|
|
147
|
+
;;
|
|
148
|
+
|
|
149
|
+
registry)
|
|
150
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
|
151
|
+
COMPREPLY=($(compgen -W "add rm sync list validate prune" -- "$cur"))
|
|
152
|
+
return 0
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
local subcommand="${COMP_WORDS[2]}"
|
|
156
|
+
case "$subcommand" in
|
|
157
|
+
add)
|
|
158
|
+
# Directory or URL completion
|
|
159
|
+
if [[ "$cur" == http* ]] || [[ "$cur" == git@* ]]; then
|
|
160
|
+
# No completion for URLs
|
|
161
|
+
return 0
|
|
162
|
+
else
|
|
163
|
+
_filedir -d
|
|
164
|
+
fi
|
|
165
|
+
;;
|
|
166
|
+
rm)
|
|
167
|
+
_oasr_skills
|
|
168
|
+
;;
|
|
169
|
+
prune)
|
|
170
|
+
if [[ "$cur" == -* ]]; then
|
|
171
|
+
COMPREPLY=($(compgen -W "--dry-run" -- "$cur"))
|
|
172
|
+
fi
|
|
173
|
+
;;
|
|
174
|
+
esac
|
|
175
|
+
;;
|
|
176
|
+
|
|
177
|
+
completion)
|
|
178
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
|
179
|
+
_oasr_completion_shells
|
|
180
|
+
return 0
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
if [[ "$cur" == -* ]]; then
|
|
184
|
+
COMPREPLY=($(compgen -W "--force --dry-run" -- "$cur"))
|
|
185
|
+
fi
|
|
186
|
+
;;
|
|
187
|
+
|
|
188
|
+
adapter)
|
|
189
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
|
190
|
+
COMPREPLY=($(compgen -W "list generate" -- "$cur"))
|
|
191
|
+
return 0
|
|
192
|
+
fi
|
|
193
|
+
;;
|
|
194
|
+
|
|
195
|
+
profile)
|
|
196
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
|
197
|
+
_oasr_profiles
|
|
198
|
+
return 0
|
|
199
|
+
fi
|
|
200
|
+
;;
|
|
201
|
+
|
|
202
|
+
find|validate|sync|diff|clean|update|help)
|
|
203
|
+
# These commands have limited or no additional completion
|
|
204
|
+
return 0
|
|
205
|
+
;;
|
|
206
|
+
esac
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
# Register the completion function
|
|
210
|
+
complete -F _oasr oasr
|
completions/fish.fish
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# oasr completion for fish
|
|
2
|
+
# This file provides tab completion for the oasr command in fish.
|
|
3
|
+
#
|
|
4
|
+
# Installation:
|
|
5
|
+
# Run: oasr completion install
|
|
6
|
+
# Or manually: Copy to ~/.config/fish/completions/oasr.fish
|
|
7
|
+
|
|
8
|
+
# Helper functions for dynamic completion
|
|
9
|
+
function __oasr_skills
|
|
10
|
+
oasr registry list --quiet 2>/dev/null | grep '^ -' | sed 's/^ - //' | awk '{print $1}'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
function __oasr_agents
|
|
14
|
+
echo codex
|
|
15
|
+
echo copilot
|
|
16
|
+
echo claude
|
|
17
|
+
echo opencode
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
function __oasr_profiles
|
|
21
|
+
oasr config profiles --names 2>/dev/null
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
function __oasr_config_keys
|
|
25
|
+
echo agent
|
|
26
|
+
echo profile
|
|
27
|
+
echo oasr.default_profile
|
|
28
|
+
echo adapter.default_targets
|
|
29
|
+
echo validation.strict
|
|
30
|
+
echo validation.reference_max_lines
|
|
31
|
+
echo oasr.completions
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Remove default completions
|
|
35
|
+
complete -c oasr -e
|
|
36
|
+
|
|
37
|
+
# Global options
|
|
38
|
+
complete -c oasr -l help -s h -d "Show help"
|
|
39
|
+
complete -c oasr -l version -d "Show version"
|
|
40
|
+
complete -c oasr -l config -d "Config file path" -r
|
|
41
|
+
complete -c oasr -l json -d "JSON output"
|
|
42
|
+
complete -c oasr -l quiet -d "Suppress warnings"
|
|
43
|
+
|
|
44
|
+
# Main commands
|
|
45
|
+
complete -c oasr -f -n __fish_use_subcommand -a registry -d "Manage skill registry"
|
|
46
|
+
complete -c oasr -f -n __fish_use_subcommand -a diff -d "Show tracked skill status"
|
|
47
|
+
complete -c oasr -f -n __fish_use_subcommand -a sync -d "Refresh tracked skills"
|
|
48
|
+
complete -c oasr -f -n __fish_use_subcommand -a config -d "Manage configuration"
|
|
49
|
+
complete -c oasr -f -n __fish_use_subcommand -a profile -d "Select execution profile"
|
|
50
|
+
complete -c oasr -f -n __fish_use_subcommand -a clone -d "Clone skills to directory"
|
|
51
|
+
complete -c oasr -f -n __fish_use_subcommand -a exec -d "Execute a skill"
|
|
52
|
+
complete -c oasr -f -n __fish_use_subcommand -a use -d "DEPRECATED - use clone"
|
|
53
|
+
complete -c oasr -f -n __fish_use_subcommand -a find -d "Find skills recursively"
|
|
54
|
+
complete -c oasr -f -n __fish_use_subcommand -a validate -d "Validate skills"
|
|
55
|
+
complete -c oasr -f -n __fish_use_subcommand -a clean -d "Clean up corrupted skills"
|
|
56
|
+
complete -c oasr -f -n __fish_use_subcommand -a adapter -d "Generate IDE files"
|
|
57
|
+
complete -c oasr -f -n __fish_use_subcommand -a update -d "Update OASR tool"
|
|
58
|
+
complete -c oasr -f -n __fish_use_subcommand -a info -d "Show skill information"
|
|
59
|
+
complete -c oasr -f -n __fish_use_subcommand -a help -d "Show help"
|
|
60
|
+
complete -c oasr -f -n __fish_use_subcommand -a completion -d "Manage shell completions"
|
|
61
|
+
|
|
62
|
+
# exec command
|
|
63
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec" -l unsafe -d "Pass unsafe agent flags"
|
|
64
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec" -l agent -d "Agent to use" -a "(__oasr_agents)"
|
|
65
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec" -l profile -d "Policy profile" -a "(__oasr_profiles)"
|
|
66
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec" -l agent-flags -d "Additional agent flags"
|
|
67
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec" -s y -l yes -d "Skip confirmation"
|
|
68
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec" -l confirm -d "Force confirmation"
|
|
69
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec" -s p -l prompt -d "Prompt from file" -r
|
|
70
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from (__oasr_skills)" -a "(__oasr_skills)" -d "Skill"
|
|
71
|
+
|
|
72
|
+
# clone command
|
|
73
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from clone" -s t -l target -d "Target directory" -r
|
|
74
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from clone; and not __fish_seen_subcommand_from (__oasr_skills)" -a "(__oasr_skills)" -d "Skill"
|
|
75
|
+
|
|
76
|
+
# info command
|
|
77
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from info" -l files -d "Show file list"
|
|
78
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from info; and not __fish_seen_subcommand_from (__oasr_skills)" -a "(__oasr_skills)" -d "Skill"
|
|
79
|
+
|
|
80
|
+
# validate command
|
|
81
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from validate; and not __fish_seen_subcommand_from (__oasr_skills)" -a "(__oasr_skills)" -d "Skill"
|
|
82
|
+
|
|
83
|
+
# config subcommands
|
|
84
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "set" -d "Set configuration value"
|
|
85
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "get" -d "Get configuration value"
|
|
86
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "list" -d "List all configuration"
|
|
87
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "agent" -d "Show agent configuration"
|
|
88
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "validation" -d "Show validation settings"
|
|
89
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "adapter" -d "Show adapter settings"
|
|
90
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "oasr" -d "Show core settings"
|
|
91
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "profiles" -d "Show profiles"
|
|
92
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "man" -d "Show config reference"
|
|
93
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "validate" -d "Validate config file"
|
|
94
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set get list agent validation adapter oasr profiles man validate path" -a "path" -d "Show config file path"
|
|
95
|
+
|
|
96
|
+
# config set/get
|
|
97
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and __fish_seen_subcommand_from set get" -a "(__oasr_config_keys)" -d "Config key"
|
|
98
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and __fish_seen_subcommand_from set; and __fish_seen_subcommand_from agent" -a "(__oasr_agents)" -d "Agent"
|
|
99
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and __fish_seen_subcommand_from set; and __fish_seen_subcommand_from profile" -a "(__oasr_profiles)" -d "Profile"
|
|
100
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and __fish_seen_subcommand_from set; and __fish_seen_subcommand_from oasr.default_profile" -a "(__oasr_profiles)" -d "Profile"
|
|
101
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from config; and __fish_seen_subcommand_from set; and __fish_seen_subcommand_from validation.strict oasr.completions" -a "true false" -d "Boolean"
|
|
102
|
+
|
|
103
|
+
# profile command
|
|
104
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from profile" -a "(__oasr_profiles)" -d "Profile"
|
|
105
|
+
|
|
106
|
+
# registry subcommands
|
|
107
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and not __fish_seen_subcommand_from add rm sync list validate prune" -a "add" -d "Add skill to registry"
|
|
108
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and not __fish_seen_subcommand_from add rm sync list validate prune" -a "rm" -d "Remove skill from registry"
|
|
109
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and not __fish_seen_subcommand_from add rm sync list validate prune" -a "sync" -d "Sync remote skills"
|
|
110
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and not __fish_seen_subcommand_from add rm sync list validate prune" -a "list" -d "List registry skills"
|
|
111
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and not __fish_seen_subcommand_from add rm sync list validate prune" -a "validate" -d "Validate registry"
|
|
112
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and not __fish_seen_subcommand_from add rm sync list validate prune" -a "prune" -d "Clean up registry"
|
|
113
|
+
|
|
114
|
+
# registry rm
|
|
115
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and __fish_seen_subcommand_from rm" -a "(__oasr_skills)" -d "Skill"
|
|
116
|
+
|
|
117
|
+
# registry prune
|
|
118
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from registry; and __fish_seen_subcommand_from prune" -l dry-run -d "Show what would be removed"
|
|
119
|
+
|
|
120
|
+
# completion command
|
|
121
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish powershell install uninstall" -a "bash" -d "Bash completion"
|
|
122
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish powershell install uninstall" -a "zsh" -d "Zsh completion"
|
|
123
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish powershell install uninstall" -a "fish" -d "Fish completion"
|
|
124
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish powershell install uninstall" -a "powershell" -d "PowerShell completion"
|
|
125
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish powershell install uninstall" -a "install" -d "Auto-detect and install"
|
|
126
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish powershell install uninstall" -a "uninstall" -d "Remove completions"
|
|
127
|
+
|
|
128
|
+
# completion flags
|
|
129
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion" -l force -d "Force reinstall"
|
|
130
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from completion" -l dry-run -d "Preview without installing"
|
|
131
|
+
|
|
132
|
+
# adapter subcommands
|
|
133
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from adapter; and not __fish_seen_subcommand_from list generate" -a "list" -d "List adapters"
|
|
134
|
+
complete -c oasr -f -n "__fish_seen_subcommand_from adapter; and not __fish_seen_subcommand_from list generate" -a "generate" -d "Generate adapter files"
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# oasr completion for PowerShell
|
|
2
|
+
# This file provides tab completion for the oasr command in PowerShell.
|
|
3
|
+
#
|
|
4
|
+
# Installation:
|
|
5
|
+
# Run: oasr completion install
|
|
6
|
+
# Or manually: Add this to your PowerShell profile ($PROFILE)
|
|
7
|
+
|
|
8
|
+
# Helper functions for dynamic completion
|
|
9
|
+
function Get-OasrSkills {
|
|
10
|
+
$skills = oasr registry list --quiet 2>$null | Select-String '^\s+-' | ForEach-Object {
|
|
11
|
+
$_.Line -replace '^\s+- ', '' -split ' ' | Select-Object -First 1
|
|
12
|
+
}
|
|
13
|
+
return $skills
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function Get-OasrAgents {
|
|
17
|
+
return @('codex', 'copilot', 'claude', 'opencode')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function Get-OasrProfiles {
|
|
21
|
+
$profiles = oasr config profiles --names 2>$null | ForEach-Object {
|
|
22
|
+
$_
|
|
23
|
+
} | Sort-Object -Unique
|
|
24
|
+
return $profiles
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function Get-OasrConfigKeys {
|
|
28
|
+
return @(
|
|
29
|
+
'agent',
|
|
30
|
+
'profile',
|
|
31
|
+
'oasr.default_profile',
|
|
32
|
+
'adapter.default_targets',
|
|
33
|
+
'validation.strict',
|
|
34
|
+
'validation.reference_max_lines',
|
|
35
|
+
'oasr.completions'
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Main completion function
|
|
40
|
+
$oasrCompletion = {
|
|
41
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
42
|
+
|
|
43
|
+
$command = $commandAst.CommandElements[0].Value
|
|
44
|
+
$elements = $commandAst.CommandElements
|
|
45
|
+
$elementCount = $elements.Count
|
|
46
|
+
|
|
47
|
+
# First argument - main commands
|
|
48
|
+
if ($elementCount -eq 2) {
|
|
49
|
+
$commands = @(
|
|
50
|
+
'registry', 'diff', 'sync', 'config', 'profile', 'clone', 'exec', 'use',
|
|
51
|
+
'find', 'validate', 'clean', 'adapter', 'update', 'info',
|
|
52
|
+
'help', 'completion'
|
|
53
|
+
)
|
|
54
|
+
$commands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
55
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
56
|
+
}
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
$subcommand = $elements[1].Value
|
|
61
|
+
|
|
62
|
+
switch ($subcommand) {
|
|
63
|
+
'exec' {
|
|
64
|
+
$prevWord = if ($elementCount -gt 2) { $elements[$elementCount - 2].Value } else { '' }
|
|
65
|
+
|
|
66
|
+
switch ($prevWord) {
|
|
67
|
+
'--agent' {
|
|
68
|
+
Get-OasrAgents | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
69
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Agent: $_")
|
|
70
|
+
}
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
'--profile' {
|
|
74
|
+
Get-OasrProfiles | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
75
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Profile: $_")
|
|
76
|
+
}
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
default {
|
|
80
|
+
if ($wordToComplete -like '-*') {
|
|
81
|
+
@('--agent', '--profile', '--agent-flags', '-y', '--yes', '--confirm', '-p', '--prompt', '--unsafe') |
|
|
82
|
+
Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
83
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
Get-OasrSkills | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
87
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Skill: $_")
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
'config' {
|
|
96
|
+
if ($elementCount -eq 3) {
|
|
97
|
+
@('set', 'get', 'list', 'agent', 'validation', 'adapter', 'oasr', 'profiles', 'man', 'validate', 'path') |
|
|
98
|
+
Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
99
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
100
|
+
}
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
$prevWord = if ($elementCount -gt 2) { $elements[$elementCount - 2].Value } else { '' }
|
|
105
|
+
if ($prevWord -eq 'set' -and $elementCount -eq 4) {
|
|
106
|
+
Get-OasrConfigKeys | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
107
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Key: $_")
|
|
108
|
+
}
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if ($prevWord -eq 'set' -and $elementCount -eq 5) {
|
|
113
|
+
$key = $elements[3].Value
|
|
114
|
+
switch ($key) {
|
|
115
|
+
'agent' {
|
|
116
|
+
Get-OasrAgents | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
117
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Agent: $_")
|
|
118
|
+
}
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
'profile' {
|
|
122
|
+
Get-OasrProfiles | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
123
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Profile: $_")
|
|
124
|
+
}
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
'oasr.default_profile' {
|
|
128
|
+
Get-OasrProfiles | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
129
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Profile: $_")
|
|
130
|
+
}
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
'validation.strict' {
|
|
134
|
+
@('true', 'false') | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
135
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
136
|
+
}
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
'oasr.completions' {
|
|
140
|
+
@('true', 'false') | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
141
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
142
|
+
}
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if ($elements[2].Value -eq 'get' -and $elementCount -eq 4) {
|
|
149
|
+
Get-OasrConfigKeys | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
150
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Key: $_")
|
|
151
|
+
}
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
'completion' {
|
|
157
|
+
if ($elementCount -eq 3) {
|
|
158
|
+
@('bash', 'zsh', 'fish', 'powershell', 'install', 'uninstall') | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
159
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
160
|
+
}
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if ($wordToComplete -like '-*') {
|
|
165
|
+
@('--force', '--dry-run') | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
166
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
'profile' {
|
|
173
|
+
if ($elementCount -eq 3) {
|
|
174
|
+
Get-OasrProfiles | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
175
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Profile: $_")
|
|
176
|
+
}
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
# Register the completion
|
|
184
|
+
Register-ArgumentCompleter -Native -CommandName oasr -ScriptBlock $oasrCompletion
|