Skip to content

Commit 5a259dc

Browse files
committed
feat: enhance README generator with programmatic access documentation
- Add comprehensive "Access Methods" section with CLI, API, MCP, and programmatic examples - Include installation instructions for all binary commands - Add endpoint documentation and curl examples for REST API - Include MCP configuration examples for Claude Desktop - Update installation section with npx usage patterns
1 parent 8dc9bba commit 5a259dc

File tree

1 file changed

+117
-3
lines changed

1 file changed

+117
-3
lines changed

scripts/generate-complete-readme.js

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,40 @@ npx ${name} --help
123123
- Dry-run mode for safe testing
124124
- Detailed operation reporting
125125
126+
### 🌐 **Multiple Access Methods**
127+
- **CLI Tool**: Direct command-line interface with JSON output
128+
- **REST API**: Lightweight HTTP server using native Node.js
129+
- **MCP Server**: Model Context Protocol for AI agent integration
130+
- **Programmatic API**: TypeScript library for Node.js applications
131+
126132
## 📦 Installation
127133
128134
### Direct Usage with npx (Recommended)
129135
\`\`\`bash
136+
# CLI Tool
130137
npx ${name} --help
131138
npx ${name} move old-doc.md new-doc.md
139+
140+
# REST API Server
141+
npx ${name}-api
142+
143+
# MCP Server
144+
npx ${name}-mcp
132145
\`\`\`
133146
134147
### Global Installation
135148
\`\`\`bash
136149
npm install -g ${name}
137-
${name} --help
150+
151+
# All tools available globally
152+
${name} --help # CLI tool
153+
${name}-api # REST API server
154+
${name}-mcp # MCP server
138155
\`\`\`
139156
140-
### Local Installation
157+
### Library Installation
141158
\`\`\`bash
142159
npm install ${name}
143-
npx ${name} --help
144160
\`\`\`
145161
146162
### Requirements
@@ -305,6 +321,104 @@ npx ${name} index --dry-run --verbose
305321
- **branch**: Index in directories with subdirectories
306322
- **existing**: Only update existing index files
307323
324+
## 🌐 Access Methods
325+
326+
${name} provides multiple ways to access its functionality:
327+
328+
### 1. CLI Tool (Command Line Interface)
329+
330+
The primary command-line interface with JSON output support:
331+
332+
\`\`\`bash
333+
# Basic usage
334+
npx ${name} move old.md new.md
335+
336+
# With JSON output for scripting
337+
npx ${name} move old.md new.md --json
338+
339+
# Dry run with detailed output
340+
npx ${name} split large.md --strategy headers --dry-run --verbose --json
341+
\`\`\`
342+
343+
### 2. REST API Server
344+
345+
Lightweight HTTP API using native Node.js (zero external dependencies):
346+
347+
\`\`\`bash
348+
# Start API server (default port 3000)
349+
npx ${name}-api
350+
351+
# Custom port
352+
PORT=8080 npx ${name}-api
353+
\`\`\`
354+
355+
**Available Endpoints:**
356+
- \`GET /health\` - Health check
357+
- \`POST /api/move\` - Move single file
358+
- \`POST /api/move-batch\` - Move multiple files
359+
- \`POST /api/validate\` - Validate operation results
360+
361+
**Example API Usage:**
362+
\`\`\`bash
363+
# Move a file
364+
curl -X POST http://localhost:3000/api/move \\
365+
-H "Content-Type: application/json" \\
366+
-d '{"source": "old.md", "destination": "new.md", "options": {"dryRun": true}}'
367+
368+
# Health check
369+
curl http://localhost:3000/health
370+
\`\`\`
371+
372+
### 3. MCP Server (Model Context Protocol)
373+
374+
For AI agent integration with Claude and other MCP-compatible systems:
375+
376+
\`\`\`bash
377+
# Start MCP server
378+
npx ${name}-mcp
379+
\`\`\`
380+
381+
**MCP Configuration for Claude Desktop:**
382+
\`\`\`json
383+
{
384+
"mcpServers": {
385+
"${name}": {
386+
"command": "npx",
387+
"args": ["${name}-mcp"]
388+
}
389+
}
390+
}
391+
\`\`\`
392+
393+
**Available MCP Tools:**
394+
- \`move_file\` - Move markdown file with link updates
395+
- \`move_files\` - Move multiple files with link updates
396+
- \`validate_operation\` - Validate operation results
397+
398+
### 4. Programmatic API
399+
400+
TypeScript/JavaScript library for Node.js applications:
401+
402+
\`\`\`typescript
403+
import { FileOperations, moveFile, createMarkMv } from '${name}';
404+
405+
// Simple usage
406+
const result = await moveFile('old.md', 'new.md');
407+
408+
// Advanced usage
409+
const fileOps = new FileOperations();
410+
const result = await fileOps.moveFile('docs/api.md', 'reference/', {
411+
dryRun: true,
412+
verbose: true
413+
});
414+
415+
// Factory pattern
416+
const markmv = createMarkMv();
417+
const result = await markmv.moveFiles([
418+
{ source: 'docs/*.md', destination: 'archive/' }
419+
]);
420+
\`\`\`
421+
308422
## ⚙️ Configuration
309423
310424
Configuration options can be passed via command line flags. See each command's \`--help\` for available options.

0 commit comments

Comments
 (0)