@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.
- package/README.md +15 -7
- package/dist/copy-templates.d.ts +5 -16
- package/dist/copy-templates.js +10 -104
- package/dist/lint.js +37 -26
- package/dist/pin-header-format.d.ts +26 -0
- package/dist/pin-header-format.js +81 -0
- package/dist/scaffold.js +8 -1
- package/package.json +4 -4
- package/scaffold/.file-history.json +30 -8
- package/scaffold/agent-specs.txt +2 -2
- package/scaffold/i18n/zh/specs/decisions/000-spec-structure-format.md +98 -0
- package/scaffold/i18n/zh/specs/intents/000-spdx-headers.md +31 -0
- package/scaffold/i18n/zh/specs/map.md +2 -8
- package/scaffold/i18n/zh/specs/meta.md +106 -74
- package/scaffold/i18n/zh/specs/packages/git.md +50 -0
- package/scaffold/i18n/zh/specs/packages/licensing.md +74 -0
- package/scaffold/spec-migration-prompt.md +2 -2
- package/scaffold/specs/decisions/000-spec-structure-format.md +2 -2
- package/scaffold/specs/intents/000-spdx-headers.md +6 -15
- package/scaffold/specs/map.md +1 -7
- package/scaffold/specs/meta.md +11 -4
- package/scaffold/specs/packages/git.md +6 -3
- package/scaffold/specs/packages/licensing.md +17 -0
- package/scaffold/update-merge-prompt.md +1 -1
package/scaffold/agent-specs.txt
CHANGED
|
@@ -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
|
|
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-
|
|
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-
|
|
4
|
+
<!-- spex-i18n-source: meta.md sha256-d7fb96010dbcdc89fcea56dc1c4cf6db6b6b56d261aedaa7f6ee36fb9dd3c7f5 -->
|
|
5
5
|
|
|
6
6
|
# meta: 规约定义
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## 意图
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
本文件依据 [DR-000](decisions/000-spec-structure-format.md) 定义规约(specs)的结构与组织方式。
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## 总体
|
|
13
13
|
|
|
14
|
+
<!-- spex-i18n-source: meta-1 sha256-98f39e3ec8fdc7f1625f5114a862eaee529e56d9a2dfe2d8d5b90c7509d81461 -->
|
|
14
15
|
### meta-1
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
`specs/` 目录应包含以下子目录和文件:
|
|
17
18
|
|
|
18
|
-
|
|
|
19
|
+
| 路径 | 内容 | 文件命名 |
|
|
19
20
|
| --------- | ------- | ------ |
|
|
20
|
-
| `decisions/` |
|
|
21
|
-
| `intents/` |
|
|
22
|
-
| `packages/` |
|
|
23
|
-
| `map.md` |
|
|
24
|
-
| `meta.md` |
|
|
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
|
-
|
|
30
|
+
任何形式的规约应以简洁的表达包含执行或审计该规约所需的最少信息,并优先使用项目符号列表、表格或(可渲染的)图示,而非段落式文字:
|
|
29
31
|
|
|
30
|
-
-
|
|
32
|
+
- 例如,`map.md` 的索引仅包含 AI 代理查找正确文件所需的内容。
|
|
31
33
|
|
|
34
|
+
<!-- spex-i18n-source: meta-25 sha256-5cc61079544bb13f32034b8d47ecf64ae4a34503d30156d735a91331fc536ce7 -->
|
|
32
35
|
### meta-25
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
规约文件应每行只写一句话——列表、表格和图示除外。
|
|
35
38
|
|
|
36
|
-
##
|
|
39
|
+
## 记录格式
|
|
37
40
|
|
|
38
|
-
<!-- spex-i18n-source: meta-4 sha256-
|
|
41
|
+
<!-- spex-i18n-source: meta-4 sha256-9094707b5ede14d4e0c104c0ae6aaf0ce2ca1129723a472b329d68e3142e1c48 -->
|
|
39
42
|
### meta-4
|
|
40
43
|
|
|
41
|
-
|
|
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
|
-
|
|
49
|
+
每份 IR 应包含`状态`、`意图`、`交付项`(带复选框)、`任务`(编号,每项工作量对应一次提交)和`验证`章节。
|
|
47
50
|
|
|
51
|
+
<!-- spex-i18n-source: meta-22 sha256-58c862ce93e422901613bdcbdb9a24c55af1b7eebe6155db95e872c85860a1ee -->
|
|
48
52
|
### meta-22
|
|
49
53
|
|
|
50
|
-
|
|
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
|
-
|
|
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
|
-
|
|
72
|
+
IR 应可删除:它不包含任何应由 DR 或规约条目涵盖的内容,删除它不会丢失任何设计或行为记录。
|
|
59
73
|
|
|
60
|
-
##
|
|
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
|
-
|
|
106
|
+
每个规约条目应自成一体:对其他条目的每一处依赖均以明确的引用表示 [[meta-16](#meta-16)]。
|
|
92
107
|
|
|
108
|
+
<!-- spex-i18n-source: meta-29 sha256-6b1b4e271a3a21ed2b817b6a133e1bec6827618259ea2d137960a3a69afb4de8 -->
|
|
93
109
|
### meta-29
|
|
94
110
|
|
|
95
|
-
|
|
111
|
+
每个规约条目应在一条 GEARS 语句 [[meta-6](#meta-6)] 中陈述一项要求,附加内容由该语句末尾的冒号引出,且只详述该项要求:
|
|
96
112
|
|
|
97
|
-
|
|
|
113
|
+
| 条目类型 | 附加内容示例 |
|
|
98
114
|
| --- | --- |
|
|
99
|
-
|
|
|
100
|
-
|
|
|
115
|
+
| 行为 | 一次操作或决策的有序步骤,或其各个情形与结果 |
|
|
116
|
+
| 测试 | 一个执行流程或一个明确的用例矩阵中的断言 |
|
|
101
117
|
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
118
|
+
- 附加内容可采用注释、列表、表格、(可渲染的)图示或示例等形式。
|
|
119
|
+
- 附加内容中的条件是情形标签。
|
|
120
|
+
- 不同的状态前置条件或触发条件表明需要额外的规约条目。
|
|
105
121
|
|
|
106
|
-
##
|
|
122
|
+
## 规约包
|
|
107
123
|
|
|
124
|
+
<!-- spex-i18n-source: meta-13 sha256-d9121e55ea381bd732db89dfbbc5b6ec903b5e2d58ab1be94ef91719c5003c92 -->
|
|
108
125
|
### meta-13
|
|
109
126
|
|
|
110
|
-
|
|
127
|
+
规约包应为一个共同的意图定义一个封闭的主体集合及这些主体的行为要求。
|
|
111
128
|
|
|
129
|
+
<!-- spex-i18n-source: meta-34 sha256-7b950bb56666ce51d75d1adee22102da76fb240cf9fc10f1720a3b2d71e948fc -->
|
|
112
130
|
### meta-34
|
|
113
131
|
|
|
114
|
-
|
|
132
|
+
规约包应完整且准确地涵盖其意图:内容足以重新实现其行为,不陈述超出该意图的要求,不在该意图范围内留下缺口,也不陈述其他规约已经陈述的任何要求。
|
|
115
133
|
|
|
134
|
+
<!-- spex-i18n-source: meta-9 sha256-7332a5da5509864275026467cdd42fdae994e872904b6a3047d0b7c66056792d -->
|
|
116
135
|
### meta-9
|
|
117
136
|
|
|
118
|
-
|
|
137
|
+
规约包应是位于 `specs/packages/` 或其子目录下、包含规约条目的单个文件。
|
|
119
138
|
|
|
120
139
|
<!-- spex-i18n-source: meta-30 sha256-0157482272767b0d31d355728e8b2df551310d4248d380ab886f71e6d0bfe93b -->
|
|
121
140
|
### meta-30
|
|
122
141
|
|
|
123
|
-
|
|
142
|
+
每个规约包文件应仅包含以下章节,并按此顺序排列:
|
|
124
143
|
|
|
125
|
-
|
|
|
144
|
+
| 章节 | 是否必需 | 内容 |
|
|
126
145
|
| ------- | -------- | ------- |
|
|
127
|
-
| `意图` |
|
|
128
|
-
| `外部行为` |
|
|
129
|
-
| `内部行为` |
|
|
130
|
-
| `验证` |
|
|
131
|
-
| `参考资料` |
|
|
146
|
+
| `意图` | 必需 | 规约包的目的 |
|
|
147
|
+
| `外部行为` | 必需 | 规约包使用者可依赖的结果与保证 |
|
|
148
|
+
| `内部行为` | 可选 | 对规约包使用者隐藏的行为 |
|
|
149
|
+
| `验证` | 必需 | 验证本规约包行为的测试条目 |
|
|
150
|
+
| `参考资料` | 可选 | 外部来源 [[meta-19](#meta-19)] |
|
|
132
151
|
|
|
133
|
-
-
|
|
134
|
-
-
|
|
152
|
+
- 规约包的使用者是使用其契约的任何人或系统组件;外部与内部均相对于该规约包而言。
|
|
153
|
+
- 主题子章节和条目标题位于行为章节与验证章节内部。
|
|
135
154
|
|
|
155
|
+
<!-- spex-i18n-source: meta-10 sha256-037882d4330f27da723e4bc9745111b6695408851582918ea2acf136bbf2cbea -->
|
|
136
156
|
### meta-10
|
|
137
157
|
|
|
138
|
-
|
|
158
|
+
包含规约条目的文件应使用在整个规约树中唯一的小写 kebab-case 基名 \<pack\>.md,并以 \<pack\> 作为其标识符。
|
|
139
159
|
|
|
160
|
+
<!-- spex-i18n-source: meta-11 sha256-7f570fb5a98c01c4ccb7b3cd48f8c370fe660d0ffaebc73333010f45e215ae8f -->
|
|
140
161
|
### meta-11
|
|
141
162
|
|
|
142
|
-
|
|
163
|
+
每个规约条目应使用 \<pack\>-\<N\> 作为其小写标题、锚点和引用文本:
|
|
143
164
|
|
|
144
|
-
- \<pack\>
|
|
145
|
-
- \<N\>
|
|
146
|
-
-
|
|
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
|
-
|
|
172
|
+
已公开发布的条目 ID 应永久绑定到其条目所指明的事项:
|
|
151
173
|
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
174
|
+
- 该 ID 永不重新编号或重新分配;
|
|
175
|
+
- 条目内容仅可在保留该事项的前提下演变;
|
|
176
|
+
- 尚未发布的 ID 可重新分配。
|
|
155
177
|
|
|
178
|
+
<!-- spex-i18n-source: meta-14 sha256-bec76a978583747ecf96f671a77e9e3a795ff4bdd69dfd72d51c98779d5d82a8 -->
|
|
156
179
|
### meta-14
|
|
157
180
|
|
|
158
|
-
|
|
181
|
+
行为条目应将每个同级规约包关系表达为绑定引用——在被引行为使之具体化的确切短语处,以行内方式引用该规约包的外部行为 [[meta-16](#meta-16)]:
|
|
159
182
|
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
183
|
+
- 绑定引用绑定的是行为,绝不只绑定规约包的主体或状态;
|
|
184
|
+
- 当多个行为分别使同一短语的不同部分具体化时,该短语可带有多个绑定引用;
|
|
185
|
+
- 不存在未被引用的同级规约包依赖。
|
|
163
186
|
|
|
187
|
+
<!-- spex-i18n-source: meta-15 sha256-2bf03e350e6014f7fe1d8623953c0e9923be83deb692411c2304c80cce52b70a -->
|
|
164
188
|
### meta-15
|
|
165
189
|
|
|
166
|
-
|
|
190
|
+
规约包应独立成立:无需打开任何链接即可完整理解——引用绝不承载规约包自身的含义。
|
|
167
191
|
|
|
192
|
+
<!-- spex-i18n-source: meta-31 sha256-22ec564553bdada3a94a3c2273dcc59b7946bf8c4311c5c245003adb17ea9fc8 -->
|
|
168
193
|
### meta-31
|
|
169
194
|
|
|
170
|
-
|
|
195
|
+
`specs/packages/` 下的小写 kebab-case 子目录应仅用于组织集合:文件的身份由其基名确定 [[meta-10](#meta-10)];在集合之间移动文件会改变相对引用路径,但不会改变任何条目 ID 或锚点。
|
|
171
196
|
|
|
172
|
-
##
|
|
197
|
+
## 测试
|
|
173
198
|
|
|
199
|
+
<!-- spex-i18n-source: meta-21 sha256-3fd36fda3683299fdba6129318987bc429027cde6bbae08485085fd596f9275e -->
|
|
174
200
|
### meta-21
|
|
175
201
|
|
|
176
|
-
|
|
202
|
+
规约测试条目应仅规定集成测试和系统测试:单元测试属于实现,任何规约条目都不规定单元测试。
|
|
177
203
|
|
|
204
|
+
<!-- spex-i18n-source: meta-32 sha256-28f1ce30821d263ee507cf71be045ab431a9d5fe449ea7ea194c2c8f15a683b9 -->
|
|
178
205
|
### meta-32
|
|
179
206
|
|
|
180
|
-
|
|
207
|
+
测试应优先执行其所验证行为绑定的真实行为 [[meta-14](#meta-14)],而非提供这些行为的替代物。
|
|
181
208
|
|
|
209
|
+
<!-- spex-i18n-source: meta-33 sha256-65a82bd4cca5750e8e7b8743c636b2fbd6dff7fe3447b0d04c30cbb70666069a -->
|
|
182
210
|
### meta-33
|
|
183
211
|
|
|
184
|
-
|
|
212
|
+
每个规约包的`验证`章节应以白盒或黑盒方式验证该规约包的每个行为。
|
|
185
213
|
|
|
186
|
-
##
|
|
214
|
+
## 引用
|
|
187
215
|
|
|
216
|
+
<!-- spex-i18n-source: meta-16 sha256-c3a9c2d5a690ea7408db2fbd0a9d1cfdbe7b14ee162cd8d414f3f734f3a86279 -->
|
|
188
217
|
### meta-16
|
|
189
218
|
|
|
190
|
-
|
|
219
|
+
对规约条目或 DR 的引用应是行内相对链接,并以被引 ID 作为链接文本:
|
|
191
220
|
|
|
192
|
-
|
|
|
221
|
+
| 引用对象 | 形式 |
|
|
193
222
|
| --- | --- |
|
|
194
|
-
|
|
|
195
|
-
|
|
|
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
|
-
|
|
229
|
+
除某份 IR 本身外,任何规约均不得引用该 IR 或在正文中提及其名称。
|
|
200
230
|
|
|
231
|
+
<!-- spex-i18n-source: meta-19 sha256-b48c49bc3cdefa532ee254bd7af670a3762fd436aaf0ca9d49560f2f9159f664 -->
|
|
201
232
|
### meta-19
|
|
202
233
|
|
|
203
|
-
|
|
234
|
+
外部引用应通过编号标记(例如 `[[1]]`)引用权威来源(例如官方文档),该标记链接至文件参考资料章节中的具体 URL,且该章节不包含任何未被引用的条目。
|
|
204
235
|
|
|
236
|
+
<!-- spex-i18n-source: meta-20 sha256-e00eba313900b6fad6a87274765cad11a900465997e0f2cacfa9c904ca4587fe -->
|
|
205
237
|
### meta-20
|
|
206
238
|
|
|
207
|
-
|
|
239
|
+
测试条目应在用于验证的断言处,以行内引用标识它所验证的每个行为,且行为引用仅限于其自身规约包。
|
|
208
240
|
|
|
209
|
-
##
|
|
241
|
+
## 编写语言
|
|
210
242
|
|
|
211
243
|
<!-- spex-i18n-source: meta-27 sha256-b19f392d742d307fb0f811892dbb65509b36dc3a9636512604c636b7b0aa5c29 -->
|
|
212
244
|
### meta-27
|
|
213
245
|
|
|
214
|
-
|
|
246
|
+
给定规约树通过本条目的机器可读标记行声明编写语言——该行采用精确格式 `Authoring language: <code>`,其中 `<code>` 仅由 ASCII 字母、数字和连字符组成——为该项目新增的规约内容应使用该语言编写:
|
|
215
247
|
|
|
216
248
|
Authoring language: zh
|
|
217
249
|
|
|
218
|
-
##
|
|
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
|
|
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
|
|
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
|
|
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
|
|
83
|
-
`map.md`
|
|
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
|
|