feat(dx): goto、cookies、source grep、--exclude-static 等 6 项开发者体验改进 - #231
Merged
Conversation
… --exclude-static New commands: - goto <url> --tab: navigate existing tab via Page.navigate (keeps SPA context) - cookies --tab [--filter]: view page cookies via Network.getCookies - source grep <pattern> --tab: search loaded JS sources for API endpoints Improvements: - trace events --exclude-static: filter out .js/.css/.png/.woff and _next/static - network requests --exclude-static: same filtering for network command - trace --exclude-static filters both requests AND their matching responses - trace body returns requestBody alongside responseBody for POST requests - open command output shows short tab ID prominently
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.
背景
用 bb-browser 探索 cms.rflow.ai 并逆向其 API 的过程中,发现了多个工具链缺失和体验痛点:
eval "window.location.href=..."破坏 SPA 路由eval "document.cookie",没有专用命令open返回 32 位长 ID,需要再查status才知道短 ID新增命令
goto <url> --tab <id>在已有 tab 中导航,使用
Page.navigate,不开新 tab。关键用途:SPA 中导航不丢失上下文。cookies --tab <id> [--filter <str>]查看页面 cookies(
Network.getCookies),支持按名称/域名过滤。source grep <pattern> --tab <id>搜索已加载的 JS 源码。使用
Page.getResourceTree+Page.getResourceContent获取所有脚本内容,用正则搜索。这是 SPA API 发现的杀手级功能。改进
--exclude-static过滤trace events和network requests新增--exclude-static标志,过滤掉.js/.css/.png/.woff/.svg/.ico以及_next/static/路径。trace 同时过滤匹配的 response 事件。trace body 增强
trace body现在同时返回 request body(POST payload)和 response body。open 输出短 ID
open命令输出现在显示短 tab ID(如88aa),不再需要查status才知道。改动文件
protocol.tscommands.tscommand-dispatch.tsgoto.ts(新)cookies.ts(新)source.ts(新)index.ts(cli)open.tstrace.tsnetwork.ts验证