Skip to content

Fix JBang metadata generation to detect all commands and resolve completion candidates#22221

Open
gnodet wants to merge 3 commits intomainfrom
fix-jbang-metadata-mojo
Open

Fix JBang metadata generation to detect all commands and resolve completion candidates#22221
gnodet wants to merge 3 commits intomainfrom
fix-jbang-metadata-mojo

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Mar 24, 2026

Summary

Fixes the PrepareCamelJBangCommandsMojo to correctly detect all JBang commands and resolve picocli ${COMPLETION-CANDIDATES} placeholders in generated documentation.

Changes

Mojo fixes (PrepareCamelJBangCommandsMojo.java):

  • Fix SUBCOMMAND_PATTERN regex to match both new CommandLine(this) and new CommandLine(main), detecting previously missed commands (wrapper, dataweave)
  • Add resolveCompletionCandidates() to find and parse picocli completionCandidates classes, replacing ${COMPLETION-CANDIDATES} with actual values in generated docs
  • Improve sanitizeDescription() to clean up residual empty parentheses
  • Add missing JavaSource import

Docs build resilience (docs/gulpfile.js):

  • Improve resilientSrc() to process each glob pattern as a separate stream, so an ENOENT from one pattern (e.g. dsl glob hitting .camel-jbang/work) doesn't abort the other patterns (core, components). Previously, a single ENOENT would stop the entire stream, producing only 47 of 71 expected symlinks and causing xref-check failures.

Regenerated content:

  • camel-jbang-commands-metadata.json — now includes wrapper and dataweave commands with all options
  • ~23 .adoc command doc files — completion candidates resolved (e.g., Java version (21, 25) instead of Java version ())

@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 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 build-all, build-dependents, 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 have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

🧪 CI tested the following changed modules:

  • docs
  • dsl/camel-jbang/camel-jbang-core
  • tooling/maven/camel-package-maven-plugin

ℹ️ Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the test-dependents label to force testing all dependents.

Build reactor — dependencies compiled but only changed modules were tested (6 modules)
  • Camel :: Docs
  • Camel :: Docs [pom]
  • Camel :: JBang :: Core
  • Camel :: JBang :: Core [jar]
  • Camel :: Maven Plugins :: Camel Maven Package
  • Camel :: Maven Plugins :: Camel Maven Package [maven-plugin]

@gnodet gnodet force-pushed the fix-jbang-metadata-mojo branch from 09aeeca to c599fd5 Compare March 24, 2026 15:00
@gnodet gnodet force-pushed the fix-jbang-metadata-mojo branch from c599fd5 to c0f74cd Compare March 24, 2026 15:42
@gnodet gnodet changed the title Fix JBang metadata generation to detect all commands Fix JBang metadata generation to detect all commands and resolve completion candidates Mar 27, 2026
@gnodet gnodet force-pushed the fix-jbang-metadata-mojo branch 2 times, most recently from 506b03a to 0b80621 Compare March 27, 2026 14:10
gnodet and others added 3 commits March 27, 2026 15:49
The PrepareCamelJBangCommandsMojo was not discovering all commands because:
- It searched for `new CommandLine(main)` but CamelJBangMain uses `new CommandLine(this)`
- The SUBCOMMAND_PATTERN regex only matched `(main)` constructor arg, not `(this)`

This caused several commands and options to be missing from generated docs:
- Missing `wrapper` command, `dataweave` subcommand
- Missing `bind` deprecation notice
- Wrong description for `--skip-plugins` option

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add resolveCompletionCandidates() to find and parse picocli
  completionCandidates classes, replacing ${COMPLETION-CANDIDATES}
  with actual values in generated docs
- Improve sanitizeDescription() to clean up residual empty parentheses
- Add missing JavaSource import to avoid FQCN usage
- Regenerate jbang command docs and metadata

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When glob-stream hits ENOENT, it stops emitting files from the entire
source — even if the error only affects one glob pattern. This caused
only 47 of 71 "others" symlinks to be created.

Fix by processing each source pattern as a separate gulp.src stream
and merging results into a single passthrough. An ENOENT in one
pattern (e.g. the dsl glob hitting .camel-jbang/work) no longer
aborts the other patterns (core, components).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet force-pushed the fix-jbang-metadata-mojo branch from 0b80621 to b53baba Compare March 27, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant