code-kg 0.1.4 → 0.1.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/dist/server/ui.js CHANGED
@@ -600,25 +600,27 @@ function renderUiHtml() {
600
600
  };
601
601
 
602
602
  const NODE_COLORS = {
603
- file: '#3af7ff',
604
- function: '#ff2de1',
605
- class: '#b8ff39',
606
- interface: '#ffb84d',
607
- variable: '#9f8cff',
608
- route: '#10f8a5',
609
- directory: '#6ea8ff',
610
- entrypoint: '#ff6d6d'
603
+ file: '#9cff3f',
604
+ function: '#bf84ff',
605
+ class: '#b66fff',
606
+ interface: '#c889ff',
607
+ variable: '#ab7aff',
608
+ route: '#73efff',
609
+ directory: '#8eff60',
610
+ entrypoint: '#ffe17a',
611
+ module: '#9cff3f'
611
612
  };
612
613
 
613
614
  const EDGE_COLORS = {
614
- IMPORTS: '#3af7ff',
615
- DEPENDS_ON: '#ff2de1',
616
- CALLS: '#b8ff39',
617
- REFERENCES: '#ffb84d',
618
- HANDLES_ROUTE: '#10f8a5',
619
- DEFINES: '#9f8cff',
620
- EXPORTS: '#8fd4ff',
621
- CONTAINS: '#4e6ea0'
615
+ IMPORTS: '#9cff3f',
616
+ DEPENDS_ON: '#8fe038',
617
+ CALLS: '#b66fff',
618
+ REFERENCES: '#c889ff',
619
+ HANDLES_ROUTE: '#73efff',
620
+ DEFINES: '#b176ff',
621
+ EXPORTS: '#8dd8ff',
622
+ CONTAINS: '#82cf34',
623
+ MODULE_DEPENDS_ON: '#9cff3f'
622
624
  };
623
625
 
