From e03557462a0fc2d8108cfa58473dbba72136050d Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 20 May 2026 20:09:03 +0200 Subject: [PATCH] update ai instructions Signed-off-by: Vladimir Mandic --- .github/instructions/core.instructions.md | 2 +- .github/instructions/ui.instructions.md | 65 +++++++++++++++++++++-- AGENTS.md | 2 + 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/.github/instructions/core.instructions.md b/.github/instructions/core.instructions.md index f0c9c7d9f..84f85c3c6 100644 --- a/.github/instructions/core.instructions.md +++ b/.github/instructions/core.instructions.md @@ -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 diff --git a/.github/instructions/ui.instructions.md b/.github/instructions/ui.instructions.md index 0334b7f8d..44702c0bf 100644 --- a/.github/instructions/ui.instructions.md +++ b/.github/instructions/ui.instructions.md @@ -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. diff --git a/AGENTS.md b/AGENTS.md index eddab0ef8..defdaf73c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,3 +6,5 @@ - For UI tasks, also review instructions `.github/instructions/ui.instructions.md` For specific SKILLS, also review the relevant skill files specified in `.github/skills/README.md` and listed `.github/skills/*/SKILL.md` + +For specific GUIDELINES, also review the relevant guideline files specified in `wiki/Dev-*.md` and listed in `wiki/Dev-Home.md`