Skip to content

feat(cli-docs-lint): preamble + cross-ref validator in push-runner quality_gate (ranks 95+96 land)#179

Merged
aloekun merged 6 commits into
masterfrom
cli-docs-lint
May 28, 2026
Merged

feat(cli-docs-lint): preamble + cross-ref validator in push-runner quality_gate (ranks 95+96 land)#179
aloekun merged 6 commits into
masterfrom
cli-docs-lint

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented May 28, 2026

Summary

順位 95 (preamble file count 自動照合) + 順位 96 (Markdown cross-reference validator) を統合した新 workspace member cli-docs-lint を導入し、push-runner の quality_gate.lint group に pnpm lint:docs として統合する PR。同時に発見された既存の outdated preamble (5 ファイル) + broken cross-ref (13 件) も本 PR で修正。

Commits

change_id description
otwyvnqq feat(cli-docs-lint): workspace member with preamble + cross-ref checks (26 unit tests)
nvkltmnk fix(docs): outdated preamble counts in todo3-7.md (cli-docs-lint compliance)
tuorutsr fix(docs): broken relative cross-refs in todo.md / todo2.md (cli-docs-lint compliance)
rqyyokzn feat(quality_gate): integrate cli-docs-lint into push-runner lint group + pnpm lint:docs
nuuznkpl docs(todo): remove ranks 95+96 — landed via cli-docs-lint

Details

