Skip to content

pre-commit: add a lint hook for a repository's own server - #175

Open
abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:feat/precommit-lint-hook
Open

abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:feat/precommit-lint-hook

Conversation

@abu-tahir-0

Copy link
Copy Markdown

Problem

Both published hooks scan a running endpoint. A repository that ships a stdio MCP server had no pre-commit path to lint its own tool manifest. Closes #147.

Solution

  • New toolgauge-lint hook: entry: toolgauge lint --command, language: system, pass_filenames: false, stages pre-commit and manual.
  • The command is supplied as one args entry so a command containing spaces stays a single argument:
    - id: toolgauge-lint
      args: ["node dist/server.js"]
  • The hook is system-only on purpose: the server it lints must run on the machine making the commit, and the published image does not (yet) carry Node.
  • docs/USING.md lists it next to the scan hooks.

Testing

  • tests/harness/test_distribution.py — the existing hook test now distinguishes the two scan hooks from the lint hook: false filenames, system language, pre-commit stage, entry ends in --command, and every flag the entry uses is read from the real lint command definition.
  • pytest tests/harness/test_distribution.py — 11 passed.
  • ruff check . — clean.
  • The lint --command "node dist/server.js" form itself is covered end to end by tests/harness/test_stdio_lint.py, which starts a stdio server and lints it.

Impact

A repository can fail a commit on a missing tool description without running an endpoint or Docker.

The hooks only scanned a running endpoint. toolgauge-lint takes the
stdio server command as one argument, reads its manifest on every
commit, and needs neither Docker nor an endpoint.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pre-commit: add a lint hook

1 participant