wiki-lint

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Wiki Lint

维基审核工具(Wiki Lint)

Audit the wiki. Produce a categorized report. Offer concrete fixes. Log the operation.
审核维基内容,生成分类报告,提供具体修复方案,并记录操作过程。

Pre-condition

前置条件

Find
SCHEMA.md
(search from cwd upward, or
~/wikis/
). If not found, tell the user to run
wiki-init
first. Read it to get wiki root path and conventions.
查找
SCHEMA.md
文件(从当前工作目录向上搜索,或在
~/wikis/
目录中查找)。如果未找到,请告知用户先运行
wiki-init
命令。读取该文件以获取维基根路径和约定规则。

Process

执行流程

1. Build the page inventory

1. 构建页面清单

Read
wiki/index.md
,
wiki/overview.md
, and all files in
wiki/pages/
. Build a map of:
  • All existing slugs (filenames without
    .md
    )
  • All
    [[slug]]
    references found in any page
  • All
    sources
    listed in frontmatter
读取
wiki/index.md
wiki/overview.md
以及
wiki/pages/
目录下的所有文件,构建包含以下内容的映射表:
  • 所有已存在的slug(不含
    .md
    的文件名)
  • 所有页面中出现的
    [[slug]]
    引用
  • frontmatter中列出的所有
    sources

2. Run all checks

2. 执行所有检查

🔴 Errors (must fix)
  • Broken links
    [[slug]]
    references where no corresponding
    wiki/pages/<slug>.md
    exists
  • Missing frontmatter — pages without required
    title
    ,
    tags
    ,
    sources
    , or
    updated
    fields
🟡 Warnings (should fix)
  • Orphan pages — pages with zero inbound
    [[slug]]
    links from any other page (excluding index.md and overview.md)
  • Contradictions — claims in one page that directly conflict with claims in another (look for the same entity described differently: dates, counts, names, relationships)
  • Stale claims — pages not updated within 90 days that contain "current", "latest", "recent", "state-of-the-art", or year literals two or more years old
  • Chronological update sections — page bodies containing date-stamped headers matching patterns like
    ## [Month]
    ,
    ## [Month] \d+
    , or
    **[Month] \d+ update
    — these are journal entries that should be integrated in-place
🔵 Info (consider addressing)
  • Missing concept pages
    [[slug]]
    references that appear 3+ times across the wiki but have no dedicated page
  • Coverage gaps — open questions listed in
    overview.md
    that could be answered by a web search or new ingest
  • Missing cross-references — two pages that discuss the same entity but don't link to each other
🔴 错误(必须修复)
  • 失效链接 — 存在
    [[slug]]
    引用,但对应的
    wiki/pages/<slug>.md
    文件不存在
  • 缺失frontmatter — 页面缺少必填的
    title
    tags
    sources
    updated
    字段
🟡 警告(建议修复)
  • 孤立页面 — 除index.md和overview.md外,没有其他页面通过
    [[slug]]
    链接指向该页面
  • 内容矛盾 — 一个页面中的声明与另一个页面的声明直接冲突(查找同一实体的不同描述:日期、数量、名称、关系等)
  • 过时声明 — 超过90天未更新的页面中包含"current"、"latest"、"recent"、"state-of-the-art"等词汇,或存在距今两年及以上的年份字面量
  • 按时间排序的更新章节 — 页面正文中包含符合
    ## [Month]
    ## [Month] \d+
    **[Month] \d+ update
    格式的带日期戳标题,这些属于日志条目,应整合到页面内容中
🔵 信息(建议处理)
  • 缺失概念页面
    [[slug]]
    引用在维基中出现3次及以上,但没有对应的专属页面
  • 覆盖缺口
    overview.md
    中列出的开放式问题,可通过网络搜索或新的数据导入来解答
  • 缺失交叉引用 — 两个讨论同一实体的页面之间没有互相链接

3. Write the lint report

3. 生成审核报告

Write
wiki/pages/lint-<today>.md
(do not ask permission — always write this):
markdown
---
title: Lint Report <today>
tags: [lint, maintenance]
sources: []
updated: <today>
---
生成
wiki/pages/lint-<today>.md
文件(无需询问权限,直接生成):
markdown
---
title: Lint Report <today>
tags: [lint, maintenance]
sources: []
updated: <today>
---

