Skip to content

feat: Add --web and --answer flags for web search #107

Description

@RomThpt

Summary

Add web search capability to ck via --web and --answer flags, allowing users to search the web alongside local files without leaving the terminal.

Motivation

ck already covers local search well across all modes (regex, semantic, lexical, hybrid). The missing piece is web search -- useful for looking up documentation, finding solutions, or answering programming questions while staying in the same workflow.

Currently users need to switch to a browser or a separate tool for web queries. Integrating web search into ck would make it a complete search tool for both local codebases and external knowledge.

Proposed Behavior

# Search the web and return raw results (URLs + snippets)
ck --web "Next.js 15 app router migration"

# Search the web and return a summarized answer
ck --web --answer "how to handle async errors in Rust"

# Combine with local search
ck --hybrid --web "authentication middleware" src/

--web flag

  • Queries a web search provider and returns ranked results (title, URL, snippet)
  • Can be combined with local search modes to merge local + web results
  • Respects --topk, --json, --jsonl output formats

--answer flag

  • Takes web search results and generates a concise summarized answer
  • Could use a local LLM (e.g., via ollama) or optionally an external API
  • Works with --web to answer questions directly in the terminal

Privacy Considerations

Ideally this follows ck's local-first philosophy:

  1. Local-first approach: Use a self-hosted search engine like SearXNG for web queries, or a local LLM for --answer summarization
  2. Optional external API fallback: Support external providers (Brave Search, DuckDuckGo API, etc.) as opt-in via config or env var when a local engine isn't available

Example config:

[web]
provider = "searxng"           # or "brave", "duckduckgo"
searxng_url = "http://localhost:8080"
brave_api_key = ""             # only if using Brave

[answer]
provider = "ollama"            # or "openai", "anthropic"
model = "llama3"

Agent Integration

This would also benefit the MCP server mode (ck --serve). Agents using ck could get web search results alongside local code search without needing a separate web search tool.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions