Harness Intelligence Wiki
SpecsCLIIssue 16 OpenCode Ruff Hooks

Issue 16 OpenCode Ruff Hooks Implementation Notes

Issue 16 OpenCode Ruff Hooks Implementation Notes

Result

Scaffolded hook generation now activates the OpenCode surface and handles Python backend edits.

OpenCode activation is plugin-only through the auto-loaded .opencode/plugins directory. Reconciliation preserves existing project config and removes the exact managed harness-format-edited-file native formatter entry so the same edit cannot execute twice. The plugin reads edit, write, and apply_patch paths from OpenCode's after-hook input arguments.

The neutral hook accepts .py files and routes captured bytes to Ruff through uv run --project, using --stdin-filename and - so Ruff retains the original path for parser and config lookup without reopening the live target. It prefers the nearest pyproject.toml; for conventional backend paths like apps/backend/main.py, it falls back to apps/backend. Ruff lint stdout is publishable only on exit zero; nonzero empty or diagnostic stdout records lint_failed and preserves the successful formatter bytes.

Files

  • apps/cli/src/data/scripts/sync-subagents.mjs
  • apps/cli/src/data/hooks/format-edited-file.mjs
  • apps/cli/src/data/hooks.test.ts
  • apps/cli/src/data/catalog/packs.ts
  • apps/cli/src/scaffold/output.ts
  • apps/cli/src/scaffold/run.test.ts
  • apps/cli/src/content/content.test.ts
  • docs/README.md
  • docs/runbooks/hi-cli-scaffolding.md
  • apps/wiki/content/docs/project/tech-debt/cli/issue-16-opencode-ruff-hooks.md

Validation

  • bun run test --filter=@punks/cli -- data/hooks.test.ts content/content.test.ts scaffold/run.test.ts
  • bun run check-types --filter=@punks/cli
  • bun run check --filter=@punks/cli
  • git diff --check

On this page