| title | CLI |
|---|---|
| order | 20 |
| date | 2026-03-25 |
| summary | Commands for building, inspecting, searching, and benchmarking indexbind artifacts. |
Install the npm package, then run the public CLI through npx indexbind ... or your package manager's local bin shim.
Main commands:
npx indexbind build [input-dir] [output-file] [--backend <hashing|model-id>]npx indexbind build-bundle [input-dir] [output-dir] [--backend <hashing|model-id>]npx indexbind update-cache [input-dir] [cache-file] [--backend <hashing|model-id>] [--git-diff] [--git-base <rev>]npx indexbind export-artifact <output-file> [--cache-file <path>]npx indexbind export-bundle <output-dir> [--cache-file <path>]npx indexbind inspect <artifact-file>npx indexbind search <artifact-file> <query> [flags]npx indexbind benchmark <artifact-file> <queries-json>
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.jsonCommands 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" --textThis default is intentional so agents, shell scripts, and CI jobs can consume CLI output without extra parsing.
Default path rules:
- omitted
input-dirmeans the current directory - omitted
output-file,output-dir, orcache-filefor build commands writes under<input-dir>/.indexbind/ export-*still requires an explicit output path; omit--cache-fileto use./.indexbind/build-cache.sqlite
Scan defaults:
- hidden files and directories are ignored
- nested
.gitignorerules are respected - common generated or dependency directories such as
node_modules/,target/,dist/, andbuild/are ignored
Index-scoped convention files:
indexbind.build.jsandindexbind.search.jsare auto-discovered from the exactinput-diror artifactsourceRoot- if you index
./docs, place them in./docs/, next to./docs/.indexbind/ - they affect only that indexed root; there is no repo-root or current-working-directory fallback
Embedding backend selection:
- pass
--backend hashing - or pass any
model2vecmodel id with--backend <model-id>
If --backend is omitted, the current default backend is used.
Recommended sequence:
update-cacheto refresh the mutable build cacheexport-artifactto write a fresh SQLite artifactexport-bundleto 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.
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.
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.
Use search to experiment with retrieval settings against a built SQLite artifact.
Supported flags:
--top-k <n>--mode <hybrid|vector|lexical>--reranker embedding-v1|heuristic-v1--candidate-pool-size <n>--relative-path-prefix <prefix>--metadata key=value(repeatable)--score-adjust-metadata-multiplier <field>--min-score <float>--text
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--mode vectormeans vector-only retrieval.--mode lexicalmeans lexical-only retrieval.
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.sqliteThis 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.