mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-11 08:00:21 +00:00
## 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>
3.0 KiB
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 |
|
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 undersrc/.
Steps
- Check if dependency-cruiser is available:
If not available, skip this check and report: "Skipped: dependency-cruiser not available. Install with:
pnpm dlx dependency-cruiser --versionpnpm add -D dependency-cruiser"
Install:
pnpm add -D dependency-cruiser
-
Identify changed directories from the diff.
-
Determine config to use:
- If
.dependency-cruiser.jsor.dependency-cruiser.cjsexists 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
- If
-
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/nullLook for modules where
.circular == truein the output. -
Parse the JSON output. Each violation has:
rule.name: the violated rulerule.severity: error, warn, infofrom: importing moduleto: imported module
-
Map violation severity:
error→majorwarn→minorinfo→nitpick- Circular dependencies →
major(category: architecture) - Orphan modules →
nitpick(category: dx)
-
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."