bluera-knowledge 0.13.1 → 0.13.3

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.
@@ -3,7 +3,7 @@ import {
3
3
  createLogger,
4
4
  summarizePayload,
5
5
  truncateForLog
6
- } from "./chunk-6ZVW2P2F.js";
6
+ } from "./chunk-AJI5DCKY.js";
7
7
 
8
8
  // src/crawl/intelligent-crawler.ts
9
9
  import { EventEmitter } from "events";
@@ -753,4 +753,4 @@ var IntelligentCrawler = class extends EventEmitter {
753
753
  export {
754
754
  IntelligentCrawler
755
755
  };
756
- //# sourceMappingURL=chunk-GCUKVV33.js.map
756
+ //# sourceMappingURL=chunk-AOSDVRRH.js.map
@@ -7,7 +7,7 @@ import {
7
7
  createStoreId,
8
8
  destroyServices,
9
9
  summarizePayload
10
- } from "./chunk-6ZVW2P2F.js";
10
+ } from "./chunk-AJI5DCKY.js";
11
11
 
12
12
  // src/mcp/server.ts
13
13
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -2151,4 +2151,4 @@ export {
2151
2151
  createMCPServer,
2152
2152
  runMCPServer
2153
2153
  };
2154
- //# sourceMappingURL=chunk-H5AKKHY7.js.map
2154
+ //# sourceMappingURL=chunk-XL2UHMBL.js.map
package/dist/index.js CHANGED
@@ -7,10 +7,10 @@ import {
7
7
  isWebStoreDefinition,
8
8
  runMCPServer,
9
9
  spawnBackgroundWorker
10
- } from "./chunk-H5AKKHY7.js";
10
+ } from "./chunk-XL2UHMBL.js";
11
11
  import {
12
12
  IntelligentCrawler
13
- } from "./chunk-GCUKVV33.js";
13
+ } from "./chunk-AOSDVRRH.js";
14
14
  import {
15
15
  ASTParser,
16
16
  AdapterRegistry,
@@ -24,7 +24,7 @@ import {
24
24
  err,
25
25
  extractRepoName,
26
26
  ok
27
- } from "./chunk-6ZVW2P2F.js";
27
+ } from "./chunk-AJI5DCKY.js";
28
28
  import "./chunk-HRQD3MPH.js";
29
29
 
30
30
  // src/index.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createMCPServer,
3
3
  runMCPServer
4
- } from "../chunk-H5AKKHY7.js";
5
- import "../chunk-6ZVW2P2F.js";
4
+ } from "../chunk-XL2UHMBL.js";
5
+ import "../chunk-AJI5DCKY.js";
6
6
  import "../chunk-HRQD3MPH.js";
7
7
  export {
8
8
  createMCPServer,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  IntelligentCrawler
4
- } from "../chunk-GCUKVV33.js";
4
+ } from "../chunk-AOSDVRRH.js";
5
5
  import {
6
6
  JobService,
7
7
  createDocumentId,
@@ -10,7 +10,7 @@ import {
10
10
  createStoreId,
11
11
  destroyServices,
12
12
  shutdownLogger
13
- } from "../chunk-6ZVW2P2F.js";
13
+ } from "../chunk-AJI5DCKY.js";
14
14
  import "../chunk-HRQD3MPH.js";
15
15
 
16
16
  // src/workers/background-worker-cli.ts
package/docs/cli.md ADDED
@@ -0,0 +1,170 @@
1
+ # CLI Reference
2
+
3
+ Complete reference for the Bluera Knowledge CLI tool (npm package).
4
+
5
+ > **Note:** When using CLI without Claude Code installed, web crawling uses simple BFS mode. Install Claude Code to unlock `--crawl` (AI-guided URL selection) and `--extract` (AI content extraction) instructions.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ # Global install (CLI available everywhere)
11
+ npm install -g bluera-knowledge
12
+
13
+ # Or project install
14
+ npm install --save-dev bluera-knowledge
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Store Management
20
+
21
+ ### Create a Store
22
+
23
+ ```bash
24
+ # Add a Git repository
25
+ bluera-knowledge store create react --type repo --source https://github.com/facebook/react
26
+
27
+ # Add a Git repository with specific branch
28
+ bluera-knowledge store create react-canary --type repo --source https://github.com/facebook/react --branch canary
29
+
30
+ # Add a local folder
31
+ bluera-knowledge store create my-docs --type file --source ./docs
32
+
33
+ # Add a web crawl
34
+ bluera-knowledge store create fastapi-docs --type web --source https://fastapi.tiangolo.com
35
+ ```
36
+
37
+ **Create Options:**
38
+
39
+ | Option | Description |
40
+ |--------|-------------|
41
+ | `-t, --type <type>` | Store type: `file`, `repo`, or `web` (required) |
42
+ | `-s, --source <path>` | Local path or URL (required) |
43
+ | `-b, --branch <branch>` | Git branch to clone (repo stores only) |
44
+ | `-d, --description <desc>` | Optional store description |
45
+ | `--tags <tags>` | Comma-separated tags for filtering |
46
+
47
+ ### List Stores
48
+
49
+ ```bash
50
+ bluera-knowledge store list
51
+ bluera-knowledge store list --type repo # Filter by type
52
+ ```
53
+
54
+ ### Store Info
55
+
56
+ ```bash
57
+ bluera-knowledge store info react
58
+ ```
59
+
60
+ ### Delete a Store
61
+
62
+ ```bash
63
+ # Interactive deletion (prompts for confirmation in TTY mode)
64
+ bluera-knowledge store delete old-store
65
+
66
+ # Force delete without confirmation
67
+ bluera-knowledge store delete old-store --force
68
+ bluera-knowledge store delete old-store -y
69
+ ```
70
+
71
+ **Delete Options:**
72
+
73
+ | Option | Description |
74
+ |--------|-------------|
75
+ | `-f, --force` | Delete without confirmation prompt |
76
+ | `-y, --yes` | Alias for `--force` |
77
+
78
+ ---
79
+
80
+ ## Indexing
81
+
82
+ ### Index a Store
83
+
84
+ ```bash
85
+ # Re-index a store (only changed files)
86
+ bluera-knowledge index react
87
+
88
+ # Force re-index all files (ignores cache)
89
+ bluera-knowledge index react --force
90
+
91
+ # Watch for changes and auto-reindex
92
+ bluera-knowledge index watch react
93
+ bluera-knowledge index watch react --debounce 2000 # Custom debounce (default: 1000ms)
94
+ ```
95
+
96
+ **Index Options:**
97
+
98
+ | Option | Description |
99
+ |--------|-------------|
100
+ | `-f, --force` | Re-index all files (ignore incremental cache) |
101
+
102
+ **Watch Options:**
103
+
104
+ | Option | Description |
105
+ |--------|-------------|
106
+ | `--debounce <ms>` | Debounce delay for file changes (default: 1000ms) |
107
+
108
+ ---
109
+
110
+ ## Searching
111
+
112
+ ```bash
113
+ # Search across all stores
114
+ bluera-knowledge search "how does useEffect work"
115
+
116
+ # Search specific stores
117
+ bluera-knowledge search "routing" --stores react,vue
118
+
119
+ # Get more results with full content
120
+ bluera-knowledge search "middleware" --limit 20 --include-content
121
+
122
+ # Filter irrelevant results (returns empty if nothing is truly relevant)
123
+ bluera-knowledge search "kubernetes deployment" --min-relevance 0.4
124
+
125
+ # Get JSON output with confidence and raw scores
126
+ bluera-knowledge search "express middleware" --format json
127
+ ```
128
+
129
+ **Search Options:**
130
+
131
+ | Option | Description |
132
+ |--------|-------------|
133
+ | `-s, --stores <stores>` | Comma-separated store names/IDs |
134
+ | `-m, --mode <mode>` | `hybrid` (default), `vector`, or `fts` |
135
+ | `-n, --limit <count>` | Max results (default: 10) |
136
+ | `-t, --threshold <score>` | Min normalized score (0-1) |
137
+ | `--min-relevance <score>` | Min raw cosine similarity (0-1) |
138
+ | `--include-content` | Show full content in results |
139
+ | `--detail <level>` | `minimal`, `contextual`, or `full` |
140
+
141
+ ---
142
+
143
+ ## Global Options
144
+
145
+ ```bash
146
+ --config <path> # Custom config file
147
+ --data-dir <path> # Custom data directory
148
+ --project-root <path> # Project root for store definitions (required for sync)
149
+ --format <format> # Output format: json | table | plain
150
+ --quiet # Suppress non-essential output
151
+ --verbose # Enable verbose logging
152
+ ```
153
+
154
+ ---
155
+
156
+ ## When to Use CLI vs Plugin
157
+
158
+ **Use CLI when:**
159
+ - Using an editor other than Claude Code (VSCode, Cursor, etc.)
160
+ - Integrating into CI/CD pipelines
161
+ - Scripting or automation
162
+ - Pre-indexing dependencies for teams
163
+
164
+ **Use Plugin when:**
165
+ - Working within Claude Code
166
+ - Want slash commands (`/bluera-knowledge:search`)
167
+ - Need Claude to automatically query your knowledge base
168
+ - Want Skills to guide optimal usage
169
+
170
+ Both interfaces use the same underlying services, so you can switch between them seamlessly.
@@ -0,0 +1,392 @@
1
+ # Commands Reference
2
+
3
+ Complete reference for all Bluera Knowledge slash commands.
4
+
5
+ ## Quick Reference
6
+
7
+ | Command | Purpose | Arguments |
8
+ |---------|---------|-----------|
9
+ | `/bluera-knowledge:suggest` | Analyze project dependencies | None |
10
+ | `/bluera-knowledge:add-repo` | Clone and index Git repository | `<url> [--name=<name>] [--branch=<branch>]` |
11
+ | `/bluera-knowledge:add-folder` | Index local folder | `<path> --name=<name>` |
12
+ | `/bluera-knowledge:search` | Search knowledge stores | `"<query>" [--stores=<names>] [--limit=<N>]` |
13
+ | `/bluera-knowledge:stores` | List all stores | None |
14
+ | `/bluera-knowledge:index` | Re-index a store | `<store-name-or-id>` |
15
+ | `/bluera-knowledge:remove-store` | Delete a store and all data | `<store-name-or-id>` |
16
+ | `/bluera-knowledge:crawl` | Crawl web pages | `<url> <store-name> [--crawl "<instruction>"]` |
17
+ | `/bluera-knowledge:sync` | Sync stores from definitions config | `[--dry-run] [--prune]` |
18
+
19
+ ---
20
+
21
+ ## `/bluera-knowledge:suggest`
22
+
23
+ **Analyze your project to suggest libraries worth indexing as knowledge stores**
24
+
25
+ ```bash
26
+ /bluera-knowledge:suggest
27
+ ```
28
+
29
+ Scans source files, counts import statements, and suggests the top 5 most-used dependencies with their repository URLs.
30
+
31
+ **Supported languages:**
32
+
33
+ | Language | Manifest File | Registry |
34
+ |----------|---------------|----------|
35
+ | JavaScript/TypeScript | `package.json` | NPM |
36
+ | Python | `requirements.txt`, `pyproject.toml` | PyPI |
37
+ | Rust | `Cargo.toml` | crates.io |
38
+ | Go | `go.mod` | Go modules |
39
+
40
+ <details>
41
+ <summary><b>Expected Output</b></summary>
42
+
43
+ ```
44
+ ## Dependency Analysis
45
+
46
+ Scanned 342 source files and found 24 dependencies.
47
+
48
+ ### Top Dependencies by Usage
49
+
50
+ 1. **react** (156 imports across 87 files)
51
+ Repository: https://github.com/facebook/react
52
+
53
+ Add with:
54
+ /bluera-knowledge:add-repo https://github.com/facebook/react --name=react
55
+
56
+ 2. **vitest** (40 imports across 40 files)
57
+ Repository: https://github.com/vitest-dev/vitest
58
+
59
+ Add with:
60
+ /bluera-knowledge:add-repo https://github.com/vitest-dev/vitest --name=vitest
61
+
62
+ 3. **lodash** (28 imports across 15 files)
63
+ Repository: https://github.com/lodash/lodash
64
+
65
+ Add with:
66
+ /bluera-knowledge:add-repo https://github.com/lodash/lodash --name=lodash
67
+
68
+ ---
69
+
70
+ Already indexed: typescript, express
71
+ ```
72
+ </details>
73
+
74
+ ---
75
+
76
+ ## `/bluera-knowledge:add-repo`
77
+
78
+ **Clone and index a Git repository**
79
+
80
+ ```bash
81
+ /bluera-knowledge:add-repo <url> [--name=<name>] [--branch=<branch>]
82
+ ```
83
+
84
+ **Examples:**
85
+ ```bash
86
+ /bluera-knowledge:add-repo https://github.com/lodash/lodash
87
+ /bluera-knowledge:add-repo https://github.com/facebook/react --branch=main --name=react
88
+ ```
89
+
90
+ <details>
91
+ <summary><b>Expected Output</b></summary>
92
+
93
+ ```
94
+ ✓ Cloning https://github.com/facebook/react...
95
+ ✓ Created store: react (a1b2c3d4...)
96
+ Location: ~/.local/share/bluera-knowledge/stores/a1b2c3d4.../
97
+
98
+ ✓ Indexing...
99
+ ✓ Indexed 1,247 files
100
+
101
+ Store is ready for searching!
102
+ ```
103
+ </details>
104
+
105
+ ---
106
+
107
+ ## `/bluera-knowledge:add-folder`
108
+
109
+ **Index a local folder**
110
+
111
+ ```bash
112
+ /bluera-knowledge:add-folder <path> --name=<name>
113
+ ```
114
+
115
+ **Use cases:**
116
+ - Project documentation
117
+ - Coding standards
118
+ - Design documents
119
+ - API specifications
120
+ - Reference materials
121
+ - Any other content
122
+
123
+ **Examples:**
124
+ ```bash
125
+ /bluera-knowledge:add-folder ./docs --name=project-docs
126
+ /bluera-knowledge:add-folder ./architecture --name=design-docs
127
+ ```
128
+
129
+ <details>
130
+ <summary><b>Expected Output</b></summary>
131
+
132
+ ```
133
+ ✓ Adding folder: ~/my-project/docs...
134
+ ✓ Created store: project-docs (e5f6g7h8...)
135
+ Location: ~/.local/share/bluera-knowledge/stores/e5f6g7h8.../
136
+
137
+ ✓ Indexing...
138
+ ✓ Indexed 342 files
139
+
140
+ Store is ready for searching!
141
+ ```
142
+ </details>
143
+
144
+ ---
145
+
146
+ ## `/bluera-knowledge:search`
147
+
148
+ **Search across indexed knowledge stores**
149
+
150
+ ```bash
151
+ /bluera-knowledge:search "<query>" [--stores=<names>] [--limit=<number>] [--min-relevance=<0-1>]
152
+ ```
153
+
154
+ **Options:**
155
+ - `--stores=<names>` - Comma-separated store names to search (default: all stores)
156
+ - `--limit=<number>` - Maximum results to return (default: 10)
157
+ - `--min-relevance=<0-1>` - Minimum raw cosine similarity; returns empty if no results meet threshold
158
+ - `--threshold=<0-1>` - Minimum normalized score to include results
159
+ - `--mode=<mode>` - Search mode: `hybrid` (default), `vector`, or `fts`
160
+ - `--detail=<level>` - Context detail: `minimal` (default), `contextual`, or `full`
161
+
162
+ **Examples:**
163
+ ```bash
164
+ # Search all stores
165
+ /bluera-knowledge:search "how to invalidate queries"
166
+
167
+ # Search specific store
168
+ /bluera-knowledge:search "useState implementation" --stores=react
169
+
170
+ # Search multiple stores (comma-separated)
171
+ /bluera-knowledge:search "deep clone" --stores=react,lodash
172
+
173
+ # Limit results
174
+ /bluera-knowledge:search "testing patterns" --limit=5
175
+
176
+ # Filter irrelevant results (returns empty if nothing is truly relevant)
177
+ /bluera-knowledge:search "kubernetes deployment" --min-relevance=0.4
178
+ ```
179
+
180
+ <details>
181
+ <summary><b>Expected Output</b></summary>
182
+
183
+ ```
184
+ ## Search Results: "button component" (hybrid search)
185
+
186
+ **1. [Score: 0.95] [Vector+FTS]**
187
+ Store: react
188
+ File: src/components/Button.tsx
189
+ Purpose: → Reusable button component with variants
190
+ Top Terms: (in this chunk): button, variant, size, color, onClick
191
+ Imports: (in this chunk): React, clsx
192
+
193
+ **2. [Score: 0.87] [Vector]**
194
+ Store: react
195
+ File: src/hooks/useButton.ts
196
+ Purpose: → Custom hook for button state management
197
+ Top Terms: (in this chunk): hook, state, pressed, disabled
198
+ Imports: (in this chunk): useState, useCallback
199
+
200
+ **3. [Score: 0.81] [Vector+FTS]**
201
+ Store: react
202
+ File: src/components/IconButton.tsx
203
+ Purpose: → Button component with icon support
204
+ Top Terms: (in this chunk): icon, button, aria-label, accessible
205
+
206
+ ---
207
+ **Found 3 results in 45ms**
208
+
209
+ **Next Steps:**
210
+ - Read file: `Read src/components/Button.tsx`
211
+ - Get full code: `mcp__bluera-knowledge__get_full_context("result-id")`
212
+ - Refine search: Use keywords above
213
+ ```
214
+ </details>
215
+
216
+ ---
217
+
218
+ ## `/bluera-knowledge:stores`
219
+
220
+ **List all indexed knowledge stores**
221
+
222
+ ```bash
223
+ /bluera-knowledge:stores
224
+ ```
225
+
226
+ Shows store name, type, ID, and source location in a clean table format.
227
+
228
+ <details>
229
+ <summary><b>Expected Output</b></summary>
230
+
231
+ ```
232
+ | Name | Type | ID | Source |
233
+ |------|------|----|--------------------|
234
+ | react | repo | 459747c7 | https://github.com/facebook/react |
235
+ | crawl4ai | repo | b5a72a94 | https://github.com/unclecode/crawl4ai.git |
236
+ | project-docs | file | 70f6309b | ~/repos/my-project/docs |
237
+ | claude-docs | web | 9cc62018 | https://code.claude.com/docs |
238
+
239
+ **Total**: 4 stores
240
+ ```
241
+ </details>
242
+
243
+ ---
244
+
245
+ ## `/bluera-knowledge:index`
246
+
247
+ **Re-index an existing store to update the search index**
248
+
249
+ ```bash
250
+ /bluera-knowledge:index <store-name-or-id>
251
+ ```
252
+
253
+ **When to re-index:**
254
+ - The source repository has been updated (for repo stores)
255
+ - Files have been added or modified (for file stores)
256
+ - Search results seem out of date
257
+
258
+ **Example:**
259
+ ```bash
260
+ /bluera-knowledge:index react
261
+ ```
262
+
263
+ <details>
264
+ <summary><b>Expected Output</b></summary>
265
+
266
+ ```
267
+ ✓ Indexing store: react...
268
+ ✓ Indexed 1,247 documents in 3,421ms
269
+
270
+ Store search index is up to date!
271
+ ```
272
+ </details>
273
+
274
+ ---
275
+
276
+ ## `/bluera-knowledge:remove-store`
277
+
278
+ **Delete a knowledge store and all associated data**
279
+
280
+ ```bash
281
+ /bluera-knowledge:remove-store <store-name-or-id>
282
+ ```
283
+
284
+ **What gets deleted:**
285
+ - Store registry entry
286
+ - LanceDB search index (vector embeddings)
287
+ - Cloned repository files (for repo stores created from URLs)
288
+
289
+ **Example:**
290
+ ```bash
291
+ /bluera-knowledge:remove-store react
292
+ ```
293
+
294
+ <details>
295
+ <summary><b>Expected Output</b></summary>
296
+
297
+ ```
298
+ Store "react" deleted successfully.
299
+
300
+ Removed:
301
+ - Store registry entry
302
+ - LanceDB search index
303
+ - Cloned repository files
304
+ ```
305
+ </details>
306
+
307
+ ---
308
+
309
+ ## `/bluera-knowledge:crawl`
310
+
311
+ **Crawl web pages with natural language control**
312
+
313
+ ```bash
314
+ /bluera-knowledge:crawl <url> <store-name> [options]
315
+ ```
316
+
317
+ **Options:**
318
+ - `--crawl "<instruction>"` - Natural language instruction for which pages to crawl
319
+ - `--extract "<instruction>"` - Natural language instruction for what content to extract
320
+ - `--simple` - Use simple BFS mode instead of intelligent crawling
321
+ - `--max-pages <n>` - Maximum pages to crawl (default: 50)
322
+ - `--fast` - Use fast axios-only mode (may fail on JavaScript-heavy sites)
323
+
324
+ **Requirements:**
325
+ - Python 3 with `crawl4ai` package installed
326
+ - Web store is auto-created if it doesn't exist
327
+
328
+ **Examples:**
329
+ ```bash
330
+ # Basic crawl
331
+ /bluera-knowledge:crawl https://docs.example.com/guide my-docs
332
+
333
+ # Intelligent crawl with custom strategy
334
+ /bluera-knowledge:crawl https://react.dev react-docs --crawl "all API reference pages"
335
+
336
+ # Extract specific content from pages
337
+ /bluera-knowledge:crawl https://example.com/pricing pricing --extract "pricing tiers and features"
338
+
339
+ # Combine crawl strategy + extraction
340
+ /bluera-knowledge:crawl https://docs.python.org python-docs \
341
+ --crawl "standard library modules" \
342
+ --extract "function signatures and examples"
343
+
344
+ # JavaScript-rendered sites work by default (uses headless browser)
345
+ /bluera-knowledge:crawl https://nextjs.org/docs nextjs-docs --max-pages 30
346
+
347
+ # Fast mode for static HTML sites (axios-only, faster but may miss JS content)
348
+ /bluera-knowledge:crawl https://example.com/static static-docs --fast --max-pages 100
349
+
350
+ # Simple BFS mode (no AI guidance)
351
+ /bluera-knowledge:crawl https://example.com/docs docs --simple --max-pages 100
352
+ ```
353
+
354
+ The crawler converts pages to markdown and indexes them for semantic search.
355
+
356
+ ---
357
+
358
+ ## `/bluera-knowledge:sync`
359
+
360
+ **Sync stores from definitions config (bootstrap on fresh clone)**
361
+
362
+ ```bash
363
+ /bluera-knowledge:sync [options]
364
+ ```
365
+
366
+ **Options:**
367
+ - `--dry-run` - Show what would happen without making changes
368
+ - `--prune` - Remove stores not in definitions
369
+ - `--reindex` - Re-index existing stores after sync
370
+
371
+ **Use cases:**
372
+ - **Fresh clone**: Recreate all stores defined by the team
373
+ - **Check status**: See which stores exist vs. defined
374
+ - **Clean up**: Remove orphan stores not in config
375
+
376
+ **Examples:**
377
+ ```bash
378
+ # Preview what would be synced
379
+ /bluera-knowledge:sync --dry-run
380
+
381
+ # Sync all stores from definitions
382
+ /bluera-knowledge:sync
383
+
384
+ # Sync and remove orphan stores
385
+ /bluera-knowledge:sync --prune
386
+ ```
387
+
388
+ **How it works:**
389
+ 1. Reads store definitions from `.bluera/bluera-knowledge/stores.config.json`
390
+ 2. Creates any stores that don't exist locally
391
+ 3. Reports orphan stores (local stores not in definitions)
392
+ 4. Optionally prunes orphans with `--prune`