docmd-search

中文文档
0.1.7发布于 2026/11/03MITTypeScriptES Module零依赖构建来源已验证

Offline semantic search engine for documentation. Local embeddings, browser-ready indexes.

原始使用文档
文档目录16 节
  1. docmd-search
  2. Quick Start
  3. Install for regular usage
  4. Features
  5. Offline by default
  6. Instant search
  7. Tiny client
  8. Built-in capabilities
  9. How It Works
  10. Models
  11. Configuration (optional)
  12. Programmatic Usage
  13. Project Structure
  14. Part of the docmd ecosystem
  15. Community & Support
  16. License

docmd-search

Search that understands meaning and runs in the browser.
Offline semantic search for any documentation site. Understands meaning, runs entirely in the browser, and never sends data to the cloud.

npm version downloads stars license

docmd-search preview

Website • Documentation • Report Bug

Quick Start

Run docmd-search instantly on any folder:

npx docmd-search ./docs

That's it.

  • Files are discovered and chunked automatically
  • Embeddings are generated locally (no cloud API)
  • Search is available in the terminal immediately

Install for regular usage

npm install -g docmd-search
# Install ML dependencies (one-time)
npm install -g @huggingface/transformers onnxruntime-node
docmd-search ./docs          # index + interactive search
docmd-search ./docs --ui     # index + web UI
docmd-search --settings      # configure model

Features

Designed to work offline, ship nothing to the browser, and stay out of your way.

Offline by default

  • All embeddings generated locally with ONNX Runtime
  • No data leaves your machine
  • No cloud API keys needed
  • Progressive indexing: search available from the first batch
  • Incremental: only re-indexes changed files
  • Resumable: interrupted indexing resumes from last checkpoint

Tiny client

  • Browser runtime is <3KB gzipped
  • No model weights in the browser
  • Hybrid scoring: keyword matching + vector similarity

Built-in capabilities

  • Multi-batch index format with automatic compression
  • Navigation tree generation for web UIs
  • First-run setup wizard with model selection
  • Interactive terminal search with live results

How It Works

Build time (Node.js)                    Search time (Browser, <3KB)
───────────────────                     ──────────────────────────
 Crawl files                             Load manifest.json
   → Chunk by heading                      → Load batch 000 (instant)
     → Embed via ONNX                        → Background-load rest
       → Quantize Float32 → Int8               → Keyword + cosine
         → Compress (ternary/PQ)                 → Ranked results
           → Save multi-batch index

Models

First run prompts you to select an embedding model:

ModelDimensionsSizeBest for
MiniLM L6 v2 ★384~30 MBFast, general purpose
BGE Small (English)384~45 MBEnglish-optimised
BGE Base (English)768~110 MBHigher quality
MPNet Base v2768~110 MBMultilingual

Change model later: docmd-search --settings

Configuration (optional)

No configuration is required to get started.

Global (~/.docmd-search/config.json):

{
  "model": "Xenova/all-MiniLM-L6-v2",
  "wizardCompleted": true
}

Per-project (_docmd-search/config.json):

{
  "model": "Xenova/bge-small-en-v1.5",
  "chunkSize": 512,
  "include": ["**/*.md"],
  "exclude": ["**/drafts/**"]
}

Config resolution: defaults → global → project → CLI flags.

Programmatic Usage

Use in scripts or CI pipelines:

import { indexDirectory, loadAllBatches } from 'docmd-search';

const index = await indexDirectory({
  rootDir: './docs',
  outDir: '_docmd-search',
});

Browser client:

import { load, search } from 'docmd-search/client';

await load('/path/to/_docmd-search');
const results = search('deploy kubernetes', 10);

Project Structure

Keeps the codebase flat and modular.

src/
├── bin/docmd-search.ts   # CLI entry point
├── client/index.ts       # Browser runtime (<3KB)
├── config.ts             # Config + model profiles
├── index-io.ts           # Multi-batch format + compression
├── index.ts              # Barrel exports
├── indexer/
│   ├── chunk.ts          # Heading-aware chunking
│   ├── crawl.ts          # File discovery
│   └── index.ts          # Progressive pipeline
├── model.ts              # ONNX embedding manager
├── tui.ts                # Terminal UI
├── types.ts              # Core types
└── ui/
    └── launcher.ts       # Web UI via docmd

Part of the docmd ecosystem

docmd-search works standalone with any documentation project. It also integrates with docmd as a semantic search plugin.

ToolWhat it does
docmdZero-config documentation generator
docmd-searchOffline semantic search engine

Community & Support

  • Contributions are welcome
  • If you find it useful, consider sponsoring or starring the repo ⭐

License

MIT License. See LICENSE for details.

版本与发布记录

docmd-search 共发布 10 个版本,首次发布于 2026/05/29;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.7latest2026/11/03今天
0.1.62026/09/271 个月前
0.1.52026/09/141 个月前
0.1.42026/09/141 个月前
0.1.32026/08/033 个月前
0.1.22026/08/033 个月前

关于 docmd-search 的常见问题

docmd-search 是什么?

文档的离线语义搜索引擎。本地嵌入,浏览器就绪索引。

如何安装 docmd-search?

在项目目录运行 npm install docmd-search,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 docmd-search,可以用 npx docmd-search 直接运行。

docmd-search 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

docmd-search 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

docmd-search 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

docmd-search 可以商用吗?

docmd-search 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

docmd-search 还在维护吗?

最新版本 0.1.7 发布于 2026/11/03(今天);至今共发布 10 个版本,其中过去 12 个月发布了 10 个;首次发布于 2026/05/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。