codexctl 0.1.4 → 0.4.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 +20 -0
- package/README.md +19 -22
- package/bin/cdx.exe +0 -0
- package/bin/codexctl +0 -0
- package/index.js +7 -0
- package/install.js +62 -36
- package/package.json +5 -13
- package/bin/cdx +0 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bhanu Korthiwada
|
|
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 LIABILITY,
|
|
19
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
20
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CodexCTL
|
|
2
2
|
|
|
3
|
-
Codex CLI Profile Manager - Manage multiple
|
|
3
|
+
Codex CLI Profile Manager - Manage multiple AI CLI accounts (Codex, Claude, Gemini, OpenAI)
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -13,39 +13,36 @@ Or use npx (no install):
|
|
|
13
13
|
npx codexctl --help
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Quick Start
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
# Save your current
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
# Save your current CLI profile
|
|
20
|
+
codexctl save work
|
|
21
|
+
codexctl save personal
|
|
22
22
|
|
|
23
23
|
# Switch between profiles
|
|
24
|
-
|
|
25
|
-
cdx load personal
|
|
24
|
+
codexctl load work
|
|
26
25
|
|
|
27
26
|
# List all profiles
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# Quick-switch to previous profile
|
|
31
|
-
cdx load -
|
|
32
|
-
|
|
33
|
-
# Auto-switch to best profile based on quota
|
|
34
|
-
cdx load auto
|
|
27
|
+
codexctl list
|
|
35
28
|
```
|
|
36
29
|
|
|
37
30
|
## Features
|
|
38
31
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
32
|
+
- Optional encryption for sensitive auth data
|
|
33
|
+
- Fast profile switching
|
|
34
|
+
- Multiple AI CLI support (Codex, Claude, Gemini, OpenAI)
|
|
35
|
+
- Export to use profiles concurrently in different terminals
|
|
36
|
+
|
|
37
|
+
## Binary Package
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
This npm package downloads pre-built binaries from GitHub Releases on install.
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
Supported platforms:
|
|
42
|
+
- Linux (x86_64, arm64)
|
|
43
|
+
- macOS (x86_64, arm64)
|
|
44
|
+
- Windows (x86_64)
|
|
48
45
|
|
|
49
46
|
## License
|
|
50
47
|
|
|
51
|
-
MIT
|
|
48
|
+
MIT
|
package/bin/cdx.exe
ADDED
|
Binary file
|
package/bin/codexctl
CHANGED
|
Binary file
|
package/index.js
ADDED
package/install.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* CodexCTL Installation Script
|
|
4
|
-
* Downloads the appropriate binary for the current platform
|
|
4
|
+
* Downloads the appropriate binary for the current platform from GitHub Releases
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const https = require('https');
|
|
8
|
+
const http = require('http');
|
|
8
9
|
const fs = require('fs');
|
|
9
10
|
const path = require('path');
|
|
10
11
|
const os = require('os');
|
|
11
|
-
const { execSync } = require('child_process');
|
|
12
|
+
const { execSync, spawn } = require('child_process');
|
|
12
13
|
|
|
13
14
|
const VERSION = require('./package.json').version;
|
|
14
|
-
const BINARY_NAME = 'codexctl';
|
|
15
15
|
|
|
16
|
-
// Platform mappings
|
|
17
16
|
const platforms = {
|
|
18
17
|
'darwin-x64': 'x86_64-apple-darwin',
|
|
19
18
|
'darwin-arm64': 'aarch64-apple-darwin',
|
|
@@ -43,31 +42,43 @@ function getDownloadUrl(target) {
|
|
|
43
42
|
|
|
44
43
|
function downloadFile(url, dest) {
|
|
45
44
|
return new Promise((resolve, reject) => {
|
|
46
|
-
const
|
|
47
|
-
|
|
45
|
+
const protocol = url.startsWith('https') ? https : http;
|
|
46
|
+
|
|
47
|
+
const request = protocol.get(url, { headers: { 'User-Agent': 'codexctl-install' } }, (response) => {
|
|
48
48
|
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const redirectUrl = response.headers.location;
|
|
50
|
+
if (redirectUrl) {
|
|
51
|
+
downloadFile(redirectUrl, dest).then(resolve).catch(reject);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
if (response.statusCode !== 200) {
|
|
55
|
-
reject(new Error(`Download failed with status ${response.statusCode}`));
|
|
57
|
+
reject(new Error(`Download failed with status ${response.statusCode}: ${url}`));
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
const file = fs.createWriteStream(dest);
|
|
59
62
|
response.pipe(file);
|
|
60
63
|
file.on('finish', () => {
|
|
61
64
|
file.close();
|
|
62
65
|
resolve();
|
|
63
66
|
});
|
|
64
|
-
})
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
request.on('error', reject);
|
|
65
70
|
});
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
function extractArchive(archivePath, destDir) {
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
const ext = path.extname(archivePath);
|
|
75
|
+
|
|
76
|
+
if (ext === '.zip') {
|
|
77
|
+
if (os.platform() === 'win32') {
|
|
78
|
+
execSync(`powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${destDir}' -Force"`, { stdio: 'inherit' });
|
|
79
|
+
} else {
|
|
80
|
+
execSync(`unzip -o "${archivePath}" -d "${destDir}"`, { stdio: 'inherit' });
|
|
81
|
+
}
|
|
71
82
|
} else {
|
|
72
83
|
execSync(`tar -xzf "${archivePath}" -C "${destDir}"`, { stdio: 'inherit' });
|
|
73
84
|
}
|
|
@@ -76,48 +87,63 @@ function extractArchive(archivePath, destDir) {
|
|
|
76
87
|
async function install() {
|
|
77
88
|
const binDir = path.join(__dirname, 'bin');
|
|
78
89
|
|
|
79
|
-
// Skip if binaries already exist
|
|
80
|
-
if (fs.existsSync(path.join(binDir,
|
|
90
|
+
// Skip if binaries already exist
|
|
91
|
+
if (fs.existsSync(path.join(binDir, 'codexctl'))) {
|
|
81
92
|
console.log('CodexCTL binaries already exist, skipping download');
|
|
82
93
|
return;
|
|
83
94
|
}
|
|
84
95
|
|
|
85
|
-
// Ensure bin directory exists
|
|
86
96
|
if (!fs.existsSync(binDir)) {
|
|
87
97
|
fs.mkdirSync(binDir, { recursive: true });
|
|
88
98
|
}
|
|
89
|
-
|
|
99
|
+
|
|
90
100
|
const target = getPlatform();
|
|
91
|
-
const url = getDownloadUrl(target);
|
|
92
101
|
const ext = target.includes('windows') ? 'zip' : 'tar.gz';
|
|
93
102
|
const archivePath = path.join(binDir, `codexctl-${target}.${ext}`);
|
|
94
103
|
|
|
95
104
|
console.log(`Downloading CodexCTL v${VERSION} for ${target}...`);
|
|
105
|
+
|
|
106
|
+
const url = getDownloadUrl(target);
|
|
96
107
|
console.log(`URL: ${url}`);
|
|
97
108
|
|
|
98
109
|
try {
|
|
110
|
+
// First try direct download
|
|
99
111
|
await downloadFile(url, archivePath);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
} catch (err) {
|
|
113
|
+
// If direct fails, try latest tag
|
|
114
|
+
const latestUrl = getDownloadUrl(target).replace(`/v${VERSION}`, '/latest');
|
|
115
|
+
console.log(`Retrying with latest...`);
|
|
116
|
+
await downloadFile(latestUrl, archivePath);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
console.log('Extracting...');
|
|
120
|
+
extractArchive(archivePath, binDir);
|
|
121
|
+
|
|
122
|
+
// Clean up archive
|
|
123
|
+
fs.unlinkSync(archivePath);
|
|
124
|
+
|
|
125
|
+
// Make executable
|
|
126
|
+
if (os.platform() !== 'win32') {
|
|
127
|
+
try {
|
|
128
|
+
fs.chmodSync(path.join(binDir, 'codexctl'), 0o755);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
// Try cdx if codexctl name differs
|
|
131
|
+
const cdxPath = path.join(binDir, 'cdx');
|
|
132
|
+
if (fs.existsSync(cdxPath)) {
|
|
133
|
+
fs.chmodSync(cdxPath, 0o755);
|
|
134
|
+
}
|
|
109
135
|
}
|
|
110
|
-
|
|
111
|
-
console.log('CodexCTL installed successfully!');
|
|
112
|
-
console.log('Run: cdx --help');
|
|
113
|
-
} catch (error) {
|
|
114
|
-
console.error('Installation failed:', error.message);
|
|
115
|
-
console.error('You can manually download from: https://github.com/repohelper/codexctl/releases');
|
|
116
|
-
process.exit(1);
|
|
117
136
|
}
|
|
137
|
+
|
|
138
|
+
console.log('CodexCTL installed successfully!');
|
|
139
|
+
console.log('Run: codexctl --help');
|
|
118
140
|
}
|
|
119
141
|
|
|
120
142
|
install().catch(err => {
|
|
121
|
-
console.error('
|
|
143
|
+
console.error('Installation failed:', err.message);
|
|
144
|
+
console.error('');
|
|
145
|
+
console.error('To install manually:');
|
|
146
|
+
console.error(`1. Download from: https://github.com/repohelper/codexctl/releases`);
|
|
147
|
+
console.error(`2. Extract and add to your PATH`);
|
|
122
148
|
process.exit(1);
|
|
123
|
-
});
|
|
149
|
+
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexctl",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Codex CLI Profile Manager - Manage multiple
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Codex CLI Profile Manager - Manage multiple AI CLI accounts",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"codexctl": "./bin/codexctl",
|
|
8
8
|
"cdx": "./bin/cdx"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"postinstall": "node install.js",
|
|
12
11
|
"test": "echo 'Binary package - no tests'"
|
|
13
12
|
},
|
|
14
13
|
"repository": {
|
|
@@ -18,20 +17,19 @@
|
|
|
18
17
|
"keywords": [
|
|
19
18
|
"ai",
|
|
20
19
|
"cli",
|
|
21
|
-
"profile",
|
|
22
|
-
"manager",
|
|
23
20
|
"codex",
|
|
24
21
|
"claude",
|
|
25
22
|
"gemini",
|
|
26
23
|
"openai",
|
|
27
|
-
"
|
|
24
|
+
"profile",
|
|
25
|
+
"manager"
|
|
28
26
|
],
|
|
29
27
|
"author": "Bhanu Korthiwada",
|
|
30
28
|
"license": "MIT",
|
|
31
29
|
"bugs": {
|
|
32
30
|
"url": "https://github.com/repohelper/codexctl/issues"
|
|
33
31
|
},
|
|
34
|
-
"homepage": "https://
|
|
32
|
+
"homepage": "https://github.com/repohelper/codexctl",
|
|
35
33
|
"engines": {
|
|
36
34
|
"node": ">=16"
|
|
37
35
|
},
|
|
@@ -40,11 +38,5 @@
|
|
|
40
38
|
"install.js",
|
|
41
39
|
"README.md",
|
|
42
40
|
"LICENSE"
|
|
43
|
-
],
|
|
44
|
-
"trusted-publishers": [
|
|
45
|
-
{
|
|
46
|
-
"type": "GitHub Actions",
|
|
47
|
-
"workflow": "release.yml"
|
|
48
|
-
}
|
|
49
41
|
]
|
|
50
42
|
}
|
package/bin/cdx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { spawn } = require('child_process');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
const binaryPath = path.join(__dirname, '..', 'bin', 'cdx');
|
|
6
|
-
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
7
|
-
stdio: 'inherit',
|
|
8
|
-
windowsHide: true
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
child.on('exit', (code) => {
|
|
12
|
-
process.exit(code);
|
|
13
|
-
});
|