This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new c7baa5b2a315 CAMEL-23702: Make jbang exported project more AI-relevant
c7baa5b2a315 is described below

commit c7baa5b2a315841d4932c3407113e83ca4c022ad
Author: Karol Krawczyk <[email protected]>
AuthorDate: Wed Jun 17 15:46:20 2026 +0200

    CAMEL-23702: Make jbang exported project more AI-relevant
    
    Add AI coding assistant guidance to projects generated by `camel export`:
    - "For AI coding assistants" section in readme.md templates pointing to
      the Apache Camel LLM index, Markdown docs convention, and Camel MCP server
    - New AGENTS.md template generated at project root for all runtimes
      with project layout, build/run guidance for coding agents
    
    Closes #24063
---
 .../ROOT/pages/camel-4x-upgrade-guide-4_21.adoc    |  7 ++++
 .../camel/dsl/jbang/core/commands/Export.java      | 12 +++++++
 .../dsl/jbang/core/commands/ExportQuarkus.java     |  2 ++
 .../src/main/resources/templates/agents.md.ftl     | 42 ++++++++++++++++++++++
 .../src/main/resources/templates/readme.md.ftl     |  8 +++++
 .../main/resources/templates/readme.native.md.ftl  |  8 +++++
 .../camel/dsl/jbang/core/commands/ExportTest.java  |  4 +++
 .../dsl/jbang/core/common/TemplateHelperTest.java  | 16 +++++++++
 8 files changed, 99 insertions(+)

diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
index 38da59bba86d..161585ae63e7 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
@@ -18,6 +18,13 @@ See the xref:camel-upgrade-recipes-tool.adoc[documentation] 
page for details.
 The library used for Camel Grok component has been migrated from no more 
maintained `io.krakens:java-grok` to its fork `io.github.whatap:java-grok`.
 It implies small differences listed 
https://github.com/whatap/java-grok#what-is-different-from-iokrakensjava-grok[here].
 
+=== camel-jbang
+
+The project exported by `camel export` now includes additional guidance for AI 
coding assistants. The generated
+`readme.md` gained a _For AI coding assistants_ section linking to the Apache 
Camel LLM index
+(`https://camel.apache.org/llms.txt`), and a new `AGENTS.md` file is generated 
at the project root. This applies to
+all runtimes (Camel Main, Spring Boot and Quarkus).
+
 === camel-micrometer
 
 The `MicrometerExchangeEventNotifier` now always includes the `routeId` tag on 
exchange event metrics.
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
index 27189e4f2eaa..4eeeeff0efb7 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Export.java
@@ -348,5 +348,17 @@ public class Export extends ExportBaseCommand {
 
         String context = TemplateHelper.processTemplate("readme.md.ftl", 
model);
         Files.writeString(Path.of(buildDir).resolve("readme.md"), context);
+
+        copyAgents(buildDir);
+    }
+
+    // Copy the AGENTS.md into the same Maven project root directory to assist 
AI coding assistants.
+    protected void copyAgents(String buildDir) throws Exception {
+        String[] ids = gav.split(":");
+        Map<String, Object> model = new HashMap<>();
+        model.put("ArtifactId", ids[1]);
+
+        String context = TemplateHelper.processTemplate("agents.md.ftl", 
model);
+        Files.writeString(Path.of(buildDir).resolve("AGENTS.md"), context);
     }
 }
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
index f993a84bc88f..1d002e0caae7 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportQuarkus.java
@@ -357,6 +357,8 @@ class ExportQuarkus extends Export {
 
         String context = 
TemplateHelper.processTemplate("readme.native.md.ftl", model);
         Files.writeString(Path.of(buildDir).resolve("readme.md"), context);
+
+        copyAgents(buildDir);
     }
 
     private void createMavenPom(Path settings, Path pom, Set<String> deps) 
