@hanzo/dev 3.0.11 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +493 -36
- package/bin/{dev.js → coder.js} +95 -38
- package/bin/codex.js +197 -0
- package/package.json +11 -11
- package/postinstall.js +501 -442
- package/scripts/preinstall.js +5 -5
- package/scripts/windows-cleanup.ps1 +7 -6
package/scripts/preinstall.js
CHANGED
|
@@ -22,8 +22,8 @@ const isWinLike = isWin || wsl;
|
|
|
22
22
|
|
|
23
23
|
// Scope: only run for global installs, unless explicitly forced. Allow opt-out.
|
|
24
24
|
const isGlobal = process.env.npm_config_global === 'true';
|
|
25
|
-
const force = process.env.
|
|
26
|
-
const skip = process.env.
|
|
25
|
+
const force = process.env.CODE_FORCE_PREINSTALL === '1';
|
|
26
|
+
const skip = process.env.CODE_SKIP_PREINSTALL === '1';
|
|
27
27
|
if (!isWinLike || skip || (!isGlobal && !force)) process.exit(0);
|
|
28
28
|
|
|
29
29
|
function tryExec(cmd, opts = {}) {
|
|
@@ -33,11 +33,11 @@ function tryExec(cmd, opts = {}) {
|
|
|
33
33
|
// 1) Stop our native binary if it is holding locks. Avoid killing unrelated tools.
|
|
34
34
|
// Only available on native Windows; skip entirely on WSL to avoid noise.
|
|
35
35
|
if (isWin) {
|
|
36
|
-
tryExec('taskkill /IM
|
|
36
|
+
tryExec('taskkill /IM code-x86_64-pc-windows-msvc.exe /F');
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// 2) Remove stale staging dirs from previous failed installs under the global
|
|
40
|
-
// @hanzo scope, which npm will reuse (e.g., .
|
|
40
|
+
// @hanzo scope, which npm will reuse (e.g., .code-XXXXX). Remove only
|
|
41
41
|
// old entries and never the current staging or live package.
|
|
42
42
|
try {
|
|
43
43
|
let scopeDir = '';
|
|
@@ -54,7 +54,7 @@ try {
|
|
|
54
54
|
const maxAgeMs = 2 * 60 * 60 * 1000; // 2 hours
|
|
55
55
|
const currentDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
56
56
|
for (const name of readdirSync(scopeDir)) {
|
|
57
|
-
if (!name.startsWith('.
|
|
57
|
+
if (!name.startsWith('.code-')) continue;
|
|
58
58
|
const p = path.join(scopeDir, name);
|
|
59
59
|
if (path.resolve(p) === currentDir) continue; // never remove our current dir
|
|
60
60
|
try {
|
|
@@ -4,15 +4,15 @@ Closes running processes and removes stale package folders.
|
|
|
4
4
|
|
|
5
5
|
Usage (PowerShell):
|
|
6
6
|
Set-ExecutionPolicy -Scope Process Bypass -Force
|
|
7
|
-
./
|
|
7
|
+
./codex-cli/scripts/windows-cleanup.ps1
|
|
8
8
|
#>
|
|
9
9
|
|
|
10
10
|
$ErrorActionPreference = 'SilentlyContinue'
|
|
11
11
|
|
|
12
|
-
Write-Host "Stopping running
|
|
13
|
-
taskkill /IM
|
|
14
|
-
taskkill /IM
|
|
15
|
-
taskkill /IM
|
|
12
|
+
Write-Host "Stopping running Code/Coder processes..."
|
|
13
|
+
taskkill /IM code-x86_64-pc-windows-msvc.exe /F 2>$null | Out-Null
|
|
14
|
+
taskkill /IM code.exe /F 2>$null | Out-Null
|
|
15
|
+
taskkill /IM coder.exe /F 2>$null | Out-Null
|
|
16
16
|
|
|
17
17
|
Write-Host "Removing old global package (if present)..."
|
|
18
18
|
$npmRoot = (& npm root -g).Trim()
|
|
@@ -23,9 +23,10 @@ if (Test-Path $pkgPath) {
|
|
|
23
23
|
|
|
24
24
|
Write-Host "Removing temp staging directories (if present)..."
|
|
25
25
|
Get-ChildItem -LiteralPath (Join-Path $npmRoot "@hanzo") -Force -ErrorAction SilentlyContinue |
|
|
26
|
-
Where-Object { $_.Name -like '.
|
|
26
|
+
Where-Object { $_.Name -like '.code-*' } |
|
|
27
27
|
ForEach-Object {
|
|
28
28
|
try { Remove-Item -LiteralPath $_.FullName -Recurse -Force -ErrorAction Stop } catch {}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
Write-Host "Cleanup complete. You can now run: npm install -g @hanzo/dev@latest"
|
|
32
|
+
|