@afterxleep/doc-bot 1.23.0 → 2.0.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 +53 -18
- package/bin/doc-bot.js +10 -4
- package/package.json +2 -3
- package/src/index.js +250 -461
- package/src/index.test.js +6 -6
- package/src/services/DocumentationService.js +10 -25
- package/src/services/InferenceEngine.js +1 -4
- package/src/services/__tests__/InferenceEngine.integration.test.js +3 -8
- package/src/services/__tests__/PaginationService.integration.test.js +20 -40
- package/src/services/docset/__tests__/DocsetDatabase.test.js +4 -5
- package/src/services/docset/__tests__/DocsetService.test.js +3 -4
- package/AGENT_INTEGRATION_RULE.txt +0 -79
- package/src/__tests__/temp-docs-1752689978225/test.md +0 -5
- package/src/__tests__/temp-docs-1752689978235/test.md +0 -5
- package/src/__tests__/temp-docs-1752689978241/test.md +0 -5
- package/src/__tests__/temp-docs-1752689978243/test.md +0 -5
- package/src/__tests__/temp-docs-1752689978244/test.md +0 -5
- package/src/__tests__/temp-docs-1756129972061/test.md +0 -5
- package/src/__tests__/temp-docs-1756129972071/test.md +0 -5
- package/src/__tests__/temp-docs-1756129972075/test.md +0 -5
- package/src/__tests__/temp-docs-1756129972077/test.md +0 -5
- package/src/__tests__/temp-docs-1756129972079/test.md +0 -5
- package/src/__tests__/temp-docs-1756130189361/test.md +0 -5
- package/src/__tests__/temp-docs-1756130189372/test.md +0 -5
- package/src/__tests__/temp-docs-1756130189375/test.md +0 -5
- package/src/__tests__/temp-docs-1756130189378/test.md +0 -5
- package/src/__tests__/temp-docs-1756130189379/test.md +0 -5
- package/src/__tests__/temp-docs-1756130271128/test.md +0 -5
- package/src/__tests__/temp-docs-1756130271139/test.md +0 -5
- package/src/__tests__/temp-docs-1756130271142/test.md +0 -5
- package/src/__tests__/temp-docs-1756130271145/test.md +0 -5
- package/src/__tests__/temp-docs-1756130271146/test.md +0 -5
- package/src/__tests__/temp-docs-1756130687030/test.md +0 -5
- package/src/__tests__/temp-docs-1756130687044/test.md +0 -5
- package/src/__tests__/temp-docs-1756130687048/test.md +0 -5
- package/src/__tests__/temp-docs-1756130687051/test.md +0 -5
- package/src/__tests__/temp-docs-1756130687053/test.md +0 -5
- package/src/__tests__/temp-docs-1756131694925/test.md +0 -5
- package/src/__tests__/temp-docs-1756131694937/test.md +0 -5
- package/src/__tests__/temp-docs-1756131694941/test.md +0 -5
- package/src/__tests__/temp-docs-1756131694944/test.md +0 -5
- package/src/__tests__/temp-docs-1756131694946/test.md +0 -5
- package/src/__tests__/temp-docs-1756133998710/test.md +0 -5
- package/src/__tests__/temp-docs-1756133998721/test.md +0 -5
- package/src/__tests__/temp-docs-1756133998724/test.md +0 -5
- package/src/__tests__/temp-docs-1756133998727/test.md +0 -5
- package/src/__tests__/temp-docs-1756133998729/test.md +0 -5
- package/src/__tests__/temp-docs-1756134345935/test.md +0 -5
- package/src/__tests__/temp-docs-1756134345948/test.md +0 -5
- package/src/__tests__/temp-docs-1756134345952/test.md +0 -5
- package/src/__tests__/temp-docs-1756134345954/test.md +0 -5
- package/src/__tests__/temp-docs-1756134345957/test.md +0 -5
- package/src/__tests__/temp-docsets-1752689978244/7e2cbc65/Mock.docset/Contents/Info.plist +0 -10
- 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 +0 -10
- package/src/__tests__/temp-docsets-1752689978244/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1752689978244/docsets.json +0 -10
- package/src/__tests__/temp-docsets-1756129972079/2e443167/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756129972079/2e443167/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756129972079/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756129972079/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756129972079/docsets.json +0 -10
- package/src/__tests__/temp-docsets-1756130189379/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756130189379/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130189379/a4934c14/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756130189379/a4934c14/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130189379/docsets.json +0 -10
- package/src/__tests__/temp-docsets-1756130271146/3f8acbb2/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756130271146/3f8acbb2/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130271146/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756130271146/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130271146/docsets.json +0 -10
- package/src/__tests__/temp-docsets-1756130687053/6810e6bd/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756130687053/6810e6bd/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130687053/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756130687053/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756130687053/docsets.json +0 -10
- package/src/__tests__/temp-docsets-1756131694946/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756131694946/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756131694946/dd703046/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756131694946/dd703046/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756131694946/docsets.json +0 -10
- package/src/__tests__/temp-docsets-1756133998729/9e061136/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756133998729/9e061136/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756133998729/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756133998729/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756133998729/docsets.json +0 -10
- package/src/__tests__/temp-docsets-1756134345957/03e730af/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756134345957/03e730af/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756134345957/Mock.docset/Contents/Info.plist +0 -10
- package/src/__tests__/temp-docsets-1756134345957/Mock.docset/Contents/Resources/docSet.dsidx +0 -0
- package/src/__tests__/temp-docsets-1756134345957/docsets.json +0 -10
package/README.md
CHANGED
|
@@ -9,16 +9,17 @@ An intelligent MCP (Model Context Protocol) server that gives AI assistants like
|
|
|
9
9
|
|
|
10
10
|
doc-bot is a documentation server that enhances AI coding assistants by providing:
|
|
11
11
|
- 🧠 **Smart search** through your project documentation
|
|
12
|
-
- 📖 **Contextual
|
|
12
|
+
- 📖 **Contextual docs** that surface guidance based on what you're working on
|
|
13
13
|
- 🔄 **Live updates** as your documentation changes
|
|
14
14
|
- 📚 **API references** from official documentation (via Docsets)
|
|
15
15
|
- 🤖 **MCP tools** for AI agents to query and understand your project
|
|
16
|
+
- ✍️ **Agent-driven updates** so new knowledge is captured in docs
|
|
16
17
|
|
|
17
18
|
## Why doc-bot?
|
|
18
19
|
|
|
19
20
|
Traditional AI assistants have limited context windows and no understanding of your specific project. doc-bot solves this by:
|
|
20
21
|
|
|
21
|
-
1. **Providing project-specific knowledge** - Your conventions, patterns, and
|
|
22
|
+
1. **Providing project-specific knowledge** - Your conventions, patterns, and decisions
|
|
22
23
|
2. **Searching intelligently** - AI finds exactly what it needs without cluttering context
|
|
23
24
|
3. **Scaling infinitely** - Thousands of docs without token limits
|
|
24
25
|
4. **Staying current** - Live reload ensures AI always has latest information
|
|
@@ -32,10 +33,10 @@ Your Project Documentation → doc-bot → MCP Protocol → AI Assistant (Claude
|
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
When you ask your AI assistant to write code, it can:
|
|
35
|
-
1.
|
|
36
|
-
2.
|
|
36
|
+
1. Search for relevant documentation
|
|
37
|
+
2. Read project docs for patterns and examples
|
|
37
38
|
3. Find API references and examples
|
|
38
|
-
4.
|
|
39
|
+
4. Update documentation when new patterns are discovered
|
|
39
40
|
|
|
40
41
|
## Quick Start
|
|
41
42
|
|
|
@@ -78,18 +79,48 @@ your-project/
|
|
|
78
79
|
└── package.json
|
|
79
80
|
```
|
|
80
81
|
|
|
81
|
-
### 3.
|
|
82
|
+
### 3. Test it!
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
Ask your AI assistant: "What are the coding standards for this project?"
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
## Versioning and Compatibility
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
doc-bot 2.0 is a breaking change. Rule enforcement and `alwaysApply` behavior are removed in favor of documentation-first guidance.
|
|
89
|
+
|
|
90
|
+
- If you need the legacy rule enforcement flow, pin to `@afterxleep/doc-bot@1` or build from the `1.x` branch.
|
|
91
|
+
- New installs should use the latest 2.x line (`@afterxleep/doc-bot@latest`).
|
|
88
92
|
|
|
89
93
|
## Project Documentation
|
|
90
94
|
|
|
91
95
|
doc-bot treats your project documentation as a searchable knowledge base for AI assistants.
|
|
92
96
|
|
|
97
|
+
### Agent-Driven Updates
|
|
98
|
+
|
|
99
|
+
doc-bot is designed for agents to keep documentation current as they work. When an assistant discovers a new pattern or a change, it can add or update docs directly:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"fileName": "auth-flow.md",
|
|
104
|
+
"title": "Auth Flow",
|
|
105
|
+
"description": "OAuth flow and token handling",
|
|
106
|
+
"keywords": ["auth", "oauth", "tokens"],
|
|
107
|
+
"filePatterns": ["src/auth/**"],
|
|
108
|
+
"content": "# Auth Flow\n\nDocument the new flow here."
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Agent Documentation Loop
|
|
113
|
+
|
|
114
|
+
Use this fast loop to extend project knowledge and keep docs current:
|
|
115
|
+
|
|
116
|
+
1. **Orient quickly**: call `doc_bot(task)` or `get_document_index()` when the project is unfamiliar.
|
|
117
|
+
2. **Find specifics**: use `search_documentation` with concrete terms (API names, class names, errors).
|
|
118
|
+
3. **Read the full context**: open matches with `read_specific_document` or `get_file_docs`.
|
|
119
|
+
4. **Capture new knowledge**: when behavior changes or new patterns emerge, write it with `create_or_update_rule`.
|
|
120
|
+
5. **Refresh when needed**: if docs are edited manually, run `refresh_documentation()`.
|
|
121
|
+
|
|
122
|
+
Keep docs short, scoped, and searchable with clear titles, keywords, and `filePatterns`.
|
|
123
|
+
|
|
93
124
|
### Documentation Format
|
|
94
125
|
|
|
95
126
|
Create markdown files with frontmatter metadata:
|
|
@@ -116,7 +147,7 @@ keywords: ["react", "components", "frontend", "jsx"]
|
|
|
116
147
|
| `title` | string | Document title (required) | "API Guidelines" |
|
|
117
148
|
| `description` | string | Brief description | "REST API design patterns" |
|
|
118
149
|
| `keywords` | array | Search keywords | ["api", "rest", "http"] |
|
|
119
|
-
| `
|
|
150
|
+
| `topics` | array | Optional topical tags | ["architecture", "backend"] |
|
|
120
151
|
| `filePatterns` | array | Apply to specific files | ["*.test.js", "**/*.spec.ts"] |
|
|
121
152
|
|
|
122
153
|
### How Search Works
|
|
@@ -126,15 +157,16 @@ keywords: ["react", "components", "frontend", "jsx"]
|
|
|
126
157
|
3. **Relevance Scoring** - Results ranked by relevance (exact matches score highest)
|
|
127
158
|
4. **Context Extraction** - Returns snippets showing matched content
|
|
128
159
|
|
|
160
|
+
doc-bot surfaces documentation for agents; it does not enforce rules. Agents should update docs when new patterns or changes appear.
|
|
161
|
+
|
|
129
162
|
### Types of Documentation
|
|
130
163
|
|
|
131
|
-
####
|
|
164
|
+
#### General Documentation
|
|
132
165
|
```markdown
|
|
133
166
|
---
|
|
134
167
|
title: "Coding Standards"
|
|
135
|
-
alwaysApply: true
|
|
136
168
|
---
|
|
137
|
-
|
|
169
|
+
Project-wide guidance and conventions
|
|
138
170
|
```
|
|
139
171
|
|
|
140
172
|
#### Contextual Documentation
|
|
@@ -227,10 +259,13 @@ doc-bot provides these tools to AI assistants:
|
|
|
227
259
|
|
|
228
260
|
| Tool | Purpose | Example Use |
|
|
229
261
|
|------|---------|-------------|
|
|
230
|
-
| `
|
|
262
|
+
| `doc_bot` | Get documentation guidance | "How should I approach auth?" |
|
|
231
263
|
| `search_documentation` | Search all documentation | "How do I implement auth?" |
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
264
|
+
| `get_file_docs` | Get file-specific docs | "Docs for Button.test.jsx" |
|
|
265
|
+
| `read_specific_document` | Read full docs by file name | "Open coding-standards.md" |
|
|
266
|
+
| `get_document_index` | List all docs | "Show documentation index" |
|
|
267
|
+
| `create_or_update_rule` | Add/update documentation | "Capture auth flow update" |
|
|
268
|
+
| `refresh_documentation` | Reload docs from disk | "Refresh the doc store" |
|
|
234
269
|
| `explore_api` | Explore API documentation | "Show me URLSession methods" |
|
|
235
270
|
| `add_docset` | Install new docset | "Add Swift docs from URL" |
|
|
236
271
|
| `remove_docset` | Remove installed docset | "Remove docset abc123" |
|
|
@@ -291,7 +326,7 @@ Options:
|
|
|
291
326
|
---
|
|
292
327
|
```
|
|
293
328
|
|
|
294
|
-
2. **
|
|
329
|
+
2. **Use file patterns for contextual docs**
|
|
295
330
|
```markdown
|
|
296
331
|
---
|
|
297
332
|
filePatterns: ["**/auth/**", "*.auth.js"]
|
|
@@ -308,7 +343,7 @@ Options:
|
|
|
308
343
|
- Use clear section headers for better snippet extraction
|
|
309
344
|
- Add descriptions to improve search relevance
|
|
310
345
|
|
|
311
|
-
## Why MCP over Static
|
|
346
|
+
## Why MCP over Static Instruction Files?
|
|
312
347
|
|
|
313
348
|
Unlike static `.cursorrules` or `.github/copilot-instructions.md` files:
|
|
314
349
|
|
package/bin/doc-bot.js
CHANGED
|
@@ -16,6 +16,7 @@ program
|
|
|
16
16
|
.description('Generic MCP server for intelligent documentation access')
|
|
17
17
|
.version(packageJson.version)
|
|
18
18
|
.option('-d, --docs <path>', 'Path to docs folder', 'doc-bot')
|
|
19
|
+
.option('-s, --docsets <path>', 'Path to docsets folder')
|
|
19
20
|
.option('-v, --verbose', 'Enable verbose logging')
|
|
20
21
|
.option('-w, --watch', 'Watch for file changes')
|
|
21
22
|
.parse();
|
|
@@ -32,11 +33,12 @@ async function main() {
|
|
|
32
33
|
console.log('📖 To get started, create your documentation folder:');
|
|
33
34
|
console.log('');
|
|
34
35
|
console.log(` mkdir ${path.basename(docsPath)}`);
|
|
35
|
-
console.log(` echo "---\
|
|
36
|
+
console.log(` echo "---\ntitle: Getting Started\n---\n# Getting Started\nThis is your project documentation." > ${path.basename(docsPath)}/getting-started.md`);
|
|
36
37
|
console.log('');
|
|
37
38
|
console.log('📋 Use frontmatter in your markdown files:');
|
|
38
|
-
console.log('
|
|
39
|
-
console.log('
|
|
39
|
+
console.log(' title: "Doc Title" (required)');
|
|
40
|
+
console.log(' keywords: ["term"] (optional)');
|
|
41
|
+
console.log(' filePatterns: ["**/*.test.js"] (optional)');
|
|
40
42
|
console.log('');
|
|
41
43
|
console.log('💡 Tip: By default, doc-bot looks for a doc-bot folder.');
|
|
42
44
|
console.log(' Use --docs to specify a different folder.');
|
|
@@ -45,6 +47,7 @@ async function main() {
|
|
|
45
47
|
|
|
46
48
|
const server = new DocsServer({
|
|
47
49
|
docsPath,
|
|
50
|
+
docsetsPath: options.docsets ? path.resolve(options.docsets) : undefined,
|
|
48
51
|
verbose: options.verbose,
|
|
49
52
|
watch: options.watch
|
|
50
53
|
});
|
|
@@ -52,6 +55,9 @@ async function main() {
|
|
|
52
55
|
if (options.verbose) {
|
|
53
56
|
console.error('🚀 Starting doc-bot...');
|
|
54
57
|
console.error(`📁 Documentation: ${docsPath}`);
|
|
58
|
+
if (options.docsets) {
|
|
59
|
+
console.error(`📚 Docsets: ${path.resolve(options.docsets)}`);
|
|
60
|
+
}
|
|
55
61
|
console.error(`⚙️ Configuration: Frontmatter-based`);
|
|
56
62
|
|
|
57
63
|
if (options.watch) {
|
|
@@ -72,4 +78,4 @@ main().catch(error => {
|
|
|
72
78
|
console.error(error.stack);
|
|
73
79
|
}
|
|
74
80
|
process.exit(1);
|
|
75
|
-
});
|
|
81
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@afterxleep/doc-bot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Generic MCP server for intelligent documentation access in any project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"bin/",
|
|
69
69
|
"prompts/",
|
|
70
70
|
"README.md",
|
|
71
|
-
"LICENSE"
|
|
72
|
-
"AGENT_INTEGRATION_RULE.txt"
|
|
71
|
+
"LICENSE"
|
|
73
72
|
]
|
|
74
73
|
}
|