Skip to content

Commit 30edb22

Browse files
committed
fix(commands): align hook filtering with HookExecutor defaults
Updated the prompt to treat omitted `enabled` flags as true and pass all hooks (including those with `condition` fields) to the HookExecutor, correctly addressing the PR review feedback.
1 parent 5b6db74 commit 30edb22

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

templates/commands/plan.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ You **MUST** consider the user input before proceeding (if not empty).
3030
- Check if `.specify/extensions.yml` exists in the project root.
3131
- If it exists, read it and look for entries under the `hooks.before_plan` key
3232
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
33-
- Filter to only hooks where `enabled: true`
34-
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
35-
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
36-
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
33+
- Treat hooks as enabled unless they explicitly specify `enabled: false`
34+
- For each enabled hook, do **not** attempt to interpret or evaluate hook `condition` expressions yourself; condition evaluation is handled by the HookExecutor implementation
35+
- Treat all enabled hooks as executable for the purposes of this plan, regardless of whether they define a `condition`
3736
- For each executable hook, output the following based on its `optional` flag:
3837
- **Optional hook** (`optional: true`):
3938
```
@@ -80,10 +79,9 @@ You **MUST** consider the user input before proceeding (if not empty).
8079
5. **Check for extension hooks**: After reporting completion, check if `.specify/extensions.yml` exists in the project root.
8180
- If it exists, read it and look for entries under the `hooks.after_plan` key
8281
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
83-
- Filter to only hooks where `enabled: true`
84-
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
85-
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
86-
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
82+
- From the discovered hooks, ignore only those where `enabled` is explicitly set to `false`. If `enabled` is omitted, treat the hook as enabled.
83+
- Do **not** attempt to interpret or evaluate hook `condition` expressions, and do **not** filter hooks based on the presence or contents of `condition`. Condition evaluation is handled by the `HookExecutor.should_execute_hook` implementation.
84+
- Treat all hooks that are not explicitly disabled (that is, all hooks where `enabled` is not `false`) as executable candidates.
8785
- For each executable hook, output the following based on its `optional` flag:
8886
- **Optional hook** (`optional: true`):
8987
```

templates/commands/specify.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ You **MUST** consider the user input before proceeding (if not empty).
2727
- Check if `.specify/extensions.yml` exists in the project root.
2828
- If it exists, read it and look for entries under the `hooks.before_specify` key
2929
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
30-
- Filter to only hooks where `enabled: true`
31-
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
32-
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
33-
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
30+
- Treat hooks as enabled unless they explicitly specify `enabled: false`
31+
- For each enabled hook, do **not** attempt to interpret or evaluate hook `condition` expressions yourself; condition evaluation is handled by the HookExecutor implementation
32+
- Treat all enabled hooks as executable for the purposes of this plan, regardless of whether they define a `condition`
3433
- For each executable hook, output the following based on its `optional` flag:
3534
- **Optional hook** (`optional: true`):
3635
```
@@ -219,7 +218,6 @@ Given that feature description, do this:
219218
- Do **not** attempt to interpret or evaluate hook `condition` expressions, and do **not** filter hooks based on the presence or contents of `condition`. Condition evaluation is handled by the `HookExecutor.should_execute_hook` implementation.
220219
- Treat all hooks that are not explicitly disabled (that is, all hooks where `enabled` is not `false`) as executable candidates.
221220
- For each executable hook, output the following based on its `optional` flag:
222-
- **Optional hook** (`optional: true`):
223221
- **Optional hook** (`optional: true`):
224222
```
225223
## Extension Hooks

0 commit comments

Comments
 (0)