@sublang/spex 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -8
- package/dist/append-agent-specs.d.ts +3 -2
- package/dist/append-agent-specs.js +21 -27
- package/dist/lint.js +33 -41
- 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/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 -4
package/README.md
CHANGED
|
@@ -38,7 +38,9 @@ This creates:
|
|
|
38
38
|
- `specs/decisions/` and `specs/intents/` hold decision records (DRs) and intent records (IRs); `specs/map.md` indexes the tree and `specs/meta.md` is the spec of specs.
|
|
39
39
|
- Two starter packages (`git.md`, `licensing.md`) and a sample intent record seed the tree.
|
|
40
40
|
- **`LICENSE`** — the verbatim Apache-2.0 text at the target root, written only when no `LICENSE` exists there.
|
|
41
|
-
- **`CLAUDE.md` / `AGENTS.md`** — instructions that tell AI agents
|
|
41
|
+
- **`CLAUDE.md` / `AGENTS.md`** — instructions that tell AI agents
|
|
42
|
+
(Claude, Codex, etc.) to read relevant specs, resolve conflicts there
|
|
43
|
+
first, and keep specs and code aligned.
|
|
42
44
|
|
|
43
45
|
See `specs/decisions/000-spec-structure-format.md` and `specs/meta.md` for the spec format and naming conventions.
|
|
44
46
|
|
|
@@ -56,7 +58,7 @@ spex lint
|
|
|
56
58
|
|
|
57
59
|
The linter validates the layout, package file sections and their order, item IDs — lowercase `<pack>-<N>` matching the file's basename, unique across the tree — citations (enclosed inline links like `[[pack-3](pack.md#pack-3)]` whose files and anchors exist), Verification items citing the behaviors they check, reference markers, record sections, and the `map.md` index.
|
|
58
60
|
Relationship-metadata lines like `Verifies:` are errors — the citations woven into an item's statement are the single source of its relationships.
|
|
59
|
-
Directories of previous spec generations (`specs/compositions/`, `specs/user/`, …) are errors pointing at the migration skill (see [Upgrading](#upgrading-from-
|
|
61
|
+
Directories of previous spec generations (`specs/compositions/`, `specs/user/`, …) are errors pointing at the migration skill (see [Upgrading](#upgrading-from-an-earlier-release)).
|
|
60
62
|
Errors exit non-zero; warnings do not.
|
|
61
63
|
|
|
62
64
|
**Try it:** review the sample intent record `specs/intents/000-spdx-headers.md`, update the copyright text, then prompt your AI coding agent:
|
|
@@ -93,16 +95,26 @@ It runs from within a git repository and requires a clean `specs/` working tree,
|
|
|
93
95
|
Review the changes with `git diff -- specs CLAUDE.md AGENTS.md` and run `spex lint`.
|
|
94
96
|
The command prints a per-file indicator for every framework and seed path, plus a copy-paste-ready prompt for your AI agent to reconcile citations and local extensions with the refreshed law.
|
|
95
97
|
|
|
96
|
-
## Upgrading from
|
|
98
|
+
## Upgrading from an earlier release
|
|
97
99
|
|
|
98
|
-
|
|
99
|
-
A tree scaffolded by any spex 0.x release carries a previous generation of that law; a future rewrite would be a 2.0.
|
|
100
|
-
What changed:
|
|
100
|
+
### From 1.x
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
Spex 2.0 tightens the packages-only law introduced in 1.0. Run
|
|
103
|
+
`spex scaffold --update`, review the refreshed law and merge guidance,
|
|
104
|
+
then reconcile your packages until `spex lint` passes. In particular,
|
|
105
|
+
every package now requires Verification of its own behavior, behavior
|
|
106
|
+
citations from Verification stay inside that package, record citations
|
|
107
|
+
use their exact IDs, and every item-bearing basename is tree-wide unique.
|
|
108
|
+
|
|
109
|
+
### From 0.x
|
|
110
|
+
|
|
111
|
+
A tree scaffolded by a spex 0.x release carries the older structural
|
|
112
|
+
generation of the law. Spex 2.0 uses the following structure:
|
|
113
|
+
|
|
114
|
+
| | Previous generations (spex 0.x) | Current generation (spex 2.0) |
|
|
103
115
|
| --- | --- | --- |
|
|
104
116
|
| Layout | `specs/user`/`dev`/`test`, later `packages/` + `compositions/` | `packages/` only — composition is a package pattern |
|
|
105
|
-
| Cross-package behavior | binding and scenario items in composition files |
|
|
117
|
+
| Cross-package behavior | binding and scenario items in composition files | behavior items binding inline to peers' External Behavior |
|
|
106
118
|
| Item IDs | ALLCAPS short form (`AUTH-3`) | lowercase file basename (`github-login-3`) |
|
|
107
119
|
| Item citations | `[AUTH-3](auth.md#auth-3)` | enclosed: `[[github-login-3](github-login.md#github-login-3)]` |
|
|
108
120
|
| Intent records | Goal, Deliverables, Tasks, Acceptance criteria | Status, Intent, Deliverables, Tasks, Verification |
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* at basePath.
|
|
4
4
|
*
|
|
5
5
|
* SCAF-10: when neither exists, both are created; when only one
|
|
6
|
-
* exists, only that file is updated. Section replacement
|
|
7
|
-
*
|
|
6
|
+
* exists, only that file is updated. Section replacement parses
|
|
7
|
+
* Markdown and matches the H2 heading "Specs (Source of Truth)"
|
|
8
|
+
* case-sensitively, immune to lookalikes inside code fences.
|
|
8
9
|
* SCAF-5: replace in place or skip when identical.
|
|
9
10
|
*
|
|
10
11
|
* With `createMissing: false` (the --update flow), absent files stay
|
|
@@ -3,37 +3,30 @@
|
|
|
3
3
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { getScaffoldDir } from "./bundled-scaffold.js";
|
|
6
|
-
|
|
6
|
+
import { headingText, parseMarkdown, startOffset } from "./markdown.js";
|
|
7
|
+
const SECTION_TITLE = "Specs (Source of Truth)";
|
|
7
8
|
const AGENT_FILES = ["CLAUDE.md", "AGENTS.md"];
|
|
8
|
-
function escapeRegExp(s) {
|
|
9
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10
|
-
}
|
|
11
9
|
/**
|
|
12
|
-
* Extract the specs section from content: from the heading to
|
|
13
|
-
* next h2 heading or end of file.
|
|
10
|
+
* Extract the specs section from content: from the managed heading to
|
|
11
|
+
* the next h2 heading or end of file. The content is parsed as
|
|
12
|
+
* Markdown, so only a real heading matches — a lookalike line inside a
|
|
13
|
+
* fenced code block neither starts the section nor terminates it.
|
|
14
14
|
* Returns [start, end] character offsets, or null if not found.
|
|
15
15
|
*/
|
|
16
16
|
function findSection(content) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const match = pattern.exec(content);
|
|
21
|
-
if (!match)
|
|
17
|
+
const headings = parseMarkdown(content).children.filter((node) => node.type === "heading" && node.depth === 2);
|
|
18
|
+
const managed = headings.find((heading) => headingText(content, heading) === SECTION_TITLE);
|
|
19
|
+
if (managed === undefined)
|
|
22
20
|
return null;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const nextH2Match = content.slice(afterHeading).match(/\r?\n## /);
|
|
33
|
-
const end = nextH2Match?.index !== undefined
|
|
34
|
-
? afterHeading + nextH2Match.index
|
|
35
|
-
: content.length;
|
|
36
|
-
return [idx, end];
|
|
21
|
+
const next = headings.find((heading) => startOffset(heading) > startOffset(managed));
|
|
22
|
+
if (next === undefined)
|
|
23
|
+
return [startOffset(managed), content.length];
|
|
24
|
+
// End before the line ending that precedes the next heading, so the
|
|
25
|
+
// separator between sections stays outside the replaced range.
|
|
26
|
+
let end = startOffset(next);
|
|
27
|
+
if (content[end - 1] === "\n")
|
|
28
|
+
end -= content[end - 2] === "\r" ? 2 : 1;
|
|
29
|
+
return [startOffset(managed), end];
|
|
37
30
|
}
|
|
38
31
|
/**
|
|
39
32
|
* Process a single agent file: replace section in place, append,
|
|
@@ -72,8 +65,9 @@ function processFile(filePath, specsContent, fileExists, shouldCreate) {
|
|
|
72
65
|
* at basePath.
|
|
73
66
|
*
|
|
74
67
|
* SCAF-10: when neither exists, both are created; when only one
|
|
75
|
-
* exists, only that file is updated. Section replacement
|
|
76
|
-
*
|
|
68
|
+
* exists, only that file is updated. Section replacement parses
|
|
69
|
+
* Markdown and matches the H2 heading "Specs (Source of Truth)"
|
|
70
|
+
* case-sensitively, immune to lookalikes inside code fences.
|
|
77
71
|
* SCAF-5: replace in place or skip when identical.
|
|
78
72
|
*
|
|
79
73
|
* With `createMissing: false` (the --update flow), absent files stay
|
package/dist/lint.js
CHANGED
|
@@ -319,7 +319,7 @@ function lintPackageFile(ctx, file) {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
if (!present.includes("Verification")) {
|
|
322
|
-
report(ctx, file.relPath, 1, "
|
|
322
|
+
report(ctx, file.relPath, 1, "error", "package/verification", 'missing required "## Verification" section (meta-30)');
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
function collectItems(ctx) {
|
|
@@ -396,22 +396,22 @@ function lintItems(ctx, items) {
|
|
|
396
396
|
report(ctx, item.file.relPath, item.heading.line, "error", "id/duplicate", `item ID ${item.id} is defined ${list.length} times across specs/ (meta-11)`);
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
//
|
|
400
|
-
//
|
|
399
|
+
// An item-bearing file's identity is its basename (meta-10),
|
|
400
|
+
// which is unique across the specs tree.
|
|
401
|
+
const itemFiles = new Set(items.map((item) => item.file.relPath));
|
|
401
402
|
const byBasename = new Map();
|
|
402
403
|
for (const file of ctx.files.values()) {
|
|
403
|
-
if (!isUnder(file.relPath, "packages"))
|
|
404
|
-
continue;
|
|
405
404
|
const basename = basenameOf(file.relPath);
|
|
406
405
|
const list = byBasename.get(basename) ?? [];
|
|
407
406
|
list.push(file);
|
|
408
407
|
byBasename.set(basename, list);
|
|
409
408
|
}
|
|
410
409
|
for (const [basename, list] of byBasename) {
|
|
411
|
-
if (list.length < 2)
|
|
410
|
+
if (list.length < 2 || !list.some((file) => itemFiles.has(file.relPath))) {
|
|
412
411
|
continue;
|
|
413
|
-
|
|
414
|
-
|
|
412
|
+
}
|
|
413
|
+
for (const file of list.filter((candidate) => itemFiles.has(candidate.relPath))) {
|
|
414
|
+
report(ctx, file.relPath, 1, "error", "id/basename", `item-bearing basename "${basename}" conflicts with ${list
|
|
415
415
|
.map((other) => other.relPath)
|
|
416
416
|
.join(", ")} (meta-10)`);
|
|
417
417
|
}
|
|
@@ -508,11 +508,9 @@ function lintItemRelationships(ctx, items) {
|
|
|
508
508
|
report(ctx, item.file.relPath, item.heading.line, "error", "verify/uncited", `Verification item ${item.id} cites no same-file behavior item; cite each behavior it verifies inline at the assertion (meta-20)`);
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
//
|
|
512
|
-
//
|
|
513
|
-
// meta-
|
|
514
|
-
// and the law is silent on it reaching a peer's Internal
|
|
515
|
-
// Behavior, so lint tolerates that reach (lint-13).
|
|
511
|
+
// A behavior reaches peers through External Behavior alone
|
|
512
|
+
// (meta-14). Verification behavior citations stay within their
|
|
513
|
+
// own package (meta-20), where Internal Behavior remains valid.
|
|
516
514
|
const isBehavior = item.section !== null && BEHAVIOR_SECTIONS.has(item.section);
|
|
517
515
|
const isVerification = item.section === "Verification";
|
|
518
516
|
if (isBehavior || isVerification) {
|
|
@@ -530,21 +528,18 @@ function lintItemRelationships(ctx, items) {
|
|
|
530
528
|
report(ctx, item.file.relPath, link.line, "error", "cite/internal", `item ${item.id} cites ${cited.id} in ${target.relPath}'s ${cited.section ?? "front matter"}; a peer behavior is relied on through External Behavior alone (meta-14)`);
|
|
531
529
|
}
|
|
532
530
|
}
|
|
533
|
-
else if (target.fragment !== ""
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
!BEHAVIOR_SECTIONS.has(cited.section)) {
|
|
539
|
-
report(ctx, item.file.relPath, link.line, "error", "cite/internal", `Verification item ${item.id} cites ${target.relPath}#${target.fragment} outside the peer's External and Internal Behavior items (meta-20)`);
|
|
540
|
-
}
|
|
531
|
+
else if (target.fragment !== "" &&
|
|
532
|
+
cited?.section !== null &&
|
|
533
|
+
cited?.section !== undefined &&
|
|
534
|
+
BEHAVIOR_SECTIONS.has(cited.section)) {
|
|
535
|
+
report(ctx, item.file.relPath, link.line, "error", "verify/peer", `Verification item ${item.id} cites peer behavior ${cited.id}; behavior citations stay within the containing package (meta-20)`);
|
|
541
536
|
}
|
|
542
537
|
}
|
|
543
538
|
}
|
|
544
539
|
}
|
|
545
|
-
// One
|
|
540
|
+
// One requirement per item (meta-29), sentence count as
|
|
546
541
|
// its advisory proxy (lint-14) — a conformant item may carry
|
|
547
|
-
// several sentences of one
|
|
542
|
+
// several sentences of one requirement's cases, so this only
|
|
548
543
|
// prompts a read: prose outside fenced blocks, lists, tables,
|
|
549
544
|
// blockquotes, and headings carries at most one sentence.
|
|
550
545
|
// Terminators: ASCII before whitespace or line end, fullwidth
|
|
@@ -573,7 +568,7 @@ function lintItemRelationships(ctx, items) {
|
|
|
573
568
|
terminators += found;
|
|
574
569
|
}
|
|
575
570
|
if (terminators > 1) {
|
|
576
|
-
report(ctx, item.file.relPath, extraLine, "warning", "item/sentence", `item ${item.id} carries more than one sentence; review it for a second
|
|
571
|
+
report(ctx, item.file.relPath, extraLine, "warning", "item/sentence", `item ${item.id} carries more than one sentence; review it for a second requirement (meta-29)`);
|
|
577
572
|
}
|
|
578
573
|
}
|
|
579
574
|
}
|
|
@@ -581,8 +576,8 @@ function lintCitationDiscipline(ctx, items) {
|
|
|
581
576
|
for (const file of ctx.files.values()) {
|
|
582
577
|
if (!isUnder(file.relPath, "packages"))
|
|
583
578
|
continue;
|
|
584
|
-
//
|
|
585
|
-
//
|
|
579
|
+
// Intent may carry supporting citations, but it is not an item
|
|
580
|
+
// relationship source, so exclude its links from cite/prose.
|
|
586
581
|
const h2s = file.headings.filter((heading) => heading.depth === 2 && heading.root);
|
|
587
582
|
const intentRanges = [];
|
|
588
583
|
for (const [index, heading] of h2s.entries()) {
|
|
@@ -593,24 +588,10 @@ function lintCitationDiscipline(ctx, items) {
|
|
|
593
588
|
end: h2s[index + 1]?.line ?? file.lines.length + 1,
|
|
594
589
|
});
|
|
595
590
|
}
|
|
596
|
-
for (const range of intentRanges) {
|
|
597
|
-
for (const link of file.links) {
|
|
598
|
-
if (link.kind !== "link")
|
|
599
|
-
continue;
|
|
600
|
-
if (link.line > range.start && link.line < range.end) {
|
|
601
|
-
report(ctx, file.relPath, link.line, "error", "intent/cited", "the Intent section carries a citation; a package reads standalone (meta-15)");
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
for (const use of file.referenceUses) {
|
|
605
|
-
if (use.line > range.start && use.line < range.end) {
|
|
606
|
-
report(ctx, file.relPath, use.line, "error", "intent/cited", "the Intent section carries a reference marker; a package reads standalone (meta-15)");
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
591
|
// Item statements are the single relationship source (meta-14):
|
|
611
592
|
// a peer-package link from section prose outside every item
|
|
612
593
|
// body declares no dependency (lint-13). Intent links are
|
|
613
|
-
//
|
|
594
|
+
// supporting context rather than behavior relationships.
|
|
614
595
|
const itemRanges = items
|
|
615
596
|
.filter((item) => item.file === file)
|
|
616
597
|
.map((item) => ({ start: item.heading.line, end: item.bodyEnd }));
|
|
@@ -696,6 +677,7 @@ function lintCitations(ctx, items) {
|
|
|
696
677
|
report(ctx, file.relPath, link.line, "error", "cite/broken-link", `link target ${resolved} does not exist`);
|
|
697
678
|
continue;
|
|
698
679
|
}
|
|
680
|
+
lintRecordCitationForm(ctx, file, link, resolved, fragment);
|
|
699
681
|
if (fragment !== "" && resolved.endsWith(".md")) {
|
|
700
682
|
const target = ctx.files.get(resolved);
|
|
701
683
|
if (target !== undefined && !target.slugs.has(fragment)) {
|
|
@@ -707,6 +689,16 @@ function lintCitations(ctx, items) {
|
|
|
707
689
|
}
|
|
708
690
|
}
|
|
709
691
|
}
|
|
692
|
+
/** Record citations are plain links to the file, labeled by record ID. */
|
|
693
|
+
function lintRecordCitationForm(ctx, file, link, targetPath, fragment) {
|
|
694
|
+
const match = targetPath.match(/^specs\/(decisions|intents|iterations)\/(\d+)-[^/]+\.md$/);
|
|
695
|
+
if (match === null)
|
|
696
|
+
return;
|
|
697
|
+
const expected = `${match[1] === "decisions" ? "DR" : "IR"}-${match[2]}`;
|
|
698
|
+
if (!link.enclosed && link.text === expected && fragment === "")
|
|
699
|
+
return;
|
|
700
|
+
report(ctx, file.relPath, link.line, "error", "cite/record-link", `citation of ${expected} must be a plain relative link to its file with ${expected} as the link text (meta-16)`);
|
|
701
|
+
}
|
|
710
702
|
/**
|
|
711
703
|
* An item citation is an enclosed inline link whose link text is
|
|
712
704
|
* the target item ID — `[[<pack>-<N>](<path>#<pack>-<N>)]`
|
package/package.json
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"i18n/zh/specs/map.md": [
|
|
3
3
|
"sha256-f1bcf636c567b830c5d6f625e10c8e4fe2c56b71fa7787106cd7b8701ad20efe",
|
|
4
|
-
"sha256-5da224028a738e3f8c50adbeb1f2bc9006beafe47050594a9a30b207d8ff0386"
|
|
4
|
+
"sha256-5da224028a738e3f8c50adbeb1f2bc9006beafe47050594a9a30b207d8ff0386",
|
|
5
|
+
"sha256-390e4beb58f88ffcdb63c9518634d31c07d61f71e09a3bfab0495a5da0c56244"
|
|
5
6
|
],
|
|
6
7
|
"i18n/zh/specs/meta.md": [
|
|
7
8
|
"sha256-ce07160cf8af1fb67f4f86c572aa182e92dff24a72b313a89914e058de894b56",
|
|
8
9
|
"sha256-78a34b62546391e16f27265399c62568882563cad97def3520d9f675a7b75cab",
|
|
9
10
|
"sha256-1d8a2507d30ef54b5d935a53b448ec74ea8a8556df5cae24e81dcfbd94f9b648",
|
|
10
|
-
"sha256-3c75823810863849ae302255d477749fc57e8e367a499240cde0dd47c479219a"
|
|
11
|
+
"sha256-3c75823810863849ae302255d477749fc57e8e367a499240cde0dd47c479219a",
|
|
12
|
+
"sha256-b4feb754ffd405050d50efe9da527c9a81e7dec48f58a7ed29db3bd28617bbbb"
|
|
11
13
|
],
|
|
12
14
|
"specs/decisions/000-spec-structure-format.md": [
|
|
13
15
|
"sha256-28d0705311a8ede97c487a944efe99bed20863e246da0aa1a33286dd4f8864ca",
|
|
14
16
|
"sha256-a06e1b102d96c91f6ba36fd317426aae9c6a384a76c2dd5996275405d02d1883",
|
|
15
17
|
"sha256-e492c52ea2ff89ab7b5b87d151a1755fac094233524eb8e6718be43111321227",
|
|
16
|
-
"sha256-97041a244e1f1bef6c14b44a2805c214931c649faa523e49489ae7c42c9c11b5"
|
|
18
|
+
"sha256-97041a244e1f1bef6c14b44a2805c214931c649faa523e49489ae7c42c9c11b5",
|
|
19
|
+
"sha256-456de62399db3a9d5d4ee9cfc722930112d677ee50660b4702d04837c9f5b1ea"
|
|
17
20
|
],
|
|
18
21
|
"specs/map.md": [
|
|
19
22
|
"sha256-a1d6bc4a23fa58d8ccdcf7cd0570fc05face0aae8b6947367298dad3cde0af75",
|
|
20
23
|
"sha256-4f2772c2d268972c1d5b1e2f4efb604b304c285ef3d91def9c1bad59666b303d",
|
|
21
|
-
"sha256-aa12c658e84b8925b2981807a72edc9dbd274a78bd87f7186bb558afc42d8bc6"
|
|
24
|
+
"sha256-aa12c658e84b8925b2981807a72edc9dbd274a78bd87f7186bb558afc42d8bc6",
|
|
25
|
+
"sha256-6d93bd3c2c2fc35e0806229f45c751429ae4ef7ae86ff9e9089b76b0edbf7461"
|
|
22
26
|
],
|
|
23
27
|
"specs/meta.md": [
|
|
24
28
|
"sha256-ce07160cf8af1fb67f4f86c572aa182e92dff24a72b313a89914e058de894b56",
|
|
25
29
|
"sha256-78a34b62546391e16f27265399c62568882563cad97def3520d9f675a7b75cab",
|
|
26
30
|
"sha256-6a23f014ccbbe871e811f2ef9bd39119b50f0ce65a10bd75045d5735cf5b70b3",
|
|
27
|
-
"sha256-ca67a077cfaecb51a85e98ec8f8508ce9d8a43dcb7355b9e16de611c38cdabfc"
|
|
31
|
+
"sha256-ca67a077cfaecb51a85e98ec8f8508ce9d8a43dcb7355b9e16de611c38cdabfc",
|
|
32
|
+
"sha256-ba58b39de3537f06fbe4f13c9b1443a8a64cf090c9ba202a67263dfc054b78c8"
|
|
28
33
|
],
|
|
29
34
|
"specs/packages/git.md": [
|
|
30
35
|
"sha256-1b194304866d05580de8b2d0caa3454aa772e876fb3dee1f6c5d637c9e9a42b2",
|
|
31
|
-
"sha256-77625a315ac14eb6fd5f3c0697f121646ba8c0d976a98c3b51f27f3422cd1afb"
|
|
36
|
+
"sha256-77625a315ac14eb6fd5f3c0697f121646ba8c0d976a98c3b51f27f3422cd1afb",
|
|
37
|
+
"sha256-648eb12f6dd2dd5b9c9cebc14708de1a6d2184b698dfeacce93102995878e14a"
|
|
32
38
|
],
|
|
33
39
|
"specs/packages/licensing.md": [
|
|
34
40
|
"sha256-ff6ce317bf51fb2f4a20dde8790a79f2a1237f6b5835c74e619f6e3d1647ab50",
|
package/scaffold/agent-specs.txt
CHANGED
|
@@ -1,13 +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.
|
|
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.
|
|
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
|
-
-
|
|
8
|
-
|
|
9
|
-
- Right level: each package file in @specs/packages holds its shared intent (## Intent), behavior its users may rely on (## External Behavior), optional implementation hidden from them (## Internal Behavior), and tests of its own claims (## Verification); behavior that emerges from several packages working together is itself a spec package citing the peers' External Behavior — there is no @specs/compositions. Specify integration/system testing, not unit testing, and prefer tests that execute the real behavior of cited packages over substitutes.
|
|
10
|
-
- Minimal: essential and concise; also check against other spec items to avoid overlap.
|
|
11
|
-
- Well organized: spec packages are finely scoped, with high cohesion and low coupling.
|
|
12
|
-
- Single-source: item citations are enclosed relative links like `[[pack-3](pack.md#pack-3)]`, written inline at the phrase that relies on them; items carry no metadata lines (`Verifies:`, `Binds:`, `Composes:`, `Clients:`, `Suppliers:`, `Scope:`).
|
|
7
|
+
- Resolve conflicts spec-first, then iterate freely: an intended change that conflicts with existing spec items is resolved in the specs — or dropped — before coding against it; implementing first to explore an approach is fine, and implementation lessons update this intent's specs, but no intent completes until its specs and code agree.
|
|
8
|
+
- Keep specs lawful per @specs/meta.md — the law itself, not this summary: complete and exact (meta-34), minimal (meta-23), one requirement per item (meta-29), cohesive packages for a shared intent (meta-13), sections per meta-30, relationships and test evidence only as inline citations (meta-14, meta-16, meta-20), integration/system tests only (meta-21, meta-32).
|
|
13
9
|
- Run `spex lint` to check structure, item IDs, and citations after editing specs; never add trace lines to satisfy an older checker.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
2
|
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
<!-- spex-i18n-source: map.md sha256-6d93bd3c2c2fc35e0806229f45c751429ae4ef7ae86ff9e9089b76b0edbf7461 -->
|
|
3
4
|
|
|
4
5
|
# 规约地图
|
|
5
6
|
|
|
@@ -11,9 +12,6 @@
|
|
|
11
12
|
|
|
12
13
|
在编写、修改或审阅 DR、IR 或条目前,先了解 [`meta.md`](meta.md) 中的规则。
|
|
13
14
|
|
|
14
|
-
- DR 和 IR:见 [Overall](meta.md#overall)、[Record format](meta.md#record-format) 和 [Citation](meta.md#citation)。
|
|
15
|
-
- 条目:见 [Overall](meta.md#overall)、[Item syntax](meta.md#item-syntax)、[Spec packages](meta.md#spec-packages)、[Testing](meta.md#testing) 和 [Citation](meta.md#citation)。
|
|
16
|
-
|
|
17
15
|
## 目录结构
|
|
18
16
|
|
|
19
17
|
```text
|
|
@@ -28,15 +26,15 @@ meta.md 规约的规约
|
|
|
28
26
|
|
|
29
27
|
| ID | 文件 | 摘要 |
|
|
30
28
|
| --- | --- | --- |
|
|
31
|
-
| DR-000
|
|
29
|
+
| [DR-000](decisions/000-spec-structure-format.md) | 000-spec-structure-format.md | 规约结构、格式和命名约定 |
|
|
32
30
|
|
|
33
31
|
## 意图
|
|
34
32
|
|
|
35
33
|
| ID | 文件 | 意图 |
|
|
36
34
|
| --- | --- | --- |
|
|
37
|
-
| IR-000
|
|
35
|
+
| [IR-000](intents/000-spdx-headers.md) | 000-spdx-headers.md | 为适用文件添加 SPDX 头 |
|
|
38
36
|
|
|
39
|
-
##
|
|
37
|
+
## 规约包
|
|
40
38
|
|
|
41
39
|
| 文件 | 摘要 |
|
|
42
40
|
| --- | --- |
|
|
@@ -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"
|
|
@@ -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,12 @@ 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`;
|
|
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
9
|
- Scope this merge to reconciling the template diff: do not restructure a legacy tree (a `user/`, `dev/`, `test/`, `items/`, `interactions/`, `compositions/`, or `iterations/` directory) into @specs/packages/ yourself — structural migration of a legacy generation belongs to the `spec-structure-migration` skill (`skills/spec-structure-migration/` in the spex repo; guide: `docs/spec-migration.md`).
|
|
10
|
-
- Convert every item citation to the enclosed ID-text form, e.g. `[[pack-3](pack.md#pack-3)]`,
|
|
11
|
-
-
|
|
12
|
-
-
|
|
10
|
+
- 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.
|
|
11
|
+
- Place every attachment after the final colon of its governing GEARS statement.
|
|
12
|
+
- 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.
|
|
13
|
+
- 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
14
|
- Update @specs/map.md where the merge left its layout, tables, or summaries stale.
|
|
14
15
|
- Focus only on the update merge; do not refine unrelated spec content.
|
|
15
16
|
- Finish by running `spex lint` and resolving remaining errors; never restore removed trace lines to satisfy an older checker.
|