update ai instructions

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-05-20 20:09:03 +02:00
parent 40bd5ca00d
commit e03557462a
3 changed files with 63 additions and 6 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ applyTo: "launch.py, webui.py, installer.py, modules/**/*.py, pipelines/**/*.py,
- Full startup: `python launch.py`
- Full lint sequence: `pnpm lint`
- Python checks individually: `pnpm ruff`, `pnpm pylint`
- JS checks: `pnpm eslint` and `pnpm eslint-ui`
- TypeScript checks: `pnpm eslint`, `pnpm tsc`
## Pitfalls
+60 -5
View File
@@ -1,5 +1,5 @@
---
description: "Use when editing frontend UI code, TypesScript, JavaScript, HTML, CSS, localization files, or built-in UI extensions including modernui and kanvas."
description: "Use when editing frontend UI code, TypeScript, JavaScript, HTML, CSS, localization files, or built-in UI extensions including modernui and kanvas."
name: "UI And Frontend Guidelines"
applyTo: "ui/**/*, extensions-builtin/sdnext-modernui/**/*, extensions-builtin/sdnext-kanvas/**/*"
---
@@ -7,10 +7,65 @@ applyTo: "ui/**/*, extensions-builtin/sdnext-modernui/**/*, extensions-builtin/s
Apply these rules in priority order:
1. Preserve the current event-handling logic and data flow between Gradio/Python endpoints and frontend handlers; do not change payload shapes without backend alignment.
If rules conflict, prioritize earlier rules over later ones unless explicitly stated otherwise.
1. 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.
2. Follow existing project lint and style patterns; prefer consistency with nearby files over introducing new frameworks or architecture.
3. Keep localization-friendly UI text changes synchronized with locale resources in `ui/locale/locale_*.json` when user-facing strings are added or changed.
4. Avoid bundling unrelated visual refactors with functional fixes; keep UI PRs scoped and reviewable.
3. Keep localization-friendly UI text changes synchronized with locale resources in `ui/locale/locale_*.json` when 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.
4. 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.
5. For extension UI work, respect each extension's boundaries and avoid cross-extension coupling.
6. Validate TypeScript and JavaScript changes with `pnpm eslint` and `pnpm tsc`.
6. Validate TypeScript and JavaScript changes with `npm run eslint` and `npm run tsc` from the repository root, or the equivalent extension-level command when working inside an extension.
7. 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/` and `extensions-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
Install dependencies from the repository root:
- `npm install`
Build UI components:
- `npm run build:core` - build the core UI
- `npm run build:modernui` - build ModernUI
- `npm run build:kanvas` - build Kanvas
- `npm run build` - build all UI components
Run development builds with watch mode:
- `npm run dev:core` - development build for core UI
- `npm run dev:modernui` - development build for ModernUI
- `npm run dev:kanvas` - development build for Kanvas
## Lint and validation
UI checks are required for all frontend contributions:
- `npm run eslint:core` - lint core UI files
- `npm run eslint:modernui` - lint ModernUI files
- `npm run eslint:kanvas` - lint Kanvas files
- `npm run eslint` - lint all UI code
- `npm run tsc:core` - type-check core UI files
- `npm run tsc:modernui` - type-check ModernUI files
- `npm run tsc:kanvas` - type-check Kanvas files
- `npm run tsc` - type-check all UI code
- `npm run precommit` - run pre-commit checks across the repository
- `npm 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.