mirror of
https://github.com/Pythagora-io/gpt-pilot.git
synced 2026-01-09 21:27:53 -05:00
add --git-use flag
This commit is contained in:
@@ -29,6 +29,7 @@ class BaseAgent:
|
||||
prev_response: Optional["AgentResponse"] = None,
|
||||
process_manager: Optional["ProcessManager"] = None,
|
||||
data: Optional[Any] = None,
|
||||
args: Optional[Any] = None,
|
||||
):
|
||||
"""
|
||||
Create a new agent.
|
||||
@@ -40,6 +41,7 @@ class BaseAgent:
|
||||
self.prev_response = prev_response
|
||||
self.step = step
|
||||
self.data = data
|
||||
self.args = args
|
||||
|
||||
@property
|
||||
def current_state(self) -> ProjectState:
|
||||
|
||||
@@ -57,7 +57,7 @@ class Orchestrator(BaseAgent, GitMixin):
|
||||
await self.init_ui()
|
||||
await self.offline_changes_check()
|
||||
|
||||
if await self.check_git_installed():
|
||||
if self.args.use_git and 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,
|
||||
|
||||
@@ -96,6 +96,7 @@ def parse_arguments() -> Namespace:
|
||||
--email: User's email address, if provided
|
||||
--extension-version: Version of the VSCode extension, if used
|
||||
--no-check: Disable initial LLM API check
|
||||
--use-git: Use Git for version control
|
||||
:return: Parsed arguments object.
|
||||
"""
|
||||
version = get_version()
|
||||
@@ -136,6 +137,7 @@ def parse_arguments() -> Namespace:
|
||||
parser.add_argument("--email", help="User's email address", required=False)
|
||||
parser.add_argument("--extension-version", help="Version of the VSCode extension", required=False)
|
||||
parser.add_argument("--no-check", help="Disable initial LLM API check", action="store_true")
|
||||
parser.add_argument("--use-git", help="Use Git for version control", action="store_true", required=False)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ def sync_cleanup(ui: UIBase):
|
||||
asyncio.run(cleanup(ui))
|
||||
|
||||
|
||||
async def run_project(sm: StateManager, ui: UIBase) -> bool:
|
||||
async def run_project(sm: StateManager, ui: UIBase, args) -> bool:
|
||||
"""
|
||||
Work on the project.
|
||||
|
||||
@@ -43,13 +43,14 @@ async def run_project(sm: StateManager, ui: UIBase) -> bool:
|
||||
|
||||
:param sm: State manager.
|
||||
:param ui: User interface.
|
||||
:param args: Command-line arguments.
|
||||
:return: True if the orchestrator exited successfully, False otherwise.
|
||||
"""
|
||||
|
||||
telemetry.set("app_id", str(sm.project.id))
|
||||
telemetry.set("initial_prompt", sm.current_state.specification.description)
|
||||
|
||||
orca = Orchestrator(sm, ui)
|
||||
orca = Orchestrator(sm, ui, args=args)
|
||||
success = False
|
||||
try:
|
||||
success = await orca.run()
|
||||
@@ -229,7 +230,7 @@ async def run_pythagora_session(sm: StateManager, ui: UIBase, args: Namespace):
|
||||
if not success:
|
||||
return False
|
||||
|
||||
return await run_project(sm, ui)
|
||||
return await run_project(sm, ui, args)
|
||||
|
||||
|
||||
async def async_main(
|
||||
|
||||
@@ -57,6 +57,7 @@ def test_parse_arguments(mock_ArgumentParser):
|
||||
"--email",
|
||||
"--extension-version",
|
||||
"--no-check",
|
||||
"--use-git",
|
||||
}
|
||||
|
||||
parser.parse_args.assert_called_once_with()
|
||||
|
||||
Reference in New Issue
Block a user