Skip to content

Commit 5a17732

Browse files
authored
Add critical command restrictions to roomote prompts (#210)
1 parent b104890 commit 5a17732

File tree

5 files changed

+45
-6
lines changed

5 files changed

+45
-6
lines changed

apps/roomote/src/lib/jobs/fixGitHubIssue.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { JobType, JobPayload } from '@roo-code-cloud/db';
22

33
import { runTask, type RunTaskCallbacks } from '../runTask';
4+
import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
45

56
const jobType: JobType = 'github.issue.fix';
67

@@ -19,6 +20,10 @@ Fix the following GitHub issue:
1920
2021
Repository: ${jobPayload.repo}
2122
Issue #${jobPayload.issue}
23+
24+
${CRITICAL_COMMAND_RESTRICTIONS}
25+
26+
${MAIN_BRANCH_PROTECTION}
2227
`.trim();
2328

2429
const { repo, issue } = jobPayload;

apps/roomote/src/lib/jobs/processIssueComment.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { JobType, JobPayload } from '@roo-code-cloud/db';
22

33
import { runTask, type RunTaskCallbacks } from '../runTask';
4+
import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
45

56
const jobType: JobType = 'github.issue.comment.respond';
67

@@ -31,6 +32,10 @@ Comment URL: ${jobPayload.commentUrl}
3132
3233
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.
3334
35+
${CRITICAL_COMMAND_RESTRICTIONS}
36+
37+
${MAIN_BRANCH_PROTECTION}
38+
3439
Instructions:
3540
1. Read and understand the context of the issue and the specific comment
3641
2. Provide a thoughtful, helpful response to the comment

apps/roomote/src/lib/jobs/processPullRequestComment.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { JobType, JobPayload } from '@roo-code-cloud/db';
22

33
import { runTask, type RunTaskCallbacks } from '../runTask';
4+
import { CRITICAL_COMMAND_RESTRICTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
45

56
const jobType: JobType = 'github.pr.comment.respond';
67

@@ -36,6 +37,10 @@ Base Branch: ${jobPayload.baseRef}
3637
3738
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.
3839
40+
${CRITICAL_COMMAND_RESTRICTIONS}
41+
42+
${MAIN_BRANCH_PROTECTION}
43+
3944
Instructions:
4045
1. First, respond to the comment to acknowledge the request and explain what you'll do
4146
2. Check out the PR branch: git checkout ${jobPayload.prBranch}

apps/roomote/src/lib/jobs/processSlackMention.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { JobType, JobPayload } from '@roo-code-cloud/db';
22

33
import { runTask, type RunTaskCallbacks } from '../runTask';
4+
import { CRITICAL_COMMAND_RESTRICTIONS, GIT_WORKFLOW_INSTRUCTIONS, MAIN_BRANCH_PROTECTION } from '../promptConstants';
45

56
const jobType: JobType = 'slack.app.mention';
67

@@ -27,18 +28,17 @@ ${originalPrompt}
2728
2829
Please analyze the request and implement the necessary changes. The user mentioned @roomote, which means they want you to engage with their request.
2930
31+
${CRITICAL_COMMAND_RESTRICTIONS}
32+
33+
${MAIN_BRANCH_PROTECTION}
34+
3035
Instructions:
3136
1. Read and understand the context of the request
3237
2. Implement the requested changes or provide the requested assistance
3338
3. Follow proper git workflow practices for any code changes
3439
4. Provide clear feedback on what was accomplished
3540
36-
IMPORTANT: After completing your changes, please follow this git workflow:
37-
1. Create and push your changes to a new remote branch using: git push origin HEAD:feature/your-branch-name
38-
2. Open a pull request using the GitHub CLI: gh pr create --title "Your PR Title" --body "Description of changes"
39-
3. Include the PR link in your completion message
40-
41-
This ensures all changes are properly tracked and can be reviewed before merging.
41+
${GIT_WORKFLOW_INSTRUCTIONS}
4242
`.trim();
4343

4444
// Add your workspace root to .env.local to override the default
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Shared constants for roomote job prompts
3+
*/
4+
5+
export const CRITICAL_COMMAND_RESTRICTIONS = `
6+
CRITICAL COMMAND RESTRICTIONS:
7+
- NEVER execute long-running commands like starting servers (npm run dev, npm start, python -m http.server, etc.)
8+
- NEVER execute interactive commands that require user input (interactive prompts, editors like vim/nano, etc.)
9+
- NEVER run commands that will block the terminal or require manual intervention
10+
- Use non-interactive alternatives when possible (e.g., use --yes flags, redirect input, etc.)
11+
`.trim();
12+
13+
export const GIT_WORKFLOW_INSTRUCTIONS = `
14+
IMPORTANT: After completing your changes, please follow this git workflow:
15+
1. Create and push your changes to a new remote branch using: git push origin HEAD:feature/your-branch-name
16+
2. Open a pull request using the GitHub CLI: gh pr create --title "Your PR Title" --body "Description of changes"
17+
3. Include the PR link in your completion message
18+
19+
This ensures all changes are properly tracked and can be reviewed before merging.
20+
`.trim();
21+
22+
export const MAIN_BRANCH_PROTECTION = `
23+
NEVER commit directly to the main branch. Always create a feature branch for your changes.
24+
`.trim();

0 commit comments

Comments
 (0)