devbrief 0.1.0__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.
@@ -0,0 +1,11 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ .env
@@ -0,0 +1 @@
1
+ 3.12
devbrief-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sebastien Claro (s3bc40)
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,169 @@
1
+ Metadata-Version: 2.4
2
+ Name: devbrief
3
+ Version: 0.1.0
4
+ Summary: Generate a human-readable brief for any GitHub repository using Claude AI
5
+ Project-URL: Homepage, https://github.com/s3bc40/devbrief
6
+ Project-URL: Repository, https://github.com/s3bc40/devbrief
7
+ Author-email: "Sebastien Claro (s3bc40)" <s3bc40@gmail.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,cli,developer-tools,github
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.12
14
+ Requires-Dist: anthropic>=0.84.0
15
+ Requires-Dist: click>=8.3.1
16
+ Requires-Dist: python-dotenv>=1.2.2
17
+ Requires-Dist: requests>=2.32.5
18
+ Requires-Dist: rich>=14.3.3
19
+ Description-Content-Type: text/markdown
20
+
21
+ # devbrief
22
+
23
+ > Generate a human-readable project brief for any GitHub repository using Claude AI.
24
+
25
+ `devbrief` takes a GitHub URL, pulls the repository metadata, README, and file tree, then asks Claude to produce a structured brief — covering what the project does, its tech stack, how to get started, and its limitations — directly in your terminal.
26
+
27
+ ---
28
+
29
+ ## Installation
30
+
31
+ ### pip
32
+
33
+ ```bash
34
+ pip install devbrief
35
+ ```
36
+
37
+ ### uvx (run without installing)
38
+
39
+ ```bash
40
+ uvx devbrief <github-url>
41
+ ```
42
+
43
+ ### uv (install globally)
44
+
45
+ ```bash
46
+ uv tool install devbrief
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Prerequisites
52
+
53
+ An [Anthropic API key](https://console.anthropic.com/) is required.
54
+
55
+ ```bash
56
+ export ANTHROPIC_API_KEY=sk-ant-...
57
+ ```
58
+
59
+ Or place it in a `.env` file at your working directory:
60
+
61
+ ```
62
+ ANTHROPIC_API_KEY=sk-ant-...
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Usage
68
+
69
+ ```bash
70
+ devbrief <github-url> [--output FILE]
71
+ ```
72
+
73
+ ### Examples
74
+
75
+ ```bash
76
+ # Print the brief to the terminal
77
+ devbrief https://github.com/anthropics/anthropic-sdk-python
78
+
79
+ # Save the brief as a markdown file
80
+ devbrief https://github.com/astral-sh/uv --output uv-brief.md
81
+ ```
82
+
83
+ ### Options
84
+
85
+ | Option | Short | Description |
86
+ |---|---|---|
87
+ | `--output FILE` | `-o` | Save the brief as a markdown file |
88
+ | `--help` | | Show usage and exit |
89
+
90
+ ### Output sections
91
+
92
+ Each generated brief contains:
93
+
94
+ - **One-line description** — a crisp summary of the project
95
+ - **Problem it solves** — the core need being addressed
96
+ - **Tech stack** — detected languages, frameworks, and tools
97
+ - **Getting started** — steps extracted from the README
98
+ - **Who would find it useful** — the target audience
99
+ - **Limitations / potential improvements** — honest trade-offs
100
+
101
+ ---
102
+
103
+ ## How it works
104
+
105
+ ```
106
+ GitHub URL
107
+
108
+ ├── /repos/:owner/:repo → name, description, stars, language, topics
109
+ ├── /repos/:owner/:repo/readme → decoded README content (first 3000 chars)
110
+ └── /repos/:owner/:repo/contents → top-level file tree
111
+
112
+ └── Structured prompt → Claude claude-opus-4-6 → Rich terminal output
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Development
118
+
119
+ Requires [uv](https://docs.astral.sh/uv/).
120
+
121
+ ```bash
122
+ git clone https://github.com/s3bc40/devbrief
123
+ cd devbrief
124
+ uv sync
125
+ ```
126
+
127
+ ### Run locally
128
+
129
+ ```bash
130
+ uv run devbrief https://github.com/s3bc40/devbrief
131
+ ```
132
+
133
+ ### Run tests
134
+
135
+ ```bash
136
+ uv run pytest
137
+ ```
138
+
139
+ Tests cover URL parsing, GitHub API response mapping, edge cases (missing README, empty file tree), and Rich display output. No real API calls are made — all HTTP responses are mocked.
140
+
141
+ ### Project structure
142
+
143
+ ```
144
+ src/devbrief/
145
+ ├── main.py # Click CLI entry point
146
+ ├── github.py # GitHub REST API fetchers
147
+ ├── brief.py # Prompt construction and Claude API call
148
+ └── display.py # Rich terminal rendering
149
+ tests/
150
+ ├── test_github.py
151
+ └── test_display.py
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Contributing
157
+
158
+ 1. Fork the repository and create a branch from `main`.
159
+ 2. Make focused commits with explicit messages (one concern per commit).
160
+ 3. Add or update tests for any changed behaviour.
161
+ 4. Open a pull request — describe the problem and your solution.
162
+
163
+ Please do not open issues to ask for new AI providers or models; the project is intentionally scoped to the Anthropic API.
164
+
165
+ ---
166
+
167
+ ## License
168
+
169
+ MIT — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,149 @@
1
+ # devbrief
2
+
3
+ > Generate a human-readable project brief for any GitHub repository using Claude AI.
4
+
5
+ `devbrief` takes a GitHub URL, pulls the repository metadata, README, and file tree, then asks Claude to produce a structured brief — covering what the project does, its tech stack, how to get started, and its limitations — directly in your terminal.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ### pip
12
+
13
+ ```bash
14
+ pip install devbrief
15
+ ```
16
+
17
+ ### uvx (run without installing)
18
+
19
+ ```bash
20
+ uvx devbrief <github-url>
21
+ ```
22
+
23
+ ### uv (install globally)
24
+
25
+ ```bash
26
+ uv tool install devbrief
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Prerequisites
32
+
33
+ An [Anthropic API key](https://console.anthropic.com/) is required.
34
+
35
+ ```bash
36
+ export ANTHROPIC_API_KEY=sk-ant-...
37
+ ```
38
+
39
+ Or place it in a `.env` file at your working directory:
40
+
41
+ ```
42
+ ANTHROPIC_API_KEY=sk-ant-...
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Usage
48
+
49
+ ```bash
50
+ devbrief <github-url> [--output FILE]
51
+ ```
52
+
53
+ ### Examples
54
+
55
+ ```bash
56
+ # Print the brief to the terminal
57
+ devbrief https://github.com/anthropics/anthropic-sdk-python
58
+
59
+ # Save the brief as a markdown file
60
+ devbrief https://github.com/astral-sh/uv --output uv-brief.md
61
+ ```
62
+
63
+ ### Options
64
+
65
+ | Option | Short | Description |
66
+ |---|---|---|
67
+ | `--output FILE` | `-o` | Save the brief as a markdown file |
68
+ | `--help` | | Show usage and exit |
69
+
70
+ ### Output sections
71
+
72
+ Each generated brief contains:
73
+
74
+ - **One-line description** — a crisp summary of the project
75
+ - **Problem it solves** — the core need being addressed
76
+ - **Tech stack** — detected languages, frameworks, and tools
77
+ - **Getting started** — steps extracted from the README
78
+ - **Who would find it useful** — the target audience
79
+ - **Limitations / potential improvements** — honest trade-offs
80
+
81
+ ---
82
+
83
+ ## How it works
84
+
85
+ ```
86
+ GitHub URL
87
+
88
+ ├── /repos/:owner/:repo → name, description, stars, language, topics
89
+ ├── /repos/:owner/:repo/readme → decoded README content (first 3000 chars)
90
+ └── /repos/:owner/:repo/contents → top-level file tree
91
+
92
+ └── Structured prompt → Claude claude-opus-4-6 → Rich terminal output
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Development
98
+
99
+ Requires [uv](https://docs.astral.sh/uv/).
100
+
101
+ ```bash
102
+ git clone https://github.com/s3bc40/devbrief
103
+ cd devbrief
104
+ uv sync
105
+ ```
106
+
107
+ ### Run locally
108
+
109
+ ```bash
110
+ uv run devbrief https://github.com/s3bc40/devbrief
111
+ ```
112
+
113
+ ### Run tests
114
+
115
+ ```bash
116
+ uv run pytest
117
+ ```
118
+
119
+ Tests cover URL parsing, GitHub API response mapping, edge cases (missing README, empty file tree), and Rich display output. No real API calls are made — all HTTP responses are mocked.
120
+
121
+ ### Project structure
122
+
123
+ ```
124
+ src/devbrief/
125
+ ├── main.py # Click CLI entry point
126
+ ├── github.py # GitHub REST API fetchers
127
+ ├── brief.py # Prompt construction and Claude API call
128
+ └── display.py # Rich terminal rendering
129
+ tests/
130
+ ├── test_github.py
131
+ └── test_display.py
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Contributing
137
+
138
+ 1. Fork the repository and create a branch from `main`.
139
+ 2. Make focused commits with explicit messages (one concern per commit).
140
+ 3. Add or update tests for any changed behaviour.
141
+ 4. Open a pull request — describe the problem and your solution.
142
+
143
+ Please do not open issues to ask for new AI providers or models; the project is intentionally scoped to the Anthropic API.
144
+
145
+ ---
146
+
147
+ ## License
148
+
149
+ MIT — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,43 @@
1
+ [project]
2
+ name = "devbrief"
3
+ version = "0.1.0"
4
+ description = "Generate a human-readable brief for any GitHub repository using Claude AI"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "anthropic>=0.84.0",
9
+ "click>=8.3.1",
10
+ "python-dotenv>=1.2.2",
11
+ "requests>=2.32.5",
12
+ "rich>=14.3.3",
13
+ ]
14
+ license = { text = "MIT" }
15
+ authors = [
16
+ { name = "Sebastien Claro (s3bc40)", email = "s3bc40@gmail.com" }
17
+ ]
18
+ keywords = ["cli", "github", "ai", "developer-tools"]
19
+ classifiers = [
20
+ "Programming Language :: Python :: 3",
21
+ "License :: OSI Approved :: MIT License",
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/s3bc40/devbrief"
26
+ Repository = "https://github.com/s3bc40/devbrief"
27
+
28
+ [project.scripts]
29
+ devbrief = "devbrief.main:cli"
30
+
31
+ [build-system]
32
+ requires = ["hatchling"]
33
+ build-backend = "hatchling.build"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/devbrief"]
37
+
38
+ [dependency-groups]
39
+ dev = [
40
+ "pytest>=9.0.2",
41
+ "pytest-mock>=3.15.1",
42
+ "twine>=6.2.0",
43
+ ]
File without changes
@@ -0,0 +1,48 @@
1
+ import os
2
+ import anthropic
3
+
4
+
5
+ def build_prompt(repo: dict, readme: str, file_tree: list[str]) -> str:
6
+ readme_snippet = readme[:3000] if readme else "No README found."
7
+ tree_str = "\n".join(file_tree) if file_tree else "No file tree available."
8
+ topics_str = ", ".join(repo["topics"]) if repo["topics"] else "none"
9
+
10
+ return f"""You are a senior developer writing a concise project brief for a technical audience.
11
+
12
+ Repository: {repo['name']}
13
+ Description: {repo['description'] or 'No description provided.'}
14
+ Stars: {repo['stars']}
15
+ Primary language: {repo['language'] or 'unknown'}
16
+ Topics: {topics_str}
17
+
18
+ Top-level file tree:
19
+ {tree_str}
20
+
21
+ README (first 3000 chars):
22
+ {readme_snippet}
23
+
24
+ Write a structured project brief with exactly these sections:
25
+ 1. **One-line description** – A single crisp sentence summarizing the project.
26
+ 2. **Problem it solves** – 2-3 sentences on the core problem addressed.
27
+ 3. **Tech stack** – Bullet list of detected technologies/frameworks.
28
+ 4. **Getting started** – 3-5 steps extracted or inferred from the README.
29
+ 5. **Who would find it useful** – 2-3 sentences on the target audience.
30
+ 6. **Limitations / potential improvements** – 3-5 bullet points.
31
+
32
+ Be concise. Do not repeat the section headers verbatim — use them as guidance only."""
33
+
34
+
35
+ def generate_brief(repo: dict, readme: str, file_tree: list[str]) -> str:
36
+ api_key = os.environ.get("ANTHROPIC_API_KEY")
37
+ if not api_key:
38
+ raise EnvironmentError("ANTHROPIC_API_KEY environment variable is not set.")
39
+
40
+ client = anthropic.Anthropic(api_key=api_key)
41
+ prompt = build_prompt(repo, readme, file_tree)
42
+
43
+ message = client.messages.create(
44
+ model="claude-opus-4-6",
45
+ max_tokens=1024,
46
+ messages=[{"role": "user", "content": prompt}],
47
+ )
48
+ return message.content[0].text
@@ -0,0 +1,30 @@
1
+ from rich.console import Console
2
+ from rich.panel import Panel
3
+ from rich.markdown import Markdown
4
+ from rich.rule import Rule
5
+ from rich import print as rprint
6
+
7
+ console = Console()
8
+
9
+
10
+ def show_fetching(url: str) -> None:
11
+ console.print(f"\n[bold cyan]Fetching data for:[/bold cyan] {url}")
12
+
13
+
14
+ def show_generating() -> None:
15
+ console.print("[bold yellow]Generating brief with Claude...[/bold yellow]\n")
16
+
17
+
18
+ def show_brief(repo_name: str, brief_text: str, elapsed: float) -> None:
19
+ console.print(Rule(f"[bold green] DevBrief: {repo_name} [/bold green]"))
20
+ console.print(Panel(Markdown(brief_text), border_style="green", padding=(1, 2)))
21
+ console.print(Rule(style="green"))
22
+ console.print(f"[dim]Brief generated in {elapsed:.1f}s[/dim]\n")
23
+
24
+
25
+ def show_saved(path: str) -> None:
26
+ console.print(f"[dim]Saved to[/dim] [bold]{path}[/bold]\n")
27
+
28
+
29
+ def show_error(message: str) -> None:
30
+ rprint(f"\n[bold red]Error:[/bold red] {message}\n")
@@ -0,0 +1,48 @@
1
+ import requests
2
+
3
+
4
+ def parse_repo_url(url: str) -> tuple[str, str]:
5
+ """Extract owner and repo name from a GitHub URL."""
6
+ parts = url.rstrip("/").split("/")
7
+ if len(parts) < 2:
8
+ raise ValueError(f"Invalid GitHub URL: {url}")
9
+ return parts[-2], parts[-1]
10
+
11
+
12
+ def fetch_repo_data(owner: str, repo: str) -> dict:
13
+ """Fetch repository metadata from GitHub API."""
14
+ url = f"https://api.github.com/repos/{owner}/{repo}"
15
+ response = requests.get(url, timeout=10)
16
+ response.raise_for_status()
17
+ data = response.json()
18
+ return {
19
+ "name": data.get("name", ""),
20
+ "description": data.get("description", ""),
21
+ "stars": data.get("stargazers_count", 0),
22
+ "language": data.get("language", ""),
23
+ "topics": data.get("topics", []),
24
+ "homepage": data.get("homepage", ""),
25
+ }
26
+
27
+
28
+ def fetch_readme(owner: str, repo: str) -> str:
29
+ """Fetch README content from GitHub API (decoded from base64)."""
30
+ url = f"https://api.github.com/repos/{owner}/{repo}/readme"
31
+ response = requests.get(url, timeout=10)
32
+ if response.status_code == 404:
33
+ return ""
34
+ response.raise_for_status()
35
+ import base64
36
+ content = response.json().get("content", "")
37
+ return base64.b64decode(content).decode("utf-8", errors="replace")
38
+
39
+
40
+ def fetch_file_tree(owner: str, repo: str) -> list[str]:
41
+ """Fetch top-level file/directory names from GitHub API."""
42
+ url = f"https://api.github.com/repos/{owner}/{repo}/contents"
43
+ response = requests.get(url, timeout=10)
44
+ if response.status_code == 404:
45
+ return []
46
+ response.raise_for_status()
47
+ items = response.json()
48
+ return [item["name"] for item in items if isinstance(item, dict)]
@@ -0,0 +1,49 @@
1
+ import time
2
+ import click
3
+ from dotenv import load_dotenv
4
+
5
+ from devbrief.github import parse_repo_url, fetch_repo_data, fetch_readme, fetch_file_tree
6
+ from devbrief.brief import generate_brief
7
+ from devbrief.display import show_fetching, show_generating, show_brief, show_error, show_saved
8
+
9
+ load_dotenv()
10
+
11
+
12
+ @click.command()
13
+ @click.argument("github_url")
14
+ @click.option("--output", "-o", default=None, metavar="FILE", help="Save the brief to a markdown file.")
15
+ def cli(github_url: str, output: str | None) -> None:
16
+ """Generate a human-readable brief for a GitHub repository."""
17
+ try:
18
+ show_fetching(github_url)
19
+ owner, repo_name = parse_repo_url(github_url)
20
+
21
+ repo = fetch_repo_data(owner, repo_name)
22
+ readme = fetch_readme(owner, repo_name)
23
+ file_tree = fetch_file_tree(owner, repo_name)
24
+
25
+ show_generating()
26
+ start = time.monotonic()
27
+ brief = generate_brief(repo, readme, file_tree)
28
+ elapsed = time.monotonic() - start
29
+ show_brief(repo["name"], brief, elapsed)
30
+
31
+ if output:
32
+ md = f"# {repo['name']}\n\n> {github_url}\n\n{brief}\n"
33
+ with open(output, "w", encoding="utf-8") as f:
34
+ f.write(md)
35
+ show_saved(output)
36
+
37
+ except ValueError as e:
38
+ show_error(str(e))
39
+ raise SystemExit(1)
40
+ except EnvironmentError as e:
41
+ show_error(str(e))
42
+ raise SystemExit(1)
43
+ except Exception as e:
44
+ show_error(f"Unexpected error: {e}")
45
+ raise SystemExit(1)
46
+
47
+
48
+ if __name__ == "__main__":
49
+ cli()
File without changes
@@ -0,0 +1,94 @@
1
+ import pytest
2
+ from io import StringIO
3
+ from rich.console import Console
4
+
5
+
6
+ # ---------------------------------------------------------------------------
7
+ # Helpers
8
+ # ---------------------------------------------------------------------------
9
+
10
+ def _capture(fn, *args, **kwargs) -> str:
11
+ """Run a display function with a plain-text Rich console and capture output."""
12
+ buf = StringIO()
13
+ console = Console(file=buf, highlight=False, markup=True, no_color=True)
14
+
15
+ import devbrief.display as display_module
16
+ original = display_module.console
17
+ display_module.console = console
18
+ try:
19
+ fn(*args, **kwargs)
20
+ finally:
21
+ display_module.console = original
22
+
23
+ return buf.getvalue()
24
+
25
+
26
+ # ---------------------------------------------------------------------------
27
+ # show_fetching
28
+ # ---------------------------------------------------------------------------
29
+
30
+ class TestShowFetching:
31
+ def test_contains_url(self):
32
+ from devbrief.display import show_fetching
33
+ out = _capture(show_fetching, "https://github.com/owner/repo")
34
+ assert "https://github.com/owner/repo" in out
35
+
36
+
37
+ # ---------------------------------------------------------------------------
38
+ # show_generating
39
+ # ---------------------------------------------------------------------------
40
+
41
+ class TestShowGenerating:
42
+ def test_contains_generating_text(self):
43
+ from devbrief.display import show_generating
44
+ out = _capture(show_generating)
45
+ assert "Generating" in out
46
+
47
+
48
+ # ---------------------------------------------------------------------------
49
+ # show_brief
50
+ # ---------------------------------------------------------------------------
51
+
52
+ class TestShowBrief:
53
+ def test_contains_repo_name(self):
54
+ from devbrief.display import show_brief
55
+ out = _capture(show_brief, "my-repo", "Some brief text.", 2.5)
56
+ assert "my-repo" in out
57
+
58
+ def test_contains_brief_text(self):
59
+ from devbrief.display import show_brief
60
+ out = _capture(show_brief, "repo", "**Problem:** it crashes.", 1.0)
61
+ assert "Problem" in out
62
+
63
+ def test_displays_elapsed_time(self):
64
+ from devbrief.display import show_brief
65
+ out = _capture(show_brief, "repo", "brief", 3.7)
66
+ assert "3.7s" in out
67
+
68
+ def test_elapsed_time_format(self):
69
+ from devbrief.display import show_brief
70
+ out = _capture(show_brief, "repo", "brief", 10.0)
71
+ assert "10.0s" in out
72
+
73
+
74
+ # ---------------------------------------------------------------------------
75
+ # show_saved
76
+ # ---------------------------------------------------------------------------
77
+
78
+ class TestShowSaved:
79
+ def test_contains_file_path(self):
80
+ from devbrief.display import show_saved
81
+ out = _capture(show_saved, "output/brief.md")
82
+ assert "output/brief.md" in out
83
+
84
+
85
+ # ---------------------------------------------------------------------------
86
+ # show_error
87
+ # ---------------------------------------------------------------------------
88
+
89
+ class TestShowError:
90
+ def test_contains_error_message(self, capsys):
91
+ from devbrief.display import show_error
92
+ show_error("something went wrong")
93
+ captured = capsys.readouterr()
94
+ assert "something went wrong" in captured.out