fix(bundles): Return all skills for complete bundle

Make the skill filter helper treat the complete bundle as a
pass-through so categories missing from the hardcoded map are
not silently omitted.

Add a regression test to keep complete bundle behavior aligned
with its name.
This commit is contained in:
sickn33
2026-03-18 19:00:40 +01:00
parent 4883b0dbb4
commit 41af2d2877
3 changed files with 39 additions and 5 deletions

View File

@@ -74,6 +74,12 @@ function filterSkillsByCategory(skills, categories = ['core']) {
* @returns {Array} Skills matching the bundle
*/
function getSkillsByBundle(skills, bundleName = 'minimal') {
if (!Array.isArray(skills)) return [];
if (bundleName === 'complete') {
return [...skills];
}
const bundle = SKILL_BUNDLES[bundleName];
if (!bundle) {
console.warn(`Unknown bundle: ${bundleName}. Using 'minimal' bundle.`);

View File

@@ -8,11 +8,12 @@ const ENABLED_VALUES = new Set(["1", "true", "yes", "on"]);
const TOOL_SCRIPTS = path.join("tools", "scripts");
const TOOL_TESTS = path.join(TOOL_SCRIPTS, "tests");
const LOCAL_TEST_COMMANDS = [
[path.join(TOOL_TESTS, "activate_skills_batch_security.test.js")],
[path.join(TOOL_TESTS, "claude_plugin_marketplace.test.js")],
[path.join(TOOL_TESTS, "jetski_gemini_loader.test.js")],
[path.join(TOOL_TESTS, "npm_package_contents.test.js")],
[path.join(TOOL_TESTS, "validate_skills_headings.test.js")],
[path.join(TOOL_TESTS, "activate_skills_batch_security.test.js")],
[path.join(TOOL_TESTS, "claude_plugin_marketplace.test.js")],
[path.join(TOOL_TESTS, "jetski_gemini_loader.test.js")],
[path.join(TOOL_TESTS, "npm_package_contents.test.js")],
[path.join(TOOL_TESTS, "skill_filter.test.js")],
[path.join(TOOL_TESTS, "validate_skills_headings.test.js")],
[path.join(TOOL_TESTS, "workflow_contracts.test.js")],
[path.join(TOOL_TESTS, "docs_security_content.test.js")],
[path.join(TOOL_SCRIPTS, "run-python.js"), path.join(TOOL_TESTS, "test_bundle_activation_security.py")],

View File

@@ -0,0 +1,27 @@
const assert = require("assert");
const {
getSkillsByBundle,
filterSkillsByCategory,
} = require("../../lib/skill-filter");
const sampleSkills = [
{ id: "core-skill", category: "core" },
{ id: "dev-skill", category: "development" },
{ id: "security-skill", category: "security" },
{ id: "uncategorized-skill", category: "made-up-category" },
];
const filtered = filterSkillsByCategory(sampleSkills, ["security"]);
assert.deepStrictEqual(
filtered.map((skill) => skill.id),
["security-skill"],
"filterSkillsByCategory should continue filtering by the requested categories",
);
const complete = getSkillsByBundle(sampleSkills, "complete");
assert.deepStrictEqual(
complete.map((skill) => skill.id),
sampleSkills.map((skill) => skill.id),
"the complete bundle should include every skill, even when categories are not hardcoded",
);