SpecsCLIIssue 16 OpenCode Ruff Hooks
Issue 16 OpenCode Ruff Hooks
Issue 16 OpenCode Ruff Hooks
Initial Situation
GitHub issue #16 reports reusable scaffold friction from dp scaffold setup in a backend plus frontend repository. OpenCode receives the auto-loaded .opencode/plugins/format-edited-file.mjs; it must not also receive a native formatter entry for the same runner. The shared neutral hook also needs .py edits to receive the same post-edit formatting/linting loop as JS/TS files.
Debt
Scaffold output implied hook coverage across generated agent surfaces, but the OpenCode and Python paths were incomplete:
- OpenCode plugin activation and native formatter configuration competed for ownership and could execute one edit twice.
.agents/hooks/format-edited-file.mjsaccepted JS/TS/JSON only.- Python backend files needed Ruff routing through the owning Python project, not Oxlint/Oxfmt.
Bounded Fix
- Activate OpenCode only through its auto-loaded plugin mirror.
- Preserve existing OpenCode config while removing only the managed legacy
harness-format-edited-filenative formatter entry. - Let the neutral hook accept
.pyfiles. - Route captured Python bytes through
uv run --project <python-project> ruff format --stdin-filename <file> -. - Route the successful formatter bytes through
uv run --project <python-project> ruff check --fix --stdin-filename <file> -; publish Ruff stdout only on success and otherwise preserve the formatter bytes while reporting lint failure. - Scaffold the neutral hook when Python is detected, even if Oxfmt is absent.
Non-Goals
- Installing Ruff into consumer repositories.
- Replacing existing repo lint scripts.
- General Python lint asset authoring.
- Changing OpenCode model/provider settings.
Acceptance Checks
- Unit tests prove Python backend files resolve Ruff format/check commands.
- Projection tests prove OpenCode uses only the auto-loaded plugin and removes the managed native formatter entry.
- Scaffold setup tests prove Python-only repositories still receive the neutral hook.
- Docs/runbook mention OpenCode activation and Ruff routing behavior.