@sigloch/graph-view-edit 0.13.0 → 0.14.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/dist/index.html CHANGED
@@ -4,7 +4,7 @@
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-DK9n2Oo-.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-B6MGO4N_.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-Cf27gkg2.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigloch/graph-view-edit",
3
- "version": "0.13.0",
3
+ "version": "0.14.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": {
@@ -22,7 +22,7 @@
22
22
  "comment:deps": "Runtime = what vite.config.js + bin/gve.mjs load at Node level when serving the prebuilt dist/. The UI libs (react, react-dom, elkjs, @tanstack/react-table, zustand) are bundled INTO dist/ by vite and must stay devDependencies — shipping them would make consumers download the whole UI stack twice.",
23
23
  "dependencies": {
24
24
  "@sigloch/contracts": ">=10.2 <11",
25
- "@sigloch/graph-api-core": ">=5.4 <6",
25
+ "@sigloch/graph-api-core": ">=5.10.1 <6",
26
26
  "@sigloch/graphcode-client": ">=1.3 <2",
27
27
  "@sigloch/se-engine": ">=1.4 <2",
28
28
  "@vitejs/plugin-react": "^4.3.4",
package/vite.config.js CHANGED
@@ -5,7 +5,7 @@ import { createRequire } from 'node:module';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { defineConfig } from 'vite';
7
7
  import react from '@vitejs/plugin-react';
8
- import { DefaultRuleEngine, SE_DESCRIPTOR, fromOntologyGraph } from '@sigloch/graph-api-core';
8
+ import { DefaultRuleEngine, SE_DESCRIPTOR, fromOntologyGraph, commandsToFormatE } from '@sigloch/graph-api-core';
9
9
  // CR-GVE-262: `moduleMetrics` ist DIESELBE Funktion, auf die graphcodes
10
10
  // graph_metrics ein dünnes Binding ist ("KEINE Rechnung hier", tools/metrics.ts)
11
11
  // — die Kohäsions-Karte rechnet also nichts selbst, sie ruft die eine Referenz.
@@ -1358,8 +1358,14 @@ function dashboardApiPlugin() {
1358
1358
  */
1359
1359
  export async function handleMutateRequest(body, { repoRoot = process.cwd(), callHostImpl = callHost } = {}) {
1360
1360
  const socketPath = join(repoRoot, '.graphcode', HOST_SOCK_BASENAME);
1361
- const result = await callHostImpl(socketPath, 'graph_mutate', body);
1362
- if (result.success && result.mutations > 0) {
1361
+ const { commands, ...rest } = body ?? {};
1362
+ // ITEM-2026-604: graph_mutate nimmt nur Format-E. Die Edit-Oberflaeche baut MutateCommands —
1363
+ // HIER, an der einen Stelle vor dem Gate, werden sie Text (`commandsToFormatE`, graph-api-core).
1364
+ const payload = commands ? { ...rest, formatE: await alsFormatE(commands, socketPath, callHostImpl) } : body;
1365
+ const result = await callHostImpl(socketPath, 'graph_mutate', payload);
1366
+ // Ein Probelauf schreibt nichts — ein erzwungener Export danach waere ungefragt (Smoke 2026-09-27:
1367
+ // der dryRun meldete mutations 34 und loeste graph_export force:true aus).
1368
+ if (result.success && result.mutations > 0 && body?.dryRun !== true) {
1363
1369
  try {
1364
1370
  await callHostImpl(socketPath, 'graph_export', { force: true });
1365
1371
  } catch (err) {
@@ -1369,10 +1375,19 @@ export async function handleMutateRequest(body, { repoRoot = process.cwd(), call
1369
1375
  return result;
1370
1376
  }
1371
1377
 
1372
- /** One Format-E `~` patch: the node under its `### <TYPE>` section, each attribute as `@key <json>`. */
1373
- function formatEPatch(node, attributes) {
1374
- const attrLines = Object.entries(attributes).map(([key, value]) => `@${key} ${JSON.stringify(value)}`);
1375
- return [`### ${node.type}`, `~ ${node.uid}`, ...attrLines];
1378
+ /**
1379
+ * MutateCommands → Format-E. Den Typabschnitt eines Knotens, den der Batch nicht anlegt (update-node
1380
+ * ohne `type`, delete-node), kennt nur der Bestand — der Host liefert ihn (`graph_get_node`).
1381
+ */
1382
+ export async function alsFormatE(commands, socketPath, callHostImpl) {
1383
+ const offen = [...new Set(commands.flatMap((c) =>
1384
+ c.op === 'delete-node' ? [c.uid] : c.op === 'update-node' && !c.node.type ? [c.node.uid] : []))];
1385
+ const typen = new Map();
1386
+ for (const uid of offen) {
1387
+ const read = await callHostImpl(socketPath, 'graph_get_node', { uid });
1388
+ if (read?.node?.type) typen.set(uid, read.node.type);
1389
+ }
1390
+ return commandsToFormatE(commands, (uid) => typen.get(uid));
1376
1391
  }
1377
1392
 
1378
1393
  /**
@@ -1400,7 +1415,7 @@ export async function handleRealizeRequest(body, { repoRoot = process.cwd(), cal
1400
1415
  const socketPath = join(repoRoot, '.graphcode', HOST_SOCK_BASENAME);
1401
1416
  const read = await callHostImpl(socketPath, 'graph_get_node', { uid: funcUid });
1402
1417
  if (!read.node) return { success: false, error: `realize: unknown funcUid '${funcUid}'.` };
1403
- const lines = ['## Nodes', ...formatEPatch(read.node, { realRef: { file, symbol, ...(lang ? { lang } : {}) } })];
1418
+ const patches = [{ op: 'update-node', node: { uid: read.node.uid, type: read.node.type, attributes: { realRef: { file, symbol, ...(lang ? { lang } : {}) } } } }];
1404
1419
 
1405
1420
  if (testUid) {
1406
1421
  const testRead = await callHostImpl(socketPath, 'graph_get_node', { uid: testUid });
@@ -1408,12 +1423,12 @@ export async function handleRealizeRequest(body, { repoRoot = process.cwd(), cal
1408
1423
  const current = testRead.node.attributes?.testRefs;
1409
1424
  const kept = Array.isArray(current) ? current.filter((r) => r.file !== testFile || r.case !== testCase) : [];
1410
1425
  const added = { file: testFile, tool: tool ?? 'vitest', ...(testCase ? { case: testCase } : {}) };
1411
- lines.push(...formatEPatch(testRead.node, { testRefs: [...kept, added] }));
1426
+ patches.push({ op: 'update-node', node: { uid: testRead.node.uid, type: testRead.node.type, attributes: { testRefs: [...kept, added] } } });
1412
1427
  }
1413
1428
 
1414
1429
  return handleMutateRequest(
1415
1430
  {
1416
- formatE: lines.join('\n'),
1431
+ formatE: commandsToFormatE(patches),
1417
1432
  baseVersion: baseVersion ?? read.graphVersion,
1418
1433
  ...(consumerId !== undefined ? { consumerId } : {}),
1419
1434
  },