Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

docs: fix dangling internal links and widen the link gate (#1502)

Zymonody75c0585c1b1ce
diff --git a/docs/README.md b/docs/README.md
index 06098be83a..8e61a2ff02 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -33,5 +33,4 @@
| [desktop-login-hosted-callback.md](./desktop-login-hosted-callback.md) | 跨仓契约 | 参考 | Desktop 系统浏览器登录的托管回调链路:auth-server 路由契约、结果页模板交付、灰度开关与回滚 | — |
| [auth-realm-routing.md](./auth-realm-routing.md) | 跨仓契约 | 参考 | 组织 SSO 双区域发现、会话区域持久化与 token 消费端点路由 | — |
| [legal/README.md](./legal/README.md) | 法律/合规索引 | authoritative | 法律合规资料归档边界与固定路径例外 | — |
-| [legal/wechat-open-sdk-compliance.md](./legal/wechat-open-sdk-compliance.md) | 合规记录 | restricted-review-required | Mobile 微信 Open SDK 版本、隐私披露和发布前签核 | — |
| [legal/notices/README.md](./legal/notices/README.md) | 第三方许可/SBOM | generated | `pnpm licenses:generate`、Desktop/Mobile 随包声明 | — |
diff --git a/docs/legal/README.md b/docs/legal/README.md
index 98403de22c..69754f8a3a 100644
--- a/docs/legal/README.md
+++ b/docs/legal/README.md
@@ -14,13 +14,6 @@
- [项目版权与归属声明](../../NOTICE):仓库根目录固定文件;其中的第三方材料入口
指向本目录的 `notices/`。
-### 人工维护的合规记录
-
-- [微信 Open SDK 合规记录](./wechat-open-sdk-compliance.md):版本、隐私披露、用户
- 同意和发布前复核记录。
-- [个人微信 IM 合规与发布记录](./wechat-personal-im-compliance.md):iLink 协议来源、
- 数据处理、腾讯接入授权与 GA 门禁。
-
### 第三方许可、受限组件与 SBOM
- [第三方声明与 SBOM 说明](./notices/README.md):生成命令、覆盖范围、审计门禁和
diff --git a/docs/openai-chat-dual-channel-plan.md b/docs/openai-chat-dual-channel-plan.md
index 50aeccfaf9..f2ee782624 100644
--- a/docs/openai-chat-dual-channel-plan.md
+++ b/docs/openai-chat-dual-channel-plan.md
@@ -2,7 +2,7 @@
> 状态:待实施。
> 范围:当前只落地 Phase 1——把 Codex 的 OpenAI Responses 请求桥接到供应商的 OpenAI Chat Completions 接口;Phase 2 及其它协议按真实需求后续实施。
-> 相关现状:[`subscription-bridge.md`](./subscription-bridge.md) 记录了 Claude Code 侧已有 Anthropic Messages → OpenAI Responses bridge;本文补齐 Codex 访问 Chat-only 上游的方向。
+> 相关现状:`packages/anthropic-responses-bridge` 实现了 Claude Code 侧已有的 Anthropic Messages → OpenAI Responses bridge;本文补齐 Codex 访问 Chat-only 上游的方向。
## 1. 目标与最终结论
@@ -149,7 +149,7 @@ export type ProviderWireProtocol =
- `providerViewToConfig`、wizard、DB JSON normalize 不能在创建、编辑、重启后丢字段;
- device-link 对执行字段做剥离,只保留展示所需的兼容类型。
-配置语义遵守 [`configuration-design-principles.md`](./configuration-design-principles.md):Codex 上游协议是创建自定义端点时必须理解的常规字段,系统默认 Responses;存量用户未设置 override 时行为完全不变,恢复默认即清除 override、重新跟随 Responses 默认。
+配置语义遵守 [`configuration-and-overrides.md`](./dev-rules/configuration-and-overrides.md):Codex 上游协议是创建自定义端点时必须理解的常规字段,系统默认 Responses;存量用户未设置 override 时行为完全不变,恢复默认即清除 override、重新跟随 Responses 默认。
### 4.2 native fast path 与 bridge path
diff --git a/scripts/__tests__/dev-docs-contract.test.mjs b/scripts/__tests__/dev-docs-contract.test.mjs
index 9243668882..f482b2d2dc 100644
--- a/scripts/__tests__/dev-docs-contract.test.mjs
+++ b/scripts/__tests__/dev-docs-contract.test.mjs
@@ -73,12 +73,54 @@ function assertPnpmCommandExists(line, rootPackage) {
assert.ok(rootPackage.scripts?.[command], `documented root script is missing: ${line}`);
}
+/**
+ * 去掉 fenced code block 与 inline code span,再抽链接。顺序不能反 —— fenced block
+ * 内部含反引号,先剥 inline 会把围栏本身吃掉。
+ *
+ * 这样 `[x](y)` 这类**演示 markdown 语法**的写法不会被当成真链接(design-rules/DESIGN.md
+ * 里有多处);而 [`foo.md`](./foo.md) 这种「链接文本本身是 inline code」的常见写法,剥完
+ * 变成 [](./foo.md),目标仍在括号里,正则照常命中。
+ */
+function stripCodeSpans(text) {
+ return (
+ text
+ // 围栏允许带缩进 —— 列表项里的围栏本就是缩进的(docs/design-rules/DESIGN.md
+ // 与 docs/dev-rules/pi-remaining-work.md 各有一处)。只认行首 ``` 会漏掉它们,
+ // 块内的示例链接就会被当成真链接。
+ .replace(/^[ \t]*```[\s\S]*?^[ \t]*```/gm, "")
+ // inline code 用「等长反引号串」配对,这样内容本身含反引号的写法也能整段剥掉
+ // (docs/product-rules/task-and-conversation-naming.md 有 `` `${n} 个会话` ``)。
+ // 刻意不跨行:落单的反引号不应该让后面整篇文档漏检。
+ .replace(/(`+)(?:(?!\1)[^\n])*?\1/g, "")
+ );
+}
+
function localMarkdownLinks(relativePath) {
- return [...readText(relativePath).matchAll(/\[[^\]]*\]\(([^)]+)\)/g)]
+ return [...stripCodeSpans(readText(relativePath)).matchAll(/\[[^\]]*\]\(([^)]+)\)/g)]
.map((match) => match[1].trim())
.filter((target) => !/^(?:https?:|mailto:|#)/.test(target));
}
+/**
+ * 需要做内链体检的全部文档:根目录规则文件 + `docs/` 下所有 markdown(递归)。
+ *
+ * 覆盖面刻意做全 —— 悬空内链最容易出现在深层目录里:文档被删除时,引用它的索引
+ * (如 `docs/legal/README.md`、`docs/README.md`)常常漏改。只体检 CHECKED_DOCS 那几篇
+ * canonical 文档挡不住这类回归。
+ */
+function listLinkCheckedDocs() {
+ const out = ["AGENTS.md", ...CONTRIBUTING_DOCS];
+ const walk = (relativeDir) => {
+ for (const entry of fs.readdirSync(path.join(ROOT, relativeDir), { withFileTypes: true })) {
+ const relativePath = path.join(relativeDir, entry.name);
+ if (entry.isDirectory()) walk(relativePath);
+ else if (entry.name.endsWith(".md")) out.push(relativePath);
+ }
+ };
+ walk("docs");
+ return [...new Set(out)].sort();
+}
+
test("developer docs only document pnpm commands that exist", () => {
const rootPackage = readJson("package.json");
for (const relativePath of CHECKED_DOCS) {
@@ -117,7 +159,7 @@ test("AGENTS and CONTRIBUTING route to the canonical developer docs", () => {
});
test("developer documentation links resolve", () => {
- for (const relativePath of CHECKED_DOCS) {
+ for (const relativePath of listLinkCheckedDocs()) {
const sourceDir = path.dirname(path.join(ROOT, relativePath));
for (const target of localMarkdownLinks(relativePath)) {
const fileTarget = decodeURIComponent(target.split("#", 1)[0]);