@sublang/spex 0.1.0 → 0.2.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 CHANGED
@@ -47,6 +47,22 @@ Idempotency: Rerunning is safe — existing files and directories are skipped.
47
47
  Complete Iteration #0
48
48
  ```
49
49
 
50
+ ### Updating templates
51
+
52
+ When a new release ships updated templates, refresh them with:
53
+
54
+ ```sh
55
+ spex scaffold --update
56
+ ```
57
+
58
+ - Spex-authoritative files (`specs/meta.md` and the spec-format decision record) are refreshed unconditionally.
59
+ - Starter files (`map.md`, the sample iteration, boilerplate items) are refreshed only when you have not customized them.
60
+ - Anything you authored outside the bundled framework and starter files is left alone.
61
+
62
+ Review the changes with `git diff -- specs`.
63
+ Update any citations that reference renamed sections or renumbered IDs — the command prints
64
+ clear next steps and a copy-paste-ready prompt you can hand to your AI agent for that review.
65
+
50
66
  ## Workflow
51
67
 
52
68
  Spex does *not* enforce a heavyweight workflow.
@@ -54,7 +70,7 @@ We believe spec-driven development is a flexible combination of a few primitives
54
70
 
55
71
  1. **Make Decisions** — Discuss requirements, architecture, and design with AI agents. Let AI generate and review decision records in `specs/decisions/`.
56
72
  2. **Plan Iterations** — Break down work into tasks with AI agents. Let AI generate and review iteration records in `specs/iterations/`.
57
- 3. **Agents Execute** — Let AI agents complete the tasks autonomously. They generate code and update `specs/items/`.
73
+ 3. **Agents Execute** — Let AI agents complete the tasks autonomously. They generate code and update `specs/user/`, `specs/dev/`, and `specs/test/`.
58
74
 
59
75
  Then loop back to the next decision or iteration.
60
76
 
@@ -2,7 +2,7 @@
2
2
  // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
3
3
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
- import { getScaffoldDir } from "./copy-templates.js";
5
+ import { getScaffoldDir } from "./bundled-scaffold.js";
6
6
  const SECTION_HEADING = "## Specs (Source of Truth)";
7
7
  const AGENT_FILES = ["CLAUDE.md", "AGENTS.md"];
8
8
  function escapeRegExp(s) {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolve the bundled scaffold/ directory path.
3
+ *
4
+ * SCAF-9: navigate from dist/ output directory up to the package
5
+ * root and return the scaffold/ directory path.
6
+ */
7
+ export declare function getScaffoldDir(): string;
8
+ export declare function stripBundledHeader(text: string): string;
9
+ export declare function readBundledMarkdown(relPath: string): string;
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
3
+ import { readFileSync } from "node:fs";
4
+ import { dirname, join, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ /**
7
+ * Resolve the bundled scaffold/ directory path.
8
+ *
9
+ * SCAF-9: navigate from dist/ output directory up to the package
10
+ * root and return the scaffold/ directory path.
11
+ */
12
+ export function getScaffoldDir() {
13
+ const thisFile = fileURLToPath(import.meta.url);
14
+ // thisFile is in dist/ — go up one level to package root.
15
+ const packageRoot = dirname(dirname(thisFile));
16
+ return resolve(packageRoot, "scaffold");
17
+ }
18
+ export function stripBundledHeader(text) {
19
+ return text
20
+ .replace(/^(?:<!-- SPDX-[\s\S]*?-->\r?\n)+\r?\n?/, "")
21
+ .replace(/\r\n/g, "\n")
22
+ .trimEnd();
23
+ }
24
+ export function readBundledMarkdown(relPath) {
25
+ return stripBundledHeader(readFileSync(join(getScaffoldDir(), relPath), "utf-8"));
26
+ }
27
+ //# sourceMappingURL=bundled-scaffold.js.map
package/dist/cli.js CHANGED
@@ -5,7 +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`;
8
+ scaffold [<path>] Create specs directory structure
9
+ scaffold --update Refresh scaffold-provided specs templates`;
9
10
  function main() {
10
11
  const args = process.argv.slice(2);
11
12
  const command = args[0];
@@ -15,7 +16,7 @@ function main() {
15
16
  }
16
17
  switch (command) {
17
18
  case "scaffold":
18
- scaffold(args[1]);
19
+ scaffold(args.slice(1));
19
20
  break;
20
21
  default:
21
22
  console.error(`Unknown command: ${command}\n`);
@@ -1,10 +1,4 @@
1
- /**
2
- * Resolve the bundled scaffold/ directory path.
3
- *
4
- * SCAF-9: navigate from dist/ output directory up to the package
5
- * root and return the scaffold/ directory path.
6
- */
7
- export declare function getScaffoldDir(): string;
1
+ export type PristineState = "pristine" | "modified" | "missing";
8
2
  /**
9
3
  * Copy bundled template files from scaffold/specs/ to target specs/.
10
4
  *
@@ -12,3 +6,19 @@ export declare function getScaffoldDir(): string;
12
6
  * SCAF-9: resolves scaffold/ from the dist/ output directory.
13
7
  */
14
8
  export declare function copyTemplates(basePath: string): void;
9
+ export declare function getFrameworkSpecFiles(): readonly string[];
10
+ export declare function getSeedSpecFiles(): readonly string[];
11
+ export declare function migrateLegacyItemLayout(basePath: string): {
12
+ migrated: string[];
13
+ conflicts: string[];
14
+ };
15
+ export declare function getFileHistory(relPath: string): string[];
16
+ export declare function canonicalContentHash(data: Buffer): string;
17
+ export declare function isPristine(basePath: string, relPath: string): PristineState;
18
+ export declare function overwriteFrameworkSpecFiles(basePath: string): void;
19
+ export declare function refreshPristineSeeds(basePath: string): {
20
+ refreshed: string[];
21
+ unchanged: string[];
22
+ modified: string[];
23
+ missing: string[];
24
+ };
@@ -1,20 +1,27 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
3
- import { copyFileSync, existsSync, readdirSync, statSync } from "node:fs";
4
- import { dirname, join, posix, resolve } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- /**
7
- * Resolve the bundled scaffold/ directory path.
8
- *
9
- * SCAF-9: navigate from dist/ output directory up to the package
10
- * root and return the scaffold/ directory path.
11
- */
12
- export function getScaffoldDir() {
13
- const thisFile = fileURLToPath(import.meta.url);
14
- // thisFile is in dist/ — go up one level to package root.
15
- const packageRoot = dirname(dirname(thisFile));
16
- return resolve(packageRoot, "scaffold");
17
- }
3
+ import { createHash } from "node:crypto";
4
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmdirSync, statSync, } from "node:fs";
5
+ import { dirname, join, posix, relative } from "node:path";
6
+ import { getScaffoldDir } from "./bundled-scaffold.js";
7
+ // SCAF-19: framework vs seed classification.
8
+ const FRAMEWORK_FILES = [
9
+ "specs/meta.md",
10
+ "specs/decisions/000-spec-structure-format.md",
11
+ ];
12
+ const SEED_FILES = [
13
+ "specs/map.md",
14
+ "specs/iterations/000-spdx-headers.md",
15
+ "specs/dev/git.md",
16
+ "specs/dev/licensing.md",
17
+ "specs/test/licensing.md",
18
+ "specs/user/.gitkeep",
19
+ ];
20
+ const LEGACY_ITEM_DIRS = [
21
+ ["specs/items/user", "specs/user"],
22
+ ["specs/items/dev", "specs/dev"],
23
+ ["specs/items/test", "specs/test"],
24
+ ];
18
25
  /**
19
26
  * Recursively copy files from srcDir to destDir.
20
27
  * Files that already exist at the destination are not overwritten (SCAF-8).
@@ -57,4 +64,143 @@ export function copyTemplates(basePath) {
57
64
  }
58
65
  copyRecursive(srcSpecs, destSpecs, "specs");
59
66
  }
67
+ // SCAF-13.
68
+ export function getFrameworkSpecFiles() {
69
+ return FRAMEWORK_FILES;
70
+ }
71
+ // SCAF-20.
72
+ export function getSeedSpecFiles() {
73
+ return SEED_FILES;
74
+ }
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
+ function removeEmptyDirectories(dir) {
91
+ if (!existsSync(dir) || !statSync(dir).isDirectory())
92
+ return false;
93
+ for (const entry of readdirSync(dir)) {
94
+ removeEmptyDirectories(join(dir, entry));
95
+ }
96
+ if (readdirSync(dir).length === 0) {
97
+ rmdirSync(dir);
98
+ return true;
99
+ }
100
+ return false;
101
+ }
102
+ // SCAF-26.
103
+ export function migrateLegacyItemLayout(basePath) {
104
+ const migrated = [];
105
+ const conflicts = [];
106
+ for (const [legacyRootRel, targetRootRel] of LEGACY_ITEM_DIRS) {
107
+ const legacyRoot = join(basePath, legacyRootRel);
108
+ if (!existsSync(legacyRoot))
109
+ continue;
110
+ for (const source of listFiles(legacyRoot)) {
111
+ const suffix = relative(legacyRoot, source).replace(/\\/g, "/");
112
+ const legacyRelPath = posix.join(legacyRootRel, suffix);
113
+ const targetRelPath = posix.join(targetRootRel, suffix);
114
+ const target = join(basePath, targetRelPath);
115
+ if (existsSync(target)) {
116
+ console.log(` ${legacyRelPath} (kept — target exists at ${targetRelPath})`);
117
+ conflicts.push(legacyRelPath);
118
+ continue;
119
+ }
120
+ mkdirSync(dirname(target), { recursive: true });
121
+ renameSync(source, target);
122
+ console.log(` ${targetRelPath} (migrated from ${legacyRelPath})`);
123
+ migrated.push(targetRelPath);
124
+ }
125
+ }
126
+ removeEmptyDirectories(join(basePath, "specs", "items"));
127
+ return { migrated, conflicts };
128
+ }
129
+ // SCAF-21.
130
+ export function getFileHistory(relPath) {
131
+ const manifestPath = join(getScaffoldDir(), ".file-history.json");
132
+ if (!existsSync(manifestPath)) {
133
+ throw new Error(`File-history manifest not found: ${manifestPath}`);
134
+ }
135
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
136
+ return manifest[relPath] ?? [];
137
+ }
138
+ function hashFile(path) {
139
+ return canonicalContentHash(readFileSync(path));
140
+ }
141
+ export function canonicalContentHash(data) {
142
+ return `sha256-${createHash("sha256")
143
+ .update(canonicalHashInput(data))
144
+ .digest("hex")}`;
145
+ }
146
+ function canonicalHashInput(data) {
147
+ if (data.includes(0))
148
+ return data;
149
+ return data.toString("utf-8").replace(/\r\n?/g, "\n");
150
+ }
151
+ // SCAF-22.
152
+ export function isPristine(basePath, relPath) {
153
+ const target = join(basePath, relPath);
154
+ if (!existsSync(target))
155
+ return "missing";
156
+ return getFileHistory(relPath).includes(hashFile(target))
157
+ ? "pristine"
158
+ : "modified";
159
+ }
160
+ // SCAF-14.
161
+ export function overwriteFrameworkSpecFiles(basePath) {
162
+ const scaffoldDir = getScaffoldDir();
163
+ for (const relPath of FRAMEWORK_FILES) {
164
+ const target = join(basePath, relPath);
165
+ const source = join(scaffoldDir, relPath);
166
+ if (existsSync(target) && hashFile(target) === hashFile(source)) {
167
+ console.log(` ${relPath} (unchanged)`);
168
+ continue;
169
+ }
170
+ copyFileSync(source, target);
171
+ console.log(` ${relPath} (updated)`);
172
+ }
173
+ }
174
+ // SCAF-23.
175
+ export function refreshPristineSeeds(basePath) {
176
+ const scaffoldDir = getScaffoldDir();
177
+ const refreshed = [];
178
+ const unchanged = [];
179
+ const modified = [];
180
+ const missing = [];
181
+ for (const relPath of SEED_FILES) {
182
+ const state = isPristine(basePath, relPath);
183
+ if (state === "missing") {
184
+ console.log(` ${relPath} (kept — missing)`);
185
+ missing.push(relPath);
186
+ continue;
187
+ }
188
+ if (state === "modified") {
189
+ console.log(` ${relPath} (kept — user-modified)`);
190
+ modified.push(relPath);
191
+ continue;
192
+ }
193
+ const target = join(basePath, relPath);
194
+ const source = join(scaffoldDir, relPath);
195
+ if (hashFile(target) === hashFile(source)) {
196
+ console.log(` ${relPath} (unchanged)`);
197
+ unchanged.push(relPath);
198
+ continue;
199
+ }
200
+ copyFileSync(source, target);
201
+ console.log(` ${relPath} (updated)`);
202
+ refreshed.push(relPath);
203
+ }
204
+ return { refreshed, unchanged, modified, missing };
205
+ }
60
206
  //# sourceMappingURL=copy-templates.js.map
@@ -9,10 +9,9 @@ const DIRS = [
9
9
  "specs",
10
10
  "specs/decisions",
11
11
  "specs/iterations",
12
- "specs/items",
13
- "specs/items/user",
14
- "specs/items/dev",
15
- "specs/items/test",
12
+ "specs/user",
13
+ "specs/dev",
14
+ "specs/test",
16
15
  ];
17
16
  /**
18
17
  * Create the specs directory structure under basePath.
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Entry point for the scaffold subcommand.
3
- * @param pathArg - Optional explicit target path
3
+ * @param args - Arguments after the scaffold subcommand
4
4
  */
5
- export declare function scaffold(pathArg?: string): void;
5
+ export declare function scaffold(args?: string[]): void;
package/dist/scaffold.js CHANGED
@@ -1,16 +1,114 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
3
+ import { execFileSync } from "node:child_process";
3
4
  import { appendAgentSpecs } from "./append-agent-specs.js";
4
- import { copyTemplates } from "./copy-templates.js";
5
+ import { readBundledMarkdown } from "./bundled-scaffold.js";
6
+ import { copyTemplates, getFrameworkSpecFiles, migrateLegacyItemLayout, overwriteFrameworkSpecFiles, refreshPristineSeeds, } from "./copy-templates.js";
5
7
  import { createSpecsStructure } from "./create-specs-structure.js";
6
8
  import { resolveBase } from "./resolve-base.js";
9
+ function parseArgs(args) {
10
+ const updateIndex = args.indexOf("--update");
11
+ if (updateIndex !== -1) {
12
+ if (args.length !== 1) {
13
+ throw new Error("--update does not accept a <path> argument");
14
+ }
15
+ return { mode: "update" };
16
+ }
17
+ if (args.length > 1) {
18
+ throw new Error(`Unexpected arguments: ${args.slice(1).join(" ")}`);
19
+ }
20
+ return { mode: "create", pathArg: args[0] };
21
+ }
22
+ function getGitRoot() {
23
+ try {
24
+ return execFileSync("git", ["rev-parse", "--show-toplevel"], {
25
+ encoding: "utf-8",
26
+ stdio: ["ignore", "pipe", "ignore"],
27
+ }).trim();
28
+ }
29
+ catch {
30
+ throw new Error("--update requires cwd inside a git repository");
31
+ }
32
+ }
33
+ function assertCleanSpecsTree(basePath) {
34
+ const status = execFileSync("git", ["status", "--porcelain", "--", "specs"], {
35
+ cwd: basePath,
36
+ encoding: "utf-8",
37
+ stdio: ["ignore", "pipe", "ignore"],
38
+ });
39
+ if (status.trim() !== "") {
40
+ throw new Error("--update requires a clean specs/ working tree");
41
+ }
42
+ }
43
+ function assertFrameworkFilesTracked(basePath) {
44
+ const missing = getFrameworkSpecFiles().filter((relPath) => {
45
+ try {
46
+ execFileSync("git", ["cat-file", "-e", `HEAD:${relPath}`], {
47
+ cwd: basePath,
48
+ stdio: "ignore",
49
+ });
50
+ return false;
51
+ }
52
+ catch {
53
+ return true;
54
+ }
55
+ });
56
+ if (missing.length > 0) {
57
+ throw new Error(`--update requires framework files tracked in HEAD: ${missing.join(", ")}`);
58
+ }
59
+ }
60
+ function readUpdateMergePrompt() {
61
+ return readBundledMarkdown("update-merge-prompt.md");
62
+ }
63
+ function updateScaffoldTemplates() {
64
+ const basePath = getGitRoot();
65
+ assertCleanSpecsTree(basePath);
66
+ assertFrameworkFilesTracked(basePath);
67
+ const legacyReport = migrateLegacyItemLayout(basePath);
68
+ overwriteFrameworkSpecFiles(basePath);
69
+ const seedReport = refreshPristineSeeds(basePath);
70
+ console.log("");
71
+ console.log("spex scaffold --update completed.");
72
+ console.log("Review the file indicators above and inspect changes (e.g., `git diff -- specs`).");
73
+ console.log("Optionally, share this prompt with your AI agent to reconcile citations and local extensions:");
74
+ console.log("");
75
+ console.log("```");
76
+ console.log(readUpdateMergePrompt());
77
+ console.log("```");
78
+ if (legacyReport.migrated.length > 0) {
79
+ console.log("");
80
+ console.log("Legacy specs/items layout migrated:");
81
+ for (const relPath of legacyReport.migrated) {
82
+ console.log(`- ${relPath}`);
83
+ }
84
+ }
85
+ if (legacyReport.conflicts.length > 0) {
86
+ console.log("");
87
+ console.log("Legacy paths left in place because flat targets already exist:");
88
+ for (const relPath of legacyReport.conflicts) {
89
+ console.log(`- ${relPath}`);
90
+ }
91
+ }
92
+ if (seedReport.refreshed.length > 0) {
93
+ console.log("");
94
+ console.log("Pristine seeds also refreshed (no prior customization detected):");
95
+ for (const relPath of seedReport.refreshed) {
96
+ console.log(`- ${relPath}`);
97
+ }
98
+ }
99
+ }
7
100
  /**
8
101
  * Entry point for the scaffold subcommand.
9
- * @param pathArg - Optional explicit target path
102
+ * @param args - Arguments after the scaffold subcommand
10
103
  */
