cg-code-graph 0.10.1__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 (174) hide show
  1. cg_code_graph-0.10.1.dist-info/METADATA +678 -0
  2. cg_code_graph-0.10.1.dist-info/RECORD +174 -0
  3. cg_code_graph-0.10.1.dist-info/WHEEL +5 -0
  4. cg_code_graph-0.10.1.dist-info/entry_points.txt +3 -0
  5. cg_code_graph-0.10.1.dist-info/licenses/LICENSE +21 -0
  6. cg_code_graph-0.10.1.dist-info/top_level.txt +1 -0
  7. codegraph/__init__.py +2 -0
  8. codegraph/aitools.py +129 -0
  9. codegraph/apps.py +76 -0
  10. codegraph/blindspots.py +428 -0
  11. codegraph/bridges.py +1701 -0
  12. codegraph/cli.py +725 -0
  13. codegraph/concepts.py +362 -0
  14. codegraph/config.py +559 -0
  15. codegraph/core/__init__.py +0 -0
  16. codegraph/core/cache.py +375 -0
  17. codegraph/core/detect.py +80 -0
  18. codegraph/core/extractors.py +187 -0
  19. codegraph/core/fsutil.py +61 -0
  20. codegraph/core/generated.py +575 -0
  21. codegraph/core/model.py +174 -0
  22. codegraph/core/paths.py +175 -0
  23. codegraph/core/plugin.py +160 -0
  24. codegraph/core/store.py +80 -0
  25. codegraph/core/syntax_errors.py +132 -0
  26. codegraph/coverage.py +928 -0
  27. codegraph/doctor.py +453 -0
  28. codegraph/external.py +613 -0
  29. codegraph/indexer.py +336 -0
  30. codegraph/link.py +434 -0
  31. codegraph/lint_async.py +524 -0
  32. codegraph/mcp_server.py +1303 -0
  33. codegraph/parity.py +473 -0
  34. codegraph/parity_structure.py +307 -0
  35. codegraph/payload.py +321 -0
  36. codegraph/plans.py +1285 -0
  37. codegraph/platform_scan.py +643 -0
  38. codegraph/platforms.py +1369 -0
  39. codegraph/plugins/__init__.py +0 -0
  40. codegraph/plugins/cfamily/__init__.py +0 -0
  41. codegraph/plugins/cfamily/plugin.py +930 -0
  42. codegraph/plugins/cfamily/syntax.py +881 -0
  43. codegraph/plugins/dart/__init__.py +0 -0
  44. codegraph/plugins/dart/bridges.py +345 -0
  45. codegraph/plugins/dart/extractor/bin/extract.dart +717 -0
  46. codegraph/plugins/dart/extractor/pubspec.lock +149 -0
  47. codegraph/plugins/dart/extractor/pubspec.yaml +7 -0
  48. codegraph/plugins/dart/http.py +904 -0
  49. codegraph/plugins/dart/models.py +308 -0
  50. codegraph/plugins/dart/plugin.py +625 -0
  51. codegraph/plugins/dart/program.py +907 -0
  52. codegraph/plugins/django/__init__.py +0 -0
  53. codegraph/plugins/django/extras.py +378 -0
  54. codegraph/plugins/django/models.py +508 -0
  55. codegraph/plugins/django/plugin.py +728 -0
  56. codegraph/plugins/django/schemas.py +339 -0
  57. codegraph/plugins/django/shapes.py +216 -0
  58. codegraph/plugins/django/urls.py +603 -0
  59. codegraph/plugins/express/__init__.py +0 -0
  60. codegraph/plugins/express/plugin.py +428 -0
  61. codegraph/plugins/flutter/__init__.py +0 -0
  62. codegraph/plugins/flutter/plugin.py +538 -0
  63. codegraph/plugins/kotlin/__init__.py +0 -0
  64. codegraph/plugins/kotlin/exact.py +457 -0
  65. codegraph/plugins/kotlin/plugin.py +1961 -0
  66. codegraph/plugins/kotlin/reparse.py +234 -0
  67. codegraph/plugins/laravel/__init__.py +0 -0
  68. codegraph/plugins/laravel/broadcast.py +351 -0
  69. codegraph/plugins/laravel/plugin.py +863 -0
  70. codegraph/plugins/laravel/tests.py +262 -0
  71. codegraph/plugins/laravel/values.py +728 -0
  72. codegraph/plugins/native/__init__.py +0 -0
  73. codegraph/plugins/native/gates.py +286 -0
  74. codegraph/plugins/native/runner.py +183 -0
  75. codegraph/plugins/native/scipread.py +194 -0
  76. codegraph/plugins/native/ts.py +54 -0
  77. codegraph/plugins/nest/__init__.py +0 -0
  78. codegraph/plugins/nest/plugin.py +654 -0
  79. codegraph/plugins/nextjs/__init__.py +0 -0
  80. codegraph/plugins/nextjs/plugin.py +336 -0
  81. codegraph/plugins/nuxt/__init__.py +0 -0
  82. codegraph/plugins/nuxt/plugin.py +308 -0
  83. codegraph/plugins/php/__init__.py +0 -0
  84. codegraph/plugins/php/extractor/composer.json +5 -0
  85. codegraph/plugins/php/extractor/composer.lock +76 -0
  86. codegraph/plugins/php/extractor/extract.php +743 -0
  87. codegraph/plugins/php/gating.py +573 -0
  88. codegraph/plugins/php/plugin.py +668 -0
  89. codegraph/plugins/php/strings.py +197 -0
  90. codegraph/plugins/python/__init__.py +0 -0
  91. codegraph/plugins/python/aitools.py +664 -0
  92. codegraph/plugins/python/external.py +245 -0
  93. codegraph/plugins/python/fields.py +107 -0
  94. codegraph/plugins/python/plugin.py +1733 -0
  95. codegraph/plugins/python/refs.py +485 -0
  96. codegraph/plugins/python/roots.py +412 -0
  97. codegraph/plugins/python/socketio.py +210 -0
  98. codegraph/plugins/python/subproc.py +864 -0
  99. codegraph/plugins/python/tests.py +1040 -0
  100. codegraph/plugins/python/values.py +179 -0
  101. codegraph/plugins/pyweb/__init__.py +0 -0
  102. codegraph/plugins/pyweb/plugin.py +1334 -0
  103. codegraph/plugins/pyweb/values.py +68 -0
  104. codegraph/plugins/rust/__init__.py +0 -0
  105. codegraph/plugins/rust/cargo.py +226 -0
  106. codegraph/plugins/rust/plugin.py +980 -0
  107. codegraph/plugins/rust/syntax.py +678 -0
  108. codegraph/plugins/scip/__init__.py +0 -0
  109. codegraph/plugins/scip/importer.py +129 -0
  110. codegraph/plugins/scip/scip.proto +962 -0
  111. codegraph/plugins/scip/scip_pb2.py +97 -0
  112. codegraph/plugins/stubs/__init__.py +0 -0
  113. codegraph/plugins/stubs/plugins.py +38 -0
  114. codegraph/plugins/swift/__init__.py +0 -0
  115. codegraph/plugins/swift/baseurl.py +109 -0
  116. codegraph/plugins/swift/exact.py +415 -0
  117. codegraph/plugins/swift/indexstore.py +209 -0
  118. codegraph/plugins/swift/packages.py +174 -0
  119. codegraph/plugins/swift/plugin.py +2890 -0
  120. codegraph/plugins/ts/__init__.py +0 -0
  121. codegraph/plugins/ts/baseurl.py +185 -0
  122. codegraph/plugins/ts/extractor/extract.mjs +2652 -0
  123. codegraph/plugins/ts/extractor/fw.mjs +685 -0
  124. codegraph/plugins/ts/extractor/package-lock.json +205 -0
  125. codegraph/plugins/ts/extractor/package.json +9 -0
  126. codegraph/plugins/ts/plugin.py +480 -0
  127. codegraph/plugins/tsweb/__init__.py +0 -0
  128. codegraph/plugins/tsweb/common.py +290 -0
  129. codegraph/plugins/tsweb/data.py +276 -0
  130. codegraph/presets/__init__.py +146 -0
  131. codegraph/presets/c_cpp.yaml +9 -0
  132. codegraph/presets/common.yaml +66 -0
  133. codegraph/presets/dart.yaml +9 -0
  134. codegraph/presets/django-ninja.yaml +15 -0
  135. codegraph/presets/django.yaml +25 -0
  136. codegraph/presets/djangorestframework.yaml +17 -0
  137. codegraph/presets/express.yaml +17 -0
  138. codegraph/presets/kotlin.yaml +11 -0
  139. codegraph/presets/laravel.yaml +40 -0
  140. codegraph/presets/nest.yaml +11 -0
  141. codegraph/presets/nextjs.yaml +15 -0
  142. codegraph/presets/nuxt.yaml +9 -0
  143. codegraph/presets/php.yaml +5 -0
  144. codegraph/presets/python.yaml +10 -0
  145. codegraph/presets/rust.yaml +5 -0
  146. codegraph/presets/swift.yaml +10 -0
  147. codegraph/presets/typescript.yaml +13 -0
  148. codegraph/process_runs.py +328 -0
  149. codegraph/protocols/__init__.py +299 -0
  150. codegraph/protocols/builtin.py +67 -0
  151. codegraph/protocols/matchers.py +144 -0
  152. codegraph/protocols/view.py +334 -0
  153. codegraph/query.py +2089 -0
  154. codegraph/realtime.py +260 -0
  155. codegraph/roundtrip.py +346 -0
  156. codegraph/routes.py +442 -0
  157. codegraph/starters.py +218 -0
  158. codegraph/tests_index.py +117 -0
  159. codegraph/viz/__init__.py +0 -0
  160. codegraph/viz/graph.py +369 -0
  161. codegraph/viz/server.py +198 -0
  162. codegraph/viz/static/app.css +148 -0
  163. codegraph/viz/static/app.js +1082 -0
  164. codegraph/viz/static/index.html +81 -0
  165. codegraph/viz/static/layered.js +237 -0
  166. codegraph/viz/static/vendor/VERSIONS.txt +4 -0
  167. codegraph/viz/static/vendor/cose-base.js +3214 -0
  168. codegraph/viz/static/vendor/cytoscape-fcose.js +1549 -0
  169. codegraph/viz/static/vendor/cytoscape.min.js +31 -0
  170. codegraph/viz/static/vendor/layout-base.js +5230 -0
  171. codegraph/viz/tools/package-lock.json +303 -0
  172. codegraph/viz/tools/package.json +7 -0
  173. codegraph/viz/tools/shoot.mjs +165 -0
  174. codegraph/xcode.py +251 -0
