@jojonax/codex-copilot 1.5.3 → 1.6.0
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/LICENSE +21 -21
- package/README.md +144 -44
- package/bin/cli.js +189 -182
- package/package.json +39 -39
- package/src/commands/evolve.js +316 -316
- package/src/commands/fix.js +447 -399
- package/src/commands/init.js +298 -298
- package/src/commands/reset.js +61 -61
- package/src/commands/retry.js +190 -153
- package/src/commands/run.js +958 -905
- package/src/commands/skip.js +62 -62
- package/src/commands/status.js +95 -95
- package/src/commands/usage.js +361 -361
- package/src/utils/automator.js +279 -279
- package/src/utils/checkpoint.js +246 -160
- package/src/utils/detect-prd.js +137 -137
- package/src/utils/git.js +388 -133
- package/src/utils/github.js +486 -429
- package/src/utils/json.js +220 -197
- package/src/utils/logger.js +41 -41
- package/src/utils/prompt.js +49 -49
- package/src/utils/provider.js +770 -769
- package/src/utils/self-heal.js +330 -0
- package/src/utils/shell-bootstrap.js +404 -0
- package/src/utils/update-check.js +103 -103
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Jonas Qin
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jonas Qin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
# Codex-Copilot 🤖
|
|
2
2
|
|
|
3
|
-
**PRD-driven automated development orchestrator
|
|
3
|
+
**PRD-driven automated development orchestrator — works with any AI coding tool**
|
|
4
4
|
|
|
5
|
-
Turn your PRD into working code — automatically. Codex-Copilot reads your product requirement docs,
|
|
5
|
+
Turn your PRD into working code — automatically. Codex-Copilot reads your product requirement docs, decomposes them into tasks, drives your AI coding tool to develop each feature, submits PRs, waits for AI code review, fixes issues, and merges — all in a fully automated loop.
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
PRD → Tasks →
|
|
8
|
+
PRD → Tasks → AI Dev → PR → AI Review → Fix → Merge → Next Task → Evolve → Repeat
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Supported AI Providers
|
|
12
|
+
|
|
13
|
+
| Provider | Mode | How it works |
|
|
14
|
+
|----------|------|-------------|
|
|
15
|
+
| **Codex CLI** | Full-auto | Pipes prompt via stdin (`codex exec --full-auto`) |
|
|
16
|
+
| **Claude Code** | Full-auto | `-p` mode with `--allowedTools` permissions |
|
|
17
|
+
| **Cursor Agent** | Full-auto | Headless `-p` mode |
|
|
18
|
+
| **Gemini CLI** | Full-auto | Non-interactive `-p` prompt execution |
|
|
19
|
+
| **Codex Desktop** | Auto-paste | Detects running IDE, auto-pastes prompt |
|
|
20
|
+
| **Cursor IDE** | Auto-paste | Detects running IDE, auto-pastes prompt |
|
|
21
|
+
| **Antigravity** | Auto-paste | Detects running IDE, auto-pastes prompt |
|
|
22
|
+
|
|
11
23
|
## Quick Start
|
|
12
24
|
|
|
13
25
|
```bash
|
|
@@ -18,7 +30,7 @@ npm install -g @jojonax/codex-copilot
|
|
|
18
30
|
npx @jojonax/codex-copilot
|
|
19
31
|
|
|
20
32
|
# In your project directory:
|
|
21
|
-
codex-copilot init # Detect PRD, generate task queue
|
|
33
|
+
codex-copilot init # Detect PRD, choose AI provider, generate task queue
|
|
22
34
|
codex-copilot run # Start the automated dev loop
|
|
23
35
|
```
|
|
24
36
|
|
|
@@ -27,49 +39,95 @@ codex-copilot run # Start the automated dev loop
|
|
|
27
39
|
### 1. `codex-copilot init`
|
|
28
40
|
|
|
29
41
|
- 🔍 **Auto-detects PRD** files in your project (by filename, size, content keywords)
|
|
30
|
-
-
|
|
42
|
+
- 🤖 **Multi-provider selection** — detects installed AI tools with version info and update status
|
|
43
|
+
- 📋 Generates a task decomposition prompt and invokes the AI to create `tasks.json`
|
|
31
44
|
- 🗂️ Creates `.codex-copilot/` with config, state, and instructions
|
|
32
45
|
|
|
33
|
-
### 2.
|
|
34
|
-
|
|
35
|
-
- Paste the generated prompt into CodeX desktop (or use CodeX CLI if available)
|
|
36
|
-
- CodeX breaks down your PRD into ordered, independent tasks → `tasks.json`
|
|
37
|
-
|
|
38
|
-
### 3. `codex-copilot run`
|
|
46
|
+
### 2. `codex-copilot run`
|
|
39
47
|
|
|
40
48
|
Loops through each task in 4 phases:
|
|
41
49
|
|
|
42
50
|
| Phase | What Happens |
|
|
43
51
|
|-------|-------------|
|
|
44
|
-
| **1. Develop** | Creates feature branch, generates dev prompt,
|
|
45
|
-
| **2. PR** | Auto commits, pushes, creates GitHub PR
|
|
46
|
-
| **3. Review** | Polls for AI review
|
|
52
|
+
| **1. Develop** | Creates feature branch, generates dev prompt, executes via AI provider |
|
|
53
|
+
| **2. PR** | Auto commits, pushes, creates GitHub PR with recovery handling |
|
|
54
|
+
| **3. Review** | Polls for AI review, classifies feedback, determines actionability |
|
|
47
55
|
| **4. Merge** | Squash merges after approval, moves to next task |
|
|
48
56
|
|
|
49
|
-
###
|
|
57
|
+
### 3. `codex-copilot evolve`
|
|
58
|
+
|
|
59
|
+
Multi-round PRD iteration — the killer feature:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Run completes → Archive round → Gap analysis against PRD →
|
|
63
|
+
Plan next batch → Generate new tasks.json → Auto-start next round
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Evolve compares completed features against the full PRD, identifies gaps, plans the next batch of 8-15 tasks, and automatically starts execution. Rounds continue until the PRD is fully implemented.
|
|
67
|
+
|
|
68
|
+
### All Commands
|
|
50
69
|
|
|
51
70
|
```bash
|
|
52
|
-
codex-copilot
|
|
53
|
-
codex-copilot
|
|
71
|
+
codex-copilot init # Initialize project (auto-detect PRD, generate task queue)
|
|
72
|
+
codex-copilot run # Start automated development loop
|
|
73
|
+
codex-copilot status # View current task progress with progress bar
|
|
74
|
+
codex-copilot evolve # Start next PRD iteration round (gap analysis → plan → run)
|
|
75
|
+
codex-copilot retry # Retry blocked tasks with enhanced prompts
|
|
76
|
+
codex-copilot skip <id> # Force-skip a task to unblock dependents
|
|
77
|
+
codex-copilot usage # Show AI token usage across all providers
|
|
78
|
+
codex-copilot fix # Repair corrupted project files + git state
|
|
79
|
+
codex-copilot reset # Reset state and start over
|
|
80
|
+
codex-copilot update # Update to latest version
|
|
54
81
|
```
|
|
55
82
|
|
|
56
83
|
## Prerequisites
|
|
57
84
|
|
|
58
|
-
| Tool | Install |
|
|
59
|
-
|
|
60
|
-
| Node.js ≥ 18 | `brew install node` |
|
|
61
|
-
| GitHub CLI | `brew install gh && gh auth login` |
|
|
62
|
-
|
|
|
63
|
-
|
|
|
85
|
+
| Tool | Required | Install |
|
|
86
|
+
|------|----------|---------|
|
|
87
|
+
| Node.js ≥ 18 | ✅ | `brew install node` / [nodejs.org](https://nodejs.org) |
|
|
88
|
+
| GitHub CLI | ✅ | `brew install gh && gh auth login` / [cli.github.com](https://cli.github.com) |
|
|
89
|
+
| Git | ✅ | Auto-installed on Windows if missing (see below) |
|
|
90
|
+
| AI Code Review bot | Recommended | [Gemini Code Assist](https://github.com/marketplace/gemini-code-assist) or similar |
|
|
91
|
+
| Any AI coding tool | ✅ | Codex / Claude / Cursor / Gemini CLI |
|
|
92
|
+
|
|
93
|
+
### Windows Support
|
|
94
|
+
|
|
95
|
+
Codex-Copilot uses POSIX shell commands internally. On Windows, it **automatically detects and configures** Git for Windows:
|
|
96
|
+
|
|
97
|
+
1. Checks if `sh` is already in PATH
|
|
98
|
+
2. Scans common Git installation paths (Program Files, Scoop, Chocolatey)
|
|
99
|
+
3. Discovers via `where git` and `GIT_INSTALL_ROOT` environment variable
|
|
100
|
+
4. If not found, **offers to auto-install** Git for Windows via `winget` or direct download
|
|
101
|
+
5. After installation, refreshes PATH from the Windows registry — no terminal restart needed
|
|
64
102
|
|
|
65
103
|
## Features
|
|
66
104
|
|
|
105
|
+
### Core Automation
|
|
67
106
|
- **🔍 Smart PRD Detection** — scans project dirs, scores candidates by filename pattern + content analysis
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
107
|
+
- **🤖 7 AI Providers** — full-auto CLI execution or auto-paste for desktop IDEs
|
|
108
|
+
- **🔄 Multi-Round Evolution** — gap analysis + re-planning across unlimited rounds until PRD is fully built
|
|
109
|
+
- **📋 AI Review Classification** — uses AI to determine if review feedback is actionable vs informational
|
|
110
|
+
|
|
111
|
+
### Reliability
|
|
112
|
+
- **💾 Fine-Grained Checkpoints** — resumes from exact sub-step (branch created? prompt generated? AI complete?)
|
|
113
|
+
- **🔧 Self-Healing** — pre-flight checks, auto-repair corrupted JSON, git state recovery
|
|
114
|
+
- **🔁 Auto-Retry** — blocked tasks automatically retry on next run with preserved branches
|
|
115
|
+
- **⏱️ Rate Limit Recovery** — detects rate limits, waits for reset, auto-resumes
|
|
116
|
+
- **🛡️ Quota Guard** — checks weekly quota before execution, stops if threshold exceeded
|
|
117
|
+
- **⏰ AI Timeout Protection** — 30-minute timeout prevents infinite hangs
|
|
118
|
+
|
|
119
|
+
### Developer Experience
|
|
120
|
+
- **📊 Multi-Provider Usage Dashboard** — token breakdown for Codex, Claude, Cursor with cache rates and quota tracking
|
|
121
|
+
- **🔧 File Repair Tool** — deep JSON corruption recovery + git state healing (locks, detached HEAD, stale indexes)
|
|
122
|
+
- **📋 Clipboard Integration** — auto-copies prompts on macOS (pbcopy), Linux (xclip/xsel), and Windows (clip)
|
|
123
|
+
- **🪟 Windows Auto-Bootstrap** — auto-detects or installs Git for Windows, no manual PATH configuration needed
|
|
124
|
+
- **⚙️ Configurable** — timeouts, branch patterns, review rounds, quota thresholds, auto-evolve toggle
|
|
125
|
+
|
|
126
|
+
### Git & PR Management
|
|
127
|
+
- **🔀 Auto Branch Management** — creates feature branches, handles checkout failures gracefully
|
|
128
|
+
- **📝 PR with Recovery** — creates PR → finds existing → fixes remote → retry (multi-level fallback)
|
|
129
|
+
- **🔍 Re-Review Requests** — automatically requests fresh review after fix pushes
|
|
130
|
+
- **🔒 Private Repo Aware** — adds `[skip ci]` to commits in private repos to save CI minutes
|
|
73
131
|
|
|
74
132
|
## Configuration
|
|
75
133
|
|
|
@@ -77,47 +135,89 @@ After `init`, edit `.codex-copilot/config.json`:
|
|
|
77
135
|
|
|
78
136
|
```json
|
|
79
137
|
{
|
|
138
|
+
"provider": "codex-cli",
|
|
80
139
|
"base_branch": "main",
|
|
81
140
|
"max_review_rounds": 2,
|
|
82
141
|
"review_poll_interval": 60,
|
|
83
|
-
"review_wait_timeout": 600
|
|
142
|
+
"review_wait_timeout": 600,
|
|
143
|
+
"weekly_quota_threshold": 97,
|
|
144
|
+
"auto_evolve": true
|
|
84
145
|
}
|
|
85
146
|
```
|
|
86
147
|
|
|
148
|
+
| Field | Default | Description |
|
|
149
|
+
|-------|---------|-------------|
|
|
150
|
+
| `provider` | `codex-cli` | AI provider ID (see Supported Providers) |
|
|
151
|
+
| `base_branch` | `main` | Branch to create feature branches from |
|
|
152
|
+
| `max_review_rounds` | `2` | Max review-fix cycles per task (hard cap: 5) |
|
|
153
|
+
| `review_poll_interval` | `60` | Seconds between review status checks |
|
|
154
|
+
| `review_wait_timeout` | `600` | Max seconds to wait for initial review |
|
|
155
|
+
| `weekly_quota_threshold` | `97` | Stop execution when weekly quota exceeds this % |
|
|
156
|
+
| `auto_evolve` | `true` | Auto-start next round after all tasks complete |
|
|
157
|
+
|
|
87
158
|
## Project Structure
|
|
88
159
|
|
|
89
160
|
```
|
|
90
|
-
.codex-copilot/
|
|
91
|
-
├── config.json
|
|
92
|
-
├── state.json
|
|
93
|
-
├── tasks.json
|
|
94
|
-
├──
|
|
95
|
-
|
|
161
|
+
.codex-copilot/ # Created in your project
|
|
162
|
+
├── config.json # Settings (provider, branch, timeouts)
|
|
163
|
+
├── state.json # Checkpoint state (auto-managed)
|
|
164
|
+
├── tasks.json # Current round's task queue
|
|
165
|
+
├── rounds.json # Multi-round evolution history
|
|
166
|
+
├── tasks_round_N.json # Archived task queues from previous rounds
|
|
167
|
+
├── codex-instructions.md # AI system prompt
|
|
168
|
+
├── parse-prd-prompt.md # PRD decomposition prompt
|
|
169
|
+
├── evolve-prompt.md # Gap analysis prompt (auto-generated)
|
|
170
|
+
└── _current_prompt.md # Active prompt (auto-copied to clipboard)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Architecture
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
CLI Entry (bin/cli.js)
|
|
177
|
+
├── Shell Bootstrap ──── Auto-detect/install sh on Windows
|
|
178
|
+
├── init ─────────────── PRD detection → Provider selection → Task decomposition
|
|
179
|
+
├── run ──────────────── 4-phase loop: Develop → PR → Review → Merge
|
|
180
|
+
│ ├── Provider ────── Execute via CLI (piped) or IDE (auto-paste/clipboard)
|
|
181
|
+
│ ├── Git ─────────── Branch, commit, push, checkout
|
|
182
|
+
│ ├── GitHub ──────── PR create/find, review polling, feedback collection
|
|
183
|
+
│ ├── Checkpoint ──── Fine-grained resume (task → phase → step)
|
|
184
|
+
│ └── Self-Heal ───── Pre-flight checks, lock cleanup, index repair
|
|
185
|
+
├── evolve ───────────── Archive round → Gap analysis → Plan next → Auto-run
|
|
186
|
+
├── usage ────────────── Multi-provider token/quota dashboard
|
|
187
|
+
└── fix ──────────────── JSON schema repair + git state recovery
|
|
96
188
|
```
|
|
97
189
|
|
|
98
190
|
## How the Review Loop Works
|
|
99
191
|
|
|
100
192
|
```
|
|
101
|
-
|
|
193
|
+
AI develops feature
|
|
194
|
+
↓
|
|
195
|
+
Push + Create PR (with multi-level recovery)
|
|
102
196
|
↓
|
|
103
|
-
|
|
197
|
+
Wait for AI Review (polling + proactive checks)
|
|
104
198
|
↓
|
|
105
|
-
|
|
199
|
+
Classify feedback via AI (pass/fix/ambiguous)
|
|
106
200
|
↓
|
|
107
|
-
┌─
|
|
108
|
-
└─
|
|
201
|
+
┌─ PASS → Merge → Next Task
|
|
202
|
+
└─ FIX → Collect specific feedback
|
|
109
203
|
↓
|
|
110
|
-
Generate fix prompt →
|
|
204
|
+
Generate targeted fix prompt → AI fixes
|
|
111
205
|
↓
|
|
112
|
-
Push →
|
|
206
|
+
Push → Request re-review → Wait
|
|
113
207
|
↓
|
|
114
|
-
(
|
|
208
|
+
(auto-extends up to 5 rounds, then blocks for human)
|
|
115
209
|
```
|
|
116
210
|
|
|
117
211
|
## Roadmap
|
|
118
212
|
|
|
213
|
+
- [x] Multi-provider support (Codex, Claude, Cursor, Gemini, IDE auto-paste)
|
|
214
|
+
- [x] Multi-round PRD evolution with gap analysis
|
|
215
|
+
- [x] AI-powered review classification
|
|
216
|
+
- [x] Rate limit detection and auto-recovery
|
|
217
|
+
- [x] Quota pre-check and protection
|
|
218
|
+
- [x] Self-healing file repair and git state recovery
|
|
219
|
+
- [x] Cross-platform support (macOS, Linux, Windows)
|
|
119
220
|
- [ ] Support for more AI review tools (CodeRabbit, GitHub Copilot Review)
|
|
120
|
-
- [ ] Built-in task decomposition (no manual CodeX step)
|
|
121
221
|
- [ ] Web dashboard for monitoring multiple projects
|
|
122
222
|
- [ ] GitHub Action for fully server-side automation
|
|
123
223
|
- [ ] Support for monorepo / multi-package projects
|