diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 98bdff031..c73a518ab 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -61,6 +61,7 @@ General app structure is: ## Repo-Local Skills +All skills are defined in `.github/skills/` and indexed in `.github/skills/README.md`. Use these repo-local skills for recurring SD.Next model integration work: - `port-model` @@ -103,4 +104,8 @@ Use these repo-local skills for recurring SD.Next model integration work: File: `.github/skills/analyze-model/SKILL.md` Use when analyzing an external model URL to identify implementation style and estimate how difficult it is to port into SD.Next. +- `fix-lint` + File: `.github/skills/fix-lint/SKILL.md` + Use when running the full lint workflow in required order (`pre-commit`, `eslint`, `ruff`, `pylint`) and fixing findings as needed, while ignoring lint issues explicitly marked with `TODO`. + When creating and updating skills, update this file and the index in `.github/skills/README.md` accordingly. diff --git a/.github/skills/README.md b/.github/skills/README.md index 04ee2d386..120b417d0 100644 --- a/.github/skills/README.md +++ b/.github/skills/README.md @@ -44,6 +44,10 @@ This folder contains repo-local Copilot skills for recurring SD.Next tasks. File: `analyze-model/SKILL.md` Use when analyzing an external model URL to classify implementation style and estimate SD.Next porting difficulty before coding. +- `fix-lint` + File: `fix-lint/SKILL.md` + Use when running the full lint workflow in strict order and fixing issues as needed (`pre-commit`, `eslint`, `ruff`, `pylint`), while ignoring findings explicitly marked with `TODO`. + ## Notes - Keep skills narrowly task-oriented and reusable. diff --git a/.github/skills/fix-lint/SKILL.md b/.github/skills/fix-lint/SKILL.md new file mode 100644 index 000000000..222dfe501 --- /dev/null +++ b/.github/skills/fix-lint/SKILL.md @@ -0,0 +1,89 @@ +--- +name: fix-lint +description: "Run SD.Next lint workflow tools in order and fix issues as needed, while ignoring lint findings explicitly marked with TODO." +argument-hint: "Optionally focus on a subset of tools or files, otherwise run full workflow" +--- + +# Fix Lint Workflow + +Run the project lint workflow in the required order, fix findings, and re-run affected tools until clean. + +## When To Use + +- The user asks to run lint and fix issues +- A PR requires lint-clean status before review +- Multiple files changed and style/static checks may have drifted +- You need a repeatable full-lint remediation pass + +## Required Environment Step + +Always start from repository root and activate virtual environment first: + +- Linux: `. venv/bin/activate` +- Windows: `venv\\scripts\\activate` + +If activation fails, report the blocker and stop before running Python-based tools. + +## Required Tool Execution Order + +Run tools in this exact sequence: + +1. `pre-commit run --all-files` +2. `eslint . javascript/` +3. `cd extensions-builtin/sdnext-modernui && eslint . javascript/` +4. `ruff check` +5. `pylint *.py` +6. `pylint modules/` +7. `pylint pipelines/` +8. `pylint scripts/` +9. `pylint extensions-builtin/` + +## Fix Policy + +- Fix issues reported by each tool before moving on. +- Ignore lint issues explicitly marked with `TODO`. +- Do not suppress errors globally just to pass checks. +- Keep fixes minimal and targeted to reported findings. +- Preserve existing project conventions and avoid unrelated refactors. + +## Procedure + +### 1. Initialize Environment + +- Confirm current directory is repository root. +- Activate venv using OS-appropriate command. + +### 2. Execute And Repair Per Tool + +For each tool in the required order: + +- Run the command. +- Parse failures and group by file. +- Apply minimal code fixes. +- Re-run the same command until it passes or only `TODO`-marked findings remain. +- If a fix introduces new failures in earlier tools, re-run impacted earlier tools. + +### 3. Cross-Check Regression + +After all tools pass individually: + +- Re-run the full ordered sequence once to ensure no cross-tool regressions. + +### 4. Report + +Return: + +- Commands executed (in order) +- Files changed +- Which issues were fixed +- Any findings intentionally ignored due to `TODO` markers +- Any remaining blockers that could not be auto-fixed + +## Pass Criteria + +A successful run means: + +- All listed tools executed in order +- No remaining fixable lint errors from those tools +- Remaining issues are only those explicitly marked with `TODO` (if any) +- Final verification pass completed diff --git a/CHANGELOG.md b/CHANGELOG.md index aa0870cd1..f7dfbf158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - additional instructions in `instructions/`: `core.instructions.md`, `ui.instructions.md` - skills in in `skills/README.md`: + *coding skills*: `fix-lint` (must before commit) *validation skills*: `check-models`, `check-api`, `check-schedulers`, `check-processing`, `check-scripts` *model skills*: `port-model`, `debug-model`, `analyze-model` *github skills*: `github-issues`, `github-features`