Skip to content

Actually search - #29

Merged
mrsimpson merged 4 commits into
mainfrom
actually-search
Mar 10, 2026
Merged

mrsimpson merged 4 commits into
mainfrom
actually-search

Conversation

@mrsimpson

Copy link
Copy Markdown
Collaborator

No description provided.

Replace the previous template-based response (which only returned
instructions on where to search) with a real streaming grep engine that
returns file path, line number, and matched content — just like ripgrep.

Key decisions:
- Pure Node.js streaming regex grep as primary search (no binary deps,
  cross-platform, supports full JS/ripgrep regex: auth|login, \s+\w+, etc.)
- MiniSearch (already a transitive dep) as optional pre-filter/ranker to
  limit candidate files on large docsets before line-level grep
- OR syntax satisfied by native RegExp — no extra tooling needed
- context_lines defaults to 0 (was 2); exposed as optional MCP param so
  callers can request 1–3 lines of surrounding context when needed

Changes:
- packages/core/src/search/searcher.ts  — new core search engine
  (buildFileIndex, searchDocset, formatSearchResult)
- packages/core/src/types.ts            — SearchMatch, SearchDocsResult,
  SearchOptions types
- packages/core/src/index.ts            — export new search symbols
- packages/mcp-server/src/server.ts     — replace template processing with
  actual search; add context_lines param to search_docs tool schema
- packages/core/src/__tests__/searcher.test.ts  — 25 new unit tests
- packages/mcp-server/src/__tests__/web-sources.test.ts — update 3 tests
  for new grep-style content[0].text response shape
- test/e2e/mcp-protocol-compliance.test.ts — update 4 stale E2E tests
  that asserted old structuredContent/instructions response shape
- docs/adr/001-search-engine-for-search-docs-tool.md — Nygard ADR with
  weighted Pugh matrix comparing ripgrep wrapper vs MiniSearch hybrid vs
  Node.js streaming grep (Option C wins, score +21 vs baseline)
…server.ts

- packages/core: add minisearch@^7.1.2 to dependencies so CI installs it
  (was only available locally as a transitive/hoisted dep)
- packages/mcp-server/server.ts: replace inline import('@agentic-knowledge/core').SearchOptions
  with a proper named import from @codemcp/knowledge-core
@mrsimpson
mrsimpson merged commit ee053e9 into main Mar 10, 2026
1 check passed
@mrsimpson
mrsimpson deleted the actually-search branch March 10, 2026 12:49
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.

1 participant