codexmate 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +429 -0
- package/README.md +231 -215
- package/cli.js +2450 -137
- package/doc/CHANGELOG.md +10 -3
- package/doc/CHANGELOG.zh-CN.md +7 -0
- package/lib/cli-utils.js +16 -0
- package/lib/workflow-engine.js +340 -0
- package/package.json +11 -4
- package/web-ui/app.js +515 -5
- package/web-ui/index.html +242 -19
- package/web-ui/logic.mjs +147 -1
- package/web-ui/styles.css +648 -10
- package/README.zh-CN.md +0 -419
package/README.en.md
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
# Codex Mate
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
<img src="res/logo.png" alt="Codex Mate logo" width="110">
|
|
6
|
+
|
|
7
|
+
[](https://github.com/ymkiux/codexmate/actions/workflows/release.yml)
|
|
8
|
+
[](https://www.npmjs.com/package/codexmate)
|
|
9
|
+
[](https://www.npmjs.com/package/codexmate)
|
|
10
|
+
[](https://github.com/ymkiux/codexmate)
|
|
11
|
+
[](https://github.com/ymkiux/codexmate/commits)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
[](https://nodejs.org)
|
|
14
|
+
|
|
15
|
+
**A lightweight AI configuration assistant: quickly switch Codex providers/models and Claude Code configs, with a unified session browser**
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<p align="center">English · <a href="README.md">中文版</a></p>
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
|
|
27
|
+
Codex Mate helps you switch Codex/Claude Code providers and models in seconds, and manage local sessions in one place.
|
|
28
|
+
|
|
29
|
+
## 60-Second Quick Start (One-Line Source Install)
|
|
30
|
+
|
|
31
|
+
Requirements: `Node.js >= 14`, `Git`
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git clone https://github.com/ymkiux/codexmate.git && cd codexmate && npm install && npm link && codexmate run
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Open `http://localhost:3737` in your browser.
|
|
38
|
+
|
|
39
|
+
If this is your first time, run:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
codexmate setup
|
|
43
|
+
codexmate status
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you only want a temporary trial, run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx codexmate@latest run
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Choose a Common Workflow
|
|
53
|
+
|
|
54
|
+
1. Switch Codex provider/model quickly
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
codexmate switch <provider>
|
|
58
|
+
codexmate use <model>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. Apply Claude Code config in one line
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
codexmate claude <BaseURL> <API_KEY> <model>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
3. Export a local session to Markdown
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
codexmate export-session --source codex --session-id <ID>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Core Commands (Most Used)
|
|
74
|
+
|
|
75
|
+
| Goal | Command |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| Check current status | `codexmate status` |
|
|
78
|
+
| Start Web UI | `codexmate run` |
|
|
79
|
+
| Interactive setup | `codexmate setup` |
|
|
80
|
+
| List providers/models | `codexmate list` / `codexmate models` |
|
|
81
|
+
| Switch provider/model | `codexmate switch <provider>` / `codexmate use <model>` |
|
|
82
|
+
| Write Claude config | `codexmate claude <BaseURL> <API_KEY> [model]` |
|
|
83
|
+
| Export session | `codexmate export-session --source <codex|claude> ...` |
|
|
84
|
+
|
|
85
|
+
## What You Get
|
|
86
|
+
|
|
87
|
+
- One-command provider/model switching
|
|
88
|
+
- Local config control with backups
|
|
89
|
+
- Lightweight Web UI instead of heavy clients
|
|
90
|
+
- Unified session browser (view/export/resume when available)
|
|
91
|
+
- Session management: list/filter/export/delete local sessions; keyword search supports Codex and Claude
|
|
92
|
+
- New in 0.0.10: Claude sessions are searchable by keywords (e.g., `claude code`, `claude-code`, numeric tokens)
|
|
93
|
+
- New in 0.0.14: Skills Manager modal adds overview counters, refined filters, and slimmer list scrollbars
|
|
94
|
+
|
|
95
|
+
## Feature Overview
|
|
96
|
+
|
|
97
|
+
| Module | Problem | Key Capabilities |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| Codex Config | Switching providers/models is painful | Provider/model switching, model management, CLI + Web entry points, template-confirmed writes |
|
|
100
|
+
| Skills Manager | Local custom skills are hard to inspect and clean up | Skills modal with overview counters, keyword/status filters, bulk delete, and cross-app import scan |
|
|
101
|
+
| Claude Code Config | Multiple profiles and inconsistent write paths | Profile management, default write to `~/.claude/settings.json` |
|
|
102
|
+
| OpenClaw Config | OpenClaw configs are scattered | JSON5 profiles, apply to `~/.openclaw/openclaw.json`, AGENTS workspace management |
|
|
103
|
+
| Session Browser | Local sessions are hard to track | List/filter sessions, keyword search (Codex + Claude), export to Markdown, copy resume command (when available), delete and batch cleanup |
|
|
104
|
+
| Utilities | Compression/extraction requires extra tools | 7-Zip preferred, JS fallback |
|
|
105
|
+
|
|
106
|
+
## Why Codex Mate
|
|
107
|
+
|
|
108
|
+
- Focused on three jobs: Codex provider/model switching + Claude Code config apply + OpenClaw config apply
|
|
109
|
+
- Local-first: configs and API keys are written to local files, not the cloud
|
|
110
|
+
- Lightweight: CLI + Web, no desktop app required
|
|
111
|
+
- Reversible: auto-backup before first takeover
|
|
112
|
+
|
|
113
|
+
## Scope and Boundaries
|
|
114
|
+
|
|
115
|
+
- Only configuration management for Codex, Claude Code, and OpenClaw, not a full all-in-one tool suite
|
|
116
|
+
- No built-in proxy/relay/billing dashboard/cloud sync (kept lightweight)
|
|
117
|
+
- Web UI runs only when you start it (`codexmate run`)
|
|
118
|
+
|
|
119
|
+
## Alternatives
|
|
120
|
+
|
|
121
|
+
- cc-switch: https://github.com/farion1231/cc-switch
|
|
122
|
+
|
|
123
|
+
## Install
|
|
124
|
+
|
|
125
|
+
### From Source (Recommended, One Line)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
git clone https://github.com/ymkiux/codexmate.git && cd codexmate && npm install && npm link
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Then verify:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
codexmate status
|
|
135
|
+
codexmate run
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Run with npx (No Install)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npx codexmate@latest status
|
|
142
|
+
npx codexmate@latest run
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Global (npm)
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npm install -g codexmate
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Package name on npm: `codexmate`. If you want the latest repo version each time, install from GitHub:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm install -g ymkiux/codexmate
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Requirements
|
|
158
|
+
|
|
159
|
+
- Node.js >= 14
|
|
160
|
+
- Windows / macOS / Linux
|
|
161
|
+
|
|
162
|
+
## CLI Cheat Sheet
|
|
163
|
+
|
|
164
|
+
| Command | Description |
|
|
165
|
+
| --- | --- |
|
|
166
|
+
| `codexmate` | Show help and available commands |
|
|
167
|
+
| `codexmate setup` | Interactive configuration wizard |
|
|
168
|
+
| `codexmate status` | Show current status |
|
|
169
|
+
| `codexmate list` | List all providers |
|
|
170
|
+
| `codexmate switch <provider>` | Switch provider |
|
|
171
|
+
| `codexmate use <model>` | Switch model |
|
|
172
|
+
| `codexmate add <name> <URL> [API key]` | Add a provider |
|
|
173
|
+
| `codexmate delete <provider>` | Delete a provider |
|
|
174
|
+
| `codexmate claude <BaseURL> <API key> [model]` | Write Claude Code config to `~/.claude/settings.json` |
|
|
175
|
+
| `codexmate models` | List all models |
|
|
176
|
+
| `codexmate add-model <model>` | Add a model |
|
|
177
|
+
| `codexmate delete-model <model>` | Delete a model |
|
|
178
|
+
| `codexmate run` | Start the Web UI |
|
|
179
|
+
| `codexmate mcp [serve] [--transport stdio] [--allow-write\|--read-only]` | Start MCP server over stdio (default read-only) |
|
|
180
|
+
| `codexmate export-session --source <codex|claude> (--session-id <ID>|--file <PATH>) [--output <PATH>] [--max-messages <N|all|Infinity>]` | Export a session to Markdown |
|
|
181
|
+
|
|
182
|
+
## MCP (stdio)
|
|
183
|
+
|
|
184
|
+
- Transport: `stdio` only
|
|
185
|
+
- Default mode: read-only tool set
|
|
186
|
+
- Write tools: enable by `--allow-write` or `CODEXMATE_MCP_ALLOW_WRITE=1`
|
|
187
|
+
- Sensitive fields in `codexmate.claude.settings.get` are returned as masked values
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Read-only (recommended for external agents)
|
|
191
|
+
codexmate mcp serve --read-only
|
|
192
|
+
|
|
193
|
+
# Enable write tools explicitly
|
|
194
|
+
codexmate mcp serve --allow-write
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Provided MCP domains:
|
|
198
|
+
|
|
199
|
+
- `tools`: status/provider/model/session/auth/proxy and config operations
|
|
200
|
+
- `resources`: status/providers/sessions snapshots
|
|
201
|
+
- `prompts`: built-in diagnose/switch/export templates
|
|
202
|
+
|
|
203
|
+
## Web UI
|
|
204
|
+
|
|
205
|
+
Start the Web UI (auto opens browser):
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
codexmate run
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Codex Config Mode
|
|
212
|
+
|
|
213
|
+
- View current provider and model status
|
|
214
|
+
- Quickly switch provider and model
|
|
215
|
+
- Manage available model list
|
|
216
|
+
- Edit `~/.codex/AGENTS.md` instruction file (same level as `config.toml`)
|
|
217
|
+
- Open the Skills Manager modal for `~/.codex/skills` (overview counters, keyword/status filters, multi-select delete, cross-app import scan)
|
|
218
|
+
- Add/delete custom providers
|
|
219
|
+
- Supports Codex config management on Linux/Windows
|
|
220
|
+
|
|
221
|
+
### Skills Manager Modal
|
|
222
|
+
|
|
223
|
+
- Shows overview counters (`total`, `with SKILL.md`, `missing SKILL.md`, `importable`) for quick audit
|
|
224
|
+
- Supports keyword search by folder name/display name/description and status filter by `SKILL.md` presence
|
|
225
|
+
- Supports multi-select and bulk deletion for local skills
|
|
226
|
+
- Supports scanning unmanaged skills from other apps and importing selected items in batch
|
|
227
|
+
|
|
228
|
+
### Claude Code Config Mode (Windows / macOS / Linux)
|
|
229
|
+
|
|
230
|
+
- Manage multiple Claude Code profiles
|
|
231
|
+
- Configure API key, Base URL, and model
|
|
232
|
+
- Default write to `env` in `~/.claude/settings.json`: `env.ANTHROPIC_API_KEY` / `env.ANTHROPIC_BASE_URL` / `env.ANTHROPIC_MODEL`
|
|
233
|
+
- One-liner apply via CLI:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
codexmate claude https://api.example.com/v1 sk-ant-xxx claude-3-7-sonnet
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
- In the Web UI, each Claude configuration card now has a "Share Import Command" button that copies a one-click import command (for example: `codexmate claude <BaseURL> <API Key> <Model>`).
|
|
240
|
+
|
|
241
|
+
### OpenClaw Config Mode
|
|
242
|
+
|
|
243
|
+
- Manage multiple OpenClaw JSON5 profiles
|
|
244
|
+
- Apply to `~/.openclaw/openclaw.json`
|
|
245
|
+
- Manage `AGENTS.md` under the OpenClaw Workspace (default: `~/.openclaw/workspace/AGENTS.md`)
|
|
246
|
+
|
|
247
|
+
### Session Browser
|
|
248
|
+
|
|
249
|
+
- View local Codex and Claude Code sessions in one page
|
|
250
|
+
- Filter by source (Codex / Claude / All)
|
|
251
|
+
- Filter by session path (cwd), auto refresh on selection
|
|
252
|
+
- Export selected sessions to Markdown
|
|
253
|
+
- Copy resume command when available
|
|
254
|
+
- Delete single sessions (local jsonl records)
|
|
255
|
+
- Batch delete multiple sessions with partial failure summary
|
|
256
|
+
- Delete individual records or multi-select within session details (writes back to original jsonl)
|
|
257
|
+
|
|
258
|
+
### Codex Template Confirmation Mode
|
|
259
|
+
|
|
260
|
+
- Codex config changes in Web UI go to a `config.toml` template editor first
|
|
261
|
+
- Only writes to `config.toml` after you click "Confirm Apply Template"
|
|
262
|
+
- Prevents direct one-click overwrites from the UI
|
|
263
|
+
|
|
264
|
+
## Configuration Files
|
|
265
|
+
|
|
266
|
+
Config directory: `~/.codex/`
|
|
267
|
+
|
|
268
|
+
- `config.toml` - Codex main config
|
|
269
|
+
- `auth.json` - API auth info
|
|
270
|
+
- `models.json` - Available model list
|
|
271
|
+
- `provider-current-models.json` - Per-provider current model config
|
|
272
|
+
- `codexmate-init.json` - First-run marker
|
|
273
|
+
- `config.toml.codexmate-backup-*.bak` - Backup created on first takeover
|
|
274
|
+
|
|
275
|
+
Claude Code config files:
|
|
276
|
+
|
|
277
|
+
- `~/.claude/settings.json` - Runtime config (default write target)
|
|
278
|
+
- `~/.claude/settings.json.codexmate-backup-*.bak` - Backup before first overwrite
|
|
279
|
+
|
|
280
|
+
OpenClaw config files:
|
|
281
|
+
|
|
282
|
+
- `~/.openclaw/openclaw.json` - OpenClaw config (JSON5)
|
|
283
|
+
- `~/.openclaw/workspace/AGENTS.md` - OpenClaw workspace instructions
|
|
284
|
+
|
|
285
|
+
## First Run Initialization
|
|
286
|
+
|
|
287
|
+
When you run `codexmate` for the first time and an existing `~/.codex/config.toml` is detected that is not managed by Codex Mate:
|
|
288
|
+
|
|
289
|
+
- The original file is backed up as `config.toml.codexmate-backup-<timestamp>.bak`
|
|
290
|
+
- The original `config.toml` is preserved, and a first-run marker is written
|
|
291
|
+
- Only when `CODEXMATE_FORCE_RESET_EXISTING_CONFIG=1` is set will the default config be rebuilt
|
|
292
|
+
- Subsequent runs will not repeat this process
|
|
293
|
+
|
|
294
|
+
## Examples
|
|
295
|
+
|
|
296
|
+
### Add a Custom API Provider
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
codexmate add myapi https://api.example.com/v1 sk-your-api-key
|
|
300
|
+
codexmate switch myapi
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Switch to a Different Model
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
codexmate use gpt-4-turbo
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Export a Session (CLI)
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
codexmate export-session --source codex --session-id 123456
|
|
313
|
+
codexmate export-session --source claude --file "~/.claude/projects/demo/session.jsonl" --max-messages=all
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
By default, exports are capped at 1000 messages. Use `--max-messages=all` (or `Infinity`) to export everything.
|
|
317
|
+
|
|
318
|
+
### Configure Claude Code (Cross-Platform)
|
|
319
|
+
|
|
320
|
+
1. Start the Web UI: `codexmate run`
|
|
321
|
+
2. Switch to "Claude Code Config" mode in the browser
|
|
322
|
+
3. Add a profile (example Zhipu GLM): Name=ZhipuGLM, API Key=your API key, Base URL=`https://open.bigmodel.cn/api/anthropic`, Model=`glm-4.7`
|
|
323
|
+
4. Click the card to apply, or use "Save & Apply to Claude Config" in the editor
|
|
324
|
+
5. Default write to `~/.claude/settings.json`
|
|
325
|
+
6. Restart Claude Code to apply
|
|
326
|
+
|
|
327
|
+
### Start the Web UI
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
codexmate run
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
By default it binds to `127.0.0.1`. To expose on LAN, use `--host` or `CODEXMATE_HOST`:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
codexmate run --host 0.0.0.0
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Then open `http://localhost:3737` (or your chosen host). Note: binding to `0.0.0.0` is unsafe on untrusted networks.
|
|
340
|
+
|
|
341
|
+
## FAQ
|
|
342
|
+
|
|
343
|
+
### Q: Which operating systems are supported?
|
|
344
|
+
|
|
345
|
+
A: Codex features support Windows and Linux (CLI and Web). Claude Code config applies to Windows / macOS / Linux (writes to `~/.claude/settings.json`).
|
|
346
|
+
|
|
347
|
+
### Q: Where are API keys stored?
|
|
348
|
+
|
|
349
|
+
A: API keys are stored locally in `~/.codex/config.toml` and are not uploaded.
|
|
350
|
+
|
|
351
|
+
### Q: Is the Web UI safe?
|
|
352
|
+
|
|
353
|
+
A: The Web UI runs locally; all operations happen on your machine. API keys are masked in the UI.
|
|
354
|
+
|
|
355
|
+
### Q: How do Claude Code configs take effect?
|
|
356
|
+
|
|
357
|
+
A: After clicking "Apply to Claude Config", it writes to `~/.claude/settings.json`. Restart Claude Code to apply.
|
|
358
|
+
|
|
359
|
+
### Q: How to uninstall?
|
|
360
|
+
|
|
361
|
+
A: Run `npm uninstall -g codexmate`.
|
|
362
|
+
|
|
363
|
+
## Extras: Compression/Extraction
|
|
364
|
+
|
|
365
|
+
Prefer 7-Zip for multithreaded zip/unzip. Fallback to the built-in JS library when unavailable.
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# Compress file or folder (default compression level 5)
|
|
369
|
+
codexmate zip <path>
|
|
370
|
+
|
|
371
|
+
# Set compression level (0-9, 0=store only, 9=max)
|
|
372
|
+
codexmate zip <path> --max:9
|
|
373
|
+
|
|
374
|
+
# Unzip a zip file (default to same-level folder)
|
|
375
|
+
codexmate unzip <zip path>
|
|
376
|
+
|
|
377
|
+
# Unzip to a specific output directory
|
|
378
|
+
codexmate unzip <zip path> <output dir>
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Examples:
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# Compress a project folder
|
|
385
|
+
codexmate zip ./my-project
|
|
386
|
+
|
|
387
|
+
# Max compression
|
|
388
|
+
codexmate zip ./my-project --max:9
|
|
389
|
+
|
|
390
|
+
# Store only (fast)
|
|
391
|
+
codexmate zip ./large-folder --max:0
|
|
392
|
+
|
|
393
|
+
# Unzip
|
|
394
|
+
codexmate unzip ./my-project.zip
|
|
395
|
+
|
|
396
|
+
# Unzip to a target location
|
|
397
|
+
codexmate unzip ./backup.zip D:/restored
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Note: 7-Zip is optional. If missing, the built-in JS library is used. `--max` only applies to 7-Zip.
|
|
401
|
+
|
|
402
|
+
## Tech Stack
|
|
403
|
+
|
|
404
|
+
- **Node.js** - Runtime
|
|
405
|
+
- **@iarna/toml** - TOML parser
|
|
406
|
+
- **Vue.js 3** - Web UI framework
|
|
407
|
+
- **Native HTTP** - Built-in Web server
|
|
408
|
+
|
|
409
|
+
## Release (GitHub Actions)
|
|
410
|
+
|
|
411
|
+
Create a tag that matches `package.json` (for example `v0.0.14`). Then run the `release` workflow in GitHub Actions and input that tag. It will create a GitHub Release and attach the `npm pack` `.tgz` artifact.
|
|
412
|
+
|
|
413
|
+
## License
|
|
414
|
+
|
|
415
|
+
Apache-2.0 © [ymkiux](https://github.com/ymkiux)
|
|
416
|
+
|
|
417
|
+
## Contributing
|
|
418
|
+
|
|
419
|
+
Issues and pull requests are welcome.
|
|
420
|
+
|
|
421
|
+
## Changelog
|
|
422
|
+
|
|
423
|
+
See [doc/CHANGELOG.md](doc/CHANGELOG.md) for the English version.
|
|
424
|
+
See [doc/CHANGELOG.zh-CN.md](doc/CHANGELOG.zh-CN.md) for the Chinese version.
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
Made with [ymkiux](https://github.com/ymkiux)
|
|
429
|
+
|