feat(categories): add disable field to CategoryConfigSchema
Allow individual categories to be disabled via `disable: true` in config. Introduce shared `mergeCategories()` utility to centralize category merging and disabled filtering across all 7 consumption sites.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import type { CategoriesConfig, CategoryConfig } from "../config/schema"
|
||||
import { DEFAULT_CATEGORIES } from "../tools/delegate-task/constants"
|
||||
|
||||
/**
|
||||
* Merge default and user categories, filtering out disabled ones.
|
||||
* Single source of truth for category merging across the codebase.
|
||||
*/
|
||||
export function mergeCategories(
|
||||
userCategories?: CategoriesConfig,
|
||||
): Record<string, CategoryConfig> {
|
||||
const merged = userCategories
|
||||
? { ...DEFAULT_CATEGORIES, ...userCategories }
|
||||
: { ...DEFAULT_CATEGORIES }
|
||||
|
||||
return Object.fromEntries(
|
||||
Object.entries(merged).filter(([, config]) => !config.disable),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user