@michelj/context-guard 0.4.1 → 0.4.3
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.md +74 -6
- package/README.zh-CN.md +74 -6
- package/{skills/context-guard/SKILL.md → SKILL.md} +216 -77
- package/bin/context-guard-skill.js +88 -3
- package/hooks.json +25 -1
- package/package.json +7 -3
- package/{skills/context-guard/references → references}/context-template.md +52 -1
- package/references/feature-chain-methodology.md +228 -0
- package/{skills/context-guard/scripts → scripts}/context_guard.py +3119 -121
- package/{skills/context-guard/scripts → scripts}/context_guard_hook.py +344 -12
- package/{skills/context-guard/tests → tests}/BC-20260701-090.sh +8 -7
- package/{skills/context-guard/tests → tests}/BC-20260702-096.sh +6 -3
- package/tests/BC-20260706-098.sh +66 -0
- package/tests/BC-20260707-099.sh +47 -0
- package/tests/BC-20260707-100.sh +46 -0
- package/tests/BC-20260707-101.sh +47 -0
- package/tests/BC-20260707-102.sh +68 -0
- package/tests/BC-20260707-103.sh +59 -0
- package/tests/BC-20260707-104.sh +103 -0
- package/tests/BC-20260707-105.sh +109 -0
- package/tests/BC-20260707-106.sh +80 -0
- package/tests/BC-20260707-107.sh +74 -0
- package/tests/BC-20260707-108.sh +48 -0
- package/tests/BC-20260707-109.sh +56 -0
- package/tests/BC-20260707-110.sh +71 -0
- package/tests/BC-20260707-111.sh +70 -0
- package/tests/BC-20260707-112.sh +45 -0
- package/tests/BC-20260707-113.sh +73 -0
- package/tests/BC-20260707-115.sh +77 -0
- package/tests/BC-20260707-116.sh +77 -0
- package/tests/BC-20260707-118.sh +115 -0
- package/tests/BC-20260707-119.sh +47 -0
- package/tests/BC-20260707-120.sh +60 -0
- package/tests/BC-20260707-121.sh +66 -0
- package/tests/BC-20260707-122.sh +48 -0
- package/tests/BC-20260707-123.sh +43 -0
- package/tests/BC-20260707-124.sh +56 -0
- package/tests/BC-20260707-125.sh +64 -0
- package/tests/BC-20260707-126.sh +80 -0
- package/tests/BC-20260707-127.sh +88 -0
- package/tests/BC-20260707-129.sh +59 -0
- package/tests/BC-20260707-130.sh +69 -0
- package/tests/BC-20260707-131.sh +140 -0
- package/tests/BC-20260707-132.sh +150 -0
- package/tests/BC-20260707-133.sh +70 -0
- package/tests/BC-20260708-136.sh +210 -0
- package/tests/BC-20260708-137.sh +106 -0
- package/tests/BC-20260708-138.sh +168 -0
- package/tests/BC-20260708-139.sh +79 -0
- package/tests/BC-20260709-002.sh +63 -0
- package/tests/BC-20260709-003.sh +239 -0
- package/tests/BC-20260709-006.sh +76 -0
- package/tests/BC-20260709-008.sh +168 -0
- package/tests/BC-20260710-001.sh +61 -0
- package/tests/BC-20260710-002.sh +111 -0
- package/tests/npm-install-smoke.sh +53 -0
- package/skills/context-guard/README.md +0 -234
- package/skills/context-guard/README.zh-CN.md +0 -234
- /package/{skills/context-guard/agents → agents}/openai.yaml +0 -0
- /package/{skills/context-guard/references → references}/register-template.md +0 -0
- /package/{skills/context-guard/references → references}/task-case-template.md +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260618-063.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260618-065.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260626-080.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260626-081.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260626-082.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260626-083.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260627-084.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260630-086.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260630-087.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260630-088.sh +0 -0
- /package/{skills/context-guard/tests → tests}/BC-20260630-089.sh +0 -0
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
# Context Guard Skill
|
|
2
|
-
|
|
3
|
-
Language: **English** | [中文](README.zh-CN.md)
|
|
4
|
-
|
|
5
|
-
Context Guard is a Codex skill for durable project memory. It keeps the task route, branches, bad cases, and verification paths inside the project's own `.codex/context/` folder, so Codex can understand where the work is, what went wrong before, and how to avoid repeating fixed mistakes across sessions.
|
|
6
|
-
|
|
7
|
-
## What It Does
|
|
8
|
-
|
|
9
|
-
- **Maintains project context**: creates and updates `.codex/context/`.
|
|
10
|
-
- **Records the roadmap**: tracks main routes, side routes, branch points, and progress.
|
|
11
|
-
- **Tracks bad cases**: records symptoms, triggers, causes, fixes, and recurrence checks.
|
|
12
|
-
- **Generates Roadmap HTML**: shows a human-readable roadmap with clickable node details.
|
|
13
|
-
- **Separates human and agent views**: HTML is for humans; Markdown/JSON are for Codex.
|
|
14
|
-
- **Supports record language preferences**: writes future context in Chinese or English.
|
|
15
|
-
- **Handles task switches**: parks, resumes, and branches interrupted work.
|
|
16
|
-
- **Keeps tests human-designed**: Codex reuses approved checks or proposes drafts, but does not silently create durable tests.
|
|
17
|
-
- **Covers bad cases with feature chains**: prefer one real feature/workflow chain covering multiple bad cases over one separate test per bad case.
|
|
18
|
-
- **Runs approved tests by default**: user-created or user-approved tests run at every development completion unless the user sets another cadence.
|
|
19
|
-
- **Provides a Test Hub entrypoint**: `dev-complete` runs approved always-run tests, cleans success artifacts, and preserves failed evidence.
|
|
20
|
-
|
|
21
|
-
## Install
|
|
22
|
-
|
|
23
|
-
Install with npx:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx @michelj/context-guard install
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Or install globally and let the package copy the skill into Codex's skill directory automatically:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm install -g @michelj/context-guard --registry=https://registry.npmjs.org
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Install hooks only when you explicitly want Context Guard reminders at Codex lifecycle events:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npx @michelj/context-guard install --with-hooks
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Use from GitHub before the npm package is published:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npx github:Michel-Johnson/Context-Guard-Skill install
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Manual install is also supported:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
git clone git@github.com:Michel-Johnson/Context-Guard-Skill.git
|
|
51
|
-
cd Context-Guard-Skill
|
|
52
|
-
mkdir -p ~/.codex/skills/context-guard
|
|
53
|
-
rsync -a --delete skills/context-guard/ ~/.codex/skills/context-guard/
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
After installation, Codex should discover:
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
~/.codex/skills/context-guard/SKILL.md
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Where Context Lives
|
|
63
|
-
|
|
64
|
-
Context must be saved under the local project currently opened in Codex:
|
|
65
|
-
|
|
66
|
-
```text
|
|
67
|
-
<Codex project root>/.codex/context/
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Do not write project context into:
|
|
71
|
-
|
|
72
|
-
- the skill install directory
|
|
73
|
-
- a chat/thread directory
|
|
74
|
-
- a temporary directory
|
|
75
|
-
- an SSH remote server path
|
|
76
|
-
|
|
77
|
-
When running scripts manually, pass the project root explicitly:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-roadmap --root /path/to/project
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Register a user-approved automated test:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-add \
|
|
87
|
-
--root /path/to/project \
|
|
88
|
-
--title "Markdown preview rendering" \
|
|
89
|
-
--command-text "npm test"
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Register a user-approved feature-chain test:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-add \
|
|
96
|
-
--root /path/to/project \
|
|
97
|
-
--title "GPU monitor button" \
|
|
98
|
-
--entry "Click the GPU monitor button" \
|
|
99
|
-
--exit-check "Open a monitoring page with a valid grafana_url" \
|
|
100
|
-
--command-text "npm test -- gpu-monitor"
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Attach a bad case to a specific feature-chain checkpoint:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-attach-bc \
|
|
107
|
-
--root /path/to/project \
|
|
108
|
-
--chain-id FC-... \
|
|
109
|
-
--node-title "Backend returns monitor URL" \
|
|
110
|
-
--bad-case BC-... \
|
|
111
|
-
--check "grafana_url is non-empty and the frontend does not hang"
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
After development, hand completion to the Test Hub:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py dev-complete --root /path/to/project --jobs 2
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Open the read-only Test Hub page:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-test-hub --root /path/to/project --open
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Manage tests lightly:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-list --root /path/to/project
|
|
130
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-disable --root /path/to/project --test-id TC-... --reason "not needed every time"
|
|
131
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-enable --root /path/to/project --test-id TC-...
|
|
132
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-set-policy --root /path/to/project --test-id TC-... --run-policy relevant-only --reason "only editor changes need it"
|
|
133
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-remove --root /path/to/project --test-id TC-...
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Common Usage
|
|
137
|
-
|
|
138
|
-
Ask Codex to maintain context:
|
|
139
|
-
|
|
140
|
-
```text
|
|
141
|
-
Use $context-guard to maintain this task context.
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Show the current roadmap:
|
|
145
|
-
|
|
146
|
-
```text
|
|
147
|
-
Use $context-guard to show the roadmap.
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Initialize project context:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py init --root /path/to/project
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Set the record language:
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py set-language --root /path/to/project --language English
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
Generate the roadmap:
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-roadmap --root /path/to/project
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
Or use the npm CLI as a thin wrapper:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
npx @michelj/context-guard show-roadmap --root /path/to/project
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Create a branch task:
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py create-branch-task \
|
|
178
|
-
--root /path/to/project \
|
|
179
|
-
--title "branch task title" \
|
|
180
|
-
--branch "branch name" \
|
|
181
|
-
--parent-node NODE-YYYYMMDD-001
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Record a roadmap checkpoint:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py checkpoint-roadmap-node \
|
|
188
|
-
--root /path/to/project \
|
|
189
|
-
--title "source title for Codex" \
|
|
190
|
-
--display-title "short human title" \
|
|
191
|
-
--user-request "what the user asked" \
|
|
192
|
-
--progress-summary "current progress" \
|
|
193
|
-
--method-summary "method used" \
|
|
194
|
-
--branch Main \
|
|
195
|
-
--level major \
|
|
196
|
-
--outcome "result"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## Main Files
|
|
200
|
-
|
|
201
|
-
```text
|
|
202
|
-
.codex/context/
|
|
203
|
-
|-- index.md # quick index and active task
|
|
204
|
-
|-- roadmap.md # agent-readable roadmap
|
|
205
|
-
|-- bad-cases.md # bad-case register
|
|
206
|
-
|-- preferences.json # language and project preferences
|
|
207
|
-
|-- roadmap/
|
|
208
|
-
| |-- roadmap.html # human-facing roadmap
|
|
209
|
-
| |-- roadmap.md # agent-readable export
|
|
210
|
-
| `-- roadmap.json # structured index
|
|
211
|
-
|-- tasks/ # task-level context
|
|
212
|
-
|-- task-cases/ # task-oriented test cases
|
|
213
|
-
|-- test-hub/ # test registry, latest result, and failed evidence
|
|
214
|
-
`-- bad-case-tests/ # reusable bad-case checks
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Principles
|
|
218
|
-
|
|
219
|
-
- Record only meaningful progress, not every small action.
|
|
220
|
-
- Human-facing titles should read naturally, not like implementation logs.
|
|
221
|
-
- A bad case should help future Codex prevent recurrence.
|
|
222
|
-
- Test design belongs to humans; Codex can run approved checks or draft a proposal for confirmation.
|
|
223
|
-
- Prefer feature chains as the durable testing unit: one clear entry, one real workflow, ordered checkpoints, and multiple covered bad cases.
|
|
224
|
-
- Attach new bad cases to an existing feature-chain checkpoint first; propose a new chain only when no existing workflow matches.
|
|
225
|
-
- User-approved tests default to `every-dev-completion`; Codex may lower that cadence only when the user asks.
|
|
226
|
-
- Approved automated tests should go into `.codex/context/test-hub/registry.json` or `.codex/context/test-hub/feature-chains.json` and be scheduled through `dev-complete`.
|
|
227
|
-
- Keep the Test Hub simple: one registry, one `dev-complete` runner, one latest-result file, one read-only HTML status page, and a few management commands.
|
|
228
|
-
- Final Codex summaries should state the current Test Hub result: whether approved always-run tests all passed, failed, blocked, or do not exist.
|
|
229
|
-
- Verification should reuse existing commands, scripts, screenshots, or manual checks first.
|
|
230
|
-
- Do not create a new script for every bad case.
|
|
231
|
-
- For frontend or HTML changes, inspect the rendered page or screenshot before claiming success.
|
|
232
|
-
- For any new durable test case, draft a short task-case proposal and confirm with the user before making it active.
|
|
233
|
-
|
|
234
|
-
See [`skills/context-guard/SKILL.md`](skills/context-guard/SKILL.md) for the full behavior rules.
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
# Context Guard Skill
|
|
2
|
-
|
|
3
|
-
语言:[English](README.md) | **中文**
|
|
4
|
-
|
|
5
|
-
Context Guard 是一个给 Codex 用的项目记忆 skill。它把任务主线、支线、bad case 和验证链路保存在项目自己的 `.codex/context/` 里,让 Codex 在不同 session 之间也能知道“现在做到哪里、踩过哪些坑、下次怎么检查”。
|
|
6
|
-
|
|
7
|
-
## 能做什么
|
|
8
|
-
|
|
9
|
-
- **维护项目 context**:自动创建并更新 `.codex/context/`。
|
|
10
|
-
- **记录路线图**:维护主线、支线、分叉节点和当前进度。
|
|
11
|
-
- **记录 bad case**:保存问题现象、触发条件、原因、修复方式和防复发检查。
|
|
12
|
-
- **生成 Roadmap HTML**:给用户查看清晰的路线图,点击节点看详情。
|
|
13
|
-
- **区分人类视图和 agent 视图**:HTML 给人看,Markdown/JSON 给 Codex 读取。
|
|
14
|
-
- **支持多语言记录**:按项目偏好用中文或英文写 context。
|
|
15
|
-
- **处理任务切换**:遇到新方向、支线任务或中断任务时,帮助 Codex park/resume。
|
|
16
|
-
- **测试由人类设计**:Codex 只复用已确认检查,或提出草案等待用户确认,不静默创建长期测试。
|
|
17
|
-
- **用功能链覆盖 bad case**:优先把多个 bad case 挂到同一条真实功能/工作流测试链上,而不是为每个 bad case 单独造测试。
|
|
18
|
-
- **默认运行已确认测试**:用户创建或确认的测试,默认每次开发结束都要运行;只有用户说明不必每次运行时才降频。
|
|
19
|
-
- **提供测试中台入口**:`dev-complete` 会统一运行已确认的 always-run 测试,成功清理临时产物,失败保留证据。
|
|
20
|
-
|
|
21
|
-
## 安装
|
|
22
|
-
|
|
23
|
-
使用 npx 安装:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx @michelj/context-guard install
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
也可以全局安装,让 npm 包自动把 skill 复制到 Codex 的 skill 目录:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm install -g @michelj/context-guard --registry=https://registry.npmjs.org
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
只有当你明确希望安装 Codex 生命周期 hook 提醒时,才加 `--with-hooks`:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npx @michelj/context-guard install --with-hooks
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
npm 包正式发布前,也可以直接从 GitHub 使用:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npx github:Michel-Johnson/Context-Guard-Skill install
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
也支持手动安装:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
git clone git@github.com:Michel-Johnson/Context-Guard-Skill.git
|
|
51
|
-
cd Context-Guard-Skill
|
|
52
|
-
mkdir -p ~/.codex/skills/context-guard
|
|
53
|
-
rsync -a --delete skills/context-guard/ ~/.codex/skills/context-guard/
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
安装后 Codex 应该能发现:
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
~/.codex/skills/context-guard/SKILL.md
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Context 保存在哪里
|
|
63
|
-
|
|
64
|
-
Context 必须保存在当前打开的本地项目里:
|
|
65
|
-
|
|
66
|
-
```text
|
|
67
|
-
<Codex 打开的项目根目录>/.codex/context/
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
不要把 context 写到:
|
|
71
|
-
|
|
72
|
-
- skill 安装目录
|
|
73
|
-
- chat/thread 名称对应的目录
|
|
74
|
-
- 临时目录
|
|
75
|
-
- SSH 远程服务器路径
|
|
76
|
-
|
|
77
|
-
如果手动运行脚本,建议显式传入项目根目录:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-roadmap --root /path/to/project
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
注册一个用户已确认的自动化测试:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-add \
|
|
87
|
-
--root /path/to/project \
|
|
88
|
-
--title "Markdown 预览渲染" \
|
|
89
|
-
--command-text "npm test"
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
注册一条用户已确认的功能链测试:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-add \
|
|
96
|
-
--root /path/to/project \
|
|
97
|
-
--title "GPU 监控按钮" \
|
|
98
|
-
--entry "点击 GPU 监控按钮" \
|
|
99
|
-
--exit-check "打开包含有效 grafana_url 的监控页" \
|
|
100
|
-
--command-text "npm test -- gpu-monitor"
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
把 bad case 挂到功能链的具体环节:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py feature-chain-attach-bc \
|
|
107
|
-
--root /path/to/project \
|
|
108
|
-
--chain-id FC-... \
|
|
109
|
-
--node-title "后端返回监控 URL" \
|
|
110
|
-
--bad-case BC-... \
|
|
111
|
-
--check "grafana_url 不为空,前端不会卡住"
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
开发完成后交给测试中台:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py dev-complete --root /path/to/project --jobs 2
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
查看只读测试中台页面:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-test-hub --root /path/to/project --open
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
简单管理测试:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-list --root /path/to/project
|
|
130
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-disable --root /path/to/project --test-id TC-... --reason "暂时不需要每次运行"
|
|
131
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-enable --root /path/to/project --test-id TC-...
|
|
132
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-set-policy --root /path/to/project --test-id TC-... --run-policy relevant-only --reason "只和编辑器改动相关"
|
|
133
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py test-hub-remove --root /path/to/project --test-id TC-...
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## 常用方式
|
|
137
|
-
|
|
138
|
-
让 Codex 启用并维护 context:
|
|
139
|
-
|
|
140
|
-
```text
|
|
141
|
-
Use $context-guard to maintain this task context.
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
展示当前路线图:
|
|
145
|
-
|
|
146
|
-
```text
|
|
147
|
-
Use $context-guard to show the roadmap.
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
初始化项目 context:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py init --root /path/to/project
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
设置记录语言:
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py set-language --root /path/to/project --language 中文
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
生成路线图:
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py show-roadmap --root /path/to/project
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
也可以用 npm CLI 作为轻量封装:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
npx @michelj/context-guard show-roadmap --root /path/to/project
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
创建支线任务:
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py create-branch-task \
|
|
178
|
-
--root /path/to/project \
|
|
179
|
-
--title "支线任务标题" \
|
|
180
|
-
--branch "支线名称" \
|
|
181
|
-
--parent-node NODE-YYYYMMDD-001
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
记录路线图节点:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
python3 ~/.codex/skills/context-guard/scripts/context_guard.py checkpoint-roadmap-node \
|
|
188
|
-
--root /path/to/project \
|
|
189
|
-
--title "给 Codex 看的源标题" \
|
|
190
|
-
--display-title "给用户看的短标题" \
|
|
191
|
-
--user-request "用户实际提出的问题" \
|
|
192
|
-
--progress-summary "当前进展" \
|
|
193
|
-
--method-summary "采取的方法" \
|
|
194
|
-
--branch Main \
|
|
195
|
-
--level major \
|
|
196
|
-
--outcome "结果"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## 主要文件
|
|
200
|
-
|
|
201
|
-
```text
|
|
202
|
-
.codex/context/
|
|
203
|
-
|-- index.md # 快速索引和当前任务
|
|
204
|
-
|-- roadmap.md # agent 可读路线图
|
|
205
|
-
|-- bad-cases.md # bad case 登记表
|
|
206
|
-
|-- preferences.json # 语言和项目偏好
|
|
207
|
-
|-- roadmap/
|
|
208
|
-
| |-- roadmap.html # 用户查看的路线图
|
|
209
|
-
| |-- roadmap.md # agent 快速读取版
|
|
210
|
-
| `-- roadmap.json # 结构化索引
|
|
211
|
-
|-- tasks/ # 任务级 context
|
|
212
|
-
|-- task-cases/ # 任务导向测试 case
|
|
213
|
-
|-- test-hub/ # 测试注册表、最近结果和失败证据
|
|
214
|
-
`-- bad-case-tests/ # 可复用 bad case 检查脚本
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## 使用原则
|
|
218
|
-
|
|
219
|
-
- 路线图只记录关键进展,不记录每个小动作。
|
|
220
|
-
- 用户看的标题要像人话,不要像实现日志。
|
|
221
|
-
- bad case 要能帮助未来避免复发。
|
|
222
|
-
- 测试设计权属于人类;Codex 可以执行已确认检查,或提出待确认草案。
|
|
223
|
-
- 测试的长期单位优先是功能链:一个明确入口、一段真实流程、多个检查点、覆盖多个 bad case。
|
|
224
|
-
- 新 bad case 优先挂到已有功能链节点;没有匹配功能链时,再提出新的功能链草案。
|
|
225
|
-
- 用户确认的测试默认是 `every-dev-completion`;只有用户要求时,Codex 才能改成其他运行频率。
|
|
226
|
-
- 已确认的自动化测试应进入 `.codex/context/test-hub/registry.json` 或 `.codex/context/test-hub/feature-chains.json`,由 `dev-complete` 统一调度。
|
|
227
|
-
- 测试中台保持简单:一个注册表、一个 `dev-complete` runner、一个最近结果、一个只读 HTML 状态页和几个管理命令。
|
|
228
|
-
- Codex 最终总结必须说明当前测试中台结果:已确认的 always-run 测试是否全部通过、失败、阻塞,或当前没有这类测试。
|
|
229
|
-
- 测试链路优先复用已有命令、脚本、截图或人工检查。
|
|
230
|
-
- 不要为了每个 bad case 都新写脚本。
|
|
231
|
-
- 前端或 HTML 改动结束前,应实际查看页面或截图,确认没有明显视觉错误。
|
|
232
|
-
- 任何新的长期测试 case 都先写简短草案,让用户确认后再变成 active 测试。
|
|
233
|
-
|
|
234
|
-
详细行为规则见 [`skills/context-guard/SKILL.md`](skills/context-guard/SKILL.md)。
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|