Skip to content

Commit 7748322

Browse files
author
root
committed
docs: clarify hook priority validation semantics
1 parent 57cc518 commit 7748322

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/reference/extensions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,14 @@ Each hook entry supports the following fields:
221221
| `command` | Extension command associated with the hook. |
222222
| `enabled` | Whether the hook is active. Hooks with `enabled: false` are skipped. |
223223
| `optional` | Whether the hook is optional. If `true`, the hook is presented with its `prompt` and can be skipped; if `false`, the hook is emitted as an automatic hook (includes `EXECUTE_COMMAND` markers). |
224-
| `priority` | Priority metadata for the hook. Values must be integers >= 1; invalid values fall back to the default priority `10`. Current command templates surface hooks in their configured YAML order and do not sort them by `priority`. |
224+
| `priority` | Priority metadata for the hook. Registered hook entries use integer values >= 1; entries installed from manifests default to `10` when no priority is declared. Current command templates surface hooks in their configured YAML order and do not sort them by `priority`. |
225225
| `prompt` | Message shown when asking whether to run an optional hook. |
226226
| `description` | Human-readable explanation of what the hook does. |
227227
| `condition` | Optional expression evaluated by `HookExecutor` (using `config.<path>` or `env.<VAR>` with `is set`, `==`, or `!=`). Current command templates do not evaluate conditions and skip hooks with a non-empty condition. |
228228
Hook event names identify when a hook is invoked. They generally use `before_<command>` or `after_<command>`, such as `before_implement`, `after_implement`, `before_tasks`, and `after_tasks`.
229229

230+
Extension manifests reject invalid hook priorities during installation. If an existing `.specify/extensions.yml` file contains a missing or corrupted `priority` value, `HookExecutor.get_hooks_for_event()` treats that entry as priority `10` when sorting.
231+
230232
`HookExecutor.get_hooks_for_event()` returns hooks ordered by `priority`, with lower values first. However, current command templates read hook lists directly and surface them in their configured YAML order rather than using priority ordering.
231233

232234
## FAQ

0 commit comments

Comments
 (0)