tv_pine_autofix
Repair Pine Script errors automatically: reads source, compiles, applies static fixes, then optionally invokes an LLM to patch remaining issues, saves, adds to chart, and verifies the result.
Instructions
Autonomous Pine Script repair loop. Reads source, compiles, applies static rules first, then optionally calls an LLM (OPENAI_API_KEY/ANTHROPIC_API_KEY) to patch remaining errors, saves, adds to chart, and verifies. DESTRUCTIVE: may save and add to chart. Set autoSave/autoAddToChart=false to run read-only diagnostics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | Natural-language goal, e.g. 'Fix all compile errors and add moving average' | |
| source | No | Optional replacement source. If omitted, reads from the editor. | |
| autoSave | No | Automatically save patched source (default true) | |
| maxAttempts | No | Maximum repair attempts (1-10, default 5) | |
| autoAddToChart | No | Automatically add to chart after compile success (default true) | |
| expectedIndicatorName | No | Name to verify in chart legend after add-to-chart |