From f918a66a08e3b2e196241735f9359286da952225 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:56:45 +0000 Subject: [PATCH] Update collection counting in apply-config.js to use effective states Co-authored-by: AstroSteveo <34114851+AstroSteveo@users.noreply.github.com> --- apply-config.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/apply-config.js b/apply-config.js index b1e5c65..5dec2b8 100755 --- a/apply-config.js +++ b/apply-config.js @@ -121,16 +121,35 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") { } } - // Count enabled collections for summary + // Count effectively enabled collections for summary + // A collection is effectively enabled if it contributes any enabled items if (config.collections) { - for (const [collectionName, enabled] of Object.entries(config.collections)) { - if (enabled) { + for (const [collectionName, configEnabled] of Object.entries(config.collections)) { + if (configEnabled) { const collectionPath = path.join(rootDir, "collections", `${collectionName}.collection.yml`); if (fs.existsSync(collectionPath)) { const collection = parseCollectionYaml(collectionPath); if (collection && collection.items) { - summary.collections++; - console.log(`✓ Enabled collection: ${collectionName} (${collection.items.length} items)`); + // Check if this collection contributes any effectively enabled items + let hasEnabledItems = false; + for (const item of collection.items) { + const itemName = path.basename(item.path).replace(/\.(prompt|instructions|chatmode)\.md$/, ''); + if (item.kind === "prompt" && effectivelyEnabledSets.prompts.has(itemName)) { + hasEnabledItems = true; + break; + } else if (item.kind === "instruction" && effectivelyEnabledSets.instructions.has(itemName)) { + hasEnabledItems = true; + break; + } else if (item.kind === "chat-mode" && effectivelyEnabledSets.chatmodes.has(itemName)) { + hasEnabledItems = true; + break; + } + } + + if (hasEnabledItems) { + summary.collections++; + console.log(`✓ Enabled collection: ${collectionName} (${collection.items.length} items)`); + } } } }