cpnlookup 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,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: cpnlookup
3
+ Version: 0.1.0
4
+ Summary: Local CLI tool for GitHub RAG, Call Graphs, and Codebase querying.
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: click>=8.0.0
8
+ Requires-Dist: rich>=13.0.0
9
+ Requires-Dist: requests>=2.0.0
File without changes
@@ -0,0 +1,18 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cpnlookup"
7
+ version = "0.1.0"
8
+ description = "Local CLI tool for GitHub RAG, Call Graphs, and Codebase querying."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ dependencies = [
12
+ "click>=8.0.0",
13
+ "rich>=13.0.0",
14
+ "requests>=2.0.0",
15
+ ]
16
+
17
+ [project.scripts]
18
+ lookup = "cpnlookup.cli:cli"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,64 @@
1
+ import click
2
+ from rich.console import Console
3
+ from rich.table import Table
4
+ from cpnlookup.github.client import get_user_repos
5
+ from cpnlookup.utils.config import save_github_token
6
+
7
+ console = Console()
8
+
9
+ @click.group()
10
+ def cli():
11
+ """
12
+ \b
13
+ ██████╗██████╗ ███╗ ██╗██╗ ██████╗ ██████╗ ██╗ ██╗██╗ ██╗██████╗
14
+ ██╔════╝██╔══██╗████╗ ██║██║ ██╔═══██╗██╔═══██╗██║ ██╔╝██║ ██║██╔══██╗
15
+ ██║ ██████╔╝██╔██╗ ██║██║ ██║ ██║██║ ██║█████╔╝ ██║ ██║██████╔╝
16
+ ██║ ██╔═══╝ ██║╚██╗██║██║ ██║ ██║██║ ██║██╔═██╗ ██║ ██║██╔═══╝
17
+ ╚██████╗██║ ██║ ╚████║███████╗╚██████╔╝╚██████╔╝██║ ██╗╚██████╔╝██║
18
+ ╚═════╝╚═╝ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
19
+
20
+ Local CLI tool for GitHub RAG, Call Graphs, and Codebase querying.
21
+ """
22
+ pass
23
+
24
+ # Auth Command
25
+ @cli.command()
26
+ @click.argument('token')
27
+ def auth(token: str):
28
+ """Save your GitHub Personal Access Token."""
29
+ save_github_token(token)
30
+
31
+ console.print("[bold green]✓[/bold green] GitHub token saved successfully to ~/.cpnlookup/auth.json")
32
+
33
+ # Profile Command
34
+ @cli.command()
35
+ @click.argument('username')
36
+ def profile(username: str):
37
+ """List the most recently updated repositories for a GitHub user."""
38
+
39
+ with console.status(f"[bold cyan]Fetching repos for {username}..."):
40
+ try:
41
+ repos = get_user_repos(username)
42
+ except Exception as e:
43
+ console.print(f"[bold red]Error fetching repos:[/] {e}")
44
+ return
45
+
46
+ if not repos:
47
+ console.print(f"[yellow]No repositories found for {username}.[/]")
48
+ return
49
+
50
+ table = Table(title=f"{username}'s Repositories", show_header=True, header_style="bold magenta")
51
+ table.add_column("#", style="dim", width=4)
52
+ table.add_column("Repo Name", style="cyan")
53
+ table.add_column("Stars", justify="right", style="yellow")
54
+ table.add_column("Language", style="green")
55
+
56
+ for i, repo in enumerate(repos[:20], 1):
57
+ table.add_row(
58
+ str(i),
59
+ repo.get("name", "Unknown"),
60
+ str(repo.get("stargazers_count", 0)),
61
+ repo.get("language") or "N/A"
62
+ )
63
+
64
+ console.print(table)
File without changes
@@ -0,0 +1,19 @@
1
+ import requests
2
+ from typing import List, Dict
3
+ from cpnlookup.utils.config import get_github_token
4
+
5
+ def get_user_repos(username: str) -> List[Dict]:
6
+ """Fetches active repositories for a given GitHub user."""
7
+ url = f"https://api.github.com/users/{username}/repos"
8
+ headers = {"Accept": "application/vnd.github.v3+json"}
9
+
10
+ token = get_github_token()
11
+ if token:
12
+ headers["Authorization"] = f"token {token}"
13
+
14
+ params = {"sort": "updated", "per_page": 100}
15
+ response = requests.get(url, headers=headers, params=params)
16
+
17
+ response.raise_for_status()
18
+
19
+ return response.json()
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ import json
2
+ from pathlib import Path
3
+
4
+ def get_global_dir() -> Path:
5
+ global_dir = Path.home() / ".cpnlookup"
6
+ global_dir.mkdir(parents=True, exist_ok=True)
7
+ return global_dir
8
+
9
+ def save_github_token(token: str) -> None:
10
+ auth_file = get_global_dir() / "auth.json"
11
+
12
+ data = {"github_token": token}
13
+ with open(auth_file, "w", encoding="utf-8") as f:
14
+ json.dump(data, f, indent=4)
15
+
16
+ def get_github_token() -> str:
17
+ auth_file = get_global_dir() / "auth.json"
18
+ if not auth_file.exists():
19
+ return ""
20
+
21
+ with open(auth_file, "r", encoding="utf-8") as f:
22
+ try:
23
+ data = json.load(f)
24
+ return data.get("github_token", "")
25
+ except json.JSONDecodeError:
26
+ return ""
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: cpnlookup
3
+ Version: 0.1.0
4
+ Summary: Local CLI tool for GitHub RAG, Call Graphs, and Codebase querying.
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: click>=8.0.0
8
+ Requires-Dist: rich>=13.0.0
9
+ Requires-Dist: requests>=2.0.0
@@ -0,0 +1,18 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/cpnlookup/__init__.py
4
+ src/cpnlookup/cli.py
5
+ src/cpnlookup.egg-info/PKG-INFO
6
+ src/cpnlookup.egg-info/SOURCES.txt
7
+ src/cpnlookup.egg-info/dependency_links.txt
8
+ src/cpnlookup.egg-info/entry_points.txt
9
+ src/cpnlookup.egg-info/requires.txt
10
+ src/cpnlookup.egg-info/top_level.txt
11
+ src/cpnlookup/github/__init__.py
12
+ src/cpnlookup/github/client.py
13
+ src/cpnlookup/indexer/__init__.py
14
+ src/cpnlookup/llm/__init__.py
15
+ src/cpnlookup/output/__init__.py
16
+ src/cpnlookup/retrieval/__init__.py
17
+ src/cpnlookup/utils/__init__.py
18
+ src/cpnlookup/utils/config.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ lookup = cpnlookup.cli:cli
@@ -0,0 +1,3 @@
1
+ click>=8.0.0
2
+ rich>=13.0.0
3
+ requests>=2.0.0
@@ -0,0 +1 @@
1
+ cpnlookup