TASK-005: Replace manual Set creation with precomputed getEffectivelyEnabledItems for O(1) performance (#37)

This commit is contained in:
Steven Mosley 2025-09-23 20:32:36 -05:00 committed by GitHub
commit d77f8e80bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -101,25 +101,10 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") {
};
// Import config manager for effective state computation
const { computeEffectiveItemStates } = require("./config-manager");
const { getEffectivelyEnabledItems } = require("./config-manager");
// Compute effective states using precedence rules
const effectiveStates = computeEffectiveItemStates(config);
// Create sets of effectively enabled items for performance
const effectivelyEnabledSets = {
prompts: new Set(),
instructions: new Set(),
chatmodes: new Set()
};
for (const section of ["prompts", "instructions", "chatmodes"]) {
for (const [itemName, state] of Object.entries(effectiveStates[section])) {
if (state.enabled) {
effectivelyEnabledSets[section].add(itemName);
}
}
}
// Get precomputed sets of effectively enabled items for O(1) performance
const effectivelyEnabledSets = getEffectivelyEnabledItems(config);
// Count enabled collections for summary
if (config.collections) {