This is an automated email from the ASF dual-hosted git repository. luigidemasi pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kit.git
commit 13b4c2a22cb9fa0d0e59d7dd68b821a958411845 Author: Luigi De Masi <[email protected]> AuthorDate: Sat Nov 28 17:10:34 2026 +0100 Fix #194: Report skill directories omitted during pack selection List skipped directories once per selected artifact so contributors can spot a missing skillTrees entry during catalog assembly. Keep the chosen packs authoritative and leave omitted assets out of the catalog. Co-authored-by: OpenAI Codex <[email protected]> --- docs/modules/ROOT/pages/contributing.adoc | 4 +- .../camel/kit/workflow/SkillPackCompiler.java | 43 +++++++++++++++++----- .../camel/kit/workflow/SkillPackCompilerTest.java | 21 +++++++++++ 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/docs/modules/ROOT/pages/contributing.adoc b/docs/modules/ROOT/pages/contributing.adoc index 4f479d72..4ec7aa3a 100644 --- a/docs/modules/ROOT/pages/contributing.adoc +++ b/docs/modules/ROOT/pages/contributing.adoc @@ -98,7 +98,9 @@ xref:skills.adoc[] for the structure and the tiers. The default distribution selects `core` and `developer-tasks`. A pack can list complete skill directories in `skillTrees`, for example `skillTrees: [camel-inspect]`. Ship `skills/camel-inspect/SKILL.md` and its guides -and examples in the same artifact as its descriptor. The compiler loads only that artifact's tree. The core +and examples in the same artifact as its descriptor. The compiler reports each directory under that artifact's +`skills/` that the selected packs omit. To include it, list it in the owning pack's `skillTrees` and select that pack. +The core workflow declares the existing entry points and their routing. A new extension skill can opt into the router through its public frontmatter. Existing overlays that require `core` can still edit the bundled developer tasks. diff --git a/kit/camel-kit-core/src/main/java/org/apache/camel/kit/workflow/SkillPackCompiler.java b/kit/camel-kit-core/src/main/java/org/apache/camel/kit/workflow/SkillPackCompiler.java index f242f264..d745ef95 100644 --- a/kit/camel-kit-core/src/main/java/org/apache/camel/kit/workflow/SkillPackCompiler.java +++ b/kit/camel-kit-core/src/main/java/org/apache/camel/kit/workflow/SkillPackCompiler.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -235,18 +236,22 @@ public final class SkillPackCompiler { } Map<String, WorkflowSkill> classified = new TreeMap<>(); workflow.skills().forEach(skill -> classified.put(skill.name(), skill)); + Map<Path, List<SkillPack>> modules = new LinkedHashMap<>(); for (SkillPack pack : packs.values()) { - if (pack.skillTrees().isEmpty()) { - continue; - } URL descriptor = SkillPack.uniqueResource(loader, SkillPack.directory(pack.id()) + "pack.yaml"); - if (descriptor.openConnection() instanceof JarURLConnection jar) { - try (var fs = FileSystems.newFileSystem(Path.of(jar.getJarFileURL().toURI()))) { - readSkillTrees(fs.getPath("/skills"), pack, classified); - } + Path module = descriptor.openConnection() instanceof JarURLConnection jar + ? Path.of(jar.getJarFileURL().toURI()) + : Path.of(descriptor.toURI()).getParent().resolve("../../../..").normalize(); + modules.computeIfAbsent(module, unused -> new ArrayList<>()).add(pack); + } + for (var module : modules.entrySet()) { + Path path = module.getKey(); + if (Files.isDirectory(path)) { + readModuleSkills(path.resolve("skills"), module.getValue(), classified); } else { - Path root = Path.of(descriptor.toURI()).getParent().resolve("../../../../skills").normalize(); - readSkillTrees(root, pack, classified); + try (var fs = FileSystems.newFileSystem(path)) { + readModuleSkills(fs.getPath("/skills"), module.getValue(), classified); + } } } for (String name : classified.keySet()) { @@ -257,6 +262,26 @@ public final class SkillPackCompiler { return workflow; } + private void readModuleSkills(Path root, List<SkillPack> packs, Map<String, WorkflowSkill> classified) + throws IOException { + var selected = new HashSet<String>(); + for (SkillPack pack : packs) { + readSkillTrees(root, pack, classified); + selected.addAll(pack.skillTrees()); + } + if (Files.isDirectory(root)) { + try (var paths = Files.list(root)) { + for (Path path : paths.filter(Files::isDirectory).sorted().toList()) { + String name = path.getFileName().toString(); + if (!selected.contains(name)) { + System.err.println("Skipping skills/" + name + " in " + root.toUri() + + ": no selected pack in this artifact lists it in skillTrees."); + } + } + } + } + } + private void readSkillTrees(Path root, SkillPack pack, Map<String, WorkflowSkill> classified) throws IOException { for (String name : pack.skillTrees()) { if (!name.matches(SkillPack.ID)) { diff --git a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/workflow/SkillPackCompilerTest.java b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/workflow/SkillPackCompilerTest.java index 5af09b36..2ed3a72f 100644 --- a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/workflow/SkillPackCompilerTest.java +++ b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/workflow/SkillPackCompilerTest.java @@ -147,6 +147,27 @@ class SkillPackCompilerTest { } } + @Test + void compilerReportsSkillDirectoriesOmittedByThePackSelection() throws Exception { + Path module = pack("team", "requires: [core]"); + Path extra = module.resolve(SkillPack.directory("extra") + "pack.yaml"); + Files.createDirectories(extra.getParent()); + Files.writeString(extra, "id: extra\nschema: 1\nrequires: [core]\nskillTrees: [camel-inspect]\n"); + Path skills = module.resolve("skills"); + Files.writeString(Files.createDirectories(skills.resolve("camel-inspect")).resolve("SKILL.md"), SKILL); + Files.createDirectories(skills.resolve("forgotten-guides")); + Path output = temp.resolve("selected.zip"); + + String team = assertJava(0, module, temp, SkillPackCompiler.class.getName(), output.toString(), "team"); + assertTrue(team.contains("Skipping skills/camel-inspect"), team); + assertTrue(team.contains("Skipping skills/forgotten-guides"), team); + + String both = assertJava(0, module, temp, SkillPackCompiler.class.getName(), output.toString(), "team,extra"); + assertFalse(both.contains("Skipping skills/camel-inspect"), both); + assertEquals(1, both.lines().filter(line -> line.contains("Skipping skills/forgotten-guides") + && line.contains("skillTrees")).count(), both); + } + @Test void claudePreservesExistingCommandsThatShareAPackSkillName() throws Exception { Path pack = pack("inspect", "add: {skill/camel-inspect: {contract: 1, resource: inspect.md}}");