cli-docs-lint binary

  • --check preamble: docs/todo*.md の preamble に書かれた Kanji 数詞 (例: 十つ) と実ファイル数の一致を検証
  • --check cross-ref: docs/**/*.md の relative link を directory-aware で resolve (起点 file の親 directory を base に解決、PR docs(todo): split summary and todo5.md tasks to keep files under 50KB #133 で markdown-link-check が見逃した ../docs/adr/... 形式の broken link を検出)
  • --check all (default): 両方実行
  • 26 unit tests (preamble 8 + cross-ref 9 + main.rs 7 + lib structure 2)

検出した既存の品質問題 (本 PR で同時 fix)

  • 5 ファイルの outdated preamble: todo3-7.md の 「X つ」Kanji 数詞が実ファイル数と乖離 (PR docs(todo): split summary and todo5.md tasks to keep files under 50KB #133 で fix した同型問題が他ファイルにも残存)
  • 13 件の broken cross-ref:
    • docs/todo.md Phase B forward ref 7 件 (.takt/facets/instructions/review-*-whole.md 等の未存在ファイル) → inline code に変換
    • docs/todo.md project-root 起点 path 5 件 (.takt/workflows/post-merge-feedback.yaml 等) → ../ prefix で正規化
    • docs/todo2.md ADR-032 forward ref 1 件 → inline code

配置先の判断 (handoff doc の .github/workflows/lint.yml 案からの変更)

本リポジトリは .github/workflows/ 未存在で、既存品質ゲートは push-runner-config.toml[quality_gate] (= push 前の lint/test/build/rust-test) に集約済。新 CI workflow を作る代わりに既存パターンに沿って統合。派生 repo 用の templates/push-runner-config.toml も同時更新。

Test plan

  • cargo test -p cli-docs-lint: 26 tests pass
  • ./.claude/cli-docs-lint.exe: OK (preamble + cross-ref)
  • pnpm build:all: clean build
  • pnpm push の pre-push-review (simplicity + security + supervise) APPROVED
  • quality_gate (lint + test + build + rust-test) all PASS、pnpm lint:docs 統合済

Removed task entries

  • docs/todo6.md の順位 95 (preamble file count スクリプト) + 順位 96 (Markdown cross-ref validator) を削除
  • docs/todo-summary.md の対応 2 行を削除
  • docs/todo.md / docs/todo9.md / docs/handoff-rank-8-weekly-review-phase-b.md の関連参照を「cli-docs-lint で land 済」表記に更新

Follow-up

  • Phase B (順位 8) の着手時に handoff doc の「依存タスク」表でこの land 状況を確認できる
  • Phase B+1 の順位 154 (file size pre-step) と scope 整理が今後必要

Summary by CodeRabbit

  • New Features

    • 新しいドキュメント検証ツールを追加しました(リンク切れ検出と目次/preamble整合性チェック、CLI実行モード対応)。
  • Chores

    • ビルド/lintパイプラインにドキュメント検証ステップを統合しました(CIのlintグループで試験運用)。
    • 配布/デプロイ手順を更新して検証ツールを含めるようにしました。
    • 各種ドキュメントの参照先・運用手順を整理・更新しました(運用無効化オプションあり)。

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e849b169-8fd9-468e-aead-0e5b5c58a16f

📥 Commits

Reviewing files that changed from the base of the PR and between 3772fc5 and 26d4862.

📒 Files selected for processing (4)
  • push-runner-config.toml
  • src/cli-docs-lint/src/main.rs
  • src/cli-docs-lint/src/preamble.rs
  • templates/push-runner-config.toml
✅ Files skipped from review due to trivial changes (1)
  • templates/push-runner-config.toml
🚧 Files skipped from review as they are similar to previous changes (3)
  • push-runner-config.toml
  • src/cli-docs-lint/src/preamble.rs
  • src/cli-docs-lint/src/main.rs

📝 Walkthrough

Walkthrough

新しいドキュメント検査ツール cli-docs-lint を Rust で実装し、ワークスペースに統合しました。Preamble 数詞同期確認と Markdown クロスリファレンス検証を行う 2 つの検査機能をビルド・デプロイ・品質ゲートパイプラインに組み込み、関連タスク・ドキュメント参照を更新しました。

Changes

ドキュメント検査ツール統合と実装

Layer / File(s) Summary
ワークスペース統合と設定
Cargo.toml, src/cli-docs-lint/Cargo.toml, package.json, push-runner-config.toml, templates/push-runner-config.toml, scripts/deploy-hooks.ts
ワークスペースに src/cli-docs-lint を追加し、lint:docs / build:cli-docs-lint スクリプト、CI の lint グループ実行、deploy-hooks の exe 配布対象を統合。
違反型と公開インターフェース
src/cli-docs-lint/src/lib.rs
検査結果を表す公開 Violation 構造体と cross_ref / preamble モジュールを公開。
Markdownクロスリファレンス検査
src/cli-docs-lint/src/cross_ref.rs
docs 以下の Markdown を再帰走査し、リンク抽出・相対パス解決・存在確認で broken link を検出する実装とテストを追加。
Preamble数詞同期検査
src/cli-docs-lint/src/preamble.rs
docs/todo*.md の先頭 preamble の数詞を列挙された todo ファイル数と照合する実装(漢数字対応含む)とテストを追加。
CLI実装と実行制御
src/cli-docs-lint/src/main.rs
--check all/preamble/cross-ref--docs-dir--help、kill-switch 環境変数の判定、検査呼び出し、終了コード制御を実装しユニットテストを追加。
ドキュメント参照とタスク一覧更新
docs/handoff-rank-8-weekly-review-phase-b.md, docs/todo-summary.md, docs/todo.md, docs/todo2.md, docs/todo3.md, docs/todo4.md, docs/todo5.md, docs/todo6.md, docs/todo7.md, docs/todo9.md
タスク 95/96 の統合・削除、cli-docs-lint の land 済反映、todo ファイル参照範囲とリンク表現の更新を反映。

Sequence Diagram(s)

sequenceDiagram
  participant User as User/CI
  participant Main as main()
  participant Parse as parse_args()
  participant Run as run()
  participant Preamble as preamble::check()
  participant CrossRef as cross_ref::check()
  participant Violations as Violation[]

  User->>Main: cli-docs-lint --check all --docs-dir ./docs
  Main->>Parse: 引数解析

  alt 解析成功
    Parse-->>Main: CliArgs { mode, docs_dir }
    Main->>Run: mode, docs_dir

    alt mode == All
      Run->>Preamble: check(docs_dir)
      Preamble-->>Violations: preamble 違反[]
      Run->>CrossRef: check(docs_dir)
      CrossRef-->>Violations: cross-ref 違反[]
    else mode == Preamble
      Run->>Preamble: check(docs_dir)
      Preamble-->>Violations: preamble 違反[]
    end

    Run-->>Main: 全違反集約

    alt 違反なし
      Main-->>User: exit code 0
    else 違反あり
      Main->>Main: 違反一覧出力
      Main-->>User: exit code 1 + 違反表示
    end
  else 解析エラー
    Parse-->>Main: Err
    Main->>Main: エラー + ヘルプ出力
    Main-->>User: exit code 2
  end
Loading
sequenceDiagram
  participant CrossRef as cross_ref::check()
  participant Walk as walk(docs_dir)
  participant File as ファイルシステム
  participant CheckFile as check_file()
  participant Validate as validate_link()

  CrossRef->>Walk: Markdown ファイル収集
  Walk->>File: readdir + 再帰走査
  File-->>Walk: パス[]
  Walk-->>CrossRef: sorted .md paths

  loop 各 Markdown ファイル
    CrossRef->>File: 内容読み込み
    File-->>CheckFile: content
    CheckFile->>CheckFile: 正規表現でリンク抽出

    loop 各リンク
      CheckFile->>Validate: link target

      alt http(s):// 等の絶対URL
        Validate-->>CheckFile: skip (ok)
      else # のみのアンカー
        Validate-->>CheckFile: skip (ok)
      else 相対パス
        Validate->>Validate: # で分割→パス部抽出
        Validate->>File: resolve して存在確認
        File-->>Validate: exists?

        alt 存在する
          Validate-->>CheckFile: ok
        else 見つからない
          Validate-->>CheckFile: Violation { file, line, message }
        end
      end
    end
  end

  CheckFile-->>CrossRef: Violation[]
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、新しい cli-docs-lint クレートの追加と push-runner の quality_gate への統合(preamble + cross-ref validator)という主要な変更を正確に反映しており、ランク95+96の着陸を明記しています。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cli-docs-lint/src/main.rs`:
- Around line 31-87: The code defaults to CheckMode::All and lacks the ADR-039
experimental-feature pattern; update parse_args, CliArgs, and run to require
explicit opt-in (e.g., add an --enable-experimental flag or read a config opt-in
field in CliArgs), implement a kill-switch (check an env var like
DISABLE_EXPERIMENTAL or a config boolean and refuse to run experimental checks
when set), and enforce a bounded lifetime by adding a compile/time-constant
expiry date checked at startup (in parse_args or run) that returns an error if
expired; wire these checks so CheckMode::All only runs experimental checks when
opt-in is present, the kill-switch is not set, and the expiry has not passed.

In `@src/cli-docs-lint/src/preamble.rs`:
- Around line 18-21: The code always subtracts one from expected_total to
compute expected_without_summary, causing undercount when todo-summary.md is
absent; change the logic in the area around list_todo_files(docs_dir) /
expected_total / expected_without_summary to detect whether the returned
todo_files includes "todo-summary.md" (or check filesystem for
docs_dir/todo-summary.md) and only decrement by 1 when it exists (e.g.,
expected_without_summary = expected_total.saturating_sub(if todo_files contains
"todo-summary.md" {1} else {0})); keep the rest of the flow unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e1f8a82-37eb-4abf-a754-8bc42cf4141e

📥 Commits

Reviewing files that changed from the base of the PR and between 8bae4d0 and 3772fc5.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (20)
  • Cargo.toml
  • docs/handoff-rank-8-weekly-review-phase-b.md
  • docs/todo-summary.md
  • docs/todo.md
  • docs/todo2.md
  • docs/todo3.md
  • docs/todo4.md
  • docs/todo5.md
  • docs/todo6.md
  • docs/todo7.md
  • docs/todo9.md
  • package.json
  • push-runner-config.toml
  • scripts/deploy-hooks.ts
  • src/cli-docs-lint/Cargo.toml
  • src/cli-docs-lint/src/cross_ref.rs
  • src/cli-docs-lint/src/lib.rs
  • src/cli-docs-lint/src/main.rs
  • src/cli-docs-lint/src/preamble.rs
  • templates/push-runner-config.toml

Comment thread src/cli-docs-lint/src/main.rs
Comment thread src/cli-docs-lint/src/preamble.rs
…(kill-switch + bounded lifetime) + preamble has_summary check
@aloekun
Copy link
Copy Markdown
Owner Author

aloekun commented May 28, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@aloekun
Copy link
Copy Markdown
Owner Author

aloekun commented May 28, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@aloekun aloekun merged commit 91f2939 into master May 28, 2026
1 check passed
@aloekun aloekun deleted the cli-docs-lint branch May 28, 2026 04:03
aloekun added a commit that referenced this pull request May 29, 2026
…up 登録 (#181)

* docs(todo): PR #179 post-merge-feedback 採用 2 件を todo9.md / summary table に登録 (2026-05-28 ユーザー承認)

* docs(handoff): 順位 8 handoff doc を 2026-05-28 セッション結果で update — memory rule 追記 + auto-mode pattern 訂正 + Phase B+1 follow-up 関連付け
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant