Skip to content

Commit ac3f45b

Browse files
Merge pull request #1827 from pmerrison/feat/calm-visualizer
feat(calm-explorer): add interactive CALM architecture explorer
2 parents 67fae05 + 472466f commit ac3f45b

File tree

123 files changed

+27910
-1009
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+27910
-1009
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build CALM Explorer
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- 'main'
10+
push:
11+
branches:
12+
- 'main'
13+
14+
jobs:
15+
calm-explorer:
16+
name: Build, Test, and Lint CALM Explorer
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout PR Branch
21+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
25+
with:
26+
node-version: v22
27+
28+
- name: Install workspace
29+
run: npm ci
30+
31+
- name: Lint Module
32+
run: npm run lint --workspace=experimental/calm-explorer
33+
34+
- name: Build workspace
35+
run: npm run build --workspace=experimental/calm-explorer
36+
37+
- name: Run tests
38+
run: npm run test:run --workspace=experimental/calm-explorer

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ website/node_modules/
1111
# Generated docs
1212
docs/contributing.md
1313

14-
# We use YARN
15-
website/package-lock.json
14+
# We use YARN (but also need package-lock.json for CI)
15+
# website/package-lock.json
1616
/.idea/
1717

1818
**/.vscode/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
docs
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
pbcopy
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is a React-based visualization tool for FINOS CALM (Common Architecture Language Model) architecture diagrams. It provides an interactive graph visualization with a JSON editor, allowing users to visualize and explore software architecture definitions.
8+
9+
## Development Commands
10+
11+
```bash
12+
# Install dependencies
13+
npm i
14+
15+
# Start development server (runs on http://[::]:8080)
16+
npm run dev
17+
18+
# Build for production
19+
npm run build
20+
21+
# Build in development mode
22+
npm run build:dev
23+
24+
# Lint code
25+
npm run lint
26+
27+
# Preview production build
28+
npm run preview
29+
```
30+
31+
## Architecture
32+
33+
### Core Application Flow
34+
35+
1. **App.tsx**: Root component that sets up routing, React Query, and toast providers
36+
2. **pages/Index.tsx**: Main page that orchestrates the three-panel layout using ResizablePanelGroup
37+
3. **State Management**: Simple React state in Index.tsx manages:
38+
- `jsonContent`: Raw JSON string for the editor
39+
- `parsedData`: Parsed CALM object for visualization
40+
- `selectedNode`: Currently selected node for details view
41+
42+
### Key Components
43+
44+
**JsonEditor** (`components/JsonEditor.tsx`)
45+
- Monaco editor for JSON input
46+
- File upload functionality
47+
- Validates and parses JSON on change
48+
49+
**ArchitectureGraph** (`components/ArchitectureGraph.tsx`)
50+
- Uses ReactFlow for graph visualization
51+
- Dagre algorithm for automatic layout (left-to-right, configurable spacing)
52+
- Parses FINOS CALM format with nested `relationship-type.connects` structure
53+
- Handles both array and object node formats
54+
- Custom edge rendering with protocol tooltips
55+
56+
**NodeDetails** (`components/NodeDetails.tsx`)
57+
- Displays selected node properties
58+
- Replaces graph view when a node is clicked
59+
60+
**CustomEdge** (`components/CustomEdge.tsx`)
61+
- Custom ReactFlow edge with hover tooltips
62+
- Shows description and protocol information
63+
- Uses EdgeLabelRenderer for proper z-index handling
64+
65+
### FINOS CALM Data Structure
66+
67+
The app expects CALM JSON with this structure:
68+
69+
```json
70+
{
71+
"nodes": [
72+
{
73+
"unique-id": "node-id",
74+
"name": "Node Name",
75+
"node-type": "system|service|data-store",
76+
"interfaces": [...]
77+
}
78+
],
79+
"relationships": [
80+
{
81+
"unique-id": "rel-id",
82+
"relationship-type": {
83+
"connects": {
84+
"source": { "node": "source-id", "interface": "interface-id" },
85+
"destination": { "node": "dest-id", "interface": "interface-id" }
86+
}
87+
},
88+
"protocol": "HTTPS|MCP|..."
89+
}
90+
]
91+
}
92+
```
93+
94+
### Layout Algorithm
95+
96+
Graph layout uses Dagre with these settings:
97+
- `rankdir: 'LR'` (left to right)
98+
- `ranksep: 150` (horizontal spacing between ranks)
99+
- `nodesep: 100` (vertical spacing between nodes)
100+
- Node dimensions: 250x100
101+
102+
To modify layout, adjust parameters in `getLayoutedElements()` in ArchitectureGraph.tsx.
103+
104+
### Styling System
105+
106+
- **Framework**: Tailwind CSS with shadcn/ui components
107+
- **Theme**: HSL-based CSS variables for colors (supports dark mode via `class` strategy)
108+
- **Component library**: Full shadcn/ui suite in `components/ui/`
109+
- **Path alias**: `@/` maps to `src/`
110+
111+
### State and Data Flow
112+
113+
1. User inputs JSON in JsonEditor or uploads file
114+
2. onChange handler in Index.tsx updates `jsonContent` and attempts parse
115+
3. Valid JSON updates `parsedData` state
116+
4. ArchitectureGraph receives `parsedData` and re-renders graph
117+
5. Clicking a node calls `onNodeClick` which updates `selectedNode`
118+
6. NodeDetails panel replaces graph when `selectedNode` is set
119+
120+
## Git Commit Requirements
121+
122+
**CRITICAL**: This repository has CLA (Contributor License Agreement) checks that require commits to be authored by @pmerrison.
123+
124+
- Git is already configured correctly with author: Paul Merrison <paul@tetrate.io>
125+
- **DO NOT** modify git author configuration
126+
- **DO NOT** use any other author name or email in commits
127+
- All commits must pass CLA checks to be accepted into the upstream repository
128+
129+
When creating commits, the configured git author will automatically be used. No additional action is required.
130+
131+
## Project Configuration
132+
133+
- **Vite**: SWC-based React plugin for fast builds
134+
- **TypeScript**: Strict mode enabled
135+
- **Dev Server**: Runs on port 8080, listens on all interfaces (`::`), configured in vite.config.ts
136+
- **ESLint**: React hooks and refresh plugins configured
137+
- **Build Tool**: Vite with production optimizations

0 commit comments

Comments
 (0)