@siamriaz/octomux 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.
- package/LICENSE +21 -0
- package/README.md +272 -0
- package/dist/bin/octomux.d.ts +1 -0
- package/dist/bin/octomux.js +22 -0
- package/dist/bin/octomux.js.map +1 -0
- package/dist/chunk-3NCQOE6V.js +1957 -0
- package/dist/chunk-3NCQOE6V.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Octomux Contributors
|
|
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,272 @@
|
|
|
1
|
+
# ๐ octomux (`omx`)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@siamriaz/octomux)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[]()
|
|
7
|
+
[](https://vitest.dev/)
|
|
8
|
+
|
|
9
|
+
> **Enterprise-grade, cross-platform GitHub multi-account multiplexer, SSH identity manager, and smart repository clone CLI.**
|
|
10
|
+
|
|
11
|
+
Seamlessly manage multiple GitHub accounts (Work, Personal, Client, Open Source) with zero SSH collisions and zero commit identity mistakes.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## โจ Features
|
|
16
|
+
|
|
17
|
+
- ๐ **Multi-Account & SSH Engine**: Add, edit, list, and switch between unlimited GitHub accounts with automated Ed25519/RSA SSH key generation.
|
|
18
|
+
- ๐ **Automatic SSH Key Discovery**: Automatically discovers existing keys in `~/.ssh/` and imports them with one click.
|
|
19
|
+
- ๐ก๏ธ **Zero-Data-Loss SSH Sync**: Safely syncs `~/.ssh/config` using isolated block delimiters (`# === OCTOMUX MANAGED HOSTS ===`) with automated backups (`.bak`).
|
|
20
|
+
- ๐ **Local & Global Identity Switcher**: Instantly toggle `user.name`, `user.email`, and `core.sshCommand` globally or per repository.
|
|
21
|
+
- ๐ **Remote Origin Helper**: `omx remote` or `omx origin` binds existing local repositories to dedicated SSH aliases with automated author and SSH key configuration.
|
|
22
|
+
- ๐ฆ **Smart Clone**: `omx clone owner/repo` automatically clones using the account's dedicated SSH Host alias and binds repository-local Git identities upon completion.
|
|
23
|
+
- ๐ป **Cross-Platform Compatibility**: Native support for **Windows** (PowerShell, CMD, Git Bash, OpenSSH), **macOS**, and **Linux** with POSIX path normalization and `chmod 0600` key permission handling.
|
|
24
|
+
- ๐จ **Dual-Mode Experience**: Modern interactive TUI wizard with `@clack/prompts` and non-interactive flags (`--json`, `--yes`, `--global`) for CI/CD scripting.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## ๐ Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Global installation via npm
|
|
32
|
+
npm install -g @siamriaz/octomux
|
|
33
|
+
|
|
34
|
+
# Or run directly via npx without installing
|
|
35
|
+
npx @siamriaz/octomux
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
*Both `octomux` and `omx` binary aliases are available upon installation.*
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## โก Quick Start
|
|
43
|
+
|
|
44
|
+
### 1. Interactive Menu
|
|
45
|
+
Simply run `omx` without arguments to open the interactive command center:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
omx
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
โ ๐ octomux (omx) โ GitHub Identity & SSH Manager
|
|
53
|
+
โ
|
|
54
|
+
โ What would you like to do?
|
|
55
|
+
โ โ ๐ List configured accounts
|
|
56
|
+
โ โ โ Add a new GitHub account
|
|
57
|
+
โ โ ๐ Auto-import existing SSH keys
|
|
58
|
+
โ โ ๐ Switch Git identity (global / local)
|
|
59
|
+
โ โ ๐ Add or set remote origin for this repo
|
|
60
|
+
โ โ ๐ฆ Smart clone a repository
|
|
61
|
+
โ โ ๐ Check active Git & SSH status
|
|
62
|
+
โ โ โก Test SSH connections
|
|
63
|
+
โ โ ๐๏ธ Uninstall & clean up octomux
|
|
64
|
+
โ โ ๐ช Exit
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## ๐ Command Reference
|
|
70
|
+
|
|
71
|
+
### Account Management (`omx account` / `omx acc`)
|
|
72
|
+
|
|
73
|
+
#### Add an Account (with Auto-Detected Keys)
|
|
74
|
+
```bash
|
|
75
|
+
# Interactive setup wizard (automatically scans ~/.ssh and shows detected keys)
|
|
76
|
+
omx account add
|
|
77
|
+
|
|
78
|
+
# Headless / scriptable setup
|
|
79
|
+
omx account add \
|
|
80
|
+
--alias work \
|
|
81
|
+
--username johndoe-corp \
|
|
82
|
+
--email john@company.com \
|
|
83
|
+
--git-name "John Doe" \
|
|
84
|
+
--keygen \
|
|
85
|
+
--global
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Auto-Import Existing SSH Keys
|
|
89
|
+
```bash
|
|
90
|
+
# Interactive key auto-discovery & import wizard:
|
|
91
|
+
omx account import
|
|
92
|
+
# or shorthand:
|
|
93
|
+
omx import
|
|
94
|
+
|
|
95
|
+
# Import a specific existing private key directly:
|
|
96
|
+
omx import ~/.ssh/id_rsa_work --alias work --username johndoe --email john@work.com
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### List Accounts
|
|
100
|
+
```bash
|
|
101
|
+
omx account list
|
|
102
|
+
# or shorthand:
|
|
103
|
+
omx ls
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Edit an Account
|
|
107
|
+
```bash
|
|
108
|
+
omx account edit work --email newemail@company.com
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Remove an Account
|
|
112
|
+
```bash
|
|
113
|
+
omx account remove work
|
|
114
|
+
# Delete associated SSH keys as well:
|
|
115
|
+
omx account remove work --delete-keys --yes
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Test SSH Connection
|
|
119
|
+
```bash
|
|
120
|
+
# Test specific profile
|
|
121
|
+
omx account test work
|
|
122
|
+
|
|
123
|
+
# Test all profiles
|
|
124
|
+
omx account test --all
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Identity Switcher (`omx switch` / `omx use`)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Interactive switcher (prompts for account and local/global scope)
|
|
133
|
+
omx switch
|
|
134
|
+
|
|
135
|
+
# Switch global Git configuration
|
|
136
|
+
omx switch work --global
|
|
137
|
+
|
|
138
|
+
# Switch local repository Git configuration & dedicated SSH key
|
|
139
|
+
omx switch work --local
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### Status Check (`omx status` / `omx current`)
|
|
145
|
+
|
|
146
|
+
Inspect active global and local Git identities and match them against configured `octomux` profiles:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
omx status
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### Remote Origin Configuration (`omx remote` / `omx origin`)
|
|
155
|
+
|
|
156
|
+
Attach or update a Git remote origin for an existing local repository and automatically bind the local author and SSH key:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Interactive wizard (prompts for repo URL/slug and account profile)
|
|
160
|
+
omx remote
|
|
161
|
+
|
|
162
|
+
# Set origin to a GitHub repository using a specific account profile:
|
|
163
|
+
omx remote owner/repo -a work
|
|
164
|
+
|
|
165
|
+
# Or with shorthand alias:
|
|
166
|
+
omx origin owner/repo -a personal
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### What `omx remote` does:
|
|
170
|
+
1. Translates the repo slug/URL into `git@github.com-<alias>:owner/repo.git`.
|
|
171
|
+
2. Adds or updates `origin` remote (`git remote add` or `git remote set-url`).
|
|
172
|
+
3. Automatically sets local repository `user.name`, `user.email`, and `core.sshCommand`.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### Smart Clone (`omx clone`)
|
|
177
|
+
|
|
178
|
+
Clone any repository and automatically bind the local repository author name, email, and SSH key identity:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Clone with interactive account picker
|
|
182
|
+
omx clone facebook/react
|
|
183
|
+
|
|
184
|
+
# Clone with explicit account identity
|
|
185
|
+
omx clone facebook/react -a work
|
|
186
|
+
|
|
187
|
+
# Clone into custom target directory
|
|
188
|
+
omx clone https://github.com/facebook/react.git my-react -a personal
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### What happens behind the scenes:
|
|
192
|
+
1. Translates the clone URL to `git@github.com-work:facebook/react.git`.
|
|
193
|
+
2. Runs `git clone`.
|
|
194
|
+
3. Navigates into the newly cloned repository directory and configures:
|
|
195
|
+
- `git config --local user.name "<gitUserName>"`
|
|
196
|
+
- `git config --local user.email "<email>"`
|
|
197
|
+
- `git config --local core.sshCommand "ssh -i <keyPath> -o IdentitiesOnly=yes"`
|
|
198
|
+
4. Guarantees every future `git commit` and `git push` in that repo will use the correct identity.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## ๐ ๏ธ Architecture & Data Safety
|
|
203
|
+
|
|
204
|
+
### SSH Configuration Isolation (`~/.ssh/config`)
|
|
205
|
+
`octomux` isolates its host definitions inside marked delimiters. Your existing custom SSH entries are never modified or deleted:
|
|
206
|
+
|
|
207
|
+
```sshconfig
|
|
208
|
+
# Existing user configurations are preserved
|
|
209
|
+
Host my-vps
|
|
210
|
+
HostName 192.168.1.100
|
|
211
|
+
User root
|
|
212
|
+
|
|
213
|
+
# === OCTOMUX MANAGED HOSTS: START ===
|
|
214
|
+
# This block is automatically managed by octomux (omx).
|
|
215
|
+
Host github.com-work
|
|
216
|
+
HostName github.com
|
|
217
|
+
User git
|
|
218
|
+
IdentityFile "C:/Users/User/.ssh/id_ed25519_octomux_work"
|
|
219
|
+
IdentitiesOnly yes
|
|
220
|
+
|
|
221
|
+
Host github.com-personal
|
|
222
|
+
HostName github.com
|
|
223
|
+
User git
|
|
224
|
+
IdentityFile "C:/Users/User/.ssh/id_ed25519_octomux_personal"
|
|
225
|
+
IdentitiesOnly yes
|
|
226
|
+
# === OCTOMUX MANAGED HOSTS: END ===
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## ๐งช Testing
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Run unit & integration tests
|
|
235
|
+
npm test
|
|
236
|
+
|
|
237
|
+
# Run type check
|
|
238
|
+
npm run typecheck
|
|
239
|
+
|
|
240
|
+
# Build bundle with tsup
|
|
241
|
+
npm run build
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## ๐งน Safe Uninstallation & Cleanup
|
|
247
|
+
|
|
248
|
+
To safely remove `octomux` configurations and clean up your system:
|
|
249
|
+
|
|
250
|
+
### 1. Using the Built-in Command:
|
|
251
|
+
```bash
|
|
252
|
+
# Clean ~/.ssh/config and ~/.octomux data (prompts for options)
|
|
253
|
+
omx uninstall
|
|
254
|
+
|
|
255
|
+
# Or completely purge everything including generated SSH keys without prompts:
|
|
256
|
+
omx uninstall --delete-keys --yes
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 2. Remove the NPM Binary:
|
|
260
|
+
```bash
|
|
261
|
+
# If installed globally via npm:
|
|
262
|
+
npm uninstall -g @siamriaz/octomux
|
|
263
|
+
|
|
264
|
+
# If linked locally during development:
|
|
265
|
+
npm unlink -g octomux
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## ๐ License
|
|
271
|
+
|
|
272
|
+
MIT ยฉ [Octomux Contributors](LICENSE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
logger,
|
|
4
|
+
run
|
|
5
|
+
} from "../chunk-3NCQOE6V.js";
|
|
6
|
+
|
|
7
|
+
// bin/octomux.ts
|
|
8
|
+
process.on("unhandledRejection", (reason) => {
|
|
9
|
+
const message = reason instanceof Error ? reason.message : String(reason);
|
|
10
|
+
logger.error(`An unexpected error occurred: ${message}`);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
});
|
|
13
|
+
process.on("uncaughtException", (error) => {
|
|
14
|
+
logger.error(`Fatal error: ${error.message}`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
});
|
|
17
|
+
run().catch((err) => {
|
|
18
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
19
|
+
logger.error(message);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=octomux.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../bin/octomux.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { run } from '../src/index.js';\nimport { logger } from '../src/ui/logger.js';\n\nprocess.on('unhandledRejection', (reason) => {\n const message = reason instanceof Error ? reason.message : String(reason);\n logger.error(`An unexpected error occurred: ${message}`);\n process.exit(1);\n});\n\nprocess.on('uncaughtException', (error) => {\n logger.error(`Fatal error: ${error.message}`);\n process.exit(1);\n});\n\nrun().catch((err: unknown) => {\n const message = err instanceof Error ? err.message : String(err);\n logger.error(message);\n process.exit(1);\n});\n"],"mappings":";;;;;;;AAKA,QAAQ,GAAG,sBAAsB,CAAC,WAAW;AAC3C,QAAM,UAAU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;AACxE,SAAO,MAAM,iCAAiC,OAAO,EAAE;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,QAAQ,GAAG,qBAAqB,CAAC,UAAU;AACzC,SAAO,MAAM,gBAAgB,MAAM,OAAO,EAAE;AAC5C,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,IAAI,EAAE,MAAM,CAAC,QAAiB;AAC5B,QAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,SAAO,MAAM,OAAO;AACpB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|