codyhelp 1.0.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.
- codyhelp-1.0.0/LICENSE +21 -0
- codyhelp-1.0.0/PKG-INFO +8 -0
- codyhelp-1.0.0/README.md +83 -0
- codyhelp-1.0.0/codyhelp/__init__.py +0 -0
- codyhelp-1.0.0/codyhelp/cli.py +106 -0
- codyhelp-1.0.0/codyhelp/prompts.py +13 -0
- codyhelp-1.0.0/codyhelp.egg-info/PKG-INFO +8 -0
- codyhelp-1.0.0/codyhelp.egg-info/SOURCES.txt +12 -0
- codyhelp-1.0.0/codyhelp.egg-info/dependency_links.txt +1 -0
- codyhelp-1.0.0/codyhelp.egg-info/entry_points.txt +2 -0
- codyhelp-1.0.0/codyhelp.egg-info/requires.txt +2 -0
- codyhelp-1.0.0/codyhelp.egg-info/top_level.txt +1 -0
- codyhelp-1.0.0/setup.cfg +4 -0
- codyhelp-1.0.0/setup.py +16 -0
codyhelp-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aleena Anil
|
|
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.
|
codyhelp-1.0.0/PKG-INFO
ADDED
codyhelp-1.0.0/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# CodyHelp
|
|
2
|
+
CodyHelp is a command-line interface tool that can analyse source code files, provide explanations, detect possible bugs, and suggest improvements.
|
|
3
|
+
|
|
4
|
+
Built for CS students and junior developers who are tired of switching between browser tabs, forgetting syntax, and blanking out when asked "can you walk me through this code?"
|
|
5
|
+
|
|
6
|
+
## Goal:
|
|
7
|
+
To build a lightweight developer assistant that works directly in the terminal, similar to modern AI coding tools.
|
|
8
|
+
|
|
9
|
+
## Inspiration:
|
|
10
|
+
As a CS student, I constantly found myself stuck, such as, forgetting syntax, not knowing how to explain my own code, and dreading the "walk me through this" question in interviews.
|
|
11
|
+
|
|
12
|
+
CodyHelp was built to fix that. It's the tool I wish I had when I started coding.
|
|
13
|
+
|
|
14
|
+
## Core Features:
|
|
15
|
+
* Explain code files
|
|
16
|
+
* Interview mode code explanation
|
|
17
|
+
* Detect possible bugs in code
|
|
18
|
+
* Review code and suggest improvements
|
|
19
|
+
* Error explanation from stack traces
|
|
20
|
+
* Support multiple programming languages
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
pip install codyhelp
|
|
24
|
+
|
|
25
|
+
## Setup
|
|
26
|
+
1. Get a free GitHub Models token at github.com/marketplace/models
|
|
27
|
+
2. Set your token:
|
|
28
|
+
- Windows: $env:GITHUB_TOKEN="your_token_here"
|
|
29
|
+
- Mac/Linux: export GITHUB_TOKEN="your_token_here"
|
|
30
|
+
3. You're ready to use it!
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
codyhelp explain main.py
|
|
34
|
+
|
|
35
|
+
codyhelp explain main.py --interview
|
|
36
|
+
|
|
37
|
+
codyhelp review main.py
|
|
38
|
+
|
|
39
|
+
codyhelp stacktrace error.txt
|
|
40
|
+
|
|
41
|
+
## Example:
|
|
42
|
+
**Run CodyHelp from the terminal:**
|
|
43
|
+
|
|
44
|
+
codyhelp explain linkedList.py --interview
|
|
45
|
+
|
|
46
|
+
**Example output:**
|
|
47
|
+
|
|
48
|
+
INTERVIEW MODE — linked_list.py
|
|
49
|
+
|
|
50
|
+
How to explain this in an interview:
|
|
51
|
+
|
|
52
|
+
"This implements a singly linked list with insert and traversal operations. Each node stores a value and a pointer to the next node, giving us dynamic memory allocation unlike arrays..."
|
|
53
|
+
|
|
54
|
+
Complexity to mention:
|
|
55
|
+
|
|
56
|
+
+ Insert at head: O(1)
|
|
57
|
+
+ Search: O(n)
|
|
58
|
+
+ Space: O(n)
|
|
59
|
+
|
|
60
|
+
Follow-up questions an interviewer might ask:
|
|
61
|
+
|
|
62
|
+
* "How would you detect a cycle in this linked list?"
|
|
63
|
+
* "How is this different from a doubly linked list?"
|
|
64
|
+
* "When would you choose a linked list over an array?"
|
|
65
|
+
|
|
66
|
+
Concepts you should know to fully defend this code:
|
|
67
|
+
|
|
68
|
+
+ Node structure and pointers
|
|
69
|
+
+ Dynamic vs static memory allocation
|
|
70
|
+
+ Singly vs doubly linked lists
|
|
71
|
+
|
|
72
|
+
## Technologies
|
|
73
|
+
|
|
74
|
+
- Python
|
|
75
|
+
- CLI (Command-line interface)
|
|
76
|
+
- Github models
|
|
77
|
+
- Git and Github
|
|
78
|
+
|
|
79
|
+
## Future Improvements
|
|
80
|
+
|
|
81
|
+
- [ ] Git diff code review
|
|
82
|
+
- [ ] Repository-level code understanding
|
|
83
|
+
- [ ] Leetcode practice suggestions
|
|
File without changes
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#CODYHELP V1
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
from openai import OpenAI
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
from codyhelp.prompts import explain_prompt, interview_prompt, review_prompt, stacktrace_prompt
|
|
8
|
+
|
|
9
|
+
api_key=os.environ.get("GITHUB_TOKEN")
|
|
10
|
+
if not api_key:
|
|
11
|
+
raise EnvironmentError("GITHUB_TOKEN environment variable is not set.")
|
|
12
|
+
|
|
13
|
+
client = OpenAI(base_url="https://models.inference.ai.azure.com", api_key=api_key)
|
|
14
|
+
|
|
15
|
+
@click.group()
|
|
16
|
+
def main():
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
#Explain a code file.
|
|
20
|
+
|
|
21
|
+
@main.command()
|
|
22
|
+
@click.argument("file")
|
|
23
|
+
@click.option("--interview", is_flag=True, help="Explain in interview mode")
|
|
24
|
+
|
|
25
|
+
def explain(file, interview):
|
|
26
|
+
try:
|
|
27
|
+
with open(file, "r") as f:
|
|
28
|
+
code = f.read()
|
|
29
|
+
except FileNotFoundError:
|
|
30
|
+
click.echo(f"Error: File '{file}' not found.")
|
|
31
|
+
return
|
|
32
|
+
|
|
33
|
+
if interview:
|
|
34
|
+
prompt = interview_prompt(code)
|
|
35
|
+
else:
|
|
36
|
+
prompt = explain_prompt(code)
|
|
37
|
+
|
|
38
|
+
click.echo("\n ANALYSING...\n")
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
response = client.chat.completions.create(
|
|
42
|
+
model="gpt-4o-mini",
|
|
43
|
+
messages=[{"role": "user", "content": prompt}]
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
click.echo(response.choices[0].message.content)
|
|
47
|
+
|
|
48
|
+
except Exception as e:
|
|
49
|
+
click.echo(f"Error while calling API: {str(e)}")
|
|
50
|
+
|
|
51
|
+
#Reviews code and suggests improvements
|
|
52
|
+
|
|
53
|
+
@main.command()
|
|
54
|
+
@click.argument("file")
|
|
55
|
+
|
|
56
|
+
def review(file):
|
|
57
|
+
try:
|
|
58
|
+
with open (file,"r") as f:
|
|
59
|
+
code=f.read()
|
|
60
|
+
except FileNotFoundError:
|
|
61
|
+
click.echo(f"Error: File '{file}' not found.")
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
prompt = review_prompt(code)
|
|
65
|
+
|
|
66
|
+
click.echo("\n ANALYSING...\n")
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
response = client.chat.completions.create(
|
|
70
|
+
model="gpt-4o-mini",
|
|
71
|
+
messages=[{"role": "user", "content": prompt}]
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
click.echo(response.choices[0].message.content)
|
|
75
|
+
|
|
76
|
+
except Exception as e:
|
|
77
|
+
click.echo(f"Error while calling API: {str(e)}")
|
|
78
|
+
|
|
79
|
+
#Error explanation through stacktraces
|
|
80
|
+
|
|
81
|
+
@main.command()
|
|
82
|
+
@click.argument("file")
|
|
83
|
+
|
|
84
|
+
def stacktrace(file):
|
|
85
|
+
try:
|
|
86
|
+
with open(file,"r") as f:
|
|
87
|
+
error=f.read()
|
|
88
|
+
except FileNotFoundError:
|
|
89
|
+
click.echo(f"Error: File '{file}' not found. ")
|
|
90
|
+
return
|
|
91
|
+
|
|
92
|
+
prompt= stacktrace_prompt(error)
|
|
93
|
+
|
|
94
|
+
click.echo("\n ANALYSING...\n")
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
response=client.chat.completions.create(
|
|
98
|
+
model="gpt-4o-mini",
|
|
99
|
+
messages=[{"role":"user", "content":prompt}]
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
click.echo(response.choices[0].message.content)
|
|
103
|
+
|
|
104
|
+
except Exception as e:
|
|
105
|
+
click.echo(f"Error while calling API: {str(e)}")
|
|
106
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#Prompts that are used to run each feature giving accurate responses to the user
|
|
2
|
+
|
|
3
|
+
def explain_prompt(code):
|
|
4
|
+
return f"Explain what this code does in simple terms:\n\n{code}"
|
|
5
|
+
|
|
6
|
+
def interview_prompt(code):
|
|
7
|
+
return f"Explain this code as if I need to defend it in a job interview. Include: how to explain it verbally, time/space complexity, likely follow-up questions, and key concepts to know.\n\n{code}"
|
|
8
|
+
|
|
9
|
+
def review_prompt(code):
|
|
10
|
+
return f"Review this code and detect possible bugs. For each bug found, label it with a severity level: [HIGH], [MEDIUM], or [LOW]. Then suggest improvements.\n\n{code}"
|
|
11
|
+
|
|
12
|
+
def stacktrace_prompt(error):
|
|
13
|
+
return f"You are a helpful coding assistant, explain errors in my code in simple words in the format:\n Error:\n What went wrong:\n Suggested fix:\n Concept to review:\n\n{error}"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
codyhelp/__init__.py
|
|
5
|
+
codyhelp/cli.py
|
|
6
|
+
codyhelp/prompts.py
|
|
7
|
+
codyhelp.egg-info/PKG-INFO
|
|
8
|
+
codyhelp.egg-info/SOURCES.txt
|
|
9
|
+
codyhelp.egg-info/dependency_links.txt
|
|
10
|
+
codyhelp.egg-info/entry_points.txt
|
|
11
|
+
codyhelp.egg-info/requires.txt
|
|
12
|
+
codyhelp.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codyhelp
|
codyhelp-1.0.0/setup.cfg
ADDED
codyhelp-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="codyhelp",
|
|
5
|
+
version="1.0.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=[
|
|
8
|
+
"click",
|
|
9
|
+
"openai",
|
|
10
|
+
],
|
|
11
|
+
entry_points={
|
|
12
|
+
"console_scripts": [
|
|
13
|
+
"codyhelp=codyhelp.cli:main",
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
)
|