Claus Ibsen created CAMEL-25363:
-----------------------------------

             Summary: camel-jbang - camel fix: fix with AI from the command line
                 Key: CAMEL-25363
                 URL: https://issues.apache.org/jira/browse/CAMEL-25363
             Project: Camel
          Issue Type: New Feature
          Components: camel-jbang
            Reporter: Claus Ibsen


CAMEL-25358 brought *Shift+F8* "fix with AI" to the Source editor, the Errors 
tab and the Log tab: something fails while the app runs in dev mode, and the AI 
gets a question with the source line, the exception and how often it failed. A 
{{camel fix}} command would give the same inner loop to people (and scripts) 
that use the plain CLI, next to {{camel ask}} and {{camel explain}}.

Proposal:
{noformat}
camel fix                        # the newest distinct errors of the running 
app: pick one, fix its source line
camel fix orders.camel.yaml:24   # fix what fails on that line
camel fix --log                  # the latest ERROR in the log (the Message 
History gives the source line)
camel fix --explain              # no edits: explain only (ErrorDiagnoser when 
no AI provider is configured)
{noformat}

* Finds the running integration as {{camel ask}} does ({{--name}}, 
auto-detected when one runs).
* Writes the question as the TUI does ({{AiFixPrompt}}), and asks the model 
with the same providers and options as {{camel ask}} ({{--api-type}}, 
{{--model}}, {{--url}}, Ollama auto-detected).
* The change of the AI is shown as a diff and applied only when confirmed 
({{--yes}} to skip); the file is validated, and dev mode reloads it.
* Without an AI provider, {{--explain}} uses {{ErrorDiagnoser}} (the known 
causes and fixes of the exception), so it is useful offline too.

To share the logic between the CLI, the TUI and the MCP tools, move 
{{RuntimeFailures}} (an error to its source line) and {{LogErrors}} (the ERRORs 
of a log, with their Message History) from the TUI plugin to 
{{camel-jbang-core}} ({{commands/ai}}), as was done for the shared authoring 
tools (CAMEL-24695).

Related: CAMEL-25358 (Shift+F8 in the TUI), CAMEL-25362 (Shift+F8 in more TUI 
screens).

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to