Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: normalize bash metadata paths on windows

Affaan Mustafa162236f46366
diff --git a/tests/hooks/hooks.test.js b/tests/hooks/hooks.test.js
index bd3440f16..b2919a038 100644
--- a/tests/hooks/hooks.test.js
+++ b/tests/hooks/hooks.test.js
@@ -8,7 +8,7 @@ const assert = require('assert');
const path = require('path');
const fs = require('fs');
const os = require('os');
-const { spawn, spawnSync } = require('child_process');
+const { execFileSync, spawn, spawnSync } = require('child_process');
function toBashPath(filePath) {
if (process.platform !== 'win32') {
@@ -25,12 +25,34 @@ function fromBashPath(filePath) {
return filePath;
}
- const match = String(filePath).match(/^\/([A-Za-z])\/(.*)$/);
- if (!match) {
- return filePath;
+ const rawPath = String(filePath || '');
+ if (!rawPath) {
+ return rawPath;
+ }
+
+ try {
+ return execFileSync(
+ 'bash',
+ ['-lc', 'cygpath -w -- "$1"', 'bash', rawPath],
+ { stdio: ['ignore', 'pipe', 'ignore'] }
+ )
+ .toString()
+ .trim();
+ } catch {
+ // Fall back to common Git Bash path shapes when cygpath is unavailable.
+ }
+
+ const match = rawPath.match(/^\/(?:cygdrive\/)?([A-Za-z])\/(.*)$/)
+ || rawPath.match(/^\/\/([A-Za-z])\/(.*)$/);
+ if (match) {
+ return `${match[1].toUpperCase()}:\\${match[2].replace(/\//g, '\\')}`;
+ }
+
+ if (/^[A-Za-z]:\//.test(rawPath)) {
+ return rawPath.replace(/\//g, '\\');
}
- return `${match[1].toUpperCase()}:\\${match[2].replace(/\//g, '\\')}`;
+ return rawPath;
}
function sleepMs(ms) {