You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2026/10/07 09:59:40 UTC
[PR] CAMEL-25411: camel-jbang - Source editor: complete the properties of a Kamelet under its kamelet: endpoint [camel]
davsclaus opened a new pull request, #27487:
URL: https://github.com/apache/camel/pull/27487
## Description
https://issues.apache.org/jira/browse/CAMEL-25411. This is a follow-up to #27486: the editor now checks the properties of a Kamelet, and with this change it also completes them.
**The problem:** pressing Tab under `parameters:` of a `kamelet:` endpoint (or in its query) listed only the options of the kamelet component itself: `block`, `routeId`, `timeout`… The properties of the Kamelet, which are what goes there, were not offered.
**Now the list shows, in order:**
1. The properties of the Kamelet, required ones first, with their type, default and description. They are found with `KameletDefinitions.find`: the project's own Kamelet file in the directory of the route, else the catalog. A property that is already set is not offered again.
2. A dim `── kamelet component options ──` divider that cannot be selected. Arrow keys skip it, and a click on it does nothing.
3. The options of the kamelet component, which are for special uses.
While filtering, the properties of the Kamelet stay above the divider. There is no divider when only one kind is listed, for example for a Kamelet without properties, or when a filter matches only one kind.
```
╭ kamelet options (9) ─────────────────────╮
│ * tag string │
│ prefix string │
│── kamelet component options ─────────────│
│ block boolean │
│ ... │
│ routeId string │
│ timeout integer │
```
## Tests
`SourceKameletValidationTest`:
- the properties of a project Kamelet come first;
- a property that is already set is not listed;
- a catalog Kamelet (`timer-source`) given in the query;
- where the divider is, while filtering and without a filter;
- no divider when a filter leaves one kind, and none for a Kamelet without properties.
The camel-jbang-plugin-tui module: 1749 tests pass. Tried by hand in the source editor with the custom Kamelet from the benchmark.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25411: camel-jbang - Source editor: Kamelet property completion, highlighting, Go to Route names and notes as warnings [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27487:
URL: https://github.com/apache/camel/pull/27487#issuecomment-6036591272
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `docs`
- `dsl/camel-jbang/camel-jbang-core`
- `dsl/camel-jbang/camel-jbang-plugin-tui`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 6 of 699 tested, 8 compile-only — current: 6 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **6 affected modules** (current approach: 6).
**Skip-tests mode would test 6 modules** (3 direct + 5 downstream), **skip tests for 8** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (6)</summary>
- `camel-jbang-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-tui` ← dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AutocompletePopup.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceEditAssist.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceTab.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SyntaxHighlighter.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceKameletValidationTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceTabJumpLinksTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SyntaxHighl
ighterTest.java
- `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-jbang-core
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
</details>
<details><summary>Modules with tests skipped (8)</summary>
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-launcher`
- `coverage`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-core`: 2 test(s) disabled on GitHub Actions
:bulb: **Manual integration tests recommended:**
> You modified `dsl/camel-jbang/camel-jbang-core`. The related integration tests in `dsl/camel-jbang/camel-jbang-it` are excluded from CI. Consider running them manually:
> ```
> mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
> ```
<details><summary>All tested modules (16 modules, 3m 55s total)</summary>
**Total reactor time:** 3m 55s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: Launcher | 56.1s | SUCCESS |
| Camel :: JBang :: Plugin :: TUI | 52.9s | SUCCESS |
| Camel :: JBang :: MCP | 45.1s | SUCCESS |
| Camel :: Docs | 22.5s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 19.0s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 16.4s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 11.5s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 2.2s | SUCCESS |
| Camel :: Coverage | 2.0s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 1.7s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 1.4s | SUCCESS |
| Camel :: JBang :: Main | 1.0s | SUCCESS |
| Camel :: JBang :: Integration tests | 1.0s | SUCCESS |
| Camel :: Launcher :: Container | 0.7s | SUCCESS |
| Camel :: JBang :: Core | n/a | |
**Top 20 slowest modules:**
- `Camel :: Launcher` (56.1s)
- `Camel :: JBang :: Plugin :: TUI` (52.9s)
- `Camel :: JBang :: MCP` (45.1s)
- `Camel :: Docs` (22.5s)
- `Camel :: JBang :: Plugin :: Validate` (19.0s)
- `Camel :: JBang :: Plugin :: Kubernetes` (16.4s)
- `Camel :: JBang :: Plugin :: Testing` (11.5s)
- `Camel :: JBang :: Plugin :: MCP` (2.2s)
- `Camel :: Coverage` (2.0s)
- `Camel :: JBang :: Plugin :: Edit` (1.8s)
- `Camel :: JBang :: Plugin :: Route Parser` (1.7s)
- `Camel :: JBang :: Plugin :: Generate` (1.4s)
- `Camel :: JBang :: Main` (1.0s)
- `Camel :: JBang :: Integration tests` (1.0s)
- `Camel :: Launcher :: Container` (0.7s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/37608437561)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25411: camel-jbang - Source editor: Kamelet property completion, highlighting, Go to Route names and notes as warnings [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27487:
URL: https://github.com/apache/camel/pull/27487
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25411: camel-jbang - Source editor: Kamelet property completion, highlighting, Go to Route names and notes as warnings [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27487:
URL: https://github.com/apache/camel/pull/27487#discussion_r4205668246
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SyntaxHighlighter.java:
##########
@@ -230,6 +230,11 @@ static Language detectLanguage(String filename) {
return Language.PLAIN;
}
ext = ext.toLowerCase();
+ // the last extension: a Kamelet is name.kamelet.yaml, which onlyExt gives as kamelet.yaml (CAMEL-25411)
+ int dot = ext.lastIndexOf('.');
+ if (dot >= 0) {
+ ext = ext.substring(dot + 1);
Review Comment:
Fixed in 0ad69e4da5d5: the `camel.yaml`, `camel.yml` and `camel.xml` arms are gone, as only the last extension reaches the switch now.
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceTab.java:
##########
@@ -1489,6 +1495,32 @@ private void scanYamlRoutes(Path file, List<RouteEntry> fromEntries, List<ToEntr
}
}
+ /** The metadata.name of a Kamelet file, or null. */
+ static String kameletName(List<String> lines) {
+ boolean metadata = false;
+ for (String line : lines) {
+ if (line.isBlank() || line.trim().startsWith("#")) {
+ continue;
+ }
+ if (lineIndent(line) == 0) {
+ metadata = line.trim().equals("metadata:");
+ } else if (metadata && line.trim().startsWith("name:")) {
+ String name = extractYamlValue(line.trim(), "name");
+ return name != null && !name.isEmpty() ? name : null;
+ }
+ }
+ return null;
+ }
+
+ private static String kameletRouteId(String kamelet, String routeId) {
+ return kamelet != null && (routeId == null || routeId.isEmpty()) ? kamelet : routeId;
+ }
+
+ /** An action or a sink is entered from kamelet:source: the routes reach it as kamelet:<its name>. */
+ private static String kameletFromUri(String kamelet, String uri) {
+ return kamelet != null && uri.startsWith("kamelet:source") ? "kamelet:" + kamelet : uri;
Review Comment:
Fixed in 0ad69e4da5d5: it matches `kamelet:source` exactly, or with a query (`kamelet:source?...`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25411: camel-jbang - Source editor: complete the properties of a Kamelet under its kamelet: endpoint [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27487:
URL: https://github.com/apache/camel/pull/27487#issuecomment-6035573263
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25411: camel-jbang - Source editor: Kamelet property completion, highlighting, Go to Route names and notes as warnings [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27487:
URL: https://github.com/apache/camel/pull/27487#discussion_r4205706375
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AutocompletePopup.java:
##########
@@ -385,9 +402,9 @@ private void renderList(Frame frame, Rect listRect) {
frame.renderStatefulWidget(list, listRect, renderState);
int visibleRows = Math.max(1, listRect.height() - 2);
- if (shown + 2 > visibleRows) {
+ if (listRows() + 2 > visibleRows) {
scrollbarState
- .contentLength(shown)
+ .contentLength(listRows())
.viewportContentLength(visibleRows)
.position(sel != null ? sel : 0);
Review Comment:
Right, thanks: applied in d1d54729a55d, the scrollbar position adds the divider row too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25411: camel-jbang - Source editor: Kamelet property completion, highlighting, Go to Route names and notes as warnings [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27487:
URL: https://github.com/apache/camel/pull/27487#discussion_r4205675031
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AutocompletePopup.java:
##########
@@ -385,9 +402,9 @@ private void renderList(Frame frame, Rect listRect) {
frame.renderStatefulWidget(list, listRect, renderState);
int visibleRows = Math.max(1, listRect.height() - 2);
- if (shown + 2 > visibleRows) {
+ if (listRows() + 2 > visibleRows) {
scrollbarState
- .contentLength(shown)
+ .contentLength(listRows())
.viewportContentLength(visibleRows)
.position(sel != null ? sel : 0);
Review Comment:
⚠️ **Scrollbar position doesn't account for the divider offset.**
At line 382, `renderState.select()` correctly adds `+1` when `dividerAt >= 0 && sel >= dividerAt` to account for the divider row above the selection. The scrollbar's `contentLength` is `listRows()` which already includes the divider row — but `.position()` uses the raw logical `sel`, so the thumb appears one slot too high when the divider is present and the selection is below it.
```suggestion
.position(sel != null ? sel + (dividerAt >= 0 && sel >= dividerAt ? 1 : 0) : 0);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25411: camel-jbang - Source editor: Kamelet property completion, highlighting, Go to Route names and notes as warnings [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27487:
URL: https://github.com/apache/camel/pull/27487#discussion_r4205635900
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SyntaxHighlighter.java:
##########
@@ -230,6 +230,11 @@ static Language detectLanguage(String filename) {
return Language.PLAIN;
}
ext = ext.toLowerCase();
+ // the last extension: a Kamelet is name.kamelet.yaml, which onlyExt gives as kamelet.yaml (CAMEL-25411)
+ int dot = ext.lastIndexOf('.');
+ if (dot >= 0) {
+ ext = ext.substring(dot + 1);
Review Comment:
nit: After this extraction, `ext` will never contain a dot, so the `"camel.yaml"`, `"camel.yml"` and `"camel.xml"` arms in the switch below become dead code. Not a bug — they still compile and the tests pass — but they may confuse a future reader who thinks the multi-dot extensions are still reachable.
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceTab.java:
##########
@@ -1489,6 +1495,32 @@ private void scanYamlRoutes(Path file, List<RouteEntry> fromEntries, List<ToEntr
}
}
+ /** The metadata.name of a Kamelet file, or null. */
+ static String kameletName(List<String> lines) {
+ boolean metadata = false;
+ for (String line : lines) {
+ if (line.isBlank() || line.trim().startsWith("#")) {
+ continue;
+ }
+ if (lineIndent(line) == 0) {
+ metadata = line.trim().equals("metadata:");
+ } else if (metadata && line.trim().startsWith("name:")) {
+ String name = extractYamlValue(line.trim(), "name");
+ return name != null && !name.isEmpty() ? name : null;
+ }
+ }
+ return null;
+ }
+
+ private static String kameletRouteId(String kamelet, String routeId) {
+ return kamelet != null && (routeId == null || routeId.isEmpty()) ? kamelet : routeId;
+ }
+
+ /** An action or a sink is entered from kamelet:source: the routes reach it as kamelet:<its name>. */
+ private static String kameletFromUri(String kamelet, String uri) {
+ return kamelet != null && uri.startsWith("kamelet:source") ? "kamelet:" + kamelet : uri;
Review Comment:
nit: `uri.startsWith("kamelet:source")` also matches a hypothetical `kamelet:source-events`. An `equals` check (or `"kamelet:source".equals(uri)` / checking for a `?` after `source`) would be exact. In practice it's safe because this only runs inside a Kamelet template (`kamelet != null`), where the canonical from URI is literally `kamelet:source`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org