mirror of
https://github.com/Pythagora-io/gpt-pilot.git
synced 2026-01-09 21:27:53 -05:00
fix git
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
|
||||
from core.agents.convo import AgentConvo
|
||||
from core.config.magic_words import GITIGNORE_CONTENT
|
||||
from core.ui.base import pythagora_source
|
||||
|
||||
|
||||
@@ -55,6 +56,13 @@ class GitMixin:
|
||||
if status_code != 0:
|
||||
raise RuntimeError(f"Failed to initialize git repository: {stderr}")
|
||||
|
||||
gitignore_path = os.path.join(workspace_path, ".gitignore")
|
||||
try:
|
||||
with open(gitignore_path, "w") as f:
|
||||
f.write(GITIGNORE_CONTENT)
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"Failed to create .gitignore file: {str(e)}")
|
||||
|
||||
# First check if there are any changes to commit
|
||||
status_code, stdout, stderr = await self.process_manager.run_command(
|
||||
"git status --porcelain",
|
||||
|
||||
@@ -53,12 +53,13 @@ class Orchestrator(BaseAgent, GitMixin):
|
||||
self.executor = Executor(self.state_manager, self.ui)
|
||||
self.process_manager = self.executor.process_manager
|
||||
# self.chat = Chat() TODO
|
||||
if await self.check_git_installed():
|
||||
await self.init_git_if_needed()
|
||||
|
||||
await self.init_ui()
|
||||
await self.offline_changes_check()
|
||||
|
||||
if await self.check_git_installed():
|
||||
await self.init_git_if_needed()
|
||||
|
||||
# TODO: consider refactoring this into two loop; the outer with one iteration per comitted step,
|
||||
# and the inner which runs the agents for the current step until they're done. This would simplify
|
||||
# handle_done() and let us do other per-step processing (eg. describing files) in between agent runs.
|
||||
|
||||
@@ -25,3 +25,35 @@ THINKING_LOGS = [
|
||||
"Pythagora is working for you, so relax!",
|
||||
"Pythagora might take some time to figure this out...",
|
||||
]
|
||||
GITIGNORE_CONTENT = """# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# SQLite databases, data files
|
||||
*.db
|
||||
*.csv
|
||||
|
||||
# Keep environment variables out of version control
|
||||
.env
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user