apigrip 0.5.1 → 0.5.3
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/README.md +13 -0
- package/cli/index.js +34 -0
- package/completions/_apigrip +9 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -97,6 +97,19 @@ apigrip last GET /users --json # full JSON output
|
|
|
97
97
|
apigrip mcp --project /path/to/api
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
### Shell completion
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Bash — add to ~/.bashrc
|
|
104
|
+
eval "$(apigrip completion --shell bash)"
|
|
105
|
+
|
|
106
|
+
# Zsh — add to ~/.zshrc
|
|
107
|
+
eval "$(apigrip completion --shell zsh)"
|
|
108
|
+
|
|
109
|
+
# Auto-detects shell if --shell is omitted
|
|
110
|
+
eval "$(apigrip completion)"
|
|
111
|
+
```
|
|
112
|
+
|
|
100
113
|
### Exit codes
|
|
101
114
|
|
|
102
115
|
| Code | Meaning |
|
package/cli/index.js
CHANGED
|
@@ -124,6 +124,40 @@ const cli = yargs(hideBin(process.argv))
|
|
|
124
124
|
const { mcpCommand } = await import('./commands/mcp.js');
|
|
125
125
|
await mcpCommand(argv);
|
|
126
126
|
})
|
|
127
|
+
.command('completion', 'Generate shell completion script', (yargs) => {
|
|
128
|
+
return yargs
|
|
129
|
+
.option('shell', { type: 'string', choices: ['bash', 'zsh'], describe: 'Shell type (default: auto-detect)' });
|
|
130
|
+
}, (argv) => {
|
|
131
|
+
const shell = argv.shell || (process.env.SHELL || '').split('/').pop() || 'bash';
|
|
132
|
+
if (shell === 'zsh') {
|
|
133
|
+
console.log(`#compdef apigrip
|
|
134
|
+
|
|
135
|
+
_apigrip() {
|
|
136
|
+
local completions
|
|
137
|
+
completions=("\${(@f)$(apigrip --get-yargs-completions "\${words[@]}" 2>/dev/null)}")
|
|
138
|
+
compadd -a completions
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_apigrip`);
|
|
142
|
+
} else {
|
|
143
|
+
// Let yargs generate bash completions by re-running with --get-yargs-completions
|
|
144
|
+
console.log(`###-begin-apigrip-completions-###
|
|
145
|
+
_apigrip_yargs_completions()
|
|
146
|
+
{
|
|
147
|
+
local cur_word args type_list
|
|
148
|
+
cur_word="\${COMP_WORDS[COMP_CWORD]}"
|
|
149
|
+
args=("\${COMP_WORDS[@]}")
|
|
150
|
+
type_list=$(apigrip --get-yargs-completions "\${args[@]}")
|
|
151
|
+
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
|
|
152
|
+
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|
|
153
|
+
COMPREPLY=()
|
|
154
|
+
fi
|
|
155
|
+
return 0
|
|
156
|
+
}
|
|
157
|
+
complete -o default -F _apigrip_yargs_completions apigrip
|
|
158
|
+
###-end-apigrip-completions-###`);
|
|
159
|
+
}
|
|
160
|
+
})
|
|
127
161
|
.demandCommand(1, 'You need at least one command')
|
|
128
162
|
.strictCommands()
|
|
129
163
|
.help()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apigrip",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "A spec-first, read-only OpenAPI client for developers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.cjs",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"lib/",
|
|
21
21
|
"mcp/",
|
|
22
22
|
"server/",
|
|
23
|
-
"client/dist/"
|
|
23
|
+
"client/dist/",
|
|
24
|
+
"completions/"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
26
27
|
"start": "node cli/index.js serve",
|