Skip to content

Commit 834c21e

Browse files
committed
feat: add codex agent to cli
1 parent d252afb commit 834c21e

File tree

11 files changed

+55
-10
lines changed

11 files changed

+55
-10
lines changed

packages/cli/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @react-grab/cli
22

3+
## 0.0.71
4+
5+
### Patch Changes
6+
7+
- feat: add Codex agent integration to CLI
8+
39
## 0.0.70
410

511
### Patch Changes

packages/cli/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ npx @react-grab/cli -p pnpm -a claude-code -y
3838
| `--framework` | `-f` | Framework to configure | `next`, `vite`, `webpack` |
3939
| `--package-manager` | `-p` | Package manager to use | `npm`, `yarn`, `pnpm`, `bun` |
4040
| `--router` | `-r` | Next.js router type | `app`, `pages` |
41-
| `--agent` | `-a` | Agent integration to add | `claude-code`, `cursor`, `opencode`, `none` |
41+
| `--agent` | `-a` | Agent integration to add | `claude-code`, `cursor`, `codex`, `opencode`, `none` |
4242
| `--yes` | `-y` | Skip all confirmation prompts | - |
4343
| `--skip-install` | - | Skip package installation (only modify files) | - |
4444
| `--help` | `-h` | Show help | - |
@@ -56,6 +56,9 @@ npx @react-grab/cli -y
5656
# Next.js App Router with Cursor agent
5757
npx @react-grab/cli -f next -r app -a cursor -y
5858

59+
# Next.js App Router with Codex agent
60+
npx @react-grab/cli -f next -r app -a codex -y
61+
5962
# Vite with Claude Code agent using pnpm
6063
npx @react-grab/cli -f vite -p pnpm -a claude-code -y
6164

@@ -81,6 +84,7 @@ The CLI can optionally set up agent integrations for:
8184

8285
- **Claude Code** (`-a claude-code`) - Send selected elements to Claude Code
8386
- **Cursor** (`-a cursor`) - Send selected elements to Cursor
87+
- **Codex** (`-a codex`) - Send selected elements to Codex
8488
- **Opencode** (`-a opencode`) - Send selected elements to Opencode
8589

