@company-semantics/contracts 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/index.ts CHANGED
@@ -31,10 +31,11 @@ export type {
31
31
  SystemCapability,
32
32
  SystemLayer,
33
33
  SystemCapabilityManifest,
34
- // Graph-based diagram spec
34
+ // Graph-based diagram spec (v0.4.0)
35
35
  DiagramNodeKind,
36
36
  DiagramEdgeRelation,
37
37
  DiagramNode,
38
38
  DiagramEdge,
39
39
  DiagramSpec,
40
+ DiagramSnapshot,
40
41
  } from './system/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/system/diagram.ts CHANGED
@@ -1,14 +1,21 @@
1
1
  /**
2
- * Diagram Specification Types
2
+ * Diagram Specification Types (v0.4.0)
3
3
  *
4
- * Graph-based semantic model for system diagrams.
4
+ * Tree-based semantic model for system diagrams.
5
5
  * These types define MEANING, not presentation.
6
6
  *
7
7
  * Key invariants:
8
8
  * - No render hints — renderers decide presentation independently
9
- * - layer metadata is semantic grouping, not layout instruction
9
+ * - parentId creates hierarchy (tree structure), not edges
10
10
  * - Graphs can be rendered as ASCII, SVG, canvas, or any future format
11
11
  *
12
+ * v0.4.0 changes:
13
+ * - 'layer' kind renamed to 'group'
14
+ * - parentId replaces layer field for tree structure
15
+ * - order replaces orderInLayer
16
+ * - No 'contains' edges (hierarchy via parentId)
17
+ * - Added DiagramSnapshot for cross-repo distribution
18
+ *
12
19
  * @see ../docs/LIVING_ASCII_DIAGRAM_SPEC.md
13
20
  */
14
21
 
@@ -17,12 +24,13 @@ import type { FeatureStatus } from './index.js'
17
24
  /**
18
25
  * The semantic role of a node in the diagram.
19
26
  */
20
- export type DiagramNodeKind = 'layer' | 'feature' | 'artifact'
27
+ export type DiagramNodeKind = 'group' | 'feature' | 'artifact'
21
28
 
22
29
  /**
23
30
  * The semantic relationship between nodes.
31
+ * Note: 'contains' removed in v0.4.0 — hierarchy now via parentId
24
32
  */
25
- export type DiagramEdgeRelation = 'contains' | 'flows_to' | 'depends_on'
33
+ export type DiagramEdgeRelation = 'flows_to' | 'depends_on'
26
34
 
27
35
  /**
28
36
  * A node in the diagram graph.
@@ -35,12 +43,14 @@ export interface DiagramNode {
35
43
  label: string
36
44
  /** Semantic role */
37
45
  kind: DiagramNodeKind
46
+ /** Parent node ID for tree hierarchy (replaces layer field) */
47
+ parentId?: string
48
+ /** Order within parent for pipeline semantics */
49
+ order?: number
50
+ /** Whether this node can receive focus in interactive renderers */
51
+ focusable?: boolean
38
52
  /** Feature maturity status (only for 'feature' nodes) */
39
53
  status?: FeatureStatus
40
- /** Semantic grouping (not layout instruction) */
41
- layer?: string
42
- /** Order within layer for pipeline semantics */
43
- orderInLayer?: number
44
54
  }
45
55
 
46
56
  /**
@@ -70,3 +80,22 @@ export interface DiagramSpec {
70
80
  /** All edges connecting nodes */
71
81
  edges: DiagramEdge[]
72
82
  }
83
+
84
+ /**
85
+ * Snapshot of a rendered diagram for cross-repo distribution.
86
+ *
87
+ * Backend generates this and pushes to site repo via CI.
88
+ * Includes pre-rendered ASCII so site doesn't need rendering logic.
89
+ */
90
+ export interface DiagramSnapshot {
91
+ /** Pre-rendered ASCII art */
92
+ ascii: string
93
+ /** Semantic nodes for interactive features */
94
+ nodes: DiagramNode[]
95
+ /** ISO timestamp when snapshot was generated */
96
+ generatedAt: string
97
+ /** Version of the source manifest */
98
+ manifestVersion: number
99
+ /** Schema version for forward compatibility */
100
+ specVersion: 'v1'
101
+ }
package/system/index.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  /**
2
- * System Diagram Types
2
+ * System Diagram Types (v0.4.0)
3
3
  *
4
4
  * Schema for the Living ASCII System Diagram feature.
5
5
  * These types define the contract between:
6
- * - company-semantics (produces semantic DiagramSpec)
7
- * - company-semantics-site (renders diagrams client-side)
6
+ * - company-semantics-backend (produces DiagramSnapshot with pre-rendered ASCII)
7
+ * - company-semantics-site (displays snapshot, interactive features)
8
8
  *
9
9
  * Architecture:
10
- * - Backend owns MEANING (DiagramSpec with nodes/edges)
11
- * - Client owns RENDERING (ASCII, SVG, etc.)
12
- * - No diagram artifacts are committed — runtime rendering only
10
+ * - Backend owns MEANING and RENDERING (DiagramSnapshot with ASCII + nodes)
11
+ * - Client displays pre-rendered ASCII
12
+ * - Snapshots pushed via CI automation
13
13
  *
14
14
  * @see docs/LIVING_ASCII_DIAGRAM_SPEC.md
15
15
  */
@@ -71,4 +71,5 @@ export type {
71
71
  DiagramNode,
72
72
  DiagramEdge,
73
73
  DiagramSpec,
74
+ DiagramSnapshot,
74
75
  } from './diagram.js'