Merge branch 'main' into copilot/fix-15

This commit is contained in:
Steven Mosley 2025-09-23 20:32:52 -05:00 committed by GitHub
commit 5dfe8679ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 43 additions and 22 deletions

View File

@ -1,11 +1,11 @@
{
"chat.modeFilesLocations": {
".github/chatmodes": true
"chatmodes": true
},
"chat.promptFilesLocations": {
".github/prompts": true
"prompts": true
},
"chat.instructionsFilesLocations": {
".github/instructions": true
"instructions": true
}
}
}

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) {

View File

@ -101,6 +101,11 @@ function toBoolean(value) {
if (normalized === "false") return false;
}
// Preserve undefined as undefined for "no explicit override"
if (value === undefined) {
return undefined;
}
return Boolean(value);
}

View File

@ -257,6 +257,37 @@ function runTests() {
assert(result.prompts.size > 0, 'Should have enabled prompts');
});
// Test 10: Undefined values are not treated as explicitly disabled (TASK-004)
test("Undefined values are not treated as explicitly disabled", () => {
const config = {
prompts: {
'playwright-generate-test': true, // explicit true
'csharp-nunit': false, // explicit false
// 'playwright-explore-website' is undefined (not mentioned)
},
collections: {
'testing-automation': true
}
};
const result = computeEffectiveItemStates(config);
// Explicit true should be explicit
const explicitTrue = result.prompts['playwright-generate-test'];
assert(explicitTrue && explicitTrue.enabled && explicitTrue.reason === 'explicit',
'Explicit true should be enabled with explicit reason');
// Explicit false should be explicit (strict === false comparison)
const explicitFalse = result.prompts['csharp-nunit'];
assert(explicitFalse && !explicitFalse.enabled && explicitFalse.reason === 'explicit',
'Explicit false should be disabled with explicit reason');
// Undefined should inherit from collection
const undefinedItem = result.prompts['playwright-explore-website'];
assert(undefinedItem && undefinedItem.enabled && undefinedItem.reason === 'collection',
'Undefined items should inherit from collection, not be treated as explicitly disabled');
});
console.log(`\nTest Results: ${passedTests}/${totalTests} passed`);
if (passedTests === totalTests) {