Skip to content

Commit f0fe4d8

Browse files
committed
fix leftovers
1 parent 19229cf commit f0fe4d8

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

codeflash/cli_cmds/cmd_init.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,10 @@ def install_github_actions(override_formatter_check: bool = False) -> None: # n
606606
logger.info("[cmd_init.py:install_github_actions] User confirmed, generating workflow content...")
607607
from importlib.resources import files
608608

609-
optimize_yml_content = (
610-
files("codeflash").joinpath("cli_cmds", "workflows", "codeflash-optimize.yaml").read_text(encoding="utf-8")
611-
)
612-
materialized_content = generate_dynamic_workflow_content(
613-
optimize_yml_content, config, git_root, benchmark_mode
609+
optimize_yml_content = (files("codeflash") / "cli_cmds" / "workflows" / "codeflash-optimize.yaml").read_text(
610+
encoding="utf-8"
614611
)
612+
materialized_content = generate_dynamic_workflow_content(optimize_yml_content, config, git_root, benchmark_mode)
615613

616614
pr_created_via_api = False
617615
pr_url = None
@@ -633,10 +631,7 @@ def install_github_actions(override_formatter_check: bool = False) -> None: # n
633631
)
634632

635633
response = setup_github_actions(
636-
owner=owner,
637-
repo=repo_name,
638-
base_branch=base_branch,
639-
workflow_content=materialized_content,
634+
owner=owner, repo=repo_name, base_branch=base_branch, workflow_content=materialized_content
640635
)
641636

642637
if response.status_code == 200:
@@ -748,18 +743,18 @@ def install_github_actions(override_formatter_check: bool = False) -> None: # n
748743
if pr_created_via_api:
749744
if pr_url:
750745
console.print(
751-
f"🚀 Codeflash is now configured to automatically optimize new Github PRs!\n"
752-
f"Once you merge the PR, the workflow will be active."
746+
"🚀 Codeflash is now configured to automatically optimize new Github PRs!\n"
747+
"Once you merge the PR, the workflow will be active."
753748
)
754749
else:
755750
console.print(
756-
f"🚀 Codeflash is now configured to automatically optimize new Github PRs!\n"
757-
f"The workflow is ready to use."
751+
"🚀 Codeflash is now configured to automatically optimize new Github PRs!\n"
752+
"The workflow is ready to use."
758753
)
759754
else:
760755
console.print(
761-
f"Please edit, commit and push this GitHub actions file to your repo, and you're all set!\n"
762-
f"🚀 Codeflash is now configured to automatically optimize new Github PRs!"
756+
"Please edit, commit and push this GitHub actions file to your repo, and you're all set!\n"
757+
"🚀 Codeflash is now configured to automatically optimize new Github PRs!"
763758
)
764759

765760
# Guide user to add GitHub secret
@@ -963,14 +958,14 @@ def collect_repo_files_for_workflow(git_root: Path) -> dict[str, Any]:
963958

964959
def generate_dynamic_workflow_content(
965960
optimize_yml_content: str,
966-
config: tuple[dict[str, Any], Path],
961+
config: dict[str, Any],
967962
git_root: Path,
968963
benchmark_mode: bool = False, # noqa: FBT001, FBT002
969964
) -> str:
970965
"""Generate workflow content with dynamic steps from AI service, falling back to static template.
971966
972967
:param optimize_yml_content: Base workflow template content
973-
:param config: Codeflash configuration tuple (dict, Path)
968+
:param config: Codeflash configuration dict
974969
:param git_root: Root directory of the git repository
975970
:param benchmark_mode: Whether to enable benchmark mode
976971
:return: Complete workflow YAML content
@@ -985,7 +980,7 @@ def generate_dynamic_workflow_content(
985980
with toml_path.open(encoding="utf8") as pyproject_file:
986981
pyproject_data = tomlkit.parse(pyproject_file.read())
987982
except FileNotFoundError:
988-
click.echo(
983+
console.print(
989984
f"I couldn't find a pyproject.toml in the current directory.{LF}"
990985
f"Please create a new empty pyproject.toml file here, OR if you use poetry then run `poetry init`, OR run `codeflash init` again from a directory with an existing pyproject.toml file."
991986
)

0 commit comments

Comments
 (0)