diff --git a/apps/roomote/src/lib/jobs/fixGitHubIssue.ts b/apps/roomote/src/lib/jobs/fixGitHubIssue.ts index 1d8206dd8a..21c0f02c6f 100644 --- a/apps/roomote/src/lib/jobs/fixGitHubIssue.ts +++ b/apps/roomote/src/lib/jobs/fixGitHubIssue.ts @@ -1,6 +1,7 @@ import type { JobType, JobPayload } from '@roo-code-cloud/db'; import { runTask, type RunTaskCallbacks } from '../runTask'; +import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants'; const jobType: JobType = 'github.issue.fix'; @@ -19,6 +20,10 @@ Fix the following GitHub issue: Repository: ${jobPayload.repo} Issue #${jobPayload.issue} + +${CRITICAL_COMMAND_RESTRICTIONS} + +${MAIN_BRANCH_PROTECTION} `.trim(); const { repo, issue } = jobPayload; diff --git a/apps/roomote/src/lib/jobs/processIssueComment.ts b/apps/roomote/src/lib/jobs/processIssueComment.ts index a9951a67a6..70b8704d5c 100644 --- a/apps/roomote/src/lib/jobs/processIssueComment.ts +++ b/apps/roomote/src/lib/jobs/processIssueComment.ts @@ -1,6 +1,7 @@ import type { JobType, JobPayload } from '@roo-code-cloud/db'; import { runTask, type RunTaskCallbacks } from '../runTask'; +import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants'; 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. +${CRITICAL_COMMAND_RESTRICTIONS} + +${MAIN_BRANCH_PROTECTION} + Instructions: 1. Read and understand the context of the issue and the specific comment 2. Provide a thoughtful, helpful response to the comment diff --git a/apps/roomote/src/lib/jobs/processPullRequestComment.ts b/apps/roomote/src/lib/jobs/processPullRequestComment.ts index 84610f2c9c..27a48584a3 100644 --- a/apps/roomote/src/lib/jobs/processPullRequestComment.ts +++ b/apps/roomote/src/lib/jobs/processPullRequestComment.ts @@ -1,6 +1,7 @@ import type { JobType, JobPayload } from '@roo-code-cloud/db'; import { runTask, type RunTaskCallbacks } from '../runTask'; +import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants'; 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. +${CRITICAL_COMMAND_RESTRICTIONS} + +${MAIN_BRANCH_PROTECTION} + Instructions: 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} diff --git a/apps/roomote/src/lib/jobs/processSlackMention.ts b/apps/roomote/src/lib/jobs/processSlackMention.ts index 7ead811c61..b232afd4cf 100644 --- a/apps/roomote/src/lib/jobs/processSlackMention.ts +++ b/apps/roomote/src/lib/jobs/processSlackMention.ts @@ -1,6 +1,7 @@ import type { JobType, JobPayload } from '@roo-code-cloud/db'; import { runTask, type RunTaskCallbacks } from '../runTask'; +import { CRITICAL_COMMAND_RESTRICTIONS, GIT_WORKFLOW_INSTRUCTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants'; 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. +${CRITICAL_COMMAND_RESTRICTIONS} + +${MAIN_BRANCH_PROTECTION} + Instructions: 1. Read and understand the context of the request 2. Implement the requested changes or provide the requested assistance 3. Follow proper git workflow practices for any code changes 4. Provide clear feedback on what was accomplished -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. +${GIT_WORKFLOW_INSTRUCTIONS} `.trim(); // Add your workspace root to .env.local to override the default diff --git a/apps/roomote/src/lib/promptConstants.ts b/apps/roomote/src/lib/promptConstants.ts new file mode 100644 index 0000000000..3baa6485be --- /dev/null +++ b/apps/roomote/src/lib/promptConstants.ts @@ -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(); \ No newline at end of file