@sdd-method/sdd-cli 0.26.1 → 0.27.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.
Files changed (30) hide show
  1. package/dist/lib/catalogue/build.d.ts.map +1 -1
  2. package/dist/lib/catalogue/build.js +103 -1
  3. package/dist/lib/catalogue/build.js.map +1 -1
  4. package/dist/lib/catalogue/builders/c4-entity-rollups.d.ts +12 -0
  5. package/dist/lib/catalogue/builders/c4-entity-rollups.d.ts.map +1 -0
  6. package/dist/lib/catalogue/builders/c4-entity-rollups.js +87 -0
  7. package/dist/lib/catalogue/builders/c4-entity-rollups.js.map +1 -0
  8. package/dist/lib/catalogue/builders/entities-manifest.d.ts +15 -0
  9. package/dist/lib/catalogue/builders/entities-manifest.d.ts.map +1 -0
  10. package/dist/lib/catalogue/builders/entities-manifest.js +137 -0
  11. package/dist/lib/catalogue/builders/entities-manifest.js.map +1 -0
  12. package/dist/lib/catalogue/builders/entities-mermaid.d.ts +16 -0
  13. package/dist/lib/catalogue/builders/entities-mermaid.d.ts.map +1 -0
  14. package/dist/lib/catalogue/builders/entities-mermaid.js +166 -0
  15. package/dist/lib/catalogue/builders/entities-mermaid.js.map +1 -0
  16. package/dist/lib/catalogue/builders/entity-slug.d.ts +2 -0
  17. package/dist/lib/catalogue/builders/entity-slug.d.ts.map +1 -0
  18. package/dist/lib/catalogue/builders/entity-slug.js +34 -0
  19. package/dist/lib/catalogue/builders/entity-slug.js.map +1 -0
  20. package/dist/lib/catalogue/builders/index.d.ts +9 -0
  21. package/dist/lib/catalogue/builders/index.d.ts.map +1 -1
  22. package/dist/lib/catalogue/builders/index.js +5 -0
  23. package/dist/lib/catalogue/builders/index.js.map +1 -1
  24. package/dist/lib/catalogue/builders/service-entity-tables.d.ts +17 -0
  25. package/dist/lib/catalogue/builders/service-entity-tables.d.ts.map +1 -0
  26. package/dist/lib/catalogue/builders/service-entity-tables.js +212 -0
  27. package/dist/lib/catalogue/builders/service-entity-tables.js.map +1 -0
  28. package/dist/lib/catalogue/canonical-schema.yaml +58 -1
  29. package/dist/lib/mcp/tools/cascade-impact.d.ts +1 -1
  30. package/package.json +2 -2
