@afterxleep/doc-bot 1.0.0 โ†’ 1.0.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.
Files changed (3) hide show
  1. package/README.md +81 -274
  2. package/bin/doc-bot.js +10 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,89 +1,74 @@
1
- # docbot
1
+ # doc-bot
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/docbot)](https://www.npmjs.com/package/docbot)
3
+ [![npm version](https://img.shields.io/npm/v/@afterxleep/doc-bot)](https://www.npmjs.com/package/@afterxleep/doc-bot)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- A generic, open-source 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.
6
+ A generic MCP (Model Context Protocol) server that provides intelligent documentation access for any project. Works with any MCP-compatible AI tools and IDEs.
7
7
 
8
- ## ๐Ÿš€ Features
8
+ ## What is doc-bot?
9
9
 
10
- - **๐Ÿ” Smart Documentation Search**: Full-text search across all documentation
11
- - **๐Ÿง  Intelligent Inference**: Context-aware documentation suggestions based on your current work
12
- - **๐Ÿ“‹ Global Rules**: Always-apply documentation that's relevant to every interaction
13
- - **๐ŸŽฏ Contextual Docs**: File-specific documentation based on patterns and file types
14
- - **๐Ÿ“ฆ Zero Config**: Works out of the box with a simple `docbot/` folder
15
- - **๐Ÿ”„ Hot Reload**: Automatically updates when documentation changes
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
- ## ๐Ÿ“ฆ Installation & Usage
17
+ ## Installation
19
18
 
20
- ### Quick Start
19
+ 1. **Create your documentation folder** in your project root (see organization section below)
21
20
 
22
- 1. **Install and run in your project:**
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
- ```
21
+ 2. **Add doc-bot to your MCP-compatible AI tool configuration**:
37
22
 
38
- 3. **Add to your Claude Code configuration:**
23
+ **For Claude Code** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
39
24
  ```json
40
25
  {
41
26
  "mcpServers": {
42
27
  "docs": {
43
28
  "command": "npx",
44
- "args": ["docbot"]
29
+ "args": ["@afterxleep/doc-bot", "--docs", "./doc-bot"]
45
30
  }
46
31
  }
47
32
  }
48
33
  ```
49
34
 
50
- 4. **Restart Claude Code and start using intelligent documentation!**
51
-
52
- ### Global Installation
35
+ **For Cursor or other MCP tools**: Add similar configuration pointing to your documentation folder
53
36
 
54
- ```bash
55
- # Install globally
56
- npm install -g docbot
37
+ 3. **Restart your AI tool**
57
38
 
58
- # Run in any project
59
- docbot
60
- ```
39
+ ## How to organize your documentation
61
40
 
62
- ## ๐Ÿ“ Project Structure
63
-
64
- Create a `docbot/` folder in your project root:
41
+ Create a `doc-bot/` folder in your project root:
65
42
 
66
43
  ```
67
44
  your-project/
68
- โ”œโ”€โ”€ docbot/
69
- โ”‚ โ”œโ”€โ”€ manifest.json # Configuration and rules
45
+ โ”œโ”€โ”€ doc-bot/
46
+ โ”‚ โ”œโ”€โ”€ manifest.json # Configuration file
70
47
  โ”‚ โ”œโ”€โ”€ core/
71
- โ”‚ โ”‚ โ”œโ”€โ”€ architecture.md # Always-apply architecture guidelines
72
- โ”‚ โ”‚ โ”œโ”€โ”€ coding-standards.md # Coding standards for all files
73
- โ”‚ โ”‚ โ””โ”€โ”€ security.md # Security guidelines
48
+ โ”‚ โ”‚ โ”œโ”€โ”€ coding-standards.md # Always-apply coding standards
49
+ โ”‚ โ”‚ โ””โ”€โ”€ security.md # Security guidelines
74
50
  โ”‚ โ”œโ”€โ”€ guides/
75
- โ”‚ โ”‚ โ”œโ”€โ”€ testing.md # Testing strategies
76
- โ”‚ โ”‚ โ”œโ”€โ”€ deployment.md # Deployment procedures
77
- โ”‚ โ”‚ โ””โ”€โ”€ api-development.md # API development guide
51
+ โ”‚ โ”‚ โ”œโ”€โ”€ testing.md # Testing strategies
52
+ โ”‚ โ”‚ โ””โ”€โ”€ api-development.md # API development guide
78
53
  โ”‚ โ””โ”€โ”€ reference/
79
- โ”‚ โ”œโ”€โ”€ troubleshooting.md # Common issues and solutions
80
- โ”‚ โ””โ”€โ”€ best-practices.md # Best practices by topic
54
+ โ”‚ โ””โ”€โ”€ troubleshooting.md # Common issues and solutions
81
55
  โ””โ”€โ”€ package.json
82
56
  ```
83
57
 
84
- ## โš™๏ธ Configuration
58
+ **Note:** You can use any folder name - just specify it in your MCP configuration:
59
+ ```json
60
+ "args": ["@afterxleep/doc-bot", "--docs", "./my-custom-docs"]
61
+ ```
62
+
63
+ ### Documentation types:
85
64
 
86
- ### Manifest File (`docbot/manifest.json`)
65
+ - **Core docs** (`core/`): Critical guidelines that should always be considered
66
+ - **Guides** (`guides/`): Step-by-step instructions for specific tasks
67
+ - **Reference** (`reference/`): Quick lookups and troubleshooting
68
+
69
+ ## The manifest file
70
+
71
+ The `doc-bot/manifest.json` file controls how your documentation works:
87
72
 
88
73
  ```json
89
74
  {
@@ -98,262 +83,84 @@ your-project/
98
83
  "*.test.js": ["guides/testing.md"],
99
84
  "*.spec.js": ["guides/testing.md"],
100
85
  "src/components/*": ["guides/react-components.md"],
101
- "src/api/*": ["guides/api-development.md"],
102
- "*.md": ["guides/documentation.md"],
103
- "package.json": ["guides/dependencies.md"]
86
+ "src/api/*": ["guides/api-development.md"]
104
87
  },
105
88
  "inference": {
106
89
  "keywords": {
107
90
  "testing": ["guides/testing.md"],
108
91
  "deployment": ["guides/deployment.md"],
109
- "api": ["guides/api-development.md"],
110
- "security": ["core/security.md"],
111
- "performance": ["guides/performance.md"]
92
+ "api": ["guides/api-development.md"]
112
93
  },
113
94
  "patterns": {
114
95
  "describe(": ["guides/testing.md"],
115
96
  "it(": ["guides/testing.md"],
116
- "fetch(": ["guides/api-development.md"],
117
- "console.error": ["reference/troubleshooting.md"],
118
- "try {": ["reference/error-handling.md"]
97
+ "fetch(": ["guides/api-development.md"]
119
98
  }
120
99
  }
121
100
  }
122
101
  ```
123
102
 
124
- ### Configuration Options
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`)
201
-
202
- ## ๐Ÿ› ๏ธ Available Tools
203
-
204
- When using with Claude Code or other MCP clients:
205
-
206
- ### `search_documentation`
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
- ```
103
+ ### Configuration explained:
223
104
 
224
- ### `get_global_rules`
225
- ```javascript
226
- // Get always-apply documentation
227
- get_global_rules()
228
- ```
105
+ - **`globalRules`**: Documents that apply to every AI interaction
106
+ - **`contextualRules`**: Documents triggered by specific file patterns (e.g., test files โ†’ testing guide)
107
+ - **`inference.keywords`**: Documents suggested when certain words appear in queries
108
+ - **`inference.patterns`**: Documents suggested when certain code patterns are detected
229
109
 
230
- ### `get_file_docs`
231
- ```javascript
232
- // Get file-specific documentation
233
- get_file_docs({ filePath: "src/api/users.js" })
234
- ```
110
+ ## Development setup
235
111
 
236
- ## ๐ŸŒŸ Examples
112
+ ### Running locally
237
113
 
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
- }
114
+ 1. **Clone the repository:**
115
+ ```bash
116
+ git clone https://github.com/afterxleep/doc-bot.git
117
+ cd doc-bot
294
118
  ```
295
119
 
296
- ### Cursor
297
- Configure MCP server integration (coming soon)
298
-
299
- ### VS Code
300
- Use with Claude Code extension or MCP-compatible extensions
120
+ 2. **Install dependencies:**
121
+ ```bash
122
+ npm install
123
+ ```
301
124
 
302
- ## ๐Ÿงช Testing Your Setup
125
+ 3. **Run the server:**
126
+ ```bash
127
+ npm start
128
+ ```
303
129
 
304
- 1. **Create test documentation:**
130
+ 4. **Run tests:**
305
131
  ```bash
306
- mkdir docbot
307
- echo '{"name": "Test Docs", "globalRules": ["test.md"]}' > docbot/manifest.json
308
- echo "# Test Document\nThis is a test." > docbot/test.md
132
+ npm test
309
133
  ```
310
134
 
311
- 2. **Run the server:**
135
+ 5. **Run with file watching:**
312
136
  ```bash
313
- npx docbot --verbose
137
+ npm start -- --watch
314
138
  ```
315
139
 
316
- 3. **Test with Claude Code:**
317
- - Ask: "What documentation is available?"
318
- - Try: "Show me the global rules"
140
+ ### Testing your setup
319
141
 
320
- ## ๐Ÿค Contributing
142
+ Ask your AI assistant something like "What documentation is available?" to test that doc-bot is working.
321
143
 
322
- We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
144
+ ### CLI Options
323
145
 
324
- ### Development Setup
325
146
  ```bash
326
- # Clone the repository
327
- git clone https://github.com/yourusername/docbot.git
328
- cd docbot
329
-
330
- # Install dependencies
331
- npm install
147
+ doc-bot [options]
332
148
 
333
- # Run tests
334
- npm test
335
-
336
- # Run in development mode
337
- npm run dev
149
+ Options:
150
+ -d, --docs <path> Path to docs folder (required)
151
+ -c, --config <path> Path to manifest file (default: <docs-path>/manifest.json)
152
+ -p, --port <port> Port to run server on (default: 3000)
153
+ -v, --verbose Enable verbose logging
154
+ -w, --watch Watch for file changes
155
+ -h, --help Show help
338
156
  ```
339
157
 
340
- ## ๐Ÿ“„ License
158
+ ## License
341
159
 
342
160
  MIT License - see the [LICENSE](LICENSE) file for details.
343
161
 
344
- ## ๐Ÿ™ Acknowledgments
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
- ---
162
+ ## Links
358
163
 
359
- **Made with โค๏ธ for developers who want intelligent documentation at their fingertips.**
164
+ - [npm package](https://www.npmjs.com/package/@afterxleep/doc-bot)
165
+ - [GitHub repository](https://github.com/afterxleep/doc-bot)
166
+ - [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.0')
11
+ .version('1.0.2')
12
12
  .option('-p, --port <port>', 'Port to run server on', '3000')
13
- .option('-d, --docs <path>', 'Path to docs folder', './docs.ai')
14
- .option('-c, --config <path>', 'Path to manifest file', './docs.ai/manifest.json')
13
+ .requiredOption('-d, --docs <path>', 'Path to docs folder')
14
+ .option('-c, --config <path>', 'Path to manifest file')
15
15
  .option('-v, --verbose', 'Enable verbose logging')
16
16
  .option('-w, --watch', 'Watch for file changes')
17
17
  .parse();
@@ -20,19 +20,19 @@ const options = program.opts();
20
20
 
21
21
  async function main() {
22
22
  const docsPath = path.resolve(options.docs);
23
- const configPath = path.resolve(options.config);
23
+ const configPath = options.config ? path.resolve(options.config) : path.resolve(options.docs, 'manifest.json');
24
24
 
25
- // Check if docs.ai folder exists
25
+ // Check if documentation 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 docs.ai folder in your project:');
29
+ console.log('๐Ÿ“– To get started, create your documentation folder:');
30
30
  console.log('');
31
- console.log(' mkdir docs.ai');
32
- console.log(' echo \'{"name": "My Project Documentation", "globalRules": []}\' > docs.ai/manifest.json');
33
- console.log(' echo "# Getting Started" > docs.ai/README.md');
31
+ console.log(` mkdir ${path.basename(docsPath)}`);
32
+ console.log(` echo '{"name": "My Project Documentation", "globalRules": []}' > ${path.basename(docsPath)}/manifest.json`);
33
+ console.log(` echo "# Getting Started" > ${path.basename(docsPath)}/README.md`);
34
34
  console.log('');
35
- console.log('Then run: npx doc-bot');
35
+ console.log('Then configure your MCP client to use this folder.');
36
36
  process.exit(1);
37
37
  }
38
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afterxleep/doc-bot",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Generic MCP server for intelligent documentation access in any project",
5
5
  "main": "src/index.js",
6
6
  "bin": {