@sublang/spex 0.3.0 → 1.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.
@@ -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.
@@ -1,5 +1,13 @@
1
1
  ## Specs (Source of Truth)
2
2
 
3
- - Canonical specs live in `specs/`. Start with `specs/map.md` for a quick-reference index of all spec files.
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.
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
- - If unsure which spec applies, search `specs/` and propose the most relevant file(s) before proceeding.
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
+ - Keep specs:
8
+ - Complete & coherent: sufficient for you to reimplement code.
9
+ - Right level: each package file in @specs/packages holds its shared intent (## Intent), behavior its users may rely on (## External Behavior), optional implementation hidden from them (## Internal Behavior), and tests of its own claims (## Verification); behavior that emerges from several packages working together is itself a spec package citing the peers' External Behavior — there is no @specs/compositions. Specify integration/system testing, not unit testing, and prefer tests that execute the real behavior of cited packages over substitutes.
10
+ - Minimal: essential and concise; also check against other spec items to avoid overlap.
11
+ - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
12
+ - Single-source: item citations are enclosed relative links like `[[pack-3](pack.md#pack-3)]`, written inline at the phrase that relies on them; items carry no metadata lines (`Verifies:`, `Binds:`, `Composes:`, `Clients:`, `Suppliers:`, `Scope:`).
13
+ - Run `spex lint` to check structure, item IDs, and citations after editing specs; never add trace lines to satisfy an older checker.
@@ -11,19 +11,17 @@
11
11
 
12
12
  在编写、修改或审阅 DR、IR 或条目前,先了解 [`meta.md`](meta.md) 中的规则。
13
13
 
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)。
14
+ - DR 和 IR:见 [Overall](meta.md#overall)、[Record format](meta.md#record-format) 和 [Citation](meta.md#citation)。
15
+ - 条目:见 [Overall](meta.md#overall)、[Item syntax](meta.md#item-syntax)、[Spec packages](meta.md#spec-packages)、[Testing](meta.md#testing) 和 [Citation](meta.md#citation)。
16
16
 
17
17
  ## 目录结构
18
18
 
19
19
  ```text
20
- decisions/ 决策记录(DRs)
21
- iterations/ 迭代记录(IRs)
22
- user/ 用户可见行为
23
- dev/ 实现要求
24
- test/ 验收测试
25
- map.md 本索引
26
- meta.md 规约的规约
20
+ decisions/ 决策记录(DRs)
21
+ intents/ 意图记录(IRs)
22
+ packages/ 规约包(每包一个文件)
23
+ map.md 本索引
24
+ meta.md 规约的规约
27
25
  ```
28
26
 
29
27
  ## 决策
@@ -32,23 +30,15 @@ meta.md 规约的规约
32
30
  | --- | --- | --- |
33
31
  | DR-000 | [000-spec-structure-format.md](decisions/000-spec-structure-format.md) | 规约结构、格式和命名约定 |
34
32
 
35
- ## 迭代
33
+ ## 意图
36
34
 
37
- | ID | 文件 | 目标 |
35
+ | ID | 文件 | 意图 |
38
36
  | --- | --- | --- |
39
- | IR-000 | [000-spdx-headers.md](iterations/000-spdx-headers.md) | 为适用文件添加 SPDX 头 |
37
+ | IR-000 | [000-spdx-headers.md](intents/000-spdx-headers.md) | 为适用文件添加 SPDX 头 |
40
38
 
41
39
  ## 包
42
40
 
43
- ### GIT
44
-
45
- | 分组 | 文件 | 摘要 |
46
- | --- | --- | --- |
47
- | dev | [git.md](dev/git.md) | 提交信息格式和 AI 共同作者 trailers |
48
-
49
- ### LIC
50
-
51
- | 分组 | 文件 | 摘要 |
52
- | --- | --- | --- |
53
- | dev | [licensing.md](dev/licensing.md) | SPDX 头要求和文件范围规则 |
54
- | test | [licensing.md](test/licensing.md) | 版权和许可证头存在性检查 |
41
+ | 文件 | 摘要 |
42
+ | --- | --- |
43
+ | [git.md](packages/git.md) | 提交信息格式和 AI 共同作者 trailers |
44
+ | [licensing.md](packages/licensing.md) | SPDX 头要求与验证检查 |
@@ -1,91 +1,81 @@
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. -->
3
4
 
4
- # META: 规约定义
5
+ # meta: 规约定义
5
6
 
6
7
  ## 意图
7
8
 
8
9
  本规约定义 specifications(specs)的结构和组织方式,遵循 [DR-000](decisions/000-spec-structure-format.md)。
9
10
 
10
- ## Organization
11
+ ## Overall
11
12
 
12
- ### META-1
13
+ ### meta-1
13
14
 
14
15
  The `specs/` directory shall contain the following subdirectories and files:
15
16
 
16
17
  | Path | Content | File Naming |
17
18
  | --------- | ------- | ------ |
18
- | `decisions/` | Decision records (DRs) | \<NNN\>-\<kebab-case\>.md |
19
- | `iterations/` | Iteration records (IRs) | \<NNN\>-\<kebab-case\>.md |
20
- | `user/` | item files for user-visible behavior | [\<path\>/]\<kebab-case\>.md |
21
- | `dev/` | item files for implementation requirements | [\<path\>/]\<kebab-case\>.md |
22
- | `test/` | item files for acceptance testing | [\<path\>/]\<kebab-case\>.md |
23
- | `map.md` | spec index for navigation with item files organized by packages | - |
19
+ | `decisions/` | decision records (DRs) | \<NNN\>-\<kebab-case\>.md |
20
+ | `intents/` | intent records (IRs) | \<NNN\>-\<kebab-case\>.md |
21
+ | `packages/` | spec packages | \<kebab-case\>.md |
22
+ | `map.md` | spec index — start here for context search | - |
24
23
  | `meta.md` | the spec of specs | - |
25
24
 
26
- <!-- spex-i18n-source: META-3 sha256-12d340f3809b0e5b716d164ba2e81ee7189d22ecb18331f8910277f65203efc6 -->
27
- ### META-3
25
+ ### meta-23
28
26
 
29
- 每个条目文件应包含一个说明其目的的 `## 意图` 章节。
27
+ 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
28
 
31
- ### META-21
29
+ ### meta-25
32
30
 
33
- Test items shall focus on integration and system testing.
34
-
35
- Unit tests shall be part of the implementation and shall not be specified as spec items.
31
+ A spec file shall keep one sentence per line — with lists, tables, and diagrams exempt.
36
32
 
37
33
  ## Record format
38
34
 
39
- <!-- spex-i18n-source: META-4 sha256-9fc0367f908c00eccdabd063021de2a66421a128ec34234a611f9271676598cc -->
40
- ### META-4
35
+ <!-- spex-i18n-source: meta-4 sha256-5ea8737b4d744c55c6c564672f86199e62a0caad95bbba2fb498b6c9407226c8 -->
36
+ ### meta-4
41
37
 
42
- 每个决策记录(DR)应遵循 ADR 格式 [[2]],并包含以下章节:状态、背景、决策、影响。
38
+ 每个决策记录(DR)应遵循 ADR 格式 [[2]],并包含以下章节:状态、背景、决策、影响与参考资料。
43
39
 
44
- <!-- spex-i18n-source: META-5 sha256-f50b8ba3ae8a9c1e8ebb9d7f368a1acb3159de392169c2e9296ab37883572ef1 -->
45
- ### META-5
40
+ <!-- spex-i18n-source: meta-5 sha256-6847734892ace98018676f3430e0a848b0a83541b23f1b4f69aa9b12a1c0aeda -->
41
+ ### meta-5
46
42
 
47
- 每个迭代记录(IR)应包含以下章节:目标、交付项(带复选框)、任务(编号且每项为一次提交大小)和验收标准。
43
+ 每个意图记录(IR)应包含以下章节:状态、意图、交付项(带复选框)、任务(编号且每项为一次提交大小)和验证。
48
44
 
49
- ### META-23
45
+ ### meta-22
50
46
 
51
- DRs and IRs shall be written in concise language, including only what is needed to act on or audit the record, with preference for bullets and tables over prose paragraphs.
47
+ 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
48
 
53
- ### META-24
49
+ ### meta-24
54
50
 
55
- A DR shall specify design decisions and constraints, not duplicate implementation logic.
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.
51
+ A DR shall record design decisions and constraints, not implementation details, sufficient to provide context for or to audit the corresponding spec items.
58
52
 
59
- ### META-25
53
+ ### meta-28
60
54
 
61
- In prose paragraphs of DRs and IRs, each sentence shall begin on a new line for diff readability.
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.
55
+ 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
56
 
65
57
  ## Item syntax
66
58
 
67
- <!-- spex-i18n-source: META-6 sha256-6a388878944a9426f53055410b686e33879d1e10c06c86d0d103b6a2f2d3a66c -->
68
- ### META-6
59
+ <!-- spex-i18n-source: meta-6 sha256-c6c53324be46702a10d6ca65a71842222518a1a2e32b8ccd334e361b70fbab75 -->
60
+ ### meta-6
69
61
 
70
- 每个规约条目应使用 GEARS 模式 [[1]]:
62
+ 每个规约条目应使用 GEARS 模式 [[1]],其子句和标点遵循自然的中文习惯:
71
63
 
72
64
  ```text
73
65
  [给定 <静态前置条件>] [如果 <状态前置条件>] [当 <触发>] <主体>应<行为>。
74
66
  ```
75
67
 
76
- 子句和标点应遵循标准中文习惯。
77
-
78
68
  | 子句 | 用途 | 示例 |
79
69
  | ------ | ------- | ------- |
80
70
  | 给定/Where | 静态前置条件(特性、配置) | 给定调试模式已启用 |
81
71
  | 如果/While | 状态前置条件(运行时状态) | 如果连接处于活动状态 |
82
- | 当/When | 触发事件(最多一个) | 当用户点击提交 |
83
- | 应/shall | 所要求的行为 | 表单应校验输入 |
72
+ | 当/When | 触发事件——最多一个 | 当用户点击提交 |
73
+ | 应/shall | 所要求的行为 | 表单应校验输入并标示每处违规 |
84
74
 
85
- <!-- spex-i18n-source: META-7 sha256-7e2912d02d3d967a84c2ec8c850db8baa378197d78e517eb269ee665b9676426 -->
86
- ### META-7
75
+ <!-- spex-i18n-source: meta-7 sha256-19317e57aa3b772b0baaa6fc119532ee806d70acb1c0b700403eb3d9e9ed7419 -->
76
+ ### meta-7
87
77
 
88
- 当测试用例以 Given-When-Then(GWT)表达时,其规约条目应按以下方式将 GWT 映射到 GEARS [[1]]:
78
+ 给定测试用例可以用 Given-When-Then(GWT)表达,其规约条目应按以下方式将 GWT 映射到 GEARS [[1]]:
89
79
 
90
80
  | GWT | 子句 |
91
81
  | --- | ------ |
@@ -93,87 +83,124 @@ Fixed-width column wrapping within a sentence is allowed.
93
83
  | When | 当/When |
94
84
  | Then | 应/shall |
95
85
 
96
- ### META-8
86
+ ### meta-8
87
+
88
+ Each spec item shall be self-contained: every reliance on another item is an explicit citation [[meta-16](#meta-16)].
97
89
 
98
- Each item shall be self-contained:
90
+ ### meta-29
99
91
 
100
- - It shall have no implicit dependency on sections other than its own subsections.
101
- - Citations to other specs or shared sections shall be explicit.
92
+ Each spec item shall be exactly one GEARS statement [[meta-6](#meta-6)], elaborated only by its attachments — such as a note, a list, a table, a (renderable) diagram, or an example.
102
93
 
103
- ### META-26
94
+ | Item kind | Example attachment |
95
+ | --- | --- |
96
+ | Behavior | ordered steps or the cases and outcomes of one operation or decision |
97
+ | Test | the assertions of one execution flow or one explicit case matrix |
104
98
 
105
- A spec item shall describe behavior as observable outcomes (e.g., file state, exit code, printed output, return value, network call) under named conditions, including any conditions under which a particular outcome shall not occur.
99
+ - A condition inside an attachment is a case label.
100
+ - Differing stateful preconditions or triggers are evidence of additional spec items.
106
101
 
107
102
  ## Spec packages
108
103
 
109
- ### META-9
104
+ ### meta-13
110
105
 
111
- A spec package shall consist of one to three coordinated item files sharing the same relative path and basename under `user/`, `dev/`, or `test/`.
106
+ A spec package shall define a closed set of subjects and their behaviors for a shared intent.
112
107
 
113
- ### META-10
108
+ ### meta-9
114
109
 
115
- A spec package shall have a basename \<kebab-case\>.md unique across `specs/user/`, `specs/dev/`, and `specs/test/`, with a short form \<ALLCAPS\>.
110
+ A spec package shall be one item file under `specs/packages/` or its subdirectory.
116
111
 
117
- Example: `package-management.md` has short form `PKGMGT`.
112
+ <!-- spex-i18n-source: meta-30 sha256-7a8f0909efcbffc412450f64f749f822d0412490e067a2310300f434a9162693 -->
113
+ ### meta-30
118
114
 
119
- ### META-11
115
+ 每个包文件应只包含下列章节,并按此顺序排列:
120
116
 
121
- Each item shall have an ID unique within `specs/`, following \<PACK\>-\<N...\> format (e.g., AUTH-11, URL-3) as a markdown heading for anchor linking.
117
+ | 章节 | 是否必需 | 内容 |
118
+ | ------- | -------- | ------- |
119
+ | `意图` | 必需 | 包内条目共享的意图 |
120
+ | `外部行为` | 必需 | 包的使用者可以依赖的结果与保证 |
121
+ | `内部行为` | 可选 | 对包的使用者隐藏的实现 |
122
+ | `验证` | 除非无关,否则必需 [[meta-33](#meta-33)] | 仅限验证本包条目的测试条目 |
123
+ | `参考资料` | 可选 | 外部来源 [[meta-19](#meta-19)] |
122
124
 
123
- Note: \<PACK\> refers to the short form of the package name.
125
+ - 包的使用者是使用其契约的任何人或系统组件;外部与内部相对于包而言。
126
+ - 主题小节与条目标题位于行为章节和验证章节内部。
124
127
 
125
- ### META-12
128
+ ### meta-10
126
129
 
127
- Item IDs shall not be modified once released; new items shall use higher IDs per package.
130
+ A spec package shall use a unique lowercase kebab-case basename \<pack\>.md, with \<pack\> serving as its package identifier.
128
131
 
129
- ### META-13
132
+ ### meta-11
130
133
 
131
- A spec package shall define a closed set of subjects and their behaviors for a single intent. The shall clause (see [META-6](#meta-6)) of any item shall only involve subjects and behaviors within its own package.
134
+ Each spec item shall use \<pack\>-\<N\> as its lowercase heading, anchor, and citation text:
132
135
 
133
- ### META-14
136
+ - \<pack\> is its containing package's identifier [[meta-10](#meta-10)];
137
+ - \<N\> is a positive integer unique within that package;
138
+ - a new item takes the lowest positive \<N\> neither assigned nor reserved by a public release [[meta-12](#meta-12)].
134
139
 
135
- The precondition and trigger clauses (Where, While, When; see [META-6](#meta-6)) of items shall be allowed to reference subjects and behaviors from other spec packages.
140
+ ### meta-12
136
141
 
137
- ### META-15
142
+ A publicly released item ID shall remain permanently bound to the concern its item names:
138
143
 
139
- Each spec package shall minimize references to the containing project. When a project-specific reference is essential to a package's intent, it shall be documented in the package's `## Intent` section.
144
+ - the ID is never renumbered or reassigned;
145
+ - the item's content may evolve only with that concern preserved;
146
+ - an unreleased ID can be reassigned.
140
147
 
141
- ## Citation
148
+ ### meta-14
149
+
150
+ A citation shall be the only relationship between packages: any general phrase of a behavior binds to a specific External Behavior of another package by citing it [[meta-16](#meta-16)].
142
151
 
143
- ### META-16
152
+ - An uncited phrase stays general as it is sufficient for code generation and audit.
153
+ - One phrase may cite several packages if it composes their behaviors.
144
154
 
145
- Citations to specific items shall use relative links with anchors (e.g., `[META-1](meta.md#meta-1)`).
155
+ ### meta-15
146
156
 
147
- ### META-17
157
+ A spec package shall stand alone: readable in full without following any link — a citation never carries its meaning.
148
158
 
149
- DRs and items shall be allowed to cite each other.
159
+ ### meta-31
150
160
 
151
- ### META-18
161
+ A 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.
152
162
 
153
- IRs shall not be cited by any spec except `map.md`.
163
+ ## Testing
154
164
 
155
- <!-- spex-i18n-source: META-19 sha256-3f6ffcfc6f8e3c50369236b4ccba2bec39ef6972b12b425946b2e9dcb2ae79d0 -->
156
- ### META-19
165
+ ### meta-21
157
166
 
158
- 规约中的外部引用应引用权威来源(例如官方文档),并使用带编号的标记(例如 `[[1]]`)指向 `## 参考资料` 章节中的具体 URL,且该章节不应包含未被引用的条目。
167
+ Spec test items shall specify integration and system tests only: unit tests belong to the implementation, and no spec item specifies one.
159
168
 
160
- ### META-20
169
+ ### meta-32
161
170
 
162
- Each test item shall include one `Verifies:` metadata line immediately below its item ID heading.
171
+ A test shall prefer executing the real behavior of a cited package [[meta-14](#meta-14)] to supplying a substitute for it.
172
+
173
+ ### meta-33
174
+
175
+ Each stated behavior shall be verified unless verification is irrelevant to it, white-box or black-box: External and Internal govern use, not verification.
176
+
177
+ ## Citation
163
178
 
164
- The `Verifies:` line shall contain one or more comma-separated [citations](#meta-16) to the user or dev items that the test item verifies.
179
+ ### meta-16
180
+
181
+ A citation of a spec item shall be a relative link with an anchor, enclosed in square brackets (e.g., `[[meta-1](meta.md#meta-1)]`), written inline at the phrase that relies on it.
182
+
183
+ ### meta-18
184
+
185
+ No DR or spec item shall cite an IR or name it in prose.
186
+
187
+ <!-- spex-i18n-source: meta-19 sha256-e6137c80fab048cd6d69bf5a9b202b27cc14d97f67f51bcf8a5e915514039aa2 -->
188
+ ### meta-19
189
+
190
+ 外部引用应通过带编号的标记(例如 `[[1]]`)引用权威来源(例如官方文档),标记指向 `参考资料` 章节中的具体 URL,且该章节不应包含未被引用的条目。
191
+
192
+ ### meta-20
193
+
194
+ A test item shall cite every behavior item it verifies, inline at the assertion that verifies the behavior.
165
195
 
166
196
  ## Authoring language
167
197
 
168
- <!-- spex-i18n-source: META-27 sha256-1fba59bae8903b6db86c0b1ed345082eabdce1cd65fa483e932e6df265a046ec -->
169
- ### META-27
198
+ <!-- spex-i18n-source: meta-27 sha256-31c8c10f1bcf6836b757e4b7cbe21be3854843c9cef548759a36e4c460fda5c1 -->
199
+ ### meta-27
170
200
 
171
201
  Authoring language: zh
172
202
 
173
- 在规约树声明编写语言时,规约应使用该语言编写。
174
-
175
- 本条目中的声明行是 scaffold 的机器可读语言标记。
176
- 该声明行应使用精确格式 `Authoring language: <code>`,其中 `<code>` 只包含 ASCII 字母、数字和连字符。
203
+ 在规约树声明编写语言时——以本条目的机器可读标记行声明,采用精确格式 `Authoring language: <code>`,其中 `<code>` 只包含 ASCII 字母、数字和连字符——规约应使用该语言编写。
177
204
 
178
205
  ## 参考资料
179
206