@sublang/spex 0.2.0 → 0.2.1

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
@@ -55,8 +55,8 @@ When a new release ships updated templates, refresh them with:
55
55
  spex scaffold --update
56
56
  ```
57
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.
58
+ - Spex-authoritative files (`specs/meta.md` and the spec-format decision record) are refreshed unconditionally, including when they are absent.
59
+ - 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
60
  - Anything you authored outside the bundled framework and starter files is left alone.
61
61
 
62
62
  Review the changes with `git diff -- specs`.
@@ -20,5 +20,4 @@ export declare function refreshPristineSeeds(basePath: string): {
20
20
  refreshed: string[];
21
21
  unchanged: string[];
22
22
  modified: string[];
23
- missing: string[];
24
23
  };
@@ -167,6 +167,7 @@ export function overwriteFrameworkSpecFiles(basePath) {
167
167
  console.log(` ${relPath} (unchanged)`);
168
168
  continue;
169
169
  }
170
+ mkdirSync(dirname(target), { recursive: true });
170
171
  copyFileSync(source, target);
171
172
  console.log(` ${relPath} (updated)`);
172
173
  }
@@ -177,14 +178,8 @@ export function refreshPristineSeeds(basePath) {
177
178
  const refreshed = [];
178
179
  const unchanged = [];
179
180
  const modified = [];
180
- const missing = [];
181
181
  for (const relPath of SEED_FILES) {
182
182
  const state = isPristine(basePath, relPath);
183
- if (state === "missing") {
184
- console.log(` ${relPath} (kept — missing)`);
185
- missing.push(relPath);
186
- continue;
187
- }
188
183
  if (state === "modified") {
189
184
  console.log(` ${relPath} (kept — user-modified)`);
190
185
  modified.push(relPath);
@@ -192,15 +187,16 @@ export function refreshPristineSeeds(basePath) {
192
187
  }
193
188
  const target = join(basePath, relPath);
194
189
  const source = join(scaffoldDir, relPath);
195
- if (hashFile(target) === hashFile(source)) {
190
+ if (state === "pristine" && hashFile(target) === hashFile(source)) {
196
191
  console.log(` ${relPath} (unchanged)`);
197
192
  unchanged.push(relPath);
198
193
  continue;
199
194
  }
195
+ mkdirSync(dirname(target), { recursive: true });
200
196
  copyFileSync(source, target);
201
197
  console.log(` ${relPath} (updated)`);
202
198
  refreshed.push(relPath);
203
199
  }
204
- return { refreshed, unchanged, modified, missing };
200
+ return { refreshed, unchanged, modified };
205
201
  }
206
202
  //# sourceMappingURL=copy-templates.js.map
package/dist/scaffold.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { execFileSync } from "node:child_process";
4
4
  import { appendAgentSpecs } from "./append-agent-specs.js";
5
5
  import { readBundledMarkdown } from "./bundled-scaffold.js";
6
- import { copyTemplates, getFrameworkSpecFiles, migrateLegacyItemLayout, overwriteFrameworkSpecFiles, refreshPristineSeeds, } from "./copy-templates.js";
6
+ import { copyTemplates, migrateLegacyItemLayout, overwriteFrameworkSpecFiles, refreshPristineSeeds, } from "./copy-templates.js";
7
7
  import { createSpecsStructure } from "./create-specs-structure.js";
8
8
  import { resolveBase } from "./resolve-base.js";
9
9
  function parseArgs(args) {
@@ -40,30 +40,12 @@ function assertCleanSpecsTree(basePath) {
40
40
  throw new Error("--update requires a clean specs/ working tree");
41
41
  }
42
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
43
  function readUpdateMergePrompt() {
61
44
  return readBundledMarkdown("update-merge-prompt.md");
62
45
  }
63
46
  function updateScaffoldTemplates() {
64
47
  const basePath = getGitRoot();
65
48
  assertCleanSpecsTree(basePath);
66
- assertFrameworkFilesTracked(basePath);
67
49
  const legacyReport = migrateLegacyItemLayout(basePath);
68
50
  overwriteFrameworkSpecFiles(basePath);
69
51
  const seedReport = refreshPristineSeeds(basePath);
@@ -91,7 +73,7 @@ function updateScaffoldTemplates() {
91
73
  }
92
74
  if (seedReport.refreshed.length > 0) {
93
75
  console.log("");
94
- console.log("Pristine seeds also refreshed (no prior customization detected):");
76
+ console.log("Seeds written from bundled templates (absent or pristine):");
95
77
  for (const relPath of seedReport.refreshed) {
96
78
  console.log(`- ${relPath}`);
97
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sublang/spex",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "The essential spec layer AI agents need to build software reliably",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",