ai-readme-mcp 0.3.3 → 0.4.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 CHANGED
@@ -46,9 +46,9 @@ This MCP (Model Context Protocol) server automates the entire workflow:
46
46
 
47
47
  - 🔍 **Auto-discovers** all AI_README.md files in your project
48
48
  - 🎯 **Routes context** - AI gets the most relevant README for the code it's editing
49
+ - 🚀 **Guided initialization** - `init_ai_readme` scans for empty files and guides AI through population
49
50
  - ✏️ **Updates automatically** - AI can add new conventions it discovers while coding
50
51
  - ✅ **Validates quality** - Ensures READMEs are concise and optimized for AI consumption
51
- - 🤖 **Smart generation** - Auto-creates AI_README based on your project structure
52
52
 
53
53
  **Result:** Every AI interaction in your project follows your team's standards and produces consistent, high-quality code.
54
54
 
@@ -58,17 +58,15 @@ This MCP (Model Context Protocol) server automates the entire workflow:
58
58
 
59
59
  - 🔍 **Automatic Discovery** - Scan and index all AI_README.md files in your project
60
60
  - 🎯 **Smart Context Routing** - Find relevant README content based on file paths
61
+ - 🚀 **Guided Initialization** - `init_ai_readme` tool scans for empty files and guides AI through population
61
62
  - 🔄 **Update & Sync** - AI can both read and update AI_README files
62
63
  - ✅ **Validation & Quality** - Ensure README consistency with token limits and structure checks
63
- - 🤖 **Smart Initialization** - Auto-generate AI_README files based on project analysis
64
64
  - 🏗️ **Monorepo Support** - Place AI_README.md files at different folder levels; the tool automatically finds and uses the most relevant one
65
65
  - 📦 **Easy Integration** - Works seamlessly with Cursor, Claude Code, and other MCP clients
66
66
 
67
67
  ---
68
68
 
69
- ## 🚀 Quick Start
70
-
71
- ### Installation
69
+ ## 🚀 Installation
72
70
 
73
71
  **Option 1: Using npx (Recommended)**
74
72
 
@@ -263,40 +261,88 @@ Add to `claude_desktop_config.json`:
263
261
  }
264
262
  ```
265
263
 
266
- ### Create Your First AI_README
264
+ ---
265
+
266
+ ## Create Your First AI_README
267
+
268
+ You have two main approaches to create and populate AI_README files:
269
+
270
+ ### Option 1: Automated Initialization (Recommended)
271
+
272
+ Use the `init_ai_readme` tool to automatically scan and populate empty AI_README files:
273
+
274
+ **Step 1:** Create empty AI_README.md files where needed
275
+
276
+ ```bash
277
+ # Example: Create empty AI_READMEs in different directories
278
+ touch AI_README.md
279
+ touch apps/backend/AI_README.md
280
+ touch apps/frontend/AI_README.md
281
+ ```
267
282
 
268
- You can use the `init_ai_readme` MCP tool to automatically generate a customized AI_README.md based on your project:
283
+ **Step 2:** Trigger the initialization
269
284
 
270
- **Smart Mode (Default)**:
271
- The tool automatically detects your project and generates relevant content:
272
- - Detects project type (library/application/monorepo)
273
- - Identifies language (TypeScript, Python, Go, Rust, Java, etc.)
274
- - Recognizes framework (React, Vue, Next.js, Express, NestJS, etc.)
275
- - Analyzes directory structure
276
- - Generates framework-specific conventions
285
+ In your AI assistant (Claude Code, Cursor, etc.), simply say:
277
286
 
278
- Ask your AI assistant:
279
- > "Please use init_ai_readme to create an AI_README.md for this project"
287
+ > "Please run init_ai_readme for this project"
280
288
 
281
- Or create manually:
289
+ Or more explicitly:
290
+
291
+ > "Initialize AI_README files"
292
+ > "Help me populate the empty AI_README files"
293
+
294
+ **What happens:**
295
+ - 🔍 Scans your project for empty AI_README files
296
+ - 📝 Creates root-level AI_README if none exist
297
+ - 📋 Provides detailed step-by-step instructions for each file
298
+ - 🤖 AI assistant will then:
299
+ - Explore relevant directories
300
+ - Analyze your codebase (tech stack, patterns, conventions)
301
+ - Populate each AI_README with relevant documentation
302
+
303
+ **When to use `init_ai_readme`:**
304
+ - First time setting up AI_README in your project
305
+ - After creating new empty AI_README.md files in subdirectories
306
+ - When `get_context_for_file` detects empty AI_README files
307
+ - To batch-process multiple empty AI_README files
308
+
309
+ ### Option 2: Manual Creation
310
+
311
+ Create and write AI_README.md files yourself:
282
312
 
283
313
  ```markdown
