rulemason 0.8.0__tar.gz
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.
- rulemason-0.8.0/.gitignore +6 -0
- rulemason-0.8.0/LICENSE +202 -0
- rulemason-0.8.0/NOTICE +4 -0
- rulemason-0.8.0/PKG-INFO +203 -0
- rulemason-0.8.0/README.md +188 -0
- rulemason-0.8.0/lint/eslint-base.mjs +10 -0
- rulemason-0.8.0/lint/ruff-base.toml +23 -0
- rulemason-0.8.0/openspec-base/artifact-rules.yaml +16 -0
- rulemason-0.8.0/openspec-base/operations.yaml +8 -0
- rulemason-0.8.0/pyproject.toml +61 -0
- rulemason-0.8.0/rules/code-style.md +18 -0
- rulemason-0.8.0/rules/copy-voice.md +43 -0
- rulemason-0.8.0/rules/python.md +11 -0
- rulemason-0.8.0/rules/react.md +27 -0
- rulemason-0.8.0/rules/workflow-gates.md +75 -0
- rulemason-0.8.0/skills/rulemason/SKILL.md +88 -0
- rulemason-0.8.0/src/rulemason/__init__.py +3 -0
- rulemason-0.8.0/src/rulemason/banner.py +98 -0
- rulemason-0.8.0/src/rulemason/check.py +733 -0
- rulemason-0.8.0/src/rulemason/cli.py +70 -0
- rulemason-0.8.0/src/rulemason/init.py +773 -0
- rulemason-0.8.0/src/rulemason/judge/__init__.py +34 -0
- rulemason-0.8.0/src/rulemason/judge/base/copy-lexicon.yaml +24 -0
- rulemason-0.8.0/src/rulemason/judge/base/judgments.yaml +22 -0
- rulemason-0.8.0/src/rulemason/judge/judge.py +584 -0
- rulemason-0.8.0/src/rulemason/judge/templates/judge.yaml +6 -0
- rulemason-0.8.0/src/rulemason/judge/templates/judge_cases.yaml +7 -0
- rulemason-0.8.0/src/rulemason/judge/templates/judgments.yaml +17 -0
- rulemason-0.8.0/src/rulemason/key.py +32 -0
- rulemason-0.8.0/src/rulemason/migrate.py +97 -0
- rulemason-0.8.0/src/rulemason/remove.py +240 -0
- rulemason-0.8.0/src/rulemason/shared.py +354 -0
- rulemason-0.8.0/src/rulemason/templates/AGENTS.md.tmpl +23 -0
- rulemason-0.8.0/src/rulemason/templates/claude.block.md +11 -0
- rulemason-0.8.0/src/rulemason/templates/code-style.block.md +7 -0
- rulemason-0.8.0/src/rulemason/templates/copies-README.md +6 -0
- rulemason-0.8.0/src/rulemason/templates/opencode.jsonc.tmpl +9 -0
- rulemason-0.8.0/src/rulemason/templates/ruff.toml.tmpl +5 -0
- rulemason-0.8.0/src/rulemason/templates/workflow-gates-spec.md.tmpl +19 -0
- rulemason-0.8.0/src/rulemason/templates/workflow-gates.block.md +1 -0
- rulemason-0.8.0/src/rulemason/update.py +127 -0
- rulemason-0.8.0/tests/conftest.py +55 -0
- rulemason-0.8.0/tests/judge/test_engine.py +603 -0
- rulemason-0.8.0/tests/test_banner.py +145 -0
- rulemason-0.8.0/tests/test_check.py +638 -0
- rulemason-0.8.0/tests/test_init.py +738 -0
- rulemason-0.8.0/tests/test_key.py +54 -0
- rulemason-0.8.0/tests/test_migrate.py +231 -0
- rulemason-0.8.0/tests/test_remove.py +244 -0
- rulemason-0.8.0/tests/test_shared.py +231 -0
- rulemason-0.8.0/tests/test_templates.py +293 -0
- rulemason-0.8.0/tests/test_update.py +246 -0
rulemason-0.8.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
rulemason-0.8.0/NOTICE
ADDED
rulemason-0.8.0/PKG-INFO
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rulemason
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: 给 AI 编码工具的共享规则与检查点:一处维护规则,项目内生成只读副本,方案与代码前后自动判断与审查
|
|
5
|
+
Project-URL: Homepage, https://github.com/rulemason/rulemason
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: NOTICE
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Requires-Dist: json5>=0.9
|
|
11
|
+
Requires-Dist: pydantic>=2.12
|
|
12
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
13
|
+
Requires-Dist: typesafe-sdk>=0.7.5
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# rulemason
|
|
17
|
+
|
|
18
|
+
给 AI 编码工具(Claude Code、OpenCode、Cursor、Codex)的共享规则与检查点。它只管三件事:
|
|
19
|
+
|
|
20
|
+
- **规则**:AI 写方案和代码时要守的写法规矩(九条、各语言落法(Python、React)、界面文案三档、方案写法)。规则只在本仓库维护,每个项目里是一份随项目提交的只读副本,克隆项目的人、云端 agent 与 CI 不装 rulemason 也能读到。
|
|
21
|
+
- **检查点**:方案写完、写代码前、写完代码后,AI 按规矩自动检查——判断方案、精简代码、独立审查、lint 与测试。
|
|
22
|
+
- **判断**(可选):用 TypeSafe 的 Jev 模型判断方案是否违反已写下的规矩,输出 pass / review / block;没有 key 时人工逐条判断。
|
|
23
|
+
|
|
24
|
+
## 安装(每台机器一次)
|
|
25
|
+
|
|
26
|
+
从 PyPI 安装(需要 [uv](https://docs.astral.sh/uv/)):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv tool install rulemason
|
|
30
|
+
rulemason --version
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 常用命令
|
|
34
|
+
|
|
35
|
+
| 什么时候 | 命令 |
|
|
36
|
+
|---|---|
|
|
37
|
+
| 项目第一次接入,或增减 AI 工具 | `rulemason init` |
|
|
38
|
+
| 以后任何时候:升级、补齐缺的配置、恢复被改的副本 | `rulemason update` |
|
|
39
|
+
| 看现状与下一步(CI 里也用它) | `rulemason check` |
|
|
40
|
+
| 配一次 Jev 的 key(只在启用判断时需要) | `rulemason key` |
|
|
41
|
+
| 不再使用:从项目卸载 | `rulemason remove` |
|
|
42
|
+
| 手动判断一个方案 | `rulemason judge --change 功能名` |
|
|
43
|
+
| 在 AI 工具里补项目简介、红线、命令表,或启用判断 | `/rulemason` |
|
|
44
|
+
|
|
45
|
+
## 第一次接入
|
|
46
|
+
|
|
47
|
+
在项目根目录运行:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
rulemason init # 交互选择工具,列出文件计划,确认一次后写入
|
|
51
|
+
rulemason init --tools claude,codex --yes # 非交互:不提问
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`init` 只做能确定做对的事:生成规则副本与各工具的入口,补齐方案写法规则、OpenSpec apply / archive 时给 AI 的检查点提示(`config.yaml` 的 `operations`)、ruff / ESLint 继承与项目的检查点规格;改不了的(例如 ruff 配置写了 `select`)只报告,不强行改写。不提交、不推送,不碰计划以外的文件。没有 `openspec/` 时会先询问并代为运行 `openspec init`。
|
|
55
|
+
|
|
56
|
+
然后在 AI 工具里运行 `/rulemason`,补项目简介、红线(注明出处并逐条确认)与命令表。
|
|
57
|
+
|
|
58
|
+
## 日常
|
|
59
|
+
|
|
60
|
+
日常开发走 OpenSpec,检查点由 AI 自动运行,不用记命令:
|
|
61
|
+
|
|
62
|
+
```txt
|
|
63
|
+
/opsx:propose 功能名 方案写完 -> 判断:格式问题 AI 自己改,碰红线的报告给你
|
|
64
|
+
/opsx:apply 功能名 写代码前再判断一次,有 block 就停下等你
|
|
65
|
+
写完 -> 自动精简 -> 独立只读审查 -> ruff -> 测试 -> 前端 lint -> 文案检查
|
|
66
|
+
/opsx:archive 功能名 归档,提交
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
自动精简只处理本次改动里的重复、死代码、冗余抽象或过复杂逻辑,保持需求、外部行为与 API 不变;Claude Code 下这一步用内置的 `/simplify`。独立审查者拿不到文件与命令工具,只看提供给它的改动与方案;必须修的问题自动修复并重新审查,不要求你逐条审核代码。
|
|
70
|
+
|
|
71
|
+
## 看现状
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
rulemason check # 只读,在项目任意子目录运行都可以
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
第一行就是结论和下一步,照着做即可,例如:
|
|
78
|
+
|
|
79
|
+
```txt
|
|
80
|
+
补项目信息:在 AI 工具中运行 /rulemason
|
|
81
|
+
接入:运行 rulemason update
|
|
82
|
+
日常巡检:一切一致
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
规则副本被改、工具入口缺失、lint 没有继承基础规则、项目还是旧格式时以非 0 退出,可以直接放进 CI:
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
- uses: astral-sh/setup-uv@v6
|
|
89
|
+
- run: uv tool install rulemason==0.8.0
|
|
90
|
+
- run: rulemason check
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 给 AI 与脚本
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
rulemason check --json # 结构化结果:next.code 是稳定的动作代码,text 是上面的报告全文;退出码同上
|
|
97
|
+
rulemason init --plan [--json] # 只列接入计划:不写文件、不提问、不运行 openspec init
|
|
98
|
+
rulemason update --dry-run [--json] # 只列升级与补齐计划,不写文件
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`/rulemason` 读的就是 `check --json`;AI 替你接入前会先用 `init --plan` 给你看计划。
|
|
102
|
+
|
|
103
|
+
## 升级
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
uv tool upgrade rulemason
|
|
107
|
+
rulemason update
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`update` 直接刷新 rulemason 自己管的规则副本与入口;你自己的文件(ruff、ESLint、`openspec/config.yaml` 等)缺了配置时,它先列出补齐计划,确认后才写,非交互环境里要加 `--yes`。之后在项目里跑一遍 lint 与测试再提交。
|
|
111
|
+
|
|
112
|
+
## 判断(可选)
|
|
113
|
+
|
|
114
|
+
判断要求项目在 git 里、已归档至少 3 个 change;`rulemason check` 的「判断」一行会写明还差什么。要启用时在 AI 工具里运行 `/rulemason` 并说明要启用判断,它会整理候选判断规则让你逐条确认。
|
|
115
|
+
|
|
116
|
+
配 key(在自己的终端里运行,输入不显示,不会进命令历史):
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
rulemason key
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
key 写在 `~/.config/rulemason/env`(权限 600),只在本机,不进任何仓库;环境变量 `TYPESAFE_API_KEY` 优先。
|
|
123
|
+
|
|
124
|
+
手动运行判断:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
rulemason judge --change 功能名 # 审 openspec/changes/功能名(已归档的也能直接用名字)
|
|
128
|
+
rulemason judge --change 功能名 --lint-only # 只跑正则检查,不联网
|
|
129
|
+
rulemason judge --copy # 审新增或改过的界面文案(项目配了 openspec/judge.yaml 才有)
|
|
130
|
+
rulemason judge --change 功能名 --dry-run # 打印将要发送的请求,不发送
|
|
131
|
+
rulemason judge --template judgments # 打印启用判断用的模板(judgments、judge、judge_cases)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
项目代码也可以把引擎当库用:`from rulemason.judge import load_rules, verdict_or_pending`。
|
|
135
|
+
|
|
136
|
+
## 卸载
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
rulemason remove --plan # 只看计划,不改任何文件
|
|
140
|
+
rulemason remove # 列出计划,确认后卸载;非交互环境加 --yes
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`remove` 删掉 rulemason 生成的东西:规则副本、各工具的 skill、`.rulemason.yaml`、AGENTS.md / CLAUDE.md 里的 rulemason 标记块、OpenCode 配置里指向 `.rulemason/` 的条目,以及没被改过的 `operations` 提示。ruff、ESLint 还在继承基础规则时,会把这两个文件移到项目的 `lint/` 并改好路径,lint 结果不变。手改过的副本保留;产物写法规则、项目的检查点规格、命令表和红线已是项目内容,只在汇报里列出,不删。本机装的 rulemason 不受影响,不用了再运行 `uv tool uninstall rulemason`。
|
|
144
|
+
|
|
145
|
+
## 出了问题怎么办
|
|
146
|
+
|
|
147
|
+
rulemason 往项目里写三类东西,都由它管理,不要手改:
|
|
148
|
+
|
|
149
|
+
- **规则副本**:`.rulemason/` 与各工具目录下的 `skills/rulemason/SKILL.md`。
|
|
150
|
+
- **标记块**:`AGENTS.md`、`CLAUDE.md` 里 `<!-- rulemason:… -->` 与 `<!-- /rulemason:… -->` 之间的内容;块外是你自己的内容,rulemason 不碰。
|
|
151
|
+
- **清单**:`.rulemason.yaml`,记录选了哪些工具、rulemason 版本与每个副本的校验值。
|
|
152
|
+
|
|
153
|
+
| `check` 第一行 | 原因 | 怎么办 |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| `接入:运行 rulemason update` | 副本或标记块被手改、入口缺失、配置没补齐 | 运行 `rulemason update`;要改规矩,到本仓库改了发布新版本 |
|
|
156
|
+
| `接入:修改 .gitignore,放行 skills/rulemason/` | `.gitignore` 忽略了工具目录,副本提交不上去 | 改成只放行 `skills/rulemason/`;说明单独写一行,git 不支持行尾注释 |
|
|
157
|
+
| `接入:运行 rulemason init` | 这个目录(或它所在的仓库)还没接入 | 在项目根运行 `rulemason init` |
|
|
158
|
+
| `接入:先修正 .rulemason.yaml` | 清单被改坏,读不出来 | 按提示修正,或删掉它后重新 `rulemason init` |
|
|
159
|
+
| `接入:运行 rulemason init 迁移格式` | 项目还是 rulekit 0.5 的格式 | 见下一节 |
|
|
160
|
+
| `补项目信息:…` | 项目简介、红线待补,或有旧名残留 | 在 AI 工具里运行 `/rulemason` |
|
|
161
|
+
|
|
162
|
+
## 从 rulekit 迁移
|
|
163
|
+
|
|
164
|
+
rulemason 的前身叫 rulekit(0.5.x)。已接入 rulekit 的项目:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
uv tool uninstall rulekit
|
|
168
|
+
uv tool install rulemason
|
|
169
|
+
rulemason init # 识别 .rulekit.yaml,列出迁移计划,确认一次后迁移
|
|
170
|
+
rulemason check # 看还有哪些旧名残留
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
迁移把 `.rulekit/`、`.rulekit.yaml`、`skills/rulekit/`、`<!-- rulekit:… -->` 标记块,以及 opencode、ruff、ESLint、项目检查点规格里的 `.rulekit/` 路径换成新名,结果与直接接入相同。旧副本被手改过时迁移停下并列出文件,不写任何东西。
|
|
174
|
+
|
|
175
|
+
标记块以外的旧名不会被自动修改,`check` 会列出来,在 AI 工具中运行 `/rulemason` 逐处确认后替换:
|
|
176
|
+
|
|
177
|
+
- 命令表里的 `jev-judge --change <name>` → `rulemason judge --change <name>`
|
|
178
|
+
- `.gitignore` 里的 `!.claude/skills/rulekit/` → `!.claude/skills/rulemason/`
|
|
179
|
+
- 项目测试里的 `from jev_judge import …` → `from rulemason.judge import …`
|
|
180
|
+
|
|
181
|
+
key 不用重配:`~/.config/rulemason/env` 不存在时,会读旧位置 `~/.config/jev-judge/env`;也可以运行一次 `rulemason key` 写到新位置。
|
|
182
|
+
|
|
183
|
+
## 参与修改
|
|
184
|
+
|
|
185
|
+
改共享规则会影响所有接入项目:在本仓库开 OpenSpec change,在受影响的项目里验证,发布新 tag 后各项目运行 `rulemason update`。
|
|
186
|
+
|
|
187
|
+
启用提交前钩子,拦截本机绝对路径(每个 clone 一次):
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
git config core.hooksPath .githooks
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
本地开发:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
uv sync
|
|
197
|
+
uv run ruff check .
|
|
198
|
+
uv run pytest
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## 许可证
|
|
202
|
+
|
|
203
|
+
[Apache-2.0](LICENSE)。版权声明见 [NOTICE](NOTICE)。
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# rulemason
|
|
2
|
+
|
|
3
|
+
给 AI 编码工具(Claude Code、OpenCode、Cursor、Codex)的共享规则与检查点。它只管三件事:
|
|
4
|
+
|
|
5
|
+
- **规则**:AI 写方案和代码时要守的写法规矩(九条、各语言落法(Python、React)、界面文案三档、方案写法)。规则只在本仓库维护,每个项目里是一份随项目提交的只读副本,克隆项目的人、云端 agent 与 CI 不装 rulemason 也能读到。
|
|
6
|
+
- **检查点**:方案写完、写代码前、写完代码后,AI 按规矩自动检查——判断方案、精简代码、独立审查、lint 与测试。
|
|
7
|
+
- **判断**(可选):用 TypeSafe 的 Jev 模型判断方案是否违反已写下的规矩,输出 pass / review / block;没有 key 时人工逐条判断。
|
|
8
|
+
|
|
9
|
+
## 安装(每台机器一次)
|
|
10
|
+
|
|
11
|
+
从 PyPI 安装(需要 [uv](https://docs.astral.sh/uv/)):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv tool install rulemason
|
|
15
|
+
rulemason --version
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 常用命令
|
|
19
|
+
|
|
20
|
+
| 什么时候 | 命令 |
|
|
21
|
+
|---|---|
|
|
22
|
+
| 项目第一次接入,或增减 AI 工具 | `rulemason init` |
|
|
23
|
+
| 以后任何时候:升级、补齐缺的配置、恢复被改的副本 | `rulemason update` |
|
|
24
|
+
| 看现状与下一步(CI 里也用它) | `rulemason check` |
|
|
25
|
+
| 配一次 Jev 的 key(只在启用判断时需要) | `rulemason key` |
|
|
26
|
+
| 不再使用:从项目卸载 | `rulemason remove` |
|
|
27
|
+
| 手动判断一个方案 | `rulemason judge --change 功能名` |
|
|
28
|
+
| 在 AI 工具里补项目简介、红线、命令表,或启用判断 | `/rulemason` |
|
|
29
|
+
|
|
30
|
+
## 第一次接入
|
|
31
|
+
|
|
32
|
+
在项目根目录运行:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
rulemason init # 交互选择工具,列出文件计划,确认一次后写入
|
|
36
|
+
rulemason init --tools claude,codex --yes # 非交互:不提问
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`init` 只做能确定做对的事:生成规则副本与各工具的入口,补齐方案写法规则、OpenSpec apply / archive 时给 AI 的检查点提示(`config.yaml` 的 `operations`)、ruff / ESLint 继承与项目的检查点规格;改不了的(例如 ruff 配置写了 `select`)只报告,不强行改写。不提交、不推送,不碰计划以外的文件。没有 `openspec/` 时会先询问并代为运行 `openspec init`。
|
|
40
|
+
|
|
41
|
+
然后在 AI 工具里运行 `/rulemason`,补项目简介、红线(注明出处并逐条确认)与命令表。
|
|
42
|
+
|
|
43
|
+
## 日常
|
|
44
|
+
|
|
45
|
+
日常开发走 OpenSpec,检查点由 AI 自动运行,不用记命令:
|
|
46
|
+
|
|
47
|
+
```txt
|
|
48
|
+
/opsx:propose 功能名 方案写完 -> 判断:格式问题 AI 自己改,碰红线的报告给你
|
|
49
|
+
/opsx:apply 功能名 写代码前再判断一次,有 block 就停下等你
|
|
50
|
+
写完 -> 自动精简 -> 独立只读审查 -> ruff -> 测试 -> 前端 lint -> 文案检查
|
|
51
|
+
/opsx:archive 功能名 归档,提交
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
自动精简只处理本次改动里的重复、死代码、冗余抽象或过复杂逻辑,保持需求、外部行为与 API 不变;Claude Code 下这一步用内置的 `/simplify`。独立审查者拿不到文件与命令工具,只看提供给它的改动与方案;必须修的问题自动修复并重新审查,不要求你逐条审核代码。
|
|
55
|
+
|
|
56
|
+
## 看现状
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
rulemason check # 只读,在项目任意子目录运行都可以
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
第一行就是结论和下一步,照着做即可,例如:
|
|
63
|
+
|
|
64
|
+
```txt
|
|
65
|
+
补项目信息:在 AI 工具中运行 /rulemason
|
|
66
|
+
接入:运行 rulemason update
|
|
67
|
+
日常巡检:一切一致
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
规则副本被改、工具入口缺失、lint 没有继承基础规则、项目还是旧格式时以非 0 退出,可以直接放进 CI:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
- uses: astral-sh/setup-uv@v6
|
|
74
|
+
- run: uv tool install rulemason==0.8.0
|
|
75
|
+
- run: rulemason check
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 给 AI 与脚本
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
rulemason check --json # 结构化结果:next.code 是稳定的动作代码,text 是上面的报告全文;退出码同上
|
|
82
|
+
rulemason init --plan [--json] # 只列接入计划:不写文件、不提问、不运行 openspec init
|
|
83
|
+
rulemason update --dry-run [--json] # 只列升级与补齐计划,不写文件
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`/rulemason` 读的就是 `check --json`;AI 替你接入前会先用 `init --plan` 给你看计划。
|
|
87
|
+
|
|
88
|
+
## 升级
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv tool upgrade rulemason
|
|
92
|
+
rulemason update
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`update` 直接刷新 rulemason 自己管的规则副本与入口;你自己的文件(ruff、ESLint、`openspec/config.yaml` 等)缺了配置时,它先列出补齐计划,确认后才写,非交互环境里要加 `--yes`。之后在项目里跑一遍 lint 与测试再提交。
|
|
96
|
+
|
|
97
|
+
## 判断(可选)
|
|
98
|
+
|
|
99
|
+
判断要求项目在 git 里、已归档至少 3 个 change;`rulemason check` 的「判断」一行会写明还差什么。要启用时在 AI 工具里运行 `/rulemason` 并说明要启用判断,它会整理候选判断规则让你逐条确认。
|
|
100
|
+
|
|
101
|
+
配 key(在自己的终端里运行,输入不显示,不会进命令历史):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
rulemason key
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
key 写在 `~/.config/rulemason/env`(权限 600),只在本机,不进任何仓库;环境变量 `TYPESAFE_API_KEY` 优先。
|
|
108
|
+
|
|
109
|
+
手动运行判断:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
rulemason judge --change 功能名 # 审 openspec/changes/功能名(已归档的也能直接用名字)
|
|
113
|
+
rulemason judge --change 功能名 --lint-only # 只跑正则检查,不联网
|
|
114
|
+
rulemason judge --copy # 审新增或改过的界面文案(项目配了 openspec/judge.yaml 才有)
|
|
115
|
+
rulemason judge --change 功能名 --dry-run # 打印将要发送的请求,不发送
|
|
116
|
+
rulemason judge --template judgments # 打印启用判断用的模板(judgments、judge、judge_cases)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
项目代码也可以把引擎当库用:`from rulemason.judge import load_rules, verdict_or_pending`。
|
|
120
|
+
|
|
121
|
+
## 卸载
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
rulemason remove --plan # 只看计划,不改任何文件
|
|
125
|
+
rulemason remove # 列出计划,确认后卸载;非交互环境加 --yes
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`remove` 删掉 rulemason 生成的东西:规则副本、各工具的 skill、`.rulemason.yaml`、AGENTS.md / CLAUDE.md 里的 rulemason 标记块、OpenCode 配置里指向 `.rulemason/` 的条目,以及没被改过的 `operations` 提示。ruff、ESLint 还在继承基础规则时,会把这两个文件移到项目的 `lint/` 并改好路径,lint 结果不变。手改过的副本保留;产物写法规则、项目的检查点规格、命令表和红线已是项目内容,只在汇报里列出,不删。本机装的 rulemason 不受影响,不用了再运行 `uv tool uninstall rulemason`。
|
|
129
|
+
|
|
130
|
+
## 出了问题怎么办
|
|
131
|
+
|
|
132
|
+
rulemason 往项目里写三类东西,都由它管理,不要手改:
|
|
133
|
+
|
|
134
|
+
- **规则副本**:`.rulemason/` 与各工具目录下的 `skills/rulemason/SKILL.md`。
|
|
135
|
+
- **标记块**:`AGENTS.md`、`CLAUDE.md` 里 `<!-- rulemason:… -->` 与 `<!-- /rulemason:… -->` 之间的内容;块外是你自己的内容,rulemason 不碰。
|
|
136
|
+
- **清单**:`.rulemason.yaml`,记录选了哪些工具、rulemason 版本与每个副本的校验值。
|
|
137
|
+
|
|
138
|
+
| `check` 第一行 | 原因 | 怎么办 |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| `接入:运行 rulemason update` | 副本或标记块被手改、入口缺失、配置没补齐 | 运行 `rulemason update`;要改规矩,到本仓库改了发布新版本 |
|
|
141
|
+
| `接入:修改 .gitignore,放行 skills/rulemason/` | `.gitignore` 忽略了工具目录,副本提交不上去 | 改成只放行 `skills/rulemason/`;说明单独写一行,git 不支持行尾注释 |
|
|
142
|
+
| `接入:运行 rulemason init` | 这个目录(或它所在的仓库)还没接入 | 在项目根运行 `rulemason init` |
|
|
143
|
+
| `接入:先修正 .rulemason.yaml` | 清单被改坏,读不出来 | 按提示修正,或删掉它后重新 `rulemason init` |
|
|
144
|
+
| `接入:运行 rulemason init 迁移格式` | 项目还是 rulekit 0.5 的格式 | 见下一节 |
|
|
145
|
+
| `补项目信息:…` | 项目简介、红线待补,或有旧名残留 | 在 AI 工具里运行 `/rulemason` |
|
|
146
|
+
|
|
147
|
+
## 从 rulekit 迁移
|
|
148
|
+
|
|
149
|
+
rulemason 的前身叫 rulekit(0.5.x)。已接入 rulekit 的项目:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
uv tool uninstall rulekit
|
|
153
|
+
uv tool install rulemason
|
|
154
|
+
rulemason init # 识别 .rulekit.yaml,列出迁移计划,确认一次后迁移
|
|
155
|
+
rulemason check # 看还有哪些旧名残留
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
迁移把 `.rulekit/`、`.rulekit.yaml`、`skills/rulekit/`、`<!-- rulekit:… -->` 标记块,以及 opencode、ruff、ESLint、项目检查点规格里的 `.rulekit/` 路径换成新名,结果与直接接入相同。旧副本被手改过时迁移停下并列出文件,不写任何东西。
|
|
159
|
+
|
|
160
|
+
标记块以外的旧名不会被自动修改,`check` 会列出来,在 AI 工具中运行 `/rulemason` 逐处确认后替换:
|
|
161
|
+
|
|
162
|
+
- 命令表里的 `jev-judge --change <name>` → `rulemason judge --change <name>`
|
|
163
|
+
- `.gitignore` 里的 `!.claude/skills/rulekit/` → `!.claude/skills/rulemason/`
|
|
164
|
+
- 项目测试里的 `from jev_judge import …` → `from rulemason.judge import …`
|
|
165
|
+
|
|
166
|
+
key 不用重配:`~/.config/rulemason/env` 不存在时,会读旧位置 `~/.config/jev-judge/env`;也可以运行一次 `rulemason key` 写到新位置。
|
|
167
|
+
|
|
168
|
+
## 参与修改
|
|
169
|
+
|
|
170
|
+
改共享规则会影响所有接入项目:在本仓库开 OpenSpec change,在受影响的项目里验证,发布新 tag 后各项目运行 `rulemason update`。
|
|
171
|
+
|
|
172
|
+
启用提交前钩子,拦截本机绝对路径(每个 clone 一次):
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
git config core.hooksPath .githooks
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
本地开发:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
uv sync
|
|
182
|
+
uv run ruff check .
|
|
183
|
+
uv run pytest
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## 许可证
|
|
187
|
+
|
|
188
|
+
[Apache-2.0](LICENSE)。版权声明见 [NOTICE](NOTICE)。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// ESLint 基础规则:代码写法的机械部分(rules/code-style.md)。只导出纯规则,不引插件:插件会从本仓库目录解析,而这里没有 node_modules
|
|
2
|
+
export default {
|
|
3
|
+
"no-console": "error",
|
|
4
|
+
"no-nested-ternary": "error",
|
|
5
|
+
// 空块(含空 catch,九条第 8 条)。确需空 catch 的项目在自己的配置里放宽并写明原因
|
|
6
|
+
"no-empty": "error",
|
|
7
|
+
// 取 15 而非 Python 的 10:JSX 里每个 && 和 ?: 都算一个分支,同样的上限放到组件上会严得多。
|
|
8
|
+
// 项目当前代码超出时,在自己的配置里用当前最复杂函数的值覆盖,写明递减计划,只降不升
|
|
9
|
+
complexity: ["error", 15],
|
|
10
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ruff 基础规则:代码写法的机械部分(rules/code-style.md)。项目用 extend 继承,只写自己的豁免并注明原因,不写 select。
|
|
2
|
+
|
|
3
|
+
[lint]
|
|
4
|
+
# 只启用 select 里点名的预览规则(PLW1514);预览模式也会改变部分稳定规则的行为,升级 ruff 后留意新增报错
|
|
5
|
+
preview = true
|
|
6
|
+
explicit-preview-rules = true
|
|
7
|
+
select = [
|
|
8
|
+
"ERA001", # 注释掉的代码(九条第 6 条)
|
|
9
|
+
"T201", # print(第 6 条)
|
|
10
|
+
"BLE001", # 过宽的 except Exception(第 8 条)
|
|
11
|
+
"E722", # 裸 except:(第 8 条)
|
|
12
|
+
"C901", # 圈复杂度
|
|
13
|
+
"F", # pyflakes:未用导入与变量、未定义名(第 6、9 条)
|
|
14
|
+
"E701", # 冒号后接语句写在同一行(附加条款「一行只做一件事」)
|
|
15
|
+
"E702", # 一行用分号写多条语句(同上)
|
|
16
|
+
"RUF021", # a and b or c 不加括号(附加条款「要停下来想优先级的表达式拆开写」)
|
|
17
|
+
"PLW1514", # 读写文本不写 encoding(python.md;Windows 中文版默认按 GBK 读写)
|
|
18
|
+
"B", # bugbear:zip 不写 strict、可变默认值等常见坑;框架约定在参数默认值里调函数的,由项目用 extend-immutable-calls 声明
|
|
19
|
+
"I", # import 排序
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[lint.mccabe]
|
|
23
|
+
max-complexity = 10
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 产物写法基础版:各项目照写进 openspec/config.yaml 的 rules 段,只追加不改写(OpenSpec 配置不能引用外部文件)
|
|
2
|
+
rules:
|
|
3
|
+
proposal:
|
|
4
|
+
- 必须说明本次明确不做的事:Non-goals 小节,或 What Changes 中以「不做」开头的条目,二者取一即可
|
|
5
|
+
- 控制在 60 行以内,只写为什么和改什么,不写怎么实现
|
|
6
|
+
design:
|
|
7
|
+
- Decisions 每条决策写明至少一个被否决的备选方案及否决理由
|
|
8
|
+
- Risks 每条用「[风险] → 对策」格式,一行一条
|
|
9
|
+
- Migration Plan 写明上线顺序与回滚方式
|
|
10
|
+
- 列出新增与修改的文件及每个文件的估计行数,apply 后对照;超出一倍要说明原因
|
|
11
|
+
specs:
|
|
12
|
+
- 每个 Requirement 至少一个 Scenario,用 WHEN / THEN
|
|
13
|
+
- 用 SHALL / MUST 表达约束,不用 should / may
|
|
14
|
+
- 每条 Requirement 正文不超过 500 个字符(openspec validate --strict 的上限)
|
|
15
|
+
tasks:
|
|
16
|
+
- 每条任务两小时内可完成,并写明怎么验证它完成了
|