add copilot-instructions

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-03-04 12:16:06 +01:00
parent eb9d9f6bb0
commit f879c2d09a
4 changed files with 88 additions and 19 deletions
+15
View File
@@ -0,0 +1,15 @@
---
description: "Use when editing Python core runtime code, startup flow, model loading, API internals, backend/device logic, or shared state in modules and pipelines."
name: "Core Runtime Guidelines"
applyTo: "launch.py, webui.py, installer.py, modules/**/*.py, pipelines/**/*.py, scripts/**/*.py, extensions-builtin/**/*.py"
---
# Core Runtime Guidelines
- Preserve startup ordering and import timing in `launch.py` and `webui.py`; avoid moving initialization steps unless required.
- Treat `modules/shared.py` as the source of truth for global runtime state (`shared.opts`, model references, backend/device flags).
- Prefer narrow changes with explicit side effects; avoid introducing new cross-module mutable globals.
- Keep platform paths neutral: do not assume CUDA-only behavior and preserve ROCm/IPEX/DirectML/OpenVINO compatibility branches.
- Keep extension and script loading resilient: when adding startup scans/hooks, preserve partial-failure tolerance and logging.
- Follow existing API/server patterns under `modules/api/` and reuse shared queue/state helpers rather than ad-hoc request handling.
- Reuse established model-loading and pipeline patterns (`modules/sd_*`, `pipelines/`) instead of creating parallel abstractions.
- For substantial Python changes, run at least relevant checks: `npm run ruff` and `npm run pylint` (or narrower equivalents when appropriate).
+14
View File
@@ -0,0 +1,14 @@
---
description: "Use when editing frontend UI code, JavaScript, HTML, CSS, localization files, or built-in UI extensions including modernui and kanvas."
name: "UI And Frontend Guidelines"
applyTo: "javascript/**/*.js, html/**/*.html, html/**/*.css, html/**/*.js, extensions-builtin/sdnext-modernui/**/*, extensions-builtin/sdnext-kanvas/**/*"
---
# UI And Frontend Guidelines
- Preserve existing UI behavior and wiring between Gradio/Python endpoints and frontend handlers; do not change payload shapes without backend alignment.
- 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 `html/locale_*.json` when user-facing strings are added or changed.
- Avoid bundling unrelated visual refactors with functional fixes; keep UI PRs scoped and reviewable.
- For extension UI work, respect each extension's boundaries and avoid cross-extension coupling.
- Validate JavaScript changes with `pnpm eslint`; for modern UI extension changes also run `pnpm eslint-ui`.
- Maintain mobile compatibility when touching layout or interaction behavior.