Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/releases/0.1.0-beta.3.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 7 additions & 0 deletions docs/wiki/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 6 additions & 1 deletion scripts/json_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = '<executable-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))
Expand Down
13 changes: 13 additions & 0 deletions scripts/terminal_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions src/SidePulse.Cli/CliApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static string[] Normalize(string[] command)
config.ConfigureConsole(AnsiConsole.Console);
config.SetApplicationName(ApplicationIdentity.Command);
config.SetApplicationVersion(ProjectInfo.Version);
config.AddCommand<SetupHelpCommand>("setup").WithDescription("Open first-run setup in an interactive terminal.");
config.AddCommand<PreferencesCommand>("settings").WithDescription("Show, set or reset persistent non-secret defaults.");
config.AddCommand<InstallCommand>("install").WithDescription("Install for this user; optionally configure user PATH.");
config.AddCommand<UninstallCommand>("uninstall").WithDescription("Remove the managed installation while retaining settings and phone links.");
Expand Down
2 changes: 1 addition & 1 deletion src/SidePulse.Cli/Interactive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
66 changes: 63 additions & 3 deletions src/SidePulse.Cli/ShellSession.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Spectre.Console.Cli;
using SidePulse.Core;
using Spectre.Console;

Expand All @@ -12,7 +13,7 @@ public sealed class ShellSession(Func<string[], CancellationToken, int> 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<string> target = new(PreferenceStore.Default.Read().OutputArguments);
private readonly Stack<string> parents = new();
private bool preview;
Expand Down Expand Up @@ -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")
{
Expand Down Expand Up @@ -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<string> { "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<AgentProvider>());
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)
Expand Down Expand Up @@ -208,3 +257,14 @@ private int RunCommand(string[] args)
finally { Console.CancelKeyPress -= cancel; }
}
}

public sealed class SetupSettings : CommandSettings;

public sealed class SetupHelpCommand : Command<SetupSettings>
{
public override int Execute(CommandContext context, SetupSettings settings, CancellationToken cancellationToken)
{
Console.Error.WriteLine("Run spn setup in an interactive terminal.");
return 1;
}
}
2 changes: 1 addition & 1 deletion src/SidePulse.Cli/SidePulse.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>spn</AssemblyName>
<Version>0.1.0-beta.2</Version>
<Version>0.1.0-beta.3</Version>
<PublishSingleFile Condition="'$(RuntimeIdentifier)' != ''">true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<DebugType>embedded</DebugType>
Expand Down
Loading