@atolis-hq/corum 0.1.5 → 0.1.6

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,220 +1,188 @@
1
1
  # Corum
2
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
3
+ Corum is a Git-native design graph for service architecture. It models components (APIs, domain models, schemas, fields) as nodes with typed edges, and exposes the graph through MCP tools so AI assistants can reason about your architecture.
9
4
 
10
5
  ## Install
11
6
 
12
- From the repository root:
13
-
14
- ```powershell
15
- npm install
7
+ ```bash
8
+ npm install -g @atolis-hq/corum
16
9
  ```
17
10
 
18
- This installs TypeScript, the MCP SDK, and YAML parsing dependencies.
11
+ Or run without installing:
19
12
 
20
- ## Build
13
+ ```bash
14
+ npx @atolis-hq/corum <command>
15
+ ```
21
16
 
22
- Compile the TypeScript sources into `dist/`:
17
+ **Windows:** If you see an "execution policy" error in PowerShell, run this once:
23
18
 
24
19
  ```powershell
25
- npm run build
20
+ Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
26
21
  ```
27
22
 
28
- The build command runs `tsc`.
29
-
30
- ## Test
23
+ This is a standard one-time setup step for Node.js development on Windows. Alternatively, `npx @atolis-hq/corum <command>` works without any setup on all platforms.
31
24
 
32
- Run the full test suite:
25
+ ## Update
33
26
 
34
- ```powershell
35
- npm test
27
+ ```bash
28
+ npm update -g @atolis-hq/corum
36
29
  ```
37
30
 
38
- This compiles the project and runs the Node test runner against:
31
+ ## Quick Start
39
32
 
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`
33
+ Scaffold a config file in your project:
46
34
 
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
35
+ ```bash
36
+ corum init
37
+ ```
50
38
 
51
- Build first:
39
+ This creates `.corum/config.yaml` with commented defaults. Edit it to point at your graph directory or git repository, then start the MCP server:
52
40
 
53
- ```powershell
54
- npm run build
41
+ ```bash
42
+ corum mcp
55
43
  ```
56
44
 
57
- Run the MCP server against the default graph path:
45
+ ## Commands
58
46
 
59
- ```powershell
60
- npm run mcp
61
- ```
47
+ ### `corum mcp`
48
+
49
+ Start the MCP stdio server. Also starts a web UI by default.
62
50
 
63
- By default, the server loads:
51
+ ```bash
52
+ corum mcp [options]
64
53
 
65
- ```text
66
- .corum/graph
54
+ Options:
55
+ --no-web Suppress the web UI
56
+ --watch Reload graph on file changes
57
+ --graph <path> Override the graph directory
67
58
  ```
68
59
 
69
- To run it against the sample graph fixture instead:
60
+ ### `corum web`
70
61
 
71
- ```powershell
72
- $env:CORUM_GRAPH_PATH = "fixtures/sample-graph"
73
- npm run mcp
74
- ```
62
+ Start the web UI only.
75
63
 
76
- To reload the in-memory graph when graph YAML or template YAML files change, pass `--watch` to the built server:
64
+ ```bash
65
+ corum web [options]
77
66
 
78
- ```powershell
79
- node dist/src/mcp/index.js --watch
67
+ Options:
68
+ --port <n> Port to listen on (default: 3000)
69
+ --graph <path> Override the graph directory
80
70
  ```
81
71
 
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`.
72
+ ### `corum init`
83
73
 
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
74
+ Scaffold `.corum/config.yaml` with commented defaults. Does not overwrite an existing file.
75
+
76
+ ```bash
77
+ corum init
90
78
  ```
91
79
 
92
- To run the web app against a git repository instead of a filesystem graph path, set `CORUM_SOURCE=git` before starting the app.
80
+ ### `corum import`
93
81
 
94
- For a local git repository:
82
+ Import specifications into the graph.
95
83
 
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
84
+ ```bash
85
+ corum import --config <path> Import using a config YAML file
103
86
  ```
104
87
 
105
- For a remote repository:
88
+ #### `corum import openapi <spec>`
106
89
 
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
- ```
90
+ Import an OpenAPI spec directly.
115
91
 
116
- For private remote repositories, also set `CORUM_GIT_TOKEN`. `CORUM_GIT_USERNAME` defaults to `x-access-token` when a token is present.
92
+ ```bash
93
+ corum import openapi <spec> [options]
117
94
 
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.
95
+ Options:
96
+ --component-strategy <strategy> Component mapping: uri-segment (default), tag, hardcoded
97
+ --segment <n> URI segment index (uri-segment strategy)
98
+ --pattern <regex> Regex pattern (uri-segment strategy)
99
+ --component <name> Component name (hardcoded strategy)
100
+ --graph <path> Override the graph directory
101
+ ```
119
102
 
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.
103
+ ## Configuration
121
104
 
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.
105
+ Run `corum init` to generate a `.corum/config.yaml` with all available options. Corum walks up from the current directory to find it, so you can place it at your project root.
123
106
 
