mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-11 03:38:15 +00:00
Add critical command restrictions to roomote prompts (#210)
This commit is contained in:
parent
b10489052f
commit
5a17732d7c
5 changed files with 45 additions and 6 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
||||||
|
|
||||||
import { runTask, type RunTaskCallbacks } from '../runTask';
|
import { runTask, type RunTaskCallbacks } from '../runTask';
|
||||||
|
import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
|
||||||
|
|
||||||
const jobType: JobType = 'github.issue.fix';
|
const jobType: JobType = 'github.issue.fix';
|
||||||
|
|
||||||
|
|
@ -19,6 +20,10 @@ Fix the following GitHub issue:
|
||||||
|
|
||||||
Repository: ${jobPayload.repo}
|
Repository: ${jobPayload.repo}
|
||||||
Issue #${jobPayload.issue}
|
Issue #${jobPayload.issue}
|
||||||
|
|
||||||
|
${CRITICAL_COMMAND_RESTRICTIONS}
|
||||||
|
|
||||||
|
${MAIN_BRANCH_PROTECTION}
|
||||||
`.trim();
|
`.trim();
|
||||||
|
|
||||||
const { repo, issue } = jobPayload;
|
const { repo, issue } = jobPayload;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
||||||
|
|
||||||
import { runTask, type RunTaskCallbacks } from '../runTask';
|
import { runTask, type RunTaskCallbacks } from '../runTask';
|
||||||
|
import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
|
||||||
|
|
||||||
const jobType: JobType = 'github.issue.comment.respond';
|
const jobType: JobType = 'github.issue.comment.respond';
|
||||||
|
|
||||||
|
|
@ -31,6 +32,10 @@ Comment URL: ${jobPayload.commentUrl}
|
||||||
|
|
||||||
Please analyze the comment and provide a helpful response. The comment mentions @roomote, which means the user wants you to engage with their question or request.
|
Please analyze the comment and provide a helpful response. The comment mentions @roomote, which means the user wants you to engage with their question or request.
|
||||||
|
|
||||||
|
${CRITICAL_COMMAND_RESTRICTIONS}
|
||||||
|
|
||||||
|
${MAIN_BRANCH_PROTECTION}
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
1. Read and understand the context of the issue and the specific comment
|
1. Read and understand the context of the issue and the specific comment
|
||||||
2. Provide a thoughtful, helpful response to the comment
|
2. Provide a thoughtful, helpful response to the comment
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
||||||
|
|
||||||
import { runTask, type RunTaskCallbacks } from '../runTask';
|
import { runTask, type RunTaskCallbacks } from '../runTask';
|
||||||
|
import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
|
||||||
|
|
||||||
const jobType: JobType = 'github.pr.comment.respond';
|
const jobType: JobType = 'github.pr.comment.respond';
|
||||||
|
|
||||||
|
|
@ -36,6 +37,10 @@ Base Branch: ${jobPayload.baseRef}
|
||||||
|
|
||||||
Please analyze the comment and understand what changes are being requested. Then implement the requested changes directly on the PR branch AND respond to the comment.
|
Please analyze the comment and understand what changes are being requested. Then implement the requested changes directly on the PR branch AND respond to the comment.
|
||||||
|
|
||||||
|
${CRITICAL_COMMAND_RESTRICTIONS}
|
||||||
|
|
||||||
|
${MAIN_BRANCH_PROTECTION}
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
1. First, respond to the comment to acknowledge the request and explain what you'll do
|
1. First, respond to the comment to acknowledge the request and explain what you'll do
|
||||||
2. Check out the PR branch: git checkout ${jobPayload.prBranch}
|
2. Check out the PR branch: git checkout ${jobPayload.prBranch}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
import type { JobType, JobPayload } from '@roo-code-cloud/db';
|
||||||
|
|
||||||
import { runTask, type RunTaskCallbacks } from '../runTask';
|
import { runTask, type RunTaskCallbacks } from '../runTask';
|
||||||
|
import { CRITICAL_COMMAND_RESTRICTIONS, GIT_WORKFLOW_INSTRUCTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
|
||||||
|
|
||||||
const jobType: JobType = 'slack.app.mention';
|
const jobType: JobType = 'slack.app.mention';
|
||||||
|
|
||||||
|
|
@ -27,18 +28,17 @@ ${originalPrompt}
|
||||||
|
|
||||||
Please analyze the request and implement the necessary changes. The user mentioned @roomote, which means they want you to engage with their request.
|
Please analyze the request and implement the necessary changes. The user mentioned @roomote, which means they want you to engage with their request.
|
||||||
|
|
||||||
|
${CRITICAL_COMMAND_RESTRICTIONS}
|
||||||
|
|
||||||
|
${MAIN_BRANCH_PROTECTION}
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
1. Read and understand the context of the request
|
1. Read and understand the context of the request
|
||||||
2. Implement the requested changes or provide the requested assistance
|
2. Implement the requested changes or provide the requested assistance
|
||||||
3. Follow proper git workflow practices for any code changes
|
3. Follow proper git workflow practices for any code changes
|
||||||
4. Provide clear feedback on what was accomplished
|
4. Provide clear feedback on what was accomplished
|
||||||
|
|
||||||
IMPORTANT: After completing your changes, please follow this git workflow:
|
${GIT_WORKFLOW_INSTRUCTIONS}
|
||||||
1. Create and push your changes to a new remote branch using: git push origin HEAD:feature/your-branch-name
|
|
||||||
2. Open a pull request using the GitHub CLI: gh pr create --title "Your PR Title" --body "Description of changes"
|
|
||||||
3. Include the PR link in your completion message
|
|
||||||
|
|
||||||
This ensures all changes are properly tracked and can be reviewed before merging.
|
|
||||||
`.trim();
|
`.trim();
|
||||||
|
|
||||||
// Add your workspace root to .env.local to override the default
|
// Add your workspace root to .env.local to override the default
|
||||||
|
|
|
||||||
24
apps/roomote/src/lib/promptConstants.ts
Normal file
24
apps/roomote/src/lib/promptConstants.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
/**
|
||||||
|
* Shared constants for roomote job prompts
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const CRITICAL_COMMAND_RESTRICTIONS = `
|
||||||
|
CRITICAL COMMAND RESTRICTIONS:
|
||||||
|
- NEVER execute long-running commands like starting servers (npm run dev, npm start, python -m http.server, etc.)
|
||||||
|
- NEVER execute interactive commands that require user input (interactive prompts, editors like vim/nano, etc.)
|
||||||
|
- NEVER run commands that will block the terminal or require manual intervention
|
||||||
|
- Use non-interactive alternatives when possible (e.g., use --yes flags, redirect input, etc.)
|
||||||
|
`.trim();
|
||||||
|
|
||||||
|
export const GIT_WORKFLOW_INSTRUCTIONS = `
|
||||||
|
IMPORTANT: After completing your changes, please follow this git workflow:
|
||||||
|
1. Create and push your changes to a new remote branch using: git push origin HEAD:feature/your-branch-name
|
||||||
|
2. Open a pull request using the GitHub CLI: gh pr create --title "Your PR Title" --body "Description of changes"
|
||||||
|
3. Include the PR link in your completion message
|
||||||
|
|
||||||
|
This ensures all changes are properly tracked and can be reviewed before merging.
|
||||||
|
`.trim();
|
||||||
|
|
||||||
|
export const MAIN_BRANCH_PROTECTION = `
|
||||||
|
NEVER commit directly to the main branch. Always create a feature branch for your changes.
|
||||||
|
`.trim();
|
||||||
Loading…
Add table
Reference in a new issue