2025-12-08 08:16:16 +08:00
|
|
|
{
|
2026-02-16 03:07:26 +08:00
|
|
|
"name": "@tobilu/qmd",
|
2026-04-06 06:18:41 +08:00
|
|
|
"version": "2.1.0",
|
2026-02-16 02:31:23 +08:00
|
|
|
"description": "Query Markup Documents - On-device hybrid search for markdown files with BM25, vector search, and LLM reranking",
|
2025-12-08 08:16:16 +08:00
|
|
|
"type": "module",
|
feat: add SDK/library mode for programmatic access
Allow QMD to be used as a library (`import { createStore } from '@tobilu/qmd'`)
in addition to CLI and MCP modes. The constructor requires explicit dbPath and
either a configPath (YAML file) or inline config object — no defaults assumed,
making it safe to embed in any application.
- Add src/index.ts entry point with QMDStore interface exposing search,
retrieval, collection/context management, and index health
- Add setConfigSource() to collections.ts for inline config support
(in-memory config with no file I/O)
- Add main/types/exports fields to package.json
- Add SDK documentation section to README
- Add 56 unit tests covering constructor, collections, contexts, search,
document retrieval, config isolation, YAML persistence, and lifecycle
2026-03-09 03:59:22 +08:00
|
|
|
"main": "dist/index.js",
|
|
|
|
|
"types": "dist/index.d.ts",
|
|
|
|
|
"exports": {
|
|
|
|
|
".": {
|
|
|
|
|
"import": "./dist/index.js",
|
|
|
|
|
"types": "./dist/index.d.ts"
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-12-08 08:16:16 +08:00
|
|
|
"bin": {
|
2026-03-10 23:43:00 +08:00
|
|
|
"qmd": "bin/qmd"
|
2025-12-08 08:16:16 +08:00
|
|
|
},
|
2026-02-16 02:31:23 +08:00
|
|
|
"files": [
|
2026-03-10 23:43:00 +08:00
|
|
|
"bin/",
|
2026-02-16 20:42:05 +08:00
|
|
|
"dist/",
|
2026-02-16 02:31:23 +08:00
|
|
|
"LICENSE",
|
|
|
|
|
"CHANGELOG.md"
|
|
|
|
|
],
|
2025-12-08 08:16:16 +08:00
|
|
|
"scripts": {
|
2026-02-16 20:42:05 +08:00
|
|
|
"prepare": "[ -d .git ] && ./scripts/install-hooks.sh || true",
|
2026-03-10 23:39:55 +08:00
|
|
|
"build": "tsc -p tsconfig.build.json && printf '#!/usr/bin/env node\n' | cat - dist/cli/qmd.js > dist/cli/qmd.tmp && mv dist/cli/qmd.tmp dist/cli/qmd.js && chmod +x dist/cli/qmd.js",
|
2026-02-16 09:37:47 +08:00
|
|
|
"test": "vitest run --reporter=verbose test/",
|
2026-03-10 23:39:55 +08:00
|
|
|
"qmd": "tsx src/cli/qmd.ts",
|
|
|
|
|
"index": "tsx src/cli/qmd.ts index",
|
|
|
|
|
"vector": "tsx src/cli/qmd.ts vector",
|
|
|
|
|
"search": "tsx src/cli/qmd.ts search",
|
|
|
|
|
"vsearch": "tsx src/cli/qmd.ts vsearch",
|
|
|
|
|
"rerank": "tsx src/cli/qmd.ts rerank",
|
|
|
|
|
"inspector": "npx @modelcontextprotocol/inspector tsx src/cli/qmd.ts mcp",
|
2026-02-16 02:31:23 +08:00
|
|
|
"release": "./scripts/release.sh"
|
|
|
|
|
},
|
|
|
|
|
"publishConfig": {
|
|
|
|
|
"access": "public"
|
|
|
|
|
},
|
|
|
|
|
"repository": {
|
|
|
|
|
"type": "git",
|
|
|
|
|
"url": "git+https://github.com/tobi/qmd.git"
|
|
|
|
|
},
|
|
|
|
|
"homepage": "https://github.com/tobi/qmd#readme",
|
|
|
|
|
"bugs": {
|
|
|
|
|
"url": "https://github.com/tobi/qmd/issues"
|
2025-12-08 08:16:16 +08:00
|
|
|
},
|
|
|
|
|
"dependencies": {
|
2026-04-06 06:17:02 +08:00
|
|
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
|
|
|
"better-sqlite3": "12.8.0",
|
|
|
|
|
"fast-glob": "3.3.3",
|
|
|
|
|
"node-llama-cpp": "3.18.1",
|
2026-06-23 19:13:04 +08:00
|
|
|
"pg": "8.13.1",
|
2026-04-06 06:17:02 +08:00
|
|
|
"picomatch": "4.0.4",
|
|
|
|
|
"sqlite-vec": "0.1.9",
|
feat: AST-aware chunking for code files via tree-sitter
Add opt-in AST-aware chunk boundary detection for code files using
web-tree-sitter. When enabled with `--chunk-strategy auto`, code files
(.ts, .tsx, .js, .jsx, .py, .go, .rs) are chunked at function, class,
and import boundaries instead of arbitrary text positions. Default
behavior (`regex`) is unchanged — no surprises on upgrade.
In testing on QMD's own codebase, AST mode split 42% fewer function
bodies across chunk boundaries compared to regex-only chunking.
Usage:
qmd embed --chunk-strategy auto
qmd query "search terms" --chunk-strategy auto
What's included:
- Language detection from file extension with support for TypeScript,
JavaScript (including arrow functions and function expressions),
Python, Go, and Rust
- Per-language tree-sitter queries with scored break points aligned to
the existing markdown scale (class=100, function=90, type=80, import=60)
- AST break points merged with regex break points — highest score wins
at each position, so embedded markdown (comments, docstrings) still
benefits from regex patterns
- Refactored chunking core: chunkDocumentWithBreakPoints() extracted,
mergeBreakPoints() added, async chunkDocumentAsync() wrapper for AST
- ChunkStrategy type ("auto" | "regex") threaded through
generateEmbeddings(), hybridQuery(), structuredSearch(), CLI, and SDK
- getASTStatus() health check wired into `qmd status`
- Parse failures log a warning and fall back to regex — never crash
Hardening:
- Grammar packages are optionalDependencies with pinned versions to
prevent ABI breaks from semver drift
- web-tree-sitter is a direct dependency (pinned)
- Errors are logged (not silently swallowed) for debuggability
- Tested on both Node.js and Bun (Bun is actually faster)
Testing:
- 26 unit tests (test/ast.test.ts) — all 4 languages, error handling
- 7 integration tests (test/store.test.ts) — merge, equivalence, bypass
- Standalone test-ast-chunking.mjs with 63 synthetic tests and a
real-collection performance scanner (npx tsx test-ast-chunking.mjs ~/code)
- Validated end-to-end with qmd embed + qmd query on QMD's own codebase
- Zero markdown regressions across all test paths
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 13:22:39 +08:00
|
|
|
"web-tree-sitter": "0.26.7",
|
2026-04-06 06:17:02 +08:00
|
|
|
"yaml": "2.8.3",
|
2026-03-12 11:09:24 +08:00
|
|
|
"zod": "4.2.1"
|
2025-12-08 08:16:16 +08:00
|
|
|
},
|
|
|
|
|
"optionalDependencies": {
|
2026-04-06 06:17:02 +08:00
|
|
|
"sqlite-vec-darwin-arm64": "0.1.9",
|
|
|
|
|
"sqlite-vec-darwin-x64": "0.1.9",
|
|
|
|
|
"sqlite-vec-linux-arm64": "0.1.9",
|
|
|
|
|
"sqlite-vec-linux-x64": "0.1.9",
|
|
|
|
|
"sqlite-vec-windows-x64": "0.1.9",
|
feat: AST-aware chunking for code files via tree-sitter
Add opt-in AST-aware chunk boundary detection for code files using
web-tree-sitter. When enabled with `--chunk-strategy auto`, code files
(.ts, .tsx, .js, .jsx, .py, .go, .rs) are chunked at function, class,
and import boundaries instead of arbitrary text positions. Default
behavior (`regex`) is unchanged — no surprises on upgrade.
In testing on QMD's own codebase, AST mode split 42% fewer function
bodies across chunk boundaries compared to regex-only chunking.
Usage:
qmd embed --chunk-strategy auto
qmd query "search terms" --chunk-strategy auto
What's included:
- Language detection from file extension with support for TypeScript,
JavaScript (including arrow functions and function expressions),
Python, Go, and Rust
- Per-language tree-sitter queries with scored break points aligned to
the existing markdown scale (class=100, function=90, type=80, import=60)
- AST break points merged with regex break points — highest score wins
at each position, so embedded markdown (comments, docstrings) still
benefits from regex patterns
- Refactored chunking core: chunkDocumentWithBreakPoints() extracted,
mergeBreakPoints() added, async chunkDocumentAsync() wrapper for AST
- ChunkStrategy type ("auto" | "regex") threaded through
generateEmbeddings(), hybridQuery(), structuredSearch(), CLI, and SDK
- getASTStatus() health check wired into `qmd status`
- Parse failures log a warning and fall back to regex — never crash
Hardening:
- Grammar packages are optionalDependencies with pinned versions to
prevent ABI breaks from semver drift
- web-tree-sitter is a direct dependency (pinned)
- Errors are logged (not silently swallowed) for debuggability
- Tested on both Node.js and Bun (Bun is actually faster)
Testing:
- 26 unit tests (test/ast.test.ts) — all 4 languages, error handling
- 7 integration tests (test/store.test.ts) — merge, equivalence, bypass
- Standalone test-ast-chunking.mjs with 63 synthetic tests and a
real-collection performance scanner (npx tsx test-ast-chunking.mjs ~/code)
- Validated end-to-end with qmd embed + qmd query on QMD's own codebase
- Zero markdown regressions across all test paths
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 13:22:39 +08:00
|
|
|
"tree-sitter-go": "0.23.4",
|
|
|
|
|
"tree-sitter-python": "0.23.4",
|
|
|
|
|
"tree-sitter-rust": "0.24.0",
|
|
|
|
|
"tree-sitter-typescript": "0.23.2"
|
2025-12-08 08:16:16 +08:00
|
|
|
},
|
|
|
|
|
"devDependencies": {
|
2026-04-06 06:17:02 +08:00
|
|
|
"@types/better-sqlite3": "7.6.13",
|
2026-06-23 19:13:04 +08:00
|
|
|
"@types/pg": "8.11.10",
|
2026-04-06 06:17:02 +08:00
|
|
|
"tsx": "4.21.0",
|
|
|
|
|
"vitest": "3.2.4"
|
2026-04-06 06:13:31 +08:00
|
|
|
},
|
|
|
|
|
"pnpm": {
|
|
|
|
|
"onlyBuiltDependencies": [
|
|
|
|
|
"better-sqlite3",
|
|
|
|
|
"esbuild",
|
|
|
|
|
"node-llama-cpp",
|
|
|
|
|
"tree-sitter-go",
|
|
|
|
|
"tree-sitter-javascript",
|
|
|
|
|
"tree-sitter-python",
|
|
|
|
|
"tree-sitter-rust",
|
|
|
|
|
"tree-sitter-typescript"
|
|
|
|
|
]
|
2025-12-08 08:16:16 +08:00
|
|
|
},
|
|
|
|
|
"peerDependencies": {
|
2025-12-22 02:50:17 +08:00
|
|
|
"typescript": "^5.9.3"
|
2025-12-08 08:16:16 +08:00
|
|
|
},
|
|
|
|
|
"engines": {
|
2026-02-16 04:44:47 +08:00
|
|
|
"node": ">=22.0.0"
|
2025-12-08 08:16:16 +08:00
|
|
|
},
|
|
|
|
|
"keywords": [
|
|
|
|
|
"markdown",
|
|
|
|
|
"search",
|
|
|
|
|
"fts",
|
2026-02-16 02:31:23 +08:00
|
|
|
"full-text-search",
|
2025-12-08 08:16:16 +08:00
|
|
|
"vector",
|
2026-02-16 02:31:23 +08:00
|
|
|
"semantic-search",
|
2025-12-08 08:16:16 +08:00
|
|
|
"sqlite",
|
|
|
|
|
"bm25",
|
|
|
|
|
"embeddings",
|
2026-02-16 02:31:23 +08:00
|
|
|
"rag",
|
|
|
|
|
"mcp",
|
|
|
|
|
"reranking",
|
|
|
|
|
"knowledge-base",
|
|
|
|
|
"local-ai",
|
|
|
|
|
"llm"
|
2025-12-08 08:16:16 +08:00
|
|
|
],
|
2026-02-16 03:14:45 +08:00
|
|
|
"author": "Tobi Lutke <tobi@lutke.com>",
|
2025-12-08 08:16:16 +08:00
|
|
|
"license": "MIT"
|
|
|
|
|
}
|