@yemi33/minions 0.1.740 → 0.1.741
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/CHANGELOG.md +4 -1
- package/engine/shared.js +55 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.1.
|
|
3
|
+
## 0.1.741 (2026-04-09)
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
- add prNumber field to pull-requests.json records (#711)
|
|
7
7
|
|
|
8
|
+
### Fixes
|
|
9
|
+
- handle NUL pseudo-file in Windows worktree cleanup (#731)
|
|
10
|
+
|
|
8
11
|
## 0.1.739 (2026-04-09)
|
|
9
12
|
|
|
10
13
|
### Fixes
|
package/engine/shared.js
CHANGED
|
@@ -857,8 +857,49 @@ function mutatePullRequests(filePath, mutator) {
|
|
|
857
857
|
* Remove a git worktree, falling back to fs.rmSync if git fails (e.g., locked on Windows).
|
|
858
858
|
* Only removes directories under worktreeRoot to prevent accidental deletion.
|
|
859
859
|
* Tracks persistent failures to avoid retrying locked paths every cleanup cycle.
|
|
860
|
+
*
|
|
861
|
+
* On Windows, reserved device-name files (NUL, CON, PRN, AUX, etc.) can appear in
|
|
862
|
+
* worktree directories when shell redirections run under Git Bash/WSL. These block
|
|
863
|
+
* git worktree remove, fs.rmSync, and PowerShell Remove-Item. Two mitigations:
|
|
864
|
+
* 1. _purgeReservedFiles() deletes them via the \\?\ extended path prefix before removal
|
|
865
|
+
* 2. cmd /c rd /s /q as final fallback handles any remaining reserved names
|
|
860
866
|
*/
|
|
861
867
|
const _removeWorktreeFailures = new Map(); // path → { count, lastAttempt }
|
|
868
|
+
|
|
869
|
+
// Windows reserved device names that cannot be deleted via normal paths
|
|
870
|
+
const _WIN_RESERVED_NAMES = new Set([
|
|
871
|
+
'CON', 'PRN', 'AUX', 'NUL',
|
|
872
|
+
'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9',
|
|
873
|
+
'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9',
|
|
874
|
+
]);
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Recursively purge Windows reserved-name pseudo-files (NUL, CON, PRN, AUX, etc.)
|
|
878
|
+
* using the \\?\ extended path prefix that bypasses reserved-name interpretation.
|
|
879
|
+
* Called before normal deletion attempts on Windows to unblock git/fs operations.
|
|
880
|
+
*/
|
|
881
|
+
function _purgeReservedFiles(dirPath) {
|
|
882
|
+
let entries;
|
|
883
|
+
try { entries = fs.readdirSync(dirPath, { withFileTypes: true }); } catch { return; }
|
|
884
|
+
for (const entry of entries) {
|
|
885
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
886
|
+
try {
|
|
887
|
+
if (entry.isDirectory()) {
|
|
888
|
+
_purgeReservedFiles(fullPath);
|
|
889
|
+
} else {
|
|
890
|
+
// Match NUL, NUL.txt, con, con.log, etc.
|
|
891
|
+
const baseName = entry.name.toUpperCase().split('.')[0];
|
|
892
|
+
if (_WIN_RESERVED_NAMES.has(baseName)) {
|
|
893
|
+
// \\?\ prefix bypasses Win32 reserved-name interpretation
|
|
894
|
+
fs.unlinkSync('\\\\?\\' + fullPath);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
} catch {
|
|
898
|
+
// Best-effort: file may already be gone or inaccessible
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
862
903
|
function removeWorktree(wtPath, gitRoot, worktreeRoot) {
|
|
863
904
|
const resolved = path.resolve(wtPath);
|
|
864
905
|
const resolvedRoot = path.resolve(worktreeRoot) + path.sep;
|
|
@@ -870,6 +911,11 @@ function removeWorktree(wtPath, gitRoot, worktreeRoot) {
|
|
|
870
911
|
const prior = _removeWorktreeFailures.get(resolved);
|
|
871
912
|
if (prior && prior.count >= 3 && Date.now() - prior.lastAttempt < 3600000) return false;
|
|
872
913
|
|
|
914
|
+
// Windows: purge reserved-name pseudo-files (NUL, CON, etc.) that block normal deletion
|
|
915
|
+
if (process.platform === 'win32') {
|
|
916
|
+
_purgeReservedFiles(resolved);
|
|
917
|
+
}
|
|
918
|
+
|
|
873
919
|
try {
|
|
874
920
|
exec(`git worktree remove "${wtPath}" --force`, { cwd: gitRoot, stdio: 'pipe', timeout: 15000, windowsHide: true });
|
|
875
921
|
_removeWorktreeFailures.delete(resolved);
|
|
@@ -881,14 +927,17 @@ function removeWorktree(wtPath, gitRoot, worktreeRoot) {
|
|
|
881
927
|
_removeWorktreeFailures.delete(resolved);
|
|
882
928
|
return true;
|
|
883
929
|
} catch (rmErr) {
|
|
884
|
-
// Windows
|
|
885
|
-
|
|
930
|
+
// Windows: try cmd /c rd /s /q for any error — handles reserved device names,
|
|
931
|
+
// locked files, and partially-deleted directories (not just EPERM)
|
|
932
|
+
if (process.platform === 'win32') {
|
|
886
933
|
try {
|
|
887
|
-
exec(`rd /s /q "${resolved}"`, { stdio: 'pipe', timeout: 15000, windowsHide: true });
|
|
934
|
+
exec(`cmd /c rd /s /q "${resolved}"`, { stdio: 'pipe', timeout: 15000, windowsHide: true });
|
|
888
935
|
try { exec('git worktree prune', { cwd: gitRoot, stdio: 'pipe', timeout: 10000, windowsHide: true }); } catch {}
|
|
889
936
|
_removeWorktreeFailures.delete(resolved);
|
|
890
937
|
return true;
|
|
891
|
-
} catch {
|
|
938
|
+
} catch (rdErr) {
|
|
939
|
+
log('warn', `removeWorktree: rd /s /q fallback failed for ${wtPath}: ${rdErr.message}`);
|
|
940
|
+
}
|
|
892
941
|
}
|
|
893
942
|
const fail = _removeWorktreeFailures.get(resolved) || { count: 0, lastAttempt: 0 };
|
|
894
943
|
fail.count++;
|
|
@@ -963,6 +1012,8 @@ module.exports = {
|
|
|
963
1012
|
killGracefully,
|
|
964
1013
|
killImmediate,
|
|
965
1014
|
removeWorktree,
|
|
1015
|
+
_purgeReservedFiles, // exported for testing
|
|
1016
|
+
_WIN_RESERVED_NAMES, // exported for testing
|
|
966
1017
|
LOCK_STALE_MS,
|
|
967
1018
|
flushLogs,
|
|
968
1019
|
slugify,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.741",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|