feat(keyword-detector): add enabled_expansions config for allowlist control

Add optional enabled_expansions field to keyword_detector config schema.
When set, acts as an allowlist - only those expansion types fire.
Empty array disables all expansions. Absent field keeps all enabled (backward-compatible).
Also supports coexistence with disabled_keywords denylist for fine-grained control.

- src/config/schema/keyword-detector.ts: add enabled_expansions field
- src/hooks/keyword-detector/detector.ts: apply allowlist filter in detectKeywordsWithType
- src/hooks/keyword-detector/hook.ts: pass enabled_expansions from config
- src/hooks/keyword-detector/index.test.ts: add 4 tests for enabled_expansions behavior
- assets/oh-my-opencode.schema.json: regenerate schema
This commit is contained in:
pizzav-xyz
2026-05-16 02:01:29 +02:00
parent 1723a8b74c
commit f152569ed4
5 changed files with 127 additions and 3 deletions
+1
View File
@@ -4,6 +4,7 @@ export const KeywordTypeSchema = z.enum(["ultrawork", "search", "analyze", "team
export type KeywordType = z.infer<typeof KeywordTypeSchema>
export const KeywordDetectorConfigSchema = z.object({
enabled_expansions: z.array(KeywordTypeSchema).optional(),
disabled_keywords: z.array(KeywordTypeSchema).optional(),
})