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:
parent
88e13bc74e
commit
f918a66a08
@ -121,14 +121,32 @@ 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) {
|
||||
// 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)`);
|
||||
}
|
||||
@ -136,6 +154,7 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up files that are no longer enabled (requirement #3: Toggling instructions off will remove them)
|
||||
const cleanupSummary = cleanupDisabledFiles(outputDir, effectivelyEnabledSets, rootDir);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user