@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.
@@ -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,9 @@
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; 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
- - 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
+ - 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/ 决策记录(DRs)
21
- iterations/ 迭代记录(IRs)
22
- user/ 用户可见行为
23
- dev/ 实现要求
24
- test/ 验收测试
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 | [000-spec-structure-format.md](decisions/000-spec-structure-format.md) | 规约结构、格式和命名约定 |
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
- ### GIT
31
+ ## 意图
44
32
 
45
- | 分组 | 文件 | 摘要 |
33
+ | ID | 文件 | 意图 |
46
34
  | --- | --- | --- |
47
- | dev | [git.md](dev/git.md) | 提交信息格式和 AI 共同作者 trailers |
35
+ | [IR-000](intents/000-spdx-headers.md) | 000-spdx-headers.md | 为适用文件添加 SPDX 头 |
48
36
 
49
- ### LIC
37
+ ## 规约包
50
38
 
51
- | 分组 | 文件 | 摘要 |
52
- | --- | --- | --- |
53
- | dev | [licensing.md](dev/licensing.md) | SPDX 头要求和文件范围规则 |
54
- | test | [licensing.md](test/licensing.md) | 版权和许可证头存在性检查 |
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
- # META: 规约定义
6
+ # meta: 规约定义
5
7
 
6
- ## 意图
8
+ ## Intent
7
9
 
8
- 本规约定义 specifications(specs)的结构和组织方式,遵循 [DR-000](decisions/000-spec-structure-format.md)。
10
+ This file defines the structure and organization of specifications (specs), per [DR-000](decisions/000-spec-structure-format.md).
9
11
 
10
- ## Organization
12
+ ## Overall
11
13
 
12
- ### META-1
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/` | 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 | - |
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
- <!-- spex-i18n-source: META-3 sha256-12d340f3809b0e5b716d164ba2e81ee7189d22ecb18331f8910277f65203efc6 -->
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
- ### META-21
30
+ - For example, `map.md` limits its indexes to those an AI agent needs to find the right files.
32
31
 
33
- Test items shall focus on integration and system testing.
32
+ ### meta-25
34
33
 
35
- Unit tests shall be part of the implementation and shall not be specified as spec items.
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: META-4 sha256-9fc0367f908c00eccdabd063021de2a66421a128ec34234a611f9271676598cc -->
40
- ### META-4
38
+ <!-- spex-i18n-source: meta-4 sha256-5ea8737b4d744c55c6c564672f86199e62a0caad95bbba2fb498b6c9407226c8 -->
39
+ ### meta-4
41
40
 
42
- 每个决策记录(DR)应遵循 ADR 格式 [[2]],并包含以下章节:状态、背景、决策、影响。
41
+ Each DR shall follow the ADR format [[2]], with sections `状态`, `背景`, `决策`, `影响`, and `参考资料`.
43
42
 
44
- <!-- spex-i18n-source: META-5 sha256-f50b8ba3ae8a9c1e8ebb9d7f368a1acb3159de392169c2e9296ab37883572ef1 -->
45
- ### META-5
43
+ <!-- spex-i18n-source: meta-5 sha256-6847734892ace98018676f3430e0a848b0a83541b23f1b4f69aa9b12a1c0aeda -->
44
+ ### meta-5
46
45
 
47
- 每个迭代记录(IR)应包含以下章节:目标、交付项(带复选框)、任务(编号且每项为一次提交大小)和验收标准。
46
+ Each IR shall contain sections `状态`, `意图`, `交付项` (with checkboxes), `任务` (numbered, each sized to one commit), and `验证`.
48
47
 
49
- ### META-23
48
+ ### meta-22
50
49
 
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.
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
- ### META-24
52
+ ### meta-24
54
53
 
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.
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
- ### META-25
56
+ ### meta-28
60
57
 
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.
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: META-6 sha256-6a388878944a9426f53055410b686e33879d1e10c06c86d0d103b6a2f2d3a66c -->
68
- ### META-6
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: META-7 sha256-7e2912d02d3d967a84c2ec8c850db8baa378197d78e517eb269ee665b9676426 -->
86
- ### META-7
78
+ <!-- spex-i18n-source: meta-7 sha256-4c4ede3e11a0482d645f0d5154791a1e4e83438033b93d4fc8b359b00f2190ad -->
79
+ ### meta-7
87
80
 
88
- 当测试用例以 Given-When-Then(GWT)表达时,其规约条目应按以下方式将 GWT 映射到 GEARS [[1]]:
81
+ 给定测试用例可用 Given-When-Then(GWT)表达,其规约条目应将 GWT 映射到 GEARS 子句 [[meta-6](#meta-6)]:
89
82
 
90
83
  | GWT | 子句 |
91
84
  | --- | ------ |
92
- | Given | 给定/Where + 如果/While |
93
- | When | 当/When |
94
- | Then | 应/shall |
85
+ | Given | 给定 + 如果 |
86
+ | When | 当 |
87
+ | Then | 应 |
88
+
89
+ ### meta-8
95
90
 
96
- ### META-8
91
+ Each spec item shall be self-contained: every reliance on another item is an explicit citation [[meta-16](#meta-16)].
97
92
 
98
- Each item shall be self-contained:
93
+ ### meta-29
99
94
 
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.
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
- ### META-26
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
- 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.
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
- ### META-9
108
+ ### meta-13
110
109
 
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/`.
110
+ A spec package shall define a closed set of subjects and their behavioral requirements for a shared intent.
112
111
 
