prisma 7.10.0-dev.9 → 8.0.0-rc.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.
Files changed (52) hide show
  1. package/LICENSE +158 -201
  2. package/README.md +108 -58
  3. package/dist/deploy-framework-DHEGywve.js +23 -0
  4. package/dist/payload-B88Qvzxk-CrtTXSOe.js +34 -0
  5. package/dist/prisma.js +15586 -0
  6. package/dist/sender.js +192 -0
  7. package/package.json +48 -188
  8. package/build/child.js +0 -82915
  9. package/build/cli.js +0 -5748
  10. package/build/completion.js +0 -804
  11. package/build/index.js +0 -2
  12. package/build/prisma_schema_build_bg.wasm +0 -0
  13. package/build/query_compiler_fast_bg.cockroachdb.js +0 -2
  14. package/build/query_compiler_fast_bg.cockroachdb.mjs +0 -2
  15. package/build/query_compiler_fast_bg.cockroachdb.wasm +0 -0
  16. package/build/query_compiler_fast_bg.mysql.js +0 -2
  17. package/build/query_compiler_fast_bg.mysql.mjs +0 -2
  18. package/build/query_compiler_fast_bg.mysql.wasm +0 -0
  19. package/build/query_compiler_fast_bg.postgresql.js +0 -2
  20. package/build/query_compiler_fast_bg.postgresql.mjs +0 -2
  21. package/build/query_compiler_fast_bg.postgresql.wasm +0 -0
  22. package/build/query_compiler_fast_bg.sqlite.js +0 -2
  23. package/build/query_compiler_fast_bg.sqlite.mjs +0 -2
  24. package/build/query_compiler_fast_bg.sqlite.wasm +0 -0
  25. package/build/query_compiler_fast_bg.sqlserver.js +0 -2
  26. package/build/query_compiler_fast_bg.sqlserver.mjs +0 -2
  27. package/build/query_compiler_fast_bg.sqlserver.wasm +0 -0
  28. package/build/query_compiler_small_bg.cockroachdb.js +0 -2
  29. package/build/query_compiler_small_bg.cockroachdb.mjs +0 -2
  30. package/build/query_compiler_small_bg.cockroachdb.wasm +0 -0
  31. package/build/query_compiler_small_bg.mysql.js +0 -2
  32. package/build/query_compiler_small_bg.mysql.mjs +0 -2
  33. package/build/query_compiler_small_bg.mysql.wasm +0 -0
  34. package/build/query_compiler_small_bg.postgresql.js +0 -2
  35. package/build/query_compiler_small_bg.postgresql.mjs +0 -2
  36. package/build/query_compiler_small_bg.postgresql.wasm +0 -0
  37. package/build/query_compiler_small_bg.sqlite.js +0 -2
  38. package/build/query_compiler_small_bg.sqlite.mjs +0 -2
  39. package/build/query_compiler_small_bg.sqlite.wasm +0 -0
  40. package/build/query_compiler_small_bg.sqlserver.js +0 -2
  41. package/build/query_compiler_small_bg.sqlserver.mjs +0 -2
  42. package/build/query_compiler_small_bg.sqlserver.wasm +0 -0
  43. package/build/schema_engine_bg.wasm +0 -0
  44. package/build/studio.css +0 -5850
  45. package/build/studio.js +0 -373
  46. package/build/xdg-open +0 -1066
  47. package/config.d.ts +0 -1
  48. package/config.js +0 -30
  49. package/dist/cli/src/config.d.ts +0 -1
  50. package/dist/cli/src/types.d.ts +0 -1
  51. package/preinstall/index.js +0 -7
  52. package/scripts/preinstall-entry.js +0 -10
