Skip to content

Commit 8a4764a

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/codex-plugin-cc-args
# Conflicts: # plugins/codex/scripts/lib/process.mjs
2 parents ab10b9c + db52e28 commit 8a4764a

9 files changed

Lines changed: 48 additions & 10 deletions

File tree

‎.claude-plugin/marketplace.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
},
66
"metadata": {
77
"description": "Codex plugins to use in Claude Code for delegation and code review.",
8-
"version": "1.0.5"
8+
"version": "1.0.6"
99
},
1010
"plugins": [
1111
{
1212
"name": "codex",
1313
"description": "Use Codex from Claude Code to review code or delegate tasks.",
14-
"version": "1.0.5",
14+
"version": "1.0.6",
1515
"author": {
1616
"name": "OpenAI"
1717
},

‎package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openai/codex-plugin-cc",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"private": true,
55
"type": "module",
66
"description": "Use Codex from Claude Code to review code or delegate tasks.",

‎plugins/codex/.claude-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codex",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "Use Codex from Claude Code to review code or delegate tasks.",
55
"author": {
66
"name": "OpenAI"

‎plugins/codex/scripts/lib/git.mjs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ const MAX_UNTRACKED_BYTES = 24 * 1024;
88
const DEFAULT_INLINE_DIFF_MAX_FILES = 2;
99
const DEFAULT_INLINE_DIFF_MAX_BYTES = 256 * 1024;
1010

11+
// Git is directly executable on Windows. Repository-derived arguments must never pass through a shell.
1112
function git(cwd, args, options = {}) {
12-
return runCommand("git", args, { cwd, ...options });
13+
return runCommand("git", args, { cwd, ...options, shell: false });
1314
}
1415

1516
function gitChecked(cwd, args, options = {}) {
16-
return runCommandChecked("git", args, { cwd, ...options });
17+
return runCommandChecked("git", args, { cwd, ...options, shell: false });
1718
}
1819

1920
function listUniqueFiles(...groups) {

‎plugins/codex/scripts/lib/process.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function prepareSpawnCommand(command, args = [], options = {}) {
5757
}
5858

5959
export function runCommand(command, args = [], options = {}) {
60-
const invocation = prepareSpawnCommand(command, args, { env: options.env });
60+
const invocation = prepareSpawnCommand(command, args, { env: options.env, shell: options.shell });
6161
const result = spawnSync(invocation.command, invocation.args, {
6262
cwd: options.cwd,
6363
env: options.env,

‎tests/git.test.mjs‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,35 @@ test("resolveReviewTarget falls back to branch diff when repo is clean", () => {
3838
assert.match(context.content, /Branch Diff/);
3939
});
4040

41+
test("default branch names with special characters are passed to git literally", () => {
42+
const cwd = makeTempDir();
43+
const branchName = "main&branch-helper&x";
44+
const helperOutputPath = path.join(cwd, "branch-helper-output");
45+
initGitRepo(cwd);
46+
fs.writeFileSync(path.join(cwd, "branch-helper.cmd"), "@echo branch-helper>branch-helper-output\r\n");
47+
fs.writeFileSync(path.join(cwd, "app.js"), "console.log('base');\n");
48+
run("git", ["add", "app.js", "branch-helper.cmd"], { cwd });
49+
run("git", ["commit", "-m", "base"], { cwd });
50+
run("git", ["branch", "-m", branchName], { cwd, shell: false });
51+
run("git", ["update-ref", `refs/remotes/origin/${branchName}`, branchName], { cwd, shell: false });
52+
run("git", ["symbolic-ref", "refs/remotes/origin/HEAD", `refs/remotes/origin/${branchName}`], {
53+
cwd,
54+
shell: false
55+
});
56+
run("git", ["checkout", "-b", "feature/test"], { cwd });
57+
fs.writeFileSync(path.join(cwd, "app.js"), "console.log('feature');\n");
58+
run("git", ["add", "app.js"], { cwd });
59+
run("git", ["commit", "-m", "feature"], { cwd });
60+
61+
const target = resolveReviewTarget(cwd, {});
62+
const context = collectReviewContext(cwd, target);
63+
64+
assert.equal(target.mode, "branch");
65+
assert.equal(target.baseRef, branchName);
66+
assert.match(context.content, /Branch Diff/);
67+
assert.equal(fs.existsSync(helperOutputPath), false);
68+
});
69+
4170
test("resolveReviewTarget honors explicit base overrides", () => {
4271
const cwd = makeTempDir();
4372
initGitRepo(cwd);

‎tests/helpers.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function run(command, args, options = {}) {
1818
env: options.env,
1919
encoding: "utf8",
2020
input: options.input,
21-
shell: process.platform === "win32" && !path.isAbsolute(command),
21+
shell: options.shell ?? (process.platform === "win32" && !path.isAbsolute(command)),
2222
windowsHide: true
2323
});
2424
}

‎tests/process.test.mjs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ test("prepareSpawnCommand preserves Windows Git Bash argument boundaries", () =>
3131
});
3232
});
3333

34+
test("prepareSpawnCommand honors an explicit shell opt-out on Windows", () => {
35+
assert.deepEqual(prepareSpawnCommand("git", ["rev-parse", "main&branch"], { platform: "win32", shell: false }), {
36+
command: "git",
37+
args: ["rev-parse", "main&branch"],
38+
shell: false
39+
});
40+
});
41+
3442
test("terminateProcessTree uses taskkill on Windows", () => {
3543
let captured = null;
3644
const outcome = terminateProcessTree(1234, {

0 commit comments

Comments
 (0)