豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit b94d838

Browse files
VOIDXAItrunkszi
authored andcommitted
tests: reduce background task timing flakiness (openai#37)
Co-authored-by: VOIDXAI <VOIDXAI@users.noreply.github.com>
1 parent 6360899 commit b94d838

File tree

14 files changed

+1540
-20
lines changed

14 files changed

+1540
-20
lines changed

.claude-plugin/marketplace.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "openai-codex",
2+
"name": "trunkszi-codex-gemini",
33
"owner": {
4-
"name": "OpenAI"
4+
"name": "trunkszi"
55
},
66
"metadata": {
7-
"description": "Codex plugins to use in Claude Code for delegation and code review.",
8-
"version": "1.0.2"
7+
"description": "Codex and Gemini plugins for Claude Code — code review and task delegation.",
8+
"version": "1.1.0"
99
},
1010
"plugins": [
1111
{
@@ -16,6 +16,15 @@
1616
"name": "OpenAI"
1717
},
1818
"source": "./plugins/codex"
19+
},
20+
{
21+
"name": "gemini",
22+
"description": "Use Gemini CLI from Claude Code for code review.",
23+
"version": "0.1.0",
24+
"author": {
25+
"name": "trunkszi"
26+
},
27+
"source": "./plugins/gemini"
1928
}
2029
]
2130
}

README.md

Lines changed: 202 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
1-
# Codex plugin for Claude Code
1+
# Codex & Gemini plugins for Claude Code
22

3-
Use Codex from inside Claude Code for code reviews or to delegate tasks to Codex.
3+
Use Codex and Gemini from inside Claude Code for code reviews or to delegate tasks.
44

5-
This plugin is for Claude Code users who want an easy way to start using Codex from the workflow
6-
they already have.
5+
This project provides two Claude Code plugins:
6+
7+
- **Codex plugin** — integrates OpenAI Codex for code review, adversarial review, and task delegation
8+
- **Gemini plugin** — integrates Google Gemini CLI for code review and adversarial review
79

810
<video src="./docs/plugin-demo.webm" controls muted playsinline autoplay></video>
911

1012
## What You Get
1113

14+
### Codex commands
15+
1216
- `/codex:review` for a normal read-only Codex review
1317
- `/codex:adversarial-review` for a steerable challenge review
1418
- `/codex:rescue`, `/codex:status`, `/codex:result`, and `/codex:cancel` to delegate work and manage background jobs
1519

20+
### Gemini commands
21+
22+
- `/gemini:review` for a read-only Gemini code review
23+
- `/gemini:adversarial-review` for a steerable adversarial review powered by Gemini
24+
- `/gemini:setup` to check Gemini CLI availability and authentication
25+
1626
## Requirements
1727

