Phiên bản
Ngôn ngữ

description: "Static code SEO audit — scan codebase for SEO templates, alt-tags, metadata, and database loops" version: "1.0"

/seo-audit-code <domain|url> [--performance] [--source-path ]

Purpose

Performs static code analysis of the website files in the workspace (default: ./sourcecode/) to verify compliance with SEO structure rules and performance best practices. Generates diff patches for easy auto-fixing.


Steps

  1. Init/load domain project (Primary Agent: @[tech-seo-director]):

    • If project doesn't exist, initialize it: python .agents/scripts/run_plugin_script.py seo-core project_manager.py init <domain>
    • Locate project directory PROJECT_DIR = .seo
  2. Verify and Resolve Target Path:

    • Check if ./sourcecode/ exists in the workspace. If yes, default to ./sourcecode.
    • If not, check if settings.source_code_path is defined in project.json.
    • If not, check for dynamic framework signatures (WordPress themes, Next.js page roots).
  3. Performance Scan Gate:

    • If --performance is not passed, prompt the user: "Bạn có muốn quét sâu về hiệu năng code (Level 2 - Ví dụ: query database trùng lặp, loop lồng nhau) không? (Y/N)"
    • Set the --performance flag accordingly based on response.
  4. Execute Scanner Script:

    • Run the Python scanner:
      python .agents/scripts/run_plugin_script.py seo-code code_scanner.py \
        --project-dir <PROJECT_DIR> \
        [--performance] \
        [--source-path <path>]
      
    • This writes code-audit-{date}.json into <PROJECT_DIR>/data/.
  5. Generate Diffs & Propose Fixes:

    • Read the scanned issues.
    • For structural template changes (e.g. adding missing hooks, image alt tags, canonicals), generate the precise diff patches.
    • Save the proposed fixes to <PROJECT_DIR>/fixes/{date}/proposed-fixes.json.
  6. Create Markdown Report:

    • Apply templates to output <PROJECT_DIR>/reports/code-audit-{date}.md.
    • Display a summary of issues classified by severity (Critical, High, Medium, Low) and framework area.
    • Display side-by-side diff mockups in the report for user review.
  7. User Approval (Suggest & Approve Gate):

    • Present the summary of issues and generated diffs.
    • Ask the user: "Đã tạo đề xuất sửa lỗi tại .seo/fixes/{date}/. Bạn muốn tự động sửa các lỗi này không? (Y/N)"
    • If Yes:
      python .agents/scripts/run_plugin_script.py seo-code code_fixer.py \
        --fix-file <PROJECT_DIR>/fixes/{date}/proposed-fixes.json