2026-10-15 11:18:46 +02:00
|
|
|
using Avalonia;
|
|
|
|
|
using AgentWikiUi.Core;
|
|
|
|
|
using AgentWikiUi.Gui;
|
2026-10-08 11:50:57 +02:00
|
|
|
|
2026-10-15 11:40:47 +02:00
|
|
|
// Con argomenti: CLI. Con `--engine <id>` per primo si sceglie il motore (default Claude Code);
|
|
|
|
|
// il resto degli argomenti è unito in un solo prompt. Senza argomenti: GUI.
|
|
|
|
|
if (args.Length > 0)
|
|
|
|
|
{
|
2026-10-15 12:13:01 +02:00
|
|
|
ConsoleHost.AttachToParent(); // Windows: l'eseguibile non ha console, si usa quella del terminale padre
|
2026-10-15 11:40:47 +02:00
|
|
|
var engine = Engines.Claude;
|
|
|
|
|
var words = args;
|
|
|
|
|
if (args[0] == "--engine")
|
|
|
|
|
{
|
|
|
|
|
if (args.Length < 3 || Engines.Find(args[1]) is not { } chosen)
|
|
|
|
|
{
|
|
|
|
|
Console.Error.WriteLine($"Uso: <app> [--engine {string.Join('|', Engines.All.Select(e => e.Id))}] \"prompt\"");
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
engine = chosen;
|
|
|
|
|
words = args[2..];
|
|
|
|
|
}
|
|
|
|
|
return EngineRunner.RunInherited(engine, string.Join(' ', words));
|
|
|
|
|
}
|
2026-10-08 11:50:57 +02:00
|
|
|
|
2026-10-15 11:18:46 +02:00
|
|
|
return AppBuilder.Configure<App>().UsePlatformDetect().StartWithClassicDesktopLifetime(args);
|