@tobilu/qmd 1.0.0 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,68 +1,313 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to QMD will be documented in this file.
3
+ ## [Unreleased]
4
+
5
+ ## [1.0.6] - 2026-02-16
6
+
7
+ ### Changes
8
+
9
+ - CLI: `qmd status` now shows models with full HuggingFace links instead of
10
+ static names in `--help`. Model info is derived from the actual configured
11
+ URIs so it stays accurate if models change.
12
+ - Release tooling: pre-push hook handles non-interactive shells (CI, editors)
13
+ gracefully — warnings auto-proceed instead of hanging on a tty prompt.
14
+ Annotated tags now resolve correctly for CI checks.
15
+
16
+ ## [1.0.5] - 2026-02-16
17
+
18
+ The npm package now ships compiled JavaScript instead of raw TypeScript,
19
+ removing the `tsx` runtime dependency. A new `/release` skill automates the
20
+ full release workflow with changelog validation and git hook enforcement.
21
+
22
+ ### Changes
23
+
24
+ - Build: compile TypeScript to `dist/` via `tsc` so the npm package no longer
25
+ requires `tsx` at runtime. The `qmd` shell wrapper now runs `dist/qmd.js`
26
+ directly.
27
+ - Release tooling: new `/release` skill that manages the full release
28
+ lifecycle — validates changelog, installs git hooks, previews release notes,
29
+ and cuts the release. Auto-populates `[Unreleased]` from git history when
30
+ empty.
31
+ - Release tooling: `scripts/extract-changelog.sh` extracts cumulative notes
32
+ for the full minor series (e.g. 1.0.0 through 1.0.5) for GitHub releases.
33
+ Includes `[Unreleased]` content in previews.
34
+ - Release tooling: `scripts/release.sh` renames `[Unreleased]` to a versioned
35
+ heading and inserts a fresh empty `[Unreleased]` section automatically.
36
+ - Release tooling: pre-push git hook blocks `v*` tag pushes unless
37
+ `package.json` version matches the tag, a changelog entry exists, and CI
38
+ passed on GitHub.
39
+ - Publish workflow: GitHub Actions now builds TypeScript, creates a GitHub
40
+ release with cumulative notes extracted from the changelog, and publishes
41
+ to npm with provenance.
4
42
 
5
43
  ## [1.0.0] - 2026-02-15
6
44
 
7
- ### Node.js Compatibility
45
+ QMD now runs on both Node.js and Bun, with up to 2.7x faster reranking
46
+ through parallel GPU contexts. GPU auto-detection replaces the unreliable
47
+ `gpu: "auto"` with explicit CUDA/Metal/Vulkan probing.
8
48
 
9
- QMD now runs on both **Node.js (>=22)** and **Bun**. Install with `npm install -g @tobilu/qmd` or `bun install -g @tobilu/qmd` — your choice. The `qmd` wrapper auto-detects Node.js via `tsx` and works out of the box with mise, asdf, nvm, and Homebrew installs.
49
+ ### Changes
10
50
 
11
- ### Performance
51
+ - Runtime: support Node.js (>=22) alongside Bun via a cross-runtime SQLite
52
+ abstraction layer (`src/db.ts`). `bun:sqlite` on Bun, `better-sqlite3` on
53
+ Node. The `qmd` wrapper auto-detects a suitable Node.js install via PATH,
54
+ then falls back to mise, asdf, nvm, and Homebrew locations.
55
+ - Performance: parallel embedding & reranking via multiple LlamaContext
56
+ instances — up to 2.7x faster on multi-core machines.
57
+ - Performance: flash attention for ~20% less VRAM per reranking context,
58
+ enabling more parallel contexts on GPU.
59
+ - Performance: right-sized reranker context (40960 → 2048 tokens, 17x less
60
+ memory) since chunks are capped at ~900 tokens.
61
+ - Performance: adaptive parallelism — context count computed from available
62
+ VRAM (GPU) or CPU math cores rather than hardcoded.
63
+ - GPU: probe for CUDA, Metal, Vulkan explicitly at startup instead of
64
+ relying on node-llama-cpp's `gpu: "auto"`. `qmd status` shows device info.
65
+ - Tests: reorganized into flat `test/` directory with vitest for Node.js and
66
+ bun test for Bun. New `eval-bm25` and `store.helpers.unit` suites.
12
67
 
