codex-multi-auth 0.1.0 → 0.1.2
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 +1 -1
- package/README.md +223 -98
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +30 -87
- package/config/{opencode-legacy.json → codex-legacy.json} +571 -571
- package/config/{opencode-modern.json → codex-modern.json} +241 -239
- package/config/{minimal-opencode.json → minimal-codex.json} +15 -13
- package/config/schema/config.schema.json +21 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/accounts.d.ts +1 -1
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/auth/auth.d.ts +1 -1
- package/dist/lib/auth/auth.js +1 -1
- package/dist/lib/cli.d.ts +1 -1
- package/dist/lib/cli.js +4 -4
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/codex-manager/settings-hub.d.ts +6 -0
- package/dist/lib/codex-manager/settings-hub.d.ts.map +1 -0
- package/dist/lib/codex-manager/settings-hub.js +1786 -0
- package/dist/lib/codex-manager/settings-hub.js.map +1 -0
- package/dist/lib/codex-manager.d.ts.map +1 -1
- package/dist/lib/codex-manager.js +5 -1637
- package/dist/lib/codex-manager.js.map +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +20 -11
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/context-overflow.d.ts +1 -1
- package/dist/lib/context-overflow.js +11 -11
- package/dist/lib/oauth-success.html +1 -1
- package/dist/lib/prompts/codex-host-bridge.d.ts +19 -0
- package/dist/lib/prompts/codex-host-bridge.d.ts.map +1 -0
- package/dist/lib/prompts/{codex-opencode-bridge.js → codex-host-bridge.js} +143 -143
- package/dist/lib/prompts/codex-host-bridge.js.map +1 -0
- package/dist/lib/prompts/codex.d.ts +2 -2
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +3 -3
- package/dist/lib/prompts/host-codex-prompt.d.ts +25 -0
- package/dist/lib/prompts/host-codex-prompt.d.ts.map +1 -0
- package/dist/lib/prompts/{opencode-codex.js → host-codex-prompt.js} +136 -47
- package/dist/lib/prompts/host-codex-prompt.js.map +1 -0
- package/dist/lib/recovery/storage.d.ts +2 -2
- package/dist/lib/recovery/storage.js +2 -2
- package/dist/lib/recovery/types.d.ts +1 -1
- package/dist/lib/recovery/types.js +1 -1
- package/dist/lib/recovery.d.ts +1 -1
- package/dist/lib/recovery.d.ts.map +1 -1
- package/dist/lib/recovery.js +1 -4
- package/dist/lib/recovery.js.map +1 -1
- package/dist/lib/request/fetch-helpers.d.ts +3 -3
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +6 -2
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/request/helpers/input-utils.d.ts +2 -2
- package/dist/lib/request/helpers/input-utils.d.ts.map +1 -1
- package/dist/lib/request/helpers/input-utils.js +14 -14
- package/dist/lib/request/helpers/input-utils.js.map +1 -1
- package/dist/lib/request/helpers/model-map.d.ts +2 -2
- package/dist/lib/request/helpers/model-map.js +2 -2
- package/dist/lib/request/request-transformer.d.ts +12 -12
- package/dist/lib/request/request-transformer.d.ts.map +1 -1
- package/dist/lib/request/request-transformer.js +23 -24
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/dist/lib/runtime-paths.d.ts +4 -4
- package/dist/lib/runtime-paths.d.ts.map +1 -1
- package/dist/lib/runtime-paths.js +57 -13
- package/dist/lib/runtime-paths.js.map +1 -1
- package/dist/lib/storage/paths.d.ts +11 -0
- package/dist/lib/storage/paths.d.ts.map +1 -1
- package/dist/lib/storage/paths.js +167 -5
- package/dist/lib/storage/paths.js.map +1 -1
- package/dist/lib/storage.d.ts +1 -0
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +290 -81
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/tools/hashline-tools.d.ts +1 -1
- package/dist/lib/tools/hashline-tools.d.ts.map +1 -1
- package/dist/lib/tools/hashline-tools.js +1 -1
- package/dist/lib/tools/hashline-tools.js.map +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/ui/copy.d.ts +6 -6
- package/dist/lib/ui/copy.js +6 -6
- package/dist/lib/ui/copy.js.map +1 -1
- package/node_modules/@codex-ai/plugin/dist/index.d.ts +2 -0
- package/node_modules/@codex-ai/plugin/dist/index.js +2 -0
- package/node_modules/@codex-ai/plugin/dist/tool.d.ts +42 -0
- package/node_modules/@codex-ai/plugin/dist/tool.js +29 -0
- package/node_modules/@codex-ai/plugin/package.json +9 -0
- package/package.json +30 -16
- package/scripts/audit-dev-allowlist.js +128 -128
- package/scripts/bench-format/{opencode.mjs → codex-host.mjs} +206 -205
- package/scripts/bench-format/hashline-v2.mjs +642 -642
- package/scripts/bench-format/models.mjs +111 -105
- package/scripts/bench-format/render.mjs +496 -496
- package/scripts/bench-format/stats.mjs +54 -54
- package/scripts/bench-format/tasks.mjs +151 -151
- package/scripts/benchmark-edit-formats.mjs +1162 -1161
- package/scripts/benchmark-render-dashboard.mjs +49 -49
- package/scripts/codex.js +40 -2
- package/scripts/copy-oauth-success.js +37 -37
- package/scripts/install-codex-auth-utils.js +49 -0
- package/scripts/{install-opencode-codex-auth.js → install-codex-auth.js} +220 -193
- package/scripts/repo-hygiene.js +320 -0
- package/scripts/test-all-models.sh +7 -7
- package/scripts/test-model-matrix.js +475 -423
- package/scripts/validate-model-map.sh +7 -7
- package/vendor/codex-ai-plugin/dist/index.d.ts +2 -0
- package/vendor/codex-ai-plugin/dist/index.js +2 -0
- package/vendor/codex-ai-plugin/dist/tool.d.ts +42 -0
- package/vendor/codex-ai-plugin/dist/tool.js +29 -0
- package/vendor/codex-ai-plugin/package.json +9 -0
- package/vendor/codex-ai-sdk/dist/index.d.ts +4 -0
- package/vendor/codex-ai-sdk/dist/index.js +2 -0
- package/vendor/codex-ai-sdk/package.json +8 -0
- package/assets/opencode-logo-ornate-dark.svg +0 -18
- package/dist/lib/prompts/codex-opencode-bridge.d.ts +0 -19
- package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +0 -1
- package/dist/lib/prompts/codex-opencode-bridge.js.map +0 -1
- package/dist/lib/prompts/opencode-codex.d.ts +0 -25
- package/dist/lib/prompts/opencode-codex.d.ts.map +0 -1
- package/dist/lib/prompts/opencode-codex.js.map +0 -1
|
@@ -1,193 +1,220 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { existsSync } from "node:fs";
|
|
4
|
-
import { readFile, writeFile, mkdir, copyFile, rm } from "node:fs/promises";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { dirname, join, resolve } from "node:path";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const PLUGIN_NAME = "codex-multi-auth";
|
|
10
|
-
|
|
11
|
-
const args = new Set(process.argv.slice(2));
|
|
12
|
-
|
|
13
|
-
if (args.has("--help") || args.has("-h")) {
|
|
14
|
-
console.log(`Usage: ${PLUGIN_NAME} [--modern|--legacy] [--dry-run] [--no-cache-clear]\n\n` +
|
|
15
|
-
"Default behavior:\n" +
|
|
16
|
-
" - Installs/updates global config at ~/.config/
|
|
17
|
-
" - Uses modern config (variants) by default\n" +
|
|
18
|
-
" - Ensures plugin is unpinned (latest)\n" +
|
|
19
|
-
" - Clears
|
|
20
|
-
"Options:\n" +
|
|
21
|
-
" --modern Force modern config (default)\n" +
|
|
22
|
-
" --legacy Use legacy config (older
|
|
23
|
-
" --dry-run Show actions without writing\n" +
|
|
24
|
-
" --no-cache-clear Skip clearing
|
|
25
|
-
);
|
|
26
|
-
process.exit(0);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const useLegacy = args.has("--legacy");
|
|
30
|
-
const useModern = args.has("--modern") || !useLegacy;
|
|
31
|
-
const dryRun = args.has("--dry-run");
|
|
32
|
-
const skipCacheClear = args.has("--no-cache-clear");
|
|
33
|
-
|
|
34
|
-
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
35
|
-
const repoRoot = resolve(scriptDir, "..");
|
|
36
|
-
const templatePath = join(
|
|
37
|
-
repoRoot,
|
|
38
|
-
"config",
|
|
39
|
-
useLegacy ? "
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const configPath
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.
|
|
76
|
-
.replace(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
log("
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { readFile, writeFile, mkdir, copyFile, rm, rename } from "node:fs/promises";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { dirname, join, resolve } from "node:path";
|
|
7
|
+
import { normalizePluginList, resolveInstallPaths } from "./install-codex-auth-utils.js";
|
|
8
|
+
|
|
9
|
+
const PLUGIN_NAME = "codex-multi-auth";
|
|
10
|
+
|
|
11
|
+
const args = new Set(process.argv.slice(2));
|
|
12
|
+
|
|
13
|
+
if (args.has("--help") || args.has("-h")) {
|
|
14
|
+
console.log(`Usage: ${PLUGIN_NAME} [--modern|--legacy] [--dry-run] [--no-cache-clear]\n\n` +
|
|
15
|
+
"Default behavior:\n" +
|
|
16
|
+
" - Installs/updates global config at ~/.config/Codex/Codex.json\n" +
|
|
17
|
+
" - Uses modern config (variants) by default\n" +
|
|
18
|
+
" - Ensures plugin is unpinned (latest)\n" +
|
|
19
|
+
" - Clears Codex plugin cache\n\n" +
|
|
20
|
+
"Options:\n" +
|
|
21
|
+
" --modern Force modern config (default)\n" +
|
|
22
|
+
" --legacy Use legacy config (older Codex versions)\n" +
|
|
23
|
+
" --dry-run Show actions without writing\n" +
|
|
24
|
+
" --no-cache-clear Skip clearing Codex cache\n"
|
|
25
|
+
);
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const useLegacy = args.has("--legacy");
|
|
30
|
+
const useModern = args.has("--modern") || !useLegacy;
|
|
31
|
+
const dryRun = args.has("--dry-run");
|
|
32
|
+
const skipCacheClear = args.has("--no-cache-clear");
|
|
33
|
+
|
|
34
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
35
|
+
const repoRoot = resolve(scriptDir, "..");
|
|
36
|
+
const templatePath = join(
|
|
37
|
+
repoRoot,
|
|
38
|
+
"config",
|
|
39
|
+
useLegacy ? "codex-legacy.json" : "codex-modern.json"
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const installPaths = resolveInstallPaths();
|
|
43
|
+
const { configDir, configPath, cacheNodeModules, cacheBunLock, cachePackageJson } = installPaths;
|
|
44
|
+
|
|
45
|
+
function log(message) {
|
|
46
|
+
console.log(message);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function formatJson(obj) {
|
|
50
|
+
return `${JSON.stringify(obj, null, 2)}\n`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function readJson(filePath) {
|
|
54
|
+
const content = await readFile(filePath, "utf-8");
|
|
55
|
+
return JSON.parse(content);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function writeJsonAtomic(filePath, value) {
|
|
59
|
+
const tempPath = `${filePath}.tmp-${process.pid}-${Date.now()}-${Math.random()
|
|
60
|
+
.toString(36)
|
|
61
|
+
.slice(2, 8)}`;
|
|
62
|
+
const content = formatJson(value);
|
|
63
|
+
try {
|
|
64
|
+
await writeFile(tempPath, content, "utf-8");
|
|
65
|
+
await rename(tempPath, filePath);
|
|
66
|
+
} finally {
|
|
67
|
+
if (existsSync(tempPath)) {
|
|
68
|
+
await rm(tempPath, { force: true });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function backupConfig(sourcePath) {
|
|
74
|
+
const timestamp = new Date()
|
|
75
|
+
.toISOString()
|
|
76
|
+
.replace(/[:.]/g, "-")
|
|
77
|
+
.replace("T", "_")
|
|
78
|
+
.replace("Z", "");
|
|
79
|
+
const nonce = `${process.pid}-${Math.random().toString(36).slice(2, 8)}`;
|
|
80
|
+
const backupPath = `${sourcePath}.bak-${timestamp}-${nonce}`;
|
|
81
|
+
if (!dryRun) {
|
|
82
|
+
await copyFile(sourcePath, backupPath);
|
|
83
|
+
}
|
|
84
|
+
return backupPath;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function removePluginFromCachePackage() {
|
|
88
|
+
if (!existsSync(cachePackageJson)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let cacheData;
|
|
93
|
+
try {
|
|
94
|
+
cacheData = await readJson(cachePackageJson);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
log(`Warning: Could not parse ${cachePackageJson} (${error}). Skipping.`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const sections = [
|
|
101
|
+
"dependencies",
|
|
102
|
+
"devDependencies",
|
|
103
|
+
"peerDependencies",
|
|
104
|
+
"optionalDependencies",
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
let changed = false;
|
|
108
|
+
for (const section of sections) {
|
|
109
|
+
const deps = cacheData?.[section];
|
|
110
|
+
if (deps && typeof deps === "object" && PLUGIN_NAME in deps) {
|
|
111
|
+
delete deps[PLUGIN_NAME];
|
|
112
|
+
changed = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!changed) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (dryRun) {
|
|
121
|
+
log(`[dry-run] Would update ${cachePackageJson} to remove ${PLUGIN_NAME}`);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
await writeJsonAtomic(cachePackageJson, cacheData);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function clearCache() {
|
|
129
|
+
if (skipCacheClear) {
|
|
130
|
+
log("Skipping cache clear (--no-cache-clear).");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (dryRun) {
|
|
135
|
+
log(`[dry-run] Would remove ${cacheNodeModules}`);
|
|
136
|
+
log(`[dry-run] Would remove ${cacheBunLock}`);
|
|
137
|
+
} else {
|
|
138
|
+
try {
|
|
139
|
+
await rm(cacheNodeModules, { recursive: true, force: true });
|
|
140
|
+
await rm(cacheBunLock, { force: true });
|
|
141
|
+
} catch (error) {
|
|
142
|
+
log(
|
|
143
|
+
`Warning: Could not fully clear cache (${error instanceof Error ? error.message : String(error)}). You may need to restart Codex.`,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
await removePluginFromCachePackage();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function main() {
|
|
152
|
+
if (!existsSync(templatePath)) {
|
|
153
|
+
throw new Error(`Config template not found at ${templatePath}`);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const template = await readJson(templatePath);
|
|
157
|
+
template.plugin = [PLUGIN_NAME];
|
|
158
|
+
|
|
159
|
+
let nextConfig = template;
|
|
160
|
+
if (existsSync(configPath)) {
|
|
161
|
+
const backupPath = await backupConfig(configPath);
|
|
162
|
+
log(`${dryRun ? "[dry-run] Would create backup" : "Backup created"}: ${backupPath}`);
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const existing = await readJson(configPath);
|
|
166
|
+
const merged = { ...existing };
|
|
167
|
+
merged.plugin = normalizePluginList(existing.plugin);
|
|
168
|
+
const provider = (existing.provider && typeof existing.provider === "object")
|
|
169
|
+
? { ...existing.provider }
|
|
170
|
+
: {};
|
|
171
|
+
const existingOpenAi = provider.openai && typeof provider.openai === "object"
|
|
172
|
+
? provider.openai
|
|
173
|
+
: {};
|
|
174
|
+
const templateOpenAi = template.provider && typeof template.provider === "object" &&
|
|
175
|
+
template.provider.openai && typeof template.provider.openai === "object"
|
|
176
|
+
? template.provider.openai
|
|
177
|
+
: {};
|
|
178
|
+
provider.openai = { ...templateOpenAi, ...existingOpenAi };
|
|
179
|
+
merged.provider = provider;
|
|
180
|
+
nextConfig = merged;
|
|
181
|
+
} catch (error) {
|
|
182
|
+
log(`Warning: Could not parse existing config (${error}). Replacing with template.`);
|
|
183
|
+
nextConfig = template;
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
log("No existing config found. Creating new global config.");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (dryRun) {
|
|
190
|
+
log(`[dry-run] Would write ${configPath} using ${useLegacy ? "legacy" : "modern"} config`);
|
|
191
|
+
} else {
|
|
192
|
+
await mkdir(configDir, { recursive: true });
|
|
193
|
+
await writeJsonAtomic(configPath, nextConfig);
|
|
194
|
+
log(`Wrote ${configPath} (${useLegacy ? "legacy" : "modern"} config)`);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
await clearCache();
|
|
198
|
+
|
|
199
|
+
log("\nDone. Restart Codex to (re)install the plugin.");
|
|
200
|
+
log("Example: Codex");
|
|
201
|
+
if (useLegacy) {
|
|
202
|
+
log("Note: Legacy config requires Codex v1.0.209 or older.");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const isDirectRun = (() => {
|
|
207
|
+
try {
|
|
208
|
+
return resolve(process.argv[1] ?? "") === fileURLToPath(import.meta.url);
|
|
209
|
+
} catch {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
})();
|
|
213
|
+
|
|
214
|
+
if (isDirectRun) {
|
|
215
|
+
main().catch((error) => {
|
|
216
|
+
console.error(`Installer failed: ${error instanceof Error ? error.message : error}`);
|
|
217
|
+
process.exit(1);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|