From 41af2d2877bb88d3796673849c9476ff899de9e0 Mon Sep 17 00:00:00 2001 From: sickn33 Date: Wed, 18 Mar 2026 19:00:40 +0100 Subject: [PATCH] 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. --- tools/lib/skill-filter.js | 6 ++++++ tools/scripts/tests/run-test-suite.js | 11 +++++----- tools/scripts/tests/skill_filter.test.js | 27 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 tools/scripts/tests/skill_filter.test.js diff --git a/tools/lib/skill-filter.js b/tools/lib/skill-filter.js index 8200c5b0..f9bfd7cf 100644 --- a/tools/lib/skill-filter.js +++ b/tools/lib/skill-filter.js @@ -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.`); diff --git a/tools/scripts/tests/run-test-suite.js b/tools/scripts/tests/run-test-suite.js index 8d781d5d..1b278164 100644 --- a/tools/scripts/tests/run-test-suite.js +++ b/tools/scripts/tests/run-test-suite.js @@ -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")], diff --git a/tools/scripts/tests/skill_filter.test.js b/tools/scripts/tests/skill_filter.test.js new file mode 100644 index 00000000..8ea08dcc --- /dev/null +++ b/tools/scripts/tests/skill_filter.test.js @@ -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", +);