repoglance 0.2.1__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.
- repoglance-0.2.1/.github/workflows/ci.yml +27 -0
- repoglance-0.2.1/.github/workflows/release.yml +54 -0
- repoglance-0.2.1/.github/workflows/repoglance.yml +25 -0
- repoglance-0.2.1/.gitignore +27 -0
- repoglance-0.2.1/.pre-commit-hooks.yaml +8 -0
- repoglance-0.2.1/.repolens-badge.json +1 -0
- repoglance-0.2.1/CONTRIBUTING.md +39 -0
- repoglance-0.2.1/LICENSE +21 -0
- repoglance-0.2.1/PKG-INFO +252 -0
- repoglance-0.2.1/README.md +223 -0
- repoglance-0.2.1/RELEASING.md +46 -0
- repoglance-0.2.1/action.yml +73 -0
- repoglance-0.2.1/assets/badge.svg +19 -0
- repoglance-0.2.1/assets/demo.svg +289 -0
- repoglance-0.2.1/assets/showcase/flask.svg +268 -0
- repoglance-0.2.1/assets/showcase/httpie.svg +311 -0
- repoglance-0.2.1/assets/showcase/requests.svg +290 -0
- repoglance-0.2.1/pyproject.toml +46 -0
- repoglance-0.2.1/src/repoglance/__init__.py +3 -0
- repoglance-0.2.1/src/repoglance/__main__.py +4 -0
- repoglance-0.2.1/src/repoglance/badge.py +94 -0
- repoglance-0.2.1/src/repoglance/cli.py +90 -0
- repoglance-0.2.1/src/repoglance/complexity.py +96 -0
- repoglance-0.2.1/src/repoglance/gitinfo.py +76 -0
- repoglance-0.2.1/src/repoglance/languages.py +111 -0
- repoglance-0.2.1/src/repoglance/metrics.py +68 -0
- repoglance-0.2.1/src/repoglance/report.py +310 -0
- repoglance-0.2.1/src/repoglance/scanner.py +181 -0
- repoglance-0.2.1/tests/test_complexity.py +32 -0
- repoglance-0.2.1/tests/test_features.py +101 -0
- repoglance-0.2.1/tests/test_scanner.py +58 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
15
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install
|
|
23
|
+
run: python -m pip install -e ".[dev]"
|
|
24
|
+
- name: Test
|
|
25
|
+
run: python -m pytest -q
|
|
26
|
+
- name: Smoke test the CLI
|
|
27
|
+
run: repoglance --json .
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a version tag (v*) is pushed, using PyPI's
|
|
4
|
+
# trusted-publisher (OIDC) flow — no API token stored in the repo.
|
|
5
|
+
#
|
|
6
|
+
# One-time setup on PyPI: create the project's "pending publisher" at
|
|
7
|
+
# https://pypi.org/manage/account/publishing/ with
|
|
8
|
+
# owner: SRJ-ai repo: repolens workflow: release.yml environment: pypi
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
tags: ["v*"]
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
- name: Build sdist and wheel
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade build
|
|
28
|
+
python -m build
|
|
29
|
+
- name: Check metadata
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade twine
|
|
32
|
+
twine check dist/*
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: dist
|
|
36
|
+
path: dist/
|
|
37
|
+
|
|
38
|
+
publish:
|
|
39
|
+
needs: build
|
|
40
|
+
# Enable by setting repo variable PUBLISH_TO_PYPI=true after the PyPI
|
|
41
|
+
# pending publisher is configured (see RELEASING.md). Until then, tags can
|
|
42
|
+
# be cut (e.g. for the Marketplace) without a failing publish job.
|
|
43
|
+
if: ${{ vars.PUBLISH_TO_PYPI == 'true' }}
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
environment: pypi
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: write # required for trusted publishing (OIDC)
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/download-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: dist
|
|
52
|
+
path: dist/
|
|
53
|
+
- name: Publish to PyPI
|
|
54
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: repoglance
|
|
2
|
+
|
|
3
|
+
# Dogfoods the action: on every PR, post a repoglance report and enforce a
|
|
4
|
+
# minimum health score.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
analyze:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
- uses: ./
|
|
23
|
+
with:
|
|
24
|
+
fail-under: "55"
|
|
25
|
+
max-complexity: "30"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Virtual envs
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# Test / coverage
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
.tox/
|
|
20
|
+
.mypy_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
|
|
23
|
+
# Editors / OS
|
|
24
|
+
.idea/
|
|
25
|
+
.vscode/
|
|
26
|
+
.DS_Store
|
|
27
|
+
Thumbs.db
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schemaVersion": 1, "label": "repoglance", "message": "1.4k loc \u2022 Python", "color": "blue"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing to repoglance
|
|
2
|
+
|
|
3
|
+
Thanks for helping! repoglance aims to stay **small, fast, and dependency-light**.
|
|
4
|
+
|
|
5
|
+
## Dev setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m pip install -e ".[dev]"
|
|
9
|
+
python -m pytest -q
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Adding a language
|
|
13
|
+
|
|
14
|
+
Most language support is a one-line change. Add the extension to `EXT_LANG` in
|
|
15
|
+
[`src/repoglance/languages.py`](src/repoglance/languages.py):
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
"kt": "Kotlin",
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Optionally give it a color in `LANG_COLOR` and a comment prefix in
|
|
22
|
+
`_COMMENT_PREFIX` (in `scanner.py`) so blank/comment/code counts are accurate.
|
|
23
|
+
|
|
24
|
+
## Guidelines
|
|
25
|
+
|
|
26
|
+
- Keep the runtime dependencies to `rich` + `click`. Anything heavier needs a
|
|
27
|
+
strong justification.
|
|
28
|
+
- Every behavior the report shows must also be reachable via `--json`.
|
|
29
|
+
- Add or update a test in `tests/` for any logic change.
|
|
30
|
+
- Run `python -m pytest -q` before opening a PR.
|
|
31
|
+
|
|
32
|
+
## Ideas / good first issues
|
|
33
|
+
|
|
34
|
+
- SVG or PNG report export.
|
|
35
|
+
- Per-directory rollups.
|
|
36
|
+
- `--since <rev>` to scope git activity to a range.
|
|
37
|
+
- More accurate multi-line comment handling.
|
|
38
|
+
|
|
39
|
+
PRs and issues welcome. Be kind. 🌱
|
repoglance-0.2.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 repoglance contributors
|
|
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,252 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: repoglance
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Instant, gorgeous insight into any code repository — languages, complexity hotspots, TODOs and git activity in one terminal command.
|
|
5
|
+
Project-URL: Homepage, https://github.com/SRJ-ai/repolens
|
|
6
|
+
Project-URL: Repository, https://github.com/SRJ-ai/repolens
|
|
7
|
+
Project-URL: Issues, https://github.com/SRJ-ai/repolens/issues
|
|
8
|
+
Author: repoglance contributors
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cli,cloc,code-analysis,complexity,developer-tools,git,loc,rich,terminal
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: click>=8.0
|
|
24
|
+
Requires-Dist: rich>=13.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
<div align="center">
|
|
31
|
+
|
|
32
|
+
# 🔍 repoglance
|
|
33
|
+
|
|
34
|
+
### Instant, gorgeous insight into any code repository — in one command.
|
|
35
|
+
|
|
36
|
+
Point it at any folder. In under a second you get a beautiful terminal report:
|
|
37
|
+
language breakdown, complexity hotspots, TODO tracker, biggest files, and git
|
|
38
|
+
activity. **Zero config. Zero API keys. Zero telemetry.**
|
|
39
|
+
|
|
40
|
+
[](https://github.com/SRJ-ai/repolens/actions/workflows/ci.yml)
|
|
41
|
+
[](https://www.python.org/)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
[](CONTRIBUTING.md)
|
|
44
|
+
[](https://github.com/SRJ-ai/repolens)
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Why repoglance?
|
|
51
|
+
|
|
52
|
+
You clone an unfamiliar repo. What *is* this thing? How big? What's the messy
|
|
53
|
+
part? Where's the unfinished work? `cloc` gives you a wall of numbers. `tokei`
|
|
54
|
+
is fast but bare. `repoglance` answers the human questions in one glance:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
repoglance .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
<div align="center">
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
## Seen in the wild
|
|
67
|
+
|
|
68
|
+
repoglance run against well-known projects (click to view the full report):
|
|
69
|
+
|
|
70
|
+
| Project | Files | Lines of code | Health |
|
|
71
|
+
|---|--:|--:|:--:|
|
|
72
|
+
| [flask](assets/showcase/flask.svg) | 200 | 25,030 | D (64) |
|
|
73
|
+
| [httpie](assets/showcase/httpie.svg) | 217 | 19,604 | D (62) |
|
|
74
|
+
| [requests](assets/showcase/requests.svg) | 71 | 13,215 | D (69) |
|
|
75
|
+
|
|
76
|
+
<div align="center">
|
|
77
|
+
|
|
78
|
+
[](assets/showcase/flask.svg)
|
|
79
|
+
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
## Install
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install repoglance
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Or run without installing:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pipx run repoglance .
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
repoglance # analyze current directory
|
|
98
|
+
repoglance path/to/repo # analyze another repo
|
|
99
|
+
repoglance --json # machine-readable output for scripts / CI
|
|
100
|
+
repoglance --svg report.svg # export a vector report
|
|
101
|
+
repoglance --html report.html # export a browser report
|
|
102
|
+
repoglance --badge badge.svg # export an embeddable badge
|
|
103
|
+
repoglance --ci --max-complexity 25 # fail CI on hotspots
|
|
104
|
+
repoglance --no-git # skip git history
|
|
105
|
+
repoglance --ignore dist --ignore fixtures
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### JSON output
|
|
109
|
+
|
|
110
|
+
Pipe structured data anywhere — dashboards, CI gates, badges:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
repoglance --json | jq '.languages.Python.code'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## What it measures
|
|
117
|
+
|
|
118
|
+
| Section | What you get |
|
|
119
|
+
|---|---|
|
|
120
|
+
| **Languages** | Lines of code per language, ranked, with % bars |
|
|
121
|
+
| **Complexity hotspots** | Per-function cyclomatic complexity (Python via AST; heuristic for other langs) |
|
|
122
|
+
| **TODO tracker** | Every `TODO` / `FIXME` / `HACK` / `XXX` / `BUG` with file:line |
|
|
123
|
+
| **Biggest files** | The files most likely to need splitting |
|
|
124
|
+
| **Git activity** | Top authors, most-churned files, active days, project lifespan |
|
|
125
|
+
|
|
126
|
+
Binary files, `node_modules`, `.venv`, build dirs and friends are skipped
|
|
127
|
+
automatically.
|
|
128
|
+
|
|
129
|
+
## More than a counter
|
|
130
|
+
|
|
131
|
+
`repoglance` isn't just another `cloc`. Tools like `tokei`, `cloc` and `scc`
|
|
132
|
+
answer *"how many lines?"*. repoglance answers *"what should I look at?"* — and
|
|
133
|
+
gives you artifacts you can put in a PR or a README.
|
|
134
|
+
|
|
135
|
+
| | repoglance | tokei | scc | cloc |
|
|
136
|
+
|---|:---:|:---:|:---:|:---:|
|
|
137
|
+
| Lines-of-code by language | ✅ | ✅ | ✅ | ✅ |
|
|
138
|
+
| Complexity hotspots (per function) | ✅ | ❌ | ⚠️ file-level | ❌ |
|
|
139
|
+
| TODO / FIXME tracker | ✅ | ❌ | ❌ | ❌ |
|
|
140
|
+
| Git activity (authors, churn) | ✅ | ❌ | ❌ | ❌ |
|
|
141
|
+
| JSON output | ✅ | ✅ | ✅ | ✅ |
|
|
142
|
+
| **HTML / SVG report export** | ✅ | ❌ | ❌ | ❌ |
|
|
143
|
+
| **Embeddable repo badge** | ✅ | ❌ | ❌ | ❌ |
|
|
144
|
+
| **CI gate (`--max-complexity`)** | ✅ | ❌ | ❌ | ❌ |
|
|
145
|
+
| Zero install deps beyond one `pip` | ✅ | (binary) | (binary) | (perl) |
|
|
146
|
+
|
|
147
|
+
## Share it: badges & reports
|
|
148
|
+
|
|
149
|
+
Generate a self-contained SVG badge — no shields.io round-trip, no tracking:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
repoglance --badge assets/badge.svg
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+

|
|
156
|
+
|
|
157
|
+
Export the full report as a standalone file to drop in a PR or wiki:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
repoglance --svg report.svg # vector, pixel-perfect
|
|
161
|
+
repoglance --html report.html # opens in any browser
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Guard your codebase in CI
|
|
165
|
+
|
|
166
|
+
Fail the build when complexity or TODO debt crosses a line:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
repoglance --ci --max-complexity 25 --max-todos 100
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
# .github/workflows/quality.yml
|
|
174
|
+
- run: pip install repoglance
|
|
175
|
+
- run: repoglance --ci --max-complexity 25
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Exit code `0` = clean, `2` = a threshold was exceeded.
|
|
179
|
+
|
|
180
|
+
## Integrations
|
|
181
|
+
|
|
182
|
+
### GitHub Action — comment on every PR
|
|
183
|
+
|
|
184
|
+
Drop repoglance into any repo. It posts a sticky report comment on pull requests
|
|
185
|
+
and can gate the build:
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
# .github/workflows/repoglance.yml
|
|
189
|
+
name: repoglance
|
|
190
|
+
on: [pull_request]
|
|
191
|
+
permissions:
|
|
192
|
+
contents: read
|
|
193
|
+
pull-requests: write
|
|
194
|
+
jobs:
|
|
195
|
+
analyze:
|
|
196
|
+
runs-on: ubuntu-latest
|
|
197
|
+
steps:
|
|
198
|
+
- uses: actions/checkout@v4
|
|
199
|
+
- uses: SRJ-ai/repolens@main
|
|
200
|
+
with:
|
|
201
|
+
fail-under: "70" # optional health gate
|
|
202
|
+
max-complexity: "25" # optional complexity gate
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
The report also lands in the workflow's **job summary** every run.
|
|
206
|
+
|
|
207
|
+
### pre-commit hook
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
# .pre-commit-config.yaml
|
|
211
|
+
repos:
|
|
212
|
+
- repo: https://github.com/SRJ-ai/repolens
|
|
213
|
+
rev: v0.2.0
|
|
214
|
+
hooks:
|
|
215
|
+
- id: repoglance
|
|
216
|
+
args: ["--ci", "--fail-under", "70"]
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Self-updating badge
|
|
220
|
+
|
|
221
|
+
Commit a shields endpoint file and point a dynamic badge at it — the badge
|
|
222
|
+
refreshes itself, no service to run:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
repoglance --badge-json .repolens-badge.json # commit this file
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```markdown
|
|
229
|
+

|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Markdown anywhere
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
repoglance --md # paste into a PR, wiki, or Slack
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Design goals
|
|
239
|
+
|
|
240
|
+
- **Fast** — a single `os.walk`, no external services.
|
|
241
|
+
- **Honest** — no network, no telemetry, no surprise writes.
|
|
242
|
+
- **Pretty** — powered by [rich](https://github.com/Textualize/rich).
|
|
243
|
+
- **Scriptable** — everything the report shows is available as `--json`.
|
|
244
|
+
|
|
245
|
+
## Contributing
|
|
246
|
+
|
|
247
|
+
Adding a language is a one-line change in `languages.py`. PRs welcome — see
|
|
248
|
+
[CONTRIBUTING.md](CONTRIBUTING.md).
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
[MIT](LICENSE) © repoglance contributors
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🔍 repoglance
|
|
4
|
+
|
|
5
|
+
### Instant, gorgeous insight into any code repository — in one command.
|
|
6
|
+
|
|
7
|
+
Point it at any folder. In under a second you get a beautiful terminal report:
|
|
8
|
+
language breakdown, complexity hotspots, TODO tracker, biggest files, and git
|
|
9
|
+
activity. **Zero config. Zero API keys. Zero telemetry.**
|
|
10
|
+
|
|
11
|
+
[](https://github.com/SRJ-ai/repolens/actions/workflows/ci.yml)
|
|
12
|
+
[](https://www.python.org/)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
[](CONTRIBUTING.md)
|
|
15
|
+
[](https://github.com/SRJ-ai/repolens)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Why repoglance?
|
|
22
|
+
|
|
23
|
+
You clone an unfamiliar repo. What *is* this thing? How big? What's the messy
|
|
24
|
+
part? Where's the unfinished work? `cloc` gives you a wall of numbers. `tokei`
|
|
25
|
+
is fast but bare. `repoglance` answers the human questions in one glance:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
repoglance .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
<div align="center">
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
## Seen in the wild
|
|
38
|
+
|
|
39
|
+
repoglance run against well-known projects (click to view the full report):
|
|
40
|
+
|
|
41
|
+
| Project | Files | Lines of code | Health |
|
|
42
|
+
|---|--:|--:|:--:|
|
|
43
|
+
| [flask](assets/showcase/flask.svg) | 200 | 25,030 | D (64) |
|
|
44
|
+
| [httpie](assets/showcase/httpie.svg) | 217 | 19,604 | D (62) |
|
|
45
|
+
| [requests](assets/showcase/requests.svg) | 71 | 13,215 | D (69) |
|
|
46
|
+
|
|
47
|
+
<div align="center">
|
|
48
|
+
|
|
49
|
+
[](assets/showcase/flask.svg)
|
|
50
|
+
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install repoglance
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or run without installing:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pipx run repoglance .
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
repoglance # analyze current directory
|
|
69
|
+
repoglance path/to/repo # analyze another repo
|
|
70
|
+
repoglance --json # machine-readable output for scripts / CI
|
|
71
|
+
repoglance --svg report.svg # export a vector report
|
|
72
|
+
repoglance --html report.html # export a browser report
|
|
73
|
+
repoglance --badge badge.svg # export an embeddable badge
|
|
74
|
+
repoglance --ci --max-complexity 25 # fail CI on hotspots
|
|
75
|
+
repoglance --no-git # skip git history
|
|
76
|
+
repoglance --ignore dist --ignore fixtures
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### JSON output
|
|
80
|
+
|
|
81
|
+
Pipe structured data anywhere — dashboards, CI gates, badges:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
repoglance --json | jq '.languages.Python.code'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## What it measures
|
|
88
|
+
|
|
89
|
+
| Section | What you get |
|
|
90
|
+
|---|---|
|
|
91
|
+
| **Languages** | Lines of code per language, ranked, with % bars |
|
|
92
|
+
| **Complexity hotspots** | Per-function cyclomatic complexity (Python via AST; heuristic for other langs) |
|
|
93
|
+
| **TODO tracker** | Every `TODO` / `FIXME` / `HACK` / `XXX` / `BUG` with file:line |
|
|
94
|
+
| **Biggest files** | The files most likely to need splitting |
|
|
95
|
+
| **Git activity** | Top authors, most-churned files, active days, project lifespan |
|
|
96
|
+
|
|
97
|
+
Binary files, `node_modules`, `.venv`, build dirs and friends are skipped
|
|
98
|
+
automatically.
|
|
99
|
+
|
|
100
|
+
## More than a counter
|
|
101
|
+
|
|
102
|
+
`repoglance` isn't just another `cloc`. Tools like `tokei`, `cloc` and `scc`
|
|
103
|
+
answer *"how many lines?"*. repoglance answers *"what should I look at?"* — and
|
|
104
|
+
gives you artifacts you can put in a PR or a README.
|
|
105
|
+
|
|
106
|
+
| | repoglance | tokei | scc | cloc |
|
|
107
|
+
|---|:---:|:---:|:---:|:---:|
|
|
108
|
+
| Lines-of-code by language | ✅ | ✅ | ✅ | ✅ |
|
|
109
|
+
| Complexity hotspots (per function) | ✅ | ❌ | ⚠️ file-level | ❌ |
|
|
110
|
+
| TODO / FIXME tracker | ✅ | ❌ | ❌ | ❌ |
|
|
111
|
+
| Git activity (authors, churn) | ✅ | ❌ | ❌ | ❌ |
|
|
112
|
+
| JSON output | ✅ | ✅ | ✅ | ✅ |
|
|
113
|
+
| **HTML / SVG report export** | ✅ | ❌ | ❌ | ❌ |
|
|
114
|
+
| **Embeddable repo badge** | ✅ | ❌ | ❌ | ❌ |
|
|
115
|
+
| **CI gate (`--max-complexity`)** | ✅ | ❌ | ❌ | ❌ |
|
|
116
|
+
| Zero install deps beyond one `pip` | ✅ | (binary) | (binary) | (perl) |
|
|
117
|
+
|
|
118
|
+
## Share it: badges & reports
|
|
119
|
+
|
|
120
|
+
Generate a self-contained SVG badge — no shields.io round-trip, no tracking:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
repoglance --badge assets/badge.svg
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+

|
|
127
|
+
|
|
128
|
+
Export the full report as a standalone file to drop in a PR or wiki:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
repoglance --svg report.svg # vector, pixel-perfect
|
|
132
|
+
repoglance --html report.html # opens in any browser
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Guard your codebase in CI
|
|
136
|
+
|
|
137
|
+
Fail the build when complexity or TODO debt crosses a line:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
repoglance --ci --max-complexity 25 --max-todos 100
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```yaml
|
|
144
|
+
# .github/workflows/quality.yml
|
|
145
|
+
- run: pip install repoglance
|
|
146
|
+
- run: repoglance --ci --max-complexity 25
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Exit code `0` = clean, `2` = a threshold was exceeded.
|
|
150
|
+
|
|
151
|
+
## Integrations
|
|
152
|
+
|
|
153
|
+
### GitHub Action — comment on every PR
|
|
154
|
+
|
|
155
|
+
Drop repoglance into any repo. It posts a sticky report comment on pull requests
|
|
156
|
+
and can gate the build:
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
# .github/workflows/repoglance.yml
|
|
160
|
+
name: repoglance
|
|
161
|
+
on: [pull_request]
|
|
162
|
+
permissions:
|
|
163
|
+
contents: read
|
|
164
|
+
pull-requests: write
|
|
165
|
+
jobs:
|
|
166
|
+
analyze:
|
|
167
|
+
runs-on: ubuntu-latest
|
|
168
|
+
steps:
|
|
169
|
+
- uses: actions/checkout@v4
|
|
170
|
+
- uses: SRJ-ai/repolens@main
|
|
171
|
+
with:
|
|
172
|
+
fail-under: "70" # optional health gate
|
|
173
|
+
max-complexity: "25" # optional complexity gate
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The report also lands in the workflow's **job summary** every run.
|
|
177
|
+
|
|
178
|
+
### pre-commit hook
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
# .pre-commit-config.yaml
|
|
182
|
+
repos:
|
|
183
|
+
- repo: https://github.com/SRJ-ai/repolens
|
|
184
|
+
rev: v0.2.0
|
|
185
|
+
hooks:
|
|
186
|
+
- id: repoglance
|
|
187
|
+
args: ["--ci", "--fail-under", "70"]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Self-updating badge
|
|
191
|
+
|
|
192
|
+
Commit a shields endpoint file and point a dynamic badge at it — the badge
|
|
193
|
+
refreshes itself, no service to run:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
repoglance --badge-json .repolens-badge.json # commit this file
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```markdown
|
|
200
|
+

|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Markdown anywhere
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
repoglance --md # paste into a PR, wiki, or Slack
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Design goals
|
|
210
|
+
|
|
211
|
+
- **Fast** — a single `os.walk`, no external services.
|
|
212
|
+
- **Honest** — no network, no telemetry, no surprise writes.
|
|
213
|
+
- **Pretty** — powered by [rich](https://github.com/Textualize/rich).
|
|
214
|
+
- **Scriptable** — everything the report shows is available as `--json`.
|
|
215
|
+
|
|
216
|
+
## Contributing
|
|
217
|
+
|
|
218
|
+
Adding a language is a one-line change in `languages.py`. PRs welcome — see
|
|
219
|
+
[CONTRIBUTING.md](CONTRIBUTING.md).
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
[MIT](LICENSE) © repoglance contributors
|