ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / build / copilot-migrate-pr.ts 609 строк · изменён 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
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
import { execFileSync } from 'child_process' ;
import * as path from 'path' ;
import * as fs from 'fs' ;
import * as os from 'os' ;
import { createInterface } from 'readline/promises' ;
import stdin input stdout output
prNumber
dryRun
verbose
Options
args process argv
prNumber
dryRun
verbose
arg args
arg
dryRun
arg
verbose
prNumber arg
prNumber arg
process
prNumber
process
prNumber dryRun verbose
message
message
message
message
message
output isTTY process env process env
text code enabled
enabled
text
verbose Logger
useColor
label
info useColor
detail useColor
step useColor
warn useColor
success useColor
message
message
verbose
message
message
message
question defaultNo
rl input output
suffix defaultNo
answer rl
answer
defaultNo
answer answer
rl
message
rl input output
rl
rl
args
args encoding maxBuffer
args cwd env NodeJS ProcessEnv
args
encoding
cwd
env env process env env process env
maxBuffer
repoRoot
repoRoot
repoRoot
ref repoRoot
ref repoRoot
prNumber
remote branchName repoRoot
remote branchName repoRoot
error
status error status status
status
error
title
body
baseRefName
headRefName
state
mergedAt
isDraft
author login
labels name
assignees login
prNumber PrMetadata
json
prNumber
json
prNumber
prNumber
name
email
date
sha
author CommitPerson
committer CommitPerson
prNumber SourceCommit
json
commits json
sha
commit
author CommitPerson
committer CommitPerson
commits commit
sha commit sha
author commit commit author
committer commit commit committer
sha
filesChanged
insertions
deletions
diff DiffStats
filesChanged
insertions
deletions
line diff
line
filesChanged
line line
insertions
line line
deletions
filesChanged
insertions
deletions
diff
lines diff
result
line lines
result line
result
line
diffGitMatch line
diffGitMatch
minusMatch line
minusMatch
plusMatch line
plusMatch
renameFromMatch line
renameFromMatch
renameToMatch line
renameToMatch
copyFromMatch line
copyFromMatch
copyToMatch line
copyToMatch
line
repoRoot
fs path repoRoot
repoRoot
unresolved repoRoot
unresolved
file unresolved
repoRoot
error
commit SourceCommit repoRoot
commit author commit committer
author commit author commit committer
committer commit committer commit author
author committer
author date
repoRoot
committer name
committer email
committer date
prNumber
commits SourceCommit
repoRoot
branchName prNumber
repoRoot
repoRoot
branchName repoRoot
branchName repoRoot
repoRoot
i i commits length i
commit commits i
patch commit sha
rewrittenPatch patch
tmpPatch path os
fs tmpPatch rewrittenPatch
tmpPatch repoRoot
repoRoot
repoRoot
fs tmpPatch
commit repoRoot
commits length
repoRoot
branchName
prNumber targetPrUrl
comment
prNumber
comment
branchName repoRoot
branchName repoRoot
meta PrMetadata branchName
migrationNote
body meta body
migrationNote
args
branchName
meta title
body
meta isDraft
args
assignee meta assignees
args assignee login
label meta labels
args label name
args
prNumber dryRun verbose
logger verbose
repoRoot path meta dirname
originalRef repoRoot
targetBranchName prNumber
shouldRestoreRef
logger
logger
dryRun
logger
targetBranchName repoRoot
logger
logger
meta prNumber
meta state
status meta mergedAt
logger
logger
logger
logger
logger
logger
logger
logger
commits prNumber
logger
logger
diff prNumber
diffStats diff
logger
logger
dryRun
logger
logger
branchName prNumber commits repoRoot
shouldRestoreRef
logger
logger
branchName repoRoot
logger
prUrl meta branchName
logger
closeOldPr
closeOldPr
prNumber prUrl
logger
error
logger
logger
shouldRestoreRef
logger
originalRef repoRoot
logger
error
logger
error
error error message error
process
{
as
,
as
}
from
'process'
;
const
SOURCE_REPO
=
'microsoft/vscode-copilot-chat'
;
const
TARGET_REPO
=
'microsoft/vscode'
;
const
PATH_PREFIX
=
'extensions/copilot'
;
interface
Options
{
:
number
;
:
boolean
;
:
boolean
;
}
function
parseArgs
(
)
:
{
const
=
.
.
slice
(
2
)
;
let
:
number
|
undefined
;
let
=
false
;
let
=
false
;
for
(
const
of
)
{
if
(
===
'--dry-run'
)
{
=
true
;
}
else
if
(
===
'--verbose'
)
{
=
true
;
}
else
if
(
!
&&
/ ^ \d + $ /
.
test
(
)
)
{
=
parseInt
(
,
10
)
;
}
else
{
console
.
error
(
` Unknown argument: ${ arg} `
)
;
.
exit
(
1
)
;
}
}
if
(
!
)
{
console
.
error
(
'Usage: node build/copilot-migrate-pr.ts <PR_NUMBER> [--dry-run] [--verbose]'
)
;
.
exit
(
1
)
;
}
return
{
,
,
}
;
}
interface
Logger
{
info
(
:
string
)
:
void
;
detail
(
:
string
)
:
void
;
step
(
:
string
)
:
void
;
warn
(
:
string
)
:
void
;
success
(
:
string
)
:
void
;
}
function
supportsColor
(
)
:
boolean
{
return
Boolean
(
.
)
&&
.
.
NO_COLOR
===
undefined
&&
.
.
TERM
!==
'dumb'
;
}
function
color
(
:
string
,
:
number
,
:
boolean
)
:
string
{
if
(
!
)
{
return
;
}
return
` \u001b[ ${ code} m ${ text} \u001b[0m `
;
}
function
createLogger
(
:
boolean
)
:
{
const
=
supportsColor
(
)
;
const
=
{
:
color
(
'[INFO]'
,
36
,
)
,
:
color
(
'[DETAIL]'
,
90
,
)
,
:
color
(
'[STEP]'
,
34
,
)
,
:
color
(
'[WARN]'
,
33
,
)
,
:
color
(
'[DONE]'
,
32
,
)
,
}
;
return
{
info
:
=>
console
.
log
(
` ${ label. info} ${ message} `
)
,
detail
:
=>
{
if
(
)
{
console
.
log
(
` ${ label. detail} ${ message} `
)
;
}
}
,
step
:
=>
console
.
log
(
` \n ${ label. step} ${ message} `
)
,
warn
:
=>
console
.
log
(
` ${ label. warn} ${ message} `
)
,
success
:
=>
console
.
log
(
` \n ${ label. success} ${ message} `
)
,
}
;
}
async
function
promptYesNo
(
:
string
,
=
true
)
:
Promise
<
boolean
>
{
const
=
createInterface
(
{
,
}
)
;
try
{
const
=
?
' [y/N]: '
:
' [Y/n]: '
;
const
=
(
await
.
question
(
` ${ question} ${ suffix} `
)
)
.
trim
(
)
.
toLowerCase
(
)
;
if
(
!
)
{
return
!
;
}
return
===
'y'
||
===
'yes'
;
}
finally
{
.
close
(
)
;
}
}
async
function
waitForEnter
(
:
string
)
:
Promise
<
void
>
{
const
=
createInterface
(
{
,
}
)
;
try
{
await
.
question
(
` ${ message} \nPress Enter to continue... `
)
;
}
finally
{
.
close
(
)
;
}
}
function
gh
(
:
string
[
]
)
:
string
{
return
execFileSync
(
'gh'
,
,
{
:
'utf-8'
,
:
50
*
1024
*
1024
}
)
;
}
function
git
(
:
string
[
]
,
?
:
string
,
?
:
.
)
:
string
{
return
execFileSync
(
'git'
,
,
{
:
'utf-8'
,
,
:
?
{
...
.
,
...
}
:
.
,
:
50
*
1024
*
1024
}
)
;
}
function
getCurrentRef
(
:
string
)
:
string
{
try
{
return
git
(
[
'symbolic-ref'
,
'--quiet'
,
'--short'
,
'HEAD'
]
,
)
.
trim
(
)
;
}
catch
{
return
git
(
[
'rev-parse'
,
'HEAD'
]
,
)
.
trim
(
)
;
}
}
function
checkoutRef
(
:
string
,
:
string
)
:
void
{
git
(
[
'checkout'
,
]
,
)
;
}
function
getMigrationBranchName
(
:
number
)
:
string
{
return
` vscode-copilot-chat/migrate- ${ prNumber} `
;
}
function
remoteBranchExists
(
:
string
,
:
string
,
:
string
)
:
boolean
{
try
{
git
(
[
'ls-remote'
,
'--exit-code'
,
'--heads'
,
,
]
,
)
;
return
true
;
}
catch
(
)
{
const
=
(
as
{
?
:
number
}
)
.
;
if
(
===
2
)
{
return
false
;
}
throw
;
}
}
interface
PrMetadata
{
:
string
;
:
string
;
:
string
;
:
string
;
:
string
;
:
string
|
null
;
:
boolean
;
number
:
number
;
:
{
:
string
}
;
:
{
:
string
}
[
]
;
:
{
:
string
}
[
]
;
}
function
fetchPrMetadata
(
:
number
)
:
{
const
=
gh
(
[
'pr'
,
'view'
,
String
(
)
,
'--repo'
,
SOURCE_REPO
,
'--json'
,
'title,body,baseRefName,headRefName,state,mergedAt,isDraft,number,author,labels,assignees'
,
]
)
;
return
JSON
.
parse
(
)
;
}
function
fetchPrDiff
(
:
number
)
:
string
{
return
gh
(
[
'pr'
,
'diff'
,
String
(
)
,
'--repo'
,
SOURCE_REPO
,
]
)
;
}
interface
CommitPerson
{
:
string
;
:
string
;
:
string
;
}
interface
SourceCommit
{
:
string
;
:
|
null
;
:
|
null
;
}
function
fetchPrCommits
(
:
number
)
:
[
]
{
const
=
gh
(
[
'api'
,
` repos/ ${ SOURCE_REPO } /pulls/ ${ prNumber} /commits `
,
'--paginate'
,
]
)
;
const
=
JSON
.
parse
(
)
as
Array
<
{
:
string
;
:
{
:
|
null
;
:
|
null
;
}
;
}
>
;
return
.
map
(
=>
(
{
:
.
,
:
.
.
,
:
.
.
,
}
)
)
;
}
function
fetchCommitPatch
(
:
string
)
:
string
{
return
gh
(
[
'api'
,
` repos/ ${ SOURCE_REPO } /commits/ ${ sha} `
,
'-H'
,
'Accept: application/vnd.github.patch'
,
]
)
;
}
interface
DiffStats
{
:
number
;
:
number
;
:
number
;
}
function
getDiffStats
(
:
string
)
:
{
let
=
0
;
let
=
0
;
let
=
0
;
for
(
const
of
.
split
(
'\n'
)
)
{
if
(
.
startsWith
(
'diff --git '
)
)
{
++
;
}
else
if
(
.
startsWith
(
'+'
)
&&
!
.
startsWith
(
'+++'
)
)
{
++
;
}
else
if
(
.
startsWith
(
'-'
)
&&
!
.
startsWith
(
'---'
)
)
{
++
;
}
}
return
{
,
,
,
}
;
}
function
rewriteDiff
(
:
string
)
:
string
{
const
=
.
split
(
'\n'
)
;
const
:
string
[
]
=
[
]
;
for
(
const
of
)
{
.
push
(
rewriteDiffLine
(
)
)
;
}
return
.
join
(
'\n'
)
;
}
function
rewriteDiffLine
(
:
string
)
:
string
{
const
=
.
match
(
/ ^ diff --git a\/ ( . + ) b\/ ( . + ) $ /
)
;
if
(
)
{
return
` diff --git a/ ${ PATH_PREFIX } / ${ diffGitMatch[ 1 ] } b/ ${ PATH_PREFIX } / ${ diffGitMatch[ 2 ] } `
;
}
const
=
.
match
(
/ ^ --- a\/ ( . + ) $ /
)
;
if
(
)
{
return
` --- a/ ${ PATH_PREFIX } / ${ minusMatch[ 1 ] } `
;
}
const
=
.
match
(
/ ^ \+ \+ \+ b\/ ( . + ) $ /
)
;
if
(
)
{
return
` +++ b/ ${ PATH_PREFIX } / ${ plusMatch[ 1 ] } `
;
}
const
=
.
match
(
/ ^ rename from ( . + ) $ /
)
;
if
(
)
{
return
` rename from ${ PATH_PREFIX } / ${ renameFromMatch[ 1 ] } `
;
}
const
=
.
match
(
/ ^ rename to ( . + ) $ /
)
;
if
(
)
{
return
` rename to ${ PATH_PREFIX } / ${ renameToMatch[ 1 ] } `
;
}
const
=
.
match
(
/ ^ copy from ( . + ) $ /
)
;
if
(
)
{
return
` copy from ${ PATH_PREFIX } / ${ copyFromMatch[ 1 ] } `
;
}
const
=
.
match
(
/ ^ copy to ( . + ) $ /
)
;
if
(
)
{
return
` copy to ${ PATH_PREFIX } / ${ copyToMatch[ 1 ] } `
;
}
return
;
}
function
hasActiveRebaseApply
(
:
string
)
:
boolean
{
return
.
existsSync
(
.
join
(
,
'.git'
,
'rebase-apply'
)
)
;
}
async
function
resolveAmConflicts
(
:
string
)
:
Promise
<
void
>
{
console
.
log
(
'\nA commit patch could not be applied cleanly.'
)
;
console
.
log
(
'Resolve merge conflicts in your working tree, stage the changes, and continue.'
)
;
for
(
;
;
)
{
await
waitForEnter
(
'After resolving conflicts and staging the changes, continue.'
)
;
const
=
git
(
[
'diff'
,
'--name-only'
,
'--diff-filter=U'
]
,
)
.
trim
(
)
;
if
(
)
{
console
.
log
(
'\nThese files still have unresolved conflicts:'
)
;
for
(
const
of
.
split
(
'\n'
)
)
{
console
.
log
(
` - ${ file} `
)
;
}
continue
;
}
try
{
git
(
[
'am'
,
'--continue'
]
,
)
;
break
;
}
catch
(
)
{
console
.
log
(
` \nCould not continue apply: ${ error instanceof Error ? error. message : String ( error) } `
)
;
console
.
log
(
'Fix any remaining issues, ensure all changes are staged, then try again.'
)
;
}
}
}
function
amendHeadCommitMetadata
(
:
,
:
string
)
:
void
{
if
(
!
.
&&
!
.
)
{
return
;
}
const
=
.
??
.
;
const
=
.
??
.
;
if
(
!
||
!
)
{
return
;
}
git
(
[
'commit'
,
'--amend'
,
'--no-edit'
,
'--author'
,
` ${ author. name} < ${ author. email} > `
,
'--date'
,
.
,
]
,
,
{
GIT_COMMITTER_NAME
:
.
,
GIT_COMMITTER_EMAIL
:
.
,
GIT_COMMITTER_DATE
:
.
,
}
)
;
}
async
function
createBranchAndApplyCommits
(
:
number
,
:
[
]
,
:
string
,
)
:
Promise
<
string
>
{
const
=
getMigrationBranchName
(
)
;
git
(
[
'checkout'
,
'main'
]
,
)
;
git
(
[
'pull'
,
'--ff-only'
,
'origin'
,
'main'
]
,
)
;
try
{
git
(
[
'checkout'
,
'-b'
,
]
,
)
;
}
catch
{
git
(
[
'checkout'
,
]
,
)
;
git
(
[
'reset'
,
'--hard'
,
'main'
]
,
)
;
}
for
(
let
=
0
;
<
.
;
++
)
{
const
=
[
]
;
const
=
fetchCommitPatch
(
.
)
;
const
=
rewriteDiff
(
)
;
const
=
.
join
(
.
tmpdir
(
)
,
` copilot-migrate-pr- ${ prNumber} - ${ i + 1 } .patch `
)
;
try
{
.
writeFileSync
(
,
)
;
try
{
git
(
[
'am'
,
'--3way'
,
]
,
)
;
}
catch
{
if
(
!
hasActiveRebaseApply
(
)
)
{
throw
new
Error
(
` Failed to apply commit ${ commit. sha} . `
)
;
}
await
resolveAmConflicts
(
)
;
}
}
finally
{
.
unlinkSync
(
)
;
}
amendHeadCommitMetadata
(
,
)
;
}
if
(
!
.
)
{
git
(
[
'commit'
,
'--allow-empty'
,
'-m'
,
` Migrate ${ SOURCE_REPO } # ${ prNumber} `
,
]
,
)
;
}
return
;
}
function
closeSourcePr
(
:
number
,
:
string
)
:
void
{
const
=
` Superseded by ${ targetPrUrl} `
;
gh
(
[
'pr'
,
'close'
,
String
(
)
,
'--repo'
,
SOURCE_REPO
,
'--comment'
,
,
]
)
;
}
function
pushBranch
(
:
string
,
:
string
)
:
void
{
git
(
[
'push'
,
'-u'
,
'origin'
,
,
'--force-with-lease'
]
,
)
;
}
function
createPr
(
:
,
:
string
)
:
string
{
const
=
[
` > Migrated from ${ SOURCE_REPO } # ${ meta. number } `
,
` > Original author: @ ${ meta. author. login} `
,
''
,
]
.
join
(
'\n'
)
;
const
=
.
?
` ${ migrationNote} \n---\n\n ${ meta. body} `
:
;
const
=
[
'pr'
,
'create'
,
'--repo'
,
TARGET_REPO
,
'--head'
,
,
'--base'
,
'main'
,
'--title'
,
.
,
'--body'
,
,
]
;
if
(
.
)
{
.
push
(
'--draft'
)
;
}
for
(
const
of
.
)
{
.
push
(
'--assignee'
,
.
)
;
}
for
(
const
of
.
)
{
.
push
(
'--label'
,
.
)
;
}
return
gh
(
)
.
trim
(
)
;
}
async
function
main
(
)
{
const
{
,
,
}
=
parseArgs
(
)
;
const
=
createLogger
(
)
;
const
=
.
dirname
(
import
.
.
)
;
const
=
getCurrentRef
(
)
;
const
=
getMigrationBranchName
(
)
;
let
=
false
;
try
{
.
info
(
` Migrating PR # ${ prNumber} from ${ SOURCE_REPO } to ${ TARGET_REPO } `
)
;
.
detail
(
` Starting ref: ${ originalRef} `
)
;
if
(
!
)
{
.
step
(
'Checking whether target branch already exists on origin'
)
;
if
(
remoteBranchExists
(
'origin'
,
,
)
)
{
throw
new
Error
(
` Remote branch already exists: origin/ ${ targetBranchName} . Delete it before rerunning. `
)
;
}
.
detail
(
` Target branch is available: origin/ ${ targetBranchName} `
)
;
}
.
step
(
'Fetching source PR metadata'
)
;
const
=
fetchPrMetadata
(
)
;
if
(
.
!==
'OPEN'
)
{
const
=
.
?
'merged'
:
'closed'
;
throw
new
Error
(
` Source PR # ${ prNumber} is ${ status} . Only open PRs can be migrated. `
)
;
}
.
info
(
` Title: ${ meta. title} `
)
;
.
detail
(
` Author: @ ${ meta. author. login} `
)
;
.
detail
(
` Base: ${ meta. baseRefName} -> Head: ${ meta. headRefName} `
)
;
.
detail
(
` State: ${ meta. state} `
)
;
.
detail
(
` Draft: ${ meta. isDraft} `
)
;
.
detail
(
` Labels: ${ meta. labels. map ( l => l. name) . join ( ', ' ) || '(none)' } `
)
;
.
detail
(
` Assignees: ${ meta. assignees. map ( a => a. login) . join ( ', ' ) || '(none)' } `
)
;
.
step
(
'Fetching source PR commits'
)
;
const
=
fetchPrCommits
(
)
;
.
info
(
` Commit count: ${ commits. length} `
)
;
.
step
(
'Fetching and rewriting diff'
)
;
const
=
fetchPrDiff
(
)
;
const
=
getDiffStats
(
)
;
.
detail
(
` Diff size: ${ diff. length} bytes `
)
;
.
info
(
` Diff stats: ${ diffStats. filesChanged} files changed, ${ diffStats. insertions} insertions(+), ${ diffStats. deletions} deletions(-) `
)
;
if
(
)
{
.
info
(
'Dry run: no changes were made.'
)
;
return
;
}
.
step
(
'Creating branch and applying commit series'
)
;
const
=
await
createBranchAndApplyCommits
(
,
,
)
;
=
true
;
.
info
(
` Branch: ${ branchName} `
)
;
.
step
(
'Pushing branch'
)
;
pushBranch
(
,
)
;
.
step
(
` Creating PR in ${ TARGET_REPO } `
)
;
const
=
createPr
(
,
)
;
.
success
(
` PR created: ${ prUrl} `
)
;
const
=
await
promptYesNo
(
` Close source PR # ${ prNumber} in ${ SOURCE_REPO } ? `
)
;
if
(
)
{
try
{
closeSourcePr
(
,
)
;
.
info
(
` Closed source PR # ${ prNumber} `
)
;
}
catch
(
)
{
.
warn
(
` Failed to close source PR # ${ prNumber} : ${ error instanceof Error ? error. message : String ( error) } `
)
;
}
}
else
{
.
info
(
` Left source PR # ${ prNumber} open `
)
;
}
}
finally
{
if
(
)
{
.
step
(
` Restoring original ref ( ${ originalRef} ) `
)
;
try
{
checkoutRef
(
,
)
;
.
info
(
` Checked out ${ originalRef} `
)
;
}
catch
(
)
{
.
warn
(
` Failed to restore original ref ${ originalRef} : ${ error instanceof Error ? error. message : String ( error) } `
)
;
}
}
}
}
main
(
)
.
catch
(
=>
{
console
.
error
(
instanceof
Error
?
.
:
String
(
)
)
;
.
exit
(
1
)
;
}
)
;