Add plans directory support to CLI session management

- Introduced `plans_directory` parameter in `CLISessionManager`, `CLISession`, and updated related methods to handle plan files.
- Updated `api/app.py` to pass the plans directory to the CLI session manager.
- Added a new test in `test_cli.py` to verify that the `--settings plansDirectory` argument is included when starting a task with a specified plans directory.
This commit is contained in:
Alishahryar1 2026-02-16 15:34:26 -08:00
parent 6939b52bca
commit 71cc814efb
4 changed files with 49 additions and 1 deletions

View file

@ -17,10 +17,12 @@ class CLISession:
workspace_path: str,
api_url: str,
allowed_dirs: Optional[List[str]] = None,
plans_directory: Optional[str] = None,
):
self.workspace = os.path.normpath(os.path.abspath(workspace_path))
self.api_url = api_url
self.allowed_dirs = [os.path.normpath(d) for d in (allowed_dirs or [])]
self.plans_directory = plans_directory
self.process: Optional[asyncio.subprocess.Process] = None
self.current_session_id: Optional[str] = None
self._is_busy = False
@ -94,6 +96,10 @@ class CLISession:
for d in self.allowed_dirs:
cmd.extend(["--add-dir", d])
if self.plans_directory is not None:
settings_json = json.dumps({"plansDirectory": self.plans_directory})
cmd.extend(["--settings", settings_json])
try:
self.process = await asyncio.create_subprocess_exec(
*cmd,