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. 文件夹画像文档 (AST 稀疏项目的降级策略) ──
643
- // AST 无法提取足够的 类/函数/协议 时,转为文件夹级分析
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 shouldEnableFolderProfiling = astSparse || shouldProfileForGenericMonolith;
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 ? 'AST sparse' : 'generic monolith';
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`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosnippet",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Extract code patterns into a knowledge base for AI coding assistants",
5
5
  "type": "module",
6
6
  "main": "lib/bootstrap.js",