From 492b38cc81840c0c129c77d67a55cf16034cbe02 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Wed, 26 Nov 2025 19:09:38 +0000 Subject: [PATCH] feat: Add linting script for coder_agent naming conventions Add a simple bash script that validates module documentation uses coder_agent.main consistently. This can be integrated into CI to prevent future inconsistencies. The script checks: - Module README files use coder_agent.main - Example templates use coder_agent.main - Root documentation uses coder_agent.main Usage: ./scripts/lint-agent-names.sh --- scripts/lint-agent-names.sh | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 scripts/lint-agent-names.sh diff --git a/scripts/lint-agent-names.sh b/scripts/lint-agent-names.sh new file mode 100755 index 00000000..96f80514 --- /dev/null +++ b/scripts/lint-agent-names.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Script to validate coder_agent naming conventions across the registry +# This ensures consistency between templates and module documentation + +ERRORS=0 + +echo "🔍 Linting coder_agent naming conventions..." +echo "" + +# Check 1: Module README files should use coder_agent.main +echo "📝 Checking module README files..." +if grep -r 'coder_agent\.' registry/*/modules/*/README.md 2> /dev/null | grep -v 'coder_agent\.main' | grep -v 'agent_id' | grep -v 'coder_agent\.id' | grep -v '# ' | grep -E 'coder_agent\.[a-z_]+'; then + echo "❌ ERROR: Module READMEs should reference 'coder_agent.main' in examples" + echo " Found references to other agent names above." + ERRORS=$((ERRORS + 1)) +else + echo "✅ All module READMEs use 'coder_agent.main'" +fi +echo "" + +# Check 2: Examples should use coder_agent.main +echo "📝 Checking example files..." +if [ -f "examples/templates/main.tf" ]; then + if grep -q 'coder_agent\.' examples/templates/main.tf | grep -v 'coder_agent\.main' 2> /dev/null; then + echo "❌ ERROR: examples/templates/main.tf should use 'coder_agent.main'" + ERRORS=$((ERRORS + 1)) + else + echo "✅ Example template uses 'coder_agent.main'" + fi +fi +echo "" + +# Check 3: Root documentation should use coder_agent.main +echo "📝 Checking root documentation..." +FILES_TO_CHECK=("README.md" "CONTRIBUTING.md") +for file in "${FILES_TO_CHECK[@]}"; do + if [ -f "$file" ]; then + if grep 'coder_agent\.' "$file" 2> /dev/null | grep -v 'coder_agent\.main' | grep -v '# ' | grep -v 'agent_id' | grep -v 'coder_agent\.id' | grep -E 'coder_agent\.[a-z_]+' > /dev/null 2>&1; then + echo "❌ ERROR: $file should use 'coder_agent.main' in examples" + ERRORS=$((ERRORS + 1)) + fi + fi +done + +if [ $ERRORS -eq 0 ]; then + echo "✅ All documentation uses 'coder_agent.main'" +fi +echo "" + +# Summary +if [ $ERRORS -eq 0 ]; then + echo "✅ All linting checks passed!" + exit 0 +else + echo "❌ Found $ERRORS linting error(s)" + echo "" + echo "â„šī¸ Module documentation should use 'coder_agent.main' in examples" + echo " to match the most common template convention (78% of templates)." + exit 1 +fi