Skip to content

Commit f6d59de

Browse files
fix: satisfy release static analysis for session links
Rename the Resume type to SessionResume and use System.Uri for OSC 8 hyperlink APIs, resolving CA1716, CA1054, and CA1055 under -warnaserror. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 902cd69 commit f6d59de

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/TSG/CommandRegistry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static Dictionary<string, Func<string[], Task<int>>> Build(IPlatformHost
3030
["db"] = args => DbQuery.RunAsync(host, args),
3131
["doctor"] = async _ => { await Diagnostics.RunDoctorAsync(host); return 0; },
3232
["config"] = args => Configuration.RunAsync(host, args),
33-
["resume"] = args => Resume.RunAsync(host, args),
33+
["resume"] = args => SessionResume.RunAsync(host, args),
3434
["version"] = _ => { Console.WriteLine($"tsg {Assembly.GetExecutingAssembly().GetName().Version}"); return Task.FromResult(0); },
3535
["help"] = _ => { PrintHelp(); return Task.FromResult(0); },
3636
["--help"] = _ => { PrintHelp(); return Task.FromResult(0); },

src/TSG/Hyperlink.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ public static class Hyperlink
2121
|| string.Equals(Environment.GetEnvironmentVariable("TERM_PROGRAM"), "vscode", StringComparison.OrdinalIgnoreCase));
2222

2323
/// <summary>Wrap <paramref name="text"/> in an OSC 8 hyperlink pointing at <paramref name="url"/>.</summary>
24-
public static string Wrap(string url, string text)
24+
public static string Wrap(Uri url, string text)
2525
{
26-
if (!IsSupported || string.IsNullOrEmpty(url)) return text;
27-
return $"{Osc8}{url}{St}{text}{Osc8}{St}";
26+
ArgumentNullException.ThrowIfNull(url);
27+
if (!IsSupported) return text;
28+
return $"{Osc8}{url.AbsoluteUri}{St}{text}{Osc8}{St}";
2829
}
2930

3031
/// <summary>Build a <c>tsg://resume/{sessionId}</c> URL to reopen a copilot session in a new tab.</summary>
31-
public static string ResumeUrl(string sessionId) => $"tsg://resume/{sessionId}";
32+
public static Uri ResumeUrl(string sessionId) => new($"tsg://resume/{sessionId}", UriKind.Absolute);
3233

3334
/// <summary>Write a clickable session ID (short prefix) to the console.</summary>
3435
public static void WriteSessionId(string sessionId, ConsoleColor color = ConsoleColor.DarkYellow)

src/TSG/Resume.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace TSG;
99
/// and launches <c>wt new-tab -d &lt;cwd&gt; pwsh -NoExit -Command "copilot --resume=&lt;id&gt;"</c>.
1010
/// Also handles the <c>tsg://resume/&lt;id&gt;</c> URL scheme registered during install.
1111
/// </summary>
12-
public static class Resume
12+
public static class SessionResume
1313
{
1414
public static Task<int> RunAsync(IPlatformHost host, string[] args)
1515
{

src/TSG/TSG.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<PackAsTool>true</PackAsTool>
2525
<ToolCommandName>tsg</ToolCommandName>
2626
<PackageId>TerminalStateGuard</PackageId>
27-
<Version>2.1.1</Version>
27+
<Version>2.1.2</Version>
2828
<Authors>sbay-dev</Authors>
2929
<Company>sbay-dev</Company>
3030
<Description>TSG — Terminal State Guard: Complete terminal intelligence platform with real-time window tracking (COM IUIAutomation), interactive process manager, SQLite state database, session recovery, and Copilot performance optimization.</Description>

0 commit comments

Comments
 (0)