Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate jj based workflows. #415

Open
TwistingTwists opened this issue Feb 28, 2025 · 0 comments
Open

integrate jj based workflows. #415

TwistingTwists opened this issue Feb 28, 2025 · 0 comments

Comments

@TwistingTwists
Copy link

TwistingTwists commented Feb 28, 2025

Ideally, I define my new issue in docs/issues/001.md and ai agent picks it up and continues to work in background in a separate branch.

Here is a little more detailed version imagined using aider (cli based coding tool)


To establish a streamlined workflow where an AI agent like Aider autonomously addresses issues by creating new branches using Jujutsu (jj), follow these concise steps:

1. Install and Configure Aider and Jujutsu (jj):

 - Initialize `jj` in your repository:
   ```bash
   jj init
   ```

2. Set Up Issue Tracking:

  • Create a directory for issues:
    mkdir -p docs/issues
  • Add new issues as markdown files in docs/issues/ (e.g., docs/issues/001.md).

3. Automate Issue Detection and Branch Creation:

  • Develop a script to monitor docs/issues/ for new files. Upon detecting a new issue file:

    • Create a new branch using jj.
    • Invoke Aider to address the issue described in the markdown file.
  • Sample Script (Python):

    import time
    import os
    import subprocess
    
    issues_dir = 'docs/issues'
    processed_issues = set(os.listdir(issues_dir))
    
    while True:
        current_issues = set(os.listdir(issues_dir))
        new_issues = current_issues - processed_issues
    
        for issue_file in new_issues:
            issue_path = os.path.join(issues_dir, issue_file)
            with open(issue_path, 'r') as f:
                issue_content = f.read()
    
            branch_name = f"issue-{issue_file.split('.')[0]}"
            subprocess.run(['jj', 'new', branch_name])
            subprocess.run(['aider', '--edit', '--message', issue_content])
    
            processed_issues.add(issue_file)
    
        time.sleep(10)  # Check for new issues every 10 seconds

4. AI Agent (Aider) Workflow:

  • Aider processes the issue description, makes necessary code modifications, and commits changes automatically.

5. Merging Changes:

  • Review and test changes on the new branch. Or raise a PR
  • Merge the branch back into the main codebase:
    jj merge issue-001

By implementing this workflow, you enable seamless collaboration between Aider and jj, facilitating efficient issue resolution and code management within your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant