@vancityayush/xpssh 0.1.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/LICENSE +21 -0
- package/README.md +84 -0
- package/dist/index.js +2929 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ayush Kumar (vancityAyush)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# xpssh
|
|
2
|
+
|
|
3
|
+
SSH keys for git providers, done right. One command takes you from nothing to a working `git clone` over SSH — key generated, `~/.ssh/config` wired, agent loaded, public key delivered, connection tested.
|
|
4
|
+
|
|
5
|
+
Supports **GitHub**, **GitLab**, **Bitbucket**, and **Azure DevOps**, with first-class multi-account support (work + personal on the same machine without the wrong-key headaches).
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npx xpssh # interactive TUI
|
|
9
|
+
npx xpssh setup github -e you@example.com # or go straight to it
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
<sub>Requires Node ≥ 22 (or Bun). Works on macOS and Linux; Windows is best-effort.</sub>
|
|
13
|
+
|
|
14
|
+
## What it does
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
$ xpssh setup github -n work -e you@company.com
|
|
18
|
+
· Generate SSH key ✓ ed25519 key written to ~/.ssh/xpssh_github_work
|
|
19
|
+
· Add host entry to ~/.ssh/config ✓ Host github.com-work added
|
|
20
|
+
· Load key into ssh-agent ✓ Key in agent (persisted to Keychain)
|
|
21
|
+
· Deliver public key to provider ✓ copied to clipboard, settings page opened
|
|
22
|
+
· Test SSH connection ✓ Hi you! You've successfully authenticated
|
|
23
|
+
✓ Profile github-work ready — clone with git@github.com-work:<owner>/<repo>.git
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Launching `xpssh` with no arguments opens the TUI: a dashboard of your profiles with status badges, a setup wizard, connection tester, agent manager — plus a Claude-Code-style command bar (`/`) that accepts every CLI command from anywhere.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
| Command | What it does |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `xpssh setup <provider>` | End-to-end key setup (`-n` name, `-e` email, `--token` API upload, `--dir` bind a folder, `-y` non-interactive) |
|
|
33
|
+
| `xpssh list [--json]` | All profiles with key/test status and clone prefixes |
|
|
34
|
+
| `xpssh test [<profile>] [--all]` | Verify SSH auth actually works |
|
|
35
|
+
| `xpssh copy <profile> [--open]` | Public key → clipboard (+ provider settings page) |
|
|
36
|
+
| `xpssh upload <profile>` | Push the public key via provider API (token from flag, env, or prompt) |
|
|
37
|
+
| `xpssh agent [list\|add\|remove\|start]` | ssh-agent management (macOS Keychain aware) |
|
|
38
|
+
| `xpssh remove <profile>` | Clean removal: config block, key files, manifest |
|
|
39
|
+
| `xpssh doctor [--fix]` | Detect & repair drift between manifest, ssh config, keys, and perms |
|
|
40
|
+
|
|
41
|
+
Providers accept aliases: `gh`, `gl`, `bb`, `ado`.
|
|
42
|
+
|
|
43
|
+
## Multi-account, solved properly
|
|
44
|
+
|
|
45
|
+
Each key is a named **profile** (`github-work`, `github-personal`). xpssh writes fenced, marker-tracked blocks to `~/.ssh/config` — your own content is never touched, and removal restores the file byte-for-byte:
|
|
46
|
+
|
|
47
|
+
```ssh-config
|
|
48
|
+
# >>> xpssh:github-work >>>
|
|
49
|
+
Host github.com-work
|
|
50
|
+
HostName github.com
|
|
51
|
+
User git
|
|
52
|
+
IdentityFile ~/.ssh/xpssh_github_work
|
|
53
|
+
IdentitiesOnly yes # ← the line that prevents wrong-account auth
|
|
54
|
+
AddKeysToAgent yes
|
|
55
|
+
UseKeychain yes # macOS only
|
|
56
|
+
# <<< xpssh:github-work <<<
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Your **first** profile per provider claims the bare host (`git@github.com:…` just works); later ones get aliases (`git@github.com-work:…`).
|
|
60
|
+
- `--dir ~/work` binds a directory to a profile via git `includeIf`: repos under it automatically commit with the right email *and* the right key, even when cloned with the bare URL.
|
|
61
|
+
|
|
62
|
+
## API token upload
|
|
63
|
+
|
|
64
|
+
Skip the copy-paste: `xpssh setup github --token <PAT>` (or `xpssh upload github-work`) pushes the key via the provider's REST API. Tokens are read from flags, `XPSSH_TOKEN_GITHUB` / `XPSSH_TOKEN_GITLAB` / `XPSSH_TOKEN_BITBUCKET`, or a masked prompt — and are **never persisted or logged**. Azure DevOps has no key API; xpssh opens the settings page instead.
|
|
65
|
+
|
|
66
|
+
## Safety
|
|
67
|
+
|
|
68
|
+
- `~/.ssh/config` edits are fenced, round-trip byte-exact, backed up to `config.xpssh.bak` first, and hard-error (never guess) on tampered fences
|
|
69
|
+
- Key files and config written with `600`, `~/.ssh` with `700`
|
|
70
|
+
- `xpssh doctor --fix` reconciles everything: missing/orphaned/stale config blocks, loose permissions, shadowed Host entries, missing key files
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
bun install
|
|
76
|
+
bun run dev # run from source
|
|
77
|
+
bun test # 90+ tests
|
|
78
|
+
bun run typecheck
|
|
79
|
+
bun run build # dist/ for npm (runs on plain Node)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|