[STG-2453] refactor(cli): remove redundant browse refs command#2297
Merged
Conversation
🦋 Changeset detectedLatest commit: ac03a25 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
No issues found across 9 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant CLI as CLI (oclif)
participant BrowseCmd as Browse Commands
participant SnapshotCmd as snapshot Command
participant DriverCmd as Driver Command CLI
participant SessMgr as Session Manager
participant Driver as Browser Driver
Note over CLI,Driver: Command resolution and execution flow
CLI->>CLI: Parse argv (e.g., browse snapshot --full)
CLI->>BrowseCmd: dispatch to matched command
alt snapshot command
BrowseCmd->>SnapshotCmd: execute snapshot
SnapshotCmd->>DriverCmd: runDriverCommandFromFlags("snapshot", {full})
DriverCmd->>SessMgr: execute driver snapshot handler
SessMgr->>Driver: capture accessibility snapshot
Driver-->>SessMgr: tree + refMaps (xpathMap, urlMap)
SessMgr->>SessMgr: cache refMaps internally
alt --full flag set
SessMgr-->>DriverCmd: {tree, urlMap, xpathMap}
DriverCmd-->>SnapshotCmd: full output
SnapshotCmd-->>CLI: formatted result with maps
else default (no --full)
SessMgr-->>DriverCmd: {tree} only
DriverCmd-->>SnapshotCmd: lean output
SnapshotCmd-->>CLI: formatted tree only
end
end
Note over CLI,Driver: Element commands (click, fill, select, etc.)
CLI->>BrowseCmd: dispatch element command
BrowseCmd->>DriverCmd: runDriverCommandFromFlags("click", ...)
DriverCmd->>SessMgr: execute click handler
SessMgr->>SessMgr: resolveSelector using cached refMaps
SessMgr->>Driver: perform element action
Driver-->>SessMgr: result
SessMgr-->>DriverCmd: action outcome
DriverCmd-->>BrowseCmd: formatted response
BrowseCmd-->>CLI: output to user
Note over CLI,Driver: Refs command removed – users must use snapshot --full
CLI->>BrowseCmd: parse browse refs
BrowseCmd-->>CLI: "command refs not found"
CLI->>CLI: display error: "browse refs is not a browse command"
3fa8f06 to
0fd7ddc
Compare
`browse snapshot` already returns the xpathMap/urlMap, and the ref maps are cached for element commands regardless — so `browse refs` only re-printed the maps from the last snapshot (and returned stale data if the page had changed). Removes the command, its driver handler, the "refs" DriverCommandName, the now unused getRefMaps accessor, and doc references. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0fd7ddc to
ac03a25
Compare
tkattkat
approved these changes
Jul 1, 2026
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
Removes the
browse refscommand. It only re-printed thexpathMap/urlMapcached from the lastbrowse snapshot— whichbrowse snapshotalready returns — so it was redundant. It was also a footgun: it returned stale maps if the page had changed since that snapshot.refswas introduced in the CLI's oclif rewrite as one of the driver commands and never pruned; nothing relies on it thatbrowse snapshotdoesn't already cover.What's removed
browse refscommand (src/commands/refs.ts)"refs"entry inDriverCommandNamegetRefMaps()accessor on the session managerbrowse refsreferences inREADME.mdand the browseSKILL.mdRef-based commands (
click,fill,select, …) are unaffected — they resolve from the cached maps viaresolveSelector, which is untouched.browse snapshotcontinues to return the ref maps by default.E2E Test Matrix
browse refs"browse refs" is not a browse command … Error: command refs not foundbrowse --helprefsentrybrowse snapshot{ tree, urlMap, xpathMap })driver-commandsunit testspnpm --dir packages/cli build(tsc)DriverCommandName)Linear: STG-2453