Files
ComfyUI_frontend/.agents/checks/import-graph.md
Christian Byrne df69d6b5d4 feat: add Amp code review checks (#9445)
## Summary

Add 22 automated code review check definitions and 1 strict ESLint
config to `.agents/checks/` for Amp-powered code review.

## Changes

- **What**: 23 files in `.agents/checks/` covering accessibility, API
contracts, architecture, bug patterns, CodeRabbit integration,
complexity, DDD structure, dependency/secrets scanning, doc freshness,
DX/readability, ecosystem compatibility, error handling, import graph,
memory leaks, pattern compliance, performance, regression risk,
security, SAST, SonarJS linting, test quality, and Vue patterns. Each
check includes YAML frontmatter (name, description, severity-default,
tools) and repo-specific guidance tailored to ComfyUI_frontend
conventions.

## Review Focus

- Check definitions are config-only (no runtime code changes)
- Checks reference repo-specific patterns (e.g., `useErrorHandling`
composable, `useToastStore`, `es-toolkit`, Tailwind 4, Vue Composition
API)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9445-feat-add-Amp-code-review-checks-31a6d73d3650817a8466fe2f4440a350)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <action@github.com>
2026-03-05 15:29:30 -08:00

3.0 KiB

name, description, severity-default, tools
name description severity-default tools
import-graph Validates import rules, detects circular dependencies, and enforces layer boundaries using dependency-cruiser high
Bash
Read

Run dependency-cruiser import graph analysis on changed files to detect circular dependencies, orphan modules, and import rule violations.

Note: The circular dependency scan in step 4 targets src/ specifically, since this is a frontend app with source code under src/.

Steps

  1. Check if dependency-cruiser is available:
    pnpm dlx dependency-cruiser --version
    
    If not available, skip this check and report: "Skipped: dependency-cruiser not available. Install with: pnpm add -D dependency-cruiser"

Install: pnpm add -D dependency-cruiser

  1. Identify changed directories from the diff.

  2. Determine config to use:

    • If .dependency-cruiser.js or .dependency-cruiser.cjs exists in the repo root, use it (dependency-cruiser auto-detects it). This config may enforce layer architecture rules (e.g., base → platform → workbench → renderer import direction):
      pnpm dlx dependency-cruiser --output-type json <changed_directories> 2>/dev/null
      
    • If no config exists, run with built-in defaults:
      pnpm dlx dependency-cruiser --no-config --output-type json <changed_directories> 2>/dev/null
      
  3. Also check for circular dependencies specifically across src/:

    pnpm dlx dependency-cruiser --no-config --output-type json --do-not-follow "node_modules" --include-only "^src" src 2>/dev/null
    

    Look for modules where .circular == true in the output.

  4. Parse the JSON output. Each violation has:

    • rule.name: the violated rule
    • rule.severity: error, warn, info
    • from: importing module
    • to: imported module
  5. Map violation severity:

    • errormajor
    • warnminor
    • infonitpick
    • Circular dependencies → major (category: architecture)
    • Orphan modules → nitpick (category: dx)
  6. Report each violation with: the rule name, source and target modules, file path, and a suggestion (usually move the import or extract an interface).

What It Catches

Rule What It Detects
no-circular Circular dependency chains (A → B → C → A)
no-orphans Modules with no incoming or outgoing dependencies
not-to-dev-dep Production code importing devDependencies
no-duplicate-dep-types Same dependency in multiple sections of package.json
Custom layer rules Import direction violations (e.g., base → platform)

Error Handling

  • If pnpm dlx is not available, skip and report the error.
  • If the config file fails to parse, fall back to --no-config.
  • If there are more than 50 violations, report the first 20 and note the total count.
  • If no violations are found, report "No issues found."