diff --git a/.changeset/fix-cli-config-docs-feedback.md b/.changeset/fix-cli-config-docs-feedback.md new file mode 100644 index 0000000000..1e7298bafa --- /dev/null +++ b/.changeset/fix-cli-config-docs-feedback.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Added user feedback when opening config docs in browser. The command now clearly indicates what it's doing and provides fallback instructions if the browser fails to open. diff --git a/packages/cli/src/modules/config/commands/docs.ts b/packages/cli/src/modules/config/commands/docs.ts index 25e3a864f4..e7d3ac13ee 100644 --- a/packages/cli/src/modules/config/commands/docs.ts +++ b/packages/cli/src/modules/config/commands/docs.ts @@ -19,6 +19,7 @@ import { mergeConfigSchemas } from '@backstage/config-loader'; import { OptionValues } from 'commander'; import { JSONSchema7 as JSONSchema } from 'json-schema'; import openBrowser from 'react-dev-utils/openBrowser'; +import chalk from 'chalk'; import { loadCliConfig } from '../lib/config'; const DOCS_URL = 'https://config.backstage.io'; @@ -36,5 +37,23 @@ export default async (opts: OptionValues) => { ), ); - openBrowser(`${DOCS_URL}#schema=${JSON.stringify(schema)}`); + const url = `${DOCS_URL}#schema=${JSON.stringify(schema)}`; + + console.log(); + console.log( + chalk.cyan( + 'Opening configuration reference documentation in your browser...', + ), + ); + console.log(` ${chalk.cyan(url)}`); + console.log(); + + const opened = openBrowser(url); + + if (!opened) { + console.log( + chalk.yellow('⚠️ WARNING: Unable to open browser automatically.'), + ); + console.log(chalk.yellow('Please open the URL manually in your browser.')); + } };