@mainwp/control 1.0.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.
Files changed (204) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +583 -0
  3. package/bin/_exit.js +12 -0
  4. package/bin/dev.js +7 -0
  5. package/bin/run.js +7 -0
  6. package/dist/chat/chat-engine.d.ts +213 -0
  7. package/dist/chat/chat-engine.d.ts.map +1 -0
  8. package/dist/chat/chat-engine.js +636 -0
  9. package/dist/chat/chat-engine.js.map +1 -0
  10. package/dist/chat/index.d.ts +10 -0
  11. package/dist/chat/index.d.ts.map +1 -0
  12. package/dist/chat/index.js +14 -0
  13. package/dist/chat/index.js.map +1 -0
  14. package/dist/chat/providers/anthropic.d.ts +52 -0
  15. package/dist/chat/providers/anthropic.d.ts.map +1 -0
  16. package/dist/chat/providers/anthropic.js +292 -0
  17. package/dist/chat/providers/anthropic.js.map +1 -0
  18. package/dist/chat/providers/gemini.d.ts +52 -0
  19. package/dist/chat/providers/gemini.d.ts.map +1 -0
  20. package/dist/chat/providers/gemini.js +284 -0
  21. package/dist/chat/providers/gemini.js.map +1 -0
  22. package/dist/chat/providers/index.d.ts +19 -0
  23. package/dist/chat/providers/index.d.ts.map +1 -0
  24. package/dist/chat/providers/index.js +23 -0
  25. package/dist/chat/providers/index.js.map +1 -0
  26. package/dist/chat/providers/local.d.ts +37 -0
  27. package/dist/chat/providers/local.d.ts.map +1 -0
  28. package/dist/chat/providers/local.js +130 -0
  29. package/dist/chat/providers/local.js.map +1 -0
  30. package/dist/chat/providers/openai-compatible.d.ts +155 -0
  31. package/dist/chat/providers/openai-compatible.d.ts.map +1 -0
  32. package/dist/chat/providers/openai-compatible.js +264 -0
  33. package/dist/chat/providers/openai-compatible.js.map +1 -0
  34. package/dist/chat/providers/openai.d.ts +24 -0
  35. package/dist/chat/providers/openai.d.ts.map +1 -0
  36. package/dist/chat/providers/openai.js +62 -0
  37. package/dist/chat/providers/openai.js.map +1 -0
  38. package/dist/chat/providers/openrouter.d.ts +26 -0
  39. package/dist/chat/providers/openrouter.d.ts.map +1 -0
  40. package/dist/chat/providers/openrouter.js +65 -0
  41. package/dist/chat/providers/openrouter.js.map +1 -0
  42. package/dist/chat/providers/provider-fetch.d.ts +15 -0
  43. package/dist/chat/providers/provider-fetch.d.ts.map +1 -0
  44. package/dist/chat/providers/provider-fetch.js +35 -0
  45. package/dist/chat/providers/provider-fetch.js.map +1 -0
  46. package/dist/chat/providers/provider.d.ts +214 -0
  47. package/dist/chat/providers/provider.d.ts.map +1 -0
  48. package/dist/chat/providers/provider.js +166 -0
  49. package/dist/chat/providers/provider.js.map +1 -0
  50. package/dist/chat/providers/sse-reader.d.ts +21 -0
  51. package/dist/chat/providers/sse-reader.d.ts.map +1 -0
  52. package/dist/chat/providers/sse-reader.js +48 -0
  53. package/dist/chat/providers/sse-reader.js.map +1 -0
  54. package/dist/chat/system-prompt.d.ts +33 -0
  55. package/dist/chat/system-prompt.d.ts.map +1 -0
  56. package/dist/chat/system-prompt.js +166 -0
  57. package/dist/chat/system-prompt.js.map +1 -0
  58. package/dist/chat/tool-envelope.d.ts +72 -0
  59. package/dist/chat/tool-envelope.d.ts.map +1 -0
  60. package/dist/chat/tool-envelope.js +263 -0
  61. package/dist/chat/tool-envelope.js.map +1 -0
  62. package/dist/commands/abilities/info.d.ts +21 -0
  63. package/dist/commands/abilities/info.d.ts.map +1 -0
  64. package/dist/commands/abilities/info.js +80 -0
  65. package/dist/commands/abilities/info.js.map +1 -0
  66. package/dist/commands/abilities/list.d.ts +19 -0
  67. package/dist/commands/abilities/list.d.ts.map +1 -0
  68. package/dist/commands/abilities/list.js +98 -0
  69. package/dist/commands/abilities/list.js.map +1 -0
  70. package/dist/commands/abilities/run.d.ts +75 -0
  71. package/dist/commands/abilities/run.d.ts.map +1 -0
  72. package/dist/commands/abilities/run.js +468 -0
  73. package/dist/commands/abilities/run.js.map +1 -0
  74. package/dist/commands/chat.d.ts +54 -0
  75. package/dist/commands/chat.d.ts.map +1 -0
  76. package/dist/commands/chat.js +384 -0
  77. package/dist/commands/chat.js.map +1 -0
  78. package/dist/commands/config/show.d.ts +54 -0
  79. package/dist/commands/config/show.d.ts.map +1 -0
  80. package/dist/commands/config/show.js +324 -0
  81. package/dist/commands/config/show.js.map +1 -0
  82. package/dist/commands/doctor.d.ts +77 -0
  83. package/dist/commands/doctor.d.ts.map +1 -0
  84. package/dist/commands/doctor.js +412 -0
  85. package/dist/commands/doctor.js.map +1 -0
  86. package/dist/commands/jobs/watch.d.ts +50 -0
  87. package/dist/commands/jobs/watch.d.ts.map +1 -0
  88. package/dist/commands/jobs/watch.js +269 -0
  89. package/dist/commands/jobs/watch.js.map +1 -0
  90. package/dist/commands/login.d.ts +25 -0
  91. package/dist/commands/login.d.ts.map +1 -0
  92. package/dist/commands/login.js +165 -0
  93. package/dist/commands/login.js.map +1 -0
  94. package/dist/commands/profile/delete.d.ts +22 -0
  95. package/dist/commands/profile/delete.d.ts.map +1 -0
  96. package/dist/commands/profile/delete.js +57 -0
  97. package/dist/commands/profile/delete.js.map +1 -0
  98. package/dist/commands/profile/list.d.ts +19 -0
  99. package/dist/commands/profile/list.d.ts.map +1 -0
  100. package/dist/commands/profile/list.js +53 -0
  101. package/dist/commands/profile/list.js.map +1 -0
  102. package/dist/commands/profile/use.d.ts +22 -0
  103. package/dist/commands/profile/use.d.ts.map +1 -0
  104. package/dist/commands/profile/use.js +46 -0
  105. package/dist/commands/profile/use.js.map +1 -0
  106. package/dist/config/fs-utils.d.ts +14 -0
  107. package/dist/config/fs-utils.d.ts.map +1 -0
  108. package/dist/config/fs-utils.js +31 -0
  109. package/dist/config/fs-utils.js.map +1 -0
  110. package/dist/config/keychain.d.ts +53 -0
  111. package/dist/config/keychain.d.ts.map +1 -0
  112. package/dist/config/keychain.js +175 -0
  113. package/dist/config/keychain.js.map +1 -0
  114. package/dist/config/profile-store.d.ts +85 -0
  115. package/dist/config/profile-store.d.ts.map +1 -0
  116. package/dist/config/profile-store.js +228 -0
  117. package/dist/config/profile-store.js.map +1 -0
  118. package/dist/config/settings.d.ts +71 -0
  119. package/dist/config/settings.d.ts.map +1 -0
  120. package/dist/config/settings.js +151 -0
  121. package/dist/config/settings.js.map +1 -0
  122. package/dist/core/abilities-executor.d.ts +126 -0
  123. package/dist/core/abilities-executor.d.ts.map +1 -0
  124. package/dist/core/abilities-executor.js +264 -0
  125. package/dist/core/abilities-executor.js.map +1 -0
  126. package/dist/core/batch-manager.d.ts +113 -0
  127. package/dist/core/batch-manager.d.ts.map +1 -0
  128. package/dist/core/batch-manager.js +244 -0
  129. package/dist/core/batch-manager.js.map +1 -0
  130. package/dist/core/http-client.d.ts +111 -0
  131. package/dist/core/http-client.d.ts.map +1 -0
  132. package/dist/core/http-client.js +329 -0
  133. package/dist/core/http-client.js.map +1 -0
  134. package/dist/core/safety-controller.d.ts +114 -0
  135. package/dist/core/safety-controller.d.ts.map +1 -0
  136. package/dist/core/safety-controller.js +229 -0
  137. package/dist/core/safety-controller.js.map +1 -0
  138. package/dist/hooks/command-not-found.d.ts +12 -0
  139. package/dist/hooks/command-not-found.d.ts.map +1 -0
  140. package/dist/hooks/command-not-found.js +58 -0
  141. package/dist/hooks/command-not-found.js.map +1 -0
  142. package/dist/index.d.ts +7 -0
  143. package/dist/index.d.ts.map +1 -0
  144. package/dist/index.js +7 -0
  145. package/dist/index.js.map +1 -0
  146. package/dist/lib/base-command.d.ts +123 -0
  147. package/dist/lib/base-command.d.ts.map +1 -0
  148. package/dist/lib/base-command.js +285 -0
  149. package/dist/lib/base-command.js.map +1 -0
  150. package/dist/output/formatter.d.ts +48 -0
  151. package/dist/output/formatter.d.ts.map +1 -0
  152. package/dist/output/formatter.js +138 -0
  153. package/dist/output/formatter.js.map +1 -0
  154. package/dist/output/json-envelope.d.ts +43 -0
  155. package/dist/output/json-envelope.d.ts.map +1 -0
  156. package/dist/output/json-envelope.js +73 -0
  157. package/dist/output/json-envelope.js.map +1 -0
  158. package/dist/utils/audit-logger.d.ts +97 -0
  159. package/dist/utils/audit-logger.d.ts.map +1 -0
  160. package/dist/utils/audit-logger.js +169 -0
  161. package/dist/utils/audit-logger.js.map +1 -0
  162. package/dist/utils/colors.d.ts +29 -0
  163. package/dist/utils/colors.d.ts.map +1 -0
  164. package/dist/utils/colors.js +36 -0
  165. package/dist/utils/colors.js.map +1 -0
  166. package/dist/utils/errors.d.ts +107 -0
  167. package/dist/utils/errors.d.ts.map +1 -0
  168. package/dist/utils/errors.js +149 -0
  169. package/dist/utils/errors.js.map +1 -0
  170. package/dist/utils/exit-codes.d.ts +21 -0
  171. package/dist/utils/exit-codes.d.ts.map +1 -0
  172. package/dist/utils/exit-codes.js +20 -0
  173. package/dist/utils/exit-codes.js.map +1 -0
  174. package/dist/utils/format.d.ts +64 -0
  175. package/dist/utils/format.d.ts.map +1 -0
  176. package/dist/utils/format.js +69 -0
  177. package/dist/utils/format.js.map +1 -0
  178. package/dist/utils/prompt.d.ts +34 -0
  179. package/dist/utils/prompt.d.ts.map +1 -0
  180. package/dist/utils/prompt.js +132 -0
  181. package/dist/utils/prompt.js.map +1 -0
  182. package/dist/utils/retry.d.ts +59 -0
  183. package/dist/utils/retry.d.ts.map +1 -0
  184. package/dist/utils/retry.js +96 -0
  185. package/dist/utils/retry.js.map +1 -0
  186. package/dist/utils/terminal-sanitizer.d.ts +60 -0
  187. package/dist/utils/terminal-sanitizer.d.ts.map +1 -0
  188. package/dist/utils/terminal-sanitizer.js +166 -0
  189. package/dist/utils/terminal-sanitizer.js.map +1 -0
  190. package/dist/validation/input-sanitizer.d.ts +76 -0
  191. package/dist/validation/input-sanitizer.d.ts.map +1 -0
  192. package/dist/validation/input-sanitizer.js +199 -0
  193. package/dist/validation/input-sanitizer.js.map +1 -0
  194. package/dist/validation/schema-validator.d.ts +75 -0
  195. package/dist/validation/schema-validator.d.ts.map +1 -0
  196. package/dist/validation/schema-validator.js +147 -0
  197. package/dist/validation/schema-validator.js.map +1 -0
  198. package/oclif.manifest.json +857 -0
  199. package/package.json +101 -0
  200. package/scripts/completions/README.md +221 -0
  201. package/scripts/completions/mainwpcontrol.bash +193 -0
  202. package/scripts/completions/mainwpcontrol.zsh +267 -0
  203. package/scripts/completions/profile-completer.sh +35 -0
  204. package/scripts/completions/regenerate.sh +78 -0
