bluera-knowledge 0.34.0 → 0.34.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-plugin/plugin.json +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/{chunk-4S6LWHKI.js → chunk-TD3VX74F.js} +2 -2
- package/dist/{chunk-K2EB4PGE.js → chunk-V5MWZM5X.js} +8 -4
- package/dist/chunk-V5MWZM5X.js.map +1 -0
- package/dist/{chunk-FYHKBCIH.js → chunk-VELBEZVB.js} +12 -2
- package/dist/chunk-VELBEZVB.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/mcp/bootstrap.js +6 -2
- package/dist/mcp/bootstrap.js.map +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/workers/background-worker-cli.js +2 -2
- package/hooks/posttooluse-bk-reminder.py +0 -0
- package/hooks/posttooluse-web-research.py +0 -0
- package/hooks/posttooluse-websearch-bk.py +0 -0
- package/package.json +1 -1
- package/scripts/auto-setup.sh +3 -0
- package/skills/advanced-workflows/SKILL.md +26 -246
- package/skills/advanced-workflows/references/examples.md +86 -0
- package/skills/eval/SKILL.md +16 -203
- package/skills/eval/references/output-format.md +73 -0
- package/skills/eval/references/procedures.md +61 -0
- package/skills/store-lifecycle/SKILL.md +16 -441
- package/skills/store-lifecycle/references/operations.md +75 -0
- package/skills/store-lifecycle/references/source-types.md +48 -0
- package/skills/test-plugin/SKILL.md +8 -515
- package/skills/test-plugin/references/output-format.md +43 -0
- package/skills/test-plugin/references/test-procedures.md +107 -0
- package/dist/chunk-FYHKBCIH.js.map +0 -1
- package/dist/chunk-K2EB4PGE.js.map +0 -1
- package/hooks/pretooluse-bk-suggest.py +0 -296
- package/hooks/skill-activation.py +0 -221
- package/hooks/skill-rules.json +0 -131
- /package/dist/{chunk-4S6LWHKI.js.map → chunk-TD3VX74F.js.map} +0 -0
|
@@ -3,452 +3,24 @@ name: store-lifecycle
|
|
|
3
3
|
description: Create, index, and manage BK stores
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Store Lifecycle Management
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Source Types
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
**✅ Use for:**
|
|
17
|
-
- Public library source code (React, Vue, Pydantic, etc.)
|
|
18
|
-
- Private repositories with auth
|
|
19
|
-
- Code you want to track and update
|
|
20
|
-
- Multi-file projects with git history
|
|
21
|
-
|
|
22
|
-
**Advantages:**
|
|
23
|
-
- Preserves git history
|
|
24
|
-
- Can pull updates (`git pull` in repo directory)
|
|
25
|
-
- Standard structure recognized by analyzers
|
|
26
|
-
- Automatic language detection
|
|
27
|
-
|
|
28
|
-
**Example:**
|
|
29
|
-
```
|
|
30
|
-
/bluera-knowledge:add-repo https://github.com/vuejs/core --name=vue
|
|
31
|
-
|
|
32
|
-
# Or via MCP:
|
|
33
|
-
create_store(
|
|
34
|
-
source='https://github.com/vuejs/core',
|
|
35
|
-
name='vue',
|
|
36
|
-
type='repo'
|
|
37
|
-
)
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**Best practices:**
|
|
41
|
-
- Use package/library name for consistency: `vue`, `fastapi`, `pydantic`
|
|
42
|
-
- For monorepos: `org-project` format: `microsoft-typescript`, `vercel-next`
|
|
43
|
-
- Include version if tracking specific release: `vue-3.4`, `python-3.11`
|
|
44
|
-
|
|
45
|
-
### Local Folders (`add-folder`)
|
|
46
|
-
|
|
47
|
-
**✅ Use for:**
|
|
48
|
-
- Private codebases not in git
|
|
49
|
-
- Work-in-progress code
|
|
50
|
-
- Local documentation
|
|
51
|
-
- Specific subdirectories of larger projects
|
|
52
|
-
|
|
53
|
-
**Advantages:**
|
|
54
|
-
- No git required
|
|
55
|
-
- Fast indexing (no clone step)
|
|
56
|
-
- Perfect for proprietary code
|
|
57
|
-
- Can index subset of larger repo
|
|
58
|
-
|
|
59
|
-
**Example:**
|
|
60
|
-
```
|
|
61
|
-
/bluera-knowledge:add-folder /path/to/my-project/api --name=my-api
|
|
62
|
-
|
|
63
|
-
# Or via MCP:
|
|
64
|
-
create_store(
|
|
65
|
-
source='/Users/me/projects/my-app/backend',
|
|
66
|
-
name='my-backend',
|
|
67
|
-
type='folder'
|
|
68
|
-
)
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Best practices:**
|
|
72
|
-
- Use descriptive names: `my-api`, `auth-service`, `shared-utils`
|
|
73
|
-
- Index focused directories (not entire ~/ )
|
|
74
|
-
- Update by re-indexing: `/bluera-knowledge:index my-api`
|
|
75
|
-
|
|
76
|
-
### Web Documentation (`crawl`)
|
|
77
|
-
|
|
78
|
-
**✅ Use for:**
|
|
79
|
-
- Official documentation sites
|
|
80
|
-
- API references hosted online
|
|
81
|
-
- Tutorials and guides
|
|
82
|
-
- Content only available via web
|
|
83
|
-
|
|
84
|
-
**Advantages:**
|
|
85
|
-
- Access web-only content
|
|
86
|
-
- Handles JavaScript-rendered sites (headless mode)
|
|
87
|
-
- Follows links automatically
|
|
88
|
-
- Converts HTML to searchable text
|
|
89
|
-
|
|
90
|
-
**Example:**
|
|
91
|
-
```
|
|
92
|
-
/bluera-knowledge:crawl https://fastapi.tiangolo.com --name=fastapi-docs --max-pages=100
|
|
93
|
-
|
|
94
|
-
# Or via MCP:
|
|
95
|
-
create_store(
|
|
96
|
-
source='https://fastapi.tiangolo.com',
|
|
97
|
-
name='fastapi-docs',
|
|
98
|
-
type='web',
|
|
99
|
-
max_pages=100
|
|
100
|
-
)
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**Best practices:**
|
|
104
|
-
- Append `-docs` to library name: `fastapi-docs`, `vue-docs`
|
|
105
|
-
- Set `max-pages` to avoid crawling entire internet
|
|
106
|
-
- Use `--headless` for JavaScript-heavy sites
|
|
107
|
-
- Crawl specific documentation paths, not marketing pages
|
|
10
|
+
| Type | Command | Best For |
|
|
11
|
+
|------|---------|----------|
|
|
12
|
+
| Git repo | `/add-repo <url>` | Public libraries, trackable code |
|
|
13
|
+
| Local folder | `/add-folder <path>` | Private code, subdirectories |
|
|
14
|
+
| Web docs | `/crawl <url>` | Documentation sites, API refs |
|
|
108
15
|
|
|
109
16
|
## Naming Conventions
|
|
110
17
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
**Library source code:**
|
|
116
|
-
```
|
|
117
|
-
vue # Official package name
|
|
118
|
-
react
|
|
119
|
-
fastapi
|
|
120
|
-
pydantic
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
**Documentation sites:**
|
|
124
|
-
```
|
|
125
|
-
vue-docs
|
|
126
|
-
fastapi-docs
|
|
127
|
-
python-3.11-docs
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
**Organization/project format:**
|
|
131
|
-
```
|
|
132
|
-
microsoft-typescript
|
|
133
|
-
vercel-next
|
|
134
|
-
acme-payment-api # Your company's code
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Versioned stores:**
|
|
138
|
-
```
|
|
139
|
-
vue-3.4
|
|
140
|
-
python-3.11
|
|
141
|
-
react-18
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
**Specialized content:**
|
|
145
|
-
```
|
|
146
|
-
coding-standards # Company standards
|
|
147
|
-
api-spec-v2 # API specification
|
|
148
|
-
architecture-docs # Design docs
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Naming Anti-Patterns
|
|
152
|
-
|
|
153
|
-
❌ Avoid:
|
|
154
|
-
- Generic names: `docs`, `code`, `library`
|
|
155
|
-
- Unclear abbreviations: `fp`, `lib1`, `proj`
|
|
156
|
-
- Dates without context: `2024-01-15`
|
|
157
|
-
- Redundant words: `my-project-library-code`
|
|
158
|
-
|
|
159
|
-
✅ Prefer:
|
|
160
|
-
- Specific, descriptive: `fastapi-docs`, `vue-source`
|
|
161
|
-
- Standard package names: `pydantic`, `lodash`
|
|
162
|
-
- Clear context: `api-spec-v2`, `coding-standards`
|
|
163
|
-
|
|
164
|
-
## Indexing Strategies
|
|
165
|
-
|
|
166
|
-
### Initial Indexing
|
|
167
|
-
|
|
168
|
-
When creating a store, indexing happens automatically in the background:
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
create_store(url, name)
|
|
172
|
-
→ Returns: job_id
|
|
173
|
-
→ Background: clone/download → analyze → index
|
|
174
|
-
→ Status: pending → running → completed
|
|
175
|
-
|
|
176
|
-
# Monitor progress
|
|
177
|
-
check_job_status(job_id)
|
|
178
|
-
→ Progress: 45% (processing src/core.ts)
|
|
179
|
-
→ Estimated: ~2 minutes remaining
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
**Indexing time estimates:**
|
|
183
|
-
- Small library (<1k files): 30-60 seconds
|
|
184
|
-
- Medium library (1k-5k files): 1-3 minutes
|
|
185
|
-
- Large library (>5k files): 3-10 minutes
|
|
186
|
-
- Documentation crawl (100 pages): 1-2 minutes
|
|
187
|
-
|
|
188
|
-
### Re-indexing (Updates)
|
|
189
|
-
|
|
190
|
-
When library code changes or you modify indexed content:
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
# For git repos: pull latest changes
|
|
194
|
-
cd .bluera/bluera-knowledge/repos/vue
|
|
195
|
-
git pull origin main
|
|
196
|
-
cd -
|
|
197
|
-
|
|
198
|
-
# Re-index
|
|
199
|
-
/bluera-knowledge:index vue
|
|
200
|
-
|
|
201
|
-
# Or via MCP:
|
|
202
|
-
index_store(store='vue')
|
|
203
|
-
→ Re-processes all files
|
|
204
|
-
→ Updates vector embeddings
|
|
205
|
-
→ Rebuilds search index
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
**When to re-index:**
|
|
209
|
-
- Library released new version
|
|
210
|
-
- You modified local folder content
|
|
211
|
-
- Search results seem outdated
|
|
212
|
-
- After significant codebase changes
|
|
213
|
-
|
|
214
|
-
**Re-indexing is incremental** - only changed files are re-processed.
|
|
215
|
-
|
|
216
|
-
### Selective Indexing
|
|
217
|
-
|
|
218
|
-
For large repos, you might want to index specific directories:
|
|
219
|
-
|
|
220
|
-
```
|
|
221
|
-
# Clone full repo manually
|
|
222
|
-
git clone https://github.com/microsoft/vscode
|
|
223
|
-
cd vscode
|
|
224
|
-
|
|
225
|
-
# Index only specific dirs
|
|
226
|
-
/bluera-knowledge:add-folder ./src/vs/editor --name=vscode-editor
|
|
227
|
-
/bluera-knowledge:add-folder ./src/vs/workbench --name=vscode-workbench
|
|
228
|
-
|
|
229
|
-
# Result: Multiple focused stores instead of one massive store
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
## Storage Management
|
|
233
|
-
|
|
234
|
-
### Monitoring Storage
|
|
235
|
-
|
|
236
|
-
Check what's using space:
|
|
237
|
-
|
|
238
|
-
```
|
|
239
|
-
list_stores()
|
|
240
|
-
→ vue: 487 files, 2.3 MB
|
|
241
|
-
→ react: 312 files, 1.8 MB
|
|
242
|
-
→ fastapi-docs: 156 pages, 0.9 MB
|
|
243
|
-
→ my-api: 89 files, 0.4 MB
|
|
244
|
-
|
|
245
|
-
Total storage: ~5.4 MB
|
|
246
|
-
|
|
247
|
-
# Detailed info
|
|
248
|
-
get_store_info('vue')
|
|
249
|
-
→ Location: .bluera/bluera-knowledge/repos/vue/
|
|
250
|
-
→ Indexed: 487 files
|
|
251
|
-
→ Size: 2.3 MB (source) + 4.1 MB (vectors)
|
|
252
|
-
→ Last indexed: 2 hours ago
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### When to Delete Stores
|
|
256
|
-
|
|
257
|
-
**✅ Delete when:**
|
|
258
|
-
- Library no longer relevant to your project
|
|
259
|
-
- Documentation outdated (re-crawl instead)
|
|
260
|
-
- Testing/experimental stores no longer needed
|
|
261
|
-
- Running low on disk space
|
|
262
|
-
- Duplicate stores exist
|
|
263
|
-
|
|
264
|
-
**How to delete:**
|
|
265
|
-
```
|
|
266
|
-
/bluera-knowledge:remove-store old-library
|
|
267
|
-
|
|
268
|
-
# Or via MCP:
|
|
269
|
-
delete_store(store='old-library')
|
|
270
|
-
→ Removes: source files, vector index, metadata
|
|
271
|
-
→ Frees: ~6-8 MB per store (varies by size)
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
**⚠️ Cannot undo!** Make sure you don't need the store before deleting.
|
|
275
|
-
|
|
276
|
-
## Background Job Monitoring
|
|
277
|
-
|
|
278
|
-
All expensive operations run as background jobs: cloning, indexing, crawling.
|
|
279
|
-
|
|
280
|
-
### Job Lifecycle
|
|
281
|
-
|
|
282
|
-
```
|
|
283
|
-
1. create_store() or index_store() → Returns job_id
|
|
284
|
-
|
|
285
|
-
2. Job states:
|
|
286
|
-
- pending: In queue, not started
|
|
287
|
-
- running: Actively processing
|
|
288
|
-
- completed: Finished successfully
|
|
289
|
-
- failed: Error occurred
|
|
290
|
-
|
|
291
|
-
3. Monitor progress:
|
|
292
|
-
check_job_status(job_id)
|
|
293
|
-
→ Current state, percentage, current file
|
|
294
|
-
|
|
295
|
-
4. List all jobs:
|
|
296
|
-
list_jobs()
|
|
297
|
-
→ See pending, running, completed jobs
|
|
298
|
-
|
|
299
|
-
5. Cancel if needed:
|
|
300
|
-
cancel_job(job_id)
|
|
301
|
-
→ Stops running job, cleans up
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Best Practices for Job Monitoring
|
|
305
|
-
|
|
306
|
-
**Do poll, but not too frequently:**
|
|
307
|
-
```
|
|
308
|
-
# ❌ Too frequent - wastes resources
|
|
309
|
-
while status != 'completed':
|
|
310
|
-
check_job_status(job_id) # Every second!
|
|
311
|
-
sleep(1)
|
|
312
|
-
|
|
313
|
-
# ✅ Reasonable polling interval
|
|
314
|
-
while status != 'completed':
|
|
315
|
-
check_job_status(job_id)
|
|
316
|
-
sleep(15) # Every 15 seconds is fine
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**Do handle failures gracefully:**
|
|
320
|
-
```
|
|
321
|
-
status = check_job_status(job_id)
|
|
322
|
-
|
|
323
|
-
if status['state'] == 'failed':
|
|
324
|
-
error = status['error']
|
|
325
|
-
|
|
326
|
-
if 'auth' in error.lower():
|
|
327
|
-
print("Authentication required - try SSH URL or provide credentials")
|
|
328
|
-
elif 'not found' in error.lower():
|
|
329
|
-
print("Repository/URL not found - check the source")
|
|
330
|
-
elif 'disk' in error.lower():
|
|
331
|
-
print("Disk space issue - delete unused stores")
|
|
332
|
-
else:
|
|
333
|
-
print(f"Unexpected error: {error}")
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
**Do list jobs to avoid duplicates:**
|
|
337
|
-
```
|
|
338
|
-
# Before creating new store
|
|
339
|
-
jobs = list_jobs()
|
|
340
|
-
existing = [j for j in jobs if j['store'] == 'vue' and j['state'] in ['pending', 'running']]
|
|
341
|
-
|
|
342
|
-
if existing:
|
|
343
|
-
print(f"Job already running for 'vue': {existing[0]['id']}")
|
|
344
|
-
# Wait for it instead of creating duplicate
|
|
345
|
-
else:
|
|
346
|
-
create_store(...)
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
## Handling Indexing Failures
|
|
18
|
+
- **Library source**: package name (`vue`, `fastapi`, `pydantic`)
|
|
19
|
+
- **Documentation**: append `-docs` (`vue-docs`, `fastapi-docs`)
|
|
20
|
+
- **Org/project**: `org-project` (`microsoft-typescript`)
|
|
21
|
+
- **Versioned**: `name-version` (`react-18`, `python-3.11`)
|
|
350
22
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
**1. Authentication Required (Private Repos)**
|
|
354
|
-
```
|
|
355
|
-
Error: "Authentication required"
|
|
356
|
-
|
|
357
|
-
Fix options:
|
|
358
|
-
- Use SSH URL: git@github.com:org/repo.git
|
|
359
|
-
- Use HTTPS with token: https://token@github.com/org/repo.git
|
|
360
|
-
- Make repo public (if appropriate)
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
**2. Invalid URL/Path**
|
|
364
|
-
```
|
|
365
|
-
Error: "Repository not found" or "Path does not exist"
|
|
366
|
-
|
|
367
|
-
Fix:
|
|
368
|
-
- Verify URL is correct (typos common!)
|
|
369
|
-
- Check path exists and is accessible
|
|
370
|
-
- Ensure network connectivity
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
**3. Disk Space**
|
|
374
|
-
```
|
|
375
|
-
Error: "No space left on device"
|
|
376
|
-
|
|
377
|
-
Fix:
|
|
378
|
-
- Check available space: df -h
|
|
379
|
-
- Delete unused stores: delete_store(old_store)
|
|
380
|
-
- Clear .bluera/bluera-knowledge/repos/ manually if needed
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
**4. Network Timeout**
|
|
384
|
-
```
|
|
385
|
-
Error: "Connection timeout" or "Failed to fetch"
|
|
386
|
-
|
|
387
|
-
Fix:
|
|
388
|
-
- Retry after checking network
|
|
389
|
-
- Use --shallow for large repos
|
|
390
|
-
- Clone manually then add-folder
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
**5. Unsupported File Types**
|
|
394
|
-
```
|
|
395
|
-
Warning: "Skipped 45 binary files"
|
|
396
|
-
|
|
397
|
-
This is normal!
|
|
398
|
-
- Binary files (images, compiled code) are skipped
|
|
399
|
-
- Only text files are indexed
|
|
400
|
-
- Check indexed count vs total to see ratio
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### Recovery Workflow
|
|
404
|
-
|
|
405
|
-
```
|
|
406
|
-
1. Attempt fails:
|
|
407
|
-
create_store(url, name) → job fails
|
|
408
|
-
|
|
409
|
-
2. Check error:
|
|
410
|
-
job_status = check_job_status(job_id)
|
|
411
|
-
error_msg = job_status['error']
|
|
412
|
-
|
|
413
|
-
3. Determine fix based on error type (see above)
|
|
414
|
-
|
|
415
|
-
4. Retry with fix:
|
|
416
|
-
create_store(corrected_url, name)
|
|
417
|
-
|
|
418
|
-
5. Verify success:
|
|
419
|
-
check_job_status(new_job_id)
|
|
420
|
-
→ Status: completed
|
|
421
|
-
|
|
422
|
-
list_stores()
|
|
423
|
-
→ Store appears in list
|
|
424
|
-
|
|
425
|
-
6. Test search:
|
|
426
|
-
search(test_query, stores=[name], limit=3)
|
|
427
|
-
→ Returns results: ✅ Ready to use!
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
## Store Lifecycle Checklist
|
|
431
|
-
|
|
432
|
-
**Creating a Store:**
|
|
433
|
-
- [ ] Choose appropriate source type (repo/folder/crawl)
|
|
434
|
-
- [ ] Use descriptive, consistent naming
|
|
435
|
-
- [ ] Start indexing job
|
|
436
|
-
- [ ] Monitor job status until complete
|
|
437
|
-
- [ ] Verify with list_stores()
|
|
438
|
-
- [ ] Test with sample search
|
|
439
|
-
|
|
440
|
-
**Maintaining a Store:**
|
|
441
|
-
- [ ] Re-index after significant changes
|
|
442
|
-
- [ ] Pull git updates periodically for repo stores
|
|
443
|
-
- [ ] Monitor storage usage
|
|
444
|
-
- [ ] Check search relevance quality
|
|
445
|
-
|
|
446
|
-
**Deleting a Store:**
|
|
447
|
-
- [ ] Confirm no longer needed
|
|
448
|
-
- [ ] Note storage freed
|
|
449
|
-
- [ ] Remove from any documentation referencing it
|
|
450
|
-
|
|
451
|
-
## Quick Reference Commands
|
|
23
|
+
## Quick Reference
|
|
452
24
|
|
|
453
25
|
```
|
|
454
26
|
# Create
|
|
@@ -467,4 +39,7 @@ This is normal!
|
|
|
467
39
|
/bluera-knowledge:remove-store <name>
|
|
468
40
|
```
|
|
469
41
|
|
|
470
|
-
|
|
42
|
+
## Detailed Guides
|
|
43
|
+
|
|
44
|
+
- Source type details and examples: [references/source-types.md](references/source-types.md)
|
|
45
|
+
- Indexing, storage, and job monitoring: [references/operations.md](references/operations.md)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Store Operations
|
|
2
|
+
|
|
3
|
+
## Indexing
|
|
4
|
+
|
|
5
|
+
### Initial Indexing
|
|
6
|
+
|
|
7
|
+
When creating a store, indexing happens automatically in the background:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
create_store(url, name) → Returns: job_id
|
|
11
|
+
→ Background: clone/download → analyze → index
|
|
12
|
+
→ Status: pending → running → completed
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Time estimates:**
|
|
16
|
+
- Small library (<1k files): 30-60 seconds
|
|
17
|
+
- Medium library (1k-5k files): 1-3 minutes
|
|
18
|
+
- Large library (>5k files): 3-10 minutes
|
|
19
|
+
- Documentation crawl (100 pages): 1-2 minutes
|
|
20
|
+
|
|
21
|
+
### Re-indexing
|
|
22
|
+
|
|
23
|
+
Re-indexing is incremental — only changed files are re-processed.
|
|
24
|
+
|
|
25
|
+
**When to re-index:**
|
|
26
|
+
- Library released new version
|
|
27
|
+
- You modified local folder content
|
|
28
|
+
- Search results seem outdated
|
|
29
|
+
|
|
30
|
+
### Selective Indexing
|
|
31
|
+
|
|
32
|
+
For large repos, index specific directories:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
git clone https://github.com/microsoft/vscode
|
|
36
|
+
/bluera-knowledge:add-folder ./vscode/src/vs/editor --name=vscode-editor
|
|
37
|
+
/bluera-knowledge:add-folder ./vscode/src/vs/workbench --name=vscode-workbench
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Background Job Monitoring
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
1. create_store() or index_store() → Returns job_id
|
|
44
|
+
2. Job states: pending → running → completed | failed
|
|
45
|
+
3. Monitor: check_job_status(job_id) → state, percentage, current file
|
|
46
|
+
4. List all: list_jobs() → pending, running, completed jobs
|
|
47
|
+
5. Cancel: cancel_job(job_id) → stops and cleans up
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Polling:** Every 15 seconds is reasonable. Don't poll every second.
|
|
51
|
+
|
|
52
|
+
## Common Failure Scenarios
|
|
53
|
+
|
|
54
|
+
| Error | Cause | Fix |
|
|
55
|
+
|-------|-------|-----|
|
|
56
|
+
| Authentication required | Private repo | Use SSH URL or HTTPS with token |
|
|
57
|
+
| Repository not found | Typo in URL | Verify URL |
|
|
58
|
+
| No space left | Disk full | Delete unused stores |
|
|
59
|
+
| Connection timeout | Network issue | Retry, or clone manually then add-folder |
|
|
60
|
+
| Skipped binary files | Normal behavior | Only text files are indexed |
|
|
61
|
+
|
|
62
|
+
## Storage Management
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
list_stores()
|
|
66
|
+
→ vue: 487 files, 2.3 MB
|
|
67
|
+
→ react: 312 files, 1.8 MB
|
|
68
|
+
|
|
69
|
+
get_store_info('vue')
|
|
70
|
+
→ Location, indexed files, size, last indexed
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Delete when:** Library no longer relevant, documentation outdated, duplicates exist, disk space needed.
|
|
74
|
+
|
|
75
|
+
**Cannot undo deletion!**
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Source Types
|
|
2
|
+
|
|
3
|
+
## Git Repositories
|
|
4
|
+
|
|
5
|
+
**Advantages:** Preserves git history, can pull updates, automatic language detection.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
/bluera-knowledge:add-repo https://github.com/vuejs/core --name=vue
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Best practices:**
|
|
12
|
+
- Use package/library name: `vue`, `fastapi`, `pydantic`
|
|
13
|
+
- For monorepos: `org-project` format: `microsoft-typescript`, `vercel-next`
|
|
14
|
+
- Include version if tracking specific release: `vue-3.4`, `python-3.11`
|
|
15
|
+
|
|
16
|
+
## Local Folders
|
|
17
|
+
|
|
18
|
+
**Advantages:** No git required, fast indexing, perfect for proprietary code.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
/bluera-knowledge:add-folder /path/to/my-project/api --name=my-api
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Best practices:**
|
|
25
|
+
- Use descriptive names: `my-api`, `auth-service`, `shared-utils`
|
|
26
|
+
- Index focused directories (not entire ~/)
|
|
27
|
+
- Update by re-indexing: `/bluera-knowledge:index my-api`
|
|
28
|
+
|
|
29
|
+
## Web Documentation
|
|
30
|
+
|
|
31
|
+
**Advantages:** Access web-only content, handles JS-rendered sites, follows links.
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
/bluera-knowledge:crawl https://fastapi.tiangolo.com --name=fastapi-docs --max-pages=100
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Best practices:**
|
|
38
|
+
- Append `-docs` to library name: `fastapi-docs`, `vue-docs`
|
|
39
|
+
- Set `max-pages` to avoid crawling entire internet
|
|
40
|
+
- Use `--headless` for JavaScript-heavy sites
|
|
41
|
+
- Crawl specific documentation paths, not marketing pages
|
|
42
|
+
|
|
43
|
+
## Naming Anti-Patterns
|
|
44
|
+
|
|
45
|
+
- Generic names: `docs`, `code`, `library`
|
|
46
|
+
- Unclear abbreviations: `fp`, `lib1`, `proj`
|
|
47
|
+
- Dates without context: `2024-01-15`
|
|
48
|
+
- Redundant words: `my-project-library-code`
|