-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Add CLI metadata extraction infrastructure and enrich-cli-help skill #574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
llewellyn-sl
wants to merge
5
commits into
master
Choose a base branch
from
ll-cli-docs-automation-infrastructure
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
51473a8
feat: Add CLI metadata extraction infrastructure
llewellyn-sl 38369c4
Update enrich-cli-help skill with default value handling guidelines
llewellyn-sl 55058c2
refactor: align CLI metadata generation with release artifacts
llewellyn-sl ba58e29
Merge branch 'master' into ll-cli-docs-automation-infrastructure
JaimeSeqLabs d789ce1
refactor: move metadata release asset into jreleaser
llewellyn-sl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Claude Code Configuration for Seqera Platform CLI | ||
|
|
||
| This directory contains Claude Code configuration and skill documentation for contributors working on the Seqera Platform CLI codebase. | ||
|
|
||
| ## Skills Available | ||
|
|
||
| ### enrich-cli-help | ||
|
|
||
| Workflow documentation for generating structured CLI metadata from the `tower-cli` source tree. | ||
|
|
||
| **Use this skill when:** | ||
| - Updating the metadata extractor | ||
| - Validating metadata output | ||
| - Reviewing the release-artifact workflow for CLI docs metadata | ||
|
|
||
| **Quick start:** | ||
| ```bash | ||
| ./gradlew extractCliMetadata | ||
| ``` | ||
|
|
||
| This generates `build/cli-metadata/cli-metadata.json`. | ||
|
|
||
| **Documentation:** | ||
| - `skills/enrich-cli-help/SKILL.md` - Complete workflow guide | ||
| - `skills/enrich-cli-help/README.md` - Quick reference | ||
|
|
||
| ## Project Context | ||
|
|
||
| ### Repository Structure | ||
| ```text | ||
| tower-cli/ | ||
| ├── src/main/java/io/seqera/tower/cli/ | ||
| │ └── utils/metadata/ | ||
| │ └── CliMetadataExtractor.java | ||
| ├── docs/ | ||
| │ └── README.md | ||
| ├── .claude/ | ||
| └── build.gradle | ||
| ``` | ||
|
|
||
| ### Key Files | ||
|
|
||
| - `src/main/java/io/seqera/tower/cli/utils/metadata/CliMetadataExtractor.java` | ||
| - `build.gradle` | ||
| - `docs/README.md` | ||
| - `.github/workflows/build.yml` | ||
|
|
||
| ## Workflow Overview | ||
|
|
||
| ```text | ||
| 1. Extract metadata | ||
| └─> ./gradlew extractCliMetadata | ||
| └─> Outputs build/cli-metadata/cli-metadata.json | ||
|
|
||
| 2. Verify | ||
| └─> Run tests when the extractor changes | ||
| └─> Confirm metadata shape stays stable | ||
|
|
||
| 3. Release | ||
| └─> Generate cli-metadata.json in CI | ||
| └─> Upload it to GitHub release assets | ||
| └─> Dispatch docs automation with the release asset URL | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # CLI Metadata Generation Skill | ||
|
|
||
| This skill documents how to generate and validate structured CLI metadata from the `tower-cli` source tree. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| Run: | ||
|
|
||
| ```bash | ||
| ./gradlew extractCliMetadata | ||
| ``` | ||
|
|
||
| The output is written to `build/cli-metadata/cli-metadata.json`. | ||
|
|
||
| ## What This Skill Does | ||
|
|
||
| 1. Generates CLI metadata from picocli command definitions | ||
| 2. Verifies the extractor output shape | ||
| 3. Documents the release-artifact workflow | ||
| 4. Keeps metadata generation independent from external OpenAPI specs | ||
|
|
||
| ## Release strategy | ||
|
|
||
| - Metadata is generated from source code without modifying it | ||
| - Metadata is a build and release artifact, not a tracked repository file | ||
| - Downstream docs tooling should consume the release asset | ||
|
|
||
| ## Files | ||
|
|
||
| - `SKILL.md` - Complete skill documentation | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Repository root: `tower-cli` | ||
| - Gradle task: `extractCliMetadata` | ||
| - Extractor: `src/main/java/io/seqera/tower/cli/utils/metadata/CliMetadataExtractor.java` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| name: enrich-cli-help | ||
| description: Generate structured CLI metadata from tower-cli source code using the built-in Java extractor. Use when validating metadata generation, updating release automation, or checking the downstream artifact consumed by docs tooling. | ||
| --- | ||
|
|
||
| # CLI Metadata Generation for Seqera Platform CLI | ||
|
|
||
| This skill is for generating and validating CLI metadata from the `tower-cli` source tree. | ||
|
|
||
| ## When to Use This Skill | ||
|
|
||
| Use this skill when: | ||
| - Updating the metadata extractor implementation | ||
| - Verifying that the Gradle task still produces valid metadata | ||
| - Reviewing release automation for the metadata artifact | ||
| - Investigating command coverage in the generated metadata | ||
| - Confirming downstream docs consumers can rely on the release artifact | ||
|
|
||
| ## Scope | ||
|
|
||
| The generator is deterministic and works directly from the compiled CLI command tree. It does not edit CLI source code and it does not depend on external OpenAPI specifications. | ||
|
|
||
| ## Workflow | ||
|
|
||
| ### Step 1: Generate metadata locally | ||
|
|
||
| Run the Gradle task from the repository root: | ||
|
|
||
| ```bash | ||
| ./gradlew extractCliMetadata | ||
| ``` | ||
|
|
||
| The generated file is written to: | ||
|
|
||
| ```text | ||
| build/cli-metadata/cli-metadata.json | ||
| ``` | ||
|
|
||
| ### Step 2: Validate the output | ||
|
|
||
| Check that the JSON contains the expected top-level keys: | ||
|
|
||
| ```text | ||
| metadata | ||
| hierarchy | ||
| commands | ||
| ``` | ||
|
|
||
| If you are changing the extractor, add or update unit tests under `src/test/`. | ||
|
|
||
| ### Step 3: Review only the metadata generation path | ||
|
|
||
| Focus on: | ||
| - `src/main/java/io/seqera/tower/cli/utils/metadata/CliMetadataExtractor.java` | ||
| - `build.gradle` | ||
| - release automation in `.github/workflows/` | ||
| - docs describing metadata generation | ||
|
|
||
| Do not mix this workflow with CLI help-text enrichment or external API specs. | ||
|
|
||
| ### Step 4: Release behavior | ||
|
|
||
| At release time the metadata should be: | ||
| 1. generated from the current `tower-cli` source tree | ||
| 2. uploaded as a GitHub release artifact | ||
| 3. passed to downstream docs tooling via the release asset URL | ||
|
|
||
| ## Notes | ||
|
|
||
| - Remove hard-coded local paths from all documentation. | ||
| - Keep generated metadata out of Git. | ||
| - Prefer battle-tested libraries already on the classpath over hand-written serializers. | ||
| - Keep the workflow focused on metadata generation only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
llewellyn-sl marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # CLI Metadata Generator | ||
|
|
||
| This directory documents the CLI metadata generator used by `tower-cli`. | ||
|
|
||
| ## Overview | ||
|
|
||
| The metadata generator inspects the compiled CLI command tree through picocli and emits a structured JSON document for downstream documentation tooling. | ||
|
|
||
| The generator: | ||
| - lives in the `tower-cli` repository | ||
| - is implemented in Java | ||
| - runs as the Gradle task `extractCliMetadata` | ||
| - does not modify CLI source files | ||
| - produces build output that is not tracked in Git | ||
|
|
||
| ## Manual generation | ||
|
|
||
| Generate metadata locally with: | ||
|
|
||
| ```bash | ||
| ./gradlew extractCliMetadata | ||
| ``` | ||
|
|
||
| The task writes the artifact to: | ||
|
|
||
| ```text | ||
| build/cli-metadata/cli-metadata.json | ||
| ``` | ||
|
|
||
| ## Output contents | ||
|
|
||
| The generated JSON includes: | ||
| - top-level extraction metadata | ||
| - the full command hierarchy | ||
| - a flat command lookup map | ||
| - command options, positional parameters, types, arity, and descriptions | ||
| - resolved picocli mixins | ||
|
|
||
| ## Implementation | ||
|
|
||
| The extractor is implemented in: | ||
|
|
||
| ```text | ||
| src/main/java/io/seqera/tower/cli/utils/metadata/CliMetadataExtractor.java | ||
| ``` | ||
|
|
||
| It builds the `tw` command tree, walks the picocli `CommandSpec` model, filters standard help/version options, and serializes the resulting structure with Jackson. | ||
|
|
||
| ## Release flow | ||
|
|
||
| The metadata file is a release artifact, similar to the CLI binaries. | ||
|
|
||
| At release time the build pipeline: | ||
| 1. runs `./gradlew extractCliMetadata` | ||
| 2. produces `build/cli-metadata/cli-metadata.json` | ||
| 3. lets JReleaser publish that file to the GitHub release assets | ||
|
|
||
| Downstream consumers should fetch metadata from the release assets rather than from a tracked repository file. | ||
|
|
||
| **Documentation:** See `.claude/skills/enrich-cli-help/` for complete workflow guide | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Missing GitHub package credentials | ||
|
|
||
| If the build fails with `Username must not be null!`, configure GitHub credentials for the private `tower-java-sdk` dependency: | ||
|
|
||
| ```bash | ||
| # In ~/.gradle/gradle.properties | ||
| github.packages.user=your-github-username | ||
| github.packages.token=your-github-token | ||
| ``` | ||
|
llewellyn-sl marked this conversation as resolved.
|
||
|
|
||
| You can also inline credentials for a one-off run: | ||
|
|
||
| ```bash | ||
| GITHUB_USERNAME=<username> GITHUB_TOKEN=<token> ./gradlew extractCliMetadata | ||
| ``` | ||
|
|
||
| or | ||
|
|
||
| ```bash | ||
| GITHUB_USERNAME=<username> GITHUB_TOKEN=$(cat gh_token.txt) ./gradlew extractCliMetadata | ||
| ``` | ||
|
|
||
| ### Commands missing from output | ||
|
|
||
| Check for: | ||
| - Proper `@Command` annotation on class | ||
| - Parent command has `subcommands = {ChildCmd.class}` reference | ||
| - Import statement if subcommand in different package | ||
|
|
||
| ### Options missing from output | ||
|
|
||
| Check for: | ||
| - Ensure mixin classes are properly annotated with `@Mixin` | ||
| - Verify option annotations: `@Option` or `@CommandLine.Option` (both supported) | ||
| - Check that picocli can access the option at runtime | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - **Java extractor:** `src/main/java/io/seqera/tower/cli/utils/metadata/CliMetadataExtractor.java` | ||
| - **Gradle task:** `extractCliMetadata` in `build.gradle` | ||
| - **Release workflow:** `.github/workflows/build.yml` | ||
| - **JReleaser config:** `jreleaser.yml` | ||
| - **Claude Code skill:** `.claude/skills/enrich-cli-help/SKILL.md` | ||
| - **CLI documentation:** https://docs.seqera.io/platform/latest/cli/overview | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.