Indexbind
Use this skill when the task is about using indexbind from a host application or environment.
Usage examples
- - "Use
indexbind to add local search to a docs folder." - "Help me choose between
indexbind, indexbind/web, and indexbind/cloudflare." - "Show me how to build a SQLite artifact for Node and a bundle for Workers."
Install
Install the package:
CODEBLOCK0
Optional global install when the goal is using indexbind as a shell command from arbitrary directories:
CODEBLOCK1
Then use either:
- -
npx indexbind ... for local installs and per-project workflows - INLINECODE7 after a global install
- INLINECODE8 or
indexbind/build for programmatic usage
Platform notes:
- - native prebuilds exist for macOS arm64, macOS x64, and Linux x64 (glibc)
- Windows usage should go through WSL
Install and packaging docs:
- - INLINECODE10
- INLINECODE11
Choose the right interface
- - Index a local docs folder or local knowledge-base directory from the shell:
use
npx indexbind ...
- - Local Node querying over a built SQLite artifact:
use
indexbind
- - Programmatic build, incremental cache update, inspect, or benchmark:
use
indexbind/build
- - Mixed local knowledge bases that need host-defined document classification, metadata, or directory weighting:
normalize documents in the host first, then pass them to
indexbind/build
- - A mostly-default local docs or knowledge-base directory that only needs light host policy:
use
indexbind.build.js and
indexbind.search.js beside that directory’s
.indexbind/
- - Browser or standard worker querying over a canonical bundle:
use
indexbind/web
- - Cloudflare Worker querying:
use
indexbind/cloudflare
- - Shell-driven build/update/export/inspect flows:
use INLINECODE21
API docs:
- - INLINECODE22
- INLINECODE23
Choose the artifact
- - Local directory indexing for later Node queries:
build a native SQLite artifact
- - Local directory indexing for browser or worker delivery:
build a canonical bundle
use a native SQLite artifact
- - Browser, Web Worker, Cloudflare Worker:
use a canonical bundle
- - Repeated rebuilds over a stable corpus:
use the build cache, then export fresh artifacts or bundles
Concepts:
- - INLINECODE24
- INLINECODE25
Common commands
Typical CLI commands:
- - INLINECODE26
- INLINECODE27
- INLINECODE28
- INLINECODE29
- INLINECODE30
- INLINECODE31
- INLINECODE32
- INLINECODE33
- INLINECODE34
- INLINECODE35
- INLINECODE36
Use indexbind/build instead when the host already has documents in memory or wants tighter control from code.
Index-scoped conventions
When one indexed root only needs a small amount of host-specific behavior, place convention files beside that root:
CODEBLOCK2
Use indexbind.build.js when the default directory scanner is already correct and you only need to:
- - skip a few files from indexing
- derive INLINECODE39
- inject metadata such as
is_default_searchable, source_root, content_kind, or INLINECODE43 - normalize
title or INLINECODE45
Use indexbind.search.js when CLI or Node search should automatically apply:
- - a default search profile
- a metadata filter
- score adjustment defaults
- lightweight query rewrite or alias expansion
These convention files are index-scoped, not repo-global:
- - if you index
./docs, the files live in INLINECODE48 - they affect only that indexed root
- there is no repo-root fallback
Common APIs
Use these APIs when the host already has documents or wants tighter control:
- -
openIndex(...) from INLINECODE50 - INLINECODE51 from INLINECODE52
- INLINECODE53 from INLINECODE54
- INLINECODE55 from INLINECODE56
- INLINECODE57 from INLINECODE58
- INLINECODE59 from INLINECODE60
- INLINECODE61 from INLINECODE62
- INLINECODE63 from INLINECODE64
- INLINECODE65 from INLINECODE66
- INLINECODE67 from INLINECODE68
- INLINECODE69 from INLINECODE70
- INLINECODE71 from INLINECODE72
Docs:
- - INLINECODE73
- INLINECODE74
- INLINECODE75
Cloudflare rule
Inside Cloudflare Workers:
- - prefer INLINECODE76
- if bundle files are not directly exposed as public URLs, pass a custom
fetch to INLINECODE78 - use the host asset loader such as
ASSETS.fetch(...) rather than monkey-patching global fetch
Docs:
- - INLINECODE80
- INLINECODE81
Read in this order when unsure
- 1. INLINECODE82
- INLINECODE83
- INLINECODE84
- INLINECODE85
Indexbind
当任务涉及从宿主应用程序或环境中使用 indexbind 时,请使用此技能。
使用示例
- - 使用 indexbind 为文档文件夹添加本地搜索功能。
- 帮我选择 indexbind、indexbind/web 和 indexbind/cloudflare。
- 演示如何为 Node 构建 SQLite 工件,并为 Workers 构建捆绑包。
安装
安装该包:
bash
npm install indexbind
当目标是在任意目录中将 indexbind 作为 shell 命令使用时,可选择全局安装:
bash
npm install -g indexbind
然后使用以下任一方式:
- - 本地安装和按项目工作流使用 npx indexbind ...
- 全局安装后使用 indexbind ...
- 编程式使用 import ... from indexbind 或 indexbind/build
平台说明:
- - 原生预构建版本支持 macOS arm64、macOS x64 和 Linux x64(glibc)
- Windows 使用应通过 WSL 进行
安装和打包文档:
- - https://indexbind.jolestar.workers.dev/guides/getting-started.md
- https://indexbind.jolestar.workers.dev/reference/packaging.md
选择正确的接口
- - 从 shell 索引本地文档文件夹或本地知识库目录:
使用 npx indexbind ...
- - 对已构建的 SQLite 工件进行本地 Node 查询:
使用 indexbind
使用 indexbind/build
- - 需要宿主定义文档分类、元数据或目录权重的混合本地知识库:
先在宿主中规范化文档,然后将其传递给 indexbind/build
在该目录的 .indexbind/ 旁使用 indexbind.build.js 和 indexbind.search.js
- - 对规范捆绑包进行浏览器或标准 Worker 查询:
使用 indexbind/web
使用 indexbind/cloudflare
- - Shell 驱动的构建/更新/导出/检查流程:
使用 npx indexbind ...
API 文档:
- - https://indexbind.jolestar.workers.dev/reference/api.md
- https://indexbind.jolestar.workers.dev/reference/cli.md
选择工件
构建原生 SQLite 工件
- - 为浏览器或 Worker 交付进行本地目录索引:
构建规范捆绑包
使用原生 SQLite 工件
- - 浏览器、Web Worker、Cloudflare Worker:
使用规范捆绑包
使用构建缓存,然后导出新工件或捆绑包
概念:
- - https://indexbind.jolestar.workers.dev/concepts/runtime-model.md
- https://indexbind.jolestar.workers.dev/concepts/canonical-bundles.md
常用命令
典型的 CLI 命令:
- - npx indexbind build ./docs
- npx indexbind build-bundle ./docs
- npx indexbind update-cache ./docs --git-diff
- npx indexbind build [input-dir] [output-file] [--backend ]
- npx indexbind build-bundle [input-dir] [output-dir] [--backend ]
- npx indexbind update-cache [input-dir] [cache-file] [--git-diff] [--git-base ] [--backend ]
- npx indexbind export-artifact [--cache-file ]
- npx indexbind export-bundle [--cache-file ]
- npx indexbind inspect
- npx indexbind search
- npx indexbind benchmark
当宿主已有内存中的文档或希望从代码中获得更紧密的控制时,请改用 indexbind/build。
索引范围约定
当一个索引根目录只需要少量宿主特定行为时,在该根目录旁放置约定文件:
text
docs/
indexbind.build.js
indexbind.search.js
.indexbind/
当默认目录扫描器已经正确,且你只需要以下操作时,使用 indexbind.build.js:
- - 跳过索引中的几个文件
- 推导 canonicalUrl
- 注入元数据,如 isdefaultsearchable、sourceroot、contentkind 或 directory_weight
- 规范化 title 或 summary
当 CLI 或 Node 搜索应自动应用以下内容时,使用 indexbind.search.js:
- - 默认搜索配置文件
- 元数据过滤器
- 分数调整默认值
- 轻量级查询重写或别名扩展
这些约定文件是索引范围的,而非仓库全局的:
- - 如果你索引 ./docs,文件位于 ./docs/
- 它们仅影响该索引根目录
- 没有仓库根目录回退
常用 API
当宿主已有文档或希望获得更紧密的控制时,使用这些 API:
- - 来自 indexbind 的 openIndex(...)
- 来自 indexbind/build 的 buildFromDirectory(...)
- 来自 indexbind/build 的 buildCanonicalBundle(...)
- 来自 indexbind/build 的 buildCanonicalBundleFromDirectory(...)
- 来自 indexbind/build 的 updateBuildCache(...)
- 来自 indexbind/build 的 updateBuildCacheFromDirectory(...)
- 来自 indexbind/build 的 exportArtifactFromBuildCache(...)
- 来自 indexbind/build 的 exportCanonicalBundleFromBuildCache(...)
- 来自 indexbind/build 的 inspectArtifact(...)
- 来自 indexbind/build 的 benchmarkArtifact(...)
- 来自 indexbind/web 的 openWebIndex(...)
- 来自 indexbind/cloudflare 的 openWebIndex(...)
文档:
- - https://indexbind.jolestar.workers.dev/reference/api.md
- https://indexbind.jolestar.workers.dev/guides/adoption-examples.md
- https://indexbind.jolestar.workers.dev/reference/cli.md
Cloudflare 规则
在 Cloudflare Workers 内部:
- - 优先使用 indexbind/cloudflare
- 如果捆绑文件未直接作为公共 URL 暴露,请向 openWebIndex(...) 传递自定义 fetch
- 使用宿主资源加载器(如 ASSETS.fetch(...)),而非猴子补丁全局 fetch
文档:
- - https://indexbind.jolestar.workers.dev/guides/web-and-cloudflare.md
- https://indexbind.jolestar.workers.dev/reference/api.md
不确定时按此顺序阅读
- 1. https://indexbind.jolestar.workers.dev/guides/getting-started.md
- https://indexbind.jolestar.workers.dev/reference/api.md
- https://indexbind.jolestar.workers.dev/reference/cli.md
- https://indexbind.jolestar.workers.dev/guides/web-and-cloudflare.md