@afterxleep/doc-bot 1.9.1 → 1.13.0
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 +226 -294
- package/bin/doc-bot.js +2 -3
- package/package.json +8 -7
- package/src/__tests__/docset-integration.test.js +146 -0
- package/src/__tests__/temp-docs-1752689978225/test.md +5 -0
- package/src/__tests__/temp-docs-1752689978235/test.md +5 -0
- package/src/__tests__/temp-docs-1752689978241/test.md +5 -0
- package/src/__tests__/temp-docs-1752689978243/test.md +5 -0
- package/src/__tests__/temp-docs-1752689978244/test.md +5 -0
- package/src/__tests__/temp-docsets-1752689978244/7e2cbc65/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1752689978244/7e2cbc65/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1752689978244/Mock.docset/Contents/Info.plist +10 -0
- package/src/__tests__/temp-docsets-1752689978244/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1752689978244/docsets.json +10 -0
- package/src/index.js +474 -28
- package/src/services/DocumentationService.js +131 -2
- package/src/services/UnifiedSearchService.js +214 -0
- package/src/services/__tests__/DocumentationService.test.js +318 -0
- package/src/services/__tests__/UnifiedSearchService.test.js +302 -0
- package/src/services/docset/ParallelSearchManager.js +158 -0
- package/src/services/docset/__tests__/DocsetDatabase.test.js +337 -0
- package/src/services/docset/__tests__/DocsetService.test.js +195 -0
- package/src/services/docset/__tests__/EnhancedDocsetDatabase.test.js +324 -0
- package/src/services/docset/database.js +474 -0
- package/src/services/docset/index.js +349 -0
package/README.md
CHANGED
|
@@ -3,306 +3,233 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@afterxleep/doc-bot)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
It's platform agnostic and designed to replace and extend the rule systems provided by different IDEs, such as Cursor (Cursor Rules) or Claude (CLAUDE.md). Instead of relying on separate rule-sets for each tool, you can use doc-bot to provide unified documentation for agentic coding across all your AI assistants.
|
|
6
|
+
An intelligent MCP (Model Context Protocol) server that gives AI assistants like Claude and Cursor deep understanding of your project through smart documentation management.
|
|
9
7
|
|
|
10
8
|
## What is doc-bot?
|
|
11
9
|
|
|
12
|
-
doc-bot is
|
|
13
|
-
- 🧠 **
|
|
14
|
-
-
|
|
15
|
-
- 🔄 **
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
IDE's use static rule files (like Cursor Rules or Copilot's .github/copilot-instructions.md), and each one has their own format, metadata and approach.
|
|
20
|
-
|
|
21
|
-
### 🚀 Dynamic Search vs Static Rules
|
|
22
|
-
|
|
23
|
-
**Static Systems:**
|
|
24
|
-
- All rules must fit in a single file or limited token window
|
|
25
|
-
- AI reads everything, even irrelevant rules
|
|
26
|
-
- No way to search or filter documentation (besides plain 'grep')
|
|
27
|
-
- Rules compete for context space
|
|
28
|
-
|
|
29
|
-
**MCP with doc-bot:**
|
|
30
|
-
- AI searches for exactly what it needs
|
|
31
|
-
- Unlimited documentation size - only relevant parts are retrieved
|
|
32
|
-
- Smart keyword and pattern matching
|
|
33
|
-
- Context window used efficiently
|
|
34
|
-
|
|
35
|
-
### 🧠 Contextual Intelligence
|
|
36
|
-
|
|
37
|
-
**Static Systems:**
|
|
38
|
-
- Duplicate or symlinked rules to work with multiple agents
|
|
39
|
-
- Agents use `grep` for basic text-base searching
|
|
40
|
-
|
|
41
|
-
**MCP with doc-bot:**
|
|
42
|
-
- AI searches for relevant documentation based on your query
|
|
43
|
-
- Context-aware suggestions from your actual questions
|
|
44
|
-
- Different documentation retrieved for different tasks
|
|
45
|
-
- Intelligent inference from keywords and search terms
|
|
46
|
-
|
|
47
|
-
### 📈 Scalability Without Limits
|
|
48
|
-
|
|
49
|
-
**Static Systems:**
|
|
50
|
-
- Limited by token count
|
|
51
|
-
- Adding more rules has impact in your context window
|
|
52
|
-
- Documentation competes with your actual code for context
|
|
53
|
-
|
|
54
|
-
**MCP with doc-bot:**
|
|
55
|
-
- Store thousands of documentation files
|
|
56
|
-
- No token limit - documentation lives outside the context
|
|
57
|
-
- AI retrieves only what's needed
|
|
58
|
-
- Your context window stays free for actual work
|
|
59
|
-
|
|
60
|
-
### 🔄 Live Updates
|
|
61
|
-
|
|
62
|
-
**Static Systems:**
|
|
63
|
-
- Changes require restarting your AI/IDE
|
|
64
|
-
- No way to know if rules are current
|
|
65
|
-
- Manual synchronization across tools and AI agents
|
|
66
|
-
|
|
67
|
-
**MCP with doc-bot:**
|
|
68
|
-
- Hot reload on documentation changes
|
|
69
|
-
- Always serves the latest version
|
|
70
|
-
- Single source of truth for all AI tools
|
|
71
|
-
|
|
72
|
-
### 🎯 Smart Discovery
|
|
10
|
+
doc-bot is a documentation server that enhances AI coding assistants by providing:
|
|
11
|
+
- 🧠 **Smart search** through your project documentation
|
|
12
|
+
- 📖 **Contextual rules** that apply based on what you're working on
|
|
13
|
+
- 🔄 **Live updates** as your documentation changes
|
|
14
|
+
- 📚 **API references** from official documentation (via Docsets)
|
|
15
|
+
- 🤖 **MCP tools** for AI agents to query and understand your project
|
|
73
16
|
|
|
74
|
-
|
|
75
|
-
- AI doesn't know what documentation exists
|
|
76
|
-
- Users must know to ask specific questions
|
|
77
|
-
- No exploration or discovery capabilities
|
|
78
|
-
- AI agents rely on basic grep searches through codebases to infer project patterns
|
|
17
|
+
## Why doc-bot?
|
|
79
18
|
|
|
80
|
-
|
|
81
|
-
- AI can list all available documentation
|
|
82
|
-
- Discovers relevant docs automatically
|
|
83
|
-
- Suggests documentation based on relevance
|
|
84
|
-
- Searchable knowledge base with intelligent ranking
|
|
85
|
-
- No need for AI to grep through your codebase - dedicated search engine
|
|
19
|
+
Traditional AI assistants have limited context windows and no understanding of your specific project. doc-bot solves this by:
|
|
86
20
|
|
|
87
|
-
|
|
21
|
+
1. **Providing project-specific knowledge** - Your conventions, patterns, and rules
|
|
22
|
+
2. **Searching intelligently** - AI finds exactly what it needs without cluttering context
|
|
23
|
+
3. **Scaling infinitely** - Thousands of docs without token limits
|
|
24
|
+
4. **Staying current** - Live reload ensures AI always has latest information
|
|
88
25
|
|
|
89
|
-
|
|
26
|
+
## How It Works
|
|
90
27
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
{
|
|
95
|
-
"mcpServers": {
|
|
96
|
-
"doc-bot": {
|
|
97
|
-
"command": "npx",
|
|
98
|
-
"args": ["@afterxleep/doc-bot@latest"]
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Custom docs folder:**
|
|
105
|
-
```json
|
|
106
|
-
{
|
|
107
|
-
"mcpServers": {
|
|
108
|
-
"doc-bot": {
|
|
109
|
-
"command": "npx",
|
|
110
|
-
"args": ["@afterxleep/doc-bot@latest", "--docs", "./my-custom-docs"]
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
Note: If a relative path does not work, you can use VSCode `${workspaceFolder}`environment variable `${workspaceFolder}/my-custom-docs`
|
|
28
|
+
doc-bot acts as a bridge between your documentation and AI assistants:
|
|
116
29
|
|
|
30
|
+
```
|
|
31
|
+
Your Project Documentation → doc-bot → MCP Protocol → AI Assistant (Claude, Cursor, etc.)
|
|
32
|
+
```
|
|
117
33
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"command": "npx",
|
|
124
|
-
"args": ["@afterxleep/doc-bot@latest", "--verbose"]
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
34
|
+
When you ask your AI assistant to write code, it can:
|
|
35
|
+
1. Check your project's coding standards
|
|
36
|
+
2. Search for relevant documentation
|
|
37
|
+
3. Find API references and examples
|
|
38
|
+
4. Follow your team's specific patterns
|
|
129
39
|
|
|
130
|
-
|
|
40
|
+
## Quick Start
|
|
131
41
|
|
|
132
|
-
|
|
42
|
+
### 1. Install doc-bot
|
|
133
43
|
|
|
134
|
-
|
|
135
|
-
**🎯 Why This Matters**: Without this rule, agents may default to general knowledge instead of your doc-bot documentation.
|
|
44
|
+
Add doc-bot to your AI assistant's configuration:
|
|
136
45
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
46
|
+
**For Claude Desktop or Claude Code:**
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"doc-bot": {
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["@afterxleep/doc-bot@latest"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
142
57
|
|
|
143
|
-
|
|
58
|
+
**Location of config file:**
|
|
59
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
60
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
61
|
+
- Linux: `~/.config/Claude/claude_desktop_config.json`
|
|
144
62
|
|
|
145
|
-
|
|
63
|
+
### 2. Create Your Documentation
|
|
146
64
|
|
|
147
|
-
Create a `doc-bot
|
|
65
|
+
Create a `doc-bot` folder in your project root and add markdown files:
|
|
148
66
|
|
|
149
67
|
```
|
|
150
68
|
your-project/
|
|
151
69
|
├── doc-bot/
|
|
152
|
-
│ ├── coding-standards.md
|
|
153
|
-
│ ├──
|
|
154
|
-
│ ├── testing.md
|
|
155
|
-
│
|
|
156
|
-
|
|
70
|
+
│ ├── coding-standards.md
|
|
71
|
+
│ ├── api-patterns.md
|
|
72
|
+
│ ├── testing-guide.md
|
|
73
|
+
│ └── architecture.md
|
|
74
|
+
├── src/
|
|
157
75
|
└── package.json
|
|
158
76
|
```
|
|
159
77
|
|
|
160
|
-
|
|
78
|
+
### 3. Test It
|
|
161
79
|
|
|
162
|
-
|
|
80
|
+
Ask your AI assistant: "What are the coding standards for this project?"
|
|
163
81
|
|
|
164
|
-
|
|
165
|
-
- **Contextual Rules** (`alwaysApply: false`): Rules applied based on file patterns and context
|
|
82
|
+
## Project Documentation
|
|
166
83
|
|
|
167
|
-
|
|
84
|
+
doc-bot treats your project documentation as a searchable knowledge base for AI assistants.
|
|
168
85
|
|
|
169
|
-
|
|
170
|
-
```markdown
|
|
171
|
-
---
|
|
172
|
-
alwaysApply: true
|
|
173
|
-
title: "Coding Standards"
|
|
174
|
-
description: "Core coding standards that apply to all code"
|
|
175
|
-
keywords: ["code-quality", "standards", "best-practices"]
|
|
176
|
-
---
|
|
86
|
+
### Documentation Format
|
|
177
87
|
|
|
178
|
-
|
|
88
|
+
Create markdown files with frontmatter metadata:
|
|
179
89
|
|
|
180
|
-
- Use 2 spaces for indentation
|
|
181
|
-
- Maximum line length: 100 characters
|
|
182
|
-
- Always use const/let, never var
|
|
183
|
-
- Prefer async/await over promises
|
|
184
|
-
- Write descriptive variable names
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
**Contextual Rule Example** (`doc-bot/testing.md`):
|
|
188
90
|
```markdown
|
|
189
91
|
---
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
keywords: ["testing", "jest", "tdd", "unit-tests"]
|
|
194
|
-
filePatterns: ["*.test.js", "*.spec.js", "__tests__/**/*"]
|
|
92
|
+
title: "React Component Guidelines"
|
|
93
|
+
description: "Standards for building React components"
|
|
94
|
+
keywords: ["react", "components", "frontend", "jsx"]
|
|
195
95
|
---
|
|
196
96
|
|
|
197
|
-
#
|
|
198
|
-
|
|
199
|
-
All test files should:
|
|
200
|
-
- Use describe/it blocks for organization
|
|
201
|
-
- Include both positive and negative test cases
|
|
202
|
-
- Mock external dependencies
|
|
203
|
-
- Aim for 80%+ code coverage
|
|
97
|
+
# React Component Guidelines
|
|
204
98
|
|
|
205
|
-
|
|
99
|
+
- Use functional components with hooks
|
|
100
|
+
- Follow PascalCase naming
|
|
101
|
+
- Keep components under 200 lines
|
|
102
|
+
- Write tests for all components
|
|
206
103
|
```
|
|
207
104
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
doc-bot uses frontmatter in your markdown files to automatically detect and categorize rules.
|
|
105
|
+
### Frontmatter Options
|
|
211
106
|
|
|
212
|
-
|
|
107
|
+
| Field | Type | Description | Example |
|
|
108
|
+
|-------|------|-------------|---------|
|
|
109
|
+
| `title` | string | Document title (required) | "API Guidelines" |
|
|
110
|
+
| `description` | string | Brief description | "REST API design patterns" |
|
|
111
|
+
| `keywords` | array | Search keywords | ["api", "rest", "http"] |
|
|
112
|
+
| `alwaysApply` | boolean | Apply to all queries | true/false |
|
|
113
|
+
| `filePatterns` | array | Apply to specific files | ["*.test.js", "**/*.spec.ts"] |
|
|
213
114
|
|
|
214
|
-
|
|
215
|
-
- **`alwaysApply: false`** - Contextual rules searched and applied based on relevance
|
|
216
|
-
- **`keywords: ["list", "of", "keywords"]`** - For smart indexing and search
|
|
217
|
-
- **`filePatterns: ["*.js", "src/**/*.ts"]`** - Apply docs to specific files (see below)
|
|
218
|
-
- **`title`** and **`description`** - Standard metadata
|
|
219
|
-
- **`confidence: 0.9`** - Relevance confidence score (0-1)
|
|
115
|
+
### How Search Works
|
|
220
116
|
|
|
221
|
-
|
|
117
|
+
1. **Intelligent Parsing** - Queries are parsed, stop words removed
|
|
118
|
+
2. **Multi-field Matching** - Searches title, description, keywords, and content
|
|
119
|
+
3. **Relevance Scoring** - Results ranked by relevance (exact matches score highest)
|
|
120
|
+
4. **Context Extraction** - Returns snippets showing matched content
|
|
222
121
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
- **Keyword-based search** from frontmatter metadata
|
|
226
|
-
- **Multi-term search** with fuzzy matching capabilities
|
|
227
|
-
- **Smart inference** from documentation content
|
|
228
|
-
- **Automatic indexing** - no manual configuration needed
|
|
229
|
-
|
|
230
|
-
### Writing effective documentation
|
|
231
|
-
|
|
232
|
-
For best results, include descriptive frontmatter:
|
|
122
|
+
### Types of Documentation
|
|
233
123
|
|
|
124
|
+
#### Global Rules (Always Apply)
|
|
234
125
|
```markdown
|
|
235
126
|
---
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
description: "Best practices for building React components"
|
|
239
|
-
keywords: ["react", "components", "hooks", "jsx"]
|
|
127
|
+
title: "Coding Standards"
|
|
128
|
+
alwaysApply: true
|
|
240
129
|
---
|
|
241
|
-
|
|
242
|
-
# React Component Guidelines
|
|
243
|
-
|
|
244
|
-
Your documentation content here...
|
|
130
|
+
Rules that apply to every file in your project
|
|
245
131
|
```
|
|
246
132
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
133
|
+
#### Contextual Documentation
|
|
134
|
+
```markdown
|
|
135
|
+
---
|
|
136
|
+
title: "Testing Guide"
|
|
137
|
+
filePatterns: ["*.test.js", "*.spec.ts"]
|
|
138
|
+
---
|
|
139
|
+
Documentation that only applies to test files
|
|
140
|
+
```
|
|
250
141
|
|
|
142
|
+
#### Searchable References
|
|
251
143
|
```markdown
|
|
252
144
|
---
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
keywords: ["testing", "jest", "react"]
|
|
256
|
-
filePatterns: ["*.test.jsx", "*.test.tsx", "__tests__/**/*"]
|
|
145
|
+
title: "Database Schema"
|
|
146
|
+
keywords: ["database", "postgres", "schema", "migrations"]
|
|
257
147
|
---
|
|
148
|
+
Documentation found through search queries
|
|
149
|
+
```
|
|
258
150
|
|
|
259
|
-
# React Testing Guide
|
|
260
151
|
|
|
261
|
-
|
|
262
|
-
```
|
|
152
|
+
## Docsets (API Documentation)
|
|
263
153
|
|
|
264
|
-
|
|
265
|
-
- `*.js` - All JavaScript files
|
|
266
|
-
- `src/**/*.ts` - TypeScript files in src directory
|
|
267
|
-
- `[Tt]est.js` - Test.js or test.js
|
|
268
|
-
- `*.{jsx,tsx}` - React component files
|
|
154
|
+
doc-bot can also search official API documentation from Docsets, giving your AI assistant access to comprehensive framework and library references.
|
|
269
155
|
|
|
270
|
-
|
|
156
|
+
### What are Docsets?
|
|
271
157
|
|
|
272
|
-
|
|
158
|
+
Docsets are pre-built documentation databases containing official docs for:
|
|
159
|
+
- Programming languages (Python, JavaScript, Go, etc.)
|
|
160
|
+
- Frameworks (React, Vue, Django, Rails, etc.)
|
|
161
|
+
- Libraries (NumPy, Express, jQuery, etc.)
|
|
162
|
+
- Platforms (iOS, Android, AWS, etc.)
|
|
273
163
|
|
|
274
|
-
###
|
|
164
|
+
### Setting Up Docsets
|
|
275
165
|
|
|
276
|
-
1. **
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
cd doc-bot
|
|
166
|
+
1. **Option A: Ask your AI assistant to install directly**:
|
|
167
|
+
|
|
168
|
+
From a URL:
|
|
280
169
|
```
|
|
281
|
-
|
|
282
|
-
2. **Install dependencies:**
|
|
283
|
-
```bash
|
|
284
|
-
npm install
|
|
170
|
+
Use the add_docset tool to install Swift documentation from https://kapeli.com/feeds/Swift.tgz
|
|
285
171
|
```
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
```
|
|
289
|
-
|
|
172
|
+
|
|
173
|
+
From a local file:
|
|
174
|
+
```
|
|
175
|
+
Use the add_docset tool to install the docset at /Users/me/Downloads/React.docset
|
|
290
176
|
```
|
|
291
177
|
|
|
292
|
-
|
|
293
|
-
```
|
|
294
|
-
|
|
178
|
+
2. **Manage your docsets**:
|
|
179
|
+
```
|
|
180
|
+
List all installed docsets
|
|
181
|
+
Remove docset with ID abc123
|
|
295
182
|
```
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
183
|
+
|
|
184
|
+
Docsets are automatically stored in `~/Developer/DocSets` by default.
|
|
185
|
+
|
|
186
|
+
### Docset Sources
|
|
187
|
+
|
|
188
|
+
- **User Contributed Docsets**: https://github.com/Kapeli/Dash-User-Contributions
|
|
189
|
+
- **Docset Generation Tools**: https://github.com/Kapeli/docset-generator
|
|
190
|
+
|
|
191
|
+
Popular docsets available:
|
|
192
|
+
- Programming Languages: Python, JavaScript, Go, Rust, Swift
|
|
193
|
+
- Web Frameworks: React, Vue, Angular, Django, Rails
|
|
194
|
+
- Mobile: iOS, Android, React Native, Flutter
|
|
195
|
+
- Databases: PostgreSQL, MySQL, MongoDB, Redis
|
|
196
|
+
- Cloud: AWS, Google Cloud, Azure
|
|
197
|
+
|
|
198
|
+
3. **Configure custom path** (optional):
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"mcpServers": {
|
|
202
|
+
"doc-bot": {
|
|
203
|
+
"command": "npx",
|
|
204
|
+
"args": ["@afterxleep/doc-bot@latest", "--docsets", "/path/to/docsets"]
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
299
208
|
```
|
|
300
209
|
|
|
301
|
-
|
|
210
|
+
### How Docset Search Works
|
|
211
|
+
|
|
212
|
+
- **Unified Search**: One query searches both your docs and API docs
|
|
213
|
+
- **Smart Prioritization**: Your project docs are boosted 5x in relevance
|
|
214
|
+
- **API Exploration**: Use `explore_api` tool to discover related classes, methods
|
|
215
|
+
- **Performance**: Parallel search across multiple docsets with caching
|
|
216
|
+
|
|
217
|
+
## Available Tools
|
|
302
218
|
|
|
303
|
-
|
|
219
|
+
doc-bot provides these tools to AI assistants:
|
|
304
220
|
|
|
305
|
-
|
|
221
|
+
| Tool | Purpose | Example Use |
|
|
222
|
+
|------|---------|-------------|
|
|
223
|
+
| `check_project_rules` | Get rules before writing code | "What patterns should I follow?" |
|
|
224
|
+
| `search_documentation` | Search all documentation | "How do I implement auth?" |
|
|
225
|
+
| `get_global_rules` | Get always-apply rules | "What are the coding standards?" |
|
|
226
|
+
| `get_file_docs` | Get file-specific docs | "Rules for Button.test.jsx" |
|
|
227
|
+
| `explore_api` | Explore API documentation | "Show me URLSession methods" |
|
|
228
|
+
| `add_docset` | Install new docset | "Add Swift docs from URL" |
|
|
229
|
+
| `remove_docset` | Remove installed docset | "Remove docset abc123" |
|
|
230
|
+
| `list_docsets` | List all docsets | "Show installed docsets" |
|
|
231
|
+
|
|
232
|
+
## Configuration Options
|
|
306
233
|
|
|
307
234
|
### CLI Options
|
|
308
235
|
|
|
@@ -310,88 +237,93 @@ Ask your AI assistant something like "What documentation is available?" to test
|
|
|
310
237
|
doc-bot [options]
|
|
311
238
|
|
|
312
239
|
Options:
|
|
313
|
-
-d, --docs <path> Path to docs folder (default: doc-bot)
|
|
240
|
+
-d, --docs <path> Path to docs folder (default: ./doc-bot)
|
|
241
|
+
-s, --docsets <path> Path to docsets folder (default: ~/Developer/DocSets)
|
|
314
242
|
-v, --verbose Enable verbose logging
|
|
315
243
|
-w, --watch Watch for file changes
|
|
316
|
-
-h, --help
|
|
244
|
+
-h, --help Display help
|
|
317
245
|
```
|
|
318
246
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
247
|
+
### Advanced Configuration
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"mcpServers": {
|
|
252
|
+
"doc-bot": {
|
|
253
|
+
"command": "npx",
|
|
254
|
+
"args": [
|
|
255
|
+
"@afterxleep/doc-bot@latest",
|
|
256
|
+
"--docs", "./documentation",
|
|
257
|
+
"--docsets", "/Library/Application Support/Dash/DocSets",
|
|
258
|
+
"--verbose",
|
|
259
|
+
"--watch"
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
```
|
|
323
265
|
|
|
324
|
-
|
|
325
|
-
doc-bot --docs ./my-docs
|
|
266
|
+
## Documentation
|
|
326
267
|
|
|
327
|
-
|
|
328
|
-
doc-bot
|
|
329
|
-
|
|
268
|
+
- **[API Reference](doc-bot/api-reference.md)** - Complete reference for all MCP tools
|
|
269
|
+
- **[Architecture Guide](doc-bot/architecture.md)** - Technical architecture and components
|
|
270
|
+
- **[Configuration Guide](doc-bot/configuration-guide.md)** - All configuration options
|
|
271
|
+
- **[Troubleshooting Guide](doc-bot/troubleshooting.md)** - Common issues and solutions
|
|
272
|
+
- **[Examples & Best Practices](doc-bot/examples-and-best-practices.md)** - Real-world usage examples
|
|
273
|
+
- **[Contributing Guide](doc-bot/contributing.md)** - How to contribute to doc-bot
|
|
330
274
|
|
|
331
|
-
##
|
|
275
|
+
## Best Practices
|
|
332
276
|
|
|
333
|
-
###
|
|
277
|
+
### Writing Effective Documentation
|
|
334
278
|
|
|
335
|
-
1. **
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
279
|
+
1. **Use descriptive titles and keywords**
|
|
280
|
+
```markdown
|
|
281
|
+
---
|
|
282
|
+
title: "Authentication Flow"
|
|
283
|
+
keywords: ["auth", "login", "jwt", "security", "authentication"]
|
|
284
|
+
---
|
|
340
285
|
```
|
|
341
286
|
|
|
342
|
-
2. **
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
287
|
+
2. **Apply rules contextually**
|
|
288
|
+
```markdown
|
|
289
|
+
---
|
|
290
|
+
filePatterns: ["**/auth/**", "*.auth.js"]
|
|
291
|
+
---
|
|
347
292
|
```
|
|
348
293
|
|
|
349
|
-
3. **
|
|
350
|
-
Add to your Claude Code config:
|
|
351
|
-
```json
|
|
352
|
-
{
|
|
353
|
-
"mcpServers": {
|
|
354
|
-
"doc-bot": {
|
|
355
|
-
"command": "node",
|
|
356
|
-
"args": ["/path/to/doc-bot/bin/doc-bot.js", "--verbose", "--watch"]
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
```
|
|
294
|
+
3. **Keep docs focused** - One topic per file
|
|
361
295
|
|
|
362
|
-
|
|
296
|
+
4. **Include examples** - Show, don't just tell
|
|
363
297
|
|
|
364
|
-
|
|
365
|
-
```bash
|
|
366
|
-
npm run test
|
|
367
|
-
npm run lint
|
|
368
|
-
```
|
|
298
|
+
### Optimizing Search
|
|
369
299
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
```
|
|
300
|
+
- Include synonyms in keywords: `["test", "testing", "spec", "jest"]`
|
|
301
|
+
- Use clear section headers for better snippet extraction
|
|
302
|
+
- Add descriptions to improve search relevance
|
|
374
303
|
|
|
375
|
-
|
|
376
|
-
```bash
|
|
377
|
-
npm publish
|
|
378
|
-
```
|
|
304
|
+
## Why MCP over Static Rules?
|
|
379
305
|
|
|
380
|
-
|
|
306
|
+
Unlike static `.cursorrules` or `.github/copilot-instructions.md` files:
|
|
381
307
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
308
|
+
- **Dynamic**: AI searches for what it needs instead of reading everything
|
|
309
|
+
- **Scalable**: Unlimited docs without token limits
|
|
310
|
+
- **Intelligent**: Context-aware documentation based on current file
|
|
311
|
+
- **Unified**: Works with any MCP-compatible AI tool
|
|
312
|
+
- **Live**: Hot reload on documentation changes
|
|
313
|
+
|
|
314
|
+
## Contributing
|
|
315
|
+
|
|
316
|
+
See our [Contributing Guide](doc-bot/contributing.md) for development setup and guidelines.
|
|
388
317
|
|
|
389
318
|
## License
|
|
390
319
|
|
|
391
|
-
MIT
|
|
320
|
+
MIT - See [LICENSE](LICENSE) for details.
|
|
392
321
|
|
|
393
|
-
##
|
|
322
|
+
## Support
|
|
323
|
+
|
|
324
|
+
- **Issues**: [GitHub Issues](https://github.com/afterxleep/doc-bot/issues)
|
|
325
|
+
- **Discussions**: [GitHub Discussions](https://github.com/afterxleep/doc-bot/discussions)
|
|
326
|
+
|
|
327
|
+
---
|
|
394
328
|
|
|
395
|
-
|
|
396
|
-
- [GitHub repository](https://github.com/afterxleep/doc-bot)
|
|
397
|
-
- [Model Context Protocol](https://github.com/modelcontextprotocol/specification)
|
|
329
|
+
Built with ❤️ in Spain
|
package/bin/doc-bot.js
CHANGED
|
@@ -6,11 +6,10 @@ import fs from 'fs-extra';
|
|
|
6
6
|
import { DocsServer } from '../src/index.js';
|
|
7
7
|
import { readFileSync } from 'fs';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
|
-
import { dirname, join } from 'path';
|
|
10
9
|
|
|
11
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
|
-
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'));
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
const packageJson = JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf8'));
|
|
14
13
|
|
|
15
14
|
program
|
|
16
15
|
.name('doc-bot')
|