@@ -0,0 +1,303 @@
1
+ {
2
+ "name": "codegraph-viz-tools",
3
+ "lockfileVersion": 3,
4
+ "requires": true,
5
+ "packages": {
6
+ "": {
7
+ "name": "codegraph-viz-tools",
8
+ "dependencies": {
9
+ "puppeteer-core": "25.12.0"
10
+ }
11
+ },
12
+ "node_modules/@puppeteer/browsers": {
13
+ "version": "3.2.3",
14
+ "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-3.2.3.tgz",
15
+ "integrity": "sha512-2Bt3m6dDAJqmZehn0wiXSYyQmuhyiHHZ7FjvrVaS1W2RoFGV6eCK71UvKYkNJjkwC1Q9nobjhvTMhLQztFVINA==",
16
+ "dependencies": {
17
+ "modern-tar": "^0.8.4",
18
+ "yargs": "^18.0.0"
19
+ },
20
+ "bin": {
21
+ "browsers": "lib/main-cli.js"
22
+ },
23
+ "engines": {
24
+ "node": ">=22.12.0"
25
+ },
26
+ "peerDependencies": {
27
+ "proxy-agent": ">=8.0.1",
28
+ "yauzl": "^2.10.0 || ^3.4.0"
29
+ },
30
+ "peerDependenciesMeta": {
31
+ "proxy-agent": {
32
+ "optional": true
33
+ },
34
+ "yauzl": {
35
+ "optional": true
36
+ }
37
+ }
38
+ },
39
+ "node_modules/ansi-regex": {
40
+ "version": "6.4.0",
41
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.4.0.tgz",
42
+ "integrity": "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==",
43
+ "engines": {
44
+ "node": ">=12"
45
+ },
46
+ "funding": {
47
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
48
+ }
49
+ },
50
+ "node_modules/ansi-styles": {
51
+ "version": "6.2.3",
52
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
53
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
54
+ "engines": {
55
+ "node": ">=12"
56
+ },
57
+ "funding": {
58
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
59
+ }
60
+ },
61
+ "node_modules/chromium-bidi": {
62
+ "version": "17.0.2",
63
+ "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-17.0.2.tgz",
64
+ "integrity": "sha512-5v9GQFhTktFvotn/OFNJBmKLKRAb6n9r0bVCwf7sHgWc3/JryK0bj1nn93L3pHFrfgcsu6Be6EWsDi+1XHTGDg==",
65
+ "dependencies": {
66
+ "mitt": "^3.0.1",
67
+ "zod": "^3.24.1"
68
+ },
69
+ "engines": {
70
+ "node": ">=20.19.0 <22.0.0 || >=22.12.0"
71
+ },
72
+ "peerDependencies": {
73
+ "devtools-protocol": "*"
74
+ }
75
+ },
76
+ "node_modules/cliui": {
77
+ "version": "9.0.1",
78
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz",
79
+ "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==",
80
+ "dependencies": {
81
+ "string-width": "^7.2.0",
82
+ "strip-ansi": "^7.1.0",
83
+ "wrap-ansi": "^9.0.0"
84
+ },
85
+ "engines": {
86
+ "node": ">=20"
87
+ }
88
+ },
89
+ "node_modules/cliui/node_modules/string-width": {
90
+ "version": "7.2.0",
91
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
92
+ "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
93
+ "dependencies": {
94
+ "emoji-regex": "^10.3.0",
95
+ "get-east-asian-width": "^1.0.0",
96
+ "strip-ansi": "^7.1.0"
97
+ },
98
+ "engines": {
99
+ "node": ">=18"
100
+ },
101
+ "funding": {
102
+ "url": "https://github.com/sponsors/sindresorhus"
103
+ }
104
+ },
105
+ "node_modules/devtools-protocol": {
106
+ "version": "0.0.1687809",
107
+ "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1687809.tgz",
108
+ "integrity": "sha512-t7kSb+UKYdyxcmqy98U2P86ne6rCve3DIJ4+lp54i/hhClgFuG35JrLj23rO14Jw3sWDsp7i+22QhNU0+/qk8g=="
109
+ },
110
+ "node_modules/emoji-regex": {
111
+ "version": "10.6.0",
112
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
113
+ "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="
114
+ },
115
+ "node_modules/escalade": {
116
+ "version": "3.2.0",
117
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
118
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
119
+ "engines": {
120
+ "node": ">=6"
121
+ }
122
+ },
123
+ "node_modules/get-caller-file": {
124
+ "version": "2.0.5",
125
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
126
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
127
+ "engines": {
128
+ "node": "6.* || 8.* || >= 10.*"
129
+ }
130
+ },
131
+ "node_modules/get-east-asian-width": {
132
+ "version": "1.7.0",
133
+ "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.7.0.tgz",
134
+ "integrity": "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==",
135
+ "engines": {
136
+ "node": ">=18"
137
+ },
138
+ "funding": {
139
+ "url": "https://github.com/sponsors/sindresorhus"
140
+ }
141
+ },
142
+ "node_modules/mitt": {
143
+ "version": "3.0.1",
144
+ "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
145
+ "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw=="
146
+ },
147
+ "node_modules/modern-tar": {
148
+ "version": "0.8.5",
149
+ "resolved": "https://registry.npmjs.org/modern-tar/-/modern-tar-0.8.5.tgz",
150
+ "integrity": "sha512-snEhs+6G5Tjd4I7tLCDOaoln2RgE0bD19RzEKgvgK2hZ5VKy3MpLhLTZ2fWpXSTg4K2cyPwp+VHATFJhxfnOeA==",
151
+ "engines": {
152
+ "node": ">=18.0.0"
153
+ }
154
+ },
155
+ "node_modules/puppeteer-core": {
156
+ "version": "25.12.0",
157
+ "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-25.12.0.tgz",
158
+ "integrity": "sha512-z6LQUt5SH7jwGtGA+nMtJuEjZIsqPiwQ+EFHCYuVDQrJpvifNmmGuyDvTzAKPyFzihxgHc5f3aMzu2kn8Ps37A==",
159
+ "dependencies": {
160
+ "@puppeteer/browsers": "3.2.3",
161
+ "chromium-bidi": "17.0.2",
162
+ "devtools-protocol": "0.0.1687809",
163
+ "typed-query-selector": "^2.12.2",
164
+ "webdriver-bidi-protocol": "0.4.3",
165
+ "ws": "^8.21.3"
166
+ },
167
+ "engines": {
168
+ "node": ">=22.12.0"
169
+ }
170
+ },
171
+ "node_modules/string-width": {
172
+ "version": "8.3.0",
173
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.3.0.tgz",
174
+ "integrity": "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ==",
175
+ "dependencies": {
176
+ "get-east-asian-width": "^1.5.0",
177
+ "strip-ansi": "^7.1.2"
178
+ },
179
+ "engines": {
180
+ "node": ">=20"
181
+ },
182
+ "funding": {
183
+ "url": "https://github.com/sponsors/sindresorhus"
184
+ }
185
+ },
186
+ "node_modules/strip-ansi": {
187
+ "version": "7.2.0",
188
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
189
+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
190
+ "dependencies": {
191
+ "ansi-regex": "^6.2.2"
192
+ },
193
+ "engines": {
194
+ "node": ">=12"
195
+ },
196
+ "funding": {
197
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
198
+ }
199
+ },
200
+ "node_modules/typed-query-selector": {
201
+ "version": "2.12.3",
202
+ "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.3.tgz",
203
+ "integrity": "sha512-/dtuMZyutHLlrxWhhC1uib00ELUr2dZ8C9B8YzZYsJmeE3V56OxRblrSM2UaF142pcMtak7ehZ6+poWGeehNIg=="
204
+ },
205
+ "node_modules/webdriver-bidi-protocol": {
206
+ "version": "0.4.3",
207
+ "resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.3.tgz",
208
+ "integrity": "sha512-uuN0goWfxP22B7J/uAgBpOYNPttC+XVseYE+rSY5+rQ+YBeVz/VORw8WbmLVcqW78zNg5A4qnjNXYUWR3il2ig=="
209
+ },
210
+ "node_modules/wrap-ansi": {
211
+ "version": "9.0.2",
212
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
213
+ "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
214
+ "dependencies": {
215
+ "ansi-styles": "^6.2.1",
216
+ "string-width": "^7.0.0",
217
+ "strip-ansi": "^7.1.0"
218
+ },
219
+ "engines": {
220
+ "node": ">=18"
221
+ },
222
+ "funding": {
223
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
224
+ }
225
+ },
226
+ "node_modules/wrap-ansi/node_modules/string-width": {
227
+ "version": "7.2.0",
228
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
229
+ "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
230
+ "dependencies": {
231
+ "emoji-regex": "^10.3.0",
232
+ "get-east-asian-width": "^1.0.0",
233
+ "strip-ansi": "^7.1.0"
234
+ },
235
+ "engines": {
236
+ "node": ">=18"
237
+ },
238
+ "funding": {
239
+ "url": "https://github.com/sponsors/sindresorhus"
240
+ }
241
+ },
242
+ "node_modules/ws": {
243
+ "version": "8.22.0",
244
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz",
245
+ "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==",
246
+ "engines": {
247
+ "node": ">=10.0.0"
248
+ },
249
+ "peerDependencies": {
250
+ "bufferutil": "^4.0.1",
251
+ "utf-8-validate": ">=5.0.2"
252
+ },
253
+ "peerDependenciesMeta": {
254
+ "bufferutil": {
255
+ "optional": true
256
+ },
257
+ "utf-8-validate": {
258
+ "optional": true
259
+ }
260
+ }
261
+ },
262
+ "node_modules/y18n": {
263
+ "version": "5.0.8",
264
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
265
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
266
+ "engines": {
267
+ "node": ">=10"
268
+ }
269
+ },
270
+ "node_modules/yargs": {
271
+ "version": "18.2.0",
272
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.2.0.tgz",
273
+ "integrity": "sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w==",
274
+ "dependencies": {
275
+ "cliui": "^9.0.1",
276
+ "escalade": "^3.1.1",
277
+ "get-caller-file": "^2.0.5",
278
+ "string-width": "^8.2.1",
279
+ "y18n": "^5.0.5",
280
+ "yargs-parser": "^22.0.0"
281
+ },
282
+ "engines": {
283
+ "node": "^20.19.0 || ^22.12.0 || >=23"
284
+ }
285
+ },
286
+ "node_modules/yargs-parser": {
287
+ "version": "22.0.0",
288
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz",
289
+ "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==",
290
+ "engines": {
291
+ "node": "^20.19.0 || ^22.12.0 || >=23"
292
+ }
293
+ },
294
+ "node_modules/zod": {
295
+ "version": "3.25.76",
296
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
297
+ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
298
+ "funding": {
299
+ "url": "https://github.com/sponsors/colinhacks"
300
+ }
301
+ }
302
+ }
303
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "codegraph-viz-tools",
3
+ "private": true,
4
+ "description": "Headless screenshots of the code-graph view (uses the system Chrome; no browser download).",
5
+ "type": "module",
6
+ "dependencies": { "puppeteer-core": "25.12.0" }
7
+ }
@@ -0,0 +1,165 @@
1
+ // Headless screenshots + layout checks of the code-graph view (issue #82 test plan).
2
+ // Usage: node shoot.mjs <base-url> <out-dir> (the view must be served: codegraph.cli serve --db … --port …)
3
+ // Environment:
4
+ // CHROME browser binary (default /usr/bin/google-chrome)
5
+ // WIDTHS viewport widths, comma-separated (default 1280,1920; heights 1024→768, 1280→800, 1440→900, 1920→1080)
6
+ // DPR deviceScaleFactor (default 2)
7
+ // SHOTS JSON file with [{file, hash | url, maxTop?, actions?}] instead of the bundled sample-app list
8
+ // PRESETS 1 = also shoot every query from /api/presets (starter presets of the served graph)
9
+ // ONLY substring filter on the file name
10
+ // NO_ASSERT 1 = report failures but exit 0
11
+ // THEME light | dark: emulate prefers-color-scheme (default: the browser's)
12
+ // BUDGET_FIRST first-graph budget in ms (default 1500; tReady includes the API call)
13
+ // Shots: "landing" (hash ''), a hash on <base-url>, or an absolute url (e.g. file:///…/export.html from viz-export).
14
+ // actions: [{expandFirstCluster: true}, {tap: '<node id>'}, {key: 'Escape'}, {wait: ms}].
15
+ // Assertions per shot and width: no console error / warning / page error / HTTP >= 400; header.scrollWidth <=
16
+ // clientWidth with no clipped or wrapped control and height <= 56 px; every drawn label >= 11 px (font-size x zoom);
17
+ // <= 5 % of visible node label boxes overlap; no compound box around one node; top-level items <= maxTop.
18
+ // Writes <out-dir>/metrics.json and exits 1 when an assertion fails.
19
+ import puppeteer from 'puppeteer-core'
20
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
21
+
22
+ const base = (process.argv[2] || 'http://127.0.0.1:8177/').replace(/#.*$/, '')
23
+ const out = process.argv[3] || 'screenshots'
24
+ mkdirSync(out, { recursive: true })
25
+ const enc = (s) => encodeURIComponent(s)
26
+ const HEIGHT = { 1024: 768, 1280: 800, 1440: 900, 1920: 1080 }
27
+ const WIDTHS = (process.env.WIDTHS || '1280,1920').split(',').map(Number)
28
+ const DPR = Number(process.env.DPR || 2)
29
+ const MIN_PX = 11; const MAX_OVERLAP = 5; const MAX_HEADER = 56
30
+ // Default shots match the bundled sample apps (examples/); pass SHOTS=path/to/shots.json for your project.
31
+ const DEFAULT_SHOTS = [
32
+ { file: 'sample_landing.png', hash: '' },
33
+ { file: 'sample_reaches_warehouse.png', hash: `mode=reaches&spec=${enc('connection:warehouse')}&spec=${enc('table:warehouse_stock')}&select=${enc('connection:warehouse')}&hl=0` },
34
+ { file: 'sample_report_page_downstream_tables.png', hash: `mode=downstream&spec=${enc('page:/reports/:id')}&sinks=${enc('table,column')}&select=${enc('page:app/pages/reports/[id].vue')}&hl=0` },
35
+ { file: 'sample_report_page_path_orders.png', hash: `mode=path&spec=${enc('page:/reports/:id')}&spec=${enc('ReportController::top')}&spec=${enc('table:orders')}` +
36
+ `&select=${enc('method:App\\Services\\SalesReportService::build')}` },
37
+ { file: 'sample_plan_preorders_overview.png', hash: 'mode=plan&spec=preorders' },
38
+ { file: 'sample_timezone_request_key_reaches.png', hash: `mode=reaches&spec=${enc('request_key:timezone')}` }
39
+ ]
40
+ let SHOTS = process.env.SHOTS ? JSON.parse(readFileSync(process.env.SHOTS, 'utf8')) : DEFAULT_SHOTS
41
+ if (process.env.PRESETS === '1') {
42
+ const presets = await (await fetch(new URL('api/presets', base))).json()
43
+ SHOTS = SHOTS.concat(presets.map((p) => ({
44
+ file: `preset_${p.id}.png`,
45
+ hash: `mode=${p.mode}` + p.specs.map((s) => `&spec=${enc(s)}`).join('') + (p.sinks ? `&sinks=${enc(p.sinks.join(','))}` : '')
46
+ })))
47
+ }
48
+ const only = process.env.ONLY
49
+
50
+ async function measure (page) {
51
+ return page.evaluate((MIN_PX) => {
52
+ const hd = document.querySelector('header')
53
+ const r = { ready: document.body.dataset.ready, header: { scroll: hd.scrollWidth, client: hd.clientWidth, height: hd.offsetHeight } }
54
+ const vis = [...hd.querySelectorAll('select,button,input,a')].filter((c) => c.offsetParent && getComputedStyle(c).visibility !== 'hidden')
55
+ r.clipped = vis.filter((c) => c.getBoundingClientRect().right > hd.clientWidth + 1).map((c) => c.id || c.textContent.trim())
56
+ r.wrapped = vis.filter((c) => c.tagName !== 'INPUT' && c.tagName !== 'SELECT' && c.getBoundingClientRect().height > 34).map((c) => c.id || c.textContent.trim())
57
+ const land = document.getElementById('landing')
58
+ if (land && !land.hidden) {
59
+ r.landing = { stats: land.querySelectorAll('.stat').length, cards: land.querySelectorAll('.card').length }
60
+ return r
61
+ }
62
+ const c = window.__cgCy
63
+ if (!c) return r
64
+ const z = c.zoom(); const ext = c.extent()
65
+ const inView = (bb) => bb.x2 > ext.x1 && bb.x1 < ext.x2 && bb.y2 > ext.y1 && bb.y1 < ext.y2
66
+ let minPx = Infinity; let drawn = 0; let hidden = 0; const boxes = []
67
+ c.elements().forEach((e) => {
68
+ if (!e.visible() || !e.style('label')) return
69
+ const px = parseFloat(e.style('font-size')) * z
70
+ if (px < (parseFloat(e.style('min-zoomed-font-size')) || 0)) { hidden++; return }
71
+ const bb = e.boundingBox({ includeNodes: false, includeEdges: false, includeLabels: true, includeOverlays: false })
72
+ if (!bb.w || !inView(bb)) return
73
+ drawn++; minPx = Math.min(minPx, px)
74
+ if (e.isNode()) boxes.push(bb)
75
+ })
76
+ let ov = 0
77
+ boxes.forEach((a, i) => { if (boxes.some((b, j) => i !== j && a.x1 < b.x2 && b.x1 < a.x2 && a.y1 < b.y2 && b.y1 < a.y2)) ov++ })
78
+ const ltr = c.edges().filter((e) => e.source().position().x < e.target().position().x).length
79
+ Object.assign(r, {
80
+ zoom: +z.toFixed(3),
81
+ labels: { drawn, hidden, minPx: drawn ? +minPx.toFixed(1) : null, overlapPct: boxes.length ? +(100 * ov / boxes.length).toFixed(1) : 0 },
82
+ top: c.nodes().filter((n) => !n.isChild() && !n.hasClass('lane')).length,
83
+ single: c.nodes(':parent').filter((p) => p.children().length === 1).length,
84
+ clusters: c.nodes('.cluster').length,
85
+ edges: c.edges().length,
86
+ ltrPct: c.edges().length ? +(100 * ltr / c.edges().length).toFixed(1) : null,
87
+ targetsVisible: c.nodes('.target, .entry').filter((n) => inView(n.boundingBox())).length + '/' + c.nodes('.target, .entry').length,
88
+ offscreen: c.nodes().not(':parent').filter((n) => { const b = n.boundingBox({ includeLabels: false }); return b.x1 < ext.x1 - 1 || b.x2 > ext.x2 + 1 || b.y1 < ext.y1 - 1 || b.y2 > ext.y2 + 1 }).length,
89
+ fitAll: document.getElementById('fitall').hidden ? null : document.getElementById('fitall').textContent,
90
+ status: document.getElementById('status').innerText.slice(0, 160)
91
+ })
92
+ return r
93
+ }, MIN_PX)
94
+ }
95
+
96
+ // performance budgets (#82 item 15): first graph <= 1.5 s for <= 300 nodes, layout <= 1.5 s, <= 400 rendered elements
97
+ const BUDGET = { firstGraphMs: Number(process.env.BUDGET_FIRST || 1500), layoutMs: 1500, rendered: 400 }
98
+ function check (m, s) {
99
+ const f = []
100
+ if (m.perf && m.perf.nodes && m.perf.nodes <= 300 && m.tReady > BUDGET.firstGraphMs) f.push(`first graph ${m.tReady} ms > ${BUDGET.firstGraphMs}`)
101
+ if (m.perf && m.perf.layoutMs > BUDGET.layoutMs) f.push(`layout ${m.perf.layoutMs} ms > ${BUDGET.layoutMs}`)
102
+ if (m.perf && m.perf.rendered > BUDGET.rendered) f.push(`rendered elements ${m.perf.rendered} > ${BUDGET.rendered}`)
103
+ if (m.offscreen) f.push(`${m.offscreen} nodes outside the canvas on first load (fit must include every node)`)
104
+ if (m.logs.length) f.push(`console: ${m.logs.length} (${m.logs[0]})`)
105
+ if (!['1', 'landing'].includes(m.ready)) f.push(`view reported ${m.ready}`)
106
+ if (m.header.scroll > m.header.client) f.push(`header overflow ${m.header.scroll} > ${m.header.client}`)
107
+ if (m.clipped.length) f.push('clipped: ' + m.clipped.join(', '))
108
+ if (m.wrapped.length) f.push('wrapped: ' + m.wrapped.join(', '))
109
+ if (m.width >= 1280 && m.header.height > MAX_HEADER) f.push(`header height ${m.header.height}`)
110
+ if (m.labels) {
111
+ if (m.labels.minPx !== null && m.labels.minPx < MIN_PX) f.push(`label ${m.labels.minPx} px < ${MIN_PX}`)
112
+ if (m.labels.overlapPct > MAX_OVERLAP) f.push(`label overlap ${m.labels.overlapPct} % > ${MAX_OVERLAP}`)
113
+ if (m.single) f.push(`${m.single} single-node compound(s)`)
114
+ if (s.maxTop && m.top > s.maxTop) f.push(`top-level items ${m.top} > ${s.maxTop}`)
115
+ }
116
+ return f
117
+ }
118
+
119
+ const browser = await puppeteer.launch({ executablePath: process.env.CHROME || '/usr/bin/google-chrome', headless: true,
120
+ args: ['--no-sandbox', '--disable-gpu'] })
121
+ const results = []
122
+ try {
123
+ for (const s of SHOTS) {
124
+ if (only && !s.file.includes(only)) continue
125
+ for (const w of WIDTHS) {
126
+ const page = await browser.newPage()
127
+ const logs = []
128
+ page.on('console', (m) => { if (['error', 'warn', 'warning'].includes(m.type())) logs.push(`console.${m.type()}: ${m.text()}`) })
129
+ page.on('pageerror', (e) => logs.push('pageerror: ' + e.message))
130
+ page.on('response', (r) => { if (r.status() >= 400) logs.push(`http ${r.status()}: ${r.url()}`) })
131
+ await page.setViewport({ width: w, height: HEIGHT[w] || Math.round(w * 0.5625), deviceScaleFactor: DPR })
132
+ if (process.env.THEME) await page.emulateMediaFeatures([{ name: 'prefers-color-scheme', value: process.env.THEME }])
133
+ // long tasks (main thread blocked > 50 ms) from the first byte on (#82 item 15)
134
+ await page.evaluateOnNewDocument(() => {
135
+ window.__cgLong = []
136
+ try { new PerformanceObserver((l) => { for (const e of l.getEntries()) window.__cgLong.push(e.duration) }).observe({ type: 'longtask', buffered: true }) } catch (e) { /* unsupported */ }
137
+ })
138
+ const t0 = Date.now()
139
+ await page.goto(s.url || (base + (s.hash ? '#' + s.hash : '')), { waitUntil: 'networkidle0' })
140
+ await page.waitForFunction(() => ['1', 'error', 'empty', 'landing'].includes(document.body.dataset.ready), { timeout: 60000 })
141
+ const tReady = Date.now() - t0
142
+ for (const a of s.actions || []) {
143
+ if (a.expandFirstCluster) await page.evaluate(() => { const n = window.__cgCy.nodes('.cluster').not('.open')[0]; if (n) n.emit('tap') })
144
+ if (a.tap) await page.evaluate((id) => window.__cgCy.getElementById(id).emit('tap'), a.tap)
145
+ if (a.key) await page.keyboard.press(a.key)
146
+ if (a.wait) await new Promise((r) => setTimeout(r, a.wait))
147
+ }
148
+ await new Promise((r) => setTimeout(r, 1000)) // last render + panel fetch
149
+ const file = `${out}/${s.file.replace(/\.png$/, '')}_${w}.png`
150
+ await page.screenshot({ path: file })
151
+ const perf = await page.evaluate(() => ({ layoutMs: Math.round(window.__cgLayoutMs || 0), maxLongTaskMs: Math.round(Math.max(0, ...(window.__cgLong || []))),
152
+ rendered: window.__cgCy ? window.__cgCy.elements(':visible').length : 0, nodes: window.__cgCy ? window.__cgCy.nodes().length : 0 }))
153
+ const m = { file, width: w, tReady, perf, ...(await measure(page)), logs }
154
+ m.failures = check(m, s)
155
+ results.push(m)
156
+ console.log(`${m.failures.length ? 'FAIL' : 'ok '} ${file}` + (m.perf && m.perf.nodes ? ` ready ${m.tReady} ms layout ${m.perf.layoutMs} ms longtask ${m.perf.maxLongTaskMs} ms els ${m.perf.rendered}` : '') + (m.labels ? ` zoom ${m.zoom} label>=${m.labels.minPx}px overlap ${m.labels.overlapPct}% top ${m.top} ltr ${m.ltrPct}%` : m.landing ? ` landing stats ${m.landing.stats} cards ${m.landing.cards}` : '') +
157
+ (m.failures.length ? '\n ' + m.failures.join('\n ') : ''))
158
+ await page.close()
159
+ }
160
+ }
161
+ } finally { await browser.close() }
162
+ writeFileSync(`${out}/metrics.json`, JSON.stringify(results, null, 1))
163
+ const failed = results.filter((r) => r.failures.length).length
164
+ console.log(`${results.length} shots, ${failed} failed; metrics in ${out}/metrics.json`)
165
+ if (failed && process.env.NO_ASSERT !== '1') process.exit(1)