Complete API reference for Aurelis command-line interface commands.
init_aurelis()
Initializes the Aurelis environment for CLI operations.
def init_aurelis(config_path: Optional[Path] = None) -> None:
"""
Initialize Aurelis for CLI usage.
Args:
config_path: Optional path to configuration file
Sets up:
- Configuration management
- Logging system
- Error handling
"""
init()
@app.command()
def init(
config_path: Optional[Path] = None,
force: bool = False
) -> None:
"""Initialize Aurelis configuration for GitHub models."""
Features:
.aurelis.yaml
configuration filemodels()
@app.command()
def models() -> None:
"""Display available GitHub models and their capabilities."""
Features:
analyze()
@app.command()
def analyze(
path: Path,
analysis_types: Optional[List[str]] = None,
output_format: str = "table",
save_report: Optional[Path] = None,
model: Optional[str] = None
) -> None:
"""Analyze Python code for issues and improvements."""
Analysis Types:
syntax
- Syntax and structural issuesperformance
- Performance optimization opportunitiessecurity
- Security vulnerabilities and concernsstyle
- Code style and best practicesOutput Formats:
table
- Rich formatted table outputjson
- Structured JSON for automationgenerate()
@app.command()
def generate(
prompt: str,
output_file: Optional[Path] = None,
model: Optional[str] = None,
temperature: float = 0.1,
max_tokens: Optional[int] = None
) -> None:
"""Generate code based on natural language description."""
Features:
explain()
@app.command()
def explain(
file_path: Path,
model: Optional[str] = None,
detailed: bool = False
) -> None:
"""Explain Python code functionality."""
Features:
fix()
@app.command()
def fix(
path: Path,
fix_type: List[str] = ["all"],
apply_fixes: bool = False,
backup: bool = True,
dry_run: bool = False,
model: Optional[str] = None
) -> None:
"""Automatically fix code issues and apply improvements."""
Fix Types:
security
- Security vulnerability fixesperformance
- Performance optimizationsstyle
- Code style improvementsbugs
- Bug fixes and correctionsall
- All fix typesFeatures:
refactor()
@app.command()
def refactor(
path: Path,
goal: str = "readability",
aggressive: bool = False,
preserve_behavior: bool = True,
output_dir: Optional[Path] = None,
model: Optional[str] = None
) -> None:
"""Refactor and optimize code for better maintainability."""
Refactor Goals:
performance
- Speed and efficiency optimizationreadability
- Code clarity and maintainabilitymodularity
- Better structure and separationpatterns
- Modern Python patterns and practicesFeatures:
docs()
@app.command()
def docs(
path: Path,
format_type: str = "markdown",
include_sections: List[str] = ["api"],
output: Optional[Path] = None,
template: Optional[str] = None,
model: Optional[str] = None
) -> None:
"""Generate comprehensive documentation for code."""
Format Types:
markdown
- Markdown documentationrst
- reStructuredText formathtml
- HTML documentationdocstring
- Python docstring formatInclude Sections:
api
- API reference documentationexamples
- Usage examplesusage
- Usage instructionsarchitecture
- Design and architecturetest()
@app.command()
def test(
path: Path,
framework: str = "pytest",
coverage: int = 80,
test_type: str = "unit",
output: Optional[Path] = None,
model: Optional[str] = None
) -> None:
"""Generate test cases and test suites for code."""
Test Frameworks:
pytest
- pytest framework (recommended)unittest
- Python unittest frameworkdoctest
- Doctest integrationTest Types:
unit
- Unit tests for individual functionsintegration
- Integration tests for componentsperformance
- Performance and benchmarking testssecurity
- Security-focused testsshell()
@app.command()
def shell() -> None:
"""Start interactive Aurelis shell."""
Features:
_display_analysis_table()
def _display_analysis_table(results) -> None:
"""Display analysis results in table format."""
Renders analysis results as a rich-formatted table with:
_display_analysis_json()
def _display_analysis_json(results) -> None:
"""Display analysis results in JSON format."""
Outputs structured JSON for:
_show_configuration()
def _show_configuration() -> None:
"""Show current configuration."""
Displays:
_list_models()
def _list_models() -> None:
"""List available models."""
Shows all available GitHub models with their identifiers.
_save_analysis_report()
def _save_analysis_report(
results,
file_path: Path,
format_type: str
) -> None:
"""Save analysis report to file."""
Supports multiple output formats:
All CLI commands use consistent error handling:
try:
# Command implementation
pass
except Exception as e:
logger.error(f"Command failed: {e}")
console.print(f"[red]Command failed: {e}[/red]")
raise typer.Exit(1)
Code | Meaning |
---|---|
0 | Success |
1 | General error |
2 | Configuration error |
3 | Authentication error |
4 | Network error |
5 | File not found |
from aurelis.cli.main import app
import typer
# Run commands programmatically
if __name__ == "__main__":
app()
from aurelis.cli.main import app
import typer
@app.command()
def custom_command():
"""Custom command extension."""
# Implementation
pass
--model
parameter allows manual selection