polycodegraph 0.1.0__py3-none-any.whl

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.
Files changed (67) hide show
  1. codegraph/__init__.py +10 -0
  2. codegraph/analysis/__init__.py +30 -0
  3. codegraph/analysis/_common.py +125 -0
  4. codegraph/analysis/blast_radius.py +63 -0
  5. codegraph/analysis/cycles.py +79 -0
  6. codegraph/analysis/dataflow.py +861 -0
  7. codegraph/analysis/dead_code.py +165 -0
  8. codegraph/analysis/hotspots.py +68 -0
  9. codegraph/analysis/infrastructure.py +439 -0
  10. codegraph/analysis/metrics.py +52 -0
  11. codegraph/analysis/report.py +222 -0
  12. codegraph/analysis/roles.py +323 -0
  13. codegraph/analysis/untested.py +79 -0
  14. codegraph/cli.py +1506 -0
  15. codegraph/config.py +64 -0
  16. codegraph/embed/__init__.py +35 -0
  17. codegraph/embed/chunker.py +120 -0
  18. codegraph/embed/embedder.py +113 -0
  19. codegraph/embed/query.py +181 -0
  20. codegraph/embed/store.py +360 -0
  21. codegraph/graph/__init__.py +0 -0
  22. codegraph/graph/builder.py +212 -0
  23. codegraph/graph/schema.py +69 -0
  24. codegraph/graph/store_networkx.py +55 -0
  25. codegraph/graph/store_sqlite.py +249 -0
  26. codegraph/mcp_server/__init__.py +6 -0
  27. codegraph/mcp_server/server.py +933 -0
  28. codegraph/parsers/__init__.py +0 -0
  29. codegraph/parsers/base.py +70 -0
  30. codegraph/parsers/go.py +570 -0
  31. codegraph/parsers/python.py +1707 -0
  32. codegraph/parsers/typescript.py +1397 -0
  33. codegraph/py.typed +0 -0
  34. codegraph/resolve/__init__.py +4 -0
  35. codegraph/resolve/calls.py +480 -0
  36. codegraph/review/__init__.py +31 -0
  37. codegraph/review/baseline.py +32 -0
  38. codegraph/review/differ.py +211 -0
  39. codegraph/review/hook.py +70 -0
  40. codegraph/review/risk.py +219 -0
  41. codegraph/review/rules.py +342 -0
  42. codegraph/viz/__init__.py +17 -0
  43. codegraph/viz/_style.py +45 -0
  44. codegraph/viz/dashboard.py +740 -0
  45. codegraph/viz/diagrams.py +370 -0
  46. codegraph/viz/explore.py +453 -0
  47. codegraph/viz/hld.py +683 -0
  48. codegraph/viz/html.py +115 -0
  49. codegraph/viz/mermaid.py +111 -0
  50. codegraph/viz/svg.py +77 -0
  51. codegraph/web/__init__.py +4 -0
  52. codegraph/web/server.py +165 -0
  53. codegraph/web/static/app.css +664 -0
  54. codegraph/web/static/app.js +919 -0
  55. codegraph/web/static/index.html +112 -0
  56. codegraph/web/static/views/architecture.js +1671 -0
  57. codegraph/web/static/views/graph3d.css +564 -0
  58. codegraph/web/static/views/graph3d.js +999 -0
  59. codegraph/web/static/views/graph3d_transform.js +984 -0
  60. codegraph/workspace/__init__.py +34 -0
  61. codegraph/workspace/config.py +110 -0
  62. codegraph/workspace/operations.py +294 -0
  63. polycodegraph-0.1.0.dist-info/METADATA +687 -0
  64. polycodegraph-0.1.0.dist-info/RECORD +67 -0
  65. polycodegraph-0.1.0.dist-info/WHEEL +4 -0
  66. polycodegraph-0.1.0.dist-info/entry_points.txt +2 -0
  67. polycodegraph-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,564 @@
