Skip to content

update from main #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from api.analyzers.source_analyzer import SourceAnalyzer
from api.git_utils import git_utils
from api.git_utils.git_graph import GitGraph
from api.graph import Graph, get_repos, graph_exists
from api.info import get_repo_info
from api.llm import ask
Expand Down Expand Up @@ -448,3 +449,41 @@ def switch_commit():
}

return jsonify(response), 200

@app.route('/list_commits', methods=['POST'])
@public_access # Apply public access decorator
@token_required # Apply token authentication decorator
def list_commits():
"""
Endpoint to list all commits of a specified repository.

Request JSON Structure:
{
"repo": "repository_name"
}

Returns:
JSON response with a list of commits or an error message.
"""

# Get JSON data from the request
data = request.get_json()

# Validate the presence of the 'repo' parameter
repo = data.get('repo')
if repo is None:
return jsonify({'status': f'Missing mandatory parameter "repo"'}), 400

# Initialize GitGraph object to interact with the repository
git_graph = GitGraph(git_utils.GitRepoName(repo))

# Fetch commits from the repository
commits = git_graph.list_commits()

# Return success response with the list of commits
response = {
'status': 'success',
'commits': commits
}

return jsonify(response), 200
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "code-graph-backend"
version = "0.4.1"
version = "0.4.2"
description = "code_graph is designed to help developers visualize and analyze the structure of their source code. It takes source code as input and generates a graph representation, making it easier to understand relationships and dependencies within the codebase."
authors = ["Roi Lipman <roilipman@gmail.com>"]
readme = "README.md"
Expand Down
Loading