13
- - **Parallel embedding & reranking** — multiple contexts split work across CPU cores (or VRAM on GPU), delivering up to **2.7x faster reranking** and significantly faster embedding on multi-core machines
14
- - **Flash attention** — ~20% less VRAM per reranking context, enabling more parallel contexts on GPU
15
- - **Right-sized contexts** — reranker context dropped from 40960 to 2048 tokens (17x less memory), since chunks are capped at ~900 tokens
16
- - **Adaptive parallelism** — automatically scales context count based on available VRAM (GPU) or CPU math cores
17
- - **CPU thread splitting** — each context runs on its own cores for true parallelism instead of contending on a single context
68
+ ### Fixes
18
69
 
19
- ### GPU Auto-Detection
70
+ - Prevent VRAM waste from duplicate context creation during concurrent
71
+ `embedBatch` calls — initialization lock now covers the full path.
72
+ - Collection-aware FTS filtering so scoped keyword search actually restricts
73
+ results to the requested collection.
74
+
75
+ ## [0.9.0] - 2026-02-15
20
76
 
21
- - Probes for CUDA, Metal, and Vulkan at startup uses the best available backend
22
- - Falls back gracefully to CPU with a warning if GPU init fails
23
- - `qmd status` now shows device info (GPU type, VRAM usage)
77
+ First published release on npm as `@tobilu/qmd`. MCP HTTP transport with
78
+ daemon mode cuts warm query latency from ~16s to ~10s by keeping models
79
+ loaded between requests.
24
80
 
25
- ### Test Suite
81
+ ### Changes
26
82
 
27
- - Tests split into `src/*.test.ts` (unit), `src/models/*.test.ts` (model), and `src/integration/*.test.ts` (CLI/integration)
28
- - Vitest config for Node.js; bun test still works for Bun
29
- - New `eval-bm25` and `store.helpers.unit` test suites
83
+ - MCP: HTTP transport with daemon lifecycle — `qmd mcp --http --daemon`
84
+ starts a background server, `qmd mcp stop` shuts it down. Models stay warm
85
+ in VRAM between queries. #149 (thanks @igrigorik)
86
+ - Search: type-routed query expansion preserves lex/vec/hyde type info and
87
+ routes to the appropriate backend. Eliminates ~4 wasted backend calls per
88
+ query (10.0 → 6.0 calls, 1278ms → 549ms). #149 (thanks @igrigorik)
89
+ - Search: unified pipeline — extracted `hybridQuery()` and
90
+ `vectorSearchQuery()` to `store.ts` so CLI and MCP share identical logic.
91
+ Fixes a class of bugs where results differed between the two. #149 (thanks
92
+ @igrigorik)
93
+ - MCP: dynamic instructions generated at startup from actual index state —
94
+ LLMs see collection names, doc counts, and content descriptions. #149
95
+ (thanks @igrigorik)
96
+ - MCP: tool renames (vsearch → vector_search, query → deep_search) with
97
+ rewritten descriptions for better tool selection. #149 (thanks @igrigorik)
98
+ - Integration: Claude Code plugin with inline status checks and MCP
99
+ integration. #99 (thanks @galligan)
30
100
 
31
101
  ### Fixes
32
102
 
33
- - Prevent VRAM waste from duplicate context creation during concurrent loads
34
- - Collection-aware FTS filtering for scoped keyword search
103
+ - BM25 score normalization formula was inverted (`1/(1+|x|)` instead of
104
+ `|x|/(1+|x|)`), so strong matches scored *lowest*. Broke `--min-score`
105
+ filtering and made the "strong signal" short-circuit dead code. #76 (thanks
106
+ @dgilperez)
107
+ - Normalize Unicode paths to NFC for macOS compatibility. #82 (thanks
108
+ @c-stoeckl)
109
+ - Handle dense content (code) that tokenizes beyond expected chunk size.
110
+ - Proper cleanup of Metal GPU resources on process exit.
111
+ - SQLite-vec readiness verification after extension load.
112
+ - Reactivate deactivated documents on re-index instead of creating duplicates.
113
+ - Bun UTF-8 path corruption workaround for non-ASCII filenames.
114
+ - Disable following symlinks in glob.scan to avoid infinite loops.
35
115
 
36
- ---
116
+ ## [0.8.0] - 2026-01-28
37
117
 
