Code Mode CLI
Command-line interface for Code Mode tool
Code Mode CLI
Use Code Mode from the command line for code generation and editing.
Commands
Generate Code
praisonai-ts tools run code-mode \
--action generate \
--content "Create a REST API with Express" \
--language typescriptEdit Code
praisonai-ts tools run code-mode \
--action edit \
--file ./src/utils.ts \
--content "Add error handling"Explain Code
praisonai-ts tools run code-mode \
--action explain \
--file ./src/complex.tsReview Code
praisonai-ts tools run code-mode \
--action review \
--file ./src/api.tsOptions
| Option | Type | Default | Description |
|---|---|---|---|
--action | string | generate | Action: generate, edit, explain, review |
--content | string | – | Description or instructions |
--file | string | – | Target file path |
--language | string | typescript | Programming language |
--format | boolean | true | Format output |
--output | string | – | Output file path |
Examples
Generate Python Script
praisonai-ts tools run code-mode \
--action generate \
--language python \
--content "Web scraper for news articles" \
--output scraper.pyRefactor File
praisonai-ts tools run code-mode \
--action edit \
--file ./legacy.js \
--content "Convert to modern ES6+ syntax"Environment Variables
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY | Yes | For code generation |