autosnippet 3.1.0 → 3.1.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.
|
@@ -639,14 +639,19 @@ export class WikiGenerator {
|
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
-
// ── 7. 文件夹画像文档
|
|
643
|
-
//
|
|
642
|
+
// ── 7. 文件夹画像文档 ──
|
|
643
|
+
// 触发条件 (满足任一即启用):
|
|
644
|
+
// a) AST 稀疏: 类/协议 < 5 且无模块文档
|
|
645
|
+
// b) generic monolith: 仅 generic discoverer + 单 target + 多目录
|
|
646
|
+
// c) 核心文章过少: 当前主题 ≤ 4 篇 → 用文件夹分析补充内容丰富度
|
|
644
647
|
const astEntityCount = (astInfo.classes?.length || 0) + (astInfo.protocols?.length || 0);
|
|
645
648
|
const hasModuleDocs = topics.some((t) => t.type === 'module');
|
|
646
649
|
const astSparse = astEntityCount < 5 && !hasModuleDocs;
|
|
647
650
|
const shouldProfileForGenericMonolith =
|
|
648
651
|
genericOnlyDiscovery && monolithSingleTarget && sourceModuleKeys.length >= 2;
|
|
649
|
-
const
|
|
652
|
+
const tooFewCoreArticles = topics.length <= 4 && sourceModuleKeys.length >= 2;
|
|
653
|
+
const shouldEnableFolderProfiling =
|
|
654
|
+
astSparse || shouldProfileForGenericMonolith || tooFewCoreArticles;
|
|
650
655
|
|
|
651
656
|
if (shouldEnableFolderProfiling) {
|
|
652
657
|
const rawFolderProfiles = profileFolders(projectInfo, {
|
|
@@ -712,7 +717,11 @@ export class WikiGenerator {
|
|
|
712
717
|
folderDocCount++;
|
|
713
718
|
}
|
|
714
719
|
|
|
715
|
-
const folderProfileReason = astSparse
|
|
720
|
+
const folderProfileReason = astSparse
|
|
721
|
+
? 'AST sparse'
|
|
722
|
+
: tooFewCoreArticles
|
|
723
|
+
? `few core articles (${topics.length - topics.filter((t) => t.type === 'folder-overview' || t.type === 'folder-profile').length} core)`
|
|
724
|
+
: 'generic monolith';
|
|
716
725
|
logger.info(
|
|
717
726
|
`[WikiGenerator] Folder profiling (${folderProfileReason}): ${folderProfiles.length} folders analyzed, ` +
|
|
718
727
|
`${topics.filter((t) => t.type === 'folder-profile').length} folder docs planned`
|