Compare commits

...
Author SHA1 Message Date
Trevor Hudson be132137d8 chore: add changeset 2025-05-22 09:38:38 -07:00
3 changed files with 126 additions and 1 deletions
+77
View File
@@ -0,0 +1,77 @@
# Workflow: Create Pull Request
This workflow outlines the steps for creating a pull request (PR) after development work is completed on a feature branch. The AI should follow these steps precisely.
## Prerequisites:
- Work is completed on the current feature branch.
- All changes are saved.
## 1. Add Changes for Commit
Stage all relevant changes for the commit.
- **Action:** Execute `git add .` to stage all changes in the current directory.
- **Alternative:** If specific files need to be staged, the AI can ask the user or attempt to identify them based on the work done. For example, `git add src/feature-file.ts webview-ui/src/components/NewComponent.tsx`.
## 2. Create a Changeset (If Applicable)
If the project uses `changesets` (e.g., `npx changeset` or `yarn changeset`), create a new changeset.
- **Action:** Check for `changeset` CLI in `package.json` scripts or as a dev dependency.
- **If `changesets` is used:**
- **Action:** Ask the user for the type of change (patch, minor, or major) and a concise summary of the changes.
- **Action:** Generate a suitable filename for the changeset (e.g., `feature-name.md` or a randomly generated name like `quick-lions-glow.md`).
- **Action:** Create the changeset file in the `.changeset` directory using the `write_to_file` tool. The content should follow the standard changeset format:
```md
---
"package-name": patch # or minor/major based on user input
---
[User-provided summary of changes]
```
- **AI Note:** The AI should determine the "package-name" (e.g., "claude-dev" from `package.json` if it's a single-package repo, or ask if it's a monorepo and the affected package isn't clear).
- **If `changesets` is not used:** Skip this step.
## 3. Commit Changes
Commit the staged changes with a descriptive message.
- **Action:** Ask the user for a commit message or suggest one based on the task.
- **Guidance for AI:** Follow conventional commit message format if the project seems to use it (e.g., `feat: add user login functionality`, `fix: resolve issue with form validation`).
- **Action:** Execute `git commit -m "<commit-message>"`.
*If changesets were added in the previous step, the commit message could be something like `chore: add changeset` or the AI can ask the user for a more specific message.*
## 4. Rebase Main Branch onto Feature Branch
Ensure the feature branch is up-to-date with the latest changes from the main branch.
- **Action:** Identify the main branch (e.g., `main` or `master`).
- **Action:** Execute `git fetch origin <main-branch-name>`.
- **Action:** Execute `git rebase origin/<main-branch-name>`.
- **Conflict Resolution:** If rebase conflicts occur:
- Inform the user: "Rebase conflicts detected. Please resolve them in your editor. After resolving, run `git rebase --continue`. If you get stuck, you can run `git rebase --abort` to cancel the rebase."
- The AI should pause and wait for the user to confirm conflicts are resolved before proceeding.
## 5. Push Changes
Push the (potentially rebased) feature branch to the remote repository.
- **Action:** Get the current branch name: `git branch --show-current`.
- **Action:** Execute `git push origin <current-branch-name> --force-with-lease`.
*`--force-with-lease` is generally safer than `--force` when pushing rebased branches.*
## 6. Create Pull Request
Open a pull request on the repository hosting platform (e.g., GitHub, GitLab).
- **Action:** Use the `gh` CLI if available and authenticated.
- **Check for `gh`:** `gh --version`.
- **Check auth status:** `gh auth status`. If not authenticated, inform the user.
- **Create PR:** `gh pr create --fill --web` (opens in web browser to finalize) or `gh pr create --title "<PR Title>" --body "<PR Body>"`.
- The AI should ask the user for a PR title and body, or suggest them based on the commit messages/changesets.
- **Alternative (if `gh` CLI is not available/configured):**
- Provide the user with a link to create the PR. The link format depends on the platform (e.g., GitHub: `https://github.com/<owner>/<repo>/compare/<main-branch>...<feature-branch>?expand=1`). The AI will need to infer owner/repo from `git remote -v`.
- Instruct the user: "Please open the following link in your browser to create the Pull Request: [link]"
## AI Instructions & Considerations:
* **Error Handling:** If any Git command fails (other than expected rebase conflicts), report the error to the user and ask for guidance.
* **User Interaction:** Clearly communicate each step. Wait for user input for commit messages, PR titles/bodies, and confirmation of conflict resolution.
* **Platform Specifics:** Be mindful that `gh` is GitHub-specific. If the remote URL suggests GitLab or Bitbucket, the PR creation step will need to be adjusted (e.g., providing a generic link or different CLI commands if known).
* **Changeset Tooling:** The exact command for changesets might vary (`yarn changeset`, `pnpm changeset`, etc.). The AI should try to infer this from `package.json`.
* **Tool Usage:** Use the `execute_command` tool for Git and `gh` operations. Set `requires_approval` to `true` for commands that modify state or create PRs.
* **Idempotency:** If a PR already exists for the branch, `gh pr create` might fail or offer to update. The AI should handle this gracefully.
+48
View File
@@ -0,0 +1,48 @@
# Workflow: Start New Work
This workflow outlines the steps for starting a new piece of work or feature development. The AI should follow these steps precisely.
## 1. Ensure a Clean Working Directory
Before starting, ensure there are no uncommitted changes.
- **Action:** Execute `git status` to check for modifications.
- **If changes exist:** Ask the user if they want to stash them (`git stash`) or commit them. Proceed only when the working directory is clean.
## 2. Switch to the Main Branch
Switch to the primary development branch (commonly `main` or `master`).
- **Action:** Execute `git checkout main`.
*If `main` doesn't exist, try `master`. If neither exists, ask the user for the correct main branch name.*
## 3. Pull Latest Changes
Update the local main branch with the latest changes from the remote repository.
- **Action:** Execute `git pull origin main` (or the identified main branch name).
*Ensure this step completes successfully before proceeding.*
## 4. Create a New Feature Branch
Create a new branch for the work. The branch name should be descriptive.
- **Action:** Ask the user for a concise branch name (e.g., `feature/user-authentication` or `fix/login-bug`).
- **Guidance for AI:** Suggest a branch name based on the task if the user doesn't provide one.
- **Example format:** `feature/<short-description>`, `fix/<short-description>`, `chore/<short-description>`.
- **Action:** Execute `git checkout -b <branch-name>`.
## 5. Confirm Branch Creation
Verify that the new branch has been created and is currently active.
- **Action:** Execute `git branch --show-current`.
- **Expected Output:** The name of the newly created branch.
## 6. Understand the Task
Once the branch is set up, clarify the development task.
- **Action:** Ask the user: "Your new branch `<branch-name>` is ready. What would you like to build or work on?"
## AI Instructions & Considerations:
* **Error Handling:** If any Git command fails, report the error to the user and ask for guidance before retrying or proceeding.
* **User Interaction:** Clearly communicate each step being performed. Wait for user confirmation or input where specified (e.g., branch name, task description).
* **Project Context:** Be aware of the project structure (from `environment_details`) to understand potential impacts of the new work.
* **Idempotency:** If the workflow is re-run and the branch already exists, ask the user if they want to switch to it or delete and recreate it.
* **Tool Usage:** Use the `execute_command` tool for all Git operations. Set `requires_approval` to `false` for read-only commands like `git status` or `git branch --show-current`, and `true` for commands that modify state like `git checkout`, `git pull`, `git stash`.
@@ -8,7 +8,7 @@ const HomeHeader = () => {
<ClineLogoVariable className="size-16" />
</div>
<div className="text-center flex items-center justify-center">
<h2 className="m-0 text-[var(--vscode-font-size)]">{"What can I do for you?"}</h2>
<h2 className="m-0 text-[var(--vscode-font-size)]">{"How can I help you?"}</h2>
<HeroTooltip
placement="bottom"
className="max-w-[300px]"