@sublang/spex 0.2.2 → 0.3.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 +11 -1
- package/dist/cli.js +2 -2
- package/dist/copy-templates.d.ts +9 -3
- package/dist/copy-templates.js +83 -48
- package/dist/scaffold.js +91 -10
- package/package.json +1 -1
- package/scaffold/.file-history.json +17 -4
- package/scaffold/i18n/zh/specs/map.md +54 -0
- package/scaffold/i18n/zh/specs/meta.md +181 -0
- package/scaffold/specs/decisions/000-spec-structure-format.md +6 -18
- package/scaffold/specs/dev/licensing.md +6 -0
- package/scaffold/specs/iterations/000-spdx-headers.md +19 -39
- package/scaffold/specs/meta.md +11 -0
package/README.md
CHANGED
|
@@ -47,6 +47,16 @@ Idempotency: Rerunning is safe — existing files and directories are skipped.
|
|
|
47
47
|
Complete Iteration #0
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
### Localization
|
|
51
|
+
|
|
52
|
+
Specs are scaffolded in English by default. To scaffold in another language, pass `--lang`:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
spex scaffold --lang zh
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Chinese (`zh`) is currently bundled. Any file without a localized template falls back to English, so the tree is always complete. The chosen language is recorded in `specs/meta.md` and reused automatically on `spex scaffold --update`.
|
|
59
|
+
|
|
50
60
|
### Updating templates
|
|
51
61
|
|
|
52
62
|
When a new release ships updated templates, refresh them with:
|
|
@@ -55,7 +65,7 @@ When a new release ships updated templates, refresh them with:
|
|
|
55
65
|
spex scaffold --update
|
|
56
66
|
```
|
|
57
67
|
|
|
58
|
-
- Spex-authoritative files (`specs/meta.md` and the spec-format decision record) are refreshed unconditionally, including when they are absent.
|
|
68
|
+
- Spex-authoritative files (`specs/meta.md` and the spec-format decision record) are refreshed unconditionally, including when they are absent. If you had modified one of these, `--update` warns and names it so you can reapply your changes from git history.
|
|
59
69
|
- Starter files (`map.md`, the sample iteration, boilerplate items) are refreshed when you have not customized them, and written from the bundled template when they are absent. Customized starter files are kept as-is. Remove a starter file *after* `--update` if you do not want it.
|
|
60
70
|
- Anything you authored outside the bundled framework and starter files is left alone.
|
|
61
71
|
|
package/dist/cli.js
CHANGED
|
@@ -5,8 +5,8 @@ import { scaffold } from "./scaffold.js";
|
|
|
5
5
|
const USAGE = `Usage: spex <command> [options]
|
|
6
6
|
|
|
7
7
|
Commands:
|
|
8
|
-
scaffold [<path>] Create specs directory structure
|
|
9
|
-
scaffold --update
|
|
8
|
+
scaffold [--lang <code>] [<path>] Create specs directory structure
|
|
9
|
+
scaffold --update Refresh scaffold-provided specs templates`;
|
|
10
10
|
function main() {
|
|
11
11
|
const args = process.argv.slice(2);
|
|
12
12
|
const command = args[0];
|
package/dist/copy-templates.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const SUPPORTED_LANGUAGES: readonly ["en", "zh"];
|
|
2
|
+
export type ScaffoldLanguage = (typeof SUPPORTED_LANGUAGES)[number];
|
|
1
3
|
export type PristineState = "pristine" | "modified" | "missing";
|
|
2
4
|
export type LegacyItemLayoutResult = {
|
|
3
5
|
status: "migrated" | "conflict";
|
|
@@ -6,20 +8,24 @@ export type LegacyItemLayoutResult = {
|
|
|
6
8
|
};
|
|
7
9
|
type RefreshPristineSeedsOptions = {
|
|
8
10
|
migratedFrom?: ReadonlyMap<string, string>;
|
|
11
|
+
language?: ScaffoldLanguage;
|
|
9
12
|
};
|
|
13
|
+
export declare function isSupportedLanguage(code: string): code is ScaffoldLanguage;
|
|
14
|
+
export declare function formatSupportedLanguages(): string;
|
|
15
|
+
export declare function getBundledSpecFilePath(relPath: string, language?: ScaffoldLanguage): string;
|
|
10
16
|
/**
|
|
11
17
|
* Copy bundled template files from scaffold/specs/ to target specs/.
|
|
12
18
|
*
|
|
13
19
|
* SCAF-8: recursively copies files; existing files are not overwritten.
|
|
14
20
|
* SCAF-9: resolves scaffold/ from the dist/ output directory.
|
|
15
21
|
*/
|
|
16
|
-
export declare function copyTemplates(basePath: string): void;
|
|
22
|
+
export declare function copyTemplates(basePath: string, language?: ScaffoldLanguage): void;
|
|
17
23
|
export declare function getFrameworkSpecFiles(): readonly string[];
|
|
18
24
|
export declare function getSeedSpecFiles(): readonly string[];
|
|
19
25
|
export declare function migrateLegacyItemLayout(basePath: string): LegacyItemLayoutResult[];
|
|
20
26
|
export declare function getFileHistory(relPath: string): string[];
|
|
21
27
|
export declare function canonicalContentHash(data: Buffer): string;
|
|
22
|
-
export declare function isPristine(basePath: string, relPath: string): PristineState;
|
|
23
|
-
export declare function overwriteFrameworkSpecFiles(basePath: string):
|
|
28
|
+
export declare function isPristine(basePath: string, relPath: string, language?: ScaffoldLanguage): PristineState;
|
|
29
|
+
export declare function overwriteFrameworkSpecFiles(basePath: string, language?: ScaffoldLanguage): string[];
|
|
24
30
|
export declare function refreshPristineSeeds(basePath: string, options?: RefreshPristineSeedsOptions): void;
|
|
25
31
|
export {};
|
package/dist/copy-templates.js
CHANGED
|
@@ -4,6 +4,7 @@ import { createHash } from "node:crypto";
|
|
|
4
4
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmdirSync, statSync, } from "node:fs";
|
|
5
5
|
import { dirname, join, posix, relative } from "node:path";
|
|
6
6
|
import { getScaffoldDir } from "./bundled-scaffold.js";
|
|
7
|
+
export const SUPPORTED_LANGUAGES = ["en", "zh"];
|
|
7
8
|
// SCAF-19: framework vs seed classification.
|
|
8
9
|
const FRAMEWORK_FILES = [
|
|
9
10
|
"specs/meta.md",
|
|
@@ -22,32 +23,54 @@ const LEGACY_ITEM_DIRS = [
|
|
|
22
23
|
["specs/items/dev", "specs/dev"],
|
|
23
24
|
["specs/items/test", "specs/test"],
|
|
24
25
|
];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
export function isSupportedLanguage(code) {
|
|
27
|
+
return SUPPORTED_LANGUAGES.includes(code);
|
|
28
|
+
}
|
|
29
|
+
export function formatSupportedLanguages() {
|
|
30
|
+
return SUPPORTED_LANGUAGES.join(", ");
|
|
31
|
+
}
|
|
32
|
+
function getOverlayRelPath(language, relPath) {
|
|
33
|
+
return posix.join("i18n", language, relPath);
|
|
34
|
+
}
|
|
35
|
+
function getOverlayBase(scaffoldDir, language) {
|
|
36
|
+
return join(scaffoldDir, "i18n", language);
|
|
37
|
+
}
|
|
38
|
+
function listFiles(dir) {
|
|
39
|
+
const files = [];
|
|
40
|
+
for (const entry of readdirSync(dir)) {
|
|
33
41
|
if (entry === ".DS_Store")
|
|
34
42
|
continue;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (statSync(srcPath).isDirectory()) {
|
|
39
|
-
copyRecursive(srcPath, destPath, relPath);
|
|
43
|
+
const path = join(dir, entry);
|
|
44
|
+
if (statSync(path).isDirectory()) {
|
|
45
|
+
files.push(...listFiles(path));
|
|
40
46
|
}
|
|
41
47
|
else {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
files.push(path);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return files;
|
|
52
|
+
}
|
|
53
|
+
function listBundledSpecRelPaths(scaffoldDir, language) {
|
|
54
|
+
const relPaths = new Set(listFiles(join(scaffoldDir, "specs")).map((path) => relative(scaffoldDir, path).replace(/\\/g, "/")));
|
|
55
|
+
if (language !== "en") {
|
|
56
|
+
const overlayBase = getOverlayBase(scaffoldDir, language);
|
|
57
|
+
const overlaySpecs = join(overlayBase, "specs");
|
|
58
|
+
if (existsSync(overlaySpecs)) {
|
|
59
|
+
for (const path of listFiles(overlaySpecs)) {
|
|
60
|
+
relPaths.add(relative(overlayBase, path).replace(/\\/g, "/"));
|
|
48
61
|
}
|
|
49
62
|
}
|
|
50
63
|
}
|
|
64
|
+
return [...relPaths].sort();
|
|
65
|
+
}
|
|
66
|
+
export function getBundledSpecFilePath(relPath, language = "en") {
|
|
67
|
+
const scaffoldDir = getScaffoldDir();
|
|
68
|
+
if (language !== "en") {
|
|
69
|
+
const overlayPath = join(scaffoldDir, getOverlayRelPath(language, relPath));
|
|
70
|
+
if (existsSync(overlayPath))
|
|
71
|
+
return overlayPath;
|
|
72
|
+
}
|
|
73
|
+
return join(scaffoldDir, relPath);
|
|
51
74
|
}
|
|
52
75
|
/**
|
|
53
76
|
* Copy bundled template files from scaffold/specs/ to target specs/.
|
|
@@ -55,14 +78,22 @@ function copyRecursive(srcDir, destDir, relRoot) {
|
|
|
55
78
|
* SCAF-8: recursively copies files; existing files are not overwritten.
|
|
56
79
|
* SCAF-9: resolves scaffold/ from the dist/ output directory.
|
|
57
80
|
*/
|
|
58
|
-
export function copyTemplates(basePath) {
|
|
81
|
+
export function copyTemplates(basePath, language = "en") {
|
|
59
82
|
const scaffoldDir = getScaffoldDir();
|
|
60
83
|
const srcSpecs = join(scaffoldDir, "specs");
|
|
61
|
-
const destSpecs = join(basePath, "specs");
|
|
62
84
|
if (!existsSync(srcSpecs)) {
|
|
63
85
|
throw new Error(`Bundled scaffold/specs/ not found: ${srcSpecs}`);
|
|
64
86
|
}
|
|
65
|
-
|
|
87
|
+
for (const relPath of listBundledSpecRelPaths(scaffoldDir, language)) {
|
|
88
|
+
const target = join(basePath, relPath);
|
|
89
|
+
if (existsSync(target)) {
|
|
90
|
+
console.log(` ${relPath} (already exists)`);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
94
|
+
copyFileSync(getBundledSpecFilePath(relPath, language), target);
|
|
95
|
+
console.log(` ${relPath}`);
|
|
96
|
+
}
|
|
66
97
|
}
|
|
67
98
|
// SCAF-13.
|
|
68
99
|
export function getFrameworkSpecFiles() {
|
|
@@ -72,21 +103,6 @@ export function getFrameworkSpecFiles() {
|
|
|
72
103
|
export function getSeedSpecFiles() {
|
|
73
104
|
return SEED_FILES;
|
|
74
105
|
}
|
|
75
|
-
function listFiles(dir) {
|
|
76
|
-
const files = [];
|
|
77
|
-
for (const entry of readdirSync(dir)) {
|
|
78
|
-
if (entry === ".DS_Store")
|
|
79
|
-
continue;
|
|
80
|
-
const path = join(dir, entry);
|
|
81
|
-
if (statSync(path).isDirectory()) {
|
|
82
|
-
files.push(...listFiles(path));
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
files.push(path);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return files;
|
|
89
|
-
}
|
|
90
106
|
function removeEmptyDirectories(dir) {
|
|
91
107
|
if (!existsSync(dir) || !statSync(dir).isDirectory())
|
|
92
108
|
return false;
|
|
@@ -140,6 +156,15 @@ export function getFileHistory(relPath) {
|
|
|
140
156
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
141
157
|
return manifest[relPath] ?? [];
|
|
142
158
|
}
|
|
159
|
+
function getRecognizedFileHistory(relPath, language) {
|
|
160
|
+
const history = new Set(getFileHistory(relPath));
|
|
161
|
+
if (language !== "en") {
|
|
162
|
+
for (const hash of getFileHistory(getOverlayRelPath(language, relPath))) {
|
|
163
|
+
history.add(hash);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return [...history];
|
|
167
|
+
}
|
|
143
168
|
function hashFile(path) {
|
|
144
169
|
return canonicalContentHash(readFileSync(path));
|
|
145
170
|
}
|
|
@@ -154,28 +179,38 @@ function canonicalHashInput(data) {
|
|
|
154
179
|
return data.toString("utf-8").replace(/\r\n?/g, "\n");
|
|
155
180
|
}
|
|
156
181
|
// SCAF-22.
|
|
157
|
-
export function isPristine(basePath, relPath) {
|
|
182
|
+
export function isPristine(basePath, relPath, language = "en") {
|
|
158
183
|
const target = join(basePath, relPath);
|
|
159
184
|
if (!existsSync(target))
|
|
160
185
|
return "missing";
|
|
161
|
-
return
|
|
186
|
+
return getRecognizedFileHistory(relPath, language).includes(hashFile(target))
|
|
162
187
|
? "pristine"
|
|
163
188
|
: "modified";
|
|
164
189
|
}
|
|
165
|
-
// SCAF-14.
|
|
166
|
-
|
|
167
|
-
|
|
190
|
+
// SCAF-14. Returns the framework paths that were overwritten while
|
|
191
|
+
// carrying unrecognized (user-modified) content, so the caller can warn
|
|
192
|
+
// before the run completes (SCAF-18).
|
|
193
|
+
export function overwriteFrameworkSpecFiles(basePath, language = "en") {
|
|
194
|
+
const replacedUserModified = [];
|
|
168
195
|
for (const relPath of FRAMEWORK_FILES) {
|
|
196
|
+
const state = isPristine(basePath, relPath, language);
|
|
169
197
|
const target = join(basePath, relPath);
|
|
170
|
-
const source =
|
|
171
|
-
if (
|
|
198
|
+
const source = getBundledSpecFilePath(relPath, language);
|
|
199
|
+
if (state !== "missing" && hashFile(target) === hashFile(source)) {
|
|
172
200
|
console.log(` ${relPath} (unchanged)`);
|
|
173
201
|
continue;
|
|
174
202
|
}
|
|
175
203
|
mkdirSync(dirname(target), { recursive: true });
|
|
176
204
|
copyFileSync(source, target);
|
|
177
|
-
|
|
205
|
+
if (state === "modified") {
|
|
206
|
+
replacedUserModified.push(relPath);
|
|
207
|
+
console.log(` ${relPath} (overwritten — user-modified)`);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
console.log(` ${relPath} (updated)`);
|
|
211
|
+
}
|
|
178
212
|
}
|
|
213
|
+
return replacedUserModified;
|
|
179
214
|
}
|
|
180
215
|
// SCAF-23.
|
|
181
216
|
function formatSeedIndicator(relPath, indicator, migratedFrom) {
|
|
@@ -187,16 +222,16 @@ function formatSeedIndicator(relPath, indicator, migratedFrom) {
|
|
|
187
222
|
return `migrated from ${legacyRelPath}; ${indicator}`;
|
|
188
223
|
}
|
|
189
224
|
export function refreshPristineSeeds(basePath, options = {}) {
|
|
190
|
-
const
|
|
225
|
+
const language = options.language ?? "en";
|
|
191
226
|
for (const relPath of SEED_FILES) {
|
|
192
|
-
const state = isPristine(basePath, relPath);
|
|
227
|
+
const state = isPristine(basePath, relPath, language);
|
|
193
228
|
if (state === "modified") {
|
|
194
229
|
const indicator = formatSeedIndicator(relPath, "kept — user-modified", options.migratedFrom);
|
|
195
230
|
console.log(` ${relPath} (${indicator})`);
|
|
196
231
|
continue;
|
|
197
232
|
}
|
|
198
233
|
const target = join(basePath, relPath);
|
|
199
|
-
const source =
|
|
234
|
+
const source = getBundledSpecFilePath(relPath, language);
|
|
200
235
|
if (state === "pristine" && hashFile(target) === hashFile(source)) {
|
|
201
236
|
const indicator = formatSeedIndicator(relPath, "unchanged", options.migratedFrom);
|
|
202
237
|
console.log(` ${relPath} (${indicator})`);
|
package/dist/scaffold.js
CHANGED
|
@@ -1,23 +1,66 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
4
6
|
import { appendAgentSpecs } from "./append-agent-specs.js";
|
|
5
7
|
import { readBundledMarkdown } from "./bundled-scaffold.js";
|
|
6
|
-
import { copyTemplates, getSeedSpecFiles, migrateLegacyItemLayout, overwriteFrameworkSpecFiles, refreshPristineSeeds, } from "./copy-templates.js";
|
|
8
|
+
import { copyTemplates, formatSupportedLanguages, getSeedSpecFiles, isSupportedLanguage, migrateLegacyItemLayout, overwriteFrameworkSpecFiles, refreshPristineSeeds, } from "./copy-templates.js";
|
|
7
9
|
import { createSpecsStructure } from "./create-specs-structure.js";
|
|
8
10
|
import { resolveBase } from "./resolve-base.js";
|
|
11
|
+
const AUTHORING_LANGUAGE_RE = /^Authoring language:\s*([A-Za-z0-9-]+)\s*$/m;
|
|
12
|
+
function parseLanguage(code) {
|
|
13
|
+
if (isSupportedLanguage(code))
|
|
14
|
+
return code;
|
|
15
|
+
throw new Error(`Unsupported language code: ${code}. Supported codes: ${formatSupportedLanguages()}`);
|
|
16
|
+
}
|
|
9
17
|
function parseArgs(args) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
let update = false;
|
|
19
|
+
let language;
|
|
20
|
+
const pathArgs = [];
|
|
21
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
22
|
+
const arg = args[i];
|
|
23
|
+
if (arg === "--update") {
|
|
24
|
+
update = true;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (arg === "--lang") {
|
|
28
|
+
const code = args[i + 1];
|
|
29
|
+
if (code === undefined) {
|
|
30
|
+
throw new Error("--lang requires a language code");
|
|
31
|
+
}
|
|
32
|
+
if (language !== undefined) {
|
|
33
|
+
throw new Error("--lang may only be specified once");
|
|
34
|
+
}
|
|
35
|
+
language = parseLanguage(code);
|
|
36
|
+
i += 1;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (arg.startsWith("--lang=")) {
|
|
40
|
+
if (language !== undefined) {
|
|
41
|
+
throw new Error("--lang may only be specified once");
|
|
42
|
+
}
|
|
43
|
+
language = parseLanguage(arg.slice("--lang=".length));
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (arg.startsWith("-")) {
|
|
47
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
48
|
+
}
|
|
49
|
+
pathArgs.push(arg);
|
|
50
|
+
}
|
|
51
|
+
if (update) {
|
|
52
|
+
if (language !== undefined) {
|
|
53
|
+
throw new Error("--update does not accept --lang");
|
|
54
|
+
}
|
|
55
|
+
if (pathArgs.length !== 0) {
|
|
13
56
|
throw new Error("--update does not accept a <path> argument");
|
|
14
57
|
}
|
|
15
58
|
return { mode: "update" };
|
|
16
59
|
}
|
|
17
|
-
if (
|
|
18
|
-
throw new Error(`Unexpected arguments: ${
|
|
60
|
+
if (pathArgs.length > 1) {
|
|
61
|
+
throw new Error(`Unexpected arguments: ${pathArgs.slice(1).join(" ")}`);
|
|
19
62
|
}
|
|
20
|
-
return { mode: "create", pathArg:
|
|
63
|
+
return { mode: "create", pathArg: pathArgs[0], language };
|
|
21
64
|
}
|
|
22
65
|
function getGitRoot() {
|
|
23
66
|
try {
|
|
@@ -43,9 +86,42 @@ function assertCleanSpecsTree(basePath) {
|
|
|
43
86
|
function readUpdateMergePrompt() {
|
|
44
87
|
return readBundledMarkdown("update-merge-prompt.md");
|
|
45
88
|
}
|
|
89
|
+
function readActiveLanguage(basePath) {
|
|
90
|
+
const metaPath = join(basePath, "specs", "meta.md");
|
|
91
|
+
if (!existsSync(metaPath))
|
|
92
|
+
return "en";
|
|
93
|
+
const match = readFileSync(metaPath, "utf-8").match(AUTHORING_LANGUAGE_RE);
|
|
94
|
+
if (match === null)
|
|
95
|
+
return "en";
|
|
96
|
+
return parseLanguage(match[1]);
|
|
97
|
+
}
|
|
98
|
+
function resolveCreateLanguage(basePath, requestedLanguage) {
|
|
99
|
+
const metaPath = join(basePath, "specs", "meta.md");
|
|
100
|
+
if (!existsSync(metaPath))
|
|
101
|
+
return requestedLanguage ?? "en";
|
|
102
|
+
const activeLanguage = readActiveLanguage(basePath);
|
|
103
|
+
if (requestedLanguage !== undefined &&
|
|
104
|
+
requestedLanguage !== activeLanguage) {
|
|
105
|
+
throw new Error(`--lang ${requestedLanguage} does not match existing authoring language ${activeLanguage}`);
|
|
106
|
+
}
|
|
107
|
+
return activeLanguage;
|
|
108
|
+
}
|
|
109
|
+
function warnReplacedFrameworkFiles(replaced) {
|
|
110
|
+
if (replaced.length === 0)
|
|
111
|
+
return;
|
|
112
|
+
console.warn("");
|
|
113
|
+
console.warn("WARNING: --update replaced framework file(s) that contained local modifications:");
|
|
114
|
+
for (const relPath of replaced) {
|
|
115
|
+
console.warn(` - ${relPath}`);
|
|
116
|
+
}
|
|
117
|
+
console.warn("These files are maintained by spex and were refreshed to the bundled version.");
|
|
118
|
+
console.warn("Your previous content remains in git history; review what changed with");
|
|
119
|
+
console.warn("`git diff -- specs` and reapply any local additions on top of the refreshed file.");
|
|
120
|
+
}
|
|
46
121
|
function updateScaffoldTemplates() {
|
|
47
122
|
const basePath = getGitRoot();
|
|
48
123
|
assertCleanSpecsTree(basePath);
|
|
124
|
+
const language = readActiveLanguage(basePath);
|
|
49
125
|
const legacyResults = migrateLegacyItemLayout(basePath);
|
|
50
126
|
const seedPaths = new Set(getSeedSpecFiles());
|
|
51
127
|
const migratedSeedSources = new Map();
|
|
@@ -62,8 +138,12 @@ function updateScaffoldTemplates() {
|
|
|
62
138
|
console.log(` ${result.targetRelPath} (migrated from ${result.legacyRelPath})`);
|
|
63
139
|
}
|
|
64
140
|
}
|
|
65
|
-
overwriteFrameworkSpecFiles(basePath);
|
|
66
|
-
refreshPristineSeeds(basePath, {
|
|
141
|
+
const replacedFramework = overwriteFrameworkSpecFiles(basePath, language);
|
|
142
|
+
refreshPristineSeeds(basePath, {
|
|
143
|
+
language,
|
|
144
|
+
migratedFrom: migratedSeedSources,
|
|
145
|
+
});
|
|
146
|
+
warnReplacedFrameworkFiles(replacedFramework);
|
|
67
147
|
console.log("");
|
|
68
148
|
console.log("spex scaffold --update completed.");
|
|
69
149
|
console.log("Review the file indicators above and inspect changes (e.g., `git diff -- specs`).");
|
|
@@ -85,8 +165,9 @@ export function scaffold(args = []) {
|
|
|
85
165
|
return;
|
|
86
166
|
}
|
|
87
167
|
const basePath = resolveBase(options.pathArg);
|
|
168
|
+
const language = resolveCreateLanguage(basePath, options.language);
|
|
88
169
|
createSpecsStructure(basePath);
|
|
89
|
-
copyTemplates(basePath);
|
|
170
|
+
copyTemplates(basePath, language);
|
|
90
171
|
appendAgentSpecs(basePath);
|
|
91
172
|
}
|
|
92
173
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
+
"i18n/zh/specs/map.md": [
|
|
3
|
+
"sha256-f1bcf636c567b830c5d6f625e10c8e4fe2c56b71fa7787106cd7b8701ad20efe"
|
|
4
|
+
],
|
|
5
|
+
"i18n/zh/specs/meta.md": [
|
|
6
|
+
"sha256-1d8a2507d30ef54b5d935a53b448ec74ea8a8556df5cae24e81dcfbd94f9b648"
|
|
7
|
+
],
|
|
2
8
|
"specs/decisions/000-spec-structure-format.md": [
|
|
3
9
|
"sha256-28d0705311a8ede97c487a944efe99bed20863e246da0aa1a33286dd4f8864ca",
|
|
4
|
-
"sha256-a06e1b102d96c91f6ba36fd317426aae9c6a384a76c2dd5996275405d02d1883"
|
|
10
|
+
"sha256-a06e1b102d96c91f6ba36fd317426aae9c6a384a76c2dd5996275405d02d1883",
|
|
11
|
+
"sha256-e492c52ea2ff89ab7b5b87d151a1755fac094233524eb8e6718be43111321227"
|
|
5
12
|
],
|
|
6
13
|
"specs/dev/git.md": [
|
|
7
14
|
"sha256-1b194304866d05580de8b2d0caa3454aa772e876fb3dee1f6c5d637c9e9a42b2"
|
|
8
15
|
],
|
|
9
16
|
"specs/dev/licensing.md": [
|
|
10
|
-
"sha256-ff6ce317bf51fb2f4a20dde8790a79f2a1237f6b5835c74e619f6e3d1647ab50"
|
|
17
|
+
"sha256-ff6ce317bf51fb2f4a20dde8790a79f2a1237f6b5835c74e619f6e3d1647ab50",
|
|
18
|
+
"sha256-f0690fbe5613097f3d0d1196fec5323a21a6b62bc3875068c38d09c74c5658c4",
|
|
19
|
+
"sha256-3ea1ba444666c05895c05d7f33056137b5dab8f6cdbdb80eb057a338fdf8eb4b"
|
|
11
20
|
],
|
|
12
21
|
"specs/iterations/000-spdx-headers.md": [
|
|
13
22
|
"sha256-a5ae7e8e31e4292a9364ba7947b2fbf27836e9f88dc80436557191550fe1bd34",
|
|
14
23
|
"sha256-3b7d95e80a9ca42b81510d4fac5515fdeeb80d842f7aeb91fef76bafccc01b1a",
|
|
15
|
-
"sha256-f9914497c46f9bfa05d12dfa9190c2d53d20cffd1af3eb3e44f0f0a4b20830f2"
|
|
24
|
+
"sha256-f9914497c46f9bfa05d12dfa9190c2d53d20cffd1af3eb3e44f0f0a4b20830f2",
|
|
25
|
+
"sha256-4fac8c7fee1fec71297c50ee605f0417c3ae2b27e8aa37b03e409f08db976516"
|
|
16
26
|
],
|
|
17
27
|
"specs/map.md": [
|
|
18
28
|
"sha256-a1d6bc4a23fa58d8ccdcf7cd0570fc05face0aae8b6947367298dad3cde0af75",
|
|
@@ -23,7 +33,10 @@
|
|
|
23
33
|
"sha256-ce07160cf8af1fb67f4f86c572aa182e92dff24a72b313a89914e058de894b56",
|
|
24
34
|
"sha256-fa6a8a8d9f0681fba06b29a2bdfb0d5ece7d678606c44271023451edbf874b97",
|
|
25
35
|
"sha256-8de1958df8dc83b3f792357f6726d61f701a210e06774707934bdb9ee892e33d",
|
|
26
|
-
"sha256-78a34b62546391e16f27265399c62568882563cad97def3520d9f675a7b75cab"
|
|
36
|
+
"sha256-78a34b62546391e16f27265399c62568882563cad97def3520d9f675a7b75cab",
|
|
37
|
+
"sha256-d7f8fba40ad0b02a862c6dd18d370269046f624b10d0f0cc296c854322439ff8",
|
|
38
|
+
"sha256-96ff2a321a1b17957fb8a2d6733302bf3405ede8d42d3029d8127edb908104c5",
|
|
39
|
+
"sha256-6a23f014ccbbe871e811f2ef9bd39119b50f0ce65a10bd75045d5735cf5b70b3"
|
|
27
40
|
],
|
|
28
41
|
"specs/test/licensing.md": [
|
|
29
42
|
"sha256-075e5782e80c7068deb55c21bfc43a1214a85945ed535d95f6ceadbbc9fa187f"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
|
|
4
|
+
# 规约地图
|
|
5
|
+
|
|
6
|
+
用于快速定位规约文件的索引。
|
|
7
|
+
规约条目是事实来源。
|
|
8
|
+
开发过程中,代码可能与规约暂时不一致。
|
|
9
|
+
|
|
10
|
+
## 编写和审阅规约
|
|
11
|
+
|
|
12
|
+
在编写、修改或审阅 DR、IR 或条目前,先了解 [`meta.md`](meta.md) 中的规则。
|
|
13
|
+
|
|
14
|
+
- DR 和 IR:见 [Organization](meta.md#organization)、[Record format](meta.md#record-format) 和 [Citation](meta.md#citation)。
|
|
15
|
+
- 条目:见 [Organization](meta.md#organization)、[Item syntax](meta.md#item-syntax)、[Spec packages](meta.md#spec-packages) 和 [Citation](meta.md#citation)。
|
|
16
|
+
|
|
17
|
+
## 目录结构
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
decisions/ 决策记录(DRs)
|
|
21
|
+
iterations/ 迭代记录(IRs)
|
|
22
|
+
user/ 用户可见行为
|
|
23
|
+
dev/ 实现要求
|
|
24
|
+
test/ 验收测试
|
|
25
|
+
map.md 本索引
|
|
26
|
+
meta.md 规约的规约
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 决策
|
|
30
|
+
|
|
31
|
+
| ID | 文件 | 摘要 |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| DR-000 | [000-spec-structure-format.md](decisions/000-spec-structure-format.md) | 规约结构、格式和命名约定 |
|
|
34
|
+
|
|
35
|
+
## 迭代
|
|
36
|
+
|
|
37
|
+
| ID | 文件 | 目标 |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| IR-000 | [000-spdx-headers.md](iterations/000-spdx-headers.md) | 为适用文件添加 SPDX 头 |
|
|
40
|
+
|
|
41
|
+
## 包
|
|
42
|
+
|
|
43
|
+
### GIT
|
|
44
|
+
|
|
45
|
+
| 分组 | 文件 | 摘要 |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| dev | [git.md](dev/git.md) | 提交信息格式和 AI 共同作者 trailers |
|
|
48
|
+
|
|
49
|
+
### LIC
|
|
50
|
+
|
|
51
|
+
| 分组 | 文件 | 摘要 |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| dev | [licensing.md](dev/licensing.md) | SPDX 头要求和文件范围规则 |
|
|
54
|
+
| test | [licensing.md](test/licensing.md) | 版权和许可证头存在性检查 |
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
<!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
3
|
+
|
|
4
|
+
# META: 规约定义
|
|
5
|
+
|
|
6
|
+
## 意图
|
|
7
|
+
|
|
8
|
+
本规约定义 specifications(specs)的结构和组织方式,遵循 [DR-000](decisions/000-spec-structure-format.md)。
|
|
9
|
+
|
|
10
|
+
## Organization
|
|
11
|
+
|
|
12
|
+
### META-1
|
|
13
|
+
|
|
14
|
+
The `specs/` directory shall contain the following subdirectories and files:
|
|
15
|
+
|
|
16
|
+
| Path | Content | File Naming |
|
|
17
|
+
| --------- | ------- | ------ |
|
|
18
|
+
| `decisions/` | Decision records (DRs) | \<NNN\>-\<kebab-case\>.md |
|
|
19
|
+
| `iterations/` | Iteration records (IRs) | \<NNN\>-\<kebab-case\>.md |
|
|
20
|
+
| `user/` | item files for user-visible behavior | [\<path\>/]\<kebab-case\>.md |
|
|
21
|
+
| `dev/` | item files for implementation requirements | [\<path\>/]\<kebab-case\>.md |
|
|
22
|
+
| `test/` | item files for acceptance testing | [\<path\>/]\<kebab-case\>.md |
|
|
23
|
+
| `map.md` | spec index for navigation with item files organized by packages | - |
|
|
24
|
+
| `meta.md` | the spec of specs | - |
|
|
25
|
+
|
|
26
|
+
<!-- spex-i18n-source: META-3 sha256-12d340f3809b0e5b716d164ba2e81ee7189d22ecb18331f8910277f65203efc6 -->
|
|
27
|
+
### META-3
|
|
28
|
+
|
|
29
|
+
每个条目文件应包含一个说明其目的的 `## 意图` 章节。
|
|
30
|
+
|
|
31
|
+
### META-21
|
|
32
|
+
|
|
33
|
+
Test items shall focus on integration and system testing.
|
|
34
|
+
|
|
35
|
+
Unit tests shall be part of the implementation and shall not be specified as spec items.
|
|
36
|
+
|
|
37
|
+
## Record format
|
|
38
|
+
|
|
39
|
+
<!-- spex-i18n-source: META-4 sha256-9fc0367f908c00eccdabd063021de2a66421a128ec34234a611f9271676598cc -->
|
|
40
|
+
### META-4
|
|
41
|
+
|
|
42
|
+
每个决策记录(DR)应遵循 ADR 格式 [[2]],并包含以下章节:状态、背景、决策、影响。
|
|
43
|
+
|
|
44
|
+
<!-- spex-i18n-source: META-5 sha256-f50b8ba3ae8a9c1e8ebb9d7f368a1acb3159de392169c2e9296ab37883572ef1 -->
|
|
45
|
+
### META-5
|
|
46
|
+
|
|
47
|
+
每个迭代记录(IR)应包含以下章节:目标、交付项(带复选框)、任务(编号且每项为一次提交大小)和验收标准。
|
|
48
|
+
|
|
49
|
+
### META-23
|
|
50
|
+
|
|
51
|
+
DRs and IRs shall be written in concise language, including only what is needed to act on or audit the record, with preference for bullets and tables over prose paragraphs.
|
|
52
|
+
|
|
53
|
+
### META-24
|
|
54
|
+
|
|
55
|
+
A DR shall specify design decisions and constraints, not duplicate implementation logic.
|
|
56
|
+
A DR is sufficient when an implementer can generate or audit code from the design intent, constraints, and tradeoffs.
|
|
57
|
+
Implementation details shall be included only when they are part of the design contract.
|
|
58
|
+
|
|
59
|
+
### META-25
|
|
60
|
+
|
|
61
|
+
In prose paragraphs of DRs and IRs, each sentence shall begin on a new line for diff readability.
|
|
62
|
+
List items and table cells are exempt, since their delimiters already isolate per-entry changes.
|
|
63
|
+
Fixed-width column wrapping within a sentence is allowed.
|
|
64
|
+
|
|
65
|
+
## Item syntax
|
|
66
|
+
|
|
67
|
+
<!-- spex-i18n-source: META-6 sha256-6a388878944a9426f53055410b686e33879d1e10c06c86d0d103b6a2f2d3a66c -->
|
|
68
|
+
### META-6
|
|
69
|
+
|
|
70
|
+
每个规约条目应使用 GEARS 模式 [[1]]:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
[给定 <静态前置条件>] [如果 <状态前置条件>] [当 <触发>] <主体>应<行为>。
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
子句和标点应遵循标准中文习惯。
|
|
77
|
+
|
|
78
|
+
| 子句 | 用途 | 示例 |
|
|
79
|
+
| ------ | ------- | ------- |
|
|
80
|
+
| 给定/Where | 静态前置条件(特性、配置) | 给定调试模式已启用 |
|
|
81
|
+
| 如果/While | 状态前置条件(运行时状态) | 如果连接处于活动状态 |
|
|
82
|
+
| 当/When | 触发事件(最多一个) | 当用户点击提交 |
|
|
83
|
+
| 应/shall | 所要求的行为 | 表单应校验输入 |
|
|
84
|
+
|
|
85
|
+
<!-- spex-i18n-source: META-7 sha256-7e2912d02d3d967a84c2ec8c850db8baa378197d78e517eb269ee665b9676426 -->
|
|
86
|
+
### META-7
|
|
87
|
+
|
|
88
|
+
当测试用例以 Given-When-Then(GWT)表达时,其规约条目应按以下方式将 GWT 映射到 GEARS [[1]]:
|
|
89
|
+
|
|
90
|
+
| GWT | 子句 |
|
|
91
|
+
| --- | ------ |
|
|
92
|
+
| Given | 给定/Where + 如果/While |
|
|
93
|
+
| When | 当/When |
|
|
94
|
+
| Then | 应/shall |
|
|
95
|
+
|
|
96
|
+
### META-8
|
|
97
|
+
|
|
98
|
+
Each item shall be self-contained:
|
|
99
|
+
|
|
100
|
+
- It shall have no implicit dependency on sections other than its own subsections.
|
|
101
|
+
- Citations to other specs or shared sections shall be explicit.
|
|
102
|
+
|
|
103
|
+
### META-26
|
|
104
|
+
|
|
105
|
+
A spec item shall describe behavior as observable outcomes (e.g., file state, exit code, printed output, return value, network call) under named conditions, including any conditions under which a particular outcome shall not occur.
|
|
106
|
+
|
|
107
|
+
## Spec packages
|
|
108
|
+
|
|
109
|
+
### META-9
|
|
110
|
+
|
|
111
|
+
A spec package shall consist of one to three coordinated item files sharing the same relative path and basename under `user/`, `dev/`, or `test/`.
|
|
112
|
+
|
|
113
|
+
### META-10
|
|
114
|
+
|
|
115
|
+
A spec package shall have a basename \<kebab-case\>.md unique across `specs/user/`, `specs/dev/`, and `specs/test/`, with a short form \<ALLCAPS\>.
|
|
116
|
+
|
|
117
|
+
Example: `package-management.md` has short form `PKGMGT`.
|
|
118
|
+
|
|
119
|
+
### META-11
|
|
120
|
+
|
|
121
|
+
Each item shall have an ID unique within `specs/`, following \<PACK\>-\<N...\> format (e.g., AUTH-11, URL-3) as a markdown heading for anchor linking.
|
|
122
|
+
|
|
123
|
+
Note: \<PACK\> refers to the short form of the package name.
|
|
124
|
+
|
|
125
|
+
### META-12
|
|
126
|
+
|
|
127
|
+
Item IDs shall not be modified once released; new items shall use higher IDs per package.
|
|
128
|
+
|
|
129
|
+
### META-13
|
|
130
|
+
|
|
131
|
+
A spec package shall define a closed set of subjects and their behaviors for a single intent. The shall clause (see [META-6](#meta-6)) of any item shall only involve subjects and behaviors within its own package.
|
|
132
|
+
|
|
133
|
+
### META-14
|
|
134
|
+
|
|
135
|
+
The precondition and trigger clauses (Where, While, When; see [META-6](#meta-6)) of items shall be allowed to reference subjects and behaviors from other spec packages.
|
|
136
|
+
|
|
137
|
+
### META-15
|
|
138
|
+
|
|
139
|
+
Each spec package shall minimize references to the containing project. When a project-specific reference is essential to a package's intent, it shall be documented in the package's `## Intent` section.
|
|
140
|
+
|
|
141
|
+
## Citation
|
|
142
|
+
|
|
143
|
+
### META-16
|
|
144
|
+
|
|
145
|
+
Citations to specific items shall use relative links with anchors (e.g., `[META-1](meta.md#meta-1)`).
|
|
146
|
+
|
|
147
|
+
### META-17
|
|
148
|
+
|
|
149
|
+
DRs and items shall be allowed to cite each other.
|
|
150
|
+
|
|
151
|
+
### META-18
|
|
152
|
+
|
|
153
|
+
IRs shall not be cited by any spec except `map.md`.
|
|
154
|
+
|
|
155
|
+
<!-- spex-i18n-source: META-19 sha256-3f6ffcfc6f8e3c50369236b4ccba2bec39ef6972b12b425946b2e9dcb2ae79d0 -->
|
|
156
|
+
### META-19
|
|
157
|
+
|
|
158
|
+
规约中的外部引用应引用权威来源(例如官方文档),并使用带编号的标记(例如 `[[1]]`)指向 `## 参考资料` 章节中的具体 URL,且该章节不应包含未被引用的条目。
|
|
159
|
+
|
|
160
|
+
### META-20
|
|
161
|
+
|
|
162
|
+
Each test item shall include one `Verifies:` metadata line immediately below its item ID heading.
|
|
163
|
+
|
|
164
|
+
The `Verifies:` line shall contain one or more comma-separated [citations](#meta-16) to the user or dev items that the test item verifies.
|
|
165
|
+
|
|
166
|
+
## Authoring language
|
|
167
|
+
|
|
168
|
+
<!-- spex-i18n-source: META-27 sha256-1fba59bae8903b6db86c0b1ed345082eabdce1cd65fa483e932e6df265a046ec -->
|
|
169
|
+
### META-27
|
|
170
|
+
|
|
171
|
+
Authoring language: zh
|
|
172
|
+
|
|
173
|
+
在规约树声明编写语言时,规约应使用该语言编写。
|
|
174
|
+
|
|
175
|
+
本条目中的声明行是 scaffold 的机器可读语言标记。
|
|
176
|
+
该声明行应使用精确格式 `Authoring language: <code>`,其中 `<code>` 只包含 ASCII 字母、数字和连字符。
|
|
177
|
+
|
|
178
|
+
## 参考资料
|
|
179
|
+
|
|
180
|
+
[1]: https://sublang.ai/zh/ref/gears-ai-ready-spec-syntax "GEARS:面向 AI 的规约语法(中文)"
|
|
181
|
+
[2]: https://github.com/npryce/adr-tools "ADR Tools"
|
|
@@ -27,10 +27,10 @@ Spex uses two forms of specs to balance unification and flexibility.
|
|
|
27
27
|
|
|
28
28
|
- **Records** must follow specified formats and may use free-form content within those formats.
|
|
29
29
|
Decisions and iterations are stored as records.
|
|
30
|
-
- Decision records (DRs) follow the ADR (Architectural Decision Record) format [[1]].
|
|
31
|
-
- Iteration records (IRs) contain
|
|
32
|
-
- **Items** must follow the GEARS pattern [
|
|
33
|
-
Each item file must include
|
|
30
|
+
- Decision records (DRs) follow the ADR (Architectural Decision Record) format [[1]], with active section titles defined by [META-4](../meta.md#meta-4).
|
|
31
|
+
- Iteration records (IRs) contain the sections defined by [META-5](../meta.md#meta-5).
|
|
32
|
+
- **Items** must follow the active GEARS pattern defined by [META-6](../meta.md#meta-6) to specify behaviors and constraints.
|
|
33
|
+
Each item file must include the active intent section defined by [META-3](../meta.md#meta-3).
|
|
34
34
|
|
|
35
35
|
### Organization
|
|
36
36
|
|
|
@@ -48,20 +48,8 @@ Spex creates the default `specs/` directory under the repo root, with the follow
|
|
|
48
48
|
|
|
49
49
|
### Item syntax
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```text
|
|
54
|
-
[Where <static precondition(s)>] [While <stateful precondition(s)>] [When <trigger>] The <subject> shall <behavior>.
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
| Keyword | Purpose |
|
|
58
|
-
| ------ | ------- |
|
|
59
|
-
| Where | Static preconditions (features, config) |
|
|
60
|
-
| While | Stateful preconditions (runtime state) |
|
|
61
|
-
| When | Trigger event (at most one) |
|
|
62
|
-
| shall | Required behavior |
|
|
63
|
-
|
|
64
|
-
For test specs, Given-When-Then maps to: Given → Where+While, When → When, Then → shall.
|
|
51
|
+
The active `meta.md` defines the GEARS item pattern, clause forms, and GWT mapping.
|
|
52
|
+
This keeps localized scaffolds aligned with the same framework without restating English-only syntax here.
|
|
65
53
|
|
|
66
54
|
### Spec packages
|
|
67
55
|
|
|
@@ -36,3 +36,9 @@ Where the file has comment syntax and is not excluded by [Exclusions](#exclusion
|
|
|
36
36
|
### LIC-2
|
|
37
37
|
|
|
38
38
|
Where the file has comment syntax, is not excluded by [Exclusions](#exclusions), and one or more project-root license files match [License File Detection](#license-file-detection), while the file is git-tracked or `git add`-able, when preparing the file for inclusion in the repo, the file shall include `SPDX-License-Identifier` in its first comment block after any shebang.
|
|
39
|
+
|
|
40
|
+
### LIC-5
|
|
41
|
+
|
|
42
|
+
Where a file's first comment block already contains `SPDX-FileCopyrightText` or `SPDX-License-Identifier` from an upstream source (e.g., a template or vendored file copied from another project), when preparing the file for inclusion in the repo, those existing SPDX lines shall be preserved unmodified, even when the project root carries a different license.
|
|
43
|
+
|
|
44
|
+
Each preserved upstream line satisfies its respective [LIC-1](#lic-1)/[LIC-2](#lic-2) requirement; any missing required line shall be supplied from upstream, not the project license.
|
|
@@ -5,51 +5,31 @@
|
|
|
5
5
|
|
|
6
6
|
## Goal
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Apply [LIC-1](../dev/licensing.md#lic-1), [LIC-2](../dev/licensing.md#lic-2), [LIC-5](../dev/licensing.md#lic-5) to in-scope files and pin the project's header format.
|
|
9
9
|
|
|
10
10
|
## Deliverables
|
|
11
11
|
|
|
12
|
-
- [ ] Add SPDX headers to
|
|
13
|
-
- [ ]
|
|
12
|
+
- [ ] Add SPDX headers to in-scope files missing them
|
|
13
|
+
- [ ] Add a `## Format` section to [`dev/licensing.md`](../dev/licensing.md) with the project's actual license and copyright
|
|
14
14
|
|
|
15
15
|
## Tasks
|
|
16
16
|
|
|
17
|
-
1.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
> **Source code** (including specs):
|
|
34
|
-
>
|
|
35
|
-
> ```typescript
|
|
36
|
-
> // SPDX-License-Identifier: Apache-2.0
|
|
37
|
-
> // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
38
|
-
> ```
|
|
39
|
-
>
|
|
40
|
-
> ```markdown
|
|
41
|
-
> <!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
42
|
-
> <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
43
|
-
> ```
|
|
44
|
-
>
|
|
45
|
-
> **Contents** (README, docs, blogs, etc.):
|
|
46
|
-
>
|
|
47
|
-
> ```markdown
|
|
48
|
-
> <!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
|
|
49
|
-
> <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
|
|
50
|
-
> ```
|
|
17
|
+
1. Resolve scope: detect a project-root license file per [License File Detection](../dev/licensing.md#license-file-detection); enumerate in-scope files per [Exclusions](../dev/licensing.md#exclusions).
|
|
18
|
+
|
|
19
|
+
2. Insert SPDX lines in each file's first comment block (after any shebang), using the file's native comment syntax.
|
|
20
|
+
|
|
21
|
+
3. Append a `## Format` section to [`dev/licensing.md`](../dev/licensing.md) showing the concrete header per comment style. Example for a single Apache-2.0 `LICENSE`:
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
25
|
+
<!-- SPDX-FileCopyrightText: <year> <holder> -->
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
30
|
+
// SPDX-FileCopyrightText: <year> <holder>
|
|
31
|
+
```
|
|
51
32
|
|
|
52
33
|
## Acceptance criteria
|
|
53
34
|
|
|
54
|
-
-
|
|
55
|
-
- Files have SPDX-License-Identifier if a license file exists ([LIC-4](../test/licensing.md#lic-4))
|
|
35
|
+
- [LIC-3](../test/licensing.md#lic-3), [LIC-4](../test/licensing.md#lic-4) pass on all in-scope files.
|
package/scaffold/specs/meta.md
CHANGED
|
@@ -157,6 +157,17 @@ Each test item shall include one `Verifies:` metadata line immediately below its
|
|
|
157
157
|
|
|
158
158
|
The `Verifies:` line shall contain one or more comma-separated [citations](#meta-16) to the user or dev items that the test item verifies.
|
|
159
159
|
|
|
160
|
+
## Authoring language
|
|
161
|
+
|
|
162
|
+
### META-27
|
|
163
|
+
|
|
164
|
+
Authoring language: en
|
|
165
|
+
|
|
166
|
+
Where a specs tree declares an authoring language, the specs shall be authored in that language.
|
|
167
|
+
|
|
168
|
+
The declaration line in this item is the machine-readable scaffold language marker.
|
|
169
|
+
It shall use the exact format `Authoring language: <code>`, where `<code>` contains only ASCII letters, digits, and hyphens.
|
|
170
|
+
|
|
160
171
|
## References
|
|
161
172
|
|
|
162
173
|
[1]: https://sublang.ai/ref/gears-ai-ready-spec-syntax "GEARS: AI-Ready Spec Syntax"
|