speckeeper 0.7.2 → 0.8.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 +1 -1
- package/dist/cli.js +57 -46
- package/dist/cli.js.map +1 -1
- package/dist/config-api-Bh0zX8W7.d.ts +967 -0
- package/dist/dsl/index.d.ts +33 -2
- package/dist/dsl/index.js +190 -1
- package/dist/dsl/index.js.map +1 -1
- package/dist/index.d.ts +3 -504
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/model-BPZMYasZ.d.ts +0 -451
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
import { z, ZodType } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Export Context
|
|
5
|
+
* Context information passed to exporter functions
|
|
6
|
+
*/
|
|
7
|
+
interface ExportContext {
|
|
8
|
+
/** Access to all models (MetaModelRegistry type, using unknown to avoid circular references) */
|
|
9
|
+
registry: unknown;
|
|
10
|
+
/** Configuration (SpeckeeperConfig type, using unknown to avoid circular references) */
|
|
11
|
+
config: unknown;
|
|
12
|
+
/** Output base directory */
|
|
13
|
+
outputDir: string;
|
|
14
|
+
/** Current date/time */
|
|
15
|
+
generatedAt: Date;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Lint Context
|
|
19
|
+
* Context information passed to lint functions
|
|
20
|
+
*/
|
|
21
|
+
interface LintContext {
|
|
22
|
+
/** Access to all models (MetaModelRegistry type) */
|
|
23
|
+
registry: unknown;
|
|
24
|
+
/** Current phase */
|
|
25
|
+
phase?: 'REQ' | 'HLD' | 'LLD' | 'OPS';
|
|
26
|
+
/** Strict mode */
|
|
27
|
+
strict?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check Context
|
|
31
|
+
* Context information passed to external SSOT check functions
|
|
32
|
+
*/
|
|
33
|
+
interface CheckContext {
|
|
34
|
+
/** Access to all models (MetaModelRegistry type) */
|
|
35
|
+
registry: unknown;
|
|
36
|
+
/** External SSOT file path */
|
|
37
|
+
sourcePath: string;
|
|
38
|
+
/** Configuration (SpeckeeperConfig type) */
|
|
39
|
+
config: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Lint Issue
|
|
43
|
+
*/
|
|
44
|
+
interface LintIssue {
|
|
45
|
+
/** Issue message */
|
|
46
|
+
message: string;
|
|
47
|
+
/** Problematic field (optional) */
|
|
48
|
+
field?: string;
|
|
49
|
+
/** Fix suggestion (optional) */
|
|
50
|
+
suggestion?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check Result
|
|
54
|
+
*/
|
|
55
|
+
interface CheckResult$1 {
|
|
56
|
+
/** Whether successful */
|
|
57
|
+
success: boolean;
|
|
58
|
+
/** List of error messages */
|
|
59
|
+
errors: CheckError[];
|
|
60
|
+
/** List of warning messages */
|
|
61
|
+
warnings: CheckWarning[];
|
|
62
|
+
}
|
|
63
|
+
interface CheckError {
|
|
64
|
+
/** Error message */
|
|
65
|
+
message: string;
|
|
66
|
+
/** Target model ID */
|
|
67
|
+
modelId: string;
|
|
68
|
+
/** External SSOT reference */
|
|
69
|
+
externalRef?: string;
|
|
70
|
+
}
|
|
71
|
+
interface CheckWarning {
|
|
72
|
+
/** Warning message */
|
|
73
|
+
message: string;
|
|
74
|
+
/** Target model ID */
|
|
75
|
+
modelId: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Markdown Exporter
|
|
79
|
+
*/
|
|
80
|
+
interface MarkdownExporter<T> {
|
|
81
|
+
/** Single document generation */
|
|
82
|
+
single: (model: T, context: ExportContext) => string;
|
|
83
|
+
/** Index page generation (optional) */
|
|
84
|
+
index?: (models: T[], context: ExportContext) => string;
|
|
85
|
+
/** Output directory (relative path from docs/) */
|
|
86
|
+
outputDir: string;
|
|
87
|
+
/** Filename generation (default is model.id) */
|
|
88
|
+
filename?: (model: T) => string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Mermaid Diagram Exporter
|
|
92
|
+
*/
|
|
93
|
+
interface MermaidExporter<T> {
|
|
94
|
+
/** Diagram type */
|
|
95
|
+
diagramType: 'flowchart' | 'sequenceDiagram' | 'erDiagram' | 'stateDiagram' | 'C4Context' | 'C4Container' | 'C4Component' | 'custom';
|
|
96
|
+
/** Diagram generation function */
|
|
97
|
+
generate: (models: T[], context: ExportContext) => string;
|
|
98
|
+
/** Output file path (relative path from docs/) */
|
|
99
|
+
outputPath: string;
|
|
100
|
+
/** Diagram title */
|
|
101
|
+
title?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* JSON Schema Exporter Settings
|
|
105
|
+
*/
|
|
106
|
+
interface JsonSchemaExporter {
|
|
107
|
+
/** Enabled */
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
/** Output directory (relative path from specs/) */
|
|
110
|
+
outputDir: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Lint Rule
|
|
114
|
+
*/
|
|
115
|
+
interface LintRule$1<T> {
|
|
116
|
+
/** Rule ID */
|
|
117
|
+
id: string;
|
|
118
|
+
/** Rule description */
|
|
119
|
+
description: string;
|
|
120
|
+
/** Severity */
|
|
121
|
+
severity: 'error' | 'warning' | 'info';
|
|
122
|
+
/** Check function */
|
|
123
|
+
check: (model: T, context: LintContext) => LintIssue | null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* External SSOT Checker
|
|
127
|
+
*/
|
|
128
|
+
interface ExternalChecker$1<T> {
|
|
129
|
+
/** External SSOT type to check */
|
|
130
|
+
targetType: 'openapi' | 'ddl' | 'iac' | 'custom';
|
|
131
|
+
/** Execute check */
|
|
132
|
+
check: (model: T, externalSource: unknown, context: CheckContext) => CheckResult$1;
|
|
133
|
+
/** Get external SSOT file path (from model) */
|
|
134
|
+
getSourcePath?: (model: T) => string | undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Inter-model Reference Definition (for traceability)
|
|
138
|
+
*/
|
|
139
|
+
interface ReferenceDefinition {
|
|
140
|
+
/** Field name with reference */
|
|
141
|
+
field: string;
|
|
142
|
+
/** Referenced model ID */
|
|
143
|
+
targetModel: string;
|
|
144
|
+
/** Whether reference is required */
|
|
145
|
+
required?: boolean;
|
|
146
|
+
/** Whether reference is array */
|
|
147
|
+
isArray?: boolean;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Model Definition
|
|
151
|
+
* Interface for users to define new entities
|
|
152
|
+
*/
|
|
153
|
+
interface ModelDefinition<T extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
154
|
+
/** Model unique identifier (kebab-case recommended) */
|
|
155
|
+
id: string;
|
|
156
|
+
/** Model name (PascalCase recommended) */
|
|
157
|
+
name: string;
|
|
158
|
+
/** Model description */
|
|
159
|
+
description: string;
|
|
160
|
+
/** Zod Schema */
|
|
161
|
+
schema: T;
|
|
162
|
+
/** ID prefix for generation */
|
|
163
|
+
idPrefix: string;
|
|
164
|
+
/** Exporter settings */
|
|
165
|
+
exporters?: {
|
|
166
|
+
/** Markdown exporter */
|
|
167
|
+
markdown?: MarkdownExporter<z.infer<T>>;
|
|
168
|
+
/** Mermaid diagram exporter (multiple allowed) */
|
|
169
|
+
mermaid?: MermaidExporter<z.infer<T>> | MermaidExporter<z.infer<T>>[];
|
|
170
|
+
/** JSON Schema exporter */
|
|
171
|
+
jsonSchema?: JsonSchemaExporter;
|
|
172
|
+
};
|
|
173
|
+
/** Lint rules */
|
|
174
|
+
lintRules?: LintRule$1<z.infer<T>>[];
|
|
175
|
+
/** External SSOT checker */
|
|
176
|
+
externalChecker?: ExternalChecker$1<z.infer<T>>;
|
|
177
|
+
/** Reference definitions (for traceability) */
|
|
178
|
+
references?: ReferenceDefinition[];
|
|
179
|
+
/** DSL function name (the Xxx part of defineXxx) */
|
|
180
|
+
dslName?: string;
|
|
181
|
+
/** Phase (the phase where this model is primarily used) */
|
|
182
|
+
phase?: 'REQ' | 'HLD' | 'LLD' | 'OPS';
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Meta Model Registry
|
|
186
|
+
* Manages registered model definitions and model instances
|
|
187
|
+
*/
|
|
188
|
+
interface MetaModelRegistry {
|
|
189
|
+
/** Registered model definitions */
|
|
190
|
+
definitions: Map<string, ModelDefinition>;
|
|
191
|
+
/** Model instances (Map<instanceId, instance> for each model ID) */
|
|
192
|
+
instances: Map<string, Map<string, unknown>>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Additional settings for meta model
|
|
196
|
+
*/
|
|
197
|
+
interface MetaModelConfig {
|
|
198
|
+
/** Custom model definitions */
|
|
199
|
+
models?: ModelDefinition[];
|
|
200
|
+
/** External SSOT settings */
|
|
201
|
+
externalSsot?: {
|
|
202
|
+
openapi?: {
|
|
203
|
+
enabled: boolean;
|
|
204
|
+
paths: string[];
|
|
205
|
+
};
|
|
206
|
+
ddl?: {
|
|
207
|
+
enabled: boolean;
|
|
208
|
+
type: 'ddl' | 'prisma' | 'typeorm' | 'drizzle';
|
|
209
|
+
path: string;
|
|
210
|
+
};
|
|
211
|
+
iac?: {
|
|
212
|
+
enabled: boolean;
|
|
213
|
+
type: 'cloudformation' | 'cdk' | 'terraform';
|
|
214
|
+
path: string;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Base type for model instances
|
|
220
|
+
* All model instances have an id
|
|
221
|
+
*/
|
|
222
|
+
interface BaseModelInstance {
|
|
223
|
+
id: string;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Helper type for creating type-safe model definitions
|
|
227
|
+
*/
|
|
228
|
+
type InferModelType<T extends ModelDefinition> = z.infer<T['schema']>;
|
|
229
|
+
declare const ReferenceDefinitionSchema: z.ZodObject<{
|
|
230
|
+
field: z.ZodString;
|
|
231
|
+
targetModel: z.ZodString;
|
|
232
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
isArray: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
field: string;
|
|
236
|
+
targetModel: string;
|
|
237
|
+
required?: boolean | undefined;
|
|
238
|
+
isArray?: boolean | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
field: string;
|
|
241
|
+
targetModel: string;
|
|
242
|
+
required?: boolean | undefined;
|
|
243
|
+
isArray?: boolean | undefined;
|
|
244
|
+
}>;
|
|
245
|
+
declare const LintIssueSchema: z.ZodObject<{
|
|
246
|
+
message: z.ZodString;
|
|
247
|
+
field: z.ZodOptional<z.ZodString>;
|
|
248
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
249
|
+
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
message: string;
|
|
251
|
+
field?: string | undefined;
|
|
252
|
+
suggestion?: string | undefined;
|
|
253
|
+
}, {
|
|
254
|
+
message: string;
|
|
255
|
+
field?: string | undefined;
|
|
256
|
+
suggestion?: string | undefined;
|
|
257
|
+
}>;
|
|
258
|
+
declare const CheckErrorSchema: z.ZodObject<{
|
|
259
|
+
message: z.ZodString;
|
|
260
|
+
modelId: z.ZodString;
|
|
261
|
+
externalRef: z.ZodOptional<z.ZodString>;
|
|
262
|
+
}, "strip", z.ZodTypeAny, {
|
|
263
|
+
message: string;
|
|
264
|
+
modelId: string;
|
|
265
|
+
externalRef?: string | undefined;
|
|
266
|
+
}, {
|
|
267
|
+
message: string;
|
|
268
|
+
modelId: string;
|
|
269
|
+
externalRef?: string | undefined;
|
|
270
|
+
}>;
|
|
271
|
+
declare const CheckWarningSchema: z.ZodObject<{
|
|
272
|
+
message: z.ZodString;
|
|
273
|
+
modelId: z.ZodString;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
message: string;
|
|
276
|
+
modelId: string;
|
|
277
|
+
}, {
|
|
278
|
+
message: string;
|
|
279
|
+
modelId: string;
|
|
280
|
+
}>;
|
|
281
|
+
declare const CheckResultSchema: z.ZodObject<{
|
|
282
|
+
success: z.ZodBoolean;
|
|
283
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
284
|
+
message: z.ZodString;
|
|
285
|
+
modelId: z.ZodString;
|
|
286
|
+
externalRef: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, "strip", z.ZodTypeAny, {
|
|
288
|
+
message: string;
|
|
289
|
+
modelId: string;
|
|
290
|
+
externalRef?: string | undefined;
|
|
291
|
+
}, {
|
|
292
|
+
message: string;
|
|
293
|
+
modelId: string;
|
|
294
|
+
externalRef?: string | undefined;
|
|
295
|
+
}>, "many">;
|
|
296
|
+
warnings: z.ZodArray<z.ZodObject<{
|
|
297
|
+
message: z.ZodString;
|
|
298
|
+
modelId: z.ZodString;
|
|
299
|
+
}, "strip", z.ZodTypeAny, {
|
|
300
|
+
message: string;
|
|
301
|
+
modelId: string;
|
|
302
|
+
}, {
|
|
303
|
+
message: string;
|
|
304
|
+
modelId: string;
|
|
305
|
+
}>, "many">;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
success: boolean;
|
|
308
|
+
errors: {
|
|
309
|
+
message: string;
|
|
310
|
+
modelId: string;
|
|
311
|
+
externalRef?: string | undefined;
|
|
312
|
+
}[];
|
|
313
|
+
warnings: {
|
|
314
|
+
message: string;
|
|
315
|
+
modelId: string;
|
|
316
|
+
}[];
|
|
317
|
+
}, {
|
|
318
|
+
success: boolean;
|
|
319
|
+
errors: {
|
|
320
|
+
message: string;
|
|
321
|
+
modelId: string;
|
|
322
|
+
externalRef?: string | undefined;
|
|
323
|
+
}[];
|
|
324
|
+
warnings: {
|
|
325
|
+
message: string;
|
|
326
|
+
modelId: string;
|
|
327
|
+
}[];
|
|
328
|
+
}>;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Definition and validation of model relations
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Model abstraction level
|
|
336
|
+
*
|
|
337
|
+
* - L0: Business + Domain Analysis (Why / Problem space)
|
|
338
|
+
* Desired outcomes/value, business flows, actors, terminology, business rules
|
|
339
|
+
* - L1: Requirements (What)
|
|
340
|
+
* Functional/non-functional requirements, constraints, acceptance criteria
|
|
341
|
+
* - L2: Design (How / Direction)
|
|
342
|
+
* Architecture, component breakdown, domain model, key sequences
|
|
343
|
+
* - L3: Detailed Design/Implementation (How to build / Concrete artifacts)
|
|
344
|
+
* Screen/API/DB definitions, external SSOT references
|
|
345
|
+
*/
|
|
346
|
+
type ModelLevel = 'L0' | 'L1' | 'L2' | 'L3';
|
|
347
|
+
/**
|
|
348
|
+
* Get numeric index of level
|
|
349
|
+
*/
|
|
350
|
+
declare function getLevelIndex(level: ModelLevel): number;
|
|
351
|
+
/**
|
|
352
|
+
* Relation types
|
|
353
|
+
*/
|
|
354
|
+
declare const RELATION_TYPES: readonly ["dependsOn", "uses", "includes", "implements", "refines", "verifies", "verifiedBy", "satisfies", "traces", "relatedTo"];
|
|
355
|
+
type RelationType = typeof RELATION_TYPES[number];
|
|
356
|
+
/**
|
|
357
|
+
* Relation schema
|
|
358
|
+
*/
|
|
359
|
+
declare const RelationSchema: z.ZodObject<{
|
|
360
|
+
/** Relation type */
|
|
361
|
+
type: z.ZodEnum<["dependsOn", "uses", "includes", "implements", "refines", "verifies", "verifiedBy", "satisfies", "traces", "relatedTo"]>;
|
|
362
|
+
/** Target ID */
|
|
363
|
+
target: z.ZodString;
|
|
364
|
+
/** Description (optional) */
|
|
365
|
+
description: z.ZodOptional<z.ZodString>;
|
|
366
|
+
}, "strip", z.ZodTypeAny, {
|
|
367
|
+
type: "includes" | "dependsOn" | "uses" | "implements" | "refines" | "verifies" | "verifiedBy" | "satisfies" | "traces" | "relatedTo";
|
|
368
|
+
target: string;
|
|
369
|
+
description?: string | undefined;
|
|
370
|
+
}, {
|
|
371
|
+
type: "includes" | "dependsOn" | "uses" | "implements" | "refines" | "verifies" | "verifiedBy" | "satisfies" | "traces" | "relatedTo";
|
|
372
|
+
target: string;
|
|
373
|
+
description?: string | undefined;
|
|
374
|
+
}>;
|
|
375
|
+
/**
|
|
376
|
+
* Relation field to add to model schemas
|
|
377
|
+
* Usage: schema.extend({ relations: RelationsFieldSchema })
|
|
378
|
+
*/
|
|
379
|
+
declare const RelationsFieldSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
380
|
+
/** Relation type */
|
|
381
|
+
type: z.ZodEnum<["dependsOn", "uses", "includes", "implements", "refines", "verifies", "verifiedBy", "satisfies", "traces", "relatedTo"]>;
|
|
382
|
+
/** Target ID */
|
|
383
|
+
target: z.ZodString;
|
|
384
|
+
/** Description (optional) */
|
|
385
|
+
description: z.ZodOptional<z.ZodString>;
|
|
386
|
+
}, "strip", z.ZodTypeAny, {
|
|
387
|
+
type: "includes" | "dependsOn" | "uses" | "implements" | "refines" | "verifies" | "verifiedBy" | "satisfies" | "traces" | "relatedTo";
|
|
388
|
+
target: string;
|
|
389
|
+
description?: string | undefined;
|
|
390
|
+
}, {
|
|
391
|
+
type: "includes" | "dependsOn" | "uses" | "implements" | "refines" | "verifies" | "verifiedBy" | "satisfies" | "traces" | "relatedTo";
|
|
392
|
+
target: string;
|
|
393
|
+
description?: string | undefined;
|
|
394
|
+
}>, "many">>;
|
|
395
|
+
type Relation = z.infer<typeof RelationSchema>;
|
|
396
|
+
/**
|
|
397
|
+
* Definition of relation constraints
|
|
398
|
+
*/
|
|
399
|
+
interface RelationConstraint {
|
|
400
|
+
/** Allowed target levels (all levels allowed if not specified) */
|
|
401
|
+
allowedTargetLevels?: ModelLevel[];
|
|
402
|
+
/** Level constraint rule */
|
|
403
|
+
levelRule: 'source>target' | 'source>=target' | 'same' | 'any';
|
|
404
|
+
/** Direction of impact propagation */
|
|
405
|
+
propagation: 'forward' | 'backward' | 'both';
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Constraint definitions per relation type
|
|
409
|
+
*
|
|
410
|
+
* Level hierarchy:
|
|
411
|
+
* L0 (Business) → L1 (Requirements) → L2 (Design) → L3 (Implementation)
|
|
412
|
+
* Abstract ───────────────────────────→ Concrete
|
|
413
|
+
*/
|
|
414
|
+
declare const RELATION_CONSTRAINTS: Record<RelationType, RelationConstraint>;
|
|
415
|
+
/**
|
|
416
|
+
* Relation validation error
|
|
417
|
+
*/
|
|
418
|
+
interface RelationValidationError {
|
|
419
|
+
type: 'level_violation' | 'target_level_violation' | 'self_reference' | 'cycle_detected';
|
|
420
|
+
message: string;
|
|
421
|
+
relation: Relation;
|
|
422
|
+
sourceId: string;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Validate level constraint for single relation
|
|
426
|
+
*
|
|
427
|
+
* @param sourceLevel - Source model level (set in _models/)
|
|
428
|
+
* @param sourceSpecId - Source spec ID
|
|
429
|
+
* @param relation - Relation
|
|
430
|
+
* @param targetLevel - Target model level
|
|
431
|
+
*/
|
|
432
|
+
declare function validateRelationLevel(sourceLevel: ModelLevel | undefined, sourceSpecId: string, relation: Relation, targetLevel: ModelLevel | undefined): RelationValidationError | null;
|
|
433
|
+
/**
|
|
434
|
+
* Detect circular references
|
|
435
|
+
*/
|
|
436
|
+
declare function detectCycles(relations: Array<{
|
|
437
|
+
sourceId: string;
|
|
438
|
+
targetId: string;
|
|
439
|
+
type: RelationType;
|
|
440
|
+
}>): RelationValidationError[];
|
|
441
|
+
/**
|
|
442
|
+
* Infer model ID from spec ID (prefix-based)
|
|
443
|
+
*/
|
|
444
|
+
declare function inferModelIdFromSpecId(specId: string): string | undefined;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Model base class
|
|
448
|
+
*
|
|
449
|
+
* All model definitions inherit from this class
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Lint rule definition
|
|
454
|
+
*/
|
|
455
|
+
interface LintRule<T> {
|
|
456
|
+
id: string;
|
|
457
|
+
severity: 'error' | 'warning' | 'info';
|
|
458
|
+
message: string;
|
|
459
|
+
check: (spec: T) => boolean;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Lint result
|
|
463
|
+
*/
|
|
464
|
+
interface LintResult {
|
|
465
|
+
ruleId: string;
|
|
466
|
+
severity: 'error' | 'warning' | 'info';
|
|
467
|
+
message: string;
|
|
468
|
+
specId?: string;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Exporter definition
|
|
472
|
+
*/
|
|
473
|
+
interface Exporter<T> {
|
|
474
|
+
format: 'markdown' | 'json' | 'mermaid';
|
|
475
|
+
single?: (spec: T) => string;
|
|
476
|
+
index?: (specs: T[]) => string;
|
|
477
|
+
outputDir?: string;
|
|
478
|
+
filename?: (spec: T) => string;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* External checker definition
|
|
482
|
+
*/
|
|
483
|
+
interface ExternalChecker<T> {
|
|
484
|
+
targetType: string;
|
|
485
|
+
sourcePath: (spec: T) => string;
|
|
486
|
+
check: (spec: T, externalData: unknown) => CheckResult;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Check result
|
|
490
|
+
*/
|
|
491
|
+
interface CheckResult {
|
|
492
|
+
success: boolean;
|
|
493
|
+
errors: {
|
|
494
|
+
message: string;
|
|
495
|
+
field?: string;
|
|
496
|
+
specId?: string;
|
|
497
|
+
}[];
|
|
498
|
+
warnings: {
|
|
499
|
+
message: string;
|
|
500
|
+
field?: string;
|
|
501
|
+
specId?: string;
|
|
502
|
+
}[];
|
|
503
|
+
/** Files where annotations matching this spec were found */
|
|
504
|
+
matchedFiles?: Array<{
|
|
505
|
+
specId: string;
|
|
506
|
+
filePath: string;
|
|
507
|
+
line: number;
|
|
508
|
+
relationType: 'verifiedBy' | 'implements' | 'traces';
|
|
509
|
+
}>;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Coverage result
|
|
513
|
+
*/
|
|
514
|
+
interface CoverageResult {
|
|
515
|
+
/** Total target count */
|
|
516
|
+
total: number;
|
|
517
|
+
/** Covered count */
|
|
518
|
+
covered: number;
|
|
519
|
+
/** Uncovered count */
|
|
520
|
+
uncovered: number;
|
|
521
|
+
/** Coverage rate (%) */
|
|
522
|
+
coveragePercent: number;
|
|
523
|
+
/** Details of covered items */
|
|
524
|
+
coveredItems: {
|
|
525
|
+
id: string;
|
|
526
|
+
description?: string;
|
|
527
|
+
}[];
|
|
528
|
+
/** Details of uncovered items */
|
|
529
|
+
uncoveredItems: {
|
|
530
|
+
id: string;
|
|
531
|
+
description?: string;
|
|
532
|
+
sourceId?: string;
|
|
533
|
+
}[];
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Coverage checker definition
|
|
537
|
+
*
|
|
538
|
+
* Verify cross-model consistency (coverage).
|
|
539
|
+
* Example: Whether TestRef covers acceptanceCriteria of Requirement
|
|
540
|
+
*/
|
|
541
|
+
interface CoverageChecker<T> {
|
|
542
|
+
/** Target model ID for coverage (e.g. 'requirement') */
|
|
543
|
+
targetModel: string;
|
|
544
|
+
/** Description of coverage check */
|
|
545
|
+
description: string;
|
|
546
|
+
/** Execute coverage check */
|
|
547
|
+
check: (specs: T[], registry: Record<string, Map<string, unknown>>) => CoverageResult;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Render context
|
|
551
|
+
* Simplified version compatible with embedoc's EmbedContext
|
|
552
|
+
*/
|
|
553
|
+
interface RenderContext {
|
|
554
|
+
/** Parameters (filter conditions other than format, etc.) */
|
|
555
|
+
params: Record<string, string | undefined>;
|
|
556
|
+
/** Markdown helpers */
|
|
557
|
+
markdown: {
|
|
558
|
+
/** Generate table */
|
|
559
|
+
table: (headers: string[], rows: (string | unknown)[][]) => string;
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Renderer definition
|
|
564
|
+
*
|
|
565
|
+
* Model-specific rendering called from embeds
|
|
566
|
+
*/
|
|
567
|
+
interface Renderer<T> {
|
|
568
|
+
/** Format ID ('table', 'list', 'detail', 'spec-chapter', etc.) */
|
|
569
|
+
format: string;
|
|
570
|
+
/** Rendering process */
|
|
571
|
+
render: (specs: T[], ctx: RenderContext) => string;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Model base class
|
|
575
|
+
*
|
|
576
|
+
* @template TSchema - Zod schema type
|
|
577
|
+
*/
|
|
578
|
+
declare abstract class Model<TSchema extends ZodType> {
|
|
579
|
+
/** Singleton instance storage (per subclass) */
|
|
580
|
+
private static _instances;
|
|
581
|
+
/**
|
|
582
|
+
* Get singleton instance of the model
|
|
583
|
+
* Usage: RequirementModel.instance
|
|
584
|
+
*/
|
|
585
|
+
static get instance(): Model<ZodType>;
|
|
586
|
+
/** Model ID ('requirement', 'usecase', etc.) */
|
|
587
|
+
abstract readonly id: string;
|
|
588
|
+
/** Model name ('Requirement', 'UseCase', etc.) */
|
|
589
|
+
abstract readonly name: string;
|
|
590
|
+
/** ID prefix ('REQ', 'UC', etc.) */
|
|
591
|
+
abstract readonly idPrefix: string;
|
|
592
|
+
/** Zod schema */
|
|
593
|
+
abstract readonly schema: TSchema;
|
|
594
|
+
/** Model description (optional) */
|
|
595
|
+
readonly description?: string;
|
|
596
|
+
/** External SSOT type (optional, e.g. 'OpenAPI', 'DDL/Prisma') */
|
|
597
|
+
readonly externalSsotType?: string;
|
|
598
|
+
/** Spec instance type */
|
|
599
|
+
protected get specType(): z.infer<TSchema>;
|
|
600
|
+
/** Lint rules (override in subclass) */
|
|
601
|
+
protected lintRules: LintRule<z.infer<TSchema>>[];
|
|
602
|
+
/** Exporters (override in subclass) */
|
|
603
|
+
protected exporters: Exporter<z.infer<TSchema>>[];
|
|
604
|
+
/** External checker (optional) */
|
|
605
|
+
protected externalChecker?: ExternalChecker<z.infer<TSchema>>;
|
|
606
|
+
/** Coverage checker (optional) */
|
|
607
|
+
protected coverageChecker?: CoverageChecker<z.infer<TSchema>>;
|
|
608
|
+
/** Model level (set in _models/) */
|
|
609
|
+
protected modelLevel?: ModelLevel;
|
|
610
|
+
/** Renderers (for embeds, override in subclass) */
|
|
611
|
+
protected renderers: Renderer<z.infer<TSchema>>[];
|
|
612
|
+
/**
|
|
613
|
+
* Get model level
|
|
614
|
+
* Returns modelLevel set in _models/
|
|
615
|
+
*/
|
|
616
|
+
get level(): ModelLevel | undefined;
|
|
617
|
+
/**
|
|
618
|
+
* Execute schema validation
|
|
619
|
+
*/
|
|
620
|
+
validate(spec: unknown): z.infer<TSchema>;
|
|
621
|
+
/**
|
|
622
|
+
* Schema validation (safe version, returns error object on failure)
|
|
623
|
+
*/
|
|
624
|
+
safeParse(spec: unknown): {
|
|
625
|
+
success: true;
|
|
626
|
+
data: z.infer<TSchema>;
|
|
627
|
+
} | {
|
|
628
|
+
success: false;
|
|
629
|
+
error: z.ZodError;
|
|
630
|
+
};
|
|
631
|
+
/**
|
|
632
|
+
* Execute lint
|
|
633
|
+
*/
|
|
634
|
+
lint(spec: z.infer<TSchema>): LintResult[];
|
|
635
|
+
/**
|
|
636
|
+
* Execute lint for multiple specs
|
|
637
|
+
*/
|
|
638
|
+
lintAll(specs: z.infer<TSchema>[]): LintResult[];
|
|
639
|
+
/**
|
|
640
|
+
* Validate level constraints of relations
|
|
641
|
+
* @param spec - Spec instance (if it has relations property)
|
|
642
|
+
* @returns Array of validation errors
|
|
643
|
+
*/
|
|
644
|
+
validateRelations(spec: z.infer<TSchema>): RelationValidationError[];
|
|
645
|
+
/**
|
|
646
|
+
* Validate relations of multiple specs (including circular reference check)
|
|
647
|
+
*/
|
|
648
|
+
validateAllRelations(specs: z.infer<TSchema>[]): RelationValidationError[];
|
|
649
|
+
/**
|
|
650
|
+
* Export in specified format (single spec)
|
|
651
|
+
*/
|
|
652
|
+
exportSingle(spec: z.infer<TSchema>, format: string): string | null;
|
|
653
|
+
/**
|
|
654
|
+
* Export in specified format (index)
|
|
655
|
+
*/
|
|
656
|
+
exportIndex(specs: z.infer<TSchema>[], format: string): string | null;
|
|
657
|
+
/**
|
|
658
|
+
* Get exporter output directory
|
|
659
|
+
*/
|
|
660
|
+
getOutputDir(format: string): string | null;
|
|
661
|
+
/**
|
|
662
|
+
* Get filename
|
|
663
|
+
*/
|
|
664
|
+
getFilename(spec: z.infer<TSchema>, format: string): string | null;
|
|
665
|
+
/**
|
|
666
|
+
* Check consistency with external SSOT
|
|
667
|
+
*/
|
|
668
|
+
check(spec: z.infer<TSchema>, externalData: unknown): CheckResult;
|
|
669
|
+
/**
|
|
670
|
+
* Get external SSOT path
|
|
671
|
+
*/
|
|
672
|
+
getExternalSourcePath(spec: z.infer<TSchema>): string | null;
|
|
673
|
+
/**
|
|
674
|
+
* Execute coverage check
|
|
675
|
+
* @param specs - Array of spec instances for this model
|
|
676
|
+
* @param registry - Registry of all models
|
|
677
|
+
*/
|
|
678
|
+
checkCoverage(specs: z.infer<TSchema>[], registry: Record<string, Map<string, unknown>>): CoverageResult | null;
|
|
679
|
+
/**
|
|
680
|
+
* Get coverage checker
|
|
681
|
+
*/
|
|
682
|
+
getCoverageChecker(): CoverageChecker<z.infer<TSchema>> | undefined;
|
|
683
|
+
/**
|
|
684
|
+
* Get lint rules
|
|
685
|
+
*/
|
|
686
|
+
getLintRules(): LintRule<z.infer<TSchema>>[];
|
|
687
|
+
/**
|
|
688
|
+
* Get exporters
|
|
689
|
+
*/
|
|
690
|
+
getExporters(): Exporter<z.infer<TSchema>>[];
|
|
691
|
+
/**
|
|
692
|
+
* Render in specified format
|
|
693
|
+
* @param format - Format ID ('table', 'list', 'detail', etc.)
|
|
694
|
+
* @param specs - Array of specs to render
|
|
695
|
+
* @param ctx - Render context
|
|
696
|
+
* @returns Rendered result (Markdown string), null if no matching renderer
|
|
697
|
+
*/
|
|
698
|
+
render(format: string, specs: z.infer<TSchema>[], ctx: RenderContext): string | null;
|
|
699
|
+
/**
|
|
700
|
+
* Get list of available formats
|
|
701
|
+
*/
|
|
702
|
+
getAvailableFormats(): string[];
|
|
703
|
+
/**
|
|
704
|
+
* Get renderers
|
|
705
|
+
*/
|
|
706
|
+
getRenderers(): Renderer<z.infer<TSchema>>[];
|
|
707
|
+
/**
|
|
708
|
+
* Check if renderer exists for specific format
|
|
709
|
+
*/
|
|
710
|
+
hasRenderer(format: string): boolean;
|
|
711
|
+
/**
|
|
712
|
+
* Register spec instances for this model.
|
|
713
|
+
* Stores specs in the global specStore keyed by this model's id.
|
|
714
|
+
*/
|
|
715
|
+
register(specs: z.infer<TSchema>[]): void;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* A single (Model, data[]) pair.
|
|
719
|
+
* Uses structural typing (not nominal Model<any>) so that
|
|
720
|
+
* compiled dist/ Model instances are compatible with src/ types.
|
|
721
|
+
*/
|
|
722
|
+
interface SpecEntry {
|
|
723
|
+
model: {
|
|
724
|
+
id: string;
|
|
725
|
+
register: (data: unknown[]) => void;
|
|
726
|
+
};
|
|
727
|
+
data: unknown[];
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Common export interface for spec data files.
|
|
731
|
+
* Each spec file exports a SpecModule via defineSpecs().
|
|
732
|
+
*/
|
|
733
|
+
interface SpecModule {
|
|
734
|
+
entries: SpecEntry[];
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Aggregated result from mergeSpecs().
|
|
738
|
+
*/
|
|
739
|
+
interface MergedDesign {
|
|
740
|
+
models: SpecEntry['model'][];
|
|
741
|
+
specs: SpecEntry[];
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Define spec data in a spec file. Returns a SpecModule.
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```typescript
|
|
748
|
+
* export default defineSpecs(
|
|
749
|
+
* [FunctionalRequirementModel.instance, functionalRequirements],
|
|
750
|
+
* [NonFunctionalRequirementModel.instance, nonFunctionalRequirements],
|
|
751
|
+
* );
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
declare function defineSpecs(...entries: [SpecEntry['model'], unknown[]][]): SpecModule;
|
|
755
|
+
/**
|
|
756
|
+
* Merge multiple SpecModules into a single MergedDesign.
|
|
757
|
+
* Models are deduplicated by model.id.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```typescript
|
|
761
|
+
* // design/index.ts
|
|
762
|
+
* export default mergeSpecs(requirements, usecases, glossary);
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
declare function mergeSpecs(...modules: SpecModule[]): MergedDesign;
|
|
766
|
+
/**
|
|
767
|
+
* Build a registry (modelId -> Map<specId, spec>) from config.specs.
|
|
768
|
+
* Pure function — no global state.
|
|
769
|
+
*/
|
|
770
|
+
declare function buildRegistryFromConfig(specs: SpecEntry[] | undefined): Record<string, Map<string, unknown>>;
|
|
771
|
+
/**
|
|
772
|
+
* Get specs for a model ID from config.specs.
|
|
773
|
+
* Pure function — no global state.
|
|
774
|
+
*/
|
|
775
|
+
declare function getSpecsFromConfig(specs: SpecEntry[] | undefined, modelId: string): unknown[];
|
|
776
|
+
/**
|
|
777
|
+
* Find which model type a spec ID belongs to, from config.specs.
|
|
778
|
+
* Pure function — no global state.
|
|
779
|
+
*/
|
|
780
|
+
declare function findModelTypeFromConfig(specs: SpecEntry[] | undefined, specId: string): string | null;
|
|
781
|
+
|
|
782
|
+
/** Artifact scan configuration */
|
|
783
|
+
interface ArtifactConfig {
|
|
784
|
+
/** File path glob patterns to scan */
|
|
785
|
+
globs: string[];
|
|
786
|
+
/** Exclusion patterns */
|
|
787
|
+
exclude?: string[];
|
|
788
|
+
/** Content search patterns (RegExp). First capture group = spec IDs (comma or space separated) */
|
|
789
|
+
contentPatterns?: RegExp[];
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* speckeeper configuration type
|
|
793
|
+
*/
|
|
794
|
+
interface SpeckeeperConfigInput {
|
|
795
|
+
/** Project name */
|
|
796
|
+
projectName?: string;
|
|
797
|
+
/** Project version */
|
|
798
|
+
version?: string;
|
|
799
|
+
/** Design files directory */
|
|
800
|
+
designDir?: string;
|
|
801
|
+
/** Docs output directory */
|
|
802
|
+
docsDir?: string;
|
|
803
|
+
/** Specs output directory */
|
|
804
|
+
specsDir?: string;
|
|
805
|
+
/** Custom model definitions (Model instances or ModelDefinition objects) */
|
|
806
|
+
models?: any[];
|
|
807
|
+
/** Spec data entries from design/index.ts via mergeSpecs() */
|
|
808
|
+
specs?: SpecEntry[];
|
|
809
|
+
/** External SSOT configuration */
|
|
810
|
+
externalSsot?: {
|
|
811
|
+
openapi?: {
|
|
812
|
+
enabled: boolean;
|
|
813
|
+
paths: string[];
|
|
814
|
+
};
|
|
815
|
+
ddl?: {
|
|
816
|
+
enabled: boolean;
|
|
817
|
+
type: 'ddl' | 'prisma' | 'typeorm' | 'drizzle';
|
|
818
|
+
path: string;
|
|
819
|
+
};
|
|
820
|
+
iac?: {
|
|
821
|
+
enabled: boolean;
|
|
822
|
+
type: 'cloudformation' | 'cdk' | 'terraform';
|
|
823
|
+
path: string;
|
|
824
|
+
};
|
|
825
|
+
};
|
|
826
|
+
/** External SSOT file paths — maps node IDs to file paths/globs */
|
|
827
|
+
externalPaths?: Record<string, string>;
|
|
828
|
+
/** Lint configuration */
|
|
829
|
+
lint?: {
|
|
830
|
+
/** Strict mode */
|
|
831
|
+
strict?: boolean;
|
|
832
|
+
/** Disable specific rules */
|
|
833
|
+
disabledRules?: string[];
|
|
834
|
+
};
|
|
835
|
+
/** Artifact scan configurations keyed by artifact class (e.g. 'test', 'typescript', 'openapi') */
|
|
836
|
+
artifacts?: Record<string, ArtifactConfig>;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Resolved speckeeper configuration
|
|
840
|
+
*/
|
|
841
|
+
interface ResolvedSpeckeeperConfig extends SpeckeeperConfigInput {
|
|
842
|
+
designDir: string;
|
|
843
|
+
docsDir: string;
|
|
844
|
+
specsDir: string;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Define speckeeper configuration
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```typescript
|
|
851
|
+
* // speckeeper.config.ts
|
|
852
|
+
* import { defineConfig, defineModel } from 'speckeeper';
|
|
853
|
+
*
|
|
854
|
+
* export default defineConfig({
|
|
855
|
+
* projectName: 'My Project',
|
|
856
|
+
* models: [
|
|
857
|
+
* // Custom model definitions
|
|
858
|
+
* ],
|
|
859
|
+
* });
|
|
860
|
+
* ```
|
|
861
|
+
*/
|
|
862
|
+
declare function defineConfig(input: SpeckeeperConfigInput): ResolvedSpeckeeperConfig;
|
|
863
|
+
/**
|
|
864
|
+
* Model definition input type
|
|
865
|
+
*/
|
|
866
|
+
interface ModelDefinitionInput<T extends z.ZodTypeAny> {
|
|
867
|
+
/** Unique identifier for the model (kebab-case recommended) */
|
|
868
|
+
id: string;
|
|
869
|
+
/** Model name (PascalCase recommended) */
|
|
870
|
+
name: string;
|
|
871
|
+
/** Model description */
|
|
872
|
+
description: string;
|
|
873
|
+
/** Zod schema */
|
|
874
|
+
schema: T;
|
|
875
|
+
/** Prefix for ID generation */
|
|
876
|
+
idPrefix: string;
|
|
877
|
+
/** Exporter configuration */
|
|
878
|
+
exporters?: {
|
|
879
|
+
markdown?: MarkdownExporter<z.infer<T>>;
|
|
880
|
+
mermaid?: MermaidExporter<z.infer<T>> | MermaidExporter<z.infer<T>>[];
|
|
881
|
+
jsonSchema?: JsonSchemaExporter;
|
|
882
|
+
};
|
|
883
|
+
/** Lint rules */
|
|
884
|
+
lintRules?: LintRule$1<z.infer<T>>[];
|
|
885
|
+
/** External SSOT checker */
|
|
886
|
+
externalChecker?: ExternalChecker$1<z.infer<T>>;
|
|
887
|
+
/** Reference definitions */
|
|
888
|
+
references?: ReferenceDefinition[];
|
|
889
|
+
/** DSL function name */
|
|
890
|
+
dslName?: string;
|
|
891
|
+
/** Phase */
|
|
892
|
+
phase?: 'REQ' | 'HLD' | 'LLD' | 'OPS';
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Create a custom model definition
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```typescript
|
|
899
|
+
* const RetryPolicyModel = defineModel({
|
|
900
|
+
* id: 'retry-policy',
|
|
901
|
+
* name: 'RetryPolicy',
|
|
902
|
+
* description: 'Retry policy definition',
|
|
903
|
+
* schema: z.object({
|
|
904
|
+
* id: z.string(),
|
|
905
|
+
* name: z.string(),
|
|
906
|
+
* maxAttempts: z.number().min(1),
|
|
907
|
+
* initialDelay: z.number().min(0),
|
|
908
|
+
* backoffMultiplier: z.number().min(1),
|
|
909
|
+
* }),
|
|
910
|
+
* idPrefix: 'RETRY',
|
|
911
|
+
* exporters: {
|
|
912
|
+
* markdown: {
|
|
913
|
+
* single: (m) => `# ${m.name}\n\n- Max Attempts: ${m.maxAttempts}`,
|
|
914
|
+
* outputDir: 'docs/retry-policies',
|
|
915
|
+
* },
|
|
916
|
+
* },
|
|
917
|
+
* lintRules: [
|
|
918
|
+
* {
|
|
919
|
+
* id: 'retry-max-limit',
|
|
920
|
+
* description: 'maxAttempts should not exceed 10',
|
|
921
|
+
* severity: 'warning',
|
|
922
|
+
* check: (m) => m.maxAttempts > 10
|
|
923
|
+
* ? { message: `maxAttempts ${m.maxAttempts} exceeds recommended limit` }
|
|
924
|
+
* : null,
|
|
925
|
+
* },
|
|
926
|
+
* ],
|
|
927
|
+
* });
|
|
928
|
+
* ```
|
|
929
|
+
*/
|
|
930
|
+
declare function defineModel<T extends z.ZodTypeAny>(input: ModelDefinitionInput<T>): ModelDefinition<T>;
|
|
931
|
+
/**
|
|
932
|
+
* Helper to create Markdown exporter
|
|
933
|
+
*/
|
|
934
|
+
declare function createMarkdownExporter<T>(config: {
|
|
935
|
+
outputDir: string;
|
|
936
|
+
single: (model: T, context: unknown) => string;
|
|
937
|
+
index?: (models: T[], context: unknown) => string;
|
|
938
|
+
filename?: (model: T) => string;
|
|
939
|
+
}): MarkdownExporter<T>;
|
|
940
|
+
/**
|
|
941
|
+
* Helper to create Mermaid diagram exporter
|
|
942
|
+
*/
|
|
943
|
+
declare function createMermaidExporter<T>(config: {
|
|
944
|
+
diagramType: MermaidExporter<T>['diagramType'];
|
|
945
|
+
outputPath: string;
|
|
946
|
+
generate: (models: T[], context: unknown) => string;
|
|
947
|
+
title?: string;
|
|
948
|
+
}): MermaidExporter<T>;
|
|
949
|
+
/**
|
|
950
|
+
* Helper to create lint rule
|
|
951
|
+
*/
|
|
952
|
+
declare function createLintRule<T>(config: {
|
|
953
|
+
id: string;
|
|
954
|
+
description: string;
|
|
955
|
+
severity: 'error' | 'warning' | 'info';
|
|
956
|
+
check: (model: T, context: unknown) => {
|
|
957
|
+
message: string;
|
|
958
|
+
field?: string;
|
|
959
|
+
suggestion?: string;
|
|
960
|
+
} | null;
|
|
961
|
+
}): LintRule$1<T>;
|
|
962
|
+
/**
|
|
963
|
+
* Load speckeeper.config.ts file and register custom models
|
|
964
|
+
*/
|
|
965
|
+
declare function loadSpeckeeperConfig(configPath?: string): Promise<ResolvedSpeckeeperConfig | null>;
|
|
966
|
+
|
|
967
|
+
export { detectCycles as $, type ArtifactConfig as A, type BaseModelInstance as B, type CheckContext as C, ReferenceDefinitionSchema as D, type ExportContext as E, type Relation as F, RelationSchema as G, type RelationValidationError as H, type InferModelType as I, type JsonSchemaExporter as J, RelationsFieldSchema as K, type LintContext as L, type ModelDefinition as M, type RenderContext as N, type Renderer as O, type ResolvedSpeckeeperConfig as P, type SpecModule as Q, RELATION_CONSTRAINTS as R, type SpecEntry as S, type SpeckeeperConfigInput as T, buildRegistryFromConfig as U, createLintRule as V, createMarkdownExporter as W, createMermaidExporter as X, defineConfig as Y, defineModel as Z, defineSpecs as _, type CheckResult$1 as a, findModelTypeFromConfig as a0, getLevelIndex as a1, getSpecsFromConfig as a2, inferModelIdFromSpecId as a3, loadSpeckeeperConfig as a4, mergeSpecs as a5, validateRelationLevel as a6, type MetaModelRegistry as b, type LintRule$1 as c, type LintIssue as d, type CheckError as e, CheckErrorSchema as f, type CheckResult as g, CheckResultSchema as h, type CheckWarning as i, CheckWarningSchema as j, type CoverageChecker as k, type CoverageResult as l, type Exporter as m, type ExternalChecker as n, LintIssueSchema as o, type LintResult as p, type LintRule as q, type MarkdownExporter as r, type MergedDesign as s, type MermaidExporter as t, type MetaModelConfig as u, Model as v, type ModelDefinitionInput as w, type ModelLevel as x, RELATION_TYPES as y, type ReferenceDefinition as z };
|