@sublang/spex 2.1.1 → 4.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.
@@ -1,9 +1,9 @@
1
1
  ## Specs (Source of Truth)
2
2
 
3
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
+ Start with @specs/map.md for a quick-reference index and @specs/meta.md for the spec format; spec packages live in @specs/packages.
5
5
  - Before making changes or suggestions in an area that has a spec, read the relevant spec file(s) first and follow them.
6
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
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
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.
9
+ - Run `npx @sublang/spex lint` (or `spex lint` where the CLI is installed) to check structure, item IDs, and citations after editing specs; never add trace lines to satisfy an older checker.
@@ -0,0 +1,98 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+ <!-- AI agents: do not edit this file without human approval. -->
4
+ <!-- spex-i18n-source: specs/decisions/000-spec-structure-format.md sha256-4c32ec9e308762026c9ec184a03885f3cd58d1eb1ab97300d6c82600ae71de64 -->
5
+
6
+ # DR-000: 规约结构与格式
7
+
8
+ ## 状态
9
+
10
+ 已接受
11
+
12
+ ## 背景
13
+
14
+ 规约(specs)需要规范的格式与结构,以支持迭代开发以及 AI 与人类之间的协作。
15
+ AI 原生软件开发是一系列人类意图的实现过程。
16
+
17
+ ## 决策
18
+
19
+ ### 要素
20
+
21
+ Spex 围绕软件开发的三个基本要素组织规约:
22
+
23
+ - **决策**。在产品与系统的*设计*中作出的选择。
24
+ - **意图**。开发意图及其*实现*。
25
+ - **要求**。产品与系统所要求的*行为*。
26
+
27
+ ### 形式
28
+
29
+ Spex 使用两种规约形式,以平衡规范化与灵活性。
30
+
31
+ - **记录**必须遵循指定格式,可在这些格式内使用自由形式的内容。
32
+ 决策和意图以记录形式存储。
33
+ - 决策记录(DRs)遵循 ADR(架构决策记录)格式 [[1]]。
34
+ - 意图记录(IRs)规划某个意图的实现并跟踪其进展 [[meta-5](../meta.md#meta-5)]。
35
+ - **条目**必须遵循 GEARS 模式 [[2]] 来规定行为。
36
+ 规约包汇集具有共同意图的规约条目。
37
+
38
+ ### 组织方式
39
+
40
+ Spex 在仓库根目录下创建默认的 `specs/` 目录,其中包含以下子目录和文件。
41
+
42
+ | 路径 | 内容 | 文件命名 |
43
+ | --------- | ------- | ------ |
44
+ | `decisions/` | DRs。设计决策及其理由。 | \<NNN\>-\<kebab-case\>.md |
45
+ | `intents/` | IRs。意图实现计划与状态。 | \<NNN\>-\<kebab-case\>.md |
46
+ | `packages/` | 规约包:行为及其测试的集合。 | \<kebab-case\>.md |
47
+ | `map.md` | 用于导航的规约索引 | - |
48
+ | `meta.md` | 规约的规约 | - |
49
+
50
+ ### 规约包
51
+
52
+ 规约包是具有共同意图的行为集合,位于 `packages/` 下的单个文件中。
53
+ 它是规约编写、复用、定制与组合的单位。
54
+
55
+ 例如,用于生成短 URL 的规约包可以是 `specs/packages/signing/gen-url.md`,其中 `signing/` 是为方便开发而设置的相关规约包的本地集合。
56
+
57
+ 每个规约包文件按以下顺序包含这些章节 [[meta-30](../meta.md#meta-30)]:
58
+
59
+ - `意图`:规约包条目共同的目的。
60
+ - `外部行为`:规约包使用者依赖的结果与保证。
61
+ 规约包的使用者可以是人或系统组件。
62
+ - `内部行为`(可选):对规约包使用者隐藏的行为。
63
+ - `验证`:检查规约包自身声明的测试条目。
64
+ - `参考资料`(可选):外部来源。
65
+
66
+ 已安装的规约包可通过在其文件中添加、修改或删除规约条目来就地定制;这仅改变已安装的副本,不会形成同级规约包关系。
67
+
68
+ ### 规约包关系
69
+
70
+ 规约包行为应通过对同级规约包外部行为的绑定引用,表达每个同级规约包关系 [[meta-14](../meta.md#meta-14)]:
71
+
72
+ | 情形 | 形式 |
73
+ | --- | --- |
74
+ | 固定绑定 | 规约包定义在被引行为使之具体化的确切短语处,将绑定固定到所要求的行为。 |
75
+ | 多态绑定 | 实例化在被引行为使之具体化的确切短语处,将绑定解析为所选行为。 |
76
+ | 组合 | 行为陈述一个整合后的结果,并在每个参与行为使之具体化的确切短语处引用该行为。 |
77
+
78
+ ### 引用
79
+
80
+ DR 和条目长期保留,且可相互引用。
81
+ DR 引用规约条目仅用于支持 DR 自身的陈述,绝不用于承载其未陈述的内容。
82
+
83
+ IR 可引用 DR 和条目,但其他任何规约都不得引用 IR 或提及其名称。
84
+ `map.md` 索引 DR 和规约包,并随这些文件的变化保持同步。
85
+
86
+ ## 影响
87
+
88
+ - 各开发周期采用一致的结构与格式
89
+ - 每个规约包一个文件:一次读取即可覆盖规约包的外部行为、内部行为和验证
90
+ - 一种规约包类型支持就地定制;一种绑定引用形式表达所有同级规约包关系
91
+ - 每个同级规约包关系都以引用形式显现在依赖它的短语处
92
+ - 去除引用后,规约包仍可独立成立
93
+ - 灵活表达外部行为、内部行为和组合行为
94
+
95
+ ## 参考资料
96
+
97
+ [1]: https://github.com/npryce/adr-tools "ADR 工具"
98
+ [2]: https://sublang.ai/ref/gears-ai-ready-spec-syntax "GEARS:面向 AI 的规约语法"
@@ -0,0 +1,31 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+ <!-- spex-i18n-source: specs/intents/000-spdx-headers.md sha256-d2246bb72b8a1be75cf8dd293e80c51e5f5de6f810a8d1fbc71982a52d3fecc3 -->
4
+
5
+ # IR-000: SPDX 头
6
+
7
+ ## 状态
8
+
9
+ 待处理
10
+
11
+ ## 意图
12
+
13
+ 将 [[licensing-1](../packages/licensing.md#licensing-1)]、[[licensing-2](../packages/licensing.md#licensing-2)]、[[licensing-5](../packages/licensing.md#licensing-5)] 应用于适用范围内的文件,使用项目自己的头部格式 [[licensing-9](../packages/licensing.md#licensing-9)]。
14
+
15
+ ## 交付项
16
+
17
+ - [ ] [`packages/licensing.md`](../packages/licensing.md) 的 `licensing-9` 注明项目的许可证和版权持有人,不留任何 `<...>` 占位符
18
+ - [ ] 为适用范围内缺少 SPDX 头的文件添加这些头
19
+
20
+ ## 任务
21
+
22
+ 1. 确认头部格式:脚手架已根据项目的 `LICENSE` 和 `git config user.name` 固定 `licensing-9`;将其遗留的任何 `<license>` 或 `<holder>` 占位符替换为项目的 SPDX 许可证标识符和版权持有人。
23
+
24
+ 2. 确定适用范围:依据 [[licensing-7](../packages/licensing.md#licensing-7)] 检测项目根目录的许可证文件;依据 [[licensing-6](../packages/licensing.md#licensing-6)] 枚举适用范围内的文件。
25
+
26
+ 3. 按照 `licensing-9` 所示,使用文件原生的注释语法,在每个文件的第一个注释块(任何 shebang 之后)中插入 SPDX 行。
27
+
28
+ ## 验证
29
+
30
+ - `licensing-9` 不含任何 `<...>` 占位符。
31
+ - [[licensing-3](../packages/licensing.md#licensing-3)]、[[licensing-4](../packages/licensing.md#licensing-4)] 在所有适用范围内的文件上通过验证。
@@ -1,10 +1,10 @@
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
+ <!-- spex-i18n-source: map.md sha256-5dbf6d5bf1f09c74f8bf71209986eca460723957c6861f0a73654b88d9e522d9 -->
4
4
 
5
5
  # 规约地图
6
6
 
7
- 用于快速定位规约文件的索引。
7
+ 用于快速定位决策和规约包的索引。
8
8
  规约条目是事实来源。
9
9
  开发过程中,代码可能与规约暂时不一致。
10
10
 
@@ -28,12 +28,6 @@ meta.md 规约的规约
28
28
  | --- | --- | --- |
29
29
  | [DR-000](decisions/000-spec-structure-format.md) | 000-spec-structure-format.md | 规约结构、格式和命名约定 |
30
30
 
31
- ## 意图
32
-
33
- | ID | 文件 | 意图 |
34
- | --- | --- | --- |
35
- | [IR-000](intents/000-spdx-headers.md) | 000-spdx-headers.md | 为适用文件添加 SPDX 头 |
36
-
37
31
  ## 规约包
38
32
 
39
33
  | 文件 | 摘要 |
@@ -1,63 +1,77 @@
1
1
  <!-- SPDX-License-Identifier: Apache-2.0 -->
2
2
  <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
3
  <!-- AI agents: do not edit this file without human approval. -->
4
- <!-- spex-i18n-source: meta.md sha256-ba58b39de3537f06fbe4f13c9b1443a8a64cf090c9ba202a67263dfc054b78c8 -->
4
+ <!-- spex-i18n-source: meta.md sha256-d7fb96010dbcdc89fcea56dc1c4cf6db6b6b56d261aedaa7f6ee36fb9dd3c7f5 -->
5
5
 
6
6
  # meta: 规约定义
7
7
 
8
- ## Intent
8
+ ## 意图
9
9
 
10
- This file defines the structure and organization of specifications (specs), per [DR-000](decisions/000-spec-structure-format.md).
10
+ 本文件依据 [DR-000](decisions/000-spec-structure-format.md) 定义规约(specs)的结构与组织方式。
11
11
 
12
- ## Overall
12
+ ## 总体
13
13
 
14
+ <!-- spex-i18n-source: meta-1 sha256-98f39e3ec8fdc7f1625f5114a862eaee529e56d9a2dfe2d8d5b90c7509d81461 -->
14
15
  ### meta-1
15
16
 
16
- The `specs/` directory shall contain the following subdirectories and files:
17
+ `specs/` 目录应包含以下子目录和文件:
17
18
 
18
- | Path | Content | File Naming |
19
+ | 路径 | 内容 | 文件命名 |
19
20
  | --------- | ------- | ------ |
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
- | `meta.md` | the spec of specs | - |
21
+ | `decisions/` | 决策记录(DRs) | \<NNN\>-\<kebab-case\>.md |
22
+ | `intents/` | 意图记录(IRs) | \<NNN\>-\<kebab-case\>.md |
23
+ | `packages/` | 规约包 | \<kebab-case\>.md |
24
+ | `map.md` | 规约索引——从此处开始查找上下文 | - |
25
+ | `meta.md` | 规约的规约 | - |
25
26
 
27
+ <!-- spex-i18n-source: meta-23 sha256-81630fea3117f135538a1f733caed7dab1dc908b08b7550039db26a87d74161c -->
26
28
  ### meta-23
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
+ - 例如,`map.md` 的索引仅包含 AI 代理查找正确文件所需的内容。
31
33
 
34
+ <!-- spex-i18n-source: meta-25 sha256-5cc61079544bb13f32034b8d47ecf64ae4a34503d30156d735a91331fc536ce7 -->
32
35
  ### meta-25
33
36
 
34
- A spec file shall keep one sentence per line — with lists, tables, and diagrams exempt.
37
+ 规约文件应每行只写一句话——列表、表格和图示除外。
35
38
 
36
- ## Record format
39
+ ## 记录格式
37
40
 
38
- <!-- spex-i18n-source: meta-4 sha256-5ea8737b4d744c55c6c564672f86199e62a0caad95bbba2fb498b6c9407226c8 -->
41
+ <!-- spex-i18n-source: meta-4 sha256-9094707b5ede14d4e0c104c0ae6aaf0ce2ca1129723a472b329d68e3142e1c48 -->
39
42
  ### meta-4
40
43
 
41
- Each DR shall follow the ADR format [[2]], with sections `状态`, `背景`, `决策`, `影响`, and `参考资料`.
44
+ 每份 DR 应遵循 ADR 格式 [[2]],包含`状态`、`背景`、`决策`和`影响`章节,并在引用外部来源时包含`参考资料`章节 [[meta-19](#meta-19)]。
42
45
 
43
46
  <!-- spex-i18n-source: meta-5 sha256-6847734892ace98018676f3430e0a848b0a83541b23f1b4f69aa9b12a1c0aeda -->
44
47
  ### meta-5
45
48
 
46
- Each IR shall contain sections `状态`, `意图`, `交付项` (with checkboxes), `任务` (numbered, each sized to one commit), and `验证`.
49
+ 每份 IR 应包含`状态`、`意图`、`交付项`(带复选框)、`任务`(编号,每项工作量对应一次提交)和`验证`章节。
47
50
 
51
+ <!-- spex-i18n-source: meta-22 sha256-58c862ce93e422901613bdcbdb9a24c55af1b7eebe6155db95e872c85860a1ee -->
48
52
  ### meta-22
49
53
 
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.
54
+ 记录的 ID 应由其类型前缀与文件名开头的编号组成——`decisions/` 下为 `DR-<NNN>`,`intents/` 下为 `IR-<NNN>`——且该编号在每种记录类型内唯一。
51
55
 
56
+ <!-- spex-i18n-source: meta-24 sha256-48a3ecf9a8bcb8c1d4455aff9a912fd484e529ec15f88e156b2a5d471eebb11f -->
52
57
  ### meta-24
53
58
 
54
- A DR shall record design decisions and constraints, not implementation details, sufficient to provide context for or to audit the corresponding spec items.
59
+ DR 应记录设计决策与约束,而非实现细节,且内容足以为相应规约条目提供上下文或用于审计这些条目。
55
60
 
61
+ <!-- spex-i18n-source: meta-35 sha256-306af9215c5a666cd2d28be58c00d92d7c62a2e556d06259902b4f014b17b345 -->
62
+ ### meta-35
63
+
64
+ 当针对已接受决策的实质性变更被接受,规约应在新的 DR 中记录该变更,保留先前的决策及其理由,并在两份记录的状态章节中相互链接,注明受影响的范围 [[meta-4](#meta-4)] [[meta-16](#meta-16)]:
65
+
66
+ - 完全替换:先前的 DR 被取代。
67
+ - 部分替换:先前的 DR 仍保持已接受状态,并附有注明范围的修订。
68
+
69
+ <!-- spex-i18n-source: meta-28 sha256-138df4b1fcfeb110a252ca26b5174f91513b1167603a322a13682cd4fa9b8a33 -->
56
70
  ### meta-28
57
71
 
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.
72
+ IR 应可删除:它不包含任何应由 DR 或规约条目涵盖的内容,删除它不会丢失任何设计或行为记录。
59
73
 
60
- ## Item syntax
74
+ ## 条目语法
61
75
 
62
76
  <!-- spex-i18n-source: meta-6 sha256-c6c53324be46702a10d6ca65a71842222518a1a2e32b8ccd334e361b70fbab75 -->
63
77
  ### meta-6
@@ -86,136 +100,154 @@ An IR shall be disposable: it contains nothing a DR or a spec item should cover,
86
100
  | When | 当 |
87
101
  | Then | 应 |
88
102
 
103
+ <!-- spex-i18n-source: meta-8 sha256-724b84c437f45fec7b3158b15b3656268bd0f5599af2f481ad1fc47eb527c873 -->
89
104
  ### meta-8
90
105
 
91
- Each spec item shall be self-contained: every reliance on another item is an explicit citation [[meta-16](#meta-16)].
106
+ 每个规约条目应自成一体:对其他条目的每一处依赖均以明确的引用表示 [[meta-16](#meta-16)]。
92
107
 
108
+ <!-- spex-i18n-source: meta-29 sha256-6b1b4e271a3a21ed2b817b6a133e1bec6827618259ea2d137960a3a69afb4de8 -->
93
109
  ### meta-29
94
110
 
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:
111
+ 每个规约条目应在一条 GEARS 语句 [[meta-6](#meta-6)] 中陈述一项要求,附加内容由该语句末尾的冒号引出,且只详述该项要求:
96
112
 
97
- | Item kind | Example attachment |
113
+ | 条目类型 | 附加内容示例 |
98
114
  | --- | --- |
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 |
115
+ | 行为 | 一次操作或决策的有序步骤,或其各个情形与结果 |
116
+ | 测试 | 一个执行流程或一个明确的用例矩阵中的断言 |
101
117
 
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.
118
+ - 附加内容可采用注释、列表、表格、(可渲染的)图示或示例等形式。
119
+ - 附加内容中的条件是情形标签。
120
+ - 不同的状态前置条件或触发条件表明需要额外的规约条目。
105
121
 
106
- ## Spec packages
122
+ ## 规约包
107
123
 
124
+ <!-- spex-i18n-source: meta-13 sha256-d9121e55ea381bd732db89dfbbc5b6ec903b5e2d58ab1be94ef91719c5003c92 -->
108
125
  ### meta-13
109
126
 
110
- A spec package shall define a closed set of subjects and their behavioral requirements for a shared intent.
127
+ 规约包应为一个共同的意图定义一个封闭的主体集合及这些主体的行为要求。
111
128
 
129
+ <!-- spex-i18n-source: meta-34 sha256-7b950bb56666ce51d75d1adee22102da76fb240cf9fc10f1720a3b2d71e948fc -->
112
130
  ### meta-34
113
131
 
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.
132
+ 规约包应完整且准确地涵盖其意图:内容足以重新实现其行为,不陈述超出该意图的要求,不在该意图范围内留下缺口,也不陈述其他规约已经陈述的任何要求。
115
133
 
134
+ <!-- spex-i18n-source: meta-9 sha256-7332a5da5509864275026467cdd42fdae994e872904b6a3047d0b7c66056792d -->
116
135
  ### meta-9
117
136
 
118
- A spec package shall be one file containing spec items under `specs/packages/` or its subdirectory.
137
+ 规约包应是位于 `specs/packages/` 或其子目录下、包含规约条目的单个文件。
119
138
 
120
139
  <!-- spex-i18n-source: meta-30 sha256-0157482272767b0d31d355728e8b2df551310d4248d380ab886f71e6d0bfe93b -->
121
140
  ### meta-30
122
141
 
123
- Each package file shall contain only the following sections, in this order:
142
+ 每个规约包文件应仅包含以下章节,并按此顺序排列:
124
143
 
125
- | Section | Presence | Content |
144
+ | 章节 | 是否必需 | 内容 |
126
145
  | ------- | -------- | ------- |
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)] |
146
+ | `意图` | 必需 | 规约包的目的 |
147
+ | `外部行为` | 必需 | 规约包使用者可依赖的结果与保证 |
148
+ | `内部行为` | 可选 | 对规约包使用者隐藏的行为 |
149
+ | `验证` | 必需 | 验证本规约包行为的测试条目 |
150
+ | `参考资料` | 可选 | 外部来源 [[meta-19](#meta-19)] |
132
151
 
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.
152
+ - 规约包的使用者是使用其契约的任何人或系统组件;外部与内部均相对于该规约包而言。
153
+ - 主题子章节和条目标题位于行为章节与验证章节内部。
135
154
 
155
+ <!-- spex-i18n-source: meta-10 sha256-037882d4330f27da723e4bc9745111b6695408851582918ea2acf136bbf2cbea -->
136
156
  ### meta-10
137
157
 
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.
158
+ 包含规约条目的文件应使用在整个规约树中唯一的小写 kebab-case 基名 \<pack\>.md,并以 \<pack\> 作为其标识符。
139
159
 
160
+ <!-- spex-i18n-source: meta-11 sha256-7f570fb5a98c01c4ccb7b3cd48f8c370fe660d0ffaebc73333010f45e215ae8f -->
140
161
  ### meta-11
141
162
 
142
- Each spec item shall use \<pack\>-\<N\> as its lowercase heading, anchor, and citation text:
163
+ 每个规约条目应使用 \<pack\>-\<N\> 作为其小写标题、锚点和引用文本:
143
164
 
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)].
165
+ - \<pack\> 是其所在文件的标识符 [[meta-10](#meta-10)];
166
+ - \<N\> 是该文件内唯一的正整数;
167
+ - 新条目采用既未被分配、也未被公开发布保留的最小正整数 \<N\> [[meta-12](#meta-12)]。
147
168
 
169
+ <!-- spex-i18n-source: meta-12 sha256-ed082a7a193eefe08f9fa15669f23d2b5d4fd5cac90c2dc7e83f6903f52bb2ba -->
148
170
  ### meta-12
149
171
 
150
- A publicly released item ID shall remain permanently bound to the concern its item names:
172
+ 已公开发布的条目 ID 应永久绑定到其条目所指明的事项:
151
173
 
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.
174
+ - 该 ID 永不重新编号或重新分配;
175
+ - 条目内容仅可在保留该事项的前提下演变;
176
+ - 尚未发布的 ID 可重新分配。
155
177
 
178
+ <!-- spex-i18n-source: meta-14 sha256-bec76a978583747ecf96f671a77e9e3a795ff4bdd69dfd72d51c98779d5d82a8 -->
156
179
  ### meta-14
157
180
 
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)]:
181
+ 行为条目应将每个同级规约包关系表达为绑定引用——在被引行为使之具体化的确切短语处,以行内方式引用该规约包的外部行为 [[meta-16](#meta-16)]:
159
182
 
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.
183
+ - 绑定引用绑定的是行为,绝不只绑定规约包的主体或状态;
184
+ - 当多个行为分别使同一短语的不同部分具体化时,该短语可带有多个绑定引用;
185
+ - 不存在未被引用的同级规约包依赖。
163
186
 
187
+ <!-- spex-i18n-source: meta-15 sha256-2bf03e350e6014f7fe1d8623953c0e9923be83deb692411c2304c80cce52b70a -->
164
188
  ### meta-15
165
189
 
166
- A spec package shall stand alone: readable in full without following any link — a citation never carries its meaning.
190
+ 规约包应独立成立:无需打开任何链接即可完整理解——引用绝不承载规约包自身的含义。
167
191
 
192
+ <!-- spex-i18n-source: meta-31 sha256-22ec564553bdada3a94a3c2273dcc59b7946bf8c4311c5c245003adb17ea9fc8 -->
168
193
  ### meta-31
169
194
 
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.
195
+ `specs/packages/` 下的小写 kebab-case 子目录应仅用于组织集合:文件的身份由其基名确定 [[meta-10](#meta-10)];在集合之间移动文件会改变相对引用路径,但不会改变任何条目 ID 或锚点。
171
196
 
172
- ## Testing
197
+ ## 测试
173
198
 
199
+ <!-- spex-i18n-source: meta-21 sha256-3fd36fda3683299fdba6129318987bc429027cde6bbae08485085fd596f9275e -->
174
200
  ### meta-21
175
201
 
176
- Spec test items shall specify integration and system tests only: unit tests belong to the implementation, and no spec item specifies one.
202
+ 规约测试条目应仅规定集成测试和系统测试:单元测试属于实现,任何规约条目都不规定单元测试。
177
203
 
204
+ <!-- spex-i18n-source: meta-32 sha256-28f1ce30821d263ee507cf71be045ab431a9d5fe449ea7ea194c2c8f15a683b9 -->
178
205
  ### meta-32
179
206
 
180
- A test shall prefer executing the real behaviors bound by the behaviors it verifies [[meta-14](#meta-14)] to supplying substitutes for them.
207
+ 测试应优先执行其所验证行为绑定的真实行为 [[meta-14](#meta-14)],而非提供这些行为的替代物。
181
208
 
209
+ <!-- spex-i18n-source: meta-33 sha256-65a82bd4cca5750e8e7b8743c636b2fbd6dff7fe3447b0d04c30cbb70666069a -->
182
210
  ### meta-33
183
211
 
184
- Each package's `Verification` section shall verify every behavior in that package, white-box or black-box.
212
+ 每个规约包的`验证`章节应以白盒或黑盒方式验证该规约包的每个行为。
185
213
 
186
- ## Citation
214
+ ## 引用
187
215
 
216
+ <!-- spex-i18n-source: meta-16 sha256-c3a9c2d5a690ea7408db2fbd0a9d1cfdbe7b14ee162cd8d414f3f734f3a86279 -->
188
217
  ### meta-16
189
218
 
190
- A citation of a spec item or record shall be an inline relative link with the cited ID as its link text:
219
+ 对规约条目或 DR 的引用应是行内相对链接,并以被引 ID 作为链接文本:
191
220
 
192
- | Cited | Form |
221
+ | 引用对象 | 形式 |
193
222
  | --- | --- |
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)`) |
223
+ | 规约条目 | 链接至其标题锚点,外加一对方括号(例如 `[[meta-1](meta.md#meta-1)]`) |
224
+ | DR | 链接至其文件,不加外层方括号(例如 `[DR-000](decisions/000-spec-structure-format.md)`) |
196
225
 
226
+ <!-- spex-i18n-source: meta-18 sha256-c861847d755a25b07322a9a05bf66295d0477ff89fae684fe1a53d18a7774cdc -->
197
227
  ### meta-18
198
228
 
199
- No DR or spec item shall cite an IR or name it in prose.
229
+ 除某份 IR 本身外,任何规约均不得引用该 IR 或在正文中提及其名称。
200
230
 
231
+ <!-- spex-i18n-source: meta-19 sha256-b48c49bc3cdefa532ee254bd7af670a3762fd436aaf0ca9d49560f2f9159f664 -->
201
232
  ### meta-19
202
233
 
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.
234
+ 外部引用应通过编号标记(例如 `[[1]]`)引用权威来源(例如官方文档),该标记链接至文件参考资料章节中的具体 URL,且该章节不包含任何未被引用的条目。
204
235
 
236
+ <!-- spex-i18n-source: meta-20 sha256-e00eba313900b6fad6a87274765cad11a900465997e0f2cacfa9c904ca4587fe -->
205
237
  ### meta-20
206
238
 
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.
239
+ 测试条目应在用于验证的断言处,以行内引用标识它所验证的每个行为,且行为引用仅限于其自身规约包。
208
240
 
209
- ## Authoring language
241
+ ## 编写语言
210
242
 
211
243
  <!-- spex-i18n-source: meta-27 sha256-b19f392d742d307fb0f811892dbb65509b36dc3a9636512604c636b7b0aa5c29 -->
212
244
  ### meta-27
213
245
 
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:
246
+ 给定规约树通过本条目的机器可读标记行声明编写语言——该行采用精确格式 `Authoring language: <code>`,其中 `<code>` 仅由 ASCII 字母、数字和连字符组成——为该项目新增的规约内容应使用该语言编写:
215
247
 
216
248
  Authoring language: zh
217
249
 
218
- ## References
250
+ ## 参考资料
219
251
 
220
252
  [1]: https://sublang.ai/zh/ref/gears-ai-ready-spec-syntax "GEARS:面向 AI 的规约语法(中文)"
221
- [2]: https://github.com/npryce/adr-tools "ADR Tools"
253
+ [2]: https://github.com/npryce/adr-tools "ADR 工具"
@@ -0,0 +1,50 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+ <!-- spex-i18n-source: specs/packages/git.md sha256-f4bdc7cf1ea7be17575fb189abb9fa3cfbc9eeb8a7bccefbbffdbea3d4210608 -->
4
+
5
+ # git: Git 工作流程
6
+
7
+ ## 意图
8
+
9
+ 本规约包使贡献者和维护者能够创建可审计的项目提交,并采用一致的提交信息和 AI 署名。
10
+ 它负责提交准备和提交信息约定,不负责分支、审阅或发布策略。
11
+ 它仅适用于当前项目。
12
+
13
+ ## 外部行为
14
+
15
+ ### git-1
16
+
17
+ 当贡献者或维护者要求提交工作流程准备一次提交,提交准备过程应报告已配置的 `user.name` 和 `user.email`,或指出每个缺失的值,并在两者均配置前不创建任何提交。
18
+
19
+ ### git-2
20
+
21
+ 当编写提交信息的主题行,提交信息应采用 `<type>(<scope>)<!>: <subject>` 格式,其中 `<scope>` 可选,破坏性变更包含 `!`,`<type>` 为 `feat|fix|docs|style|refactor|test|ci|build|perf|chore` 中的一种,`<subject>` 使用祈使语气、长度 <=50 字符且不以句点结尾。
22
+
23
+ ### git-3
24
+
25
+ 给定提交信息包含正文,当编写正文,提交信息正文应解释改了什么以及为什么修改,而非如何修改,以 72 字符为换行上限,并在使用项目符号列表更清晰时采用该形式。
26
+
27
+ ### git-4
28
+
29
+ 当 AI 协助编码或编写内容,提交信息应在 Git 识别的末尾连续尾注块中包含一个或多个 `Co-authored-by` 尾注,尾注之间无空行,且每个尾注采用 `<model> (<role>) <email>` 格式,其中 `<role>` 为 `coder|reviewer|maintainer` 中的一种,`<email>` 为 `cligent@sublang.ai`:
30
+
31
+ ```text
32
+ Co-authored-by: GPT-6 Sol (coder) <cligent@sublang.ai>
33
+ Co-authored-by: Claude Opus 5.5 (reviewer) <cligent@sublang.ai>
34
+ ```
35
+
36
+ ### git-5
37
+
38
+ 给定提交实现了已记录的意图,提交信息应在主题行或正文中以 `IR-<N>` 形式的纯 ID 引用意图记录。
39
+
40
+ ## 验证
41
+
42
+ ### git-6
43
+
44
+ 当审计已准备的提交,审计应断言该提交遵循本规约包的约定:
45
+
46
+ - 提交记录已配置的 `user.name` 和 `user.email` [[git-1](#git-1)];
47
+ - 主题行遵循 `<type>(<scope>)<!>: <subject>` 格式 [[git-2](#git-2)];
48
+ - 正文如存在,应解释改了什么以及为什么修改,并以 72 字符为换行上限 [[git-3](#git-3)];
49
+ - AI 协助完成的提交所要求的一个或多个 `Co-authored-by` 尾注出现在 Git 解析出的尾注块中,并采用规定格式 [[git-4](#git-4)];
50
+ - 实现已记录意图的提交引用该意图记录的 ID [[git-5](#git-5)]。
@@ -0,0 +1,74 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+ <!-- spex-i18n-source: specs/packages/licensing.md sha256-0fdea7c594fe52e33c78f30afd2edc3e53414a8ee666a1a4acdaf64ee05487b0 -->
4
+
5
+ # licensing: 许可证头
6
+
7
+ ## 意图
8
+
9
+ 本规约包使贡献者和审阅者能够通过一致的 SPDX 头识别项目中纳入文件的版权和许可证。
10
+ 它负责头部的适用范围和内容,不负责项目许可证的选择。
11
+ 它仅适用于当前项目。
12
+
13
+ ## 外部行为
14
+
15
+ ### licensing-6
16
+
17
+ 当对项目文件进行许可证头分类,许可证头适用范围应恰好排除以下类别:
18
+
19
+ - 不支持注释语法的文件,例如 JSON 和二进制文件;
20
+ - 配置文件,例如 `.gitignore`、`.editorconfig`、`**/settings.json`、`AGENTS.md`、`.github/workflows/ci.yml`,以及锁文件;
21
+ - 生成内容或第三方供应内容,例如 `dist/`、`node_modules/` 和第三方供应目录;以及
22
+ - 许可证和法律文档。
23
+
24
+ ### licensing-7
25
+
26
+ 当检查项目根目录以确定其许可证,许可证文件检测器应识别以下模式:
27
+
28
+ - `LICENSE`、`LICENSE.txt`、`LICENSE.md`、`COPYING`
29
+ - `LICENSE-CONTENT`、`LICENSE-APACHE` 等(带名称的变体)
30
+ - `LICENCE`、`LICENCE.txt`(英式拼写)
31
+ - `LICENSES/` 文件夹(REUSE 约定)
32
+
33
+ ### licensing-1
34
+
35
+ 给定文件支持注释语法且未被许可证头适用范围排除 [[licensing-6](#licensing-6)],如果文件已由 Git 跟踪或可通过 `git add` 添加,当准备将文件纳入仓库,文件应在任何 shebang 之后的第一个注释块中包含 `SPDX-FileCopyrightText`。
36
+
37
+ ### licensing-2
38
+
39
+ 给定文件支持注释语法、未被许可证头适用范围排除 [[licensing-6](#licensing-6)],且一个或多个项目根目录许可证文件匹配许可证文件检测器的模式 [[licensing-7](#licensing-7)],如果文件已由 Git 跟踪或可通过 `git add` 添加,当准备将文件纳入仓库,文件应在任何 shebang 之后的第一个注释块中包含 `SPDX-License-Identifier`。
40
+
41
+ ### licensing-5
42
+
43
+ 给定文件的第一个注释块已包含来自上游的 `SPDX-FileCopyrightText` 或 `SPDX-License-Identifier`(例如从其他项目复制的模板或第三方供应文件),当准备将文件纳入仓库,这些已有 SPDX 行应原样保留,即使项目根目录采用不同的许可证——每条保留的上游行分别满足相应的版权头要求 [[licensing-1](#licensing-1)] 或许可证头要求 [[licensing-2](#licensing-2)],任何缺失的必需行均由上游来源补齐,而非采用项目许可证。
44
+
45
+ ### licensing-9
46
+
47
+ 给定文件不含上游 SPDX 行 [[licensing-5](#licensing-5)],当为版权头要求 [[licensing-1](#licensing-1)] 和许可证头要求 [[licensing-2](#licensing-2)] 编写其 SPDX 行,这些行应使用文件原生的注释语法注明项目自己的许可证和版权持有人:
48
+
49
+ ```markdown
50
+ <!-- SPDX-License-Identifier: <license> -->
51
+ <!-- SPDX-FileCopyrightText: <year> <holder> -->
52
+ ```
53
+
54
+ ```typescript
55
+ // SPDX-License-Identifier: <license>
56
+ // SPDX-FileCopyrightText: <year> <holder>
57
+ ```
58
+
59
+ - 版权持有人为 `<holder>`,许可证为 `<license>`;年份为文件首次纳入项目的年份。
60
+ - 仍以 `<...>` 占位符形式呈现的值尚未解析:应将其替换为项目自己的值,绝不使用从模板文件复制的持有人。
61
+
62
+ ## 验证
63
+
64
+ ### licensing-3
65
+
66
+ 给定文件支持注释语法且属于许可证头适用范围 [[licensing-6](#licensing-6)],如果文件已由 Git 跟踪或可通过 `git add` 添加,当检查任何 shebang 之后的第一个注释块,验证应通过找到 `SPDX-FileCopyrightText` 来断言版权头要求 [[licensing-1](#licensing-1)]。
67
+
68
+ ### licensing-4
69
+
70
+ 给定文件支持注释语法、属于许可证头适用范围 [[licensing-6](#licensing-6)],且许可证文件检测器 [[licensing-7](#licensing-7)] 识别出项目根目录的许可证,如果文件已由 Git 跟踪或可通过 `git add` 添加,当检查任何 shebang 之后的第一个注释块,验证应通过找到 `SPDX-License-Identifier` 来断言许可证头要求 [[licensing-2](#licensing-2)]。
71
+
72
+ ### licensing-8
73
+
74
+ 给定文件已包含上游 SPDX 行且项目许可证不同,当运行纳入准备流程,验证应断言每条上游行均逐字节保留,且任何缺失的必需行均采用上游数据而非项目许可证数据 [[licensing-5](#licensing-5)]。
@@ -18,9 +18,9 @@ When the update created a current seed at a destination, reconcile legacy local
18
18
  - Make each package self-contained with `# <basename>: <Title>` and the current section order.
19
19
  Classify guarantees its human or component users rely on as External Behavior and hidden behavior as Internal Behavior; behavior cited by a peer must be External.
20
20
  - Restate each item as one GEARS requirement and place its cases or steps after the statement's final colon.
21
- Use current item and record citation forms, put every peer binding citation at the behavior phrase it makes specific, confine Verification citations to the containing package, and remove relationship-metadata lines or detached `Verifies` sentences.
21
+ Use current item and DR citation forms, put every peer binding citation at the behavior phrase it makes specific, confine Verification citations to the containing package, and remove relationship-metadata lines or detached `Verifies` sentences.
22
22
  - Give every DR and IR the current sections and truthful status.
23
- For a legacy IR missing commit-sized Tasks, recover minimal truthful tasks from history or flag the gap rather than inventing them; no DR or spec item may cite or name an IR.
23
+ For a legacy IR missing commit-sized Tasks, recover minimal truthful tasks from history or flag the gap rather than inventing them; no other spec may cite or name an IR.
24
24
  - Update `map.md` and any project guidance describing the old layout.
25
25
  Preserve SPDX headers byte-for-byte, keep one sentence per line, and remove legacy files or directories only after their content and citations survive in the new tree.
26
26
  - Loop on `spex lint` until clean.
@@ -79,8 +79,8 @@ A package behavior shall express every peer package relationship through binding
79
79
  DRs and items are persistent and may cite each other.
80
80
  A DR references a spec item only to support what the DR itself states, never to carry content it leaves unsaid.
81
81
 
82
- IRs may cite, but must not be cited by, DRs or items.
83
- `map.md` may cite all spec files and is kept in sync as files change.
82
+ IRs may cite DRs and items, but no other spec may cite or name an IR.
83
+ `map.md` indexes DRs and spec packages, and is kept in sync as those files change.
84
84
 
85
85
  ## Consequences
86
86