fix(agent-rules): accept both scope-index headings in validation - #62
Conversation
generate-agents.sh emits the root scope index under the heading "## Scoped AGENTS.md (MUST read when working in these directories)" (strengthened from the legacy "## Index of scoped AGENTS.md" in commit bbb6899), but validate-structure.sh still grepped for the legacy literal. A freshly generated root longer than 50 lines therefore failed the skill's own structure validation: ERROR: Root is bloated: N lines and no scope index Match both headings via a shared ERE so validation stays in sync with the generator and remains backward-compatible with files produced by older versions and the reference examples (which use the legacy heading). Add a regression test that drives generate-agents.sh -> validate-structure.sh end to end and a workflow to run it, so the two cannot drift apart again. Fixes #55 Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
There was a problem hiding this comment.
Code Review
This pull request introduces a regression test script (test-scope-index-heading.sh) and updates validate-structure.sh to support both current and legacy scope-index headings via a regular expression, ensuring backward compatibility. The review feedback highlights portability issues with using sed -i without arguments in the test script on macOS versus Linux, suggesting a temporary file redirection approach instead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Replace GNU-only `sed -i` with a temp-file + mv form so the regression test runs on BSD sed (macOS) as well as GNU sed; this repo's CI also runs the generator on macos-latest. Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
|



Problem
generate-agents.shemits the root scope index under the heading(strengthened from the legacy
## Index of scoped AGENTS.mdin commitbbb6899), butvalidate-structure.shstill grepped for the legacy literal in three places. A freshly generated root longer than 50 lines therefore failed the skill's own structure validation:Fixes #55.
Fix
Introduce one shared ERE —
^## (Index of scoped|Scoped) AGENTS\.md— and use it in all three checks (check_root_is_thin, thecheck_scope_linksguard, and thesedblock extraction). This keeps the validator in sync with the generator and backward-compatible with files produced by older versions and the reference examples, which still use the legacy heading (including this repo's own rootAGENTS.md).Regression guard
skills/agent-rules/scripts/tests/test-scope-index-heading.shdrivesgenerate-agents.sh→validate-structure.shend to end and asserts:A new
Test Scriptsworkflow (.github/workflows/test-scripts.yml) runs it on PRs touchingskills/agent-rules/scripts/**orassets/**.Verification
The test was confirmed to fail against the pre-fix validator (exits 1 at test 1) and pass against the fix — so it is a genuine guard, not a tautology.
actionlint,shellcheck, andbash -nall clean.