codemap-python 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 (58) hide show
  1. analysis/__init__.py +1 -0
  2. analysis/architecture/__init__.py +1 -0
  3. analysis/architecture/architecture_engine.py +155 -0
  4. analysis/architecture/dependency_cycles.py +103 -0
  5. analysis/architecture/risk_radar.py +220 -0
  6. analysis/call_graph/__init__.py +1 -0
  7. analysis/call_graph/call_extractor.py +91 -0
  8. analysis/call_graph/call_graph_builder.py +1 -0
  9. analysis/call_graph/call_resolver.py +56 -0
  10. analysis/call_graph/context_models.py +1 -0
  11. analysis/call_graph/cross_file_resolver.py +122 -0
  12. analysis/call_graph/execution_tracker.py +1 -0
  13. analysis/call_graph/flow_builder.py +1 -0
  14. analysis/call_graph/models.py +1 -0
  15. analysis/core/__init__.py +1 -0
  16. analysis/core/ast_context.py +1 -0
  17. analysis/core/ast_parser.py +8 -0
  18. analysis/core/class_extractor.py +35 -0
  19. analysis/core/function_extractor.py +16 -0
  20. analysis/core/import_extractor.py +43 -0
  21. analysis/explain/__init__.py +1 -0
  22. analysis/explain/docstring_extractor.py +45 -0
  23. analysis/explain/explain_runner.py +177 -0
  24. analysis/explain/repo_summary_generator.py +138 -0
  25. analysis/explain/return_analyzer.py +114 -0
  26. analysis/explain/risk_flags.py +1 -0
  27. analysis/explain/signature_extractor.py +104 -0
  28. analysis/explain/summary_generator.py +282 -0
  29. analysis/graph/__init__.py +1 -0
  30. analysis/graph/callgraph_index.py +117 -0
  31. analysis/graph/entrypoint_detector.py +1 -0
  32. analysis/graph/impact_analyzer.py +210 -0
  33. analysis/indexing/__init__.py +1 -0
  34. analysis/indexing/import_resolver.py +156 -0
  35. analysis/indexing/symbol_index.py +150 -0
  36. analysis/runners/__init__.py +1 -0
  37. analysis/runners/phase4_runner.py +137 -0
  38. analysis/utils/__init__.py +1 -0
  39. analysis/utils/ast_helpers.py +1 -0
  40. analysis/utils/cache_manager.py +659 -0
  41. analysis/utils/path_resolver.py +1 -0
  42. analysis/utils/repo_fetcher.py +469 -0
  43. cli.py +1728 -0
  44. codemap_cli.py +11 -0
  45. codemap_python-0.1.0.dist-info/METADATA +399 -0
  46. codemap_python-0.1.0.dist-info/RECORD +58 -0
  47. codemap_python-0.1.0.dist-info/WHEEL +5 -0
  48. codemap_python-0.1.0.dist-info/entry_points.txt +2 -0
  49. codemap_python-0.1.0.dist-info/top_level.txt +5 -0
  50. security_utils.py +51 -0
  51. ui/__init__.py +1 -0
  52. ui/app.py +2160 -0
  53. ui/device_id.py +27 -0
  54. ui/static/app.js +2703 -0
  55. ui/static/styles.css +1268 -0
  56. ui/templates/index.html +231 -0
  57. ui/utils/__init__.py +1 -0
  58. ui/utils/registry_manager.py +190 -0
