@sublang/spex 0.3.0 → 1.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 +60 -17
- package/dist/append-agent-specs.d.ts +7 -1
- package/dist/append-agent-specs.js +7 -2
- package/dist/cli.js +7 -1
- package/dist/copy-templates.d.ts +19 -0
- package/dist/copy-templates.js +90 -7
- package/dist/create-specs-structure.js +2 -4
- package/dist/lint.d.ts +15 -0
- package/dist/lint.js +967 -0
- package/dist/markdown.d.ts +46 -0
- package/dist/markdown.js +130 -0
- package/dist/scaffold.js +87 -28
- package/package.json +15 -7
- package/scaffold/.file-history.json +26 -29
- package/scaffold/.legacy-file-history.json +48 -0
- package/scaffold/LICENSE +202 -0
- package/scaffold/agent-specs.txt +10 -2
- package/scaffold/i18n/zh/specs/map.md +14 -24
- package/scaffold/i18n/zh/specs/meta.md +110 -83
- package/scaffold/specs/decisions/000-spec-structure-format.md +41 -31
- package/scaffold/specs/intents/000-spdx-headers.md +39 -0
- package/scaffold/specs/map.md +14 -24
- package/scaffold/specs/meta.md +105 -78
- package/scaffold/specs/packages/git.md +46 -0
- package/scaffold/specs/packages/licensing.md +56 -0
- package/scaffold/update-merge-prompt.md +8 -1
- package/scaffold/specs/dev/git.md +0 -28
- package/scaffold/specs/dev/licensing.md +0 -44
- package/scaffold/specs/iterations/000-spdx-headers.md +0 -35
- package/scaffold/specs/test/licensing.md +0 -20
- package/scaffold/specs/user/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -32,19 +32,37 @@ spex scaffold
|
|
|
32
32
|
|
|
33
33
|
This creates:
|
|
34
34
|
|
|
35
|
-
- **`specs/`** —
|
|
36
|
-
specs,
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
- **`specs/`** — the spec tree and its law:
|
|
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
|
+
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 the tree and `specs/meta.md` is the spec of specs.
|
|
39
|
+
- Two starter packages (`git.md`, `licensing.md`) and a sample intent record seed the tree.
|
|
40
|
+
- **`LICENSE`** — the verbatim Apache-2.0 text at the target root, written only when no `LICENSE` exists there.
|
|
41
|
+
- **`CLAUDE.md` / `AGENTS.md`** — instructions that tell AI agents (Claude, Codex, etc.) to read and follow the specs before writing code.
|
|
39
42
|
|
|
40
|
-
See `specs/decisions/000-spec-structure-format.md` for the spec format and naming conventions.
|
|
43
|
+
See `specs/decisions/000-spec-structure-format.md` and `specs/meta.md` for the spec format and naming conventions.
|
|
41
44
|
|
|
42
|
-
Idempotency:
|
|
45
|
+
Idempotency: rerunning `scaffold` is safe — it only adds missing files.
|
|
46
|
+
The one in-place edit it makes is to an existing `CLAUDE.md`/`AGENTS.md`, whose managed `## Specs (Source of Truth)` section is added or refreshed.
|
|
47
|
+
(`--update` edits more, mechanically; see below.)
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
### Linting
|
|
50
|
+
|
|
51
|
+
Check the specs tree at any time:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
spex lint
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The linter validates the layout, package file sections and their order, item IDs — lowercase `<pack>-<N>` matching the file's basename, unique across the tree — citations (enclosed inline links like `[[pack-3](pack.md#pack-3)]` whose files and anchors exist), Verification items citing the behaviors they check, reference markers, record sections, and the `map.md` index.
|
|
58
|
+
Relationship-metadata lines like `Verifies:` are errors — the citations woven into an item's statement are the single source of its relationships.
|
|
59
|
+
Directories of previous spec generations (`specs/compositions/`, `specs/user/`, …) are errors pointing at the migration skill (see [Upgrading](#upgrading-from-a-previous-generation)).
|
|
60
|
+
Errors exit non-zero; warnings do not.
|
|
61
|
+
|
|
62
|
+
**Try it:** review the sample intent record `specs/intents/000-spdx-headers.md`, update the copyright text, then prompt your AI coding agent:
|
|
45
63
|
|
|
46
64
|
```text
|
|
47
|
-
Complete
|
|
65
|
+
Complete IR-000
|
|
48
66
|
```
|
|
49
67
|
|
|
50
68
|
### Localization
|
|
@@ -65,13 +83,38 @@ When a new release ships updated templates, refresh them with:
|
|
|
65
83
|
spex scaffold --update
|
|
66
84
|
```
|
|
67
85
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
86
|
+
It runs from within a git repository and requires a clean `specs/` working tree, so every edit stays reviewable.
|
|
87
|
+
|
|
88
|
+
- Spex-authoritative *framework* 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.
|
|
89
|
+
- Starter *seed* files (`map.md`, the sample intent record, the starter packages) 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.
|
|
90
|
+
- The managed specs section of an existing `CLAUDE.md`/`AGENTS.md` is refreshed; absent agent files are not created.
|
|
91
|
+
- Files you authored are never edited.
|
|
92
|
+
|
|
93
|
+
Review the changes with `git diff -- specs CLAUDE.md AGENTS.md` and run `spex lint`.
|
|
94
|
+
The command prints a per-file indicator for every framework and seed path, plus a copy-paste-ready prompt for your AI agent to reconcile citations and local extensions with the refreshed law.
|
|
95
|
+
|
|
96
|
+
## Upgrading from a previous generation
|
|
97
|
+
|
|
98
|
+
Spex 1.0 rewrote the spec convention — the law in `specs/meta.md` and the spec-format decision record.
|
|
99
|
+
A tree scaffolded by any spex 0.x release carries a previous generation of that law; a future rewrite would be a 2.0.
|
|
100
|
+
What changed:
|
|
101
|
+
|
|
102
|
+
| | Previous generations (spex 0.x) | Current generation (spex 1.0) |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| Layout | `specs/user`/`dev`/`test`, later `packages/` + `compositions/` | `packages/` only — composition is a package pattern |
|
|
105
|
+
| Cross-package behavior | binding and scenario items in composition files | ordinary packages citing peers' External Behavior |
|
|
106
|
+
| Item IDs | ALLCAPS short form (`AUTH-3`) | lowercase file basename (`github-login-3`) |
|
|
107
|
+
| Item citations | `[AUTH-3](auth.md#auth-3)` | enclosed: `[[github-login-3](github-login.md#github-login-3)]` |
|
|
108
|
+
| Intent records | Goal, Deliverables, Tasks, Acceptance criteria | Status, Intent, Deliverables, Tasks, Verification |
|
|
109
|
+
|
|
110
|
+
The CLI detects but does not restructure a legacy tree:
|
|
111
|
+
|
|
112
|
+
- `spex scaffold --update` still refreshes the spex-owned law files, leaves all legacy content untouched, and prints migration guidance when it recognizes a legacy generation.
|
|
113
|
+
- Plain `spex scaffold` refuses a tree with a legacy directory — it writes nothing and points at `--update` — so two generations never entangle.
|
|
114
|
+
- `spex lint` reports legacy directories as errors pointing the same way.
|
|
71
115
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
clear next steps and a copy-paste-ready prompt you can hand to your AI agent for that review.
|
|
116
|
+
The structural migration itself — items reclassify, compositions fold into packages, intents get rewritten — is judgment work done by an AI agent following the **spec-structure-migration** skill shipped in the spex repo, not by a script (the scripted migration of earlier releases is retired).
|
|
117
|
+
Follow the walkthrough in [docs/spec-migration.md](https://github.com/sublang-ai/spex/blob/main/docs/spec-migration.md), install the skill per [its README](https://github.com/sublang-ai/spex/blob/main/skills/spec-structure-migration/README.md), and let the agent loop until its checker and `spex lint` — the mechanical gate — pass clean.
|
|
75
118
|
|
|
76
119
|
## Workflow
|
|
77
120
|
|
|
@@ -79,10 +122,10 @@ Spex does *not* enforce a heavyweight workflow.
|
|
|
79
122
|
We believe spec-driven development is a flexible combination of a few primitives.
|
|
80
123
|
|
|
81
124
|
1. **Make Decisions** — Discuss requirements, architecture, and design with AI agents. Let AI generate and review decision records in `specs/decisions/`.
|
|
82
|
-
2. **
|
|
83
|
-
3. **Agents Execute** — Let AI agents complete the tasks autonomously. They generate code and update `specs/
|
|
125
|
+
2. **Record Intents** — Break down work into tasks with AI agents. Let AI generate and review intent records in `specs/intents/`.
|
|
126
|
+
3. **Agents Execute** — Let AI agents complete the tasks autonomously. They generate code and update `specs/packages/`.
|
|
84
127
|
|
|
85
|
-
Then loop back to the next decision or
|
|
128
|
+
Then loop back to the next decision or intent.
|
|
86
129
|
|
|
87
130
|
## Requirements
|
|
88
131
|
|
|
@@ -6,5 +6,11 @@
|
|
|
6
6
|
* exists, only that file is updated. Section replacement uses
|
|
7
7
|
* case-sensitive match on "## Specs (Source of Truth)".
|
|
8
8
|
* SCAF-5: replace in place or skip when identical.
|
|
9
|
+
*
|
|
10
|
+
* With `createMissing: false` (the --update flow), absent files stay
|
|
11
|
+
* absent; only existing agent files get their managed section
|
|
12
|
+
* refreshed.
|
|
9
13
|
*/
|
|
10
|
-
export declare function appendAgentSpecs(basePath: string
|
|
14
|
+
export declare function appendAgentSpecs(basePath: string, options?: {
|
|
15
|
+
createMissing?: boolean;
|
|
16
|
+
}): void;
|
|
@@ -75,8 +75,13 @@ function processFile(filePath, specsContent, fileExists, shouldCreate) {
|
|
|
75
75
|
* exists, only that file is updated. Section replacement uses
|
|
76
76
|
* case-sensitive match on "## Specs (Source of Truth)".
|
|
77
77
|
* SCAF-5: replace in place or skip when identical.
|
|
78
|
+
*
|
|
79
|
+
* With `createMissing: false` (the --update flow), absent files stay
|
|
80
|
+
* absent; only existing agent files get their managed section
|
|
81
|
+
* refreshed.
|
|
78
82
|
*/
|
|
79
|
-
export function appendAgentSpecs(basePath) {
|
|
83
|
+
export function appendAgentSpecs(basePath, options = {}) {
|
|
84
|
+
const createMissing = options.createMissing ?? true;
|
|
80
85
|
const scaffoldDir = getScaffoldDir();
|
|
81
86
|
const specsContent = readFileSync(join(scaffoldDir, "agent-specs.txt"), "utf-8");
|
|
82
87
|
const presence = AGENT_FILES.map((f) => existsSync(join(basePath, f)));
|
|
@@ -85,7 +90,7 @@ export function appendAgentSpecs(basePath) {
|
|
|
85
90
|
const fileName = AGENT_FILES[i];
|
|
86
91
|
const filePath = join(basePath, fileName);
|
|
87
92
|
const fileExists = presence[i];
|
|
88
|
-
const shouldCreate = neitherExists;
|
|
93
|
+
const shouldCreate = createMissing && neitherExists;
|
|
89
94
|
const result = processFile(filePath, specsContent, fileExists, shouldCreate);
|
|
90
95
|
switch (result) {
|
|
91
96
|
case "created":
|
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
4
|
+
import { lint } from "./lint.js";
|
|
4
5
|
import { scaffold } from "./scaffold.js";
|
|
5
6
|
const USAGE = `Usage: spex <command> [options]
|
|
6
7
|
|
|
7
8
|
Commands:
|
|
8
9
|
scaffold [--lang <code>] [<path>] Create specs directory structure
|
|
9
|
-
scaffold --update Refresh scaffold-provided specs templates
|
|
10
|
+
scaffold --update Refresh scaffold-provided specs templates
|
|
11
|
+
lint [<path>] Check the specs tree structure, item IDs,
|
|
12
|
+
and citations`;
|
|
10
13
|
function main() {
|
|
11
14
|
const args = process.argv.slice(2);
|
|
12
15
|
const command = args[0];
|
|
@@ -18,6 +21,9 @@ function main() {
|
|
|
18
21
|
case "scaffold":
|
|
19
22
|
scaffold(args.slice(1));
|
|
20
23
|
break;
|
|
24
|
+
case "lint":
|
|
25
|
+
lint(args.slice(1));
|
|
26
|
+
break;
|
|
21
27
|
default:
|
|
22
28
|
console.error(`Unknown command: ${command}\n`);
|
|
23
29
|
console.error(USAGE);
|
package/dist/copy-templates.d.ts
CHANGED
|
@@ -9,9 +9,16 @@ export type LegacyItemLayoutResult = {
|
|
|
9
9
|
type RefreshPristineSeedsOptions = {
|
|
10
10
|
migratedFrom?: ReadonlyMap<string, string>;
|
|
11
11
|
language?: ScaffoldLanguage;
|
|
12
|
+
/**
|
|
13
|
+
* Replacement indicator text for user-modified seeds that this run
|
|
14
|
+
* transformed in place (e.g. a restructured map.md), so one line
|
|
15
|
+
* reports the seed's true outcome.
|
|
16
|
+
*/
|
|
17
|
+
indicatorOverrides?: ReadonlyMap<string, string>;
|
|
12
18
|
};
|
|
13
19
|
export declare function isSupportedLanguage(code: string): code is ScaffoldLanguage;
|
|
14
20
|
export declare function formatSupportedLanguages(): string;
|
|
21
|
+
export declare function listFiles(dir: string): string[];
|
|
15
22
|
export declare function getBundledSpecFilePath(relPath: string, language?: ScaffoldLanguage): string;
|
|
16
23
|
/**
|
|
17
24
|
* Copy bundled template files from scaffold/specs/ to target specs/.
|
|
@@ -20,10 +27,22 @@ export declare function getBundledSpecFilePath(relPath: string, language?: Scaff
|
|
|
20
27
|
* SCAF-9: resolves scaffold/ from the dist/ output directory.
|
|
21
28
|
*/
|
|
22
29
|
export declare function copyTemplates(basePath: string, language?: ScaffoldLanguage): void;
|
|
30
|
+
/**
|
|
31
|
+
* Copy the bundled top-level LICENSE to the target repository root.
|
|
32
|
+
*
|
|
33
|
+
* SCAF-37: writes scaffold/LICENSE (verbatim Apache-2.0) to
|
|
34
|
+
* <basePath>/LICENSE only when the target is absent, so an existing
|
|
35
|
+
* downstream license is never overwritten. Not localized.
|
|
36
|
+
*/
|
|
37
|
+
export declare function copyRootLicense(basePath: string): void;
|
|
23
38
|
export declare function getFrameworkSpecFiles(): readonly string[];
|
|
24
39
|
export declare function getSeedSpecFiles(): readonly string[];
|
|
25
40
|
export declare function migrateLegacyItemLayout(basePath: string): LegacyItemLayoutResult[];
|
|
41
|
+
export declare function migrateIterationsLayout(basePath: string): LegacyItemLayoutResult[];
|
|
26
42
|
export declare function getFileHistory(relPath: string): string[];
|
|
43
|
+
export declare function getLegacyFileHistory(relPath: string): string[];
|
|
44
|
+
/** isPristine over the legacy manifest (removed bundled paths). */
|
|
45
|
+
export declare function isLegacyPristine(basePath: string, relPath: string): PristineState;
|
|
27
46
|
export declare function canonicalContentHash(data: Buffer): string;
|
|
28
47
|
export declare function isPristine(basePath: string, relPath: string, language?: ScaffoldLanguage): PristineState;
|
|
29
48
|
export declare function overwriteFrameworkSpecFiles(basePath: string, language?: ScaffoldLanguage): string[];
|
package/dist/copy-templates.js
CHANGED
|
@@ -12,11 +12,9 @@ const FRAMEWORK_FILES = [
|
|
|
12
12
|
];
|
|
13
13
|
const SEED_FILES = [
|
|
14
14
|
"specs/map.md",
|
|
15
|
-
"specs/
|
|
16
|
-
"specs/
|
|
17
|
-
"specs/
|
|
18
|
-
"specs/test/licensing.md",
|
|
19
|
-
"specs/user/.gitkeep",
|
|
15
|
+
"specs/intents/000-spdx-headers.md",
|
|
16
|
+
"specs/packages/git.md",
|
|
17
|
+
"specs/packages/licensing.md",
|
|
20
18
|
];
|
|
21
19
|
const LEGACY_ITEM_DIRS = [
|
|
22
20
|
["specs/items/user", "specs/user"],
|
|
@@ -35,7 +33,7 @@ function getOverlayRelPath(language, relPath) {
|
|
|
35
33
|
function getOverlayBase(scaffoldDir, language) {
|
|
36
34
|
return join(scaffoldDir, "i18n", language);
|
|
37
35
|
}
|
|
38
|
-
function listFiles(dir) {
|
|
36
|
+
export function listFiles(dir) {
|
|
39
37
|
const files = [];
|
|
40
38
|
for (const entry of readdirSync(dir)) {
|
|
41
39
|
if (entry === ".DS_Store")
|
|
@@ -95,6 +93,23 @@ export function copyTemplates(basePath, language = "en") {
|
|
|
95
93
|
console.log(` ${relPath}`);
|
|
96
94
|
}
|
|
97
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Copy the bundled top-level LICENSE to the target repository root.
|
|
98
|
+
*
|
|
99
|
+
* SCAF-37: writes scaffold/LICENSE (verbatim Apache-2.0) to
|
|
100
|
+
* <basePath>/LICENSE only when the target is absent, so an existing
|
|
101
|
+
* downstream license is never overwritten. Not localized.
|
|
102
|
+
*/
|
|
103
|
+
export function copyRootLicense(basePath) {
|
|
104
|
+
const source = join(getScaffoldDir(), "LICENSE");
|
|
105
|
+
const target = join(basePath, "LICENSE");
|
|
106
|
+
if (existsSync(target)) {
|
|
107
|
+
console.log(` LICENSE (already exists)`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
copyFileSync(source, target);
|
|
111
|
+
console.log(` LICENSE`);
|
|
112
|
+
}
|
|
98
113
|
// SCAF-13.
|
|
99
114
|
export function getFrameworkSpecFiles() {
|
|
100
115
|
return FRAMEWORK_FILES;
|
|
@@ -147,6 +162,55 @@ export function migrateLegacyItemLayout(basePath) {
|
|
|
147
162
|
removeEmptyDirectories(join(basePath, "specs", "items"));
|
|
148
163
|
return results;
|
|
149
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
|
+
}
|
|
150
214
|
// SCAF-21.
|
|
151
215
|
export function getFileHistory(relPath) {
|
|
152
216
|
const manifestPath = join(getScaffoldDir(), ".file-history.json");
|
|
@@ -156,6 +220,25 @@ export function getFileHistory(relPath) {
|
|
|
156
220
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
157
221
|
return manifest[relPath] ?? [];
|
|
158
222
|
}
|
|
223
|
+
// Hash histories of bundled files that no longer ship (the legacy
|
|
224
|
+
// user/dev/test seeds), so migration can tell an untouched old seed
|
|
225
|
+
// from user-authored content.
|
|
226
|
+
export function getLegacyFileHistory(relPath) {
|
|
227
|
+
const manifestPath = join(getScaffoldDir(), ".legacy-file-history.json");
|
|
228
|
+
if (!existsSync(manifestPath))
|
|
229
|
+
return [];
|
|
230
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
231
|
+
return manifest[relPath] ?? [];
|
|
232
|
+
}
|
|
233
|
+
/** isPristine over the legacy manifest (removed bundled paths). */
|
|
234
|
+
export function isLegacyPristine(basePath, relPath) {
|
|
235
|
+
const target = join(basePath, relPath);
|
|
236
|
+
if (!existsSync(target))
|
|
237
|
+
return "missing";
|
|
238
|
+
return getLegacyFileHistory(relPath).includes(hashFile(target))
|
|
239
|
+
? "pristine"
|
|
240
|
+
: "modified";
|
|
241
|
+
}
|
|
159
242
|
function getRecognizedFileHistory(relPath, language) {
|
|
160
243
|
const history = new Set(getFileHistory(relPath));
|
|
161
244
|
if (language !== "en") {
|
|
@@ -226,7 +309,7 @@ export function refreshPristineSeeds(basePath, options = {}) {
|
|
|
226
309
|
for (const relPath of SEED_FILES) {
|
|
227
310
|
const state = isPristine(basePath, relPath, language);
|
|
228
311
|
if (state === "modified") {
|
|
229
|
-
const indicator = formatSeedIndicator(relPath, "kept — user-modified", options.migratedFrom);
|
|
312
|
+
const indicator = formatSeedIndicator(relPath, options.indicatorOverrides?.get(relPath) ?? "kept — user-modified", options.migratedFrom);
|
|
230
313
|
console.log(` ${relPath} (${indicator})`);
|
|
231
314
|
continue;
|
|
232
315
|
}
|
|
@@ -8,10 +8,8 @@ import { join } from "node:path";
|
|
|
8
8
|
const DIRS = [
|
|
9
9
|
"specs",
|
|
10
10
|
"specs/decisions",
|
|
11
|
-
"specs/
|
|
12
|
-
"specs/
|
|
13
|
-
"specs/dev",
|
|
14
|
-
"specs/test",
|
|
11
|
+
"specs/intents",
|
|
12
|
+
"specs/packages",
|
|
15
13
|
];
|
|
16
14
|
/**
|
|
17
15
|
* Create the specs directory structure under basePath.
|
package/dist/lint.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type LintSeverity = "error" | "warning";
|
|
2
|
+
export type LintFinding = {
|
|
3
|
+
path: string;
|
|
4
|
+
line: number;
|
|
5
|
+
severity: LintSeverity;
|
|
6
|
+
rule: string;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
/** Lint the specs tree under basePath (lint-10). */
|
|
10
|
+
export declare function lintSpecs(basePath: string): LintFinding[];
|
|
11
|
+
/**
|
|
12
|
+
* Entry point for the lint subcommand. Prints findings and exits
|
|
13
|
+
* non-zero when any error-severity finding exists (lint-1..3).
|
|
14
|
+
*/
|
|
15
|
+
export declare function lint(args?: string[]): void;
|