feat(terminal): detect and open URLs from terminal output#1434
Open
yashdev9274 wants to merge 2 commits intogeneralaction:mainfrom
Open
feat(terminal): detect and open URLs from terminal output#1434yashdev9274 wants to merge 2 commits intogeneralaction:mainfrom
yashdev9274 wants to merge 2 commits intogeneralaction:mainfrom
Conversation
- Added functionality to extract URLs from terminal output during the 'run' phase. - Implemented a dropdown to select and open detected URLs in the browser. - Introduced a function to standardize URL formats. - Updated electron API types to include for URL handling.
|
@yashdev9274 is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryThis PR adds a quality-of-life feature that detects localhost URLs emitted during the Key findings:
Confidence Score: 2/5
|
| Filename | Overview |
|---|---|
| src/renderer/components/TaskTerminalPanel.tsx | Adds URL detection and open-in-browser UI to the run toolbar. Contains a side effect in a state updater, a broken HTTPS URL display label, and a likely non-functional tooltip when multiple URLs are detected (TooltipTrigger asChild wrapping a Select). |
| src/shared/urls.ts | Adds normalizeUrl which extracts and normalises localhost-family URLs from a string. Logic is correct; catches parse errors gracefully. Minor: no blank line between the constants and the new function. |
| src/renderer/types/electron-api.d.ts | Adds onHostPreviewEvent type declaration and openExternal method. onHostPreviewEvent is not used anywhere in the implementation — appears to be unused dead code from a previous design iteration. |
Sequence Diagram
sequenceDiagram
participant Main as Main Process
participant Renderer as TaskTerminalPanel
participant normalizeUrl as normalizeUrl (urls.ts)
participant State as React State
participant Electron as electronAPI.openExternal
Main->>Renderer: onLifecycleEvent({ phase: 'run', status: 'line', line: '...URL...' })
Renderer->>normalizeUrl: normalizeUrl(data.line)
normalizeUrl-->>Renderer: "http://localhost:3000/"
Renderer->>State: setDetectedUrls([...prev, url])
Renderer->>State: setSelectedUrl(url) [first URL only]
Note over Renderer: UI renders Globe/ExternalLink button
alt Single URL
Renderer->>Electron: openExternal(selectedUrl) on button click
else Multiple URLs
Renderer->>Electron: openExternal(value) on Select change
end
Main->>Renderer: onLifecycleEvent({ phase: 'run', status: 'done' | 'error' })
Renderer->>State: setDetectedUrls([]), setSelectedUrl(null)
Note over Renderer: URL button disappears
Last reviewed commit: 721477c
- Updated logic to set the selected URL when a new URL is detected. - Wrapped URL selection dropdown in a span for better layout control. - Improved URL formatting in the dropdown to handle both HTTP and HTTPS protocols.
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
This PR adds a feature that allows users to quickly open detected localhost URLs (from running dev servers) directly in their system browser from the run terminal toolbar.
Fixes
Fixes #1369
Snapshot
Feat-.1369.mp4
Type of change
Mandatory Tasks
Checklist
pnpm run format)pnpm run lint)