@atolis-hq/corum 0.1.0 → 0.1.5

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/README.md CHANGED
@@ -1,223 +1,220 @@
1
- <div width="100%" align="center">
2
- <img src="assets/corum-logo.svg" width="120" height="120" /><br>
3
- <h1>Corum</h1>
4
- </div>
5
-
6
- Corum loads design graph files from disk into an in-memory graph and exposes the graph through MCP tools.
7
-
8
- ## Requirements
9
-
10
- - Node.js 20 or newer
11
- - npm
12
-
13
- ## Install
14
-
15
- From the repository root:
16
-
17
- ```powershell
18
- npm install
19
- ```
20
-
21
- This installs TypeScript, the MCP SDK, and YAML parsing dependencies.
22
-
23
- ## Build
24
-
25
- Compile the TypeScript sources into `dist/`:
26
-
27
- ```powershell
28
- npm run build
29
- ```
30
-
31
- The build command runs `tsc`.
32
-
33
- ## Test
34
-
35
- Run the full test suite:
36
-
37
- ```powershell
38
- npm test
39
- ```
40
-
41
- This compiles the project and runs the Node test runner against:
42
-
43
- - `test/schema.test.ts`
44
- - `test/loader.test.ts`
45
- - `test/graph.test.ts`
46
- - `test/mcp.test.ts`
47
- - `test/writer.test.ts`
48
- - `test/serializer.test.ts`
49
-
50
- The fixture graph used by the tests is in `fixtures/sample-graph`. The tests verify that it loads as `45` nodes and `38` edges.
51
-
52
- ## Run The MCP Server
53
-
54
- Build first:
55
-
56
- ```powershell
57
- npm run build
58
- ```
59
-
60
- Run the MCP server against the default graph path:
61
-
62
- ```powershell
63
- npm run mcp
64
- ```
65
-
66
- By default, the server loads:
67
-
68
- ```text
69
- .corum/graph
70
- ```
71
-
72
- To run it against the sample graph fixture instead:
73
-
74
- ```powershell
75
- $env:CORUM_GRAPH_PATH = "fixtures/sample-graph"
76
- npm run mcp
77
- ```
78
-
79
- To reload the in-memory graph when graph YAML or template YAML files change, pass `--watch` to the built server:
80
-
81
- ```powershell
82
- node dist/src/mcp/index.js --watch
83
- ```
84
-
85
- The same watcher can be enabled for the web server with `node dist/src/web/server.js --watch`, or for either server by setting `CORUM_FILE_WATCHER=true`.
86
-
87
- Starting with powershell
88
- ```
89
- $env:CORUM_GRAPH_PATH = "fixtures/sample-graph";
90
- $env:CORUM_WEB_PORT = 3001;
91
- $env:CORUM_FILE_WATCHER="true";
92
- npm run web
93
- ```
94
-
95
- To run the web app against a git repository instead of a filesystem graph path, set `CORUM_SOURCE=git` before starting the app.
96
-
97
- For a local git repository:
98
-
99
- ```powershell
100
- $env:CORUM_SOURCE = "git"
101
- $env:CORUM_GIT_LOCAL_PATH = "C:\git\atolis-hq\corum-design-graph"
102
- $env:CORUM_GIT_BRANCH = "main"
103
- $env:CORUM_GIT_POLL_SECONDS = 10
104
- $env:CORUM_WEB_PORT = 3001
105
- npm run web
106
- ```
107
-
108
- For a remote repository:
109
-
110
- ```powershell
111
- $env:CORUM_SOURCE = "git"
112
- $env:CORUM_GIT_REMOTE_URL = "https://github.com/org/design-repo.git"
113
- $env:CORUM_GIT_BRANCH = "main"
114
- $env:CORUM_GIT_POLL_SECONDS = 10
115
- $env:CORUM_WEB_PORT = 3001
116
- npm run web
117
- ```
118
-
119
- For private remote repositories, also set `CORUM_GIT_TOKEN`. `CORUM_GIT_USERNAME` defaults to `x-access-token` when a token is present.
120
-
121
- The same git source config is used by `npm run mcp`. Git-backed startup expects graph files in `.corum/graph` and template packs in `.corum/packs`, and loads the selected branch at process start.
122
-
123
- `CORUM_GIT_POLL_SECONDS` is optional. When set to a positive number of seconds, the web server polls the git source for branch/ref changes, invalidates its cached multi-branch view, and reloads the app automatically. If it is not set, git-backed content is not polled.
124
-
125
- `CORUM_FILE_WATCHER` only watches filesystem graph paths. It does not watch git refs. For git-backed web sessions, you can either enable `CORUM_GIT_POLL_SECONDS` or use the always-visible `Reload` button in the branch bar to force a refresh.
126
-
127
- The MCP server exposes these tools:
128
-
129
- - `list_nodes`: lists graph nodes, optionally filtered by `template`, `component`, `state`, or `stability`
130
- - `list_templates`: lists loaded graph templates with summary metadata
131
- - `get_template`: returns full details for a loaded graph template
132
- - `get_cluster`: returns a root node, owned child nodes, and edges inside that cluster
133
- - `get_linked_fields`: returns `maps-to` edges touching fields owned by a root node
134
-
135
- Each tool accepts an optional `format` argument:
136
-
137
- - `yaml`: default, human-readable YAML
138
- - `json`: pretty JSON
139
- - `toon`: TOON output via the official `@toon-format/toon` encoder for lower token use
140
-
141
- Each tool also accepts `compact_keys: true` to shorten common graph keys before serialization. This works with all formats:
142
-
143
- ```text
144
- id -> i
145
- template -> t
146
- component -> cp
147
- state -> s
148
- stability -> st
149
- schemaVersion -> sv
150
- lastModifiedAt -> lm
151
- extractedFrom -> xf
152
- properties -> p
153
- root -> r
154
- children -> ch
155
- edges -> e
156
- nodes -> n
157
- from -> fr
158
- to -> to
159
- type -> ty
160
- notes -> nt
161
- ```
162
-
163
- ## MCP Client Configuration
164
-
165
- This repo includes a project-level `.mcp.json`:
166
-
167
- ```json
168
- {
169
- "mcpServers": {
170
- "corum": {
171
- "command": "node",
172
- "args": ["dist/src/mcp/index.js"],
173
- "env": {
174
- "CORUM_GRAPH_PATH": "fixtures/sample-graph"
175
- }
176
- }
177
- }
178
- }
179
- ```
180
-
181
- Build the project before using this config from an MCP client:
182
-
183
- ```powershell
184
- npm run build
185
- ```
186
-
187
- The checked-in config points at `fixtures/sample-graph` so the tools return sample nodes immediately. Change `CORUM_GRAPH_PATH` to `.corum/graph` when you have graph component files there.
188
-
189
- ## MCP Smoke Test
190
-
191
- Run a local MCP client against the configured server and print graph data:
192
-
193
- ```powershell
194
- npm run mcp:smoke
195
- ```
196
-
197
- The smoke test starts the MCP server over stdio and calls:
198
-
199
- - `list_nodes`
200
- - `list_nodes` filtered to `APIEndpoint`
201
- - `get_cluster` for `orders.DomainModel.order`
202
- - `get_linked_fields` for `orders.DomainModel.order`
203
-
204
- ## Useful Development Commands
205
-
206
- Type-check without emitting files:
207
-
208
- ```powershell
209
- npx tsc --noEmit
210
- ```
211
-
212
- Run one compiled test file after building:
213
-
214
- ```powershell
215
- npm run build
216
- node --test dist/test/loader.test.js
217
- ```
218
-
219
- Clean generated build output manually if needed:
220
-
221
- ```powershell
222
- Remove-Item -Recurse -Force dist
223
- ```
1
+ # Corum
2
+
3
+ Corum loads design graph files from disk into an in-memory graph and exposes the graph through MCP tools.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js 20 or newer
8
+ - npm
9
+
10
+ ## Install
11
+
12
+ From the repository root:
13
+
14
+ ```powershell
15
+ npm install
16
+ ```
17
+
18
+ This installs TypeScript, the MCP SDK, and YAML parsing dependencies.
19
+
20
+ ## Build
21
+
22
+ Compile the TypeScript sources into `dist/`:
23
+
24
+ ```powershell
25
+ npm run build
26
+ ```
27
+
28
+ The build command runs `tsc`.
29
+
30
+ ## Test
31
+
32
+ Run the full test suite:
33
+
34
+ ```powershell
35
+ npm test
36
+ ```
37
+
38
+ This compiles the project and runs the Node test runner against:
39
+
40
+ - `test/schema.test.ts`
41
+ - `test/loader.test.ts`
42
+ - `test/graph.test.ts`
43
+ - `test/mcp.test.ts`
44
+ - `test/writer.test.ts`
45
+ - `test/serializer.test.ts`
46
+
47
+ The fixture graph used by the tests is in `fixtures/sample-graph`. The tests verify that it loads as `45` nodes and `38` edges.
48
+
49
+ ## Run The MCP Server
50
+
51
+ Build first:
52
+
53
+ ```powershell
54
+ npm run build
55
+ ```
56
+
57
+ Run the MCP server against the default graph path:
58
+
59
+ ```powershell
60
+ npm run mcp
61
+ ```
62
+
63
+ By default, the server loads:
64
+
65
+ ```text
66
+ .corum/graph
67
+ ```
68
+
69
+ To run it against the sample graph fixture instead:
70
+
71
+ ```powershell
72
+ $env:CORUM_GRAPH_PATH = "fixtures/sample-graph"
73
+ npm run mcp
74
+ ```
75
+
76
+ To reload the in-memory graph when graph YAML or template YAML files change, pass `--watch` to the built server:
77
+
78
+ ```powershell
79
+ node dist/src/mcp/index.js --watch
80
+ ```
81
+
82
+ The same watcher can be enabled for the web server with `node dist/src/web/server.js --watch`, or for either server by setting `CORUM_FILE_WATCHER=true`.
83
+
84
+ Starting with powershell
85
+ ```
86
+ $env:CORUM_GRAPH_PATH = "fixtures/sample-graph";
87
+ $env:CORUM_WEB_PORT = 3001;
88
+ $env:CORUM_FILE_WATCHER="true";
89
+ npm run web
90
+ ```
91
+
92
+ To run the web app against a git repository instead of a filesystem graph path, set `CORUM_SOURCE=git` before starting the app.
93
+
94
+ For a local git repository:
95
+
96
+ ```powershell
97
+ $env:CORUM_SOURCE = "git"
98
+ $env:CORUM_GIT_LOCAL_PATH = "C:\git\atolis-hq\corum-design-graph"
99
+ $env:CORUM_GIT_BRANCH = "main"
100
+ $env:CORUM_GIT_POLL_SECONDS = 10
101
+ $env:CORUM_WEB_PORT = 3001
102
+ npm run web
103
+ ```
104
+
105
+ For a remote repository:
106
+
107
+ ```powershell
108
+ $env:CORUM_SOURCE = "git"
109
+ $env:CORUM_GIT_REMOTE_URL = "https://github.com/org/design-repo.git"
110
+ $env:CORUM_GIT_BRANCH = "main"
111
+ $env:CORUM_GIT_POLL_SECONDS = 10
112
+ $env:CORUM_WEB_PORT = 3001
113
+ npm run web
114
+ ```
115
+
116
+ For private remote repositories, also set `CORUM_GIT_TOKEN`. `CORUM_GIT_USERNAME` defaults to `x-access-token` when a token is present.
117
+
118
+ The same git source config is used by `npm run mcp`. Git-backed startup expects graph files in `.corum/graph` and template packs in `.corum/packs`, and loads the selected branch at process start.
119
+
120
+ `CORUM_GIT_POLL_SECONDS` is optional. When set to a positive number of seconds, the web server polls the git source for branch/ref changes, invalidates its cached multi-branch view, and reloads the app automatically. If it is not set, git-backed content is not polled.
121
+
122
+ `CORUM_FILE_WATCHER` only watches filesystem graph paths. It does not watch git refs. For git-backed web sessions, you can either enable `CORUM_GIT_POLL_SECONDS` or use the always-visible `Reload` button in the branch bar to force a refresh.
123
+
124
+ The MCP server exposes these tools:
125
+
126
+ - `list_nodes`: lists graph nodes, optionally filtered by `template`, `component`, `state`, or `stability`
127
+ - `list_templates`: lists loaded graph templates with summary metadata
128
+ - `get_template`: returns full details for a loaded graph template
129
+ - `get_cluster`: returns a root node, owned child nodes, and edges inside that cluster
130
+ - `get_linked_fields`: returns `maps-to` edges touching fields owned by a root node
131
+
132
+ Each tool accepts an optional `format` argument:
133
+
134
+ - `yaml`: default, human-readable YAML
135
+ - `json`: pretty JSON
136
+ - `toon`: TOON output via the official `@toon-format/toon` encoder for lower token use
137
+
138
+ Each tool also accepts `compact_keys: true` to shorten common graph keys before serialization. This works with all formats:
139
+
140
+ ```text
141
+ id -> i
142
+ template -> t
143
+ component -> cp
144
+ state -> s
145
+ stability -> st
146
+ schemaVersion -> sv
147
+ lastModifiedAt -> lm
148
+ extractedFrom -> xf
149
+ properties -> p
150
+ root -> r
151
+ children -> ch
152
+ edges -> e
153
+ nodes -> n
154
+ from -> fr
155
+ to -> to
156
+ type -> ty
157
+ notes -> nt
158
+ ```
159
+
160
+ ## MCP Client Configuration
161
+
162
+ This repo includes a project-level `.mcp.json`:
163
+
164
+ ```json
165
+ {
166
+ "mcpServers": {
167
+ "corum": {
168
+ "command": "node",
169
+ "args": ["dist/src/mcp/index.js"],
170
+ "env": {
171
+ "CORUM_GRAPH_PATH": "fixtures/sample-graph"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ Build the project before using this config from an MCP client:
179
+
180
+ ```powershell
181
+ npm run build
182
+ ```
183
+
184
+ The checked-in config points at `fixtures/sample-graph` so the tools return sample nodes immediately. Change `CORUM_GRAPH_PATH` to `.corum/graph` when you have graph component files there.
185
+
186
+ ## MCP Smoke Test
187
+
188
+ Run a local MCP client against the configured server and print graph data:
189
+
190
+ ```powershell
191
+ npm run mcp:smoke
192
+ ```
193
+
194
+ The smoke test starts the MCP server over stdio and calls:
195
+
196
+ - `list_nodes`
197
+ - `list_nodes` filtered to `APIEndpoint`
198
+ - `get_cluster` for `orders.DomainModel.order`
199
+ - `get_linked_fields` for `orders.DomainModel.order`
200
+
201
+ ## Useful Development Commands
202
+
203
+ Type-check without emitting files:
204
+
205
+ ```powershell
206
+ npx tsc --noEmit
207
+ ```
208
+
209
+ Run one compiled test file after building:
210
+
211
+ ```powershell
212
+ npm run build
213
+ node --test dist/test/loader.test.js
214
+ ```
215
+
216
+ Clean generated build output manually if needed:
217
+
218
+ ```powershell
219
+ Remove-Item -Recurse -Force dist
220
+ ```
@@ -49,45 +49,45 @@ program
49
49
  });
50
50
  });
51
51
  // ── init ─────────────────────────────────────────────────────────────────────
52
- const CONFIG_TEMPLATE = `# Corum project configuration
53
- # Uncomment and set the options relevant to your setup.
54
- # All values can be overridden by environment variables (CORUM_*) or CLI flags.
55
-
56
- # Source type: 'file' (default) or 'git'
57
- # Maps to: CORUM_SOURCE
58
- # source: file
59
-
60
- # ── File source (default) ─────────────────────────────────────────────────────
61
- # Local path to the graph directory.
62
- # Maps to: CORUM_GRAPH_PATH
63
- # graph: .corum/graph
64
-
65
- # ── Git source ────────────────────────────────────────────────────────────────
66
- # Uncomment 'source: git' above and configure one of the following:
67
-
68
- # Local path to a git repository containing the graph.
69
- # Maps to: CORUM_GIT_LOCAL_PATH
70
- # git_local_path: /path/to/repo
71
-
72
- # Remote URL of a git repository containing the graph.
73
- # Maps to: CORUM_GIT_REMOTE_URL
74
- # git_remote_url: https://github.com/org/repo
75
-
76
- # Default branch to load (git source only).
77
- # Maps to: CORUM_GIT_BRANCH
78
- # git_branch: main
79
-
80
- # How often to poll the remote for changes, in seconds (remote git only).
81
- # Maps to: CORUM_GIT_POLL_SECONDS
82
- # git_poll_seconds: 30
83
-
84
- # Auth token for private repositories. Prefer setting CORUM_GIT_TOKEN as an
85
- # environment variable rather than storing a token in this file.
86
- # git_token: ""
87
-
88
- # Auth username (default: x-access-token, suits GitHub PATs and Actions tokens).
89
- # Maps to: CORUM_GIT_USERNAME
90
- # git_username: x-access-token
52
+ const CONFIG_TEMPLATE = `# Corum project configuration
53
+ # Uncomment and set the options relevant to your setup.
54
+ # All values can be overridden by environment variables (CORUM_*) or CLI flags.
55
+
56
+ # Source type: 'file' (default) or 'git'
57
+ # Maps to: CORUM_SOURCE
58
+ # source: file
59
+
60
+ # ── File source (default) ─────────────────────────────────────────────────────
61
+ # Local path to the graph directory.
62
+ # Maps to: CORUM_GRAPH_PATH
63
+ # graph: .corum/graph
64
+
65
+ # ── Git source ────────────────────────────────────────────────────────────────
66
+ # Uncomment 'source: git' above and configure one of the following:
67
+
68
+ # Local path to a git repository containing the graph.
69
+ # Maps to: CORUM_GIT_LOCAL_PATH
70
+ # git_local_path: /path/to/repo
71
+
72
+ # Remote URL of a git repository containing the graph.
73
+ # Maps to: CORUM_GIT_REMOTE_URL
74
+ # git_remote_url: https://github.com/org/repo
75
+
76
+ # Default branch to load (git source only).
77
+ # Maps to: CORUM_GIT_BRANCH
78
+ # git_branch: main
79
+
80
+ # How often to poll the remote for changes, in seconds (remote git only).
81
+ # Maps to: CORUM_GIT_POLL_SECONDS
82
+ # git_poll_seconds: 30
83
+
84
+ # Auth token for private repositories. Prefer setting CORUM_GIT_TOKEN as an
85
+ # environment variable rather than storing a token in this file.
86
+ # git_token: ""
87
+
88
+ # Auth username (default: x-access-token, suits GitHub PATs and Actions tokens).
89
+ # Maps to: CORUM_GIT_USERNAME
90
+ # git_username: x-access-token
91
91
  `;
