Skip to main content

Grep + neural reranking for code search

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

hygrep (hhg)

Semantic code search with automatic indexing

pip install hygrep
hhg "authentication flow" ./src

What it does

Search your codebase using natural language. Results are functions and classes ranked by relevance:

$ hhg "error handling" ./tests/golden
No index found. Building...
Found 4 files (0.0s)
✓ Indexed 59 blocks from 4 files (5.4s)

Searching for: error handling
api_handlers.ts:127 function errorHandler
  function errorHandler(err: Error, req: Request, res: Response, next: NextFunc...
    console.error('API Error:', err.message);

errors.rs:7 class AppError
  pub enum AppError {
      /// Database operation failed.
      Database(DatabaseError),

2 results (0.60s)

Search Modes

Mode Flag Use Case
Semantic (default) Best quality, uses embeddings + index
Fast -f No index, grep + neural rerank
Exact -e Fastest, literal string match
Regex -r Pattern matching
hhg "auth flow" ./src           # Semantic (auto-indexes on first run)
hhg -f "validate" ./src         # Grep + neural rerank (no index needed)
hhg -e "TODO" ./src             # Exact match (fastest)
hhg -r "TODO.*fix" ./src        # Regex match

Install

pip install hygrep
# or
uv tool install hygrep
# or
pipx install hygrep

First search builds an index automatically (stored in .hhg/). Models are downloaded from HuggingFace and cached.

Usage

hhg "query" [path]              # Search (default: current dir)
hhg -n 5 "error handling" .     # Limit results
hhg --json "auth" .             # JSON output for scripts/agents
hhg -l "config" .               # List matching files only
hhg -t py,js "api" .            # Filter by file type
hhg --exclude "tests/*" "fn" .  # Exclude patterns
hhg status [path]               # Check index status
hhg rebuild [path]              # Rebuild index from scratch
hhg clean [path]                # Delete index

Note: Options must come before positional arguments.

Output

Default:

src/auth.py:42 function login
  def login(user, password):
      """Authenticate user and create session."""
      ...

JSON (--json):

[
  {
    "file": "src/auth.py",
    "type": "function",
    "name": "login",
    "line": 42,
    "end_line": 58,
    "content": "def login(user, password): ...",
    "score": 0.87
  }
]

Compact JSON (--json --compact): Same fields without content.

How it Works

Semantic mode (default):

Query → Embed → Vector search → Results
         ↓
    Auto-indexes on first run (.hhg/)
    Auto-updates when files change

Fast mode (-f):

Query → Grep scan → Tree-sitter extract → Neural rerank → Results

Exact/Regex mode (-e/-r):

Pattern → Grep scan → Tree-sitter extract → Results

Supported Languages

Bash, C, C++, C#, Elixir, Go, Java, JavaScript, JSON, Kotlin, Lua, Mojo, PHP, Python, Ruby, Rust, Svelte, Swift, TOML, TypeScript, YAML, Zig

Development

git clone https://github.com/nijaru/hygrep && cd hygrep
pixi install && pixi run build-ext && pixi run test

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hygrep-0.0.8-cp313-cp313-manylinux_2_17_x86_64.whl (98.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hygrep-0.0.8-cp313-cp313-macosx_11_0_arm64.whl (87.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hygrep-0.0.8-cp312-cp312-manylinux_2_17_x86_64.whl (98.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hygrep-0.0.8-cp312-cp312-macosx_11_0_arm64.whl (87.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hygrep-0.0.8-cp311-cp311-manylinux_2_17_x86_64.whl (98.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hygrep-0.0.8-cp311-cp311-macosx_11_0_arm64.whl (88.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file hygrep-0.0.8-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.8-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a00499e9af4457806fd0071a119a6dbe14200d4938dbd62d173596da7e874bc5
MD5 01ecd940309d402afab1d89c41ad797a
BLAKE2b-256 779d5b5290b4854cb7e8db3c9b5d1600673a3196d33f26c93f7fc3837f6dcac6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.8-cp313-cp313-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hygrep-0.0.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1bc1b97617ef6a9e6dde7fce5a0aca3079d6d6b2f3268af2fbf78c54cf511731
MD5 d6d48317717fa24a5e0ca5f1f69c988d
BLAKE2b-256 860540ddcaa4d5e4af9ac8e81788e5d3d74fb68a4536e7ce1afc2f5e39397231

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.8-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hygrep-0.0.8-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.8-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1c959c3770b34adb66bce1f62ce650ecae11235e7065bdbf3ca6c57a2e0bf1ff
MD5 86c5984e988c03525e8b37d1d804e98b
BLAKE2b-256 20158354e9acb9c828b36da2762560317636aaa929682494284fcce2a6c6e248

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.8-cp312-cp312-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hygrep-0.0.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86dc6e02a7414f710308160665f83dd75d37c804a62accfe83ee75a28f5f4d25
MD5 b1d404a9c7d1cfd18533579aa36fe28d
BLAKE2b-256 eef896407400a9d085e62cbe5fe1885520361a138e585cd9611d60c2c3c5d6fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.8-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hygrep-0.0.8-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.8-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 da2048fb62ff188900e4934526679c35d64c115b947caaa63b20aed5423830f6
MD5 e58d9bc479ac30b61bb7027e51f4bffb
BLAKE2b-256 b07a206a189210c2eedc951e01cb95f7a94d4501c81625f54b60190dda193ea8

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.8-cp311-cp311-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hygrep-0.0.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e95de0cfe95d645b5045345ac7e2f62107d9de3393127527eaeb807fbc354a8
MD5 34a16574913e773387ae96e2a60b8fb6
BLAKE2b-256 fd46790d593b95378d731abbdad90fe18b24fc141fb2cbf270d92fea5cf7ed08

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.8-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page