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.7-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.7-cp313-cp313-macosx_11_0_arm64.whl (88.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hygrep-0.0.7-cp312-cp312-manylinux_2_17_x86_64.whl (98.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hygrep-0.0.7-cp312-cp312-macosx_11_0_arm64.whl (88.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hygrep-0.0.7-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.7-cp311-cp311-macosx_11_0_arm64.whl (87.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hygrep-0.0.7-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 62b8bd2a33b2c426900661228f8b40031099c236989fc48d27cfa9fe05378128
MD5 d6242daa4a7576da35758818bebcd819
BLAKE2b-256 271af7b22368c47a855d265d6bb259180d1a77d2173a33eb75ac6db2f8fdfc14

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a5d854a029ffdedad16c30dbaa33892da4d1239c1b2fb86aeb0bfc5a99ffb91
MD5 a934d8a0451b05932595f2750dc9b146
BLAKE2b-256 82c3e221d42bc19d3de24c6acdaa3f7ba4bb4cc555e6762fc6629cace6f36324

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.7-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ef8fcd5deddd575cc39b2302c5eb431767786dad3f7b0c199a1215193d3edae2
MD5 78ecbdf74025eb4eb34c6fb31194db0a
BLAKE2b-256 0e48809819d4d443b7c978eaf931b93faf45295d7c0f5d9be310ab05c5c6b1ca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8203fd381da14969128c9bba9bca72a5a9cf823cea0740bb8a1230cd69a0f112
MD5 2ed2833f6a263614c47f07496522f7a6
BLAKE2b-256 85af0f120b7f258a81990d155ad06950bcf4d4e8816e0b7be96f24a8bc064eb0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.7-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2408ca8501f73f8cb889cdd4a1ca2462bf6048074717d8f7264c127bf1ad705c
MD5 85956ea7ed5900ef36ad5d66c9ca2034
BLAKE2b-256 7a420c22971b2fe615221c7ac04f81af6286c7da72b2cc47741c72cae2201e95

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f65959fa3e3aed5b336d98f955be46d10284d214a1d88b60c9089b3fd49e766e
MD5 dec3ffa1ddfc5f3107e4295617a96eb7
BLAKE2b-256 c38312ce83006cf06399d3142aeab0162f163eb98115f30befa5b14e68e058ce

See more details on using hashes here.

Provenance

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