gh-ssh 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/dist/cli.js +2329 -0
  4. package/package.json +66 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Juncen Zhou
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,76 @@
1
+ # gh-ssh
2
+
3
+ An interactive CLI that guides you through creating or reusing an SSH key and connecting it to GitHub in a 7-step workflow. Optimized for macOS with clipboard support, but works on Linux/Windows by printing the key when clipboard isn’t available.
4
+
5
+ ## Installation
6
+
7
+ Requirements:
8
+
9
+ - Node.js >= 20
10
+
11
+ Install globally:
12
+
13
+ - `npm install -g gh-ssh`
14
+
15
+ Run without installing:
16
+
17
+ - `npx gh-ssh`
18
+
19
+ ## Usage
20
+
21
+ Run interactive setup:
22
+
23
+ - `gh-ssh`
24
+
25
+ Show help/version:
26
+
27
+ - `gh-ssh --help`
28
+ - `gh-ssh --version`
29
+
30
+ Provide options up front:
31
+
32
+ - `gh-ssh --email you@example.com`
33
+ - `gh-ssh --type ed25519`
34
+ - `gh-ssh --key-name id_github_work`
35
+ - `gh-ssh --update-config`
36
+ - `gh-ssh --skip-config`
37
+
38
+ Options:
39
+
40
+ - `-h, --help`
41
+ - `-v, --version`
42
+ - `--email <email>` GitHub email for key comment
43
+ - `--type <ed25519|rsa>` Key type (default: ed25519)
44
+ - `--key-name <name>` Key filename in ~/.ssh (default: id_ed25519 or id_rsa)
45
+ - `--update-config` Update ~/.ssh/config with the selected key
46
+ - `--skip-config` Skip updating ~/.ssh/config
47
+
48
+ ## How it works
49
+
50
+ 1. Detect existing public keys in ~/.ssh and optionally reuse one.
51
+ 2. Generate a new key pair if needed (ed25519 by default, rsa 4096 fallback).
52
+ 3. Start ssh-agent if it is not already running.
53
+ 4. Add the selected key to ssh-agent.
54
+ 5. Optionally update ~/.ssh/config (with an optional GitHub host alias).
55
+ 6. Copy the public key to clipboard (macOS) or print it to the terminal, then add it at https://github.com/settings/keys.
56
+ 7. Prompt to verify with `ssh -T git@github.com` (or your alias).
57
+
58
+ ## Platform notes
59
+
60
+ - macOS: full workflow, clipboard uses `pbcopy`.
61
+ - Linux/Windows: clipboard step prints the key to the terminal instead.
62
+ - Requires `ssh-keygen`, `ssh-agent`, and `ssh-add` to be available in PATH.
63
+
64
+ ## Development
65
+
66
+ - Install dependencies: `npm install`
67
+ - Run locally (TypeScript): `npm run dev`
68
+ - Type check: `npm run typecheck`
69
+ - Build CLI: `npm run build`
70
+ - Run built CLI: `npm start`
71
+
72
+ ## Manual testing
73
+
74
+ - `npm run dev -- --help`
75
+ - `npm run dev -- --version`
76
+ - `npm run dev -- --email test@example.com --type ed25519`