@maintainer-pro/ai-bridge 0.1.9 → 0.1.10
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/package.json +1 -1
- package/src/daemon.mjs +17 -1
package/package.json
CHANGED
package/src/daemon.mjs
CHANGED
|
@@ -2125,14 +2125,30 @@ function collectOfferedFolders() {
|
|
|
2125
2125
|
return [browseRootFromCwd()];
|
|
2126
2126
|
}
|
|
2127
2127
|
|
|
2128
|
-
/**
|
|
2128
|
+
/**
|
|
2129
|
+
* Folder picker root — not `/` or a drive letter.
|
|
2130
|
+
* Windows: `D:\Projects\app` → `D:\Projects`.
|
|
2131
|
+
* macOS/Linux: `~/projects/app` → `~/projects`.
|
|
2132
|
+
*/
|
|
2129
2133
|
function browseRootFromCwd() {
|
|
2130
2134
|
const cwd = path.resolve(process.cwd());
|
|
2131
2135
|
if (process.platform === "win32") {
|
|
2132
2136
|
const drive = path.parse(cwd).root;
|
|
2133
2137
|
const first = cwd.slice(drive.length).split(/[\\/]/).filter(Boolean)[0];
|
|
2134
2138
|
if (first) return path.resolve(path.join(drive, first));
|
|
2139
|
+
return cwd;
|
|
2140
|
+
}
|
|
2141
|
+
const home = path.resolve(os.homedir());
|
|
2142
|
+
if (pathInside(cwd, home)) {
|
|
2143
|
+
const first = cwd.slice(home.length).split("/").filter(Boolean)[0];
|
|
2144
|
+
if (first) return path.join(home, first);
|
|
2145
|
+
return home;
|
|
2146
|
+
}
|
|
2147
|
+
const bits = cwd.split("/").filter(Boolean);
|
|
2148
|
+
if (bits[0] === "Volumes" && bits[1]) {
|
|
2149
|
+
return path.join("/", bits[0], bits[1]);
|
|
2135
2150
|
}
|
|
2151
|
+
if (bits[0]) return path.join("/", bits[0]);
|
|
2136
2152
|
return cwd;
|
|
2137
2153
|
}
|
|
2138
2154
|
|