1
+ /* graph3d.css — styles for the 3D Graph view (per PLAN_3D_VIEW.md §4).
2
+ * Loaded after app.css, so it can rely on the dashboard's CSS custom
3
+ * properties (--bg-*, --txt-*, --brand, --line). All theme parity comes
4
+ * from those variables — no hex literals duplicated here. */
5
+
6
+ .g3d-controls {
7
+ display: flex;
8
+ align-items: center;
9
+ flex-wrap: wrap;
10
+ gap: 10px;
11
+ padding: 10px 14px;
12
+ margin-bottom: 14px;
13
+ background: var(--bg-2);
14
+ border: 1px solid var(--line);
15
+ border-radius: 10px;
16
+ box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.03) inset;
17
+ }
18
+
19
+ .g3d-controls-group {
20
+ display: flex;
21
+ align-items: center;
22
+ gap: 6px;
23
+ flex-wrap: wrap;
24
+ }
25
+
26
+ .g3d-controls-lbl {
27
+ font-size: 11px;
28
+ letter-spacing: 0.12em;
29
+ text-transform: uppercase;
30
+ color: var(--txt-2);
31
+ margin-right: 4px;
32
+ }
33
+
34
+ .g3d-controls-sep {
35
+ width: 1px;
36
+ align-self: stretch;
37
+ background: var(--line);
38
+ margin: 0 4px;
39
+ }
40
+
41
+ .g3d-filter-btn {
42
+ font-size: 11px;
43
+ font-weight: 500;
44
+ letter-spacing: 0.04em;
45
+ padding: 5px 10px;
46
+ border-radius: 6px;
47
+ border: 1px solid var(--line-strong);
48
+ background: var(--bg-3);
49
+ color: var(--txt-1);
50
+ cursor: pointer;
51
+ transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
52
+ }
53
+
54
+ .g3d-filter-btn:hover {
55
+ border-color: var(--brand);
56
+ color: var(--txt-0);
57
+ }
58
+
59
+ .g3d-filter-btn.active {
60
+ background: linear-gradient(180deg, rgba(129, 140, 248, 0.18), rgba(129, 140, 248, 0.06));
61
+ border-color: var(--brand);
62
+ color: var(--txt-0);
63
+ }
64
+
65
+ .g3d-filter-btn:focus-visible {
66
+ outline: 2px solid var(--brand);
67
+ outline-offset: 2px;
68
+ }
69
+
70
+ .g3d-canvas-wrap {
71
+ position: relative;
72
+ width: 100%;
73
+ height: min(72vh, 760px);
74
+ min-height: 480px;
75
+ border: 1px solid var(--line);
76
+ border-radius: 12px;
77
+ overflow: hidden;
78
+ background: var(--bg-1);
79
+ box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.55);
80
+ cursor: grab;
81
+ }
82
+
83
+ .g3d-canvas-wrap:active { cursor: grabbing; }
84
+
85
+ .g3d-canvas-wrap canvas { display: block; }
86
+
87
+ .g3d-empty {
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: center;
91
+ height: 100%;
92
+ color: var(--txt-2);
93
+ font-size: 13px;
94
+ }
95
+
96
+ .g3d-detail {
97
+ /* Reuse panel styles from app.css — only minor overrides needed. */
98
+ }
99
+
100
+ .g3d-fallback {
101
+ border: 1px dashed var(--line-strong);
102
+ border-radius: 10px;
103
+ background: var(--bg-2);
104
+ }
105
+
106
+ /* 3d-force-graph injects a tooltip <div class="scene-tooltip"> on the body. */
107
+ .scene-tooltip,
108
+ .g3d-tip {
109
+ font-family: 'Inter var', Inter, system-ui, sans-serif !important;
110
+ font-size: 12px !important;
111
+ line-height: 1.4;
112
+ background: var(--bg-3) !important;
113
+ color: var(--txt-0) !important;
114
+ border: 1px solid var(--line-strong) !important;
115
+ border-radius: 6px !important;
116
+ padding: 8px 10px !important;
117
+ box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.65) !important;
118
+ }
119
+
120
+ .g3d-tip b { color: var(--brand); }
121
+
122
+ /* ---- Focus mode additions (v0.1.0) ---- */
123
+
124
+ .g3d-controls-search {
125
+ flex: 1 1 220px;
126
+ min-width: 220px;
127
+ }
128
+ .g3d-controls-search-large { flex-basis: 360px; }
129
+
130
+ .g3d-search {
131
+ position: relative;
132
+ display: flex;
133
+ align-items: center;
134
+ width: 100%;
135
+ background: var(--bg-3);
136
+ border: 1px solid var(--line-strong);
137
+ border-radius: 8px;
138
+ padding: 6px 10px;
139
+ gap: 8px;
140
+ transition: border-color 120ms ease;
141
+ }
142
+ .g3d-search:focus-within { border-color: var(--brand); }
143
+ .g3d-search input {
144
+ flex: 1;
145
+ background: transparent;
146
+ border: 0;
147
+ outline: 0;
148
+ color: var(--txt-0);
149
+ font-size: 13px;
150
+ font-family: inherit;
151
+ }
152
+ .g3d-search-icon { color: var(--txt-3); }
153
+
154
+ .g3d-search-popover {
155
+ position: relative;
156
+ background: var(--bg-2);
157
+ border: 1px solid var(--line-strong);
158
+ border-radius: 10px;
159
+ margin-top: -8px;
160
+ margin-bottom: 14px;
161
+ max-height: 320px;
162
+ overflow-y: auto;
163
+ box-shadow: 0 16px 32px -16px rgba(0, 0, 0, 0.45);
164
+ }
165
+
166
+ .g3d-depth-val {
167
+ display: inline-block;
168
+ min-width: 18px;
169
+ text-align: center;
170
+ font-variant-numeric: tabular-nums;
171
+ font-size: 12px;
172
+ color: var(--txt-1);
173
+ }
174
+
175
+ #g3d-depth {
176
+ width: 110px;
177
+ accent-color: var(--brand);
178
+ }
179
+
180
+ .g3d-picker-stage {
181
+ display: grid;
182
+ grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
183
+ gap: 18px;
184
+ align-items: start;
185
+ }
186
+ @media (max-width: 900px) {
187
+ .g3d-picker-stage { grid-template-columns: 1fr; }
188
+ }
189
+
190
+ .g3d-picker-results {
191
+ background: var(--bg-2);
192
+ border: 1px solid var(--line);
193
+ border-radius: 12px;
194
+ overflow: hidden;
195
+ }
196
+
197
+ .g3d-picker-empty {
198
+ display: flex;
199
+ flex-direction: column;
200
+ align-items: flex-start;
201
+ gap: 10px;
202
+ padding: 24px;
203
+ background: linear-gradient(160deg, rgba(167,139,250,0.08), rgba(34,211,238,0.04));
204
+ border: 1px dashed var(--line-strong);
205
+ border-radius: 12px;
206
+ color: var(--txt-1);
207
+ }
208
+ .g3d-picker-empty h3 {
209
+ margin: 0;
210
+ font-size: 15px;
211
+ font-weight: 600;
212
+ color: var(--txt-0);
213
+ }
214
+ .g3d-picker-empty p { margin: 0; font-size: 12.5px; line-height: 1.5; }
215
+
216
+ .g3d-pick-row {
217
+ display: grid;
218
+ grid-template-columns: 72px 1fr auto;
219
+ align-items: center;
220
+ gap: 10px;
221
+ width: 100%;
222
+ padding: 10px 14px;
223
+ background: transparent;
224
+ border: 0;
225
+ border-bottom: 1px solid var(--line);
226
+ color: var(--txt-1);
227
+ text-align: left;
228
+ cursor: pointer;
229
+ font-size: 12.5px;
230
+ font-family: inherit;
231
+ transition: background 100ms ease;
232
+ }
233
+ .g3d-pick-row:last-child { border-bottom: 0; }
234
+ .g3d-pick-row:hover {
235
+ background: linear-gradient(180deg, rgba(129,140,248,0.10), rgba(129,140,248,0.04));
236
+ color: var(--txt-0);
237
+ }
238
+ .g3d-pick-name { font-weight: 600; }
239
+ .g3d-pick-qn {
240
+ grid-column: 2;
241
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
242
+ font-size: 11px;
243
+ color: var(--txt-2);
244
+ overflow: hidden;
245
+ text-overflow: ellipsis;
246
+ white-space: nowrap;
247
+ }
248
+ .g3d-pick-meta {
249
+ font-size: 11px;
250
+ color: var(--txt-3);
251
+ letter-spacing: 0.04em;
252
+ white-space: nowrap;
253
+ }
254
+ .g3d-picker-noresults {
255
+ padding: 16px;
256
+ color: var(--txt-3);
257
+ font-size: 12px;
258
+ text-align: center;
259
+ }
260
+
261
+ /* ---- Grouped picker (Item 4) ---- */
262
+ .g3d-grp { border-bottom: 1px solid var(--line); }
263
+ .g3d-grp:last-child { border-bottom: 0; }
264
+ .g3d-grp-hdr {
265
+ display: flex;
266
+ align-items: center;
267
+ gap: 8px;
268
+ padding: 10px 14px 6px;
269
+ background: linear-gradient(180deg, rgba(129,140,248,0.04), transparent);
270
+ }
271
+ .g3d-grp-tag {
272
+ display: inline-flex;
273
+ align-items: center;
274
+ justify-content: center;
275
+ font-size: 9px;
276
+ font-weight: 700;
277
+ letter-spacing: 0.1em;
278
+ padding: 2px 5px;
279
+ border-radius: 3px;
280
+ background: rgba(129,140,248,0.12);
281
+ color: var(--brand);
282
+ border: 1px solid rgba(129,140,248,0.3);
283
+ }
284
+ .g3d-grp-name {
285
+ font-size: 12px;
286
+ font-weight: 600;
287
+ color: var(--txt-0);
288
+ overflow: hidden;
289
+ text-overflow: ellipsis;
290
+ white-space: nowrap;
291
+ }
292
+ .g3d-grp-file {
293
+ margin-left: auto;
294
+ font-size: 10.5px;
295
+ color: var(--txt-3);
296
+ }
297
+ .g3d-grp-body {
298
+ display: flex;
299
+ flex-direction: column;
300
+ }
301
+ .g3d-grp-class {
302
+ border-top: 1px dashed var(--line);
303
+ }
304
+ .g3d-grp-class-hdr {
305
+ display: flex;
306
+ align-items: center;
307
+ gap: 8px;
308
+ padding: 6px 14px 4px;
309
+ font-size: 11px;
310
+ color: var(--txt-2);
311
+ }
312
+ .g3d-grp-class-name {
313
+ font-weight: 600;
314
+ color: var(--txt-1);
315
+ }
316
+ .g3d-pick-indent {
317
+ padding-left: 32px;
318
+ }
319
+
320
+ .g3d-kind-badge {
321
+ display: inline-flex;
322
+ align-items: center;
323
+ justify-content: center;
324
+ font-size: 9.5px;
325
+ font-weight: 700;
326
+ letter-spacing: 0.08em;
327
+ padding: 2px 6px;
328
+ border-radius: 4px;
329
+ background: var(--bg-3);
330
+ color: var(--txt-1);
331
+ border: 1px solid var(--line-strong);
332
+ text-transform: uppercase;
333
+ width: fit-content;
334
+ }
335
+ .g3d-kind-function { color: #34d399; border-color: rgba(52,211,153,0.4); }
336
+ .g3d-kind-method { color: #22d3ee; border-color: rgba(34,211,238,0.4); }
337
+ .g3d-kind-class { color: #a78bfa; border-color: rgba(167,139,250,0.4); }
338
+ .g3d-kind-module { color: #818cf8; border-color: rgba(129,140,248,0.4); }
339
+
340
+ /* ---- Breadcrumb trail ---- */
341
+ .g3d-breadcrumb {
342
+ display: flex;
343
+ align-items: center;
344
+ gap: 6px;
345
+ flex-wrap: wrap;
346
+ margin-bottom: 12px;
347
+ font-size: 11.5px;
348
+ color: var(--txt-2);
349
+ }
350
+ .g3d-breadcrumb-lbl {
351
+ font-size: 10px;
352
+ letter-spacing: 0.14em;
353
+ text-transform: uppercase;
354
+ color: var(--txt-3);
355
+ margin-right: 4px;
356
+ }
357
+ .g3d-breadcrumb-sep { color: var(--txt-3); }
358
+ .g3d-crumb {
359
+ background: transparent;
360
+ border: 1px solid var(--line);
361
+ color: var(--txt-1);
362
+ padding: 3px 8px;
363
+ border-radius: 4px;
364
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
365
+ font-size: 10.5px;
366
+ cursor: pointer;
367
+ max-width: 280px;
368
+ overflow: hidden;
369
+ text-overflow: ellipsis;
370
+ white-space: nowrap;
371
+ transition: border-color 120ms, color 120ms;
372
+ }
373
+ .g3d-crumb:hover { border-color: var(--brand); color: var(--txt-0); }
374
+ .g3d-crumb.is-current {
375
+ border-color: var(--brand);
376
+ color: var(--txt-0);
377
+ background: rgba(167,139,250,0.10);
378
+ cursor: default;
379
+ }
380
+
381
+ .g3d-detail-hint {
382
+ font-size: 11px;
383
+ color: var(--txt-3);
384
+ font-style: italic;
385
+ }
386
+
387
+ .g3d-detail-actions {
388
+ display: flex;
389
+ gap: 8px;
390
+ flex-wrap: wrap;
391
+ }
392
+
393
+ .g3d-detail-name {
394
+ color: var(--txt-0);
395
+ }
396
+
397
+ /* ---- Color & kind legend (Item 3) ---- */
398
+ .g3d-legend {
399
+ position: absolute;
400
+ top: 12px;
401
+ right: 12px;
402
+ z-index: 4;
403
+ background: rgba(12, 16, 24, 0.78);
404
+ border: 1px solid var(--line-strong);
405
+ border-radius: 10px;
406
+ padding: 10px 12px;
407
+ min-width: 180px;
408
+ backdrop-filter: blur(6px);
409
+ -webkit-backdrop-filter: blur(6px);
410
+ color: var(--txt-1);
411
+ font-size: 11.5px;
412
+ box-shadow: 0 12px 28px -16px rgba(0,0,0,0.6);
413
+ transition: padding 120ms ease, min-width 120ms ease;
414
+ }
415
+ .theme-light .g3d-legend {
416
+ background: rgba(255, 255, 255, 0.84);
417
+ color: var(--txt-1);
418
+ }
419
+ .g3d-legend.is-collapsed {
420
+ padding: 4px;
421
+ min-width: 0;
422
+ }
423
+ .g3d-legend.is-collapsed .g3d-legend-body { display: none; }
424
+
425
+ .g3d-legend-toggle {
426
+ position: absolute;
427
+ top: 4px;
428
+ right: 4px;
429
+ width: 20px;
430
+ height: 20px;
431
+ border: 1px solid var(--line);
432
+ border-radius: 4px;
433
+ background: var(--bg-3);
434
+ color: var(--txt-1);
435
+ font-size: 12px;
436
+ line-height: 1;
437
+ cursor: pointer;
438
+ display: flex;
439
+ align-items: center;
440
+ justify-content: center;
441
+ }
442
+ .g3d-legend-toggle:hover { border-color: var(--brand); color: var(--txt-0); }
443
+
444
+ .g3d-legend.is-collapsed .g3d-legend-toggle {
445
+ position: static;
446
+ }
447
+
448
+ .g3d-legend-body {
449
+ display: flex;
450
+ flex-direction: column;
451
+ gap: 10px;
452
+ margin-top: 4px;
453
+ padding-right: 18px;
454
+ }
455
+
456
+ .g3d-legend-section {
457
+ display: flex;
458
+ flex-direction: column;
459
+ gap: 4px;
460
+ }
461
+
462
+ .g3d-legend-title {
463
+ font-size: 9.5px;
464
+ letter-spacing: 0.14em;
465
+ text-transform: uppercase;
466
+ color: var(--txt-3);
467
+ }
468
+
469
+ .g3d-legend-row {
470
+ display: flex;
471
+ align-items: center;
472
+ gap: 8px;
473
+ font-size: 11.5px;
474
+ color: var(--txt-1);
475
+ }
476
+
477
+ .g3d-legend-dot {
478
+ width: 10px;
479
+ height: 10px;
480
+ border-radius: 50%;
481
+ display: inline-block;
482
+ box-shadow: 0 0 0 1px rgba(0,0,0,0.2) inset;
483
+ }
484
+ .g3d-legend-dot-outline {
485
+ background: transparent;
486
+ border: 1.5px solid #8b9ab8;
487
+ }
488
+
489
+ .g3d-legend-kinds {
490
+ display: flex;
491
+ gap: 6px;
492
+ flex-wrap: wrap;
493
+ }
494
+ .g3d-legend-lbl { font-size: 11px; }
495
+
496
+ /* ---- Role-grouped picker (Change 3) ---- */
497
+ .g3d-role-bucket {
498
+ border-bottom: 1px solid var(--line);
499
+ }
500
+ .g3d-role-bucket:last-child { border-bottom: 0; }
501
+ .g3d-role-bucket-hdr {
502
+ display: flex;
503
+ align-items: center;
504
+ gap: 8px;
505
+ padding: 10px 14px 8px;
506
+ background: linear-gradient(180deg, rgba(167,139,250,0.06), transparent);
507
+ border-bottom: 1px dashed var(--line);
508
+ }
509
+ .g3d-role-chip {
510
+ display: inline-block;
511
+ width: 10px;
512
+ height: 10px;
513
+ border-radius: 3px;
514
+ box-shadow: 0 0 0 1px rgba(0,0,0,0.25) inset;
515
+ }
516
+ .g3d-role-bucket-name {
517
+ font-size: 11px;
518
+ font-weight: 700;
519
+ letter-spacing: 0.14em;
520
+ text-transform: uppercase;
521
+ color: var(--txt-0);
522
+ }
523
+ .g3d-role-bucket-count {
524
+ margin-left: auto;
525
+ font-size: 10.5px;
526
+ color: var(--txt-3);
527
+ }
528
+
529
+ /* ---- Detail signature (Change 4) ---- */
530
+ .g3d-detail-sig-lbl {
531
+ margin-top: 10px;
532
+ font-size: 9.5px;
533
+ letter-spacing: 0.14em;
534
+ text-transform: uppercase;
535
+ color: var(--txt-3);
536
+ margin-bottom: 4px;
537
+ }
538
+ .g3d-detail-sig {
539
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
540
+ font-size: 12px;
541
+ color: var(--txt-1);
542
+ background: var(--bg-3);
543
+ border: 1px solid var(--line);
544
+ border-radius: 6px;
545
+ padding: 8px 10px;
546
+ white-space: pre-wrap;
547
+ word-break: break-word;
548
+ }
549
+ .g3d-detail-role {
550
+ display: inline-flex;
551
+ align-items: center;
552
+ gap: 4px;
553
+ margin-left: 8px;
554
+ font-size: 10px;
555
+ letter-spacing: 0.12em;
556
+ text-transform: uppercase;
557
+ color: var(--txt-2);
558
+ }
559
+ .g3d-detail-rolechip {
560
+ display: inline-block;
561
+ width: 8px;
562
+ height: 8px;
563
+ border-radius: 2px;
564
+ }