Skip to main content

require-valid-repository-hook-command-type

Require repository hook definitions to declare a supported type value such as command or prompt.

Rule catalog ID: R060

Targeted pattern scope​

  • .github/hooks/**/*.json

What this rule reports​

  • hook objects with a missing type
  • hook objects whose type is not a supported string

Why this rule exists​

Each hook definition needs an explicit type so Copilot knows how to interpret it. Requiring a supported type catches incomplete hook entries and obvious schema mismatches.

❌ Incorrect​

{
"version": 1,
"hooks": {
"sessionStart": [{ "bash": "echo ready" }]
}
}

✅ Correct​

{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready" }]
}
}

Further reading​