92
92
  program
93
93
  .command('init')
package/package.json CHANGED
@@ -1,36 +1,40 @@
1
- {
2
- "name": "@atolis-hq/corum",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "files": [
6
- "dist/src/",
7
- "web/"
8
- ],
9
- "bin": {
10
- "corum": "./dist/src/bin/corum.js"
11
- },
12
- "scripts": {
13
- "build": "tsc",
14
- "test": "tsc && node --test dist/test",
15
- "wireframes": "node design/wireframes/server.mjs",
16
- "mcp": "node dist/src/mcp/index.js",
17
- "mcp:smoke": "npm run build && node scripts/mcp-smoke.mjs",
18
- "web": "node dist/src/web/server.js"
19
- },
20
- "dependencies": {
21
- "@apidevtools/swagger-parser": "^12.1.0",
22
- "@modelcontextprotocol/sdk": "^1.0.0",
23
- "@toon-format/toon": "^2.1.0",
24
- "commander": "^14.0.3",
25
- "express": "^4.22.1",
26
- "isomorphic-git": "^1.37.6",
27
- "openapi-types": "^12.1.3",
28
- "yaml": "^2.3.4"
29
- },
30
- "devDependencies": {
31
- "@types/express": "^4.17.25",
32
- "@types/node": "^20.0.0",
33
- "@types/swagger-parser": "^4.0.3",
34
- "typescript": "^5.0.0"
35
- }
36
- }
1
+ {
2
+ "name": "@atolis-hq/corum",
3
+ "version": "0.1.5",
4
+ "type": "module",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/atolis-hq/corum"
8
+ },
9
+ "files": [
10
+ "dist/src/",
11
+ "web/"
12
+ ],
13
+ "bin": {
14
+ "corum": "dist/src/bin/corum.js"
15
+ },
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "test": "tsc && node scripts/run-tests.mjs",
19
+ "wireframes": "node design/wireframes/server.mjs",
20
+ "mcp": "node dist/src/mcp/index.js",
21
+ "mcp:smoke": "npm run build && node scripts/mcp-smoke.mjs",
22
+ "web": "node dist/src/web/server.js"
23
+ },
24
+ "dependencies": {
25
+ "@apidevtools/swagger-parser": "^12.1.0",
26
+ "@modelcontextprotocol/sdk": "^1.0.0",
27
+ "@toon-format/toon": "^2.1.0",
28
+ "commander": "^14.0.3",
29
+ "express": "^4.22.1",
30
+ "isomorphic-git": "^1.37.6",
31
+ "openapi-types": "^12.1.3",
32
+ "yaml": "^2.3.4"
33
+ },
34
+ "devDependencies": {
35
+ "@types/express": "^4.17.25",
36
+ "@types/node": "^24.0.0",
37
+ "@types/swagger-parser": "^4.0.3",
38
+ "typescript": "^5.0.0"
39
+ }
40
+ }