@carjms/codexswitch 0.6.0 → 0.6.1
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 +1 -1
- package/src/cli.js +12 -2
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -772,6 +772,14 @@ async function cmdExec(args) {
|
|
|
772
772
|
if (explicit && !store.accountExists(explicit)) throw new Error(`no such account: ${explicit}`);
|
|
773
773
|
if (rest[0] === 'resume') allowResume = false; // user drives resume themselves
|
|
774
774
|
|
|
775
|
+
// A prompt like "- item one ..." would be parsed as an option by codex;
|
|
776
|
+
// if the last argument starts with "-" but contains whitespace it can only
|
|
777
|
+
// be a prompt, so protect it with a "--" separator.
|
|
778
|
+
if (!rest.includes('--')) {
|
|
779
|
+
const last = rest[rest.length - 1];
|
|
780
|
+
if (last && /^-/.test(last) && /\s/.test(last)) rest.splice(rest.length - 1, 0, '--');
|
|
781
|
+
}
|
|
782
|
+
|
|
775
783
|
store.syncBack(); // pick up tokens refreshed by plain codex before overlaying
|
|
776
784
|
const meta = store.loadMeta();
|
|
777
785
|
const total = store.listAccounts().length;
|
|
@@ -795,7 +803,7 @@ async function cmdExec(args) {
|
|
|
795
803
|
// On rotation, continue the same session with the next account instead
|
|
796
804
|
// of restarting the whole prompt — the session files are shared.
|
|
797
805
|
const codexArgs = useResume
|
|
798
|
-
? ['exec', 'resume', '--last', ...buildExecArgs([], meta), RESUME_PROMPT]
|
|
806
|
+
? ['exec', 'resume', '--last', ...buildExecArgs([], meta), '--', RESUME_PROMPT]
|
|
799
807
|
: ['exec', ...buildExecArgs(rest, meta)];
|
|
800
808
|
const startTs = Date.now();
|
|
801
809
|
const res = await runner.runCodex(name, codexArgs, { capture: true });
|
|
@@ -900,7 +908,9 @@ async function cmdChat() {
|
|
|
900
908
|
continue;
|
|
901
909
|
}
|
|
902
910
|
|
|
903
|
-
|
|
911
|
+
// "--" marks the prompt as positional so lines starting with "-" are
|
|
912
|
+
// never parsed as codex options.
|
|
913
|
+
const code = await cmdExec(inSession ? ['resume', '--last', '--', line] : ['--', line]);
|
|
904
914
|
if (code === 0) inSession = true;
|
|
905
915
|
else if (code === 2) out(ui.fail('all accounts exhausted — try again later or /use a specific account'));
|
|
906
916
|
}
|