speckeeper 0.3.0 → 0.4.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/dist/cli.js +71 -78
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +14 -52
- package/dist/index.js +27 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -855,54 +855,6 @@ declare abstract class Model<TSchema extends ZodType> {
|
|
|
855
855
|
*/
|
|
856
856
|
register(specs: z.infer<TSchema>[]): void;
|
|
857
857
|
}
|
|
858
|
-
/**
|
|
859
|
-
* Get the global spec store (model ID → spec ID → spec data)
|
|
860
|
-
*/
|
|
861
|
-
declare function getSpecStore(): Map<string, Map<string, unknown>>;
|
|
862
|
-
/**
|
|
863
|
-
* Reset the spec store (clears all registered specs)
|
|
864
|
-
*/
|
|
865
|
-
declare function resetSpecStore(): void;
|
|
866
|
-
/**
|
|
867
|
-
* Register model
|
|
868
|
-
*/
|
|
869
|
-
declare function registerModel(model: Model<any>): void;
|
|
870
|
-
/**
|
|
871
|
-
* Get model
|
|
872
|
-
*/
|
|
873
|
-
declare function getModel(id: string): Model<any> | undefined;
|
|
874
|
-
/**
|
|
875
|
-
* Get all registered models
|
|
876
|
-
*/
|
|
877
|
-
declare function getAllModels(): Model<any>[];
|
|
878
|
-
/**
|
|
879
|
-
* Clear registry
|
|
880
|
-
*/
|
|
881
|
-
declare function clearModelRegistry(): void;
|
|
882
|
-
/**
|
|
883
|
-
* Register model instances from config.models array.
|
|
884
|
-
* Filters out non-Model values. Call this once after config is loaded.
|
|
885
|
-
*/
|
|
886
|
-
declare function registerModelsFromConfig(models: unknown[]): void;
|
|
887
|
-
/**
|
|
888
|
-
* Get specs for a given model ID from specStore
|
|
889
|
-
*/
|
|
890
|
-
declare function getSpecs(modelId: string): unknown[];
|
|
891
|
-
/**
|
|
892
|
-
* Get all spec IDs across all models
|
|
893
|
-
*/
|
|
894
|
-
declare function getAllSpecIds(): Set<string>;
|
|
895
|
-
/**
|
|
896
|
-
* Find which model type a spec ID belongs to
|
|
897
|
-
*/
|
|
898
|
-
declare function findModelTypeBySpecId(specId: string): string | null;
|
|
899
|
-
/**
|
|
900
|
-
* Get a spec by ID (searches all models)
|
|
901
|
-
*/
|
|
902
|
-
declare function getSpecById(specId: string): {
|
|
903
|
-
modelId: string;
|
|
904
|
-
spec: unknown;
|
|
905
|
-
} | null;
|
|
906
858
|
/**
|
|
907
859
|
* A single (Model, data[]) pair.
|
|
908
860
|
* Uses structural typing (not nominal Model<any>) so that
|
|
@@ -953,10 +905,20 @@ declare function defineSpecs(...entries: [SpecEntry['model'], unknown[]][]): Spe
|
|
|
953
905
|
*/
|
|
954
906
|
declare function mergeSpecs(...modules: SpecModule[]): MergedDesign;
|
|
955
907
|
/**
|
|
956
|
-
*
|
|
957
|
-
*
|
|
908
|
+
* Build a registry (modelId -> Map<specId, spec>) from config.specs.
|
|
909
|
+
* Pure function — no global state.
|
|
910
|
+
*/
|
|
911
|
+
declare function buildRegistryFromConfig(specs: SpecEntry[] | undefined): Record<string, Map<string, unknown>>;
|
|
912
|
+
/**
|
|
913
|
+
* Get specs for a model ID from config.specs.
|
|
914
|
+
* Pure function — no global state.
|
|
915
|
+
*/
|
|
916
|
+
declare function getSpecsFromConfig(specs: SpecEntry[] | undefined, modelId: string): unknown[];
|
|
917
|
+
/**
|
|
918
|
+
* Find which model type a spec ID belongs to, from config.specs.
|
|
919
|
+
* Pure function — no global state.
|
|
958
920
|
*/
|
|
959
|
-
declare function
|
|
921
|
+
declare function findModelTypeFromConfig(specs: SpecEntry[] | undefined, specId: string): string | null;
|
|
960
922
|
|
|
961
923
|
/**
|
|
962
924
|
* Register model definition
|
|
@@ -1392,4 +1354,4 @@ declare function findDefinitionFiles(srcDir: string, subDir: string): Promise<st
|
|
|
1392
1354
|
declare function generateDocsPath(baseDir: string, category: string, filename: string): string;
|
|
1393
1355
|
declare function generateSpecsPath(baseDir: string, category: string, filename: string): string;
|
|
1394
1356
|
|
|
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,
|
|
1357
|
+
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, buildRegistryFromConfig, checkBatchDrift, checkExternalSsot, checkFileDrift, checkReferenceIntegrity, 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, findModelTypeFromConfig, findTypeScriptFiles, generateDocsPath, generateSpecsPath, getAllInstances, getAllModelDefinitions, getAllModelInstances, getExpectedOutputDirs, getGlobalModelRegistry, getLevelIndex, getModelDefinition, getModelInstance, getModelRegistryStats, getOutputPaths, getSpecsFromConfig, inferModelIdFromSpecId, lintAllModels, lintModel, loadConfig, loadSpeckeeperConfig, mergeSpecs, registerModelDefinition, registerModelDefinitions, registerModelInstance, resetModelInstances, resetModelRegistry, resolveReference, validateConfig, validateOutputPaths, validateRelationLevel, writeFile, writeJsonFile };
|
package/dist/index.js
CHANGED
|
@@ -561,57 +561,10 @@ var Model = class {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
var specStore = /* @__PURE__ */ new Map();
|
|
564
|
-
function getSpecStore() {
|
|
565
|
-
return specStore;
|
|
566
|
-
}
|
|
567
|
-
function resetSpecStore() {
|
|
568
|
-
specStore.clear();
|
|
569
|
-
}
|
|
570
564
|
var modelRegistry = /* @__PURE__ */ new Map();
|
|
571
|
-
function registerModel(model) {
|
|
572
|
-
modelRegistry.set(model.id, model);
|
|
573
|
-
}
|
|
574
|
-
function getModel(id) {
|
|
575
|
-
return modelRegistry.get(id);
|
|
576
|
-
}
|
|
577
565
|
function getAllModels() {
|
|
578
566
|
return Array.from(modelRegistry.values());
|
|
579
567
|
}
|
|
580
|
-
function clearModelRegistry() {
|
|
581
|
-
modelRegistry.clear();
|
|
582
|
-
}
|
|
583
|
-
function registerModelsFromConfig(models) {
|
|
584
|
-
for (const model of models) {
|
|
585
|
-
if (model && typeof model === "object" && "id" in model && "schema" in model) {
|
|
586
|
-
registerModel(model);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
function getSpecs(modelId) {
|
|
591
|
-
const map = specStore.get(modelId);
|
|
592
|
-
if (!map) return [];
|
|
593
|
-
return Array.from(map.values());
|
|
594
|
-
}
|
|
595
|
-
function getAllSpecIds() {
|
|
596
|
-
const ids = /* @__PURE__ */ new Set();
|
|
597
|
-
for (const map of specStore.values()) {
|
|
598
|
-
for (const id of map.keys()) {
|
|
599
|
-
ids.add(id);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
return ids;
|
|
603
|
-
}
|
|
604
|
-
function findModelTypeBySpecId(specId) {
|
|
605
|
-
for (const [modelId, map] of specStore) {
|
|
606
|
-
if (map.has(specId)) return modelId;
|
|
607
|
-
}
|
|
608
|
-
return null;
|
|
609
|
-
}
|
|
610
|
-
function getSpecById(specId) {
|
|
611
|
-
const modelId = findModelTypeBySpecId(specId);
|
|
612
|
-
if (!modelId) return null;
|
|
613
|
-
return { modelId, spec: specStore.get(modelId).get(specId) };
|
|
614
|
-
}
|
|
615
568
|
function defineSpecs(...entries) {
|
|
616
569
|
return {
|
|
617
570
|
entries: entries.map(([model, data]) => ({ model, data }))
|
|
@@ -631,11 +584,34 @@ function mergeSpecs(...modules) {
|
|
|
631
584
|
specs: allSpecs
|
|
632
585
|
};
|
|
633
586
|
}
|
|
634
|
-
function
|
|
635
|
-
|
|
587
|
+
function buildRegistryFromConfig(specs) {
|
|
588
|
+
const registry = {};
|
|
589
|
+
if (!specs) return registry;
|
|
636
590
|
for (const entry of specs) {
|
|
637
|
-
entry.model.
|
|
591
|
+
if (!registry[entry.model.id]) {
|
|
592
|
+
registry[entry.model.id] = /* @__PURE__ */ new Map();
|
|
593
|
+
}
|
|
594
|
+
const map = registry[entry.model.id];
|
|
595
|
+
for (const spec of entry.data) {
|
|
596
|
+
map.set(spec.id, spec);
|
|
597
|
+
}
|
|
638
598
|
}
|
|
599
|
+
return registry;
|
|
600
|
+
}
|
|
601
|
+
function getSpecsFromConfig(specs, modelId) {
|
|
602
|
+
if (!specs) return [];
|
|
603
|
+
return specs.filter((e) => e.model.id === modelId).flatMap((e) => e.data);
|
|
604
|
+
}
|
|
605
|
+
function findModelTypeFromConfig(specs, specId) {
|
|
606
|
+
if (!specs) return null;
|
|
607
|
+
for (const entry of specs) {
|
|
608
|
+
for (const spec of entry.data) {
|
|
609
|
+
if (spec.id === specId) {
|
|
610
|
+
return entry.model.id;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return null;
|
|
639
615
|
}
|
|
640
616
|
|
|
641
617
|
// src/core/model-registry.ts
|
|
@@ -1172,6 +1148,6 @@ function generateSpecsPath(baseDir, category, filename) {
|
|
|
1172
1148
|
return join(baseDir, category, filename);
|
|
1173
1149
|
}
|
|
1174
1150
|
|
|
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,
|
|
1151
|
+
export { CheckErrorSchema, CheckResultSchema, CheckWarningSchema, ConcretizationSlotSchema, ID_PATTERNS, LinkSchema, LintIssueSchema, Model, PhaseSchema, PrioritySchema, RELATION_CONSTRAINTS, RELATION_TYPES, ReferenceDefinitionSchema, RelationSchema, RelationsFieldSchema, batchWriteFiles, buildRegistryFromConfig, checkBatchDrift, checkExternalSsot, checkFileDrift, checkReferenceIntegrity, 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, findModelTypeFromConfig, findTypeScriptFiles, generateDocsPath, generateSpecsPath, getAllInstances, getAllModelDefinitions, getAllModelInstances, getExpectedOutputDirs, getGlobalModelRegistry, getLevelIndex, getModelDefinition, getModelInstance, getModelRegistryStats, getOutputPaths, getSpecsFromConfig, inferModelIdFromSpecId, lintAllModels, lintModel, loadConfig, loadSpeckeeperConfig, mergeSpecs, registerModelDefinition, registerModelDefinitions, registerModelInstance, resetModelInstances, resetModelRegistry, resolveReference, validateConfig, validateOutputPaths, validateRelationLevel, writeFile, writeJsonFile };
|
|
1176
1152
|
//# sourceMappingURL=index.js.map
|
|
1177
1153
|
//# sourceMappingURL=index.js.map
|