feat(gemini): add status / history / detail / read commands#1838
Merged
Conversation
ChatGPT and Claude already expose `status` / `history` / `detail` / `read`; Gemini was missing all four. The helpers needed to back them (`getGeminiPageState`, `getGeminiConversationList`, `resolveGeminiConversationForQuery`, `getGeminiVisibleTurns`) are already implemented in `clis/gemini/utils.js` — this PR is the cli() wire-up. ## Commands - `gemini status` — uses `getGeminiPageState`; treats `isSignedIn=null` (composer present but no explicit Sign-in CTA) as logged in. - `gemini history [--limit N]` — uses `getGeminiConversationList`; filters out the sidebar's "New chat" affordance (URL = `/app`, no id) so callers get a clean conversation list. `--limit` clamped to `[1, 200]`. - `gemini detail <id>` — accepts a bare 16-hex id, a `/app/<id>` path, a full `https://gemini.google.com/app/<id>` URL, or a sidebar title (exact or substring). Title lookup wins for generic alphanumeric strings so a chat called "Empire study" doesn't get treated as the literal id "Empire study". - `gemini read` — current-conversation `getGeminiVisibleTurns`. ## Tests - `clis/gemini/commands.test.js`, 18 cases: - 4× `extractGeminiId` (bare id / path / URL / garbage) - 3× `status` (connected / signed-out CTA / ambiguous-null treated as logged in) - 4× `history` (rows / `--limit` / `--limit` validation / empty sidebar) - 4× `detail` (direct id nav / title resolution / missing id / no-match / zero turns) - 2× `read` (happy / zero turns) - `npx vitest run clis/gemini/commands.test.js` — 18/18 pass. - `npm run test:adapter` — 380 files / 3732 tests pass. Live smoke-tested against a real signed-in Gemini account: all four commands return real data end-to-end via the Browser Bridge.
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.
ChatGPT and Claude already expose
status/history/detail/read; Gemini was missing all four. The helpers needed to back them (getGeminiPageState,getGeminiConversationList,resolveGeminiConversationForQuery,getGeminiVisibleTurns) are already implemented inclis/gemini/utils.js— this PR is just thecli()wire-up plus anextractGeminiIdparser shared betweenhistoryanddetail.Commands added
gemini statusgetGeminiPageStateisSignedIn=null(composer present but no explicit Sign-in CTA) as logged in.gemini history [--limit N]getGeminiConversationList/app, no id) so callers get a clean conversation list.--limitclamped to[1, 200].gemini detail <id>getGeminiConversationList+resolveGeminiConversationForQuery+getGeminiVisibleTurns/app/<id>path, full URL, or a sidebar title (exact or substring).gemini readgetGeminiVisibleTurnsdetailonly short-circuits the sidebar lookup when the input is unambiguously id-shaped (URL //app/<id>/ 16-hex bare id). Generic alphanumeric strings like"Empire study"go through title-matching first so a chat doesn't get treated as a literal conversation id.Verification
clis/gemini/commands.test.js— 18 cases:extractGeminiId(bare id / path / URL / garbage)status(connected / signed-out CTA / ambiguous-null treated as logged in)history(rows /--limit/--limitvalidation / empty sidebar)detail(direct-id nav / title resolution / missing id / no-match / zero turns)read(happy / zero turns)npm run test:adapter— 380 files / 3732 tests passnpm run build-manifest— clean, +4 entries (gemini/status,gemini/history,gemini/detail,gemini/read)Live smoke test against a real signed-in Gemini account: