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.
package/README.md CHANGED
@@ -35,28 +35,19 @@ All searchable in milliseconds, no rate limits, fully offline.
35
35
 
36
36
  - [Installation](#-installation)
37
37
  - [Why Bluera Knowledge?](#-why-bluera-knowledge)
38
- - [Token Efficiency](#-token-efficiency)
38
+ - [When to Query BK](#-when-claude-code-should-query-bk)
39
39
  - [Quick Start](#-quick-start)
40
40
  - [Features](#-features)
41
41
  - [How It Works](#-how-it-works)
42
42
  - [User Interface](#-user-interface)
43
43
  - [Background Jobs](#-background-jobs)
44
- - [Commands](#-commands)
45
- - [Crawler Architecture](#-crawler-architecture)
46
44
  - [Use Cases](#-use-cases)
47
- - [Dependencies](#-dependencies)
48
- - [Troubleshooting](#-troubleshooting)
49
- - [MCP Integration](#-mcp-integration)
50
- - [CLI Tool](#️-cli-tool)
51
45
  - [Skills for Claude Code](#-skills-for-claude-code)
52
46
  - [Data Storage](#-data-storage)
53
- - [Development](#-development)
54
- - [Setup](#-setup)
55
- - [Claude Code Settings](#️-claude-code-settings-recommended)
56
- - [Commands / Scripts](#-commands)
57
- - [Releasing](#-releasing)
58
- - [Testing](#-testing-locally)
47
+ - [Troubleshooting](#-troubleshooting)
48
+ - [Dependencies](#-dependencies)
59
49
  - [Technologies](#-technologies)
50
+ - [Documentation](#-documentation)
60
51
  - [Contributing](#-contributing)
61
52
  - [License](#-license)
62
53
 
@@ -163,92 +154,6 @@ BK is cheap (~100ms, no rate limits), authoritative (actual source code), and co
163
154
 
164
155
  ---
165
156
 
166
- ## 💰 Token Efficiency
167
-
168
- Beyond speed and accuracy, Bluera Knowledge can **significantly reduce token consumption** for code-related queries—typically saving 60-75% compared to web search approaches.
169
-
170
- ### 📊 How It Works
171
-
172
- **Without Bluera Knowledge:**
173
- - Web searches return 5-10 results (~500-2,000 tokens each)
174
- - Total per search: **3,000-10,000 tokens**
175
- - Often need multiple searches to find the right answer
176
- - Lower signal-to-noise ratio (blog posts mixed with actual docs)
177
-
178
- **With Bluera Knowledge:**
179
- - Semantic search returns top 10 relevant code chunks (~200-400 tokens each)
180
- - Structured metadata (file paths, imports, purpose)
181
- - Total per search: **1,500-3,000 tokens**
182
- - Higher relevance due to vector search (fewer follow-up queries needed)
183
-
184
- ### 🎯 Real-World Examples
185
-
186
- #### Example 1: Library Implementation Question
187
-
188
- **Question:** "How does Express handle middleware errors?"
189
-
190
- | Approach | Token Cost | Result |
191
- |----------|-----------|--------|
192
- | **Web Search** | ~8,000 tokens<br/>(3 searches: general query → refined query → source code) | Blog posts + Stack Overflow + eventual guess |
193
- | **Bluera Knowledge** | ~2,000 tokens<br/>(1 semantic search) | Actual Express source code, authoritative |
194
- | **Savings** | **75% fewer tokens** ✅ | Higher accuracy |
195
-
196
- #### Example 2: Dependency Exploration
197
-
198
- **Question:** "How does LanceDB's vector search work?"
199
-
200
- | Approach | Token Cost | Result |
201
- |----------|-----------|--------|
202
- | **Web Search** | ~9,500 tokens<br/>(General docs → API docs → fetch specific page) | Documentation, might miss implementation details |
203
- | **Bluera Knowledge** | ~1,500 tokens<br/>(Search returns source + tests + examples) | Source code from Python + Rust implementation |
204
- | **Savings** | **84% fewer tokens** ✅ | Complete picture |
205
-
206
- #### Example 3: Version-Specific Behavior
207
-
208
- **Question:** "What changed in React 18's useEffect cleanup?"
209
-
210
- | Approach | Token Cost | Result |
211
- |----------|-----------|--------|
212
- | **Training Data** | 0 tokens (but might be outdated) | Uncertain if accurate for React 18 |
213
- | **Web Search** | ~5,000 tokens<br/>(Search changelog → blog posts → docs) | Mix of React 17 and 18 info |
214
- | **Bluera Knowledge** | ~2,000 tokens<br/>(Search indexed React 18 source) | Exact React 18 implementation |
215
- | **Savings** | **60% fewer tokens** ✅ | Version-accurate |
216
-
217
- ### ⚖️ When BK Uses More Tokens
218
-
219
- Bluera Knowledge isn't always the most token-efficient choice:
220
-
221
- | Scenario | Best Approach | Why |
222
- |----------|---------------|-----|
223
- | **Simple concept questions**<br/>("What is a JavaScript closure?") | Training data | Claude already knows this (0 tokens) |
224
- | **Current events**<br/>("Latest Next.js 15 release notes") | Web search | BK only has what you've indexed |
225
- | **General advice**<br/>("How to structure a React app?") | Training data | Opinion-based, not code-specific |
226
-
227
- ### 📈 Summary: Token Savings by Query Type
228
-
229
- | Query Type | Typical Token Savings | When to Use BK |
230
- |------------|----------------------|----------------|
231
- | **Library internals** | 60-75% | ✅ Always |
232
- | **Version-specific behavior** | 50-70% | ✅ Always |
233
- | **"How does X work internally?"** | 70-85% | ✅ Always |
234
- | **API usage examples** | 40-60% | ✅ Recommended |
235
- | **General concepts** | -100% (uses more) | ❌ Skip BK |
236
- | **Current events** | -100% (uses more) | ❌ Skip BK |
237
-
238
- ### 💡 Best Practice
239
-
240
- **Default to BK for library questions.** It's cheap, fast, and authoritative:
241
-
242
- | Question Type | Action | Why |
243
- |--------------|--------|-----|
244
- | Library internals, APIs, errors, versions, config | **Query BK first** | Source code is definitive, 60-85% token savings |
245
- | General programming concepts | Skip BK | Training data is sufficient |
246
- | Breaking news, release notes | Web search | BK only has indexed content |
247
-
248
- The plugin's Skills teach Claude Code these patterns automatically. When in doubt about a dependency, query BK—it's faster and more accurate than guessing or web searching.
249
-
250
- ---
251
-
252
157
  ## 🚀 Quick Start
253
158
 
254
159
  ### Using Claude Code Plugin
@@ -487,483 +392,54 @@ Background jobs include significant performance optimizations:
487
392
 
488
393
  ---
489
394
 
490
- ## 📖 Quick Reference
491
-
492
- | Command | Purpose | Arguments |
493
- |---------|---------|-----------|
494
- | 🔬 `/bluera-knowledge:suggest` | Analyze project dependencies | None |
495
- | 📦 `/bluera-knowledge:add-repo` | Clone and index Git repository | `<url> [--name=<name>] [--branch=<branch>]` |
496
- | 📁 `/bluera-knowledge:add-folder` | Index local folder | `<path> --name=<name>` |
497
- | 🔍 `/bluera-knowledge:search` | Search knowledge stores | `"<query>" [--stores=<names>] [--limit=<N>]` |
498
- | 📋 `/bluera-knowledge:stores` | List all stores | None |
499
- | 🔄 `/bluera-knowledge:index` | Re-index a store | `<store-name-or-id>` |
500
- | 🗑️ `/bluera-knowledge:remove-store` | Delete a store and all data | `<store-name-or-id>` |
501
- | 🌐 `/bluera-knowledge:crawl` | Crawl web pages | `<url> <store-name> [--crawl "<instruction>"]` |
502
- | 🔁 `/bluera-knowledge:sync` | Sync stores from definitions config | `[--dry-run] [--prune]` |
503
-
504
- ---
505
-
506
- ## 💻 Commands
395
+ ## 🎯 Use Cases
507
396
 
508
- ### 🔬 `/bluera-knowledge:suggest`
397
+ ### Dependency Source Code
509
398
 
510
- **Analyze your project to suggest libraries worth indexing as knowledge stores**
399
+ Provide AI agents with canonical dependency implementation details:
511
400
 
512
401
  ```bash
513
402
  /bluera-knowledge:suggest
514
- ```
515
-
516
- Scans source files, counts import statements, and suggests the top 5 most-used dependencies with their repository URLs.
517
-
518
- **Supported languages:**
519
- | Language | Manifest File | Registry |
520
- |----------|---------------|----------|
521
- | JavaScript/TypeScript | `package.json` | NPM |
522
- | Python | `requirements.txt`, `pyproject.toml` | PyPI |
523
- | Rust | `Cargo.toml` | crates.io |
524
- | Go | `go.mod` | Go modules |
525
-
526
- <details>
527
- <summary><b>📊 Expected Output</b></summary>
528
-
529
- ```
530
- ## Dependency Analysis
531
-
532
- Scanned 342 source files and found 24 dependencies.
533
-
534
- ### Top Dependencies by Usage
535
-
536
- 1. **react** (156 imports across 87 files)
537
- Repository: https://github.com/facebook/react
538
-
539
- Add with:
540
- /bluera-knowledge:add-repo https://github.com/facebook/react --name=react
541
-
542
- 2. **vitest** (40 imports across 40 files)
543
- Repository: https://github.com/vitest-dev/vitest
544
-
545
- Add with:
546
- /bluera-knowledge:add-repo https://github.com/vitest-dev/vitest --name=vitest
547
-
548
- 3. **lodash** (28 imports across 15 files)
549
- Repository: https://github.com/lodash/lodash
550
-
551
- Add with:
552
- /bluera-knowledge:add-repo https://github.com/lodash/lodash --name=lodash
553
-
554
- ---
555
-
556
- Already indexed: typescript, express
557
- ```
558
- </details>
559
-
560
- ---
561
-
562
- ### 📦 `/bluera-knowledge:add-repo`
563
-
564
- **Clone and index a Git repository**
565
-
566
- ```bash
567
- /bluera-knowledge:add-repo <url> [--name=<name>] [--branch=<branch>]
568
- ```
569
-
570
- **Examples:**
571
- ```bash
572
- /bluera-knowledge:add-repo https://github.com/lodash/lodash
573
- /bluera-knowledge:add-repo https://github.com/facebook/react --branch=main --name=react
574
- ```
575
-
576
- <details>
577
- <summary><b>✅ Expected Output</b></summary>
578
-
579
- ```
580
- ✓ Cloning https://github.com/facebook/react...
581
- ✓ Created store: react (a1b2c3d4...)
582
- Location: ~/.local/share/bluera-knowledge/stores/a1b2c3d4.../
583
-
584
- ✓ Indexing...
585
- ✓ Indexed 1,247 files
403
+ /bluera-knowledge:add-repo https://github.com/expressjs/express
586
404
 
587
- Store is ready for searching!
405
+ # AI agents can now:
406
+ # - Semantic search: "middleware error handling"
407
+ # - Direct access: Grep/Glob through the cloned express repo
588
408
  ```
589
- </details>
590
-
591
- ---
592
409
 
593
- ### 📁 `/bluera-knowledge:add-folder`
410
+ ### Project Documentation
594
411
 
595
- **Index a local folder**
596
-
597
- ```bash
598
- /bluera-knowledge:add-folder <path> --name=<name>
599
- ```
600
-
601
- **📚 Use cases:**
602
- - 📖 Project documentation
603
- - 📏 Coding standards
604
- - 🎨 Design documents
605
- - 🔌 API specifications
606
- - 📚 Reference materials
607
- - 📄 Any other content
412
+ Make project-specific documentation available:
608
413
 
609
- **Examples:**
610
414
  ```bash
611
415
  /bluera-knowledge:add-folder ./docs --name=project-docs
612
- /bluera-knowledge:add-folder ./architecture --name=design-docs
613
- ```
614
-
615
- <details>
616
- <summary><b>✅ Expected Output</b></summary>
617
-
618
- ```
619
- ✓ Adding folder: ~/my-project/docs...
620
- ✓ Created store: project-docs (e5f6g7h8...)
621
- Location: ~/.local/share/bluera-knowledge/stores/e5f6g7h8.../
622
-
623
- ✓ Indexing...
624
- ✓ Indexed 342 files
625
-
626
- Store is ready for searching!
627
- ```
628
- </details>
629
-
630
- ---
631
-
632
- ### 🔍 `/bluera-knowledge:search`
633
-
634
- **Search across indexed knowledge stores**
635
-
636
- ```bash
637
- /bluera-knowledge:search "<query>" [--stores=<names>] [--limit=<number>] [--min-relevance=<0-1>]
638
- ```
639
-
640
- **Options:**
641
- - `--stores=<names>` - Comma-separated store names to search (default: all stores)
642
- - `--limit=<number>` - Maximum results to return (default: 10)
643
- - `--min-relevance=<0-1>` - Minimum raw cosine similarity; returns empty if no results meet threshold
644
- - `--threshold=<0-1>` - Minimum normalized score to include results
645
- - `--mode=<mode>` - Search mode: `hybrid` (default), `vector`, or `fts`
646
- - `--detail=<level>` - Context detail: `minimal` (default), `contextual`, or `full`
647
-
648
- **Examples:**
649
- ```bash
650
- # Search all stores
651
- /bluera-knowledge:search "how to invalidate queries"
652
-
653
- # Search specific store
654
- /bluera-knowledge:search "useState implementation" --stores=react
655
-
656
- # Search multiple stores (comma-separated)
657
- /bluera-knowledge:search "deep clone" --stores=react,lodash
658
-
659
- # Limit results
660
- /bluera-knowledge:search "testing patterns" --limit=5
661
-
662
- # Filter irrelevant results (returns empty if nothing is truly relevant)
663
- /bluera-knowledge:search "kubernetes deployment" --min-relevance=0.4
664
- ```
665
-
666
- <details>
667
- <summary><b>📊 Expected Output</b></summary>
668
-
669
- ```
670
- ## Search Results: "button component" (hybrid search)
671
-
672
- **1. [Score: 0.95] [Vector+FTS]**
673
- Store: react
674
- File: 📄 src/components/Button.tsx
675
- Purpose: → Reusable button component with variants
676
- Top Terms: 🔑 (in this chunk): button, variant, size, color, onClick
677
- Imports: 📦 (in this chunk): React, clsx
678
-
679
- **2. [Score: 0.87] [Vector]**
680
- Store: react
681
- File: 📄 src/hooks/useButton.ts
682
- Purpose: → Custom hook for button state management
683
- Top Terms: 🔑 (in this chunk): hook, state, pressed, disabled
684
- Imports: 📦 (in this chunk): useState, useCallback
685
-
686
- **3. [Score: 0.81] [Vector+FTS]**
687
- Store: react
688
- File: 📄 src/components/IconButton.tsx
689
- Purpose: → Button component with icon support
690
- Top Terms: 🔑 (in this chunk): icon, button, aria-label, accessible
691
-
692
- ---
693
- **Found 3 results in 45ms**
694
-
695
- 💡 **Next Steps:**
696
- - Read file: `Read src/components/Button.tsx`
697
- - Get full code: `mcp__bluera-knowledge__get_full_context("result-id")`
698
- - Refine search: Use keywords above
699
- ```
700
- </details>
701
-
702
- ---
703
-
704
- ### 📋 `/bluera-knowledge:stores`
705
-
706
- **List all indexed knowledge stores**
707
-
708
- ```bash
709
- /bluera-knowledge:stores
710
- ```
711
-
712
- Shows store name, type, ID, and source location in a clean table format.
713
-
714
- <details>
715
- <summary><b>📊 Expected Output</b></summary>
716
-
717
- ```
718
- | Name | Type | ID | Source |
719
- |------|------|----|--------------------|
720
- | react | repo | 459747c7 | https://github.com/facebook/react |
721
- | crawl4ai | repo | b5a72a94 | https://github.com/unclecode/crawl4ai.git |
722
- | project-docs | file | 70f6309b | ~/repos/my-project/docs |
723
- | claude-docs | web | 9cc62018 | https://code.claude.com/docs |
724
-
725
- **Total**: 4 stores
726
- ```
727
- </details>
728
-
729
- ---
730
-
731
- ### 🔄 `/bluera-knowledge:index`
732
-
733
- **Re-index an existing store to update the search index**
734
-
735
- ```bash
736
- /bluera-knowledge:index <store-name-or-id>
737
- ```
738
-
739
- **🔄 When to re-index:**
740
- - The source repository has been updated (for repo stores)
741
- - Files have been added or modified (for file stores)
742
- - Search results seem out of date
743
-
744
- **Example:**
745
- ```bash
746
- /bluera-knowledge:index react
747
- ```
748
-
749
- <details>
750
- <summary><b>✅ Expected Output</b></summary>
751
-
752
- ```
753
- ✓ Indexing store: react...
754
- ✓ Indexed 1,247 documents in 3,421ms
755
-
756
- Store search index is up to date!
757
- ```
758
- </details>
759
-
760
- ---
761
-
762
- ### 🗑️ `/bluera-knowledge:remove-store`
763
-
764
- **Delete a knowledge store and all associated data**
765
-
766
- ```bash
767
- /bluera-knowledge:remove-store <store-name-or-id>
768
- ```
769
-
770
- **🗑️ What gets deleted:**
771
- - Store registry entry
772
- - LanceDB search index (vector embeddings)
773
- - Cloned repository files (for repo stores created from URLs)
774
-
775
- **Example:**
776
- ```bash
777
- /bluera-knowledge:remove-store react
778
- ```
779
-
780
- <details>
781
- <summary><b>✅ Expected Output</b></summary>
782
-
783
- ```
784
- Store "react" deleted successfully.
785
-
786
- Removed:
787
- - Store registry entry
788
- - LanceDB search index
789
- - Cloned repository files
790
- ```
791
- </details>
792
-
793
- ---
794
-
795
- ### 🌐 `/bluera-knowledge:crawl`
796
-
797
- **Crawl web pages with natural language control**
416
+ /bluera-knowledge:add-folder ./architecture --name=architecture
798
417
 
799
- ```bash
800
- /bluera-knowledge:crawl <url> <store-name> [options]
418
+ # AI agents can search across all documentation or access specific files
801
419
  ```
802
420
 
803
- **Options:**
804
- - `--crawl "<instruction>"` - Natural language instruction for which pages to crawl
805
- - `--extract "<instruction>"` - Natural language instruction for what content to extract
806
- - `--simple` - Use simple BFS mode instead of intelligent crawling
807
- - `--max-pages <n>` - Maximum pages to crawl (default: 50)
808
- - `--fast` - Use fast axios-only mode (may fail on JavaScript-heavy sites)
421
+ ### Coding Standards
809
422
 
810
- **⚙️ Requirements:**
811
- - 🐍 Python 3 with `crawl4ai` package installed
812
- - 📦 Web store is auto-created if it doesn't exist
423
+ Provide definitive coding standards and best practices:
813
424
 
814
- **Examples:**
815
425
  ```bash
816
- # Basic crawl
817
- /bluera-knowledge:crawl https://docs.example.com/guide my-docs
818
-
819
- # Intelligent crawl with custom strategy
820
- /bluera-knowledge:crawl https://react.dev react-docs --crawl "all API reference pages"
821
-
822
- # Extract specific content from pages
823
- /bluera-knowledge:crawl https://example.com/pricing pricing --extract "pricing tiers and features"
824
-
825
- # Combine crawl strategy + extraction
826
- /bluera-knowledge:crawl https://docs.python.org python-docs \
827
- --crawl "standard library modules" \
828
- --extract "function signatures and examples"
829
-
830
- # JavaScript-rendered sites work by default (uses headless browser)
831
- /bluera-knowledge:crawl https://nextjs.org/docs nextjs-docs --max-pages 30
832
-
833
- # Fast mode for static HTML sites (axios-only, faster but may miss JS content)
834
- /bluera-knowledge:crawl https://example.com/static static-docs --fast --max-pages 100
835
-
836
- # Simple BFS mode (no AI guidance)
837
- /bluera-knowledge:crawl https://example.com/docs docs --simple --max-pages 100
838
- ```
839
-
840
- The crawler converts pages to markdown and indexes them for semantic search.
841
-
842
- ---
843
-
844
- ### 🔁 `/bluera-knowledge:sync`
845
-
846
- **Sync stores from definitions config (bootstrap on fresh clone)**
426
+ /bluera-knowledge:add-folder ./company-standards --name=standards
427
+ /bluera-knowledge:add-folder ./api-specs --name=api-docs
847
428
 
848
- ```bash
849
- /bluera-knowledge:sync [options]
429
+ # AI agents reference actual company standards, not generic advice
850
430
  ```
851
431
 
852
- **Options:**
853
- - `--dry-run` - Show what would happen without making changes
854
- - `--prune` - Remove stores not in definitions
855
- - `--reindex` - Re-index existing stores after sync
432
+ ### Mixed Sources
856
433
 
857
- **Use cases:**
858
- - **Fresh clone**: Recreate all stores defined by the team
859
- - **Check status**: See which stores exist vs. defined
860
- - **Clean up**: Remove orphan stores not in config
434
+ Combine canonical library code with project-specific patterns:
861
435
 
862
- **Examples:**
863
436
  ```bash
864
- # Preview what would be synced
865
- /bluera-knowledge:sync --dry-run
866
-
867
- # Sync all stores from definitions
868
- /bluera-knowledge:sync
869
-
870
- # Sync and remove orphan stores
871
- /bluera-knowledge:sync --prune
872
- ```
873
-
874
- **How it works:**
875
- 1. Reads store definitions from `.bluera/bluera-knowledge/stores.config.json`
876
- 2. Creates any stores that don't exist locally
877
- 3. Reports orphan stores (local stores not in definitions)
878
- 4. Optionally prunes orphans with `--prune`
879
-
880
- ---
881
-
882
- ## 🕷️ Crawler Architecture
883
-
884
- The crawler defaults to **headless mode** (Playwright) for maximum compatibility with modern JavaScript-rendered sites. Use `--fast` for static HTML sites when speed is critical.
885
-
886
- ### 🎭 Default Mode (Headless - JavaScript-Rendered Sites)
887
-
888
- By default, the crawler uses Playwright via crawl4ai to render JavaScript content:
889
-
890
- ```mermaid
891
- sequenceDiagram
892
- participant User
893
- participant CLI
894
- participant IntelligentCrawler
895
- participant Axios
896
- participant Claude
897
-
898
- User->>CLI: crawl URL --crawl "instruction"
899
- CLI->>IntelligentCrawler: crawl(url, {useHeadless: true})
900
- IntelligentCrawler->>PythonBridge: fetchHeadless(url)
901
- PythonBridge->>crawl4ai: AsyncWebCrawler.arun(url)
902
- crawl4ai->>Playwright: Launch browser & render JS
903
- Playwright-->>crawl4ai: Rendered HTML
904
- crawl4ai-->>PythonBridge: {html, markdown, links}
905
- PythonBridge-->>IntelligentCrawler: Rendered HTML
906
- IntelligentCrawler->>Claude: determineCrawlUrls(html, instruction)
907
- Note over Claude: Natural language instruction<br/>STILL FULLY ACTIVE
908
- Claude-->>IntelligentCrawler: [urls to crawl]
909
- loop For each URL
910
- IntelligentCrawler->>PythonBridge: fetchHeadless(url)
911
- PythonBridge->>crawl4ai: Render JS
912
- crawl4ai-->>PythonBridge: HTML
913
- PythonBridge-->>IntelligentCrawler: HTML
914
- IntelligentCrawler->>IntelligentCrawler: Convert to markdown & index
915
- end
916
- ```
437
+ /bluera-knowledge:add-repo https://github.com/facebook/react --name=react
438
+ /bluera-knowledge:add-folder ./docs/react-patterns --name=react-patterns
917
439
 
918
- ### Fast Mode (Static Sites - `--fast`)
919
-
920
- For static HTML sites, use `--fast` for faster crawling with axios:
921
-
922
- ```mermaid
923
- sequenceDiagram
924
- participant User
925
- participant CLI
926
- participant IntelligentCrawler
927
- participant Axios
928
- participant Claude
929
-
930
- User->>CLI: crawl URL --crawl "instruction" --fast
931
- CLI->>IntelligentCrawler: crawl(url, {useHeadless: false})
932
- IntelligentCrawler->>Axios: fetchHtml(url)
933
- Axios-->>IntelligentCrawler: Static HTML
934
- IntelligentCrawler->>Claude: determineCrawlUrls(html, instruction)
935
- Claude-->>IntelligentCrawler: [urls to crawl]
936
- loop For each URL
937
- IntelligentCrawler->>Axios: fetchHtml(url)
938
- Axios-->>IntelligentCrawler: HTML
939
- IntelligentCrawler->>IntelligentCrawler: Convert to markdown & index
940
- end
440
+ # Search across both dependency source and team patterns
941
441
  ```
942
442
 
943
- ### 🔑 Key Points
944
-
945
- - **🎭 Default to headless** - Maximum compatibility with modern JavaScript-rendered sites (React, Vue, Next.js)
946
- - **⚡ Fast mode available** - Use `--fast` for static HTML sites when speed is critical
947
- - **🧠 Intelligent crawling preserved** - Claude Code CLI analyzes pages and selects URLs in both modes
948
- - **🔄 Automatic fallback** - If headless fetch fails, automatically falls back to axios
949
-
950
- ### 🤖 Intelligent Mode vs Simple Mode
951
-
952
- The crawler operates in two modes depending on Claude Code CLI availability:
953
-
954
- | Mode | Requires Claude CLI | Behavior |
955
- |------|---------------------|----------|
956
- | **Intelligent** | ✅ Yes | Claude analyzes pages and selects URLs based on natural language instructions |
957
- | **Simple (BFS)** | ❌ No | Breadth-first crawl up to max depth (2 levels) |
958
-
959
- **Automatic detection:**
960
- - When Claude Code CLI is available: Full intelligent mode with `--crawl` and `--extract` instructions
961
- - When Claude Code CLI is unavailable: Automatically uses simple BFS mode
962
- - Clear messaging: "Claude CLI not found, using simple crawl mode"
963
-
964
- > [!NOTE]
965
- > Install Claude Code to unlock `--crawl` (AI-guided URL selection) and `--extract` (AI content extraction). Without it, web crawling still works but uses simple BFS mode.
966
-
967
443
  ---
968
444
 
969
445
  ## 🔧 Troubleshooting
@@ -986,6 +462,18 @@ If the plugin isn't listed, install it:
986
462
  ```
987
463
  </details>
988
464
 
465
+ <details>
466
+ <summary><b>🔌 MCP server shows as "failed" in /plugin</b></summary>
467
+
468
+ If the MCP server shows as failed after installation:
469
+
470
+ 1. **Restart Claude Code** - MCP servers require a restart to initialize
471
+ 2. **Check status:** Run `/mcp` to see connection status
472
+ 3. **Reinstall:** Try `/plugin uninstall bluera-knowledge` then `/plugin install bluera-knowledge@bluera`
473
+
474
+ If the issue persists, check that Claude Code is v2.0.65 or later (earlier versions had MCP loading bugs).
475
+ </details>
476
+
989
477
  <details>
990
478
  <summary><b>🌐 Web crawling fails</b></summary>
991
479
 
@@ -1045,121 +533,6 @@ Simple mode still crawls effectively—it just doesn't use AI to select which pa
1045
533
 
1046
534
  ---
1047
535
 
1048
- ## 🎯 Use Cases
1049
-
1050
- ### 📦 Dependency Source Code
1051
-
1052
- Provide AI agents with canonical dependency implementation details:
1053
-
1054
- ```bash
1055
- /bluera-knowledge:suggest
1056
- /bluera-knowledge:add-repo https://github.com/expressjs/express
1057
-
1058
- # AI agents can now:
1059
- # - Semantic search: "middleware error handling"
1060
- # - Direct access: Grep/Glob through the cloned express repo
1061
- ```
1062
-
1063
- ### 📚 Project Documentation
1064
-
1065
- Make project-specific documentation available:
1066
-
1067
- ```bash
1068
- /bluera-knowledge:add-folder ./docs --name=project-docs
1069
- /bluera-knowledge:add-folder ./architecture --name=architecture
1070
-
1071
- # AI agents can search across all documentation or access specific files
1072
- ```
1073
-
1074
- ### 📏 Coding Standards
1075
-
1076
- Provide definitive coding standards and best practices:
1077
-
1078
- ```bash
1079
- /bluera-knowledge:add-folder ./company-standards --name=standards
1080
- /bluera-knowledge:add-folder ./api-specs --name=api-docs
1081
-
1082
- # AI agents reference actual company standards, not generic advice
1083
- ```
1084
-
1085
- ### 🔀 Mixed Sources
1086
-
1087
- Combine canonical library code with project-specific patterns:
1088
-
1089
- ```bash
1090
- /bluera-knowledge:add-repo https://github.com/facebook/react --name=react
1091
- /bluera-knowledge:add-folder ./docs/react-patterns --name=react-patterns
1092
-
1093
- # Search across both dependency source and team patterns
1094
- ```
1095
-
1096
- ---
1097
-
1098
- ## 💭 What Claude Code Says About Bluera Knowledge
1099
-
1100
- > ### *As an AI coding assistant, here's what I've discovered using this plugin*
1101
- >
1102
- > ---
1103
- >
1104
- > #### ⚡ The Immediate Impact
1105
- >
1106
- > **The difference is immediate.** When a user asks "how does React's useEffect cleanup work?", I can search the actual React source code indexed locally instead of relying on my training data or making web requests. The results include the real implementation, related functions, and usage patterns—all in ~100ms.
1107
- >
1108
- > **Code graph analysis changes the game.** The plugin doesn't just index files—it builds a relationship graph showing which functions call what, import dependencies, and class hierarchies. When I search for a function, I see how many places call it and what it calls. This context makes my suggestions dramatically more accurate.
1109
- >
1110
- > ---
1111
- >
1112
- > #### 🔀 Multi-Modal Search Power
1113
- >
1114
- > I can combine three search approaches in a single workflow:
1115
- >
1116
- > | Mode | Use Case | Example |
1117
- > |------|----------|---------|
1118
- > | 🧠 **Semantic** | Conceptual queries | "authentication flow with JWT validation" |
1119
- > | 📂 **Direct Access** | Pattern matching | Grep for specific identifiers in cloned repos |
1120
- > | 📝 **Full-Text** | Exact matches | Find precise function names or imports |
1121
- >
1122
- > This flexibility means I can start broad (semantic) and narrow down (exact file access) seamlessly.
1123
- >
1124
- > ---
1125
- >
1126
- > #### 🕷️ Intelligent Crawling
1127
- >
1128
- > **The `--crawl` instruction isn't marketing**—it actually uses Claude Code CLI to analyze each page and intelligently select which links to follow. I can tell it "crawl all API reference pages but skip blog posts" and it understands the intent.
1129
- >
1130
- > For JavaScript-rendered sites (Next.js, React docs), the default headless mode renders pages with Playwright while I still control the crawl strategy with natural language. Use `--fast` when you need speed on static sites.
1131
- >
1132
- > ---
1133
- >
1134
- > #### ✨ What Makes It Valuable
1135
- >
1136
- > | Benefit | Impact |
1137
- > |---------|--------|
1138
- > | ✅ **No guessing** | I read actual source code, not blog interpretations |
1139
- > | 🔌 **Offline first** | Works without internet, zero rate limits |
1140
- > | 🎯 **Project-specific** | Index your team's standards, not generic advice |
1141
- > | ⚡ **Speed** | Sub-100ms searches vs 2-5 second web lookups |
1142
- > | 📚 **Completeness** | Tests, implementation details, edge cases—all indexed |
1143
- >
1144
- > ---
1145
- >
1146
- > #### 🌟 When It Shines Most
1147
- >
1148
- > 1. **Deep library questions** - "how does this internal method handle edge cases?"
1149
- > 2. **Version-specific answers** - your indexed version is what you're actually using
1150
- > 3. **Private codebases** - your docs, your standards, your patterns
1151
- > 4. **Complex workflows** - combining semantic search + direct file access + code graph
1152
- >
1153
- > ---
1154
- >
1155
- > The plugin essentially gives me a **photographic memory** of your dependencies and documentation.
1156
- >
1157
- > Instead of *"I think based on training data"*, I can say *"I searched the indexed React v18.2.0 source and found this in `ReactFiberWorkLoop.js:1247`"*.
1158
- >
1159
- > **That's the difference between helpful and authoritative.**
1160
-
1161
- ---
1162
-
1163
536
  ## 🔧 Dependencies
1164
537
 
1165
538
  The plugin automatically checks for and attempts to install Python dependencies on first use:
@@ -1198,253 +571,6 @@ export BK_SKIP_AUTO_INSTALL=1
1198
571
 
1199
572
  ---
1200
573
 
1201
- ## 🔌 MCP Integration
1202
-
1203
- The plugin includes a Model Context Protocol server that exposes search tools. This is configured inline in `.claude-plugin/plugin.json`:
1204
-
1205
- > [!IMPORTANT]
1206
- > **Commands vs MCP Tools**: You interact with the plugin using `/bluera-knowledge:` slash commands. Behind the scenes, these commands instruct Claude Code to use MCP tools (`mcp__bluera-knowledge__*`) which handle the actual operations. Commands provide the user interface, while MCP tools are the backend that AI agents use to access your knowledge stores.
1207
-
1208
- ```json
1209
- {
1210
- "mcpServers": {
1211
- "bluera-knowledge": {
1212
- "command": "node",
1213
- "args": ["${CLAUDE_PLUGIN_ROOT}/dist/mcp/server.js"],
1214
- "env": {
1215
- "PROJECT_ROOT": "${PWD}",
1216
- "DATA_DIR": ".bluera/bluera-knowledge/data",
1217
- "CONFIG_PATH": ".bluera/bluera-knowledge/config.json"
1218
- }
1219
- }
1220
- }
1221
- }
1222
- ```
1223
-
1224
- ### 🎯 Context Efficiency Strategy
1225
-
1226
- **Why only 3 MCP tools?**
1227
-
1228
- Every MCP tool exposed requires its full schema to be sent to Claude with each tool invocation. More tools = more tokens consumed before Claude can even respond.
1229
-
1230
- **Design decision:** Consolidate from 10+ tools down to 3:
1231
-
1232
- | Approach | Tool Count | Context Cost | Trade-off |
1233
- |----------|------------|--------------|-----------|
1234
- | Individual tools | 10+ | ~800+ tokens | Simple calls, high overhead |
1235
- | **Consolidated (current)** | 3 | ~300 tokens | Minimal overhead, slightly longer commands |
1236
-
1237
- **How it works:**
1238
-
1239
- 1. **Native tools for common workflow** - `search` and `get_full_context` are the operations Claude uses most often, so they get dedicated tools with full schemas
1240
-
1241
- 2. **Meta-tool for management** - The `execute` tool consolidates 8 store/job management commands into a single tool. Commands are discovered on-demand via `execute("commands")` or `execute("help", {command: "store:create"})`
1242
-
1243
- 3. **Lazy documentation** - Command help isn't pre-sent with tool listings; it's discoverable when needed
1244
-
1245
- **Result:** ~60% reduction in context overhead for MCP tool listings, without sacrificing functionality.
1246
-
1247
- > [!TIP]
1248
- > This pattern—consolidating infrequent operations into a meta-tool while keeping high-frequency operations native—is a general strategy for MCP context efficiency.
1249
-
1250
- ### 🛠️ Available MCP Tools
1251
-
1252
- The plugin exposes 3 MCP tools optimized for minimal context overhead:
1253
-
1254
- #### `search`
1255
- 🔍 Semantic vector search across all indexed stores or a specific subset. Returns structured code units with relevance ranking.
1256
-
1257
- **Parameters:**
1258
- - `query` - Search query (natural language, patterns, or type signatures)
1259
- - `intent` - Search intent: find-pattern, find-implementation, find-usage, find-definition, find-documentation
1260
- - `mode` - Search mode: hybrid (default), vector, or fts
1261
- - `detail` - Context level: minimal, contextual, or full
1262
- - `limit` - Maximum results (default: 10)
1263
- - `stores` - Array of specific store IDs to search (optional, searches all stores if not specified)
1264
- - `threshold` - Minimum normalized score (0-1) for filtering results
1265
- - `minRelevance` - Minimum raw cosine similarity (0-1) for filtering results
1266
-
1267
- #### `get_full_context`
1268
- 📖 Retrieve complete code and context for a specific search result by ID.
1269
-
1270
- **Parameters:**
1271
- - `resultId` - The result ID from a previous search
1272
-
1273
- #### `execute`
1274
- ⚡ Meta-tool for store and job management. Consolidates 8 operations into one tool with subcommands.
1275
-
1276
- **Parameters:**
1277
- - `command` - Command to execute (see below)
1278
- - `args` - Command-specific arguments (optional)
1279
-
1280
- **Available commands:**
1281
- | Command | Args | Description |
1282
- |---------|------|-------------|
1283
- | `stores` | `type?` | List all knowledge stores |
1284
- | `store:info` | `store` | Get detailed store information including file path |
1285
- | `store:create` | `name`, `type`, `source`, `branch?`, `description?` | Create a new store |
1286
- | `store:index` | `store` | Re-index an existing store |
1287
- | `store:delete` | `store` | Delete a store and all data |
1288
- | `stores:sync` | `dryRun?`, `prune?`, `reindex?` | Sync stores from definitions config |
1289
- | `jobs` | `activeOnly?`, `status?` | List background jobs |
1290
- | `job:status` | `jobId` | Check specific job status |
1291
- | `job:cancel` | `jobId` | Cancel a running job |
1292
- | `help` | `command?` | Show help for commands |
1293
- | `commands` | - | List all available commands |
1294
-
1295
- ---
1296
-
1297
- ## 🖥️ CLI Tool
1298
-
1299
- While Bluera Knowledge works seamlessly as a Claude Code plugin, it's also available as a standalone CLI tool for use outside Claude Code.
1300
-
1301
- > [!NOTE]
1302
- > 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.
1303
-
1304
- ### Installation
1305
-
1306
- Install globally via npm:
1307
-
1308
- ```bash
1309
- npm install -g bluera-knowledge
1310
- ```
1311
-
1312
- Or use in a project:
1313
-
1314
- ```bash
1315
- npm install --save-dev bluera-knowledge
1316
- ```
1317
-
1318
- ### Usage
1319
-
1320
- #### Create a Store
1321
-
1322
- ```bash
1323
- # Add a Git repository
1324
- bluera-knowledge store create react --type repo --source https://github.com/facebook/react
1325
-
1326
- # Add a Git repository with specific branch
1327
- bluera-knowledge store create react-canary --type repo --source https://github.com/facebook/react --branch canary
1328
-
1329
- # Add a local folder
1330
- bluera-knowledge store create my-docs --type file --source ./docs
1331
-
1332
- # Add a web crawl
1333
- bluera-knowledge store create fastapi-docs --type web --source https://fastapi.tiangolo.com
1334
- ```
1335
-
1336
- **Create Options:**
1337
- - `-t, --type <type>` - Store type: `file`, `repo`, or `web` (required)
1338
- - `-s, --source <path>` - Local path or URL (required)
1339
- - `-b, --branch <branch>` - Git branch to clone (repo stores only)
1340
- - `-d, --description <desc>` - Optional store description
1341
- - `--tags <tags>` - Comma-separated tags for filtering
1342
-
1343
- #### Index a Store
1344
-
1345
- ```bash
1346
- # Re-index a store (only changed files)
1347
- bluera-knowledge index react
1348
-
1349
- # Force re-index all files (ignores cache)
1350
- bluera-knowledge index react --force
1351
-
1352
- # Watch for changes and auto-reindex
1353
- bluera-knowledge index watch react
1354
- bluera-knowledge index watch react --debounce 2000 # Custom debounce (default: 1000ms)
1355
- ```
1356
-
1357
- **Index Options:**
1358
- - `-f, --force` - Re-index all files (ignore incremental cache)
1359
-
1360
- **Watch Options:**
1361
- - `--debounce <ms>` - Debounce delay for file changes (default: 1000ms)
1362
-
1363
- #### Search
1364
-
1365
- ```bash
1366
- # Search across all stores
1367
- bluera-knowledge search "how does useEffect work"
1368
-
1369
- # Search specific stores
1370
- bluera-knowledge search "routing" --stores react,vue
1371
-
1372
- # Get more results with full content
1373
- bluera-knowledge search "middleware" --limit 20 --include-content
1374
-
1375
- # Filter irrelevant results (returns empty if nothing is truly relevant)
1376
- bluera-knowledge search "kubernetes deployment" --min-relevance 0.4
1377
-
1378
- # Get JSON output with confidence and raw scores
1379
- bluera-knowledge search "express middleware" --format json
1380
- ```
1381
-
1382
- **Search Options:**
1383
- - `-s, --stores <stores>` - Comma-separated store names/IDs
1384
- - `-m, --mode <mode>` - `hybrid` (default), `vector`, or `fts`
1385
- - `-n, --limit <count>` - Max results (default: 10)
1386
- - `-t, --threshold <score>` - Min normalized score (0-1)
1387
- - `--min-relevance <score>` - Min raw cosine similarity (0-1)
1388
- - `--include-content` - Show full content in results
1389
- - `--detail <level>` - `minimal`, `contextual`, or `full`
1390
-
1391
- #### List Stores
1392
-
1393
- ```bash
1394
- bluera-knowledge store list
1395
- bluera-knowledge store list --type repo # Filter by type
1396
- ```
1397
-
1398
- #### Store Info
1399
-
1400
- ```bash
1401
- bluera-knowledge store info react
1402
- ```
1403
-
1404
- #### Delete a Store
1405
-
1406
- ```bash
1407
- # Interactive deletion (prompts for confirmation in TTY mode)
1408
- bluera-knowledge store delete old-store
1409
-
1410
- # Force delete without confirmation
1411
- bluera-knowledge store delete old-store --force
1412
- bluera-knowledge store delete old-store -y
1413
- ```
1414
-
1415
- **Delete Options:**
1416
- - `-f, --force` - Delete without confirmation prompt
1417
- - `-y, --yes` - Alias for `--force`
1418
-
1419
- ### Global Options
1420
-
1421
- ```bash
1422
- --config <path> # Custom config file
1423
- --data-dir <path> # Custom data directory
1424
- --project-root <path> # Project root for store definitions (required for sync)
1425
- --format <format> # Output format: json | table | plain
1426
- --quiet # Suppress non-essential output
1427
- --verbose # Enable verbose logging
1428
- ```
1429
-
1430
- ### When to Use CLI vs Plugin
1431
-
1432
- **Use CLI when:**
1433
- - Using an editor other than Claude Code (VSCode, Cursor, etc.)
1434
- - Integrating into CI/CD pipelines
1435
- - Scripting or automation
1436
- - Pre-indexing dependencies for teams
1437
-
1438
- **Use Plugin when:**
1439
- - Working within Claude Code
1440
- - Want slash commands (`/bluera-knowledge:search`)
1441
- - Need Claude to automatically query your knowledge base
1442
- - Want Skills to guide optimal usage
1443
-
1444
- Both interfaces use the same underlying services, so you can switch between them seamlessly.
1445
-
1446
- ---
1447
-
1448
574
  ## 🎓 Skills for Claude Code
1449
575
 
1450
576
  > [!NOTE]
@@ -1568,257 +694,6 @@ This ensures:
1568
694
 
1569
695
  ---
1570
696
 
1571
- ## 🛠️ Development
1572
-
1573
- ### 🚀 Setup
1574
-
1575
- ```bash
1576
- git clone https://github.com/blueraai/bluera-knowledge.git
1577
- cd bluera-knowledge
1578
- bun install
1579
- bun run build
1580
- bun test
1581
- ```
1582
-
1583
- > **Note:** This project uses [Bun](https://bun.sh) for development. Install it via `curl -fsSL https://bun.sh/install | bash`
1584
-
1585
- ### ⚙️ Claude Code Settings (Recommended)
1586
-
1587
- For the best development experience with Claude Code, copy the example settings file:
1588
-
1589
- ```bash
1590
- cp .claude/settings.local.json.example .claude/settings.local.json
1591
- ```
1592
-
1593
- **This provides:**
1594
- - ✅ **Smart validation** - Automatically runs lint/typecheck after editing code (file-type aware)
1595
- - ✅ **No permission prompts** - Pre-approves common commands (lint, typecheck, precommit)
1596
- - ✅ **Desktop notifications** - macOS notifications when Claude needs your input
1597
- - ✅ **Plugin auto-enabled** - Automatically enables the bluera-knowledge plugin
1598
- - ✅ **Faster workflow** - Catch issues immediately without manual validation
1599
-
1600
- The validation is intelligent - it only runs checks for TypeScript/JavaScript files, skipping docs/config to save time.
1601
-
1602
- > **Note:** The `.claude/settings.local.json` file is gitignored (local to your machine). The example file is checked in for reference.
1603
-
1604
- ### 🐕 Dogfooding
1605
-
1606
- Develop this plugin while using it with Claude Code:
1607
-
1608
- ```bash
1609
- claude --plugin-dir /path/to/bluera-knowledge
1610
- ```
1611
-
1612
- This loads the plugin directly from source. Changes take effect on Claude Code restart (no reinstall needed).
1613
-
1614
- | What to test | Approach |
1615
- |--------------|----------|
1616
- | **Commands** (`/search`, `/add-repo`) | `--plugin-dir` (changes need restart) |
1617
- | **Hooks** (job status, dependencies) | `--plugin-dir` (changes need restart) |
1618
- | **MCP tools** (compiled) | `--plugin-dir` (run `bun run build` first) |
1619
- | **MCP tools** (live TypeScript) | `~/.claude.json` dev server (see below) |
1620
-
1621
- ### 🔌 MCP Server Development
1622
-
1623
- **Production mode** (`mcp.plugin.json`):
1624
- - Uses `${CLAUDE_PLUGIN_ROOT}/dist/mcp/server.js` (compiled)
1625
- - Distributed with plugin, no extra setup needed
1626
-
1627
- **Development mode** (live TypeScript):
1628
-
1629
- For instant feedback when editing MCP server code, add a dev server to `~/.claude.json`:
1630
-
1631
- ```json
1632
- {
1633
- "mcpServers": {
1634
- "bluera-knowledge-dev": {
1635
- "command": "npx",
1636
- "args": ["tsx", "/path/to/bluera-knowledge/src/mcp/server.ts"],
1637
- "env": {
1638
- "PWD": "${PWD}",
1639
- "DATA_DIR": "${PWD}/.bluera/bluera-knowledge/data",
1640
- "CONFIG_PATH": "${PWD}/.bluera/bluera-knowledge/config.json"
1641
- }
1642
- }
1643
- }
1644
- }
1645
- ```
1646
-
1647
- This creates a separate `bluera-knowledge-dev` MCP server that runs source TypeScript directly via `tsx` - no rebuild needed for MCP changes
1648
-
1649
- ### 📜 Commands
1650
-
1651
- | Command | Description | When to Use |
1652
- |---------|-------------|-------------|
1653
- | `bun run build` | 🏗️ Compile TypeScript to dist/ | Before testing CLI, after code changes |
1654
- | `bun run dev` | 👀 Watch mode compilation | During active development |
1655
- | `bun start` | ▶️ Run the CLI | Execute CLI commands directly |
1656
- | `bun test` | 🧪 Run tests in watch mode | During TDD/active development |
1657
- | `bun run test:run` | ✅ Run tests once | Quick verification |
1658
- | `bun run test:coverage` | 📊 Run tests with coverage | Before committing, CI checks |
1659
- | `bun run lint` | 🔍 Run ESLint (quiet by default) | Check code style issues |
1660
- | `bun run typecheck` | 🔒 Run TypeScript type checking (quiet by default) | Verify type safety |
1661
- | `bun run precommit` | ✨ Smart validation (file-type aware) | Runs only relevant checks based on changed files |
1662
- | `bun run prepush` | 📊 Smart coverage (skips for docs/config) | Runs coverage only when src/tests changed |
1663
- | `bun run lint:verbose` | 📢 ESLint (full output) | Debugging lint issues |
1664
- | `bun run typecheck:verbose` | 📢 Type check (full output) | Debugging type errors |
1665
- | `bun run test:changed:verbose` | 📢 Test changed files (full output) | Debugging test failures |
1666
- | `bun run test:coverage:verbose` | 📢 Coverage (full output) | Reviewing detailed coverage |
1667
- | `bun run build:verbose` | 📢 Build (full output) | Debugging build issues |
1668
- | `bun run gh:status` | 📋 List recent GitHub Actions runs | Monitor CI/CD status |
1669
- | `bun run gh:watch` | 👁️ Watch latest workflow (quiet, shows result + failures) | Wait for CI completion |
1670
- | `bun run gh:watch:verbose` | 📢 Watch with live status updates | Debugging CI issues |
1671
- | `bun run gh:releases` | 🏷️ List recent GitHub releases | Check release history |
1672
-
1673
- ### 🔄 Automatic Build & Dist Commit
1674
-
1675
- The `dist/` directory **must be committed** because Claude Code plugins are installed by copying files—there's no build step during installation.
1676
-
1677
- **Good news: This is fully automatic!**
1678
-
1679
- 1. **On every commit**, the pre-commit hook intelligently validates based on file types
1680
- 2. **If source/config changed**, it runs build and automatically stages `dist/` via `git add dist/`
1681
- 3. **You never need to manually build or stage dist** — just commit your source changes
1682
-
1683
- **For live rebuilding during development:**
1684
-
1685
- ```bash
1686
- bun run dev # Watches for changes and rebuilds instantly
1687
- ```
1688
-
1689
- This is useful when testing CLI commands locally, but not required for committing — the hook handles everything.
1690
-
1691
- | `bun run version:patch` | 🔢 Run quality checks, then bump patch version (0.0.x) | Bug fixes, minor updates |
1692
- | `bun run version:minor` | 🔢 Run quality checks, then bump minor version (0.x.0) | New features, backwards compatible |
1693
- | `bun run version:major` | 🔢 Run quality checks, then bump major version (x.0.0) | Breaking changes |
1694
-
1695
- ### 🚀 Releasing
1696
-
1697
- ```bash
1698
- # Bump version, commit, tag, and push (triggers GitHub Actions release)
1699
- bun run release:patch # Bug fixes (0.0.x)
1700
- bun run release:minor # New features (0.x.0)
1701
- bun run release:major # Breaking changes (x.0.0)
1702
- ```
1703
-
1704
- **Workflow (Fully Automated):**
1705
-
1706
- 1. Make changes and commit
1707
- 2. Bump version: `bun run version:patch` (runs quality checks first, then updates package.json, plugin.json, README, CHANGELOG)
1708
- 3. Commit version bump: `git commit -am "chore: bump version to X.Y.Z"`
1709
- 4. Push to main: `git push`
1710
- 5. **GitHub Actions automatically:**
1711
- - ✅ Runs CI (lint, typecheck, tests, build)
1712
- - ✅ Creates release tag when CI passes
1713
- - ✅ Creates GitHub release
1714
- - ✅ Updates marketplace
1715
-
1716
- Note: The version command runs full quality checks (format, lint, deadcode, typecheck, coverage, build) BEFORE bumping to catch issues early.
1717
-
1718
- > 💡 **That's it!** No manual tagging needed. Just push to `main` and the release happens automatically when CI passes.
1719
-
1720
- ### 🔍 Post-Release Validation
1721
-
1722
- After a release, validate the npm package works correctly:
1723
-
1724
- ```bash
1725
- bun run validate:npm
1726
- ```
1727
-
1728
- This script:
1729
- - Installs the latest `bluera-knowledge` from npm globally
1730
- - Exercises all CLI commands (stores, add-folder, search, index, delete)
1731
- - Writes detailed logs to `logs/validation/npm-validation-*.log`
1732
- - Returns exit code 0 on success, 1 on failure
1733
-
1734
- Use this to catch any packaging or runtime issues after npm publish.
1735
-
1736
- ### 🧪 Plugin Self-Test
1737
-
1738
- Test all plugin functionality from within Claude Code:
1739
-
1740
- ```
1741
- /test-plugin
1742
- ```
1743
-
1744
- This command runs 13 tests covering:
1745
- - **MCP Tools**: execute (help, stores, create, info, index), search, get_full_context
1746
- - **Slash Commands**: /stores, /search, /suggest
1747
- - **Cleanup**: Store deletion, artifact removal, verification
1748
-
1749
- The test creates temporary content, exercises all features, and cleans up automatically. Use this to verify the plugin is working correctly after installation or updates.
1750
-
1751
- ### 🧪 Testing Locally
1752
-
1753
- **Option 1: Development MCP Server (Recommended)**
1754
-
1755
- Use the local development MCP server (see "MCP Server" section above) which runs your source code directly via `tsx`:
1756
-
1757
- 1. Set up dev MCP server in `~/.claude.json` (see MCP Server section)
1758
- 2. Test your changes - MCP server updates automatically as you edit code
1759
-
1760
- **Option 2: Test Plugin from Working Directory**
1761
-
1762
- Load the plugin directly from your development directory:
1763
-
1764
- ```bash
1765
- cd /path/to/bluera-knowledge
1766
- claude --plugin-dir .
1767
- ```
1768
-
1769
- The MCP config in `plugin.json` is only loaded when the directory is loaded as a plugin (via `--plugin-dir` or marketplace install), so there's no conflict with project-level MCP config.
1770
-
1771
- **Option 3: CLI Tool Testing**
1772
-
1773
- ```bash
1774
- # Build and link
1775
- cd /path/to/bluera-knowledge
1776
- bun run build
1777
- bun link
1778
-
1779
- # Now 'bluera-knowledge' command is available globally
1780
- cd ~/your-project
1781
- bluera-knowledge search "test query" my-store
1782
- ```
1783
-
1784
- **For testing as an installed plugin:**
1785
- This requires publishing a new version to the marketplace.
1786
-
1787
- ### 📂 Project Structure
1788
-
1789
- ```
1790
- .claude-plugin/
1791
- └── plugin.json # Plugin metadata (references mcp.plugin.json)
1792
-
1793
- mcp.plugin.json # MCP server configuration (plugin-scoped)
1794
- commands/ # Slash commands (auto-discovered)
1795
- skills/ # Agent Skills (auto-discovered)
1796
- ├── knowledge-search/ # How to access dependency sources
1797
- │ └── SKILL.md
1798
- ├── when-to-query/ # When to query BK vs project files
1799
- │ └── SKILL.md
1800
- ├── advanced-workflows/ # Multi-tool orchestration patterns
1801
- │ └── SKILL.md
1802
- ├── search-optimization/ # Search parameter optimization
1803
- │ └── SKILL.md
1804
- └── store-lifecycle/ # Store management best practices
1805
- └── SKILL.md
1806
- dist/ # Built MCP server (committed for distribution)
1807
-
1808
- src/
1809
- ├── analysis/ # Dependency analysis & URL resolution
1810
- ├── crawl/ # Web crawling with Python bridge
1811
- ├── services/ # Index, store, and search services
1812
- ├── mcp/ # MCP server source
1813
- └── cli/ # CLI entry point
1814
-
1815
- tests/
1816
- ├── integration/ # Integration tests
1817
- └── fixtures/ # Test infrastructure
1818
- ```
1819
-
1820
- ---
1821
-
1822
697
  ## 🔬 Technologies
1823
698
 
1824
699
  - **🔌 Claude Code Plugin System** with MCP server
@@ -1832,14 +707,22 @@ tests/
1832
707
 
1833
708
  ---
1834
709
 
1835
- ## 🤝 Contributing
710
+ ## 📚 Documentation
711
+
712
+ | Document | Description |
713
+ |----------|-------------|
714
+ | [CLI Reference](docs/cli.md) | Complete CLI commands, options, and usage examples |
715
+ | [MCP Integration](docs/mcp-integration.md) | MCP server configuration and tool documentation |
716
+ | [Commands Reference](docs/commands.md) | All slash commands with parameters and examples |
717
+ | [Crawler Architecture](docs/crawler-architecture.md) | How the intelligent web crawler works |
718
+ | [Token Efficiency](docs/token-efficiency.md) | How BK reduces token consumption vs web search |
719
+ | [CONTRIBUTING](CONTRIBUTING.md) | Development setup, testing, and release process |
1836
720
 
1837
- Contributions welcome! Please:
721
+ ---
722
+
723
+ ## 🤝 Contributing
1838
724
 
1839
- 1. 🍴 Fork the repository
1840
- 2. 🌿 Create a feature branch
1841
- 3. ✅ Add tests
1842
- 4. 📬 Submit a pull request
725
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing, and release process.
1843
726
 
1844
727
  ---
1845
728