gitshift 1.0.4 → 1.0.6
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 +15 -0
- package/README.md +70 -0
- package/package.json +9 -3
- package/src/server.js +22 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Akash Lakade
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# GitShift CLI
|
|
2
|
+
|
|
3
|
+
GitShift CLI helps you create, manage, and switch between GitHub identity profiles from the terminal. It stores profiles locally, updates your global Git config, and can generate SSH keys for each profile when needed.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g gitshift
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run it locally from the project:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install
|
|
15
|
+
npm start -- --help
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
GitShift expects the following tools to be available on your machine:
|
|
21
|
+
|
|
22
|
+
- `git`
|
|
23
|
+
- `ssh`
|
|
24
|
+
- `ssh-keygen` for automatic SSH key generation
|
|
25
|
+
- `gh` is recommended and checked by `gitshift doctor`
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
gitshift --help
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Commands
|
|
34
|
+
|
|
35
|
+
- `gitshift add` - Create a new local profile. Prompts for profile name, GitHub username, email, and whether to generate an SSH key.
|
|
36
|
+
- `gitshift list` - Show all saved profiles.
|
|
37
|
+
- `gitshift current` - Display the active profile.
|
|
38
|
+
- `gitshift use <profile>` - Switch to a saved profile and update global Git user name and email.
|
|
39
|
+
- `gitshift remove <profile>` - Delete a saved profile.
|
|
40
|
+
- `gitshift doctor` - Check whether Git, SSH, and GitHub CLI are installed.
|
|
41
|
+
|
|
42
|
+
## Example Workflow
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
gitshift add
|
|
46
|
+
gitshift list
|
|
47
|
+
gitshift use personal
|
|
48
|
+
gitshift current
|
|
49
|
+
gitshift doctor
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
When you create a profile and choose SSH generation, GitShift creates a key under your home directory in `.ssh` using the pattern `gitshift-<profile-name>`.
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
Profiles are saved locally on your machine using the app's configuration store. Switching profiles updates your global Git identity with:
|
|
57
|
+
|
|
58
|
+
- `user.name`
|
|
59
|
+
- `user.email`
|
|
60
|
+
|
|
61
|
+
## Notes
|
|
62
|
+
|
|
63
|
+
- Profile names must be unique.
|
|
64
|
+
- `gitshift use <profile>` only switches to profiles that already exist locally.
|
|
65
|
+
- If SSH key generation fails, make sure OpenSSH is installed and available in your shell.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
ISC
|
|
70
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitshift",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "GitHub Account Switcher CLI",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"bin": {
|
|
@@ -11,8 +11,14 @@
|
|
|
11
11
|
"start": "node src/server.js",
|
|
12
12
|
"doctor": "node src/server.js doctor"
|
|
13
13
|
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
|
|
14
|
+
"keywords": [
|
|
15
|
+
"git",
|
|
16
|
+
"github",
|
|
17
|
+
"cli",
|
|
18
|
+
"ssh",
|
|
19
|
+
"account-switcher"
|
|
20
|
+
],
|
|
21
|
+
"author": "Akash Lakade",
|
|
16
22
|
"license": "ISC",
|
|
17
23
|
"type": "module",
|
|
18
24
|
"dependencies": {
|
package/src/server.js
CHANGED
|
@@ -64,6 +64,7 @@ async function checkForUpdates() {
|
|
|
64
64
|
}
|
|
65
65
|
} catch (error) {
|
|
66
66
|
// Ignore version check failures so the CLI still starts offline.
|
|
67
|
+
// intentionally ignore errors (network may be offline)
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -122,10 +123,28 @@ async function main() {
|
|
|
122
123
|
)
|
|
123
124
|
.action(doctorCommand);
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
program.exitOverride();
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
await program.parseAsync(process.argv);
|
|
130
|
+
process.exitCode = 0;
|
|
131
|
+
} catch (err) {
|
|
132
|
+
if (err && (err.name === "CommanderError" || err.code === "outputHelp")) {
|
|
133
|
+
process.exitCode = 0;
|
|
134
|
+
} else {
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
126
138
|
}
|
|
127
139
|
|
|
128
140
|
main().catch((error) => {
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
if (error) {
|
|
142
|
+
if (error.stack) {
|
|
143
|
+
console.error(error.stack);
|
|
144
|
+
} else {
|
|
145
|
+
console.error(error);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
131
150
|
});
|