284
314
  # My Project
285
315
 
286
- ## Architecture
316
+ ## Tech Stack
287
317
  - Framework: React + Express
288
318
  - Database: PostgreSQL
319
+ - Testing: Jest + Vitest
320
+
321
+ ## Architecture Patterns
322
+ - Follows MVC pattern for backend
323
+ - Component-based architecture for frontend
324
+ - RESTful API design
289
325
 
290
326
  ## Coding Conventions
291
327
  - Use TypeScript for all files
292
328
  - Components in PascalCase
293
- - Test coverage: 80%+
329
+ - Functions and variables in camelCase
330
+ - Test coverage: 80%+ required
294
331
 
295
332
  ## Testing
296
333
  Run tests with: `npm test`
334
+ Write tests alongside source files
297
335
  ```
298
336
 
299
- ### Multi-Level AI_README (Not Just for Monorepos!)
337
+ **Best Practices:**
338
+ - Keep it concise (< 400 tokens is ideal)
339
+ - Focus on conventions, not documentation
340
+ - Update as your project evolves
341
+ - Use AI to help maintain it
342
+
343
+ ---
344
+
345
+ ## Multi-Level AI_README (Not Just for Monorepos!)
300
346
 
301
347
  **The power of this tool is multi-level documentation** - not just for monorepos, but for **any project** that wants to organize conventions by module or feature.
302
348
 
@@ -324,10 +370,11 @@ my-monorepo/
324
370
  ```
325
371
 
326
372
  **Smart Empty README Handling:**
327
- - 📝 If you create an empty `AI_README.md` in a subdirectory, the tool can auto-fill it with relevant conventions
373
+ - 📝 Create empty `AI_README.md` files in subdirectories where you need specific conventions
374
+ - 🚀 Run `init_ai_readme` tool (just tell your AI: "Please initialize AI_README files")
375
+ - 🤖 AI automatically analyzes each directory and populates conventions
328
376
  - 🔗 For subdirectories with parent READMEs, generates differential content (only module-specific conventions)
329
377
  - 📋 For root directories, generates full project analysis
330
- - Ask your AI: "This AI_README.md is empty, can you help fill it?"
331
378
 
332
379
  When AI works on a file, it automatically gets:
333
380
  - The **most relevant** AI_README (closest parent directory)
@@ -409,61 +456,6 @@ npm run dev
409
456
 
410
457
  ## 🛠️ Available MCP Tools
411
458
 
412
- ### `init_ai_readme`
413
-
414
- Initialize a new AI_README.md file with smart content generation based on project analysis.
415
-
416
- ```typescript
417
- // Parameters
418
- {
419
- targetPath: string; // Required: Directory where AI_README.md will be created
420
- projectName?: string; // Optional: Project name (auto-detected if not provided)
421
- overwrite?: boolean; // Optional: Overwrite existing file (default: false)
422
- smart?: boolean; // Optional: Enable smart content generation (default: true)
423
- }
424
-
425
- // Returns
426
- {
427
- success: boolean;
428
- readmePath: string;
429
- action: 'created' | 'filled' | 'overwritten';
430
- projectInfo?: {
431
- projectName: string;
432
- projectType: 'library' | 'application' | 'monorepo' | 'unknown';
433
- language: string;
434
- framework?: string;
435
- packageManager?: string;
436
- hasTests: boolean;
437
- mainDirs: string[];
438
- };
439
- message: string;
440
- }
441
- ```
442
-
443
- **Smart Mode Features**:
444
- - Auto-detects project type, language, and framework
445
- - Generates framework-specific conventions (React, Vue, Python, etc.)
446
- - For subdirectories with parent READMEs, generates differential content
447
- - Handles empty files (< 50 chars) by auto-filling them
448
- - Analyzes directory structure and dependencies
449
-
450
- **Example Usage**:
451
-
452
- ```typescript
453
- // Create smart README for React project
454
- {
455
- targetPath: "/path/to/react-app",
456
- smart: true
457
- }
458
- // Result: Auto-detects React, generates component naming conventions, etc.
459
-
460
- // Fill empty subdirectory README
461
- {
462
- targetPath: "/path/to/monorepo/apps/frontend"
463
- }
464
- // Result: Generates differential content extending root README
465
- ```
466
-
467
459
  ### `discover_ai_readmes`
