Initialize Git repositories on crewai create ...#6364
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughCrew, flow, and JSON crew scaffolding now initialize a Git repository in the generated project root when Git is available. A new helper centralizes the Git check and initialization path, and tests cover the updated CLI behavior. ChangesCLI Git initialization
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Summary: This PR initializes a Git repository after successful project generation for crews, flows, and JSON crews. No exploitable security vulnerabilities were identified in the added code.
Risk: Low risk. The new subprocess invocation uses a fixed argument list without shell execution and does not introduce public endpoints, authentication changes, or new data-access boundaries.
crewai create ...
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/cli/src/crewai_cli/git.py`:
- Around line 206-212: The initialize_if_git_available helper currently lets
subprocess.run(["git", "init"], check=True) raise and crash the CLI even after
scaffolding is complete. Update initialize_if_git_available to treat git init as
best-effort: catch the failure from subprocess.run in this function, optionally
emit a warning, and return False instead of propagating the exception. Keep the
existing Repository.is_git_installed guard and preserve the True return only
when git init succeeds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a4712ead-9e99-4d2f-9b0d-b9beb340b767
📒 Files selected for processing (5)
lib/cli/src/crewai_cli/create_crew.pylib/cli/src/crewai_cli/create_flow.pylib/cli/src/crewai_cli/create_json_crew.pylib/cli/src/crewai_cli/git.pylib/cli/tests/test_create_crew.py
20433b9 to
74f8c3c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 74f8c3c. Configure here.

Initialize a Git repo when
crewai create crew,crewai create flow, and JSON crew creation finish successfully.Note
Low Risk
Scoped CLI scaffolding change that no-ops when Git is missing; only runs
git initon new project directories.Overview
Newly scaffolded crew, flow, and JSON crew projects now run
git initat the end of creation when Git is on the PATH, via a sharedinitialize_if_git_availablehelper increwai_cli.git.Python crew creation only does this for top-level projects (
not parent_folder), so crews added inside an existing flow folder are unchanged. Flow and JSON crew paths always init Git on the new project root after templates and env setup.Tests add an integration check that
crewai create crewandcrewai create flowleave a.gitdirectory when Git is installed, and mocked crew tests now create the mock folder on disk so scaffolding matches real behavior.Reviewed by Cursor Bugbot for commit 74f8c3c. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit