Skip to content

Add Gemini CLI support and harden search/runtime workflows#45

Closed
chumyin wants to merge 1 commit intospool-lab:mainfrom
chumyin:feat/gemini-cli-search-hardening
Closed

Add Gemini CLI support and harden search/runtime workflows#45
chumyin wants to merge 1 commit intospool-lab:mainfrom
chumyin:feat/gemini-cli-search-hardening

Conversation

@chumyin
Copy link
Copy Markdown
Contributor

@chumyin chumyin commented Apr 8, 2026

Summary

This PR expands Spool's session/search workflow so Gemini CLI is treated as a first-class source and local verification is repeatable across Node and Electron runtimes.

What changed

  • add Gemini CLI session indexing, filtering, resume commands, badges/counts, docs, and built-in ACP agent support
  • add Gemini fixtures and fast-search e2e coverage
  • improve current search/session behavior around multi-term search flows and Codex transcript filtering
  • add explicit better-sqlite3 rebuild paths for Node vs Electron runtimes
  • isolate Electron Playwright user data so e2e runs do not conflict with a live local Spool instance

Validation

  • tsc -p packages/core/tsconfig.json
  • tsc -p packages/app/tsconfig.json
  • vitest run packages/core/src/parsers/claude.test.ts packages/core/src/parsers/codex.test.ts packages/core/src/parsers/gemini.test.ts packages/core/src/sync/source-paths.test.ts packages/app/src/shared/resumeCommand.test.ts packages/app/src/main/sessionResume.test.ts packages/app/src/main/acp.test.ts
  • vitest run packages/core/src/db/search-query.test.ts (after Node rebuild)
  • electron-vite build
  • playwright test fast-search.spec.ts (after Electron rebuild)

Notes

  • better-sqlite3 now has explicit Node/Electron rebuild guidance because the native binary cannot safely drift between runtimes.
  • Test-only Electron startup uses a dedicated userData directory to avoid single-instance collisions with a developer's live app session.

Closes #44

chumyin added a commit to chumyin/spool that referenced this pull request Apr 8, 2026
The newly added Gemini/search coverage accidentally carried over
personal-looking references from local history into fixture data.
These tests only need stable synthetic strings, so the fixture corpus
now uses neutral change-tracking examples while preserving the same
search behavior and ranking assertions.

Constraint: Fixture text must remain deterministic enough to preserve phrase-vs-all-terms coverage
Rejected: Keep the original PR-specific wording | leaked user-specific context into repository fixtures
Confidence: high
Scope-risk: narrow
Directive: Keep future fixture/session samples synthetic and non-attributable even when seeded from local transcripts
Tested: tsc -p packages/core/tsconfig.json
Tested: tsc -p packages/app/tsconfig.json
Tested: playwright test fast-search.spec.ts
Not-tested: Node-side search-query vitest after this string-only fixture sanitization
Related: spool-lab#44
Related: spool-lab#45
This branch expands Spool's local session/search surface so Gemini CLI
is treated as a first-class source while keeping verification reliable
across Node and Electron runtimes. It adds Gemini CLI indexing,
filtering, resume support, built-in ACP agent wiring, UI/docs updates,
fixture coverage, and the runtime-specific rebuild/test hardening needed
for repeatable local validation.

The follow-up fixture corpus is intentionally synthetic. Search and e2e
coverage now use neutral change-tracking examples instead of
personal-looking transcript fragments, preserving the same ranking and
matching behavior without carrying over user-specific context.

Constraint: Gemini CLI stores project chats under .gemini/tmp with project identity resolved via history markers
Constraint: better-sqlite3 must be rebuilt separately for Node and Electron runtimes
Constraint: Fixture text must remain deterministic enough to preserve phrase-vs-all-terms coverage
Rejected: Share the default Electron userData directory in tests | caused launch conflicts with live Spool instances
Rejected: Keep one implicit native rebuild path | led to NODE_MODULE_VERSION drift between Node and Electron
Rejected: Keep the original PR-specific wording | leaked user-specific context into repository fixtures
Confidence: high
Scope-risk: moderate
Directive: Use rebuild:native:node before Node-side tests and rebuild:native:electron before Electron/e2e runs; keep future fixture/session samples synthetic and non-attributable
Tested: tsc -p packages/core/tsconfig.json
Tested: tsc -p packages/app/tsconfig.json
Tested: vitest run packages/core/src/parsers/claude.test.ts packages/core/src/parsers/codex.test.ts packages/core/src/parsers/gemini.test.ts packages/core/src/sync/source-paths.test.ts packages/app/src/shared/resumeCommand.test.ts packages/app/src/main/sessionResume.test.ts packages/app/src/main/acp.test.ts
Tested: vitest run packages/core/src/db/search-query.test.ts (after Node rebuild)
Tested: electron-vite build
Tested: playwright test fast-search.spec.ts (after Electron rebuild)
Not-tested: Full turbo test matrix
Related: spool-lab#44
Related: spool-lab#45
@chumyin chumyin force-pushed the feat/gemini-cli-search-hardening branch from 3b78655 to cc07b20 Compare April 8, 2026 05:13
Copy link
Copy Markdown
Contributor

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

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

