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 dec4749efdf43605db82306f4e69381890897759
Author: Luigi De Masi <[email protected]>
AuthorDate: Tue Nov 17 23:57:34 2026 +0100

    Fix Windows CLI initialization and subprocess encoding
    
    Derive generated command prefixes from the registered command hierarchy
    instead of optional process metadata. Check both entry points in one JVM
    and through neutral Java argument files, including regeneration.
    
    Use explicit UTF-8 encoding in subprocess fixtures and assert the Unicode
    banner so Windows native output is decoded under the intended contract.
    
    Co-authored-by: OpenAI Codex <[email protected]>
---
 .../org/apache/camel/kit/CamelKitCommandParityTest.java    | 14 +++++++++-----
 .../org/apache/camel/kit/HostedCliCompatibilityTest.java   |  6 ++++--
 .../java/org/apache/camel/kit/command/InitCommand.java     |  8 +-------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git 
a/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/CamelKitCommandParityTest.java
 
b/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/CamelKitCommandParityTest.java
index dfeda3ff..20cf17e5 100644
--- 
a/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/CamelKitCommandParityTest.java
+++ 
b/kit/camel-jbang-plugin-kit/src/test/java/org/apache/camel/kit/CamelKitCommandParityTest.java
@@ -49,13 +49,15 @@ class CamelKitCommandParityTest {
                     "--silent", "--no-fetch", "--force"));
             assertEquals(0, main.run(pluginCommands(main), "kit", "init", 
pluginDir.toString(), "--ai", "bob2",
                     "--silent", "--no-fetch", "--force"));
+            assertEquals("camel-kit", 
loadConfig(standaloneDir).getProperty("project.command-prefix"));
+            assertEquals("camel kit", 
loadConfig(pluginDir).getProperty("project.command-prefix"));
             for (String name : PUBLIC_SKILLS) {
                 String relative = ".bob/skills/" + name + "/SKILL.md";
                 String skill = 
Files.readString(standaloneDir.resolve(relative));
                 String pluginSkill = 
Files.readString(pluginDir.resolve(relative));
                 assertTrue(skill.contains("\nuser-invocable: true\n"), name);
-                // Both entry points share this JVM's process-based CLI prefix 
detection.
-                assertEquals(skill, pluginSkill, name);
+                assertEquals(skill.replace("camel kit", "camel-kit"), 
pluginSkill.replace("camel kit", "camel-kit"),
+                        name);
             }
         }
     }
@@ -247,10 +249,12 @@ class CamelKitCommandParityTest {
     void nativeInitAndRegenerationDetectThePrefixInSeparateProcesses(boolean 
plugin, String agent) throws Exception {
         Path workspace = tempDir.resolve("workspace");
         String expectedPrefix = plugin ? "camel kit" : "camel-kit";
-        // The argument file keeps dependency paths out of process-based 
prefix detection.
-        Path arguments = tempDir.resolve(plugin ? "camel-jbang.args" : 
"camel-kit.args");
+        // Neither the process name nor its argument file identifies the Kit 
entry point.
+        Path arguments = tempDir.resolve("java.args");
         String classpath = System.getProperty("surefire.test.class.path", 
System.getProperty("java.class.path"));
-        Files.writeString(arguments, "--class-path\n" + 
quoteJavaArgument(classpath) + "\n"
+        Files.writeString(arguments,
+                
"-Dfile.encoding=UTF-8\n-Dstdout.encoding=UTF-8\n-Dstderr.encoding=UTF-8\n--class-path\n"
+                                     + quoteJavaArgument(classpath) + "\n"
                                      + InitProcess.class.getName() + "\n" + 
plugin + "\n"
                                      + quoteJavaArgument(workspace.toString()) 
+ "\n" + agent + "\n");
 
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 11fc38ba..d1854283 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
@@ -75,7 +75,7 @@ class HostedCliCompatibilityTest {
         Result banner = run(CamelKitMain.class);
         assertEquals(0, banner.exit, banner.err);
         assertTrue(banner.err.isBlank(), banner.err);
-        assertTrue(banner.out.contains("Design Apache Camel Integrations with 
AI"), banner.out);
+        assertTrue(banner.out.contains("Camel-Kit \u2014 Design Apache Camel 
Integrations with AI"), banner.out);
         assertTrue(banner.out.contains("Usage: camel-kit"), banner.out);
         assertFalse(banner.out.contains("\u001b"), "Redirected output contains 
terminal control sequences");
     }
@@ -112,7 +112,9 @@ class HostedCliCompatibilityTest {
         }
         classpath = classpath.replace(classes.toString(), jar.toString());
         Path javaArguments = directory.resolve("java.args");
-        Files.writeString(javaArguments, "--class-path\n" + quote(classpath) + 
"\n"
+        Files.writeString(javaArguments,
+                
"-Dfile.encoding=UTF-8\n-Dstdout.encoding=UTF-8\n-Dstderr.encoding=UTF-8\n--class-path\n"
+                                         + quote(classpath) + "\n"
                                          + quote("-Duser.home=" + directory) + 
"\n" + entryPoint.getName()
                                          + "\n");
         List<String> command = new ArrayList<>(
diff --git 
a/kit/camel-kit-core/src/main/java/org/apache/camel/kit/command/InitCommand.java
 
b/kit/camel-kit-core/src/main/java/org/apache/camel/kit/command/InitCommand.java
index 4b920287..09d8fb2a 100644
--- 
a/kit/camel-kit-core/src/main/java/org/apache/camel/kit/command/InitCommand.java
+++ 
b/kit/camel-kit-core/src/main/java/org/apache/camel/kit/command/InitCommand.java
@@ -242,7 +242,7 @@ public class InitCommand extends CamelKitCommand {
                 noFetch,
                 withCitrusMcp,
                 sourcePlatform,
-                detectCommandPrefix(),
+                qualifiedName(parent != null ? parent : main),
                 CamelKitMain.DEFAULT_CITRUS_VERSION,
                 CamelKitMain.distribution(),
                 printer(),
@@ -385,10 +385,4 @@ public class InitCommand extends CamelKitCommand {
         printer().println();
     }
 
-    private String detectCommandPrefix() {
-        String cmdLine = 
ProcessHandle.current().info().commandLine().orElse("");
-        if (cmdLine.contains("camel-kit"))
-            return "camel-kit";
-        return "camel kit";
-    }
 }

Reply via email to