feat: add --gstack mode for GStack Desktop integration#120
Open
lancepan123 wants to merge 1 commit intoepiral:mainfrom
Open
feat: add --gstack mode for GStack Desktop integration#120lancepan123 wants to merge 1 commit intoepiral:mainfrom
lancepan123 wants to merge 1 commit intoepiral:mainfrom
Conversation
Add a new --gstack flag that routes browser commands through GStack Desktop's Unix domain socket IPC instead of discovering a CDP endpoint automatically. Changes: - gstack-bridge.ts: new bridge module (execFileSync → gstack CLI → IPC socket) - index.ts: --gstack flag parsing, handleGstackCommand() intercept layer - site.ts: gstack execution path with tab discovery + evaluate + auth detection - cdp-client.ts: createTargetWithFallback() for runtimes without Target.createTarget - open.ts: relax tabId parsing to accept both numeric and string/UUID IDs
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
Add a new
--gstackflag that routes browser commands through GStack Desktop's Unix domain socket IPC instead of discovering a CDP endpoint automatically.This enables bb-browser CLI to drive an Electron-based desktop app (GStack Desktop) via its IPC interface, while preserving full CDP fallback for unsupported operations.
Changes
packages/cli/src/gstack-bridge.tsexecFileSync→ gstack CLI → IPC socket). Exports:gstackGetTabs,gstackFindTabByDomain,gstackOpenTab,gstackEvaluate,gstackScreenshot,gstackNavigatepackages/cli/src/index.ts--gstackflag parsing,handleGstackCommand()intercept layer inmain()— supported commands: open, screenshot, tab, eval, back/forward/refresh; unsupported commands fall through to CDPpackages/cli/src/commands/site.tssiteRun()— tab discovery by domain → open if needed → evaluate adapter script → auth error detectionpackages/cli/src/cdp-client.tscreateTargetWithFallback()— gracefully handles runtimes whereTarget.createTargetis not supported (e.g. some Electron builds)packages/cli/src/commands/open.tstabIdparsing to accept both numeric index and string/UUID IDsHow it works
When
--gstackis set:handleGstackCommand()intercepts known commands and routes them viagstack-bridge.tssitecommand uses gstack tab discovery + evaluate instead of CDP Runtime.evaluateTesting
pnpm buildpasses with zero TS errors--gstackis not set