1.0.0 β’ Published 5 months ago
repo-mapper v1.0.0
repo-mapper πΊοΈ
A powerful Node.js package that generates detailed repository maps, summaries, and statistics. Perfect for documentation, codebase understanding, and AI prompts.
Features β¨
- π Generate clear, hierarchical repository structure
- π Collect detailed statistics about your codebase
- π Create concise summaries of repository content
- β‘ Fast and efficient directory scanning
- π€ AI-prompt friendly output format
Installation
npm install repo-mapper
Project Structure
root/
βββ src/
β βββ index.ts # Main entry point
β βββ mapper.ts # Core mapping functionality
β βββ types.ts # TypeScript type definitions
βββ tests/
β βββ __tests__/ # Test files
βββ docs/ # Documentation
Core Files
src/index.ts
Entry point that exports the main mapRepository
function. Acts as the public API for the package.
src/mapper.ts
Contains the RepoMapper
class that handles:
- Directory scanning
- Structure generation
- Summary creation
- Statistics collection
src/types.ts
TypeScript interfaces and types for:
- MapResult
- MapperOptions
- Internal types
API Documentation
Main Function
async function mapRepository(
dirPath: string,
options: MapperOptions = {}
): Promise<MapResult>
Parameters
dirPath
: Path to the repository directory to mapoptions
: Configuration options (optional)interface MapperOptions { ignorePaths?: string[]; // Paths to ignore maxDepth?: number; // Maximum directory depth // Add other options as needed }
Returns
interface MapResult {
structure: string; // Formatted repository structure
summary: string; // Repository summary
statistics: { // Repository statistics
totalFiles: number;
totalDirectories: number;
fileTypes: Record<string, number>;
// Other statistics
}
}
Usage Examples
Basic Usage
import { mapRepository } from 'repo-mapper';
const result = await mapRepository('./project-path');
console.log(result.structure);
With Options
const result = await mapRepository('./project-path', {
ignorePaths: ['node_modules', 'dist'],
maxDepth: 3
});
Getting Statistics
const { statistics } = await mapRepository('./project-path');
console.log(statistics.totalFiles);
console.log(statistics.fileTypes);
Common Use Cases
Repository Documentation
- Generate clear repository structure documentation
- Create standardized README files
- Document codebase organization
AI Development
- Generate context for AI programming assistants
- Create structured input for code analysis
- Standardize repository documentation
Development Workflows
- Onboard new team members
- Track project structure changes
- Maintain consistent documentation
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the ISC License.
1.0.0
5 months ago