GUI Avalonia multipiattaforma in solo C# e rinomina in agent-wiki-ui
Sostituisce WinForms, WebView2 e ui.html con una GUI Avalonia (XAML, ViewModel, tema chiaro/scuro) e un renderer markdown che trasforma l'albero di Markdig in controlli. Un solo progetto net10.0 per Windows e Linux, con publish single-file compresso. L'avvio di claude è in un solo punto (Core/Claude.cs) condiviso da CLI e GUI. Il nome dell'app viene dall'AssemblyName; ChatStore migra la cartella dati LlmRun alla nuova. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c6a679e6a
commit
941d02110d
13 files changed
+966
-50
No files matched your search
+6
-42
@@ -1,44 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using Avalonia;
|
||||
using AgentWikiUi.Core;
|
||||
using AgentWikiUi.Gui;
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
// WebView2 richiede un thread STA, che i top-level statements non danno
|
||||
var ui = new Thread(() =>
|
||||
{
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.SetColorMode(SystemColorMode.System);
|
||||
Application.Run(new Gui());
|
||||
});
|
||||
ui.SetApartmentState(ApartmentState.STA);
|
||||
ui.Start();
|
||||
ui.Join();
|
||||
return 0;
|
||||
}
|
||||
// Con argomenti: CLI (tutti gli argomenti uniti in un prompt). Senza: GUI.
|
||||
if (args.Length > 0) return Claude.RunInherited(string.Join(' ', args));
|
||||
|
||||
var psi = NewClaude(string.Join(' ', args));
|
||||
try
|
||||
{
|
||||
using var p = Process.Start(psi)!; // stdout/stderr ereditati: streaming in tempo reale
|
||||
p.StandardInput.Close();
|
||||
p.WaitForExit();
|
||||
return p.ExitCode;
|
||||
}
|
||||
catch (System.ComponentModel.Win32Exception)
|
||||
{
|
||||
Console.Error.WriteLine("'claude' non trovato nel PATH.");
|
||||
return 127;
|
||||
}
|
||||
|
||||
static ProcessStartInfo NewClaude(string prompt)
|
||||
{
|
||||
var psi = new ProcessStartInfo("claude")
|
||||
{
|
||||
WorkingDirectory = AppContext.BaseDirectory,
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true, // evita l'attesa di stdin di claude
|
||||
};
|
||||
psi.ArgumentList.Add("-p");
|
||||
psi.ArgumentList.Add(prompt);
|
||||
return psi;
|
||||
}
|
||||
return AppBuilder.Configure<App>().UsePlatformDetect().StartWithClassicDesktopLifetime(args);
|
||||
Reference in new issue
Block a user