624
626
  const els = {
@@ -654,7 +656,7 @@ function renderUiHtml() {
654
656
 
655
657
  function colorForEdge(type) {
656
658
  const key = String(type || '').toUpperCase();
657
- return EDGE_COLORS[key] || '#4f6e8a';
659
+ return EDGE_COLORS[key] || '#82cf34';
658
660
  }
659
661
 
660
662
  function isQualityMode(value) {
@@ -799,12 +801,14 @@ function renderUiHtml() {
799
801
  return false;
800
802
  }
801
803
 
802
- const memoryBuffer = wasm.memory && wasm.memory.buffer ? wasm.memory.buffer : null;
804
+ let memoryBuffer = wasm.memory && wasm.memory.buffer ? wasm.memory.buffer : null;
803
805
  if (!memoryBuffer) {
804
806
  return false;
805
807
  }
806
808
 
807
- new Uint32Array(memoryBuffer, edgePtr, edgeArray.length).set(edgeArray);
809
+ if (edgeArray.length > 0) {
810
+ new Uint32Array(memoryBuffer, edgePtr, edgeArray.length).set(edgeArray);
811
+ }
808
812
  const seed = stableHash(seedText || state.view || 'codekg');
809
813
  const status = wasm.layout_graph(
810
814
  state.graphData.nodes.length,
@@ -819,6 +823,11 @@ function renderUiHtml() {
819
823
  return false;
820
824
  }
821
825
 
826
+ // Rust allocations inside layout_graph can grow memory, so always re-read the buffer.
827
+ memoryBuffer = wasm.memory && wasm.memory.buffer ? wasm.memory.buffer : null;
828
+ if (!memoryBuffer) {
829
+ return false;
830
+ }
822
831
  const positions = new Float32Array(memoryBuffer, outPtr, outCount);
823
832
  for (let index = 0; index < state.graphData.nodes.length; index += 1) {
824
833
  const node = state.graphData.nodes[index];
@@ -926,14 +935,14 @@ function renderUiHtml() {
926
935
  graph.d3VelocityDecay(usingWasmLayout ? 0.9 : mode === 'normal' ? 0.28 : mode === 'degraded' ? 0.4 : 0.58);
927
936
  }
928
937
  if (typeof graph.nodeResolution === 'function') {
929
- graph.nodeResolution(mode === 'normal' ? 8 : mode === 'degraded' ? 6 : 4);
938
+ graph.nodeResolution(mode === 'normal' ? 7 : mode === 'degraded' ? 5 : 4);
930
939
  }
931
940
  if (typeof graph.linkResolution === 'function') {
932
- graph.linkResolution(mode === 'normal' ? 6 : mode === 'degraded' ? 4 : 3);
941
+ graph.linkResolution(mode === 'normal' ? 4 : mode === 'degraded' ? 3 : 2);
933
942
  }
934
943
 
935
- graph.linkOpacity(mode === 'normal' ? 0.66 : mode === 'degraded' ? 0.56 : 0.48);
936
- graph.nodeRelSize(mode === 'normal' ? 3.2 : mode === 'degraded' ? 2.8 : 2.55);
944
+ graph.linkOpacity(mode === 'normal' ? 0.2 : mode === 'degraded' ? 0.16 : 0.13);
945
+ graph.nodeRelSize(mode === 'normal' ? 1.22 : mode === 'degraded' ? 1.02 : 0.88);
937
946
 
938
947
  if (typeof graph.d3Force === 'function') {
939
948
  const currentCharge = graph.d3Force('charge');
@@ -1038,7 +1047,7 @@ function renderUiHtml() {
1038
1047
  type,
1039
1048
  path,
1040
1049
  props: node.props || {},
1041
- baseVal: 2.6 + Math.min(14, d * 0.9),
1050
+ baseVal: 0.86 + Math.min(3.4, d * 0.12),
1042
1051
  __color: colorForNode(type),
1043
1052
  __searchText: (String(name) + ' ' + String(path) + ' ' + String(type)).toLowerCase(),
1044
1053
  __matched: false,
@@ -1067,9 +1076,9 @@ function renderUiHtml() {
1067
1076
  }
1068
1077
 
1069
1078
  const graph = window.ForceGraph3D()(els.graphCanvas)
1070
- .backgroundColor('#05060f')
1079
+ .backgroundColor('#01040f')
1071
1080
  .showNavInfo(false)
1072
- .nodeOpacity(0.95)
1081
+ .nodeOpacity(0.92)
1073
1082
  .nodeVisibility((node) => node.__renderVisible !== false)
1074
1083
  .nodeLabel((node) => {
1075
1084
  const name = String(node.name || node.id || 'node');
@@ -1079,10 +1088,10 @@ function renderUiHtml() {
1079
1088
  })
1080
1089
  .nodeColor((node) => {
1081
1090
  if (node.__selected) {
1082
- return '#ff2de1';
1091
+ return '#ff46d9';
1083
1092
  }
1084
1093
  if (node.__matched) {
1085
- return '#f6ff4d';
1094
+ return '#f3ff77';
1086
1095
  }
1087
1096
  return node.__color || '#d5f4ff';
1088
1097
  })
@@ -1092,23 +1101,23 @@ function renderUiHtml() {
1092
1101
  })
1093
1102
  .linkColor((link) => {
1094
1103
  if (link.__highlight) {
1095
- return '#f6ff4d';
1104
+ return '#f3ff77';
1096
1105
  }
1097
- return link.__color || '#5f7fa1';
1106
+ return link.__color || '#82cf34';
1098
1107
  })
1099
1108
  .linkWidth((link) => {
1100
- const base = state.perfMode === 'normal' ? 0.75 : state.perfMode === 'degraded' ? 0.46 : 0.34;
1101
- const highlight = state.perfMode === 'normal' ? 2.2 : state.perfMode === 'degraded' ? 1.35 : 1.05;
1109
+ const base = state.perfMode === 'normal' ? 0.22 : state.perfMode === 'degraded' ? 0.18 : 0.14;
1110
+ const highlight = state.perfMode === 'normal' ? 0.9 : state.perfMode === 'degraded' ? 0.66 : 0.54;
1102
1111
  return link.__highlight ? highlight : base;
1103
1112
  })
1104
1113
  .linkVisibility((link) => link.__renderVisible !== false)
1105
1114
  .linkDirectionalParticles((link) => {
1106
- return link.__highlight ? (state.perfMode === 'normal' ? 3 : 1) : 0;
1115
+ return link.__highlight ? (state.perfMode === 'normal' ? 2 : 1) : 0;
1107
1116
  })
1108
1117
  .linkDirectionalParticleWidth((link) => {
1109
- return link.__highlight ? (state.perfMode === 'normal' ? 2.2 : 1.25) : 0;
1118
+ return link.__highlight ? (state.perfMode === 'normal' ? 1.3 : 0.95) : 0;
1110
1119
  })
1111
- .linkDirectionalParticleColor(() => '#f6ff4d')
1120
+ .linkDirectionalParticleColor(() => '#f3ff77')
1112
1121
  .onNodeClick((node) => {
1113
1122
  if (!node || !node.id) {
1114
1123
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/server/ui.ts"],"names":[],"mappings":";;AAEA,oCA4jDC;AA9jDD,2DAAmE;AAEnE,SAAgB,YAAY;IAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2gC3D,CAAC;AACT,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-kg",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Local code knowledge graph CLI with interactive visualization and deterministic analysis APIs",
5
5
  "license": "MIT",
6
6
  "keywords": [