Skip to content

[STG-2453] refactor(cli): remove redundant browse refs command#2297

Merged
shrey150 merged 1 commit into
mainfrom
shrey/remove-browse-refs
Jul 1, 2026
Merged

[STG-2453] refactor(cli): remove redundant browse refs command#2297
shrey150 merged 1 commit into
mainfrom
shrey/remove-browse-refs

Conversation

@shrey150

@shrey150 shrey150 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the browse refs command. It only re-printed the xpathMap/urlMap cached from the last browse snapshot — which browse snapshot already returns — so it was redundant. It was also a footgun: it returned stale maps if the page had changed since that snapshot.

refs was introduced in the CLI's oclif rewrite as one of the driver commands and never pruned; nothing relies on it that browse snapshot doesn't already cover.

What's removed

  • The browse refs command (src/commands/refs.ts)
  • Its driver handler + the "refs" entry in DriverCommandName
  • The now-unused getRefMaps() accessor on the session manager
  • browse refs references in README.md and the browse SKILL.md

Ref-based commands (click, fill, select, …) are unaffected — they resolve from the cached maps via resolveSelector, which is untouched. browse snapshot continues to return the ref maps by default.

E2E Test Matrix

Command / flow Observed output Confidence
browse refs "browse refs" is not a browse command … Error: command refs not found Command removed
browse --help no refs entry Removed from the surface
browse snapshot unchanged (still returns { tree, urlMap, xpathMap }) Snapshot behavior untouched
driver-commands unit tests 14/14 pass No test regressions
pnpm --dir packages/cli build (tsc) success Typechecks (incl. narrowed DriverCommandName)

Linear: STG-2453

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ac03a25

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Loading

Re-trigger cubic

@shrey150 shrey150 force-pushed the shrey/remove-browse-refs branch from 3fa8f06 to 0fd7ddc Compare July 1, 2026 02:15
@shrey150 shrey150 changed the base branch from shrey/browse-lean-snapshot-default to main July 1, 2026 02:15
@shrey150 shrey150 closed this Jul 1, 2026
@shrey150 shrey150 reopened this Jul 1, 2026
`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>
@shrey150 shrey150 force-pushed the shrey/remove-browse-refs branch from 0fd7ddc to ac03a25 Compare July 1, 2026 02:18
@shrey150 shrey150 merged commit c18ab34 into main Jul 1, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants