feat: 文档源连接器多源化——通用镜像引擎 + Notion + Google Docs#3
Merged
Conversation
把飞书硬编码的文档镜像抽成通用引擎(server/docsync.mjs,provider 无关的增量/孤儿 prune/脱敏/单轮一 commit),
飞书改成第一个 adapter,新增 Notion 与 Google Docs 两个 provider(原生 fetch,零新依赖)。
查询/看板/MCP 全部从 feishu-only 泛化到三源:grep/find/ls/read 自动覆盖新子树,Web Docs 视图按存在的源
子树列举,MCP 工具描述与 /ask 提示同步。
- core/{notion,google}.mjs + server/{notion,google}docs.mjs:两个新文档源 adapter
- server/docsync.mjs:通用 collection→doc 对账引擎;feishudocs.mjs 重构为 adapter
- server/server.mjs:DOC_SOURCES 表驱动轮询(加新源只加一行)+ /capabilities 暴露 notion/google
- web/app.js:Docs 视图/总览/面包屑多源化;mcp/server.mjs + ASK_HINT 描述同步
- 复用:core/retry.mjs(退避,三源共用)、core/safe.mjs#saniName(名字消毒,去三处重复)
- 测试:test/{notion,google}.test.mjs(18 例);全套 162 绿
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 25, 2026
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.
背景
team-brain 此前只把飞书 wiki 单向镜像进真相库的
feishu/子树。作为产品能力,把文档镜像做成可插拔多源,并落地 Notion 与 Google Docs 两个新源。做了什么
server/docsync.mjs:把飞书硬编码逻辑抽成 provider 无关的syncDocs(TRUTH, req, provider, opts)——增量去重(按edited指纹)、孤儿/死库 prune、零库保护、redactAgent脱敏、一轮一 commit。feishudocs.mjs重构成第一个 adapter(签名不变,旧测试全绿)。core/notion.mjs+server/notiondocs.mjs:integration token,search 列页面 + 块树递归取正文。core/google.mjs+server/googledocs.mjs:service account(node:crypto自签 JWT,无 SDK)+ Driveexport到 text/plain。grep/find/ls/read默认全仓覆盖新子树;web/app.jsDocs 视图/总览/面包屑按存在的源子树列举;mcp/server.mjs工具描述 +/ask提示同步;/capabilities暴露notion/google。DOC_SOURCES:加新源只加一行。core/retry.mjs(退避,三源共用)、core/safe.mjs#saniName(名字消毒,去三处复制)。验证
npm test162/162(飞书 10 + Notion 11 + Google 7 + 其余)/ls//find//grep//read命中三源,/read出口脱敏生效配置(运维)
新增
notion.example.yaml/google.example.yaml(均 gitignore 对应*.yaml,缺省即关),README 双语补「其它文档源」小节。🤖 Generated with Claude Code