codebread 1.0.0__tar.gz → 1.0.2__tar.gz

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 (29) hide show
  1. {codebread-1.0.0 → codebread-1.0.2}/PKG-INFO +13 -10
  2. {codebread-1.0.0 → codebread-1.0.2}/README.md +12 -9
  3. {codebread-1.0.0 → codebread-1.0.2}/codebread/__init__.py +1 -1
  4. {codebread-1.0.0 → codebread-1.0.2}/codebread/analyzer.py +5 -1
  5. {codebread-1.0.0 → codebread-1.0.2}/codebread/parsers/generic_parser.py +14 -0
  6. {codebread-1.0.0 → codebread-1.0.2}/codebread/server.py +12 -3
  7. {codebread-1.0.0 → codebread-1.0.2}/codebread.egg-info/PKG-INFO +13 -10
  8. {codebread-1.0.0 → codebread-1.0.2}/pyproject.toml +1 -1
  9. {codebread-1.0.0 → codebread-1.0.2}/LICENSE +0 -0
  10. {codebread-1.0.0 → codebread-1.0.2}/codebread/classifier.py +0 -0
  11. {codebread-1.0.0 → codebread-1.0.2}/codebread/cli.py +0 -0
  12. {codebread-1.0.0 → codebread-1.0.2}/codebread/connections.py +0 -0
  13. {codebread-1.0.0 → codebread-1.0.2}/codebread/diff.py +0 -0
  14. {codebread-1.0.0 → codebread-1.0.2}/codebread/export.py +0 -0
  15. {codebread-1.0.0 → codebread-1.0.2}/codebread/languages.py +0 -0
  16. {codebread-1.0.0 → codebread-1.0.2}/codebread/models.py +0 -0
  17. {codebread-1.0.0 → codebread-1.0.2}/codebread/parsers/__init__.py +0 -0
  18. {codebread-1.0.0 → codebread-1.0.2}/codebread/parsers/javascript_parser.py +0 -0
  19. {codebread-1.0.0 → codebread-1.0.2}/codebread/parsers/python_parser.py +0 -0
  20. {codebread-1.0.0 → codebread-1.0.2}/codebread/scanner.py +0 -0
  21. {codebread-1.0.0 → codebread-1.0.2}/codebread/web/app.js +0 -0
  22. {codebread-1.0.0 → codebread-1.0.2}/codebread/web/index.html +0 -0
  23. {codebread-1.0.0 → codebread-1.0.2}/codebread/web/style.css +0 -0
  24. {codebread-1.0.0 → codebread-1.0.2}/codebread.egg-info/SOURCES.txt +0 -0
  25. {codebread-1.0.0 → codebread-1.0.2}/codebread.egg-info/dependency_links.txt +0 -0
  26. {codebread-1.0.0 → codebread-1.0.2}/codebread.egg-info/entry_points.txt +0 -0
  27. {codebread-1.0.0 → codebread-1.0.2}/codebread.egg-info/requires.txt +0 -0
  28. {codebread-1.0.0 → codebread-1.0.2}/codebread.egg-info/top_level.txt +0 -0
  29. {codebread-1.0.0 → codebread-1.0.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codebread
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Interactive codebase analyzer & visualizer — slice open a project and see how it's wired together.
5
5
  Author: Danial Irsyad
6
6
  License: MIT
@@ -13,7 +13,7 @@ Requires-Dist: pathspec>=0.11; extra == "full"
13
13
  Dynamic: license-file
14
14
 
15
15
  <p align="center">
16
- <img src="assets/logo-wordmark.png" alt="CodeBread" width="360">
16
+ <img src="https://cdn.jsdelivr.net/gh/honow48-tech/CodeBread@main/assets/logo-wordmark.png" alt="CodeBread" width="360">
17
17
  </p>
18
18
 
19
19
  <p align="center">
@@ -22,7 +22,7 @@ Dynamic: license-file
22
22
  </p>
23
23
 
24
24
  <p align="center">
25
- <img alt="version" src="https://img.shields.io/badge/version-1.0.0-2dd4bf">
25
+ <img alt="version" src="https://img.shields.io/badge/version-1.0.2-2dd4bf">
26
26
  <img alt="python" src="https://img.shields.io/badge/python-3.9%2B-0284c7">
27
27
  <img alt="deps" src="https://img.shields.io/badge/required%20dependencies-none-2dd4bf">
28
28
  <img alt="license" src="https://img.shields.io/badge/license-MIT-8b5cf6">
@@ -74,27 +74,30 @@ That's it. Clone it, run it, nothing to compile.
74
74
  ## Install
75
75
 
76
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
77
+ pip install codebread
82
78
  ```
83
79
 
84
80
  Optional extra (better `.gitignore` matching while scanning):
85
81
 
86
82
  ```bash
87
- pip install .[full] # adds pathspec
83
+ pip install codebread[full] # adds pathspec
88
84
  ```
89
85
 
90
86
  Requires **Python 3.9+**. Nothing else.
91
87
 
88
+ Prefer running from source instead (e.g. to contribute)?
89
+
90
+ ```bash
91
+ git clone https://github.com/honow48-tech/CodeBread.git
92
+ cd CodeBread
93
+ pip install . # or: python codebread.py --path /path/to/project
94
+ ```
95
+
92
96
  ## Use
93
97
 
94
98
  ```bash
95
99
  codebread --path /path/to/project # scan + open the UI in your browser
96
100
  codebread # prompts for the path
97
- python codebread.py --path . # uninstalled, same thing
98
101
  ```
99
102
 
100
103
  That's the whole quick start: point it at a folder, a browser tab opens with
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="assets/logo-wordmark.png" alt="CodeBread" width="360">
2
+ <img src="https://cdn.jsdelivr.net/gh/honow48-tech/CodeBread@main/assets/logo-wordmark.png" alt="CodeBread" width="360">
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -8,7 +8,7 @@
8
8
  </p>
9
9
 
10
10
  <p align="center">
11
- <img alt="version" src="https://img.shields.io/badge/version-1.0.0-2dd4bf">
11
+ <img alt="version" src="https://img.shields.io/badge/version-1.0.2-2dd4bf">
12
12
  <img alt="python" src="https://img.shields.io/badge/python-3.9%2B-0284c7">
13
13
  <img alt="deps" src="https://img.shields.io/badge/required%20dependencies-none-2dd4bf">
14
14
  <img alt="license" src="https://img.shields.io/badge/license-MIT-8b5cf6">
@@ -60,27 +60,30 @@ That's it. Clone it, run it, nothing to compile.
60
60
  ## Install
61
61
 
62
62
  ```bash
63
- # option A: install the CLI
64
- pip install .
65
-
66
- # option B: don't install anything, just run it
67
- python codebread.py --path /path/to/project
63
+ pip install codebread
68
64
  ```
69
65
 
70
66
  Optional extra (better `.gitignore` matching while scanning):
71
67
 
72
68
  ```bash
73
- pip install .[full] # adds pathspec
69
+ pip install codebread[full] # adds pathspec
74
70
  ```
75
71
 
76
72
  Requires **Python 3.9+**. Nothing else.
77
73
 
74
+ Prefer running from source instead (e.g. to contribute)?
75
+
76
+ ```bash
77
+ git clone https://github.com/honow48-tech/CodeBread.git
78
+ cd CodeBread
79
+ pip install . # or: python codebread.py --path /path/to/project
80
+ ```
81
+
78
82
  ## Use
79
83
 
80
84
  ```bash
81
85
  codebread --path /path/to/project # scan + open the UI in your browser
82
86
  codebread # prompts for the path
83
- python codebread.py --path . # uninstalled, same thing
84
87
  ```
85
88
 
86
89
  That's the whole quick start: point it at a folder, a browser tab opens with
@@ -1,3 +1,3 @@
1
1
  """CodeBread — slice open a codebase and see its internal structure."""
2
2
 
3
- __version__ = "1.0.0"
3
+ __version__ = "1.0.2"
@@ -34,8 +34,12 @@ def analyze(root: str,
34
34
  info.warnings.append(err)
35
35
  info.layer = classify(info, text)
36
36
  if info.parsed or info.language in ("html", "css"):
37
- info.source = text if len(text) <= 300_000 else \
37
+ src = text if len(text) <= 300_000 else \
38
38
  text[:300_000] + "\n… (truncated)"
39
+ if info.language == "config":
40
+ from .parsers.generic_parser import redact_secrets
41
+ src = redact_secrets(src)
42
+ info.source = src
39
43
  parsed.append(info)
40
44
  for w in info.warnings:
41
45
  if w.startswith("Unsupported:"):
@@ -286,3 +286,17 @@ def parse_config(info: FileInfo, text: str) -> None:
286
286
  value = value[:57] + "..."
287
287
  info.db_config.append(f"{key} = {value}")
288
288
  info.db_config = info.db_config[:20]
289
+
290
+
291
+ def redact_secrets(text: str) -> str:
292
+ """Mask secret-looking values line by line. Used on config-file source
293
+ before it's stored/exported, so the raw "IDE view" / JSON export can't
294
+ leak what the DB-config summary already redacts."""
295
+ out = []
296
+ for line in text.splitlines():
297
+ m = re.match(r"^(\s*[\"']?[\w.\-]+[\"']?\s*[:=]\s*)(.+)$", line)
298
+ if m and SECRET_KEY_RE.search(m.group(1)):
299
+ out.append(m.group(1) + "•••masked•••")
300
+ else:
301
+ out.append(URL_CREDS_RE.sub("://***:***@", line))
302
+ return "\n".join(out)
@@ -10,6 +10,7 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
10
10
  from typing import Dict
11
11
 
12
12
  WEB_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web")
13
+ WEB_ROOT = os.path.realpath(WEB_DIR)
13
14
 
14
15
  MIME = {".html": "text/html; charset=utf-8",
15
16
  ".js": "application/javascript; charset=utf-8",
@@ -45,11 +46,19 @@ def serve(graph: Dict, port: int = 8137, open_browser: bool = True) -> None:
45
46
  self._file(path.lstrip("/"))
46
47
 
47
48
  def _file(self, rel: str):
48
- rel = os.path.normpath(rel).replace("\\", "/")
49
- if rel.startswith("..") or rel.startswith("/"):
49
+ # Resolve against WEB_DIR and verify the *result* is still inside
50
+ # it. String-prefix checks on `rel` alone aren't enough: on
51
+ # Windows, os.path.join(WEB_DIR, "C:/some/file") silently
52
+ # discards WEB_DIR because the second argument is drive-absolute,
53
+ # which would otherwise let a request read any file on disk.
54
+ full = os.path.realpath(os.path.join(WEB_DIR, rel))
55
+ try:
56
+ inside = os.path.commonpath([full, WEB_ROOT]) == WEB_ROOT
57
+ except ValueError:
58
+ inside = False # e.g. different drives on Windows
59
+ if not inside:
50
60
  self.send_error(403)
51
61
  return
52
- full = os.path.join(WEB_DIR, rel)
53
62
  if not os.path.isfile(full):
54
63
  self.send_error(404)
55
64
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codebread
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Interactive codebase analyzer & visualizer — slice open a project and see how it's wired together.
5
5
  Author: Danial Irsyad
6
6
  License: MIT
@@ -13,7 +13,7 @@ Requires-Dist: pathspec>=0.11; extra == "full"
13
13
  Dynamic: license-file
14
14
 
15
15
  <p align="center">
16
- <img src="assets/logo-wordmark.png" alt="CodeBread" width="360">
16
+ <img src="https://cdn.jsdelivr.net/gh/honow48-tech/CodeBread@main/assets/logo-wordmark.png" alt="CodeBread" width="360">
17
17
  </p>
18
18
 
19
19
  <p align="center">
@@ -22,7 +22,7 @@ Dynamic: license-file
22
22
  </p>
23
23
 
24
24
  <p align="center">
25
- <img alt="version" src="https://img.shields.io/badge/version-1.0.0-2dd4bf">
25
+ <img alt="version" src="https://img.shields.io/badge/version-1.0.2-2dd4bf">
26
26
  <img alt="python" src="https://img.shields.io/badge/python-3.9%2B-0284c7">
27
27
  <img alt="deps" src="https://img.shields.io/badge/required%20dependencies-none-2dd4bf">
28
28
  <img alt="license" src="https://img.shields.io/badge/license-MIT-8b5cf6">
@@ -74,27 +74,30 @@ That's it. Clone it, run it, nothing to compile.
74
74
  ## Install
75
75
 
76
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
77
+ pip install codebread
82
78
  ```
83
79
 
84
80
  Optional extra (better `.gitignore` matching while scanning):
85
81
 
86
82
  ```bash
87
- pip install .[full] # adds pathspec
83
+ pip install codebread[full] # adds pathspec
88
84
  ```
89
85
 
90
86
  Requires **Python 3.9+**. Nothing else.
91
87
 
88
+ Prefer running from source instead (e.g. to contribute)?
89
+
90
+ ```bash
91
+ git clone https://github.com/honow48-tech/CodeBread.git
92
+ cd CodeBread
93
+ pip install . # or: python codebread.py --path /path/to/project
94
+ ```
95
+
92
96
  ## Use
93
97
 
94
98
  ```bash
95
99
  codebread --path /path/to/project # scan + open the UI in your browser
96
100
  codebread # prompts for the path
97
- python codebread.py --path . # uninstalled, same thing
98
101
  ```
99
102
 
100
103
  That's the whole quick start: point it at a folder, a browser tab opens with
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "codebread"
7
- version = "1.0.0"
7
+ version = "1.0.2"
8
8
  description = "Interactive codebase analyzer & visualizer — slice open a project and see how it's wired together."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes