fix(codex-config): stop rejecting env values that start with "-"
--env's value is the RHS of one KEY=VALUE argv element, never its own argv position, so a leading "-" can never be parsed as a flag — unlike the key, which stays validated as an identifier. assertArg's leading-dash guard was reused for the value too, refusing ordinary values like "-1". Split it into assertEnvValue (no leading-dash check) for values only.
This commit is contained in:
@@ -189,6 +189,20 @@ describe("codex-cli argv construction", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("accepts an env value starting with '-' — it's the RHS of one KEY=VALUE argv element, never a flag", async () => {
|
||||
const restore = stubCodex();
|
||||
try {
|
||||
const result = await cli.mcpAdd({
|
||||
name: "docs",
|
||||
command: "node",
|
||||
env: { OFFSET: "-1" },
|
||||
});
|
||||
assert.deepEqual(argvOf(result), ["mcp", "add", "docs", "--env", "OFFSET=-1", "--", "node"]);
|
||||
} finally {
|
||||
restore();
|
||||
}
|
||||
});
|
||||
|
||||
it("builds mcp list / remove argvs", async () => {
|
||||
const restore = stubCodex();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user