gitraze 0.0.1__py3-none-any.whl

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.
gitraze/__init__.py ADDED
File without changes
gitraze/cli.py ADDED
@@ -0,0 +1,78 @@
1
+ import argparse
2
+ from gitraze.utils.helpers import pretty_print
3
+ from gitraze.modules.user import get_user
4
+
5
+
6
+ def main():
7
+ parser = argparse.ArgumentParser(
8
+ prog="gitraze",
9
+ description="GitRaze CLI Tool"
10
+ )
11
+
12
+ # Global flag
13
+ parser.add_argument(
14
+ "--version",
15
+ action="version",
16
+ version="gitraze 0.0.1"
17
+ )
18
+
19
+ subparsers = parser.add_subparsers(dest="command", required=True)
20
+
21
+ # --- USER ---
22
+ user_parser = subparsers.add_parser("user", help="Fetch user info (GitHub username)")
23
+ user_parser.add_argument("username")
24
+
25
+ # --- REPO ---
26
+ repo_parser = subparsers.add_parser("repo", help="Fetch repo info (Repository in owner/repo format)")
27
+ repo_parser.add_argument("repo")
28
+
29
+ # --- SEARCH ---
30
+ search_parser = subparsers.add_parser("search", help="Search GitHub")
31
+ search_parser.add_argument("query", nargs="+")
32
+
33
+ # --- ANALYZE ---
34
+ analyze_parser = subparsers.add_parser("analyze", help="Analyze target")
35
+ analyze_parser.add_argument("target", nargs="+")
36
+
37
+ args = parser.parse_args()
38
+
39
+ # --- ROUTING ---
40
+ if args.command == "user":
41
+ handle_user(args)
42
+ elif args.command == "repo":
43
+ handle_repo(args)
44
+ elif args.command == "search":
45
+ handle_search(args)
46
+ elif args.command == "analyze":
47
+ handle_analysis(args)
48
+ else:
49
+ parser.print_help()
50
+
51
+
52
+ # --- HANDLERS ---
53
+
54
+ def handle_user(args):
55
+ data = get_user(args.username)
56
+
57
+ if "error" in data:
58
+ print(data["error"])
59
+ return
60
+
61
+ pretty_print(data, title=f"User: {args.username}")
62
+
63
+
64
+ def handle_repo(args):
65
+ print(f"[REPO] Fetching data for {args.repo}")
66
+ print("Not implemented yet")
67
+
68
+
69
+ def handle_search(args):
70
+ query = " ".join(args.query)
71
+ print(f"[SEARCH] Searching for '{query}'")
72
+ print("Not implemented yet")
73
+
74
+
75
+ def handle_analysis(args):
76
+ target = " ".join(args.target)
77
+ print(f"[ANALYZE] Analyzing '{target}'")
78
+ print("Not implemented yet")
gitraze/config.py ADDED
@@ -0,0 +1,7 @@
1
+ # config.py
2
+ REST_BASE_URL = "https://api.github.com"
3
+ GRAPHQL_URL = "https://api.github.com/graphql"
4
+ DEFAULT_TIMEOUT = 10
5
+ DEFAULT_HEADERS = {
6
+ "Accept": "application/vnd.github+json"
7
+ }
File without changes
@@ -0,0 +1 @@
1
+ # api_graphql.py
@@ -0,0 +1,34 @@
1
+ # api_rest.py
2
+ import requests
3
+ from gitraze.config import REST_BASE_URL, DEFAULT_HEADERS, DEFAULT_TIMEOUT
4
+
5
+
6
+ import requests
7
+
8
+ def get_user(username):
9
+ url = f"{REST_BASE_URL}/users/{username}"
10
+
11
+ try:
12
+ response = requests.get(
13
+ url,
14
+ headers=DEFAULT_HEADERS,
15
+ timeout=DEFAULT_TIMEOUT
16
+ )
17
+ response.raise_for_status()
18
+ return response.json()
19
+
20
+ except requests.exceptions.Timeout:
21
+ return {"error": "Request timed out. Check your connection."}
22
+
23
+ except requests.exceptions.RequestException as e:
24
+ return {"error": f"Request failed: {str(e)}"}
25
+
26
+
27
+ def get_repo(owner, repo):
28
+ url = f"{REST_BASE_URL}/repos/{owner}/{repo}"
29
+ response = requests.get(url, headers=DEFAULT_HEADERS, timeout=DEFAULT_TIMEOUT)
30
+
31
+ if response.status_code != 200:
32
+ return {"error": f"Failed to fetch repo: {response.status_code}"}
33
+
34
+ return response.json()
File without changes
@@ -0,0 +1 @@
1
+ # analytics.py
@@ -0,0 +1 @@
1
+ # repo.py
@@ -0,0 +1 @@
1
+ # search.py
@@ -0,0 +1,28 @@
1
+ # user.py
2
+ from gitraze.utils.helpers import format_date
3
+ from gitraze.core.api_rest import get_user as rest_get_user
4
+
5
+ def get_user(username):
6
+ data = rest_get_user(username)
7
+
8
+ if "error" in data:
9
+ return data
10
+
11
+ return {
12
+ "name": data.get("name"),
13
+ "login": data.get("login"),
14
+ "id": data.get("id"),
15
+ "node_id": data.get("node_id"),
16
+ "type": data.get("type"),
17
+ "user_view_type": data.get("user_view_type"),
18
+ "bio": data.get("bio"),
19
+ "followers": data.get("followers"),
20
+ "following": data.get("following"),
21
+ "public_repos": data.get("public_repos"),
22
+ "public_gists": data.get("public_gists"),
23
+ "location": data.get("location"),
24
+ "profile_url": data.get("html_url"),
25
+ "created_at": format_date(data.get("created_at")),
26
+ "email": data.get("email"),
27
+ "twitter_username": data.get("twitter_username")
28
+ }
File without changes
@@ -0,0 +1,35 @@
1
+ # helpers.py
2
+ from datetime import datetime
3
+ from colorama import Fore, Style, init
4
+
5
+ init(autoreset=True)
6
+
7
+
8
+ def pretty_print(data, title=None):
9
+ if not isinstance(data, dict):
10
+ print(Fore.RED + "Invalid data format")
11
+ return
12
+
13
+ # Title
14
+ if title:
15
+ print(Fore.CYAN + Style.BRIGHT + f"\n{title}")
16
+ print(Fore.CYAN + "-" * len(title))
17
+
18
+ # Calculate max key length for alignment
19
+ max_key_len = max(len(str(key)) for key in data.keys())
20
+
21
+ # Print key-value pairs
22
+ for key, value in data.items():
23
+ key_str = f"{key.capitalize():<{max_key_len}}"
24
+ print(
25
+ Fore.YELLOW + key_str +
26
+ Fore.WHITE + " : " +
27
+ Fore.GREEN + str(value)
28
+ )
29
+
30
+ print() # spacing
31
+
32
+ def format_date(date_str):
33
+ if not date_str:
34
+ return None
35
+ return datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%SZ").strftime("%d %b %Y")
@@ -0,0 +1,55 @@
1
+ Metadata-Version: 2.4
2
+ Name: gitraze
3
+ Version: 0.0.1
4
+ Summary: A CLI and Python library for GitHub reconnaissance, search, and analysis
5
+ Author: AK Pandey
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/akpandey-dev/gitraze
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests
14
+ Requires-Dist: colorama
15
+
16
+ # Gitraze
17
+
18
+ Gitraze is a fast, hacker-style CLI tool for exploring, analyzing, and extracting insights from GitHub data using REST and GraphQL APIs.
19
+
20
+ > Currently in early development
21
+
22
+ ## Features
23
+
24
+ * Modular architecture for easy extension
25
+ * CLI-based interaction
26
+ * GitHub API integration (REST & GraphQL)
27
+ * Repo, user, search, and analytics modules
28
+
29
+ ## Installation
30
+
31
+ ```bash id="gq3k8x"
32
+ pip install gitraze
33
+ ```
34
+
35
+ > Not yet available on PyPI
36
+
37
+ ## Usage
38
+
39
+ ```bash id="k2znw0"
40
+ gitraze --help
41
+ ```
42
+
43
+ > CLI under development
44
+
45
+ ## Development
46
+
47
+ ```bash id="x8l2qp"
48
+ git clone https://github.com/akpandey-dev/gitraze.git
49
+ cd gitraze
50
+ pip install -e .
51
+ ```
52
+
53
+ ## License
54
+
55
+ MIT
@@ -0,0 +1,18 @@
1
+ gitraze/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ gitraze/cli.py,sha256=bSCxI5DpvfzYnHwpYCQzcCUbydphVfl7moTxZdV8iJo,2051
3
+ gitraze/config.py,sha256=oN0DyLqmB3jDqrL5N5tE32KtGuF41ScoFz8XXjH_ixo,192
4
+ gitraze/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ gitraze/core/api_graphql.py,sha256=LTn2wVxvO92mAgQx8LpafiLtLfXjnaYyHVrLzsTV_7U,18
6
+ gitraze/core/api_rest.py,sha256=Do-aQgio7fo31ZFp5tBuBZQoyYUqFMS04OgW5Ak7_08,957
7
+ gitraze/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ gitraze/modules/analytics.py,sha256=QYyzSjUygJWdIKuT4xqJZppwUawlyzDmcXppS-v2F1U,16
9
+ gitraze/modules/repo.py,sha256=zsdincCcPJknam9lIgBM8ImBv3ERfiQX9jeMHMiEXgM,11
10
+ gitraze/modules/search.py,sha256=mOejyc2sQIpjfKB6DL_hkswGQK2cbEEFQEq4HI3Zo-0,13
11
+ gitraze/modules/user.py,sha256=V2a1EVvT1LuPjbNmGpwhGajI2Pbxk3mGmQvWq2mEBS4,955
12
+ gitraze/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ gitraze/utils/helpers.py,sha256=cATpcQ4NQoTV-QV0ZqysLDB1uwq3A_Ju77Z0C3d1Y3E,930
14
+ gitraze-0.0.1.dist-info/METADATA,sha256=JwDyddH1VeNhTwDkdKtXCPaskHWPlFOLxqKgrRdgV_E,1194
15
+ gitraze-0.0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
16
+ gitraze-0.0.1.dist-info/entry_points.txt,sha256=raebcVZgYkU8OPxr171hs40YuVqdvr8r5Z3dRaTTDtQ,45
17
+ gitraze-0.0.1.dist-info/top_level.txt,sha256=-3Fd9wZPBxk80WkgpMLnGG-XlS-if38zq9zHm9qNQcQ,8
18
+ gitraze-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ gitraze = gitraze.cli:main
@@ -0,0 +1 @@
1
+ gitraze