feat: add automatic bug reporting flow (closes #334)#345
Open
smazmi wants to merge 4 commits intoSurgeDM:mainfrom
Open
feat: add automatic bug reporting flow (closes #334)#345smazmi wants to merge 4 commits intoSurgeDM:mainfrom
smazmi wants to merge 4 commits intoSurgeDM:mainfrom
Conversation
- add `surge bug-report` CLI command with browser-open fallback URL output - add shared internal bugreport helper with template-aligned prefilled issue body - add TUI dashboard keybinding for bug reporting using shared helper - add commit metadata wiring via ldflags and build info fallback - add tests for URL generation and open-url validation - update CLI usage docs for surge bug-report Signed-off-by: Sadique Azmi <sadiquemobaraka5@gmail.com>
Signed-off-by: Sadique Azmi <sadiquemobaraka5@gmail.com>
Signed-off-by: Sadique Azmi <sadiquemobaraka5@gmail.com>
Signed-off-by: Sadique Azmi <sadiquemobaraka5@gmail.com>
Binary Size Analysis
|
Member
|
Hi @smazmi I would like to know more about the UX for reporting a bug. I wanted it to be something like:
3a. If Core:
3b. If Extension:
|
Member
|
Also I feel like since this is opening something new, if triggered via CLI we need to have a confirmation modal asking:
|
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.
Summary
Adds a bug-report flow in both CLI and TUI that opens a pre-filled GitHub issue with environment details, reducing manual bug-report setup and improving report completeness.
What Changed
surge bug-report.internal/bugreportfor:Why
Issue #334 asks for automatic bug report preparation so users do not need to manually collect version/build/system details.
Implementation Notes
net/urlandurl.Values.How To Test
go test ./...go build ./...surge bug-reportPATH='' ./surge bug-reportsurge?on dashboard.Checklist
Greptile Summary
This PR adds a
surge bug-reportCLI command and a?TUI keybinding that each open a pre-filled GitHub issue URL containing OS, architecture, version, and commit metadata. The implementation is clean: a newinternal/bugreportpackage builds the URL,utils.OpenBrowserhandles launching the browser, and browser failures gracefully print the raw URL as a fallback.There are no blocking issues. Two minor style observations are noted below.
Confidence Score: 5/5
Safe to merge — no blocking issues found; prior review concerns have been addressed.
All findings are P2 style observations. The URL-building logic is correct, error handling is graceful, the variadic signature change is backward-compatible with existing tests, and the ldflag wiring matches the build system. The two P2 notes (unreachable guard and TUI code-path inconsistency) are non-blocking cleanup items.
No files require special attention.
Important Files Changed
url.Values; empty inputs normalise to "unknown".OpenBrowser(validates non-empty URL, delegates toopenWithSystem). DuplicateOpenURLremoved as per prior review feedback.OpenBrowser. Coverage is adequate for validation logic.?key handler for bug reporting. Log entry is emitted beforeOpenBrowseris called; fallback URL is shown on failure.ReportBugbinding to?and included it inFullHelp(). Struct definition and key map initialisation are consistent.CurrentCommitfield and wired the variadiccurrentCommitparameter intoInitialRootModel, maintaining backward compat with existing tests.Commitbuild-var withdebug.ReadBuildInfofallback and passes it through toInitialRootModel. Logic is correct and idiomatic.newRemoteRootModelto passCommittoInitialRootModel. Minimal, correct change.-X cmd.Commitand-X cmd.BuildTimeldflags so release builds inject the correct values. No issues.surge bug-reportrow to the command table with a concise description and fallback note. Consistent with existing table style.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A([User triggers bug report]) --> B{Entry point} B -- "surge bug-report (CLI)" --> C[cmd/bugreport.go] B -- "Press ? in TUI dashboard" --> D[update_dashboard.go ReportBug handler] C --> E[bugreport.BugReportURL\nversion, commit] D --> E E --> F{URL empty?} F -- "No (always)" --> G[utils.OpenBrowser URL] F -- "Yes (unreachable)" --> H1[CLI: return error / TUI: log error entry] G --> I{Browser opened?} I -- Success --> J[Done] I -- Failure --> K1[CLI: print raw URL to stdout] I -- Failure --> K2[TUI: log raw URL as fallback] subgraph bugreport.BugReportURL L[url.Parse hardcoded GitHub URL] L --> M[fmt.Sprintf body OS / arch / version / commit] M --> N[url.Values.Encode params] N --> O[Return full issue URL] endPrompt To Fix All With AI
Reviews (4): Last reviewed commit: "fix: log bug-report browser intent befor..." | Re-trigger Greptile