@sublang/spex 0.3.0 → 2.0.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/README.md +72 -17
- package/dist/append-agent-specs.d.ts +10 -3
- package/dist/append-agent-specs.js +28 -29
- package/dist/cli.js +7 -1
- package/dist/copy-templates.d.ts +19 -0
- package/dist/copy-templates.js +90 -7
- package/dist/create-specs-structure.js +2 -4
- package/dist/lint.d.ts +15 -0
- package/dist/lint.js +959 -0
- package/dist/markdown.d.ts +46 -0
- package/dist/markdown.js +130 -0
- package/dist/scaffold.js +87 -28
- package/package.json +15 -7
- package/scaffold/.file-history.json +32 -29
- package/scaffold/.legacy-file-history.json +48 -0
- package/scaffold/LICENSE +202 -0
- package/scaffold/agent-specs.txt +6 -2
- package/scaffold/i18n/zh/specs/map.md +15 -27
- package/scaffold/i18n/zh/specs/meta.md +130 -90
- package/scaffold/specs/decisions/000-spec-structure-format.md +41 -31
- package/scaffold/specs/intents/000-spdx-headers.md +39 -0
- package/scaffold/specs/map.md +13 -26
- package/scaffold/specs/meta.md +119 -79
- package/scaffold/specs/packages/git.md +46 -0
- package/scaffold/specs/packages/licensing.md +56 -0
- package/scaffold/update-merge-prompt.md +9 -1
- package/scaffold/specs/dev/git.md +0 -28
- package/scaffold/specs/dev/licensing.md +0 -44
- package/scaffold/specs/iterations/000-spdx-headers.md +0 -35
- package/scaffold/specs/test/licensing.md +0 -20
- package/scaffold/specs/user/.gitkeep +0 -0
package/scaffold/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.
|
package/scaffold/agent-specs.txt
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
## Specs (Source of Truth)
|
|
2
2
|
|
|
3
|
-
- Canonical specs live in
|
|
3
|
+
- Canonical specs live in @specs/.
|
|
4
|
+
Start with @specs/map.md for a quick-reference index of all spec files and @specs/meta.md for the spec format; spec packages live in @specs/packages.
|
|
4
5
|
- Before making changes or suggestions in an area that has a spec, read the relevant spec file(s) first and follow them.
|
|
5
|
-
-
|
|
6
|
+
- Whenever your changes involve any spec, or you make a decision worth recording, keep the specs in sync — don't let them drift.
|
|
7
|
+
- Resolve conflicts spec-first, then iterate freely: an intended change that conflicts with existing spec items is resolved in the specs — or dropped — before coding against it; implementing first to explore an approach is fine, and implementation lessons update this intent's specs, but no intent completes until its specs and code agree.
|
|
8
|
+
- Keep specs lawful per @specs/meta.md — the law itself, not this summary: complete and exact (meta-34), minimal (meta-23), one requirement per item (meta-29), cohesive packages for a shared intent (meta-13), sections per meta-30, relationships and test evidence only as inline citations (meta-14, meta-16, meta-20), integration/system tests only (meta-21, meta-32).
|
|
9
|
+
- Run `spex lint` to check structure, item IDs, and citations after editing specs; never add trace lines to satisfy an older checker.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
2
|
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
<!-- spex-i18n-source: map.md sha256-6d93bd3c2c2fc35e0806229f45c751429ae4ef7ae86ff9e9089b76b0edbf7461 -->
|
|
3
4
|
|
|
4
5
|
# 规约地图
|
|
5
6
|
|
|
@@ -11,44 +12,31 @@
|
|
|
11
12
|
|
|
12
13
|
在编写、修改或审阅 DR、IR 或条目前,先了解 [`meta.md`](meta.md) 中的规则。
|
|
13
14
|
|
|
14
|
-
- DR 和 IR:见 [Organization](meta.md#organization)、[Record format](meta.md#record-format) 和 [Citation](meta.md#citation)。
|
|
15
|
-
- 条目:见 [Organization](meta.md#organization)、[Item syntax](meta.md#item-syntax)、[Spec packages](meta.md#spec-packages) 和 [Citation](meta.md#citation)。
|
|
16
|
-
|
|
17
15
|
## 目录结构
|
|
18
16
|
|
|
19
17
|
```text
|
|
20
|
-
decisions/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
map.md 本索引
|
|
26
|
-
meta.md 规约的规约
|
|
18
|
+
decisions/ 决策记录(DRs)
|
|
19
|
+
intents/ 意图记录(IRs)
|
|
20
|
+
packages/ 规约包(每包一个文件)
|
|
21
|
+
map.md 本索引
|
|
22
|
+
meta.md 规约的规约
|
|
27
23
|
```
|
|
28
24
|
|
|
29
25
|
## 决策
|
|
30
26
|
|
|
31
27
|
| ID | 文件 | 摘要 |
|
|
32
28
|
| --- | --- | --- |
|
|
33
|
-
| DR-000
|
|
34
|
-
|
|
35
|
-
## 迭代
|
|
36
|
-
|
|
37
|
-
| ID | 文件 | 目标 |
|
|
38
|
-
| --- | --- | --- |
|
|
39
|
-
| IR-000 | [000-spdx-headers.md](iterations/000-spdx-headers.md) | 为适用文件添加 SPDX 头 |
|
|
40
|
-
|
|
41
|
-
## 包
|
|
29
|
+
| [DR-000](decisions/000-spec-structure-format.md) | 000-spec-structure-format.md | 规约结构、格式和命名约定 |
|
|
42
30
|
|
|
43
|
-
|
|
31
|
+
## 意图
|
|
44
32
|
|
|
45
|
-
|
|
|
33
|
+
| ID | 文件 | 意图 |
|
|
46
34
|
| --- | --- | --- |
|
|
47
|
-
|
|
|
35
|
+
| [IR-000](intents/000-spdx-headers.md) | 000-spdx-headers.md | 为适用文件添加 SPDX 头 |
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
## 规约包
|
|
50
38
|
|
|
51
|
-
|
|
|
52
|
-
| --- | --- |
|
|
53
|
-
|
|
|
54
|
-
|
|
|
39
|
+
| 文件 | 摘要 |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| [git.md](packages/git.md) | 提交信息格式和 AI 共同作者 trailers |
|
|
42
|
+
| [licensing.md](packages/licensing.md) | SPDX 头要求与验证检查 |
|
|
@@ -1,181 +1,221 @@
|
|
|
1
1
|
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
2
|
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
<!-- AI agents: do not edit this file without human approval. -->
|
|
4
|
+
<!-- spex-i18n-source: meta.md sha256-ba58b39de3537f06fbe4f13c9b1443a8a64cf090c9ba202a67263dfc054b78c8 -->
|
|
3
5
|
|
|
4
|
-
#
|
|
6
|
+
# meta: 规约定义
|
|
5
7
|
|
|
6
|
-
##
|
|
8
|
+
## Intent
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
This file defines the structure and organization of specifications (specs), per [DR-000](decisions/000-spec-structure-format.md).
|
|
9
11
|
|
|
10
|
-
##
|
|
12
|
+
## Overall
|
|
11
13
|
|
|
12
|
-
###
|
|
14
|
+
### meta-1
|
|
13
15
|
|
|
14
16
|
The `specs/` directory shall contain the following subdirectories and files:
|
|
15
17
|
|
|
16
18
|
| Path | Content | File Naming |
|
|
17
19
|
| --------- | ------- | ------ |
|
|
18
|
-
| `decisions/` |
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `test/` | item files for acceptance testing | [\<path\>/]\<kebab-case\>.md |
|
|
23
|
-
| `map.md` | spec index for navigation with item files organized by packages | - |
|
|
20
|
+
| `decisions/` | decision records (DRs) | \<NNN\>-\<kebab-case\>.md |
|
|
21
|
+
| `intents/` | intent records (IRs) | \<NNN\>-\<kebab-case\>.md |
|
|
22
|
+
| `packages/` | spec packages | \<kebab-case\>.md |
|
|
23
|
+
| `map.md` | spec index — start here for context search | - |
|
|
24
24
|
| `meta.md` | the spec of specs | - |
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
### META-3
|
|
26
|
+
### meta-23
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
A spec in any form shall contain the minimal information, concisely expressed, to act on it or audit it, preferring bullets, tables, or (renderable) diagrams to prose:
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
- For example, `map.md` limits its indexes to those an AI agent needs to find the right files.
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
### meta-25
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
A spec file shall keep one sentence per line — with lists, tables, and diagrams exempt.
|
|
36
35
|
|
|
37
36
|
## Record format
|
|
38
37
|
|
|
39
|
-
<!-- spex-i18n-source:
|
|
40
|
-
###
|
|
38
|
+
<!-- spex-i18n-source: meta-4 sha256-5ea8737b4d744c55c6c564672f86199e62a0caad95bbba2fb498b6c9407226c8 -->
|
|
39
|
+
### meta-4
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
Each DR shall follow the ADR format [[2]], with sections `状态`, `背景`, `决策`, `影响`, and `参考资料`.
|
|
43
42
|
|
|
44
|
-
<!-- spex-i18n-source:
|
|
45
|
-
###
|
|
43
|
+
<!-- spex-i18n-source: meta-5 sha256-6847734892ace98018676f3430e0a848b0a83541b23f1b4f69aa9b12a1c0aeda -->
|
|
44
|
+
### meta-5
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
Each IR shall contain sections `状态`, `意图`, `交付项` (with checkboxes), `任务` (numbered, each sized to one commit), and `验证`.
|
|
48
47
|
|
|
49
|
-
###
|
|
48
|
+
### meta-22
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
A record's ID shall join its kind prefix to its filename's leading number — `DR-<NNN>` under `decisions/`, `IR-<NNN>` under `intents/` — with the leading number unique within each record kind.
|
|
52
51
|
|
|
53
|
-
###
|
|
52
|
+
### meta-24
|
|
54
53
|
|
|
55
|
-
A DR shall
|
|
56
|
-
A DR is sufficient when an implementer can generate or audit code from the design intent, constraints, and tradeoffs.
|
|
57
|
-
Implementation details shall be included only when they are part of the design contract.
|
|
54
|
+
A DR shall record design decisions and constraints, not implementation details, sufficient to provide context for or to audit the corresponding spec items.
|
|
58
55
|
|
|
59
|
-
###
|
|
56
|
+
### meta-28
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
List items and table cells are exempt, since their delimiters already isolate per-entry changes.
|
|
63
|
-
Fixed-width column wrapping within a sentence is allowed.
|
|
58
|
+
An IR shall be disposable: it contains nothing a DR or a spec item should cover, and its deletion loses no design or behavior record.
|
|
64
59
|
|
|
65
60
|
## Item syntax
|
|
66
61
|
|
|
67
|
-
<!-- spex-i18n-source:
|
|
68
|
-
###
|
|
62
|
+
<!-- spex-i18n-source: meta-6 sha256-c6c53324be46702a10d6ca65a71842222518a1a2e32b8ccd334e361b70fbab75 -->
|
|
63
|
+
### meta-6
|
|
69
64
|
|
|
70
|
-
每个规约条目应使用 GEARS 模式 [[1]]
|
|
65
|
+
每个规约条目应使用 GEARS 模式 [[1]],其子句和标点遵循自然的中文习惯:
|
|
71
66
|
|
|
72
67
|
```text
|
|
73
|
-
[给定 <静态前置条件>] [如果 <状态前置条件>] [当
|
|
68
|
+
[给定 <静态前置条件>] [如果 <状态前置条件>] [当 <触发条件>] <主体> 应 <行为>。
|
|
74
69
|
```
|
|
75
70
|
|
|
76
|
-
子句和标点应遵循标准中文习惯。
|
|
77
|
-
|
|
78
71
|
| 子句 | 用途 | 示例 |
|
|
79
72
|
| ------ | ------- | ------- |
|
|
80
73
|
| 给定/Where | 静态前置条件(特性、配置) | 给定调试模式已启用 |
|
|
81
74
|
| 如果/While | 状态前置条件(运行时状态) | 如果连接处于活动状态 |
|
|
82
|
-
| 当/When |
|
|
83
|
-
| 应/shall | 所要求的行为 |
|
|
75
|
+
| 当/When | 触发事件——最多一个 | 当用户点击提交 |
|
|
76
|
+
| 应/shall | 所要求的行为 | 表单应校验输入并标示每处违规 |
|
|
84
77
|
|
|
85
|
-
<!-- spex-i18n-source:
|
|
86
|
-
###
|
|
78
|
+
<!-- spex-i18n-source: meta-7 sha256-4c4ede3e11a0482d645f0d5154791a1e4e83438033b93d4fc8b359b00f2190ad -->
|
|
79
|
+
### meta-7
|
|
87
80
|
|
|
88
|
-
|
|
81
|
+
给定测试用例可用 Given-When-Then(GWT)表达,其规约条目应将 GWT 映射到 GEARS 子句 [[meta-6](#meta-6)]:
|
|
89
82
|
|
|
90
83
|
| GWT | 子句 |
|
|
91
84
|
| --- | ------ |
|
|
92
|
-
| Given |
|
|
93
|
-
| When |
|
|
94
|
-
| Then |
|
|
85
|
+
| Given | 给定 + 如果 |
|
|
86
|
+
| When | 当 |
|
|
87
|
+
| Then | 应 |
|
|
88
|
+
|
|
89
|
+
### meta-8
|
|
95
90
|
|
|
96
|
-
|
|
91
|
+
Each spec item shall be self-contained: every reliance on another item is an explicit citation [[meta-16](#meta-16)].
|
|
97
92
|
|
|
98
|
-
|
|
93
|
+
### meta-29
|
|
99
94
|
|
|
100
|
-
|
|
101
|
-
- Citations to other specs or shared sections shall be explicit.
|
|
95
|
+
Each spec item shall state one requirement in one GEARS statement [[meta-6](#meta-6)], with attachments introduced by a colon at the statement's end and elaborating only that requirement:
|
|
102
96
|
|
|
103
|
-
|
|
97
|
+
| Item kind | Example attachment |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| Behavior | ordered steps or the cases and outcomes of one operation or decision |
|
|
100
|
+
| Test | the assertions of one execution flow or one explicit case matrix |
|
|
104
101
|
|
|
105
|
-
|
|
102
|
+
- An attachment may take a form such as a note, list, table, (renderable) diagram, or example.
|
|
103
|
+
- A condition inside an attachment is a case label.
|
|
104
|
+
- Differing stateful preconditions or triggers are evidence of additional spec items.
|
|
106
105
|
|
|
107
106
|
## Spec packages
|
|
108
107
|
|
|
109
|
-
###
|
|
108
|
+
### meta-13
|
|
110
109
|
|
|
111
|
-
A spec package shall
|
|
110
|
+
A spec package shall define a closed set of subjects and their behavioral requirements for a shared intent.
|
|
112
111
|
|
|
113
|
-
###
|
|
112
|
+
### meta-34
|
|
114
113
|
|
|
115
|
-
A spec package shall
|
|
114
|
+
A spec package shall be complete and exact for its intent: sufficient to reimplement its behavior, stating no requirement beyond that intent, leaving no gap within it, and stating no requirement another spec already states.
|
|
116
115
|
|
|
117
|
-
|
|
116
|
+
### meta-9
|
|
118
117
|
|
|
119
|
-
|
|
118
|
+
A spec package shall be one file containing spec items under `specs/packages/` or its subdirectory.
|
|
120
119
|
|
|
121
|
-
|
|
120
|
+
<!-- spex-i18n-source: meta-30 sha256-0157482272767b0d31d355728e8b2df551310d4248d380ab886f71e6d0bfe93b -->
|
|
121
|
+
### meta-30
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
Each package file shall contain only the following sections, in this order:
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
| Section | Presence | Content |
|
|
126
|
+
| ------- | -------- | ------- |
|
|
127
|
+
| `意图` | required | the package's purpose |
|
|
128
|
+
| `外部行为` | required | outcomes and guarantees the package's users may rely on |
|
|
129
|
+
| `内部行为` | optional | behavior hidden from the package's users |
|
|
130
|
+
| `验证` | required | test items verifying this package's behavior |
|
|
131
|
+
| `参考资料` | optional | external sources [[meta-19](#meta-19)] |
|
|
126
132
|
|
|
127
|
-
|
|
133
|
+
- A package's user is any human or system component using its contract; External and Internal are relative to the package.
|
|
134
|
+
- Topic subsections and item headings live inside the Behavior and Verification sections.
|
|
128
135
|
|
|
129
|
-
###
|
|
136
|
+
### meta-10
|
|
130
137
|
|
|
131
|
-
A spec
|
|
138
|
+
A file containing spec items shall use a lowercase kebab-case basename \<pack\>.md unique across the specs tree, with \<pack\> serving as its identifier.
|
|
132
139
|
|
|
133
|
-
###
|
|
140
|
+
### meta-11
|
|
134
141
|
|
|
135
|
-
|
|
142
|
+
Each spec item shall use \<pack\>-\<N\> as its lowercase heading, anchor, and citation text:
|
|
136
143
|
|
|
137
|
-
|
|
144
|
+
- \<pack\> is its containing file's identifier [[meta-10](#meta-10)];
|
|
145
|
+
- \<N\> is a positive integer unique within that file;
|
|
146
|
+
- a new item takes the lowest positive \<N\> neither assigned nor reserved by a public release [[meta-12](#meta-12)].
|
|
138
147
|
|
|
139
|
-
|
|
148
|
+
### meta-12
|
|
140
149
|
|
|
141
|
-
|
|
150
|
+
A publicly released item ID shall remain permanently bound to the concern its item names:
|
|
142
151
|
|
|
143
|
-
|
|
152
|
+
- the ID is never renumbered or reassigned;
|
|
153
|
+
- the item's content may evolve only with that concern preserved;
|
|
154
|
+
- an unreleased ID can be reassigned.
|
|
144
155
|
|
|
145
|
-
|
|
156
|
+
### meta-14
|
|
146
157
|
|
|
147
|
-
|
|
158
|
+
A behavior item shall express every peer package relationship as a binding citation — an inline citation of that package's External Behavior at the exact phrase the cited behavior makes specific [[meta-16](#meta-16)]:
|
|
148
159
|
|
|
149
|
-
|
|
160
|
+
- a binding citation binds behavior, never package subjects or states alone;
|
|
161
|
+
- one phrase may carry several binding citations when several behaviors make its different parts specific, respectively;
|
|
162
|
+
- there is no uncited peer package dependency.
|
|
150
163
|
|
|
151
|
-
###
|
|
164
|
+
### meta-15
|
|
152
165
|
|
|
153
|
-
|
|
166
|
+
A spec package shall stand alone: readable in full without following any link — a citation never carries its meaning.
|
|
154
167
|
|
|
155
|
-
|
|
156
|
-
### META-19
|
|
168
|
+
### meta-31
|
|
157
169
|
|
|
158
|
-
|
|
170
|
+
A lowercase kebab-case subdirectory under `specs/packages/` shall be an organizational collection only: a file's identity is its basename [[meta-10](#meta-10)]; moving a file between collections changes relative citation paths but no item ID or anchor.
|
|
159
171
|
|
|
160
|
-
|
|
172
|
+
## Testing
|
|
161
173
|
|
|
162
|
-
|
|
174
|
+
### meta-21
|
|
163
175
|
|
|
164
|
-
|
|
176
|
+
Spec test items shall specify integration and system tests only: unit tests belong to the implementation, and no spec item specifies one.
|
|
165
177
|
|
|
166
|
-
|
|
178
|
+
### meta-32
|
|
167
179
|
|
|
168
|
-
|
|
169
|
-
### META-27
|
|
180
|
+
A test shall prefer executing the real behaviors bound by the behaviors it verifies [[meta-14](#meta-14)] to supplying substitutes for them.
|
|
170
181
|
|
|
171
|
-
|
|
182
|
+
### meta-33
|
|
183
|
+
|
|
184
|
+
Each package's `Verification` section shall verify every behavior in that package, white-box or black-box.
|
|
185
|
+
|
|
186
|
+
## Citation
|
|
187
|
+
|
|
188
|
+
### meta-16
|
|
189
|
+
|
|
190
|
+
A citation of a spec item or record shall be an inline relative link with the cited ID as its link text:
|
|
191
|
+
|
|
192
|
+
| Cited | Form |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| Spec item | its heading anchor, in an outer pair of square brackets (e.g., `[[meta-1](meta.md#meta-1)]`) |
|
|
195
|
+
| Record | its file, with no outer brackets (e.g., `[DR-000](decisions/000-spec-structure-format.md)`) |
|
|
172
196
|
|
|
173
|
-
|
|
197
|
+
### meta-18
|
|
174
198
|
|
|
175
|
-
|
|
176
|
-
|
|
199
|
+
No DR or spec item shall cite an IR or name it in prose.
|
|
200
|
+
|
|
201
|
+
### meta-19
|
|
202
|
+
|
|
203
|
+
An external reference shall cite an authoritative source (e.g., official docs) by a numbered marker (e.g., `[[1]]`) linked to a specific URL in the file's references section, which holds no uncited entry.
|
|
204
|
+
|
|
205
|
+
### meta-20
|
|
206
|
+
|
|
207
|
+
A test item shall identify every behavior it verifies by an inline citation at the verifying assertion, with behavior citations confined to its own package.
|
|
208
|
+
|
|
209
|
+
## Authoring language
|
|
210
|
+
|
|
211
|
+
<!-- spex-i18n-source: meta-27 sha256-b19f392d742d307fb0f811892dbb65509b36dc3a9636512604c636b7b0aa5c29 -->
|
|
212
|
+
### meta-27
|
|
213
|
+
|
|
214
|
+
Where a specs tree declares an authoring language — by this item's machine-readable marker line, in the exact format `Authoring language: <code>` with `<code>` of only ASCII letters, digits, and hyphens — spec content added for that project shall be authored in that language:
|
|
215
|
+
|
|
216
|
+
Authoring language: zh
|
|
177
217
|
|
|
178
|
-
##
|
|
218
|
+
## References
|
|
179
219
|
|
|
180
220
|
[1]: https://sublang.ai/zh/ref/gears-ai-ready-spec-syntax "GEARS:面向 AI 的规约语法(中文)"
|
|
181
221
|
[2]: https://github.com/npryce/adr-tools "ADR Tools"
|