opencode-openai-codex-multi-auth 4.4.6 → 4.4.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-openai-codex-multi-auth",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.8",
|
|
4
4
|
"description": "OpenAI ChatGPT (Codex backend) OAuth auth plugin for opencode - use your ChatGPT Plus/Pro subscription instead of API credits",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -10,16 +10,18 @@ import { parse, modify, applyEdits, printParseErrorCode } from "jsonc-parser";
|
|
|
10
10
|
// This repository is a fork. Install the plugin from GitHub to ensure
|
|
11
11
|
// OpenCode uses this fork instead of the upstream npm package.
|
|
12
12
|
// The npm package name for this fork.
|
|
13
|
-
const
|
|
13
|
+
const PLUGIN_PACKAGE = "opencode-openai-codex-multi-auth";
|
|
14
|
+
// Keep the OpenCode plugin entry unpinned so it stays up to date.
|
|
15
|
+
const PLUGIN_ENTRY_LATEST = `${PLUGIN_PACKAGE}@latest`;
|
|
14
16
|
// Keep track of older identifiers so we can migrate cleanly.
|
|
15
17
|
const UPSTREAM_PACKAGE = "opencode-openai-codex-auth";
|
|
16
18
|
const LEGACY_GITHUB_SPEC = "github:iam-brain/opencode-openai-codex-multi-auth";
|
|
17
|
-
const PLUGIN_ALIASES = [
|
|
19
|
+
const PLUGIN_ALIASES = [PLUGIN_PACKAGE, UPSTREAM_PACKAGE, LEGACY_GITHUB_SPEC];
|
|
18
20
|
const args = new Set(process.argv.slice(2));
|
|
19
21
|
|
|
20
22
|
if (args.has("--help") || args.has("-h")) {
|
|
21
23
|
console.log(
|
|
22
|
-
`Usage: ${
|
|
24
|
+
`Usage: ${PLUGIN_PACKAGE} [--modern|--legacy] [--uninstall] [--all] [--dry-run] [--no-cache-clear]\n\n` +
|
|
23
25
|
"Default behavior:\n" +
|
|
24
26
|
" - Installs/updates global config at ~/.config/opencode/opencode.jsonc (falls back to .json)\n" +
|
|
25
27
|
" - Uses modern config (variants) by default\n" +
|
|
@@ -55,7 +57,7 @@ const configDir = join(homedir(), ".config", "opencode");
|
|
|
55
57
|
const configPathJson = join(configDir, "opencode.json");
|
|
56
58
|
const configPathJsonc = join(configDir, "opencode.jsonc");
|
|
57
59
|
const cacheDir = join(homedir(), ".cache", "opencode");
|
|
58
|
-
const cacheNodeModules = join(cacheDir, "node_modules",
|
|
60
|
+
const cacheNodeModules = join(cacheDir, "node_modules", PLUGIN_PACKAGE);
|
|
59
61
|
const cacheNodeModulesUpstream = join(cacheDir, "node_modules", UPSTREAM_PACKAGE);
|
|
60
62
|
const cacheNodeModulesLegacyGitHub = join(cacheDir, "node_modules", LEGACY_GITHUB_SPEC);
|
|
61
63
|
const cacheBunLock = join(cacheDir, "bun.lock");
|
|
@@ -72,8 +74,19 @@ function log(message) {
|
|
|
72
74
|
console.log(message);
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
function isPluginPackageSpec(entry) {
|
|
78
|
+
return typeof entry === "string" && entry.startsWith(`${PLUGIN_PACKAGE}@`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function resolveDesiredPluginEntry(list) {
|
|
82
|
+
const entries = Array.isArray(list) ? list.filter(Boolean) : [];
|
|
83
|
+
const existingPinned = entries.find(isPluginPackageSpec);
|
|
84
|
+
return typeof existingPinned === "string" ? existingPinned : PLUGIN_ENTRY_LATEST;
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
function normalizePluginList(list) {
|
|
76
88
|
const entries = Array.isArray(list) ? list.filter(Boolean) : [];
|
|
89
|
+
const desiredPluginEntry = resolveDesiredPluginEntry(entries);
|
|
77
90
|
const filtered = entries.filter((entry) => {
|
|
78
91
|
if (typeof entry !== "string") return true;
|
|
79
92
|
return !PLUGIN_ALIASES.some(
|
|
@@ -81,7 +94,7 @@ function normalizePluginList(list) {
|
|
|
81
94
|
entry === alias || entry.startsWith(`${alias}@`) || entry.includes(alias),
|
|
82
95
|
);
|
|
83
96
|
});
|
|
84
|
-
return [...filtered,
|
|
97
|
+
return [...filtered, desiredPluginEntry];
|
|
85
98
|
}
|
|
86
99
|
|
|
87
100
|
function removePluginEntries(list) {
|
|
@@ -394,7 +407,7 @@ async function main() {
|
|
|
394
407
|
}
|
|
395
408
|
|
|
396
409
|
const template = await readJson(templatePath);
|
|
397
|
-
template.plugin = [
|
|
410
|
+
template.plugin = [PLUGIN_ENTRY_LATEST];
|
|
398
411
|
|
|
399
412
|
let nextConfig = template;
|
|
400
413
|
let nextContent = null;
|