Repository navigation
feat(cli): add explicit shell-scoped sp shorthand - #75
Merged
Merged
Conversation
abruption
marked this pull request as ready for review
September 29, 2026 08:37
2 of 5 tasks
8 of 11 tasks
Windows PowerShell -Command reports only 0 or 1 unless the command string ends with exit $LASTEXITCODE (about_PowerShell_exe), which turned expected usage refusals (exit 2) into 1. Keep -Command for global-scope alias removal, propagate the script exit code, and report every shorthand case mismatch with its output in one assertion.
Run the install/activate/update/uninstall lifecycle in every fixture shell with a second fixture-only version, assert command-not-found after removal, require exit 7 for the canonical capture, compare stderr between names, and verify each runner reports a script's own exit code.
Explain the PowerShell -ListImported limit for modules not yet imported, how to check an installation for the activation files, and the lifecycle coverage.
Node 22 prefixes the SQLite ExperimentalWarning with a per-process ID, so stderr from two invocations differs only in that number.
The lifecycle fixture replaces the package with a lower fixture version in the same prefix; it is not a registry upgrade and does not cover moving the canonical command on PATH.
…settings test:package does not load the isolate-env preload, so the shorthand fixture sets the same variables explicitly.
This was referenced Oct 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Users can opt in to
spas another invocation name for the installedsession-peerCLI. Ship Bash/zsh and PowerShell activation files that are explicitly sourced into the caller's shell/scope and refuse any existingspexecutable, alias or function. PowerShell's defaultsp = Set-ItemPropertymust be explicitly resolved by the user first.The alias resolves canonical
session-peerwithout a second parser, wrapper, argument reconstruction or eval. npm continues to register only the canonical bin and performs no profile/PATH edits or activation hooks. Scripts, SSH, help/version and reply instructions retain the canonical name. This assumes one installed implementation; Python/TS co-installation and a dispatcher are out of scope. Windows cmd.exe uses the canonical command.Document activation, scope/detection limits, deactivation and manager-owned update/uninstall in a detailed guide linked from all four README/guide languages. The public npm 0.2.1 archive is explicitly excluded; the source addition targets 0.3.0.
Closes #74. Python counterpart: abruption/session-peer#242. Correlation: SP-CLI-SHORTHAND-20260929.
Validation
spbin.--(canonical and alias capture both exit 7), unchanged collisions and deactivation. Each fixture shell first proves its runner reports a script's own exit code (exit 3-> 3).--prefix: install the packed version, activatesp, replace it in place with a second, lower fixture-only version (a version replacement in the same prefix, not a registry upgrade or a PATH move) (<version>-fixture.1, packed from a private copy withpackage.jsonand the compiledVERSIONchanged), assertsp --versionandsession-peer --versionboth report the new version, uninstall, assert both names fail as command not found (Bash/zsh exit 127 with "not found", PowerShellCommandNotFoundException), and confirm deactivation removessp. Fixture PATH excludes unrelated installed CLIs; no global install or profile change.64b98b9(fix(windows): give the creation-time probe a cold-start deadline #79, feat(ssh): support ordered multi-host commands and constrained connection options #84, feat(updates): add npm-aware update check and opt-in cached notices #85, feat(replies): add verified sender context and optional return-route diagnostics #86). Package file lists inscripts/release.mjsandtest/package-smoke.tsare the union of the shorthand assets plusdocs/shorthand.mdand main'sdist/ssh.*,dist/replies.*,dist/updates.*; PARITY keeps main's sections and adds the shorthand section after them.test:packagedoes not loadtest/fixtures/isolate-env.mjs, so the shorthand fixture sets the same isolation explicitly (SESSION_PEER_TAILSCALE=off, cleared sender socket, reply-host and update-notice variables); its PATH contains only the installed bin and a node link, so no realssh/tailscaleis reachable.npm test121 tests, 116 pass, 5 skipped (Windows-only), 0 fail;test:packagebash/zsh contract and lifecycle pass;test:types,check-repository,release.mjs pack+artifact,npm audit(0) and diff check pass.796b525) and CodeQL run 37091757017 pass every job.shorthandLifecyclewith0.2.1 -> 0.2.1-fixture.1appears for bash (Linux and macOS, Node 22/24), zsh (macOS, Node 22/24) and powershell (Windows PowerShell 5.1, Node 22/24), alongsideshorthandContractfor the same shells. Alias forwarding retains PowerShell's ordinary native-argument/text-pipeline semantics.(node:<pid>) ExperimentalWarningprefix; all other stderr bytes must match.Get-Command -ListImporteddoes not consider commands from modules not yet imported; activation does not import modules), how to check an installation for the activation files (--versioncannot distinguish a local build from public 0.2.1), and the exact lifecycle coverage.spalias isReadOnly, AllScope, so the fixture removes it with-Forcein global scope (the activator never removes it); Windows PowerShell 5.1ConvertFrom-Jsonarrays are assigned directly to keep argument arrays flat; and-Commandreports only 0/1 unless the command string ends withexit $LASTEXITCODE(about_PowerShell_exe), which had turned expected usage refusals (exit 2) into 1. The fixture now reports every mismatching case in one assertion.Release impact
No runtime parser, transport or submission code changes. Package contents add two opt-in activation assets and one guide. No publication, fleet installation or user shell/profile changes are performed by this PR.