@afterxleep/doc-bot 1.23.0 → 1.23.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +78 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afterxleep/doc-bot",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "description": "Generic MCP server for intelligent documentation access in any project",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -166,7 +166,7 @@ class DocsServer {
166
166
  tools: [
167
167
  {
168
168
  name: 'check_project_rules',
169
- description: 'Get mandatory coding standards for your task. Call BEFORE writing code AND whenever you start a new component/feature/file. Returns architecture patterns, security requirements, and performance guidelines specific to this codebase. Prevents rework by catching violations early. Use this repeatedly: before each major code block, when switching contexts, or when unsure about approach.',
169
+ description: 'Get mandatory coding standards for your task. Call BEFORE writing ANY code AND whenever you start a new component/feature/file. Returns architecture patterns, security requirements, and performance guidelines specific to this codebase. Prevents rework by catching violations early. Use this repeatedly: before each major code block, when switching contexts, or when unsure about approach. CRITICAL: This gives you task-specific rules, but you should ALSO call doc_bot() for complete project context and checkpoint guidance. Think of check_project_rules as "what rules apply to this task" and doc_bot as "am I still aligned with the project".',
170
170
  inputSchema: {
171
171
  type: 'object',
172
172
  properties: {
@@ -364,13 +364,13 @@ class DocsServer {
364
364
  },
365
365
  {
366
366
  name: 'doc_bot',
367
- description: 'ALWAYS call this FIRST for ANY task, AND consult again when switching contexts or starting new features. Returns mandatory project standards (alwaysApply rules) that must be followed, plus a catalog of documentation tools. This is your entry point - it tells you what rules are non-negotiable AND which other tools to use for deeper dives. Call whenever: beginning any task, switching to a different feature/component, facing uncertainty, or needing to verify compliance. Think of this as your "project compass" - use it repeatedly to stay aligned.',
367
+ description: 'Your continuous project compass - call at EVERY major decision point, not just once. REQUIRED at: (1) Before starting any task, (2) Before each new component/file, (3) When uncertain about approach, (4) After errors/blockers, (5) When switching contexts, (6) Before architectural decisions. Returns mandatory standards PLUS checkpoint reminders for what you might be missing. This is NOT a one-time initialization - it\'s your continuous compliance guardian. Agents who skip regular check-ins often violate standards or miss critical patterns. Think "check in before committing" not "check in once at start". Each call validates you\'re still aligned with project requirements.',
368
368
  inputSchema: {
369
369
  type: 'object',
370
370
  properties: {
371
371
  task: {
372
372
  type: 'string',
373
- description: 'What do you need help with? Examples: "create REST API", "understand auth flow", "document this pattern", "find database models"'
373
+ description: 'What do you need help with? Examples: "create REST API", "modify auth.js", "debug auth error", "review completion", "understand auth flow"'
374
374
  },
375
375
  page: {
376
376
  type: 'number',
@@ -954,9 +954,18 @@ Try:
954
954
  if (localResults.length > 0) {
955
955
  output += `- Read project docs with \`read_specific_document\`\n`;
956
956
  }
957
-
957
+
958
958
  output += `- Use \`explore_api\` to see all methods/properties for a class\n`;
959
-
959
+
960
+ // Add engagement hooks for continuous investigation
961
+ output += '\n## šŸ” Continue Your Investigation:\n';
962
+ output += 'This search gave you starting points, but consider:\n';
963
+ output += `- Did you check file-specific docs with \`get_file_docs\`? Files often have unique conventions\n`;
964
+ output += `- Have you explored the full API surface with \`explore_api\`? You might be missing key methods\n`;
965
+ output += `- Are there related patterns? Try searching for variations or related terms\n`;
966
+ output += `\nāš ļø **Working without complete context increases error risk**\n`;
967
+ output += `\nšŸ”„ **Checkpoint reminder**: Before writing code, return to \`doc_bot()\` to verify compliance with project standards\n`;
968
+
960
969
  return output;
961
970
  }
962
971
 
@@ -1085,7 +1094,19 @@ Try:
1085
1094
  output += `- Review the code samples for implementation examples\n`;
1086
1095
  }
1087
1096
  output += `- Import the framework and start using these APIs\n`;
1088
-
1097
+
1098
+ // Add "what you're missing" section
1099
+ output += `\n## āš ļø What This Response Doesn't Include:\n`;
1100
+ output += `- **Project-specific usage patterns**: Your codebase may use ${apiName} differently than shown here\n`;
1101
+ output += `- **Forbidden patterns**: Some methods might be banned by project rules\n`;
1102
+ output += `- **Performance gotchas**: File-specific docs might have critical performance notes\n`;
1103
+ output += `- **Team conventions**: How your team prefers to use this API\n`;
1104
+ output += `\nšŸ’” **Recommended next actions**:\n`;
1105
+ output += `1. Run \`search_documentation("${apiName}")\` to find how THIS project uses ${apiName}\n`;
1106
+ output += `2. Before implementing, call \`doc_bot(task="implement ${apiName}")\` to check project standards\n`;
1107
+ output += `3. Use \`get_file_docs(filePath)\` for the specific file you'll modify\n`;
1108
+ output += `\nšŸ”„ **Checkpoint reminder**: This is generic API documentation. Return to \`doc_bot()\` before writing code to ensure project compliance.\n`;
1109
+
1089
1110
  return output;
1090
1111
  }
1091
1112
 
@@ -1185,9 +1206,9 @@ Try:
1185
1206
  if (!fileDocs || fileDocs.length === 0) {
1186
1207
  return `No specific documentation found for file: ${filePath}`;
1187
1208
  }
1188
-
1209
+
1189
1210
  let output = `# Documentation for ${filePath}\n\n`;
1190
-
1211
+
1191
1212
  fileDocs.forEach(doc => {
1192
1213
  output += `## ${doc.metadata?.title || doc.fileName}\n`;
1193
1214
  if (doc.metadata?.description) {
@@ -1196,7 +1217,16 @@ Try:
1196
1217
  output += `${doc.content}\n\n`;
1197
1218
  output += '---\n\n';
1198
1219
  });
1199
-
1220
+
1221
+ // Add checkpoint reminder
1222
+ output += `## āš ļø Important Context:\n`;
1223
+ output += `This shows file/directory-specific rules for **${filePath}**.\n\n`;
1224
+ output += `**Remember**:\n`;
1225
+ output += `- These rules are IN ADDITION to global project rules\n`;
1226
+ output += `- If there's a conflict, ask via \`doc_bot()\` which takes precedence\n`;
1227
+ output += `- Other files in different directories may have different conventions\n`;
1228
+ output += `\nšŸ”„ **Next checkpoint**: Before modifying this file, return to \`doc_bot(task="modify ${filePath}")\` to get a complete compliance check.\n`;
1229
+
1200
1230
  return output;
1201
1231
  }
1202
1232
 
@@ -1204,25 +1234,37 @@ Try:
1204
1234
  if (!doc) {
1205
1235
  return 'Document not found';
1206
1236
  }
1207
-
1237
+
1208
1238
  let output = `# ${doc.metadata?.title || doc.fileName}\n\n`;
1209
-
1239
+
1210
1240
  if (doc.metadata?.description) {
1211
1241
  output += `**Description:** ${doc.metadata.description}\n\n`;
1212
1242
  }
1213
-
1243
+
1214
1244
  if (doc.metadata?.keywords) {
1215
1245
  output += `**Keywords:** ${Array.isArray(doc.metadata.keywords) ? doc.metadata.keywords.join(', ') : doc.metadata.keywords}\n\n`;
1216
1246
  }
1217
-
1247
+
1218
1248
  if (doc.metadata?.alwaysApply !== undefined) {
1219
1249
  output += `**Always Apply:** ${doc.metadata.alwaysApply ? 'Yes (Global Rule)' : 'No (Contextual Rule)'}\n\n`;
1220
1250
  }
1221
-
1251
+
1222
1252
  output += `**File:** ${doc.fileName}\n\n`;
1223
1253
  output += '---\n\n';
1224
1254
  output += doc.content;
1225
-
1255
+
1256
+ // Add cross-reference suggestions
1257
+ output += `\n\n---\n\n`;
1258
+ output += `## šŸ” Related Documentation:\n`;
1259
+ if (doc.metadata?.keywords && doc.metadata.keywords.length > 0) {
1260
+ output += `Consider searching for related topics:\n`;
1261
+ const keywords = Array.isArray(doc.metadata.keywords) ? doc.metadata.keywords : [doc.metadata.keywords];
1262
+ keywords.slice(0, 3).forEach(keyword => {
1263
+ output += `- \`search_documentation("${keyword}")\`\n`;
1264
+ });
1265
+ }
1266
+ output += `\nšŸ’” **Before implementing**: Return to \`doc_bot()\` to verify this guidance aligns with current project state and your specific task.\n`;
1267
+
1226
1268
  return output;
1227
1269
  }
1228
1270
 
@@ -1392,17 +1434,33 @@ Try:
1392
1434
  catalog += `- Get complete project philosophy and engineering principles\n`;
1393
1435
  catalog += `- Use when: Making architectural decisions or need comprehensive context\n\n`;
1394
1436
 
1437
+ catalog += `---\n\n`;
1438
+ catalog += `## šŸ”„ MANDATORY CHECKPOINTS - Return to doc_bot()\n\n`;
1439
+ catalog += `You MUST call doc_bot() again when you:\n\n`;
1440
+ catalog += `1. **Before file operations**: About to Write/Edit a new file? → \`doc_bot(task="modify [filepath]")\`\n`;
1441
+ catalog += `2. **Context switches**: Moving to a different component/feature? → \`doc_bot(task="[new context]")\`\n`;
1442
+ catalog += `3. **Errors encountered**: Hit an unexpected error? → \`doc_bot(task="debug [error]")\`\n`;
1443
+ catalog += `4. **Decision points**: Multiple valid approaches? → \`doc_bot(task="decide [decision]")\`\n`;
1444
+ catalog += `5. **Section completion**: Finished a major part? → \`doc_bot(task="review [what completed]")\`\n\n`;
1445
+ catalog += `āš ļø **Failure to checkpoint leads to**:\n`;
1446
+ catalog += `- Violating file-specific conventions you didn't know about\n`;
1447
+ catalog += `- Using patterns that were recently deprecated\n`;
1448
+ catalog += `- Missing performance/security requirements for that area\n\n`;
1449
+
1395
1450
  catalog += `---\n\n`;
1396
1451
  catalog += `## Your Task: "${task}"\n\n`;
1397
1452
  catalog += `**You now have:**\n`;
1398
1453
  catalog += `āœ… Mandatory project standards (above)\n`;
1399
- catalog += `āœ… Tools to explore codebase-specific patterns (listed above)\n\n`;
1454
+ catalog += `āœ… Tools to explore codebase-specific patterns (listed above)\n`;
1455
+ catalog += `āœ… Checkpoint requirements for continuous compliance\n\n`;
1400
1456
 
1401
- catalog += `**Your decision:**\n`;
1402
- catalog += `- If you understand how to implement this correctly with the standards above → proceed\n`;
1403
- catalog += `- If you need to understand existing patterns in this codebase → use the tools above\n\n`;
1457
+ catalog += `**Your immediate next steps:**\n`;
1458
+ catalog += `1. Review the mandatory standards above\n`;
1459
+ catalog += `2. Use additional tools if needed for this specific task\n`;
1460
+ catalog += `3. Begin implementation\n`;
1461
+ catalog += `4. **REMEMBER**: Return to doc_bot() at each checkpoint listed above\n\n`;
1404
1462
 
1405
- catalog += `Remember: You know the codebase context best. Use additional tools only if you need them.\n`;
1463
+ catalog += `Remember: Continuous check-ins = Continuous correctness.\n`;
1406
1464
 
1407
1465
  return catalog;
1408
1466
  }