Skip to content

Commit f73c673

Browse files
authored
Merge pull request #1287 from codeflash-ai/fix/codeflash-toml-config-detection
[Fix] Reading config fille
2 parents 5627ea9 + f862cb2 commit f73c673

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

codeflash/setup/detector.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -664,19 +664,20 @@ def has_existing_config(project_root: Path) -> tuple[bool, str | None]:
664664
665665
Returns:
666666
Tuple of (has_config, config_file_type).
667-
config_file_type is "pyproject.toml", "package.json", or None.
667+
config_file_type is "pyproject.toml", "codeflash.toml", "package.json", or None.
668668
669669
"""
670-
# Check pyproject.toml
671-
pyproject_path = project_root / "pyproject.toml"
672-
if pyproject_path.exists():
673-
try:
674-
with pyproject_path.open("rb") as f:
675-
data = tomlkit.parse(f.read())
676-
if "tool" in data and "codeflash" in data["tool"]:
677-
return True, "pyproject.toml"
678-
except Exception:
679-
pass
670+
# Check TOML config files (pyproject.toml, codeflash.toml)
671+
for toml_filename in ("pyproject.toml", "codeflash.toml"):
672+
toml_path = project_root / toml_filename
673+
if toml_path.exists():
674+
try:
675+
with toml_path.open("rb") as f:
676+
data = tomlkit.parse(f.read())
677+
if "tool" in data and "codeflash" in data["tool"]:
678+
return True, toml_filename
679+
except Exception:
680+
pass
680681

681682
# Check package.json
682683
package_json_path = project_root / "package.json"

0 commit comments

Comments
 (0)