@@ -0,0 +1,267 @@
1
+ #compdef mainwpcontrol
2
+ # mainwpcontrol zsh completion script
3
+ #
4
+ # Installation:
5
+ # source /path/to/mainwpcontrol/scripts/completions/mainwpcontrol.zsh
6
+ #
7
+ # Or add to ~/.zshrc:
8
+ # source /path/to/mainwpcontrol/scripts/completions/mainwpcontrol.zsh
9
+
10
+ # Determine the directory where this script is located
11
+ _MAINWPCTL_COMPLETION_DIR="${0:A:h}"
12
+
13
+ # Source the profile completer helper
14
+ if [[ -f "${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh" ]]; then
15
+ source "${_MAINWPCTL_COMPLETION_DIR}/profile-completer.sh"
16
+ fi
17
+
18
+ # Helper function to get profile names for completion
19
+ _mainwpcontrol_profiles() {
20
+ local profiles
21
+ if (( $+functions[_mainwpcontrol_get_profiles] )); then
22
+ profiles=("${(@f)$(_mainwpcontrol_get_profiles)}")
23
+ _describe -t profiles 'profile' profiles
24
+ fi
25
+ }
26
+
27
+ # Main completion function
28
+ _mainwpcontrol() {
29
+ local curcontext="$curcontext" state line
30
+ typeset -A opt_args
31
+
32
+ # Common flags available on all commands
33
+ local -a common_flags
34
+ common_flags=(
35
+ '--debug[Show debug output]'
36
+ '--help[Show help]'
37
+ '--json[Output JSON (for scripting/CI)]'
38
+ '(-p --profile)'{-p,--profile}'[Use a specific profile]:profile:_mainwpcontrol_profiles'
39
+ )
40
+
41
+ # Top-level commands
42
+ local -a commands
43
+ commands=(
44
+ 'abilities:Manage and execute abilities'
45
+ 'autocomplete:Display autocomplete installation instructions'
46
+ 'chat:Interactive chat mode for MainWP Dashboard management'
47
+ 'doctor:Check configuration and connectivity'
48
+ 'help:Display help for a command'
49
+ 'jobs:Manage batch jobs'
50
+ 'login:Authenticate with a MainWP Dashboard'
51
+ 'profile:Manage connection profiles'
52
+ )
53
+
54
+ _arguments -C \
55
+ $common_flags \
56
+ '1: :->command' \
57
+ '*:: :->args'
58
+
59
+ case "$state" in
60
+ command)
61
+ _describe -t commands 'mainwpcontrol commands' commands
62
+ ;;
63
+ args)
64
+ case "$words[1]" in
65
+ abilities)
66
+ _mainwpcontrol_abilities
67
+ ;;
68
+ autocomplete)
69
+ _mainwpcontrol_autocomplete
70
+ ;;
71
+ chat)
72
+ _mainwpcontrol_chat
73
+ ;;
74
+ doctor)
75
+ _mainwpcontrol_doctor
76
+ ;;
77
+ help)
78
+ _mainwpcontrol_help
79
+ ;;
80
+ jobs)
81
+ _mainwpcontrol_jobs
82
+ ;;
83
+ login)
84
+ _mainwpcontrol_login
85
+ ;;
86
+ profile)
87
+ _mainwpcontrol_profile
88
+ ;;
89
+ esac
90
+ ;;
91
+ esac
92
+ }
93
+
94
+ # Abilities command completions
95
+ _mainwpcontrol_abilities() {
96
+ local -a subcommands
97
+ subcommands=(
98
+ 'info:Get detailed information about an ability'
99
+ 'list:List available abilities'
100
+ 'run:Execute an ability'
101
+ )
102
+
103
+ _arguments -C \
104
+ $common_flags \
105
+ '1: :->subcommand' \
106
+ '*:: :->args'
107
+
108
+ case "$state" in
109
+ subcommand)
110
+ _describe -t commands 'abilities subcommands' subcommands
111
+ ;;
112
+ args)
113
+ case "$words[1]" in
114
+ info)
115
+ _arguments \
116
+ $common_flags \
117
+ '1:ability name:'
118
+ ;;
119
+ list)
120
+ _arguments \
121
+ $common_flags \
122
+ '--category[Filter by category]:category:(sites clients updates plugins themes core tags batch)'
123
+ ;;
124
+ run)
125
+ _arguments \
126
+ $common_flags \
127
+ '(-i --input)'{-i,--input}'[Input parameters as JSON]:input:' \
128
+ '--dry-run[Preview changes without executing]' \
129
+ '--confirm[Execute destructive ability (after preview)]' \
130
+ '--force[Skip confirmation prompt (use with --confirm)]' \
131
+ '1:ability name:'
132
+ ;;
133
+ esac
134
+ ;;
135
+ esac
136
+ }
137
+
138
+ # Autocomplete command completions
139
+ _mainwpcontrol_autocomplete() {
140
+ _arguments \
141
+ '1:shell:(bash zsh)'
142
+ }
143
+
144
+ # Chat command completions
145
+ _mainwpcontrol_chat() {
146
+ _arguments \
147
+ $common_flags \
148
+ '--provider[LLM provider]:provider:(anthropic gemini local openai openrouter)' \
149
+ '(-m --model)'{-m,--model}'[Model to use]:model:' \
150
+ '--api-key[LLM API key (overrides environment)]:api key:' \
151
+ '--base-url[Custom API base URL]:url:' \
152
+ '--max-turns[Maximum tool calls per turn]:turns:' \
153
+ '--max-context-messages[Maximum messages to keep in context]:messages:' \
154
+ '--stream[Enable streaming responses]' \
155
+ '--no-stream[Disable streaming responses]' \
156
+ '1:message:'
157
+ }
158
+
159
+ # Doctor command completions
160
+ _mainwpcontrol_doctor() {
161
+ _arguments \
162
+ $common_flags \
163
+ '(-v --verbose)'{-v,--verbose}'[Verbose output]'
164
+ }
165
+
166
+ # Help command completions
167
+ _mainwpcontrol_help() {
168
+ local -a commands
169
+ commands=(
170
+ 'abilities'
171
+ 'autocomplete'
172
+ 'chat'
173
+ 'doctor'
174
+ 'help'
175
+ 'jobs'
176
+ 'login'
177
+ 'profile'
178
+ )
179
+
180
+ _arguments \
181
+ '1:command:($commands)'
182
+ }
183
+
184
+ # Jobs command completions
185
+ _mainwpcontrol_jobs() {
186
+ local -a subcommands
187
+ subcommands=(
188
+ 'watch:Monitor a batch job'
189
+ )
190
+
191
+ _arguments -C \
192
+ $common_flags \
193
+ '1: :->subcommand' \
194
+ '*:: :->args'
195
+
196
+ case "$state" in
197
+ subcommand)
198
+ _describe -t commands 'jobs subcommands' subcommands
199
+ ;;
200
+ args)
201
+ case "$words[1]" in
202
+ watch)
203
+ _arguments \
204
+ $common_flags \
205
+ '--timeout[Maximum time to wait in seconds]:seconds:' \
206
+ '--initial-delay[Initial polling delay in seconds]:seconds:' \
207
+ '--max-delay[Maximum polling delay in seconds]:seconds:' \
208
+ '--no-progress[Disable progress output]' \
209
+ '1:job id:'
210
+ ;;
211
+ esac
212
+ ;;
213
+ esac
214
+ }
215
+
216
+ # Login command completions
217
+ _mainwpcontrol_login() {
218
+ _arguments \
219
+ $common_flags \
220
+ '(-u --url)'{-u,--url}'[Dashboard URL]:url:' \
221
+ '--username[WordPress admin username]:username:' \
222
+ '--password[Application password]:password:' \
223
+ '(-n --name)'{-n,--name}'[Profile name]:name:' \
224
+ '--skip-ssl-verify[Skip SSL certificate verification]'
225
+ }
226
+
227
+ # Profile command completions
228
+ _mainwpcontrol_profile() {
229
+ local -a subcommands
230
+ subcommands=(
231
+ 'delete:Delete a profile'
232
+ 'list:List all profiles'
233
+ 'use:Switch active profile'
234
+ )
235
+
236
+ _arguments -C \
237
+ $common_flags \
238
+ '1: :->subcommand' \
239
+ '*:: :->args'
240
+
241
+ case "$state" in
242
+ subcommand)
243
+ _describe -t commands 'profile subcommands' subcommands
244
+ ;;
245
+ args)
246
+ case "$words[1]" in
247
+ delete)
248
+ _arguments \
249
+ $common_flags \
250
+ '1:profile name:_mainwpcontrol_profiles'
251
+ ;;
252
+ list)
253
+ _arguments \
254
+ $common_flags
255
+ ;;
256
+ use)
257
+ _arguments \
258
+ $common_flags \
259
+ '1:profile name:_mainwpcontrol_profiles'
260
+ ;;
261
+ esac
262
+ ;;
263
+ esac
264
+ }
265
+
266
+ # Register the completion function
267
+ compdef _mainwpcontrol mainwpcontrol
@@ -0,0 +1,35 @@
1
+ #!/bin/sh
2
+ # profile-completer.sh - Helper script to get available mainwpcontrol profile names
3
+ # This script is sourced by shell completion scripts to provide dynamic profile completion.
4
+ #
5
+ # Usage: source this file, then call _mainwpcontrol_get_profiles
6
+ #
7
+ # Returns profile names one per line, empty if no profiles exist or config is missing.
8
+
9
+ _mainwpcontrol_get_profiles() {
10
+ local config_file="${XDG_CONFIG_HOME:-$HOME/.config}/mainwpcontrol/profiles.json"
11
+
12
+ # Exit silently if config file doesn't exist
13
+ if [ ! -f "$config_file" ]; then
14
+ return 0
15
+ fi
16
+
17
+ # Try jq first (most reliable JSON parsing)
18
+ if command -v jq >/dev/null 2>&1; then
19
+ jq -r '.profiles | keys[]' "$config_file" 2>/dev/null
20
+ return 0
21
+ fi
22
+
23
+ # Fallback: use grep/sed for simple JSON parsing
24
+ # This handles: {"profiles":{"name1":{...},"name2":{...}}}
25
+ # Extract keys after "profiles": and before their values
26
+ grep -o '"profiles"[[:space:]]*:[[:space:]]*{[^}]*}' "$config_file" 2>/dev/null | \
27
+ grep -o '"[^"]*"[[:space:]]*:' | \
28
+ sed 's/"//g; s/[[:space:]]*://g' | \
29
+ grep -v '^profiles$' 2>/dev/null
30
+ }
31
+
32
+ # If called directly (not sourced), output profile names
33
+ if [ "${0##*/}" = "profile-completer.sh" ]; then
34
+ _mainwpcontrol_get_profiles
35
+ fi
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ # regenerate.sh - Regenerate shell completion scripts for mainwpcontrol
3
+ #
4
+ # This script helps developers update completion scripts after CLI changes.
5
+ # Run this after adding, removing, or modifying commands or flags.
6
+ #
7
+ # Usage: ./scripts/completions/regenerate.sh
8
+
9
+ set -e
10
+
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
13
+
14
+ echo "Shell Completion Regeneration Helper"
15
+ echo "====================================="
16
+ echo ""
17
+ echo "The mainwpcontrol completion scripts are manually maintained to provide"
18
+ echo "optimal completion behavior with dynamic profile name completion."
19
+ echo ""
20
+ echo "After adding, removing, or modifying commands/flags, you should update:"
21
+ echo ""
22
+ echo " 1. $SCRIPT_DIR/mainwpcontrol.bash"
23
+ echo " - Update 'commands' variable for new top-level commands"
24
+ echo " - Update '*_commands' variables for new subcommands"
25
+ echo " - Update '*_flags' variables for new flags"
26
+ echo ""
27
+ echo " 2. $SCRIPT_DIR/mainwpcontrol.zsh"
28
+ echo " - Update 'commands' array for new top-level commands"
29
+ echo " - Update subcommand arrays in respective functions"
30
+ echo " - Update _arguments calls for new flags"
31
+ echo ""
32
+ echo "Testing completions:"
33
+ echo " # Bash"
34
+ echo " source $SCRIPT_DIR/mainwpcontrol.bash"
35
+ echo " mainwpcontrol <TAB>"
36
+ echo ""
37
+ echo " # Zsh"
38
+ echo " source $SCRIPT_DIR/mainwpcontrol.zsh"
39
+ echo " mainwpcontrol <TAB>"
40
+ echo ""
41
+
42
+ # Verify files exist
43
+ echo "Checking completion files..."
44
+
45
+ if [[ -f "$SCRIPT_DIR/mainwpcontrol.bash" ]]; then
46
+ echo " [OK] mainwpcontrol.bash"
47
+ else
48
+ echo " [MISSING] mainwpcontrol.bash"
49
+ fi
50
+
51
+ if [[ -f "$SCRIPT_DIR/mainwpcontrol.zsh" ]]; then
52
+ echo " [OK] mainwpcontrol.zsh"
53
+ else
54
+ echo " [MISSING] mainwpcontrol.zsh"
55
+ fi
56
+
57
+ if [[ -f "$SCRIPT_DIR/profile-completer.sh" ]]; then
58
+ echo " [OK] profile-completer.sh"
59
+ else
60
+ echo " [MISSING] profile-completer.sh"
61
+ fi
62
+
63
+ echo ""
64
+ echo "Extracting current CLI structure..."
65
+ echo ""
66
+
67
+ # Try to extract commands from the built CLI
68
+ if [[ -x "$PROJECT_ROOT/bin/run.js" ]]; then
69
+ echo "Top-level commands:"
70
+ "$PROJECT_ROOT/bin/run.js" --help 2>/dev/null | grep -E '^\s+[a-z]+\s' | awk '{print " - " $1}' || echo " (could not extract)"
71
+ echo ""
72
+ else
73
+ echo "Note: Build the project first to extract command structure:"
74
+ echo " npm run build"
75
+ echo ""
76
+ fi
77
+
78
+ echo "Done. Remember to commit your changes after updating completion scripts."