Skip to content

Commit 9afc52a

Browse files
committed
Add agentflow package skeleton
1 parent 334a3e3 commit 9afc52a

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

agentflow/paths.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from __future__ import annotations
2+
3+
from pathlib import Path
4+
5+
AGENTFLOW_DIR = ".agentflow"
6+
7+
8+
def find_project_root(start: str | Path | None = None) -> Path:
9+
"""Find the nearest parent containing .agentflow; fallback to cwd."""
10+
path = Path(start or ".").resolve()
11+
if path.is_file():
12+
path = path.parent
13+
for candidate in [path, *path.parents]:
14+
if (candidate / AGENTFLOW_DIR).is_dir():
15+
return candidate
16+
return path
17+
18+
19+
def agentflow_dir(root: str | Path | None = None) -> Path:
20+
return find_project_root(root) / AGENTFLOW_DIR

0 commit comments

Comments
 (0)