speckeeper 0.9.2 → 0.9.3

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.
@@ -0,0 +1,810 @@
1
+ # Requirements
2
+
3
+ ## Functional Requirements
4
+
5
+ | ID | Name | Priority | Category |
6
+ |----|------|----------|----------|
7
+ | FR-100 | Common Requirements (All Models) | must | common |
8
+ | FR-101 | ID Management | must | common |
9
+ | FR-102 | Phase Management | must | common |
10
+ | FR-104 | Model Definition | must | common |
11
+ | FR-105 | Project Initialization | should | common |
12
+ | FR-106 | Artifact Class-Based Scaffold | must | common |
13
+ | FR-107 | Core-Provided Model Factories | must | common |
14
+ | FR-200 | External SSOT Reference | must | model |
15
+ | FR-201 | External SSOT Path Configuration | must | model |
16
+ | FR-300 | Generation (build) | must | build |
17
+ | FR-301 | Rendering Feature for External Programs | must | build |
18
+ | FR-302 | Machine-readable Artifacts (specs/) | must | build |
19
+ | FR-400 | Lint/Validation | must | lint |
20
+ | FR-401 | Common Lint Items | must | lint |
21
+ | FR-402 | Custom Lint Rules | must | lint |
22
+ | FR-500 | Drift Check | must | drift |
23
+ | FR-600 | External SSOT Consistency Check | must | check |
24
+ | FR-601 | Three Categories of Consistency Check | must | check |
25
+ | FR-602 | Check Command | must | check |
26
+ | FR-603 | External Checker | must | check |
27
+ | FR-604 | Coverage Verification | should | check |
28
+ | FR-605 | Model-Integrated Check Architecture | must | check |
29
+ | FR-700 | Change Impact Analysis | should | impact |
30
+ | FR-701 | Inter-model Relations | should | impact |
31
+ | FR-702 | Verified-By / Verifies Relation Types | must | impact |
32
+ | FR-703 | Edge Type-Specific Relation Schema | must | impact |
33
+ | FR-800 | Artifact Export (optional) | could | export |
34
+ | FR-1000 | External Checker Implementation | must | check |
35
+ | FR-1001 | OpenAPI YAML/JSON Parsing | must | check |
36
+ | FR-1002 | OpenAPI Spec ID Verification | must | check |
37
+ | FR-1003 | OpenAPI Missing Spec ID Warning | must | check |
38
+ | FR-1004 | OpenAPI Method Check | should | check |
39
+ | FR-1005 | OpenAPI Parameter/Response Check | should | check |
40
+ | FR-1006 | OpenAPI Mismatch Warnings | must | check |
41
+ | FR-1007 | OpenAPI File Not Found Error | must | check |
42
+ | FR-1008 | OpenAPI Parse Failure Error | must | check |
43
+ | FR-1009 | SQL DDL Parsing | must | check |
44
+ | FR-1010 | SQL Table Existence Check | must | check |
45
+ | FR-1011 | SQL Column Existence Check | must | check |
46
+ | FR-1012 | SQL Type Consistency Check | should | check |
47
+ | FR-1013 | SQL Checker Warnings | must | check |
48
+ | FR-1014 | SQL File Not Found Error | must | check |
49
+ | FR-1015 | SQL Parse Failure Graceful Degradation | must | check |
50
+ | FR-1016 | Checker Pattern Consistency | must | check |
51
+ | FR-1017 | Source Path Fallback | must | check |
52
+ | FR-1018 | Minimal New Dependencies | must | check |
53
+ | FR-1019 | Checker Documentation Accuracy | must | check |
54
+
55
+ ---
56
+
57
+ ## FR-100: Common Requirements (All Models)
58
+
59
+ **Type**: functional | **Priority**: must | **Category**: common
60
+
61
+ Defines common requirements that apply to all models.
62
+
63
+ ### Acceptance Criteria
64
+
65
+ - **FR-100-01**: All child requirements (FR-101, FR-102, FR-104) are satisfied [review]
66
+
67
+ ---
68
+
69
+ ## FR-101: ID Management
70
+
71
+ **Type**: functional | **Priority**: must | **Category**: common
72
+
73
+ All model elements have a unique `id` and provide ID-based reference and consistency checking
74
+
75
+ ### Rationale
76
+
77
+ To prevent ID duplication, ensure reference integrity, and maintain traceability
78
+
79
+ ### Acceptance Criteria
80
+
81
+ - **FR-101-01**: All model elements have a unique id [test]
82
+ - **FR-101-02**: id follows conventions (e.g., REQ-OBS-001, ENT-ORDER, COMP-API) [test]
83
+ - **FR-101-03**: References are expressed by ID and reference integrity checking is provided [test]
84
+ - **FR-101-04**: ID changes detect all reference locations via reference integrity check (lint) [test]
85
+
86
+ ---
87
+
88
+ ## FR-102: Phase Management
89
+
90
+ **Type**: functional | **Priority**: must | **Category**: common
91
+
92
+ Set phase (REQ/HLD/LLD/OPS) on models and verify phase gates
93
+
94
+ ### Rationale
95
+
96
+ To ensure no items requiring resolution in subsequent phases remain
97
+
98
+ ### Acceptance Criteria
99
+
100
+ - **FR-102-01**: Phase can be handled as REQ | HLD | LLD | OPS [test]
101
+ - **FR-102-02**: Can set phase in model definition and verify phase gate [test]
102
+ - **FR-102-03**: TBD is allowed/prohibited at specified phase [test]
103
+
104
+ ---
105
+
106
+ ## FR-104: Model Definition
107
+
108
+ **Type**: functional | **Priority**: must | **Category**: common
109
+
110
+ Define and register project-specific models in TypeScript
111
+
112
+ ### Rationale
113
+
114
+ To define project-specific models (Requirement, Entity, Screen, Runbook, etc.) in a unified way
115
+
116
+ ### Acceptance Criteria
117
+
118
+ - **FR-104-01**: Can define models by inheriting from Model base class [test]
119
+ - **FR-104-02**: Can define runtime validation with Zod schema [test]
120
+ - **FR-104-03**: Can define model-specific lint rules [test]
121
+ - **FR-104-04**: Can define model-specific renderers (text output functions) [test]
122
+ - **FR-104-05**: Can define external SSOT consistency checkers (optional) [test]
123
+ - **FR-104-06**: Can register as models: [...] in speckeeper.config.ts [demo]
124
+ - **FR-104-07**: Registered models become targets of lint/build/drift/check [test]
125
+ - **FR-104-08**: Can set modelLevel on models to enable relation constraint verification [test]
126
+ - **FR-104-09**: Can get model level (L0/L1/L2/L3) via Model.level property [test]
127
+
128
+ ---
129
+
130
+ ## FR-105: Project Initialization
131
+
132
+ **Type**: functional | **Priority**: should | **Category**: common
133
+
134
+ Initialize a new speckeeper project with starter templates and basic model definitions
135
+
136
+ ### Rationale
137
+
138
+ To provide a quick start experience for new users by generating project structure, configuration, and basic model definitions
139
+
140
+ ### Acceptance Criteria
141
+
142
+ - **FR-105-01**: speckeeper init creates design/ directory structure [test]
143
+ - **FR-105-02**: speckeeper init generates speckeeper.config.ts with default settings [test]
144
+ - **FR-105-03**: speckeeper init generates package.json with type: module and dependencies [test]
145
+ - **FR-105-04**: speckeeper init generates tsconfig.json for TypeScript support [test]
146
+ - **FR-105-05**: speckeeper init generates basic model definitions in design/_models/ [test]
147
+ - **FR-105-06**: speckeeper init generates sample specification files [test]
148
+ - **FR-105-07**: Generated project passes speckeeper lint without errors [test]
149
+ - **FR-105-08**: Generated project passes typecheck without errors [test]
150
+ - **FR-105-09**: speckeeper init --force overwrites existing files [test]
151
+ - **FR-105-10**: speckeeper init skips package.json if it already exists (without --force) [test]
152
+
153
+ ---
154
+
155
+ ## FR-106: Artifact Class-Based Scaffold
156
+
157
+ **Type**: functional | **Priority**: must | **Category**: common
158
+
159
+ Scaffold generates model files from a common base template based on artifact class specified in mermaid flowchart, replacing fixed node-to-template mappings
160
+
161
+ ### Rationale
162
+
163
+ To eliminate fixed template mappings (NODE_ALIAS, TEMPLATE_META, CHECKER_ALIAS) and enable flexible artifact type addition via class specification
164
+
165
+ ### Acceptance Criteria
166
+
167
+ - **FR-106-01**: Scaffold recognizes artifact class on mermaid flowchart nodes and generates model files from a common base template [test]
168
+ - **FR-106-02**: Artifact class is used for: (1) aggregating same-class nodes into one model file, (2) deriving model/file names from class name, (3) selecting checker bindings for external nodes [test]
169
+ - **FR-106-03**: Multiple nodes with same artifact class are aggregated into a single model file [test]
170
+ - **FR-106-04**: Nodes without artifact class are generated with base template using node ID as model name [test]
171
+ - **FR-106-05**: Model name is PascalCase of node ID/class name, file name is kebab-case (e.g., class "requirement" → Model "Requirement", file "requirement.ts") [test]
172
+ - **FR-106-06**: NODE_ALIAS (fixed node ID to template mapping) is removed [test]
173
+ - **FR-106-07**: TEMPLATE_META (fixed template name to level/type/filename registry) is removed [test]
174
+ - **FR-106-08**: CHECKER_ALIAS (fixed external node ID to checker template mapping) is removed [test]
175
+ - **FR-106-09**: Fixed model template functions (requirement.ts, usecase.ts, term.ts, etc.) are removed; only base template remains [test]
176
+
177
+ ---
178
+
179
+ ## FR-107: Core-Provided Model Factories
180
+
181
+ **Type**: functional | **Priority**: must | **Category**: common
182
+
183
+ speckeeper core provides generic lint rule, exporter, schema, test checker, and coverage checker factories to simplify model definitions
184
+
185
+ ### Rationale
186
+
187
+ To reduce model definition verbosity by extracting common patterns into reusable core-provided factories
188
+
189
+ ### Acceptance Criteria
190
+
191
+ - **FR-107-01**: Core provides generic lint rule factories: field required check, array min length check, ID format check, child element ID format check [test]
192
+ - **FR-107-02**: Core provides generic exporter factories: markdown single exporter (declarative title/metadata/section), markdown index exporter (declarative table columns) [test]
193
+ - **FR-107-03**: Core provides common schema base (id, name, description, relations) that models extend with custom fields [test]
194
+ - **FR-107-04**: Core provides test verification common logic (test file search, spec ID reference check, test result parsing) usable by specifying test file path only [test]
195
+ - **FR-107-05**: Core provides relation-based coverage checker common logic (coverage calculation against all IDs of target model) [test]
196
+ - **FR-107-06**: All core-provided factories are optional; custom logic can coexist with core factories [test]
197
+
198
+ ---
199
+
200
+ ## FR-200: External SSOT Reference
201
+
202
+ **Type**: functional | **Priority**: must | **Category**: model
203
+
204
+ Can define references to external SSOT (OpenAPI, DDL, IaC, etc.)
205
+
206
+ ### Rationale
207
+
208
+ To manage API specifications and DB definitions with external tools while ensuring model consistency
209
+
210
+ ### Acceptance Criteria
211
+
212
+ - **FR-200-01**: Provides basic interfaces for APIRef/TableRef/IaCRef/BatchRef [test]
213
+ - **FR-200-02**: Can set file path and identifier for referenced target [test]
214
+ - **FR-200-03**: Can associate with related components and entities [test]
215
+
216
+ ---
217
+
218
+ ## FR-201: External SSOT Path Configuration
219
+
220
+ **Type**: functional | **Priority**: must | **Category**: model
221
+
222
+ External SSOT file paths (OpenAPI, DDL, test code, etc.) are configured in speckeeper.config.ts, not in mermaid flowcharts
223
+
224
+ ### Rationale
225
+
226
+ To centralize runtime configuration (file paths) in config file, keeping mermaid flowcharts as scaffold-only artifacts
227
+
228
+ ### Acceptance Criteria
229
+
230
+ - **FR-201-01**: External SSOT file paths are defined in speckeeper.config.ts via ExternalSsotPaths [test]
231
+ - **FR-201-02**: Mermaid flowchart is scaffold-only and does not contain runtime configuration such as file paths [review]
232
+
233
+ ---
234
+
235
+ ## FR-300: Generation (build)
236
+
237
+ **Type**: functional | **Priority**: must | **Category**: build
238
+
239
+ Generate "human-readable artifacts (docs/)" and "machine-readable artifacts (specs/)" from TS models
240
+
241
+ ### Acceptance Criteria
242
+
243
+ - **FR-300-01**: Can output human-readable artifacts (docs/) [test]
244
+ - **FR-300-02**: Can output machine-readable artifacts (specs/) [test]
245
+ - **FR-300-03**: Manual editing of artifacts is prohibited (subject to drift check) [review]
246
+
247
+ ---
248
+
249
+ ## FR-301: Rendering Feature for External Programs
250
+
251
+ **Type**: functional | **Priority**: must | **Category**: build
252
+
253
+ Models provide text rendering functionality callable from external programs
254
+
255
+ ### Rationale
256
+
257
+ To make model rendering functionality available to external programs (template engines, document generation tools, etc.)
258
+
259
+ ### Acceptance Criteria
260
+
261
+ - **FR-301-01**: Can define rendering functions in Model class via renderers property [test]
262
+ - **FR-301-02**: Rendering can be invoked via common interface from external programs [test]
263
+ - **FR-301-03**: Rendering results switch internally based on model class [test]
264
+ - **FR-301-04**: Output format can be specified via format parameter [test]
265
+ - **FR-301-05**: Regeneration produces identical content (idempotency) [test]
266
+
267
+ ---
268
+
269
+ ## FR-302: Machine-readable Artifacts (specs/)
270
+
271
+ **Type**: functional | **Priority**: must | **Category**: build
272
+
273
+ Generate JSON Schema and requirement definitions from concept model entities
274
+
275
+ ### Rationale
276
+
277
+ For use as contract definitions with external systems, validation, and input for lint/check/impact analysis
278
+
279
+ ### Acceptance Criteria
280
+
281
+ - **FR-302-01**: Entity attributes are mapped to JSON Schema properties [test]
282
+ - **FR-302-02**: Can output reference resolution graph (specs/index.json) [test]
283
+
284
+ ---
285
+
286
+ ## FR-400: Lint/Validation
287
+
288
+ **Type**: functional | **Priority**: must | **Category**: lint
289
+
290
+ Provides lint functionality to verify model consistency
291
+
292
+ ### Acceptance Criteria
293
+
294
+ - **FR-400-01**: Can verify common lint items [test]
295
+ - **FR-400-02**: Can define and execute model-specific custom lint rules [test]
296
+
297
+ ---
298
+
299
+ ## FR-401: Common Lint Items
300
+
301
+ **Type**: functional | **Priority**: must | **Category**: lint
302
+
303
+ Verify common lint items that apply to all models
304
+
305
+ ### Rationale
306
+
307
+ ID duplication and reference inconsistencies break traceability
308
+
309
+ ### Acceptance Criteria
310
+
311
+ - **FR-401-01**: Verify IDs are not duplicated within the same type [test]
312
+ - **FR-401-02**: Verify IDs follow conventions [test]
313
+ - **FR-401-03**: Verify referenced targets exist [test]
314
+ - **FR-401-04**: Verify no circular references exist [test]
315
+ - **FR-401-05**: Verify no TBDs remain at specified phase [test]
316
+ - **FR-401-06**: Detect orphan elements (entities without relations, etc.) [test]
317
+
318
+ ---
319
+
320
+ ## FR-402: Custom Lint Rules
321
+
322
+ **Type**: functional | **Priority**: must | **Category**: lint
323
+
324
+ Each model can define lintRules to verify model-specific constraints
325
+
326
+ ### Rationale
327
+
328
+ To verify model-specific constraints (layer violations, required attributes, etc.)
329
+
330
+ ### Acceptance Criteria
331
+
332
+ - **FR-402-01**: Can set lintRules in Model definition [test]
333
+ - **FR-402-02**: Can set severity (error/warning/info) [test]
334
+ - **FR-402-03**: Lint results include rule ID, message, and target ID [test]
335
+
336
+ ---
337
+
338
+ ## FR-500: Drift Check
339
+
340
+ **Type**: functional | **Priority**: must | **Category**: drift
341
+
342
+ Detect if artifacts (docs/, specs/) have been manually edited
343
+
344
+ ### Rationale
345
+
346
+ To detect divergence between TS models and artifacts and maintain SSOT principle
347
+
348
+ ### Acceptance Criteria
349
+
350
+ - **FR-500-01**: After build execution, detect differences between generated docs//specs/ and committed files [test]
351
+ - **FR-500-02**: Fail CI when differences are found [test]
352
+ - **FR-500-03**: Output message prompting to "regenerate and commit" [test]
353
+ - **FR-500-04**: Manual editing of artifacts is prohibited (detected by drift) [review]
354
+
355
+ ---
356
+
357
+ ## FR-600: External SSOT Consistency Check
358
+
359
+ **Type**: functional | **Priority**: must | **Category**: check
360
+
361
+ Verify consistency between TS models (external SSOT references) and external SSOT (OpenAPI, DDL, IaC, etc.)
362
+
363
+ ### Acceptance Criteria
364
+
365
+ - **FR-600-01**: Existence check (referenced items exist in external artifacts) [test]
366
+ - **FR-600-02**: Type check (expected type/class/category matches) [test]
367
+ - **FR-600-03**: Constraint check (non-functional/guardrails are satisfied) [test]
368
+
369
+ ---
370
+
371
+ ## FR-601: Three Categories of Consistency Check
372
+
373
+ **Type**: functional | **Priority**: must | **Category**: check
374
+
375
+ All external SSOT consistency checks are uniformly composed of existence, type, and constraint categories
376
+
377
+ ### Acceptance Criteria
378
+
379
+ - **FR-601-01**: Existence: Referenced items exist in external artifacts [test]
380
+ - **FR-601-02**: Type: Expected type/class/category matches [test]
381
+ - **FR-601-03**: Constraints: Non-functional/guardrails are satisfied [test]
382
+
383
+ ---
384
+
385
+ ## FR-602: Check Command
386
+
387
+ **Type**: functional | **Priority**: must | **Category**: check
388
+
389
+ Provide CLI command to execute external SSOT consistency check
390
+
391
+ ### Rationale
392
+
393
+ Since consistency checks are implemented per model, filter by model name
394
+
395
+ ### Acceptance Criteria
396
+
397
+ - **FR-602-01**: speckeeper check runs external SSOT consistency check for all models [test]
398
+ - **FR-602-02**: speckeeper check --model <model-name> checks only specific model [test]
399
+ - **FR-602-03**: Model name is the model ID defined in design/_models/ [review]
400
+ - **FR-602-04**: Only models with externalChecker are targeted [test]
401
+
402
+ ---
403
+
404
+ ## FR-603: External Checker
405
+
406
+ **Type**: functional | **Priority**: must | **Category**: check
407
+
408
+ Each model can define externalChecker to implement consistency check with external SSOT
409
+
410
+ ### Rationale
411
+
412
+ Clarify model responsibilities by including external SSOT consistency check logic in model definition
413
+
414
+ ### Acceptance Criteria
415
+
416
+ - **FR-603-01**: Can set externalChecker in Model definition [test]
417
+ - **FR-603-02**: externalChecker includes target file reading and check logic [test]
418
+ - **FR-603-03**: Check results include success, errors, warnings [test]
419
+ - **FR-603-04**: speckeeper check command auto-detects and runs models with externalChecker [test]
420
+
421
+ ---
422
+
423
+ ## FR-604: Coverage Verification
424
+
425
+ **Type**: functional | **Priority**: should | **Category**: check
426
+
427
+ Use Model class coverageChecker to verify cross-model coverage
428
+
429
+ ### Rationale
430
+
431
+ To verify cross-model consistency (coverage) and prevent gaps
432
+
433
+ ### Acceptance Criteria
434
+
435
+ - **FR-604-01**: Execute coverage verification with speckeeper check --coverage [test]
436
+ - **FR-604-02**: Define coverageChecker interface in Model class [test]
437
+ - **FR-604-03**: Auto-detect and execute models with coverageChecker [test]
438
+ - **FR-604-04**: Calculate and display coverage rate (%) [test]
439
+ - **FR-604-05**: List uncovered items [test]
440
+
441
+ ---
442
+
443
+ ## FR-605: Model-Integrated Check Architecture
444
+
445
+ **Type**: functional | **Priority**: must | **Category**: check
446
+
447
+ External SSOT and test verification logic is integrated into _models/ definitions, eliminating the separate _checkers/ directory
448
+
449
+ ### Rationale
450
+
451
+ To consolidate check logic with model definitions, reducing management overhead and ensuring model-check consistency
452
+
453
+ ### Acceptance Criteria
454
+
455
+ - **FR-605-01**: Scaffold does not generate _checkers/ directory [test]
456
+ - **FR-605-02**: Verification logic is included in _models/ model definitions [test]
457
+ - **FR-605-03**: speckeeper check external-ssot uses verification logic from _models/ model definitions only [test]
458
+ - **FR-605-04**: speckeeper check external-ssot does not reference _checkers/ directory [test]
459
+ - **FR-605-05**: Checker template functions (src/scaffold/templates/checkers/) are removed; checker logic moves to core DSL (src/core/dsl/) [test]
460
+
461
+ ---
462
+
463
+ ## FR-700: Change Impact Analysis
464
+
465
+ **Type**: functional | **Priority**: should | **Category**: impact
466
+
467
+ Analyze and list impact scope when IDs change
468
+
469
+ ### Rationale
470
+
471
+ To understand the impact of changes in advance and support safe refactoring
472
+
473
+ ### Acceptance Criteria
474
+
475
+ - **FR-700-01**: Analyze and list impact scope with speckeeper impact {ID} [test]
476
+ - **FR-700-02**: Define relations between models and track associations [test]
477
+ - **FR-700-03**: Reference depth (--depth) can be specified [test]
478
+ - **FR-700-04**: Display impacted specs, components, and documents [test]
479
+
480
+ ---
481
+
482
+ ## FR-701: Inter-model Relations
483
+
484
+ **Type**: functional | **Priority**: should | **Category**: impact
485
+
486
+ Define relations between models to enable impact scope tracking
487
+
488
+ ### Rationale
489
+
490
+ Explicitly defining relations between models improves change impact analysis accuracy
491
+
492
+ ### Acceptance Criteria
493
+
494
+ - **FR-701-01**: Can define relations via relations property in model definition [test]
495
+ - **FR-701-02**: Provides standard relation types [review]
496
+ - **FR-701-03**: Relations are used as input for impact analysis [test]
497
+ - **FR-701-04**: Define source/target model level constraints per relation type [test]
498
+ - **FR-701-05**: Level violations and circular references can be detected by lint [test]
499
+
500
+ ---
501
+
502
+ ## FR-702: Verified-By / Verifies Relation Types
503
+
504
+ **Type**: functional | **Priority**: must | **Category**: impact
505
+
506
+ Add verifiedBy relation type (spec→test code) and redefine verifies (test code→implementation code) for semantic accuracy
507
+
508
+ ### Rationale
509
+
510
+ To express spec-test-implementation relationships with semantically accurate relation names instead of overloading implements
511
+
512
+ ### Acceptance Criteria
513
+
514
+ - **FR-702-01**: verifiedBy is added as RelationType with edge category "check" (spec→test code direction) [test]
515
+ - **FR-702-02**: verifies is redefined as "test code tests implementation code" (test→implementation direction) [test]
516
+ - **FR-702-03**: verifiedBy between speckeeper→speckeeper nodes produces a warning [test]
517
+ - **FR-702-04**: Same source node can have both implements and verifiedBy edges, each verified independently [test]
518
+ - **FR-702-05**: verifies (typically external→external) is recognized for traceability but not a checker generation target [test]
519
+
520
+ ---
521
+
522
+ ## FR-703: Edge Type-Specific Relation Schema
523
+
524
+ **Type**: functional | **Priority**: must | **Category**: impact
525
+
526
+ implements and verifiedBy relations have edge-type-specific schemas (ImplementsRelationSchema, VerifiedByRelationSchema) with additional properties beyond target ID
527
+
528
+ ### Rationale
529
+
530
+ To define structured relation data (path, target type, etc.) per edge type instead of using generic relation schema
531
+
532
+ ### Acceptance Criteria
533
+
534
+ - **FR-703-01**: implements and verifiedBy have edge-type-specific schemas with additional properties (path, target type, etc.) [test]
535
+ - **FR-703-02**: Scaffold generates checker binding guidance comments when implements/verifiedBy edges are detected [test]
536
+ - **FR-703-03**: Edge-type-specific relation schemas are provided by core; no manual definition needed in model definitions [test]
537
+
538
+ ---
539
+
540
+ ## FR-800: Artifact Export (optional)
541
+
542
+ **Type**: functional | **Priority**: could | **Category**: export
543
+
544
+ Output aggregated JSON for machine processing
545
+
546
+ ### Acceptance Criteria
547
+
548
+ - **FR-800-01**: Can output aggregated JSON for machine processing (specs/index.json) [test]
549
+ - **FR-800-02**: Can be used for future tool integration (dashboards, requirement lists, progress visualization) [review]
550
+
551
+ ---
552
+
553
+ ## FR-1000: External Checker Implementation
554
+
555
+ **Type**: functional | **Priority**: must | **Category**: check
556
+
557
+ Implement actual validation logic for externalOpenAPIChecker and externalSqlSchemaChecker, replacing stubs with real file parsing and verification
558
+
559
+ ### Acceptance Criteria
560
+
561
+ - **FR-1000-01**: All child requirements (FR-1001~FR-1019) are satisfied [review]
562
+
563
+ ---
564
+
565
+ ## FR-1001: OpenAPI YAML/JSON Parsing
566
+
567
+ **Type**: functional | **Priority**: must | **Category**: check
568
+
569
+ externalOpenAPIChecker MUST parse YAML and JSON format OpenAPI files
570
+
571
+ ### Acceptance Criteria
572
+
573
+ - **FR-1001-01**: YAML format OpenAPI files are parsed successfully [test]
574
+ - **FR-1001-02**: JSON format OpenAPI files are parsed successfully [test]
575
+
576
+ ---
577
+
578
+ ## FR-1002: OpenAPI Spec ID Verification
579
+
580
+ **Type**: functional | **Priority**: must | **Category**: check
581
+
582
+ externalOpenAPIChecker MUST verify spec IDs via operationId, path segments, schema names, and x-spec-id extensions
583
+
584
+ ### Acceptance Criteria
585
+
586
+ - **FR-1002-01**: Spec ID found via operationId [test]
587
+ - **FR-1002-02**: Spec ID found via exact path segment match [test]
588
+ - **FR-1002-03**: Spec ID found via schema name [test]
589
+ - **FR-1002-04**: Spec ID found via x-spec-id extension [test]
590
+
591
+ ---
592
+
593
+ ## FR-1003: OpenAPI Missing Spec ID Warning
594
+
595
+ **Type**: functional | **Priority**: must | **Category**: check
596
+
597
+ externalOpenAPIChecker MUST report a warning for each spec ID not found in the OpenAPI document
598
+
599
+ ### Acceptance Criteria
600
+
601
+ - **FR-1003-01**: Warning reported when spec ID is not found [test]
602
+
603
+ ---
604
+
605
+ ## FR-1004: OpenAPI Method Check
606
+
607
+ **Type**: functional | **Priority**: should | **Category**: check
608
+
609
+ externalOpenAPIChecker MAY optionally verify HTTP method exists for matched path (opt-in via config)
610
+
611
+ ### Acceptance Criteria
612
+
613
+ - **FR-1004-01**: Method check is opt-in via mapper config [test]
614
+ - **FR-1004-02**: Warning reported for method mismatch [test]
615
+
616
+ ---
617
+
618
+ ## FR-1005: OpenAPI Parameter/Response Check
619
+
620
+ **Type**: functional | **Priority**: should | **Category**: check
621
+
622
+ externalOpenAPIChecker MAY optionally verify parameter names, response property names and types (opt-in via config)
623
+
624
+ ### Acceptance Criteria
625
+
626
+ - **FR-1005-01**: Parameter check is opt-in via mapper config [test]
627
+ - **FR-1005-02**: Response property check is opt-in via mapper config [test]
628
+ - **FR-1005-03**: Type containment is used for type comparison [test]
629
+
630
+ ---
631
+
632
+ ## FR-1006: OpenAPI Mismatch Warnings
633
+
634
+ **Type**: functional | **Priority**: must | **Category**: check
635
+
636
+ externalOpenAPIChecker MUST report warnings for method/parameter/property/type mismatches
637
+
638
+ ### Acceptance Criteria
639
+
640
+ - **FR-1006-01**: Warning for missing/wrong HTTP method [test]
641
+ - **FR-1006-02**: Warning for missing request parameter [test]
642
+ - **FR-1006-03**: Warning for missing response property [test]
643
+ - **FR-1006-04**: Warning for type mismatch [test]
644
+
645
+ ---
646
+
647
+ ## FR-1007: OpenAPI File Not Found Error
648
+
649
+ **Type**: functional | **Priority**: must | **Category**: check
650
+
651
+ externalOpenAPIChecker MUST report an error when the OpenAPI file does not exist
652
+
653
+ ### Acceptance Criteria
654
+
655
+ - **FR-1007-01**: Error reported with missing file path [test]
656
+
657
+ ---
658
+
659
+ ## FR-1008: OpenAPI Parse Failure Error
660
+
661
+ **Type**: functional | **Priority**: must | **Category**: check
662
+
663
+ externalOpenAPIChecker MUST report an error when the OpenAPI file cannot be parsed
664
+
665
+ ### Acceptance Criteria
666
+
667
+ - **FR-1008-01**: Error reported for invalid YAML [test]
668
+ - **FR-1008-02**: Error reported for empty file [test]
669
+
670
+ ---
671
+
672
+ ## FR-1009: SQL DDL Parsing
673
+
674
+ **Type**: functional | **Priority**: must | **Category**: check
675
+
676
+ externalSqlSchemaChecker MUST parse SQL DDL files and extract table definitions
677
+
678
+ ### Acceptance Criteria
679
+
680
+ - **FR-1009-01**: DDL parsed with node-sql-parser [test]
681
+ - **FR-1009-02**: Table names, column names, and column types extracted [test]
682
+
683
+ ---
684
+
685
+ ## FR-1010: SQL Table Existence Check
686
+
687
+ **Type**: functional | **Priority**: must | **Category**: check
688
+
689
+ externalSqlSchemaChecker MUST verify spec-referenced table names exist in parsed DDL
690
+
691
+ ### Acceptance Criteria
692
+
693
+ - **FR-1010-01**: Warning when referenced table is missing [test]
694
+
695
+ ---
696
+
697
+ ## FR-1011: SQL Column Existence Check
698
+
699
+ **Type**: functional | **Priority**: must | **Category**: check
700
+
701
+ externalSqlSchemaChecker MUST verify spec-referenced columns exist in DDL table
702
+
703
+ ### Acceptance Criteria
704
+
705
+ - **FR-1011-01**: Warning when referenced column is missing [test]
706
+ - **FR-1011-02**: Column check skipped when table is missing [test]
707
+
708
+ ---
709
+
710
+ ## FR-1012: SQL Type Consistency Check
711
+
712
+ **Type**: functional | **Priority**: should | **Category**: check
713
+
714
+ externalSqlSchemaChecker MAY optionally verify column type containment (opt-in via checkTypes)
715
+
716
+ ### Acceptance Criteria
717
+
718
+ - **FR-1012-01**: Type check is opt-in via checkTypes config [test]
719
+ - **FR-1012-02**: Wider DDL type accepted (SMALLINT→INT OK) [test]
720
+ - **FR-1012-03**: Narrower DDL type produces warning (INT→SMALLINT NG) [test]
721
+
722
+ ---
723
+
724
+ ## FR-1013: SQL Checker Warnings
725
+
726
+ **Type**: functional | **Priority**: must | **Category**: check
727
+
728
+ externalSqlSchemaChecker MUST report warnings for missing table, column, and type mismatches
729
+
730
+ ### Acceptance Criteria
731
+
732
+ - **FR-1013-01**: Warning for missing table [test]
733
+ - **FR-1013-02**: Warning for missing column [test]
734
+ - **FR-1013-03**: Warning for type mismatch [test]
735
+
736
+ ---
737
+
738
+ ## FR-1014: SQL File Not Found Error
739
+
740
+ **Type**: functional | **Priority**: must | **Category**: check
741
+
742
+ externalSqlSchemaChecker MUST report an error when the DDL file does not exist
743
+
744
+ ### Acceptance Criteria
745
+
746
+ - **FR-1014-01**: Error reported with missing file path [test]
747
+
748
+ ---
749
+
750
+ ## FR-1015: SQL Parse Failure Graceful Degradation
751
+
752
+ **Type**: functional | **Priority**: must | **Category**: check
753
+
754
+ externalSqlSchemaChecker MUST handle DDL parse failures gracefully with regex fallback
755
+
756
+ ### Acceptance Criteria
757
+
758
+ - **FR-1015-01**: Regex fallback used when parser fails [test]
759
+ - **FR-1015-02**: Warning emitted for parse fallback [test]
760
+
761
+ ---
762
+
763
+ ## FR-1016: Checker Pattern Consistency
764
+
765
+ **Type**: functional | **Priority**: must | **Category**: check
766
+
767
+ Both checkers follow the testChecker pattern: file existence check → content parsing → spec ID verification
768
+
769
+ ### Acceptance Criteria
770
+
771
+ - **FR-1016-01**: OpenAPI checker follows file→parse→verify pattern [test]
772
+ - **FR-1016-02**: SQL checker follows file→parse→verify pattern [test]
773
+
774
+ ---
775
+
776
+ ## FR-1017: Source Path Fallback
777
+
778
+ **Type**: functional | **Priority**: must | **Category**: check
779
+
780
+ Both checkers use sourcePath from checker config, falling back to hardcoded defaults
781
+
782
+ ### Acceptance Criteria
783
+
784
+ - **FR-1017-01**: Config sourcePath used when provided [test]
785
+ - **FR-1017-02**: Default path used when no config [test]
786
+
787
+ ---
788
+
789
+ ## FR-1018: Minimal New Dependencies
790
+
791
+ **Type**: functional | **Priority**: must | **Category**: check
792
+
793
+ Only node-sql-parser added as new runtime dependency (>100K weekly downloads)
794
+
795
+ ### Acceptance Criteria
796
+
797
+ - **FR-1018-01**: Only node-sql-parser added as new dependency [review]
798
+
799
+ ---
800
+
801
+ ## FR-1019: Checker Documentation Accuracy
802
+
803
+ **Type**: functional | **Priority**: must | **Category**: check
804
+
805
+ README and scaffold-mermaid-spec.md accurately describe all three built-in checkers as fully implemented
806
+
807
+ ### Acceptance Criteria
808
+
809
+ - **FR-1019-01**: README checker table describes validation levels [review]
810
+ - **FR-1019-02**: scaffold-mermaid-spec.md Section 7 describes validation levels [review]