@afterxleep/doc-bot 1.0.0 โ 1.0.1
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 +80 -275
- package/bin/doc-bot.js +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,89 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# doc-bot
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@afterxleep/doc-bot)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
A generic
|
|
6
|
+
A generic MCP (Model Context Protocol) server that provides intelligent documentation access for any project. Works with AI agents like Claude Code, Cursor, and any other MCP-compatible tools.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## What is doc-bot?
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- **๐ ๏ธ Universal**: Works with any project, any language, any framework
|
|
10
|
+
doc-bot is an intelligent documentation server that:
|
|
11
|
+
- ๐ **Searches** your project documentation instantly
|
|
12
|
+
- ๐ง **Infers** relevant docs based on your current work
|
|
13
|
+
- ๐ **Applies** global rules to every AI interaction
|
|
14
|
+
- ๐ฏ **Suggests** contextual documentation based on file patterns
|
|
15
|
+
- ๐ **Updates** automatically when docs change
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## Installation
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
Add doc-bot to your Claude Code MCP configuration:
|
|
21
20
|
|
|
22
|
-
1. **
|
|
23
|
-
```bash
|
|
24
|
-
# Navigate to your project directory
|
|
25
|
-
cd your-project
|
|
26
|
-
|
|
27
|
-
# Run the server (installs automatically)
|
|
28
|
-
npx docbot
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
2. **Create your documentation structure:**
|
|
32
|
-
```bash
|
|
33
|
-
mkdir docbot
|
|
34
|
-
echo '{"name": "My Project Documentation", "globalRules": []}' > docbot/manifest.json
|
|
35
|
-
echo "# Getting Started" > docbot/README.md
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
3. **Add to your Claude Code configuration:**
|
|
21
|
+
1. **Add to Claude Code configuration** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
39
22
|
```json
|
|
40
23
|
{
|
|
41
24
|
"mcpServers": {
|
|
42
25
|
"docs": {
|
|
43
26
|
"command": "npx",
|
|
44
|
-
"args": ["
|
|
27
|
+
"args": ["@afterxleep/doc-bot"]
|
|
45
28
|
}
|
|
46
29
|
}
|
|
47
30
|
}
|
|
48
31
|
```
|
|
49
32
|
|
|
50
|
-
|
|
33
|
+
2. **Restart Claude Code**
|
|
51
34
|
|
|
52
|
-
|
|
35
|
+
3. **Create your documentation folder** (if it doesn't exist, doc-bot will show you how when you first use it)
|
|
53
36
|
|
|
54
|
-
|
|
55
|
-
# Install globally
|
|
56
|
-
npm install -g docbot
|
|
37
|
+
## How to organize your documentation
|
|
57
38
|
|
|
58
|
-
|
|
59
|
-
docbot
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## ๐ Project Structure
|
|
63
|
-
|
|
64
|
-
Create a `docbot/` folder in your project root:
|
|
39
|
+
Create a `doc-bot/` folder in your project root:
|
|
65
40
|
|
|
66
41
|
```
|
|
67
42
|
your-project/
|
|
68
|
-
โโโ
|
|
69
|
-
โ โโโ manifest.json # Configuration
|
|
43
|
+
โโโ doc-bot/
|
|
44
|
+
โ โโโ manifest.json # Configuration file
|
|
70
45
|
โ โโโ core/
|
|
71
|
-
โ โ โโโ
|
|
72
|
-
โ โ
|
|
73
|
-
โ โ โโโ security.md # Security guidelines
|
|
46
|
+
โ โ โโโ coding-standards.md # Always-apply coding standards
|
|
47
|
+
โ โ โโโ security.md # Security guidelines
|
|
74
48
|
โ โโโ guides/
|
|
75
|
-
โ โ โโโ testing.md
|
|
76
|
-
โ โ
|
|
77
|
-
โ โ โโโ api-development.md # API development guide
|
|
49
|
+
โ โ โโโ testing.md # Testing strategies
|
|
50
|
+
โ โ โโโ api-development.md # API development guide
|
|
78
51
|
โ โโโ reference/
|
|
79
|
-
โ
|
|
80
|
-
โ โโโ best-practices.md # Best practices by topic
|
|
52
|
+
โ โโโ troubleshooting.md # Common issues and solutions
|
|
81
53
|
โโโ package.json
|
|
82
54
|
```
|
|
83
55
|
|
|
84
|
-
|
|
56
|
+
**Note:** You can use a different folder name by passing the `--docs` parameter:
|
|
57
|
+
```bash
|
|
58
|
+
npx @afterxleep/doc-bot --docs ./my-custom-docs
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Documentation types:
|
|
62
|
+
|
|
63
|
+
- **Core docs** (`core/`): Critical guidelines that should always be considered
|
|
64
|
+
- **Guides** (`guides/`): Step-by-step instructions for specific tasks
|
|
65
|
+
- **Reference** (`reference/`): Quick lookups and troubleshooting
|
|
66
|
+
|
|
67
|
+
## The manifest file
|
|
85
68
|
|
|
86
|
-
|
|
69
|
+
The `doc-bot/manifest.json` file controls how your documentation works:
|
|
87
70
|
|
|
88
71
|
```json
|
|
89
72
|
{
|
|
@@ -98,262 +81,84 @@ your-project/
|
|
|
98
81
|
"*.test.js": ["guides/testing.md"],
|
|
99
82
|
"*.spec.js": ["guides/testing.md"],
|
|
100
83
|
"src/components/*": ["guides/react-components.md"],
|
|
101
|
-
"src/api/*": ["guides/api-development.md"]
|
|
102
|
-
"*.md": ["guides/documentation.md"],
|
|
103
|
-
"package.json": ["guides/dependencies.md"]
|
|
84
|
+
"src/api/*": ["guides/api-development.md"]
|
|
104
85
|
},
|
|
105
86
|
"inference": {
|
|
106
87
|
"keywords": {
|
|
107
88
|
"testing": ["guides/testing.md"],
|
|
108
89
|
"deployment": ["guides/deployment.md"],
|
|
109
|
-
"api": ["guides/api-development.md"]
|
|
110
|
-
"security": ["core/security.md"],
|
|
111
|
-
"performance": ["guides/performance.md"]
|
|
90
|
+
"api": ["guides/api-development.md"]
|
|
112
91
|
},
|
|
113
92
|
"patterns": {
|
|
114
93
|
"describe(": ["guides/testing.md"],
|
|
115
94
|
"it(": ["guides/testing.md"],
|
|
116
|
-
"fetch(": ["guides/api-development.md"]
|
|
117
|
-
"console.error": ["reference/troubleshooting.md"],
|
|
118
|
-
"try {": ["reference/error-handling.md"]
|
|
95
|
+
"fetch(": ["guides/api-development.md"]
|
|
119
96
|
}
|
|
120
97
|
}
|
|
121
98
|
}
|
|
122
99
|
```
|
|
123
100
|
|
|
124
|
-
### Configuration
|
|
125
|
-
|
|
126
|
-
- **`globalRules`**: Documentation that applies to all interactions
|
|
127
|
-
- **`contextualRules`**: Documentation triggered by specific file patterns
|
|
128
|
-
- **`inference.keywords`**: Documentation triggered by keywords in queries
|
|
129
|
-
- **`inference.patterns`**: Documentation triggered by code patterns
|
|
130
|
-
|
|
131
|
-
## ๐ง CLI Options
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
docbot [options]
|
|
135
|
-
|
|
136
|
-
Options:
|
|
137
|
-
-p, --port <port> Port to run server on (default: 3000)
|
|
138
|
-
-d, --docs <path> Path to docs folder (default: ./docbot)
|
|
139
|
-
-c, --config <path> Path to manifest file (default: ./docbot/manifest.json)
|
|
140
|
-
-v, --verbose Enable verbose logging
|
|
141
|
-
-w, --watch Watch for file changes
|
|
142
|
-
-h, --help Show help
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## ๐ฏ How It Works
|
|
146
|
-
|
|
147
|
-
### 1. Global Rules (Always Apply)
|
|
148
|
-
Documents listed in `globalRules` are automatically included in every AI interaction:
|
|
149
|
-
|
|
150
|
-
```json
|
|
151
|
-
{
|
|
152
|
-
"globalRules": [
|
|
153
|
-
"core/coding-standards.md",
|
|
154
|
-
"core/security.md"
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### 2. Contextual Rules (File-Based)
|
|
160
|
-
When you're working on specific files, relevant documentation is automatically suggested:
|
|
161
|
-
|
|
162
|
-
```json
|
|
163
|
-
{
|
|
164
|
-
"contextualRules": {
|
|
165
|
-
"*.test.js": ["guides/testing.md"],
|
|
166
|
-
"src/components/*": ["guides/react-components.md"]
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 3. Smart Inference
|
|
172
|
-
The server analyzes your queries and code to suggest relevant documentation:
|
|
173
|
-
|
|
174
|
-
- **Keywords**: "testing" โ `guides/testing.md`
|
|
175
|
-
- **Code Patterns**: `describe(` โ `guides/testing.md`
|
|
176
|
-
- **File Extensions**: `.py` โ Python-related docs
|
|
177
|
-
|
|
178
|
-
## ๐ Documentation Format
|
|
179
|
-
|
|
180
|
-
### Frontmatter Support
|
|
181
|
-
Add metadata to your documentation:
|
|
182
|
-
|
|
183
|
-
```markdown
|
|
184
|
-
---
|
|
185
|
-
title: Testing Guide
|
|
186
|
-
description: Comprehensive testing strategies
|
|
187
|
-
category: guides
|
|
188
|
-
tags: [testing, jest, react]
|
|
189
|
-
alwaysApply: false
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
# Testing Guide
|
|
193
|
-
|
|
194
|
-
Your documentation content here...
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### Supported Formats
|
|
198
|
-
- **Markdown** (`.md`)
|
|
199
|
-
- **MDX** (`.mdx`)
|
|
200
|
-
- **Cursor Rules** (`.mdc`)
|
|
101
|
+
### Configuration explained:
|
|
201
102
|
|
|
202
|
-
|
|
103
|
+
- **`globalRules`**: Documents that apply to every AI interaction
|
|
104
|
+
- **`contextualRules`**: Documents triggered by specific file patterns (e.g., test files โ testing guide)
|
|
105
|
+
- **`inference.keywords`**: Documents suggested when certain words appear in queries
|
|
106
|
+
- **`inference.patterns`**: Documents suggested when certain code patterns are detected
|
|
203
107
|
|
|
204
|
-
|
|
108
|
+
## Development setup
|
|
205
109
|
|
|
206
|
-
###
|
|
207
|
-
```javascript
|
|
208
|
-
// Search all documentation
|
|
209
|
-
search_documentation({ query: "testing best practices" })
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### `get_relevant_docs`
|
|
213
|
-
```javascript
|
|
214
|
-
// Get context-aware suggestions
|
|
215
|
-
get_relevant_docs({
|
|
216
|
-
context: {
|
|
217
|
-
query: "How to test React components",
|
|
218
|
-
filePath: "src/components/UserProfile.test.tsx",
|
|
219
|
-
codeSnippet: "describe('UserProfile', () => {"
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
```
|
|
110
|
+
### Running locally
|
|
223
111
|
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### `get_file_docs`
|
|
231
|
-
```javascript
|
|
232
|
-
// Get file-specific documentation
|
|
233
|
-
get_file_docs({ filePath: "src/api/users.js" })
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
## ๐ Examples
|
|
237
|
-
|
|
238
|
-
### React Project
|
|
239
|
-
```json
|
|
240
|
-
{
|
|
241
|
-
"globalRules": ["core/react-standards.md"],
|
|
242
|
-
"contextualRules": {
|
|
243
|
-
"src/components/*": ["guides/components.md"],
|
|
244
|
-
"*.test.tsx": ["guides/testing.md"]
|
|
245
|
-
},
|
|
246
|
-
"inference": {
|
|
247
|
-
"keywords": {
|
|
248
|
-
"hook": ["guides/hooks.md"],
|
|
249
|
-
"state": ["guides/state-management.md"]
|
|
250
|
-
},
|
|
251
|
-
"patterns": {
|
|
252
|
-
"useState": ["guides/hooks.md"],
|
|
253
|
-
"useEffect": ["guides/hooks.md"]
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Node.js API Project
|
|
260
|
-
```json
|
|
261
|
-
{
|
|
262
|
-
"globalRules": ["core/api-standards.md", "core/security.md"],
|
|
263
|
-
"contextualRules": {
|
|
264
|
-
"routes/*": ["guides/routing.md"],
|
|
265
|
-
"middleware/*": ["guides/middleware.md"],
|
|
266
|
-
"*.test.js": ["guides/testing.md"]
|
|
267
|
-
},
|
|
268
|
-
"inference": {
|
|
269
|
-
"keywords": {
|
|
270
|
-
"authentication": ["guides/auth.md"],
|
|
271
|
-
"database": ["guides/database.md"]
|
|
272
|
-
},
|
|
273
|
-
"patterns": {
|
|
274
|
-
"app.get": ["guides/routing.md"],
|
|
275
|
-
"app.post": ["guides/routing.md"]
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
## ๐ Integration with IDEs
|
|
282
|
-
|
|
283
|
-
### Claude Code
|
|
284
|
-
1. Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
285
|
-
```json
|
|
286
|
-
{
|
|
287
|
-
"mcpServers": {
|
|
288
|
-
"docs": {
|
|
289
|
-
"command": "npx",
|
|
290
|
-
"args": ["docbot"]
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
112
|
+
1. **Clone the repository:**
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/afterxleep/doc-bot.git
|
|
115
|
+
cd doc-bot
|
|
294
116
|
```
|
|
295
117
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
Use with Claude Code extension or MCP-compatible extensions
|
|
118
|
+
2. **Install dependencies:**
|
|
119
|
+
```bash
|
|
120
|
+
npm install
|
|
121
|
+
```
|
|
301
122
|
|
|
302
|
-
|
|
123
|
+
3. **Run the server:**
|
|
124
|
+
```bash
|
|
125
|
+
npm start
|
|
126
|
+
```
|
|
303
127
|
|
|
304
|
-
|
|
128
|
+
4. **Run tests:**
|
|
305
129
|
```bash
|
|
306
|
-
|
|
307
|
-
echo '{"name": "Test Docs", "globalRules": ["test.md"]}' > docbot/manifest.json
|
|
308
|
-
echo "# Test Document\nThis is a test." > docbot/test.md
|
|
130
|
+
npm test
|
|
309
131
|
```
|
|
310
132
|
|
|
311
|
-
|
|
133
|
+
5. **Run with file watching:**
|
|
312
134
|
```bash
|
|
313
|
-
|
|
135
|
+
npm start -- --watch
|
|
314
136
|
```
|
|
315
137
|
|
|
316
|
-
|
|
317
|
-
- Ask: "What documentation is available?"
|
|
318
|
-
- Try: "Show me the global rules"
|
|
138
|
+
### Testing your setup
|
|
319
139
|
|
|
320
|
-
|
|
140
|
+
Ask Claude something like "What documentation is available?" to test that doc-bot is working.
|
|
321
141
|
|
|
322
|
-
|
|
142
|
+
### CLI Options
|
|
323
143
|
|
|
324
|
-
### Development Setup
|
|
325
144
|
```bash
|
|
326
|
-
|
|
327
|
-
git clone https://github.com/yourusername/docbot.git
|
|
328
|
-
cd docbot
|
|
329
|
-
|
|
330
|
-
# Install dependencies
|
|
331
|
-
npm install
|
|
145
|
+
doc-bot [options]
|
|
332
146
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
147
|
+
Options:
|
|
148
|
+
-p, --port <port> Port to run server on (default: 3000)
|
|
149
|
+
-d, --docs <path> Path to docs folder (default: ./doc-bot)
|
|
150
|
+
-c, --config <path> Path to manifest file (default: ./doc-bot/manifest.json)
|
|
151
|
+
-v, --verbose Enable verbose logging
|
|
152
|
+
-w, --watch Watch for file changes
|
|
153
|
+
-h, --help Show help
|
|
338
154
|
```
|
|
339
155
|
|
|
340
|
-
##
|
|
156
|
+
## License
|
|
341
157
|
|
|
342
158
|
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
343
159
|
|
|
344
|
-
##
|
|
345
|
-
|
|
346
|
-
- Built on the [Model Context Protocol](https://github.com/modelcontextprotocol/specification)
|
|
347
|
-
- Inspired by the need for intelligent, context-aware documentation
|
|
348
|
-
- Thanks to the Claude Code and Cursor teams for MCP support
|
|
349
|
-
|
|
350
|
-
## ๐ Links
|
|
351
|
-
|
|
352
|
-
- [npm package](https://www.npmjs.com/package/docbot)
|
|
353
|
-
- [GitHub repository](https://github.com/yourusername/docbot)
|
|
354
|
-
- [Model Context Protocol](https://github.com/modelcontextprotocol/specification)
|
|
355
|
-
- [Claude Code documentation](https://docs.anthropic.com/claude/docs/claude-code)
|
|
356
|
-
|
|
357
|
-
---
|
|
160
|
+
## Links
|
|
358
161
|
|
|
359
|
-
|
|
162
|
+
- [npm package](https://www.npmjs.com/package/@afterxleep/doc-bot)
|
|
163
|
+
- [GitHub repository](https://github.com/afterxleep/doc-bot)
|
|
164
|
+
- [Model Context Protocol](https://github.com/modelcontextprotocol/specification)
|
package/bin/doc-bot.js
CHANGED
|
@@ -8,10 +8,10 @@ const { DocsServer } = require('../src/index.js');
|
|
|
8
8
|
program
|
|
9
9
|
.name('doc-bot')
|
|
10
10
|
.description('Generic MCP server for intelligent documentation access')
|
|
11
|
-
.version('1.0.
|
|
11
|
+
.version('1.0.1')
|
|
12
12
|
.option('-p, --port <port>', 'Port to run server on', '3000')
|
|
13
|
-
.option('-d, --docs <path>', 'Path to docs folder', './
|
|
14
|
-
.option('-c, --config <path>', 'Path to manifest file', './
|
|
13
|
+
.option('-d, --docs <path>', 'Path to docs folder', './doc-bot')
|
|
14
|
+
.option('-c, --config <path>', 'Path to manifest file', './doc-bot/manifest.json')
|
|
15
15
|
.option('-v, --verbose', 'Enable verbose logging')
|
|
16
16
|
.option('-w, --watch', 'Watch for file changes')
|
|
17
17
|
.parse();
|
|
@@ -22,17 +22,17 @@ async function main() {
|
|
|
22
22
|
const docsPath = path.resolve(options.docs);
|
|
23
23
|
const configPath = path.resolve(options.config);
|
|
24
24
|
|
|
25
|
-
// Check if
|
|
25
|
+
// Check if doc-bot folder exists
|
|
26
26
|
if (!await fs.pathExists(docsPath)) {
|
|
27
27
|
console.error(`โ Documentation folder not found: ${docsPath}`);
|
|
28
28
|
console.log('');
|
|
29
|
-
console.log('๐ To get started, create a
|
|
29
|
+
console.log('๐ To get started, create a doc-bot folder in your project:');
|
|
30
30
|
console.log('');
|
|
31
|
-
console.log(' mkdir
|
|
32
|
-
console.log(' echo \'{"name": "My Project Documentation", "globalRules": []}\' >
|
|
33
|
-
console.log(' echo "# Getting Started" >
|
|
31
|
+
console.log(' mkdir doc-bot');
|
|
32
|
+
console.log(' echo \'{"name": "My Project Documentation", "globalRules": []}\' > doc-bot/manifest.json');
|
|
33
|
+
console.log(' echo "# Getting Started" > doc-bot/README.md');
|
|
34
34
|
console.log('');
|
|
35
|
-
console.log('Then run: npx doc-bot');
|
|
35
|
+
console.log('Then run: npx @afterxleep/doc-bot');
|
|
36
36
|
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
|