gnodet-bot commented on code in PR #30566:
URL: https://github.com/apache/camel/pull/30566#discussion_r4657210369


##########
design/upgrade-guides-as-data.adoc:
##########
@@ -0,0 +1,483 @@
+---
+title: Upgrade guides as data in the Camel catalog
+authors:
+  - "@davsclaus"
+reviewers: []
+approvers: []
+creation-date: 2026-11-21
+last-updated: 2026-11-22
+status: proposed
+see-also:
+  - "CAMEL-27359"
+  - "CAMEL-27352"
+  - "CAMEL-27351"
+replaces: []
+superseded-by: []
+---
+
+== Summary
+
+The upgrade guides 
(`docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_*.adoc`) are 
written for people
+who read them on the website, one page per minor release. A tool that helps 
with an upgrade needs the same content
+as data: the entries that apply between the version in use and the target, the 
components each entry is about,
+whether it is a removal or a deprecation, and a link to the entry on the 
website.
+
+This proposal adds a build step that turns the guides into JSON, one entry per 
change, and ships the JSON in
+`camel-catalog`, as the catalog already ships the Camel releases and the 
security advisories:
+
+[source,json]
+----
+{
+  "id": "4.22.3/camel-ftp-sftp-uses-remote-file-and-directory-names-as-given",
+  "change": 
"4.24/camel-ftp-sftp-uses-remote-file-and-directory-names-as-given",
+  "guide": "4.22",
+  "from": "4.22.2",
+  "to": "4.22.3",
+  "title": "camel-ftp - sftp uses remote file and directory names as given",
+  "components": ["camel-ftp"],
+  "kind": "change",
+  "breaking": false,
+  "summary": "The sftp component now uses a remote file or directory name 
exactly as given, also when it contains * or ?.",
+  "text": "...the entry, as Markdown...",
+  "url": 
"https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html#_camel_ftp_sftp_uses_remote_file_and_directory_names_as_given";
+}
+----
+
+The AsciiDoc stays the source. Guide authors write it as they do today. Checks 
in the build find the mistakes of the
+guides, which are fixed in the guides, so the JSON is as accurate as the 
guides can be made. The document also defines the rule for
+choosing the entries of an upgrade from one version to another, so every tool 
lists the same entries.
+
+The point is that the format is shared. The Camel CLI, the MCP server, an IDE 
plugin, Camel Kit or a tool nobody has
+written yet can each build their own upgrade help on the same data. None of 
them has to parse AsciiDoc.
+
+== Motivation
+
+Today a tool that wants the guides parses the AsciiDoc itself:
+
+- The MCP server (`camel-jbang-mcp`) copies the guide files into its JAR at 
build time (`copy-migration-guides` in
+  its `pom.xml`). `MigrationData` splits them into sections at the `==` and 
`===` headings, and searches them with
+  BM25 for `camel_migration_guide_search`. It does not know which component an 
entry is about, or whether an entry
+  of a patch release is already in the version in use.
+- The upgrade view planned in CAMEL-27352 (the Camel CLI `camel update check` 
and a screen of the Camel TUI) needs the
+  entries between two versions, per component, so it can show only the entries 
that touch the components the
+  integration uses. The guides are not in the CLI, so it would have to parse 
them again.
+- The https://github.com/apache/camel-upgrade-recipes/[Camel Upgrade Recipes] 
automate part of a migration. They
+  would gain from knowing which guide entries a recipe covers, so a tool can 
say "this entry is done for you, these
+  you do by hand".
+- An IDE plugin, Karavan or Camel Kit would each write a third, fourth and 
fifth parser.
+
+Each parser has its own idea of where an entry starts and ends, which version 
it belongs to, and which component it is
+about. The guides have more structure than a quick parser sees:
+
+- A guide has a `==` section per release: the minor release (`== Upgrading 
Camel 4.21 to 4.22`) and the patch
+  releases of an LTS line (`== Upgrading from 4.22.2 to 4.22.3`). Some guides 
also have a `==` section that is not a
+  release (`== Camel Spring Boot`, `== Removed deprecated components`).
+- An entry is usually a `===` heading, but the 4.23 guide groups its entries 
under `=== Breaking Changes` and
+  `=== Deprecated Components and Features`, with an entry per `====` heading.
+- A change that is backported has an entry in each line it went into: the 4.18 
guide, the 4.22 guide, and the minor
+  guide of the release where it landed on main. A tool that lists all three 
tells the user the same thing three
+  times. A tool that lists the minor entry to a user who already has the 
backport tells them about a change they have.
+
+A parser in the catalog build, run once, with tests and with warnings when a 
guide does not fit the rules, is better
+than one per tool.
+
+== Goals
+
+- One JSON entry per change, with the release that brings it, the components 
it is about, its kind and a link to the
+  website.
+- A written rule for which entries apply to an upgrade from version A to 
version B, including patch releases and
+  backports, which every tool follows.
+- The JSON in `camel-catalog`, read through `CamelCatalog`, and as plain files 
in the JAR for a tool that is not
+  written in Java.
+- Data as accurate as we can make it: checks in the build that find the 
mistakes of the guides (a section in the wrong
+  guide, a missing patch release, a backport with no entry on the minor 
guide), a pass that fixes the ones there are
+  today, and a strict build afterwards, so the guides stay correct for the 
website as well as for the JSON.
+
+== Non-goals
+
+- Changing the code of a project. That is the job of the Camel Upgrade Recipes 
and `camel update run`.
+- A new authoring format. The guides stay AsciiDoc, written as today. The 
conventions in
+  <<Conventions for guide authors>> are the ones most entries follow already.
+- The upgrade view itself (CAMEL-27352). It is one user of the data, not part 
of this design.
+- The guides of Camel Spring Boot and Camel Quarkus, which live in their own 
repositories. They can produce the same
+  format later (see <<Open questions>>).
+
+== Proposal
+
+=== The files
+
+A new goal of `camel-package-maven-plugin`, `prepare-upgrade-guides`, runs in 
the normal `camel-catalog` build, next to
+`prepare-catalog`. Unlike the releases and the advisories, which are synced 
from camel-website by a profile, the
+guides live in this repository, so the JSON is generated in every build and 
committed like the other generated
+catalog files:
+
+----
+catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/upgrade-guides/
+  index.json
+  camel-4x-upgrade-guide-4_1.json
+  ...
+  camel-4x-upgrade-guide-4_24.json
+----
+
+`index.json` lists the guides:
+
+[source,json]
+----
+{
+  "schemaVersion": 1,
+  "guides": [
+    {
+      "guide": "4.22",
+      "file": "camel-4x-upgrade-guide-4_22.json",
+      "title": "Upgrade guide 4.21 -> 4.22 LTS",
+      "lts": true,
+      "url": 
"https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html";,
+      "sections": [
+        { "from": "4.22.2", "to": "4.22.3" },
+        { "from": "4.22.1", "to": "4.22.2" },
+        { "from": "4.22.0", "to": "4.22.1" },
+        { "from": "4.21", "to": "4.22" }
+      ],
+      "entries": 214
+    }
+  ]
+}
+----
+
+Each guide file is a JSON array of entries. The 4.x guides are 2 MB of 
AsciiDoc. The JSON, with the text as Markdown,
+is about 2 MB too, and about 600 KB as stored (compressed) in the JAR.
+
+=== The entry
+
+[cols="1,1,4"]
+|===
+| Field | Type | What it is
+
+| `id`
+| string
+| The id of the entry, unique in the catalog: the release of its section, `/`, 
and the slug of its title. The release
+  is the `to` of the section: `4.24` for a minor section, `4.22.3` for a patch 
section. The slug is the title in lower
+  case, with each run of characters that are not `a-z` or `0-9` replaced by 
one `-`, and no `-` at the start or the
+  end. It has no maximum length. A second entry with the same title in one 
section gets `-2` (and a warning, see

Review Comment:
   πŸ’‘ **Spec gap:** The collision rule only specifies that a second entry with 
the same title in one section gets `-2`. What suffix does the third get? `-3`? 
The pattern is natural to assume but should be stated explicitly (e.g. β€œa third 
gets `-3`, and so on”) so tool implementers are not guessing.



##########
design/upgrade-guides-as-data.adoc:
##########
@@ -0,0 +1,483 @@
+---
+title: Upgrade guides as data in the Camel catalog
+authors:
+  - "@davsclaus"
+reviewers: []
+approvers: []
+creation-date: 2026-11-21
+last-updated: 2026-11-22
+status: proposed
+see-also:
+  - "CAMEL-27359"
+  - "CAMEL-27352"
+  - "CAMEL-27351"
+replaces: []
+superseded-by: []
+---
+
+== Summary
+
+The upgrade guides 
(`docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_*.adoc`) are 
written for people
+who read them on the website, one page per minor release. A tool that helps 
with an upgrade needs the same content
+as data: the entries that apply between the version in use and the target, the 
components each entry is about,
+whether it is a removal or a deprecation, and a link to the entry on the 
website.
+
+This proposal adds a build step that turns the guides into JSON, one entry per 
change, and ships the JSON in
+`camel-catalog`, as the catalog already ships the Camel releases and the 
security advisories:
+
+[source,json]
+----
+{
+  "id": "4.22.3/camel-ftp-sftp-uses-remote-file-and-directory-names-as-given",
+  "change": 
"4.24/camel-ftp-sftp-uses-remote-file-and-directory-names-as-given",
+  "guide": "4.22",
+  "from": "4.22.2",
+  "to": "4.22.3",
+  "title": "camel-ftp - sftp uses remote file and directory names as given",
+  "components": ["camel-ftp"],
+  "kind": "change",
+  "breaking": false,
+  "summary": "The sftp component now uses a remote file or directory name 
exactly as given, also when it contains * or ?.",
+  "text": "...the entry, as Markdown...",
+  "url": 
"https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html#_camel_ftp_sftp_uses_remote_file_and_directory_names_as_given";
+}
+----
+
+The AsciiDoc stays the source. Guide authors write it as they do today. Checks 
in the build find the mistakes of the
+guides, which are fixed in the guides, so the JSON is as accurate as the 
guides can be made. The document also defines the rule for
+choosing the entries of an upgrade from one version to another, so every tool 
lists the same entries.
+
+The point is that the format is shared. The Camel CLI, the MCP server, an IDE 
plugin, Camel Kit or a tool nobody has
+written yet can each build their own upgrade help on the same data. None of 
them has to parse AsciiDoc.
+
+== Motivation
+
+Today a tool that wants the guides parses the AsciiDoc itself:
+
+- The MCP server (`camel-jbang-mcp`) copies the guide files into its JAR at 
build time (`copy-migration-guides` in
+  its `pom.xml`). `MigrationData` splits them into sections at the `==` and 
`===` headings, and searches them with
+  BM25 for `camel_migration_guide_search`. It does not know which component an 
entry is about, or whether an entry
+  of a patch release is already in the version in use.
+- The upgrade view planned in CAMEL-27352 (the Camel CLI `camel update check` 
and a screen of the Camel TUI) needs the
+  entries between two versions, per component, so it can show only the entries 
that touch the components the
+  integration uses. The guides are not in the CLI, so it would have to parse 
them again.
+- The https://github.com/apache/camel-upgrade-recipes/[Camel Upgrade Recipes] 
automate part of a migration. They
+  would gain from knowing which guide entries a recipe covers, so a tool can 
say "this entry is done for you, these
+  you do by hand".
+- An IDE plugin, Karavan or Camel Kit would each write a third, fourth and 
fifth parser.
+
+Each parser has its own idea of where an entry starts and ends, which version 
it belongs to, and which component it is
+about. The guides have more structure than a quick parser sees:
+
+- A guide has a `==` section per release: the minor release (`== Upgrading 
Camel 4.21 to 4.22`) and the patch
+  releases of an LTS line (`== Upgrading from 4.22.2 to 4.22.3`). Some guides 
also have a `==` section that is not a
+  release (`== Camel Spring Boot`, `== Removed deprecated components`).
+- An entry is usually a `===` heading, but the 4.23 guide groups its entries 
under `=== Breaking Changes` and
+  `=== Deprecated Components and Features`, with an entry per `====` heading.
+- A change that is backported has an entry in each line it went into: the 4.18 
guide, the 4.22 guide, and the minor
+  guide of the release where it landed on main. A tool that lists all three 
tells the user the same thing three
+  times. A tool that lists the minor entry to a user who already has the 
backport tells them about a change they have.
+
+A parser in the catalog build, run once, with tests and with warnings when a 
guide does not fit the rules, is better
+than one per tool.
+
+== Goals
+
+- One JSON entry per change, with the release that brings it, the components 
it is about, its kind and a link to the
+  website.
+- A written rule for which entries apply to an upgrade from version A to 
version B, including patch releases and
+  backports, which every tool follows.
+- The JSON in `camel-catalog`, read through `CamelCatalog`, and as plain files 
in the JAR for a tool that is not
+  written in Java.
+- Data as accurate as we can make it: checks in the build that find the 
mistakes of the guides (a section in the wrong
+  guide, a missing patch release, a backport with no entry on the minor 
guide), a pass that fixes the ones there are
+  today, and a strict build afterwards, so the guides stay correct for the 
website as well as for the JSON.
+
+== Non-goals
+
+- Changing the code of a project. That is the job of the Camel Upgrade Recipes 
and `camel update run`.
+- A new authoring format. The guides stay AsciiDoc, written as today. The 
conventions in
+  <<Conventions for guide authors>> are the ones most entries follow already.
+- The upgrade view itself (CAMEL-27352). It is one user of the data, not part 
of this design.
+- The guides of Camel Spring Boot and Camel Quarkus, which live in their own 
repositories. They can produce the same
+  format later (see <<Open questions>>).
+
+== Proposal
+
+=== The files
+
+A new goal of `camel-package-maven-plugin`, `prepare-upgrade-guides`, runs in 
the normal `camel-catalog` build, next to
+`prepare-catalog`. Unlike the releases and the advisories, which are synced 
from camel-website by a profile, the
+guides live in this repository, so the JSON is generated in every build and 
committed like the other generated
+catalog files:
+
+----
+catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/upgrade-guides/
+  index.json
+  camel-4x-upgrade-guide-4_1.json
+  ...
+  camel-4x-upgrade-guide-4_24.json
+----
+
+`index.json` lists the guides:
+
+[source,json]
+----
+{
+  "schemaVersion": 1,
+  "guides": [
+    {
+      "guide": "4.22",
+      "file": "camel-4x-upgrade-guide-4_22.json",
+      "title": "Upgrade guide 4.21 -> 4.22 LTS",
+      "lts": true,
+      "url": 
"https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html";,
+      "sections": [
+        { "from": "4.22.2", "to": "4.22.3" },
+        { "from": "4.22.1", "to": "4.22.2" },
+        { "from": "4.22.0", "to": "4.22.1" },
+        { "from": "4.21", "to": "4.22" }
+      ],
+      "entries": 214
+    }
+  ]
+}
+----
+
+Each guide file is a JSON array of entries. The 4.x guides are 2 MB of 
AsciiDoc. The JSON, with the text as Markdown,
+is about 2 MB too, and about 600 KB as stored (compressed) in the JAR.
+
+=== The entry
+
+[cols="1,1,4"]
+|===
+| Field | Type | What it is
+
+| `id`
+| string
+| The id of the entry, unique in the catalog: the release of its section, `/`, 
and the slug of its title. The release
+  is the `to` of the section: `4.24` for a minor section, `4.22.3` for a patch 
section. The slug is the title in lower
+  case, with each run of characters that are not `a-z` or `0-9` replaced by 
one `-`, and no `-` at the start or the
+  end. It has no maximum length. A second entry with the same title in one 
section gets `-2` (and a warning, see
+  <<Checks in the build>>). Example: 
`4.22.3/camel-ftp-sftp-uses-remote-file-and-directory-names-as-given`.
+
+| `change`
+| string
+| The id of the change the entry is about. For an entry of a minor section, 
its own `id`: each change lands on `main`
+  once, in one minor release. For an entry of a patch section, the `id` of the 
minor entry it is a backport of (see
+  <<Backports>>), or its own `id` when there is none. The rule of <<Which 
entries apply to an upgrade>> works on
+  `change`.
+
+| `guide`
+| string
+| The minor version of the guide the entry is in: `4.22`.
+
+| `from`, `to`
+| string
+| The `==` section the entry is in. For a minor section `4.21` and `4.22`, for 
a patch section `4.22.2` and
+  `4.22.3`. A `==` section that is not a release (`== Camel Spring Boot`) 
belongs to the minor release of its guide.
+
+| `title`
+| string
+| The heading of the entry, as written.
+
+| `group`
+| string, optional
+| The `===` heading an entry is grouped under, when the entry is a `====` 
heading: `Breaking Changes`,
+  `camel-core - Enterprise Integration Patterns (EIPs)`.
+
+| `components`
+| array of strings
+| The Maven artifact ids the entry is about: `camel-ftp`, `camel-core`, 
`camel-yaml-dsl`. Empty for a general entry
+  (Java DSL, EIPs, Spring Boot).
+
+| `eips`
+| array of strings, optional
+| The EIPs an entry is about, when the heading names them (`=== Recipient 
List, Split and Multicast EIP`). A value is
+  the `name` of the EIP model in the catalog (`models/split.json`, 
`CamelCatalog.findModelNames()`): case-sensitive,
+  in camel case, such as `split` and `recipientList`.
+
+| `kind`
+| string
+| `change`, `deprecation` or `removal`. A rename (of an option, a header, a 
page, a class) is a `change`, with the old
+  and the new name in the text. There is no `addition`: the upgrade guides are 
for migration only, not for new
+  features (the upgrade guide rule of `CLAUDE.md`), so an entry about a new 
feature is a `change` too.
+
+| `breaking`
+| boolean
+| `true` when the heading or its group says it is a breaking change 
(`(Breaking change)`, `- potential breaking change`,
+  `=== Breaking Changes`).
+
+| `summary`
+| string
+| The first sentence of the entry, as plain text: for a list, a table or a 
one-line view.
+
+| `text`
+| string
+| The whole entry, as Markdown (see <<The text>>).
+
+| `url`
+| string
+| The entry on the website: the page of the guide and the anchor of the 
heading.
+|===
+
+New fields can be added in a later version of the format. A tool ignores the 
fields it does not know. A change that
+breaks a reader increases `schemaVersion`.
+
+=== From AsciiDoc to entries
+
+The goal reads each guide line by line, as `MigrationData` does today, and 
skips the content of delimited blocks
+(`----`, `....`, `====`, `|===`), so a heading inside an example is not taken 
for one.
+
+Sections::
+* `== Upgrading Camel X.Y to X.Z` is a minor section, `from` X.Y and `to` X.Z.
+* `== Upgrading from X.Y.A to X.Y.B` is a patch section. The versions are as 
written: `4.18.1 to 4.18.3` skips 4.18.2,
+  which was not released.
+* Any other `==` section belongs to the minor release of the guide.
+
+Entries::
+* A `===` heading with no `====` heading under it is one entry.
+* A `===` heading with `====` headings under it is a group. Each `====` 
heading is an entry, with the `===` heading as
+  its `group`. The text between the `===` heading and the first `====` 
heading, if any, is one more entry, titled as
+  the group.
+* The list under `Removed deprecated components` (as a `==` or a `===` 
heading) gives one entry of kind `removal` per
+  component in the list.
+
+Components::
+* The part of the heading before ` - ` or ` (` is split at `,`, `/` and ` and 
`. Each part that is a Maven artifact id of
+  this repository is a component of the entry: `=== camel-file / camel-aws2-s3 
/ camel-ibm-cos` names three.
+* A small alias file maps names that are not artifact ids: `camel-jbang` to 
the Camel CLI artifacts, `camel-sftp` and
+  `camel-ftps` to `camel-ftp`, `camel-cxf` to `camel-cxf-soap` and 
`camel-cxf-rest`. A removed component (`camel-irc`,
+  `camel-ironmq`) is not an artifact any more: its name is kept as written, as 
it is the name a project that still
+  uses it has in its `pom.xml`.
+* An entry of a group with no component in its own heading gets the components 
of the group heading:
+  `==== Split EIP - ...` under `=== camel-core - Enterprise Integration 
Patterns (EIPs)` is about `camel-core`.
+
+Kind::
+* `removal` for a heading or group with `(Removal)`, `Removed`, or the list of 
removed components.
+* `deprecation` for a heading or group with `(Deprecation)`, `(deprecated)`, 
`Deprecated` or ending in `deprecated`.
+* `change` for all other entries.
+
+URL::
+The anchor is the id Asciidoctor gives the heading on the website: `_` and the 
title in lower case, with the characters
+that are not a letter, a digit, a space, `-` or `.` removed, and each space, 
`-` or `.` replaced by `_`. A second
+heading with the same title on the page gets `_2`, as the second `=== 
camel-kafka` of the 4.19 guide does. A test
+checks the goal against the ids of a guide rendered with Asciidoctor.
+
+The goal does not use a full AsciiDoc parser. The guides use a small part of 
AsciiDoc (headings, lists, source
+blocks, tables, admonitions, `xref:`), and the line reader that 
`MigrationData` uses has worked on all of them.
+
+=== The text
+
+`text` is the entry as Markdown: a source block becomes a fenced code block 
with its language, an admonition a quote
+starting with `**NOTE:**`, an `xref:` a link to the page on the website, and a 
table a GitHub table. A table that has
+blocks inside a cell (lists, code), which Markdown tables cannot hold, becomes 
a fenced code block with the language
+`asciidoc`. So `text` is always Markdown, and the exception is marked the way 
Markdown marks any code: a tool that
+renders Markdown shows the table as source, and a tool that wants it can find 
it by the language. Today the 4.x guides have 294 source blocks, 121 tables, 51 
admonitions and 88 `xref:` links.

Review Comment:
   πŸ”§ **Style:** This line is 191 characters. AsciiDoc source conventionally 
wraps at ~120 chars for readability in editors and diff tools. Consider 
splitting at the sentence boundary after `by the language.`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to