Skip to content

Add lore query CLI subcommand for read-side parity #155

@jafreck

Description

@jafreck

Problem

The CLI surface is write-only (index, refresh, hooks, ingest-coverage, mcp). All 17 MCP query tools have no CLI equivalent. Users and scripts cannot query the knowledge base without spinning up an MCP server and connecting a client.

Proposal

Add a lore query <tool-name> [--json '{ ... }'] subcommand that dispatches directly to MCP tool handlers.

lore query lore_code_search --db lore.db --json '{"query": "auth middleware", "mode": "fused"}'
lore query lore_git_blame --db lore.db --json '{"path": "src/server.ts", "mode": "ownership"}'
lore query lore_metrics --db lore.db --json '{"mode": "aggregate"}'

Implementation notes

  • ToolRegistry already maps tool names → handler factories. This subcommand needs ~50 lines: open DB read-only, instantiate ToolDependencies, look up the handler by name, parse --json args, call it, print JSON to stdout.
  • Output to stdout as JSON for piping; errors to stderr.
  • lore query --list prints available tool names.
  • Tool names should match the renamed tools from Namespace MCP tools with domain prefixes for discoverability #152.

Acceptance criteria

  • lore query <tool> --db <path> --json '{...}' calls the named tool handler and prints JSON to stdout
  • lore query --list prints all registered tool names
  • Error on unknown tool name with helpful message
  • Documented in --help output

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions