session-peer 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PARITY.md +281 -17
- package/README.ja.md +12 -5
- package/README.ko.md +12 -5
- package/README.md +12 -4
- package/README.zh-CN.md +11 -4
- package/RELEASING.md +60 -7
- package/SECURITY.md +1 -1
- package/VALIDATION.md +186 -7
- package/dist/cli.d.ts +10 -1
- package/dist/cli.js +274 -44
- package/dist/diagnostics.d.ts +2 -0
- package/dist/diagnostics.js +1 -1
- package/dist/help.js +32 -5
- package/dist/output.d.ts +1 -1
- package/dist/output.js +15 -0
- package/dist/process.js +76 -5
- package/dist/protocol.d.ts +6 -3
- package/dist/protocol.js +17 -6
- package/dist/replies.d.ts +30 -0
- package/dist/replies.js +283 -0
- package/dist/ssh.d.ts +24 -0
- package/dist/ssh.js +114 -0
- package/dist/updates.d.ts +37 -0
- package/dist/updates.js +444 -0
- package/dist/windows.d.ts +1 -1
- package/dist/windows.js +4 -3
- package/docs/api.md +4 -4
- package/docs/design/remote-deployment.md +867 -0
- package/docs/guide.ja.md +116 -14
- package/docs/guide.ko.md +216 -21
- package/docs/guide.md +253 -23
- package/docs/guide.zh-CN.md +103 -13
- package/docs/shorthand.md +198 -0
- package/package.json +4 -3
- package/shorthand/sp.ps1 +11 -0
- package/shorthand/sp.sh +11 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Optional `sp` shorthand
|
|
2
|
+
|
|
3
|
+
[README](../README.md) · [User guide](guide.md)
|
|
4
|
+
|
|
5
|
+
This feature ships with 0.3.0 and later ([#74](https://github.com/abruption/session-peer-ts/issues/74)).
|
|
6
|
+
The npm 0.2.1 and earlier archives do **not** contain these activation files;
|
|
7
|
+
install 0.3.0 or later, or use a reviewed checkout or its
|
|
8
|
+
[locally built tarball](guide.md#build-from-source).
|
|
9
|
+
|
|
10
|
+
`session-peer` is the canonical command. `sp` is an opt-in alias in your current
|
|
11
|
+
Bash/zsh session or PowerShell scope. It resolves the same command on PATH: there
|
|
12
|
+
is no second CLI parser, argument reconstruction, `eval`, runtime dispatcher or
|
|
13
|
+
extra delivery attempt. Version/help output continues to say `session-peer`.
|
|
14
|
+
Keep `session-peer` in scripts, automation, SSH commands and reply instructions.
|
|
15
|
+
Windows cmd.exe also uses the canonical command; this feature does not install
|
|
16
|
+
an `sp.cmd` launcher.
|
|
17
|
+
|
|
18
|
+
Only one implementation is assumed installed. Check `session-peer --version`
|
|
19
|
+
and your installation manager before enabling the alias. Python and TypeScript
|
|
20
|
+
co-installation is outside this feature's scope.
|
|
21
|
+
|
|
22
|
+
## Checking for the activation files
|
|
23
|
+
|
|
24
|
+
An installation that reports 0.3.0 or later contains these files. `--version`
|
|
25
|
+
alone is not conclusive for a source build, which reports its checkout's
|
|
26
|
+
package version. Check for the files in the installed package directory:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
# Global npm installation:
|
|
30
|
+
ls "$(npm root --global)/session-peer/shorthand/sp.sh"
|
|
31
|
+
# Isolated or project prefix (replace <prefix>):
|
|
32
|
+
ls "$(npm root --prefix <prefix>)/session-peer/shorthand/sp.sh"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
Test-Path (Join-Path (npm root --global) 'session-peer/shorthand/sp.ps1')
|
|
37
|
+
# Isolated or project prefix (replace <prefix>):
|
|
38
|
+
Test-Path (Join-Path (npm root --prefix <prefix>) 'session-peer/shorthand/sp.ps1')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
A missing file means that installation predates the feature (for example the
|
|
42
|
+
0.2.1 archive); its `session-peer` command still works, but `sp` cannot
|
|
43
|
+
be activated from it.
|
|
44
|
+
|
|
45
|
+
## Why activation is explicit
|
|
46
|
+
|
|
47
|
+
npm owns only the `session-peer` executable. Adding another unconditional npm
|
|
48
|
+
`bin` entry would claim the generic `sp` name during installation. Instead, npm
|
|
49
|
+
ships activation files and never creates an `sp` executable, changes PATH,
|
|
50
|
+
edits a shell profile or runs an installation hook.
|
|
51
|
+
|
|
52
|
+
The activation file runs **in the shell you source it into**, so it can detect
|
|
53
|
+
that shell's aliases and functions as well as commands on PATH. A subprocess
|
|
54
|
+
cannot see every alias/function in its parent shell. This is why activation is
|
|
55
|
+
not a separate `session-peer install-alias` process. Detection is a snapshot of
|
|
56
|
+
that scope/PATH, not a machine-wide reservation; commands added later can still
|
|
57
|
+
change resolution. A repeated activation also refuses the already defined `sp`.
|
|
58
|
+
|
|
59
|
+
## Bash and zsh
|
|
60
|
+
|
|
61
|
+
Inspect the existing names and read the activation file before sourcing it:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
type -a session-peer
|
|
65
|
+
type -a sp
|
|
66
|
+
# Reviewed source checkout:
|
|
67
|
+
. ./shorthand/sp.sh
|
|
68
|
+
sp --version
|
|
69
|
+
sp list --agent claude --json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`type -a sp` reporting no command is expected when the name is free. The asset
|
|
73
|
+
refuses an existing alias, function or executable and also refuses a missing
|
|
74
|
+
`session-peer`. It defines only `alias sp='session-peer'`. Quoted arguments,
|
|
75
|
+
Unicode, stdin and `--` retain their ordinary shell meaning; message contents
|
|
76
|
+
are never evaluated again.
|
|
77
|
+
|
|
78
|
+
With an npm installation **that contains the new files**, the activation path is:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
# Global npm installation:
|
|
82
|
+
. "$(npm root --global)/session-peer/shorthand/sp.sh"
|
|
83
|
+
# Or a project-local installation (choose one):
|
|
84
|
+
# . ./node_modules/session-peer/shorthand/sp.sh
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use this in an interactive Bash/zsh session. Bash disables alias expansion by
|
|
88
|
+
default in noninteractive scripts; the asset does not change shell options.
|
|
89
|
+
Use canonical `session-peer` in automation. If you want persistence, review and
|
|
90
|
+
add the chosen source line yourself to `.bashrc` or `.zshrc` after PATH setup.
|
|
91
|
+
A child shell cannot activate an alias in its parent.
|
|
92
|
+
|
|
93
|
+
To disable it, inspect `alias sp`; if it still points to `session-peer`, run
|
|
94
|
+
`unalias sp`. Remove your profile source line too, if you added one. Do not
|
|
95
|
+
remove a replacement alias belonging to another tool.
|
|
96
|
+
|
|
97
|
+
## PowerShell
|
|
98
|
+
|
|
99
|
+
PowerShell normally already defines `sp` as `Set-ItemProperty`. Activation
|
|
100
|
+
intentionally refuses that collision. Inspect **all** matches first:
|
|
101
|
+
|
|
102
|
+
```powershell
|
|
103
|
+
Get-Command session-peer -All
|
|
104
|
+
Get-Command sp -All
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
If you decide to give up the built-in alias in this scope, explicitly remove it
|
|
108
|
+
only after verifying its definition. Windows PowerShell marks this built-in alias
|
|
109
|
+
read-only, so this explicit removal uses `-Force`. Activation never does. This
|
|
110
|
+
is a separate user choice:
|
|
111
|
+
|
|
112
|
+
```powershell
|
|
113
|
+
if ((Get-Alias sp -ErrorAction SilentlyContinue).Definition -eq 'Set-ItemProperty') {
|
|
114
|
+
Remove-Item Alias:sp -Force
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Other `sp` commands/functions/aliases must also be resolved by you.
|
|
119
|
+
|
|
120
|
+
The PowerShell activator detects collisions with `Get-Command sp -ListImported`,
|
|
121
|
+
which covers aliases, functions, cmdlets and PATH applications already visible in
|
|
122
|
+
the session. It does **not** consider an `sp` command exported by a module that
|
|
123
|
+
is installed but not yet imported (module auto-loading). Activation deliberately
|
|
124
|
+
does not import modules to find out, because importing runs module code. If you
|
|
125
|
+
rely on such a module, check `Get-Command sp -All` (which can auto-load it) and
|
|
126
|
+
choose accordingly; once that module is imported, the activator refuses its `sp`.
|
|
127
|
+
|
|
128
|
+
Then read
|
|
129
|
+
and dot-source the activation file (do not invoke it with `&`):
|
|
130
|
+
|
|
131
|
+
```powershell
|
|
132
|
+
# Reviewed source checkout:
|
|
133
|
+
. ./shorthand/sp.ps1
|
|
134
|
+
sp --version
|
|
135
|
+
sp list --agent claude --json
|
|
136
|
+
# For a global npm installation containing the new files, use this path instead:
|
|
137
|
+
# . (Join-Path (npm root --global) 'session-peer/shorthand/sp.ps1')
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The alias belongs to the caller's scope. Dot-sourcing inside a function does not
|
|
141
|
+
activate it globally. Shell execution policy still applies; activation does not
|
|
142
|
+
change it. PowerShell's normal native argument and text-pipeline encoding rules
|
|
143
|
+
remain the same for both names. The alias does not add a wrapper around npm's
|
|
144
|
+
existing launcher.
|
|
145
|
+
|
|
146
|
+
To disable only this alias:
|
|
147
|
+
|
|
148
|
+
```powershell
|
|
149
|
+
if ((Get-Alias sp -ErrorAction SilentlyContinue).Definition -eq 'session-peer') {
|
|
150
|
+
Remove-Item Alias:sp
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Remove any activation line you chose to add to `$PROFILE`. A new unmodified
|
|
155
|
+
PowerShell session restores its normal built-in aliases.
|
|
156
|
+
|
|
157
|
+
## Updating, uninstalling and replacing an implementation
|
|
158
|
+
|
|
159
|
+
Use npm to update an npm-owned runtime as described in the [README](../README.md#update).
|
|
160
|
+
An active `sp` alias follows the canonical name on PATH after an in-place npm
|
|
161
|
+
update; it does not pin a package version or cache the previous CLI entry point.
|
|
162
|
+
After changing prefixes/PATH, check both `session-peer --version` and `sp --version`.
|
|
163
|
+
|
|
164
|
+
Disable the alias and remove a persistent profile line before running
|
|
165
|
+
`npm uninstall --global session-peer` (use your original prefix for a local
|
|
166
|
+
installation). npm removes the package and activation files but cannot remove
|
|
167
|
+
an alias already loaded into another shell. Such an alias becomes unresolved
|
|
168
|
+
when the canonical executable disappears; it does not install a fallback.
|
|
169
|
+
|
|
170
|
+
When changing between Python and TypeScript, first remove the old implementation
|
|
171
|
+
with its own manager, then select the new installation. Do not use npm `--force`
|
|
172
|
+
to replace another manager's files. Never silently replace another tool's `sp`.
|
|
173
|
+
|
|
174
|
+
## Validation boundaries
|
|
175
|
+
|
|
176
|
+
Package tests compare both names against an isolated installed CLI for
|
|
177
|
+
version/help/list/dry-run and argument errors, including exit codes and stdout
|
|
178
|
+
and stderr. Shell fixtures check whitespace, Unicode, literal metacharacters,
|
|
179
|
+
stdin, `--`, executable/alias/function collisions, missing canonical commands
|
|
180
|
+
and deactivation; each fixture shell first proves that its runner reports a
|
|
181
|
+
script's own exit code (3), not a 0/1 summary.
|
|
182
|
+
|
|
183
|
+
The lifecycle fixture runs in every fixture shell: Bash on macOS/Linux, zsh where
|
|
184
|
+
present (including macOS), and Windows PowerShell 5.1 on Windows Node 22/24. In an
|
|
185
|
+
isolated `--prefix` it installs the packed version, activates `sp`, replaces it
|
|
186
|
+
in place with a second, fixture-only version packed from a copy whose
|
|
187
|
+
`package.json` version and compiled `VERSION` constant were changed (it sorts
|
|
188
|
+
below the original, so this is a version replacement, not a registry upgrade),
|
|
189
|
+
and checks that `sp --version` and `session-peer --version` both report the
|
|
190
|
+
replacement. It then uninstalls the package and checks that both names fail as
|
|
191
|
+
command not found (Bash/zsh exit 127, PowerShell `CommandNotFoundException`) and
|
|
192
|
+
that deactivation removes `sp`. Installation and replacement use the same
|
|
193
|
+
prefix, so moving the canonical command to another PATH location is not covered.
|
|
194
|
+
It never installs globally or edits a profile.
|
|
195
|
+
|
|
196
|
+
These are isolated fixtures, not live message or ACK evidence. Submission,
|
|
197
|
+
ownership, permissions and no-retry-on-unknown contracts remain those of the
|
|
198
|
+
canonical CLI.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "session-peer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"dist",
|
|
27
27
|
"docs",
|
|
28
|
+
"shorthand",
|
|
28
29
|
"README.md",
|
|
29
30
|
"README.ko.md",
|
|
30
31
|
"README.ja.md",
|
|
@@ -38,9 +39,9 @@
|
|
|
38
39
|
],
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "tsc -p tsconfig.json",
|
|
41
|
-
"test": "npm run build && npm run test:types && node --experimental-strip-types --test test/*.test.ts",
|
|
42
|
+
"test": "npm run build && npm run test:types && node --import ./test/fixtures/isolate-env.mjs --experimental-strip-types --test test/*.test.ts",
|
|
42
43
|
"test:types": "tsc -p tsconfig.test.json",
|
|
43
|
-
"test:windows": "npm run build && npm run test:types && node --import ./test/fixtures/windows-inspection-diagnostic.mjs --experimental-strip-types --test --test-concurrency=1 test/windows.test.ts test/windows-contract.test.ts test/windows-inspection.test.ts test/input-boundaries.test.ts test/discovery.test.ts test/codex-homes.test.ts test/diagnostics.test.ts test/cli-usability.test.ts test/skill-guidance.test.ts",
|
|
44
|
+
"test:windows": "npm run build && npm run test:types && node --import ./test/fixtures/isolate-env.mjs --import ./test/fixtures/windows-inspection-diagnostic.mjs --experimental-strip-types --test --test-concurrency=1 test/windows.test.ts test/windows-contract.test.ts test/windows-inspection.test.ts test/input-boundaries.test.ts test/discovery.test.ts test/codex-homes.test.ts test/diagnostics.test.ts test/cli-usability.test.ts test/skill-guidance.test.ts test/ssh-hosts.test.ts test/replies.test.ts test/updates.test.ts",
|
|
44
45
|
"test:package": "npm run build && node --experimental-strip-types test/package-smoke.ts"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
package/shorthand/sp.ps1
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Dot-source this file to opt in in the caller's current PowerShell scope.
|
|
2
|
+
if ($MyInvocation.InvocationName -ne '.') {
|
|
3
|
+
throw 'Dot-source this file to activate sp in the current scope.'
|
|
4
|
+
}
|
|
5
|
+
if (Get-Command sp -ListImported -ErrorAction SilentlyContinue) {
|
|
6
|
+
throw 'sp already exists; inspect Get-Command sp -All before choosing a name.'
|
|
7
|
+
}
|
|
8
|
+
if (-not (Get-Command session-peer -ErrorAction SilentlyContinue)) {
|
|
9
|
+
throw 'session-peer is not available; select its installation on PATH first.'
|
|
10
|
+
}
|
|
11
|
+
Set-Alias -Name sp -Value session-peer -Scope Local -ErrorAction Stop
|
package/shorthand/sp.sh
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Source this file in an interactive Bash or zsh session to opt in.
|
|
2
|
+
# No profile edits, PATH changes, argument reconstruction or external launcher.
|
|
3
|
+
if command -v sp >/dev/null 2>&1; then
|
|
4
|
+
printf '%s\n' 'sp already exists; inspect it with type -a sp before choosing a name.' >&2
|
|
5
|
+
return 1
|
|
6
|
+
fi
|
|
7
|
+
if ! command -v session-peer >/dev/null 2>&1; then
|
|
8
|
+
printf '%s\n' 'session-peer is not available; select its installation on PATH first.' >&2
|
|
9
|
+
return 1
|
|
10
|
+
fi
|
|
11
|
+
alias sp='session-peer'
|