glassbrain 0.2.0-alpha.4 → 0.2.0-alpha.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 +18 -8
- package/dist/adapters.js +25 -1
- package/dist/chunks/{chunk-3JGZ27DC.js → chunk-3P34XHQ2.js} +4 -3
- package/dist/chunks/{chunk-SEOAVI3E.js → chunk-3SAL4526.js} +259 -94
- package/dist/chunks/{chunk-ISWKAU5G.js → chunk-5DEN6HXJ.js} +1 -3
- package/dist/chunks/{chunk-R2CQA4OJ.js → chunk-LMYD4QHC.js} +107 -163
- package/dist/chunks/{chunk-G7XWVKHN.js → chunk-M3MAM2VD.js} +5 -4
- package/dist/chunks/{chunk-YGRPNAXE.js → chunk-OE5IRKWZ.js} +8 -1
- package/dist/cli/glassbrain.js +438 -272
- package/dist/cli/viewer.js +45 -45
- package/dist/core.js +7 -5
- package/dist/edit.d.ts +5 -3
- package/dist/elements.d.ts +2 -0
- package/dist/index.js +10 -8
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +12 -8
- package/dist/layers.d.ts +1 -1
- package/dist/layout/engine.d.ts +3 -1
- package/dist/layout/inline-pool.js +1 -1
- package/dist/layout/order.d.ts +9 -5
- package/dist/layout/worker.js +7 -1
- package/dist/model.d.ts +15 -5
- package/dist/paint.d.ts +2 -0
- package/dist/profile.d.ts +9 -1
- package/dist/react/DetailPanel.js +2 -2
- package/dist/react/GraphCanvas.d.ts +5 -2
- package/dist/react/GraphCanvas.js +5 -5
- package/dist/react/Toolbar.d.ts +2 -1
- package/dist/tree.d.ts +11 -0
- package/package.json +1 -1
- package/schema/graph.schema.json +125 -23
package/README.md
CHANGED
|
@@ -22,10 +22,12 @@ lets you read one at a glance, and when the agent learns something, shows you ex
|
|
|
22
22
|
```json
|
|
23
23
|
{
|
|
24
24
|
"nodes": [
|
|
25
|
-
{ "id": "src", "label": "src", "kind": "folder", "
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
{ "id": "src", "label": "src", "kind": "folder", "children": [
|
|
26
|
+
{ "id": "src/auth", "label": "auth", "kind": "folder", "children": [
|
|
27
|
+
{ "id": "src/auth/login.ts", "label": "login.ts", "kind": "file" }
|
|
28
|
+
] },
|
|
29
|
+
{ "id": "src/db.ts", "label": "db.ts", "kind": "file" }
|
|
30
|
+
] }
|
|
29
31
|
],
|
|
30
32
|
"edges": [{ "source": "src/auth/login.ts", "target": "src/db.ts", "kind": "uses" }]
|
|
31
33
|
}
|
|
@@ -39,9 +41,17 @@ it as an error (forty kinds without colours look exactly like one kind):
|
|
|
39
41
|
"edgePalette": { "uses": "#2563eb" } }
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
`
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
Only `id` is required. Nest nodes in `children`; array order is reading order. `kind` is recommended.
|
|
45
|
+
Within one pass, fragments with the same id fill absent fields. Equal values are accepted; conflicting values
|
|
46
|
+
are errors. Repeated `children` declarations must have the same direct child ids in the same order;
|
|
47
|
+
child details compose independently. An omitted list is unspecified; `[]` explicitly declares no children.
|
|
48
|
+
Top-level fragments attach wherever their id appears in another node's children. Unattached nodes are roots.
|
|
49
|
+
Each node has at most one parent, and cycles are errors. Each pass is a complete snapshot.
|
|
50
|
+
|
|
51
|
+
The layout reads children clockwise when seeding recursive sectors: the outer circle reserves an empty
|
|
52
|
+
sector at the top, and descendants subdivide their parent's angular interval. Re-layout samples again;
|
|
53
|
+
the force solver can change the final angular order. The layer view uses the root's children, or the forest's
|
|
54
|
+
roots, in reading order. No parent, order or layer field is written. See [tree composition](https://github.com/voidixyn/glassbrain/blob/main/docs/cli.md#tree-fragments-and-composition).
|
|
45
55
|
A [JSON Schema](https://github.com/voidixyn/glassbrain/blob/main/schema/graph.schema.json) describes every field, and the CLI answers in a form an
|
|
46
56
|
agent can act on — findings identify the problem and structural advice suggests a next step:
|
|
47
57
|
|
|
@@ -96,7 +106,7 @@ That makes change the main event:
|
|
|
96
106
|
|
|
97
107
|
Search ranks by how well a node matches, the detail panel renders the node's markdown, labels
|
|
98
108
|
make room for each other instead of piling up, and [dark mode is computed](https://github.com/voidixyn/glassbrain/blob/main/docs/guide.md#color-hue-is-configured-everything-else-is-computed)
|
|
99
|
-
from the light palette.
|
|
109
|
+
from the light palette. The root’s children can be read as floors in 2.5D:
|
|
100
110
|
|
|
101
111
|

|
|
102
112
|
|
package/dist/adapters.js
CHANGED
|
@@ -481,12 +481,36 @@ function adapt(files, only) {
|
|
|
481
481
|
const out = pick.convert(files);
|
|
482
482
|
const skipped = pick === MARKDOWN ? [] : files.filter((f) => /\.jsonl?$/i.test(f.path) && !pick.detect([f])).map((f) => f.path);
|
|
483
483
|
return {
|
|
484
|
-
sources: out
|
|
484
|
+
sources: treeSources(out),
|
|
485
485
|
profile: out.profile,
|
|
486
486
|
adapter: pick,
|
|
487
487
|
skipped
|
|
488
488
|
};
|
|
489
489
|
}
|
|
490
|
+
function treeSources(out) {
|
|
491
|
+
const children = /* @__PURE__ */ new Map();
|
|
492
|
+
for (const s of out.sources) for (const n of s.graph.nodes) {
|
|
493
|
+
if (!n.parent) continue;
|
|
494
|
+
const kids = children.get(n.parent) ?? /* @__PURE__ */ new Map();
|
|
495
|
+
kids.set(n.id, typeof n.order === "number" ? n.order : void 0);
|
|
496
|
+
children.set(n.parent, kids);
|
|
497
|
+
}
|
|
498
|
+
const written = /* @__PURE__ */ new Set();
|
|
499
|
+
return out.sources.map((s) => ({ origin: s.origin, text: JSON.stringify({
|
|
500
|
+
...s.graph,
|
|
501
|
+
nodes: s.graph.nodes.map((n) => {
|
|
502
|
+
const { parent: _parent, order: _order, layer: _layer, ...fields } = n;
|
|
503
|
+
const kids = children.get(n.id);
|
|
504
|
+
if (!kids || written.has(n.id)) return fields;
|
|
505
|
+
written.add(n.id);
|
|
506
|
+
return {
|
|
507
|
+
...fields,
|
|
508
|
+
...fields.unordered === void 0 && [...kids.values()].every((v) => v === void 0) ? { unordered: true } : {},
|
|
509
|
+
children: [...kids].sort((a, b) => (a[1] ?? Infinity) - (b[1] ?? Infinity)).map(([id]) => ({ id }))
|
|
510
|
+
};
|
|
511
|
+
})
|
|
512
|
+
}) }));
|
|
513
|
+
}
|
|
490
514
|
var isNativeGraph = (f) => {
|
|
491
515
|
if (!/\.json$/i.test(f.path)) return false;
|
|
492
516
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EN
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5DEN6HXJ.js";
|
|
4
4
|
|
|
5
5
|
// src/react/i18n.ts
|
|
6
6
|
import { createContext, useContext } from "react";
|
|
@@ -175,6 +175,7 @@ function DetailPanel({ node, spec, kindLabels, onClose, renderText, onEdit, colo
|
|
|
175
175
|
"label",
|
|
176
176
|
"parent",
|
|
177
177
|
"order",
|
|
178
|
+
"children",
|
|
178
179
|
"layer",
|
|
179
180
|
"flags"
|
|
180
181
|
]);
|
|
@@ -201,8 +202,8 @@ function DetailPanel({ node, spec, kindLabels, onClose, renderText, onEdit, colo
|
|
|
201
202
|
/* @__PURE__ */ jsx3("span", { children: node.parent ?? "Root" })
|
|
202
203
|
] }),
|
|
203
204
|
node.parent && /* @__PURE__ */ jsxs("div", { className: "gb-line", children: [
|
|
204
|
-
/* @__PURE__ */ jsx3("span", { className: "gb-k", children: "
|
|
205
|
-
/* @__PURE__ */ jsx3("span", { children: node.order ?? "
|
|
205
|
+
/* @__PURE__ */ jsx3("span", { className: "gb-k", children: "Position" }),
|
|
206
|
+
/* @__PURE__ */ jsx3("span", { children: node.order ?? "\u2014" })
|
|
206
207
|
] }),
|
|
207
208
|
node.flags.map((f) => {
|
|
208
209
|
const note = spec.flagNotes?.[f];
|