18-
- **ChatGPT subscription (incl. Free) or OpenAI API key.**
19-
- Usage will contribute to your Codex usage limits. [Learn more](https://developers.openai.com/codex/pricing).
2028
- **Node.js 18.18 or later**
29+
- **For Codex commands:** ChatGPT subscription (incl. Free) or OpenAI API key. Usage will contribute to your Codex usage limits. [Learn more](https://developers.openai.com/codex/pricing).
30+
- **For Gemini commands:** Google account with Gemini access.
2131

2232
## Install
2333

24-
Add the marketplace in Claude Code:
34+
### Option A: Install from this fork via marketplace (includes both Codex and Gemini)
35+
36+
Add this fork as a marketplace in Claude Code:
2537

2638
```bash
27-
/plugin marketplace add openai/codex-plugin-cc
39+
/plugin marketplace add trunkszi/codex-plugin-cc
2840
```
2941

30-
Install the plugin:
42+
Install the plugins you need:
3143

3244
```bash
33-
/plugin install codex@openai-codex
45+
/plugin install codex@trunkszi-codex-gemini
46+
/plugin install gemini@trunkszi-codex-gemini
3447
```
3548

3649
Reload plugins:
@@ -39,7 +52,40 @@ Reload plugins:
3952
/reload-plugins
4053
```
4154

42-
Then run:
55+
### Option B: Install from local directory
56+
57+
Clone this repository and load plugins directly:
58+
59+
```bash
60+
git clone https://github.com/trunkszi/codex-plugin-cc.git
61+
cd codex-plugin-cc
62+
git checkout gemini/plugin-integration
63+
claude --plugin-dir ./plugins/codex --plugin-dir ./plugins/gemini
64+
```
65+
66+
Or load only the plugin you need:
67+
68+
```bash
69+
claude --plugin-dir ./plugins/codex # Codex only
70+
claude --plugin-dir ./plugins/gemini # Gemini only
71+
```
72+
73+
### Option C: Install Codex plugin from official marketplace (Codex only)
74+
75+
If you only need the original Codex plugin, install from the official marketplace:
76+
77+
```bash
78+
/plugin marketplace add openai/codex-plugin-cc
79+
/plugin install codex@openai-codex
80+
/reload-plugins
81+
```
82+
83+
> [!NOTE]
84+
> The official marketplace only includes the Codex plugin. The Gemini plugin is available through this fork (Option A or B).
85+
86+
### Post-install setup
87+
88+
For Codex, run:
4389

4490
```bash
4591
/codex:setup
@@ -59,10 +105,28 @@ If Codex is installed but not logged in yet, run:
59105
!codex login
60106
```
61107

108+
For Gemini, run:
109+
110+
```bash
111+
/gemini:setup
112+
```
113+
114+
If Gemini CLI is not installed:
115+
116+
```bash
117+
npm install -g @google/gemini-cli
118+
```
119+
120+
If Gemini CLI is installed but not authenticated, start the login flow:
121+
122+
```bash
123+
!gemini
124+
```
125+
62126
After install, you should see:
63127

64-
- the slash commands listed below
65-
- the `codex:codex-rescue` subagent in `/agents`
128+
- the Codex slash commands (`/codex:*`) and the `codex:codex-rescue` subagent in `/agents`
129+
- the Gemini slash commands (`/gemini:*`)
66130

67131
One simple first run is:
68132

@@ -303,3 +367,128 @@ Yes. If you already use Codex, the plugin picks up the same [configuration](#com
303367
Yes. Because the plugin uses your local Codex CLI, your existing sign-in method and config still apply.
304368

305369
If you need to point the built-in OpenAI provider at a different endpoint, set `openai_base_url` in your [Codex config](https://developers.openai.com/codex/config-advanced/#config-and-state-locations).
370+
371+
---
372+
373+
# Gemini plugin for Claude Code
374+
375+
Use Google Gemini CLI from inside Claude Code for code reviews.
376+
377+
This plugin is for Claude Code users who want to use Gemini as an additional review tool alongside or instead of Codex.
378+
379+
See the [Install](#install) section above for setup instructions.
380+
381+
## Usage
382+
383+
### `/gemini:review`
384+
385+
Runs a standard Gemini code review on your current work. The review runs in read-only mode (`--approval-mode plan`) and will not modify any files.
386+
387+
> [!NOTE]
388+
> Code review for multi-file changes might take a while. It's generally recommended to run it in the background.
389+
390+
Use it when you want:
391+
392+
- a review of your current uncommitted changes
393+
- a review of your branch compared to a base branch like `main`
394+
395+
Use `--base <ref>` for branch review. It also supports `--wait` and `--background`.
396+
397+
Examples:
398+
399+
```bash
400+
/gemini:review
401+
/gemini:review --base main
402+
/gemini:review --background
403+
/gemini:review --model gemini-2.5-pro --wait
404+
```
405+
406+
This command is read-only and will not perform any changes.
407+
408+
### `/gemini:adversarial-review`
409+
410+
Runs a **steerable** adversarial review that questions the chosen implementation and design.
411+
412+
It can be used to pressure-test assumptions, tradeoffs, failure modes, and whether a different approach would have been safer or simpler.
413+
414+
It uses the same review target selection as `/gemini:review`, including `--base <ref>` for branch review.
415+
It also supports `--wait`, `--background`, and `--model <model>`. Unlike `/gemini:review`, it can take extra focus text after the flags.
416+
417+
Use it when you want:
418+
419+
- a review before shipping that challenges the direction, not just the code details
420+
- review focused on design choices, tradeoffs, hidden assumptions, and alternative approaches
421+
- pressure-testing around specific risk areas like auth, data loss, rollback, race conditions, or reliability
422+
423+
Examples:
424+
425+
```bash
426+
/gemini:adversarial-review
427+
/gemini:adversarial-review --base main challenge whether this was the right caching design
428+
/gemini:adversarial-review --model gemini-2.5-pro --wait look for race conditions
429+
/gemini:adversarial-review --background
430+
```
431+
432+
This command is read-only. It does not fix code.
433+
434+
### `/gemini:setup`
435+
436+
Checks whether Gemini CLI is installed and authenticated.
437+
438+
```bash
439+
/gemini:setup
440+
```
441+
442+
## Typical Gemini Flows
443+
444+
### Quick Review
445+
446+
```bash
447+
/gemini:review --wait
448+
```
449+
450+
### Adversarial Review Before Shipping
451+
452+
```bash
453+
/gemini:adversarial-review --wait
454+
```
455+
456+
### Use A Specific Model
457+
458+
```bash
459+
/gemini:adversarial-review --model gemini-2.5-pro --wait
460+
```
461+
462+
### Background Review
463+
464+
```bash
465+
/gemini:review --background
466+
```
467+
468+
## Gemini Integration
469+
470+
The Gemini plugin invokes the [Gemini CLI](https://github.com/google-gemini/gemini-cli) in headless mode (`gemini -p <prompt> --approval-mode plan`). Each review spawns a single `gemini` process that runs to completion.
471+
472+
Review context (git diff, file contents) is piped via stdin with randomized boundary tags to prevent prompt injection. The instruction prompt is passed via the `-p` flag.
473+
474+
The plugin reuses shared infrastructure from the Codex plugin for git context collection, argument parsing, and workspace resolution.
475+
476+
## Gemini FAQ
477+
478+
### Do I need a Google Cloud account?
479+
480+
No. Gemini CLI authenticates with a standard Google account. Run `gemini` interactively once to complete the login flow.
481+
482+
### What model does it use by default?
483+
484+
Gemini CLI uses its own default model (currently `gemini-2.0-pro-exp-02-05` as of CLI version 0.36.0). You can override it with `--model <model-name>` on any review command.
485+
486+
### Can I use both Codex and Gemini plugins together?
487+
488+
Yes. Load both plugins with:
489+
490+
```bash
491+
claude --plugin-dir ./plugins/codex --plugin-dir ./plugins/gemini
492+
```
493+
494+
The commands use different prefixes (`/codex:*` and `/gemini:*`) so they do not conflict.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "gemini",
3+
"version": "0.1.0",
4+
"description": "Use Gemini CLI from Claude Code to review code.",
5+
"author": {
6+
"name": "Community"
7+
}
8+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: gemini-review
3+
description: Use proactively when the user asks to review code with Gemini, run a Gemini code review, run a Gemini adversarial review, or mentions "gemini review", "gemini adversarial-review", or "use gemini to review". This agent handles all Gemini CLI review operations.
4+
tools: Bash
5+
---
6+
7+
You are a forwarding wrapper around the Gemini companion review runtime.
8+
9+
Your job is to invoke the correct Gemini review command based on the user's request. Do not do anything else.
10+
11+
Selection guidance:
12+
13+
- Use this subagent when the user mentions Gemini and review in the same request.
14+
- This includes: "use gemini to review", "gemini review", "gemini adversarial review", "use gemini:review", "use gemini:adversarial-review", or any natural language request to perform a code review using Gemini.
15+
- Do not use this agent for non-review tasks. Gemini plugin only supports review operations.
16+
17+
Review type detection:
18+
19+
- If the user mentions "adversarial", "challenge", "question the design", "pressure test", or provides focus text describing what to challenge, use `adversarial-review`.
20+
- Otherwise, use `review`.
21+
22+
Argument handling:
23+
24+
- `--model <model>`: Pass through if the user specifies a model name (e.g., `--model gemini-2.5-pro`, `--model gemini-3.1-pro-preview`).
25+
- `--base <ref>`: Pass through if the user specifies a base branch (e.g., `--base main`).
26+
- `--scope <scope>`: Pass through if specified. Valid values: `auto`, `working-tree`, `branch`.
27+
- `--wait` / `--background`: If the user does not specify, prefer `--wait` for small reviews, omit for larger ones to let the script decide.
28+
- Focus text: For adversarial reviews, any extra descriptive text from the user (e.g., "look for race conditions") should be passed as positional arguments after the flags.
29+
- IMPORTANT: When inserting arguments into the shell command, always wrap them in single quotes to prevent bash command substitution.
30+
31+
Forwarding rules:
32+
33+
- Use exactly one `Bash` call to invoke the companion script.
34+
35+
For standard review:
36+
```bash
37+
node "${CLAUDE_PLUGIN_ROOT}/scripts/gemini-companion.mjs" review [flags]
38+
```
39+
40+
For adversarial review:
41+
```bash
42+
node "${CLAUDE_PLUGIN_ROOT}/scripts/gemini-companion.mjs" adversarial-review [flags] [focus text]
43+
```
44+
45+
- Return the stdout of the command exactly as-is.
46+
- Do not paraphrase, summarize, or add commentary before or after the output.
47+
- Do not fix any issues mentioned in the review output.
48+
- If the Bash call fails, return the error message as-is.
49+
50+
Response style:
51+
52+
- Do not add commentary before or after the review output.

0 commit comments

Comments
 (0)