feat: Phase 0 shells, design system, server skeleton, Docker and CI
- Titano.Ui: DESIGN.md tokens (dark/light), generated 16-px icon set, styles for all standard controls, custom chrome window with snap layouts, rail, job bar, Auto/manual slider, chips, toasts. - Titano desktop shell with sections, Settings (language, theme), About and a --capture screenshot mode. - Titano Server skeleton: env/server.json configuration, self-signed TLS with fingerprint, /health, /server/info, i18n endpoint and the embedded admin panel; in-process server tests. - Docker image (multi-arch, PUID/PGID, health check), compose file, Unraid template; CI, release and nightly workflows; changelog tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
122 files changed
+6838
-22
No files matched your search
@@ -0,0 +1,90 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Titano.Tools.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Builds release notes from Conventional Commits. Reads <c>git log --format=%h%x09%s</c> lines from stdin
|
||||
/// (or <c>--in file</c>) and writes Markdown grouped by type.
|
||||
/// </summary>
|
||||
internal sealed partial class ChangelogCommand : ICommand
|
||||
{
|
||||
private static readonly (string Type, string Heading)[] Sections =
|
||||
[
|
||||
("feat", "Added"),
|
||||
("fix", "Fixed"),
|
||||
("perf", "Performance"),
|
||||
("security", "Security"),
|
||||
("i18n", "Localization"),
|
||||
("docs", "Documentation"),
|
||||
];
|
||||
|
||||
public string Name => "changelog";
|
||||
public string Summary => "Release notes from Conventional Commits on stdin (--title, --out file)";
|
||||
|
||||
public async Task<int> RunAsync(string[] args)
|
||||
{
|
||||
var a = new Args(args);
|
||||
IReadOnlyList<string> input = a.Get("in") is { } file ? await File.ReadAllLinesAsync(file) : ReadStdin();
|
||||
var markdown = Render(input, a.Get("title"));
|
||||
if (a.Get("out") is { } outFile)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(outFile))!);
|
||||
await File.WriteAllTextAsync(outFile, markdown, new UTF8Encoding(false));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write(markdown);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal static string Render(IEnumerable<string> lines, string? title)
|
||||
{
|
||||
var groups = new Dictionary<string, List<string>>(StringComparer.Ordinal);
|
||||
var breaking = new List<string>();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var tab = line.IndexOf('\t');
|
||||
var hash = tab > 0 ? line[..tab] : string.Empty;
|
||||
var subject = tab > 0 ? line[(tab + 1)..] : line;
|
||||
var m = Conventional().Match(subject);
|
||||
if (!m.Success) continue;
|
||||
var type = m.Groups["type"].Value.ToLowerInvariant();
|
||||
var scope = m.Groups["scope"].Success ? $"**{m.Groups["scope"].Value}**: " : string.Empty;
|
||||
var entry = $"- {scope}{m.Groups["desc"].Value.Trim()}{(hash.Length > 0 ? $" ({hash})" : string.Empty)}";
|
||||
if (m.Groups["bang"].Success) breaking.Add(entry);
|
||||
if (!groups.TryGetValue(type, out var list)) groups[type] = list = [];
|
||||
list.Add(entry);
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
if (title is not null) sb.Append("# ").AppendLine(title).AppendLine();
|
||||
if (breaking.Count > 0)
|
||||
{
|
||||
sb.AppendLine("### Breaking changes");
|
||||
foreach (var e in breaking) sb.AppendLine(e);
|
||||
sb.AppendLine();
|
||||
}
|
||||
foreach (var (type, heading) in Sections)
|
||||
{
|
||||
if (!groups.TryGetValue(type, out var entries)) continue;
|
||||
sb.Append("### ").AppendLine(heading);
|
||||
foreach (var e in entries) sb.AppendLine(e);
|
||||
sb.AppendLine();
|
||||
}
|
||||
if (sb.Length == 0) sb.AppendLine("Maintenance release.");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static List<string> ReadStdin()
|
||||
{
|
||||
var lines = new List<string>();
|
||||
if (!Console.IsInputRedirected) return lines;
|
||||
while (Console.In.ReadLine() is { } line) lines.Add(line);
|
||||
return lines;
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"^(?<type>[a-zA-Z]+)(?:\((?<scope>[^)]+)\))?(?<bang>!)?:\s*(?<desc>.+)$")]
|
||||
private static partial Regex Conventional();
|
||||
}
|
||||
@@ -83,6 +83,8 @@ internal sealed partial class I18nCommand : ICommand
|
||||
foreach (var (file, key) in UsedKeys(root))
|
||||
{
|
||||
if (en.ContainsKey(key)) continue;
|
||||
// Prefix lookups such as L("Settings.Page." + page) are satisfied by any key under the prefix.
|
||||
if (key.EndsWith('.') && en.Keys.Any(k => k.StartsWith(key, StringComparison.Ordinal))) continue;
|
||||
// Plural lookups reference the stem; any suffix satisfies them.
|
||||
if (en.Keys.Any(k => k.StartsWith(key + ".", StringComparison.Ordinal) && PluralSuffix().IsMatch(k[(key.Length + 1)..]))) continue;
|
||||
errors.Add($"{Path.GetRelativePath(root, file)}: unknown key {key}");
|
||||
|
||||
@@ -7,6 +7,7 @@ var commands = new ICommand[]
|
||||
new I18nCommand(),
|
||||
new XamlLintCommand(),
|
||||
new PackageGuardCommand(),
|
||||
new ChangelogCommand(),
|
||||
};
|
||||
|
||||
if (args.Length == 0 || args[0] is "-h" or "--help" or "help")
|
||||
|
||||
Reference in new issue
Block a user