New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@grepai/cli

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grepai/cli

CLI for semantic code search. It uses vector embeddings to understand code meaning, enabling natural language queries that find relevant code—even when naming conventions vary.

latest
Source
npmnpm
Version
0.9.2
Version published
Maintainers
1
Created
Source

@grepai/cli

Semantic code search CLI. It indexes your codebase using vector embeddings to enable natural language queries that find relevant code by meaning, regardless of naming conventions.

Installation

bun add -g @grepai/cli

Usage

# Index your codebase (run whenever code changes)
grepai index

# Search using natural language
grepai search "how is user authentication handled?"

# Options: --topK (default 20)
grepai search "database config" --topK 50

Configuration

Create a .grepairc.json or grepai-config.json in your project root. Supports ${ENV_VAR} substitution.

Minimal Example (Turso)

{
  "$schema": "https://raw.githubusercontent.com/bismuth1991/grepai-ts/refs/heads/main/packages/core/src/grepai-config-schema.json",
  "storage": {
    "type": "turso",
    "url": "${TURSO_DB_URL}",
    "authToken": "${TURSO_DB_AUTH_TOKEN}"
  },
  "embedding": {
    "provider": "google",
    "model": "gemini-embedding-001",
    "apiKey": "${GEMINI_API_KEY}"
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules", "dist", "**/*.test.ts"]
}

Postgres Example

{
  "storage": {
    "type": "postgres",
    "connectionString": "postgres://user:pass@localhost:5432/grepai"
  },
  "embedding": {
    "provider": "google",
    "model": "gemini-embedding-001",
    "apiKey": "${GEMINI_API_KEY}",
    "dimensions": 1536
  }
}

Local LanceDB Example

{
  "storage": {
    "type": "lancedb"
  },
  "embedding": {
    "provider": "google",
    "model": "gemini-embedding-001",
    "apiKey": "${GEMINI_API_KEY}",
    "dimensions": 1536
  }
}

Advanced Configuration

Full list of options:

{
  "embedding": {
    "provider": "google",
    "model": "gemini-embedding-001",
    "apiKey": "${GEMINI_API_KEY}",
    "dimensions": 3072, // 768, 1536, or 3072
    "targetChunkSize": 256, // Preferred tokens per chunk
    "maxChunkSize": 1024, // Max tokens per chunk
    "tokenizer": "gemini-embedding-001" // or "simple"
  }
}

Read https://github.com/bismuth1991/grepai-ts/blob/main/packages/core/src/domain/config.ts for full configuration details.

How it works

  • AST Parsing: GrepAI parses your code (TypeScript/TSX) into an Abstract Syntax Tree.
  • Smart Chunking: It splits code into meaningful chunks, preserving scope context (class names, function signatures) even for deep nested code.
  • Embedding: Chunks are embedded using Google's Gemini models.
  • Vector Search: Queries are embedded and compared against code chunks using cosine similarity.

Repository | Issues | License

FAQs

Package last updated on 16 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts