Files
cyclop/prompts/tasks/repository_management_tasks.md
T
2024-08-19 12:42:33 -05:00

5.1 KiB

Repository Management Task Examples

This document provides step-by-step examples of various tasks that can be completed using the available repository management tools.

Task 1: Add a New Feature to an Existing File

Step 1: Create a new branch

create_branch:
  branch_name: "add-new-feature"

Expected return: Confirmation that the branch was created and set as current.

Step 2: Read the existing file

read_file:
  path: "path/to/existing/file.py"

Expected return: The content of the file.

Step 3: Modify the file content

(This step is done manually by the developer)

Step 4: Commit the changes

commit_file:
  file_path: "path/to/existing/file.py"
  commit_message: "Add new feature X to file.py"
  content: "Updated file content with new feature"

Expected return: Confirmation that the file was committed.

Step 5: Create a pull request

create_pull_request:
  title: "Add new feature X"
  body: "This PR adds feature X to file.py, which does Y and Z."

Expected return: Details of the created pull request, including its number.

Step 6: Approve the pull request

approve_pull_request:
  pull_number: 123  # Use the actual PR number from the previous step

Expected return: Confirmation that the PR was approved.

Step 7: Merge the pull request

merge_pull_request:
  pull_number: 123  # Use the actual PR number
  merge_method: "squash"

Expected return: Confirmation that the PR was merged.

Task 2: Search for and Update Multiple Files

Step 1: Create a new branch

create_branch:
  branch_name: "update-deprecated-function"

Expected return: Confirmation that the branch was created and set as current.

Step 2: Search for code

search_code:
  query: "deprecated_function"

Expected return: A list of files containing the deprecated function.

Step 3: Read and update each file

(Repeat for each file found in the search)

read_file:
  path: "path/to/file1.py"

Expected return: The content of the file.

(Update the file content manually)

commit_file:
  file_path: "path/to/file1.py"
  commit_message: "Replace deprecated_function with new_function in file1.py"
  content: "Updated file content"

Expected return: Confirmation that the file was committed.

Step 4: Create a pull request

create_pull_request:
  title: "Replace deprecated function with new function"
  body: "This PR replaces all instances of deprecated_function with new_function across the repository."

Expected return: Details of the created pull request, including its number.

Step 5: Approve and merge the pull request

(Same as steps 6 and 7 in Task 1)

Task 3: Analyze Repository History

Step 1: List all branches

list_branches:
  all_pages: true

Expected return: A list of all branches in the repository.

Step 2: Get commit history for a file

get_commit_history:
  file_path: "path/to/important/file.py"
  num_commits: 20

Expected return: The commit history for the specified file.

Step 3: Get file contents at a specific commit

get_file_at_commit:
  file_path: "path/to/important/file.py"
  commit_sha: "abc123..."  # Use a SHA from the commit history

Expected return: The content of the file at the specified commit.

Suggestions Box:

For the repository history analysis task, adopting the persona of a "Time-Traveling Code Archaeologist" might enhance the experience. This persona would approach the task with a sense of curiosity and excitement about uncovering the evolution of the code over time.

Task 4: Optimize Repository Performance

Step 1: Get function metrics

get_function_metrics:

Expected return: Metrics for all measured functions.

Step 2: Get top N functions by execution time

get_top_n_functions:
  n: 5

Expected return: The top 5 functions by total execution time.

Step 3: Analyze and optimize

(This step involves manually reviewing the results and optimizing the identified functions)

Step 4: Create a new branch for optimizations

create_branch:
  branch_name: "optimize-top-functions"

Expected return: Confirmation that the branch was created and set as current.

Step 5: Commit optimized files

(Repeat for each optimized file)

commit_file:
  file_path: "path/to/optimized/file.py"
  commit_message: "Optimize function X for better performance"
  content: "Optimized file content"

Expected return: Confirmation that the file was committed.

Step 6: Create a pull request

create_pull_request:
  title: "Optimize top 5 functions for better performance"
  body: "This PR optimizes the top 5 functions identified by our performance metrics, improving overall repository performance."

Expected return: Details of the created pull request, including its number.

Step 7: Approve and merge the pull request

(Same as steps 6 and 7 in Task 1)

Suggestions Box:

For the performance optimization task, adopting the persona of a "Code Performance Guru" could be beneficial. This persona would approach the task with a deep understanding of performance optimization techniques and a commitment to achieving maximum efficiency.