@sigloch/graph-view-edit 0.11.0 → 0.13.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/assets/index-DK9n2Oo-.js +185 -0
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/vite.config.js +52 -14
- package/dist/assets/index-DqiKdkrq.js +0 -246
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-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DK9n2Oo-.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.
|
|
3
|
+
"version": "0.13.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": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
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
|
-
"@sigloch/contracts": ">=10.
|
|
24
|
+
"@sigloch/contracts": ">=10.2 <11",
|
|
25
25
|
"@sigloch/graph-api-core": ">=5.4 <6",
|
|
26
26
|
"@sigloch/graphcode-client": ">=1.3 <2",
|
|
27
27
|
"@sigloch/se-engine": ">=1.4 <2",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@playwright/test": "^1.58.2",
|
|
34
|
-
"@sigloch/graphcode": ">=0.
|
|
34
|
+
"@sigloch/graphcode": ">=0.25 <1",
|
|
35
35
|
"@tanstack/react-table": "^8.20.5",
|
|
36
36
|
"@testing-library/react": "^16.0.1",
|
|
37
37
|
"elkjs": "^0.11.1",
|
package/vite.config.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
moduleMetrics,
|
|
21
21
|
MetricPolicySchema,
|
|
22
22
|
DEFAULT_METRIC_POLICY,
|
|
23
|
+
RULE_TO_DIMENSION,
|
|
23
24
|
} from '@sigloch/contracts/se';
|
|
24
25
|
// CR-GC-265: these eight come from the read-side client, not the substrate.
|
|
25
26
|
// They are pure projection plus a node:net socket call — depending on
|
|
@@ -1052,6 +1053,11 @@ export function nextMovePayload(nextStep, suggest) {
|
|
|
1052
1053
|
elementId: top.elementId,
|
|
1053
1054
|
message: top.message,
|
|
1054
1055
|
score: top.score,
|
|
1056
|
+
// CR-GVE-297: die Dimension des Zuges, aus DERSELBEN Abbildung, aus der auch
|
|
1057
|
+
// `dimension_readiness` und der Hygiene-Kanal ihre Themen nehmen
|
|
1058
|
+
// (RULE_TO_DIMENSION in @sigloch/contracts). Keine zweite Zuordnung im Viewer:
|
|
1059
|
+
// sonst koennte derselbe Zug hier unter einem anderen Thema stehen als dort.
|
|
1060
|
+
dimension: RULE_TO_DIMENSION[top.ruleId] ?? null,
|
|
1055
1061
|
applicable: top.applicable === true,
|
|
1056
1062
|
// Der konkrete Zug, nicht nur der Fund. `retire` gesetzt heißt Umhängen:
|
|
1057
1063
|
// anwenden als EIN graph_mutate-Batch (CR-GC-435), `codeImpact` benennt
|
|
@@ -1363,24 +1369,56 @@ export async function handleMutateRequest(body, { repoRoot = process.cwd(), call
|
|
|
1363
1369
|
return result;
|
|
1364
1370
|
}
|
|
1365
1371
|
|
|
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];
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1366
1378
|
/**
|
|
1367
|
-
* POST /api/realize (CR-GVE-135 / REQ-real-bind) —
|
|
1368
|
-
* and
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1379
|
+
* POST /api/realize (CR-GVE-135 / REQ-real-bind) — binds FUNC↔realRef (R-20)
|
|
1380
|
+
* and optionally TEST↔testRefs (R-19). Since CR-GVE-299 this is a Format-E
|
|
1381
|
+
* batch through graph_mutate (`~ FUNC-x` + `@realRef {…}`), sent via
|
|
1382
|
+
* handleMutateRequest — the same gate and the same post-write export as every
|
|
1383
|
+
* edit; graph_realize is gone from the graphcode surface (CR-GC-685).
|
|
1384
|
+
*
|
|
1385
|
+
* `@testRefs` is a PATCH of the whole list, so the endpoint reads the TEST's
|
|
1386
|
+
* current testRefs first and sends existing + new (1:n since CR-SM-231 — a
|
|
1387
|
+
* unit and a visual run must not overwrite each other). The same file+case
|
|
1388
|
+
* bound again replaces its entry; a non-array value is replaced, not extended.
|
|
1389
|
+
* The graphVersion of that read is the OCC baseVersion unless the caller
|
|
1390
|
+
* supplied one.
|
|
1372
1391
|
*/
|
|
1373
1392
|
export async function handleRealizeRequest(body, { repoRoot = process.cwd(), callHostImpl = callHost } = {}) {
|
|
1393
|
+
const { funcUid, file, symbol, lang, testUid, testFile, testCase, tool, consumerId, baseVersion } = body ?? {};
|
|
1394
|
+
if (!funcUid || !file || !symbol) {
|
|
1395
|
+
return { success: false, error: 'realize: funcUid, file and symbol are required.' };
|
|
1396
|
+
}
|
|
1397
|
+
if (testUid && !testFile) {
|
|
1398
|
+
return { success: false, error: 'realize: testFile is required when testUid is given.' };
|
|
1399
|
+
}
|
|
1374
1400
|
const socketPath = join(repoRoot, '.graphcode', HOST_SOCK_BASENAME);
|
|
1375
|
-
const
|
|
1376
|
-
if (
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
}
|
|
1401
|
+
const read = await callHostImpl(socketPath, 'graph_get_node', { uid: funcUid });
|
|
1402
|
+
if (!read.node) return { success: false, error: `realize: unknown funcUid '${funcUid}'.` };
|
|
1403
|
+
const lines = ['## Nodes', ...formatEPatch(read.node, { realRef: { file, symbol, ...(lang ? { lang } : {}) } })];
|
|
1404
|
+
|
|
1405
|
+
if (testUid) {
|
|
1406
|
+
const testRead = await callHostImpl(socketPath, 'graph_get_node', { uid: testUid });
|
|
1407
|
+
if (!testRead.node) return { success: false, error: `realize: unknown testUid '${testUid}'.` };
|
|
1408
|
+
const current = testRead.node.attributes?.testRefs;
|
|
1409
|
+
const kept = Array.isArray(current) ? current.filter((r) => r.file !== testFile || r.case !== testCase) : [];
|
|
1410
|
+
const added = { file: testFile, tool: tool ?? 'vitest', ...(testCase ? { case: testCase } : {}) };
|
|
1411
|
+
lines.push(...formatEPatch(testRead.node, { testRefs: [...kept, added] }));
|
|
1382
1412
|
}
|
|
1383
|
-
|
|
1413
|
+
|
|
1414
|
+
return handleMutateRequest(
|
|
1415
|
+
{
|
|
1416
|
+
formatE: lines.join('\n'),
|
|
1417
|
+
baseVersion: baseVersion ?? read.graphVersion,
|
|
1418
|
+
...(consumerId !== undefined ? { consumerId } : {}),
|
|
1419
|
+
},
|
|
1420
|
+
{ repoRoot, callHostImpl },
|
|
1421
|
+
);
|
|
1384
1422
|
}
|
|
1385
1423
|
|
|
1386
1424
|
/**
|
|
@@ -1415,7 +1453,7 @@ function mutateApiPlugin() {
|
|
|
1415
1453
|
res.end(JSON.stringify(result));
|
|
1416
1454
|
} catch (err) {
|
|
1417
1455
|
// A dead/absent socket is a 503 "start a session"; a tool-level
|
|
1418
|
-
// rejection (e.g.
|
|
1456
|
+
// rejection (e.g. a Format-E decode error) is the tool's own
|
|
1419
1457
|
// message, not a host problem (CR-GVE-135).
|
|
1420
1458
|
const hostDown = /ENOENT|ECONNREFUSED|ECONNRESET|EPIPE|socket/i.test(err.message);
|
|
1421
1459
|
res.statusCode = hostDown ? 503 : 422;
|