Skip to content

Conversation

@elan-llm
Copy link
Contributor

@elan-llm elan-llm commented Dec 2, 2025

Fix: Display subcommands for 'rt --help' command

Problem

aio rt --help only shows flags, missing TOPICS and COMMANDS sections.
aio runtime --help works correctly.

Closes #issue-number

Root Cause

oclif's Help system doesn't recognize rt as an alias for a topic with subcommands.

Solution

Added custom help class in main aio-cli repository to intercept the help before hitting ocliff's main.js - help class

  • Intercepts aio rt --help requests
  • Shows help for runtime instead of rt
  • Exits before oclif's default help runs

Testing

  • All 799 tests pass
  • Added 3 new tests for hook coverage
  • Manual testing:
  • aio rt --help → Shows subcommands
  • aio runtime --help → Still works
  • aio rt (no flag) → Shows subcommands


## Types of changes

- [X ] Bug fix (non-breaking change which fixes an issue)

**Added files:**
src/hooks/init/AliasHelpHook.js - Init hook to intercept and redirect help
test/hooks/init/AliasHelpHook.test.js - Test coverage for the hook

**Modified existing files:**
src/commands/runtime/index.js - Changed to use this.id dynamically


## Checklist:

- [ ] I have signed the [Adobe Open Source CLA](http://opensource.adobe.com/cla.html).
- [x ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ x] I have read the **CONTRIBUTING** document.
- [ x] I have added tests to cover my changes.
- [ x] All new and existing tests passed.

@elan-llm elan-llm added bug Something isn't working good first issue Good for newcomers labels Dec 2, 2025
@elan-llm elan-llm changed the title ACNA-4221: fixing alias rt to display help commands ACNA-4221: fixing alias rt to display help commands [draft] Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@purplecabbage
Copy link
Member

This is great, and absolutely works, however we have been very careful to limit our use of hooks as they slow down every command the cli executes, not even just runtime commands, but all commands.
Please spend just a little more time to be sure that there is not a solution that doesn't need hooks.

Can we create the /src/commands/rt/index.js to handle this?
Does the oclif.manifest.json file created by running npm run prepack affect what help displays?

Note that you can work in isolation in the repo by just doing:

npm install
DEBUG=* ./bin/run runtime --help
DEBUG=* ./bin/run rt --help

The DEBUG flag lets you see everything that happens in the loading of the command, you can filter to be more precise too DEBUG=config* etc ..

@elan-llm elan-llm merged commit 3ca5176 into adobe:master Dec 9, 2025
11 checks passed
@elan-llm elan-llm deleted the alias_map branch December 9, 2025 23:53
elan-llm added a commit to adobe/aio-cli that referenced this pull request Dec 9, 2025
ACNA-4221: Addding custome help class to fix alias rt to display help… +
adobe/aio-cli-plugin-runtime#389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants