Command Overview
The InitRepo CLI provides comprehensive commands for code analysis, documentation generation, and safe code modifications. All commands support both human-readable and JSON output formats for seamless AI integration.Command Categories
Analysis Commands
Deep codebase analysis including structure, complexity, and quality metrics
Generation Commands
Automated documentation and structure generation from code analysis
Modification Commands
Safe code modifications using AST-based operations
Utility Commands
Project scaffolding, configuration, and task management
Core Analysis Commands
analyze
Performs comprehensive codebase analysis and creates a .initrepo/ directory with results.
--format: Output format (text, json)--include: Include file patterns--exclude: Exclude file patterns--max-depth: Maximum directory depth--verbose: Detailed output
generate-structure
Creates visual project structure documentation.
- Tree Format
- JSON Format
--format: tree, json--max-depth: Maximum directory depth (default: 5)--output: Output file path--include-hidden: Include hidden files and directories
analyze-complexity
Analyzes code complexity and identifies potential issues.
--threshold: Complexity threshold (default: 10)--with-recommendations: Include improvement suggestions--format: text, json--include: File patterns to analyze--exclude: File patterns to exclude
analyze-imports
Analyzes import statements and identifies issues.
--unused-only: Show only unused imports--circular-only: Show only circular dependencies--format: text, json--fix: Automatically fix issues (use with caution)
validate-structure
Validates project structure against best practices.
- Structure score (0-100)
- Best practice violations
- Improvement recommendations
- Compliance status
Documentation Commands
deps
Analyzes and documents project dependencies.
Basic Usage
Basic Usage
Output Formats
Output Formats
find-symbol
Searches for symbols (functions, classes, variables) in the codebase.
--type: Symbol type (function, class, variable, interface)--exact: Exact matching only--case-sensitive: Case-sensitive search--format: text, json
get-code
Extracts code blocks with context.
minimal: Function/class onlydependencies: Include immediate dependenciesfull: Include complete context and relationships
Safe Modification Commands
safe-rename
Safely renames symbols throughout the codebase using AST analysis.
1
Preview Changes
2
Apply Rename
3
Verify Changes
--dry-run: Preview changes without applying--backup: Create backup before changes--scope: Limit scope (file, directory, project)--format: text, json
manage-imports
Manages import statements automatically.
--remove-unused: Remove unused import statements--organize: Sort and group imports--dry-run: Preview changes--backup: Create backup before changes
Utility Commands
scaffold
Creates new projects with best practices and templates.
- Web Projects
- Backend & APIs
- Libraries & Tools
- Project templates are pre-configured with best practices
- Includes package.json, configuration files, and basic project structure
- Ready for immediate development and deployment
suggest-refactor
Provides AI-powered refactoring suggestions.
performance: Performance improvementsmaintainability: Code maintainabilitysecurity: Security enhancementsstyle: Code style consistency
find-references
Finds all references to a symbol.
Global Options
All commands support these global options:Advanced Usage Examples
Automated Quality Analysis
CI/CD Integration
AI Assistant Integration
Command Aliases
Common command aliases for faster usage:Best Practices
For Development Workflow
- Run analysis regularly:
initrepo-cli analyzeshould be part of your development routine - Use JSON output: Enable better integration with scripts and AI assistants
- Preview before modifying: Always use
--dry-runfor modification commands - Set appropriate thresholds: Adjust complexity thresholds based on your project needs
For Team Collaboration
- Standardize configurations: Use consistent
.initrepoignorefiles across team - Integrate with CI/CD: Automate quality checks in your pipelines
- Share JSON outputs: Use structured outputs for team analysis and reporting
- Document decisions: Use refactoring suggestions to document architectural decisions