-
Notifications
You must be signed in to change notification settings - Fork 1
fix(wrapper): support codex-multi-auth version flags #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ndycode
wants to merge
5
commits into
main
Choose a base branch
from
fix/codex-multi-auth-version-flag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
960ca3e
fix(wrapper): support codex-multi-auth version flags
ndycode 858f1fa
test(wrapper): cover multi-arg version passthrough
ndycode da49573
style(wrapper): fix runtime exit indentation
ndycode 2cb694b
test wrapper cleanup retry enotempty
ndycode 70c3651
test: harden wrapper version passthrough coverage
ndycode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,40 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import { createRequire } from "node:module"; | ||
| import { runCodexMultiAuthCli } from "../dist/lib/codex-manager.js"; | ||
|
|
||
| try { | ||
| const versionFlags = new Set(["--version", "-v"]); | ||
|
|
||
| function resolveCliVersion() { | ||
| const require = createRequire(import.meta.url); | ||
| const pkg = require("../package.json"); | ||
| const version = typeof pkg?.version === "string" ? pkg.version.trim() : ""; | ||
| if (version.length > 0) { | ||
| process.env.CODEX_MULTI_AUTH_CLI_VERSION = version; | ||
| try { | ||
| const pkg = require("../package.json"); | ||
| const version = typeof pkg?.version === "string" ? pkg.version.trim() : ""; | ||
| if (version.length > 0) { | ||
| return version; | ||
| } | ||
| } catch { | ||
| // Best effort only. | ||
| } | ||
| } catch { | ||
| // Best effort only. | ||
| return ""; | ||
| } | ||
|
|
||
| const args = process.argv.slice(2); | ||
| const version = resolveCliVersion(); | ||
|
|
||
| if (version.length > 0) { | ||
| process.env.CODEX_MULTI_AUTH_CLI_VERSION = version; | ||
| } | ||
|
|
||
| const exitCode = await runCodexMultiAuthCli(process.argv.slice(2)); | ||
| process.exitCode = Number.isInteger(exitCode) ? exitCode : 1; | ||
| if (args.length === 1 && versionFlags.has(args[0])) { | ||
| if (version.length > 0) { | ||
| process.stdout.write(`${version}\n`); | ||
| process.exitCode = 0; | ||
| } else { | ||
| process.stderr.write("codex-multi-auth version is unavailable.\n"); | ||
| process.exitCode = 1; | ||
| } | ||
| } else { | ||
| const { runCodexMultiAuthCli } = await import("../dist/lib/codex-manager.js"); | ||
| const exitCode = await runCodexMultiAuthCli(args); | ||
| process.exitCode = Number.isInteger(exitCode) ? exitCode : 1; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.