bluera-knowledge 0.13.0 → 0.13.2
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/.claude/rules/code-quality.md +12 -0
- package/.claude/rules/git.md +5 -0
- package/.claude/rules/versioning.md +7 -0
- package/.claude-plugin/plugin.json +2 -15
- package/.mcp.json +11 -0
- package/CHANGELOG.md +7 -0
- package/CLAUDE.md +5 -13
- package/CONTRIBUTING.md +307 -0
- package/README.md +58 -1167
- package/commands/crawl.md +2 -1
- package/commands/test-plugin.md +197 -72
- package/docs/claude-code-best-practices.md +458 -0
- package/docs/cli.md +170 -0
- package/docs/commands.md +392 -0
- package/docs/crawler-architecture.md +89 -0
- package/docs/mcp-integration.md +130 -0
- package/docs/token-efficiency.md +91 -0
- package/eslint.config.js +1 -1
- package/hooks/check-dependencies.sh +18 -1
- package/hooks/hooks.json +2 -2
- package/hooks/posttooluse-bk-reminder.py +30 -2
- package/package.json +1 -1
- package/scripts/test-mcp-dev.js +260 -0
- package/src/mcp/plugin-mcp-config.test.ts +26 -19
- package/tests/integration/cli-consistency.test.ts +3 -2
- package/docs/plans/2024-12-17-ai-search-quality-implementation.md +0 -752
- package/docs/plans/2024-12-17-ai-search-quality-testing-design.md +0 -201
- package/docs/plans/2025-12-16-bluera-knowledge-cli.md +0 -2951
- package/docs/plans/2025-12-16-phase2-features.md +0 -1518
- package/docs/plans/2025-12-17-hil-implementation.md +0 -926
- package/docs/plans/2025-12-17-hil-quality-testing.md +0 -224
- package/docs/plans/2025-12-17-search-quality-phase1-implementation.md +0 -1416
- package/docs/plans/2025-12-17-search-quality-testing-v2-design.md +0 -212
- package/docs/plans/2025-12-28-ai-agent-optimization.md +0 -1630
package/commands/crawl.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Crawl web pages with natural language control and add to knowledge store
|
|
3
3
|
argument-hint: "[url] [store-name] [--crawl instruction] [--extract instruction] [--fast]"
|
|
4
|
-
allowed-tools: [Bash(
|
|
4
|
+
allowed-tools: ["Bash(node ${CLAUDE_PLUGIN_ROOT}/dist/index.js crawl:*)"]
|
|
5
|
+
context: fork
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
Crawling and indexing: $ARGUMENTS
|
package/commands/test-plugin.md
CHANGED
|
@@ -1,24 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run comprehensive plugin validation test suite
|
|
3
|
+
argument-hint: "[--dev]"
|
|
4
|
+
context: fork
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Test Plugin
|
|
2
8
|
|
|
3
|
-
Comprehensive test of all Bluera Knowledge plugin functionality
|
|
9
|
+
Comprehensive test of all Bluera Knowledge plugin functionality.
|
|
10
|
+
|
|
11
|
+
## When to Use Each Mode
|
|
12
|
+
|
|
13
|
+
| Scenario | Command | Tests |
|
|
14
|
+
|----------|---------|-------|
|
|
15
|
+
| Claude running with `--plugin-dir .` | `/test-plugin` | 19/19 (full suite) |
|
|
16
|
+
| Plugin installed from marketplace | `/test-plugin` | 19/19 (full suite) |
|
|
17
|
+
| Claude running WITHOUT plugin loaded | `/test-plugin --dev` | 16/19 (no slash cmds) |
|
|
18
|
+
| CI/CD or scripted testing (no Claude) | `--dev` via bash | 16/19 (no slash cmds) |
|
|
19
|
+
|
|
20
|
+
**Modes:**
|
|
21
|
+
- **Default mode**: Uses Claude's MCP tools. Works when plugin is loaded via `--plugin-dir .` or installed from marketplace. Runs all 19 tests including slash commands.
|
|
22
|
+
- **`--dev` mode**: Spawns MCP server directly via `scripts/test-mcp-dev.js`. Works without Claude Code or when plugin isn't loaded. Skips slash command tests (8-10) since they require Claude's skill router.
|
|
23
|
+
|
|
24
|
+
**Recommendation:** If developing with `claude --plugin-dir .`, use default mode (no `--dev` flag) for full test coverage.
|
|
4
25
|
|
|
5
26
|
## Context
|
|
6
27
|
|
|
7
28
|
!`echo "=== BK Plugin Test ===" && ls -la .bluera/bluera-knowledge/ 2>/dev/null || echo "No BK data dir yet (will be created)"`
|
|
8
29
|
|
|
30
|
+
## Mode Detection
|
|
31
|
+
|
|
32
|
+
Check if `--dev` flag is present in: $ARGUMENTS
|
|
33
|
+
|
|
34
|
+
- If `--dev` is present: Use **Development Mode** (MCP via scripts/test-mcp-dev.js)
|
|
35
|
+
- Otherwise: Use **Production Mode** (MCP via Claude's built-in tools)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
9
39
|
## Pre-Test Cleanup
|
|
10
40
|
|
|
11
41
|
First, clean up any leftover artifacts from previous test runs (ignore errors if they don't exist):
|
|
12
42
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
43
|
+
**In `--dev` mode:**
|
|
44
|
+
```bash
|
|
45
|
+
node scripts/test-mcp-dev.js call execute '{"command":"store:delete","args":{"store":"bk-test-store"}}' 2>/dev/null || true
|
|
46
|
+
rm -rf .bluera/bluera-knowledge/test-content
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**In production mode:**
|
|
50
|
+
1. Call MCP tool `execute` with `{ command: "store:delete", args: { store: "bk-test-store" } }` - ignore errors
|
|
51
|
+
2. Run: `rm -rf .bluera/bluera-knowledge/test-content`
|
|
18
52
|
|
|
19
53
|
## Test Content Setup
|
|
20
54
|
|
|
21
|
-
|
|
55
|
+
Create test content for indexing:
|
|
22
56
|
|
|
23
57
|
```bash
|
|
24
58
|
mkdir -p .bluera/bluera-knowledge/test-content
|
|
@@ -40,136 +74,225 @@ EOF
|
|
|
40
74
|
|
|
41
75
|
Execute each test in order. Mark each as PASS or FAIL.
|
|
42
76
|
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
# DEVELOPMENT MODE (`--dev`)
|
|
80
|
+
|
|
81
|
+
Use this section if `--dev` flag is present. Uses `scripts/test-mcp-dev.js` to spawn MCP server directly.
|
|
82
|
+
|
|
83
|
+
### Part 1: MCP Server Tests (via dev script)
|
|
84
|
+
|
|
85
|
+
1. **MCP Connection**:
|
|
86
|
+
```bash
|
|
87
|
+
node scripts/test-mcp-dev.js call execute '{"command":"help"}'
|
|
88
|
+
```
|
|
89
|
+
- PASS if output contains "Available commands"
|
|
90
|
+
|
|
91
|
+
2. **List Stores**:
|
|
92
|
+
```bash
|
|
93
|
+
node scripts/test-mcp-dev.js call execute '{"command":"stores"}'
|
|
94
|
+
```
|
|
95
|
+
- PASS if no error (may return empty array)
|
|
96
|
+
|
|
97
|
+
3. **Create Store**:
|
|
98
|
+
```bash
|
|
99
|
+
node scripts/test-mcp-dev.js call execute '{"command":"store:create","args":{"name":"bk-test-store","type":"file","source":".bluera/bluera-knowledge/test-content"}}'
|
|
100
|
+
```
|
|
101
|
+
- PASS if response indicates success
|
|
102
|
+
|
|
103
|
+
4. **Store Info**:
|
|
104
|
+
```bash
|
|
105
|
+
node scripts/test-mcp-dev.js call execute '{"command":"store:info","args":{"store":"bk-test-store"}}'
|
|
106
|
+
```
|
|
107
|
+
- PASS if response contains store details
|
|
108
|
+
|
|
109
|
+
5. **Index Store** (via CLI for reliability):
|
|
110
|
+
```bash
|
|
111
|
+
node dist/index.js index bk-test-store
|
|
112
|
+
```
|
|
113
|
+
- PASS if output shows "Indexed X documents"
|
|
114
|
+
|
|
115
|
+
6-7. **Search + Get Full Context** (session mode to maintain cache):
|
|
116
|
+
```bash
|
|
117
|
+
node scripts/test-mcp-dev.js session << 'EOF'
|
|
118
|
+
search {"query":"validateBKPlugin","stores":["bk-test-store"]}
|
|
119
|
+
get_full_context {"resultId":"$LAST_ID"}
|
|
120
|
+
EOF
|
|
121
|
+
```
|
|
122
|
+
- PASS if first result has non-empty results array
|
|
123
|
+
- PASS if second result contains "BK Plugin Test File"
|
|
124
|
+
|
|
125
|
+
### Part 2: Slash Commands (SKIPPED in --dev mode)
|
|
126
|
+
|
|
127
|
+
Tests 8-10 are skipped in development mode because slash commands require Claude Code to invoke them. The MCP server tests (Part 1) provide equivalent coverage of the underlying functionality.
|
|
128
|
+
|
|
129
|
+
### Part 3: Hook Tests (same for both modes)
|
|
130
|
+
|
|
131
|
+
[Continue to Part 3 below]
|
|
132
|
+
|
|
133
|
+
### Part 4: Cleanup (--dev mode)
|
|
134
|
+
|
|
135
|
+
17. **Delete Store**:
|
|
136
|
+
```bash
|
|
137
|
+
node scripts/test-mcp-dev.js call execute '{"command":"store:delete","args":{"store":"bk-test-store"}}'
|
|
138
|
+
```
|
|
139
|
+
- PASS if deletion succeeds
|
|
140
|
+
|
|
141
|
+
18. **Remove Test Content**:
|
|
142
|
+
```bash
|
|
143
|
+
rm -rf .bluera/bluera-knowledge/test-content
|
|
144
|
+
```
|
|
145
|
+
- PASS if command succeeds
|
|
146
|
+
|
|
147
|
+
19. **Verify Cleanup**:
|
|
148
|
+
```bash
|
|
149
|
+
node scripts/test-mcp-dev.js call execute '{"command":"stores"}'
|
|
150
|
+
```
|
|
151
|
+
- PASS if bk-test-store is NOT in the list
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
# PRODUCTION MODE (default)
|
|
156
|
+
|
|
157
|
+
Use this section if `--dev` flag is NOT present. Uses Claude's built-in MCP tools.
|
|
158
|
+
|
|
43
159
|
### Part 1: MCP Tools
|
|
44
160
|
|
|
45
161
|
1. **MCP Connection**: Call MCP tool `execute` with `{ command: "help" }`
|
|
46
|
-
- Expected: Returns list of available commands
|
|
47
162
|
- PASS if response contains "Available commands"
|
|
48
163
|
|
|
49
164
|
2. **List Stores (MCP)**: Call MCP tool `execute` with `{ command: "stores" }`
|
|
50
|
-
- Expected: Returns store list (may be empty initially)
|
|
51
165
|
- PASS if no error
|
|
52
166
|
|
|
53
167
|
3. **Create Store**: Call MCP tool `execute` with:
|
|
54
168
|
```json
|
|
55
169
|
{ "command": "store:create", "args": { "name": "bk-test-store", "type": "file", "source": ".bluera/bluera-knowledge/test-content" } }
|
|
56
170
|
```
|
|
57
|
-
- Expected: Store created successfully
|
|
58
171
|
- PASS if response indicates success
|
|
59
172
|
|
|
60
173
|
4. **Store Info**: Call MCP tool `execute` with:
|
|
61
174
|
```json
|
|
62
175
|
{ "command": "store:info", "args": { "store": "bk-test-store" } }
|
|
63
176
|
```
|
|
64
|
-
- Expected: Returns store metadata including name, type, path
|
|
65
177
|
- PASS if response contains store details
|
|
66
178
|
|
|
67
|
-
5. **Index Store**: Run CLI command via Bash
|
|
179
|
+
5. **Index Store**: Run CLI command via Bash:
|
|
68
180
|
```bash
|
|
69
181
|
node dist/index.js index bk-test-store
|
|
70
182
|
```
|
|
71
|
-
- Expected: Output shows "Indexed X documents, Y chunks"
|
|
72
183
|
- PASS if indexing completes successfully
|
|
73
184
|
|
|
74
185
|
6. **Search (MCP)**: Call MCP tool `search` with:
|
|
75
186
|
```json
|
|
76
187
|
{ "query": "validateBKPlugin", "stores": ["bk-test-store"] }
|
|
77
188
|
```
|
|
78
|
-
-
|
|
79
|
-
- PASS if results array is non-empty and contains test file
|
|
189
|
+
- PASS if results array is non-empty
|
|
80
190
|
|
|
81
|
-
7. **Get Full Context**:
|
|
82
|
-
```json
|
|
83
|
-
{ "resultId": "<id from search result>" }
|
|
84
|
-
```
|
|
85
|
-
- Expected: Returns full file content
|
|
191
|
+
7. **Get Full Context**: Call MCP tool `get_full_context` with resultId from step 6
|
|
86
192
|
- PASS if response contains "BK Plugin Test File"
|
|
87
193
|
|
|
88
194
|
### Part 2: Slash Commands
|
|
89
195
|
|
|
90
196
|
8. **Stores Command**: Run `/bluera-knowledge:stores`
|
|
91
|
-
-
|
|
92
|
-
- PASS if store is listed
|
|
197
|
+
- PASS if bk-test-store is listed
|
|
93
198
|
|
|
94
199
|
9. **Search Command**: Run `/bluera-knowledge:search "bluera-knowledge-test"`
|
|
95
|
-
- Expected: Returns results from test store
|
|
96
200
|
- PASS if results are shown
|
|
97
201
|
|
|
98
202
|
10. **Suggest Command**: Run `/bluera-knowledge:suggest`
|
|
99
|
-
- Expected: Runs without error (may show no suggestions if no package.json)
|
|
100
203
|
- PASS if no error thrown
|
|
101
204
|
|
|
102
|
-
### Part 3: Hook Tests
|
|
205
|
+
### Part 3: Hook Tests (same for both modes)
|
|
206
|
+
|
|
207
|
+
[Continue to Part 3 below]
|
|
103
208
|
|
|
104
|
-
|
|
209
|
+
### Part 4: Cleanup (production mode)
|
|
105
210
|
|
|
106
|
-
|
|
211
|
+
17. **Delete Store**: Call MCP tool `execute` with:
|
|
212
|
+
```json
|
|
213
|
+
{ "command": "store:delete", "args": { "store": "bk-test-store" } }
|
|
214
|
+
```
|
|
215
|
+
- PASS if deletion succeeds
|
|
216
|
+
|
|
217
|
+
18. **Remove Test Content**:
|
|
107
218
|
```bash
|
|
108
|
-
|
|
219
|
+
rm -rf .bluera/bluera-knowledge/test-content
|
|
109
220
|
```
|
|
110
|
-
-
|
|
111
|
-
- PASS if command succeeds with truthy output
|
|
221
|
+
- PASS if command succeeds
|
|
112
222
|
|
|
113
|
-
|
|
223
|
+
19. **Verify Cleanup**: Call MCP tool `execute` with `{ command: "stores" }`
|
|
224
|
+
- PASS if bk-test-store is NOT in the list
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
# Part 3: Hook Tests (both modes)
|
|
229
|
+
|
|
230
|
+
These tests verify that plugin hooks work correctly by running hook scripts directly.
|
|
231
|
+
|
|
232
|
+
11. **Hook Registration**:
|
|
233
|
+
```bash
|
|
234
|
+
cat hooks/hooks.json | jq -e '.hooks.PostToolUse and .hooks.UserPromptSubmit and .hooks.SessionStart'
|
|
235
|
+
```
|
|
236
|
+
- PASS if returns `true`
|
|
237
|
+
|
|
238
|
+
12. **PostToolUse Hook - Library Detection**:
|
|
114
239
|
```bash
|
|
115
240
|
echo '{"tool_name": "Read", "tool_input": {"file_path": "/project/node_modules/express/index.js"}}' | python3 hooks/posttooluse-bk-reminder.py
|
|
116
241
|
```
|
|
117
|
-
-
|
|
118
|
-
- PASS if output contains reminder text and library name "express"
|
|
242
|
+
- PASS if output contains "BLUERA-KNOWLEDGE REMINDER" and "express"
|
|
119
243
|
|
|
120
|
-
13. **PostToolUse Hook - Non-Library (Silent)**:
|
|
244
|
+
13. **PostToolUse Hook - Non-Library (Silent)**:
|
|
121
245
|
```bash
|
|
122
246
|
echo '{"tool_name": "Read", "tool_input": {"file_path": "/project/src/index.ts"}}' | python3 hooks/posttooluse-bk-reminder.py
|
|
123
247
|
```
|
|
124
|
-
- Expected: Empty output (no reminder for non-library paths)
|
|
125
248
|
- PASS if output is empty
|
|
126
249
|
|
|
127
|
-
14. **Skill Activation Hook - Matching Prompt**:
|
|
250
|
+
14. **Skill Activation Hook - Matching Prompt**:
|
|
128
251
|
```bash
|
|
129
252
|
export CLAUDE_PLUGIN_ROOT="$(pwd)" && echo '{"prompt": "why does the express package throw this error?"}' | python3 hooks/skill-activation.py
|
|
130
253
|
```
|
|
131
|
-
-
|
|
132
|
-
- PASS if output contains "MANDATORY EVALUATION" and "knowledge-search"
|
|
254
|
+
- PASS if output contains "MANDATORY EVALUATION"
|
|
133
255
|
|
|
134
|
-
15. **Skill Activation Hook - Excluded Prompt**:
|
|
256
|
+
15. **Skill Activation Hook - Excluded Prompt**:
|
|
135
257
|
```bash
|
|
136
258
|
export CLAUDE_PLUGIN_ROOT="$(pwd)" && echo '{"prompt": "/bluera-knowledge:search express"}' | python3 hooks/skill-activation.py
|
|
137
259
|
```
|
|
138
|
-
- Expected: Empty output (global exclusion matches)
|
|
139
260
|
- PASS if output is empty
|
|
140
261
|
|
|
141
|
-
16. **Skill Rules File**:
|
|
262
|
+
16. **Skill Rules File**:
|
|
142
263
|
```bash
|
|
143
264
|
jq -e '(.skills | length) > 0 and (.globalExclusions | length) > 0' hooks/skill-rules.json
|
|
144
265
|
```
|
|
145
|
-
-
|
|
146
|
-
- PASS if command succeeds
|
|
147
|
-
|
|
148
|
-
### Part 4: Cleanup
|
|
266
|
+
- PASS if returns `true`
|
|
149
267
|
|
|
150
|
-
|
|
151
|
-
```json
|
|
152
|
-
{ "command": "store:delete", "args": { "store": "bk-test-store" } }
|
|
153
|
-
```
|
|
154
|
-
- Expected: Store deleted
|
|
155
|
-
- PASS if deletion succeeds
|
|
268
|
+
---
|
|
156
269
|
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
rm -rf .bluera/bluera-knowledge/test-content
|
|
160
|
-
```
|
|
161
|
-
- Expected: Directory removed
|
|
162
|
-
- PASS if command succeeds
|
|
270
|
+
## Output Format
|
|
163
271
|
|
|
164
|
-
|
|
165
|
-
- Expected: bk-test-store is NOT in the list
|
|
166
|
-
- PASS if test store is gone
|
|
272
|
+
### For `--dev` mode (16 tests):
|
|
167
273
|
|
|
168
|
-
|
|
274
|
+
| # | Test | Status |
|
|
275
|
+
|---|------|--------|
|
|
276
|
+
| 1 | MCP Connection (help) | ? |
|
|
277
|
+
| 2 | List Stores | ? |
|
|
278
|
+
| 3 | Create Store | ? |
|
|
279
|
+
| 4 | Store Info | ? |
|
|
280
|
+
| 5 | Index Store | ? |
|
|
281
|
+
| 6-7 | Search + Get Full Context | ? |
|
|
282
|
+
| 8-10 | Slash Commands | SKIPPED (--dev mode) |
|
|
283
|
+
| 11 | Hook Registration | ? |
|
|
284
|
+
| 12 | PostToolUse - Library Detection | ? |
|
|
285
|
+
| 13 | PostToolUse - Non-Library | ? |
|
|
286
|
+
| 14 | Skill Activation - Matching | ? |
|
|
287
|
+
| 15 | Skill Activation - Excluded | ? |
|
|
288
|
+
| 16 | Skill Rules File | ? |
|
|
289
|
+
| 17 | Delete Store | ? |
|
|
290
|
+
| 18 | Remove Test Content | ? |
|
|
291
|
+
| 19 | Verify Cleanup | ? |
|
|
169
292
|
|
|
170
|
-
|
|
293
|
+
**Result: X/16 tests passed (3 skipped)**
|
|
171
294
|
|
|
172
|
-
###
|
|
295
|
+
### For production mode (19 tests):
|
|
173
296
|
|
|
174
297
|
| # | Test | Status |
|
|
175
298
|
|---|------|--------|
|
|
@@ -185,7 +308,7 @@ After running all tests, report results in this format:
|
|
|
185
308
|
| 10 | /suggest Command | ? |
|
|
186
309
|
| 11 | Hook Registration | ? |
|
|
187
310
|
| 12 | PostToolUse - Library Detection | ? |
|
|
188
|
-
| 13 | PostToolUse - Non-Library
|
|
311
|
+
| 13 | PostToolUse - Non-Library | ? |
|
|
189
312
|
| 14 | Skill Activation - Matching | ? |
|
|
190
313
|
| 15 | Skill Activation - Excluded | ? |
|
|
191
314
|
| 16 | Skill Rules File | ? |
|
|
@@ -195,16 +318,18 @@ After running all tests, report results in this format:
|
|
|
195
318
|
|
|
196
319
|
**Result: X/19 tests passed**
|
|
197
320
|
|
|
321
|
+
---
|
|
322
|
+
|
|
198
323
|
## Error Recovery
|
|
199
324
|
|
|
200
325
|
If tests fail partway through, clean up manually:
|
|
201
326
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
327
|
+
**In --dev mode:**
|
|
328
|
+
```bash
|
|
329
|
+
node scripts/test-mcp-dev.js call execute '{"command":"store:delete","args":{"store":"bk-test-store"}}' 2>/dev/null || true
|
|
330
|
+
rm -rf .bluera/bluera-knowledge/test-content
|
|
331
|
+
```
|
|
206
332
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
```
|
|
333
|
+
**In production mode:**
|
|
334
|
+
1. Call MCP tool `execute` with `{ command: "store:delete", args: { store: "bk-test-store" } }`
|
|
335
|
+
2. Run: `rm -rf .bluera/bluera-knowledge/test-content`
|