11
- export function scaffold(pathArg) {
104
+ export function scaffold(args = []) {
12
105
  try {
13
- const basePath = resolveBase(pathArg);
106
+ const options = parseArgs(args);
107
+ if (options.mode === "update") {
108
+ updateScaffoldTemplates();
109
+ return;
110
+ }
111
+ const basePath = resolveBase(options.pathArg);
14
112
  createSpecsStructure(basePath);
15
113
  copyTemplates(basePath);
16
114
  appendAgentSpecs(basePath);
package/package.json CHANGED
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "name": "@sublang/spex",
3
- "version": "0.1.0",
4
- "description": "Spec framework CLI",
3
+ "version": "0.2.0",
4
+ "description": "The essential spec layer AI agents need to build software reliably",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/sublang-ai/spex.git"
10
10
  },
11
+ "keywords": [
12
+ "spex",
13
+ "ai-agents",
14
+ "specs",
15
+ "specification",
16
+ "spec-driven-development",
17
+ "scaffold",
18
+ "cli"
19
+ ],
11
20
  "bin": {
12
21
  "spex": "dist/cli.js"
13
22
  },
@@ -0,0 +1,35 @@
1
+ {
2
+ "specs/decisions/000-spec-structure-format.md": [
3
+ "sha256-28d0705311a8ede97c487a944efe99bed20863e246da0aa1a33286dd4f8864ca",
4
+ "sha256-a06e1b102d96c91f6ba36fd317426aae9c6a384a76c2dd5996275405d02d1883"
5
+ ],
6
+ "specs/dev/git.md": [
7
+ "sha256-1b194304866d05580de8b2d0caa3454aa772e876fb3dee1f6c5d637c9e9a42b2"
8
+ ],
9
+ "specs/dev/licensing.md": [
10
+ "sha256-ff6ce317bf51fb2f4a20dde8790a79f2a1237f6b5835c74e619f6e3d1647ab50"
11
+ ],
12
+ "specs/iterations/000-spdx-headers.md": [
13
+ "sha256-a5ae7e8e31e4292a9364ba7947b2fbf27836e9f88dc80436557191550fe1bd34",
14
+ "sha256-3b7d95e80a9ca42b81510d4fac5515fdeeb80d842f7aeb91fef76bafccc01b1a",
15
+ "sha256-f9914497c46f9bfa05d12dfa9190c2d53d20cffd1af3eb3e44f0f0a4b20830f2"
16
+ ],
17
+ "specs/map.md": [
18
+ "sha256-a1d6bc4a23fa58d8ccdcf7cd0570fc05face0aae8b6947367298dad3cde0af75",
19
+ "sha256-ff80b3088852d9ae07856d72a71e649a77251d3abd127531536bbe389dad2ad4",
20
+ "sha256-4f2772c2d268972c1d5b1e2f4efb604b304c285ef3d91def9c1bad59666b303d"
21
+ ],
22
+ "specs/meta.md": [
23
+ "sha256-ce07160cf8af1fb67f4f86c572aa182e92dff24a72b313a89914e058de894b56",
24
+ "sha256-fa6a8a8d9f0681fba06b29a2bdfb0d5ece7d678606c44271023451edbf874b97",
25
+ "sha256-8de1958df8dc83b3f792357f6726d61f701a210e06774707934bdb9ee892e33d",
26
+ "sha256-78a34b62546391e16f27265399c62568882563cad97def3520d9f675a7b75cab"
27
+ ],
28
+ "specs/test/licensing.md": [
29
+ "sha256-075e5782e80c7068deb55c21bfc43a1214a85945ed535d95f6ceadbbc9fa187f"
30
+ ],
31
+ "specs/user/.gitkeep": [
32
+ "sha256-01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
33
+ "sha256-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
34
+ ]
35
+ }
@@ -29,7 +29,7 @@ Spex uses two forms of specs to balance unification and flexibility.
29
29
  Decisions and iterations are stored as records.
30
30
  - Decision records (DRs) follow the ADR (Architectural Decision Record) format [[1]].
31
31
  - Iteration records (IRs) contain four sections: Goal, Deliverables, Tasks, and Acceptance criteria.
32
- - **Items** must follow the GEARS pattern [[2]] to specify requirements and constraints.
32
+ - **Items** must follow the GEARS pattern [[2]] to specify behaviors and constraints.
33
33
  Each item file must include an intent statement.
34
34
 
35
35
  ### Organization
@@ -38,22 +38,14 @@ Spex creates the default `specs/` directory under the repo root, with the follow
38
38
 
39
39
  | Path | Content | File Naming |
40
40
  | --------- | ------- | ------ |
41
- | `decisions/` | DRs | \<NNN\>-\<kebab-case\>.md |
42
- | `iterations/` | IRs | \<NNN\>-\<kebab-case\>.md |
43
- | `items/` | item files | [\<path\>/]\<kebab-case\>.md |
41
+ | `decisions/` | DRs. Design decisions and rationale. | \<NNN\>-\<kebab-case\>.md |
42
+ | `iterations/` | IRs. Implementation plans. | \<NNN\>-\<kebab-case\>.md |
43
+ | `user/` | item files for user-visible behavior. What the system does. | [\<path\>/]\<kebab-case\>.md |
44
+ | `dev/` | item files for system internal behavior. How the system is built. | [\<path\>/]\<kebab-case\>.md |
45
+ | `test/` | item files for acceptance testing. Quality guard for user and dev items. | [\<path\>/]\<kebab-case\>.md |
44
46
  | `map.md` | spec index for navigation | - |
45
47
  | `meta.md` | the spec of specs | - |
46
48
 
47
- ### Item groups
48
-
49
- Item files are grouped into three subdirectories under `items/`:
50
-
51
- | Subdirectory | Purpose |
52
- | ----- | ------- |
53
- | `user/` | What the system does. User-visible behavior. |
54
- | `dev/` | How the system is built. Not user-visible. |
55
- | `test/` | Acceptance testing. Each item cites the user or dev item it tests. |
56
-
57
49
  ### Item syntax
58
50
 
59
51
  A spec item must follow the GEARS syntax:
@@ -77,13 +69,13 @@ A spec package is a coherent set of spec items for a *single* intent.
77
69
  It is the basic unit for spec composition, reuse, and extension.
78
70
 
79
71
  A spec package consists of one to three coordinated item files sharing the same relative path and basename.
80
- The item files are located in `user/`, `dev/`, or `test/` according to which [groups](#item-groups) they belong to.
72
+ The item files are located in `user/`, `dev/`, or `test/` according to their category.
81
73
 
82
74
  For example, a spec package for generating short URLs may be named `gen-url` and consist of:
83
75
 
84
- - `items/user/signing/gen-url.md` for user-facing behaviors (e.g., basic operations, URL format)
85
- - `items/dev/signing/gen-url.md` for internal-implementation behaviors (e.g., algorithms)
86
- - `items/test/signing/gen-url.md` for tests covering the corresponding user and dev items
76
+ - `specs/user/signing/gen-url.md` for user-facing behaviors (e.g., basic operations, URL format)
77
+ - `specs/dev/signing/gen-url.md` for internal-implementation behaviors (e.g., algorithms)
78
+ - `specs/test/signing/gen-url.md` for tests covering the corresponding user and dev items
87
79
 
88
80
  Here, `signing/` is a local collection of related spec packages for development convenience.
89
81
 
@@ -9,7 +9,7 @@ Add SPDX headers (license and copyright info) to applicable files.
9
9
 
10
10
  ## Deliverables
11
11
 
12
- - [x] Add SPDX headers to applicable files missing them
12
+ - [ ] Add SPDX headers to applicable files missing them
13
13
  - [ ] Document header format in a dev spec
14
14
 
15
15
  ## Tasks
@@ -51,5 +51,5 @@ Add SPDX headers (license and copyright info) to applicable files.
51
51
 
52
52
  ## Acceptance criteria
53
53
 
54
- - All source files have SPDX-FileCopyrightText header ([LIC-3](../items/test/licensing.md#lic-3))
55
- - Files have SPDX-License-Identifier if a license file exists ([LIC-4](../items/test/licensing.md#lic-4))
54
+ - All source files have SPDX-FileCopyrightText header ([LIC-3](../test/licensing.md#lic-3))
55
+ - Files have SPDX-License-Identifier if a license file exists ([LIC-4](../test/licensing.md#lic-4))
@@ -7,15 +7,21 @@ Quick-reference index for locating spec files.
7
7
  Spec items are the source of truth.
8
8
  Code can be inconsistent with specs during development.
9
9
 
10
+ ## Authoring and reviewing specs
11
+
12
+ Know the rules in [`meta.md`](meta.md) before authoring, modifying, or reviewing a DR, IR, or item.
13
+
14
+ - DRs and IRs: see [Organization](meta.md#organization), [Record format](meta.md#record-format), and [Citation](meta.md#citation).
15
+ - Items: see [Organization](meta.md#organization), [Item syntax](meta.md#item-syntax), [Spec packages](meta.md#spec-packages), and [Citation](meta.md#citation).
16
+
10
17
  ## Layout
11
18
 
12
19
  ```text
13
20
  decisions/ Decision records (DRs)
14
21
  iterations/ Iteration records (IRs)
15
- items/ Spec item files
16
- user/ User-visible behavior
17
- dev/ Implementation requirements
18
- test/ Acceptance testing
22
+ user/ User-visible behavior
23
+ dev/ Implementation requirements
24
+ test/ Acceptance testing
19
25
  map.md This index
20
26
  meta.md The spec of specs
21
27
  ```
@@ -38,11 +44,11 @@ meta.md The spec of specs
38
44
 
39
45
  | Group | File | Summary |
40
46
  | --- | --- | --- |
41
- | dev | [git.md](items/dev/git.md) | Commit message format and AI co-authorship trailers |
47
+ | dev | [git.md](dev/git.md) | Commit message format and AI co-authorship trailers |
42
48
 
43
49
  ### LIC
44
50
 
45
51
  | Group | File | Summary |
46
52
  | --- | --- | --- |
47
- | dev | [licensing.md](items/dev/licensing.md) | SPDX header requirements and file-scope rules |
48
- | test | [licensing.md](items/test/licensing.md) | Copyright and license header presence checks |
53
+ | dev | [licensing.md](dev/licensing.md) | SPDX header requirements and file-scope rules |
54
+ | test | [licensing.md](test/licensing.md) | Copyright and license header presence checks |
@@ -17,23 +17,21 @@ The `specs/` directory shall contain the following subdirectories and files:
17
17
  | --------- | ------- | ------ |
18
18
  | `decisions/` | Decision records (DRs) | \<NNN\>-\<kebab-case\>.md |
19
19
  | `iterations/` | Iteration records (IRs) | \<NNN\>-\<kebab-case\>.md |
20
- | `items/` | item files | [\<path\>/]\<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 |
21
23
  | `map.md` | spec index for navigation with item files organized by packages | - |
22
24
  | `meta.md` | the spec of specs | - |
23
25
 
24
- ### META-2
26
+ ### META-3
25
27
 
26
- Item files shall be grouped into three subdirectories under `items/`:
28
+ Each item file shall include an `## Intent` section stating its purpose.
27
29
 
28
- | Subdirectory | Purpose |
29
- | ----- | ------- |
30
- | `user/` | What the system does. User-visible behavior. |
31
- | `dev/` | How the system is built. Not user-visible. |
32
- | `test/` | Acceptance testing. Test items cite the user or dev items they verify. |
30
+ ### META-21
33
31
 
34
- ### META-3
32
+ Test items shall focus on integration and system testing.
35
33
 
36
- Each item file shall include an `## Intent` section stating its purpose.
34
+ Unit tests shall be part of the implementation and shall not be specified as spec items.
37
35
 
38
36
  ## Record format
39
37
 
@@ -43,7 +41,23 @@ Each decision record (DR) shall follow the ADR format [[2]] with the following s
43
41
 
44
42
  ### META-5
45
43
 
46
- Each iteration record (IR) shall contain the following sections: Goal, Deliverables, Tasks, and Acceptance criteria.
44
+ Each iteration record (IR) shall contain the following sections: Goal, Deliverables (with checkboxes), Tasks (numbered, each in one-commit size), and Acceptance criteria.
45
+
46
+ ### META-23
47
+
48
+ 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.
49
+
50
+ ### META-24
51
+
52
+ A DR shall specify design decisions and constraints, not duplicate implementation logic.
53
+ A DR is sufficient when an implementer can generate or audit code from the design intent, constraints, and tradeoffs.
54
+ Implementation details shall be included only when they are part of the design contract.
55
+
56
+ ### META-25
57
+
58
+ In prose paragraphs of DRs and IRs, each sentence shall begin on a new line for diff readability.
59
+ List items and table cells are exempt, since their delimiters already isolate per-entry changes.
60
+ Fixed-width column wrapping within a sentence is allowed.
47
61
 
48
62
  ## Item syntax
49
63
 
@@ -81,6 +95,10 @@ Each item shall be self-contained:
81
95
  - It shall have no implicit dependency on sections other than its own subsections.
82
96
  - Citations to other specs or shared sections shall be explicit.
83
97
 
98
+ ### META-26
99
+
100
+ 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.
101
+
84
102
  ## Spec packages
85
103
 
86
104
  ### META-9
@@ -89,7 +107,7 @@ A spec package shall consist of one to three coordinated item files sharing the
89
107
 
90
108
  ### META-10
91
109
 
92
- A spec package shall have a basename \<kebab-case\>.md unique within `specs/items/`, with a short form \<ALLCAPS\>.
110
+ A spec package shall have a basename \<kebab-case\>.md unique across `specs/user/`, `specs/dev/`, and `specs/test/`, with a short form \<ALLCAPS\>.
93
111
 
94
112
  Example: `package-management.md` has short form `PKGMGT`.
95
113
 
File without changes
@@ -0,0 +1,8 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+
4
+ Review Git diffs under @specs/ and perform a spec update merge:
5
+
6
+ - If section headings or spec IDs changed, update citations across @specs/ (DRs, IRs, items, map.md) to match.
7
+ - 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.
8
+ - Focus only on the update merge; do not refine unrelated spec content.
@@ -1 +0,0 @@
1
-
File without changes
File without changes