Skip to content

Commit 484de42

Browse files
feat: Add codex resource (#56)
* feat: Add codex resource (auto-generated from issue #52) * fix: fix schema for codex and codex mcp * feat: added auto-completion for codex models and fix nest completion paths * chore: bump version --------- Co-authored-by: kevinwang5658 <20214115+kevinwang5658@users.noreply.github.com> Co-authored-by: kevinwang <kevinwang5658@gmail.com>
1 parent 41d3368 commit 484de42

18 files changed

Lines changed: 1261 additions & 16 deletions

completions-cron/src/__generated__/completions-index.ts

Lines changed: 14 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: codex-app
3+
description: A reference page for the codex-app resource
4+
---
5+
6+
The codex-app resource installs the [Codex desktop app](https://developers.openai.com/codex/app) — OpenAI's "Codex command center" for managing coding agent threads, projects, and worktrees. It is a thin wrapper around the Homebrew cask install; the app shares its login, configuration, and MCP servers with the [`codex`](/docs/resources/codex/codex) CLI and IDE extension via `~/.codex/config.toml`.
7+
8+
This resource is **macOS only**. The Codex desktop app is also available on Windows via the Microsoft Store, but is not yet available on Linux.
9+
10+
## Parameters
11+
12+
This resource has no configurable parameters — it manages installation only.
13+
14+
## Example usage
15+
16+
```json title="codify.jsonc"
17+
[
18+
{
19+
"type": "codex-app",
20+
"os": ["macOS"]
21+
}
22+
]
23+
```
24+
25+
### Install the CLI and the desktop app together
26+
27+
```json title="codify.jsonc"
28+
[
29+
{
30+
"type": "codex",
31+
"os": ["macOS"]
32+
},
33+
{
34+
"type": "codex-app",
35+
"os": ["macOS"]
36+
}
37+
]
38+
```
39+
40+
## Notes
41+
42+
- Installed via `brew install --cask codex-app` to `/Applications/Codex.app`.
43+
- The desktop app, CLI, and IDE extension all read and write `~/.codex/config.toml` and share the same login session — use the [`codex`](/docs/resources/codex/codex) resource to manage settings and MCP servers declaratively.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: codex-project
3+
description: A reference page for the codex-project resource
4+
---
5+
6+
The codex-project resource manages **per-project** Codex configuration. It writes a project-scoped `AGENTS.md`, settings, and MCP servers under a specific directory — leaving global configuration untouched. Use it alongside the [`codex`](/docs/resources/codex/codex) resource, which handles installation.
7+
8+
## Parameters
9+
10+
- **directory**: *(string, required)* Path to the project directory. Configuration files are written relative to this path:
11+
- `<directory>/AGENTS.md`
12+
- `<directory>/.codex/config.toml`
13+
14+
- **agentsMd**: *(string, optional)* Content for `<directory>/AGENTS.md`. Accepts inline text, an `https://` URL, or a `codify://documentId:fileId` cloud URL. Codex walks from the project root down to the current working directory and concatenates any `AGENTS.md` files it finds, using them as project-specific instructions.
15+
16+
- **config**: *(object, optional)* Key-value pairs to merge into `<directory>/.codex/config.toml`. On apply, the declared keys are written; on destroy, only the declared keys are removed. Supports the same keys as the global config, e.g. `model`, `approval_policy`, `sandbox_mode`, `sandbox_workspace_write`.
17+
- Note: Codex ignores `model_provider`, `openai_base_url`, `notify`, `otel`, and `profiles` in project-level config files for security reasons.
18+
19+
- **mcpServers**: *(array, optional)* MCP servers to register for this project under `[mcp_servers]` in `<directory>/.codex/config.toml`. Each entry requires a `name` and `type`, plus transport-specific fields:
20+
- **stdio**: `{ name, type: "stdio", command, args?, env?, envVars?, cwd?, startupTimeoutSec?, toolTimeoutSec? }` — local process server
21+
- **http**: `{ name, type: "http", url, bearerTokenEnvVar?, httpHeaders? }` — remote streamable-HTTP server
22+
23+
## Example usage
24+
25+
### Per-project AGENTS.md and sandbox policy
26+
27+
```json title="codify.jsonc"
28+
[
29+
{
30+
"type": "codex-project",
31+
"directory": "~/projects/my-api",
32+
"agentsMd": "# Project Instructions\n\nThis is a Node.js API. Always use async/await.\nRun `npm test` before committing.",
33+
"config": {
34+
"sandbox_mode": "workspace-write",
35+
"approval_policy": "on-request"
36+
}
37+
}
38+
]
39+
```
40+
41+
### Per-project AGENTS.md with an MCP server
42+
43+
```json title="codify.jsonc"
44+
[
45+
{
46+
"type": "codex-project",
47+
"directory": "~/projects/my-api",
48+
"agentsMd": "# Project Instructions\n\nAlways check types with `npm run typecheck` before submitting.",
49+
"mcpServers": [
50+
{
51+
"name": "project-db",
52+
"type": "stdio",
53+
"command": "npx",
54+
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
55+
}
56+
]
57+
}
58+
]
59+
```
60+
61+
### Per-project AGENTS.md from a remote URL
62+
63+
```json title="codify.jsonc"
64+
[
65+
{
66+
"type": "codex-project",
67+
"directory": "~/projects/my-api",
68+
"agentsMd": "codify://my-document-id:my-file-id"
69+
}
70+
]
71+
```
72+
73+
Or from a public HTTPS URL:
74+
75+
```json title="codify.jsonc"
76+
[
77+
{
78+
"type": "codex-project",
79+
"directory": "~/projects/my-api",
80+
"agentsMd": "https://raw.githubusercontent.com/my-org/dotfiles/main/AGENTS.md"
81+
}
82+
]
83+
```
84+
85+
### Global install + per-project config together
86+
87+
```json title="codify.jsonc"
88+
[
89+
{
90+
"type": "codex",
91+
"config": {
92+
"model": "gpt-5.1-codex"
93+
}
94+
},
95+
{
96+
"type": "codex-project",
97+
"directory": "~/projects/my-api",
98+
"agentsMd": "# My API\n\nNode.js + TypeScript. Run `npm test` before any commit."
99+
}
100+
]
101+
```
102+
103+
## Notes
104+
105+
- The `codex` resource must be applied before `codex-project` (it declares a dependency automatically). If Codex is not installed, this resource will report as not present.
106+
- Multiple `codex-project` entries can coexist — each unique `directory` is a separate resource instance.
107+
- Destroying a `codex-project` resource removes only the per-project files (`AGENTS.md` and the `.codex/config.toml` directory). The Codex binary and global configuration are left untouched.
108+
- The `config` parameter merges only the declared top-level keys. Existing project config not in your Codify config is left untouched.
109+
- The `agentsMd` parameter manages the entire `AGENTS.md` file. On destroy, the file is removed.
110+
- MCP servers are stored under `[mcp_servers.<name>]` in `<directory>/.codex/config.toml`. Removing an MCP server from your config removes its table; other servers are untouched.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: codex
3+
description: A reference page for the codex resource
4+
---
5+
6+
The codex resource installs the [Codex CLI](https://developers.openai.com/codex) — OpenAI's terminal-based coding agent — and manages its global configuration. It handles installation via the official installer script and gives you declarative control over `~/.codex/config.toml` settings and global MCP servers.
7+
8+
## Parameters
9+
10+
- **config**: *(object, optional)* Key-value pairs to merge into `~/.codex/config.toml`. On apply, the declared keys are written; on destroy, only the declared keys are removed. Common settings include:
11+
- `model` — the model Codex uses (e.g. `"gpt-5.1-codex"`)
12+
- `model_provider` — the model provider (default: `"openai"`)
13+
- `approval_policy``"untrusted"` | `"on-request"` | `"never"` (default: `"on-request"`)
14+
- `sandbox_mode``"read-only"` | `"workspace-write"` | `"danger-full-access"` (default: `"workspace-write"`)
15+
- `sandbox_workspace_write``{ network_access, writable_roots, ... }`
16+
- `model_reasoning_effort``"minimal"` | `"low"` | `"medium"` | `"high"` | `"xhigh"`
17+
- `model_reasoning_summary``"auto"` | `"concise"` | `"detailed"` | `"none"`
18+
- `web_search``"disabled"` | `"cached"` | `"live"` (default: `"cached"`)
19+
- `file_opener``"vscode"` | `"cursor"` | `"windsurf"` | `"none"`
20+
- `history``{ persistence, max_bytes }`
21+
- `shell_environment_policy``{ inherit, set, include_only, exclude }`
22+
23+
- **mcpServers**: *(array, optional)* MCP servers to register globally under `[mcp_servers]` in `~/.codex/config.toml`. Each entry requires a `name` and `type`, plus transport-specific fields:
24+
- **stdio**: `{ name, type: "stdio", command, args?, env?, envVars?, cwd?, startupTimeoutSec?, toolTimeoutSec? }` — local process server
25+
- **http**: `{ name, type: "http", url, bearerTokenEnvVar?, httpHeaders? }` — remote streamable-HTTP server
26+
27+
## Example usage
28+
29+
### Install Codex with custom settings
30+
31+
```json title="codify.jsonc"
32+
[
33+
{
34+
"type": "codex",
35+
"config": {
36+
"model": "gpt-5.1-codex",
37+
"approval_policy": "on-request",
38+
"sandbox_mode": "workspace-write"
39+
}
40+
}
41+
]
42+
```
43+
44+
### Codex with an MCP server
45+
46+
```json title="codify.jsonc"
47+
[
48+
{
49+
"type": "codex",
50+
"mcpServers": [
51+
{
52+
"name": "filesystem",
53+
"type": "stdio",
54+
"command": "npx",
55+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
56+
}
57+
]
58+
}
59+
]
60+
```
61+
62+
### Codex with a remote MCP server
63+
64+
```json title="codify.jsonc"
65+
[
66+
{
67+
"type": "codex",
68+
"mcpServers": [
69+
{
70+
"name": "figma",
71+
"type": "http",
72+
"url": "https://mcp.figma.com/mcp",
73+
"bearerTokenEnvVar": "FIGMA_OAUTH_TOKEN"
74+
}
75+
]
76+
}
77+
]
78+
```
79+
80+
## Notes
81+
82+
- Codex is installed via the official installer (`curl -fsSL https://chatgpt.com/codex/install.sh | sh`) on both macOS and Linux. The binary is placed at `~/.local/bin/codex`.
83+
- The installer adds `~/.local/bin` to your PATH. This entry remains after destroy — remove it manually if you no longer want it.
84+
- The `config` parameter merges only the declared top-level keys of `~/.codex/config.toml`. Existing keys not in your Codify config (including `mcp_servers`) are left untouched.
85+
- MCP servers are stored under `[mcp_servers.<name>]` in `~/.codex/config.toml`. Removing an MCP server from your config removes its table; other servers are untouched.
86+
- For per-project configuration (AGENTS.md, project-scoped settings and MCP servers), see [`codex-project`](/docs/resources/codex/codex-project). For the Codex desktop app, see [`codex-app`](/docs/resources/codex/codex-app).
87+
- Authentication (`codex login`) is interactive and not managed by this resource.

package-lock.json

Lines changed: 15 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "default",
3-
"version": "1.12.0",
3+
"version": "1.13.0",
44
"description": "Default plugin for Codify - provides 50+ declarative resources for managing development tools and system configuration across macOS and Linux",
55
"main": "dist/index.js",
66
"scripts": {
@@ -51,6 +51,7 @@
5151
"nanoid": "^5.0.9",
5252
"plist": "^3.1.0",
5353
"semver": "^7.6.0",
54+
"smol-toml": "^1.6.1",
5455
"strip-ansi": "^7.1.0",
5556
"trash": "^10.0.0"
5657
},

scripts/generate-completions-index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const modules = completionFiles.map((relPath, i) => {
2828
)
2929
}
3030
const resourceType = filename.substring(0, dotIndex)
31-
const parameterPath = '/' + filename.substring(dotIndex + 1)
31+
const parameterPath = '/' + filename.substring(dotIndex + 1).replaceAll('.', '/')
3232

3333
// Path from completions-cron/src/__generated__/ back to plugin src/resources/
3434
const importPath = '../../../src/' + relPath.replace(/\.ts$/, '.js')

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ import { MacportsResource } from './resources/macports/macports.js';
3434
import { ClaudeCodeResource } from './resources/claude-code/claude-code.js';
3535
import { OpenClawResource } from './resources/openclaw/openclaw.js';
3636
import { ClaudeCodeProjectResource } from './resources/claude-code/claude-code-project.js';
37+
import { CodexResource } from './resources/codex/codex.js';
38+
import { CodexProjectResource } from './resources/codex/codex-project.js';
39+
import { CodexAppResource } from './resources/codex/codex-app.js';
3740
import { OllamaResource } from './resources/ollama/ollama.js';
3841
import { PgcliResource } from './resources/pgcli/pgcli.js';
3942
import { Pip } from './resources/python/pip/pip.js';
@@ -146,6 +149,9 @@ runPlugin(Plugin.create(
146149
new TartVmResource(),
147150
new ClaudeCodeResource(),
148151
new ClaudeCodeProjectResource(),
152+
new CodexResource(),
153+
new CodexProjectResource(),
154+
new CodexAppResource(),
149155
new OllamaResource(),
150156
new SyncthingResource(),
151157
new SyncthingDeviceResource(),

0 commit comments

Comments
 (0)