feat(file-manager): suggest-name via naming engine; plan.naming source from override chain (W9-H G9)

- POST /files/suggest-name renders the effective template (entity > root >
  global) with the same variables as organize: file name segment for files,
  work/season dir segment for directories; identity_uncertain when no entity
- planImport plan.naming.templateSource/templateVersion now come from
  effectiveNaming + the registered template version (fixes the leftover
  DEFAULT_TEMPLATES reference after the naming chain landed)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 15:26:34 +08:00
1 parent 8651a35594
commit 99a3e17210
5 files changed
+129 -14

No files matched your search

@@ -572,9 +572,11 @@ export async function planImport(d: AoDeps, req: ImportRequest): Promise<PlanRes
...(req.slotId ? { slotId: req.slotId } : {}),
naming: {
mode: keepNames ? "keep" : "template",
// 模板层级(作品/库根/全局)接入前只有全局默认模板;保留原文件名 = 本次覆写
templateSource: req.namingSource ?? (keepNames ? "override" : "global"),
templateVersion: DEFAULT_TEMPLATES.version,
// 模板来源按 作品 > 库根 > 全局 回落;保留原文件名 = 本次覆写
templateSource:
req.namingSource ??
(keepNames ? "override" : effectiveNaming(namingSettings, root, entity).sources[namingEntity.kind!]),
templateVersion: fileTemplates.version,
},
};
const drafts = organizePlanToFileResults(plan, { targetLibraryRootId: root.id });