decodie-flag-stale
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDecodie — Flag Stale Mode
Decodie — 标记过时模式
Fast, CI-friendly counterpart to verify mode. For every entry with a , check whether any of its source files have changed since that SHA, and flip on entries that have. Does not read source files or recompute anchor hashes — only diffs filenames against git history.
verified_shastale: trueThis mode modifies only.
.decodie/index.json作为验证模式的快速、适配CI的替代方案。对于每个带有的条目,检查其任意源文件自该SHA以来是否已更改,并将已更改条目的设为。无需读取源文件或重新计算锚点哈希值——仅对比文件名与git历史记录的差异。
verified_shastaletrue此模式仅修改。
.decodie/index.jsonActivation
激活方式
Takes no arguments. Always operates on the full index.
无需参数。始终对完整索引进行操作。
Setup
设置步骤
- Confirm exists. If not: "No
.decodie/directory found — nothing to check." Stop..decodie/ - Confirm git repository:
If not: "Not a git repository —bash
git rev-parse --git-dirrequires git history. Run verify mode instead." Stop.flag-stale - Read . If empty: "No entries to check." Stop.
.decodie/index.json
- 确认目录存在。若不存在:“未找到
.decodie/目录——无可检查内容。”停止操作。.decodie/ - 确认当前为git仓库:
若不是git仓库:“当前不是git仓库——bash
git rev-parse --git-dir需要git历史记录。请改用验证模式。”停止操作。flag-stale - 读取。若为空:“无可检查的条目。”停止操作。
.decodie/index.json
Detection Process
检测流程
For each entry:
- Skip entries with no . Report as
verified_sha.unverified - Skip entries with no (and no
sourcesfallback). Report asreferences[].file.no-sources - Compute changed files:
If the SHA is unknown to git (history rewritten), treat as stale.bash
git diff --name-only <verified_sha>..HEAD - Compare changed files against entry's source files. If any match, the entry is stale.
- Update:
- Newly stale → set . Leave
stale: trueunchanged.verified_sha - Already stale → no change (still counted).
- No source files in diff → leave as-is. Do not flip stale back to fresh — only verify mode can do that.
stale
- Newly stale → set
Write updates back to .
index.json针对每个条目:
- 跳过无的条目,标记为
verified_sha。unverified - 跳过无的条目(且无
sources作为备选),标记为references[].file。no-sources - 计算已更改文件:
若git无法识别该SHA(历史记录已重写),则视为过时。bash
git diff --name-only <verified_sha>..HEAD - 对比已更改文件与条目的源文件。若存在匹配项,则该条目为过时状态。
- 更新条目:
- 新变为过时 → 设置,保留
stale: true不变。verified_sha - 已处于过时状态 → 不做更改(仍计入统计)。
- 源文件未出现在差异结果中 → 保留原有状态。请勿将过时状态改回正常——仅验证模式可执行此操作。
stale
- 新变为过时 → 设置
将更新结果写回。
index.jsonReporting
报告输出
Decodie flag-stale
Newly stale: N entries
Already stale: M entries
Fresh: F entries
Unverified: U entries (no verified_sha -- run verify mode)
No sources: K entriesIf newly stale, list them:
Newly stale:
- entry-1711540000-a1b2 -- src/lib/foo.ts
- entry-1711540123-c3d4 -- src/lib/bar.ts, src/lib/baz.tsDecodie flag-stale
Newly stale: N entries
Already stale: M entries
Fresh: F entries
Unverified: U entries (no verified_sha -- run verify mode)
No sources: K entries若存在新的过时条目,将列出这些条目:
Newly stale:
- entry-1711540000-a1b2 -- src/lib/foo.ts
- entry-1711540123-c3d4 -- src/lib/bar.ts, src/lib/baz.tsImportant Notes
重要说明
- One-way flag. Only flips to
stale. Clearing requires verify mode.true - No source file reads. Based purely on . This is what makes it fast enough for CI.
git diff --name-only - No exit-code policy. Whether stale entries block a PR is a per-repo decision.
- No git history rewriting. Only read-only git commands.
- 单向标记:仅将设为
stale。清除过时状态需使用验证模式。true - 不读取源文件:完全基于实现,这也是其能够在CI中快速运行的原因。
git diff --name-only - 无退出码规则:是否因过时条目阻塞PR需由各仓库自行决定。
- 不修改git历史:仅使用只读git命令。