Queue/Task(s)/Gate in deutschem Fliesstext auf Warteschlange/Aufgabe(n)/ Limit-Stopp vereinheitlicht, columnTask-Keys auf AUFGABE angeglichen, Kill-Tonalitaet (closeSession/killSessionTip) ehrlich-destruktiv gemacht. RepoImportModalViewModel.CreateButtonText und alle Installer-Check-Messages (Git/GitIdentity/WriteAccess/ClaudeCli/ClaudeVersion/ClaudeAuth/ PermissionModeAuto/Ports) ueber Locale-Keys geroutet statt hartem Englisch, mit dem bestehenden TrExtension.Localizer-Fallback-Muster.
55 lines
2.2 KiB
C#
55 lines
2.2 KiB
C#
using System.Text.RegularExpressions;
|
|
using ClaudeDo.Data.Environment;
|
|
using ClaudeDo.Installer.Core;
|
|
using ClaudeDo.Installer.Core.Interfaces;
|
|
using ClaudeDo.Installer.Localization;
|
|
|
|
namespace ClaudeDo.Installer.Checks;
|
|
|
|
/// <summary>Without git, no task can run (worktrees) — blocking.</summary>
|
|
public sealed class GitCheck : IEnvironmentCheck
|
|
{
|
|
public const string CheckId = "git";
|
|
private static readonly Regex VersionPattern = new(@"\d+(\.\d+){1,3}", RegexOptions.Compiled);
|
|
|
|
private readonly IProcessRunner _processRunner;
|
|
private readonly string? _pathOverride;
|
|
private readonly string? _pathExtOverride;
|
|
|
|
public GitCheck(IProcessRunner processRunner, string? pathOverride = null, string? pathExtOverride = null)
|
|
{
|
|
_processRunner = processRunner;
|
|
_pathOverride = pathOverride;
|
|
_pathExtOverride = pathExtOverride;
|
|
}
|
|
|
|
public string Id => CheckId;
|
|
public CheckSeverity Severity => CheckSeverity.Error;
|
|
|
|
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
|
|
{
|
|
var loc = TrExtension.Localizer;
|
|
var resolved = ExecutableResolver.Resolve("git", _pathOverride, _pathExtOverride);
|
|
if (resolved is null)
|
|
{
|
|
return CheckResult.Fail(Id, Severity, "checks.git.title",
|
|
loc?["checks.git.notFound"] ?? "git was not found on PATH.",
|
|
"checks.git.hint", "https://git-scm.com/downloads");
|
|
}
|
|
|
|
var (fileName, arguments) = ProcessCommand.For(resolved, "--version");
|
|
var (exitCode, output) = await _processRunner.RunAsync(fileName, arguments, null, ct);
|
|
|
|
if (exitCode != 0)
|
|
{
|
|
return CheckResult.Fail(Id, Severity, "checks.git.title",
|
|
loc?.Get("checks.git.exitCode", resolved.Path, exitCode) ?? $"'{resolved.Path}' exited with code {exitCode}.",
|
|
"checks.git.hint", "https://git-scm.com/downloads", output);
|
|
}
|
|
|
|
var version = VersionPattern.Match(output) is { Success: true } match ? match.Value : output.Trim();
|
|
return CheckResult.Ok(Id, Severity, "checks.git.title",
|
|
loc?.Get("checks.git.resolvedFormat", resolved.Path, version) ?? $"{resolved.Path} — {version}");
|
|
}
|
|
}
|