feat(worker): detect company repos by origin remote pattern

This commit is contained in:
mika kuns
2026-10-01 10:28:54 +02:00
parent db3c7e69e5
commit faa91e0661
4 changed files with 61 additions and 0 deletions
@@ -70,6 +70,10 @@ public sealed class WorkerConfig
[JsonPropertyName("ticket_api_base_url")]
public string? TicketApiBaseUrl { get; set; }
/// <summary>Teilstring der <c>origin</c>-URL, an dem ein Firmen-Repo erkannt wird. Nur per Hand editierbar.</summary>
[JsonPropertyName("company_remote_pattern")]
public string CompanyRemotePattern { get; set; } = "/_git/";
public static string DefaultConfigPath =>
Path.Combine(Paths.AppDataRoot(), "worker.config.json");
+16
View File
@@ -0,0 +1,16 @@
using ClaudeDo.Data.Git;
namespace ClaudeDo.Worker.Git;
/// <summary>Erkennt Firmen-Repos am <c>origin</c>-Remote; das Muster kommt aus <c>WorkerConfig.CompanyRemotePattern</c>.</summary>
public static class CompanyRepo
{
/// <summary>True wenn <paramref name="remoteUrl"/> das (nicht-leere) Muster enthält, ohne Groß-/Kleinschreibung.</summary>
public static bool Matches(string? remoteUrl, string? pattern) =>
!string.IsNullOrWhiteSpace(remoteUrl) && !string.IsNullOrWhiteSpace(pattern)
&& remoteUrl.Contains(pattern, StringComparison.OrdinalIgnoreCase);
/// <summary>Liest <c>origin</c> live (kein Cache — ein Remote kann sich jederzeit ändern).</summary>
public static async Task<bool> IsCompanyAsync(GitService git, string workingDir, string? pattern, CancellationToken ct) =>
Matches(await git.GetRemoteUrlAsync(workingDir, "origin", ct), pattern);
}