Use llm to talk to git
from the root directory run
.devcontainer/post_create.sh
poetry install
poetry shell
poetry run pytest --disable-warnings
poetry add pack
git add poetry.lock pyproject.toml && git commit "installed new pkg"
git push origin
Use llm to talk to git
import subprocess
import json
from typing import List, Optional
from pydantic import BaseModel, validator
from urllib.parse: urlparse
class Commit(BaseModel):
hash: str
author: str
message: str
date: str
class Repository(BaseModel):
url: str
name: str = ""
owner: str = ""
commits: List[Commit] = []
@validator('url')
def parse_url(cls, value):
parsed_url = urlparse(value)
path_parts = parsed_url.path.strip('/').split('/')
if len(path_parts) != 2:
raise ValueError("Invalid GitHub repository URL")
cls.owner, cls.name = path_parts
return value
def fetch_commits(self):
try:
result = subprocess.run(
["gh", "repo", "view", f"{self.owner}/{self.name}", "--json", "commits", "--limit", "100"],
capture_output=True,
text=True,
check=True
)
data = json.loads(result.stdout)
self.commits = [
Commit(
hash=commit['oid'],
author=commit['author']['user']['login'] if commit['author']['user'] else 'Unknown',
message=commit['messageHeadline'],
date=commit['committedDate']
) for commit in data['commits']
]
except subprocess.CalledProcessError as e:
print(f"Error fetching commits: {e}")
def get_commit_by_hash(self, commit_hash: str) -> Optional[Commit]:
for commit in self.commits:
if commit.hash == commit_hash:
return commit
return None
if name == "main":
repo_url = "https://github.com/user/example-repo"
repo = Repository(url=repo_url)
# Fetch commits using GitHub CLI
repo.fetch_commits()
# Retrieve a commit by its hash
commit = repo.get_commit_by_hash("abc123")
if commit:
print(commit)
else:
print("Commit not found")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.