Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
IMPORTANT: As Claude runs tests that generate content, always clean up the content once done if it's temporary and not needed for the project.
npm run build - Compiles all TypeScript packages using workspace dependenciesnpm start - Runs the production MCP servernpm run dev - Runs with file watching for developmentnpm run generate-html - Interactive CLI for creating themed adventure content in multiple formats (HTML, Markdown, JSON, XML, Text)npm run lint - Check code quality and complexitynpm run lint:fix - Auto-fix linting issues where possiblenpm run lint:complexity - Focus on cyclomatic complexity analysisnpm test - Runs comprehensive test suite across all packagesnpm run test:unit - Core algorithm and component testsnpm run test:integration - LLM provider and repomix integration testsnpm run test:simple - Basic MCP workflow validation (2 minutes timeout)npm run test:real-world - Full system integration with performance monitoringnpm run chat - Interactive terminal-based testing clientnpm run test:html - Quick HTML generation (minimal LLM calls for fast testing)npm run test:md - Quick Markdown generation for testing format strategiesnpm run test:prompts - LLM prompt analysis and debuggingThe system works without LLM configuration (using fallback templates), but LLM enables dynamic story generation:
cp .env.example .env # Configure LLM_API_KEY, LLM_BASE_URL, LLM_MODEL
ALWAYS use the code-reviewer agent after writing or significantly modifying code. This includes:
Exception: Skip code review only for trivial changes like:
ALWAYS run
npm run lint and fix any linting errors before committing code. The project uses ESLint with cyclomatic complexity analysis to maintain code quality.
The project enforces these complexity limits to maintain readability and testability:
Functions exceeding these limits should be refactored into smaller, more focused units.
This is a multi-package monorepo that gamifies code repository exploration through AI-powered storytelling. The system operates as both an MCP (Model Context Protocol) server and a standalone HTML generator, using domain-driven architecture principles.
The system is organized into three specialized packages with clear separation of concerns:
packages/mcp/) - Protocol implementation and user interfacepackages/core/) - Domain logic, LLM integration, and shared functionalitypackages/generator/) - Static site generation for standalone adventuresDomain-Driven Design: Each package represents a distinct domain with clear boundaries Event-Driven Communication: MCP protocol orchestrates tool interactions Plugin-Based LLM Integration: Unified interface supporting multiple AI providers Template-Based Fallback: Ensures functionality without LLM dependencies
packages/mcp/)Protocol Layer: Implements MCP specification with stdio transport
server.ts: Dynamic tool registration using Zod schemas, graceful shutdown handlingtools.ts: Tool orchestration with 4 main tools (start_adventure, choose_theme, explore_path, view_progress)tools/: Individual tool implementations maintaining shared state through singleton patternpackages/core/)Business Logic Layer: Domain models and LLM integration
adventure/: Story generation and state management
AdventureManager: Orchestrates adventure flow and user interactionsStoryGenerator: LLM-powered content generation with template fallbacksanalyzer/: Repository analysis through repomix subprocess integration
RepoAnalyzer: Intelligent caching and content analysis coordinationllm/: Multi-provider LLM abstraction (OpenAI, Azure OpenAI, GitHub Models, Ollama)
LLMClient: Unified API with provider auto-detection and response cachingshared/: Cross-cutting concerns (configuration, themes, validation, error handling)packages/generator/)Presentation Layer: Multi-format content generation with interactive CLI
html-generator.ts: Multi-theme site builder with parallel generation supporttemplate-engine.ts: Variable substitution and markdown processingformatters/: Strategy pattern implementation for multiple output formats
format-strategy.ts: Base interface for all format strategies (supports both single-file and multi-file generation)format-factory.ts: Factory for creating format-specific strategiesformat-context.ts: Coordinates format generation and strategy selectionformat-exporter.ts: Facade providing simple API for format exportformat-types.ts: TypeScript interfaces for HTML builder and asset managerstrategies/: Format implementations (HTML, Markdown, JSON, XML, Text)templates/: Responsive HTML templates with mobile-first designthemes/: CSS theming system with animations and theme-specific visual elementsThe
FileSystemScanner detects technologies through file patterns and extensions. Technologies are returned in UPPERCASE format (e.g., 'TYPESCRIPT', 'JAVASCRIPT'). Each technology maps to themed characters in the adventure stories.
packages/core/src/shared/config.ts)All timeouts, limits, and environment variables are centralized:
Environment Variables:
LLM_API_KEY, LLM_BASE_URL, LLM_MODEL, GITHUB_TOKEN
Resource Limits: File size (10MB), scan depth (3 levels), key files (10), functions/classes in summaries
Timeouts: File operations (10s), analysis (30s), LLM requests (15s), cache TTL (5min)
packages/core/src/shared/theme.ts)Five built-in themes with extensible custom theme support:
adventure.config.jsonThe generator uses the Strategy Pattern to support multiple output formats with clean separation of concerns:
FormatStrategy Interface: Defines contract for all format implementations
format(data): stringgenerateFiles(): Promise<void>getFileExtension(), getFileName(), and isMultiFile()BaseFormatStrategy: Abstract base class with shared utilities (e.g., getQuestContent())FormatStrategyFactory: Creates appropriate strategy based on format type
registerStrategy()FormatContext: Coordinates strategy selection and executionFormatExporter: Facade providing simple API for external callersHtmlStrategy: Multi-file generation with themes, assets, and navigationMarkdownStrategy: Single markdown file with quest sectionsJsonStrategy: Structured JSON with quest metadata and contentXmlStrategy: XML format with proper escaping for special charactersTextStrategy: Plain text format with simple formatting--theme all) is only supported for HTML format--serve flag only works with HTML format (will error with other formats)index.md, index.json)packages/core/src/shared/instances.ts)packages/core/src/llm/)The typical user interaction flow:
start_adventure - Analyzes codebase, returns available themeschoose_theme - Generates story and adventures for selected themeexplore_path - Explores specific adventures (can be called multiple times)view_progress - Shows completion status and remaining adventuresModule System:
"type": "module" in package.json).js extension even for TypeScript filesTesting Considerations:
.js imports in TypeScript{ "mcpServers": { "repo-adventures": { "command": "node", "args": ["/path/to/ai-repo-adventures/dist/server.js"], "cwd": "/path/to/target/project" } } }
Note: The
cwd should point to the project you want to explore, not this MCP server's directory.
Stories are generated based on the actual codebase being analyzed:
Key implications:
### Adventure Generation Commands - **Interactive Generation**: `npm run generate-html` - CLI wizard for theme selection, format, and output configuration - **Quick Testing**: `npm run test:html` - Fast HTML generation with minimal LLM calls - **Markdown Format**: `npm run test:md` - Generate markdown format for testing - **Multiple Formats**: The generator supports 5 output formats: - **HTML** (default): Interactive website with navigation, themes, and quest pages - **Markdown** (`--format md`): Single markdown file for GitHub/documentation - **JSON** (`--format json`): Structured data for programmatic use - **XML** (`--format xml`): XML format for data exchange - **Text** (`--format txt`): Plain text format - **Format Examples**: - `node packages/generator/bin/cli.js --theme space --format md --output ./docs` - `node packages/generator/bin/cli.js --theme mythical --format json --output ./exports` - `node packages/generator/bin/cli.js --theme all --output tests/public --overwrite --max-quests 1` - Generate all themes (HTML only supports multi-theme) ### Special Instructions **Important**: Add each prompt entered by the user to ./user-prompts.md. Create the file if it doesn't already exist.