glassbrain 0.2.0-alpha.5 → 0.2.0-alpha.7
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 -12
- package/dist/adapters.js +25 -1
- package/dist/chunks/{chunk-3JGZ27DC.js → chunk-3KUNYSJE.js} +6 -3
- package/dist/chunks/{chunk-F4HDKER4.js → chunk-FNTYI7VP.js} +291 -112
- package/dist/chunks/{chunk-WUBELTBU.js → chunk-GZSWZSSE.js} +392 -339
- package/dist/chunks/{chunk-G7XWVKHN.js → chunk-LK77SYCN.js} +39 -5
- package/dist/chunks/{chunk-ISWKAU5G.js → chunk-Q35ZKWKF.js} +3 -5
- package/dist/cli/glassbrain.js +552 -380
- package/dist/cli/viewer.js +92 -63
- package/dist/core.d.ts +1 -0
- package/dist/core.js +13 -5
- package/dist/edit.d.ts +5 -3
- package/dist/index.js +15 -7
- package/dist/internal.js +15 -7
- package/dist/kinds.d.ts +23 -0
- package/dist/layers.d.ts +1 -1
- package/dist/model.d.ts +15 -5
- package/dist/profile.d.ts +14 -2
- package/dist/react/DetailPanel.js +2 -2
- package/dist/react/GlassPlanes.d.ts +11 -0
- package/dist/react/GraphCanvas.d.ts +2 -0
- package/dist/react/GraphCanvas.js +4 -4
- package/dist/react/icons.d.ts +2 -0
- package/dist/strings.d.ts +2 -2
- package/dist/tree.d.ts +11 -0
- package/package.json +1 -1
- package/schema/graph.schema.json +125 -23
- package/schema/profile.schema.json +2 -2
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,13 +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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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).
|
|
49
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
|
|
50
56
|
agent can act on — findings identify the problem and structural advice suggests a next step:
|
|
51
57
|
|
|
@@ -100,7 +106,7 @@ That makes change the main event:
|
|
|
100
106
|
|
|
101
107
|
Search ranks by how well a node matches, the detail panel renders the node's markdown, labels
|
|
102
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)
|
|
103
|
-
from the light palette.
|
|
109
|
+
from the light palette. The root’s children can be read as floors in 2.5D:
|
|
104
110
|
|
|
105
111
|

|
|
106
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-Q35ZKWKF.js";
|
|
4
4
|
|
|
5
5
|
// src/react/i18n.ts
|
|
6
6
|
import { createContext, useContext } from "react";
|
|
@@ -18,6 +18,8 @@ var I = {
|
|
|
18
18
|
fit: "M4 9V5a1 1 0 0 1 1-1h4M15 4h4a1 1 0 0 1 1 1v4M20 15v4a1 1 0 0 1-1 1h-4M9 20H5a1 1 0 0 1-1-1v-4",
|
|
19
19
|
more: "M4 7h10M18 7h2M4 17h2M10 17h10M16 5v4M8 15v4",
|
|
20
20
|
warn: "M12 4 2.8 19.5h18.4L12 4Zm0 6v4.5m0 2.5v.5",
|
|
21
|
+
error: "M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18Zm-3 6 6 6m0-6-6 6",
|
|
22
|
+
info: "M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18Zm0 8v5m0-9v.5",
|
|
21
23
|
arrow: "M5 12h13M13 7l5 5-5 5",
|
|
22
24
|
stack: "M12 4 3 8.5l9 4.5 9-4.5L12 4ZM3 12.5l9 4.5 9-4.5M3 16.5l9 4.5 9-4.5",
|
|
23
25
|
edit: "M4 20h4L19 9l-4-4L4 16v4Zm9-13 4 4",
|
|
@@ -175,6 +177,7 @@ function DetailPanel({ node, spec, kindLabels, onClose, renderText, onEdit, colo
|
|
|
175
177
|
"label",
|
|
176
178
|
"parent",
|
|
177
179
|
"order",
|
|
180
|
+
"children",
|
|
178
181
|
"layer",
|
|
179
182
|
"flags"
|
|
180
183
|
]);
|
|
@@ -201,8 +204,8 @@ function DetailPanel({ node, spec, kindLabels, onClose, renderText, onEdit, colo
|
|
|
201
204
|
/* @__PURE__ */ jsx3("span", { children: node.parent ?? "Root" })
|
|
202
205
|
] }),
|
|
203
206
|
node.parent && /* @__PURE__ */ jsxs("div", { className: "gb-line", children: [
|
|
204
|
-
/* @__PURE__ */ jsx3("span", { className: "gb-k", children: "
|
|
205
|
-
/* @__PURE__ */ jsx3("span", { children: node.order ?? "
|
|
207
|
+
/* @__PURE__ */ jsx3("span", { className: "gb-k", children: "Position" }),
|
|
208
|
+
/* @__PURE__ */ jsx3("span", { children: node.order ?? "\u2014" })
|
|
206
209
|
] }),
|
|
207
210
|
node.flags.map((f) => {
|
|
208
211
|
const note = spec.flagNotes?.[f];
|