cxg-workflow 0.1.2
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 -0
- package/README.md +266 -0
- package/README.zh-CN.md +266 -0
- package/bin/cxg.mjs +2 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +47 -0
- package/dist/index.d.mts +133 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.mjs +6 -0
- package/dist/shared/cxg-workflow.BdjkxkKP.mjs +701 -0
- package/package.json +68 -0
- package/templates/prompts/cxg-analyze.md +94 -0
- package/templates/prompts/cxg-commit.md +88 -0
- package/templates/prompts/cxg-debug.md +111 -0
- package/templates/prompts/cxg-enhance.md +83 -0
- package/templates/prompts/cxg-execute.md +74 -0
- package/templates/prompts/cxg-feat.md +85 -0
- package/templates/prompts/cxg-init.md +96 -0
- package/templates/prompts/cxg-optimize.md +88 -0
- package/templates/prompts/cxg-plan.md +116 -0
- package/templates/prompts/cxg-review.md +99 -0
- package/templates/prompts/cxg-test.md +72 -0
- package/templates/prompts/cxg-workflow.md +154 -0
- package/templates/roles/codex/analyzer.md +50 -0
- package/templates/roles/codex/architect.md +46 -0
- package/templates/roles/codex/reviewer.md +70 -0
- package/templates/skills/cxg/analyze/SKILL.md +60 -0
- package/templates/skills/cxg/commit/SKILL.md +53 -0
- package/templates/skills/cxg/debug/SKILL.md +63 -0
- package/templates/skills/cxg/enhance/SKILL.md +42 -0
- package/templates/skills/cxg/execute/SKILL.md +51 -0
- package/templates/skills/cxg/feat/SKILL.md +62 -0
- package/templates/skills/cxg/init/SKILL.md +44 -0
- package/templates/skills/cxg/optimize/SKILL.md +59 -0
- package/templates/skills/cxg/plan/SKILL.md +70 -0
- package/templates/skills/cxg/review/SKILL.md +55 -0
- package/templates/skills/cxg/test/SKILL.md +44 -0
- package/templates/skills/cxg/workflow/SKILL.md +108 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 fengshao1227
|
|
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
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# CXG - Codex Single-Model Structured Workflow
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
English | [简体中文](./README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
CXG is a Codex-first workflow package for Codex CLI. It installs a structured set of slash commands, skills, role prompts, and a `codeagent-wrapper` binary so Codex can handle research, planning, execution, optimization, and review in a consistent single-model workflow.
|
|
10
|
+
|
|
11
|
+
> Note: CXG is a Codex-only simplified derivative of [`ccg-workflow`](https://github.com/fengshao1227/ccg-workflow). It keeps the structured workflow and wrapper-based orchestration ideas from the original project, while narrowing the scope to a leaner single-model experience built around Codex.
|
|
12
|
+
|
|
13
|
+
## Why CXG?
|
|
14
|
+
|
|
15
|
+
- **Derived from `ccg-workflow`**: preserves the original workflow philosophy while simplifying it into a Codex-only package.
|
|
16
|
+
- **Single-model by design**: no routing between different models, only Codex orchestration plus Codex subprocess roles.
|
|
17
|
+
- **Structured delivery**: the main workflow follows `research -> plan -> execute -> optimize -> review`.
|
|
18
|
+
- **Reusable expert roles**: built-in `analyzer`, `architect`, and `reviewer` role prompts drive subprocess work.
|
|
19
|
+
- **Optional code retrieval**: supports `ace-tool`, can be prepared for `contextweaver`, and falls back to `Glob + Grep` when MCP is skipped.
|
|
20
|
+
- **Ready-to-use slash commands**: installs 12 commands directly into `~/.codex/prompts/`.
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
Codex CLI
|
|
26
|
+
|
|
|
27
|
+
+-- /cxg-* custom prompts
|
|
28
|
+
|
|
|
29
|
+
+-- skills/cxg/*
|
|
30
|
+
|
|
|
31
|
+
+-- codeagent-wrapper
|
|
32
|
+
|
|
|
33
|
+
+-- Codex subprocess (analyzer / architect / reviewer)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The main Codex session orchestrates the workflow. Subprocesses are used for focused analysis, planning, and review, then their output is fed back into the main session.
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Prerequisites
|
|
41
|
+
|
|
42
|
+
| Dependency | Required | Notes |
|
|
43
|
+
|------------|----------|-------|
|
|
44
|
+
| Node.js | Yes | Node.js 18+ recommended for modern ESM and built-in `fetch` |
|
|
45
|
+
| Codex CLI | Yes | CXG installs commands into `~/.codex/` for Codex CLI to use |
|
|
46
|
+
| GitHub Releases access | Yes | `init` downloads `codeagent-wrapper` during installation |
|
|
47
|
+
| ace-tool | No | Optional MCP retrieval provider |
|
|
48
|
+
| ContextWeaver | No | Optional MCP retrieval provider, requires manual setup |
|
|
49
|
+
|
|
50
|
+
### Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx cxg-workflow init
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Useful variants:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# overwrite existing CXG files
|
|
60
|
+
npx cxg-workflow init --force
|
|
61
|
+
|
|
62
|
+
# install without WebUI-related wrapper behavior
|
|
63
|
+
npx cxg-workflow init --lite
|
|
64
|
+
|
|
65
|
+
# configure ace-tool in ~/.codex/config.toml
|
|
66
|
+
npx cxg-workflow init --mcp ace-tool
|
|
67
|
+
|
|
68
|
+
# skip MCP and use filesystem search fallback
|
|
69
|
+
npx cxg-workflow init --skip-mcp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
After installation, open Codex CLI and invoke commands as slash commands such as:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
/cxg-workflow implement user authentication
|
|
76
|
+
/cxg-plan refactor payment service
|
|
77
|
+
/cxg-review
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Verify Installation
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npx cxg-workflow doctor
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Uninstall
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx cxg-workflow uninstall
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Commands
|
|
93
|
+
|
|
94
|
+
### Core Workflow
|
|
95
|
+
|
|
96
|
+
| Command | Description |
|
|
97
|
+
|---------|-------------|
|
|
98
|
+
| `/cxg-workflow` | Full 5-phase structured workflow |
|
|
99
|
+
| `/cxg-plan` | Generate an implementation plan |
|
|
100
|
+
| `/cxg-execute` | Execute an approved plan file |
|
|
101
|
+
|
|
102
|
+
### Development
|
|
103
|
+
|
|
104
|
+
| Command | Description |
|
|
105
|
+
|---------|-------------|
|
|
106
|
+
| `/cxg-feat` | Smart feature development |
|
|
107
|
+
| `/cxg-analyze` | Technical analysis without code changes |
|
|
108
|
+
| `/cxg-debug` | Diagnose and fix problems |
|
|
109
|
+
| `/cxg-optimize` | Performance and resource optimization |
|
|
110
|
+
|
|
111
|
+
### Quality
|
|
112
|
+
|
|
113
|
+
| Command | Description |
|
|
114
|
+
|---------|-------------|
|
|
115
|
+
| `/cxg-test` | Test design and generation |
|
|
116
|
+
| `/cxg-review` | Quality and security review |
|
|
117
|
+
| `/cxg-enhance` | Turn vague requests into structured tasks |
|
|
118
|
+
|
|
119
|
+
### Delivery And Bootstrap
|
|
120
|
+
|
|
121
|
+
| Command | Description |
|
|
122
|
+
|---------|-------------|
|
|
123
|
+
| `/cxg-commit` | Generate Conventional Commit messages |
|
|
124
|
+
| `/cxg-init` | Generate project `AGENTS.md` context docs |
|
|
125
|
+
|
|
126
|
+
## Workflow Guides
|
|
127
|
+
|
|
128
|
+
### Planning And Execution Separation
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# 1. Generate the plan
|
|
132
|
+
/cxg-plan implement user authentication
|
|
133
|
+
|
|
134
|
+
# 2. Review and adjust the generated plan
|
|
135
|
+
# plan file is saved under .codex/plan/
|
|
136
|
+
|
|
137
|
+
# 3. Execute the approved plan
|
|
138
|
+
/cxg-execute .codex/plan/user-auth.md
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Full Workflow For Larger Tasks
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
/cxg-workflow implement invoice export with audit logging
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Use the full workflow when the task spans multiple modules, needs tradeoff analysis, or should go through an explicit optimization and review phase.
|
|
148
|
+
|
|
149
|
+
### Initialize Project Context
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
/cxg-init build a modular AGENTS.md for this repository
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
This command generates root-level and module-level `AGENTS.md` files using a "concise at root, detailed by module" strategy.
|
|
156
|
+
|
|
157
|
+
## Configuration
|
|
158
|
+
|
|
159
|
+
### Installed Layout
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
~/.codex/
|
|
163
|
+
├── prompts/
|
|
164
|
+
│ ├── cxg-workflow.md
|
|
165
|
+
│ ├── cxg-plan.md
|
|
166
|
+
│ └── ...
|
|
167
|
+
├── skills/
|
|
168
|
+
│ └── cxg/
|
|
169
|
+
│ ├── workflow/SKILL.md
|
|
170
|
+
│ ├── plan/SKILL.md
|
|
171
|
+
│ └── ...
|
|
172
|
+
├── bin/
|
|
173
|
+
│ └── codeagent-wrapper
|
|
174
|
+
├── config.toml # Codex MCP config when ace-tool is enabled
|
|
175
|
+
└── .cxg/
|
|
176
|
+
├── config.toml
|
|
177
|
+
└── roles/
|
|
178
|
+
└── codex/
|
|
179
|
+
├── analyzer.md
|
|
180
|
+
├── architect.md
|
|
181
|
+
└── reviewer.md
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### CXG Config
|
|
185
|
+
|
|
186
|
+
CXG stores its own state in `~/.codex/.cxg/config.toml`, including:
|
|
187
|
+
|
|
188
|
+
- installed command list
|
|
189
|
+
- wrapper path
|
|
190
|
+
- role prompt paths
|
|
191
|
+
- selected MCP provider
|
|
192
|
+
- whether `--lite` mode was used
|
|
193
|
+
|
|
194
|
+
### MCP Options
|
|
195
|
+
|
|
196
|
+
**`ace-tool`**
|
|
197
|
+
|
|
198
|
+
- Install with `npx cxg-workflow init --mcp ace-tool`
|
|
199
|
+
- CXG writes the MCP server entry into `~/.codex/config.toml`
|
|
200
|
+
- Prompt templates use `mcp__ace-tool__search_context`
|
|
201
|
+
|
|
202
|
+
**`contextweaver`**
|
|
203
|
+
|
|
204
|
+
- Select with `npx cxg-workflow init --mcp contextweaver`
|
|
205
|
+
- CXG records the provider and prints manual setup guidance
|
|
206
|
+
- You still need to install `contextweaver` yourself and configure `~/.contextweaver/.env`
|
|
207
|
+
|
|
208
|
+
**`skip`**
|
|
209
|
+
|
|
210
|
+
- Default behavior
|
|
211
|
+
- Prompt templates fall back to filesystem search via `Glob + Grep`
|
|
212
|
+
|
|
213
|
+
## Supported Platforms
|
|
214
|
+
|
|
215
|
+
`codeagent-wrapper` binaries are resolved per platform and architecture:
|
|
216
|
+
|
|
217
|
+
- macOS `arm64` / `amd64`
|
|
218
|
+
- Linux `arm64` / `amd64`
|
|
219
|
+
- Windows `arm64` / `amd64`
|
|
220
|
+
|
|
221
|
+
## GitHub CI/CD
|
|
222
|
+
|
|
223
|
+
CXG can use GitHub Actions for both CI and npm release automation:
|
|
224
|
+
|
|
225
|
+
- `CI`: runs on every push and pull request to `main`, executing `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build` on Node.js 20 and 22.
|
|
226
|
+
- `Publish to npm`: runs when a Git tag matching `v*.*.*` is pushed. The workflow verifies that the tag matches `package.json`, reruns validation, and publishes the package to npm as `public` with provenance enabled.
|
|
227
|
+
|
|
228
|
+
Required repository secret:
|
|
229
|
+
|
|
230
|
+
- `NPM_TOKEN`: npm automation token with publish access to the `cxg-workflow` package
|
|
231
|
+
|
|
232
|
+
Recommended release flow:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
pnpm lint
|
|
236
|
+
pnpm typecheck
|
|
237
|
+
pnpm test
|
|
238
|
+
pnpm build
|
|
239
|
+
git commit -am "chore: release v0.1.1"
|
|
240
|
+
git tag v0.1.1
|
|
241
|
+
git push origin main --tags
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
`codeagent-wrapper` is still downloaded from the shared GitHub Release maintained by `fengshao1227/ccg-workflow` under the `preset` tag. CXG's GitHub workflow added here covers the npm package itself, not binary compilation.
|
|
245
|
+
|
|
246
|
+
## FAQ
|
|
247
|
+
|
|
248
|
+
### The slash commands do not appear in Codex CLI
|
|
249
|
+
|
|
250
|
+
Run `npx cxg-workflow init`, then restart Codex CLI. CXG installs prompt files into `~/.codex/prompts/`, which Codex loads as slash commands.
|
|
251
|
+
|
|
252
|
+
### Installation failed while downloading `codeagent-wrapper`
|
|
253
|
+
|
|
254
|
+
`init` fetches the binary from GitHub Releases. Check network access first, then rerun:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
npx cxg-workflow init --force
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### I selected `contextweaver`, but retrieval still does not work
|
|
261
|
+
|
|
262
|
+
That option does not fully provision ContextWeaver for you. Install the `contextweaver` executable and configure `~/.contextweaver/.env`, or switch to `ace-tool`.
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# CXG - Codex 单模型结构化工作流
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[English](./README.md) | 简体中文
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
CXG 是一个面向 Codex CLI 的单模型工作流包。它会安装一组结构化 Slash Commands、Skills、角色提示词和 `codeagent-wrapper` 二进制,使 Codex 能以统一方式完成研究、规划、执行、优化和评审。
|
|
10
|
+
|
|
11
|
+
> 说明:CXG 基于 [`ccg-workflow`](https://github.com/fengshao1227/ccg-workflow) 项目衍生而来,可视为面向 Codex 的单模型简化版。它保留了原项目的结构化工作流与 wrapper 编排思路,但将范围收敛为更精简的 Codex-only 使用体验。
|
|
12
|
+
|
|
13
|
+
## 为什么选择 CXG?
|
|
14
|
+
|
|
15
|
+
- **基于 `ccg-workflow` 衍生**:延续原项目的工作流设计思路,同时简化为仅面向 Codex 的轻量版本。
|
|
16
|
+
- **单模型协作**:不做多模型路由,只使用 Codex 主会话加 Codex 子进程角色分工。
|
|
17
|
+
- **结构化交付**:主工作流固定为 `研究 -> 计划 -> 执行 -> 优化 -> 评审`。
|
|
18
|
+
- **内置专家角色**:提供 `analyzer`、`architect`、`reviewer` 三类角色提示词。
|
|
19
|
+
- **可选代码检索**:支持 `ace-tool`,可预留 `contextweaver`,不配置 MCP 时自动退回 `Glob + Grep`。
|
|
20
|
+
- **直接可用的 Slash Commands**:安装后会把 12 个命令写入 `~/.codex/prompts/`。
|
|
21
|
+
|
|
22
|
+
## 架构
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
Codex CLI
|
|
26
|
+
|
|
|
27
|
+
+-- /cxg-* 自定义命令
|
|
28
|
+
|
|
|
29
|
+
+-- skills/cxg/*
|
|
30
|
+
|
|
|
31
|
+
+-- codeagent-wrapper
|
|
32
|
+
|
|
|
33
|
+
+-- Codex 子进程(analyzer / architect / reviewer)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
主 Codex 会话负责整体编排,子进程负责聚焦分析、规划和审查,再把结果回传给主会话继续推进。
|
|
37
|
+
|
|
38
|
+
## 快速开始
|
|
39
|
+
|
|
40
|
+
### 前置条件
|
|
41
|
+
|
|
42
|
+
| 依赖 | 必需 | 说明 |
|
|
43
|
+
|------|------|------|
|
|
44
|
+
| Node.js | 是 | 建议 Node.js 18+,便于兼容 ESM 和内置 `fetch` |
|
|
45
|
+
| Codex CLI | 是 | CXG 会把命令安装到 `~/.codex/` 供 Codex CLI 使用 |
|
|
46
|
+
| GitHub Releases 访问能力 | 是 | `init` 时会下载 `codeagent-wrapper` |
|
|
47
|
+
| ace-tool | 否 | 可选的 MCP 代码检索提供者 |
|
|
48
|
+
| ContextWeaver | 否 | 可选的 MCP 检索提供者,需要手动配置 |
|
|
49
|
+
|
|
50
|
+
### 安装
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx cxg-workflow init
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
常用变体:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# 强制覆盖已有 CXG 文件
|
|
60
|
+
npx cxg-workflow init --force
|
|
61
|
+
|
|
62
|
+
# 精简模式安装
|
|
63
|
+
npx cxg-workflow init --lite
|
|
64
|
+
|
|
65
|
+
# 在 ~/.codex/config.toml 中配置 ace-tool
|
|
66
|
+
npx cxg-workflow init --mcp ace-tool
|
|
67
|
+
|
|
68
|
+
# 跳过 MCP,使用文件系统检索兜底
|
|
69
|
+
npx cxg-workflow init --skip-mcp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
安装完成后,在 Codex CLI 中以 Slash Command 方式调用:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
/cxg-workflow 实现用户认证
|
|
76
|
+
/cxg-plan 重构支付服务
|
|
77
|
+
/cxg-review
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 验证安装
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npx cxg-workflow doctor
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 卸载
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx cxg-workflow uninstall
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 命令
|
|
93
|
+
|
|
94
|
+
### 核心工作流
|
|
95
|
+
|
|
96
|
+
| 命令 | 说明 |
|
|
97
|
+
|------|------|
|
|
98
|
+
| `/cxg-workflow` | 完整 5 阶段结构化工作流 |
|
|
99
|
+
| `/cxg-plan` | 生成实施计划 |
|
|
100
|
+
| `/cxg-execute` | 按已批准的计划文件执行 |
|
|
101
|
+
|
|
102
|
+
### 开发类
|
|
103
|
+
|
|
104
|
+
| 命令 | 说明 |
|
|
105
|
+
|------|------|
|
|
106
|
+
| `/cxg-feat` | 智能功能开发 |
|
|
107
|
+
| `/cxg-analyze` | 只分析,不改代码 |
|
|
108
|
+
| `/cxg-debug` | 问题诊断与修复 |
|
|
109
|
+
| `/cxg-optimize` | 性能与资源优化 |
|
|
110
|
+
|
|
111
|
+
### 质量类
|
|
112
|
+
|
|
113
|
+
| 命令 | 说明 |
|
|
114
|
+
|------|------|
|
|
115
|
+
| `/cxg-test` | 测试设计与生成 |
|
|
116
|
+
| `/cxg-review` | 质量与安全审查 |
|
|
117
|
+
| `/cxg-enhance` | 将模糊需求整理成结构化任务 |
|
|
118
|
+
|
|
119
|
+
### 交付与初始化
|
|
120
|
+
|
|
121
|
+
| 命令 | 说明 |
|
|
122
|
+
|------|------|
|
|
123
|
+
| `/cxg-commit` | 生成 Conventional Commit 提交信息 |
|
|
124
|
+
| `/cxg-init` | 生成项目 `AGENTS.md` 上下文文档 |
|
|
125
|
+
|
|
126
|
+
## 工作流指南
|
|
127
|
+
|
|
128
|
+
### 计划与执行分离
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# 1. 生成计划
|
|
132
|
+
/cxg-plan 实现用户认证
|
|
133
|
+
|
|
134
|
+
# 2. 审查并调整生成的计划
|
|
135
|
+
# 计划文件保存在 .codex/plan/ 下
|
|
136
|
+
|
|
137
|
+
# 3. 执行已批准的计划
|
|
138
|
+
/cxg-execute .codex/plan/user-auth.md
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 复杂任务使用完整工作流
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
/cxg-workflow 实现发票导出与审计日志
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
当任务跨多个模块、需要方案权衡、或者希望显式经过优化与评审阶段时,优先使用完整工作流。
|
|
148
|
+
|
|
149
|
+
### 初始化项目上下文
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
/cxg-init 为当前仓库生成模块化 AGENTS.md
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
该命令会按“根级简明、模块级详尽”的策略生成根目录和模块目录下的 `AGENTS.md`。
|
|
156
|
+
|
|
157
|
+
## 配置
|
|
158
|
+
|
|
159
|
+
### 安装后的目录结构
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
~/.codex/
|
|
163
|
+
├── prompts/
|
|
164
|
+
│ ├── cxg-workflow.md
|
|
165
|
+
│ ├── cxg-plan.md
|
|
166
|
+
│ └── ...
|
|
167
|
+
├── skills/
|
|
168
|
+
│ └── cxg/
|
|
169
|
+
│ ├── workflow/SKILL.md
|
|
170
|
+
│ ├── plan/SKILL.md
|
|
171
|
+
│ └── ...
|
|
172
|
+
├── bin/
|
|
173
|
+
│ └── codeagent-wrapper
|
|
174
|
+
├── config.toml # 启用 ace-tool 时写入 Codex MCP 配置
|
|
175
|
+
└── .cxg/
|
|
176
|
+
├── config.toml
|
|
177
|
+
└── roles/
|
|
178
|
+
└── codex/
|
|
179
|
+
├── analyzer.md
|
|
180
|
+
├── architect.md
|
|
181
|
+
└── reviewer.md
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### CXG 配置文件
|
|
185
|
+
|
|
186
|
+
CXG 自身状态保存在 `~/.codex/.cxg/config.toml`,包含:
|
|
187
|
+
|
|
188
|
+
- 已安装命令列表
|
|
189
|
+
- wrapper 路径
|
|
190
|
+
- 角色提示词路径
|
|
191
|
+
- 当前 MCP provider
|
|
192
|
+
- 是否启用 `--lite`
|
|
193
|
+
|
|
194
|
+
### MCP 配置
|
|
195
|
+
|
|
196
|
+
**`ace-tool`**
|
|
197
|
+
|
|
198
|
+
- 使用 `npx cxg-workflow init --mcp ace-tool`
|
|
199
|
+
- CXG 会把 MCP 服务写入 `~/.codex/config.toml`
|
|
200
|
+
- 命令模板内部调用 `mcp__ace-tool__search_context`
|
|
201
|
+
|
|
202
|
+
**`contextweaver`**
|
|
203
|
+
|
|
204
|
+
- 使用 `npx cxg-workflow init --mcp contextweaver`
|
|
205
|
+
- CXG 只会记录 provider 并提示你继续手动配置
|
|
206
|
+
- 你仍需自行安装 `contextweaver` 可执行文件并配置 `~/.contextweaver/.env`
|
|
207
|
+
|
|
208
|
+
**`skip`**
|
|
209
|
+
|
|
210
|
+
- 默认模式
|
|
211
|
+
- 命令模板自动退回 `Glob + Grep` 文件系统检索
|
|
212
|
+
|
|
213
|
+
## 支持平台
|
|
214
|
+
|
|
215
|
+
`codeagent-wrapper` 会按平台和架构自动选择二进制:
|
|
216
|
+
|
|
217
|
+
- macOS `arm64` / `amd64`
|
|
218
|
+
- Linux `arm64` / `amd64`
|
|
219
|
+
- Windows `arm64` / `amd64`
|
|
220
|
+
|
|
221
|
+
## GitHub CI/CD
|
|
222
|
+
|
|
223
|
+
CXG 可以通过 GitHub Actions 完成 CI 和 npm 自动发布:
|
|
224
|
+
|
|
225
|
+
- `CI`:在每次向 `main` 分支 push 或发起 PR 时运行,执行 `pnpm lint`、`pnpm typecheck`、`pnpm test`、`pnpm build`,并覆盖 Node.js 20、22。
|
|
226
|
+
- `Publish to npm`:在推送匹配 `v*.*.*` 的 Git tag 时触发。工作流会先校验 tag 与 `package.json` 版本一致,再重新执行校验,并以 `public` 访问级别发布到 npm,同时开启 provenance。
|
|
227
|
+
|
|
228
|
+
需要配置的仓库 Secret:
|
|
229
|
+
|
|
230
|
+
- `NPM_TOKEN`:具备 `cxg-workflow` 发布权限的 npm automation token
|
|
231
|
+
|
|
232
|
+
推荐发版流程:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
pnpm lint
|
|
236
|
+
pnpm typecheck
|
|
237
|
+
pnpm test
|
|
238
|
+
pnpm build
|
|
239
|
+
git commit -am "chore: release v0.1.1"
|
|
240
|
+
git tag v0.1.1
|
|
241
|
+
git push origin main --tags
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
当前 `codeagent-wrapper` 仍然从 `fengshao1227/ccg-workflow` 仓库的 GitHub Release `preset` tag 下载。这里新增的 GitHub 工作流只负责 `cxg-workflow` npm 包本身,不负责编译二进制。
|
|
245
|
+
|
|
246
|
+
## 常见问题
|
|
247
|
+
|
|
248
|
+
### Codex CLI 里看不到 Slash Commands
|
|
249
|
+
|
|
250
|
+
先执行 `npx cxg-workflow init`,然后重启 Codex CLI。CXG 的命令本质上是写入 `~/.codex/prompts/` 的 prompt 文件,需由 Codex 重新加载。
|
|
251
|
+
|
|
252
|
+
### 安装时 `codeagent-wrapper` 下载失败
|
|
253
|
+
|
|
254
|
+
`init` 会从 GitHub Releases 拉取二进制。先检查网络,再重试:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
npx cxg-workflow init --force
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 选择了 `contextweaver`,但代码检索仍然不可用
|
|
261
|
+
|
|
262
|
+
这个选项不会自动把 ContextWeaver 完整装好。你需要自己安装 `contextweaver` 命令并配置 `~/.contextweaver/.env`;如果不想手动处理,直接改用 `ace-tool`。
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
MIT
|
package/bin/cxg.mjs
ADDED
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import cac from 'cac';
|
|
3
|
+
import { i as init, u as uninstall, d as doctor, v as version } from './shared/cxg-workflow.BdjkxkKP.mjs';
|
|
4
|
+
import 'fs-extra';
|
|
5
|
+
import 'node:os';
|
|
6
|
+
import 'pathe';
|
|
7
|
+
import 'node:url';
|
|
8
|
+
import 'smol-toml';
|
|
9
|
+
|
|
10
|
+
const VALID_MCP_PROVIDERS = ["skip", "ace-tool", "contextweaver"];
|
|
11
|
+
function setupCommands(cli) {
|
|
12
|
+
cli.command("", "CXG Workflow - Codex \u5355\u6A21\u578B\u534F\u4F5C\u5DE5\u4F5C\u6D41").action(() => {
|
|
13
|
+
cli.outputHelp();
|
|
14
|
+
});
|
|
15
|
+
cli.command("init", "\u5B89\u88C5 CXG \u5DE5\u4F5C\u6D41\u5230 ~/.codex/").alias("i").option("--force, -f", "\u5F3A\u5236\u8986\u76D6\u5DF2\u6709\u6587\u4EF6").option("--lite", "\u7CBE\u7B80\u6A21\u5F0F\uFF08\u7981\u7528 WebUI\uFF09").option("--mcp <provider>", "MCP \u4EE3\u7801\u68C0\u7D22\u63D0\u4F9B\u8005 (ace-tool|contextweaver|skip)", { default: "skip" }).option("--skip-mcp", "\u8DF3\u8FC7 MCP \u914D\u7F6E").action(async (options) => {
|
|
16
|
+
const provider = options.skipMcp ? "skip" : options.mcp || "skip";
|
|
17
|
+
if (!VALID_MCP_PROVIDERS.includes(provider)) {
|
|
18
|
+
console.error(` \u2717 \u65E0\u6548\u7684 MCP provider: ${provider}`);
|
|
19
|
+
console.error(` \u6709\u6548\u503C: ${VALID_MCP_PROVIDERS.join(", ")}`);
|
|
20
|
+
process.exitCode = 1;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
await init({
|
|
24
|
+
force: options.force,
|
|
25
|
+
liteMode: options.lite,
|
|
26
|
+
mcpProvider: provider
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
cli.command("uninstall", "\u5378\u8F7D CXG \u5DE5\u4F5C\u6D41").alias("rm").action(async () => {
|
|
30
|
+
await uninstall();
|
|
31
|
+
});
|
|
32
|
+
cli.command("doctor", "\u8BCA\u65AD CXG \u5B89\u88C5\u5B8C\u6574\u6027").action(async () => {
|
|
33
|
+
await doctor();
|
|
34
|
+
});
|
|
35
|
+
cli.help();
|
|
36
|
+
cli.version(version);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function main() {
|
|
40
|
+
const cli = cac("cxg");
|
|
41
|
+
setupCommands(cli);
|
|
42
|
+
cli.parse();
|
|
43
|
+
}
|
|
44
|
+
main().catch((error) => {
|
|
45
|
+
console.error(error);
|
|
46
|
+
process.exitCode = 1;
|
|
47
|
+
});
|