{"id":26189097,"url":"https://github.com/johnlindquist/ghx","last_synced_at":"2025-04-15T01:34:31.236Z","repository":{"id":274102659,"uuid":"921920902","full_name":"johnlindquist/ghx","owner":"johnlindquist","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-18T17:09:03.000Z","size":173,"stargazers_count":38,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T02:33:59.794Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/johnlindquist.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}},"created_at":"2025-01-24T21:48:52.000Z","updated_at":"2025-04-03T08:54:20.000Z","dependencies_parsed_at":"2025-01-24T22:37:56.087Z","dependency_job_id":null,"html_url":"https://github.com/johnlindquist/ghx","commit_stats":null,"previous_names":["johnlindquist/ghx"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fghx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fghx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fghx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlindquist%2Fghx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnlindquist","download_url":"https://codeload.github.com/johnlindquist/ghx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248989143,"owners_count":21194537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-03-12T00:30:30.311Z","updated_at":"2025-04-15T01:34:31.209Z","avatar_url":"https://github.com/johnlindquist.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ghx - GitHub Code Search CLI\n\nA CLI tool for searching GitHub code and viewing results in your editor.\n\n## Prerequisites\n\n### GitHub CLI Required\n\nThis tool requires the [GitHub CLI](https://cli.github.com/) (`gh`) to be:\n\n1. Installed and available in your PATH\n2. Authenticated with your GitHub account\n\nWithout these requirements, the tool will fail to work due to GitHub API rate limiting.\n\n### Installation \u0026 Authentication Steps\n\n1. Install GitHub CLI:\n   - macOS: `brew install gh`\n   - [Other installation methods](https://github.com/cli/cli#installation)\n\n2. Authenticate with GitHub:\n   ```bash\n   gh auth login\n   ```\n   Follow the prompts to complete authentication.\n\n3. Install ghx:\n   ```bash\n   pnpm add -g @johnlindquist/ghx\n   ```\n\n## Usage\n\n```bash\nghx \"your search query\" [options]\n```\n\n### Options\n\n- `--pipe` - Output results directly to stdout\n- `--debug` - Output code fence contents for testing\n- `--limit, -L \u003cn\u003e` - Maximum number of results to fetch (default: 50)\n- `--context, -c \u003cn\u003e` - Number of context lines around matches (default: 20)\n- `--max-filename, -f \u003cn\u003e` - Maximum length of generated filenames (default: 50)\n\n### Search Qualifiers\n\nYou can use either CLI flags or GitHub's search qualifiers:\n\nCLI Flags:\n- `--filename \u003cname\u003e` - Search in files with a specific name\n- `--extension \u003cext\u003e` - Search files with specific extension\n- `--language \u003clang\u003e` - Search in a specific programming language\n- `--repo \u003cowner/repo\u003e` - Search in a specific repository\n- `--path \u003cpath\u003e` - Search in a specific file path\n- `--size \u003cn\u003e` - Files that are n bytes in size\n- `--fork` - Include or exclude forked repositories\n\nExamples:\n```bash\n# Search for TypeScript config files\nghx --filename tsconfig.json \"strict\"\n\n# Find React components\nghx --language typescript --extension tsx \"useState\"\n\n# Search in specific repo\nghx --repo facebook/react \"useState\"\n\n# Search and pipe results to stdout\nghx --pipe --filename tsconfig.json \"strict\"\n\n# Pipe results to a file\nghx --pipe --language typescript \"useState\" \u003e results.md\n\n# Get more results\nghx --limit 100 --filename package.json \"dependencies\"\n\n# Show more context around matches\nghx --context 50 --language typescript \"useState\"\n\n# Allow longer filenames\nghx --max-filename 100 --filename package.json \"devDependencies\"\n\n# Combine options\nghx -L 100 -c 30 -f 75 --repo facebook/react \"hooks\"\n```\n\n### Search Results\n\nResults are saved as markdown files in your system's config directory:\n- macOS: `~/Library/Preferences/johnlindquist/ghx-nodejs/searches/`\n- Linux: `~/.config/johnlindquist/ghx-nodejs/searches/`\n- Windows: `%APPDATA%/johnlindquist/ghx-nodejs/searches/`\n\n### Editor Integration\n\nOn first run, ghx will prompt you to:\n1. Choose whether to automatically open results in an editor\n2. Specify your preferred editor command (e.g., 'code', 'cursor', 'vim')\n\nYou can change these settings by editing the config file in:\n- macOS: `~/Library/Preferences/johnlindquist/ghx-nodejs/config.json`\n- Linux: `~/.config/johnlindquist/ghx-nodejs/config.json`\n- Windows: `%APPDATA%/johnlindquist/ghx-nodejs/config.json`\n\n## Features\n\n- Searches GitHub code using the GitHub API\n- Shows matching code snippets with context\n- Saves results as markdown for easy viewing\n- Handles rate limiting and authentication through GitHub CLI\n- Opens results in Cursor (if available)\n\n## Troubleshooting\n\nIf you get authentication errors:\n1. Make sure GitHub CLI is installed: `gh --version`\n2. Make sure you're logged in: `gh auth status`\n3. Try logging in again: `gh auth login`\n\n## Development\n\n```bash\n# Clone the repo\ngit clone https://github.com/johnlindquist/ghx.git\n\n# Install dependencies\npnpm install\n\n# Run in development\npnpm dev\n\n# Build\npnpm build\n```\n\n## License\n\nISC ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlindquist%2Fghx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnlindquist%2Fghx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlindquist%2Fghx/lists"}