This is a large PR that bundles three distinct concerns:

  1. Gemini CLI as a first-class session source (parser, sync, UI, ACP agent)
  2. Multi-term search overhaul (session-level FTS, trigram indexes, LIKE fallback, search plan builder)
  3. Dev/runtime infrastructure (native rebuild scripts, single-instance lock, search cache, Electron userData isolation)

Could you consider splitting them into standalone PRs?

doodlewind pushed a commit that referenced this pull request Apr 8, 2026
This branch expands Spool's local session/search surface so Gemini CLI
is treated as a first-class source while keeping verification reliable
across Node and Electron runtimes. It adds Gemini CLI indexing,
filtering, resume support, built-in ACP agent wiring, UI/docs updates,
fixture coverage, and the runtime-specific rebuild/test hardening needed
for repeatable local validation.

The follow-up fixture corpus is intentionally synthetic. Search and e2e
coverage now use neutral change-tracking examples instead of
personal-looking transcript fragments, preserving the same ranking and
matching behavior without carrying over user-specific context.

Constraint: Gemini CLI stores project chats under .gemini/tmp with project identity resolved via history markers
Constraint: better-sqlite3 must be rebuilt separately for Node and Electron runtimes
Constraint: Fixture text must remain deterministic enough to preserve phrase-vs-all-terms coverage
Rejected: Share the default Electron userData directory in tests | caused launch conflicts with live Spool instances
Rejected: Keep one implicit native rebuild path | led to NODE_MODULE_VERSION drift between Node and Electron
Rejected: Keep the original PR-specific wording | leaked user-specific context into repository fixtures
Confidence: high
Scope-risk: moderate
Directive: Use rebuild:native:node before Node-side tests and rebuild:native:electron before Electron/e2e runs; keep future fixture/session samples synthetic and non-attributable
Tested: tsc -p packages/core/tsconfig.json
Tested: tsc -p packages/app/tsconfig.json
Tested: vitest run packages/core/src/parsers/claude.test.ts packages/core/src/parsers/codex.test.ts packages/core/src/parsers/gemini.test.ts packages/core/src/sync/source-paths.test.ts packages/app/src/shared/resumeCommand.test.ts packages/app/src/main/sessionResume.test.ts packages/app/src/main/acp.test.ts
Tested: vitest run packages/core/src/db/search-query.test.ts (after Node rebuild)
Tested: electron-vite build
Tested: playwright test fast-search.spec.ts (after Electron rebuild)
Not-tested: Full turbo test matrix
Related: #44
Related: #45
@doodlewind
Copy link
Copy Markdown
Contributor

Rebased onto current main (post-OpenCLI removal) and pushed to origin/feat/gemini-cli-search-hardening.

Conflicts resolved:

  • README.md — merged Gemini session description with connector plugin line (removed OpenCLI/URL capture references)
  • types.ts — kept SessionSource with 'gemini', removed 'opencli' from Source union
  • db.ts — kept ('gemini', '~/.gemini/tmp') source, removed opencli source and opencli_sources/opencli_setup tables; kept session_search tables
  • queries.ts — removed OpenCLISource import
  • main/index.ts — kept searchSessionPreview import, removed OpenCLIManager and related imports
  • acp.ts — merged: Gemini CLI in agent list + connector-based data description (not OpenCLI)
  • SourcesPanel.tsx — kept geminiCount prop, removed OpenCLISource/PlatformInfo state
  • agent-integration.md — merged: "Gemini sessions, connector data"

Core and CLI build clean after rebase. The PR can be merged from this branch when ready.

@doodlewind
Copy link
Copy Markdown
Contributor

Closing in favor of #47, which has this PR's changes rebased onto current main (post-OpenCLI removal). All conflicts have been resolved there.

@chumyin Thanks for the contribution! Please review #47 — the code is identical to yours, just rebased with conflict resolution. We'll continue the review there.

@doodlewind doodlewind closed this Apr 8, 2026
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.

Add Gemini CLI support and harden search/runtime workflows

2 participants