diff --git a/CLAUDE_CODE_PROMPT.md b/CLAUDE_CODE_PROMPT.md index 0482f64..f224fcc 100644 --- a/CLAUDE_CODE_PROMPT.md +++ b/CLAUDE_CODE_PROMPT.md @@ -12,9 +12,9 @@ I need to move faster. Install Code Conductor into this project so we can run mu This will transform our development workflow from single-threaded to massively parallel. Instead of one AI doing tasks sequentially, we'll have specialized agents working simultaneously—frontend, backend, testing, DevOps—all coordinated through GitHub Issues. Please install Code Conductor now: -1. Run: bash <(curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh) -2. When prompted, select options that match our tech stack -3. After installation, run: ./conductor start dev +1. Run: curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge +2. Wait for the PR to be created and auto-merge +3. After the PR merges, run: ./conductor start dev 4. Complete the [INIT] task to map our entire codebase 5. Submit with: ./conductor complete @@ -33,8 +33,8 @@ Our current setup is good, but the latest version includes: - Better error recovery and diagnostics Upgrade now: -1. Run: bash <(curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh) -2. Choose option 1 (Upgrade) when prompted +1. Run: curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --upgrade --create-pr --auto-merge +2. Wait for the upgrade PR to be created and auto-merge 3. Review what's new in the upgrade summary 4. Verify with: ./conductor status 5. If any issues: ./conductor diagnose @@ -55,17 +55,16 @@ I want you to: Execute this transformation: -# Install Code Conductor -bash <(curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh) +# Install Code Conductor with automatic PR creation +curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge -# Installation choices: -- Existing installation? Choose 2 (Reinstall) -- Copy examples? Press Enter (Yes) -- Agent roles? Select all that apply to our stack, then 0 -- Demo tasks? Type n (No - we'll generate real ones) -- Auto-commit? Press Enter (Yes) -- Environment? Choose 3 (IDE) -- Start agent? Press Enter (Yes) +# The installer will automatically: +- Configure based on detected tech stack +- Create all necessary files +- Commit changes +- Create and push a PR +- Enable auto-merge +- Complete installation once PR merges After installation: 1. Claim the [INIT] discovery task automatically @@ -83,8 +82,8 @@ In under 5 minutes, we'll have a fully mapped codebase with prioritized tasks re ``` Level up our IDE workflow with agentic development. Install Code Conductor to enable parallel AI agents in our familiar environment. -Execute: bash <(curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh) -Choose: Option 3 (IDE) for seamless integration +Execute: curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge +Automatic: Configures for IDE integration and creates PR Launch: ./conductor start [role] to unleash specialized agents Transform your IDE into a multi-agent powerhouse. @@ -94,8 +93,8 @@ Transform your IDE into a multi-agent powerhouse. ``` Command-line mastery meets agentic development. Set up Code Conductor for terminal-based parallel execution. -Execute: bash <(curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh) -Choose: Option 2 (Terminal) for CLI excellence +Execute: curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge +Automatic: Configures for terminal workflow and creates PR Launch: ./conductor start [role] to deploy your agent army Because the best interface is no interface—just results. @@ -105,8 +104,8 @@ Because the best interface is no interface—just results. ``` Experience the future of development with the native Conductor app. One-click agent orchestration. -Execute: bash <(curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh) -Choose: Option 1 (Conductor) for the premium experience +Execute: curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge +Automatic: Configures for Conductor app and creates PR Launch: Open Conductor.app and add this project as a workspace Visual agent management. Real-time progress. Pure productivity. diff --git a/README.md b/README.md index 358de54..26699a7 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,16 @@ The installer auto-detects your stack (React, Python, Go, etc.) and configures e curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto ``` +**With automatic PR creation and auto-merge:** +```bash +curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge +``` + **Or paste this prompt into Claude Code:** ``` I need to move faster. Install Code Conductor into this project so we can run multiple Claude Code agents at once. -Execute: curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto +Execute: curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge ``` ## See It In Action diff --git a/conductor-init.sh b/conductor-init.sh index 80a12dd..e2baa39 100644 --- a/conductor-init.sh +++ b/conductor-init.sh @@ -16,6 +16,9 @@ FORCE_REINSTALL=false SKIP_EXAMPLES=false SKIP_COMMIT=false SKIP_AGENT_START=false +CREATE_PR=false +AUTO_MERGE_PR=false +PR_BRANCH="" # Parse command-line arguments while [[ $# -gt 0 ]]; do @@ -49,6 +52,24 @@ while [[ $# -gt 0 ]]; do SKIP_AGENT_START=true shift ;; + --create-pr) + CREATE_PR=true + shift + ;; + --auto-merge) + AUTO_MERGE_PR=true + CREATE_PR=true # Auto-merge implies creating a PR + shift + ;; + --pr-branch) + if [[ -n "$2" && ! "$2" =~ ^-- ]]; then + PR_BRANCH="$2" + shift 2 + else + echo "Error: --pr-branch requires a branch name" + exit 1 + fi + ;; --help) echo "Code Conductor Universal Installer" echo "" @@ -62,6 +83,9 @@ while [[ $# -gt 0 ]]; do echo " --skip-examples Skip copying example configurations" echo " --skip-commit Skip auto-committing changes to Git" echo " --skip-agent-start Skip starting a dev agent after installation" + echo " --create-pr Create a pull request after installation" + echo " --auto-merge Enable auto-merge on the created PR (implies --create-pr)" + echo " --pr-branch Specify branch name for PR (default: auto-generated)" echo " --help Show this help message" echo "" echo "Examples:" @@ -73,6 +97,9 @@ while [[ $# -gt 0 ]]; do echo "" echo " # Force upgrade in non-interactive mode" echo " curl -fsSL ... | bash -s -- --auto --upgrade" + echo "" + echo " # Create PR with auto-merge after installation" + echo " curl -fsSL ... | bash -s -- --auto --create-pr --auto-merge" exit 0 ;; *) @@ -610,6 +637,147 @@ else fi fi +# Step 7.5: Create Pull Request if requested +if [ "$CREATE_PR" = true ] && [ "$SKIP_COMMIT" = false ]; then + echo "" + echo -e "${YELLOW}🔄 Creating pull request...${NC}" + + # Check if GitHub CLI is available and authenticated + if ! command -v gh >/dev/null 2>&1; then + echo -e "${RED}❌ GitHub CLI (gh) not found. Cannot create PR.${NC}" + echo "Install GitHub CLI and run 'gh auth login' to enable PR creation." + CREATE_PR=false + elif ! gh auth status >/dev/null 2>&1; then + echo -e "${RED}❌ GitHub CLI not authenticated. Cannot create PR.${NC}" + echo "Run 'gh auth login' to authenticate, then try again." + CREATE_PR=false + else + # Check if we have changes committed + CURRENT_BRANCH=$(git branch --show-current) + DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main") + + # Generate PR branch name if not provided + if [ -z "$PR_BRANCH" ]; then + TIMESTAMP=$(date +%Y%m%d-%H%M%S) + if [ "$IS_UPGRADE" = true ]; then + PR_BRANCH="conductor-upgrade-$NEW_VERSION-$TIMESTAMP" + else + PR_BRANCH="conductor-setup-$TIMESTAMP" + fi + fi + + # Check if we're on the default branch + if [ "$CURRENT_BRANCH" = "$DEFAULT_BRANCH" ]; then + echo -e "${YELLOW}📝 Creating new branch for PR: $PR_BRANCH${NC}" + git checkout -b "$PR_BRANCH" || { + echo -e "${RED}❌ Failed to create branch.${NC}" + CREATE_PR=false + } + else + # Already on a feature branch, use it + PR_BRANCH="$CURRENT_BRANCH" + echo -e "${YELLOW}📝 Using current branch for PR: $PR_BRANCH${NC}" + fi + + if [ "$CREATE_PR" = true ]; then + # Push the branch + echo -e "${YELLOW}📤 Pushing branch to origin...${NC}" + git push -u origin "$PR_BRANCH" || { + echo -e "${RED}❌ Failed to push branch.${NC}" + CREATE_PR=false + } + + if [ "$CREATE_PR" = true ]; then + # Create the PR + if [ "$IS_UPGRADE" = true ]; then + PR_TITLE="🔧 Upgrade Code Conductor from $CURRENT_VERSION to $NEW_VERSION" + PR_BODY="## Summary +This PR upgrades Code Conductor to version $NEW_VERSION. + +### Changes +- Updated core scripts and utilities +- Updated role definitions +- Updated GitHub workflows +- Preserved existing configuration + +### Testing +- [ ] Installation/upgrade completed successfully +- [ ] Conductor commands work as expected +- [ ] GitHub integration functional + +### Auto-generated +This PR was automatically created by the Code Conductor installer." + else + PR_TITLE="🚀 Initialize Code Conductor for AI agent orchestration" + PR_BODY="## Summary +This PR sets up Code Conductor to enable multiple AI agents to work on this codebase simultaneously. + +### What is Code Conductor? +Code Conductor is an AI agent coordination system that: +- Enables multiple AI coding agents (Claude Code, Conductor, Warp) to work in parallel +- Uses GitHub Issues as a task queue with automatic conflict prevention +- Provides isolated git worktrees for each agent +- Includes AI-powered code reviews on all PRs + +### Changes +- Added \`.conductor\` directory with scripts and configuration +- Added GitHub workflows for automation +- Configured agent roles based on detected technology stack +- Created initial tasks for agents to claim + +### Next Steps +1. Merge this PR to enable Code Conductor +2. AI agents can start claiming and working on tasks +3. Monitor progress via GitHub Issues labeled \`conductor:task\` + +### Auto-generated +This PR was automatically created by the Code Conductor installer." + fi + + echo -e "${YELLOW}📝 Creating pull request...${NC}" + PR_URL=$(gh pr create \ + --title "$PR_TITLE" \ + --body "$PR_BODY" \ + --base "$DEFAULT_BRANCH" \ + --head "$PR_BRANCH" 2>&1) || { + echo -e "${RED}❌ Failed to create PR: $PR_URL${NC}" + CREATE_PR=false + } + + if [ "$CREATE_PR" = true ]; then + echo -e "${GREEN}✅ Pull request created successfully!${NC}" + echo -e "${GREEN}📎 PR URL: $PR_URL${NC}" + + # Enable auto-merge if requested + if [ "$AUTO_MERGE_PR" = true ]; then + echo -e "${YELLOW}🤖 Enabling auto-merge...${NC}" + gh pr merge --auto --merge "$PR_URL" || { + echo -e "${YELLOW}⚠️ Could not enable auto-merge. You may need to:${NC}" + echo " 1. Ensure branch protection rules allow auto-merge" + echo " 2. Wait for required checks to be configured" + echo " 3. Enable auto-merge manually with: gh pr merge --auto $PR_URL" + } + fi + + # Add labels + gh pr edit "$PR_URL" --add-label "conductor:setup,automation" 2>/dev/null || true + + echo "" + echo -e "${GREEN}🎉 Next steps:${NC}" + echo " 1. Review the PR: $PR_URL" + if [ "$AUTO_MERGE_PR" = false ]; then + echo " 2. Merge the PR to activate Code Conductor" + echo " 3. Other agents can then see and use the system" + else + echo " 2. PR will auto-merge once checks pass" + echo " 3. Other agents will then see and use the system" + fi + fi + fi + fi + fi +fi + # Step 8: Development Environment Selection - skip for upgrades if [ "$IS_UPGRADE" = false ]; then if [ "$AUTO_MODE" = true ]; then diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index 37a29ae..4bc14df 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -24,6 +24,16 @@ Use the `--auto` flag for non-interactive installation (perfect for Claude Code) curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto ``` +**Recommended: Create PR with auto-merge for immediate activation:** +```bash +curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge +``` + +This creates a pull request that: +- Makes Code Conductor visible to all agents and developers +- Auto-merges once CI checks pass (if configured) +- Provides a clear installation record in your git history + ### Installation Options The installer supports various command-line flags for customization: @@ -40,10 +50,15 @@ bash <(curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/ --skip-examples # Skip copying example configurations --skip-commit # Skip auto-committing changes to Git --skip-agent-start # Skip starting a dev agent after installation +--create-pr # Create a pull request after installation +--auto-merge # Enable auto-merge on the created PR (implies --create-pr) +--pr-branch # Specify branch name for PR (default: auto-generated) # Examples: curl -fsSL ... | bash -s -- --auto --upgrade # Auto-upgrade curl -fsSL ... | bash -s -- --auto --skip-commit # Install without committing +curl -fsSL ... | bash -s -- --auto --create-pr # Install and create PR +curl -fsSL ... | bash -s -- --auto --auto-merge # Install, create PR, and auto-merge ``` ### Installation Notes @@ -56,6 +71,37 @@ curl -fsSL ... | bash -s -- --auto --skip-commit # Install without committing One-line Install Happy orchestrating +### Pull Request Workflow + +**Why create a PR during installation?** + +When Code Conductor is installed locally, the `.conductor` directory only exists in your working copy. Other agents or developers won't see it until these changes are merged into the main branch. The `--create-pr` option solves this by: + +1. **Automatic Branch Creation**: If you're on the main branch, creates a new feature branch +2. **Push and PR Creation**: Pushes changes and creates a PR with detailed description +3. **Optional Auto-Merge**: With `--auto-merge`, the PR merges automatically once CI passes +4. **Visibility**: Makes Code Conductor immediately visible to all agents and collaborators + +**Example workflow:** +```bash +# Install and create PR in one command +curl -fsSL https://raw.githubusercontent.com/ryanmac/code-conductor/main/conductor-init.sh | bash -s -- --auto --create-pr --auto-merge + +# The installer will: +# 1. Install Code Conductor locally +# 2. Commit all changes +# 3. Create branch "conductor-setup-20240125-143022" (or use custom with --pr-branch) +# 4. Push to origin +# 5. Create PR with comprehensive description +# 6. Enable auto-merge (if --auto-merge specified) +# 7. Add labels "conductor:setup" and "automation" +``` + +**Requirements:** +- GitHub CLI (`gh`) must be installed and authenticated +- Repository must have a remote origin configured +- For auto-merge: repository must have branch protection that allows it + ## Option 2: Poetry (For Cloned Repo) ```bash # Clone the repository