8690
## Manual Installation

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-grab/cli",
3-
"version": "0.0.70",
3+
"version": "0.0.71",
44
"type": "module",
55
"bin": {
66
"react-grab": "./dist/cli.js"

packages/cli/src/cli.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const PACKAGE_MANAGER_NAMES: Record<PackageManager, string> = {
3232
const AGENT_NAMES: Record<string, string> = {
3333
"claude-code": "Claude Code",
3434
cursor: "Cursor",
35+
codex: "Codex",
3536
opencode: "Opencode",
3637
};
3738

@@ -169,7 +170,7 @@ const parseArgs = async (): Promise<CliArgs> => {
169170
.option("agent", {
170171
alias: "a",
171172
type: "string",
172-
choices: ["claude-code", "cursor", "opencode", "none"] as const,
173+
choices: ["claude-code", "cursor", "opencode", "codex", "none"] as const,
173174
description: "Agent integration to automatically forward selected elements to agent instead of copying to clipboard",
174175
})
175176
.option("yes", {
@@ -191,12 +192,14 @@ const parseArgs = async (): Promise<CliArgs> => {
191192
.example("$0 -y", "Auto-detect everything and install without prompts")
192193
.example("$0 -f next -r app", "Configure for Next.js App Router")
193194
.example("$0 -a cursor -y", "Add Cursor agent integration non-interactively")
195+
.example("$0 -a codex -y", "Add Codex agent integration non-interactively")
194196
.example("$0 -p pnpm -a claude-code", "Use pnpm and add Claude Code agent")
195197
.example("$0 --skip-install", "Only modify files, install packages manually")
196198
.epilog(
197199
`${pc.bold("Agent Integrations:")}\n` +
198200
` ${pc.cyan("claude-code")} Connect React Grab to Claude Code\n` +
199201
` ${pc.cyan("cursor")} Connect React Grab to Cursor IDE\n` +
202+
` ${pc.cyan("codex")} Connect React Grab to Codex CLI\n` +
200203
` ${pc.cyan("opencode")} Connect React Grab to Opencode\n\n` +
201204
`${pc.bold("Supported Frameworks:")}\n` +
202205
` ${pc.cyan("next")} Next.js (App Router & Pages Router)\n` +
@@ -360,6 +363,7 @@ const main = async () => {
360363
const availableAgents = [
361364
{ name: "Claude Code", value: "claude-code" as const },
362365
{ name: "Cursor", value: "cursor" as const },
366+
{ name: "Codex", value: "codex" as const },
363367
{ name: "Opencode", value: "opencode" as const },
364368
].filter((agent) => !projectInfo.installedAgents.includes(agent.value));
365369

@@ -372,7 +376,7 @@ const main = async () => {
372376
});
373377
} else {
374378
const wantAgentIntegration = await confirm({
375-
message: "Do you want to add an agent integration (Claude Code, Cursor, or Opencode)?",
379+
message: "Do you want to add an agent integration (Claude Code, Cursor, Codex, or Opencode)?",
376380
default: false,
377381
});
378382

packages/cli/src/detect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export const detectReactGrab = (projectRoot: string): boolean => {
291291
return filesToCheck.some(hasReactGrabInFile);
292292
};
293293

294-
const AGENT_PACKAGES = ["@react-grab/claude-code", "@react-grab/cursor", "@react-grab/opencode"];
294+
const AGENT_PACKAGES = ["@react-grab/claude-code", "@react-grab/cursor", "@react-grab/opencode", "@react-grab/codex"];
295295

296296
export const detectUnsupportedFramework = (projectRoot: string): UnsupportedFramework => {
297297
const packageJsonPath = join(projectRoot, "package.json");

packages/cli/src/templates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type AgentIntegration = "claude-code" | "cursor" | "opencode" | "none";
1+
export type AgentIntegration = "claude-code" | "cursor" | "opencode" | "codex" | "none";
22

33
export const NEXT_APP_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
44
<Script

packages/cli/src/transform.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ export const transformProject = (
597597
const AGENT_PREFIXES: Record<string, string> = {
598598
"claude-code": "npx @react-grab/claude-code@latest &&",
599599
cursor: "npx @react-grab/cursor@latest &&",
600+
codex: "npx @react-grab/codex@latest &&",
600601
opencode: "npx @react-grab/opencode@latest &&",
601602
};
602603

packages/cli/test/detect.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ describe("detectInstalledAgents", () => {
224224
devDependencies: {
225225
"@react-grab/cursor": "1.0.0",
226226
"@react-grab/claude-code": "1.0.0",
227+
"@react-grab/codex": "1.0.0",
227228
},
228229
})
229230
);
230231

231232
const agents = detectInstalledAgents("/test");
232233
expect(agents).toContain("cursor");
233234
expect(agents).toContain("claude-code");
235+
expect(agents).toContain("codex");
234236
expect(agents).not.toContain("opencode");
235237
});
236238

packages/cli/test/install.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("getPackagesToInstall", () => {
2727
});
2828

2929
it("should handle all agent types", () => {
30-
const agents = ["claude-code", "cursor", "opencode"] as const;
30+
const agents = ["claude-code", "cursor", "opencode", "codex"] as const;
3131

3232
for (const agent of agents) {
3333
const packages = getPackagesToInstall(agent, false);

packages/cli/test/templates.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("Next.js App Router templates", () => {
3232
});
3333

3434
it("should include all agent types correctly", () => {
35-
const agents = ["claude-code", "cursor", "opencode"] as const;
35+
const agents = ["claude-code", "cursor", "opencode", "codex"] as const;
3636

3737
for (const agent of agents) {
3838
const script = NEXT_APP_ROUTER_SCRIPT_WITH_AGENT(agent);
@@ -54,6 +54,13 @@ describe("Vite templates", () => {
5454
expect(script).toContain("@react-grab/opencode");
5555
});
5656

57+
it("should generate script with codex agent", () => {
58+
const script = VITE_SCRIPT_WITH_AGENT("codex");
59+
60+
expect(script).toContain("react-grab");
61+
expect(script).toContain("@react-grab/codex");
62+
});
63+
5764
it("should return basic script when agent is none", () => {
5865
const script = VITE_SCRIPT_WITH_AGENT("none");
5966

0 commit comments

Comments
 (0)