Skip to main content

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.
Options:
  • --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.
Options:
  • --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.
Options:
  • --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.
Options:
  • --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.
Output includes:
  • Structure score (0-100)
  • Best practice violations
  • Improvement recommendations
  • Compliance status

Documentation Commands

deps

Analyzes and documents project dependencies.

find-symbol

Searches for symbols (functions, classes, variables) in the codebase.
Options:
  • --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.
Context levels:
  • minimal: Function/class only
  • dependencies: Include immediate dependencies
  • full: 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

Options:
  • --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.
Options:
  • --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.
Options:
  • 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.
Categories:
  • performance: Performance improvements
  • maintainability: Code maintainability
  • security: Security enhancements
  • style: 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

  1. Run analysis regularly: initrepo-cli analyze should be part of your development routine
  2. Use JSON output: Enable better integration with scripts and AI assistants
  3. Preview before modifying: Always use --dry-run for modification commands
  4. Set appropriate thresholds: Adjust complexity thresholds based on your project needs

For Team Collaboration

  1. Standardize configurations: Use consistent .initrepoignore files across team
  2. Integrate with CI/CD: Automate quality checks in your pipelines
  3. Share JSON outputs: Use structured outputs for team analysis and reporting
  4. Document decisions: Use refactoring suggestions to document architectural decisions

Next Steps

Advanced Features

Explore CI/CD integration, team workflows, and automation scripts

Configuration Guide

Customize CLI behavior for your specific needs