124
- The MCP server exposes these tools:
107
+ **Precedence (highest to lowest):** CLI flags → environment variables → `.corum/config.yaml`
125
108
 
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
109
+ | Config key | Environment variable | Description |
110
+ |---|---|---|
111
+ | `source` | `CORUM_SOURCE` | `file` (default) or `git` |
112
+ | `graph` | `CORUM_GRAPH_PATH` | Path to the graph directory |
113
+ | `git_local_path` | `CORUM_GIT_LOCAL_PATH` | Local git repo path |
114
+ | `git_remote_url` | `CORUM_GIT_REMOTE_URL` | Remote git repo URL |
115
+ | `git_branch` | `CORUM_GIT_BRANCH` | Branch to load |
116
+ | `git_poll_seconds` | `CORUM_GIT_POLL_SECONDS` | Polling interval for remote git |
117
+ | `git_token` | `CORUM_GIT_TOKEN` | Auth token for private repos |
118
+ | `git_username` | `CORUM_GIT_USERNAME` | Auth username (default: `x-access-token`) |
131
119
 
132
- Each tool accepts an optional `format` argument:
120
+ ### File source (default)
133
121
 
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
122
+ ```yaml
123
+ # .corum/config.yaml
124
+ source: file
125
+ graph: .corum/graph
126
+ ```
137
127
 
138
- Each tool also accepts `compact_keys: true` to shorten common graph keys before serialization. This works with all formats:
128
+ ### Git source
139
129
 
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
130
+ ```yaml
131
+ # .corum/config.yaml
132
+ source: git
133
+ git_remote_url: https://github.com/org/design-repo
134
+ git_branch: main
135
+ git_poll_seconds: 30
158
136
  ```
159
137
 
138
+ For private repositories, set `CORUM_GIT_TOKEN` as an environment variable rather than storing it in the config file.
139
+
160
140
  ## MCP Client Configuration
161
141
 
162
- This repo includes a project-level `.mcp.json`:
142
+ Configure your MCP client to run Corum. For Claude Code or Claude Desktop:
163
143
 
164
144
  ```json
165
145
  {
166
146
  "mcpServers": {
167
147
  "corum": {
168
- "command": "node",
169
- "args": ["dist/src/mcp/index.js"],
148
+ "command": "npx",
149
+ "args": ["@atolis-hq/corum", "mcp", "--no-web"],
170
150
  "env": {
171
- "CORUM_GRAPH_PATH": "fixtures/sample-graph"
151
+ "CORUM_GRAPH_PATH": "/path/to/your/graph"
172
152
  }
173
153
  }
174
154
  }
175
155
  }
176
156
  ```
177
157
 
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
158
+ Or if installed globally:
187
159
 
188
- Run a local MCP client against the configured server and print graph data:
189
-
190
- ```powershell
191
- npm run mcp:smoke
160
+ ```json
161
+ {
162
+ "mcpServers": {
163
+ "corum": {
164
+ "command": "corum",
165
+ "args": ["mcp", "--no-web"],
166
+ "env": {
167
+ "CORUM_GRAPH_PATH": "/path/to/your/graph"
168
+ }
169
+ }
170
+ }
171
+ }
192
172
  ```
193
173
 
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
- ```
174
+ ## MCP Tools
208
175
 
209
- Run one compiled test file after building:
176
+ | Tool | Description |
177
+ |---|---|
178
+ | `list_nodes` | List graph nodes, optionally filtered by `template`, `component`, `state`, or `stability` |
179
+ | `list_templates` | List loaded templates with summary metadata |
180
+ | `get_template` | Return full details for a template |
181
+ | `get_cluster` | Return a root node, its owned children, and internal edges |
182
+ | `get_linked_fields` | Return `maps-to` edges touching fields owned by a root node |
210
183
 
211
- ```powershell
212
- npm run build
213
- node --test dist/test/loader.test.js
214
- ```
184
+ All tools accept an optional `format` argument: `yaml` (default), `json`, or `toon`. All tools also accept `compact_keys: true` to shorten common keys before serialization, reducing token usage.
215
185
 
216
- Clean generated build output manually if needed:
186
+ ## Contributing
217
187
 
218
- ```powershell
219
- Remove-Item -Recurse -Force dist
220
- ```
188
+ See [DEVELOPMENT.md](DEVELOPMENT.md) for build, test, and local development instructions.
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import { Command } from 'commander';
2
3
  import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
3
4
  import path from 'node:path';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/corum",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",