mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-01 19:20:10 +00:00
## Summary Pure rename of CLAUDE.md files to AGENTS.md (no content changes). ## Changes | Old Path | New Path | |----------|----------| | `.github/CLAUDE.md` | `.github/AGENTS.md` | | `.storybook/CLAUDE.md` | `.storybook/AGENTS.md` | | `browser_tests/CLAUDE.md` | `browser_tests/AGENTS.md` | | `src/CLAUDE.md` | `src/AGENTS.md` | | `src/components/CLAUDE.md` | `src/components/AGENTS.md` | | `src/lib/litegraph/CLAUDE.md` | `src/lib/litegraph/AGENTS.md` | Root `CLAUDE.md` deleted (content will be merged into `AGENTS.md` in follow-up PR). ## Follow-up A second PR will add glob-based guidance files and consolidate redundancies. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org>
42 lines
1.3 KiB
Markdown
42 lines
1.3 KiB
Markdown
# Litegraph Guidelines
|
|
|
|
## Code Philosophy
|
|
|
|
- Write concise, legible, and easily maintainable code
|
|
- Avoid repetition where possible, but not at expense of legibility
|
|
- Prefer running single tests, not the whole suite, for performance
|
|
|
|
## Code Style
|
|
|
|
- Prefer single line `if` syntax for concise expressions
|
|
- Take advantage of `TypedArray` `subarray` when appropriate
|
|
- The `size` and `pos` properties of `Rectangle` share the same array buffer
|
|
- Prefer returning `undefined` over `null`
|
|
- Type assertions are a last resort (acceptable for legacy code interop)
|
|
|
|
## Circular Dependencies in Tests
|
|
|
|
**CRITICAL**: Always import from the barrel export for subgraph code:
|
|
|
|
```typescript
|
|
// ✅ Correct - barrel import
|
|
import { LGraph, Subgraph, SubgraphNode } from "@/lib/litegraph/src/litegraph"
|
|
|
|
// ❌ Wrong - causes circular dependency
|
|
import { LGraph } from "@/lib/litegraph/src/LGraph"
|
|
```
|
|
|
|
**Root cause**: `LGraph` ↔ `Subgraph` circular dependency (Subgraph extends LGraph, LGraph creates Subgraph instances).
|
|
|
|
## Test Helpers
|
|
|
|
```typescript
|
|
import { createTestSubgraph, createTestSubgraphNode } from "./fixtures/subgraphHelpers"
|
|
|
|
function createTestSetup() {
|
|
const subgraph = createTestSubgraph()
|
|
const subgraphNode = createTestSubgraphNode(subgraph)
|
|
return { subgraph, subgraphNode }
|
|
}
|
|
```
|