Skip to content

comment

by rob

Developer

Add inline comments to code explaining what each section does

code comments documentation
# comment

Add inline comments to code explaining what each section does

## Installation

This is a CmdForge tool. Install it from the registry:

```bash
cmdforge install comment
```

## Usage

Pipe code into the tool to add explanatory inline comments:

```bash
# Comment a Python file
cat script.py | comment

# Comment and save to a new file
cat app.js | comment --of app-commented.js

# Comment code from clipboard
xclip -o | comment

# Comment a specific function
cat utils.py | comment > utils-documented.py
```

## Arguments

| Flag | Variable | Description |
|------|----------|-------------|
| `--of` | `outputfile` | Optional output file path to save commented code |

## How It Works

1. **AI Analysis**: The input code is sent to the `opencode-deepseek` provider, which analyzes the code structure and generates appropriate inline comments explaining what each section does
2. **Post-Processing**: A code step processes the AI response to format the output correctly
3. **Output**: Returns the code with inline comments added, either to stdout or to the specified output file

## Dependencies

None

No reviews yet.

Issues

No issues reported for this tool.