speckeeper 0.2.1 → 0.3.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 +13 -5
- package/dist/cli.js +49 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +58 -8
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/templates/init/design/index.ts +4 -5
- package/dist/templates/init/design/requirements.ts +5 -4
- package/dist/templates/init/speckeeper.config.ts +3 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -903,6 +903,60 @@ declare function getSpecById(specId: string): {
|
|
|
903
903
|
modelId: string;
|
|
904
904
|
spec: unknown;
|
|
905
905
|
} | null;
|
|
906
|
+
/**
|
|
907
|
+
* A single (Model, data[]) pair.
|
|
908
|
+
* Uses structural typing (not nominal Model<any>) so that
|
|
909
|
+
* compiled dist/ Model instances are compatible with src/ types.
|
|
910
|
+
*/
|
|
911
|
+
interface SpecEntry {
|
|
912
|
+
model: {
|
|
913
|
+
id: string;
|
|
914
|
+
register: (data: unknown[]) => void;
|
|
915
|
+
};
|
|
916
|
+
data: unknown[];
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Common export interface for spec data files.
|
|
920
|
+
* Each spec file exports a SpecModule via defineSpecs().
|
|
921
|
+
*/
|
|
922
|
+
interface SpecModule {
|
|
923
|
+
entries: SpecEntry[];
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Aggregated result from mergeSpecs().
|
|
927
|
+
*/
|
|
928
|
+
interface MergedDesign {
|
|
929
|
+
models: SpecEntry['model'][];
|
|
930
|
+
specs: SpecEntry[];
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Define spec data in a spec file. Returns a SpecModule.
|
|
934
|
+
*
|
|
935
|
+
* @example
|
|
936
|
+
* ```typescript
|
|
937
|
+
* export default defineSpecs(
|
|
938
|
+
* [FunctionalRequirementModel.instance, functionalRequirements],
|
|
939
|
+
* [NonFunctionalRequirementModel.instance, nonFunctionalRequirements],
|
|
940
|
+
* );
|
|
941
|
+
* ```
|
|
942
|
+
*/
|
|
943
|
+
declare function defineSpecs(...entries: [SpecEntry['model'], unknown[]][]): SpecModule;
|
|
944
|
+
/**
|
|
945
|
+
* Merge multiple SpecModules into a single MergedDesign.
|
|
946
|
+
* Models are deduplicated by model.id.
|
|
947
|
+
*
|
|
948
|
+
* @example
|
|
949
|
+
* ```typescript
|
|
950
|
+
* // design/index.ts
|
|
951
|
+
* export default mergeSpecs(requirements, usecases, glossary);
|
|
952
|
+
* ```
|
|
953
|
+
*/
|
|
954
|
+
declare function mergeSpecs(...modules: SpecModule[]): MergedDesign;
|
|
955
|
+
/**
|
|
956
|
+
* Register spec data from config.specs into specStore.
|
|
957
|
+
* Call this after registerModelsFromConfig().
|
|
958
|
+
*/
|
|
959
|
+
declare function registerSpecsFromConfig(specs: SpecEntry[] | undefined): void;
|
|
906
960
|
|
|
907
961
|
/**
|
|
908
962
|
* Register model definition
|
|
@@ -1021,13 +1075,6 @@ declare function getModelRegistryStats(): {
|
|
|
1021
1075
|
totalInstances: number;
|
|
1022
1076
|
};
|
|
1023
1077
|
|
|
1024
|
-
/**
|
|
1025
|
-
* Configuration API for speckeeper
|
|
1026
|
-
*
|
|
1027
|
-
* Provides `defineConfig` and `defineModel` functions for users to
|
|
1028
|
-
* create speckeeper.config.ts files with custom model definitions.
|
|
1029
|
-
*/
|
|
1030
|
-
|
|
1031
1078
|
/**
|
|
1032
1079
|
* speckeeper configuration type
|
|
1033
1080
|
*/
|
|
@@ -1044,6 +1091,8 @@ interface SpeckeeperConfigInput {
|
|
|
1044
1091
|
specsDir?: string;
|
|
1045
1092
|
/** Custom model definitions (Model instances or ModelDefinition objects) */
|
|
1046
1093
|
models?: any[];
|
|
1094
|
+
/** Spec data entries from design/index.ts via mergeSpecs() */
|
|
1095
|
+
specs?: SpecEntry[];
|
|
1047
1096
|
/** External SSOT configuration */
|
|
1048
1097
|
externalSsot?: {
|
|
1049
1098
|
openapi?: {
|
|
@@ -1282,6 +1331,7 @@ interface SpeckeeperConfig {
|
|
|
1282
1331
|
mermaidCliPath?: string;
|
|
1283
1332
|
};
|
|
1284
1333
|
models?: unknown[];
|
|
1334
|
+
specs?: SpecEntry[];
|
|
1285
1335
|
}
|
|
1286
1336
|
/**
|
|
1287
1337
|
* Get output paths compliant with specification
|
|
@@ -1342,4 +1392,4 @@ declare function findDefinitionFiles(srcDir: string, subDir: string): Promise<st
|
|
|
1342
1392
|
declare function generateDocsPath(baseDir: string, category: string, filename: string): string;
|
|
1343
1393
|
declare function generateSpecsPath(baseDir: string, category: string, filename: string): string;
|
|
1344
1394
|
|
|
1345
|
-
export { type APIRefId, type ActorId, type BaseModelInstance, type BatchRefId, type BatchWriteResult, type BoundaryId, type CheckContext, type CheckError, CheckErrorSchema, type CheckResult, CheckResultSchema, type CheckWarning, CheckWarningSchema, type ComponentId, type ConcretizationSlot, ConcretizationSlotSchema, type CoverageChecker, type CoverageResult, type DTORequirementId, type DriftResult, type EntityId, type ErrorCaseId, type EventRequirementId, type ExportContext, type Exporter, type ExternalChecker, type FormId, ID_PATTERNS, type IaCRefId, type InferModelType, type JsonSchemaExporter, type LayerId, type Link, LinkSchema, type LintContext, type LintIssue, LintIssueSchema, type LintResult, type LintRule, type MarkdownExporter, type MermaidExporter, type MetaModelConfig, type MetaModelRegistry, Model, type ModelDefinition, type ModelDefinitionInput, type ModelLevel, type ModelRegistrySchema, type OutputPaths, type Phase, PhaseSchema, type Priority, PrioritySchema, type ProcessFlowId, RELATION_CONSTRAINTS, RELATION_TYPES, type ReferenceDefinition, ReferenceDefinitionSchema, type Relation, type RelationId, RelationSchema, type RelationValidationError, RelationsFieldSchema, type RenderContext, type Renderer, type RequirementId, type ResolvedSpeckeeperConfig, type RuleId, type ScreenId, type Severity, type SpeckeeperConfig, type SpeckeeperConfigInput, type StateId, type TableRefId, type TermId, type TransitionId, type UIComponentId, type UseCaseId, type ValidationError, type ValidationResult, type WriteResult, batchWriteFiles, checkBatchDrift, checkExternalSsot, checkFileDrift, checkReferenceIntegrity, clearModelRegistry, computeHash, createAPIRefId, createActorId, createBatchRefId, createBoundaryId, createComponentId, createDTORequirementId, createEntityId, createErrorCaseId, createEventRequirementId, createFormId, createIaCRefId, createLayerId, createLintRule, createMarkdownExporter, createMermaidExporter, createProcessFlowId, createRelationId, createRequirementId, createRuleId, createScreenId, createStateId, createTableRefId, createTermId, createTransitionId, createUIComponentId, createUseCaseId, defineConfig, defineModel, detectCycles, ensureDir, exportAllModels, exportMarkdown, exportMermaid, findConfigFile, findDefinitionFiles, findFiles, findModelTypeBySpecId, findTypeScriptFiles, generateDocsPath, generateSpecsPath, getAllInstances, getAllModelDefinitions, getAllModelInstances, getAllModels, getAllSpecIds, getExpectedOutputDirs, getGlobalModelRegistry, getLevelIndex, getModel, getModelDefinition, getModelInstance, getModelRegistryStats, getOutputPaths, getSpecById, getSpecStore, getSpecs, inferModelIdFromSpecId, lintAllModels, lintModel, loadConfig, loadSpeckeeperConfig, registerModel, registerModelDefinition, registerModelDefinitions, registerModelInstance, registerModelsFromConfig, resetModelInstances, resetModelRegistry, resetSpecStore, resolveReference, validateConfig, validateOutputPaths, validateRelationLevel, writeFile, writeJsonFile };
|
|
1395
|
+
export { type APIRefId, type ActorId, type BaseModelInstance, type BatchRefId, type BatchWriteResult, type BoundaryId, type CheckContext, type CheckError, CheckErrorSchema, type CheckResult, CheckResultSchema, type CheckWarning, CheckWarningSchema, type ComponentId, type ConcretizationSlot, ConcretizationSlotSchema, type CoverageChecker, type CoverageResult, type DTORequirementId, type DriftResult, type EntityId, type ErrorCaseId, type EventRequirementId, type ExportContext, type Exporter, type ExternalChecker, type FormId, ID_PATTERNS, type IaCRefId, type InferModelType, type JsonSchemaExporter, type LayerId, type Link, LinkSchema, type LintContext, type LintIssue, LintIssueSchema, type LintResult, type LintRule, type MarkdownExporter, type MergedDesign, type MermaidExporter, type MetaModelConfig, type MetaModelRegistry, Model, type ModelDefinition, type ModelDefinitionInput, type ModelLevel, type ModelRegistrySchema, type OutputPaths, type Phase, PhaseSchema, type Priority, PrioritySchema, type ProcessFlowId, RELATION_CONSTRAINTS, RELATION_TYPES, type ReferenceDefinition, ReferenceDefinitionSchema, type Relation, type RelationId, RelationSchema, type RelationValidationError, RelationsFieldSchema, type RenderContext, type Renderer, type RequirementId, type ResolvedSpeckeeperConfig, type RuleId, type ScreenId, type Severity, type SpecEntry, type SpecModule, type SpeckeeperConfig, type SpeckeeperConfigInput, type StateId, type TableRefId, type TermId, type TransitionId, type UIComponentId, type UseCaseId, type ValidationError, type ValidationResult, type WriteResult, batchWriteFiles, checkBatchDrift, checkExternalSsot, checkFileDrift, checkReferenceIntegrity, clearModelRegistry, computeHash, createAPIRefId, createActorId, createBatchRefId, createBoundaryId, createComponentId, createDTORequirementId, createEntityId, createErrorCaseId, createEventRequirementId, createFormId, createIaCRefId, createLayerId, createLintRule, createMarkdownExporter, createMermaidExporter, createProcessFlowId, createRelationId, createRequirementId, createRuleId, createScreenId, createStateId, createTableRefId, createTermId, createTransitionId, createUIComponentId, createUseCaseId, defineConfig, defineModel, defineSpecs, detectCycles, ensureDir, exportAllModels, exportMarkdown, exportMermaid, findConfigFile, findDefinitionFiles, findFiles, findModelTypeBySpecId, findTypeScriptFiles, generateDocsPath, generateSpecsPath, getAllInstances, getAllModelDefinitions, getAllModelInstances, getAllModels, getAllSpecIds, getExpectedOutputDirs, getGlobalModelRegistry, getLevelIndex, getModel, getModelDefinition, getModelInstance, getModelRegistryStats, getOutputPaths, getSpecById, getSpecStore, getSpecs, inferModelIdFromSpecId, lintAllModels, lintModel, loadConfig, loadSpeckeeperConfig, mergeSpecs, registerModel, registerModelDefinition, registerModelDefinitions, registerModelInstance, registerModelsFromConfig, registerSpecsFromConfig, resetModelInstances, resetModelRegistry, resetSpecStore, resolveReference, validateConfig, validateOutputPaths, validateRelationLevel, writeFile, writeJsonFile };
|
package/dist/index.js
CHANGED
|
@@ -612,6 +612,31 @@ function getSpecById(specId) {
|
|
|
612
612
|
if (!modelId) return null;
|
|
613
613
|
return { modelId, spec: specStore.get(modelId).get(specId) };
|
|
614
614
|
}
|
|
615
|
+
function defineSpecs(...entries) {
|
|
616
|
+
return {
|
|
617
|
+
entries: entries.map(([model, data]) => ({ model, data }))
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
function mergeSpecs(...modules) {
|
|
621
|
+
const modelMap = /* @__PURE__ */ new Map();
|
|
622
|
+
const allSpecs = [];
|
|
623
|
+
for (const mod of modules) {
|
|
624
|
+
for (const entry of mod.entries) {
|
|
625
|
+
modelMap.set(entry.model.id, entry.model);
|
|
626
|
+
allSpecs.push(entry);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
models: Array.from(modelMap.values()),
|
|
631
|
+
specs: allSpecs
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
function registerSpecsFromConfig(specs) {
|
|
635
|
+
if (!specs) return;
|
|
636
|
+
for (const entry of specs) {
|
|
637
|
+
entry.model.register(entry.data);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
615
640
|
|
|
616
641
|
// src/core/model-registry.ts
|
|
617
642
|
var globalRegistry = {
|
|
@@ -1147,6 +1172,6 @@ function generateSpecsPath(baseDir, category, filename) {
|
|
|
1147
1172
|
return join(baseDir, category, filename);
|
|
1148
1173
|
}
|
|
1149
1174
|
|
|
1150
|
-
export { CheckErrorSchema, CheckResultSchema, CheckWarningSchema, ConcretizationSlotSchema, ID_PATTERNS, LinkSchema, LintIssueSchema, Model, PhaseSchema, PrioritySchema, RELATION_CONSTRAINTS, RELATION_TYPES, ReferenceDefinitionSchema, RelationSchema, RelationsFieldSchema, batchWriteFiles, checkBatchDrift, checkExternalSsot, checkFileDrift, checkReferenceIntegrity, clearModelRegistry, computeHash, createAPIRefId, createActorId, createBatchRefId, createBoundaryId, createComponentId, createDTORequirementId, createEntityId, createErrorCaseId, createEventRequirementId, createFormId, createIaCRefId, createLayerId, createLintRule, createMarkdownExporter, createMermaidExporter, createProcessFlowId, createRelationId, createRequirementId, createRuleId, createScreenId, createStateId, createTableRefId, createTermId, createTransitionId, createUIComponentId, createUseCaseId, defineConfig, defineModel, detectCycles, ensureDir, exportAllModels, exportMarkdown, exportMermaid, findConfigFile, findDefinitionFiles, findFiles, findModelTypeBySpecId, findTypeScriptFiles, generateDocsPath, generateSpecsPath, getAllInstances, getAllModelDefinitions, getAllModelInstances, getAllModels, getAllSpecIds, getExpectedOutputDirs, getGlobalModelRegistry, getLevelIndex, getModel, getModelDefinition, getModelInstance, getModelRegistryStats, getOutputPaths, getSpecById, getSpecStore, getSpecs, inferModelIdFromSpecId, lintAllModels, lintModel, loadConfig, loadSpeckeeperConfig, registerModel, registerModelDefinition, registerModelDefinitions, registerModelInstance, registerModelsFromConfig, resetModelInstances, resetModelRegistry, resetSpecStore, resolveReference, validateConfig, validateOutputPaths, validateRelationLevel, writeFile, writeJsonFile };
|
|
1175
|
+
export { CheckErrorSchema, CheckResultSchema, CheckWarningSchema, ConcretizationSlotSchema, ID_PATTERNS, LinkSchema, LintIssueSchema, Model, PhaseSchema, PrioritySchema, RELATION_CONSTRAINTS, RELATION_TYPES, ReferenceDefinitionSchema, RelationSchema, RelationsFieldSchema, batchWriteFiles, checkBatchDrift, checkExternalSsot, checkFileDrift, checkReferenceIntegrity, clearModelRegistry, computeHash, createAPIRefId, createActorId, createBatchRefId, createBoundaryId, createComponentId, createDTORequirementId, createEntityId, createErrorCaseId, createEventRequirementId, createFormId, createIaCRefId, createLayerId, createLintRule, createMarkdownExporter, createMermaidExporter, createProcessFlowId, createRelationId, createRequirementId, createRuleId, createScreenId, createStateId, createTableRefId, createTermId, createTransitionId, createUIComponentId, createUseCaseId, defineConfig, defineModel, defineSpecs, detectCycles, ensureDir, exportAllModels, exportMarkdown, exportMermaid, findConfigFile, findDefinitionFiles, findFiles, findModelTypeBySpecId, findTypeScriptFiles, generateDocsPath, generateSpecsPath, getAllInstances, getAllModelDefinitions, getAllModelInstances, getAllModels, getAllSpecIds, getExpectedOutputDirs, getGlobalModelRegistry, getLevelIndex, getModel, getModelDefinition, getModelInstance, getModelRegistryStats, getOutputPaths, getSpecById, getSpecStore, getSpecs, inferModelIdFromSpecId, lintAllModels, lintModel, loadConfig, loadSpeckeeperConfig, mergeSpecs, registerModel, registerModelDefinition, registerModelDefinitions, registerModelInstance, registerModelsFromConfig, registerSpecsFromConfig, resetModelInstances, resetModelRegistry, resetSpecStore, resolveReference, validateConfig, validateOutputPaths, validateRelationLevel, writeFile, writeJsonFile };
|
|
1151
1176
|
//# sourceMappingURL=index.js.map
|
|
1152
1177
|
//# sourceMappingURL=index.js.map
|