Maintain Markdown references, code excerpts and source snapshots
Dependencies
版本说明:0.5.0 提供项目配置、init 与 check 文档维护入口。Mooncakes 安装请指定 @0.5.0;GitHub 的旧 v0.4.0 不包含这些入口。
| 检查对象 | 使用方式 | 发现的问题 |
|---|---|---|
| 本地文件与目录 | 普通链接、引用式链接、图片或 HTML 链接 | 来源被删除、迁移或超出工作区 |
| 标题与来源范围 | 标题锚点、#L10-L20、#region:name | 标题改名、行范围或命名区域失效 |
| 源码与配置片段 | 代码围栏添加 source=路径 | 文档片段与当前来源不一致 |
| 逐字引文 | 双引号引文配来源链接或显式引用块 | 引文不在当前来源中;网页需 --online |
| 引用快照 | --snapshot 保存,--baseline 复查 | 来源区域或引用上下文改变,新增引用待复核 |
| 项目配置 | init 建立配置与基线,之后只运行 check | 本地与 CI 复用文档范围、排除项与检查规则 |
| CI 检查 | GitHub Action 或 --github | 以退出码和文件行号提示文档作者 |
git clone https://github.com/Freakz2z/tracecite.git
cd tracecite
moon update
moon run cmd/main checkmoon run cmd/main init docs README.md --root /path/to/your/repositorymoon run cmd/main check --root /path/to/your/repositorybash scripts/package.sh
./_build/native/release/build/cmd/main/main.exe checkpreferred_target = "native"```text source=moon.mod
preferred_target = "native"
```moon run cmd/main checkmoon run cmd/main check --snapshot .tracecite-docs.json
moon run cmd/main check- uses: actions/checkout@v5
- uses: Freakz2z/tracecite@main| 输入 | 默认值 | 说明 |
|---|---|---|
| config | 自动读取 tracecite.json | 指定其他项目配置,路径相对调用方根目录 |
| path | 配置中的 paths;无配置为 . | 指定时覆盖扫描范围 |
| strict | 配置值;无配置为 true | 显式 true / false 覆盖规则 |
| online | 配置值;无配置为 false | 显式 true / false 覆盖规则 |
| baseline | 配置值 | 指定时覆盖引用快照路径 |
| exclude | 配置值 | 追加排除路径,每行一个 |
| 退出码 | 含义 |
|---|---|
| 0 | 实际检查的引用通过;严格模式下没有待复核项 |
| 1 | 参数、输入读取或快照写入失败 |
| 2 | 引用失败、来源改变、没有可检查引用;严格模式下也包含待复核项 |
moon add Freakz2z/tracecite@0.5.0moon info
moon fmt
moon check --deny-warn
moon test --deny-warn
moon test --target js --deny-warn
moon test --target wasm --deny-warn
python3 scripts/test_document_cli.py
python3 -m unittest discover -s adapters -p 'test_*.py'
sh scripts/smoke.sh| 资料 | 内容 |
|---|---|
| 文档引用维护指南 | 片段绑定、标题锚点、引文与快照的完整用法 |
| Mooncakes 发布与接入 | 源码包验证、公开 API 接入与发布步骤 |
| 输入约定 | 兼容接口、输入格式与 HTTP 回源规则 |
| 第三方资料审计 | 网页逐字引文的固定样本、结果与局限 |
| 普通报告试验 | 普通 Markdown 报告的核验记录 |
| Mooncakes 模块 | 平台上的已发布版本 |
pub(all) struct CitationEdge {
claim_index : Int
source_id : String
call_id : String?
line : Int
evidence_status : String
} derive(ToJson)pub(all) struct CitationNote {
claim : String
quote : String
url : String
line : Int
} derive(ToJson)pub(all) struct CitationNotes {
notes : Array[CitationNote]
diagnostics : Array[Diagnostic]
} derive(ToJson)pub(all) struct DocumentProjectConfigResult {
config : DocumentProjectConfig?
diagnostics : Array[Diagnostic]
} derive(ToJson)pub(all) struct DocumentReference {
line : Int
source : String
kind : String
excerpt : String?
} derive(ToJson)pub(all) struct DocumentReferences {
references : Array[DocumentReference]
diagnostics : Array[Diagnostic]
warnings : Array[Diagnostic]
unbound_snippets : Int
} derive(ToJson)pub(all) struct DocumentSnapshot {
version : Int
entries : Array[DocumentSnapshotEntry]
} derive(ToJson, FromJson)pub(all) struct DriftReport {
old_run_id : String?
new_run_id : String?
old_valid : Bool
new_valid : Bool
unchanged_count : Int
changes : Array[SourceChange]
old_diagnostics : Array[Diagnostic]
new_diagnostics : Array[Diagnostic]
} derive(ToJson)pub(all) struct LiveCitationMatch {
source_id : String
claim_index : Int
quote_present : Bool
} derive(ToJson)pub(all) struct Report {
run_id : String?
event_count : Int
call_count : Int
source_count : Int
claim_count : Int
verified_citation_count : Int
sources : Array[SourceRecord]
citations : Array[CitationEdge]
diagnostics : Array[Diagnostic]
} derive(ToJson)pub(all) struct SourceRecord {
id : String
uri : String
title : String?
call_id : String
line : Int
content_present : Bool
} derive(ToJson)fn check_live_source_quotes(input : String, uri : String, live_content : String) -> Array[LiveCitationMatch]fn document_excerpt_matches(content : String, excerpt : String, kind : String) -> Boolfn document_source_context(content : String, excerpt : String, kind : String) -> Stringfn normalize_web_text(input : String) -> String原文:“quoted text” 来源:title Inline-code backticks are Markdown formatting, not part of rendered quotes.
fn quote_appears_in_text(source : String, quote : String) -> Boolfn source_snapshot_matches(input : String, uri : String, live_content : String) -> BoolInstall
Download zipMaintain Markdown references, code excerpts and source snapshots
Dependencies