feat(help): add Examples section to every customer-facing command's --help#10
Open
anil-bd wants to merge 1 commit into
Open
feat(help): add Examples section to every customer-facing command's --help#10anil-bd wants to merge 1 commit into
anil-bd wants to merge 1 commit into
Conversation
…-help
AWS CLI, gh, and Stripe CLI all ship an Examples section in every command's
--help output. Until this change, none of brightdata's customer-facing
commands did. The first reflex on hitting an unfamiliar command is --help;
seeing Usage + Options without examples forces the user to alt-tab to the
README, which is a 1,200-line file that does not surface examples
discoverably either.
Adds an Examples section to the six Scraper-Studio-adjacent commands.
Examples use real, public, scrape-friendly domains (Hacker News,
Y Combinator, real SERP queries) per house-style C5. No example.com.
Implementation
- new src/utils/help.ts with format_examples() + add_examples() so every
command renders the section identically (`# description` then `$ cmd`
per example, blank line between examples, "Examples:" header)
- six command files each gain three examples covering: minimal happy path,
one useful variant, one production pattern
- attached via Commander's addHelpText('after', ...), which renders during
outputHelp() (the --help path) without affecting helpInformation() or
parse-time behavior
Tests
- src/__tests__/utils/help.test.ts: ten tests
- format_examples() unit (3): empty input, single, multiple with blank-
line separator
- add_examples() integration (1): on a fresh Command, renders correctly
- regression contract (6): each of `scraper create`, `scraper run`,
`discover`, `search`, `pipelines`, `scrape` has an Examples block,
has at least one $ brightdata command inside it, and uses no
example.com URL in the Examples block
- the regression test renders help via configureOutput() + outputHelp()
to capture the addHelpText output (helpInformation() does not include
it)
- full suite: 183 pass / 9 fail. The 9 failures all pre-exist on main and
are unrelated to this change (verified by running the suite on the
stashed baseline)
What this does NOT do
- does not touch the misleading https://example.com/webhook default value
on `--deliver-webhook` (that is issue N10, its own PR)
- does not change Usage, Options, Arguments, or any command behavior
- does not change exit codes, output streams, or stdout/stderr routing
- does not add a dependency
Refs: audit issue N13 (scraper-studio-cli-demo/ISSUES.md), bright-dx-writer
critique (scraper-studio-cli-demo/CRITIQUE.md), DX content pattern C5
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.
feat(help): add Examples section to every customer-facing command's
--helpThe gap
AWS CLI,
gh, and Stripe CLI all ship anExamples:section in every command's--helpoutput. Bright Data CLI does not. The user's first reflex on hitting an unfamiliar command is--help; seeingUsage:+Arguments:+Options:without an example forces them to alt-tab to the README. The README is 1,200 lines and does not surface examples discoverably either.Specifically for Scraper Studio: when a YouTube creator records a demo (per the recent creator brief), the
bdata scraper create --helpmoment is the first on-screen reference. Today they see thehttps://example.com/webhookdefault and no real invocation, then leave the terminal to find one. That's an off-camera cut at scene 1:30 of every shoot.What this adds
An
Examples:section to the six Scraper-Studio-adjacent commands:scraper createscraper rundiscoversearchpipelinesscrapeAll examples use real, public, scrape-friendly domains (Hacker News, Y Combinator, real SERP queries). No
example.com. Bright Data house style C5.Implementation
src/utils/help.tswithformat_examples()+add_examples()so every command renders the section identically. The format is:addHelpText('after', ...). This renders duringoutputHelp()(the--helppath) without affectinghelpInformation()or parse-time behavior. Zero impact on any non-help code path.Tests
src/__tests__/utils/help.test.ts, 10 cases:format_examples()unit (3): empty input, single example, multiple with blank-line separatoradd_examples()integration (1): on a fresh Commander instance, renders correctly viaoutputHelp()Examples:block, contains at least one$ brightdataline inside the block, and uses noexample.comURL in the Examples block. If a future refactor drops Examples from any command, this fires.The regression test renders help via
configureOutput({writeOut})+outputHelp()to capture theaddHelpTextoutput.helpInformation()alone does NOT includeaddHelpTextcontent, so a naive test would silently pass.Run:
Full suite: 183 passed / 9 failed. The 9 failures (in
scrape,browser,discover,add-mcptests) all pre-exist onmainand are unrelated to this change. Confirmed by running the suite on the stashed baseline.Live verification
Same shape on
scraper run,discover,search,pipelines,scrape.What this does NOT do
https://example.com/webhookdefault value on--deliver-webhook(that is issue N10, its own PR).Usage,Options,Arguments, or any command behavior.Refs
scraper-studio-cli-demo/ISSUES.mdscraper-studio-cli-demo/CRITIQUE.md(DX content pattern C5, Examples-absent reference failure mode)aws s3 cp help,gh pr create --help,stripe customers create --helpall ship Examples