Update collection counting in apply-config.js to use effective states

Co-authored-by: AstroSteveo <34114851+AstroSteveo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-09-23 23:56:45 +00:00
parent 88e13bc74e
commit f918a66a08

View File

@ -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) { if (config.collections) {
for (const [collectionName, enabled] of Object.entries(config.collections)) { for (const [collectionName, configEnabled] of Object.entries(config.collections)) {
if (enabled) { if (configEnabled) {
const collectionPath = path.join(rootDir, "collections", `${collectionName}.collection.yml`); const collectionPath = path.join(rootDir, "collections", `${collectionName}.collection.yml`);
if (fs.existsSync(collectionPath)) { if (fs.existsSync(collectionPath)) {
const collection = parseCollectionYaml(collectionPath); const collection = parseCollectionYaml(collectionPath);
if (collection && collection.items) { if (collection && collection.items) {
summary.collections++; // Check if this collection contributes any effectively enabled items
console.log(`✓ Enabled collection: ${collectionName} (${collection.items.length} 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)`);
}
} }
} }
} }