Skip to content

Commit 4c0e0e5

Browse files
authored
Merge pull request #214 from calchiwo/feat/github-file-analysis
feat(cli, github): add GitHub file analysis with strict routing, validation, and direct fetch pipeline
2 parents 812418d + 4eaf2b9 commit 4c0e0e5

8 files changed

Lines changed: 585 additions & 43 deletions

File tree

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ explainthisrepo github.com/owner/repo
195195
explainthisrepo https://github.com/owner/repo/issues/123
196196
explainthisrepo https://github.com/owner/repo?tab=readme
197197
explainthisrepo git@github.com:owner/repo.git
198+
explainthisrepo owner/repo/path/to/file.py
198199
explainthisrepo .
199200
explainthisrepo ./path/to/directory
201+
explainthisrepo ./path/to/file.py
200202
```
201203

202204
All inputs are normalized internally to `owner/repo`.
@@ -344,6 +346,38 @@ When analyzing a file:
344346
- The explanation focuses on purpose, logic, and behavior
345347
- This makes it easy to understand unfamiliar files without scanning entire repositories.
346348

349+
## GitHub File Analysis
350+
351+
ExplainThisRepo can analyze a single file directly from a GitHub repository without cloning it.
352+
353+
```bash
354+
explainthisrepo owner/repo/path/to/file.py
355+
```
356+
Supports all explanation modes:
357+
358+
```bash
359+
explainthisrepo owner/repo/path/to/file.py --quick
360+
explainthisrepo owner/repo/path/to/file.py --simple
361+
explainthisrepo owner/repo/path/to/file.py --detailed
362+
```
363+
364+
When analyzing a GitHub file:
365+
- The file is fetched directly via the GitHub API
366+
- Only valid text files are processed (binary files are rejected)
367+
- File size is capped to prevent unsafe or truncated analysis
368+
- The explanation focuses on the file’s purpose, logic, and behavior
369+
370+
Input format must be:
371+
372+
```bash
373+
explainthisrepo owner/repo/path/to/file
374+
```
375+
376+
This is different from local file analysis:
377+
378+
```bash
379+
explainthisrepo ./path/to/file.py
380+
```
347381
### Custom output
348382

349383
`--output`, `-o` → Specify output file or directory (default: `EXPLAIN.md`)

_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "0.22.5"
1+
VERSION = "0.23.0"

explain_this_repo/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "0.22.5"
1+
VERSION = "0.23.0"

0 commit comments

Comments
 (0)