codebread 1.0.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.
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: codebread
3
+ Version: 1.0.0
4
+ Summary: Interactive codebase analyzer & visualizer — slice open a project and see how it's wired together.
5
+ Author: Danial Irsyad
6
+ License: MIT
7
+ Keywords: codebase,analyzer,visualizer,call-graph,architecture
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Provides-Extra: full
12
+ Requires-Dist: pathspec>=0.11; extra == "full"
13
+ Dynamic: license-file
14
+
15
+ <p align="center">
16
+ <img src="assets/logo-wordmark.png" alt="CodeBread" width="360">
17
+ </p>
18
+
19
+ <p align="center">
20
+ <b>Slice open any codebase and see how it's actually wired together.</b><br>
21
+ An interactive, zero-dependency map of files → functions → API routes → database tables.
22
+ </p>
23
+
24
+ <p align="center">
25
+ <img alt="version" src="https://img.shields.io/badge/version-1.0.0-2dd4bf">
26
+ <img alt="python" src="https://img.shields.io/badge/python-3.9%2B-0284c7">
27
+ <img alt="deps" src="https://img.shields.io/badge/required%20dependencies-none-2dd4bf">
28
+ <img alt="license" src="https://img.shields.io/badge/license-MIT-8b5cf6">
29
+ </p>
30
+
31
+ ---
32
+
33
+ ## What is this
34
+
35
+ CodeBread scans a project, extracts every function and class, maps how
36
+ everything connects — **frontend → API → backend → database** — and renders
37
+ it as an interactive node-graph in your browser. Click a file to slice it
38
+ open into its functions; click a function to see everything it calls and
39
+ everything that calls it, with the full chain lit up end to end.
40
+
41
+ **The problem it solves:** dropping into a codebase you didn't write — or one
42
+ an AI generated for you — and not knowing where anything is. Reading files
43
+ one at a time doesn't build a mental model fast. CodeBread builds the model
44
+ for you: it finds the routes, follows the `fetch()` calls to the handlers
45
+ that answer them, follows the handlers to the tables they touch, and draws
46
+ the whole path.
47
+
48
+ ## Why I built this
49
+
50
+ This started as a personal tool. I kept generating projects with AI and then
51
+ staring at the result with no idea how the pieces fit together — which file
52
+ called which, where the API boundary actually was, what touched the
53
+ database. I wanted something that would just *show* me, instead of me
54
+ grepping through the tree file by file. CodeBread is that tool.
55
+
56
+ It's a v1.0 — actively used by me on my own projects, and I'll keep adding
57
+ to it. If it's useful to you too, that's a bonus. Issues and PRs are welcome.
58
+
59
+ ## What it's built with
60
+
61
+ - **Backend/analysis engine:** pure Python **standard library** — no
62
+ required third-party packages, nothing to `pip install` beyond Python
63
+ itself. Parsing is stdlib `ast` for Python and structural regex for
64
+ everything else (see language table below).
65
+ - **Frontend:** vanilla **JavaScript + SVG**, no framework, no build step,
66
+ no `npm install`. The entire UI is three files (`app.js`, `index.html`,
67
+ `style.css`).
68
+ - **Serving:** a tiny local server built on `http.server` from the stdlib.
69
+
70
+ That's it. Clone it, run it, nothing to compile.
71
+
72
+ ---
73
+
74
+ ## Install
75
+
76
+ ```bash
77
+ # option A: install the CLI
78
+ pip install .
79
+
80
+ # option B: don't install anything, just run it
81
+ python codebread.py --path /path/to/project
82
+ ```
83
+
84
+ Optional extra (better `.gitignore` matching while scanning):
85
+
86
+ ```bash
87
+ pip install .[full] # adds pathspec
88
+ ```
89
+
90
+ Requires **Python 3.9+**. Nothing else.
91
+
92
+ ## Use
93
+
94
+ ```bash
95
+ codebread --path /path/to/project # scan + open the UI in your browser
96
+ codebread # prompts for the path
97
+ python codebread.py --path . # uninstalled, same thing
98
+ ```
99
+
100
+ That's the whole quick start: point it at a folder, a browser tab opens with
101
+ the map already scanned.
102
+
103
+ ### CLI reference
104
+
105
+ | Flag | What it does |
106
+ |---|---|
107
+ | `--path, -p PATH` | root folder to scan (prompted if omitted) |
108
+ | `--port 8137` | local server port (auto-picks a free one nearby if taken) |
109
+ | `--json out.json` | export the full graph as JSON |
110
+ | `--load out.json` | re-open a saved scan without re-scanning |
111
+ | `--html out.html` | export a **self-contained static HTML** file you can share |
112
+ | `--diff old.json new.json` | compare two saved scans and print what changed (files/functions/tables added, removed, changed) |
113
+ | `--no-open` | don't auto-open the browser |
114
+ | `--no-serve` | scan + export only, don't start the server |
115
+ | `--version` | print the installed version |
116
+
117
+ ---
118
+
119
+ ## What you get
120
+
121
+ - **Explorer sidebar** — the full folder tree, expandable like a file
122
+ explorer; every file tagged with its layer color.
123
+ - **Orbit layout (default)** — files float freely in space, spread apart so
124
+ connections stay untangled. Expand a file and its functions arrange in a
125
+ clean ring around it, spoked by straight lines back to the center. A
126
+ **Free** force-directed layout is also available (toggle bottom-right).
127
+ - **Focus mode** — clears the canvas so you inspect one file at a time:
128
+ pick a file in the Explorer and only it, its functions, and its direct
129
+ connections show up. Toggle it off to go back to the full overview.
130
+ - **Progressive reveal (OSINT-style)** — click a file to slice it open into
131
+ its numbered functions; click a function to draw in what it calls and
132
+ what calls it. Dense codebases stay readable.
133
+ - **Full-chain highlight** — select any node and its complete end-to-end
134
+ chain lights up (frontend `fetch()` → `GET /api/users` route → handler →
135
+ `users` table), everything unrelated dims.
136
+ - **Right-click for actions** — a context menu on every node, edge, and
137
+ the empty canvas: reveal connections, focus a file, open it in the IDE
138
+ view, jump to a route's source/target, copy a name or path, and more.
139
+ - **Insights panel** — flags orphaned functions (no detected callers) and
140
+ circular call chains, both clickable to jump straight to them.
141
+ - **Diff mode** — compare two saved scans (`--diff old.json new.json`) to
142
+ see exactly what changed between them.
143
+ - **Minimap + breadcrumb** — a live minimap of the whole graph with a
144
+ draggable viewport, and a breadcrumb showing the real folder path of
145
+ whatever's currently selected.
146
+ - **Keyboard navigation** — `←`/`→` step through a selected node's
147
+ neighbors, `↑`/`↓` walk back/forward through your selection history,
148
+ `/` to search.
149
+ - **Detail panel** — params, return type, auto-generated description
150
+ ("Function 3 · handles GET /api/users · queries users"), every caller and
151
+ callee, clickable.
152
+ - **View the actual code** — every function has an expandable
153
+ **▸ View code** section: syntax-highlighted source with real line
154
+ numbers. A full **IDE view** (⌗) opens any file whole, with an outline
155
+ sidebar.
156
+ - **Search** (`/`) and **layer filter** (Frontend / Backend / Database /
157
+ Config) in the header.
158
+ - **Warnings, never silence** — unreadable files, unsupported languages and
159
+ permission problems show up as ⚠ badges and in the warnings list, never
160
+ hidden. Secrets found in config files are always masked.
161
+
162
+ ## Language support
163
+
164
+ | Language | Parser | Extracted |
165
+ |---|---|---|
166
+ | Python | stdlib `ast` (precise) | functions, classes, params/annotations, docstrings, Flask/FastAPI/Django routes, SQLAlchemy/Django models, raw SQL, `requests`/`httpx` calls |
167
+ | JavaScript / TypeScript / JSX / TSX / Vue / Svelte | structural regex + brace matching | functions, arrow fns, classes, Express/Nest/Fastify routes, `fetch`/`axios` calls, Mongoose/Prisma/Sequelize/Knex/TypeORM, raw SQL |
168
+ | Java, C#, Go, PHP, Ruby | structural regex | functions/methods, classes, Spring/ASP.NET/Laravel/Rails/Gin routes, raw SQL |
169
+ | SQL | regex | `CREATE TABLE` schemas with columns |
170
+ | Config (`.env`, json/yaml/toml/ini, settings.py…) | key scan | DB connection settings — **credentials always masked** |
171
+ | Anything else (Rust, Kotlin, Swift, C/C++…) | — | shown in the UI as "⚠ Unsupported — parsing skipped", never silently dropped |
172
+
173
+ ## How it classifies layers
174
+
175
+ Score-based heuristics combining framework import signatures
176
+ (React/Vue → frontend, Flask/Express → backend, SQLAlchemy/Prisma →
177
+ database), folder conventions (`/client`, `/server`, `/models`…), file
178
+ extensions, and extracted facts (defines routes → backend, defines models →
179
+ database). Ambiguous files are marked **Unclassified** instead of guessed.
180
+
181
+ ## How orphan + cycle detection works
182
+
183
+ - **Orphaned functions**: any function/method with zero detected incoming
184
+ calls, that isn't a route handler and isn't a common framework entry
185
+ point (`__init__`, `main`, `setUp`, test functions, …). Flagged with a
186
+ badge on the node and listed in the Insights panel — a good starting
187
+ point for finding dead code (heuristic, not exhaustive: it can miss calls
188
+ the static parser doesn't recognize).
189
+ - **Circular call chains**: an iterative cycle-detection pass over the
190
+ call graph (no recursion, so it's safe on large codebases) flags
191
+ functions that call each other in a loop, both on the node (↻ badge) and
192
+ as a listed chain in the Insights panel.
193
+
194
+ ## Project layout
195
+
196
+ ```
197
+ codebread.py ← runnable entry point (no install needed)
198
+ codebread/
199
+ cli.py ← argparse CLI
200
+ scanner.py ← .gitignore-aware recursive walker
201
+ languages.py ← language detection / binary sniffing
202
+ parsers/
203
+ python_parser.py ← ast-based Python extractor
204
+ javascript_parser.py ← JS/TS/Vue/Svelte extractor
205
+ generic_parser.py ← Java/C#/Go/PHP/Ruby + SQL + config
206
+ classifier.py ← frontend/backend/database/config scoring
207
+ connections.py ← call graph + API↔route + fn↔table matching +
208
+ orphan/cycle detection
209
+ analyzer.py ← pipeline orchestration
210
+ diff.py ← compares two saved scans
211
+ server.py ← stdlib local web server
212
+ export.py ← JSON + single-file HTML export
213
+ web/ ← the UI (vanilla JS + SVG, zero dependencies)
214
+ assets/ ← logo (.svg source + .png for the README —
215
+ GitHub blocks same-repo SVG <img> embeds)
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Roadmap
221
+
222
+ Already done as of v1.0:
223
+
224
+ - [x] Orphaned-function and circular-dependency detection
225
+ - [x] Diff mode between two scans
226
+ - [x] Focus mode, orbit layout, right-click actions, minimap, breadcrumb
227
+
228
+ Not yet, but planned:
229
+
230
+ - [ ] "Explain this function" — a plain-language AI summary button
231
+ - [ ] More precise multi-language parsing (currently structural regex for
232
+ everything but Python)
233
+ - [ ] An automated test suite
234
+
235
+ Have an idea? Open an issue.
236
+
237
+ ## Contributing
238
+
239
+ This is a young, actively-changing personal project, so keep that in mind —
240
+ but contributions are genuinely welcome:
241
+
242
+ - **Bugs / ideas** → open an issue with a repro or a description.
243
+ - **Pull requests** → welcome, especially for language parser improvements
244
+ or UI polish. Keep the zero-dependency philosophy: the core tool should
245
+ keep running on nothing but the Python standard library, and the UI
246
+ should keep running on vanilla JS with no build step.
247
+ - No formal test suite yet, so please describe how you manually verified a
248
+ change in your PR.
249
+
250
+ ## License
251
+
252
+ [MIT](LICENSE) — use it, modify it, ship it, sell it. No attribution
253
+ required beyond keeping the license file. See [LICENSE](LICENSE) for the
254
+ full text.
@@ -0,0 +1,24 @@
1
+ codebread/__init__.py,sha256=BC-wwjQfPOvr7SvqouJDXsRzLwI89Hv9LPFCODM5dDc,97
2
+ codebread/analyzer.py,sha256=7uf00Lw5jjtsA4-fb8x2bUsoZybyPNeVQsXSBx1bPhY,3061
3
+ codebread/classifier.py,sha256=jehD-XQ80CP_O4x9YRi4JQqzd4AaHxKpzI83wLG1yvM,4067
4
+ codebread/cli.py,sha256=AMvwk29cOJDjsI-I07pCGbqogdtq1Y6HWnT52FHYyLs,4072
5
+ codebread/connections.py,sha256=FN0c-W9_tnQUVetnF0eVyC6lllyBOyZ3512sXShpy7Q,16609
6
+ codebread/diff.py,sha256=5SDGW56yo2zyCEeeDD_CZWiQN6Ls7knDI1j_Zwi-JvQ,4960
7
+ codebread/export.py,sha256=rKYmzuSEXYDrgcItnhdyXI_lo0LN2PSoMe0hYElzU88,1512
8
+ codebread/languages.py,sha256=SKHy9v7QPreWZG6FbuX3B0-kq1jqVn-rmwNqJ9ESFqo,4494
9
+ codebread/models.py,sha256=Sw2PJW63dKyl5RpWwfY2ZvCJLYttmjoQg4O5H5DtLgM,4214
10
+ codebread/scanner.py,sha256=bEXSaoENmJ-C_oabj2IF1aWs9-LaIqMc80xXQvo7-eg,8020
11
+ codebread/server.py,sha256=9MPHNx3b_KQV4YA4XGeW9vhfkiq4jz-j5f6M9RDyhSc,3020
12
+ codebread/parsers/__init__.py,sha256=ovsvmXGClshiUlDdx6mkBmRu8__OZIqYos6-1eLb9eM,2285
13
+ codebread/parsers/generic_parser.py,sha256=5XveP1AkCpIni9faEU9MRc93ZGHek7_R_TkQSZEOxts,11382
14
+ codebread/parsers/javascript_parser.py,sha256=lVIlydQ3--Owd78816XIM77NntfQ97DeLzYvPrjd5GE,15916
15
+ codebread/parsers/python_parser.py,sha256=QnhCLx01bKYLYqav33cI27qbEQNPUiXnS5uN7cb8poQ,11671
16
+ codebread/web/app.js,sha256=P1zpCHNMyczAuLWL9zM5htl9E3wG3jJdpZ6orLhixTM,65672
17
+ codebread/web/index.html,sha256=6YqjC_wO3pfqyG_11uIhvRM16Wagu2l8eSOs1FNc-UY,8693
18
+ codebread/web/style.css,sha256=fiq1bC-I1bC6-6MxRn0blQwGOjO_fdClPrhf5W7zqPw,23729
19
+ codebread-1.0.0.dist-info/licenses/LICENSE,sha256=okINupIvMgiuOlvMVpsM9DT5jb6QQmKBd--yfZq4bjc,1070
20
+ codebread-1.0.0.dist-info/METADATA,sha256=qzULyaRVsH_7ybNluHcLL-2CLAsZtxRgSAW0cQq5j7g,11258
21
+ codebread-1.0.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
22
+ codebread-1.0.0.dist-info/entry_points.txt,sha256=ItG61aUP1YTvA_zA-jlUshBc5BPpJDpCyVnsyaxNXKA,49
23
+ codebread-1.0.0.dist-info/top_level.txt,sha256=KctFB7UQb4tN9YotaJD95GuHWIQuoO5VqyLdo_gEswQ,10
24
+ codebread-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ codebread = codebread.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Danial Irsyad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ codebread