The New Archon (Beta) - The Operating System for AI Coding Assistants!

This commit is contained in:
Cole Medin
2025-08-13 07:58:24 -05:00
parent 13e1fc6a0e
commit 59084036f6
603 changed files with 131376 additions and 417 deletions

View File

@@ -0,0 +1,34 @@
@github_agent.tool
async def get_file_content(ctx: RunContext[GitHubDeps], github_url: str, file_path: str) -> str:
"""Get the content of a specific file from the GitHub repository.
Args:
ctx: The context.
github_url: The GitHub repository URL.
file_path: Path to the file within the repository.
Returns:
str: File content as a string.
"""
match = re.search(r'github\.com[:/]([^/]+)/([^/]+?)(?:\.git)?$', github_url)
if not match:
return "Invalid GitHub URL format"
owner, repo = match.groups()
headers = {'Authorization': f'token {ctx.deps.github_token}'} if ctx.deps.github_token else {}
response = await ctx.deps.client.get(
f'https://raw.githubusercontent.com/{owner}/{repo}/main/{file_path}',
headers=headers
)
if response.status_code != 200:
# Try with master branch if main fails
response = await ctx.deps.client.get(
f'https://raw.githubusercontent.com/{owner}/{repo}/master/{file_path}',
headers=headers
)
if response.status_code != 200:
return f"Failed to get file content: {response.text}"
return response.text