Lint Report — <today>

Lint Report — <today>

Summary

Summary

  • 🔴 Errors: N
  • 🟡 Warnings: N
  • 🔵 Info: N
  • 🔴 Errors: N
  • 🟡 Warnings: N
  • 🔵 Info: N

🔴 Broken Links

🔴 Broken Links

  • [[source-page]] references [[missing-slug]] — does not exist Fix: create the page or remove the reference
  • [[source-page]] references [[missing-slug]] — does not exist Fix: create the page or remove the reference

🔴 Missing Frontmatter

🔴 Missing Frontmatter

  • [[page]] is missing: title, updated
  • [[page]] is missing: title, updated

🟡 Orphan Pages

🟡 Orphan Pages

  • [[slug]] — no inbound links Fix: add link from [[related-page]], or delete if no longer relevant
  • [[slug]] — no inbound links Fix: add link from [[related-page]], or delete if no longer relevant

🟡 Contradictions

🟡 Contradictions

  • [[page-a]] says: "<claim>"
  • [[page-b]] says: "<conflicting claim>" Recommendation: <which to trust, or "investigate further">
  • [[page-a]] says: "<claim>"
  • [[page-b]] says: "<conflicting claim>" Recommendation: <which to trust, or "investigate further">

🟡 Stale Claims

🟡 Stale Claims

  • [[page]] last updated <date>, contains "latest" — may be outdated Fix: re-verify claims or add a "as of <date>" qualifier
  • [[page]] last updated <date>, contains "latest" — may be outdated Fix: re-verify claims or add a "as of <date>" qualifier

🔵 Missing Concept Pages

🔵 Missing Concept Pages

  • [[slug]] referenced N times but no page exists Fix: run wiki-ingest or create a stub
  • [[slug]] referenced N times but no page exists Fix: run wiki-ingest or create a stub

🔵 Coverage Gaps

🔵 Coverage Gaps

  • Open question from overview.md: "<question>" Suggestion: search for <X> or ingest <source type>
  • Open question from overview.md: "<question>" Suggestion: search for <X> or ingest <source type>

🔵 Missing Cross-References

🔵 Missing Cross-References

  • [[page-a]] and [[page-b]] both discuss <entity> but don't link to each other

Add the lint report to `wiki/index.md` under a Maintenance category (create it if it doesn't exist).
  • [[page-a]] and [[page-b]] both discuss <entity> but don't link to each other

将审核报告添加到`wiki/index.md`的Maintenance分类下(如果该分类不存在则创建)。

4. Offer concrete fixes

4. 提供具体修复方案

For each fixable category, offer:
  • Broken links: "Remove the broken
    [[slug]]
    references? (I'll show each change before writing)"
  • Missing cross-references: "Add the missing links between these page pairs?"
  • Orphan page tags: "Add
    status: orphan
    to frontmatter of orphan pages?"
  • Missing frontmatter: "Add missing frontmatter fields with placeholder values?"
Show the exact diff for each change before writing. Apply only after confirmation.
针对每个可修复的类别,提供以下选项:
  • 失效链接:“是否移除失效的
    [[slug]]
    引用?(我会在修改前展示所有变更内容)”
  • 缺失交叉引用:“是否在这些页面之间添加缺失的链接?”
  • 孤立页面标签:“是否在孤立页面的frontmatter中添加
    status: orphan
    ?”
  • 缺失frontmatter:“是否用占位符值添加缺失的frontmatter字段?”
在修改前展示每个变更的精确差异,仅在获得确认后执行修改。

5. Append to
wiki/log.md

5. 追加到
wiki/log.md

Always append — do not ask permission:
undefined
直接追加内容,无需询问权限:
undefined

[<today>] lint | <N errors> errors, <N warnings> warnings, <N info> info

[<today>] lint | <N errors> errors, <N warnings> warnings, <N info> info

Report: [[lint-<today>]] Fixed: <list what was auto-fixed, or "none">
undefined
Report: [[lint-<today>]] Fixed: <list what was auto-fixed, or "none">
undefined