From 2ba04bb1bd506e8018dd18d150f96ec894fd5619 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Thu, 27 Aug 2026 17:14:40 +0800 Subject: [PATCH] docs: merge CLAUDE.md content into AGENTS.md and remove CLAUDE.md --- AGENTS.md | 150 +++++++++++++++++++++++++++++++------------ CLAUDE.md | 189 ------------------------------------------------------ 2 files changed, 109 insertions(+), 230 deletions(-) delete mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md index 480bee6c..783981c3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,6 +2,10 @@ This file provides guidance for agentic coding assistants working in this repository. +## Overview + +ComfyUI LoRA Manager is a comprehensive LoRA management system for ComfyUI that combines a Python backend with browser-based widgets. It provides model organization, downloading from CivitAI/CivArchive, recipe management, and one-click workflow integration. + ## Development Commands ### Backend Development @@ -28,16 +32,21 @@ COVERAGE_FILE=coverage/backend/.coverage pytest \ --cov=py --cov=standalone \ --cov-report=term-missing \ --cov-report=html:coverage/backend/html \ - --cov-report=xml:coverage/backend/coverage.xml + --cov-report=xml:coverage/backend/coverage.xml \ + --cov-report=json:coverage/backend/coverage.json ``` ### Frontend Development (LoRA Manager Web UI) ```bash +# Install dependencies (root and Vue widgets) npm install +cd vue-widgets && npm install && cd .. + npm test # Run all tests (JS + Vue) npm run test:js # Run JS tests only -npm run test:watch # Watch mode +npm run test:vue # Run Vue widget tests only +npm run test:watch # Watch mode (JS tests only) npm run test:coverage # Generate coverage report ``` @@ -54,88 +63,159 @@ npm run test:watch # Watch mode npm run test:coverage # Generate coverage report ``` -## Python Code Style +### Localization -### Imports & Formatting +```bash +# Sync translation keys after UI string updates +python scripts/sync_translation_keys.py +``` + +Locale files are in `locales/` (en, zh-CN, zh-TW, ja, ko, fr, de, es, ru, he). + +## Code Style + +### Python + +#### Imports & Formatting - Use `from __future__ import annotations` for forward references - Group imports: standard library, third-party, local (blank line separated) +- Use `TYPE_CHECKING` guard for type-checking-only imports - Absolute imports within `py/`: `from ..services import X` - PEP 8 with 4-space indentation, type hints required -### Naming Conventions +#### Naming Conventions - Files: `snake_case.py`, Classes: `PascalCase`, Functions/vars: `snake_case` - Constants: `UPPER_SNAKE_CASE`, Private: `_protected`, `__mangled` -### Error Handling & Async +#### Error Handling & Async - Use `logging.getLogger(__name__)`, define custom exceptions in `py/services/errors.py` - `async def` for I/O, `@pytest.mark.asyncio` for async tests - Singleton with `asyncio.Lock`: see `ModelScanner.get_instance()` - Return `aiohttp.web.json_response` or `web.Response` -### Testing +### JavaScript/TypeScript -- `pytest` with `--import-mode=importlib` -- Fixtures in `tests/conftest.py`, use `tmp_path_factory` for isolation -- Mark tests needing real paths: `@pytest.mark.no_settings_dir_isolation` -- Mock ComfyUI dependencies via conftest patterns - -## JavaScript/TypeScript Code Style - -### Imports & Modules +#### Imports & Modules - ES modules: `import { app } from "../../scripts/app.js"` for ComfyUI - Vue: `import { ref, computed } from 'vue'`, type imports: `import type { Foo }` - Export named functions: `export function foo() {}` -### Naming & Formatting +#### Naming & Formatting - camelCase for functions/vars/props, PascalCase for classes - Constants: `UPPER_SNAKE_CASE`, Files: `snake_case.js` or `kebab-case.js` - 2-space indentation preferred (follow existing file conventions) - Vue Single File Components: `