CLI

Install the npm package, then run the public CLI through npx indexbind ... or your package manager's local bin shim.

Main commands:

Examples:

npx indexbind build ./docs
npx indexbind build . ./index.sqlite --backend hashing
npx indexbind build-bundle ./docs
npx indexbind update-cache ./docs --git-diff
npx indexbind export-artifact ./index.sqlite --cache-file ./docs/.indexbind/build-cache.sqlite
npx indexbind export-bundle ./index.bundle --cache-file ./docs/.indexbind/build-cache.sqlite
npx indexbind inspect ./docs/.indexbind/index.sqlite
npx indexbind search ./docs/.indexbind/index.sqlite "rust guide"
npx indexbind search ./docs/.indexbind/index.sqlite "rust guide" --text
npx indexbind benchmark ./docs/.indexbind/index.sqlite fixtures/benchmark/basic/queries.json

Output Mode

Commands print JSON by default.

Add --text when you want a compact terminal-oriented summary instead:

npx indexbind inspect ./docs/.indexbind/index.sqlite --text
npx indexbind search ./docs/.indexbind/index.sqlite "rust guide" --text

This default is intentional so agents, shell scripts, and CI jobs can consume CLI output without extra parsing.

Default path rules:

Scan defaults:

Index-scoped convention files:

Embedding backend selection:

If --backend is omitted, the current default backend is used.

Incremental Cache Flow

Recommended sequence:

  1. update-cache to refresh the mutable build cache
  2. export-artifact to write a fresh SQLite artifact
  3. export-bundle to write a fresh canonical bundle when needed

update-cache defaults to a full directory scan. Add --git-diff to use Git as a change-detection fast path. Add --git-base <rev> when you want to diff against a specific revision and still reuse the same cache.

Build Conventions

Optional indexbind.build.js exports can extend the default directory scanner:

export function includeDocument(relativePath, ctx) {
  return true;
}

export async function transformDocument(document, ctx) {
  return document;
}

transformDocument() receives the default normalized document shape after frontmatter parsing. It is the right place to derive canonicalUrl, inject metadata, or normalize title/summary without replacing the scanner.

Search Conventions

Optional indexbind.search.js exports can define a default profile for indexbind search:

export const profiles = {
  default: {
    metadata: {
      is_default_searchable: 'true',
    },
    scoreAdjustment: {
      metadataNumericMultiplier: 'directory_weight',
    },
  },
};

export function transformQuery(query, ctx) {
  return { query };
}

profiles.default is applied first, then explicit CLI flags override it. transformQuery() rewrites only the query string.

Search Flags

Use search to experiment with retrieval settings against a built SQLite artifact.

Supported flags:

Example:

npx indexbind search ./docs/.indexbind/index.sqlite "rust guide" \
  --top-k 5 \
  --mode vector \
  --reranker heuristic-v1 \
  --candidate-pool-size 25 \
  --min-score 0.05 \
  --text

Trigger Example

One simple local hook pattern is updating the cache after branch changes:

#!/usr/bin/env bash
set -euo pipefail

npx indexbind update-cache ./docs --git-diff
npx indexbind export-artifact ./index.sqlite --cache-file ./docs/.indexbind/build-cache.sqlite

This is only an adapter example. The cache logic still lives in the shared incremental engine, so the same flow can also be called from agent scripts, task runners, or a file watcher.