ci(llms-full): regen via pre-commit hook; CI verifies sync#279
Merged
Conversation
Replaces the post-merge auto-push approach with a simpler design: 1. Pre-commit hook (auto-installed via npm install) regenerates llms-full.txt whenever a staged file could affect its content (any .md, llms.txt itself, or scripts/gen-llms-full.mjs). The regenerated file is auto-staged into the same commit. Dev sees nothing unless they bypass the hook. 2. CI's build-and-test job (ubuntu-latest only) re-runs the generator and fails if llms-full.txt is stale. Catches --no-verify bypass and devs who skipped npm install. Removes: - The PR-time auto-commit + push-back-to-PR-branch pattern. That contaminated PR heads with bot commits and made required status checks land on a SHA no one expected, breaking merge. - paths-ignore for llms-full.txt is no longer needed (the file is always committed by the dev's own commit, not bot pushes). Trade: dev needs Node on PATH at commit time (already required for the project). CI check catches everything else.
v0.2.1 was just tagged on main. Bump now so subsequent dev work on main accumulates under v0.2.2 (snapshot builds will read this for version_<sha> naming).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the post-merge auto-push approach with a simpler, lower-attack-surface design:
npm install) regeneratesllms-full.txtwhenever a staged file could affect its content (any.md,llms.txtitself, orscripts/gen-llms-full.mjs). The regenerated file is auto-staged into the same commit. Dev sees nothing unless they bypass the hook.llms-full.txtis stale. Catches--no-verifybypass and devs who skippednpm install.Why this over the post-merge auto-push pattern
Considered (and rejected):
update-llms-fulljob that committed back to the PR branch as github-actions[bot] -- contaminated PR heads with bot commits and made required status checks land on a SHA no one expected, breaking merge. (Confirmed during the recent feat/agy-support merge.)The hook + CI-check pattern needs zero new secrets, no branch-protection bypass actors, no GitHub Apps, and no env-with-reviewers. The file is committed by the dev's own commit (transparently), so it naturally lands in the PR's squash commit through normal git flow.
Changes
.github/hooks/pre-commit: keeps existing portability checks (non-ASCII, PS backtick), adds an llms-full.txt regen block guarded by "did the staged set include any input to gen-llms-full.mjs?".github/workflows/ci.yml:build-and-test(ubuntu-latest only), so it's automatically a required check via the existingbuild-and-test (ubuntu-latest)context.update-llms-fulljob.llms-full.txtfrompaths-ignore(no longer needed -- the file is always part of the dev's commit, not bot pushes).Test plan
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com