Repository navigation
feat(cli): Discord as help/bug-report fallback - #3451
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 000aadb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Architecture diagram
sequenceDiagram
participant User as CLI User
participant Oclif as Oclif Runtime
participant BrowseCmd as BrowseCommand (base.ts)
participant HelpMod as Help Formatter (help.ts)
participant SupportLinks as Support Links Module
participant Stderr as STDERR
participant Stdout as STDOUT
Note over User,Stdout: Root Help Flow (browse / browse --help)
User->>Oclif: Execute browse or browse --help
Oclif->>HelpMod: showRootHelp()
HelpMod->>SupportLinks: Import DISCORD_INVITE_URL, GITHUB_ISSUES_URL
HelpMod->>Stdout: Log AGENT_HEADER
HelpMod->>Stdout: Log auto-generated help sections
HelpMod->>Stdout: Log COMMUNITY footer with Discord + GitHub links
Stdout-->>User: Display full help with community footer
Note over User,Stderr: Subcommand Help Flow (browse open --help)
User->>Oclif: Execute browse open --help
Oclif->>HelpMod: showTopicHelp() or showCommandHelp()
HelpMod->>Stdout: Log help (no community footer)
Stdout-->>User: Display subcommand help only
Note over User,Stderr: Error Handling Flow
User->>Oclif: Execute browse command (e.g., browse open URL)
Oclif->>BrowseCmd: Run command
alt Unexpected runtime error (non-oclif error)
BrowseCmd->>BrowseCmd: isOclifError(err) returns false
BrowseCmd->>SupportLinks: Access DISCORD_INVITE_URL, GITHUB_ISSUES_URL
BrowseCmd->>Stderr: Write "Get help: Discord... · Report a bug: GitHub..."
Stderr-->>User: Display support hint
BrowseCmd->>Oclif: super.catch(err)
Oclif-->>User: Display error details
else Oclif usage/validation error (oclif.exit number)
BrowseCmd->>BrowseCmd: isOclifError(err) returns true
BrowseCmd->>Oclif: super.catch(err)
Oclif-->>User: Display usage error (no support hint)
else Expected CommandFailure (exitCode in err)
BrowseCmd->>BrowseCmd: Exit with err.exitCode
Oclif-->>User: Display command failure (no support hint)
else Successful execution
BrowseCmd-->>User: Command output
end
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
cursor
Bot
force-pushed
the
cursor/discord-help-fallback-621e
branch
5 times, most recently
from
November 17, 2026 00:48
97b2273 to
afb8e6c
Compare
seanmcguire12
approved these changes
Nov 18, 2026
shrey150
added a commit
that referenced
this pull request
Nov 18, 2026
# why Make it easy to join the Stagehand and Browse CLI community from the terminal to contribute, request features, and share feedback. # what changed Adds `browse discord`, visible in root help, with this invitation: ```console $ browse discord --no-open https://discord.gg/stagehand Join our Discord community to contribute to Stagehand and the Browse CLI, request features, and share feedback! ``` - In an interactive terminal outside CI, opens the invite using the maintained [`open`](https://github.com/sindresorhus/open) package and prints the URL and invitation. - `--no-open` or noninteractive stdout skips the opener. A nonempty `CI` value (including `true` or `1`) also skips it; literal `CI=false` disables that guard, matching the `ci-info` convention. - If the opener cannot start, the command still prints the invitation and exits successfully. - Adds a Discord link to the CLI README and shared support URLs. - Includes a **patch changeset for `browse`**: a small support command that preserves existing behavior. For review, the command and copy are in `packages/cli/src/commands/discord.ts`; terminal/CI guards and opener error handling are in `packages/cli/src/lib/open-url.ts`. Platform-specific launching is delegated to `open`, with its dependency recorded in the CLI manifest and lockfile. The stacked follow-up, #3451, adds community links to help and error messages. # test plan - [x] CLI TypeScript build and oclif manifest generation. - [x] Discord, CLI surface, and opener regression tests: **73 passed**. - [x] Seven compiled CLI smoke checks using the real `open` package: interactive launch, `CI=false`, `--no-open`, `CI=true`, `CI=0`, piped stdout, and missing-launcher fallback. - [x] Changed-file formatting and lint checks, plus changeset validation. - [x] CI passing at `7e1f854bd`, including Linux/Windows builds, CLI contracts, Chrome smoke tests, regression tests, and automated review. <!-- CURSOR_AGENT_PR_BODY_BEGIN --> # why Make it easy to join the Stagehand and Browse CLI community from the terminal to contribute, request features, and share feedback. # what changed Adds `browse discord`, visible in root help, with this invitation: ```console $ browse discord --no-open https://discord.gg/stagehand Join our Discord community to contribute to Stagehand and the Browse CLI, request features, and share feedback! ``` - In an interactive terminal outside CI, opens the invite using a hand-rolled browser opener and prints the URL and invitation. - `--no-open` or noninteractive stdout skips the opener. A nonempty `CI` value (including `true` or `1`) also skips it; literal `CI=false` disables that guard, matching the `ci-info` convention. - If the opener cannot start, the command still prints the invitation and exits successfully. - Adds a Discord link to the CLI README and shared support URLs. - Includes a **patch changeset for `browse`**: a small support command that preserves existing behavior. ## Browser opener implementation Uses a hand-rolled default-browser opener instead of the `open` npm package (no new dependencies): | Platform | Command | Notes | |----------|---------|-------| | macOS | `open <url>` | | | Windows | `rundll32 url.dll,FileProtocolHandler <url>` | Avoids URL mangling | | Linux/Unix | `$BROWSER <url>` | If `$BROWSER` is set | | WSL (non-SSH) | `rundll32.exe url.dll,FileProtocolHandler <url>` | Falls back to `xdg-open` on ENOENT | | Linux/Unix/WSL-SSH | `xdg-open <url>` | Default fallback | Key properties: - **No shell**: spawns without `shell: true`, so URLs with `&`, `?`, `#`, spaces, etc. are passed untouched as a single argv element. - **Detached + unref**: the opener process continues after the CLI exits. - **Error-safe**: registers an `'error'` listener to swallow async ENOENT/EACCES (opener not found) without crashing. - **`$BROWSER` support**: respects the standard `$BROWSER` environment variable on Linux/Unix. - **WSL-aware**: detects WSL via `WSL_DISTRO_NAME` or `/proc/version` containing "microsoft", uses Windows opener via interop (unless over SSH). - **WSL fallback**: if `rundll32.exe` fails (e.g. interop disabled), falls back to `xdg-open`. For review, the command and copy are in `packages/cli/src/commands/discord.ts`; terminal/CI guards and opener error handling are in `packages/cli/src/lib/open-url.ts`. The stacked follow-up, #3451, adds community links to help and error messages. # test plan - [x] CLI TypeScript build and oclif manifest generation. - [x] Discord, CLI surface, and opener regression tests: **643 passed**. - [x] Comprehensive unit tests for the browser opener: - Platform-specific command verification (darwin, linux, win32) - `$BROWSER` override tests - WSL detection via env and `/proc/version` - WSL over SSH uses `xdg-open` - `rundll32.exe` ENOENT falls back to `xdg-open` - URLs with special characters (`&`, `?`, `#`, encoded spaces) passed untouched - `shell: false`, `detached: true`, `stdio: 'ignore'` options verified - `unref()` called on child process - Async `'error'` event (ENOENT) swallowed without crash - TTY/CI/`--no-open` gating verified - [x] Changed-file formatting and lint checks, plus changeset validation. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-1a17422b-39e8-50b7-99b6-8f734c5335c8?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-1a17422b-39e8-50b7-99b6-8f734c5335c8&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> --------- Co-authored-by: Cursor Agent <[email protected]>
Add support links as help/bug-report fallback: - Root help footer with Discord and GitHub Issues links - One-line support hint on unexpected runtime errors only The support hint is NOT shown for: - Usage/validation errors (oclif errors) - Command-not-found (handled by hook) - Expected CommandFailure errors (with resultCode) Tests verify footer presence on root help, absence on subcommand help, and hint only on unexpected errors. Co-authored-by: Shrey Pandya <[email protected]>
shrey150
force-pushed
the
cursor/discord-help-fallback-621e
branch
from
November 18, 2026 20:24
afb8e6c to
000aadb
Compare
This was referenced Nov 18, 2026
shrey150
pushed a commit
that referenced
this pull request
Nov 19, 2026
Release Browse independently of the Stagehand SDKs. Merging this PR publishes the CLI from the merged commit. ## 0.12.0 ### Minor Changes - [#3482](#3482) [`8901460`](8901460) Thanks [@suyashguptasg](https://github.com/suyashguptasg)! - Add `--size regular|large|xlarge` to `browse cloud sessions create` to select the browser size. - [#3499](#3499) [`a5a19ea`](a5a19ea) Thanks [@shrey150](https://github.com/shrey150)! - Remove deprecated `browse cloud contexts update`; context uploads are no longer supported. ### Patch Changes - [#3450](#3450) [`c118e9c`](c118e9c) Thanks [@shrey150](https://github.com/shrey150)! - Add `browse discord` command to open the Stagehand Discord in your system browser - [#3473](#3473) [`0f9a64c`](0f9a64c) Thanks [@github-actions](https://github.com/apps/github-actions)! - fix the CLI printing replacement characters when a daemon reply splits a multi-byte character across socket chunks - [#3451](#3451) [`902e91b`](902e91b) Thanks [@shrey150](https://github.com/shrey150)! - Add Discord and GitHub links to root help footer and support hints on unexpected errors - [#3481](#3481) [`ebf15c8`](ebf15c8) Thanks [@shrey150](https://github.com/shrey150)! - Add search filtering options and migrate cloud commands to the Browserbase SDK. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.
why
Help users find the Stagehand and Browse CLI community when they check help or encounter an unexpected error. This PR is stacked on #3450, which adds
browse discordand the updated community invitation.what changed
Adds this footer to root help (
browseandbrowse --help):Unexpected runtime errors also print this hint to stderr:
The footer appears only on root help. Usage errors, command-not-found, and expected
CommandFailureerrors omit the support hint.For review,
packages/cli/src/help.tsadds the footer andpackages/cli/src/base.tshandles the error hint. Includes a patch changeset forbrowse.test plan
5c8de796d, including Linux/Windows contracts, Chrome smoke tests, regression tests, and automated review. Windows contracts passed on rerun after the existing daemon-lock fixtureEPERM; the isolated test fix is test(cli): fix Windows race in concurrent daemon lock fixture #3456.