@afterxleep/doc-bot 1.1.0 → 1.2.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.
Files changed (3) hide show
  1. package/README.md +10 -0
  2. package/package.json +1 -1
  3. package/src/index.js +36 -0
package/README.md CHANGED
@@ -109,6 +109,16 @@ Run tests with: `npm test`
109
109
 
110
110
  **👀 See `examples/` folder for complete example files with proper frontmatter and content structure.**
111
111
 
112
+ ## Rule Enforcement
113
+
114
+ Doc-bot ensures your rules are **always considered** through MCP system prompt injection:
115
+
116
+ - **Global Rules**: Automatically injected into the agent's system prompt as critical requirements
117
+ - **Contextual Rules**: Applied when working with matching files/patterns
118
+ - **Automatic Compliance**: Agent must check rules before generating any code
119
+
120
+ The `docs://system-prompt` resource delivers your global rules directly to the agent's context, making rule violations impossible to ignore.
121
+
112
122
  ## The manifest file
113
123
 
114
124
  The `doc-bot/manifest.json` file controls how your documentation works:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afterxleep/doc-bot",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Generic MCP server for intelligent documentation access in any project",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -68,6 +68,12 @@ class DocsServer {
68
68
  name: 'Documentation Manifest',
69
69
  description: 'Project documentation configuration',
70
70
  mimeType: 'application/json'
71
+ },
72
+ {
73
+ uri: 'docs://system-prompt',
74
+ name: 'System Prompt Injection',
75
+ description: 'Critical rules that must be considered before generating any code',
76
+ mimeType: 'text/plain'
71
77
  }
72
78
  ]
73
79
  };
@@ -107,6 +113,16 @@ class DocsServer {
107
113
  text: JSON.stringify(manifest, null, 2)
108
114
  }]
109
115
  };
116
+
117
+ case 'docs://system-prompt':
118
+ const systemPrompt = await this.generateSystemPrompt();
119
+ return {
120
+ contents: [{
121
+ uri,
122
+ mimeType: 'text/plain',
123
+ text: systemPrompt
124
+ }]
125
+ };
110
126
 
111
127
  default:
112
128
  throw new Error(`Unknown resource: ${uri}`);
@@ -351,6 +367,26 @@ class DocsServer {
351
367
 
352
368
  return output;
353
369
  }
370
+
371
+ async generateSystemPrompt() {
372
+ const globalRules = await this.docService.getGlobalRules();
373
+
374
+ if (!globalRules || globalRules.length === 0) {
375
+ return 'No global documentation rules defined.';
376
+ }
377
+
378
+ let prompt = '# CRITICAL: Project Documentation Rules\n\n';
379
+ prompt += 'IMPORTANT: You MUST follow these rules before generating ANY code:\n\n';
380
+
381
+ globalRules.forEach((rule, index) => {
382
+ prompt += `## Rule ${index + 1}: ${rule.metadata?.title || rule.fileName}\n`;
383
+ prompt += `${rule.content}\n\n`;
384
+ });
385
+
386
+ prompt += '⚠️ VIOLATION OF THESE RULES IS NOT ACCEPTABLE. Always check compliance before responding.\n';
387
+
388
+ return prompt;
389
+ }
354
390
 
355
391
  async start() {
356
392
  // Initialize services