Add critical command restrictions to roomote prompts (#210)

This commit is contained in:
Roomote 2025-07-06 10:12:03 -08:00 committed by GitHub
parent b10489052f
commit 5a17732d7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 45 additions and 6 deletions

View file

@ -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;

View file

@ -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

View file

@ -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}

View file

@ -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

View 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();