{"id":50515368,"url":"https://github.com/dkmaker/websearch-cli","last_synced_at":"2026-06-02T23:31:13.359Z","repository":{"id":339434522,"uuid":"1161825166","full_name":"dkmaker/websearch-cli","owner":"dkmaker","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-19T17:02:45.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-19T20:41:04.248Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dkmaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-19T15:03:41.000Z","updated_at":"2026-02-19T17:02:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dkmaker/websearch-cli","commit_stats":null,"previous_names":["dkmaker/websearch-cli"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/dkmaker/websearch-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkmaker%2Fwebsearch-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkmaker%2Fwebsearch-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkmaker%2Fwebsearch-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkmaker%2Fwebsearch-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkmaker","download_url":"https://codeload.github.com/dkmaker/websearch-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkmaker%2Fwebsearch-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33841995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-02T23:31:12.678Z","updated_at":"2026-06-02T23:31:13.354Z","avatar_url":"https://github.com/dkmaker.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# websearch\n\nA Go CLI tool for AI agents to perform web searches via Perplexity, Brave, and GitHub APIs. Uses a profile system to abstract away provider selection, search modes, and result formatting — so agents just specify a profile and query.\n\n## Installation\n\nDownload a prebuilt binary from the [latest release](https://github.com/dkmaker/websearch-cli/releases/latest), or install with Go:\n\n```bash\ngo install github.com/dkmaker/websearch/cmd/websearch@latest\n```\n\nOr build from source:\n\n```bash\ngit clone https://github.com/dkmaker/websearch-cli.git\ncd websearch-cli\ngo build -o websearch ./cmd/websearch/\n```\n\n## Setup\n\nSet at least one API key:\n\n```bash\nexport PERPLEXITY_API_KEY=\"pplx-...\"   # For Perplexity (ask, search, reason, research)\nexport BRAVE_API_KEY=\"BSA...\"          # For Brave (web search)\n```\n\nBoth can be set simultaneously — the profile determines which provider to use.\n\n## Usage\n\n```bash\n# Basic search (uses \"general\" profile, Perplexity ask mode)\nwebsearch \"what is the Go programming language\"\n\n# Use a specific profile\nwebsearch --profile nodejs \"how to use streams in Node 22\"\nwebsearch --profile python \"async patterns in Python 3.12\"\n\n# Override the search mode\nwebsearch --mode research \"compare React vs Svelte 2025\"\nwebsearch --mode reason \"why is my Docker container slow\"\n\n# Include source citations\nwebsearch --include-sources \"latest Go releases\"\n\n# JSON output (for programmatic consumption)\nwebsearch --json \"kubernetes networking\"\n\n# Override provider\nwebsearch --provider brave \"local pizza restaurants\"\n\n# Pipe content as context\ncat document.txt | websearch \"summarize the key points\"\ngit diff | websearch \"review this code change\"\n\n# Stdin as the full query\necho \"explain quantum computing\" | websearch\n\n# Skip cache\nwebsearch --no-cache \"breaking news today\"\n\n# List available profiles\nwebsearch --list-profiles\n```\n\n## Flags\n\n| Flag | Short | Description | Default |\n|------|-------|-------------|---------|\n| `--profile` | `-p` | Profile name | `general` |\n| `--mode` | `-m` | Search mode override | profile default |\n| `--json` | | JSON output instead of markdown | `false` |\n| `--provider` | | Provider override (`perplexity`, `brave`) | profile decides |\n| `--max-results` | `-n` | Max result count | profile default |\n| `--max-tokens` | | Max response tokens | profile default |\n| `--include-sources` | | Include citations/sources in output | `false` |\n| `--no-cache` | | Bypass response cache | `false` |\n| `--list-profiles` | | List available profiles | |\n\n## Search Modes\n\n### Perplexity Modes\n\n| Mode | Model | Best For |\n|------|-------|----------|\n| `ask` | sonar | Quick factual answers |\n| `search` | sonar-pro | Complex queries, more sources |\n| `reason` | sonar-reasoning | Step-by-step analysis, comparisons |\n| `research` | sonar-deep-research | Comprehensive multi-source reports |\n\n### Brave Modes\n\n| Mode | Best For |\n|------|----------|\n| `web` | Raw search results with snippets |\n\n## Profiles\n\nProfiles bundle provider, mode, system prompt, domain filters, and output constraints into a single name. Three built-in profiles ship with the binary:\n\n### general\n\nGeneral-purpose web search. No domain restrictions. Good for any question.\n\n### nodejs\n\nFocused on the Node.js ecosystem. Prefers official docs (nodejs.org, MDN, npmjs.com). System prompt requests modern ESM syntax and version compatibility notes.\n\n### python\n\nFocused on the Python ecosystem. Prefers official docs (docs.python.org, pypi.org, realpython.com). System prompt requests modern Python 3.10+ syntax.\n\n### Custom Profiles\n\nCreate YAML files in `~/.config/websearch/profiles/` to add or override profiles:\n\n```yaml\n# ~/.config/websearch/profiles/devops.yaml\nname: devops\ndescription: \"DevOps and infrastructure searches\"\nprovider: perplexity\nmode: ask\nsystem_prompt: |\n  Focus on DevOps, CI/CD, containerization, and cloud infrastructure.\n  Include configuration examples. Prefer official documentation.\ndomain_filter:\n  - kubernetes.io\n  - docs.docker.com\n  - docs.aws.amazon.com\nmax_results: 5\nmax_tokens: 2048\noutput_format: markdown\n```\n\nUser profiles with the same name as a built-in profile override it (fields merge — unset fields inherit from the built-in).\n\n### Profile Fields\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `name` | string | Profile identifier |\n| `description` | string | Human-readable description |\n| `provider` | string | Preferred provider (`perplexity` or `brave`) |\n| `mode` | string | Default search mode |\n| `system_prompt` | string | System prompt sent to the provider |\n| `domain_filter` | string[] | Restrict results to these domains |\n| `max_results` | int | Maximum number of results |\n| `max_tokens` | int | Maximum response tokens |\n| `output_format` | string | Output format (`markdown` or `json`) |\n\n## Output\n\n### Default (Markdown)\n\nBy default, output is concise markdown with sources stripped for token efficiency. A hint comment is appended:\n\n```\nThe Go programming language is an open-source language developed by Google...\n\n- Built-in concurrency via goroutines\n- Fast compilation to native binaries\n- Rich standard library\n\u003c!-- run with --include-sources for citations --\u003e\n```\n\n### With Sources\n\n```bash\nwebsearch --include-sources \"Go programming\"\n```\n\nAppends a sources section:\n\n```\n...\n\n---\nSources:\n- [Go Documentation](https://go.dev/doc/)\n- [Go (programming language) - Wikipedia](https://en.wikipedia.org/wiki/Go_(programming_language))\n```\n\n### JSON Output\n\n```bash\nwebsearch --json \"Go programming\"\n```\n\n```json\n{\n  \"content\": \"The Go programming language is...\",\n  \"provider\": \"perplexity\",\n  \"mode\": \"ask\",\n  \"cached\": false\n}\n```\n\nWith `--include-sources --json`, the `sources` array is included.\n\n## Caching\n\nResponses are cached locally to avoid repeated API calls:\n\n- **Location:** `~/.cache/websearch/` (respects `XDG_CACHE_HOME`)\n- **TTL:** 60 minutes\n- **Key:** SHA256 hash of query + profile + mode + provider\n- **Purge:** Stale entries auto-purged on each run\n\nUse `--no-cache` to bypass both reading and writing to the cache.\n\n## Provider Resolution\n\nWhen both API keys are set, the provider is chosen by:\n\n1. `--provider` flag (if set)\n2. Profile's `provider` field\n3. If preferred provider's key is missing, falls back to the other with a stderr warning\n4. If the profile's mode is incompatible with the fallback provider, mode is auto-adjusted\n\nErrors go to stderr, results to stdout — safe for piping.\n\n## For AI Agents\n\nThis tool is designed to be called from AI agent workflows. Key design decisions:\n\n- **Errors to stderr, results to stdout** — pipe-friendly\n- **Exit code 0** on success, **1** on error\n- **Token-efficient** — sources stripped by default\n- **Profiles abstract complexity** — agents don't need to know about providers or modes\n- **Caching** — repeated queries are fast and free\n- **JSON mode** — structured output for programmatic consumption\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkmaker%2Fwebsearch-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkmaker%2Fwebsearch-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkmaker%2Fwebsearch-cli/lists"}