@sublang/spex 1.0.0 → 2.1.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 +63 -17
- package/dist/append-agent-specs.d.ts +26 -14
- package/dist/append-agent-specs.js +173 -48
- package/dist/cli.js +7 -3
- package/dist/copy-templates.d.ts +9 -2
- package/dist/copy-templates.js +10 -8
- package/dist/lint.js +35 -43
- package/dist/scaffold.js +130 -44
- package/package.json +1 -1
- package/scaffold/.file-history.json +12 -6
- package/scaffold/agent-specs.txt +3 -7
- package/scaffold/i18n/zh/specs/map.md +4 -6
- package/scaffold/i18n/zh/specs/meta.md +54 -41
- package/scaffold/language-switch-prompt.md +12 -0
- package/scaffold/spec-migration-prompt.md +28 -0
- package/scaffold/specs/decisions/000-spec-structure-format.md +17 -17
- package/scaffold/specs/map.md +2 -5
- package/scaffold/specs/meta.md +36 -23
- package/scaffold/specs/packages/git.md +1 -1
- package/scaffold/update-merge-prompt.md +5 -5
|
@@ -1,12 +1,13 @@
|
|
|
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
5
|
|
|
5
6
|
# meta: 规约定义
|
|
6
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
11
|
|
|
11
12
|
## Overall
|
|
12
13
|
|
|
@@ -24,7 +25,9 @@ The `specs/` directory shall contain the following subdirectories and files:
|
|
|
24
25
|
|
|
25
26
|
### meta-23
|
|
26
27
|
|
|
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
|
|
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:
|
|
29
|
+
|
|
30
|
+
- For example, `map.md` limits its indexes to those an AI agent needs to find the right files.
|
|
28
31
|
|
|
29
32
|
### meta-25
|
|
30
33
|
|
|
@@ -35,12 +38,12 @@ A spec file shall keep one sentence per line — with lists, tables, and diagram
|
|
|
35
38
|
<!-- spex-i18n-source: meta-4 sha256-5ea8737b4d744c55c6c564672f86199e62a0caad95bbba2fb498b6c9407226c8 -->
|
|
36
39
|
### meta-4
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
Each DR shall follow the ADR format [[2]], with sections `状态`, `背景`, `决策`, `影响`, and `参考资料`.
|
|
39
42
|
|
|
40
43
|
<!-- spex-i18n-source: meta-5 sha256-6847734892ace98018676f3430e0a848b0a83541b23f1b4f69aa9b12a1c0aeda -->
|
|
41
44
|
### meta-5
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
Each IR shall contain sections `状态`, `意图`, `交付项` (with checkboxes), `任务` (numbered, each sized to one commit), and `验证`.
|
|
44
47
|
|
|
45
48
|
### meta-22
|
|
46
49
|
|
|
@@ -62,7 +65,7 @@ An IR shall be disposable: it contains nothing a DR or a spec item should cover,
|
|
|
62
65
|
每个规约条目应使用 GEARS 模式 [[1]],其子句和标点遵循自然的中文习惯:
|
|
63
66
|
|
|
64
67
|
```text
|
|
65
|
-
[给定 <静态前置条件>] [如果 <状态前置条件>] [当
|
|
68
|
+
[给定 <静态前置条件>] [如果 <状态前置条件>] [当 <触发条件>] <主体> 应 <行为>。
|
|
66
69
|
```
|
|
67
70
|
|
|
68
71
|
| 子句 | 用途 | 示例 |
|
|
@@ -72,16 +75,16 @@ An IR shall be disposable: it contains nothing a DR or a spec item should cover,
|
|
|
72
75
|
| 当/When | 触发事件——最多一个 | 当用户点击提交 |
|
|
73
76
|
| 应/shall | 所要求的行为 | 表单应校验输入并标示每处违规 |
|
|
74
77
|
|
|
75
|
-
<!-- spex-i18n-source: meta-7 sha256-
|
|
78
|
+
<!-- spex-i18n-source: meta-7 sha256-4c4ede3e11a0482d645f0d5154791a1e4e83438033b93d4fc8b359b00f2190ad -->
|
|
76
79
|
### meta-7
|
|
77
80
|
|
|
78
|
-
|
|
81
|
+
给定测试用例可用 Given-When-Then(GWT)表达,其规约条目应将 GWT 映射到 GEARS 子句 [[meta-6](#meta-6)]:
|
|
79
82
|
|
|
80
83
|
| GWT | 子句 |
|
|
81
84
|
| --- | ------ |
|
|
82
|
-
| Given |
|
|
83
|
-
| When |
|
|
84
|
-
| Then |
|
|
85
|
+
| Given | 给定 + 如果 |
|
|
86
|
+
| When | 当 |
|
|
87
|
+
| Then | 应 |
|
|
85
88
|
|
|
86
89
|
### meta-8
|
|
87
90
|
|
|
@@ -89,13 +92,14 @@ Each spec item shall be self-contained: every reliance on another item is an exp
|
|
|
89
92
|
|
|
90
93
|
### meta-29
|
|
91
94
|
|
|
92
|
-
Each spec item shall
|
|
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:
|
|
93
96
|
|
|
94
97
|
| Item kind | Example attachment |
|
|
95
98
|
| --- | --- |
|
|
96
99
|
| Behavior | ordered steps or the cases and outcomes of one operation or decision |
|
|
97
100
|
| Test | the assertions of one execution flow or one explicit case matrix |
|
|
98
101
|
|
|
102
|
+
- An attachment may take a form such as a note, list, table, (renderable) diagram, or example.
|
|
99
103
|
- A condition inside an attachment is a case label.
|
|
100
104
|
- Differing stateful preconditions or triggers are evidence of additional spec items.
|
|
101
105
|
|
|
@@ -103,38 +107,42 @@ Each spec item shall be exactly one GEARS statement [[meta-6](#meta-6)], elabora
|
|
|
103
107
|
|
|
104
108
|
### meta-13
|
|
105
109
|
|
|
106
|
-
A spec package shall define a closed set of subjects and their
|
|
110
|
+
A spec package shall define a closed set of subjects and their behavioral requirements for a shared intent.
|
|
111
|
+
|
|
112
|
+
### meta-34
|
|
113
|
+
|
|
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.
|
|
107
115
|
|
|
108
116
|
### meta-9
|
|
109
117
|
|
|
110
|
-
A spec package shall be one
|
|
118
|
+
A spec package shall be one file containing spec items under `specs/packages/` or its subdirectory.
|
|
111
119
|
|
|
112
|
-
<!-- spex-i18n-source: meta-30 sha256-
|
|
120
|
+
<!-- spex-i18n-source: meta-30 sha256-0157482272767b0d31d355728e8b2df551310d4248d380ab886f71e6d0bfe93b -->
|
|
113
121
|
### meta-30
|
|
114
122
|
|
|
115
|
-
|
|
123
|
+
Each package file shall contain only the following sections, in this order:
|
|
116
124
|
|
|
117
|
-
|
|
|
125
|
+
| Section | Presence | Content |
|
|
118
126
|
| ------- | -------- | ------- |
|
|
119
|
-
| `意图` |
|
|
120
|
-
| `外部行为` |
|
|
121
|
-
| `内部行为` |
|
|
122
|
-
| `验证` |
|
|
123
|
-
| `参考资料` |
|
|
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)] |
|
|
124
132
|
|
|
125
|
-
-
|
|
126
|
-
-
|
|
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.
|
|
127
135
|
|
|
128
136
|
### meta-10
|
|
129
137
|
|
|
130
|
-
A spec
|
|
138
|
+
A file containing spec items shall use a lowercase kebab-case basename \<pack\>.md unique across the specs tree, with \<pack\> serving as its identifier.
|
|
131
139
|
|
|
132
140
|
### meta-11
|
|
133
141
|
|
|
134
142
|
Each spec item shall use \<pack\>-\<N\> as its lowercase heading, anchor, and citation text:
|
|
135
143
|
|
|
136
|
-
- \<pack\> is its containing
|
|
137
|
-
- \<N\> is a positive integer unique within that
|
|
144
|
+
- \<pack\> is its containing file's identifier [[meta-10](#meta-10)];
|
|
145
|
+
- \<N\> is a positive integer unique within that file;
|
|
138
146
|
- a new item takes the lowest positive \<N\> neither assigned nor reserved by a public release [[meta-12](#meta-12)].
|
|
139
147
|
|
|
140
148
|
### meta-12
|
|
@@ -147,10 +155,11 @@ A publicly released item ID shall remain permanently bound to the concern its it
|
|
|
147
155
|
|
|
148
156
|
### meta-14
|
|
149
157
|
|
|
150
|
-
A
|
|
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)]:
|
|
151
159
|
|
|
152
|
-
-
|
|
153
|
-
-
|
|
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.
|
|
154
163
|
|
|
155
164
|
### meta-15
|
|
156
165
|
|
|
@@ -158,7 +167,7 @@ A spec package shall stand alone: readable in full without following any link
|
|
|
158
167
|
|
|
159
168
|
### meta-31
|
|
160
169
|
|
|
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.
|
|
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.
|
|
162
171
|
|
|
163
172
|
## Testing
|
|
164
173
|
|
|
@@ -168,41 +177,45 @@ Spec test items shall specify integration and system tests only: unit tests belo
|
|
|
168
177
|
|
|
169
178
|
### meta-32
|
|
170
179
|
|
|
171
|
-
A test shall prefer executing the real
|
|
180
|
+
A test shall prefer executing the real behaviors bound by the behaviors it verifies [[meta-14](#meta-14)] to supplying substitutes for them.
|
|
172
181
|
|
|
173
182
|
### meta-33
|
|
174
183
|
|
|
175
|
-
Each
|
|
184
|
+
Each package's `Verification` section shall verify every behavior in that package, white-box or black-box.
|
|
176
185
|
|
|
177
186
|
## Citation
|
|
178
187
|
|
|
179
188
|
### meta-16
|
|
180
189
|
|
|
181
|
-
A citation of a spec item shall be
|
|
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)`) |
|
|
182
196
|
|
|
183
197
|
### meta-18
|
|
184
198
|
|
|
185
199
|
No DR or spec item shall cite an IR or name it in prose.
|
|
186
200
|
|
|
187
|
-
<!-- spex-i18n-source: meta-19 sha256-e6137c80fab048cd6d69bf5a9b202b27cc14d97f67f51bcf8a5e915514039aa2 -->
|
|
188
201
|
### meta-19
|
|
189
202
|
|
|
190
|
-
|
|
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.
|
|
191
204
|
|
|
192
205
|
### meta-20
|
|
193
206
|
|
|
194
|
-
A test item shall
|
|
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.
|
|
195
208
|
|
|
196
209
|
## Authoring language
|
|
197
210
|
|
|
198
|
-
<!-- spex-i18n-source: meta-27 sha256-
|
|
211
|
+
<!-- spex-i18n-source: meta-27 sha256-b19f392d742d307fb0f811892dbb65509b36dc3a9636512604c636b7b0aa5c29 -->
|
|
199
212
|
### meta-27
|
|
200
213
|
|
|
201
|
-
Authoring language:
|
|
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:
|
|
202
215
|
|
|
203
|
-
|
|
216
|
+
Authoring language: zh
|
|
204
217
|
|
|
205
|
-
##
|
|
218
|
+
## References
|
|
206
219
|
|
|
207
220
|
[1]: https://sublang.ai/zh/ref/gears-ai-ready-spec-syntax "GEARS:面向 AI 的规约语法(中文)"
|
|
208
221
|
[2]: https://github.com/npryce/adr-tools "ADR Tools"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
|
|
4
|
+
Translate this project's own specs into the authoring language now declared by @specs/meta.md:
|
|
5
|
+
|
|
6
|
+
- Translate the prose of every spec file the project owns under @specs/ — package Intents, behavior and test statements, decision records, intent records, and @specs/map.md entries. The bundled framework files are already in the new language.
|
|
7
|
+
- Preserve every item ID, heading anchor, and citation target exactly: `[[pack-3](pack.md#pack-3)]` keeps its ID text and link, and `pack-3` stays `pack-3` in the heading it names.
|
|
8
|
+
- Use the section names the active @specs/meta.md defines for package files and records; do not invent alternatives.
|
|
9
|
+
- Leave untranslated what is not prose: file paths, identifiers, code, commands, `Authoring language:` and other machine-readable marker lines, and external reference URLs.
|
|
10
|
+
- Preserve meaning over style. Where a term is a defined concept in @specs/meta.md, translate it the way meta.md translates it, and keep one rendering per term throughout.
|
|
11
|
+
- Translate only. Do not add, drop, split, merge, or restructure any requirement while translating.
|
|
12
|
+
- Finish by running `spex lint` and resolving any error.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
|
|
4
|
+
Migrate every legacy Spex specs tree in this repository to the current spec generation:
|
|
5
|
+
|
|
6
|
+
- Read current `@specs/meta.md` and `@specs/decisions/000-spec-structure-format.md` fully before editing; they are the target law, and `spex scaffold --update` refreshed them while leaving legacy content untouched.
|
|
7
|
+
Synchronize each additional spec tree's framework law to that target while preserving tree-specific context; do not revise the target law itself without explicit human approval.
|
|
8
|
+
- Preserve every stated behavior, local extension, record state, checkbox, and item's concern; invent or drop nothing.
|
|
9
|
+
If an item ID appeared in a public release, obtain owner approval for the generation-wide spelling change before editing.
|
|
10
|
+
- Inventory the whole tree and build a complete rename map before moving content.
|
|
11
|
+
Each old short-form ID becomes `<destination-file-basename>-<N>`, lowercase, with `<N>` unchanged; resolve basename clashes first, then retarget headings, prose names, links, paths, anchors, and inbound citations tree-wide.
|
|
12
|
+
- Retarget old `META-*` citations by concern, never by number alone.
|
|
13
|
+
Non-identity mappings are `META-3` and `META-28` to `meta-30`, `META-32` to `meta-31`, `META-37` to `meta-28`, `META-38` to `meta-33`, `META-42` to `meta-29`, and `META-43` to `meta-22`; `META-17`, `META-26`, `META-31`, `META-33` through `META-36`, `META-39` through `META-41`, and `META-44` have no direct successor.
|
|
14
|
+
For removed law, keep still-true prose and drop the link; rewrite or remove a dead claim.
|
|
15
|
+
- Merge old `user/`, `dev/`, `test/`, and `items/` sources for one subject into one package; those directories are classification hints only.
|
|
16
|
+
Fold `interactions/` and `compositions/` into ordinary packages, and move `iterations/` records to `intents/`.
|
|
17
|
+
When the update created a current seed at a destination, reconcile legacy local content into it rather than overwriting or duplicating it.
|
|
18
|
+
- Make each package self-contained with `# <basename>: <Title>` and the current section order.
|
|
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
|
+
- 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.
|
|
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.
|
|
24
|
+
- Update `map.md` and any project guidance describing the old layout.
|
|
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
|
+
- Loop on `spex lint` until clean.
|
|
27
|
+
Manually review for residue it may not catch — old uppercase item IDs, single-bracket item citations, legacy paths, relationship-metadata lines, and dangling links — and re-read heavily restructured files for semantic fidelity.
|
|
28
|
+
- Hand over the rename map, every classification, dependency, status, and split judgment, and every unresolved question for human diff review; do not merge it yourself.
|
|
@@ -32,7 +32,7 @@ Decisions and intents are stored as records.
|
|
|
32
32
|
- Decision records (DRs) follow the ADR (Architectural Decision Record) format [[1]].
|
|
33
33
|
- Intent records (IRs) plan an intent's implementation and track its progress [[meta-5](../meta.md#meta-5)].
|
|
34
34
|
- **Items** must follow the GEARS pattern [[2]] to specify behaviors.
|
|
35
|
-
|
|
35
|
+
A spec package collects spec items that share an intent.
|
|
36
36
|
|
|
37
37
|
### Organization
|
|
38
38
|
|
|
@@ -48,31 +48,31 @@ Spex creates the default `specs/` directory under the repo root, with the follow
|
|
|
48
48
|
|
|
49
49
|
### Spec packages
|
|
50
50
|
|
|
51
|
-
A spec package is a collection of behaviors for a shared intent
|
|
52
|
-
It is the unit of spec authoring, reuse,
|
|
51
|
+
A spec package is a collection of behaviors for a shared intent, in one file under `packages/`.
|
|
52
|
+
It is the unit of spec authoring, reuse, customization, and composition.
|
|
53
53
|
|
|
54
|
-
A spec package is one file under `packages/` or its subdirectory.
|
|
55
54
|
For example, a spec package for generating short URLs may be `specs/packages/signing/gen-url.md`, where `signing/` is a local collection of related packages for development convenience.
|
|
56
55
|
|
|
57
|
-
Each package file carries
|
|
56
|
+
Each package file carries these sections in this order [[meta-30](../meta.md#meta-30)]:
|
|
58
57
|
|
|
58
|
+
- `Intent` for the purpose the package's items share.
|
|
59
59
|
- `External Behavior` for outcomes and guarantees the package's users rely on.
|
|
60
60
|
A package's user may be a human or a system component.
|
|
61
|
-
- `Internal Behavior` for
|
|
61
|
+
- `Internal Behavior` (optional) for behavior hidden from the package's users.
|
|
62
62
|
- `Verification` for test items that check the package's own claims.
|
|
63
|
+
- `References` (optional) for external sources.
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
But a spec package remains meaningfully self-contained.
|
|
66
|
-
It reads in full without following any link.
|
|
65
|
+
An installed package can be customized in place by adding, changing, or deleting spec items in its file; this changes only the installed copy and creates no peer package relationship.
|
|
67
66
|
|
|
68
67
|
### Package relationships
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
Three patterns cover most cases:
|
|
69
|
+
A package behavior shall express every peer package relationship through binding citations to peer External Behavior [[meta-14](../meta.md#meta-14)]:
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
| Case | Form |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| Fixed binding | The package definition fixes the binding to a required behavior at the exact phrase the cited behavior makes specific. |
|
|
74
|
+
| Polymorphic binding | Instantiation resolves the binding to a selected behavior at the exact phrase the cited behavior makes specific. |
|
|
75
|
+
| Composition | A behavior states an integrated outcome and cites each contributing behavior at the exact phrase it makes specific. |
|
|
76
76
|
|
|
77
77
|
### Citations
|
|
78
78
|
|
|
@@ -86,10 +86,10 @@ IRs may cite, but must not be cited by, DRs or items.
|
|
|
86
86
|
|
|
87
87
|
- Consistent structure and format across development cycles
|
|
88
88
|
- One file per package: a single read covers a package's external behavior, internal behavior, and verification
|
|
89
|
-
- One package kind
|
|
90
|
-
- Every relationship is visible as a citation at the phrase that relies on it
|
|
89
|
+
- One package kind supports in-place customization; one binding-citation form expresses every peer package relationship
|
|
90
|
+
- Every peer package relationship is visible as a citation at the phrase that relies on it
|
|
91
91
|
- A package stands alone once its citations are stripped
|
|
92
|
-
- Flexible expression of
|
|
92
|
+
- Flexible expression of external, internal, and composed behavior
|
|
93
93
|
|
|
94
94
|
## References
|
|
95
95
|
|
package/scaffold/specs/map.md
CHANGED
|
@@ -11,9 +11,6 @@ Code can be inconsistent with specs during development.
|
|
|
11
11
|
|
|
12
12
|
Know the rules in [`meta.md`](meta.md) before authoring, modifying, or reviewing a DR, IR, or item.
|
|
13
13
|
|
|
14
|
-
- DRs and IRs: see [Overall](meta.md#overall), [Record format](meta.md#record-format), and [Citation](meta.md#citation).
|
|
15
|
-
- Items: see [Overall](meta.md#overall), [Item syntax](meta.md#item-syntax), [Spec packages](meta.md#spec-packages), [Testing](meta.md#testing), and [Citation](meta.md#citation).
|
|
16
|
-
|
|
17
14
|
## Layout
|
|
18
15
|
|
|
19
16
|
```text
|
|
@@ -28,13 +25,13 @@ meta.md The spec of specs
|
|
|
28
25
|
|
|
29
26
|
| ID | File | Summary |
|
|
30
27
|
| --- | --- | --- |
|
|
31
|
-
| DR-000
|
|
28
|
+
| [DR-000](decisions/000-spec-structure-format.md) | 000-spec-structure-format.md | Spec structure, format, and naming conventions |
|
|
32
29
|
|
|
33
30
|
## Intents
|
|
34
31
|
|
|
35
32
|
| ID | File | Intent |
|
|
36
33
|
| --- | --- | --- |
|
|
37
|
-
| IR-000
|
|
34
|
+
| [IR-000](intents/000-spdx-headers.md) | 000-spdx-headers.md | Add SPDX headers to applicable files |
|
|
38
35
|
|
|
39
36
|
## Packages
|
|
40
37
|
|
package/scaffold/specs/meta.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## Intent
|
|
8
8
|
|
|
9
|
-
This
|
|
9
|
+
This file defines the structure and organization of specifications (specs), per [DR-000](decisions/000-spec-structure-format.md).
|
|
10
10
|
|
|
11
11
|
## Overall
|
|
12
12
|
|
|
@@ -24,7 +24,9 @@ The `specs/` directory shall contain the following subdirectories and files:
|
|
|
24
24
|
|
|
25
25
|
### meta-23
|
|
26
26
|
|
|
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
|
|
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:
|
|
28
|
+
|
|
29
|
+
- For example, `map.md` limits its indexes to those an AI agent needs to find the right files.
|
|
28
30
|
|
|
29
31
|
### meta-25
|
|
30
32
|
|
|
@@ -71,7 +73,7 @@ Each spec item shall use the GEARS pattern [[1]], with its clauses and punctuati
|
|
|
71
73
|
|
|
72
74
|
### meta-7
|
|
73
75
|
|
|
74
|
-
Where test cases can be expressed by Given-When-Then (GWT), their spec items shall map GWT to GEARS [[
|
|
76
|
+
Where test cases can be expressed by Given-When-Then (GWT), their spec items shall map GWT to the GEARS clauses [[meta-6](#meta-6)]:
|
|
75
77
|
|
|
76
78
|
| GWT | Clause |
|
|
77
79
|
| --- | ------ |
|
|
@@ -85,13 +87,14 @@ Each spec item shall be self-contained: every reliance on another item is an exp
|
|
|
85
87
|
|
|
86
88
|
### meta-29
|
|
87
89
|
|
|
88
|
-
Each spec item shall
|
|
90
|
+
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:
|
|
89
91
|
|
|
90
92
|
| Item kind | Example attachment |
|
|
91
93
|
| --- | --- |
|
|
92
94
|
| Behavior | ordered steps or the cases and outcomes of one operation or decision |
|
|
93
95
|
| Test | the assertions of one execution flow or one explicit case matrix |
|
|
94
96
|
|
|
97
|
+
- An attachment may take a form such as a note, list, table, (renderable) diagram, or example.
|
|
95
98
|
- A condition inside an attachment is a case label.
|
|
96
99
|
- Differing stateful preconditions or triggers are evidence of additional spec items.
|
|
97
100
|
|
|
@@ -99,11 +102,15 @@ Each spec item shall be exactly one GEARS statement [[meta-6](#meta-6)], elabora
|
|
|
99
102
|
|
|
100
103
|
### meta-13
|
|
101
104
|
|
|
102
|
-
A spec package shall define a closed set of subjects and their
|
|
105
|
+
A spec package shall define a closed set of subjects and their behavioral requirements for a shared intent.
|
|
106
|
+
|
|
107
|
+
### meta-34
|
|
108
|
+
|
|
109
|
+
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.
|
|
103
110
|
|
|
104
111
|
### meta-9
|
|
105
112
|
|
|
106
|
-
A spec package shall be one
|
|
113
|
+
A spec package shall be one file containing spec items under `specs/packages/` or its subdirectory.
|
|
107
114
|
|
|
108
115
|
### meta-30
|
|
109
116
|
|
|
@@ -111,10 +118,10 @@ Each package file shall contain only the following sections, in this order:
|
|
|
111
118
|
|
|
112
119
|
| Section | Presence | Content |
|
|
113
120
|
| ------- | -------- | ------- |
|
|
114
|
-
| `Intent` | required | the
|
|
121
|
+
| `Intent` | required | the package's purpose |
|
|
115
122
|
| `External Behavior` | required | outcomes and guarantees the package's users may rely on |
|
|
116
|
-
| `Internal Behavior` | optional |
|
|
117
|
-
| `Verification` | required
|
|
123
|
+
| `Internal Behavior` | optional | behavior hidden from the package's users |
|
|
124
|
+
| `Verification` | required | test items verifying this package's behavior |
|
|
118
125
|
| `References` | optional | external sources [[meta-19](#meta-19)] |
|
|
119
126
|
|
|
120
127
|
- A package's user is any human or system component using its contract; External and Internal are relative to the package.
|
|
@@ -122,14 +129,14 @@ Each package file shall contain only the following sections, in this order:
|
|
|
122
129
|
|
|
123
130
|
### meta-10
|
|
124
131
|
|
|
125
|
-
A spec
|
|
132
|
+
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.
|
|
126
133
|
|
|
127
134
|
### meta-11
|
|
128
135
|
|
|
129
136
|
Each spec item shall use \<pack\>-\<N\> as its lowercase heading, anchor, and citation text:
|
|
130
137
|
|
|
131
|
-
- \<pack\> is its containing
|
|
132
|
-
- \<N\> is a positive integer unique within that
|
|
138
|
+
- \<pack\> is its containing file's identifier [[meta-10](#meta-10)];
|
|
139
|
+
- \<N\> is a positive integer unique within that file;
|
|
133
140
|
- a new item takes the lowest positive \<N\> neither assigned nor reserved by a public release [[meta-12](#meta-12)].
|
|
134
141
|
|
|
135
142
|
### meta-12
|
|
@@ -142,10 +149,11 @@ A publicly released item ID shall remain permanently bound to the concern its it
|
|
|
142
149
|
|
|
143
150
|
### meta-14
|
|
144
151
|
|
|
145
|
-
A
|
|
152
|
+
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)]:
|
|
146
153
|
|
|
147
|
-
-
|
|
148
|
-
-
|
|
154
|
+
- a binding citation binds behavior, never package subjects or states alone;
|
|
155
|
+
- one phrase may carry several binding citations when several behaviors make its different parts specific, respectively;
|
|
156
|
+
- there is no uncited peer package dependency.
|
|
149
157
|
|
|
150
158
|
### meta-15
|
|
151
159
|
|
|
@@ -153,7 +161,7 @@ A spec package shall stand alone: readable in full without following any link
|
|
|
153
161
|
|
|
154
162
|
### meta-31
|
|
155
163
|
|
|
156
|
-
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.
|
|
164
|
+
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.
|
|
157
165
|
|
|
158
166
|
## Testing
|
|
159
167
|
|
|
@@ -163,17 +171,22 @@ Spec test items shall specify integration and system tests only: unit tests belo
|
|
|
163
171
|
|
|
164
172
|
### meta-32
|
|
165
173
|
|
|
166
|
-
A test shall prefer executing the real
|
|
174
|
+
A test shall prefer executing the real behaviors bound by the behaviors it verifies [[meta-14](#meta-14)] to supplying substitutes for them.
|
|
167
175
|
|
|
168
176
|
### meta-33
|
|
169
177
|
|
|
170
|
-
Each
|
|
178
|
+
Each package's `Verification` section shall verify every behavior in that package, white-box or black-box.
|
|
171
179
|
|
|
172
180
|
## Citation
|
|
173
181
|
|
|
174
182
|
### meta-16
|
|
175
183
|
|
|
176
|
-
A citation of a spec item shall be
|
|
184
|
+
A citation of a spec item or record shall be an inline relative link with the cited ID as its link text:
|
|
185
|
+
|
|
186
|
+
| Cited | Form |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| Spec item | its heading anchor, in an outer pair of square brackets (e.g., `[[meta-1](meta.md#meta-1)]`) |
|
|
189
|
+
| Record | its file, with no outer brackets (e.g., `[DR-000](decisions/000-spec-structure-format.md)`) |
|
|
177
190
|
|
|
178
191
|
### meta-18
|
|
179
192
|
|
|
@@ -181,19 +194,19 @@ No DR or spec item shall cite an IR or name it in prose.
|
|
|
181
194
|
|
|
182
195
|
### meta-19
|
|
183
196
|
|
|
184
|
-
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
|
|
197
|
+
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.
|
|
185
198
|
|
|
186
199
|
### meta-20
|
|
187
200
|
|
|
188
|
-
A test item shall
|
|
201
|
+
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.
|
|
189
202
|
|
|
190
203
|
## Authoring language
|
|
191
204
|
|
|
192
205
|
### meta-27
|
|
193
206
|
|
|
194
|
-
Authoring language:
|
|
207
|
+
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:
|
|
195
208
|
|
|
196
|
-
|
|
209
|
+
Authoring language: en
|
|
197
210
|
|
|
198
211
|
## References
|
|
199
212
|
|
|
@@ -25,7 +25,7 @@ Where a commit message includes a body, when writing the body, the commit body s
|
|
|
25
25
|
|
|
26
26
|
### git-4
|
|
27
27
|
|
|
28
|
-
When AI assists in coding or authoring, the commit message shall include a `Co-authored-by` trailer in the format `<model> (<role>) <email>`, where `<role>` is one of `coder|reviewer|maintainer` and `<email>` is `cligent@sublang.ai
|
|
28
|
+
When AI assists in coding or authoring, the commit message shall include a `Co-authored-by` trailer in the format `<model> (<role>) <email>`, where `<role>` is one of `coder|reviewer|maintainer` and `<email>` is `cligent@sublang.ai`:
|
|
29
29
|
|
|
30
30
|
Example: `Co-authored-by: GPT-5.2-Codex (coder) <cligent@sublang.ai>`
|
|
31
31
|
|
|
@@ -5,11 +5,11 @@ Review Git diffs under @specs/ and perform a spec update merge:
|
|
|
5
5
|
|
|
6
6
|
- If @specs/decisions/000-spec-structure-format.md or @specs/meta.md changed, update existing @specs/ files to conform while preserving local content that still applies.
|
|
7
7
|
- Preserve every item ID and normative concern that appeared in a prior release; provisional IDs may be compacted before publication.
|
|
8
|
-
- Classify behavior relative to each package: outcomes and guarantees the package's users may rely on belong in `## External Behavior`;
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- Remove relationship-metadata lines (`Verifies:`, `Binds:`, `Composes:`, `Clients:`, `Suppliers:`, `Scope:`) and detached `Verifies ...` sentences:
|
|
12
|
-
- Keep each package's `## Intent` a self-contained
|
|
8
|
+
- Classify behavior relative to each package: outcomes and guarantees the package's users may rely on belong in `## External Behavior`; behavior hidden from them belongs in `## Internal Behavior`.
|
|
9
|
+
- Convert every item citation to the enclosed ID-text form, e.g. `[[pack-3](pack.md#pack-3)]`, and every record citation to a plain ID-text link, e.g. `[DR-000](decisions/000-example.md)`; place a behavior binding citation at the phrase it makes specific and confine test behavior citations to the containing package.
|
|
10
|
+
- Place every attachment after the final colon of its governing GEARS statement.
|
|
11
|
+
- Remove relationship-metadata lines (`Verifies:`, `Binds:`, `Composes:`, `Clients:`, `Suppliers:`, `Scope:`) and detached `Verifies ...` sentences: move each binding citation to the behavior phrase it makes specific and each test citation to the assertion it verifies, then delete the line.
|
|
12
|
+
- Keep each package's `## Intent` a self-contained statement of purpose whose meaning no supporting citation carries, and check each file's title still fits.
|
|
13
13
|
- Update @specs/map.md where the merge left its layout, tables, or summaries stale.
|
|
14
14
|
- Focus only on the update merge; do not refine unrelated spec content.
|
|
15
15
|
- Finish by running `spex lint` and resolving remaining errors; never restore removed trace lines to satisfy an older checker.
|