@42ailab/42plugin 0.1.16 → 0.1.17
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/db.ts +8 -1
package/package.json
CHANGED
package/src/db.ts
CHANGED
|
@@ -439,6 +439,12 @@ async function correctCachePath(cachePath: string): Promise<string> {
|
|
|
439
439
|
const dirs = entries.filter((e) => e.isDirectory() && !e.name.startsWith('.'));
|
|
440
440
|
const nonMetadataFiles = files.filter((f) => f.name !== 'metadata.json');
|
|
441
441
|
|
|
442
|
+
// 如果只有一个子目录(且没有其他文件),递归进入
|
|
443
|
+
if (dirs.length === 1 && nonMetadataFiles.length === 0) {
|
|
444
|
+
const subDir = path.join(cachePath, dirs[0].name);
|
|
445
|
+
return correctCachePath(subDir);
|
|
446
|
+
}
|
|
447
|
+
|
|
442
448
|
// 如果只有一个主文件(排除 metadata.json),返回该文件路径
|
|
443
449
|
if (nonMetadataFiles.length === 1 && dirs.length === 0) {
|
|
444
450
|
return path.join(cachePath, nonMetadataFiles[0].name);
|
|
@@ -461,7 +467,8 @@ async function resolveFinalPath(dir: string): Promise<string> {
|
|
|
461
467
|
const subDir = path.join(dir, dirs[0].name);
|
|
462
468
|
const subEntries = await fs.readdir(subDir);
|
|
463
469
|
if (subEntries.length > 0) {
|
|
464
|
-
|
|
470
|
+
// 递归查找,处理 agent/command 类型的 name/name.md 结构
|
|
471
|
+
return resolveFinalPath(subDir);
|
|
465
472
|
}
|
|
466
473
|
}
|
|
467
474
|
|