38
- ## [0.9.0] - 2026-02-15
118
+ Fine-tuned query expansion model trained with GRPO replaces the stock Qwen3
119
+ 0.6B. The training pipeline scores expansions on named entity preservation,
120
+ format compliance, and diversity — producing noticeably better lexical
121
+ variations and HyDE documents.
122
+
123
+ ### Changes
124
+
125
+ - LLM: deploy GRPO-trained (Group Relative Policy Optimization) query
126
+ expansion model, hosted on HuggingFace and auto-downloaded on first use.
127
+ Better preservation of proper nouns and technical terms in expansions.
128
+ - LLM: `/only:lex` mode for single-type expansions — useful when you know
129
+ which search backend will help.
130
+ - LLM: HyDE output moved to first position so vector search can start
131
+ embedding while other expansions generate.
132
+ - LLM: session lifecycle management via `withLLMSession()` pattern — ensures
133
+ cleanup even on failure, similar to database transactions.
134
+ - Integration: org-mode title extraction support. #50 (thanks @sh54)
135
+ - Integration: SQLite extension loading in Nix devshell. #48 (thanks @sh54)
136
+ - Integration: AI agent discovery via skills.sh. #64 (thanks @Algiras)
137
+
138
+ ### Fixes
39
139
 
40
- Initial public release.
140
+ - Use sequential embedding on CPU-only systems — parallel contexts caused a
141
+ race condition where contexts competed for CPU cores, making things slower.
142
+ #54 (thanks @freeman-jiang)
143
+ - Fix `collectionName` column in vector search SQL (was still using old
144
+ `collectionId` from before YAML migration). #61 (thanks @jdvmi00)
145
+ - Fix Qwen3 sampling params to prevent repetition loops — stock
146
+ temperature/top-p caused occasional infinite repeat patterns.
147
+ - Add `--index` option to CLI argument parser (was documented but not wired
148
+ up). #84 (thanks @Tritlo)
149
+ - Fix DisposedError during slow batch embedding. #41 (thanks @wuhup)
41
150
 
42
- ### Features
151
+ ## [0.7.0] - 2026-01-09
43
152
 
44
- - **Hybrid search pipeline** BM25 full-text + vector similarity + LLM reranking with Reciprocal Rank Fusion
45
- - **Smart chunking** scored markdown break points keep sections, paragraphs, and code blocks intact (~900 tokens/chunk, 15% overlap)
46
- - **Query expansion** fine-tuned Qwen3 1.7B model generates search variations for better recall
47
- - **Cross-encoder reranking** — Qwen3-Reranker scores candidates with position-aware blending
48
- - **Vector embeddings** — EmbeddingGemma 300M via node-llama-cpp, all on-device
49
- - **MCP server** — stdio and HTTP transports for Claude Desktop, Claude Code, and any MCP client
50
- - **Collection management** index multiple directories with glob patterns
51
- - **Context annotations** add descriptions to collections and paths for richer search
52
- - **Document IDs** 6-char content hash for stable references across re-indexes
53
- - **Multi-get**retrieve multiple documents by glob pattern, comma list, or docids
54
- - **Multiple output formats** JSON, CSV, Markdown, XML, files list
55
- - **Claude Code plugin** — inline status checks and MCP integration
153
+ First community contributions. The project gained external contributors,
154
+ surfacing bugs that only appear in diverse environments Homebrew sqlite-vec
155
+ paths, case-sensitive model filenames, and sqlite-vec JOIN incompatibilities.
156
+
157
+ ### Changes
158
+
159
+ - Indexing: native `realpathSync()` replaces `readlink -f` subprocess spawn
160
+ per file. On a 5000-file collection this eliminates 5000 shell spawns,
161
+ ~15% faster. #8 (thanks @burke)
162
+ - Indexing: single-pass tokenization chunking algorithm tokenized each
163
+ document twice (count then split); now tokenizes once and reuses. #9
164
+ (thanks @burke)
56
165
 
57
166
  ### Fixes
58
167
 