113
- ### META-10
112
+ ### meta-34
114
113
 
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\>.
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
- Example: `package-management.md` has short form `PKGMGT`.
116
+ ### meta-9
118
117
 
119
- ### META-11
118
+ A spec package shall be one file containing spec items under `specs/packages/` or its subdirectory.
120
119
 
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.
120
+ <!-- spex-i18n-source: meta-30 sha256-0157482272767b0d31d355728e8b2df551310d4248d380ab886f71e6d0bfe93b -->
121
+ ### meta-30
122
122
 
123
- Note: \<PACK\> refers to the short form of the package name.
123
+ Each package file shall contain only the following sections, in this order:
124
124
 
125
- ### META-12
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
- Item IDs shall not be modified once released; new items shall use higher IDs per package.
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
- ### META-13
136
+ ### meta-10
130
137
 
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.
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
- ### META-14
140
+ ### meta-11
134
141
 
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.
142
+ Each spec item shall use \<pack\>-\<N\> as its lowercase heading, anchor, and citation text:
136
143
 
137
- ### META-15
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
- 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.
148
+ ### meta-12
140
149
 
141
- ## Citation
150
+ A publicly released item ID shall remain permanently bound to the concern its item names:
142
151
 
143
- ### META-16
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
- Citations to specific items shall use relative links with anchors (e.g., `[META-1](meta.md#meta-1)`).
156
+ ### meta-14
146
157
 
147
- ### META-17
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
- DRs and items shall be allowed to cite each other.
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
- ### META-18
164
+ ### meta-15
152
165
 
153
- IRs shall not be cited by any spec except `map.md`.
166
+ A spec package shall stand alone: readable in full without following any link — a citation never carries its meaning.
154
167
 
155
- <!-- spex-i18n-source: META-19 sha256-3f6ffcfc6f8e3c50369236b4ccba2bec39ef6972b12b425946b2e9dcb2ae79d0 -->
156
- ### META-19
168
+ ### meta-31
157
169
 
158
- 规约中的外部引用应引用权威来源(例如官方文档),并使用带编号的标记(例如 `[[1]]`)指向 `## 参考资料` 章节中的具体 URL,且该章节不应包含未被引用的条目。
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
- ### META-20
172
+ ## Testing
161
173
 
162
- Each test item shall include one `Verifies:` metadata line immediately below its item ID heading.
174
+ ### meta-21
163
175
 
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.
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
- ## Authoring language
178
+ ### meta-32
167
179
 
168
- <!-- spex-i18n-source: META-27 sha256-1fba59bae8903b6db86c0b1ed345082eabdce1cd65fa483e932e6df265a046ec -->
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
- Authoring language: zh
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
- 本条目中的声明行是 scaffold 的机器可读语言标记。
176
- 该声明行应使用精确格式 `Authoring language: <code>`,其中 `<code>` 只包含 ASCII 字母、数字和连字符。
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"