@@ -1,804 +0,0 @@
1
- "use strict";var Qe=Object.create;var L=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty;var I=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports);var Ze=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Ye(o))!Xe.call(e,i)&&i!==t&&L(e,i,{get:()=>o[i],enumerable:!(r=ze(o,i))||r.enumerable});return e};var F=(e,o,t)=>(t=e!=null?Qe(Je(e)):{},Ze(o||!e||!e.__esModule?L(t,"default",{value:e,enumerable:!0}):t,e));var Y=I((Yt,z)=>{"use strict";var N=Symbol("arg flag"),f=class e extends Error{constructor(o,t){super(o),this.name="ArgError",this.code=t,Object.setPrototypeOf(this,e.prototype)}};function P(e,{argv:o=process.argv.slice(2),permissive:t=!1,stopAtPositional:r=!1}={}){if(!e)throw new f("argument specification object is required","ARG_CONFIG_NO_SPEC");let i={_:[]},n={},m={};for(let s of Object.keys(e)){if(!s)throw new f("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(s[0]!=="-")throw new f(`argument key must start with '-' but found: '${s}'`,"ARG_CONFIG_NONOPT_KEY");if(s.length===1)throw new f(`argument key must have a name; singular '-' keys are not allowed: ${s}`,"ARG_CONFIG_NONAME_KEY");if(typeof e[s]=="string"){n[s]=e[s];continue}let d=e[s],h=!1;if(Array.isArray(d)&&d.length===1&&typeof d[0]=="function"){let[C]=d;d=($,v,g=[])=>(g.push(C($,v,g[g.length-1])),g),h=C===Boolean||C[N]===!0}else if(typeof d=="function")h=d===Boolean||d[N]===!0;else throw new f(`type missing or not a function or valid array type: ${s}`,"ARG_CONFIG_VAD_TYPE");if(s[1]!=="-"&&s.length>2)throw new f(`short argument keys (with a single hyphen) must have only one character: ${s}`,"ARG_CONFIG_SHORTOPT_TOOLONG");m[s]=[d,h]}for(let s=0,d=o.length;s<d;s++){let h=o[s];if(r&&i._.length>0){i._=i._.concat(o.slice(s));break}if(h==="--"){i._=i._.concat(o.slice(s+1));break}if(h.length>1&&h[0]==="-"){let C=h[1]==="-"||h.length===2?[h]:h.slice(1).split("").map($=>`-${$}`);for(let $=0;$<C.length;$++){let v=C[$],[g,R]=v[1]==="-"?v.split(/=(.*)/,2):[v,void 0],u=g;for(;u in n;)u=n[u];if(!(u in m))if(t){i._.push(v);continue}else throw new f(`unknown or unexpected option: ${g}`,"ARG_UNKNOWN_OPTION");let[b,q]=m[u];if(!q&&$+1<C.length)throw new f(`option requires argument (but was followed by another short argument): ${g}`,"ARG_MISSING_REQUIRED_SHORTARG");if(q)i[u]=b(!0,u,i[u]);else if(R===void 0){if(o.length<s+2||o[s+1].length>1&&o[s+1][0]==="-"&&!(o[s+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(b===Number||typeof BigInt<"u"&&b===BigInt))){let Ke=g===u?"":` (alias for ${u})`;throw new f(`option requires argument: ${g}${Ke}`,"ARG_MISSING_REQUIRED_LONGARG")}i[u]=b(o[s+1],u,i[u]),++s}else i[u]=b(R,u,i[u])}}else i._.push(h)}return i}P.flag=e=>(e[N]=!0,e);P.COUNT=P.flag((e,o,t)=>(t||0)+1);P.ArgError=f;z.exports=P});var X=I((Jt,J)=>{"use strict";J.exports=e=>{let o=e.match(/^[ \t]*(?=\S)/gm);return o?o.reduce((t,r)=>Math.min(t,r.length),1/0):0}});function M(e,o){return`#compdef ${e}
2
- compdef _${e} ${e}
3
-
4
- # zsh completion for ${e} -*- shell-script -*-
5
-
6
- __${e}_debug() {
7
- local file="$BASH_COMP_DEBUG_FILE"
8
- if [[ -n \${file} ]]; then
9
- echo "$*" >> "\${file}"
10
- fi
11
- }
12
-
13
- _${e}() {
14
- local shellCompDirectiveError=${p.ShellCompDirectiveError}
15
- local shellCompDirectiveNoSpace=${p.ShellCompDirectiveNoSpace}
16
- local shellCompDirectiveNoFileComp=${p.ShellCompDirectiveNoFileComp}
17
- local shellCompDirectiveFilterFileExt=${p.ShellCompDirectiveFilterFileExt}
18
- local shellCompDirectiveFilterDirs=${p.ShellCompDirectiveFilterDirs}
19
- local shellCompDirectiveKeepOrder=${p.ShellCompDirectiveKeepOrder}
20
-
21
- local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
22
- local -a completions
23
-
24
- __${e}_debug "\\n========= starting completion logic =========="
25
- __${e}_debug "CURRENT: \${CURRENT}, words[*]: \${words[*]}"
26
-
27
- # The user could have moved the cursor backwards on the command-line.
28
- # We need to trigger completion from the $CURRENT location, so we need
29
- # to truncate the command-line ($words) up to the $CURRENT location.
30
- # (We cannot use $CURSOR as its value does not work when a command is an alias.)
31
- words=( "\${=words[1,CURRENT]}" )
32
- __${e}_debug "Truncated words[*]: \${words[*]},"
33
-
34
- lastParam=\${words[-1]}
35
- lastChar=\${lastParam[-1]}
36
- __${e}_debug "lastParam: \${lastParam}, lastChar: \${lastChar}"
37
-
38
- # For zsh, when completing a flag with an = (e.g., ${e} -n=<TAB>)
39
- # completions must be prefixed with the flag
40
- setopt local_options BASH_REMATCH
41
- if [[ "\${lastParam}" =~ '-.*=' ]]; then
42
- # We are dealing with a flag with an =
43
- flagPrefix="-P \${BASH_REMATCH}"
44
- fi
45
-
46
- # Prepare the command to obtain completions, ensuring arguments are quoted for eval
47
- local -a args_to_quote=("\${(@)words[2,-1]}")
48
- if [ "\${lastChar}" = "" ] && [ "\${args_to_quote[-1]}" != "" ]; then
49
- # If the last parameter is complete (there is a space following it)
50
- # We add an extra empty parameter so we can indicate this to the go completion code.
51
- __${e}_debug "Adding extra empty parameter"
52
- args_to_quote+=("")
53
- fi
54
-
55
- # Use Zsh's (q) flag to quote each argument safely for eval
56
- local quoted_args=("\${(@q)args_to_quote}")
57
-
58
- # Join the main command and the quoted arguments into a single string for eval
59
- requestComp="${o} complete -- \${quoted_args[*]}"
60
-
61
- __${e}_debug "About to call: eval \${requestComp}"
62
-
63
- # Use eval to handle any environment variables and such
64
- out=$(eval \${requestComp} 2>/dev/null)
65
- __${e}_debug "completion output: \${out}"
66
-
67
- # Extract the directive integer following a : from the last line
68
- local lastLine
69
- while IFS='
70
- ' read -r line; do
71
- lastLine=\${line}
72
- done < <(printf "%s
73
- " "\${out[@]}")
74
- __${e}_debug "last line: \${lastLine}"
75
-
76
- if [ "\${lastLine[1]}" = : ]; then
77
- directive=\${lastLine[2,-1]}
78
- # Remove the directive including the : and the newline
79
- local suffix
80
- (( suffix=\${#lastLine}+2))
81
- out=\${out[1,-$suffix]}
82
- else
83
- # There is no directive specified. Leave $out as is.
84
- __${e}_debug "No directive found. Setting to default"
85
- directive=0
86
- fi
87
-
88
- __${e}_debug "directive: \${directive}"
89
- __${e}_debug "completions: \${out}"
90
- __${e}_debug "flagPrefix: \${flagPrefix}"
91
-
92
- if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
93
- __${e}_debug "Completion received error. Ignoring completions."
94
- return
95
- fi
96
-
97
- local activeHelpMarker="%"
98
- local endIndex=\${#activeHelpMarker}
99
- local startIndex=$((\${#activeHelpMarker}+1))
100
- local hasActiveHelp=0
101
- while IFS='
102
- ' read -r comp; do
103
- # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
104
- if [ "\${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
105
- __${e}_debug "ActiveHelp found: $comp"
106
- comp="\${comp[$startIndex,-1]}"
107
- if [ -n "$comp" ]; then
108
- compadd -x "\${comp}"
109
- __${e}_debug "ActiveHelp will need delimiter"
110
- hasActiveHelp=1
111
- fi
112
- continue
113
- fi
114
-
115
- if [ -n "$comp" ]; then
116
- # If requested, completions are returned with a description.
117
- # The description is preceded by a TAB character.
118
- # For zsh's _describe, we need to use a : instead of a TAB.
119
- # We first need to escape any : as part of the completion itself.
120
- comp=\${comp//:/\\:}
121
-
122
- local tab="$(printf '\\t')"
123
- comp=\${comp//$tab/:}
124
-
125
- __${e}_debug "Adding completion: \${comp}"
126
- completions+=\${comp}
127
- lastComp=$comp
128
- fi
129
- done < <(printf "%s
130
- " "\${out[@]}")
131
-
132
- # Add a delimiter after the activeHelp statements, but only if:
133
- # - there are completions following the activeHelp statements, or
134
- # - file completion will be performed (so there will be choices after the activeHelp)
135
- if [ $hasActiveHelp -eq 1 ]; then
136
- if [ \${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
137
- __${e}_debug "Adding activeHelp delimiter"
138
- compadd -x "--"
139
- hasActiveHelp=0
140
- fi
141
- fi
142
-
143
- if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
144
- __${e}_debug "Activating nospace."
145
- noSpace="-S ''"
146
- fi
147
-
148
- if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
149
- __${e}_debug "Activating keep order."
150
- keepOrder="-V"
151
- fi
152
-
153
- if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
154
- # File extension filtering
155
- local filteringCmd
156
- filteringCmd='_files'
157
- for filter in \${completions[@]}; do
158
- if [ \${filter[1]} != '*' ]; then
159
- # zsh requires a glob pattern to do file filtering
160
- filter="\\*.$filter"
161
- fi
162
- filteringCmd+=" -g $filter"
163
- done
164
- filteringCmd+=" \${flagPrefix}"
165
-
166
- __${e}_debug "File filtering command: $filteringCmd"
167
- _arguments '*:filename:'"$filteringCmd"
168
- elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
169
- # File completion for directories only
170
- local subdir
171
- subdir="\${completions[1]}"
172
- if [ -n "$subdir" ]; then
173
- __${e}_debug "Listing directories in $subdir"
174
- pushd "\${subdir}" >/dev/null 2>&1
175
- else
176
- __${e}_debug "Listing directories in ."
177
- fi
178
-
179
- local result
180
- _arguments '*:dirname:_files -/'" \${flagPrefix}"
181
- result=$?
182
- if [ -n "$subdir" ]; then
183
- popd >/dev/null 2>&1
184
- fi
185
- return $result
186
- else
187
- __${e}_debug "Calling _describe"
188
- if eval _describe $keepOrder "completions" completions -Q \${flagPrefix} \${noSpace}; then
189
- __${e}_debug "_describe found some completions"
190
-
191
- # Return the success of having called _describe
192
- return 0
193
- else
194
- __${e}_debug "_describe did not find completions."
195
- __${e}_debug "Checking if we should do file completion."
196
- if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
197
- __${e}_debug "deactivating file completion"
198
-
199
- # Return 0 to indicate completion is finished and prevent zsh from
200
- # trying other completion algorithms (which could cause hanging).
201
- # We use NoFileComp directive to explicitly disable file completion.
202
- return 0
203
- else
204
- # Perform file completion
205
- __${e}_debug "Activating file completion"
206
-
207
- # We must return the result of this command, so it must be the
208
- # last command, or else we must store its result to return it.
209
- _arguments '*:filename:_files'" \${flagPrefix}"
210
- fi
211
- fi
212
- fi
213
- }
214
-
215
- # don't run the completion function when being sourced or eval-ed
216
- if [ "\${funcstack[1]}" = "_${e}" ]; then
217
- _${e}
218
- fi
219
- `}function H(e,o){let t=e.replace(/[-:]/g,"_");return`# bash completion for ${e}
220
-
221
- # Define shell completion directives
222
- readonly ShellCompDirectiveError=${p.ShellCompDirectiveError}
223
- readonly ShellCompDirectiveNoSpace=${p.ShellCompDirectiveNoSpace}
224
- readonly ShellCompDirectiveNoFileComp=${p.ShellCompDirectiveNoFileComp}
225
- readonly ShellCompDirectiveFilterFileExt=${p.ShellCompDirectiveFilterFileExt}
226
- readonly ShellCompDirectiveFilterDirs=${p.ShellCompDirectiveFilterDirs}
227
- readonly ShellCompDirectiveKeepOrder=${p.ShellCompDirectiveKeepOrder}
228
-
229
- # Function to debug completion
230
- __${t}_debug() {
231
- if [[ -n \${BASH_COMP_DEBUG_FILE:-} ]]; then
232
- echo "$*" >> "\${BASH_COMP_DEBUG_FILE}"
233
- fi
234
- }
235
-
236
- # Function to handle completions
237
- __${t}_complete() {
238
- local cur prev words cword
239
- _get_comp_words_by_ref -n "=:" cur prev words cword
240
-
241
- local requestComp out directive
242
-
243
- # Build the command to get completions
244
- requestComp="${o} complete -- \${words[@]:1}"
245
-
246
- # Add an empty parameter if the last parameter is complete
247
- if [[ -z "$cur" ]]; then
248
- requestComp="$requestComp ''"
249
- fi
250
-
251
- # Get completions from the program
252
- out=$(eval "$requestComp" 2>/dev/null)
253
-
254
- # Extract directive if present
255
- directive=0
256
- if [[ "$out" == *:* ]]; then
257
- directive=\${out##*:}
258
- out=\${out%:*}
259
- fi
260
-
261
- # Process completions based on directive
262
- if [[ $((directive & $ShellCompDirectiveError)) -ne 0 ]]; then
263
- # Error, no completion
264
- return
265
- fi
266
-
267
- # Apply directives
268
- if [[ $((directive & $ShellCompDirectiveNoSpace)) -ne 0 ]]; then
269
- compopt -o nospace
270
- fi
271
- if [[ $((directive & $ShellCompDirectiveKeepOrder)) -ne 0 ]]; then
272
- compopt -o nosort
273
- fi
274
- if [[ $((directive & $ShellCompDirectiveNoFileComp)) -ne 0 ]]; then
275
- compopt +o default
276
- fi
277
-
278
- # Handle file extension filtering
279
- if [[ $((directive & $ShellCompDirectiveFilterFileExt)) -ne 0 ]]; then
280
- local filter=""
281
- for ext in $out; do
282
- filter="$filter|$ext"
283
- done
284
- filter="\\.($filter)"
285
- compopt -o filenames
286
- COMPREPLY=( $(compgen -f -X "!$filter" -- "$cur") )
287
- return
288
- fi
289
-
290
- # Handle directory filtering
291
- if [[ $((directive & $ShellCompDirectiveFilterDirs)) -ne 0 ]]; then
292
- compopt -o dirnames
293
- COMPREPLY=( $(compgen -d -- "$cur") )
294
- return
295
- fi
296
-
297
- # Process completions
298
- local IFS=$'\\n'
299
- local tab=$(printf '\\t')
300
-
301
- # Parse completions with descriptions
302
- local completions=()
303
- while read -r comp; do
304
- if [[ "$comp" == *$tab* ]]; then
305
- # Split completion and description
306
- local value=\${comp%%$tab*}
307
- local desc=\${comp#*$tab}
308
- completions+=("$value")
309
- else
310
- completions+=("$comp")
311
- fi
312
- done <<< "$out"
313
-
314
- # Return completions
315
- COMPREPLY=( $(compgen -W "\${completions[*]}" -- "$cur") )
316
- }
317
-
318
- # Register completion function
319
- complete -F __${t}_complete ${e}
320
- `}function W(e,o){let t=e.replace(/[-:]/g,"_"),r=p.ShellCompDirectiveError,i=p.ShellCompDirectiveNoSpace,n=p.ShellCompDirectiveNoFileComp,m=p.ShellCompDirectiveFilterFileExt,s=p.ShellCompDirectiveFilterDirs;return`# fish completion for ${e} -*- shell-script -*-
321
-
322
- function __${t}_debug
323
- set -l file "$BASH_COMP_DEBUG_FILE"
324
- if test -n "$file"
325
- echo "$argv" >> $file
326
- end
327
- end
328
-
329
- function __${t}_perform_completion
330
- __${t}_debug "Starting __${t}_perform_completion"
331
-
332
- # Extract all args except the last one
333
- set -l args (commandline -opc)
334
- # Extract the last arg and escape it in case it is a space or wildcard
335
- set -l lastArg (string escape -- (commandline -ct))
336
-
337
- __${t}_debug "args: $args"
338
- __${t}_debug "last arg: $lastArg"
339
-
340
- # Build the completion request command
341
- set -l requestComp "${o} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg"
342
-
343
- __${t}_debug "Calling $requestComp"
344
- set -l results (eval $requestComp 2> /dev/null)
345
-
346
- # Some programs may output extra empty lines after the directive.
347
- # Let's ignore them or else it will break completion.
348
- # Ref: https://github.com/spf13/cobra/issues/1279
349
- for line in $results[-1..1]
350
- if test (string trim -- $line) = ""
351
- # Found an empty line, remove it
352
- set results $results[1..-2]
353
- else
354
- # Found non-empty line, we have our proper output
355
- break
356
- end
357
- end
358
-
359
- set -l comps $results[1..-2]
360
- set -l directiveLine $results[-1]
361
-
362
- # For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)
363
- # completions must be prefixed with the flag
364
- set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
365
-
366
- __${t}_debug "Comps: $comps"
367
- __${t}_debug "DirectiveLine: $directiveLine"
368
- __${t}_debug "flagPrefix: $flagPrefix"
369
-
370
- for comp in $comps
371
- printf "%s%s\\n" "$flagPrefix" "$comp"
372
- end
373
-
374
- printf "%s\\n" "$directiveLine"
375
- end
376
-
377
- # This function limits calls to __${t}_perform_completion, by caching the result
378
- function __${t}_perform_completion_once
379
- __${t}_debug "Starting __${t}_perform_completion_once"
380
-
381
- if test -n "$__${t}_perform_completion_once_result"
382
- __${t}_debug "Seems like a valid result already exists, skipping __${t}_perform_completion"
383
- return 0
384
- end
385
-
386
- set --global __${t}_perform_completion_once_result (__${t}_perform_completion)
387
- if test -z "$__${t}_perform_completion_once_result"
388
- __${t}_debug "No completions, probably due to a failure"
389
- return 1
390
- end
391
-
392
- __${t}_debug "Performed completions and set __${t}_perform_completion_once_result"
393
- return 0
394
- end
395
-
396
- # This function is used to clear the cached result after completions are run
397
- function __${t}_clear_perform_completion_once_result
398
- __${t}_debug ""
399
- __${t}_debug "========= clearing previously set __${t}_perform_completion_once_result variable =========="
400
- set --erase __${t}_perform_completion_once_result
401
- __${t}_debug "Successfully erased the variable __${t}_perform_completion_once_result"
402
- end
403
-
404
- function __${t}_requires_order_preservation
405
- __${t}_debug ""
406
- __${t}_debug "========= checking if order preservation is required =========="
407
-
408
- __${t}_perform_completion_once
409
- if test -z "$__${t}_perform_completion_once_result"
410
- __${t}_debug "Error determining if order preservation is required"
411
- return 1
412
- end
413
-
414
- set -l directive (string sub --start 2 $__${t}_perform_completion_once_result[-1])
415
- __${t}_debug "Directive is: $directive"
416
-
417
- set -l shellCompDirectiveKeepOrder ${p.ShellCompDirectiveKeepOrder}
418
- set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
419
- __${t}_debug "Keeporder is: $keeporder"
420
-
421
- if test $keeporder -ne 0
422
- __${t}_debug "This does require order preservation"
423
- return 0
424
- end
425
-
426
- __${t}_debug "This doesn't require order preservation"
427
- return 1
428
- end
429
-
430
- # This function does two things:
431
- # - Obtain the completions and store them in the global __${t}_comp_results
432
- # - Return false if file completion should be performed
433
- function __${t}_prepare_completions
434
- __${t}_debug ""
435
- __${t}_debug "========= starting completion logic =========="
436
-
437
- # Start fresh
438
- set --erase __${t}_comp_results
439
-
440
- __${t}_perform_completion_once
441
- __${t}_debug "Completion results: $__${t}_perform_completion_once_result"
442
-
443
- if test -z "$__${t}_perform_completion_once_result"
444
- __${t}_debug "No completion, probably due to a failure"
445
- # Might as well do file completion, in case it helps
446
- return 1
447
- end
448
-
449
- set -l directive (string sub --start 2 $__${t}_perform_completion_once_result[-1])
450
- set --global __${t}_comp_results $__${t}_perform_completion_once_result[1..-2]
451
-
452
- __${t}_debug "Completions are: $__${t}_comp_results"
453
- __${t}_debug "Directive is: $directive"
454
-
455
- set -l shellCompDirectiveError ${r}
456
- set -l shellCompDirectiveNoSpace ${i}
457
- set -l shellCompDirectiveNoFileComp ${n}
458
- set -l shellCompDirectiveFilterFileExt ${m}
459
- set -l shellCompDirectiveFilterDirs ${s}
460
-
461
- if test -z "$directive"
462
- set directive 0
463
- end
464
-
465
- set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
466
- if test $compErr -eq 1
467
- __${t}_debug "Received error directive: aborting."
468
- # Might as well do file completion, in case it helps
469
- return 1
470
- end
471
-
472
- set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
473
- set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
474
- if test $filefilter -eq 1; or test $dirfilter -eq 1
475
- __${t}_debug "File extension filtering or directory filtering not supported"
476
- # Do full file completion instead
477
- return 1
478
- end
479
-
480
- set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
481
- set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
482
-
483
- __${t}_debug "nospace: $nospace, nofiles: $nofiles"
484
-
485
- # If we want to prevent a space, or if file completion is NOT disabled,
486
- # we need to count the number of valid completions.
487
- # To do so, we will filter on prefix as the completions we have received
488
- # may not already be filtered so as to allow fish to match on different
489
- # criteria than the prefix.
490
- if test $nospace -ne 0; or test $nofiles -eq 0
491
- set -l prefix (commandline -t | string escape --style=regex)
492
- __${t}_debug "prefix: $prefix"
493
-
494
- set -l completions (string match -r -- "^$prefix.*" $__${t}_comp_results)
495
- set --global __${t}_comp_results $completions
496
- __${t}_debug "Filtered completions are: $__${t}_comp_results"
497
-
498
- # Important not to quote the variable for count to work
499
- set -l numComps (count $__${t}_comp_results)
500
- __${t}_debug "numComps: $numComps"
501
-
502
- if test $numComps -eq 1; and test $nospace -ne 0
503
- # We must first split on \\t to get rid of the descriptions to be
504
- # able to check what the actual completion will be.
505
- # We don't need descriptions anyway since there is only a single
506
- # real completion which the shell will expand immediately.
507
- set -l split (string split --max 1 "\\t" $__${t}_comp_results[1])
508
-
509
- # Fish won't add a space if the completion ends with any
510
- # of the following characters: @=/:.,
511
- set -l lastChar (string sub -s -1 -- $split)
512
- if not string match -r -q "[@=/:.,]" -- "$lastChar"
513
- # In other cases, to support the "nospace" directive we trick the shell
514
- # by outputting an extra, longer completion.
515
- __${t}_debug "Adding second completion to perform nospace directive"
516
- set --global __${t}_comp_results $split[1] $split[1].
517
- __${t}_debug "Completions are now: $__${t}_comp_results"
518
- end
519
- end
520
-
521
- if test $numComps -eq 0; and test $nofiles -eq 0
522
- # To be consistent with bash and zsh, we only trigger file
523
- # completion when there are no other completions
524
- __${t}_debug "Requesting file completion"
525
- return 1
526
- end
527
- end
528
-
529
- return 0
530
- end
531
-
532
- # Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
533
- # so we can properly delete any completions provided by another script.
534
- # Only do this if the program can be found, or else fish may print some errors; besides,
535
- # the existing completions will only be loaded if the program can be found.
536
- if type -q "${e}"
537
- # The space after the program name is essential to trigger completion for the program
538
- # and not completion of the program name itself.
539
- # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
540
- complete --do-complete "${e} " > /dev/null 2>&1
541
- end
542
-
543
- # Remove any pre-existing completions for the program since we will be handling all of them.
544
- complete -c ${e} -e
545
-
546
- # This will get called after the two calls below and clear the cached result
547
- complete -c ${e} -n '__${t}_clear_perform_completion_once_result'
548
- # The call to __${t}_prepare_completions will setup __${t}_comp_results
549
- # which provides the program's completion choices.
550
- # If this doesn't require order preservation, we don't use the -k flag
551
- complete -c ${e} -n 'not __${t}_requires_order_preservation && __${t}_prepare_completions' -f -a '$__${t}_comp_results'
552
- # Otherwise we use the -k flag
553
- complete -k -c ${e} -n '__${t}_requires_order_preservation && __${t}_prepare_completions' -f -a '$__${t}_comp_results'
554
- `}function V(e,o){let t=e.replace(/[-:]/g,"_");return`# powershell completion for ${e} -*- shell-script -*-
555
-
556
- [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
557
- function __${e}_debug {
558
- if ($env:BASH_COMP_DEBUG_FILE) {
559
- "$args" | Out-File -Append -FilePath "$env:BASH_COMP_DEBUG_FILE"
560
- }
561
- }
562
-
563
- filter __${e}_escapeStringWithSpecialChars {
564
- $_ -replace '\\s|#|@|\\$|;|,|''|\\{|\\}|\\(|\\)|"|\\||<|>|&','\`$&'
565
- }
566
-
567
- [scriptblock]$__${t}CompleterBlock = {
568
- param(
569
- $WordToComplete,
570
- $CommandAst,
571
- $CursorPosition
572
- )
573
-
574
- # Get the current command line and convert into a string
575
- $Command = $CommandAst.CommandElements
576
- $Command = "$Command"
577
-
578
- __${e}_debug ""
579
- __${e}_debug "========= starting completion logic =========="
580
- __${e}_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition"
581
-
582
- # The user could have moved the cursor backwards on the command-line.
583
- # We need to trigger completion from the $CursorPosition location, so we need
584
- # to truncate the command-line ($Command) up to the $CursorPosition location.
585
- # Make sure the $Command is longer then the $CursorPosition before we truncate.
586
- # This happens because the $Command does not include the last space.
587
- if ($Command.Length -gt $CursorPosition) {
588
- $Command = $Command.Substring(0, $CursorPosition)
589
- }
590
- __${e}_debug "Truncated command: $Command"
591
-
592
- $ShellCompDirectiveError=${p.ShellCompDirectiveError}
593
- $ShellCompDirectiveNoSpace=${p.ShellCompDirectiveNoSpace}
594
- $ShellCompDirectiveNoFileComp=${p.ShellCompDirectiveNoFileComp}
595
- $ShellCompDirectiveFilterFileExt=${p.ShellCompDirectiveFilterFileExt}
596
- $ShellCompDirectiveFilterDirs=${p.ShellCompDirectiveFilterDirs}
597
- $ShellCompDirectiveKeepOrder=${p.ShellCompDirectiveKeepOrder}
598
-
599
- # Prepare the command to request completions for the program.
600
- # Split the command at the first space to separate the program and arguments.
601
- $Program, $Arguments = $Command.Split(" ", 2)
602
-
603
- $QuotedArgs = ($Arguments -split ' ' | ForEach-Object { "'" + ($_ -replace "'", "''") + "'" }) -join ' '
604
- __${e}_debug "QuotedArgs: $QuotedArgs"
605
-
606
- $RequestComp = "& ${o} complete '--' $QuotedArgs"
607
- __${e}_debug "RequestComp: $RequestComp"
608
-
609
- # we cannot use $WordToComplete because it
610
- # has the wrong values if the cursor was moved
611
- # so use the last argument
612
- if ($WordToComplete -ne "" ) {
613
- $WordToComplete = $Arguments.Split(" ")[-1]
614
- }
615
- __${e}_debug "New WordToComplete: $WordToComplete"
616
-
617
-
618
- # Check for flag with equal sign
619
- $IsEqualFlag = ($WordToComplete -Like "--*=*" )
620
- if ( $IsEqualFlag ) {
621
- __${e}_debug "Completing equal sign flag"
622
- # Remove the flag part
623
- $Flag, $WordToComplete = $WordToComplete.Split("=", 2)
624
- }
625
- $HasTrailingEmptyArg = $QuotedArgs -match "(^| )''$"
626
- __${e}_debug "HasTrailingEmptyArg: $HasTrailingEmptyArg"
627
-
628
- if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag ) -And ( -Not $HasTrailingEmptyArg )) {
629
- # If the last parameter is complete (there is a space following it)
630
- # We add an extra empty parameter so we can indicate this to the go method.
631
- __${e}_debug "Adding extra empty parameter"
632
- # PowerShell 7.2+ changed the way how the arguments are passed to executables,
633
- # so for pre-7.2 or when Legacy argument passing is enabled we need to use
634
- if ($PSVersionTable.PsVersion -lt [version]'7.2.0' -or
635
- ($PSVersionTable.PsVersion -lt [version]'7.3.0' -and -not [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -or
636
- (($PSVersionTable.PsVersion -ge [version]'7.3.0' -or [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -and
637
- $PSNativeCommandArgumentPassing -eq 'Legacy')) {
638
- $RequestComp="$RequestComp" + ' \`"\`"'
639
- } else {
640
- $RequestComp = "$RequestComp" + ' ""'
641
- }
642
- }
643
-
644
- __${e}_debug "Calling $RequestComp"
645
- # First disable ActiveHelp which is not supported for Powershell
646
- $env:ActiveHelp = 0
647
-
648
- # call the command store the output in $out and redirect stderr and stdout to null
649
- # $Out is an array contains each line per element
650
- Invoke-Expression -OutVariable out "$RequestComp" 2>&1 | Out-Null
651
-
652
- # get directive from last line
653
- [int]$Directive = $Out[-1].TrimStart(':')
654
- if ($Directive -eq "") {
655
- # There is no directive specified
656
- $Directive = 0
657
- }
658
- __${e}_debug "The completion directive is: $Directive"
659
-
660
- # remove directive (last element) from out
661
- $Out = $Out | Where-Object { $_ -ne $Out[-1] }
662
- __${e}_debug "The completions are: $Out"
663
-
664
- if (($Directive -band $ShellCompDirectiveError) -ne 0 ) {
665
- # Error code. No completion.
666
- __${e}_debug "Received error from custom completion go code"
667
- return
668
- }
669
-
670
- $Longest = 0
671
- [Array]$Values = $Out | ForEach-Object {
672
- # Split the output in name and description
673
- $Name, $Description = $_.Split("\`t", 2)
674
- __${e}_debug "Name: $Name Description: $Description"
675
-
676
- # Look for the longest completion so that we can format things nicely
677
- if ($Longest -lt $Name.Length) {
678
- $Longest = $Name.Length
679
- }
680
-
681
- # Set the description to a one space string if there is none set.
682
- # This is needed because the CompletionResult does not accept an empty string as argument
683
- if (-Not $Description) {
684
- $Description = " "
685
- }
686
- @{ Name = "$Name"; Description = "$Description" }
687
- }
688
-
689
-
690
- $Space = " "
691
- if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) {
692
- # remove the space here
693
- __${e}_debug "ShellCompDirectiveNoSpace is called"
694
- $Space = ""
695
- }
696
-
697
- if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or
698
- (($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {
699
- __${e}_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"
700
-
701
- # return here to prevent the completion of the extensions
702
- return
703
- }
704
-
705
- $Values = $Values | Where-Object {
706
- # filter the result
707
- $_.Name -like "$WordToComplete*"
708
-
709
- # Join the flag back if we have an equal sign flag
710
- if ( $IsEqualFlag ) {
711
- __${e}_debug "Join the equal sign flag back to the completion value"
712
- $_.Name = $Flag + "=" + $_.Name
713
- }
714
- }
715
-
716
- # we sort the values in ascending order by name if keep order isn't passed
717
- if (($Directive -band $ShellCompDirectiveKeepOrder) -eq 0 ) {
718
- $Values = $Values | Sort-Object -Property Name
719
- }
720
-
721
- if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
722
- __${e}_debug "ShellCompDirectiveNoFileComp is called"
723
-
724
- if ($Values.Length -eq 0) {
725
- # Just print an empty string here so the
726
- # shell does not start to complete paths.
727
- # We cannot use CompletionResult here because
728
- # it does not accept an empty string as argument.
729
- ""
730
- return
731
- }
732
- }
733
-
734
- # Get the current mode
735
- $Mode = (Get-PSReadLineKeyHandler | Where-Object { $_.Key -eq "Tab" }).Function
736
- __${e}_debug "Mode: $Mode"
737
-
738
- $Values | ForEach-Object {
739
-
740
- # store temporary because switch will overwrite $_
741
- $comp = $_
742
-
743
- # PowerShell supports three different completion modes
744
- # - TabCompleteNext (default windows style - on each key press the next option is displayed)
745
- # - Complete (works like bash)
746
- # - MenuComplete (works like zsh)
747
- # You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function <mode>
748
-
749
- # CompletionResult Arguments:
750
- # 1) CompletionText text to be used as the auto completion result
751
- # 2) ListItemText text to be displayed in the suggestion list
752
- # 3) ResultType type of completion result
753
- # 4) ToolTip text for the tooltip with details about the object
754
-
755
- switch ($Mode) {
756
-
757
- # bash like
758
- "Complete" {
759
-
760
- if ($Values.Length -eq 1) {
761
- __${e}_debug "Only one completion left"
762
-
763
- # insert space after value
764
- [System.Management.Automation.CompletionResult]::new($($comp.Name | __${e}_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
765
-
766
- } else {
767
- # Add the proper number of spaces to align the descriptions
768
- while($comp.Name.Length -lt $Longest) {
769
- $comp.Name = $comp.Name + " "
770
- }
771
-
772
- # Check for empty description and only add parentheses if needed
773
- if ($($comp.Description) -eq " " ) {
774
- $Description = ""
775
- } else {
776
- $Description = " ($($comp.Description))"
777
- }
778
-
779
- [System.Management.Automation.CompletionResult]::new("$($comp.Name)$Description", "$($comp.Name)$Description", 'ParameterValue', "$($comp.Description)")
780
- }
781
- }
782
-
783
- # zsh like
784
- "MenuComplete" {
785
- # insert space after value
786
- # MenuComplete will automatically show the ToolTip of
787
- # the highlighted value at the bottom of the suggestions.
788
- [System.Management.Automation.CompletionResult]::new($($comp.Name | __${e}_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
789
- }
790
-
791
- # TabCompleteNext and in case we get something unknown
792
- Default {
793
- # Like MenuComplete but we don't want to add a space here because
794
- # the user need to press space anyway to get the completion.
795
- # Description will not be shown because that's not possible with TabCompleteNext
796
- [System.Management.Automation.CompletionResult]::new($($comp.Name | __${e}_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
797
- }
798
- }
799
-
800
- }
801
- }
802
-
803
- Register-ArgumentCompleter -CommandName '${e}' -ScriptBlock $__${t}CompleterBlock
804
- `}var G=F(require("node:assert"),1),p={ShellCompDirectiveError:1,ShellCompDirectiveNoSpace:2,ShellCompDirectiveNoFileComp:4,ShellCompDirectiveFilterFileExt:8,ShellCompDirectiveFilterDirs:16,ShellCompDirectiveKeepOrder:32,shellCompDirectiveMaxValue:64,ShellCompDirectiveDefault:0},et=class{name;variadic;command;handler;constructor(e,o,t,r=!1){this.command=e,this.name=o,this.handler=t,this.variadic=r}},tt=class{value;description;command;handler;alias;isBoolean;constructor(e,o,t,r,i,n){this.command=e,this.value=o,this.description=t,this.handler=r,this.alias=i,this.isBoolean=n}},B=class{value;description;options=new Map;arguments=new Map;parent;constructor(e,o){this.value=e,this.description=o}option(e,o,t,r){let i,n,m;typeof t=="function"?(i=t,n=r,m=!1):typeof t=="string"?(i=void 0,n=t,m=!0):(i=void 0,n=void 0,m=!0);let s=new tt(this,e,o,i,n,m);return this.options.set(e,s),this}argument(e,o,t=!1){let r=new et(this,e,o,t);return this.arguments.set(e,r),this}},ot=class extends B{commands=new Map;completions=[];directive=p.ShellCompDirectiveDefault;constructor(){super("","")}command(e,o){let t=new B(e,o);return this.commands.set(e,t),t}stripOptions(e){let o=[],t=0;for(;t<e.length;){let r=e[t];if(r.startsWith("-")){t++;let i=!1,n=this.findOption(this,r);if(n)i=n.isBoolean??!1;else for(let[,m]of this.commands){let s=this.findOption(m,r);if(s){i=s.isBoolean??!1;break}}!i&&t<e.length&&!e[t].startsWith("-")&&t++}else o.push(r),t++}return o}matchCommand(e){e=this.stripOptions(e);let o=[],t=[],r=null;for(let i=0;i<e.length;i++){let n=e[i];o.push(n);let m=this.commands.get(o.join(" "));if(m)r=m;else{t=e.slice(i,e.length);break}}return[r||this,t]}shouldCompleteFlags(e,o){if(o.startsWith("-"))return!0;if(e?.startsWith("-")){let t=this.findOption(this,e);if(!t){for(let[,r]of this.commands)if(t=this.findOption(r,e),t)break}return!(t&&t.isBoolean)}return!1}shouldCompleteCommands(e){return!e.startsWith("-")}handleFlagCompletion(e,o,t,r){let i;if(t.includes("=")){let[n]=t.split("=");i=n}else if(r?.startsWith("-")){let n=this.findOption(e,r);n&&!n.isBoolean&&(i=r)}if(i){let n=this.findOption(e,i);if(n?.handler){let m=[];n.handler.call(n,(s,d)=>m.push({value:s,description:d}),e.options),this.completions=m}return}if(t.startsWith("-")){let n=t.startsWith("-")&&!t.startsWith("--"),m=t.replace(/^-+/,"");for(let[s,d]of e.options)n&&d.alias&&`-${d.alias}`.startsWith(t)?this.completions.push({value:`-${d.alias}`,description:d.description}):!n&&s.startsWith(m)&&this.completions.push({value:`--${s}`,description:d.description})}}findOption(e,o){let t=e.options.get(o);if(t||(t=e.options.get(o.replace(/^-+/,"")),t))return t;for(let[r,i]of e.options)if(i.alias&&`-${i.alias}`===o)return i}handleCommandCompletion(e,o){let t=this.stripOptions(e);for(let[r,i]of this.commands){if(r==="")continue;let n=r.split(" ");n.slice(0,t.length).every((m,s)=>m===t[s])&&n[t.length]?.startsWith(o)&&this.completions.push({value:n[t.length],description:i.description})}}handlePositionalCompletion(e,o){let t=this.stripOptions(o),r=e.value.split(" ").length,i=Math.max(0,t.length-r),n=Array.from(e.arguments.entries());if(n.length>0){let m;if(i<n.length){let[s,d]=n[i];m=d}else{let s=n[n.length-1][1];s.variadic&&(m=s)}if(m&&m.handler&&typeof m.handler=="function"){let s=[];m.handler.call(m,(d,h)=>s.push({value:d,description:h}),e.options),this.completions.push(...s)}}}complete(e){this.directive=p.ShellCompDirectiveNoFileComp;let o=new Set;this.completions.filter(t=>o.has(t.value)?!1:(o.add(t.value),!0)).filter(t=>{if(e.includes("=")){let[,r]=e.split("=");return t.value.startsWith(r)}return t.value.startsWith(e)}).forEach(t=>console.log(`${t.value} ${t.description??""}`)),console.log(`:${this.directive}`)}parse(e){this.completions=[];let o=e[e.length-1]==="";o&&e.pop();let t=e[e.length-1]||"",r=e.slice(0,-1);o&&(t!==""&&r.push(t),t="");let[i]=this.matchCommand(r),n=r[r.length-1];this.shouldCompleteFlags(n,t)?this.handleFlagCompletion(i,r,t,n):(this.shouldCompleteCommands(t)&&this.handleCommandCompletion(r,t),i&&i.arguments.size>0&&this.handlePositionalCompletion(i,r)),this.complete(t)}setup(e,o,t){switch((0,G.default)(t==="zsh"||t==="bash"||t==="fish"||t==="powershell","Unsupported shell"),t){case"zsh":{let r=M(e,o);console.log(r);break}case"bash":{let r=H(e,o);console.log(r);break}case"fish":{let r=W(e,o);console.log(r);break}case"powershell":{let r=V(e,o);console.log(r);break}}}},D=new ot;var O,U,j,K,Q=!0;typeof process<"u"&&({FORCE_COLOR:O,NODE_DISABLE_COLORS:U,NO_COLOR:j,TERM:K}=process.env||{},Q=process.stdout&&process.stdout.isTTY);var it={enabled:!U&&j==null&&K!=="dumb"&&(O!=null&&O!=="0"||Q)};function c(e,o){let t=new RegExp(`\\x1b\\[${o}m`,"g"),r=`\x1B[${e}m`,i=`\x1B[${o}m`;return function(n){return!it.enabled||n==null?n:r+(~(""+n).indexOf(i)?n.replace(t,i+r):n)+i}}var Pt=c(0,0),rt=c(1,22),Dt=c(2,22),St=c(3,23),wt=c(4,24),xt=c(7,27),Et=c(8,28),Ft=c(9,29),Ot=c(30,39),nt=c(31,39),Nt=c(32,39),At=c(33,39),kt=c(34,39),Tt=c(35,39),Rt=c(36,39),qt=c(37,39),Lt=c(90,39),It=c(90,39),Mt=c(40,49),Ht=c(41,49),Wt=c(42,49),Vt=c(43,49),Bt=c(44,49),Gt=c(45,49),Ut=c(46,49),jt=c(47,49);var y=class e extends Error{constructor(o){super(o),this.name="HelpError",Object.setPrototypeOf(this,e.prototype)}};var Z=F(Y());var st=F(X(),1);function ee(e,o,t=!0,r=!1){try{return(0,Z.default)(o,{argv:e,stopAtPositional:t,permissive:r})}catch(i){return i}}function te(e){return e instanceof Error}var l=[{value:"prisma/schema.prisma",description:"Default schema path"},{value:"./schema.prisma",description:"Schema in project root"}],a=[{value:"prisma.config.ts",description:"Default config path"}],_=[{value:"postgresql://",description:"PostgreSQL connection string"},{value:"mysql://",description:"MySQL connection string"},{value:"file:",description:"SQLite connection string"},{value:"mongodb://",description:"MongoDB connection string"},{value:"sqlserver://",description:"SQL Server connection string"}],S=[{value:"<your-api-key>",description:"Workspace API key"}],w=[{value:"db_",description:"Database ID prefix (e.g. db_abc123)"}],oe=[{value:"prisma-client",description:"Prisma Client generator"},{value:"prisma-client-js",description:"Legacy Prisma Client JS generator"}],ie=[{value:"./generated/prisma",description:"Common client output path"},{value:"../generated/prisma",description:"Alternative client output path"}],re=[{value:"typedSql",description:"TypedSQL preview feature"}],ne=[{value:"./script.sql",description:"SQL script file"}],A=[{value:"prisma/migrations",description:"Default migrations directory"},{value:"./migrations",description:"Custom migrations directory"}],se=[{value:"diff.sql",description:"SQL diff output file"}],ae=[{value:"init",description:"Initial migration name"},{value:"add_users",description:"Example migration name"}],k=[{value:"20201231000000_add_users_table",description:"Example migration ID"}],le=[{value:"-1",description:"Infinite depth (default)"},{value:"0",description:"Off"},{value:"2",description:"Two levels deep"}],me=[{value:"public",description:"PostgreSQL default schema"}],pe=[{value:"postgresql",description:"PostgreSQL"},{value:"mysql",description:"MySQL"},{value:"sqlite",description:"SQLite"},{value:"mongodb",description:"MongoDB"},{value:"sqlserver",description:"SQL Server"},{value:"cockroachdb",description:"CockroachDB"}],ce=[{value:"prisma-client",description:"Prisma Client"},{value:"prisma-client-js",description:"Legacy Prisma Client JS"}],de=[{value:"51212",description:"Default Studio port"},{value:"5555",description:"Common custom port"},{value:"3000",description:"Alternative port"}],ue=[{value:"none",description:"Do not open browser"},{value:"chrome",description:"Google Chrome"},{value:"firefox",description:"Mozilla Firefox"},{value:"safari",description:"Safari"}],he=[{value:"default",description:"Default server name"}],fe=[{value:"51213",description:"Default HTTP server port"}],ge=[{value:"51214",description:"Default database port"}],_e=[{value:"51215",description:"Default shadow database port"}];var $e={name:"db",description:"Manage your database schema and lifecycle",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"schema",description:"Custom path to your Prisma schema",values:l}]};var Ce={name:"db execute",description:"Execute SQL or scripts on your database",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"file",description:"Path to a file containing the script to execute",values:ne},{name:"stdin",description:"Use terminal standard input as the script to execute"}]};var ve={name:"db pull",description:"Pull the schema from an existing database",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"url",description:"Override the datasource URL from the Prisma config file",values:_},{name:"force",description:"Ignore current Prisma schema file"},{name:"print",description:"Print the introspected Prisma schema to stdout"},{name:"composite-type-depth",description:"Specify the depth for introspecting composite types",values:le},{name:"schemas",description:"Specify database schemas to introspect (overrides datasource block)",values:me}]};var be={name:"db push",description:"Push the Prisma schema state to the database",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"url",description:"Override the datasource URL from the Prisma config file",values:_},{name:"accept-data-loss",description:"Ignore data loss warnings"},{name:"force-reset",description:"Force a reset of the database before push"}]};var ye={name:"db seed",description:"Seed your database",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a}]};var Pe={name:"migrate",description:"Migrate your database",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"schema",description:"Custom path to your Prisma schema",values:l}]};var De={name:"migrate deploy",description:"Apply pending migrations to the database",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a}]};var Se={name:"migrate dev",description:"Create and apply migrations in development",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"url",description:"Override the datasource URL from the Prisma config file",values:_},{name:"name",alias:"n",description:"Name the migration",values:ae},{name:"create-only",description:"Create a new migration but do not apply it"}]};var we={name:"migrate diff",description:"Compare the database schema from two arbitrary sources",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"output",alias:"o",description:"Write the diff to a file instead of stdout",values:se},{name:"from-empty",description:"Assume the source data model is empty"},{name:"from-schema",description:"Path to a Prisma schema file as the source",values:l},{name:"from-migrations",description:"Path to a Prisma migrations directory as the source",values:A},{name:"from-config-datasource",description:"Use the datasource from the Prisma config file as the source"},{name:"to-empty",description:"Assume the destination data model is empty"},{name:"to-schema",description:"Path to a Prisma schema file as the destination",values:l},{name:"to-migrations",description:"Path to a Prisma migrations directory as the destination",values:A},{name:"to-config-datasource",description:"Use the datasource from the Prisma config file as the destination"},{name:"script",description:"Output a SQL script instead of a human-readable summary"},{name:"exit-code",description:"Change the exit code behavior (Empty=0, Error=1, Not empty=2)"}]};var xe={name:"migrate reset",description:"Reset your database and apply all migrations",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"force",alias:"f",description:"Skip the confirmation prompt"}]};var Ee={name:"migrate resolve",description:"Mark a migration as applied or rolled back",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"applied",description:"Mark a migration as applied",values:k},{name:"rolled-back",description:"Mark a migration as rolled back",values:k}]};var Fe={name:"migrate status",description:"Check the status of your database migrations",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a}]};var Oe=[{name:"nextjs",label:"Next.js"},{name:"express",label:"Express"},{name:"hono",label:"Hono"},{name:"fastify",label:"Fastify"},{name:"nuxt",label:"Nuxt"},{name:"sveltekit",label:"SvelteKit"},{name:"remix",label:"Remix"},{name:"react-router-7",label:"React Router 7"},{name:"astro",label:"Astro"},{name:"nest",label:"NestJS"}];var Ne={name:"bootstrap",description:"Bootstrap a Prisma Postgres project",options:[{name:"api-key",description:"Workspace API key (CI / non-interactive)",values:S},{name:"database",description:"Database ID to link to (e.g. db_abc123)",values:w},{name:"template",description:"Starter template name",values:Oe.map(({name:e,label:o})=>({value:e,description:`${o} starter`}))},{name:"force",description:"Re-link even if already linked to Prisma Postgres"}]};var Ae={name:"debug",description:"Displays Prisma debug info",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a}]};var ke={name:"format",description:"Format your Prisma schema",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"check",description:"Check if the schema is formatted"}]};var Te={name:"generate",description:"Generate artifacts (e.g. Prisma Client)",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"watch",description:"Watch the Prisma schema and rerun after a change"},{name:"generator",description:"Generator to use (may be provided multiple times)",values:oe},{name:"no-hints",description:"Hides the hint messages but still outputs errors and warnings"},{name:"require-models",description:"Do not allow generating a client without models"},{name:"sql",description:"Generate TypedSQL module"}]};var Re={name:"init",description:"Set up Prisma for your app",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"url",description:"Define a custom datasource url",values:_},{name:"datasource-provider",description:"Define the datasource provider",values:pe},{name:"generator-provider",description:"Define the generator provider",values:ce},{name:"preview-feature",description:"Define a preview feature to use (can be specified multiple times)",values:re},{name:"output",description:"Define Prisma Client generator output path",values:ie},{name:"with-model",description:"Add an example model to the created schema file"},{name:"db",description:"Provision a fully managed Prisma Postgres database on the Prisma Data Platform"}]};var qe={name:"mcp",description:"Starts an MCP server to use with AI development tools",options:[{name:"early-access",description:"Enable early access features"}]};var Le={name:"platform",description:"Prisma Data Platform commands",options:[{name:"help",alias:"h",description:"Display this help message"}],subcommands:[{name:"platform status",description:"Show Prisma Data Platform service status",options:[{name:"help",alias:"h",description:"Display this help message"}]}]};var Ie={name:"postgres link",description:"Link a local project to a Prisma Postgres database",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"api-key",description:"Workspace API key (CI / non-interactive)",values:S},{name:"database",description:"Database ID to link to (e.g. db_abc123)",values:w},{name:"force",description:"Re-link even if already linked to Prisma Postgres"}]};var Me={name:"postgres",description:"Manage Prisma Postgres databases",options:[{name:"help",alias:"h",description:"Display this help message"}]};var He={name:"studio",description:"Browse your data with Prisma Studio",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"config",description:"Custom path to your Prisma config file",values:a},{name:"url",description:"Database connection string (overrides the one in your Prisma config file)",values:_},{name:"port",alias:"p",description:"Port to start Studio on",values:de},{name:"browser",alias:"b",description:"Browser to auto-open Studio in",values:ue}]};var We={name:"validate",description:"Validate your Prisma schema",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"schema",description:"Custom path to your Prisma schema",values:l},{name:"config",description:"Custom path to your Prisma config file",values:a}]};var Ve={name:"version",description:"Displays Prisma version info",options:[{name:"help",alias:"h",description:"Display this help message"},{name:"json",description:"Output version information as JSON"}]};var at={name:"dev",description:"Start a local Prisma Postgres server for development",options:[{name:"name",alias:"n",description:"Name of the server (helps keep state isolated between different projects)",values:he},{name:"port",alias:"p",description:"Main port number for the HTTP server",values:fe},{name:"db-port",alias:"P",description:"Port number for the database server",values:ge},{name:"shadow-db-port",description:"Port number for the shadow database server",values:_e},{name:"detach",alias:"d",description:"Run the server in the background"},{name:"debug",description:"Enable debug logging"}]},x={name:"debug",description:"Enable debug logging"},lt={name:"dev ls",description:"List available servers",options:[x]},mt={name:"dev rm",description:"Remove servers",options:[x,{name:"force",description:"Stop any running servers before removing them"}]},pt={name:"dev start",description:"Start one or more stopped servers",options:[x]},ct={name:"dev stop",description:"Stop servers",options:[x]},E=["zsh","bash","fish","powershell"],dt={name:"complete",description:"Generate shell completion script",subcommands:E.map(e=>({name:`complete ${e}`,description:`Generate completion script for ${e}`}))},Be=[Re,Ne,at,lt,mt,pt,ct,Te,He,We,ke,Ve,Ae,qe,Le,Me,Ie,dt,$e,Ce,ve,be,ye,Pe,Se,xe,De,Fe,Ee,we];function Ue(e){let o=D.command(e.name,e.description);for(let t of e.options??[])ut(o,t);for(let t of e.subcommands??[])Ue(t)}function ut(e,o){if(o.values===void 0){o.alias!==void 0?e.option(o.name,o.description,o.alias):e.option(o.name,o.description);return}e.option(o.name,o.description,t=>{let r=typeof o.values=="function"?o.values():o.values??[];for(let i of r)t(i.value,i.description??"")},o.alias)}function je(e){if(e[0]==="--"){Ge();try{return D.parse(e.slice(1)),""}catch(r){return new Error(`Failed to parse completions: ${r}`)}}let o=ee(e,{});if(te(o))return new y(o.message);let t=o._[0];if(t&&E.includes(t)){Ge();try{return D.setup("prisma","prisma",t),""}catch(r){return new Error(`Failed to setup completions: ${r}`)}}return new y(`Invalid shell type. Must be one of: ${E.join(", ")}`)}function Ge(){for(let e of Be)Ue(e)}var T=je(process.argv.slice(3));T instanceof Error?(console.error(T.message),process.exitCode=1):console.log(T);