@company-semantics/contracts 0.2.2 → 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,14 +31,11 @@ export type {
31
31
  SystemCapability,
32
32
  SystemLayer,
33
33
  SystemCapabilityManifest,
34
- // Snapshot metadata
35
- SystemSnapshotMeta,
36
- /** @deprecated Use DiagramSpec instead */
37
- SystemSnapshot,
38
- // Graph-based diagram spec (new architecture)
34
+ // Graph-based diagram spec (v0.4.0)
39
35
  DiagramNodeKind,
40
36
  DiagramEdgeRelation,
41
37
  DiagramNode,
42
38
  DiagramEdge,
43
39
  DiagramSpec,
40
+ DiagramSnapshot,
44
41
  } from './system/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/system/README.md CHANGED
@@ -25,17 +25,13 @@ Defines the semantic contract between backend (producer) and site (renderer).
25
25
  - `SystemLayer` — logical layer grouping
26
26
  - `SystemCapabilityManifest` — full manifest structure (YAML representation)
27
27
 
28
- ### Diagram graph (new architecture)
28
+ ### Diagram graph
29
29
  - `DiagramNodeKind` — 'layer' | 'feature' | 'artifact'
30
30
  - `DiagramEdgeRelation` — 'contains' | 'flows_to' | 'depends_on'
31
31
  - `DiagramNode` — semantic node with optional layer grouping
32
32
  - `DiagramEdge` — semantic relationship between nodes
33
33
  - `DiagramSpec` — complete graph that crosses system boundaries
34
34
 
35
- ### Metadata (retained for compatibility)
36
- - `SystemSnapshotMeta` — generation metadata
37
- - `SystemSnapshot` — **deprecated**, use DiagramSpec instead
38
-
39
35
  ## Dependencies
40
36
 
41
37
  **Imports from:** (none — leaf module)
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
  */
@@ -64,43 +64,12 @@ export interface SystemCapabilityManifest {
64
64
  layers: SystemLayer[]
65
65
  }
66
66
 
67
- /**
68
- * Metadata accompanying a generated snapshot.
69
- */
70
- export interface SystemSnapshotMeta {
71
- /** Metadata format version */
72
- version: number
73
- /** ISO 8601 timestamp of generation */
74
- snapshotDate: string
75
- /** Git commit SHA of source */
76
- commitSha: string
77
- /** Schema version used for generation */
78
- schemaVersion: string
79
- /** Visibility level (always 'public' for now) */
80
- visibility: 'public'
81
- /** SHA256 checksum of the ASCII content */
82
- checksum?: string
83
- }
84
-
85
- /**
86
- * Complete snapshot bundle (ASCII + metadata).
87
- * @deprecated Use DiagramSpec instead. This type will be removed in a future version.
88
- * ASCII rendering now happens client-side from DiagramSpec.
89
- */
90
- export interface SystemSnapshot {
91
- /** Raw ASCII diagram content */
92
- ascii: string
93
- /** Snapshot metadata */
94
- meta: SystemSnapshotMeta
95
- /** Optional explanation markdown */
96
- explanation?: string
97
- }
98
-
99
- // Graph-based diagram types (new architecture)
67
+ // Graph-based diagram types
100
68
  export type {
101
69
  DiagramNodeKind,
102
70
  DiagramEdgeRelation,
103
71
  DiagramNode,
104
72
  DiagramEdge,
105
73
  DiagramSpec,
74
+ DiagramSnapshot,
106
75
  } from './diagram.js'