mirror of
https://github.com/vladmandic/automatic
synced 2026-08-28 08:00:59 +02:00
9ade767836
Signed-off-by: Vladimir Mandic <mandic00@live.com>
4.8 KiB
4.8 KiB
description, name, applyTo
| description | name | applyTo |
|---|---|---|
| Use when editing frontend UI code, TypeScript, JavaScript, HTML, CSS, localization files, or built-in UI extensions including modernui and kanvas. | UI And Frontend Guidelines | ui/**/*, extensions-builtin/sdnext-modernui/**/*, extensions-builtin/sdnext-kanvas/**/* |
Agent Guidelines
- Verify the user instruction against relevant guidelines in this file and linked instruction files before proceeding.
- If the instruction conflicts with any guideline, do not proceed. Explain which guideline(s) it conflicts with and how to adjust the instruction to comply.
- If the instruction is valid but unclear or incomplete, ask targeted follow-up questions before implementation. Do not assume user intent or requirements.
- When giving feedback, name the applicable guideline(s) and explain how each one applies.
- If the instruction is clear and compliant, proceed and keep resulting changes aligned with project coding style, conventions, and structure.
Language Guidelines
- Use clear and concise language when communicating with users, providing feedback, and explaining guidelines.
- Avoid unnecessary pleasantries or filler language; focus on the technical content and actionable feedback.
- When asking follow-up questions for clarification, be direct and specific about the information needed to proceed with the instruction while ensuring that the questions are relevant to the project guidelines and conventions.
UI And Frontend Guidelines
Apply these rules in priority order:
If rules conflict, prioritize earlier rules over later ones unless explicitly stated otherwise.
- Preserve the current event-handling logic and data flow between Gradio/Python endpoints and frontend handlers. Do not modify payload shapes or event-handling mechanisms unless explicitly aligned with the backend team.
- Follow existing project lint and style patterns; prefer consistency with nearby files over introducing new frameworks or architecture.
- Keep localization-friendly UI text changes synchronized with locale resources in
ui/locale/locale_*.jsonwhen user-facing strings are added or changed. For dynamically generated UI text, ensure that localization keys are pre-defined and referenced appropriately in the codebase. - Avoid combining visual changes that do not directly support the functional fixes being implemented; ensure UI PRs are scoped to a single purpose and remain reviewable.
- For extension UI work, respect each extension's boundaries and avoid cross-extension coupling.
- Validate TypeScript and JavaScript changes with
pnpm run eslintandpnpm run tscfrom the repository root, or the equivalent extension-level command when working inside an extension. - Maintain mobile compatibility when touching layout or interaction behavior.
UI code locations
- Core UI source:
ui/ - Core build config:
ui/.build.json - ModernUI source:
extensions-builtin/sdnext-modernui/src/ - Kanvas source:
extensions-builtin/sdnext-kanvas/src/ - ModernUI built output:
extensions-builtin/sdnext-modernui/javascript/ - Kanvas built output:
extensions-builtin/sdnext-kanvas/javascript/andextensions-builtin/sdnext-kanvas/dist/ - Core built output:
ui/dist/
Do not edit built files directly. Always change source files and use the build commands to regenerate UI artifacts.
Build and development commands
Ensure pnpm is installed:
npm install -g pnpm
Install dependencies from the repository root:
pnpm install
Build UI components:
pnpm run build:core- build the core UIpnpm run build:modernui- build ModernUIpnpm run build:kanvas- build Kanvaspnpm run build- build all UI components
Run development builds with watch mode:
pnpm run dev:core- development build for core UIpnpm run dev:modernui- development build for ModernUIpnpm run dev:kanvas- development build for Kanvas
Lint and validation
UI checks are required for all frontend contributions:
pnpm run eslint:core- lint core UI filespnpm run eslint:modernui- lint ModernUI filespnpm run eslint:kanvas- lint Kanvas filespnpm run eslint- lint all UI codepnpm run tsc:core- type-check core UI filespnpm run tsc:modernui- type-check ModernUI filespnpm run tsc:kanvas- type-check Kanvas filespnpm run tsc- type-check all UI codepnpm run precommit- run pre-commit checks across the repositorypnpm run ui- run full UI lint/type/build sequence
Notes
- UI changes require rebuilding before they are visible in the running application.
- If you are changing UI text, update localization resources in
ui/locale/as needed. - If a build command fails, check the error logs and ensure all dependencies are installed. Refer to the repository troubleshooting guide for common issues.
- Use the existing code patterns in the current UI folders rather than introducing parallel frontend frameworks.