59
- - Handle dense content (code) that tokenizes beyond expected chunk size
60
- - Proper cleanup of Metal GPU resources
61
- - SQLite-vec readiness verification after extension load
62
- - Reactivate deactivated documents on re-index
63
- - BM25 score normalization with Math.abs
64
- - Bun UTF-8 path corruption workaround
168
+ - Fix `vsearch` and `query` hanging sqlite-vec's virtual table doesn't
169
+ support the JOIN pattern used; rewrote to subquery. #23 (thanks @mbrendan)
170
+ - Fix MCP server exiting immediately after startup — process had no active
171
+ handles keeping the event loop alive. #29 (thanks @mostlydev)
172
+ - Fix collection filter SQL to properly restrict vector search results.
173
+ - Support non-ASCII filenames in collection filter.
174
+ - Skip empty files during indexing instead of crashing on zero-length content.
175
+ - Fix case sensitivity in Qwen3 model filename resolution. #15 (thanks
176
+ @gavrix)
177
+ - Fix sqlite-vec loading on macOS with Homebrew (`BREW_PREFIX` detection).
178
+ #42 (thanks @komsit37)
179
+ - Fix Nix flake to use correct `src/qmd.ts` path. #7 (thanks @burke)
180
+ - Fix docid lookup with quotes support in get command. #36 (thanks
181
+ @JoshuaLelon)
182
+ - Fix query expansion model size in documentation. #38 (thanks @odysseus0)
183
+
184
+ ## [0.6.0] - 2025-12-28
185
+
186
+ Replaced Ollama HTTP API with node-llama-cpp for all LLM operations. Ollama
187
+ adds convenience but also a running server dependency. node-llama-cpp loads
188
+ GGUF models directly in-process — zero external dependencies. Models
189
+ auto-download from HuggingFace on first use.
190
+
191
+ ### Changes
192
+
193
+ - LLM: structured query expansion via JSON schema grammar constraints.
194
+ Model produces typed expansions — **lexical** (BM25 keywords), **vector**
195
+ (semantic rephrasings), **HyDE** (hypothetical document excerpts) — so each
196
+ routes to the right backend instead of sending everything everywhere.
197
+ - LLM: lazy model loading with 2-minute inactivity auto-unload. Keeps memory
198
+ low when idle while avoiding ~3s model load on every query.
199
+ - Search: conditional query expansion — when BM25 returns strong results, the
200
+ expensive LLM expansion is skipped entirely.
201
+ - Search: multi-chunk reranking — documents with multiple relevant chunks
202
+ scored by aggregating across all chunks rather than best single chunk.
203
+ - Search: cosine distance for vector search (was L2).
204
+ - Search: embeddinggemma nomic-style prompt formatting.
205
+ - Testing: evaluation harness with synthetic test documents and Hit@K metrics
206
+ for BM25, vector, and hybrid RRF.
207
+
208
+ ## [0.5.0] - 2025-12-13
209
+
210
+ Collections and contexts moved from SQLite tables to YAML at
211
+ `~/.config/qmd/index.yml`. SQLite was overkill for config — you can't share
212
+ it, and it's opaque. YAML is human-readable and version-controllable. The
213
+ migration was extensive (35+ commits) because every part of the system that
214
+ touched collections or contexts had to be updated.
215
+
216
+ ### Changes
217
+
218
+ - Config: YAML-based collections and contexts replace SQLite tables.
219
+ `collections` and `path_contexts` tables dropped from schema. Collections
220
+ support an optional `update:` command (e.g., `git pull`) before re-index.
221
+ - CLI: `qmd collection add/list/remove/rename` commands with `--name` and
222
+ `--mask` glob pattern support.
223
+ - CLI: `qmd ls` virtual file tree — list collections, files in a collection,
224
+ or files under a path prefix.
225
+ - CLI: `qmd context add/list/check/rm` with hierarchical context inheritance.
226
+ A query to `qmd://notes/2024/jan/` inherits context from `notes/`,
227
+ `notes/2024/`, and `notes/2024/jan/`.
228
+ - CLI: `qmd context add / "text"` for global context across all collections.
229
+ - CLI: `qmd context check` audit command to find paths without context.
230
+ - Paths: `qmd://` virtual URI scheme for portable document references.
231
+ `qmd://notes/ideas.md` works regardless of where the collection lives on
232
+ disk. Works in `get`, `multi-get`, `ls`, and context commands.
233
+ - CLI: document IDs (docid) — first 6 chars of content hash for stable
234
+ references. Shown as `#abc123` in search results, usable with `get` and
235
+ `multi-get`.
236
+ - CLI: `--line-numbers` flag for get command output.
237
+
238
+ ## [0.4.0] - 2025-12-10
239
+
240
+ MCP server for AI agent integration. Without it, agents had to shell out to
241
+ `qmd search` and parse CLI output. The monolithic `qmd.ts` (1840 lines) was
242
+ split into focused modules with the project's first test suite (215 tests).
243
+
244
+ ### Changes
245
+
246
+ - MCP: stdio server with tools for search, vector search, hybrid query,
247
+ document retrieval, and status. Runs over stdio transport for Claude
248
+ Desktop and MCP clients.
249
+ - MCP: spec-compliant with June 2025 MCP specification — removed non-spec
250
+ `mimeType`, added `isError: true` to errors, `structuredContent` for
251
+ machine-readable results, proper URI encoding.
252
+ - MCP: simplified tool naming (`qmd_search` → `search`) since MCP already
253
+ namespaces by server.
254
+ - Architecture: extract `store.ts` (1221 LOC), `llm.ts` (539 LOC),
255
+ `formatter.ts` (359 LOC), `mcp.ts` (503 LOC) from monolithic `qmd.ts`.
256
+ - Testing: 215 tests (store: 96, llm: 60, mcp: 59) with mocked Ollama for
257
+ fast, deterministic runs. Before this: zero tests.
258
+
259
+ ## [0.3.0] - 2025-12-08
260
+
261
+ Document chunking for vector search. A 5000-word document about many topics
262
+ gets a single embedding that averages everything together, matching poorly for
263
+ specific queries. Chunking produces one embedding per ~900-token section with
264
+ focused semantic signal.
265
+
266
+ ### Changes
267
+
268
+ - Search: markdown-aware chunking — prefers heading boundaries, then paragraph
269
+ breaks, then sentence boundaries. 15% overlap between chunks ensures
270
+ cross-boundary queries still match.
271
+ - Search: multi-chunk scoring bonus (+0.02 per additional chunk, capped at
272
+ +0.1 for 5+ chunks). Documents relevant in multiple sections rank higher.
273
+ - CLI: display paths show collection-relative paths and extracted titles
274
+ (from H1 headings or YAML frontmatter) instead of raw filesystem paths.
275
+ - CLI: `--all` flag returns all matches (use with `--min-score` to filter).
276
+ - CLI: byte-based progress bar with ETA for `embed` command.
277
+ - CLI: human-readable time formatting ("15m 4s" instead of "904.2s").
278
+ - CLI: documents >64KB truncated with warning during embedding.
279
+
280
+ ## [0.2.0] - 2025-12-08
281
+
282
+ ### Changes
283
+
284
+ - CLI: `--json`, `--csv`, `--files`, `--md`, `--xml` output format flags.
285
+ `--json` for programmatic access, `--files` for piping, `--md`/`--xml` for
286
+ LLM consumption, `--csv` for spreadsheets.
287
+ - CLI: `qmd status` shows index health — document count, size, embedding
288
+ coverage, time since last update.
289
+ - Search: weighted RRF — original query gets 2x weight relative to expanded
290
+ queries since the user's actual words are a more reliable signal.
291
+
292
+ ## [0.1.0] - 2025-12-07
293
+
294
+ Initial implementation. Built in a single day for searching personal markdown
295
+ notes, journals, and meeting transcripts.
296
+
297
+ ### Changes
298
+
299
+ - Search: SQLite FTS5 with BM25 ranking. Chose SQLite over Elasticsearch
300
+ because QMD is a personal tool — single binary, no server dependencies.
301
+ - Search: sqlite-vec for vector similarity. Same rationale: in-process, no
302
+ external vector database.
303
+ - Search: Reciprocal Rank Fusion to combine BM25 and vector results. RRF is
304
+ parameter-free and handles missing signals gracefully.
305
+ - LLM: Ollama for embeddings, reranking, and query expansion. Later replaced
306
+ with node-llama-cpp in 0.6.0.
307
+ - CLI: `qmd add`, `qmd embed`, `qmd search`, `qmd vsearch`, `qmd query`,
308
+ `qmd get`. ~1800 lines of TypeScript in a single `qmd.ts` file.
65
309
 
