feat(RHIDP-14129): add intent-based CLI commands and backstage-cli pass-through - #156
Open
yangcao77 wants to merge 6 commits into
Open
feat(RHIDP-14129): add intent-based CLI commands and backstage-cli pass-through#156yangcao77 wants to merge 6 commits into
yangcao77 wants to merge 6 commits into
Conversation
…tions related will use backstage-cli Signed-off-by: Stephanie <yangcao@redhat.com>
…nto intent-based-cli
Signed-off-by: Stephanie <yangcao@redhat.com>
Author
- Statically import command modules in commands/index.ts instead of using require(), since the backstage-cli bundler only follows static ESM imports/dynamic import() and silently dropped the require()'d files from the packed dist, breaking every command once installed from npm (Cannot find module './backstage-passthrough'). - Fix TS2352 in intent-errors.ts by adding a safe getStderr() helper instead of casting Error directly to Record<string, unknown>. - Restrict the PATH used to resolve backstage-cli via `which` to directories that aren't group/other-writable, addressing the SonarCloud S4036 PATH-search security hotspot in lib/client.ts. - Extract shared runEntityListAction/runRawAction/runSearchAction helpers and a registerPassthroughCommand helper to remove the heavy code duplication SonarCloud flagged across catalog/api/template/ search/docs/backstage-passthrough command files. - Fix pre-existing lint (no-empty, func-names) and prettier issues so the Checks job can get past the linter/prettier steps. Co-authored-by: Cursor <cursoragent@cursor.com>
…ctory Move catalog/api/search/docs/template/backstage-passthrough and their supporting client/format/intent-errors/helpers modules into src/commands/intent-based-actions/, mirroring the existing export-dynamic-plugin/ and package-dynamic-plugins/ layout, with a single registerIntentCommands() entry point. Co-authored-by: Cursor <cursoragent@cursor.com>
SonarCloud S4036 still flagged spawnSync('which', ...) even with a restricted PATH env, since it pattern-matches on shelling out to a path-search utility rather than analyzing the PATH value. Replace it with a direct filesystem walk over PATH entries (skipping group/other-writable directories) and an accessSync executability check, avoiding the flagged pattern entirely.
Co-authored-by: Cursor <cursoragent@cursor.com>
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



https://redhat.atlassian.net/browse/RHIDP-14129
Adds intent-based subcommands and backstage-cli pass-through commands to rhdh-cli
Today, interacting with a running RHDH/Backstage instance from the CLI requires
backstage-cli actions execute <pluginId>:<actionName>with internal action IDs and raw JSON input. This is very bad experience for human operations.This change makes rhdh-cli the single entry point:
All intent-based commands support
--output jsonfor agent consumption and--instance <name>for multi-instance targeting.The local metadata file is still going to use the config file for
backstage-cli, so that existing backstage-cli user can migrate to userhdh-cliwith no extra effortsee recording:
rhdh-cli.mov