Open-Source Wikis

/

Starship

/

Subsystems

/

Bug report

starship/starship

Bug report

starship bug-report is a self-service tool for filing GitHub issues with relevant environment information. It lives in src/bug_report.rs and is one of the few subcommands that prompts the user interactively.

What it does

  1. Collects the current environment:
    • OS: type and version via os_info::get().
    • Shell: detected from $STARSHIP_SHELL / parent process / fallback heuristics. Includes the shell's version (best effort) by running its --version flag.
    • Terminal: detected from $TERM_PROGRAM, $TERM, parent process, etc.
    • Starship config: reads the user's starship.toml (without env-var expansion, so secrets in env vars don't leak).
    • Starship version: shadow::VERSION plus shadow::TAG/shadow::BRANCH to indicate whether the build is from a tag or a feature branch.
  2. Renders a Markdown bug-report body with these fields pre-populated.
  3. Prints the body to stdout and asks the user to confirm with y\n whether to open the issue in their browser.
  4. If yes: builds a https://github.com/starship/starship/issues/new?body=... URL with urlencoding::encode and opens it via the open crate. The body is truncated at the GitHub character limit (8100).
  5. If no: prints the report and asks the user to copy/paste manually.

Privacy considerations

The report includes the literal contents of starship.toml. The bug-report flow explicitly warns the user before opening the browser:

Warning: To avoid any sensitive data from being exposed, please review the included information before proceeding.

Environment variables, shell history, and command output are never collected. The shell version detection runs each shell's --version only, which historically does not contain user data.

Implementation notes

  • get_pkg_branch_tag() returns shadow::TAG if non-empty, else shadow::BRANCH. This is what tells maintainers whether the bug is on a release or on main (or a fork branch).
  • get_starship_config() returns <unknown config> if the file cannot be read.
  • The "Forward the pre-filled report above to GitHub in your browser?" prompt is one of only two interactive read-from-stdin paths in the binary (the other being starship config opening the user's editor).

Entry points for modification

  • Add a new field to the report: extend the Environment struct and the corresponding get_* helper, then update get_github_issue_body.
  • Change the issue URL: edit make_github_issue_link.
  • Change the truncation limit: edit GITHUB_CHAR_LIMIT (currently 8100).

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Bug report – Starship wiki | Factory