@@ -0,0 +1,166 @@
1
+ // Reverse-method walker for the entities catalogue per ADR 0159 §4.3.
2
+ // Parses `erDiagram` blocks in `docs/domains/{domain}/architecture/data-model.mermaid.md`
3
+ // (or whatever file domain_models.csv references for that domain).
4
+ //
5
+ // Phase Pre findings (research/adr-0159-prototypes/connect-mermaid-authoring-quirks.md):
6
+ // - Multi-erDiagram-per-file is the norm (asset has 7 blocks; identity has 4).
7
+ // Walker merges entities across all `erDiagram` fences in the file.
8
+ // - Naming style varies within a single file: UPPER_SNAKE_CASE, PascalCase,
9
+ // ALLCAPS-no-underscores, lowercase / camelCase. Regex accepts [A-Za-z_]
10
+ // as first char with explicit Mermaid-keyword exclusion.
11
+ // - Relationship lines (`A ||--o{ B : "label"`) start with an identifier but
12
+ // are not entity declarations; detected via arrow-token pattern + skipped.
13
+ // - Mermaid comments (`%% ...`) are tolerated inside entity blocks.
14
+ // - Files may mix `erDiagram` with other Mermaid diagram types (flowchart,
15
+ // sequenceDiagram). Each fenced block is independently checked for the
16
+ // erDiagram opener; non-ER blocks are skipped.
17
+ import { readFile } from "node:fs/promises";
18
+ import { entitySlug } from "./entity-slug.js";
19
+ const RE_MERMAID_OPEN = /^```\s*mermaid\s*$/i;
20
+ const RE_FENCE_CLOSE = /^```\s*$/;
21
+ const RE_COMMENT = /^\s*%%/;
22
+ const RE_ENTITY_OPEN = /^\s*([A-Za-z_][A-Za-z0-9_]*)\s*\{\s*$/;
23
+ const RE_REL_LINE = /^\s*[A-Za-z_][A-Za-z0-9_]*\s+\|?\|?[o|\-]+\{?\s+[A-Za-z]/;
24
+ const MERMAID_KEYWORDS = new Set(["erdiagram", "subgraph", "classdef", "style", "class"]);
25
+ export async function buildEntitiesFromMermaid(inputs) {
26
+ const rows = [];
27
+ const seenAcrossFiles = new Map(); // id → originating doc_path
28
+ for (const dm of inputs.domainModels) {
29
+ if (!dm.doc_path.endsWith(".mermaid.md"))
30
+ continue;
31
+ const docPath = dm.doc_path.startsWith("/")
32
+ ? dm.doc_path
33
+ : `${inputs.sddPath}/${dm.doc_path}`;
34
+ let text;
35
+ try {
36
+ text = await readFile(docPath, "utf-8");
37
+ }
38
+ catch (err) {
39
+ if (err.code === "ENOENT")
40
+ continue;
41
+ throw err;
42
+ }
43
+ const parsed = parseFile(text, dm, inputs.findings);
44
+ // Within-file dedup by id is enforced inside parseFile via seen-set;
45
+ // cross-file dedup is enforced here (shouldn't fire in current Adopter A,
46
+ // defensive against future authoring that splits a domain across files).
47
+ for (const p of parsed) {
48
+ const id = `${p.domainId}-${entitySlug(p.name)}`;
49
+ const existing = seenAcrossFiles.get(id);
50
+ if (existing) {
51
+ inputs.findings.add("divergence", `entities: cross-file id collision on "${id}" — declared in ${existing} and ${dm.doc_path}; keeping first`);
52
+ continue;
53
+ }
54
+ seenAcrossFiles.set(id, dm.doc_path);
55
+ const glossaryTerm = resolveGlossaryTermBySlug(p.name, inputs.knownGlossaryIds);
56
+ rows.push({
57
+ id,
58
+ name: p.name,
59
+ domain_id: p.domainId,
60
+ source_domain_model_id: p.sourceDomainModelId,
61
+ persistence_kind: "",
62
+ glossary_term: glossaryTerm,
63
+ notes: `columns=${p.columnCount}`,
64
+ source_sdd_id: "",
65
+ });
66
+ }
67
+ }
68
+ return rows;
69
+ }
70
+ function parseFile(text, dm, findings) {
71
+ const lines = text.split(/\r?\n/);
72
+ const out = [];
73
+ const seenInFile = new Set();
74
+ let inMermaid = false;
75
+ let isEr = false;
76
+ let firstKeywordSeen = false;
77
+ let inEntity = false;
78
+ let entityName = null;
79
+ let entityColumns = 0;
80
+ for (let i = 0; i < lines.length; i++) {
81
+ const raw = lines[i] ?? "";
82
+ if (!inMermaid) {
83
+ if (RE_MERMAID_OPEN.test(raw)) {
84
+ inMermaid = true;
85
+ isEr = false;
86
+ firstKeywordSeen = false;
87
+ }
88
+ continue;
89
+ }
90
+ // in_mermaid == true
91
+ if (RE_FENCE_CLOSE.test(raw)) {
92
+ inMermaid = false;
93
+ isEr = false;
94
+ firstKeywordSeen = false;
95
+ // If we exit mid-entity, drop it silently — malformed block.
96
+ inEntity = false;
97
+ entityName = null;
98
+ continue;
99
+ }
100
+ const stripped = raw.trim();
101
+ if (!firstKeywordSeen && stripped !== "" && !RE_COMMENT.test(raw)) {
102
+ firstKeywordSeen = true;
103
+ isEr = stripped.toLowerCase().startsWith("erdiagram");
104
+ }
105
+ if (!isEr)
106
+ continue;
107
+ if (inEntity) {
108
+ if (stripped.startsWith("}")) {
109
+ if (entityName !== null) {
110
+ const slug = entitySlug(entityName);
111
+ if (!seenInFile.has(slug)) {
112
+ seenInFile.add(slug);
113
+ out.push({
114
+ name: entityName,
115
+ domainId: dm.domain_id,
116
+ sourceDomainModelId: dm.id,
117
+ columnCount: entityColumns,
118
+ });
119
+ }
120
+ }
121
+ inEntity = false;
122
+ entityName = null;
123
+ entityColumns = 0;
124
+ continue;
125
+ }
126
+ if (RE_COMMENT.test(raw))
127
+ continue;
128
+ if (stripped)
129
+ entityColumns++;
130
+ continue;
131
+ }
132
+ // Not in an entity block — look for an opener.
133
+ if (RE_COMMENT.test(raw))
134
+ continue;
135
+ if (RE_REL_LINE.test(raw))
136
+ continue;
137
+ const m = RE_ENTITY_OPEN.exec(raw);
138
+ if (m) {
139
+ const ident = m[1] ?? "";
140
+ if (MERMAID_KEYWORDS.has(ident.toLowerCase()))
141
+ continue;
142
+ entityName = ident;
143
+ inEntity = true;
144
+ entityColumns = 0;
145
+ }
146
+ }
147
+ // Defensive: if a block ended without closing an entity, log it once.
148
+ if (inEntity && entityName !== null) {
149
+ findings.add("convention", `entities-mermaid: ${dm.doc_path}: unclosed entity block for "${entityName}" — discarded`);
150
+ }
151
+ return out;
152
+ }
153
+ function resolveGlossaryTermBySlug(entityName, knownGlossaryIds) {
154
+ const slug = entitySlug(entityName);
155
+ if (!slug)
156
+ return "";
157
+ // Glossary ids follow {owning_domain_id}-{term_slug} or {slug} shape.
158
+ // Suffix-match keeps cross-domain ids resolvable while avoiding random
159
+ // substring collisions.
160
+ for (const id of knownGlossaryIds) {
161
+ if (id === slug || id.endsWith(`-${slug}`))
162
+ return id;
163
+ }
164
+ return ""; // Most data-model entities have no glossary term; no orphan finding.
165
+ }
166
+ //# sourceMappingURL=entities-mermaid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities-mermaid.js","sourceRoot":"","sources":["../../../../src/lib/catalogue/builders/entities-mermaid.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,0FAA0F;AAC1F,mEAAmE;AACnE,EAAE;AACF,yFAAyF;AACzF,+EAA+E;AAC/E,sEAAsE;AACtE,4EAA4E;AAC5E,2EAA2E;AAC3E,2DAA2D;AAC3D,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,2EAA2E;AAC3E,yEAAyE;AACzE,iDAAiD;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAC9C,MAAM,cAAc,GAAG,UAAU,CAAC;AAClC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,cAAc,GAAG,uCAAuC,CAAC;AAC/D,MAAM,WAAW,GAAG,0DAA0D,CAAC;AAE/E,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAuB1F,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAA6B;IAE7B,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,4BAA4B;IAE/E,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,YAAY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1
+ export declare function entitySlug(s: string): string;
2
+ //# sourceMappingURL=entity-slug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-slug.d.ts","sourceRoot":"","sources":["../../../../src/lib/catalogue/builders/entity-slug.ts"],"names":[],"mappings":"AA0BA,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO5C"}
@@ -0,0 +1,34 @@
1
+ // Entity-aware slug helper used by the data-model-entity walkers
2
+ // (entities-manifest, entities-mermaid, service-entity-tables) per ADR 0159 §4.6.
3
+ //
4
+ // Differs from the base `slugify` in events / capabilities / contracts: adds
5
+ // an ALLCAPS-then-Pascal split rule so naming-style variation across
6
+ // UPPER_SNAKE_CASE Mermaid authoring and PascalCase data-store-table
7
+ // authoring resolves to a single canonical slug.
8
+ //
9
+ // Examples:
10
+ // entitySlug("OBUConfigurationTemplate") → "obu-configuration-template"
11
+ // entitySlug("OBU_CONFIGURATION_TEMPLATE") → "obu-configuration-template"
12
+ // entitySlug("Vehicle") → "vehicle"
13
+ // entitySlug("APIKeyRotationRecord") → "api-key-rotation-record"
14
+ // entitySlug("customer") → "customer" (lowercase Mermaid)
15
+ // entitySlug("accountFeatures") → "account-features"
16
+ //
17
+ // Phase Pre finding (research/adr-0159-prototypes/PHASE-PRE-SYNTHESIS.md):
18
+ // without the ALLCAPS-then-Pascal rule, the Data Store Mapping table form
19
+ // (`OBUConfigurationTemplate`) never resolves to the Mermaid form
20
+ // (`OBU_CONFIGURATION_TEMPLATE`), breaking ~50% of expected service_entity
21
+ // edges in Adopter A.
22
+ //
23
+ // Kept local to the entity walkers to avoid affecting events / contracts /
24
+ // capability id generation. Promote to a shared module only if a fourth
25
+ // walker needs it (per ADR 0159 §4.6 deferred decision).
26
+ export function entitySlug(s) {
27
+ return s
28
+ .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2")
29
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
30
+ .toLowerCase()
31
+ .replace(/[^a-z0-9]+/g, "-")
32
+ .replace(/^-+|-+$/g, "");
33
+ }
34
+ //# sourceMappingURL=entity-slug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-slug.js","sourceRoot":"","sources":["../../../../src/lib/catalogue/builders/entity-slug.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,kFAAkF;AAClF,EAAE;AACF,6EAA6E;AAC7E,qEAAqE;AACrE,qEAAqE;AACrE,iDAAiD;AACjD,EAAE;AACF,YAAY;AACZ,4EAA4E;AAC5E,4EAA4E;AAC5E,yDAAyD;AACzD,yEAAyE;AACzE,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,kEAAkE;AAClE,2EAA2E;AAC3E,sBAAsB;AACtB,EAAE;AACF,2EAA2E;AAC3E,wEAAwE;AACxE,yDAAyD;AAEzD,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAO,CAAC;SACL,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
@@ -78,4 +78,13 @@ export { buildSystemExternalDependency } from "./system-external-dependency.js";
78
78
  export type { SystemExternalDependencyInputs } from "./system-external-dependency.js";
79
79
  export { buildPersonaC4System } from "./persona-c4system.js";
80
80
  export type { PersonaC4SystemInputs } from "./persona-c4system.js";
81
+ export { entitySlug } from "./entity-slug.js";
82
+ export { buildEntitiesFromManifest } from "./entities-manifest.js";
83
+ export type { EntitiesManifestInputs } from "./entities-manifest.js";
84
+ export { buildEntitiesFromMermaid } from "./entities-mermaid.js";
85
+ export type { EntitiesMermaidInputs, DomainModelInput, } from "./entities-mermaid.js";
86
+ export { buildServiceEntityFromTables } from "./service-entity-tables.js";
87
+ export type { ServiceEntityTablesInputs } from "./service-entity-tables.js";
88
+ export { buildC4ContainerEntity, buildC4SystemEntity, } from "./c4-entity-rollups.js";
89
+ export type { C4ContainerEntityInputs, C4SystemEntityInputs, } from "./c4-entity-rollups.js";
81
90
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/catalogue/builders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EACV,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EACV,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,E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CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EACV,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,YAAY,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC"}
@@ -42,4 +42,9 @@ export { buildProductPlatformDependencies } from "./product-platform-dependencie
42
42
  export { buildC4ExternalSystems } from "./c4-external-systems.js";
43
43
  export { buildSystemExternalDependency } from "./system-external-dependency.js";
44
44
  export { buildPersonaC4System } from "./persona-c4system.js";
45
+ export { entitySlug } from "./entity-slug.js";
46
+ export { buildEntitiesFromManifest } from "./entities-manifest.js";
47
+ export { buildEntitiesFromMermaid } from "./entities-mermaid.js";
48
+ export { buildServiceEntityFromTables } from "./service-entity-tables.js";
49
+ export { buildC4ContainerEntity, buildC4SystemEntity, } from "./c4-entity-rollups.js";
45
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/catalogue/builders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAA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E,MAAM,oCAAoC,CAAC;AAEtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAKlE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAKjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { CatalogueRow } from "../csv-writer.js";
2
+ import type { FindingsLog } from "../findings.js";
3
+ import type { DomainModelInput } from "./entities-mermaid.js";
4
+ export interface ServiceEntityTablesInputs {
5
+ readonly sddPath: string;
6
+ readonly findings: FindingsLog;
7
+ readonly domainModels: readonly DomainModelInput[];
8
+ /** From the entities builder: (domain, entitySlug(name)) → entities.id. */
9
+ readonly entityIdByDomainSlug: ReadonlyMap<string, string>;
10
+ /** All entity ids, for cross-domain fallback lookup. Key = entitySlug(name); value = first matching entities.id. */
11
+ readonly entityIdBySlug: ReadonlyMap<string, string>;
12
+ /** From the services builder. */
13
+ readonly services: readonly CatalogueRow[];
14
+ readonly knownServiceIds: ReadonlySet<string>;
15
+ }
16
+ export declare function buildServiceEntityFromTables(inputs: ServiceEntityTablesInputs): Promise<CatalogueRow[]>;
17
+ //# sourceMappingURL=service-entity-tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-entity-tables.d.ts","sourceRoot":"","sources":["../../../../src/lib/catalogue/builders/service-entity-tables.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAM9D,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,2EAA2E;IAC3E,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3D,oHAAoH;IACpH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/C;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,YAAY,EAAE,CAAC,CAqHzB"}
@@ -0,0 +1,212 @@
1
+ // Primary reverse-method walker for the service_entity edge catalogue per
2
+ // ADR 0159 §4.5. Reads per-domain `## Data Store Mapping` markdown tables in
3
+ // `docs/domains/{domain}/architecture/data-model.mermaid.md` files.
4
+ //
5
+ // Phase Pre findings (research/adr-0159-prototypes/connect-data-store-mapping-table-variations.md):
6
+ // - Two heading variants: `## Data Store Mapping` and `## Data Store Inventory`
7
+ // (the latter is store-centric — different schema, no Entity column — and
8
+ // gets skipped with a convention finding).
9
+ // - Three column-shape variants: standard (Entity | Store | Schema/Collection
10
+ // | Owning Service | PPT/Notes), developer's first col = `Entity / Artefact`,
11
+ // and vehicle's lack of `Owning Service` column (skipped).
12
+ // - Compound owning-service cells split on ` / ` — emit one edge per part.
13
+ // - Trailing `(annotation)` on entity texts stripped before slug-lookup.
14
+ // - Cross-domain entity references in tables resolve against entities.csv
15
+ // from any domain (not just the table's own domain) — same-domain first.
16
+ //
17
+ // Service-name resolution rules (ADR 0159 §4.7):
18
+ // 1. Try alias-map exact match (case-insensitive on display name).
19
+ // 2. Try entitySlug(display_name) ⋈ entitySlug(services.name).
20
+ // 3. Try entitySlug(display_name) ⋈ last_segment(services.id).
21
+ // 4. Fire [finding] orphan; skip edge.
22
+ import { readFile } from "node:fs/promises";
23
+ import { join } from "node:path";
24
+ import { parse as parseYaml } from "yaml";
25
+ import { entitySlug } from "./entity-slug.js";
26
+ const RE_DATA_STORE_HEADING = /^##\s+Data Store\s+(Mapping|Inventory)\s*$/i;
27
+ const ALIAS_REL_PATH = join("docs", "platform", "reference", "service-name-aliases.yaml");
28
+ export async function buildServiceEntityFromTables(inputs) {
29
+ const aliasMap = await loadAliasMap(inputs.sddPath, inputs.findings);
30
+ // Pre-compute service lookups.
31
+ const serviceIdBySlugName = new Map();
32
+ const serviceIdByTrailSegment = new Map();
33
+ for (const s of inputs.services) {
34
+ const id = String(s["id"]);
35
+ const name = String(s["name"] ?? "");
36
+ if (name)
37
+ serviceIdBySlugName.set(entitySlug(name), id);
38
+ const lastSeg = id.split("-").pop() ?? "";
39
+ if (lastSeg && !serviceIdByTrailSegment.has(lastSeg)) {
40
+ serviceIdByTrailSegment.set(lastSeg, id);
41
+ }
42
+ }
43
+ const rowsByPk = new Map();
44
+ for (const dm of inputs.domainModels) {
45
+ if (!dm.doc_path.endsWith(".mermaid.md"))
46
+ continue;
47
+ const fullPath = dm.doc_path.startsWith("/")
48
+ ? dm.doc_path
49
+ : join(inputs.sddPath, dm.doc_path);
50
+ let text;
51
+ try {
52
+ text = await readFile(fullPath, "utf-8");
53
+ }
54
+ catch (err) {
55
+ if (err.code === "ENOENT")
56
+ continue;
57
+ throw err;
58
+ }
59
+ const lines = text.split(/\r?\n/);
60
+ const headingIdx = lines.findIndex((l) => RE_DATA_STORE_HEADING.test(l));
61
+ if (headingIdx === -1)
62
+ continue;
63
+ const tableLines = collectTableLines(lines, headingIdx + 1);
64
+ if (tableLines === null || tableLines.length < 2) {
65
+ inputs.findings.add("convention", `service-entity-tables: ${dm.doc_path}: Data Store heading present but no markdown table follows — skipped`);
66
+ continue;
67
+ }
68
+ const headers = splitRow(tableLines[0]);
69
+ let entityColIdx = -1;
70
+ let serviceColIdx = -1;
71
+ for (let i = 0; i < headers.length; i++) {
72
+ const h = headers[i].toLowerCase();
73
+ if (entityColIdx === -1 && (h === "entity" || h.startsWith("entity"))) {
74
+ entityColIdx = i;
75
+ }
76
+ if (serviceColIdx === -1 && h.includes("owning service")) {
77
+ serviceColIdx = i;
78
+ }
79
+ }
80
+ if (entityColIdx === -1 || serviceColIdx === -1) {
81
+ inputs.findings.add("convention", `service-entity-tables: ${dm.doc_path}: Data Store table missing Entity or Owning Service column (headers: ${headers.join(" | ")}) — skipped`);
82
+ continue;
83
+ }
84
+ // Skip the |---|---| separator row (lineLine[1]); data rows start at index 2.
85
+ for (let i = 2; i < tableLines.length; i++) {
86
+ const cells = splitRow(tableLines[i]);
87
+ if (cells.length <= Math.max(entityColIdx, serviceColIdx))
88
+ continue;
89
+ const entityText = cells[entityColIdx].trim();
90
+ const serviceText = cells[serviceColIdx].trim();
91
+ if (!entityText || !serviceText)
92
+ continue;
93
+ // Strip trailing parenthetical annotation: "Role (fleet)" → "Role".
94
+ const entityNorm = entityText.replace(/\s*\([^)]+\)\s*$/, "").trim();
95
+ const entSlug = entitySlug(entityNorm);
96
+ let entityId = inputs.entityIdByDomainSlug.get(`${dm.domain_id}|${entSlug}`);
97
+ if (entityId === undefined) {
98
+ entityId = inputs.entityIdBySlug.get(entSlug);
99
+ }
100
+ if (entityId === undefined) {
101
+ inputs.findings.add("orphan", `service-entity-tables: ${dm.doc_path}: entity "${entityText}" doesn't resolve to an entities.csv row — edge skipped`);
102
+ continue;
103
+ }
104
+ // Compound owning-service: split on " / ".
105
+ const serviceParts = serviceText
106
+ .split(/\s+\/\s+/)
107
+ .map((s) => s.trim())
108
+ .filter((s) => s.length > 0);
109
+ for (const sp of serviceParts) {
110
+ const serviceId = resolveService(sp, aliasMap, serviceIdBySlugName, serviceIdByTrailSegment, inputs.knownServiceIds);
111
+ if (serviceId === undefined) {
112
+ inputs.findings.add("orphan", `service-entity-tables: ${dm.doc_path}: owning-service "${sp}" doesn't resolve to a services.csv row — edge skipped`);
113
+ continue;
114
+ }
115
+ const pk = `${serviceId}__${entityId}__owns`;
116
+ if (rowsByPk.has(pk))
117
+ continue;
118
+ rowsByPk.set(pk, {
119
+ id: pk,
120
+ service_id: serviceId,
121
+ entity_id: entityId,
122
+ relation: "owns",
123
+ evidence_path: dm.doc_path,
124
+ source_sdd_id: "",
125
+ });
126
+ }
127
+ }
128
+ }
129
+ return [...rowsByPk.values()];
130
+ }
131
+ async function loadAliasMap(sddPath, findings) {
132
+ const empty = { byDisplayLower: new Map() };
133
+ const path = join(sddPath, ALIAS_REL_PATH);
134
+ let text;
135
+ try {
136
+ text = await readFile(path, "utf-8");
137
+ }
138
+ catch (err) {
139
+ if (err.code === "ENOENT")
140
+ return empty;
141
+ throw err;
142
+ }
143
+ let raw;
144
+ try {
145
+ raw = parseYaml(text);
146
+ }
147
+ catch (err) {
148
+ findings.add("convention", `${ALIAS_REL_PATH}: failed to parse YAML — ${err.message}`);
149
+ return empty;
150
+ }
151
+ if (!raw || typeof raw !== "object")
152
+ return empty;
153
+ const obj = raw;
154
+ const aliases = obj["aliases"];
155
+ if (!Array.isArray(aliases))
156
+ return empty;
157
+ const map = new Map();
158
+ for (const a of aliases) {
159
+ if (!a || typeof a !== "object")
160
+ continue;
161
+ const e = a;
162
+ const display = String(e["display"] ?? "").trim();
163
+ const canonical = String(e["canonical"] ?? "").trim();
164
+ if (display && canonical)
165
+ map.set(display.toLowerCase(), canonical);
166
+ }
167
+ return { byDisplayLower: map };
168
+ }
169
+ function resolveService(display, alias, serviceIdBySlugName, serviceIdByTrailSegment, knownServiceIds) {
170
+ // 1. Alias map exact (case-insensitive).
171
+ const aliased = alias.byDisplayLower.get(display.toLowerCase());
172
+ if (aliased && knownServiceIds.has(aliased))
173
+ return aliased;
174
+ // 2. Slug-of-name match.
175
+ const slug = entitySlug(display);
176
+ if (!slug)
177
+ return undefined;
178
+ const bySlugName = serviceIdBySlugName.get(slug);
179
+ if (bySlugName && knownServiceIds.has(bySlugName))
180
+ return bySlugName;
181
+ // 3. Trailing-id-segment match.
182
+ const byTrail = serviceIdByTrailSegment.get(slug);
183
+ if (byTrail && knownServiceIds.has(byTrail))
184
+ return byTrail;
185
+ return undefined;
186
+ }
187
+ function splitRow(line) {
188
+ // Strip leading/trailing `|`, split on `|`, trim cells.
189
+ const trimmed = line.trim();
190
+ const parts = trimmed.split("|");
191
+ // Drop the empty cells from leading/trailing `|`.
192
+ return parts.slice(1, parts.length - 1).map((c) => c.trim());
193
+ }
194
+ function collectTableLines(lines, startIdx) {
195
+ let i = startIdx;
196
+ while (i < lines.length) {
197
+ const l = lines[i] ?? "";
198
+ if (l.startsWith("## "))
199
+ return null;
200
+ if (l.trimStart().startsWith("|")) {
201
+ const out = [];
202
+ while (i < lines.length && lines[i].trimStart().startsWith("|")) {
203
+ out.push(lines[i]);
204
+ i++;
205
+ }
206
+ return out;
207
+ }
208
+ i++;
209
+ }
210
+ return null;
211
+ }
212
+ //# sourceMappingURL=service-entity-tables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-entity-tables.js","sourceRoot":"","sources":["../../../../src/lib/catalogue/builders/service-entity-tables.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,oEAAoE;AACpE,EAAE;AACF,oGAAoG;AACpG,gFAAgF;AAChF,4EAA4E;AAC5E,6CAA6C;AAC7C,8EAA8E;AAC9E,gFAAgF;AAChF,6DAA6D;AAC7D,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,EAAE;AACF,iDAAiD;AACjD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CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;gBACpB,CAAC,EAAE,CAAC;YACN,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -45,7 +45,7 @@
45
45
  # Builder contract: see docs/method/methods/catalogue-builder-specification.md.
46
46
  # Category taxonomy: see docs/method/methods/product-category-taxonomy.md.
47
47
 
48
- schema_version: "2.12.0"
48
+ schema_version: "2.13.0"
49
49
  schema_owner: "sdd-method"
50
50
  schema_status: "canonical"
51
51
  # Bump rationale (2.9.0 — additive minor): adds the Track 2 cohort-sweep
@@ -507,6 +507,23 @@ catalogues:
507
507
  - { name: version, type: string, nullable: true, description: "Optional explicit version; null until the domain model is formally versioned (typically at first contract lock-in)." }
508
508
  - { name: source_sdd_id, type: string, nullable: true, description: "Originating SDD slug. Populated by the aggregator per ADR 0134." }
509
509
 
510
+ entities:
511
+ primary_key: id
512
+ description: "Data-model entity (a structural realisation of a concept inside a domain's data model). Distinct from glossary_items (vocabulary-level) and from domain_models (file-level). Added in schema 2.13.0 per ADR 0159. Forward source: `models[].entities[]` in glossary-alignment-manifest.yaml. Reverse source: `EntityName { ... }` declarations inside `erDiagram` fences in `docs/domains/{domain}/architecture/data-model.mermaid.md`. PK uses an entity-aware slug that normalises across UPPER_SNAKE and PascalCase authoring styles."
513
+ foreign_keys:
514
+ - { column: domain_id, references: domains.id, nullable: true }
515
+ - { column: source_domain_model_id, references: domain_models.id, nullable: true }
516
+ - { column: glossary_term, references: glossary_items.id, nullable: true }
517
+ columns:
518
+ - { name: id, type: string, nullable: false, description: "Slugged PK: {domain_id}-{entitySlug(name)}. For manifest-sourced rows with domain=platform-wide, the leading domain segment is empty (`-{entitySlug(name)}`) and the row carries a [finding] convention." }
519
+ - { name: name, type: string, nullable: false, description: "Entity name as authored. Preserves the original case/style (UPPER_SNAKE_CASE, PascalCase, lowercase camelCase all observed in the wild)." }
520
+ - { name: domain_id, type: string, nullable: true, description: "Owning domain. Nullable when the source is a non-canonical domain hint such as `platform-wide`; the walker emits a finding in that case." }
521
+ - { name: source_domain_model_id, type: string, nullable: true, description: "FK to domain_models.csv — the file the entity was extracted from. Populated by the reverse-method walker (Mermaid parse); empty when authored only via the forward-method manifest." }
522
+ - { name: persistence_kind, type: string, nullable: true, description: "Open string; recommended values: relational-table | document-collection | event-payload | dto | view | other. Values outside the recommended set fire `[finding] convention`." }
523
+ - { name: glossary_term, type: string, nullable: true, description: "FK to glossary_items.id when the entity name resolves to a canonical glossary term (by entity-aware slug). Drives entity_glossary edge emission." }
524
+ - { name: notes, type: string, nullable: true, description: "Free-form notes preserved from the authoring source. Carries `status=...`, `superseded_by=...`, and column count for diagnostic value." }
525
+ - { name: source_sdd_id, type: string, nullable: true, description: "Originating SDD slug. Populated by the aggregator per ADR 0134." }
526
+
510
527
  # ---- Edge catalogues ----
511
528
  # Edge catalogues do not carry source_sdd_id — provenance is recoverable
512
529
  # from either endpoint's row per ADR 0134.
@@ -583,6 +600,20 @@ catalogues:
583
600
  - { name: event_id, type: string, nullable: false }
584
601
  - { name: role, type: string, nullable: false, description: "publishes | consumes." }
585
602
 
603
+ service_entity:
604
+ primary_key: id
605
+ description: "Edge: service touches data-model entity. Added in schema 2.13.0 per ADR 0159. Primary source: per-domain `## Data Store Mapping` markdown table in `docs/domains/{domain}/architecture/data-model.mermaid.md` (relation=owns). Optional forward source (Phase 5 deferred): `entities:` block in `orchestration/repo-config/<repo>.yaml`. Service names resolve via heuristic (slug-of-name; trailing-id-segment) with optional adopter-authored alias map at `docs/platform/reference/service-name-aliases.yaml`."
606
+ foreign_keys:
607
+ - { column: service_id, references: services.id, nullable: false }
608
+ - { column: entity_id, references: entities.id, nullable: false }
609
+ columns:
610
+ - { name: id, type: string, nullable: false, description: "Composite PK: {service_id}__{entity_id}__{relation}." }
611
+ - { name: service_id, type: string, nullable: false }
612
+ - { name: entity_id, type: string, nullable: false }
613
+ - { name: relation, type: string, nullable: false, description: "Open string; recommended values: owns | reads | writes | references. Data Store Mapping table source emits `owns`. Values outside the recommended set fire `[finding] convention`." }
614
+ - { name: evidence_path, type: string, nullable: true, description: "Source markdown path or feature-grounding row that produced the edge. Audit aid." }
615
+ - { name: source_sdd_id, type: string, nullable: true, description: "Originating SDD slug. Populated by the aggregator per ADR 0134." }
616
+
586
617
  capability_feature:
587
618
  primary_key: id
588
619
  description: "Edge: capability decomposes into features. Forward: traceability.runway.enables. Reverse: parsed from spec Feature Grounding."
@@ -760,6 +791,32 @@ catalogues:
760
791
  - { name: external_system_id, type: string, nullable: false }
761
792
  - { name: interaction, type: string, nullable: true, description: "Optional integration label/protocol from the Rel(...) line." }
762
793
 
794
+ c4_container_entity:
795
+ primary_key: id
796
+ description: "Derived edge: C4 container is responsible for data-model entity. Added in schema 2.13.0 per ADR 0159 §4.8. Pure transitive derivation: `service_entity ⋈ c4_containers.service_id`. Only the subset of containers with `service_id` populated contribute edges (per ADR 0155 the container ↔ service cardinality is o-or-1; data-store containers and infra-umbrella containers without a service mapping legitimately emit no rows)."
797
+ foreign_keys:
798
+ - { column: container_id, references: c4_containers.id, nullable: false }
799
+ - { column: entity_id, references: entities.id, nullable: false }
800
+ columns:
801
+ - { name: id, type: string, nullable: false, description: "Composite PK: {container_id}__{entity_id}." }
802
+ - { name: container_id, type: string, nullable: false }
803
+ - { name: entity_id, type: string, nullable: false }
804
+ - { name: relation, type: string, nullable: false, description: "Inherits from upstream service_entity.relation when derived." }
805
+ - { name: source_sdd_id, type: string, nullable: true }
806
+
807
+ c4_system_entity:
808
+ primary_key: id
809
+ description: "Derived edge: C4 system is responsible for data-model entity. Added in schema 2.13.0 per ADR 0159 §4.8. Pure aggregation roll-up: `c4_container_entity ⋈ c4_containers.system_id`, with container_count recording how many of the system's containers touch the entity (governance signal for cross-container concerns)."
810
+ foreign_keys:
811
+ - { column: system_id, references: c4_systems.id, nullable: false }
812
+ - { column: entity_id, references: entities.id, nullable: false }
813
+ columns:
814
+ - { name: id, type: string, nullable: false, description: "Composite PK: {system_id}__{entity_id}." }
815
+ - { name: system_id, type: string, nullable: false }
816
+ - { name: entity_id, type: string, nullable: false }
817
+ - { name: container_count, type: integer, nullable: false, description: "Number of the system's containers that touch this entity. Aggregated from c4_container_entity." }
818
+ - { name: source_sdd_id, type: string, nullable: true }
819
+
763
820
  capability_adr:
764
821
  primary_key: id
765
822
  description: "Edge: ADR informs capability. Forward: declared in capability spec Architecture Decisions. Reverse: same plus heuristic match supplements with confidence."
@@ -12,8 +12,8 @@ import { z } from "zod";
12
12
  export declare const cascadeImpactArgsSchema: {
13
13
  change_type: z.ZodEnum<{
14
14
  capability: "capability";
15
- service: "service";
16
15
  entity: "entity";
16
+ service: "service";
17
17
  }>;
18
18
  target: z.ZodString;
19
19
  pin_to_commit: z.ZodOptional<z.ZodString>;