add --git-use flag

This commit is contained in:
LeonOstrez
2024-11-19 12:08:58 +01:00
parent 9d23bcc5cd
commit 89c3f510f3
5 changed files with 10 additions and 4 deletions

View File

@@ -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:

View File

@@ -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,

View File

@@ -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()

View File

@@ -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(

View File

@@ -57,6 +57,7 @@ def test_parse_arguments(mock_ArgumentParser):
"--email",
"--extension-version",
"--no-check",
"--use-git",
}
parser.parse_args.assert_called_once_with()