ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / test / scenario / src / evidence.ts 531 строк · изменён 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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
import type { Page } from '@playwright/test' ;
import * as fs from 'fs' ;
import * as path from 'path' ;
import { ApplicationService, getProductVersion, JSONValue } from './application' ;
const rootPath = path. join ( __dirname, '..' , '..' , '..' ) ;
const artifactRootPath = path. join ( rootPath, '.build' , 'vscode-playwright-mcp'
evidenceRootPath path artifactRootPath
logsRootPath path artifactRootPath
qualityNames
status StepStatus
timestamp
screenshot
windowUrl
details
blockedOn StepBlocker
id
title
captures EvidenceCapture
size
mtimeMs
id
state
scenarioId
title
source
scenarioPath
workspacePath
startedAt
videoStartedAt
completedAt
outcome RunOutcome
notes
runPath
videos Set path
pageListener page Page
logFilesBefore Map LogFileSnapshot
artifacts
report
videos
logs
finalizationError
environment
platform NodeJS Platform
architecture
nodeVersion
vscodeVersion
quality
commit
steps EvidenceStep
currentRun EvidenceRun
appService ApplicationService
scenarioId title source scenarioPath workspacePath userSettings Record JSONValue extraArgs
currentRun
appService application
source source
startedAt
id
runPath path evidenceRootPath id
fs runPath recursive
logFilesBefore logsRootPath file
stat fs file
file size stat size mtimeMs stat mtimeMs
releaseProfileCleanup
profileCleanupReady resolve releaseProfileCleanup resolve
appService profileCleanupReady
run EvidenceRun
id
state
scenarioId
title
source
scenarioPath
workspacePath
startedAt
runPath
videos
logFilesBefore
releaseProfileCleanup
artifacts videos logs
environment
platform process platform
architecture process arch
nodeVersion process version
vscodeVersion
quality
commit process env process env
steps
currentRun run
app Awaited ReturnType ApplicationService
app appService recordVideo workspacePath userSettings extraArgs
error
currentRun run
currentRun
appService
error
run environment quality qualityNames app quality app quality
app code driver videoStartedAt
run videoStartedAt app code driver videoStartedAt
run page
video page
video
run videos video
page app code driver
run page
app code driver browserContext run pageListener
app
run state
runPath
error
run pageListener
app code driver browserContext run pageListener
app
appService app
currentRun
run
appService
error
id title status StepStatus details blockedOn StepBlocker screenshot Buffer screenshotPath
run
run state
step run steps candidate candidate id id
isNewStep
status
step
activeStep run steps candidate candidate captures status
activeStep
step id title captures
run steps step
isNewStep
step status
activeStep run steps candidate candidate captures status
activeStep
step id title captures
run steps step
isNewStep
step step captures status
run state
screenshotName
app appService
app
run pageListener app code driver currentPage
screenshot Buffer
attempt attempt attempt
status
sequence run steps step
screenshotName
screenshot screenshotName
error
app appService
app attempt
error
run pageListener app code driver currentPage
screenshot screenshotName
step captures
status
timestamp
screenshot screenshotName
windowUrl app code driver currentPage
details
blockedOn
screenshot screenshotPath path run runPath screenshotName
error
isNewStep step captures length
run steps run steps step
screenshotName
fs path run runPath screenshotName force
error
currentRun run run state
run state
outcome RunOutcome notes
run
run state
activeStep run steps candidate candidate captures status
activeStep outcome
failedStep run steps candidate candidate captures status
failedStep outcome
outcome
notes notes Boolean
run state
app appService
outcome outcome outcome
closureNote
notes closureNote
notes notes closureNote Boolean
app
attempt attempt attempt
error
app appService
app
attempt
error
run completedAt
run outcome outcome
run notes notes
app
page app code driver
run pageListener page
app
appService app
error
appService
error
app
run outcome outcome
run notes notes
reportPath
run artifacts report path run runPath reportPath path sep
reportPath
error
message error error message error
run completedAt
run outcome
run artifacts finalizationError message
run notes notes Boolean
error
app appService application
app run pageListener
app code driver browserContext run pageListener
app
app
appService app
currentRun
run
appService
EvidenceRun
currentRun
currentRun
name Buffer
run
app appService application
app
screenshot app code driver
fs path run runPath name screenshot
screenshot
run
run videos size
index
video run videos
relativePath
destination path run runPath relativePath
fs path destination recursive
video destination
run artifacts videos relativePath
run
file logsRootPath
previous run logFilesBefore file
stat fs file
contents fs file
wasReplacedArchive path file previous mtimeMs stat mtimeMs
offset wasReplacedArchive previous size
contents length offset
relativeSource path logsRootPath file
relativeDestination path relativeSource
destination path run runPath relativeDestination
fs path destination recursive
fs destination contents offset
run artifacts logs relativeDestination path sep
run
manifest
id run id
scenarioId run scenarioId
title run title
source run source
scenarioPath run scenarioPath
workspacePath run workspacePath
startedAt run startedAt
videoStartedAt run videoStartedAt
completedAt run completedAt
outcome run outcome
notes run notes
environment run environment
artifacts run artifacts
steps run steps
fs path run runPath manifest
run
rows run steps step
result step captures
screenshots step captures capture
blocker result blockedOn
blocked run steps
step step capture step captures
entry entry step EvidenceStep capture EvidenceCapture entry capture blockedOn
blockedSection blocked length
videoElements run artifacts videos length
run artifacts videos video
logs run artifacts logs log
html
reportPath path run runPath
fs reportPath html
reportPath
value
sanitized value
sanitized
directory
fs directory
fs directory withFileTypes entry
entryPath path directory entry name
entry entryPath entryPath
value
value
milliseconds
resolve resolve milliseconds
value
protocol value protocol
protocol protocol
)
;
const
=
.
join
(
,
'evidence'
)
;
const
=
.
join
(
,
'logs'
)
;
const
=
[
'Dev'
,
'Insiders'
,
'Stable'
,
'Exploration'
,
'OSS'
]
;
export
type
StepStatus
=
'started'
|
'passed'
|
'failed'
|
'skipped'
;
export
type
StepBlocker
=
'human'
|
'infrastructure'
;
export
type
RunOutcome
=
'passed'
|
'failed'
|
'aborted'
;
interface
EvidenceCapture
{
:
;
:
string
;
:
string
;
:
string
;
?
:
string
;
?
:
;
}
interface
EvidenceStep
{
:
string
;
:
string
;
:
[
]
;
}
interface
LogFileSnapshot
{
:
number
;
:
number
;
}
interface
EvidenceRun
{
:
string
;
:
'initializing'
|
'active'
|
'capturing'
|
'finishing'
;
:
string
;
:
string
;
?
:
string
;
?
:
string
;
?
:
string
;
:
string
;
?
:
string
;
?
:
string
;
?
:
;
?
:
string
;
:
string
;
:
<
{
saveAs
(
:
string
)
:
Promise
<
void
>
}
>
;
?
:
(
:
)
=>
void
;
:
<
string
,
>
;
releaseProfileCleanup
:
(
)
=>
void
;
:
{
?
:
string
;
:
string
[
]
;
:
string
[
]
;
?
:
string
;
}
;
:
{
:
.
;
:
string
;
:
string
;
:
string
;
:
string
;
?
:
string
;
}
;
:
[
]
;
}
export
class
EvidenceService
{
private
:
|
undefined
;
constructor
(
private
readonly
:
)
{
}
async
start
(
:
string
,
:
string
,
?
:
string
,
?
:
string
,
?
:
string
,
?
:
<
string
,
>
,
?
:
string
[
]
)
:
Promise
<
string
>
{
if
(
this
.
)
{
throw
new
Error
(
` Evidence run ' ${ this . currentRun. id} ' is already active. `
)
;
}
if
(
this
.
.
)
{
throw
new
Error
(
'Stop the existing VS Code instance before starting evidence capture so video recording can be enabled at launch.'
)
;
}
if
(
&&
!
isHttpUrl
(
)
)
{
throw
new
Error
(
` Evidence source must use HTTP or HTTPS: ' ${ source} '. `
)
;
}
const
=
new
Date
(
)
.
toISOString
(
)
;
const
=
` ${ sanitizePathSegment ( scenarioId) } - ${ startedAt. replace ( / [ :.] / g , '-' ) } `
;
const
=
.
join
(
,
)
;
.
mkdirSync
(
,
{
:
true
}
)
;
const
=
new
Map< string , LogFileSnapshot>
(
listFiles
(
)
.
map
(
=>
{
const
=
.
statSync
(
)
;
return
[
,
{
:
.
,
:
.
}
]
;
}
)
)
;
let
!
:
(
)
=>
void
;
const
=
new
Promise < void >
(
=>
=
)
;
this
.
.
deferProfileCleanup
(
)
;
const
:
=
{
,
:
'initializing'
,
,
,
,
,
,
,
,
:
new
Set
(
)
,
,
,
:
{
:
[
]
,
:
[
]
}
,
:
{
:
.
,
:
.
,
:
.
,
:
getProductVersion
(
)
,
:
'unknown'
,
:
.
.
GITHUB_SHA
??
.
.
BUILD_SOURCEVERSION
}
,
:
[
]
}
;
this
.
=
;
let
:
<
<
[
'getOrCreateApplication'
]
>>
;
try
{
=
await
this
.
.
getOrCreateApplication
(
{
:
true
,
,
,
}
)
;
}
catch
(
)
{
if
(
this
.
===
)
{
this
.
=
undefined
;
}
releaseProfileCleanup
(
)
;
await
this
.
.
waitForProfileCleanup
(
)
;
throw
;
}
.
.
=
[
.
]
??
String
(
.
)
;
if
(
.
.
.
!==
undefined
)
{
.
=
new
Date
(
.
.
.
)
.
toISOString
(
)
;
}
try
{
.
pageListener
=
=>
{
const
=
.
video
(
)
;
if
(
)
{
.
.
add
(
)
;
}
}
;
for
(
const
of
.
.
.
getAllWindows
(
)
)
{
.
pageListener
(
)
;
}
.
.
.
.
on
(
'page'
,
.
)
;
await
.
startTracing
(
)
;
await
wait
(
500
)
;
await
this
.
capture
(
'00-scenario-started.png'
)
;
this
.
writeManifest
(
)
;
.
=
'active'
;
return
;
}
catch
(
)
{
try
{
if
(
.
)
{
.
?.
.
.
off
(
'page'
,
.
)
;
}
}
catch
{
}
try
{
await
.
stopTracing
(
undefined
,
true
)
;
await
this
.
.
stopApplication
(
)
;
}
catch
{
}
finally
{
this
.
=
undefined
;
.
releaseProfileCleanup
(
)
;
await
this
.
.
waitForProfileCleanup
(
)
;
}
throw
;
}
}
async
step
(
:
string
,
:
string
,
:
,
?
:
string
,
?
:
)
:
Promise
<
{
:
;
:
string
}
>
{
const
=
this
.
requireRun
(
)
;
if
(
.
!==
'active'
)
{
throw
new
Error
(
` Evidence run ' ${ run. id} ' is busy ( ${ run. state} ). `
)
;
}
let
=
.
.
find
(
=>
.
===
)
;
let
=
false
;
if
(
===
'started'
)
{
if
(
)
{
throw
new
Error
(
` Step ' ${ id} ' has already started. `
)
;
}
const
=
.
.
find
(
=>
.
.
at
(
-
1
)
?.
===
'started'
)
;
if
(
)
{
throw
new
Error
(
` Step ' ${ activeStep. id} ' is still active. Mark it passed or failed before starting ' ${ id} '. `
)
;
}
=
{
,
,
:
[
]
}
;
.
.
push
(
)
;
=
true
;
}
else
if
(
!
&&
===
'skipped'
)
{
const
=
.
.
find
(
=>
.
.
at
(
-
1
)
?.
===
'started'
)
;
if
(
)
{
throw
new
Error
(
` Step ' ${ activeStep. id} ' is still active. Complete it before skipping ' ${ id} '. `
)
;
}
=
{
,
,
:
[
]
}
;
.
.
push
(
)
;
=
true
;
}
else
if
(
!
||
.
.
at
(
-
1
)
?.
!==
'started'
)
{
throw
new
Error
(
` Step ' ${ id} ' must be started before it can be marked ' ${ status} '. `
)
;
}
.
=
'capturing'
;
let
:
string
|
undefined
;
try
{
let
=
await
this
.
.
getApplicationIfRunning
(
)
;
if
(
!
)
{
throw
new
Error
(
'VS Code is not running. Finish the evidence run as aborted or failed.'
)
;
}
.
?.
(
.
.
.
)
;
let
:
|
undefined
;
for
(
let
=
0
;
<
2
;
++
)
{
try
{
await
wait
(
===
'started'
?
500
:
250
)
;
const
=
String
(
.
.
indexOf
(
)
+
1
)
.
padStart
(
2
,
'0'
)
;
=
` ${ sequence} - ${ sanitizePathSegment ( id) } - ${ status} .png `
;
=
await
this
.
capture
(
)
;
break
;
}
catch
(
)
{
=
await
this
.
.
getApplicationIfRunning
(
)
;
if
(
!
||
===
1
)
{
throw
;
}
.
?.
(
.
.
.
)
;
}
}
if
(
!
||
!
)
{
throw
new
Error
(
` Failed to capture evidence for step ' ${ id} '. `
)
;
}
.
.
push
(
{
,
:
new
Date
(
)
.
toISOString
(
)
,
:
,
:
.
.
.
.
url
(
)
,
,
}
)
;
this
.
writeManifest
(
)
;
return
{
,
:
.
join
(
.
,
)
}
;
}
catch
(
)
{
if
(
&&
!
.
.
)
{
.
.
splice
(
.
.
indexOf
(
)
,
1
)
;
if
(
)
{
try
{
.
rmSync
(
.
join
(
.
,
)
,
{
:
true
}
)
;
}
catch
{
}
}
}
throw
;
}
finally
{
if
(
this
.
===
&&
.
===
'capturing'
)
{
.
=
'active'
;
}
}
}
async
finish
(
:
,
?
:
string
)
:
Promise
<
string
>
{
const
=
this
.
requireRun
(
)
;
if
(
.
!==
'active'
)
{
throw
new
Error
(
` Evidence run ' ${ run. id} ' is busy ( ${ run. state} ). `
)
;
}
const
=
.
.
find
(
=>
.
.
at
(
-
1
)
?.
===
'started'
)
;
if
(
&&
!==
'aborted'
)
{
throw
new
Error
(
` Step ' ${ activeStep. id} ' is still active. Complete it before finishing the run. `
)
;
}
const
=
.
.
find
(
=>
.
.
at
(
-
1
)
?.
===
'failed'
)
;
if
(
&&
===
'passed'
)
{
=
'failed'
;
=
[
,
` Run marked failed because step ' ${ failedStep. id} ' failed. `
]
.
filter
(
)
.
join
(
'\n'
)
;
}
.
=
'finishing'
;
try
{
let
=
await
this
.
.
getApplicationIfRunning
(
)
;
const
recordApplicationClosure
=
(
)
=>
{
=
===
'passed'
?
'failed'
:
;
const
=
'VS Code closed before evidence capture was finalized.'
;
if
(
!
?.
includes
(
)
)
{
=
[
,
]
.
filter
(
)
.
join
(
'\n'
)
;
}
}
;
if
(
)
{
for
(
let
=
0
;
<
2
;
++
)
{
try
{
await
wait
(
500
)
;
await
this
.
capture
(
` 99-result- ${ outcome} .png `
)
;
break
;
}
catch
(
)
{
=
await
this
.
.
getApplicationIfRunning
(
)
;
if
(
!
)
{
recordApplicationClosure
(
)
;
break
;
}
if
(
===
1
)
{
throw
;
}
}
}
}
else
{
recordApplicationClosure
(
)
;
}
.
=
new
Date
(
)
.
toISOString
(
)
;
.
=
;
.
=
;
this
.
writeManifest
(
)
;
if
(
)
{
try
{
for
(
const
of
.
.
.
getAllWindows
(
)
)
{
.
?.
(
)
;
}
await
.
stopTracing
(
undefined
,
true
)
;
await
this
.
.
stopApplication
(
)
;
}
catch
(
)
{
if
(
await
this
.
.
getApplicationIfRunning
(
)
)
{
throw
;
}
=
undefined
;
recordApplicationClosure
(
)
;
.
=
;
.
=
;
this
.
writeManifest
(
)
;
}
}
await
this
.
saveVideo
(
)
;
this
.
copyLogArtifacts
(
)
;
const
=
this
.
writeReport
(
)
;
.
.
=
.
relative
(
.
,
)
.
replaceAll
(
.
,
'/'
)
;
this
.
writeManifest
(
)
;
return
;
}
catch
(
)
{
const
=
instanceof
Error
?
.
:
String
(
)
;
.
??=
new
Date
(
)
.
toISOString
(
)
;
.
=
'failed'
;
.
.
=
;
.
=
[
,
` Evidence finalization failed: ${ message} `
]
.
filter
(
)
.
join
(
'\n'
)
;
try
{
this
.
writeManifest
(
)
;
}
catch
{
}
throw
;
}
finally
{
const
=
this
.
.
;
if
(
&&
.
)
{
.
.
.
.
off
(
'page'
,
.
)
;
}
try
{
if
(
)
{
await
.
stopTracing
(
undefined
,
true
)
;
await
this
.
.
stopApplication
(
)
;
}
}
catch
{
}
this
.
=
undefined
;
.
releaseProfileCleanup
(
)
;
await
this
.
.
waitForProfileCleanup
(
)
;
}
}
private
requireRun
(
)
:
{
if
(
!
this
.
)
{
throw
new
Error
(
'No evidence run is active. Start one before recording steps.'
)
;
}
return
this
.
;
}
private
async
capture
(
:
string
)
:
Promise
<
>
{
const
=
this
.
requireRun
(
)
;
const
=
this
.
.
;
if
(
!
)
{
throw
new
Error
(
'VS Code is not running.'
)
;
}
const
=
await
.
.
.
screenshotBuffer
(
false
)
;
.
writeFileSync
(
.
join
(
.
,
)
,
)
;
return
;
}
private
async
saveVideo
(
)
:
Promise
<
void
>
{
const
=
this
.
requireRun
(
)
;
if
(
!
.
.
)
{
return
;
}
let
=
0
;
for
(
const
of
.
)
{
const
=
` videos/recording- ${ ++ index} .webm `
;
const
=
.
join
(
.
,
)
;
.
mkdirSync
(
.
dirname
(
)
,
{
:
true
}
)
;
await
.
saveAs
(
)
;
.
.
.
push
(
)
;
}
}
private
copyLogArtifacts
(
)
:
void
{
const
=
this
.
requireRun
(
)
;
for
(
const
of
listFiles
(
)
)
{
const
=
.
.
get
(
)
;
const
=
.
statSync
(
)
;
const
=
.
readFileSync
(
)
;
const
=
.
extname
(
)
.
toLowerCase
(
)
===
'.zip'
&&
?.
!==
.
;
const
=
?
0
:
?.
??
0
;
if
(
.
<=
)
{
continue
;
}
const
=
.
relative
(
,
)
;
const
=
.
join
(
'logs'
,
)
;
const
=
.
join
(
.
,
)
;
.
mkdirSync
(
.
dirname
(
)
,
{
:
true
}
)
;
.
writeFileSync
(
,
.
subarray
(
)
)
;
.
.
.
push
(
.
replaceAll
(
.
,
'/'
)
)
;
}
}
private
writeManifest
(
)
:
void
{
const
=
this
.
requireRun
(
)
;
const
=
{
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
}
;
.
writeFileSync
(
.
join
(
.
,
'manifest.json'
)
,
JSON
.
stringify
(
,
undefined
,
2
)
)
;
}
private
writeReport
(
)
:
string
{
const
=
this
.
requireRun
(
)
;
const
=
.
.
map
(
=>
{
const
=
.
.
at
(
-
1
)
;
const
=
.
.
map
(
=>
` <a href=" ${ escapeHtml ( capture. screenshot) } "> ${ escapeHtml ( capture. status) } </a> `
)
.
join
(
', '
)
;
const
=
?.
?
` <span class="blocked">(needs ${ escapeHtml ( result. blockedOn) } )</span> `
:
''
;
return
` <tr><td> ${ escapeHtml ( step. id) } </td><td> ${ escapeHtml ( step. title) } </td><td class=" ${ escapeHtml ( result?. status ?? '' ) } "> ${ escapeHtml ( result?. status ?? 'unknown' ) } ${ blocker} </td><td> ${ screenshots} </td><td> ${ escapeHtml ( result?. details ?? '' ) } </td></tr> `
;
}
)
.
join
(
''
)
;
const
=
.
.
map
(
=>
(
{
,
:
.
.
at
(
-
1
)
}
)
)
.
filter
(
(
)
:
is
{
:
;
:
}
=>
!
!
.
?.
)
;
const
=
.
?
` <h2>Needs attention</h2><ul> ${ blocked. map ( ( { step, capture } ) =>
` <li><strong> ${ escapeHtml ( step. id) } </strong> needs ${ escapeHtml ( capture. blockedOn ?? '' ) } : ${ escapeHtml ( capture. details ?? '' ) } </li> ` ) . join ( '' ) } </ul> `
:
''
;
const
=
.
.
.
?
.
.
.
map
(
=>
` <video controls src=" ${ escapeHtml ( video) } "></video> `
)
.
join
(
''
)
:
'<p>No video file was produced.</p>'
;
const
=
.
.
.
map
(
=>
` <li><a href=" ${ escapeHtml ( log) } "> ${ escapeHtml ( log) } </a></li> `
)
.
join
(
''
)
;
const
=
` <!doctype html>
<html lang="en"><head><meta charset="utf-8"><title> ${ escapeHtml ( run. title) } </title>
<style>body{font:14px system-ui;margin:32px;max-width:1200px}table{border-collapse:collapse;width:100%}th,td{border:1px solid #bbb;padding:8px;text-align:left}th{background:#eee}video{display:block;max-width:100%;margin:16px 0}.passed{color:#187b34}.failed{color:#b42318}.skipped{color:#8a6100}.blocked{color:#8a6100;font-weight:600}</style></head>
<body><h1> ${ escapeHtml ( run. title) } </h1><p><strong>Scenario:</strong> ${ escapeHtml ( run. scenarioId) } <br><strong>Outcome:</strong> <span class=" ${ escapeHtml ( run. outcome ?? '' ) } "> ${ escapeHtml ( run. outcome ?? 'unknown' ) } </span><br><strong>Started:</strong> ${ escapeHtml ( run. startedAt) } <br><strong>Completed:</strong> ${ escapeHtml ( run. completedAt ?? '' ) } </p>
<p><strong>Source:</strong> ${ run. source ? ` <a href=" ${ escapeHtml ( run. source) } "> ${ escapeHtml ( run. source) } </a> ` : 'Not recorded' } <br><strong>Workspace:</strong> ${ escapeHtml ( run. workspacePath ?? 'Not specified' ) } <br><strong>Environment:</strong> ${ escapeHtml ( ` ${ run. environment. platform} ${ run. environment. architecture} ; VS Code ${ run. environment. vscodeVersion} ( ${ run. environment. quality} ); Node ${ run. environment. nodeVersion} ; commit ${ run. environment. commit ?? 'unknown' } ` ) } </p>
<p> ${ escapeHtml ( run. notes ?? '' ) } </p><h2>Steps</h2><table><thead><tr><th>ID</th><th>Title</th><th>Result</th><th>Screenshots</th><th>Details</th></tr></thead><tbody> ${ rows} </tbody></table>
${ blockedSection} <h2>Video</h2> ${ videoElements} <h2>Trace and logs</h2> ${ logs ? ` <ul> ${ logs} </ul> ` : '<p>No new trace or log content was produced.</p>' } </body></html> `
;
const
=
.
join
(
.
,
'report.html'
)
;
.
writeFileSync
(
,
)
;
return
;
}
}
function
sanitizePathSegment
(
:
string
)
:
string
{
const
=
.
trim
(
)
.
replace
(
/ [ ^ a- z A- Z 0- 9 ._-] + / g
,
'-'
)
.
replace
(
/ ^ -+ | -+ $ / g
,
''
)
;
return
||
'unnamed'
;
}
function
listFiles
(
:
string
)
:
string
[
]
{
if
(
!
.
existsSync
(
)
)
{
return
[
]
;
}
return
.
readdirSync
(
,
{
:
true
}
)
.
flatMap
(
=>
{
const
=
.
join
(
,
.
)
;
return
.
isDirectory
(
)
?
listFiles
(
)
:
[
]
;
}
)
;
}
function
escapeHtml
(
:
string
)
:
string
{
return
.
replaceAll
(
'&'
,
'&'
)
.
replaceAll
(
'<'
,
'<'
)
.
replaceAll
(
'>'
,
'>'
)
.
replaceAll
(
'"'
,
'"'
)
.
replaceAll
(
'\''
,
'''
)
;
}
function
wait
(
:
number
)
:
Promise
<
void
>
{
return
new
Promise
(
=>
setTimeout
(
,
)
)
;
}
function
isHttpUrl
(
:
string
)
:
boolean
{
try
{
const
=
new
URL
(
)
.
;
return
===
'http:'
||
===
'https:'
;
}
catch
{
return
false
;
}
}