chore: bootstrap repository foundation
Solution layout, build rules with zero-package guard, in-house test framework, localization runtime, brand mark rasteriser with ICO/PNG generation, Core contracts (imaging, video, domain model, TIFF reader), Titano.Tools (make-icon, i18n, xaml-lint, package-guard) and docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
109 files changed
+7523
No files matched your search
@@ -0,0 +1,61 @@
|
||||
namespace Titano.Tools;
|
||||
|
||||
internal interface ICommand
|
||||
{
|
||||
string Name { get; }
|
||||
string Summary { get; }
|
||||
Task<int> RunAsync(string[] args);
|
||||
}
|
||||
|
||||
internal sealed class ToolException(string message) : Exception(message);
|
||||
|
||||
/// <summary>Minimal option parser: <c>--key value</c>, <c>--flag</c>, positional arguments.</summary>
|
||||
internal sealed class Args
|
||||
{
|
||||
private readonly Dictionary<string, string?> _options = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public Args(string[] args, params string[] flags)
|
||||
{
|
||||
for (var i = 0; i < args.Length; i++)
|
||||
{
|
||||
var a = args[i];
|
||||
if (a.StartsWith("--", StringComparison.Ordinal))
|
||||
{
|
||||
var key = a[2..];
|
||||
if (flags.Contains(key, StringComparer.OrdinalIgnoreCase) || i + 1 >= args.Length || args[i + 1].StartsWith("--", StringComparison.Ordinal))
|
||||
_options[key] = null;
|
||||
else
|
||||
_options[key] = args[++i];
|
||||
}
|
||||
else
|
||||
{
|
||||
Positional.Add(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> Positional { get; } = [];
|
||||
|
||||
public bool Has(string key) => _options.ContainsKey(key);
|
||||
|
||||
public string? Get(string key) => _options.TryGetValue(key, out var v) ? v : null;
|
||||
|
||||
public string Get(string key, string fallback) => Get(key) ?? fallback;
|
||||
|
||||
public static string RepoRoot()
|
||||
{
|
||||
var dir = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
while (dir is not null)
|
||||
{
|
||||
if (File.Exists(Path.Combine(dir.FullName, "Titano.slnx"))) return dir.FullName;
|
||||
dir = dir.Parent;
|
||||
}
|
||||
dir = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (dir is not null)
|
||||
{
|
||||
if (File.Exists(Path.Combine(dir.FullName, "Titano.slnx"))) return dir.FullName;
|
||||
dir = dir.Parent;
|
||||
}
|
||||
throw new ToolException("Repository root (Titano.slnx) not found.");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user