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

Requires Python 3.11-3.13 (onnxruntime lacks 3.14 support).

pip install hygrep
# or
uv tool install hygrep --python 3.13
# 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.10-cp313-cp313-manylinux_2_17_x86_64.whl (98.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hygrep-0.0.10-cp313-cp313-macosx_11_0_arm64.whl (88.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hygrep-0.0.10-cp312-cp312-manylinux_2_17_x86_64.whl (98.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hygrep-0.0.10-cp312-cp312-macosx_11_0_arm64.whl (88.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hygrep-0.0.10-cp311-cp311-manylinux_2_17_x86_64.whl (98.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hygrep-0.0.10-cp311-cp311-macosx_11_0_arm64.whl (88.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hygrep-0.0.10-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b0fa61b4f846cdf6c0266c3a8544146dd0524499fede756a6e6d35ca0129cf36
MD5 bcbafc6ce1d4dc0d79d36dfbb7b3c041
BLAKE2b-256 171ae43c54fafdfb576b65c00fa7ce40cd84ad38e0a09e3acc937e24ca43874a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.10-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.10-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a138594bdc1b7433d3a605004d4145c328c748f167787c70df5940b7b1b94f06
MD5 abd83d7987a5fc1ffe3c2def5777c701
BLAKE2b-256 67a9cc358a1f90034224d161edf78f41739d377d78115a808d69e0079b8d18fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.10-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.10-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.10-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 24e925d56c1547c7518040de025402830fad3acdeae3239a4fe0b386232e55a0
MD5 e5dd20fdf2b53309b8bc9f3404062644
BLAKE2b-256 ae66b5dd08a1e777f1de9d333869391ce5f3c0c23f2e4d381ae9d0f87980d254

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.10-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.10-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3f28ec2786661bc61e02c0f003d76d84d14afd41ec2b343147ae25295d086bd3
MD5 1832b8728cbd2b9d0bf34d9e8eca954b
BLAKE2b-256 73d76b537af4903c7a7f26e6eb154fe3e7ea137f2f24a4f557e92c8eb38f4224

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.10-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.10-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.10-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 09351aa4f033efad17bb8c7bc77c39e6447d91c4e18c7d6c46c60c7dd6ff999c
MD5 8bf8beabfd0544e677b1aad1103a0a05
BLAKE2b-256 6858c1736aba2f58450fafcf58a720b704554ee84ff2f8b20b3514b29e04a949

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.10-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.10-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.10-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42093c1107a17da3bae6b3cbcb7ad5dda51c37fd550396d87571e93d32ed8a83
MD5 92dc18b6291e2f1c57077879b2e3f7fc
BLAKE2b-256 bc620bee47756bb9ab72f0344ae6e2f8773507d7f7b315337b58bfab616d11fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.10-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