468
460
 
469
461
  Scans your project and discovers all AI_README.md files.
@@ -586,6 +578,59 @@ Update an AI_README.md file with specified operations.
586
578
  }
587
579
  ```
588
580
 
581
+ ### `init_ai_readme`
582
+
583
+ Initialize and populate empty AI_README files in your project.
584
+
585
+ ```typescript
586
+ // Parameters
587
+ {
588
+ projectRoot: string; // Required: Project root directory
589
+ excludePatterns?: string[]; // Optional: Glob patterns to exclude
590
+ targetPath?: string; // Optional: Specific directory to initialize
591
+ }
592
+
593
+ // Returns
594
+ {
595
+ success: boolean;
596
+ message: string;
597
+ readmesToInitialize: string[]; // Paths to empty AI_README files
598
+ instructions: string; // Detailed step-by-step guide for populating
599
+ }
600
+ ```
601
+
602
+ **Features:**
603
+ - 🔍 Scans project for empty or missing AI_README files
604
+ - 📝 Creates root-level AI_README if none exist
605
+ - 📋 Generates detailed step-by-step instructions for each file
606
+ - 🎯 Can target specific directories with `targetPath` parameter
607
+ - 🤖 Guides AI through analysis: tech stack, patterns, conventions
608
+
609
+ **Example Usage:**
610
+
611
+ ```typescript
612
+ // Initialize all empty AI_READMEs in project
613
+ {
614
+ projectRoot: "/path/to/project"
615
+ }
616
+
617
+ // Initialize only in specific directory
618
+ {
619
+ projectRoot: "/path/to/project",
620
+ targetPath: "apps/backend"
621
+ }
622
+ ```
623
+
624
+ **Typical Workflow:**
625
+ 1. AI assistant runs `init_ai_readme`
626
+ 2. Receives detailed instructions for each empty file
627
+ 3. Follows instructions:
628
+ - Uses `Glob` to scan directory
629
+ - Reads 2-5 key source files
630
+ - Analyzes tech stack, patterns, conventions
631
+ 4. Uses `update_ai_readme` to populate each file
632
+ 5. Verifies with `get_context_for_file` or `validate_ai_readmes`
633
+
589
634
  ### `validate_ai_readmes`
590
635
 
591
636
  Validate all AI_README.md files in your project for quality and token efficiency.
@@ -647,9 +692,8 @@ Validate all AI_README.md files in your project for quality and token efficiency
647
692
 
648
693
  We're actively working on new features:
649
694
 
650
- - **Watch Mode** - Auto-sync changes when AI_README files are modified
651
- - **Performance Optimization** - Caching and incremental updates
652
- - **VSCode Extension** - Visual interface for managing AI_README files
695
+ - **Auto-populate Empty AI_README** - Automatically generate AI_README content when `get_context_for_file` detects empty files, reducing manual initialization steps
696
+ - **Enhanced Tool Triggering** - Improve tool descriptions and prompts to ensure AI assistants trigger tools at the right moments with better precision and reliability
653
697
  - **CI/CD Integration** - GitHub Actions for automated README validation
654
698
 
655
699
  Want to contribute? Check out our [Contributing Guide](./CONTRIBUTING.md)!