Skip to content

feat(automation): auto-sync listings from NN-slug/index.html#36

Merged
watanabe-kohei-jp merged 5 commits into
mainfrom
work/auto-listings
May 25, 2026
Merged

feat(automation): auto-sync listings from NN-slug/index.html#36
watanabe-kohei-jp merged 5 commits into
mainfrom
work/auto-listings

Conversation

@watanabe-kohei-jp
Copy link
Copy Markdown
Collaborator

Summary

  • 新しい講義ディレクトリ (NN-slug/) を追加するだけで sitemap.xml / llms.txt / index.html / README.md の講義一覧が自動同期される仕組みを導入
  • 真実源は NN-slug/index.html<title><meta name="description"><section> 数(標準ライブラリ Python で抽出)
  • PR では CI が --check を強制(sync-listings-check.yml)、main では bot が --write で自己修復(sync-listings-bot.yml

Related Issue

No-Issue: PR #31 と STRATEGY.md「第1段:正典化+GEO」の同期漏れ恒久対策。先行 PR で手動同期した直後の改善で、独立した issue 化は冗長。

Changes

  • scripts/sync_listings.py — メインスクリプト(--check / --write、Python 3.x 標準ライブラリのみ)
  • scripts/README.md — 使い方ドキュメント
  • .github/workflows/sync-listings-check.yml — PR 時の verify-only
  • .github/workflows/sync-listings-bot.yml — main 時の auto-commit (github-actions[bot])
  • sitemap.xml / llms.txt / index.html / README.md — マーカー埋め込み、現状の listing を再生成
  • CONTRIBUTING.md / CLAUDE.md / _template/index.html — 自動同期の運用ノートを追記

<meta description> をそのまま流用する方針なので、index.htmlllms.txt.desc は各講義の <meta name="description"> 全文に置き換わります(既存の手書き短文との差し替え)。README の章テーブルも <title> から抽出した topic 名に揃います。

Test plan

  • python3 scripts/sync_listings.py --check が pass する(初期同期済み)
  • ファイルを意図的に壊して --check が exit 1 + diff レポートを出すこと
  • --write で自動修復され、再度 --check が pass すること
  • PR で Listings Sync Check ワークフローが green になることを確認
  • merge 後 Listings Sync BotNo changes で終了することを確認
  • 次の新規 Lecture 追加 PR で、scripts/sync_listings.py だけで 4 ファイルが揃うことを実証

🤖 Generated with Claude Code

watanabe-kohei-jp and others added 2 commits May 21, 2026 15:40
既存講義 02-setup / 03-claude-md を SEO・GEO 系メタデータに同期し、
02/03 の og:url が旧 GitHub Pages URL を指していた誤りを修正する。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NN-slug/index.html を真実源として sitemap.xml / llms.txt / index.html /
README.md の講義一覧ブロックを自動生成する仕組みを追加。

- scripts/sync_listings.py: <title> / <meta description> / <section> 数を
  抽出して各 listing ファイルのマーカー間を再生成する
- sync-listings-check.yml: PR で --check を強制
- sync-listings-bot.yml: main へのマージ後 --write して bot コミット
- 4 ファイルにマーカー埋め込み、現状の listing を再生成済み
- CONTRIBUTING.md / CLAUDE.md / _template/index.html に運用ノート追記

PR #31 で手動同期した同期漏れの再発防止。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
main 上の以下の変更を取り込み:
- dist/ 完全版ビルド (#34) と pages-deploy.yml
- STRATEGY.md の取り下げ (#26)
- 各講義のスライド枚数更新 (00:10/01:13/02:13/03:13)

コンフリクト解消:
- 02/03 の og:description は main の新しい枚数表記を採用
- README.md / llms.txt の listing 領域は本ブランチのマーカー構造を維持し、
  sync_listings.py --write で main の最新メタから再生成
main 取り込み後の各講義 index.html の最終コミット日 (2026-05-19) を
sitemap.xml に反映する。
Comment thread .github/workflows/sync-listings-check.yml Fixed
@watanabe-kohei-jp watanabe-kohei-jp marked this pull request as ready for review May 24, 2026 09:46
Codex レビュー (PR #36) で出た 6 点を反映:

1. HTML/XML エスケープ: render_sitemap / render_index_html / render_readme_table
   が title / description / dir_name を生で埋めていたため、`<`, `&`, `"` 等が
   入った瞬間に root index.html や sitemap.xml の構造が壊れるリスクがあった。
   html.escape() を出力側で適用。読み込み側は html.unescape() で正規化して
   ダブルエンコードを避ける。
2. Marker injection 対策: title / description に '<!-- listings:auto'、改行、
   '|' (markdown table 破壊要因) のいずれかが入っていたら fail させる
   pre-flight validation (validate_metadata) を追加。
3. README table 破壊対策: 1+2 と同系統。`|` を pre-flight で reject + 角括弧を
   markdown 側でエスケープ。
4. discover_lectures が NN-slug/index.html 不在を silently skip していたのを
   SystemExit に変更。壊れた lecture を見逃さない。
5. sync-listings-check.yml に permissions: contents: read を明示。
6. sync-listings-bot.yml の git add -A を 4 ファイル限定に絞り、
   concurrency group を追加して push race を防止。
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.

2 participants