diff --git a/docs/releases/0.1.0-beta.3.md b/docs/releases/0.1.0-beta.3.md new file mode 100644 index 0000000..f21c329 --- /dev/null +++ b/docs/releases/0.1.0-beta.3.md @@ -0,0 +1,8 @@ +# SidePulse.NET 0.1.0-beta.3 + +- Run `spn setup` in a terminal to review installation and optional user PATH changes, pair a phone, select an output and try a first state. +- Repair managed hook paths for Copilot, Codex, Claude Code, Kiro and OpenCode with `spn agents repair`. +- Check device firmware and verify firmware packages with `spn firmware upgrade --dry-run`. Dot storage control supports Linux and macOS with libusb. Windows firmware support includes an explicit read-only Pro channel pending physical validation. +- Updates detect edits to user files between preparation and replacement. Release preparation reuses verified drafts and refuses published versions. + +Download the archive for your platform and architecture and verify it against `SHA256SUMS`. Extract it, then run the included executable with `setup`. Stop a running SPN host before replacing an installation. diff --git a/docs/wiki/Installation.md b/docs/wiki/Installation.md index eda77ce..2473242 100644 --- a/docs/wiki/Installation.md +++ b/docs/wiki/Installation.md @@ -117,3 +117,10 @@ reproduction; Native AOT/trimming remains a separate investigation. After adopting a portable executable into a permanent directory, use `spn agents repair --dry-run` to inspect existing managed hooks, stop the host, then apply with `spn agents repair --apply`. See [integration path repair and recovery](Agent-Integrations.md#repair-paths-after-moving-or-installing-spn). + +Run `spn setup` in an interactive terminal, or open **Settings → First-run setup**. +Choose installation with an optional user PATH change or keep the executable portable. +The installer shows its destination and planned changes before confirmation. +Pair a phone or choose an existing phone or mounted device as your preferred output. +Preview the Working state and confirm separately when you want to send it. Setup +can be revisited, and leaving it preserves choices you already confirmed. diff --git a/scripts/json_compatibility.py b/scripts/json_compatibility.py index 645269c..04cac73 100644 --- a/scripts/json_compatibility.py +++ b/scripts/json_compatibility.py @@ -83,7 +83,12 @@ def main(): capture_output=True, text=True, timeout=15) channel = response.stdout if response.returncode == 0 else response.stderr try: - value = normalize(json.loads(channel), executable) + value = json.loads(channel) + if command == ['about', 'info', '--json'] and response.returncode == 0: + version = subprocess.check_output([str(executable), '--version'], env=environment, text=True, timeout=15).strip() + assert value['version'] == version, (value, version) + value['version'] = '' + value = normalize(value, executable) except ValueError as error: raise AssertionError(f'Invalid JSON for {command}, exit {response.returncode}') from error results.append((response.returncode, value)) diff --git a/scripts/terminal_smoke.py b/scripts/terminal_smoke.py index 85d072b..0600c87 100644 --- a/scripts/terminal_smoke.py +++ b/scripts/terminal_smoke.py @@ -70,6 +70,19 @@ def finish(self): self.process.kill() os.close(self.master) + setup = Terminal(['setup']) + try: + setup.until('Preview first state') + setup.send(b'\x1b[B' * 4 + b'\r') + setup.until('Completed: state working') + assert not (root / 'config').exists() + setup.until('First-run setup') + setup.send(b'\x1b') + setup.until('Quit') + setup.send(b'\x03') + finally: + setup.finish() + menu = Terminal([]) try: menu.until('Host: not connected') diff --git a/src/SidePulse.Cli/CliApplication.cs b/src/SidePulse.Cli/CliApplication.cs index 5fd463a..fbe1273 100644 --- a/src/SidePulse.Cli/CliApplication.cs +++ b/src/SidePulse.Cli/CliApplication.cs @@ -33,6 +33,7 @@ static string[] Normalize(string[] command) config.ConfigureConsole(AnsiConsole.Console); config.SetApplicationName(ApplicationIdentity.Command); config.SetApplicationVersion(ProjectInfo.Version); + config.AddCommand("setup").WithDescription("Open first-run setup in an interactive terminal."); config.AddCommand("settings").WithDescription("Show, set or reset persistent non-secret defaults."); config.AddCommand("install").WithDescription("Install for this user; optionally configure user PATH."); config.AddCommand("uninstall").WithDescription("Remove the managed installation while retaining settings and phone links."); diff --git a/src/SidePulse.Cli/Interactive.cs b/src/SidePulse.Cli/Interactive.cs index fa90cbc..3f6d320 100644 --- a/src/SidePulse.Cli/Interactive.cs +++ b/src/SidePulse.Cli/Interactive.cs @@ -14,7 +14,7 @@ public static class Interactive if (!TerminalMode.Interactive) { if (args.Length == 0) return ["--help"]; - if (args.Length == 1 && args[0] is "about" or "animations" or "agents" or "link" or "host" or "profiles") return [args[0], "--help"]; + if (args.Length == 1 && args[0] is "about" or "animations" or "agents" or "link" or "host" or "profiles" or "setup") return [args[0], "--help"]; return args; } if (args.Length > 1 || args.Length == 1 && args[0] is not ("about" or "animations" or "agents" or "link" or "host" or "profiles" or "update")) return args; diff --git a/src/SidePulse.Cli/ShellSession.cs b/src/SidePulse.Cli/ShellSession.cs index 6dac247..276a89e 100644 --- a/src/SidePulse.Cli/ShellSession.cs +++ b/src/SidePulse.Cli/ShellSession.cs @@ -1,3 +1,4 @@ +using Spectre.Console.Cli; using SidePulse.Core; using Spectre.Console; @@ -12,7 +13,7 @@ public sealed class ShellSession(Func execute) { private static readonly MenuItem[] Home = [new("Send state"), new("Animations"), new("Devices & phones"), new("Agents & host"), new("Settings"), new("Help & about"), new("Quit")]; - private static readonly string[] Groups = ["about", "animations", "agents", "link", "host", "profiles", "update"]; + private static readonly string[] Groups = ["about", "animations", "agents", "link", "host", "profiles", "update", "setup"]; private readonly List target = new(PreferenceStore.Default.Read().OutputArguments); private readonly Stack parents = new(); private bool preview; @@ -53,11 +54,13 @@ public int Run(string[] args) } if (section == "Settings") { - var action = Interactive.Choose(section, [new("Preferences"), new("Diagnostics", ["doctor"]), new("Installation"), new("Updates"), new("Profiles"), new("Back")]); + var action = Interactive.Choose(section, [new("Preferences"), new("Diagnostics", ["doctor"]), new("Installation"), new("Updates"), new("Profiles"), new("Back"), new("First-run setup", ["setup"])]); if (action is null || action.Label == "Back") { section = Back(); continue; } - if (action.Arguments is { } command) RunCommand(command); else { parents.Push(section); section = action.Label.ToLowerInvariant(); } + if (action.Label == "First-run setup") Setup(); + else if (action.Arguments is { } command) RunCommand(command); else { parents.Push(section); section = action.Label.ToLowerInvariant(); } continue; } + if (section == "setup") { Setup(); section = Back(); continue; } if (section == "preferences") { EditPreferences(); section = Back(); continue; } if (section == "installation") { @@ -104,6 +107,52 @@ public int Run(string[] args) private string? Back() => parents.TryPop(out var parent) ? parent : null; + private void Setup() + { + while (true) + { + var status = Installation.Status(); + var step = Interactive.Choose("First-run setup", + [new("Install for this user"), new("Continue in portable mode"), new("Pair a phone"), + new("Choose preferred output"), new("Preview first state"), new("Send first state"), + new("Register an agent integration"), new("Back")], + $"Installation: {(status.installedExecutableExists ? status.installedExecutable : "portable")}\nOutput: {PreferenceStore.Default.Read().OutputDescription}"); + switch (step?.Label) + { + case null or "Back": return; + case "Continue in portable mode": + Console.WriteLine("Keep this executable at a permanent path before registering hooks. Use agents repair if you move it later."); + break; + case "Install for this user": + var install = new List { "install", "--directory", status.directory ?? UserInstallation.DefaultDirectory }; + if (Interactive.Confirm("Add spn to user PATH?", false)) install.AddRange(["--add-to-path", "--shell", TerminalMode.Shell]); + if (RunCommand([.. install, "--dry-run"]) == 0 && Interactive.Confirm("Apply the installation shown above?", false)) + RunCommand([.. install]); + break; + case "Pair a phone": + RunCommand(["link", "pair", Interactive.Ask("Phone alias")]); + break; + case "Choose preferred output": + ChangeOutput(); + break; + case "Preview first state": + RunCommand(["state", "working", .. target, "--dry-run"]); + break; + case "Send first state": + if (Interactive.Confirm("Send Working to the preferred output now?", false)) + RunCommand(["state", "working", .. target]); + break; + case "Register an agent integration": + if (!status.installedExecutableExists && !Interactive.Confirm("Hooks will use this portable path. Continue without installing?", false)) break; + var provider = Interactive.Pick("Agent", Enum.GetValues()); + string[] hooks = ["agents", "install", provider.ToString()]; + if (RunCommand([.. hooks, "--dry-run"]) == 0 && Interactive.Confirm("Register the hooks shown above?", false)) + RunCommand(hooks); + break; + } + } + } + private void SendState() { while (true) @@ -208,3 +257,14 @@ private int RunCommand(string[] args) finally { Console.CancelKeyPress -= cancel; } } } + +public sealed class SetupSettings : CommandSettings; + +public sealed class SetupHelpCommand : Command +{ + public override int Execute(CommandContext context, SetupSettings settings, CancellationToken cancellationToken) + { + Console.Error.WriteLine("Run spn setup in an interactive terminal."); + return 1; + } +} diff --git a/src/SidePulse.Cli/SidePulse.Cli.csproj b/src/SidePulse.Cli/SidePulse.Cli.csproj index bacbc4b..10d0954 100644 --- a/src/SidePulse.Cli/SidePulse.Cli.csproj +++ b/src/SidePulse.Cli/SidePulse.Cli.csproj @@ -2,7 +2,7 @@ Exe spn - 0.1.0-beta.2 + 0.1.0-beta.3 true true embedded