Repository navigation
feat(standards): include GEMINI.md in agent configuration standard and audit #1378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ on: | |
| type: string | ||
| default: | | ||
| CLAUDE.md | ||
| GEMINI.md | ||
| AGENTS.md | ||
| org-standards-ref: | ||
| description: "String AGENTS.md must reference (regex, basic grep -E)" | ||
|
|
@@ -89,6 +90,12 @@ jobs: | |
| status=1 | ||
| fi | ||
|
|
||
| if [ -f "GEMINI.md" ] && \ | ||
| ! grep -qi 'AGENTS.md' GEMINI.md; then | ||
| echo "::error file=GEMINI.md::Must reference AGENTS.md" | ||
| status=1 | ||
| fi | ||
|
Comment on lines
+93
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Gemini pass/fail decision is implemented directly in the reusable workflow, contrary to AGENTS.md reference: AGENTS.md:L175-L177 Useful? React with 👍 / 👎. |
||
|
|
||
| if [ -f "AGENTS.md" ] && \ | ||
| ! grep -qiE "$ORG_REF" AGENTS.md; then | ||
| echo "::error file=AGENTS.md::Must reference org standards ($ORG_REF)" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # GEMINI.md | ||
|
|
||
| This repository follows the development and agentic architecture standards defined in [AGENTS.md](AGENTS.md) and [`combsmith/.github/AGENTS.md`](https://github.com/combsmith/.github/blob/main/AGENTS.md). | ||
|
|
||
| Read [AGENTS.md](AGENTS.md) for full context, project conventions, testing guidelines, and architectural rules. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2477,6 +2477,32 @@ check_claude_md() { | |
| fi | ||
| } | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Check: GEMINI.md exists and references AGENTS.md | ||
| # --------------------------------------------------------------------------- | ||
| check_gemini_md() { | ||
| local repo="$1" | ||
|
|
||
| local content | ||
| content=$(gh_api "repos/$ORG/$repo/contents/GEMINI.md" --jq '.content' 2>/dev/null || echo "") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔎 Supported by static analysis
Distinguish a 404 from other Contents API failures.
|
||
|
|
||
| if [ -z "$content" ]; then | ||
| add_finding "$repo" "standards" "missing-gemini-md" "error" \ | ||
| "Missing \`GEMINI.md\` — every repo must have a GEMINI.md that references AGENTS.md" \ | ||
| "AGENTS.md" | ||
| return | ||
| fi | ||
|
|
||
| local decoded | ||
| decoded=$(echo "$content" | base64 -d 2>/dev/null || echo "") | ||
|
|
||
| if ! echo "$decoded" | grep -qi 'AGENTS\.md'; then | ||
| add_finding "$repo" "standards" "gemini-md-missing-agents-ref" "error" \ | ||
| "\`GEMINI.md\` does not reference \`AGENTS.md\`" \ | ||
| "AGENTS.md" | ||
| fi | ||
| } | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Check: AGENTS.md exists and references org .github/AGENTS.md | ||
| # --------------------------------------------------------------------------- | ||
|
|
@@ -3062,7 +3088,7 @@ create_umbrella_issue() { | |
| "reusable-workflows|Reusable Workflows (disabled_manually)|gh workflow disable <workflow> -R <repo>" | ||
| "action-pinning|Action SHA Pinning|pin actions to SHA in each workflow file" | ||
| "dependabot|Dependabot Configuration|per-repo .github/dependabot.yml" | ||
| "standards|Agent Standards (CLAUDE.md / AGENTS.md / copilot-setup-steps.yml)|per-repo doc and workflow additions" | ||
| "standards|Agent Standards (CLAUDE.md / GEMINI.md / AGENTS.md / copilot-setup-steps.yml)|per-repo doc and workflow additions" | ||
| ) | ||
|
|
||
| local body | ||
|
|
@@ -3657,6 +3683,7 @@ main() { | |
| check_verbatim_stubs "$repo" | ||
| check_centralized_check_names "$repo" | ||
| check_claude_md "$repo" | ||
| check_gemini_md "$repo" | ||
| check_agents_md "$repo" | ||
| check_copilot_setup_steps "$repo" | ||
| check_copilot_instructions "$repo" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/usr/bin/env bats | ||
| # Unit tests for check_gemini_md in scripts/compliance-audit.sh | ||
| # (standards/agent-standards.md). | ||
|
|
||
| bats_require_minimum_version 1.5.0 | ||
|
|
||
| REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../.." && pwd)" | ||
| SCRIPT="$REPO_ROOT/scripts/compliance-audit.sh" | ||
|
|
||
| setup() { | ||
| TMPDIR_TEST="$(mktemp -d)" | ||
| export TMPDIR_TEST | ||
| } | ||
|
|
||
| teardown() { | ||
| rm -rf "$TMPDIR_TEST" | ||
| } | ||
|
|
||
| run_check_gemini_md() { | ||
| local repo="$1" gemini_body="$2" | ||
| bash -c ' | ||
| set -euo pipefail | ||
| export ORG="combsmith" | ||
| export OUTPUT_DIR="'"$TMPDIR_TEST"'" | ||
| source "'"$SCRIPT"'" | ||
| FINDINGS_FILE="$OUTPUT_DIR/findings.json" | ||
| echo "[]" > "$FINDINGS_FILE" | ||
| findings_count=0 | ||
| GEMINI_BODY="$2" | ||
| gh_api() { | ||
| if [ -z "$GEMINI_BODY" ]; then | ||
| return 1 | ||
| fi | ||
| printf "%s" "$GEMINI_BODY" | base64 | tr -d "\n" | ||
| printf "\n" | ||
| } | ||
| check_gemini_md "$1" | ||
| cat "$FINDINGS_FILE" | ||
| ' _ "$repo" "$gemini_body" | ||
| } | ||
|
|
||
| @test "check_gemini_md: compliant GEMINI.md referencing AGENTS.md produces no finding" { | ||
| run run_check_gemini_md "incubator" "# GEMINI.md | ||
| See [AGENTS.md](AGENTS.md) and https://github.com/combsmith/.github/blob/main/AGENTS.md" | ||
| [ "$status" -eq 0 ] | ||
| [ "$output" = "[]" ] | ||
| } | ||
|
|
||
| @test "check_gemini_md: missing GEMINI.md raises missing-gemini-md error" { | ||
| run run_check_gemini_md "incubator" "" | ||
| [ "$status" -eq 0 ] | ||
| [[ "$output" == *'"check": "missing-gemini-md"'* ]] | ||
| [[ "$output" == *'"severity": "error"'* ]] | ||
| } | ||
|
|
||
| @test "check_gemini_md: GEMINI.md without AGENTS.md reference raises gemini-md-missing-agents-ref error" { | ||
| run run_check_gemini_md "incubator" "# GEMINI.md | ||
| Project instructions without referencing the required file." | ||
| [ "$status" -eq 0 ] | ||
| [[ "$output" == *'"check": "gemini-md-missing-agents-ref"'* ]] | ||
| [[ "$output" == *'"severity": "error"'* ]] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match the literal
AGENTS.mdfilename.If
GEMINI.mdsaysAGENTS-mdinstead ofAGENTS.md, this grep succeeds because.matches any character. The required CI check then passes a file that lacks the required reference. Usegrep -qiF 'AGENTS.md'. As per coding guidelines, “GEMINI.md” MUST referenceAGENTS.mdfor development standards.Source: Coding guidelines