tabctl
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTab Control
标签控制
Use tabctl to inspect and analyze tabs safely, then perform targeted actions only when requested.
使用tabctl安全地检查和分析标签页,仅在收到请求时执行针对性操作。
GraphQL API (preferred for agents)
GraphQL API(Agent优先使用)
Use for field-selective reads and mutations in a single roundtrip.
Use to discover available types and fields.
tabctl querytabctl schema使用可在单次往返中完成字段选择性读取和Mutation操作。
使用可查看可用的类型和字段。
tabctl querytabctl schemaRead examples
读取示例
bash
undefinedbash
undefinedGet only tabId and url for all windows
Get only tabId and url for all windows
tabctl query '{ windows { windowId tabs { tabId url } } }'
tabctl query '{ windows { windowId tabs { tabId url } } }'
Paginated tabs (default limit 20)
Paginated tabs (default limit 20)
tabctl query '{ tabs { items { tabId url title } total hasMore } }'
tabctl query '{ tabs { items { tabId url title } total hasMore } }'
Next page
Next page
tabctl query '{ tabs(offset: 20) { items { tabId url } total hasMore } }'
tabctl query '{ tabs(offset: 20) { items { tabId url } total hasMore } }'
Get tabs in a specific window
Get tabs in a specific window
tabctl query '{ tabs(windowId: 123) { items { tabId title url } total } }'
tabctl query '{ tabs(windowId: 123) { items { tabId title url } total } }'
Get groups with tab counts
Get groups with tab counts
tabctl query '{ groups { groupId title tabCount } }'
tabctl query '{ groups { groupId title tabCount } }'
Get a single tab by ID
Get a single tab by ID
tabctl query '{ tab(id: 456) { tabId url title active groupTitle } }'
undefinedtabctl query '{ tab(id: 456) { tabId url title active groupTitle } }'
undefinedMutation examples
Mutation 示例
bash
undefinedbash
undefinedClose tabs and get remaining tabs in one call
Close tabs and get remaining tabs in one call
tabctl query 'mutation { closeTabs(tabIds: [123, 456], confirm: true) { txid closedTabs remainingTabs { tabId url } } }'
tabctl query 'mutation { closeTabs(tabIds: [123, 456], confirm: true) { txid closedTabs remainingTabs { tabId url } } }'
Open tabs and get the new tab IDs
Open tabs and get the new tab IDs
tabctl query 'mutation { openTabs(urls: ["https://example.com"], group: "Research") { tabs { tabId url } } }'
tabctl query 'mutation { openTabs(urls: ["https://example.com"], group: "Research") { tabs { tabId url } } }'
Refresh tabs
Refresh tabs
tabctl query 'mutation { refreshTabs(tabIds: [123]) { refreshedTabs } }'
undefinedtabctl query 'mutation { refreshTabs(tabIds: [123]) { refreshedTabs } }'
undefinedIntrospection
内省查询
bash
tabctl schema # Full SDL
tabctl query '{ __type(name: "Tab") { fields { name } } }' # Discover Tab fieldsbash
tabctl schema # Full SDL
tabctl query '{ __type(name: "Tab") { fields { name } } }' # Discover Tab fieldsSafety
安全注意事项
- Prefer read-only commands: list, analyze, inspect, report, query (without mutations).
- Never run or
archive --allin a normal session.close --apply - Only mutate explicit targets (,
--tab,--group) and use--windowfor close.--confirm - Respect policy: protected tabs are excluded.
- Use screenshots only when you need visual context.
- 优先使用只读命令:list、analyze、inspect、report、无Mutation的query。
- 常规会话中切勿运行或
archive --all命令。close --apply - 仅对明确目标(、
--tab、--group)执行变更操作,关闭标签时需使用--window参数。--confirm - 遵守策略:受保护的标签页会被排除在外。
- 仅当需要可视化上下文时才使用截图功能。
Discover commands
查看可用命令
- Use (or
tabctl help) to discover commands and flags.tabctl help --json - For specific commands, use .
tabctl <command> --help
- 使用(或
tabctl help)查看所有命令和参数。tabctl help --json - 如需查看特定命令的帮助,使用。
tabctl <command> --help
Common tasks (CLI)
常见任务(CLI)
- List tabs in a window:
tabctl list --window <id|active|last-focused> - List ungrouped tabs:
tabctl list --ungrouped - List with pagination:
tabctl list --all --limit 10 --offset 0 - Close tabs:
tabctl close --tab <id1> --tab <id2> --confirm - Refresh a tab:
tabctl refresh --tab <id> - Generate a report: (add scope flags as needed)
tabctl report --format md - Get page metadata:
tabctl inspect --tab <id> --signal page-meta - Get page metadata after JS loads:
tabctl inspect --tab <id> --signal page-meta --wait-for settle - Extract links safely (absolute http(s) only):
tabctl inspect --tab <id> --selector '{"name":"links","selector":"a[href]","attr":"href-url","all":true}' - Capture visual context when needed:
tabctl screenshot --tab <id> --mode full - Undo most recent change:
tabctl undo --latest - Undo by txid: (from
tabctl undo <txid>)tabctl history --json | jq -r '.[] | .txid'
- 列出指定窗口的标签页:
tabctl list --window <id|active|last-focused> - 列出未分组的标签页:
tabctl list --ungrouped - 分页列出标签页:
tabctl list --all --limit 10 --offset 0 - 关闭标签页:
tabctl close --tab <id1> --tab <id2> --confirm - 刷新标签页:
tabctl refresh --tab <id> - 生成报告:(可按需添加范围参数)
tabctl report --format md - 获取页面元数据:
tabctl inspect --tab <id> --signal page-meta - 获取JS加载完成后的页面元数据:
tabctl inspect --tab <id> --signal page-meta --wait-for settle - 安全提取链接(仅提取http(s)绝对链接):
tabctl inspect --tab <id> --selector '{"name":"links","selector":"a[href]","attr":"href-url","all":true}' - 必要时捕获可视化上下文:
tabctl screenshot --tab <id> --mode full - 撤销最近一次变更:
tabctl undo --latest - 通过txid撤销操作:(txid可通过
tabctl undo <txid>获取)tabctl history --json | jq -r '.[] | .txid'
Narrow scope
缩小作用域
Use one or more of: , , , , .
If scope is unclear, ask for it before running mutating commands.
--window--group--group-id--tab--ungrouped可使用以下一个或多个参数:、、、、。
如果作用域不明确,在运行变更命令前请先询问确认。
--window--group--group-id--tab--ungroupedTroubleshooting
问题排查
- Check profile health:
tabctl doctor - Auto-repair broken profiles and resync extension files:
tabctl doctor --fix - Verify connection + runtime version sync:
tabctl ping --json - Read version state only from /
pingsurfaces (not fromversion/openoutput payloads).list - For local release-like sync checks during development, run a scoped command with (example:
TABCTL_AUTO_SYNC_MODE=release-like).TABCTL_AUTO_SYNC_MODE=release-like tabctl list --all
- 检查配置文件健康状态:
tabctl doctor - 自动修复损坏的配置文件并同步扩展文件:
tabctl doctor --fix - 验证连接和运行时版本同步状态:
tabctl ping --json - 仅从/
ping接口读取版本状态(不要从version/open输出负载中获取)。list - 开发过程中如需进行类正式发布的同步检查,可添加环境变量运行限定范围的命令(示例:
TABCTL_AUTO_SYNC_MODE=release-like)。TABCTL_AUTO_SYNC_MODE=release-like tabctl list --all
Output flags
输出参数
- Use for JSON output (list/analyze/inspect/etc.).
--json - is only for
--format(e.g.,report).tabctl report --format md
- 使用获取JSON格式输出(适用于list/analyze/inspect等命令)。
--json - 仅适用于
--format命令(例如:report)。tabctl report --format md
Wait modes for inspect/screenshot
inspect/screenshot等待模式
Use to control when inspection runs:
--wait-for- – wait for page load event (may miss JS-set titles)
load - – wait for DOMContentLoaded
dom - – wait for URL and title to stabilize (500ms quiet period); use for JS-heavy pages or freshly opened tabs
settle - – no waiting (default)
none
Example for newly opened tabs:
bash
tabctl open --url "https://example.com" --json
tabctl inspect --tab <new_tab_id> --wait-for settle --wait-timeout-ms 10000 --json使用控制检查操作的触发时机:
--wait-for- – 等待页面load事件触发(可能遗漏JS设置的标题)
load - – 等待DOMContentLoaded事件触发
dom - – 等待URL和标题稳定(500ms无变化周期);适用于重JS页面或刚打开的标签页
settle - – 不等待(默认值)
none
新打开标签页的使用示例:
bash
tabctl open --url "https://example.com" --json
tabctl inspect --tab <new_tab_id> --wait-for settle --wait-timeout-ms 10000 --json