@tensor.chat/companion 0.3.0 → 0.3.1
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/tools/files.js +16 -7
package/package.json
CHANGED
package/src/tools/files.js
CHANGED
|
@@ -172,17 +172,26 @@ function walk(root, onEntry) {
|
|
|
172
172
|
// A pattern written as the tree shows it ("Devices/Devbox/game/**", or just the device
|
|
173
173
|
// folder "Devices/Devbox/**") narrows to that shared folder and continues relative to
|
|
174
174
|
// it; anything else is matched relative to every shared folder, as before.
|
|
175
|
+
// Every folder's own name is tried before the device folder: the device folder is the
|
|
176
|
+
// start of every name, so tried in the same pass it caught "Devices/PC/VoiceType/*" at
|
|
177
|
+
// the first folder, and only the first shared folder could be searched (03.10.2026).
|
|
175
178
|
function splitTreePattern(okRoots, pattern) {
|
|
176
179
|
const p = pattern.replace(/\\/g, '/');
|
|
177
180
|
const low = p.toLowerCase();
|
|
181
|
+
const rest = (prefix) => {
|
|
182
|
+
if (!prefix) return null;
|
|
183
|
+
const pre = prefix.toLowerCase();
|
|
184
|
+
if (low === pre) return '*';
|
|
185
|
+
return low.startsWith(pre + '/') ? p.slice(prefix.length + 1) || '*' : null;
|
|
186
|
+
};
|
|
178
187
|
for (const r of okRoots) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
188
|
+
const after = r.label ? rest(r.label) : null;
|
|
189
|
+
if (after !== null) return { roots: [r], pattern: after };
|
|
190
|
+
}
|
|
191
|
+
for (const r of okRoots) {
|
|
192
|
+
const cut = r.label ? r.label.lastIndexOf('/') : -1;
|
|
193
|
+
const after = rest(cut > 0 ? r.label.slice(0, cut) : '');
|
|
194
|
+
if (after !== null) return { roots: okRoots, pattern: after };
|
|
186
195
|
}
|
|
187
196
|
return { roots: okRoots, pattern: p };
|
|
188
197
|
}
|