feat: add push_to_default_branch and agent_timeout inputs

Playground repos can push directly to the default branch instead of opening PRs; agent runtime is configurable (default 5m).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Frank Schwenk
2026-07-05 15:54:43 +02:00
parent 893d7bec1e
commit 239e110b72
4 changed files with 61 additions and 12 deletions
+33 -12
View File
@@ -53,6 +53,36 @@ jq -n \
git config user.name "cursor"
git config user.email "cursor@users.noreply.gitea.schwenk.online"
AGENT_TIMEOUT="${AGENT_TIMEOUT:-5m}"
if [ "${PUSH_TO_DEFAULT_BRANCH:-false}" = "true" ]; then
TAKE_ACTION_SECTION='3. **Take Action:**
- If implementing code: commit changes directly to the default branch and push (do not open a pull request)
- If reviewing code: post a structured review in the pull request
- If answering questions: provide helpful, accurate information
- If the request is not feasible or safe: explain why and suggest alternatives
- Do not create a pull request for implementation work — push to the default branch instead'
SAFETY_RULES_SECTION='## SAFETY RULES
- Commit and push implementation changes directly to the default branch — do not create a pull request
- Always use MCP tools for Gitea interactions
- Be minimal, precise, and safe in your actions'
else
TAKE_ACTION_SECTION='3. **Take Action:**
- If implementing code: create a feature branch and open a pull request
- If reviewing code: post a structured review in the pull request
- If answering questions: provide helpful, accurate information
- If the request is not feasible or safe: explain why and suggest alternatives
- Use the MCP tool to create a Pull Request if needed'
SAFETY_RULES_SECTION='## SAFETY RULES
- NEVER push directly to protected branches (main, master, etc.)
- Always use MCP tools for Gitea interactions
- Be minimal, precise, and safe in your actions'
fi
PROMPT="You are an autonomous software engineering agent called cursor for repository: ${REPO_FULL_NAME}
## CONTEXT INFORMATION
@@ -84,25 +114,16 @@ You have full access to Gitea via MCP tools. Use them to:
- Consider the context of the ${ISSUE_TYPE} and previous discussion
- If the request is unclear, ask for clarification via a comment
3. **Take Action:**
- If implementing code: create a feature branch and open a pull request
- If reviewing code: post a structured review in the pull request
- If answering questions: provide helpful, accurate information
- If the request is not feasible or safe: explain why and suggest alternatives
- Use the MCP tool to create a Pull Request if needed
${TAKE_ACTION_SECTION}
4. **Let the user know you've completed the request**
- Post your response as a comment on the ${ISSUE_TYPE}
- If the request is not feasible or safe: explain why and suggest alternatives
## SAFETY RULES
- NEVER push directly to protected branches (main, master, etc.)
- Always use MCP tools for Gitea interactions
- Be minimal, precise, and safe in your actions"
${SAFETY_RULES_SECTION}"
echo "Running Cursor agent for ${REPO_FULL_NAME} ${ISSUE_TYPE} #${ISSUE_NUMBER} (model: ${AI_MODEL})"
timeout 30m agent -p "$PROMPT" --force --model "${AI_MODEL}" --output-format=text
timeout "${AGENT_TIMEOUT}" agent -p "$PROMPT" --force --model "${AI_MODEL}" --output-format=text
echo "Cursor agent completed."