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 27cc4d9a8448b90ef1ccaf8f5293522d20127538 Author: Luigi De Masi <[email protected]> AuthorDate: Thu Nov 26 13:54:48 2026 +0100 Fix #195: Verify the complete catalog evidence example Configure the example repository in the test workspace so that a missing or incorrect repository in the installed guide fails the comparison. Distinguish install-time names from placeholders filled by the workflow. Exercise init property overrides through the CLI in an isolated process. Co-authored-by: OpenAI Codex <[email protected]> --- .../apache/camel/kit/HostedCliCompatibilityTest.java | 15 +++++++++++++++ .../src/main/resources/skills/shared/mcp-setup.md | 3 ++- .../apache/camel/kit/command/TargetCommandTest.java | 5 +++-- .../org/apache/camel/kit/service/InitServiceTest.java | 19 ------------------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java b/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java index 58b4209e..97dc254f 100644 --- a/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java +++ b/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/HostedCliCompatibilityTest.java @@ -44,6 +44,21 @@ class HostedCliCompatibilityTest { assertFalse(Files.exists(directory.resolve(".camel-kit"))); } + @Test + void initWritesPropertyOverridesToTheLauncherAndGuides() throws Exception { + Result init = run("kit", "init", "orders", "--ai", "claude", "--no-fetch", + "-p", "camel.main.version=4.99.1", "-p", "camel.mcp.version=4.99.2", + "-p", "maven.dependency.plugin.version=3.99.1"); + assertEquals(0, init.exit, init.err); + Path targetDir = directory.resolve("orders"); + assertTrue(Files.readString(targetDir.resolve(".mcp.json")).contains("camel-jbang-mcp:4.99.2")); + Path skills = targetDir.resolve(".claude/skills"); + assertTrue(Files.readString(skills.resolve("shared/mcp-setup.md")) + .contains("org.apache.camel:camel-catalog:4.99.1")); + assertTrue(Files.readString(skills.resolve("camel-brainstorm/guides/version-selection.md")) + .contains("maven-dependency-plugin:3.99.1:tree")); + } + @Test void hostExpandsFilesAndKeepsEscapedAndAttachedContextLiteral() throws Exception { Path arguments = Files.writeString(directory.resolve("arguments"), "kit --version"); diff --git a/kit/camel-kit-core/src/main/resources/skills/shared/mcp-setup.md b/kit/camel-kit-core/src/main/resources/skills/shared/mcp-setup.md index 5f6c18e1..1c3cc0fa 100644 --- a/kit/camel-kit-core/src/main/resources/skills/shared/mcp-setup.md +++ b/kit/camel-kit-core/src/main/resources/skills/shared/mcp-setup.md @@ -215,7 +215,8 @@ Informational searches can use the bundled catalog. Required lookups use Rule 3. ### Placeholder conventions -At install time, Camel Kit expands uppercase names enclosed in single braces, such as the name `CAMEL_VERSION`. +Camel Kit expands only its recognized single-brace names at install time, including `CAMEL_VERSION`. +During the workflow, fill placeholders such as `{MODULE_PREFIX}` using the module selected for the task. Use context placeholders such as `{project.camelVersion}` when describing values read from `.camel-kit/config.properties`. Use double-brace placeholders such as `{{customer.host}}` only for literal Camel property placeholders that must remain in generated route files. diff --git a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/command/TargetCommandTest.java b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/command/TargetCommandTest.java index 3f31265c..0a5c5e79 100644 --- a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/command/TargetCommandTest.java +++ b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/command/TargetCommandTest.java @@ -5,6 +5,7 @@ import java.io.RandomAccessFile; import java.io.StringWriter; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; @@ -51,13 +52,13 @@ class TargetCommandTest { @Test void mainAcceptsEvidenceInTheDocumentedShape() throws Exception { execute(0, "init", dir.toString(), "--ai", "claude", "--no-fetch"); + Files.writeString(dir.resolve(".camel-kit/config.properties"), + "camel.catalog.repos=https://repo.maven.apache.org/maven2/\n", StandardOpenOption.APPEND); String guide = Files.readString(dir.resolve(".claude/skills/shared/mcp-setup.md")); String example = guide.substring(guide.indexOf("### Rule 3:")); int start = example.indexOf("```json") + 7; ObjectNode wire = (ObjectNode) JSON.readTree(example.substring(start, example.indexOf("```", start))); var profile = JSON.readTree(run(0)); - // The example repository list is illustrative. Use the repositories configured in this workspace. - ((ObjectNode) wire.get("profile")).set("repositories", profile.get("repositories")); assertEquals(profile, wire.get("profile")); String core = profile.get("camelVersion").asText(); diff --git a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/service/InitServiceTest.java b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/service/InitServiceTest.java index 2e795886..f08e0736 100644 --- a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/service/InitServiceTest.java +++ b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/service/InitServiceTest.java @@ -516,25 +516,6 @@ class InitServiceTest { assertFalse(mcp.contains("org.citrusframework:citrus-mcp-server:4.9.2:runner")); } - @Test - void propagatesIndependentDistributionOverridesToTheLauncherAndInstalledGuides() throws Exception { - Path targetDir = tempDir.resolve("orders"); - Properties overrides = new Properties(); - overrides.setProperty("camel.main.version", "4.99.1"); - overrides.setProperty("camel.mcp.version", "4.99.2"); - overrides.setProperty("maven.dependency.plugin.version", "3.99.1"); - DistributionConfig distribution = DistributionConfig.load(overrides); - new InitService().initialize(request(targetDir, "claude", distribution.citrusVersion(), distribution, - InitProgress.noop(), InitReporter.noop())); - - assertTrue(Files.readString(targetDir.resolve(".mcp.json")).contains("camel-jbang-mcp:4.99.2")); - Path skills = targetDir.resolve(".claude/skills"); - assertTrue(Files.readString(skills.resolve("shared/mcp-setup.md")) - .contains("org.apache.camel:camel-catalog:4.99.1")); - assertTrue(Files.readString(skills.resolve("camel-brainstorm/guides/version-selection.md")) - .contains("maven-dependency-plugin:3.99.1:tree")); - } - @Test void explicitCitrusMcpVersionOverrideIsUsedWithCustomCitrusVersion() throws Exception { Path targetDir = tempDir.resolve("orders");