310
+ [Unreleased]: https://github.com/tobi/qmd/compare/v1.0.0...HEAD
66
311
  [1.0.0]: https://github.com/tobi/qmd/releases/tag/v1.0.0
67
- [0.9.0]: https://github.com/tobi/qmd/releases/tag/v0.9.0
312
+ [0.9.0]: https://github.com/tobi/qmd/compare/v0.8.0...v0.9.0
68
313
 
package/README.md CHANGED
@@ -6,6 +6,8 @@ QMD combines BM25 full-text search, vector semantic search, and LLM re-ranking
6
6
 
7
7
  ![QMD Architecture](assets/qmd-architecture.png)
8
8
 
9
+ You can read more about QMD's progress in the [CHANGELOG](CHANGELOG.md).
10
+
9
11
  ## Quick Start
10
12
 
11
13
  ```sh
@@ -23,7 +25,7 @@ qmd collection add ~/notes --name notes
23
25
  qmd collection add ~/Documents/meetings --name meetings
24
26
  qmd collection add ~/work/docs --name docs
25
27
 
26
- # Add context to help with search results
28
+ # Add context to help with search results, each piece of context will be returned when matching sub documents are returned. This works as a tree. This is the key feature of QMD as it allows LLMs to make much better contextual choices when selecting documents. Don't sleep on it!
27
29
  qmd context add qmd://notes "Personal notes and ideas"
28
30
  qmd context add qmd://meetings "Meeting transcripts and notes"
29
31
  qmd context add qmd://docs "Work documentation"
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Collections configuration management
3
+ *
4
+ * This module manages the YAML-based collection configuration at ~/.config/qmd/index.yml.
5
+ * Collections define which directories to index and their associated contexts.
6
+ */
7
+ /**
8
+ * Context definitions for a collection
9
+ * Key is path prefix (e.g., "/", "/2024", "/Board of Directors")
10
+ * Value is the context description
11
+ */
12
+ export type ContextMap = Record<string, string>;
13
+ /**
14
+ * A single collection configuration
15
+ */
16
+ export interface Collection {
17
+ path: string;
18
+ pattern: string;
19
+ context?: ContextMap;
20
+ update?: string;
21
+ }
22
+ /**
23
+ * The complete configuration file structure
24
+ */
25
+ export interface CollectionConfig {
26
+ global_context?: string;
27
+ collections: Record<string, Collection>;
28
+ }
29
+ /**
30
+ * Collection with its name (for return values)
31
+ */
32
+ export interface NamedCollection extends Collection {
33
+ name: string;
34
+ }
35
+ /**
36
+ * Set the current index name for config file lookup
37
+ * Config file will be ~/.config/qmd/{indexName}.yml
38
+ */
39
+ export declare function setConfigIndexName(name: string): void;
40
+ /**
41
+ * Load configuration from ~/.config/qmd/index.yml
42
+ * Returns empty config if file doesn't exist
43
+ */
44
+ export declare function loadConfig(): CollectionConfig;
45
+ /**
46
+ * Save configuration to ~/.config/qmd/index.yml
47
+ */
48
+ export declare function saveConfig(config: CollectionConfig): void;
49
+ /**
50
+ * Get a specific collection by name
51
+ * Returns null if not found
52
+ */
53
+ export declare function getCollection(name: string): NamedCollection | null;
54
+ /**
55
+ * List all collections
56
+ */
57
+ export declare function listCollections(): NamedCollection[];
58
+ /**
59
+ * Add or update a collection
60
+ */
61
+ export declare function addCollection(name: string, path: string, pattern?: string): void;
62
+ /**
63
+ * Remove a collection
64
+ */
65
+ export declare function removeCollection(name: string): boolean;
66
+ /**
67
+ * Rename a collection
68
+ */
69
+ export declare function renameCollection(oldName: string, newName: string): boolean;
70
+ /**
71
+ * Get global context
72
+ */
73
+ export declare function getGlobalContext(): string | undefined;
74
+ /**
75
+ * Set global context
76
+ */
77
+ export declare function setGlobalContext(context: string | undefined): void;
78
+ /**
79
+ * Get all contexts for a collection
80
+ */
81
+ export declare function getContexts(collectionName: string): ContextMap | undefined;
82
+ /**
83
+ * Add or update a context for a specific path in a collection
84
+ */
85
+ export declare function addContext(collectionName: string, pathPrefix: string, contextText: string): boolean;
86
+ /**
87
+ * Remove a context from a collection
88
+ */
89
+ export declare function removeContext(collectionName: string, pathPrefix: string): boolean;
90
+ /**
91
+ * List all contexts across all collections
92
+ */
93
+ export declare function listAllContexts(): Array<{
94
+ collection: string;
95
+ path: string;
96
+ context: string;
97
+ }>;
98
+ /**
99
+ * Find best matching context for a given collection and path
100
+ * Returns the most specific matching context (longest path prefix match)
101
+ */
102
+ export declare function findContextForPath(collectionName: string, filePath: string): string | undefined;
103
+ /**
104
+ * Get the config file path (useful for error messages)
105
+ */
106
+ export declare function getConfigPath(): string;
107
+ /**
108
+ * Check if config file exists
109
+ */
110
+ export declare function configExists(): boolean;
111
+ /**
112
+ * Validate a collection name
113
+ * Collection names must be valid and not contain special characters
114
+ */
115
+ export declare function isValidCollectionName(name: string): boolean;