@sigloch/graph-view-edit 0.9.0 → 0.11.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/README.md +8 -0
- package/dist/assets/{index-BtUB8acj.css → index-Cf27gkg2.css} +1 -1
- package/dist/assets/index-DqiKdkrq.js +246 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/config.mjs +7 -0
- package/vite.config.js +106 -5
- package/dist/assets/index-_FhVxvpu.js +0 -246
package/dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>graph-view-edit</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DqiKdkrq.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Cf27gkg2.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigloch/graph-view-edit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "React/Vite viewer+editor over @sigloch/graphcode — 12 graph-views + 16 doc-views via a declarative View-Registry, plus an SE-Dashboard sibling route. Reads docs/graph/<member>.graph.json client-side (no 2nd Kuzu handle).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/config.mjs
CHANGED
|
@@ -80,6 +80,13 @@ export const ConfigSchema = z.object({
|
|
|
80
80
|
enabled: z.boolean().default(false),
|
|
81
81
|
})
|
|
82
82
|
.prefault({}),
|
|
83
|
+
// CR-GVE-283: ab MEHR als so vielen Enden (Sender + Leser im Modell) zeichnet
|
|
84
|
+
// das Funktionsnetzwerk ein Netz als Etikett je Anschluss statt als Linien.
|
|
85
|
+
net: z
|
|
86
|
+
.object({
|
|
87
|
+
globalThreshold: z.number().int().nonnegative().default(9),
|
|
88
|
+
})
|
|
89
|
+
.prefault({}),
|
|
83
90
|
});
|
|
84
91
|
|
|
85
92
|
export function loadConfig(path = process.env.GVE_CONFIG_PATH || resolve(process.cwd(), 'config.json')) {
|
package/vite.config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, mkdirSync, unlinkSync, existsSync, readdirSync, realpathSync, statSync, watch } from 'node:fs';
|
|
2
2
|
import { execFileSync } from 'node:child_process';
|
|
3
|
-
import { join, basename } from 'node:path';
|
|
3
|
+
import { join, basename, dirname, sep } from 'node:path';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
4
5
|
import { fileURLToPath } from 'node:url';
|
|
5
6
|
import { defineConfig } from 'vite';
|
|
6
7
|
import react from '@vitejs/plugin-react';
|
|
@@ -100,9 +101,97 @@ function servedRepoRoot() {
|
|
|
100
101
|
* listed ontology/rules/engine but never the app rendering them, so a bug
|
|
101
102
|
* report could not say WHICH GVE produced the screen.
|
|
102
103
|
*/
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const OWN_ROOT = fileURLToPath(new URL('.', import.meta.url));
|
|
105
|
+
const GVE_VERSION = JSON.parse(readFileSync(join(OWN_ROOT, 'package.json'), 'utf8')).version;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* CR-GVE-292: die Version allein sagt nicht, WELCHER Code läuft. `0.9.0` war
|
|
109
|
+
* gleichzeitig das npm-Paket unter bok/node_modules UND der Dev-Checkout mit 25
|
|
110
|
+
* Commits danach — Health zeigte beides als dieselbe Zahl. Deshalb trägt jede
|
|
111
|
+
* Paketzeile jetzt ihre HERKUNFT: `npm` (aus einem node_modules-Baum installiert,
|
|
112
|
+
* also exakt der publizierte Tarball) oder `dev <sha>` (Arbeitskopie, per Link
|
|
113
|
+
* eingebunden; `*` = ungecommittete Änderungen im Paketverzeichnis). Und nicht
|
|
114
|
+
* nur gve: dieselbe Zeile für jedes Familienpaket, das der Viewer lädt — sonst
|
|
115
|
+
* bleibt die Frage „welche contracts sind das" wieder eine Rekonstruktion aus
|
|
116
|
+
* vier package.json. Der Pfad-Test auf `node_modules` ist die Unterscheidung:
|
|
117
|
+
* `realpathSync` folgt dem Link aus dem node_modules-Baum heraus in die
|
|
118
|
+
* Arbeitskopie; ein installiertes Paket bleibt drin. Kein Tarball trägt ein
|
|
119
|
+
* `.git`, also braucht es keinen zweiten Beweis.
|
|
120
|
+
*/
|
|
121
|
+
export const FAMILY_PACKAGES = [
|
|
122
|
+
'@sigloch/contracts',
|
|
123
|
+
'@sigloch/graph-api-core',
|
|
124
|
+
'@sigloch/graphcode-client',
|
|
125
|
+
'@sigloch/se-engine',
|
|
126
|
+
'@sigloch/graphcode',
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
const ownRequire = createRequire(import.meta.url);
|
|
130
|
+
|
|
131
|
+
/** Reales Paketverzeichnis eines geladenen Pakets, `null` wenn nicht auflösbar. */
|
|
132
|
+
export function packageRoot(name, requireImpl = ownRequire, from = OWN_ROOT) {
|
|
133
|
+
let dir;
|
|
134
|
+
try {
|
|
135
|
+
dir = dirname(requireImpl.resolve(`${name}/package.json`));
|
|
136
|
+
} catch {
|
|
137
|
+
try {
|
|
138
|
+
dir = dirname(requireImpl.resolve(name));
|
|
139
|
+
} catch {
|
|
140
|
+
// Ein Paket ohne `.`-Export (graphcode ist ein bin-Paket) löst `require`
|
|
141
|
+
// nicht auf — dann derselbe node_modules-Aufstieg, den Node selbst ginge.
|
|
142
|
+
dir = null;
|
|
143
|
+
for (let d = from; ; d = dirname(d)) {
|
|
144
|
+
const candidate = join(d, 'node_modules', name);
|
|
145
|
+
if (existsSync(join(candidate, 'package.json'))) { dir = candidate; break; }
|
|
146
|
+
if (dirname(d) === d) return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
for (;;) {
|
|
151
|
+
const pj = join(dir, 'package.json');
|
|
152
|
+
if (existsSync(pj) && JSON.parse(readFileSync(pj, 'utf8')).name === name) return realpathSync(dir);
|
|
153
|
+
const parent = dirname(dir);
|
|
154
|
+
if (parent === dir) return null;
|
|
155
|
+
dir = parent;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Herkunft eines Paketverzeichnisses: `{source:'npm'}` oder `{source:'dev', commit, dirty}`. */
|
|
160
|
+
export function provenanceOf(root, git = gitOut) {
|
|
161
|
+
if (!root) return null;
|
|
162
|
+
if (root.split(sep).includes('node_modules')) return { source: 'npm' };
|
|
163
|
+
const commit = git(root, ['rev-parse', '--short', 'HEAD']);
|
|
164
|
+
const dirty = commit !== null && git(root, ['status', '--porcelain', '--', '.']) !== '';
|
|
165
|
+
return { source: 'dev', commit, dirty };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function gitOut(root, args) {
|
|
169
|
+
try {
|
|
170
|
+
return execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
171
|
+
} catch {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Eine Health-Zelle: `10.2.0 · npm` bzw. `0.9.0 · dev 6130c07*`. */
|
|
177
|
+
export function versionLabel(version, prov) {
|
|
178
|
+
if (!prov) return `${version} · nicht auflösbar`;
|
|
179
|
+
if (prov.source === 'npm') return `${version} · npm`;
|
|
180
|
+
return `${version} · dev ${prov.commit ?? '?'}${prov.dirty ? '*' : ''}`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const FAMILY_ROOTS = new Map(FAMILY_PACKAGES.map((n) => [n, packageRoot(n)]));
|
|
184
|
+
|
|
185
|
+
/** gve selbst plus jedes Familienpaket, Schlüssel ohne den `@sigloch/`-Präfix. */
|
|
186
|
+
export function familyVersions() {
|
|
187
|
+
const rows = { gve: versionLabel(GVE_VERSION, provenanceOf(realpathSync(OWN_ROOT))) };
|
|
188
|
+
for (const name of FAMILY_PACKAGES) {
|
|
189
|
+
const root = FAMILY_ROOTS.get(name);
|
|
190
|
+
const version = root ? JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).version : '—';
|
|
191
|
+
rows[name.replace('@sigloch/', '')] = versionLabel(version, provenanceOf(root));
|
|
192
|
+
}
|
|
193
|
+
return rows;
|
|
194
|
+
}
|
|
106
195
|
|
|
107
196
|
/**
|
|
108
197
|
* Serves docs/graph/*.json from the resolved repo root (CR-GVE-127) instead
|
|
@@ -378,6 +467,13 @@ function cohesionRollup(rawModules) {
|
|
|
378
467
|
lcom4: m.lcom4 ?? null,
|
|
379
468
|
fanIn: m.fanIn ?? null,
|
|
380
469
|
fanOut: m.fanOut ?? null,
|
|
470
|
+
// CR-GVE-293: zwei Felder, die der Host seit contracts 22 mitliefert und die
|
|
471
|
+
// diese Whitelist bis dahin still verschluckt hat. `uphillDependencies` ist
|
|
472
|
+
// Messung ohne Urteil (CR-SM-301), `rollupContainer` der Grund, warum MT-02
|
|
473
|
+
// ein Modul NICHT beurteilt (CR-SM-263) — ohne das Flag urteilte gve dort,
|
|
474
|
+
// wo der Host schweigt.
|
|
475
|
+
uphillDependencies: m.uphillDependencies ?? null,
|
|
476
|
+
rollupContainer: m.rollupContainer ?? false,
|
|
381
477
|
}));
|
|
382
478
|
const connections = (m) => (m.cohesion ? m.cohesion.internal + m.cohesion.external : -1);
|
|
383
479
|
rows.sort((a, b) => connections(b) - connections(a) || a.moduleId.localeCompare(b.moduleId));
|
|
@@ -412,6 +508,9 @@ export function architecturePayload({ hostMetrics, hostError, ontologyJson, repo
|
|
|
412
508
|
policy: hostMetrics.policy,
|
|
413
509
|
policySource: hostMetrics.policySource ?? null,
|
|
414
510
|
fit: hostMetrics.fit ?? null,
|
|
511
|
+
// CR-GVE-293: Kritikalität je FUNC (CR-SM-314) — eine Host-Zahl wie `fit`,
|
|
512
|
+
// unverändert durchgereicht; die Schwelle steht in `policy.criticality`.
|
|
513
|
+
functions: hostMetrics.functions ?? null,
|
|
415
514
|
};
|
|
416
515
|
}
|
|
417
516
|
const local = readMetricPolicy(repoRoot);
|
|
@@ -427,6 +526,8 @@ export function architecturePayload({ hostMetrics, hostError, ontologyJson, repo
|
|
|
427
526
|
// Zielrichtung aus der Profildatei bleibt lesbar, der Zielwert kommt bewusst
|
|
428
527
|
// NICHT mit: er ist nur zusammen mit dem Ist-Wert sinnvoll, gegen den er steht.
|
|
429
528
|
fit: null,
|
|
529
|
+
// Ebenso host-only: ohne Host keine Kettenzahl je FUNC, also null, nicht [].
|
|
530
|
+
functions: null,
|
|
430
531
|
profile: targetProfilePayload(repoRoot),
|
|
431
532
|
};
|
|
432
533
|
}
|
|
@@ -1039,7 +1140,7 @@ function dashboardApiPlugin() {
|
|
|
1039
1140
|
store: 'committed graph.json (read-only)',
|
|
1040
1141
|
gate: 'n/a — dashboard is read-only (writes go through MCP mutate())',
|
|
1041
1142
|
versions: {
|
|
1042
|
-
|
|
1143
|
+
...familyVersions(),
|
|
1043
1144
|
ontology: ONTOLOGY_VERSION,
|
|
1044
1145
|
rules: RULES_VERSION,
|
|
1045
1146
|
engine: SE_DESCRIPTOR.version,
|