208 lines
3.8 KiB
Text
208 lines
3.8 KiB
Text
---
|
|
title: "CLI Reference"
|
|
description: "Complete command-line reference for Codeflash CLI commands, flags, and options"
|
|
icon: "terminal"
|
|
sidebarTitle: "Overview"
|
|
keywords:
|
|
[
|
|
"CLI",
|
|
"command line",
|
|
"commands",
|
|
"flags",
|
|
"options",
|
|
"reference",
|
|
"terminal",
|
|
]
|
|
---
|
|
|
|
# Codeflash CLI Reference
|
|
|
|
Complete command-line reference for all Codeflash commands, flags, and options with practical examples you can run directly in your terminal.
|
|
|
|
<Info>
|
|
**Prerequisites** - Ensure Codeflash is installed in your Python environment
|
|
and you have a configured `pyproject.toml` in your project.
|
|
</Info>
|
|
|
|
---
|
|
|
|
## Quick Start
|
|
|
|
<Tabs>
|
|
<Tab title="Linux/macOS">
|
|
```bash
|
|
# Activate virtual environment (if using one)
|
|
source .venv/bin/activate
|
|
|
|
# Verify installation
|
|
codeflash --version
|
|
```
|
|
</Tab>
|
|
<Tab title="Windows">
|
|
```powershell
|
|
# Activate virtual environment (if using one)
|
|
.venv\Scripts\activate
|
|
|
|
# Verify installation
|
|
codeflash --version
|
|
```
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
---
|
|
|
|
## Common Workflows
|
|
|
|
### 1. First-Time Setup
|
|
|
|
<Steps>
|
|
<Step title="Install Codeflash">
|
|
```bash
|
|
pip install codeflash
|
|
```
|
|
</Step>
|
|
<Step title="Initialize Project">
|
|
```bash
|
|
codeflash init
|
|
```
|
|
</Step>
|
|
<Step title="Verify Setup">
|
|
```bash
|
|
codeflash --verify-setup
|
|
```
|
|
</Step>
|
|
<Step title="Run First Optimization">
|
|
```bash
|
|
codeflash --file src/main.py --function my_function --no-pr
|
|
```
|
|
</Step>
|
|
</Steps>
|
|
|
|
---
|
|
|
|
### 2. Optimize a Workflow
|
|
|
|
<Steps>
|
|
<Step title="Trace Your Script">
|
|
```bash
|
|
codeflash optimize my_script.py --arg1 value1
|
|
```
|
|
</Step>
|
|
<Step title="Review Optimizations">
|
|
Check the generated PR or local changes for optimization suggestions.
|
|
</Step>
|
|
</Steps>
|
|
|
|
---
|
|
|
|
### 3. CI/CD Integration
|
|
|
|
<Steps>
|
|
<Step title="Set Up GitHub Actions">
|
|
```bash
|
|
codeflash init-actions
|
|
```
|
|
</Step>
|
|
<Step title="Merge the Workflow PR">
|
|
Review and merge the generated GitHub Actions workflow.
|
|
</Step>
|
|
<Step title="Automatic Optimization">
|
|
Codeflash will now optimize code in every PR automatically!
|
|
</Step>
|
|
</Steps>
|
|
|
|
---
|
|
|
|
## Help & Version
|
|
|
|
```bash
|
|
# Display version
|
|
codeflash --version
|
|
|
|
# Main help
|
|
codeflash --help
|
|
|
|
# Subcommand help
|
|
codeflash optimize --help
|
|
codeflash init --help
|
|
```
|
|
|
|
---
|
|
|
|
## Documentation Structure
|
|
|
|
This CLI reference is organized into the following sections:
|
|
|
|
<CardGroup cols={2}>
|
|
<Card
|
|
title="Setup Commands"
|
|
icon="wrench"
|
|
href="/cli-reference/setup"
|
|
>
|
|
Initialize projects, set up GitHub Actions, and verify installation
|
|
</Card>
|
|
<Card
|
|
title="Optimization Commands"
|
|
icon="bullseye"
|
|
href="/cli-reference/optimization"
|
|
>
|
|
Optimize single functions or entire codebases
|
|
</Card>
|
|
<Card
|
|
title="Tracing & Workflows"
|
|
icon="route"
|
|
href="/cli-reference/tracing"
|
|
>
|
|
Trace script execution and optimize based on real usage
|
|
</Card>
|
|
<Card
|
|
title="Flags Reference"
|
|
icon="list"
|
|
href="/cli-reference/flags"
|
|
>
|
|
Complete reference for all command-line flags
|
|
</Card>
|
|
<Card
|
|
title="Troubleshooting"
|
|
icon="wrench"
|
|
href="/cli-reference/troubleshooting"
|
|
>
|
|
Solutions for common CLI issues
|
|
</Card>
|
|
</CardGroup>
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
<CardGroup cols={2}>
|
|
<Card
|
|
title="Optimize a Function"
|
|
icon="bullseye"
|
|
href="/optimizing-with-codeflash/one-function"
|
|
>
|
|
Learn how to optimize individual functions
|
|
</Card>
|
|
<Card
|
|
title="Trace & Optimize"
|
|
icon="route"
|
|
href="/optimizing-with-codeflash/trace-and-optimize"
|
|
>
|
|
Optimize entire workflows with tracing
|
|
</Card>
|
|
<Card
|
|
title="GitHub Actions"
|
|
icon="github"
|
|
href="/optimizing-with-codeflash/codeflash-github-actions"
|
|
>
|
|
Set up continuous optimization
|
|
</Card>
|
|
<Card
|
|
title="Configuration"
|
|
icon="gear"
|
|
href="/configuration"
|
|
>
|
|
Advanced configuration options
|
|
</Card>
|
|
</CardGroup>
|
|
|