@sublang/spex 2.1.1 → 3.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 +12 -4
- package/dist/copy-templates.d.ts +0 -14
- package/dist/copy-templates.js +4 -102
- package/dist/lint.js +37 -26
- package/package.json +1 -1
- package/scaffold/.file-history.json +10 -5
- package/scaffold/agent-specs.txt +1 -1
- package/scaffold/i18n/zh/specs/map.md +2 -8
- package/scaffold/i18n/zh/specs/meta.md +6 -6
- package/scaffold/spec-migration-prompt.md +2 -2
- package/scaffold/specs/decisions/000-spec-structure-format.md +2 -2
- package/scaffold/specs/map.md +1 -7
- package/scaffold/specs/meta.md +4 -4
- package/scaffold/update-merge-prompt.md +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ This creates:
|
|
|
35
35
|
- **`specs/`** — the spec tree and its law:
|
|
36
36
|
- `specs/packages/` holds one file per spec package: a self-contained `## Intent`, the behavior its users may rely on (`## External Behavior`), implementation hidden from them (`## Internal Behavior`), and the tests of its own claims (`## Verification`) — one read covers one package.
|
|
37
37
|
Behavior that emerges from several packages working together is itself a spec package citing the peers' External Behavior — there is no compositions directory.
|
|
38
|
-
- `specs/decisions/` and `specs/intents/` hold decision records (DRs) and intent records (IRs); `specs/map.md` indexes
|
|
38
|
+
- `specs/decisions/` and `specs/intents/` hold decision records (DRs) and intent records (IRs); `specs/map.md` indexes decisions and packages 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
41
|
- **Agent instruction files** — a managed section that tells coding
|
|
@@ -131,21 +131,29 @@ The command prints a per-file indicator for every framework and seed path, plus
|
|
|
131
131
|
|
|
132
132
|
## Upgrading from an earlier release
|
|
133
133
|
|
|
134
|
+
### From 2.x
|
|
135
|
+
|
|
136
|
+
Spex 3.0 makes intent records disposable planning artifacts: no other
|
|
137
|
+
spec may cite or name an IR, and `specs/map.md` indexes decisions and
|
|
138
|
+
packages only. Run `spex scaffold --update`, remove intent rows from a
|
|
139
|
+
customized map and references to IRs from other specs, then reconcile
|
|
140
|
+
until `spex lint` passes.
|
|
141
|
+
|
|
134
142
|
### From 1.x
|
|
135
143
|
|
|
136
144
|
Spex 2.0 tightens the packages-only law introduced in 1.0. Run
|
|
137
145
|
`spex scaffold --update`, review the refreshed law and printed merge prompt,
|
|
138
146
|
then reconcile your packages until `spex lint` passes. In particular,
|
|
139
147
|
every package now requires Verification of its own behavior, behavior
|
|
140
|
-
citations from Verification stay inside that package,
|
|
148
|
+
citations from Verification stay inside that package, DR citations
|
|
141
149
|
use their exact IDs, and every item-bearing basename is tree-wide unique.
|
|
142
150
|
|
|
143
151
|
### From 0.x
|
|
144
152
|
|
|
145
153
|
A tree scaffolded by a spex 0.x release carries the older structural
|
|
146
|
-
generation of the law. Spex 2.0
|
|
154
|
+
generation of the law. Spex 2.0 and later use the following structure:
|
|
147
155
|
|
|
148
|
-
| | Previous generations (spex 0.x) |
|
|
156
|
+
| | Previous generations (spex 0.x) | Packages generation (spex 2.0+) |
|
|
149
157
|
| --- | --- | --- |
|
|
150
158
|
| Layout | `specs/user`/`dev`/`test`, later `packages/` + `compositions/` | `packages/` only — composition is a package pattern |
|
|
151
159
|
| Cross-package behavior | binding and scenario items in composition files | behavior items binding inline to peers' External Behavior |
|
package/dist/copy-templates.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
export declare const SUPPORTED_LANGUAGES: readonly ["en", "zh"];
|
|
2
2
|
export type ScaffoldLanguage = (typeof SUPPORTED_LANGUAGES)[number];
|
|
3
3
|
export type PristineState = "pristine" | "modified" | "missing";
|
|
4
|
-
export type LegacyItemLayoutResult = {
|
|
5
|
-
status: "migrated" | "conflict";
|
|
6
|
-
targetRelPath: string;
|
|
7
|
-
legacyRelPath: string;
|
|
8
|
-
};
|
|
9
4
|
type RefreshPristineSeedsOptions = {
|
|
10
|
-
migratedFrom?: ReadonlyMap<string, string>;
|
|
11
5
|
language?: ScaffoldLanguage;
|
|
12
6
|
/**
|
|
13
7
|
* A second language whose bundled versions also count as pristine.
|
|
@@ -16,12 +10,6 @@ type RefreshPristineSeedsOptions = {
|
|
|
16
10
|
* convertible bundled file, not a user customization.
|
|
17
11
|
*/
|
|
18
12
|
alsoRecognize?: readonly ScaffoldLanguage[];
|
|
19
|
-
/**
|
|
20
|
-
* Replacement indicator text for user-modified seeds that this run
|
|
21
|
-
* transformed in place (e.g. a restructured map.md), so one line
|
|
22
|
-
* reports the seed's true outcome.
|
|
23
|
-
*/
|
|
24
|
-
indicatorOverrides?: ReadonlyMap<string, string>;
|
|
25
13
|
};
|
|
26
14
|
export declare function isSupportedLanguage(code: string): code is ScaffoldLanguage;
|
|
27
15
|
export declare function formatSupportedLanguages(): string;
|
|
@@ -44,8 +32,6 @@ export declare function copyTemplates(basePath: string, language?: ScaffoldLangu
|
|
|
44
32
|
export declare function copyRootLicense(basePath: string): void;
|
|
45
33
|
export declare function getFrameworkSpecFiles(): readonly string[];
|
|
46
34
|
export declare function getSeedSpecFiles(): readonly string[];
|
|
47
|
-
export declare function migrateLegacyItemLayout(basePath: string): LegacyItemLayoutResult[];
|
|
48
|
-
export declare function migrateIterationsLayout(basePath: string): LegacyItemLayoutResult[];
|
|
49
35
|
export declare function getFileHistory(relPath: string): string[];
|
|
50
36
|
export declare function getLegacyFileHistory(relPath: string): string[];
|
|
51
37
|
/** isPristine over the legacy manifest (removed bundled paths). */
|
package/dist/copy-templates.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync,
|
|
4
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmdirSync, statSync, } from "node:fs";
|
|
5
5
|
import { dirname, join, posix, relative } from "node:path";
|
|
6
6
|
import { getScaffoldDir } from "./bundled-scaffold.js";
|
|
7
7
|
export const SUPPORTED_LANGUAGES = ["en", "zh"];
|
|
@@ -16,11 +16,6 @@ const SEED_FILES = [
|
|
|
16
16
|
"specs/packages/git.md",
|
|
17
17
|
"specs/packages/licensing.md",
|
|
18
18
|
];
|
|
19
|
-
const LEGACY_ITEM_DIRS = [
|
|
20
|
-
["specs/items/user", "specs/user"],
|
|
21
|
-
["specs/items/dev", "specs/dev"],
|
|
22
|
-
["specs/items/test", "specs/test"],
|
|
23
|
-
];
|
|
24
19
|
export function isSupportedLanguage(code) {
|
|
25
20
|
return SUPPORTED_LANGUAGES.includes(code);
|
|
26
21
|
}
|
|
@@ -130,87 +125,6 @@ function removeEmptyDirectories(dir) {
|
|
|
130
125
|
}
|
|
131
126
|
return false;
|
|
132
127
|
}
|
|
133
|
-
// SCAF-26.
|
|
134
|
-
export function migrateLegacyItemLayout(basePath) {
|
|
135
|
-
const results = [];
|
|
136
|
-
for (const [legacyRootRel, targetRootRel] of LEGACY_ITEM_DIRS) {
|
|
137
|
-
const legacyRoot = join(basePath, legacyRootRel);
|
|
138
|
-
if (!existsSync(legacyRoot))
|
|
139
|
-
continue;
|
|
140
|
-
for (const source of listFiles(legacyRoot)) {
|
|
141
|
-
const suffix = relative(legacyRoot, source).replace(/\\/g, "/");
|
|
142
|
-
const legacyRelPath = posix.join(legacyRootRel, suffix);
|
|
143
|
-
const targetRelPath = posix.join(targetRootRel, suffix);
|
|
144
|
-
const target = join(basePath, targetRelPath);
|
|
145
|
-
if (existsSync(target)) {
|
|
146
|
-
results.push({
|
|
147
|
-
status: "conflict",
|
|
148
|
-
targetRelPath,
|
|
149
|
-
legacyRelPath,
|
|
150
|
-
});
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
154
|
-
renameSync(source, target);
|
|
155
|
-
results.push({
|
|
156
|
-
status: "migrated",
|
|
157
|
-
targetRelPath,
|
|
158
|
-
legacyRelPath,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
removeEmptyDirectories(join(basePath, "specs", "items"));
|
|
163
|
-
return results;
|
|
164
|
-
}
|
|
165
|
-
// SCAF-51: iteration records become intent records (DR-017).
|
|
166
|
-
export function migrateIterationsLayout(basePath) {
|
|
167
|
-
const results = [];
|
|
168
|
-
const legacyRoot = join(basePath, "specs", "iterations");
|
|
169
|
-
if (!existsSync(legacyRoot) || !statSync(legacyRoot).isDirectory()) {
|
|
170
|
-
return results;
|
|
171
|
-
}
|
|
172
|
-
// Record ids form from the leading number, so a move may collide
|
|
173
|
-
// with a differently named intents/ file on the same number; such
|
|
174
|
-
// a move is kept in place and reported against the id holder.
|
|
175
|
-
const numberTaken = new Map();
|
|
176
|
-
const targetRoot = join(basePath, "specs", "intents");
|
|
177
|
-
if (existsSync(targetRoot) && statSync(targetRoot).isDirectory()) {
|
|
178
|
-
for (const existing of listFiles(targetRoot)) {
|
|
179
|
-
const rel = relative(targetRoot, existing).replace(/\\/g, "/");
|
|
180
|
-
const digits = /^(\d+)/.exec(posix.basename(rel))?.[1];
|
|
181
|
-
if (digits !== undefined && !numberTaken.has(digits)) {
|
|
182
|
-
numberTaken.set(digits, posix.join("specs/intents", rel));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
for (const source of listFiles(legacyRoot)) {
|
|
187
|
-
const suffix = relative(legacyRoot, source).replace(/\\/g, "/");
|
|
188
|
-
const legacyRelPath = posix.join("specs/iterations", suffix);
|
|
189
|
-
const targetRelPath = posix.join("specs/intents", suffix);
|
|
190
|
-
const target = join(basePath, targetRelPath);
|
|
191
|
-
if (existsSync(target)) {
|
|
192
|
-
results.push({ status: "conflict", targetRelPath, legacyRelPath });
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
const digits = /^(\d+)/.exec(posix.basename(suffix))?.[1];
|
|
196
|
-
const idHolder = digits === undefined ? undefined : numberTaken.get(digits);
|
|
197
|
-
if (idHolder !== undefined) {
|
|
198
|
-
results.push({
|
|
199
|
-
status: "conflict",
|
|
200
|
-
targetRelPath: idHolder,
|
|
201
|
-
legacyRelPath,
|
|
202
|
-
});
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
206
|
-
renameSync(source, target);
|
|
207
|
-
if (digits !== undefined)
|
|
208
|
-
numberTaken.set(digits, targetRelPath);
|
|
209
|
-
results.push({ status: "migrated", targetRelPath, legacyRelPath });
|
|
210
|
-
}
|
|
211
|
-
removeEmptyDirectories(legacyRoot);
|
|
212
|
-
return results;
|
|
213
|
-
}
|
|
214
128
|
// SCAF-21.
|
|
215
129
|
export function getFileHistory(relPath) {
|
|
216
130
|
const manifestPath = join(getScaffoldDir(), ".file-history.json");
|
|
@@ -297,35 +211,23 @@ export function overwriteFrameworkSpecFiles(basePath, language = "en", alsoRecog
|
|
|
297
211
|
}
|
|
298
212
|
return replacedUserModified;
|
|
299
213
|
}
|
|
300
|
-
// SCAF-23.
|
|
301
|
-
function formatSeedIndicator(relPath, indicator, migratedFrom) {
|
|
302
|
-
const legacyRelPath = migratedFrom?.get(relPath);
|
|
303
|
-
if (legacyRelPath === undefined)
|
|
304
|
-
return indicator;
|
|
305
|
-
if (indicator === "unchanged")
|
|
306
|
-
return `migrated from ${legacyRelPath}`;
|
|
307
|
-
return `migrated from ${legacyRelPath}; ${indicator}`;
|
|
308
|
-
}
|
|
309
214
|
export function refreshPristineSeeds(basePath, options = {}) {
|
|
310
215
|
const language = options.language ?? "en";
|
|
311
216
|
for (const relPath of SEED_FILES) {
|
|
312
217
|
const state = isPristine(basePath, relPath, language, options.alsoRecognize);
|
|
313
218
|
if (state === "modified") {
|
|
314
|
-
|
|
315
|
-
console.log(` ${relPath} (${indicator})`);
|
|
219
|
+
console.log(` ${relPath} (kept — user-modified)`);
|
|
316
220
|
continue;
|
|
317
221
|
}
|
|
318
222
|
const target = join(basePath, relPath);
|
|
319
223
|
const source = getBundledSpecFilePath(relPath, language);
|
|
320
224
|
if (state === "pristine" && hashFile(target) === hashFile(source)) {
|
|
321
|
-
|
|
322
|
-
console.log(` ${relPath} (${indicator})`);
|
|
225
|
+
console.log(` ${relPath} (unchanged)`);
|
|
323
226
|
continue;
|
|
324
227
|
}
|
|
325
228
|
mkdirSync(dirname(target), { recursive: true });
|
|
326
229
|
copyFileSync(source, target);
|
|
327
|
-
|
|
328
|
-
console.log(` ${relPath} (${formatSeedIndicator(relPath, indicator, options.migratedFrom)})`);
|
|
230
|
+
console.log(` ${relPath} (${state === "missing" ? "created" : "updated"})`);
|
|
329
231
|
}
|
|
330
232
|
}
|
|
331
233
|
//# sourceMappingURL=copy-templates.js.map
|
package/dist/lint.js
CHANGED
|
@@ -22,9 +22,8 @@ const PACKAGE_SECTION_ORDER = [
|
|
|
22
22
|
"References",
|
|
23
23
|
];
|
|
24
24
|
// Required record sections per meta-4 / meta-5, with the zh names
|
|
25
|
-
// of the bundled templates.
|
|
26
|
-
//
|
|
27
|
-
// external sources legitimately omits it — it is not required here.
|
|
25
|
+
// of the bundled templates. meta-4 makes a DR's References section
|
|
26
|
+
// conditional on citing an external source, so it is not listed.
|
|
28
27
|
const DR_SECTIONS = {
|
|
29
28
|
Status: ["Status", "状态"],
|
|
30
29
|
Context: ["Context", "背景"],
|
|
@@ -210,13 +209,16 @@ const SECTION_BY_NAME = aliasSet(SECTION_ALIASES);
|
|
|
210
209
|
function isUnder(relPath, dir) {
|
|
211
210
|
return relPath.startsWith(`specs/${dir}/`);
|
|
212
211
|
}
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
212
|
+
// meta-18 exempts one thing: the record naming itself, which every
|
|
213
|
+
// IR does in its H1. So a file may reference only its own id — a
|
|
214
|
+
// package, the map, and one IR naming another are all violations.
|
|
215
|
+
// Returns the id a file may name, or null when it may name none.
|
|
216
|
+
function ownIntentId(relPath) {
|
|
217
|
+
if (!isUnder(relPath, "intents") && !isUnder(relPath, "iterations")) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
const leading = basenameOf(relPath).match(/^(\d+)/);
|
|
221
|
+
return leading === null ? null : `IR-${leading[1]}`;
|
|
220
222
|
}
|
|
221
223
|
function basenameOf(relPath) {
|
|
222
224
|
return posix.basename(relPath, ".md");
|
|
@@ -623,17 +625,16 @@ function lintCitationDiscipline(ctx, items) {
|
|
|
623
625
|
function lintCitations(ctx, items) {
|
|
624
626
|
const bySlug = itemsBySlug(items);
|
|
625
627
|
for (const file of ctx.files.values()) {
|
|
626
|
-
// Naming an IR in prose is citing it, and no
|
|
627
|
-
// does either (meta-18)
|
|
628
|
-
// packages/, and meta.md alone; intent records and map.md sit
|
|
629
|
-
// outside the prohibition. Matched over parsed inline text, so
|
|
628
|
+
// Naming an IR in prose is citing it, and no spec but that IR
|
|
629
|
+
// does either (meta-18). Matched over parsed inline text, so
|
|
630
630
|
// inline code and code blocks cannot trip it (lint-10).
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
631
|
+
const ownId = ownIntentId(file.relPath);
|
|
632
|
+
for (const span of file.texts) {
|
|
633
|
+
for (const [offset, value] of span.value.split("\n").entries()) {
|
|
634
|
+
for (const match of value.matchAll(/\bIR-\d+\b/g)) {
|
|
635
|
+
if (match[0] === ownId)
|
|
636
|
+
continue;
|
|
637
|
+
report(ctx, file.relPath, span.line + offset, "error", "cite/intent", `no spec but that intent record names an IR in prose (meta-18): ${match[0]}`);
|
|
637
638
|
}
|
|
638
639
|
}
|
|
639
640
|
}
|
|
@@ -668,10 +669,12 @@ function lintCitations(ctx, items) {
|
|
|
668
669
|
report(ctx, file.relPath, link.line, "error", "cite/legacy-path", `link points into the legacy layout (${resolved}); cite the current layout of meta-1 instead`);
|
|
669
670
|
continue;
|
|
670
671
|
}
|
|
672
|
+
// A link into an intent record is a citation of it; only that
|
|
673
|
+
// record itself is exempt (meta-18).
|
|
671
674
|
if ((resolved.startsWith("specs/intents/") ||
|
|
672
675
|
resolved.startsWith("specs/iterations/")) &&
|
|
673
|
-
|
|
674
|
-
report(ctx, file.relPath, link.line, "error", "cite/intent", `no
|
|
676
|
+
resolved !== file.relPath) {
|
|
677
|
+
report(ctx, file.relPath, link.line, "error", "cite/intent", `no spec but that intent record cites an IR (meta-18)`);
|
|
675
678
|
}
|
|
676
679
|
if (!existsSync(join(ctx.basePath, resolved))) {
|
|
677
680
|
report(ctx, file.relPath, link.line, "error", "cite/broken-link", `link target ${resolved} does not exist`);
|
|
@@ -689,12 +692,17 @@ function lintCitations(ctx, items) {
|
|
|
689
692
|
}
|
|
690
693
|
}
|
|
691
694
|
}
|
|
692
|
-
/**
|
|
695
|
+
/**
|
|
696
|
+
* DR citations are plain links to the file, labeled by record ID.
|
|
697
|
+
* meta-16 states a form for spec items and DRs alone: no spec but an
|
|
698
|
+
* intent record itself may cite one (meta-18), and the form of that
|
|
699
|
+
* one link is unstated, so this rule leaves intent records alone.
|
|
700
|
+
*/
|
|
693
701
|
function lintRecordCitationForm(ctx, file, link, targetPath, fragment) {
|
|
694
|
-
const match = targetPath.match(/^specs\/
|
|
702
|
+
const match = targetPath.match(/^specs\/decisions\/(\d+)-[^/]+\.md$/);
|
|
695
703
|
if (match === null)
|
|
696
704
|
return;
|
|
697
|
-
const expected =
|
|
705
|
+
const expected = `DR-${match[1]}`;
|
|
698
706
|
if (!link.enclosed && link.text === expected && fragment === "")
|
|
699
707
|
return;
|
|
700
708
|
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)`);
|
|
@@ -827,8 +835,11 @@ function lintMap(ctx) {
|
|
|
827
835
|
listed.add(posix.normalize(posix.join("specs", url.split("#")[0])));
|
|
828
836
|
}
|
|
829
837
|
for (const file of ctx.files.values()) {
|
|
830
|
-
|
|
838
|
+
// The map indexes decisions and packages (DR-000), so both are
|
|
839
|
+
// checked; intent records are outside it (meta-18).
|
|
840
|
+
if (!isUnder(file.relPath, "packages") && !isUnder(file.relPath, "decisions")) {
|
|
831
841
|
continue;
|
|
842
|
+
}
|
|
832
843
|
if (!listed.has(file.relPath)) {
|
|
833
844
|
report(ctx, file.relPath, 1, "warning", "map/unlisted", `${file.relPath} is not linked from specs/map.md`);
|
|
834
845
|
}
|
package/package.json
CHANGED
|
@@ -2,34 +2,39 @@
|
|
|
2
2
|
"i18n/zh/specs/map.md": [
|
|
3
3
|
"sha256-f1bcf636c567b830c5d6f625e10c8e4fe2c56b71fa7787106cd7b8701ad20efe",
|
|
4
4
|
"sha256-5da224028a738e3f8c50adbeb1f2bc9006beafe47050594a9a30b207d8ff0386",
|
|
5
|
-
"sha256-390e4beb58f88ffcdb63c9518634d31c07d61f71e09a3bfab0495a5da0c56244"
|
|
5
|
+
"sha256-390e4beb58f88ffcdb63c9518634d31c07d61f71e09a3bfab0495a5da0c56244",
|
|
6
|
+
"sha256-a1c6e3e3b6f41531da5959dd688d8c0049d1e64b19ecf708a944de987c987f83"
|
|
6
7
|
],
|
|
7
8
|
"i18n/zh/specs/meta.md": [
|
|
8
9
|
"sha256-ce07160cf8af1fb67f4f86c572aa182e92dff24a72b313a89914e058de894b56",
|
|
9
10
|
"sha256-78a34b62546391e16f27265399c62568882563cad97def3520d9f675a7b75cab",
|
|
10
11
|
"sha256-1d8a2507d30ef54b5d935a53b448ec74ea8a8556df5cae24e81dcfbd94f9b648",
|
|
11
12
|
"sha256-3c75823810863849ae302255d477749fc57e8e367a499240cde0dd47c479219a",
|
|
12
|
-
"sha256-b4feb754ffd405050d50efe9da527c9a81e7dec48f58a7ed29db3bd28617bbbb"
|
|
13
|
+
"sha256-b4feb754ffd405050d50efe9da527c9a81e7dec48f58a7ed29db3bd28617bbbb",
|
|
14
|
+
"sha256-78e528aee1d8f5b4946c53e119a81c7548df53bd09f8458152c2c2aaa386cd82"
|
|
13
15
|
],
|
|
14
16
|
"specs/decisions/000-spec-structure-format.md": [
|
|
15
17
|
"sha256-28d0705311a8ede97c487a944efe99bed20863e246da0aa1a33286dd4f8864ca",
|
|
16
18
|
"sha256-a06e1b102d96c91f6ba36fd317426aae9c6a384a76c2dd5996275405d02d1883",
|
|
17
19
|
"sha256-e492c52ea2ff89ab7b5b87d151a1755fac094233524eb8e6718be43111321227",
|
|
18
20
|
"sha256-97041a244e1f1bef6c14b44a2805c214931c649faa523e49489ae7c42c9c11b5",
|
|
19
|
-
"sha256-456de62399db3a9d5d4ee9cfc722930112d677ee50660b4702d04837c9f5b1ea"
|
|
21
|
+
"sha256-456de62399db3a9d5d4ee9cfc722930112d677ee50660b4702d04837c9f5b1ea",
|
|
22
|
+
"sha256-4c32ec9e308762026c9ec184a03885f3cd58d1eb1ab97300d6c82600ae71de64"
|
|
20
23
|
],
|
|
21
24
|
"specs/map.md": [
|
|
22
25
|
"sha256-a1d6bc4a23fa58d8ccdcf7cd0570fc05face0aae8b6947367298dad3cde0af75",
|
|
23
26
|
"sha256-4f2772c2d268972c1d5b1e2f4efb604b304c285ef3d91def9c1bad59666b303d",
|
|
24
27
|
"sha256-aa12c658e84b8925b2981807a72edc9dbd274a78bd87f7186bb558afc42d8bc6",
|
|
25
|
-
"sha256-6d93bd3c2c2fc35e0806229f45c751429ae4ef7ae86ff9e9089b76b0edbf7461"
|
|
28
|
+
"sha256-6d93bd3c2c2fc35e0806229f45c751429ae4ef7ae86ff9e9089b76b0edbf7461",
|
|
29
|
+
"sha256-5dbf6d5bf1f09c74f8bf71209986eca460723957c6861f0a73654b88d9e522d9"
|
|
26
30
|
],
|
|
27
31
|
"specs/meta.md": [
|
|
28
32
|
"sha256-ce07160cf8af1fb67f4f86c572aa182e92dff24a72b313a89914e058de894b56",
|
|
29
33
|
"sha256-78a34b62546391e16f27265399c62568882563cad97def3520d9f675a7b75cab",
|
|
30
34
|
"sha256-6a23f014ccbbe871e811f2ef9bd39119b50f0ce65a10bd75045d5735cf5b70b3",
|
|
31
35
|
"sha256-ca67a077cfaecb51a85e98ec8f8508ce9d8a43dcb7355b9e16de611c38cdabfc",
|
|
32
|
-
"sha256-ba58b39de3537f06fbe4f13c9b1443a8a64cf090c9ba202a67263dfc054b78c8"
|
|
36
|
+
"sha256-ba58b39de3537f06fbe4f13c9b1443a8a64cf090c9ba202a67263dfc054b78c8",
|
|
37
|
+
"sha256-ed90e3e82e18d3893e52d18e80d795406bc9a0b5915416ee73295a4d7c7ff52a"
|
|
33
38
|
],
|
|
34
39
|
"specs/packages/git.md": [
|
|
35
40
|
"sha256-1b194304866d05580de8b2d0caa3454aa772e876fb3dee1f6c5d637c9e9a42b2",
|
package/scaffold/agent-specs.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.
|
|
@@ -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,7 +1,7 @@
|
|
|
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-ed90e3e82e18d3893e52d18e80d795406bc9a0b5915416ee73295a4d7c7ff52a -->
|
|
5
5
|
|
|
6
6
|
# meta: 规约定义
|
|
7
7
|
|
|
@@ -35,10 +35,10 @@ A spec file shall keep one sentence per line — with lists, tables, and diagram
|
|
|
35
35
|
|
|
36
36
|
## Record format
|
|
37
37
|
|
|
38
|
-
<!-- spex-i18n-source: meta-4 sha256-
|
|
38
|
+
<!-- spex-i18n-source: meta-4 sha256-9094707b5ede14d4e0c104c0ae6aaf0ce2ca1129723a472b329d68e3142e1c48 -->
|
|
39
39
|
### meta-4
|
|
40
40
|
|
|
41
|
-
Each DR shall follow the ADR format [[2]], with sections `状态`, `背景`, `决策`, `影响`,
|
|
41
|
+
Each DR shall follow the ADR format [[2]], with sections `状态`, `背景`, `决策`, and `影响`, plus `参考资料` where it cites an external source [[meta-19](#meta-19)].
|
|
42
42
|
|
|
43
43
|
<!-- spex-i18n-source: meta-5 sha256-6847734892ace98018676f3430e0a848b0a83541b23f1b4f69aa9b12a1c0aeda -->
|
|
44
44
|
### meta-5
|
|
@@ -187,16 +187,16 @@ Each package's `Verification` section shall verify every behavior in that packag
|
|
|
187
187
|
|
|
188
188
|
### meta-16
|
|
189
189
|
|
|
190
|
-
A citation of a spec item or
|
|
190
|
+
A citation of a spec item or DR shall be an inline relative link with the cited ID as its link text:
|
|
191
191
|
|
|
192
192
|
| Cited | Form |
|
|
193
193
|
| --- | --- |
|
|
194
194
|
| Spec item | its heading anchor, in an outer pair of square brackets (e.g., `[[meta-1](meta.md#meta-1)]`) |
|
|
195
|
-
|
|
|
195
|
+
| DR | its file, with no outer brackets (e.g., `[DR-000](decisions/000-spec-structure-format.md)`) |
|
|
196
196
|
|
|
197
197
|
### meta-18
|
|
198
198
|
|
|
199
|
-
No
|
|
199
|
+
No spec shall cite an IR or name it in prose, except that IR itself.
|
|
200
200
|
|
|
201
201
|
### meta-19
|
|
202
202
|
|
|
@@ -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
|
|
package/scaffold/specs/map.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# Spec Map
|
|
5
5
|
|
|
6
|
-
Quick-reference index for locating spec
|
|
6
|
+
Quick-reference index for locating decisions and spec packages.
|
|
7
7
|
Spec items are the source of truth.
|
|
8
8
|
Code can be inconsistent with specs during development.
|
|
9
9
|
|
|
@@ -27,12 +27,6 @@ meta.md The spec of specs
|
|
|
27
27
|
| --- | --- | --- |
|
|
28
28
|
| [DR-000](decisions/000-spec-structure-format.md) | 000-spec-structure-format.md | Spec structure, format, and naming conventions |
|
|
29
29
|
|
|
30
|
-
## Intents
|
|
31
|
-
|
|
32
|
-
| ID | File | Intent |
|
|
33
|
-
| --- | --- | --- |
|
|
34
|
-
| [IR-000](intents/000-spdx-headers.md) | 000-spdx-headers.md | Add SPDX headers to applicable files |
|
|
35
|
-
|
|
36
30
|
## Packages
|
|
37
31
|
|
|
38
32
|
| File | Summary |
|
package/scaffold/specs/meta.md
CHANGED
|
@@ -36,7 +36,7 @@ A spec file shall keep one sentence per line — with lists, tables, and diagram
|
|
|
36
36
|
|
|
37
37
|
### meta-4
|
|
38
38
|
|
|
39
|
-
Each DR shall follow the ADR format [[2]], with sections Status, Context, Decision, Consequences,
|
|
39
|
+
Each DR shall follow the ADR format [[2]], with sections Status, Context, Decision, and Consequences, plus References where it cites an external source [[meta-19](#meta-19)].
|
|
40
40
|
|
|
41
41
|
### meta-5
|
|
42
42
|
|
|
@@ -181,16 +181,16 @@ Each package's `Verification` section shall verify every behavior in that packag
|
|
|
181
181
|
|
|
182
182
|
### meta-16
|
|
183
183
|
|
|
184
|
-
A citation of a spec item or
|
|
184
|
+
A citation of a spec item or DR shall be an inline relative link with the cited ID as its link text:
|
|
185
185
|
|
|
186
186
|
| Cited | Form |
|
|
187
187
|
| --- | --- |
|
|
188
188
|
| Spec item | its heading anchor, in an outer pair of square brackets (e.g., `[[meta-1](meta.md#meta-1)]`) |
|
|
189
|
-
|
|
|
189
|
+
| DR | its file, with no outer brackets (e.g., `[DR-000](decisions/000-spec-structure-format.md)`) |
|
|
190
190
|
|
|
191
191
|
### meta-18
|
|
192
192
|
|
|
193
|
-
No
|
|
193
|
+
No spec shall cite an IR or name it in prose, except that IR itself.
|
|
194
194
|
|
|
195
195
|
### meta-19
|
|
196
196
|
|
|
@@ -6,7 +6,7 @@ Review Git diffs under @specs/ and perform a spec update merge:
|
|
|
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
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
|
|
9
|
+
- Convert every item citation to the enclosed ID-text form, e.g. `[[pack-3](pack.md#pack-3)]`, and every DR 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
10
|
- Place every attachment after the final colon of its governing GEARS statement.
|
|
11
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
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.
|