ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / terminal-suggest / scripts / pullZshBuiltins.ts 258 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
import * as fs from 'fs/promises' ;
import * as path from 'path' ;
import { checkWindows, execAsync, copyright } from './terminalScriptHelpers' ;
checkWindows ( ) ;
const latestZshVersion = 5.9 ;
const shortDescriptions: Map< string , string > = new Map ( [
[ '.' , 'Source a file' ] ,
[ ':' , 'No effect'
description
args
shortDescription
zshBuiltinsCommandDescriptionsCache
cachedCommandDescriptions Map shortDescription description args
output
zshVersionOutput r r stdout
zshVersionMatch zshVersionOutput
zshVersionMatch
process
zshVersion zshVersionMatch
zshVersion latestZshVersion
process
output r r stdout
commands Map
commandRegex
output
lines output
currentCommand
currentCommandStart
seenOutput
i
i lines length i
currentCommand seenOutput
match lines i commandRegex
match groups command
currentCommand
commands currentCommand lines currentCommandStart i
currentCommand match groups command
currentCommandStart i
seenOutput
currentCommand
seenOutput
seenOutput lines i length lines i commandRegex
currentCommand
commands currentCommand lines currentCommandStart i
commands size
process
command lines commands
shortDescription shortDescriptions command
argsEnd
line lines argsEnd
line length line commandRegex
e
e
formattedArgs lines argsEnd
args stdout
description lines argsEnd e e
shortDescription
cachedCommandDescriptions command
shortDescription
description
args
cachedCommandDescriptions command
description
args
zshBuiltinsCommandDescriptionsCache cachedCommandDescriptions
text
formattedText text
formattedText
zshBuiltinsCommandDescriptionsCache size
missingShortDescription
command entry zshBuiltinsCommandDescriptionsCache
entry shortDescription
missingShortDescription command
missingShortDescription length
missingShortDescription
cacheFilePath path __dirname
cacheObject Object zshBuiltinsCommandDescriptionsCache
tsContent
fs cacheFilePath tsContent
Object cacheObject length
error
error
]
,
[
'alias'
,
'Define or view aliases'
]
,
[
'autoload'
,
'Autoload a function'
]
,
[
'bg'
,
'Put a job in the background'
]
,
[
'bindkey'
,
'Manipulate keymap names'
]
,
[
'break'
,
'Exit from a loop'
]
,
[
'builtin'
,
'Executes a builtin'
]
,
[
'bye'
,
'Exit the shell'
]
,
[
'cap'
,
'Manipulating POSIX capability sets'
]
,
[
'cd'
,
'Change the current directory'
]
,
[
'chdir'
,
'Change the current directory'
]
,
[
'clone'
,
'Clone shell onto another terminal'
]
,
[
'command'
,
'Execute a command'
]
,
[
'comparguments'
,
'Complete arguments'
]
,
[
'compcall'
,
'Complete call'
]
,
[
'compctl'
,
'Complete control'
]
,
[
'compdescribe'
,
'Complete describe'
]
,
[
'compfiles'
,
'Complete files'
]
,
[
'compgroups'
,
'Complete groups'
]
,
[
'compquote'
,
'Complete quote'
]
,
[
'comptags'
,
'Complete tags'
]
,
[
'comptry'
,
'Complete try'
]
,
[
'compvalues'
,
'Complete values'
]
,
[
'continue'
,
'Resume the next loop iteration'
]
,
[
'declare'
,
'Set or display parameter attributes/values'
]
,
[
'dirs'
,
'Interact with directory stack'
]
,
[
'disable'
,
'Disable shell features'
]
,
[
'disown'
,
'Remove job from job table'
]
,
[
'echo'
,
'Write on standard output'
]
,
[
'echotc'
,
'Echo terminal capabilities'
]
,
[
'echoti'
,
'Echo terminal info'
]
,
[
'emulate'
,
'Emulate a shell'
]
,
[
'enable'
,
'Enable shell features'
]
,
[
'eval'
,
'Execute arguments in shell'
]
,
[
'exec'
,
'Replace shell with command'
]
,
[
'exit'
,
'Exit the shell'
]
,
[
'export'
,
'Export to environment'
]
,
[
'false'
,
'Return exit status of 1'
]
,
[
'fc'
,
'Fix command'
]
,
[
'fg'
,
'Put a job in the foreground'
]
,
[
'float'
,
'Floating point arithmetic'
]
,
[
'functions'
,
'List functions'
]
,
[
'getcap'
,
'Get capabilities'
]
,
[
'getln'
,
'Get line from buffer'
]
,
[
'getopts'
,
'Parse positional parameters'
]
,
[
'hash'
,
'Remember command locations'
]
,
[
'history'
,
'Command history'
]
,
[
'integer'
,
'Integer arithmetic'
]
,
[
'jobs'
,
'List active jobs'
]
,
[
'kill'
,
'Send a signal to a process'
]
,
[
'let'
,
'Evaluate arithmetic expression'
]
,
[
'limit'
,
'Set or display resource limits'
]
,
[
'local'
,
'Create a local variable'
]
,
[
'logout'
,
'Exit the shell'
]
,
[
'noglob'
,
'Disable filename expansion'
]
,
[
'popd'
,
'Remove directory from stack'
]
,
[
'print'
,
'Print arguments'
]
,
[
'printf'
,
'Format and print data'
]
,
[
'pushd'
,
'Add directory to stack'
]
,
[
'pushln'
,
'Push arguments onto the buffer'
]
,
[
'pwd'
,
'Print working directory'
]
,
[
'r'
,
'Re-execute command'
]
,
[
'read'
,
'Read a line from input'
]
,
[
'readonly'
,
'Mark variables as read-only'
]
,
[
'rehash'
,
'Recompute command hash table'
]
,
[
'return'
,
'Return from a function'
]
,
[
'sched'
,
'Schedule commands'
]
,
[
'set'
,
'Set shell options'
]
,
[
'setcap'
,
'Set capabilities'
]
,
[
'setopt'
,
'Set shell options'
]
,
[
'shift'
,
'Shift positional parameters'
]
,
[
'source'
,
'Source a file'
]
,
[
'stat'
,
'Display file status'
]
,
[
'suspend'
,
'Suspend the shell'
]
,
[
'test'
,
'Evaluate a conditional expression'
]
,
[
'times'
,
'Display shell times'
]
,
[
'trap'
,
'Set signal handlers'
]
,
[
'true'
,
'Return exit status of 0'
]
,
[
'ttyctl'
,
'Control terminal attributes'
]
,
[
'type'
,
'Describe a command'
]
,
[
'typeset'
,
'Set or display parameter attributes/values'
]
,
[
'ulimit'
,
'Set or display resource limits'
]
,
[
'umask'
,
'Set file creation mask'
]
,
[
'unalias'
,
'Removes aliases'
]
,
[
'unfunction'
,
'Remove function definition'
]
,
[
'unhash'
,
'Remove command from hash table'
]
,
[
'unlimit'
,
'Remove resource limits'
]
,
[
'unset'
,
'Unset values and attributes of variables'
]
,
[
'unsetopt'
,
'Unset shell options'
]
,
[
'vared'
,
'Edit shell variables'
]
,
[
'wait'
,
'Wait for a process'
]
,
[
'whence'
,
'Locate a command'
]
,
[
'where'
,
'Locate a command'
]
,
[
'which'
,
'Locate a command'
]
,
[
'zcompile'
,
'Compile functions'
]
,
[
'zformat'
,
'Format strings'
]
,
[
'zftp'
,
'Zsh FTP client'
]
,
[
'zle'
,
'Zsh line editor'
]
,
[
'zmodload'
,
'Load a module'
]
,
[
'zparseopts'
,
'Parse options'
]
,
[
'zprof'
,
'Zsh profiler'
]
,
[
'zpty'
,
'Zsh pseudo terminal'
]
,
[
'zregexparse'
,
'Parse regex'
]
,
[
'zsocket'
,
'Zsh socket interface'
]
,
[
'zstyle'
,
'Define styles'
]
,
[
'ztcp'
,
'Manipulate TCP sockets'
]
,
]
)
;
interface
ICommandDetails
{
:
string
;
:
string
|
undefined
;
?
:
string
;
}
let
=
new
Map< string , ICommandDetails>
(
)
;
async
function
createCommandDescriptionsCache
(
)
:
Promise
<
void
>
{
const
:
<
string
,
{
?
:
string
;
:
string
;
:
string
|
undefined
}
>
=
new
Map
(
)
;
let
=
''
;
const
=
await
execAsync
(
'zsh --version'
)
.
then
(
=>
.
)
;
const
=
.
match
(
/ zsh ( \d + \. \d + ) /
)
;
if
(
!
)
{
console
.
error
(
'\x1b[31mFailed to determine zsh version\x1b[0m'
)
;
.
exit
(
1
)
;
}
const
=
parseFloat
(
[
1
]
)
;
if
(
<
)
{
console
.
error
(
` \x1b[31mZsh version must be ${ latestZshVersion} or higher\x1b[0m `
)
;
.
exit
(
1
)
;
}
try
{
=
await
execAsync
(
'pandoc --from man --to markdown --wrap=none < $(man -w zshbuiltins)'
)
.
then
(
=>
.
)
;
}
catch
{
}
const
:
<
string
,
string
[
]
>
=
new
Map
(
)
;
const
=
/ ^ \* \* (?<command > [ a- z \. :] + ) \* \* (?: \s \* . + \* ) ? (?: \s \\ \[ . + \\ \] ) ? $ /
;
if
(
)
{
const
=
.
split
(
'\n'
)
;
let
:
string
|
undefined
;
let
=
0
;
let
=
false
;
let
=
0
;
for
(
;
<
.
;
++
)
{
if
(
!
||
)
{
const
=
[
]
.
match
(
)
;
if
(
?.
?.
)
{
if
(
)
{
.
set
(
,
.
slice
(
,
)
)
;
}
=
.
.
;
=
;
=
false
;
}
}
if
(
!
)
{
continue
;
}
if
(
!
)
{
=
[
]
.
>
0
&&
!
[
]
.
match
(
)
;
}
}
if
(
)
{
.
set
(
,
.
slice
(
,
-
1
)
)
;
}
}
if
(
.
===
0
)
{
console
.
error
(
'\x1b[31mFailed to parse command descriptions\x1b[30m'
)
;
.
exit
(
1
)
;
}
for
(
const
[
,
]
of
)
{
const
=
.
get
(
)
;
let
=
0
;
try
{
while
(
true
)
{
const
=
[
++
]
;
if
(
.
trim
(
)
.
>
0
&&
!
.
match
(
)
)
{
break
;
}
}
}
catch
(
)
{
console
.
log
(
)
;
}
const
=
.
slice
(
0
,
-
1
)
.
join
(
'\n'
)
;
const
=
(
await
execAsync
(
` pandoc --from markdown --to plain <<< " ${ formattedArgs} " `
)
)
.
.
trim
(
)
;
const
=
.
slice
(
)
.
map
(
=>
formatLineAsMarkdown
(
)
)
.
join
(
'\n'
)
.
trim
(
)
;
if
(
)
{
.
set
(
,
{
,
,
}
)
;
}
else
{
.
set
(
,
{
,
}
)
;
}
}
=
;
}
function
formatLineAsMarkdown
(
:
string
)
:
string
{
const
=
.
replace
(
/ \\ `( [ ^ '] + ) \\ '/ g
,
'`$1`'
)
;
return
;
}
const
main
=
async
(
)
=>
{
try
{
await
createCommandDescriptionsCache
(
)
;
console
.
log
(
'created command descriptions cache with '
,
.
,
'entries'
)
;
const
:
string
[
]
=
[
]
;
for
(
const
[
,
]
of
.
entries
(
)
)
{
if
(
.
===
undefined
)
{
.
push
(
)
;
}
}
if
(
.
>
0
)
{
console
.
log
(
'\x1b[31mmissing short description for commands:\n'
+
.
join
(
'\n'
)
+
'\x1b[0m'
)
;
}
const
=
.
join
(
,
'../src/shell/zshBuiltinsCache.ts'
)
;
const
=
.
fromEntries
(
)
;
const
=
` ${ copyright} \n\nexport const zshBuiltinsCommandDescriptionsCache = ${ JSON . stringify ( cacheObject, null , 2 ) } as const; `
;
await
.
writeFile
(
,
,
'utf8'
)
;
console
.
log
(
'saved command descriptions cache to zshBuiltinsCache.ts with '
,
.
keys
(
)
.
,
'entries'
)
;
}
catch
(
)
{
console
.
error
(
'Error:'
,
)
;
}
}
;
main
(
)
;