throws Exception {
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/agents.md.ftl 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/agents.md.ftl
new file mode 100644
index 000000000000..e3e8a552fd8d
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/agents.md.ftl
@@ -0,0 +1,42 @@
+<#--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+# AGENTS.md
+
+Guidance for AI coding assistants working on this Apache Camel project, which 
was generated by the Camel CLI.
+
+## Start here
+
+- Apache Camel LLM index: https://camel.apache.org/llms.txt
+- Any Apache Camel documentation page is available as LLM-friendly Markdown by 
replacing `.html` with `.md` in its URL.
+- Prefer the Camel CLI and the Camel MCP server (linked from the index above) 
to inspect components, their endpoint options and the catalog. Do not invent 
component URIs or options — verify them against the catalog or documentation.
+
+## Routes
+
+- If this project uses the YAML DSL, write routes in the canonical YAML DSL 
format, and use the Camel MCP server to validate their structure.
+
+## Project layout
+
+- `src/main/java` — Java route builders and beans.
+- `src/main/resources` — Camel routes (YAML/XML), `application.properties` and 
other resources.
+- `pom.xml` — Maven build for the `[=ArtifactId]` application.
+
+## Build and run
+
+- Build: `./mvnw clean package`
+- See `readme.md` for how to run and containerize the application.
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.md.ftl 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.md.ftl
index 58ff6140e70d..ccbbf837add8 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.md.ftl
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.md.ftl
@@ -22,6 +22,14 @@ This project was generated using [Camel 
Jbang](https://camel.apache.org/manual/c
 
 This is a brief guide explaining how to build, "containerize" and run your 
Camel application.
 
+## For AI coding assistants
+
+If you are an AI coding assistant working on this project, start from the 
Apache Camel LLM index at https://camel.apache.org/llms.txt.
+
+- Any Apache Camel documentation page is available as LLM-friendly Markdown by 
replacing `.html` with `.md` in its URL.
+- Use the Camel CLI and the Camel MCP server (linked from the index above) to 
look up components, their options and the catalog instead of guessing endpoint 
URIs and options.
+- See `AGENTS.md` in this directory for project-specific guidance.
+
 ## Build the Maven project
 
 ```bash
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.native.md.ftl
 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.native.md.ftl
index 08b0f1ef21bc..3d6bf2345661 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.native.md.ftl
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/templates/readme.native.md.ftl
@@ -22,6 +22,14 @@ This project was generated using [Camel 
Jbang](https://camel.apache.org/manual/c
 
 This is a brief guide explaining how to build, "containerize" and run your 
Camel application.
 
+## For AI coding assistants
+
+If you are an AI coding assistant working on this project, start from the 
Apache Camel LLM index at https://camel.apache.org/llms.txt.
+
+- Any Apache Camel documentation page is available as LLM-friendly Markdown by 
replacing `.html` with `.md` in its URL.
+- Use the Camel CLI and the Camel MCP server (linked from the index above) to 
look up components, their options and the catalog instead of guessing endpoint 
URIs and options.
+- See `AGENTS.md` in this directory for project-specific guidance.
+
 ## Build the Maven project (JVM mode)
 
 ```bash
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
index c4ecf30300c7..855bb1222dda 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
@@ -460,6 +460,8 @@ class ExportTest {
         Assertions.assertTrue(new File(workingDir + "/src/main/docker", 
"Dockerfile").exists(), "Missing Dockerfile");
         // Readme
         Assertions.assertTrue(new File(workingDir, "readme.md").exists(), 
"Missing readme.md");
+        // AGENTS.md
+        Assertions.assertTrue(new File(workingDir, "AGENTS.md").exists(), 
"Missing AGENTS.md");
     }
 
     // Each runtime may have a different logic
@@ -520,6 +522,8 @@ class ExportTest {
         Assertions.assertTrue(new File(workingDir + "/src/main/docker", 
"Dockerfile").exists(), "Missing Dockerfile");
         // Readme
         Assertions.assertTrue(new File(workingDir, "readme.md").exists(), 
"Missing readme.md");
+        // AGENTS.md
+        Assertions.assertTrue(new File(workingDir, "AGENTS.md").exists(), 
"Missing AGENTS.md");
     }
 
     @ParameterizedTest
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/TemplateHelperTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/TemplateHelperTest.java
index 3494dfc90632..5a8ce163655d 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/TemplateHelperTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/TemplateHelperTest.java
@@ -130,6 +130,7 @@ class TemplateHelperTest {
         assertNoLicenseHeader(result);
         assertNoUnresolvedInterpolations(result);
         assertTrue(result.contains("my-app"));
+        assertTrue(result.contains("https://camel.apache.org/llms.txt";));
     }
 
     @Test
@@ -144,6 +145,21 @@ class TemplateHelperTest {
         assertNoLicenseHeader(result);
         assertNoUnresolvedInterpolations(result);
         assertTrue(result.contains("my-app"));
+        assertTrue(result.contains("https://camel.apache.org/llms.txt";));
+    }
+
+    @Test
+    void testAgentsTemplate() throws IOException {
+        Map<String, Object> model = new HashMap<>();
+        model.put("ArtifactId", "my-app");
+
+        String result = TemplateHelper.processTemplate("agents.md.ftl", model);
+
+        assertNoLicenseHeader(result);
+        assertNoUnresolvedInterpolations(result);
+        assertTrue(result.contains("my-app"));
+        assertTrue(result.contains("https://camel.apache.org/llms.txt";));
+        assertTrue(result.contains("canonical YAML DSL"));
     }
 
     @Test

Reply via email to