ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / src / extension / chatSessions / copilotcli / vscode-node / test / copilotCLISDKUpgrade.spec.ts 257 строк · изменён 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
import { promises as fs } from 'fs' ;
import { isBinaryFile } from 'isbinaryfile' ;
import * as path from 'path' ;
import { beforeAll, describe, it } from 'vitest' ;
import { TestLogService } from '../../../../../platform/testing/common/testLogService' ;
import { copyRipgrepShim } from '../../../copilotcli/node/ripgrepShim' ;
describe ( 'CopilotCLI SDK Upgrade' , function ( ) {
const extensionPath path __dirname
copilotSDKPath path extensionPath
extensionPath
existingBinaries copilotSDKPath
knownBinaries
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
path
p path copilotSDKPath p
ripgrepFilesWeCopy path copilotSDKPath
errors
binary existingBinaries
binary ripgrepFilesWeCopy
binaryName path binary
binaryName binaryName
knownBinaries binary
errors
binary knownBinaries
binary ripgrepFilesWeCopy
existingBinaries binary
copilotSDKPath binary copilotSDKPath binary
errors
errors length
errors
copilotPlatformArchs
report process report header glibcVersionRuntime
process platform report header glibcVersionRuntime
copilotSDKPath binary
relativeSegments path copilotSDKPath binary path sep
platformArch relativeSegments segment copilotPlatformArchs segment
platformArch platformArch
copilotSDKPath binary
relative path copilotSDKPath binary path sep path posix sep
pvRecorderPrefix
relative pvRecorderPrefix
currentPlatformArch
relative
currentPlatformArch
relative
currentPlatformArch
relative
currentPlatformArch currentPlatformArch
relative
currentPlatformArch
relative
currentPlatformArch
extensionPath
copilotSDKPath path extensionPath
vscodeRipgrepPath path copilotSDKPath process platform process arch
extensionPath vscodeRipgrepPath
dir
binaryFiles
filesToIgnore
dir
fs dir
entries fs dir withFileTypes
entries entry
fullPath path dir entry name
filesToIgnore entry name
entry
fullPath
entry
isBinary fullPath
isBinary
binaryFiles fullPath
dir
binaryFiles
=
.
join
(
,
'..'
,
'..'
,
'..'
,
'..'
,
'..'
,
'..'
)
;
const
=
.
join
(
,
'node_modules'
,
'@github'
,
'copilot'
)
;
beforeAll
(
async
function
(
)
{
await
copyBinaries
(
)
;
}
)
;
it
(
'should be able to load the SDK without errors'
,
async
function
(
)
{
await
import
(
'@github/copilot/sdk'
)
;
}
,
10000
)
;
it
(
'should not contain new native binaries nor removed native binaries'
,
async
function
(
)
{
const
=
new
Set
(
await
findAllBinaries
(
)
)
;
const
=
new
Set
(
[
.
join
(
'ripgrep'
,
'bin'
,
'win32-arm64'
,
'rg.exe'
)
,
.
join
(
'ripgrep'
,
'bin'
,
'win32-x64'
,
'rg.exe'
)
,
.
join
(
'prebuilds'
,
'darwin-arm64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'darwin-x64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'linux-arm64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'linux-x64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'linuxmusl-arm64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'linuxmusl-x64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'win32-arm64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'win32-x64'
,
'cli-native.node'
)
,
.
join
(
'prebuilds'
,
'darwin-arm64'
,
'runtime.node'
)
,
.
join
(
'prebuilds'
,
'darwin-x64'
,
'runtime.node'
)
,
.
join
(
'prebuilds'
,
'linux-arm64'
,
'runtime.node'
)
,
.
join
(
'prebuilds'
,
'linux-x64'
,
'runtime.node'
)
,
.
join
(
'prebuilds'
,
'linuxmusl-arm64'
,
'runtime.node'
)
,
.
join
(
'prebuilds'
,
'linuxmusl-x64'
,
'runtime.node'
)
,
.
join
(
'prebuilds'
,
'win32-arm64'
,
'runtime.node'
)
,
.
join
(
'prebuilds'
,
'win32-x64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'darwin-arm64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'darwin-x64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linux-arm64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linux-x64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linuxmusl-arm64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linuxmusl-x64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'win32-arm64'
,
'runtime.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'runtime.node'
)
,
.
join
(
'ripgrep'
,
'bin'
,
'darwin-arm64'
,
'rg'
)
,
.
join
(
'ripgrep'
,
'bin'
,
'darwin-x64'
,
'rg'
)
,
.
join
(
'ripgrep'
,
'bin'
,
'linux-x64'
,
'rg'
)
,
.
join
(
'ripgrep'
,
'bin'
,
'linux-arm64'
,
'rg'
)
,
.
join
(
'ripgrep'
,
'bin'
,
'linuxmusl-arm64'
,
'rg'
)
,
.
join
(
'ripgrep'
,
'bin'
,
'linuxmusl-x64'
,
'rg'
)
,
.
join
(
'tgrep'
,
'bin'
,
'darwin-arm64'
,
'tgrep'
)
,
.
join
(
'tgrep'
,
'bin'
,
'darwin-x64'
,
'tgrep'
)
,
.
join
(
'tgrep'
,
'bin'
,
'linux-x64'
,
'tgrep'
)
,
.
join
(
'tgrep'
,
'bin'
,
'linux-arm64'
,
'tgrep'
)
,
.
join
(
'tgrep'
,
'bin'
,
'linuxmusl-arm64'
,
'tgrep'
)
,
.
join
(
'tgrep'
,
'bin'
,
'linuxmusl-x64'
,
'tgrep'
)
,
.
join
(
'tgrep'
,
'bin'
,
'win32-arm64'
,
'tgrep.exe'
)
,
.
join
(
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'darwin-arm64'
,
'tgrep'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'darwin-x64'
,
'tgrep'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'linux-x64'
,
'tgrep'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'linux-arm64'
,
'tgrep'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'linuxmusl-arm64'
,
'tgrep'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'linuxmusl-x64'
,
'tgrep'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'win32-arm64'
,
'tgrep.exe'
)
,
.
join
(
'sdk'
,
'tgrep'
,
'bin'
,
'win32-x64'
,
'tgrep.exe'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'darwin-arm64'
,
'cli-native.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'darwin-x64'
,
'cli-native.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linux-arm64'
,
'cli-native.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linux-x64'
,
'cli-native.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linuxmusl-arm64'
,
'cli-native.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'linuxmusl-x64'
,
'cli-native.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'win32-arm64'
,
'cli-native.node'
)
,
.
join
(
'sdk'
,
'prebuilds'
,
'win32-x64'
,
'cli-native.node'
)
,
.
join
(
'foundry-local-sdk'
,
'node_modules'
,
'foundry-local-sdk'
,
'prebuilds'
,
'darwin-arm64'
,
'foundry_local_napi.node'
)
,
.
join
(
'foundry-local-sdk'
,
'node_modules'
,
'foundry-local-sdk'
,
'prebuilds'
,
'linux-x64'
,
'foundry_local_napi.node'
)
,
.
join
(
'foundry-local-sdk'
,
'node_modules'
,
'foundry-local-sdk'
,
'prebuilds'
,
'linux-arm64'
,
'foundry_local_napi.node'
)
,
.
join
(
'foundry-local-sdk'
,
'node_modules'
,
'foundry-local-sdk'
,
'prebuilds'
,
'win32-arm64'
,
'foundry_local_napi.node'
)
,
.
join
(
'foundry-local-sdk'
,
'node_modules'
,
'foundry-local-sdk'
,
'prebuilds'
,
'win32-x64'
,
'foundry_local_napi.node'
)
,
.
join
(
'pvrecorder'
,
'node_modules'
,
'@picovoice'
,
'pvrecorder-node'
,
'lib'
,
'linux'
,
'x86_64'
,
'pv_recorder.node'
)
,
.
join
(
'pvrecorder'
,
'node_modules'
,
'@picovoice'
,
'pvrecorder-node'
,
'lib'
,
'mac'
,
'arm64'
,
'pv_recorder.node'
)
,
.
join
(
'pvrecorder'
,
'node_modules'
,
'@picovoice'
,
'pvrecorder-node'
,
'lib'
,
'mac'
,
'x86_64'
,
'pv_recorder.node'
)
,
.
join
(
'pvrecorder'
,
'node_modules'
,
'@picovoice'
,
'pvrecorder-node'
,
'lib'
,
'windows'
,
'amd64'
,
'pv_recorder.node'
)
,
.
join
(
'pvrecorder'
,
'node_modules'
,
'@picovoice'
,
'pvrecorder-node'
,
'lib'
,
'windows'
,
'arm64'
,
'pv_recorder.node'
)
,
'tree-sitter-bash.wasm'
,
'tree-sitter.wasm'
,
'tree-sitter-c_sharp.wasm'
,
'tree-sitter-c.wasm'
,
'tree-sitter-cpp.wasm'
,
'tree-sitter-css.wasm'
,
'tree-sitter-html.wasm'
,
'tree-sitter-java.wasm'
,
'tree-sitter-php.wasm'
,
'tree-sitter-go.wasm'
,
'tree-sitter-json.wasm'
,
'tree-sitter-javascript.wasm'
,
'tree-sitter-python.wasm'
,
'tree-sitter-ruby.wasm'
,
'tree-sitter-tsx.wasm'
,
'tree-sitter-rust.wasm'
,
'tree-sitter-typescript.wasm'
,
'tree-sitter-scala.wasm'
,
]
.
map
(
=>
.
join
(
,
)
)
)
;
const
=
.
join
(
,
'sdk'
,
'ripgrep'
,
'bin'
)
;
const
:
string
[
]
=
[
]
;
for
(
const
of
)
{
if
(
.
startsWith
(
)
)
{
continue
;
}
const
=
.
basename
(
)
;
if
(
.
startsWith
(
'keytar'
)
||
.
startsWith
(
'clipboard'
)
)
{
continue
;
}
if
(
!
.
has
(
)
)
{
.
push
(
` Unexpected native binary found in Copilot CLI SDK: ${ path. relative ( copilotSDKPath, binary) } `
)
;
}
}
for
(
const
of
)
{
if
(
.
startsWith
(
)
)
{
continue
;
}
if
(
!
.
has
(
)
)
{
if
(
isNonCurrentCopilotPlatformBinary
(
,
)
||
isNonCurrentPvRecorderBinary
(
,
)
)
{
continue
;
}
.
push
(
` Expected native binary missing from Copilot CLI SDK: ${ path. relative ( copilotSDKPath, binary) } `
)
;
}
}
if
(
.
>
0
)
{
throw
new
Error
(
.
join
(
'\n'
)
)
;
}
}
,
30000
)
;
it
(
'should be able to load the @github/copilot module without errors'
,
async
function
(
)
{
await
import
(
'@github/copilot/sdk'
)
;
}
)
;
}
)
;
const
=
new
Set
(
[
'darwin-arm64'
,
'darwin-x64'
,
'linux-arm64'
,
'linux-x64'
,
'linuxmusl-arm64'
,
'linuxmusl-x64'
,
'win32-arm64'
,
'win32-x64'
,
]
)
;
function
currentCopilotPlatformArch
(
)
:
string
{
const
=
.
?.
getReport
(
)
as
{
?
:
{
?
:
string
}
}
|
undefined
;
if
(
.
===
'linux'
&&
!
?.
?.
)
{
return
` linuxmusl- ${ process. arch} `
;
}
return
` ${ process. platform} - ${ process. arch} `
;
}
function
isNonCurrentCopilotPlatformBinary
(
:
string
,
:
string
)
:
boolean
{
const
=
.
relative
(
,
)
.
split
(
.
)
;
const
=
.
find
(
=>
.
has
(
)
)
;
return
!==
undefined
&&
!==
currentCopilotPlatformArch
(
)
;
}
function
isNonCurrentPvRecorderBinary
(
:
string
,
:
string
)
:
boolean
{
const
=
.
relative
(
,
)
.
split
(
.
)
.
join
(
.
.
)
;
const
=
'pvrecorder/node_modules/@picovoice/pvrecorder-node/lib/'
;
if
(
!
.
startsWith
(
)
)
{
return
false
;
}
const
=
currentCopilotPlatformArch
(
)
;
if
(
.
startsWith
(
` ${ pvRecorderPrefix} mac/arm64/ `
)
)
{
return
!==
'darwin-arm64'
;
}
if
(
.
startsWith
(
` ${ pvRecorderPrefix} mac/x86_64/ `
)
)
{
return
!==
'darwin-x64'
;
}
if
(
.
startsWith
(
` ${ pvRecorderPrefix} linux/x86_64/ `
)
)
{
return
!==
'linux-x64'
&&
!==
'linuxmusl-x64'
;
}
if
(
.
startsWith
(
` ${ pvRecorderPrefix} windows/amd64/ `
)
)
{
return
!==
'win32-x64'
;
}
if
(
.
startsWith
(
` ${ pvRecorderPrefix} windows/arm64/ `
)
)
{
return
!==
'win32-arm64'
;
}
return
false
;
}
async
function
copyBinaries
(
:
string
)
{
const
=
.
join
(
,
'node_modules'
,
'@github'
,
'copilot'
)
;
const
=
.
join
(
,
'ripgrep'
,
'bin'
,
.
+
'-'
+
.
)
;
await
copyRipgrepShim
(
,
,
new
TestLogService
(
)
)
;
}
async
function
findAllBinaries
(
:
string
)
:
Promise
<
string
[
]
>
{
const
:
string
[
]
=
[
]
;
const
=
[
'.DS_Store'
]
;
async
function
findFilesRecursively
(
:
string
)
:
Promise
<
void
>
{
try
{
await
.
access
(
)
;
}
catch
{
return
;
}
const
=
await
.
readdir
(
,
{
:
true
}
)
;
await
Promise
.
all
(
.
map
(
async
(
)
=>
{
const
=
.
join
(
,
.
)
;
if
(
.
includes
(
.
)
)
{
return
;
}
if
(
.
isDirectory
(
)
)
{
await
findFilesRecursively
(
)
;
}
else
if
(
.
isFile
(
)
)
{
const
=
await
isBinaryFile
(
)
;
if
(
)
{
.
push
(
)
;
}
}
}
)
)
;
}
await
findFilesRecursively
(
)
;
return
;
}