Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Finds a Python binary that meets the minimum version requirement.
* Tries well-known candidates first, and if none are suitable,
* installs Python 3.12 via Homebrew.
*/
async
function
findSuitablePython
(
)
:
Promise
<
string
>
{
const
=
[
'python3'
,
'python3.12'
,
'python3.11'
,
'python3.10'
,
// Homebrew paths (Apple Silicon)
'/opt/homebrew/opt/python@3.12/bin/python3'
,
'/opt/homebrew/opt/python@3.11/bin/python3'
,
'/opt/homebrew/opt/python@3.10/bin/python3'
,
// Homebrew paths (Intel)
'/usr/local/opt/python@3.12/bin/python3'
,
'/usr/local/opt/python@3.11/bin/python3'
,
'/usr/local/opt/python@3.10/bin/python3'
,
]
;
for
(
const
of
)
{
if
(
await
checkPythonVersion
(
)
)
{
console
.
log
(
`Found suitable Python: ${candidate}`
)
;
return
;
}
}
console
.
log
(
`No Python >= ${MIN_PYTHON_VERSION[0]}.${MIN_PYTHON_VERSION[1]} found, installing via Homebrew...`
)
;
await
spawn
(
'brew'
,
[
'install'
,
'python@3.12'
]
,
{
:
'inherit'
,
:
{
...
.
,
HOMEBREW_NO_AUTO_UPDATE
:
'1'
,
HOMEBREW_NO_INSTALL_CLEANUP
:
'1'
}
}
)
;
// Use `brew --prefix` to reliably locate the installation
const
=
(
await
spawn
(
'brew'
,
[
'--prefix'
,
'python@3.12'
]
)
)
.
trim
(
)
;
const
=
.
join
(
,
'bin'
)
;
console
.
log
(
`Homebrew Python prefix: ${brewPrefix}`
)
;
// Try both python3 and python3.12 (keg-only formulae may only have the versioned name)
for
(
const
of
[
'python3'
,
'python3.12'
]
)
{
const
=
.
join
(
,
)
;
if
(
await
checkPythonVersion
(
)
)
{
console
.
log
(
`Using Homebrew Python: ${fullPath}`
)
;
return
;
}
}
throw
new
Error
(
`Could not find Python >= ${MIN_PYTHON_VERSION[0]}.${MIN_PYTHON_VERSION[1]} even after Homebrew install at ${brewPrefix}.`
)
;
}
async
function
ensureDmgBuild
(
)
:
Promise
<
void
>
{
const
=
getDmgBuildPath
(
)
;
const
=
getVenvPath
(
)
;
const
=
.
join
(
,
'.installed'
)
;
if
(
.
existsSync
(
)
)
{
console
.
log
(
'dmgbuild already installed, skipping setup'
)
;
return
;
}
console
.
log
(
'Setting up dmgbuild from GitHub...'
)
;
if
(
.
existsSync
(
)
)
{
.
rmSync
(
,
{
:
true
}
)
;
}
console
.
log
(
`Cloning dmgbuild from ${DMGBUILD_REPO} at ${DMGBUILD_COMMIT}...`
)
;
await
spawn
(
'git'
,
[
'clone'
,
DMGBUILD_REPO
,
]
,
{
:
'inherit'
}
)
;
await
spawn
(
'git'
,
[
'-C'
,
,
'checkout'
,
DMGBUILD_COMMIT
]
,
{
:
'inherit'
}
)
;
const
=
await
findSuitablePython
(
)
;
console
.
log
(
'Creating Python virtual environment...'
)
;
await
spawn
(
,
[
'-m'
,
'venv'
,
]
,
{
:
'inherit'
}
)
;
console
.
log
(
'Installing dmgbuild and dependencies into venv...'
)
;
const
=
.
join
(
,
'bin'
,
'pip'
)
;
await
spawn
(
,
[
'install'
,
]
,
{
:
'inherit'
}
)
;
.
writeFileSync
(
,
`Installed at ${newDate().toISOString()}\nCommit: ${DMGBUILD_COMMIT}\n`
)
;
console
.
log
(
'dmgbuild setup complete'
)
;
}
async
function
runDmgBuild
(
:
string
,
:
string
,
:
string
)
:
Promise
<
void
>
{
await
ensureDmgBuild
(
)
;
const
=
getPythonPath
(
)
;
await
spawn
(
,
[
'-m'
,
'dmgbuild'
,
'-s'
,
,
,
]
,
{
:
'inherit'
}
)
;
}
async
function
main
(
?
:
string
,
?
:
string
)
:
Promise
<
void
>
{
const
=
.
[
'VSCODE_ARCH'
]
;
const
=
.
[
'VSCODE_QUALITY'
]
;
if
(
!
)
{
throw
new
Error
(
'Build directory argument is required'
)
;
}
if
(
!
)
{
throw
new
Error
(
'$VSCODE_ARCH not set'
)
;
}
if
(
!
)
{
throw
new
Error
(
'Output directory argument is required'
)
;
}
const
=
.
join
(
,
`VSCode-darwin-${arch}`
)
;
const
=
.
+
'.app'
;
const
=
.
join
(
,
)
;
const
=
`VSCode-darwin-${arch}`
;
const
=
.
join
(
,
`${dmgName}.dmg`
)
;
const
=
.
join
(
import
.
.
,
`dmg-background-${quality}.tiff`
)
;
const
=
.
join
(
,
'resources'
,
'darwin'
,
'code.icns'
)
;
let
=
'Code OSS'
;
switch
(
)
{
case
'stable'
:
=
'VS Code'
;
break
;
case
'insider'
:
=
'VS Code Insiders'
;
break
;
case
'exploration'
:
=
'VS Code Exploration'
;
break
;
}
if
(
!
.
existsSync
(
)
)
{
throw
new
Error
(
`App path does not exist: ${appPath}`
)
;
}
console
.
log
(
`Creating DMG for ${product.nameLong}...`
)
;
console
.
log
(
` App path: ${appPath}`
)
;
console
.
log
(
` Output directory: ${outDir}`
)
;
console
.
log
(
` DMG name: ${dmgName}`
)
;
if
(
.
existsSync
(
)
)
{
.
unlinkSync
(
)
;
}
// Copy and process the settings template for dmgbuild
const
=
.
join
(
import
.
.
,
'dmg-settings.py.template'
)
;
const
=
.
join
(
,
'.dmg-settings.py'
)
;
let
=
.
readFileSync
(
,
'utf8'
)
;
=
.
replace
(
'{{VOLUME_NAME}}'
,
JSON
.
stringify
(
)
)
.
replace
(
'{{BADGE_ICON}}'
,
JSON
.
stringify
(
)
)
.
replace
(
'{{BACKGROUND}}'
,
JSON
.
stringify
(
)
)
.
replace
(
'{{APP_PATH}}'
,
JSON
.
stringify
(
)
)
.
replace
(
'{{APP_NAME}}'
,
JSON
.
stringify
(
.
+
'.app'
)
)
;
.
writeFileSync
(
,
)
;
try
{
await
runDmgBuild
(
,
,
)
;
}
finally
{
if
(
.
existsSync
(
)
)
{
.
unlinkSync
(
)
;
}
}
if
(
!
.
existsSync
(
)
)
{
throw
new
Error
(
`DMG was not created at expected path: ${artifactPath}`
)
;
}
const
=
.
statSync
(
)
;
console
.
log
(
`Successfully created DMG: ${artifactPath} (${(stats.size /1024/1024).toFixed(2)} MB)`