codemap_cli.py ADDED
@@ -0,0 +1,11 @@
1
+ from __future__ import annotations
2
+
3
+ from cli import main as _main
4
+
5
+
6
+ def main() -> int:
7
+ return _main()
8
+
9
+
10
+ if __name__ == "__main__":
11
+ raise SystemExit(main())
@@ -0,0 +1,399 @@
1
+ Metadata-Version: 2.4
2
+ Name: codemap-python
3
+ Version: 0.1.0
4
+ Summary: Local Python code analysis tool - understand architecture, dependencies, and call graphs
5
+ Author-email: ADITYA <aditykushwaha69@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ADITYA-kus/codemap_ai
8
+ Project-URL: Repository, https://github.com/ADITYA-kus/codemap_ai.git
9
+ Project-URL: Issues, https://github.com/ADITYA-kus/codemap_ai/issues
10
+ Project-URL: Documentation, https://github.com/ADITYA-kus/codemap_ai#readme
11
+ Keywords: code-analysis,python,architecture,call-graph,cli,dashboard,local,privacy
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: fastapi>=0.110
24
+ Requires-Dist: uvicorn>=0.23
25
+ Requires-Dist: jinja2>=3.1
26
+ Requires-Dist: requests>=2.31
27
+
28
+ # CodeMap
29
+
30
+ **CodeMap** is a pure local developer tool that analyzes Python codebases and provides:
31
+
32
+ - 📊 **Architecture Analysis** - Understand code structure, dependencies, and call graphs
33
+ - 🦺 **Call Graph Extraction** - Trace function/method calls across your codebase
34
+ - ⚠️ **Risk Analysis** - Identify complex code patterns and potential issues
35
+ - 📈 **Symbol Indexing** - Search and explore functions, classes, and methods
36
+ - 🌐 **Local Web Dashboard** - Visual code analysis interface
37
+ - 🔐 **Privacy First** - All analysis runs locally, no data leaves your machine
38
+
39
+ ## Requirements
40
+
41
+ - **Python 3.10+**
42
+ - **pip** (Python package manager)
43
+ - **~5 minutes** to get started
44
+
45
+ ## Quick Start (3 Steps)
46
+
47
+ ### Step 1️⃣: Install CodeMap
48
+
49
+ ```bash
50
+ # Clone the repository
51
+ git clone https://github.com/ADITYA-kus/codemap_ai.git
52
+ cd codemap_ai
53
+
54
+ # Install as a local package
55
+ pip install -e .
56
+ ```
57
+
58
+ **Verify installation:**
59
+ ```bash
60
+ codemap --help
61
+ ```
62
+
63
+ You should see:
64
+ ```
65
+ usage: codemap [-h] {analyze,dashboard,open,cache} ...
66
+ ```
67
+
68
+ ---
69
+
70
+ ### Step 2️⃣: Analyze Your First Repository
71
+
72
+ **IMPORTANT:** The `analyze` command REQUIRES the `--path` argument pointing to a directory!
73
+
74
+ ```bash
75
+ # Analyze the demo repo (takes 5-10 seconds)
76
+ codemap analyze --path demo_repo
77
+ ```
78
+
79
+ **Output: JSON analysis data**
80
+ ```json
81
+ {
82
+ "ok": true,
83
+ "cache_dir": ".codemap_cache/...",
84
+ "analysis_version": "2.2",
85
+ "repo_dir": "demo_repo"
86
+ }
87
+ ```
88
+
89
+ **Analyze your own Python project:**
90
+ ```bash
91
+ codemap analyze --path /path/to/your/python/project
92
+ ```
93
+
94
+ **Analyze a GitHub repository:**
95
+ ```bash
96
+ codemap analyze --github https://github.com/owner/repo
97
+ ```
98
+
99
+ ---
100
+
101
+ ### Step 3️⃣: View in Web Dashboard
102
+
103
+ ```bash
104
+ # Start the web dashboard
105
+ codemap dashboard --port 8000
106
+ ```
107
+
108
+ **Open in browser:**
109
+ ```
110
+ http://127.0.0.1:8000
111
+ ```
112
+
113
+ You'll see:
114
+ - List of analyzed repositories
115
+ - Call graphs
116
+ - Architecture metrics
117
+ - Risk analysis
118
+ - Symbol search
119
+
120
+ ---
121
+
122
+ ## Common Commands
123
+
124
+ ### Analyze Commands
125
+ ```bash
126
+ # ⚠️ REQUIRED: Analyze needs --path argument!
127
+
128
+ # Analyze a local repository
129
+ codemap analyze --path <repo_directory>
130
+
131
+ # Analyze a GitHub repository (public)
132
+ codemap analyze --github https://github.com/owner/repo
133
+
134
+ # Analyze private GitHub repo (requires token)
135
+ codemap analyze --github https://github.com/owner/private-repo --token YOUR_GITHUB_TOKEN
136
+
137
+ # Force rebuild analysis (ignore cache)
138
+ codemap analyze --path <repo_directory> --rebuild
139
+
140
+ # Use API for detailed JSON output
141
+ codemap api analyze --path <repo_directory>
142
+ ```
143
+
144
+ ### Dashboard Commands
145
+ ```bash
146
+ # Start web dashboard (default: localhost:8000)
147
+ codemap dashboard --port 8000
148
+
149
+ # Start dashboard with auto-reload (development)
150
+ codemap dashboard --port 8000 --reload
151
+
152
+ # Open dashboard in browser
153
+ codemap open --port 8000
154
+ ```
155
+
156
+ ### Cache Management
157
+ ```bash
158
+ # List all analyzed repositories
159
+ codemap cache list
160
+
161
+ # Show cache details for a repository
162
+ codemap cache info <repo_hash>
163
+
164
+ # Clear a specific repository's cache
165
+ codemap cache clear <repo_hash>
166
+
167
+ # Show cache retention policy
168
+ codemap cache retention <repo_hash>
169
+
170
+ # Sweep expired caches (auto-cleanup)
171
+ codemap cache sweep
172
+ ```
173
+
174
+ **Get GitHub Token (for private repos):**
175
+ 1. Go to https://github.com/settings/tokens
176
+ 2. Click "Generate new token" → "Generate new token (classic)"
177
+ 3. Give it a name (e.g., "CodeMap")
178
+ 4. Select **`repo`** scope (full control of private repos)
179
+ 5. Copy the token and save it somewhere safe
180
+ 6. Use in commands: `--token ghp_xxxxx`
181
+
182
+ **Or pass token via stdin (more secure):**
183
+ ```bash
184
+ echo "YOUR_TOKEN" | codemap analyze --github https://github.com/owner/repo --token-stdin
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Directory Structure
190
+
191
+ ```
192
+ codemap_ai_clean/
193
+ ├── README.md # This file
194
+ ├── cli.py # Command-line interface
195
+ ├── security_utils.py # Security & secret redaction
196
+ ├── pyproject.toml # Package configuration
197
+ ├── analysis/ # Code analysis engine
198
+ │ ├── core/ # AST parsing, imports
199
+ │ ├── call_graph/ # Call graph building
200
+ │ ├── explain/ # Symbol metadata
201
+ │ ├── architecture/ # Dependency analysis
202
+ │ └── graph/ # Graph indexing
203
+ ├── ui/ # Web dashboard
204
+ │ ├── app.py # FastAPI server
205
+ │ ├── templates/ # HTML templates
206
+ │ └── static/ # CSS, JavaScript
207
+ ├── tests/ # Test suite
208
+ └── demo_repo/ # Example repository
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Features Explained
214
+
215
+ ### 🔍 Symbol Search
216
+ Find all functions, classes, and methods in your codebase:
217
+
218
+ ```bash
219
+ codemap api search --path <repo_path> --query "MyClass"
220
+ codemap api search --path <repo_path> --query "function_name"
221
+ ```
222
+
223
+ ### 📊 Call Graph
224
+ Understand how functions call each other:
225
+
226
+ ```bash
227
+ codemap api explain --path <repo_path> --symbol "module.ClassName.method"
228
+ ```
229
+
230
+ ### ⚠️ Risk Radar
231
+ Detect complex code patterns and potential issues:
232
+
233
+ ```bash
234
+ codemap api risk_radar --path <repo_path>
235
+ ```
236
+
237
+ ### 📈 Impact Analysis
238
+ See which files/functions are affected by changes:
239
+
240
+ ```bash
241
+ codemap api impact --path <repo_path> --target "module.function"
242
+ ```
243
+
244
+ ---
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ ## Privacy & Security
255
+
256
+ ✅ **100% Local**
257
+ - All analysis happens on your machine
258
+ - No data sent to external servers
259
+ - .env files and secrets are never exposed
260
+
261
+ ✅ **Secure Cache**
262
+ - Analysis results cached locally
263
+ - Cache auto-cleared after 14 days (configurable)
264
+ - No credentials stored
265
+
266
+ ✅ **Secret Redaction**
267
+ - API keys automatically masked in output
268
+ - GitHub tokens never logged
269
+ - Safe error messages
270
+
271
+ ---
272
+
273
+ ## Example Workflow
274
+
275
+ ### Local Project Analysis
276
+ ```bash
277
+ # 1. Navigate to your Python project
278
+ cd C:\Users\YourName\my_python_project
279
+
280
+ # 2. Analyze it with CodeMap
281
+ codemap analyze --path .
282
+ # ✅ Analysis complete! Results cached locally
283
+
284
+ # 3. Start the web dashboard
285
+ codemap dashboard --port 8000
286
+ # ✅ Dashboard running at http://127.0.0.1:8000
287
+
288
+ # 4. Open in browser
289
+ codemap open --port 8000
290
+
291
+ # 5. Explore in browser:
292
+ # - View all repositories
293
+ # - See call graphs
294
+ # - Check architecture metrics
295
+ # - View risk analysis
296
+
297
+ # 6. Search for a specific class
298
+ codemap api search --path . --query "MyClass"
299
+
300
+ # 7. Check call graph for a function
301
+ codemap api explain --path . --symbol "mymodule.MyClass.method"
302
+ ```
303
+
304
+ ### GitHub Repository Analysis
305
+ ```bash
306
+ # 1. Analyze a public GitHub repo
307
+ codemap analyze --github https://github.com/owner/awesome-project
308
+ # ✅ Downloaded and analyzed
309
+
310
+ # 2. View in dashboard
311
+ codemap dashboard --port 8000
312
+ codemap open --port 8000
313
+
314
+ # 3. Clean up old repos
315
+ codemap cache list # See all cached repos
316
+ codemap cache sweep # Auto-cleanup old ones
317
+ ```
318
+
319
+ ---
320
+
321
+ ## Next Steps
322
+
323
+ 1. 🎯 **First analysis** - Try the demo:
324
+ ```bash
325
+ codemap analyze --path demo_repo
326
+ ```
327
+
328
+ 2. 📊 **View results** - Open the dashboard:
329
+ ```bash
330
+ codemap dashboard --port 8000
331
+ ```
332
+
333
+ 3. 📁 **Analyze your code** - Point to your project:
334
+ ```bash
335
+ codemap analyze --path ~/my-project
336
+ ```
337
+
338
+ 4. 🔗 **Try GitHub** - Analyze public repos:
339
+ ```bash
340
+ codemap analyze --github https://github.com/owner/repo
341
+ ```
342
+
343
+ 5. 🚀 **Advanced features** - Explore search, impact, risk analysis:
344
+ ```bash
345
+ codemap api search --path . --query "YourClass"
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Quick Reference
351
+
352
+ ```bash
353
+ # Installation
354
+ pip install -e .
355
+
356
+ # Most common commands
357
+ codemap analyze --path <directory> # Analyze local repo
358
+ codemap analyze --github <url> # Analyze GitHub repo
359
+ codemap dashboard --port 8000 # Start dashboard
360
+ codemap open --port 8000 # Open in browser
361
+ codemap cache list # List all analyses
362
+ codemap cache clear <hash> # Delete one analysis
363
+ ```
364
+
365
+ ---
366
+
367
+ ## Support & Help
368
+
369
+ ✅ **Run without arguments** to see all available commands:
370
+ ```bash
371
+ codemap --help
372
+ codemap analyze --help
373
+ codemap dashboard --help
374
+ codemap api --help
375
+ ```
376
+
377
+ ✅ **Check requirements:**
378
+ ```bash
379
+ python --version # Should be 3.10+
380
+ pip --version # Should be installed
381
+ git --version # For GitHub repos
382
+ ```
383
+
384
+ ✅ **Verify repo path:**
385
+ ```bash
386
+ # Make sure your repo has Python files
387
+ dir <your_repo> # Windows
388
+ ls <your_repo> # Linux/Mac
389
+ find <your_repo> -name "*.py" # Find Python files
390
+ ```
391
+
392
+ ---
393
+
394
+ **Happy coding! 🚀**
395
+
396
+ ---
397
+
398
+ **GitHub:** https://github.com/ADITYA-kus/codemap_ai
399
+
@@ -0,0 +1,58 @@
1
+ cli.py,sha256=boH_c_MEviQtmCetl-nTSMWoHkz6sVLIbv887aUzJEA,72912
2
+ codemap_cli.py,sha256=W6GWcVQsIUQwUq5xTe0R-6hSKOwkqgpJxlosdSEyYco,175
3
+ security_utils.py,sha256=6wmKx3qeYQmyIhc69ENocdclzKjIskhGhbbYzyrOfSs,1958
4
+ analysis/__init__.py,sha256=gk7XcsmXhT6ewXV3CFezT6R5Q8E2RJ_W1lAPYWmloUQ,20
5
+ analysis/architecture/__init__.py,sha256=8Bo3TpyB49uJs6QpQMTWpUR2hJhqEpbkK_E_GW7tYpU,5
6
+ analysis/architecture/architecture_engine.py,sha256=8aWqfvdGHP9gIf03VdLrkn1vF670MzeKXpPVVeP7kh4,5567
7
+ analysis/architecture/dependency_cycles.py,sha256=fu1kQY1N4jmAdCdh2V2g9e8aZRoC17WtGEy6rPStDbI,3342
8
+ analysis/architecture/risk_radar.py,sha256=3nCxjH96cicb_UQ67T4Hk63cIWWgG5syQhlaoFsoWEA,8681
9
+ analysis/call_graph/__init__.py,sha256=w0foWNOGbFJTxtZUs08tnR3MM5mRTfA0xz6DtGRNGOk,22
10
+ analysis/call_graph/call_extractor.py,sha256=ePYwybRNn5U6dZ21wiovtnVzCskaohNMINvaM_zOEaU,2673
11
+ analysis/call_graph/call_graph_builder.py,sha256=h3D2SzvNmyPtVEBvwGTHM2LVsUwxq9MBLEMhkMi8gGc,29
12
+ analysis/call_graph/call_resolver.py,sha256=gdSAy_042xxXby65FfSIMGBYI3yU4-jT-zMvpajHdF8,1600
13
+ analysis/call_graph/context_models.py,sha256=pYCvdJOEdR35p-BO42BtXoJIFdieF6CEp-f_rSFbd0Q,29
14
+ analysis/call_graph/cross_file_resolver.py,sha256=NvCsNijZ6PoBR-U0SHfpUaViQ9av2leh7hEu6yMuOlo,3485
15
+ analysis/call_graph/execution_tracker.py,sha256=kF8zrEdt-H0nbfMTLIWvDKZ0KAwJ_6vIsO1cnHCKQxU,31
16
+ analysis/call_graph/flow_builder.py,sha256=B029swJPLTaB6MazmHfK-XS9rLpg7HSTwiEj176hZ7w,26
17
+ analysis/call_graph/models.py,sha256=bj3YVEVIKhSNrYdczUewhckocjYp9qrdQzV65ICPJvQ,23
18
+ analysis/core/__init__.py,sha256=Sl3CBLE_4V96jffhhcEY6C_-grRWDCQyoB-LVtNnP_A,39
19
+ analysis/core/ast_context.py,sha256=kQZB3jM4Mnqy8VtnlT5Towdo5Rfg6sr2hF-eVxjQY6Q,29
20
+ analysis/core/ast_parser.py,sha256=JKmnMu9jmTj3gktRXamzPp94OjAlPCLCkQ20Xfa9IOE,184
21
+ analysis/core/class_extractor.py,sha256=YJctW3TigWa7gra02qgZJXoVboDDTikkIyPzEDfNiI8,1039
22
+ analysis/core/function_extractor.py,sha256=5y0teAJ8vzGTZ8Te80m9i0ihP8g2jgR2FEcddxIvhwc,436
23
+ analysis/core/import_extractor.py,sha256=hefburHlOhvfHneADTk7Nxi1pAlp29KH7EirLhOjPK0,1262
24
+ analysis/explain/__init__.py,sha256=2FsKrvLP_OgFFTuoFToaXRs6lM3lmz6lpEqjy5Agko8,55
25
+ analysis/explain/docstring_extractor.py,sha256=9AO1ITf48KMg5ezZm_GYJzTlFi8sOBYih3uXlyectWM,1449
26
+ analysis/explain/explain_runner.py,sha256=bgB7PFUidR_aRBr8TdWr3KWNMWsy5o1H_-0IzNQli7M,5587
27
+ analysis/explain/repo_summary_generator.py,sha256=eCNve4-eHG0d2XLJttFA-Bh5suZIvKack_jBRaMHrHc,6474
28
+ analysis/explain/return_analyzer.py,sha256=KjHj7SHWTUMQAzLUi0A8BL5cv5tCxr5XeAw2VG-uyYg,3100
29
+ analysis/explain/risk_flags.py,sha256=QNV101q4PMMIJ_LKv80EwX6uaAysiZC-aGyYTSbwPb8,39
30
+ analysis/explain/signature_extractor.py,sha256=Wx-8tvCArg8B9LtMsvw0O5kd48PsGf0KjiEDF7uzTmc,3430
31
+ analysis/explain/summary_generator.py,sha256=Km39BqMIBFOljlxTy9-NdyFNnVbx14XQXH2NVbnoWRU,9944
32
+ analysis/graph/__init__.py,sha256=JcO7GEPE5fMocTUC1ou9AKGCnv3RwpTKt1CrNKQ-puM,52
33
+ analysis/graph/callgraph_index.py,sha256=34LE8Vgv-z6kVOIoCdKJ19ej550ENEYI-78xuhF6QQE,3770
34
+ analysis/graph/entrypoint_detector.py,sha256=4NDD4z-tAIcryTVcHkV7dMLDOQp3J-QKDFPUcIESRsg,40
35
+ analysis/graph/impact_analyzer.py,sha256=LN23TnFr-4CSvrwC4pI-YbGXaGbg6ZUnktRvC5jByQM,7507
36
+ analysis/indexing/__init__.py,sha256=eiE_smnnd-0xjpMBKDQilIypx5oiLA9N_40xBxDQSe4,54
37
+ analysis/indexing/import_resolver.py,sha256=ZkTyx3RdzrEwdHMVax0uM5D4AjJNEo1FoXAD1rsx5QY,4697
38
+ analysis/indexing/symbol_index.py,sha256=RoBsehau9u0tYB8hUEvN5K4dINgtiGH07qV0vznKAhA,5491
39
+ analysis/runners/__init__.py,sha256=4caStudxQFG1nCXBGpoyV7DvxN5ySfwVm4ENQc46w6s,21
40
+ analysis/runners/phase4_runner.py,sha256=HASv0IsVye7TdxwZ2TQfVjShJ8Q4b533IZ8Hd1CVTWU,4875
41
+ analysis/utils/__init__.py,sha256=sJCGmNWVjSiFK21dDvTzQFMUPyQYNP3b4-Lj42DNA-s,17
42
+ analysis/utils/ast_helpers.py,sha256=qMny-x6kvMt7F1b9Q8HtR2o0nen6bR-MyQsClBzLNpI,20
43
+ analysis/utils/cache_manager.py,sha256=FUuZOO_CSHP_A2cFO4Kk8WQc34AYfqTol2w6n7DmTBE,24579
44
+ analysis/utils/path_resolver.py,sha256=NprapbBX8E1c_5jp2R1OLIYMeqrFeNfaxnmIlwqs9hI,27
45
+ analysis/utils/repo_fetcher.py,sha256=bCUBG0qUypcXXgQPAAdJAaRoQSc75Nd53B7HD72Euno,15105
46
+ ui/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
47
+ ui/app.py,sha256=HQQ6oGR-LScaLxXbVklRkZRAF8YIXg3U7JtWymie8js,80878
48
+ ui/device_id.py,sha256=gAan8gMnSY_lDpDSllafK27CSskFT-_OdFw2m8y2QUA,708
49
+ ui/static/app.js,sha256=Qv7VPyBG2hWyX3PT2A0EO5XYcdImObiUctuqK5jHl50,114003
50
+ ui/static/styles.css,sha256=gUEnjAQHh9qy0J2drZEiQyXMYe7y-krK1TX97yi4Q7w,20759
51
+ ui/templates/index.html,sha256=h60_WeamhraIrxwAOifVFMeQ_Yzg7zye5etAjypmxjY,10773
52
+ ui/utils/__init__.py,sha256=8Bo3TpyB49uJs6QpQMTWpUR2hJhqEpbkK_E_GW7tYpU,5
53
+ ui/utils/registry_manager.py,sha256=jEhWMQJ3H1ZtyUP2ObneqFOVDTdDqiBvUh-46-rGFDw,6730
54
+ codemap_python-0.1.0.dist-info/METADATA,sha256=1dcRsNr8nxwc5kkJ0Hb42b7jGKElQ68Fo34aiRnIBuU,10075
55
+ codemap_python-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
56
+ codemap_python-0.1.0.dist-info/entry_points.txt,sha256=71TCgwo56CPxSfh-YSmofpNwq4-kSsjmBL_qzJ5kfmk,45
57
+ codemap_python-0.1.0.dist-info/top_level.txt,sha256=JOu1LG-DyeBXc4u2Cn7KznNz-bZExhsf1CB7fV4r-t8,43
58
+ codemap_python-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ codemap = codemap_cli:main
@@ -0,0 +1,5 @@
1
+ analysis
2
+ cli
3
+ codemap_cli
4
+ security_utils
5
+ ui
security_utils.py ADDED
@@ -0,0 +1,51 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ from typing import Any, Iterable, Optional
5
+
6
+
7
+ _GITHUB_TOKEN_RE = re.compile(r"\b(gh[pousr]_[A-Za-z0-9_]{8,})\b")
8
+ _BEARER_RE = re.compile(r"(?i)\bBearer\s+([A-Za-z0-9\-._~+/]+=*)")
9
+ _BASIC_RE = re.compile(r"(?i)\bBasic\s+([A-Za-z0-9\-._~+/]+=*)")
10
+ _URL_CREDENTIALS_RE = re.compile(r"(https?://)([^/\s:@]+):([^@\s/]+)@")
11
+ _API_KEY_RE = re.compile(r"(?i)\b(api[_-]?key|token|secret|password)\s*[:=]\s*['\"]?([^\s'\";]{6,})")
12
+
13
+
14
+ def _mask_token(value: str) -> str:
15
+ token = str(value or "")
16
+ if token.startswith("gh") and "_" in token:
17
+ prefix, _ = token.split("_", 1)
18
+ return f"{prefix}_************"
19
+ return "********"
20
+
21
+
22
+ def redact_secrets(text: str, extra_secrets: Optional[Iterable[str]] = None) -> str:
23
+ value = str(text or "")
24
+
25
+ for secret in (extra_secrets or []):
26
+ s = str(secret or "").strip()
27
+ if s:
28
+ value = value.replace(s, "********")
29
+
30
+ value = _GITHUB_TOKEN_RE.sub(lambda m: _mask_token(m.group(1)), value)
31
+ value = _BEARER_RE.sub("Bearer ********", value)
32
+ value = _BASIC_RE.sub("Basic ********", value)
33
+ value = _URL_CREDENTIALS_RE.sub(r"\1***:***@", value)
34
+
35
+ def _api_key_sub(match: re.Match) -> str:
36
+ return f"{match.group(1)}=[REDACTED]"
37
+
38
+ value = _API_KEY_RE.sub(_api_key_sub, value)
39
+ return value
40
+
41
+
42
+ def redact_payload(payload: Any, extra_secrets: Optional[Iterable[str]] = None) -> Any:
43
+ if isinstance(payload, str):
44
+ return redact_secrets(payload, extra_secrets=extra_secrets)
45
+ if isinstance(payload, list):
46
+ return [redact_payload(v, extra_secrets=extra_secrets) for v in payload]
47
+ if isinstance(payload, tuple):
48
+ return [redact_payload(v, extra_secrets=extra_secrets) for v in payload]
49
+ if isinstance(payload, dict):
50
+ return {k: redact_payload(v, extra_secrets=extra_secrets) for k, v in payload.items()}
51
+ return payload
ui/__init__.py ADDED
@@ -0,0 +1 @@
1
+