apigrip 0.5.1 → 0.5.2

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 CHANGED
@@ -97,6 +97,18 @@ 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
+ # Zsh — copy to your fpath
104
+ cp "$(npm root -g)/apigrip/completions/_apigrip" /usr/local/share/zsh/site-functions/
105
+ # or symlink into any directory in your $fpath, then:
106
+ autoload -Uz compinit && compinit
107
+
108
+ # Bash
109
+ apigrip completion >> ~/.bashrc
110
+ ```
111
+
100
112
  ### Exit codes
101
113
 
102
114
  | Code | Meaning |
package/cli/index.js CHANGED
@@ -126,5 +126,6 @@ const cli = yargs(hideBin(process.argv))
126
126
  })
127
127
  .demandCommand(1, 'You need at least one command')
128
128
  .strictCommands()
129
+ .completion('completion', 'Generate shell completion script')
129
130
  .help()
130
131
  .argv;
@@ -0,0 +1,144 @@
1
+ #compdef apigrip
2
+
3
+ _apigrip() {
4
+ local -a commands
5
+ commands=(
6
+ 'serve:Start the web UI server'
7
+ 'send:Send an API request'
8
+ 'curl:Generate curl command'
9
+ 'list:List endpoints from spec'
10
+ 'show:Show endpoint details'
11
+ 'projects:Manage project bookmarks'
12
+ 'last:Show last cached response'
13
+ 'env:Manage environments'
14
+ 'spec:Print the parsed OpenAPI spec'
15
+ 'mcp:Start MCP server'
16
+ 'completion:Generate shell completion script'
17
+ )
18
+
19
+ local -a global_opts
20
+ global_opts=(
21
+ '--help[Show help]'
22
+ '--version[Show version number]'
23
+ )
24
+
25
+ local -a project_opts
26
+ project_opts=(
27
+ '--project[Project directory]:directory:_directories'
28
+ '--spec[Path to spec file]:file:_files'
29
+ )
30
+
31
+ _arguments -C \
32
+ '1:command:->command' \
33
+ '*::arg:->args'
34
+
35
+ case $state in
36
+ command)
37
+ _describe -t commands 'apigrip command' commands
38
+ ;;
39
+ args)
40
+ case $words[1] in
41
+ serve)
42
+ _arguments \
43
+ '--port[Port to listen on]:port' \
44
+ '--host[Host to bind to]:host' \
45
+ '--open[Open browser on start]' \
46
+ '--no-browse[Disable directory browsing]' \
47
+ $project_opts \
48
+ $global_opts
49
+ ;;
50
+ send)
51
+ _arguments \
52
+ '1:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \
53
+ '2:path' \
54
+ '-d[Request body]:body' \
55
+ '--data[Request body]:body' \
56
+ '-e[Environment name]:env' \
57
+ '--env[Environment name]:env' \
58
+ '*--query[Query params (key=value)]:param' \
59
+ '*--header[Headers (Name: value)]:header' \
60
+ '*--pathParam[Path params (key=value)]:param' \
61
+ '-v[Verbose output]' \
62
+ '--verbose[Verbose output]' \
63
+ '-i[Include headers]' \
64
+ '--headers[Include headers]' \
65
+ '--dry-run[Print without sending]' \
66
+ '--curl[Print curl command only]' \
67
+ '--filter[jq filter for response body]:filter' \
68
+ $project_opts \
69
+ $global_opts
70
+ ;;
71
+ curl)
72
+ _arguments \
73
+ '1:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \
74
+ '2:path' \
75
+ '-d[Request body]:body' \
76
+ '--data[Request body]:body' \
77
+ '-e[Environment name]:env' \
78
+ '--env[Environment name]:env' \
79
+ '*--query[Query params (key=value)]:param' \
80
+ '*--header[Headers (Name: value)]:header' \
81
+ '*--pathParam[Path params (key=value)]:param' \
82
+ $project_opts \
83
+ $global_opts
84
+ ;;
85
+ list)
86
+ _arguments \
87
+ '--tag[Filter by tag]:tag' \
88
+ '--search[Search endpoints]:search' \
89
+ '--json[JSON output]' \
90
+ $project_opts \
91
+ $global_opts
92
+ ;;
93
+ show)
94
+ _arguments \
95
+ '1:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \
96
+ '2:path' \
97
+ '--json[Full JSON output]' \
98
+ $project_opts \
99
+ $global_opts
100
+ ;;
101
+ projects)
102
+ _arguments \
103
+ '1:action:(add remove)' \
104
+ '2:directory:_directories'
105
+ ;;
106
+ last)
107
+ _arguments \
108
+ '1:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \
109
+ '2:path' \
110
+ '--json[Full JSON output]' \
111
+ '-v[Verbose output]' \
112
+ '--verbose[Verbose output]' \
113
+ '-i[Include headers]' \
114
+ '--headers[Include headers]' \
115
+ $project_opts \
116
+ $global_opts
117
+ ;;
118
+ env)
119
+ _arguments \
120
+ '1:action:(show set delete import)' \
121
+ '2:name' \
122
+ '3:key' \
123
+ '4:value' \
124
+ '--import-name[Target environment name]:name' \
125
+ '--merge[Merge with existing values]' \
126
+ '--project[Project directory]:directory:_directories'
127
+ ;;
128
+ spec)
129
+ _arguments \
130
+ '--raw[Print raw spec file]' \
131
+ $project_opts \
132
+ $global_opts
133
+ ;;
134
+ mcp)
135
+ _arguments \
136
+ $project_opts \
137
+ $global_opts
138
+ ;;
139
+ esac
140
+ ;;
141
+ esac
142
+ }
143
+
144
+ _apigrip
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apigrip",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
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",