refactor(query): 结果文档装配收敛到 formatting seam - #11
Merged
Conversation
候选 3:三处结果文档装配(TUI 条目 / LLM 消息 / db_query 工具输出)
收敛到 formatting/result-document.ts 单一纯函数入口,受众差异(标题风格、
表格格式器、宽度钳制、空态)内化在模块内,调用点退化为薄 adapter。
- renderQueryDocument(doc, { audience }) 返回 DocLine[](text + style +
hint),TUI 渲染器映射 theme 颜色、追加 keyHint 提示
- 删除 formatRelatedResults / formatRelatedSummary / formatRelatedExpanded
三份重复装配,测试迁移到 result-document.test.ts
- 工具执行输出统一中文(与 /db query 的 LLM 消息、TUI 文案一致),
AGENTS.md 澄清该条仅约束模型提示语(description/promptSnippet 等)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
候选 3:三处结果文档装配收敛到 formatting seam
变更内容
formatting/result-document.ts:renderQueryDocument(doc, { audience })单一纯函数入口,输出 DocLine[](text + style 颜色提示 + hint 交互标记)renderers.ts退化为薄 adapter:DocLine→theme 上色 + keyHint 追加formatRelatedResults/formatRelatedSummary/formatRelatedExpanded三份重复装配db_query工具输出改用统一文档(中文 markdown,与 /db query 消息合流),其余工具输出全部中文化为什么
"查询结果展示哪些元数据、如何排版"之前散落在三个文件三种措辞里,related 节被装配两次。收敛后加元数据字段只改一处,测试打在模块接口上。
验证
npm run check(tsc)通过npm test230 通过(新增 result-document 13 例,迁移 renderers/formatRelatedResults 用例)npm run lint0 errorsnpm run fmt+fmt:check通过