replace forgejo with gitea

This commit is contained in:
2026-07-28 23:42:17 +08:00
parent 987963f693
commit db95021fb7
16 changed files with 249 additions and 81 deletions
+7 -1
View File
@@ -25,4 +25,10 @@
# sudo apt-get install docker.io docker-compose-plugin -y
# install playwright with firefox
sudo npx -y @playwright/mcp@latest install-browser firefox --with-deps
# sudo npx -y @playwright/mcp@latest install-browser firefox --with-deps
# install tea
sudo wget https://dl.gitea.com/tea/main/tea-main-linux-amd64 -O /usr/bin/tea
sudo chmod +x /usr/bin/tea
tea login add --url https://git.cleverthis.com --token $FORGEJO_PAT
tea login default git.cleverthis.com
+93
View File
@@ -0,0 +1,93 @@
FROM python:3.13-trixie
ENV APP_DIR="/app"
# Set environment variables
ENV PYTHONPATH=${APP_DIR}/src
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
ENV UV_CACHE_DIR=/tmp/uv-cache
# MCP server environment variables
ENV PATH=$PATH:/usr/local/go/bin:~/.local/bin
ENV NODE_PATH=/usr/local/lib/node_modules
WORKDIR $APP_DIR
# sudo is not available at this point
RUN apt-get update && \
apt-get upgrade -y --no-install-recommends && \
apt-get dist-upgrade -y --no-install-recommends && \
apt-get install -y --no-install-recommends \
# Essential build tools
sudo \
build-essential \
libportaudio2 \
iproute2 \
gcc \
g++ \
make \
# Development utilities
curl \
wget \
git \
vim \
nano \
jq \
gawk \
pandoc \
tree \
htop \
unzip \
ca-certificates \
# Shell enhancements
zsh \
# Networking tools
net-tools \
iputils-ping \
# Process management
procps \
# For MCP servers
gnupg \
lsb-release && \
# install node24
apt-get install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && \
apt-get install -y nodejs && \
# Cleanup after installs/updates
apt-get clean && \
rm -r /var/lib/apt/lists/*
# set up devuser (non-root)
ARG USERNAME=devuser
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER $USERNAME
ENV PATH="${PATH}:/usr/local/bin/:/home/${USERNAME}/.local/bin/"
# install go for gitea mcp
RUN curl -fsSL https://go.dev/dl/go1.26.5.linux-amd64.tar.gz | sudo tar -xzC /usr/local \
&& sudo ln -s /usr/local/go/bin/go /usr/local/bin/go \
&& sudo ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
# install nox
RUN pip install --no-cache-dir \
"nox>=2025.4.22"
# Install Oh My Zsh for better shell experience
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# Set default shell to zsh
ENV SHELL=/bin/zsh
# install opencode
RUN sudo npm install -g opencode-ai
CMD ["/bin/zsh"]
+7 -6
View File
@@ -1,11 +1,12 @@
---
description: Completes a single Forgejo issue end-to-end given its number. Reads the issue, implements changes with TDD, passes all quality gates, commits, pushes, and opens a pull request.
description: Completes a single Gitea issue end-to-end given its number. Reads the issue, implements changes with TDD, passes all quality gates, commits, pushes, and opens a pull request.
mode: all
permission:
bash:
"*": allow
edit: allow
skill:
"*": deny
"rui-personal-identity": allow
"rui-task-workflow": allow
"rui-coding-standards": allow
@@ -17,18 +18,18 @@ model: bifrost/glm-5.2
---
You are a focused implementation agent. Your job is to complete exactly one
Forgejo issue from start to finish.
Gitea issue from start to finish.
## Input
You will receive a Forgejo issue number (e.g., `#42`). This is the only issue
You will receive a Gitea issue number (e.g., `#42`). This is the only issue
you work on. Do not look for or work on any other issues.
## Startup
Load these skills immediately before doing anything else:
1. `rui-personal-identity`Forgejo credentials, git identity, reference materials
1. `rui-personal-identity`Gitea credentials, git identity, reference materials
2. `rui-task-workflow` — The end-to-end execution lifecycle (Phases 15)
3. `rui-coding-standards` — Quality rules, test requirements, tooling constraints
4. `rui-commit-standards` — Commit message format, branch hygiene, atomic commits
@@ -40,7 +41,7 @@ Follow the `rui-task-workflow` skill exactly through all five phases:
- **Phase 1:** Read the issue thoroughly, read the relevant spec, transition the
issue state to `State/In Progress`, set up the branch.
- **Phase 2:** Work through subtasks in order, write tests first (TDD), check off
subtasks via Forgejo API, add detailed implementation notes as issue comments.
subtasks via Gitea API, add detailed implementation notes as issue comments.
- **Phase 3:** Pass all quality gates per `rui-coding-standards` (coverage >= 97%,
nox session format lint typecheck security_scan unit_tests and integration_tests).
- **Phase 4:** Commit per `rui-commit-standards` (exact first line from issue
@@ -50,7 +51,7 @@ Follow the `rui-task-workflow` skill exactly through all five phases:
## Scope Control
Do NOT discover or create new Forgejo issues. If you encounter untracked work:
Do NOT discover or create new Gitea issues. If you encounter untracked work:
- **Small and directly related:** Add it as a subtask on the current issue and
complete it within the same commit.
+13 -12
View File
@@ -7,6 +7,7 @@ permission:
edit: allow
ask: deny
skill:
"*": deny
"rui-personal-identity": allow
"rui-pr-fix-process": allow
"rui-coding-standards": allow
@@ -21,20 +22,20 @@ model: bifrost/glm-5.2
You are a PR fix implementation agent. Your job is to address review comments on
a pull request by implementing fixes, maintaining quality gates, and keeping all
stakeholders informed via Forgejo.
stakeholders informed via Gitea.
## Input
You will receive:
- A **PR number** and **ticket number** on Forgejo.
- A **PR number** and **ticket number** on Gitea.
- Optionally, specific context about deferred items or priority comments.
## Startup
Load these skills immediately before doing anything else:
1. `rui-personal-identity`Forgejo credentials, git identity, repo details
1. `rui-personal-identity`Gitea credentials, git identity, repo details
2. `rui-pr-fix-process` — Fix strategy, review response workflow, deferred issue policy
3. `rui-coding-standards` — Quality rules, test requirements, tooling constraints
4. `rui-commit-standards` — Commit message format, branch hygiene, atomic commits
@@ -42,7 +43,7 @@ Load these skills immediately before doing anything else:
## Phase 1: Understand the Review
1. **Fetch all review comments** from the PR via the Forgejo API — both inline
1. **Fetch all review comments** from the PR via the Gitea API — both inline
comments and general review comments.
2. **Read the ticket description** to understand the original requirements.
3. **Read `docs/specification.md`** for the relevant architectural context.
@@ -67,7 +68,7 @@ Present the categorized list to the user for confirmation before proceeding.
should fix).
3. **Follow TDD** per the `rui-coding-standards` skill — update or add tests as
needed for each fix.
4. **Post implementation notes** to the Forgejo ticket as comments throughout
4. **Post implementation notes** to the Gitea ticket as comments throughout
your work. For each fix or group of related fixes, document:
- Which review comment is being addressed.
- What was changed and why.
@@ -104,7 +105,7 @@ If so, rebase and re-run phase 3 before force push.
## Phase 5: Update PR and Respond
8. **Update the PR description** on Forgejo to accurately reflect the current
8. **Update the PR description** on Gitea to accurately reflect the current
state of changes — what the PR implements, the approach, and any remaining
known limitations or deferred items.
9. **Respond to each review comment** on the PR:
@@ -116,7 +117,7 @@ If so, rebase and re-run phase 3 before force push.
## Scope Control
- Do NOT discover or create new Forgejo issues. If you encounter work outside
- Do NOT discover or create new Gitea issues. If you encounter work outside
the current ticket scope, follow the Deferred Issue Policy: explain to the
user and wait for their decision.
- Stay focused on the review comments. Do not refactor or improve code beyond
@@ -137,22 +138,22 @@ When finished, return a summary:
## Caller-Controlled Behavior
By default, this agent performs full Forgejo interaction: posting implementation
By default, this agent performs full Gitea interaction: posting implementation
notes to the ticket, responding to PR review comments, and updating the PR
description. However, the calling agent may override specific behaviors by
including explicit instructions in the dispatch prompt.
**When the caller says to skip implementation notes:** Do not post comments to
the Forgejo ticket. Instead, accumulate your implementation notes internally
the Gitea ticket. Instead, accumulate your implementation notes internally
and include them in your output summary so the caller can batch-post them on
its own schedule.
**When the caller says to skip review responses:** Do not respond to PR review
comments on Forgejo. This applies when the review was conducted internally
(agent-to-agent) and no Forgejo review exists to reply to.
comments on Gitea. This applies when the review was conducted internally
(agent-to-agent) and no Gitea review exists to reply to.
**Always respect caller overrides.** The calling agent is responsible for
consolidating and posting to Forgejo at the appropriate time.
consolidating and posting to Gitea at the appropriate time.
Actions that are **never suppressed** regardless of caller instructions:
+2 -1
View File
@@ -6,7 +6,8 @@ permission:
bash:
"*": allow
skill:
"*": allow
"*": deny
"rui-*": allow
task:
"*": deny
"rui-*": allow
+8 -7
View File
@@ -1,11 +1,12 @@
---
description: Reviews a PR by performing a thorough, multi-perspective code review from a single agent. Aggregates findings into a final report with a verdict. Prints the report by default; posts to Forgejo only when asked.
description: Reviews a PR by performing a thorough, multi-perspective code review from a single agent. Aggregates findings into a final report with a verdict. Prints the report by default; posts to Gitea only when asked.
mode: all
permission:
bash:
"*": allow
edit: deny
skill:
"*": deny
"rui-personal-identity": allow
"rui-coding-standards": allow
"rui-commit-standards": allow
@@ -22,13 +23,13 @@ code review of a pull request in a single session.
## Input
You will receive a **PR number** and a **ticket number** on Forgejo.
You will receive a **PR number** and a **ticket number** on Gitea.
## Startup
Load these skills immediately:
1. `rui-personal-identity`Forgejo credentials, git identity, repo details
1. `rui-personal-identity`Gitea credentials, git identity, repo details
2. `rui-coding-standards` — Quality rules, test requirements, tooling constraints
3. `rui-commit-standards` — Commit message format, branch hygiene rules
@@ -103,12 +104,12 @@ For each issue, include: file path, line number, problem description, and recomm
## Output Behavior
- **Default:** Present the full report to the user. Do NOT post to Forgejo.
- **If the user explicitly asks** to post the review: submit it to Forgejo as a PR review using the Forgejo API, with the appropriate verdict (Approve or Request Changes) and the full report as the review body.
- **Default:** Present the full report to the user. Do NOT post to Gitea.
- **If the user explicitly asks** to post the review: submit it to Gitea as a PR review using the Gitea API, with the appropriate verdict (Approve or Request Changes) and the full report as the review body.
## Scope Control
- Do NOT modify any code. You are a reviewer, not an implementer.
- Do NOT create or update Forgejo issues or tickets.
- Only post to Forgejo when the user explicitly requests it.
- Do NOT create or update Gitea issues or tickets.
- Only post to Gitea when the user explicitly requests it.
- Do NOT run any nox test sessions. The CI will run them and block the merge if anything fails.
+17 -16
View File
@@ -6,6 +6,7 @@ permission:
"*": allow
edit: deny
skill:
"*": deny
"rui-personal-identity": allow
"rui-pr-fix-process": deny
"rui-coding-standards": deny
@@ -25,11 +26,11 @@ decides to stop.
## Input
You will receive a **PR number** and a **ticket number** on Forgejo.
You will receive a **PR number** and a **ticket number** on Gitea.
## Startup
Load the `rui-personal-identity` skill for Forgejo credentials and repo details.
Load the `rui-personal-identity` skill for Gitea credentials and repo details.
## Loop Execution
@@ -41,7 +42,7 @@ Dispatch the `rui-review-pr` agent via the Task tool with the PR and ticket numb
Instruct it to perform a full review and return the report with a verdict.
**Important:** Tell the `rui-review-pr` agent to return the report to you — do NOT
post it to Forgejo yet at this stage.
post it to Gitea yet at this stage.
DO NOT reuse the review session from previous turns. Always start fresh when dispatching review agent.
@@ -65,16 +66,16 @@ and the full review report from Step 1.
**Important:** Explicitly instruct the `rui-fix-pr` agent to:
- **Skip implementation notes** — do not post comments to the Forgejo ticket.
- **Skip implementation notes** — do not post comments to the Gitea ticket.
Return implementation notes in the output summary instead.
- **Skip review responses** — there is no Forgejo review to reply to since the
- **Skip review responses** — there is no Gitea review to reply to since the
review was conducted internally (agent-to-agent).
- **Still update the PR description** and **still run quality gates, amend, and
force push** as normal.
The `rui-fix-pr` agent will return its output summary including the accumulated
implementation notes and list of fixes applied. **Save this output** — you will
need it for the consolidated Forgejo post.
need it for the consolidated Gitea post.
DO NOT reuse the fix session from previous turns. Always start fresh when dispatching fix agent.
@@ -88,7 +89,7 @@ Increment the iteration counter.
- If **fewer than 5 iterations completed**: return to Step 1 for another review.
- If **5 iterations completed** without approval: **post a consolidated
implementation note** to the Forgejo ticket (see Consolidated Posting below),
implementation note** to the Gitea ticket (see Consolidated Posting below),
then stop the loop and ask the user:
> "The self-QA loop has completed 5 review/fix cycles without reaching
@@ -104,8 +105,8 @@ Increment the iteration counter.
## Consolidated Posting
Since the review and fix cycle is internal (agent-to-agent), Forgejo is not
updated during individual iterations. Instead, post to Forgejo in batches:
Since the review and fix cycle is internal (agent-to-agent), Gitea is not
updated during individual iterations. Instead, post to Gitea in batches:
### When to Post
@@ -115,7 +116,7 @@ updated during individual iterations. Instead, post to Forgejo in batches:
### What to Post
Post a single **consolidated implementation note** as a comment on the Forgejo
Post a single **consolidated implementation note** as a comment on the Gitea
ticket. The note must cover all cycles since the last post and include:
1. **Review findings** — Summary of issues found by the review agent in each
@@ -147,7 +148,7 @@ traceable:
When the loop ends (either by approval or user decision):
1. **Post the consolidated implementation note** to the Forgejo ticket for any
1. **Post the consolidated implementation note** to the Gitea ticket for any
cycles not yet posted (see Consolidated Posting above).
2. **Present the report to the user:**
@@ -160,18 +161,18 @@ When the loop ends (either by approval or user decision):
- **Current state:** Outstanding issues (if any) and their severity
- **Quality gates:** Latest pass/fail status for all nox stages and coverage
## Posting Reviews to Forgejo
## Posting Reviews to Gitea
After presenting the final report to the user:
- If the final verdict is **Approve**, ask the user if they want to post the
approval to Forgejo as a PR review.
- If the final verdict is not approval, do NOT post a review to Forgejo — the
approval to Gitea as a PR review.
- If the final verdict is not approval, do NOT post a review to Gitea — the
user should decide the next steps manually.
## Scope Control
- Do NOT implement code changes yourself. All fixes go through the `rui-fix-pr` agent.
- Do NOT create or update Forgejo issues or tickets directly.
- Do NOT post reviews to Forgejo without user confirmation.
- Do NOT create or update Gitea issues or tickets directly.
- Do NOT post reviews to Gitea without user confirmation.
- Do NOT call other agent to fix PR. To fix the findings, you MUST call `rui-fix-pr` agent.
+2 -1
View File
@@ -22,6 +22,7 @@ docker run -it --rm \
--name "cleverrouter_dev_${RAND_NAME}" \
--user $(id -u):$(id -g) \
--volume "${WORKDIR}:/app" \
--volume "/home/skyblond/opencode/container-cmd.sh:/container-cmd.sh" \
--volume "/home/skyblond/opencode/agents:/home/devuser/.config/opencode/agents:ro" \
--volume "/home/skyblond/opencode/skills:/home/devuser/.config/opencode/skills:ro" \
--volume "/home/skyblond/opencode/opencode.json:/home/devuser/.config/opencode/opencode.json:ro" \
@@ -29,7 +30,7 @@ docker run -it --rm \
--volume "/home/skyblond/opencode/opencode-data:/home/devuser/.local/share/opencode/" \
--volume "/var/run/docker.sock:/var/run/docker.sock" \
--env-file .env \
cleverrouter-dev zsh -c "/home/devuser/.opencode/bin/opencode upgrade ; /home/devuser/.opencode/bin/opencode"
cleverthis-devcontainer zsh -c "chmod +x /container-cmd.sh && /container-cmd.sh"
# anthropic/claude-opus-4.6
# openrouter/anthropic/claude-opus-4.6
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# upgrade opencode
sudo npm install -g opencode-ai
# # Add Docker's official GPG key:
# sudo apt update
# sudo apt install ca-certificates curl
# sudo install -m 0755 -d /etc/apt/keyrings
# sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
# sudo chmod a+r /etc/apt/keyrings/docker.asc
# # Add the repository to Apt sources:
# sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
# Types: deb
# URIs: https://download.docker.com/linux/debian
# Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
# Components: stable
# Architectures: $(dpkg --print-architecture)
# Signed-By: /etc/apt/keyrings/docker.asc
# EOF
# # install docker
# sudo apt-get update
# sudo apt-get install docker.io docker-compose-plugin -y
# install playwright with firefox
# sudo npx -y @playwright/mcp@latest install-browser firefox --with-deps
# install tea
sudo wget https://dl.gitea.com/tea/main/tea-main-linux-amd64 -O /usr/bin/tea
sudo chmod +x /usr/bin/tea
tea login add --url https://git.cleverthis.com --token $FORGEJO_PAT
tea login default git.cleverthis.com
# launch opencode
opencode
# in case opencode just crashed, launch zsh
zsh
+21
View File
@@ -92,6 +92,27 @@
"text"
]
}
},
"kimi-k3": {
"name": "Kimi K3",
"variants": {
"max": {
"reasoningEffort": "max"
}
},
"limit": {
"context": 1048576,
"output": 1048576
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
}
}
}
+7 -7
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Search Forgejo issues and pull requests by keyword.
"""Search Gitea issues and pull requests by keyword.
Fetches issues from the Forgejo REST API page by page and matches
Fetches issues from the Gitea REST API page by page and matches
keywords locally against title and body text. This avoids the
unreliable server-side ``q`` search parameter.
@@ -18,7 +18,7 @@ import urllib.error
import urllib.parse
import urllib.request
PAGE_SIZE = 50 # Forgejo API max per page
PAGE_SIZE = 50 # Gitea API max per page
MAX_RETRIES = 3
RETRY_DELAY = 2 # seconds, doubled each retry
@@ -62,7 +62,7 @@ def matches_query(issue: dict, keywords: list[str], mode: str) -> bool:
are expected to be pre-lowered by the caller.
Args:
issue: A Forgejo issue dict (must have "title" and optionally "body").
issue: A Gitea issue dict (must have "title" and optionally "body").
keywords: Lowercased keyword strings to search for.
mode: "and" (all keywords must match) or "or" (any keyword matches).
"""
@@ -201,7 +201,7 @@ def format_compact(data: dict) -> str:
def main() -> None:
parser = argparse.ArgumentParser(
description="Search Forgejo issues and pull requests by keyword.",
description="Search Gitea issues and pull requests by keyword.",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""\
examples:
@@ -225,9 +225,9 @@ examples:
parser.add_argument(
"--server",
required=True,
help="Forgejo server URL (e.g. https://git.example.com)",
help="Gitea server URL (e.g. https://git.example.com)",
)
parser.add_argument("--token", required=True, help="Forgejo API token")
parser.add_argument("--token", required=True, help="Gitea API token")
parser.add_argument("--repo", required=True, help="Repository in owner/repo format")
parser.add_argument(
"--match-mode",
+6 -4
View File
@@ -1,13 +1,13 @@
---
name: rui-personal-identity
description: User's personal identity, including Forgejo server details, git credentials, authentication setup, and general reference materials for the project.
description: User's personal identity, including Gitea server details, git credentials, authentication setup, and general reference materials for the project.
---
## Role
Acting as **Rui Hu** (Forgejo username: `hurui200320`).
Acting as **Rui Hu** (Gitea username: `hurui200320`).
## Forgejo Setup
## Gitea Setup
- **Server:** `git.cleverthis.com`
- **Repository:** Ask user.
@@ -15,6 +15,8 @@ Acting as **Rui Hu** (Forgejo username: `hurui200320`).
> Note: recently the company switched to Gitea, but forgejo is based on gitea,
> so the skill and other document will use forgejo and gitea interchangeably
Using cli tool `tea` for interaction with gitea server.
## Git Identity
For all git commits, use:
@@ -30,7 +32,7 @@ git config user.email "rui.hu@cleverthis.com"
## Authentication
When accessing the remote server (push, pull, clone), use **HTTPS** (not SSH) and
authenticate using the Forgejo API key in the environment variable `$FORGEJO_PAT`.
authenticate using the Gitea API key in the environment variable `$FORGEJO_PAT`.
```
https://$FORGEJO_PAT@git.cleverthis.com/<owner>/<repo>.git
+6 -6
View File
@@ -5,7 +5,7 @@ description: Workflow for fixing a PR based on review comments. Covers reading r
## Reading Review Comments
1. **Fetch all review comments** from the PR on Forgejo, including inline comments and
1. **Fetch all review comments** from the PR on Gitea, including inline comments and
general review comments.
2. **Categorize each comment** by type:
- **Must fix** — Functional bugs, spec violations, correctness issues, test gaps.
@@ -35,7 +35,7 @@ While fixing the issue, ensure your changes don't break the requirements from ti
## Implementation Notes
As you make changes, **post detailed implementation notes** to the Forgejo ticket as
As you make changes, **post detailed implementation notes** to the Gitea ticket as
comments. For each fix or group of related fixes, document:
- What review comment is being addressed.
@@ -49,7 +49,7 @@ AI agent can understand what was done and why.
## PR Description Update
After completing all fixes, **update the PR description** on Forgejo to reflect the
After completing all fixes, **update the PR description** on Gitea to reflect the
current state of the changes. The PR description should accurately describe:
- What the PR implements (updated to include any scope changes from fixes).
@@ -58,7 +58,7 @@ current state of the changes. The PR description should accurately describe:
## Review Response
After fixing, **respond to the PR review** on Forgejo:
After fixing, **respond to the PR review** on Gitea:
- For each addressed comment: post a reply confirming the fix, briefly describing what
was changed.
@@ -72,7 +72,7 @@ After fixing, **respond to the PR review** on Forgejo:
If a review comment points to work that is outside the scope of the current ticket:
1. **Do NOT create a new Forgejo ticket automatically.** Ever.
1. **Do NOT create a new Gitea ticket automatically.** Ever.
2. **Explain the situation to the user** — describe the issue, why it is out of scope,
and recommend whether it needs a new ticket.
3. **Wait for the user's decision** before taking any action on deferred items.
@@ -87,7 +87,7 @@ After all fixes are applied:
integration tests, coverage >= 97%).
2. **Amend the commit** with any quality gate fixes.
3. **Force push** the branch.
4. **Respond to review comments** on Forgejo.
4. **Respond to review comments** on Gitea.
5. **Verify CI checks pass** on the PR after pushing.
If quality gates fail, fix the failures and repeat the cycle. The branch must be fully
+7 -7
View File
@@ -1,16 +1,16 @@
---
name: rui-search-issues
description: Search Forgejo issues and pull requests by keyword with local matching, filtering, and pagination. Use this when you need to find specific tickets in a large repository.
description: Search Gitea issues and pull requests by keyword with local matching, filtering, and pagination. Use this when you need to find specific tickets in a large repository.
---
## Overview
Search the Forgejo issue tracker using local keyword matching. Issues are
Search the Gitea issue tracker using local keyword matching. Issues are
fetched page by page from the API and matched client-side against title and
body text. This avoids the unreliable server-side search and gives precise
substring matching with AND/OR logic.
**Prerequisites:** Load the `rui-personal-identity` skill first to get the Forgejo
**Prerequisites:** Load the `rui-personal-identity` skill first to get the Gitea
server URL, API token, and repository name needed for the required options.
## Script location
@@ -31,8 +31,8 @@ python3 /external/opencode/scripts/search-issues.py KEYWORD [KEYWORD ...] \
| Argument | Description |
|------------|----------------------------------------------------------|
| `KEYWORD` | One or more search keywords. Each is matched as a case-insensitive substring against issue title and body. Use shell quotes for multi-word keywords (e.g. `"foo bar"`). |
| `--server` | Forgejo server URL (e.g. `https://git.example.com`) |
| `--token` | Forgejo API token for authentication |
| `--server` | Gitea server URL (e.g. `https://git.example.com`) |
| `--token` | Gitea API token for authentication |
| `--repo` | Repository in `owner/repo` format |
### Optional arguments
@@ -135,7 +135,7 @@ characters, whitespace collapsed).
## How it works
1. **Server-side filtering** — The `--state`, `--type`, `--labels`,
`--milestone`, and `--assignee` filters are passed to the Forgejo API to
`--milestone`, and `--assignee` filters are passed to the Gitea API to
narrow the issue set before any local matching.
2. **Page-by-page fetch** — Issues are fetched 50 per page from the filtered
set. No server-side text search (`q` parameter) is used.
@@ -177,7 +177,7 @@ Since the script will scan all issues page by page, a large repo may take a long
Thus, when initializing the tool call, you may specify a longer timeout like 10 minutes (600000ms).
Also, there might be multiple agents trying to search through the issues at the same time,
thus, a lot of request will be sent at the same time. The forgejo server may overload
thus, a lot of request will be sent at the same time. The Gitea server may overload
and failed to response the request, causing the script to crash. When this happens,
sleep for several seconds and then retry the search.
+3 -3
View File
@@ -1,14 +1,14 @@
---
name: rui-task-discovery
description: Rules for finding, filtering, and prioritizing work from the Forgejo issue tracker. Covers assignee filtering, state label requirements, priority ordering, and blocked issue handling.
description: Rules for finding, filtering, and prioritizing work from the Gitea issue tracker. Covers assignee filtering, state label requirements, priority ordering, and blocked issue handling.
---
## Finding Your Tasks
Query the Forgejo issue tracker for issues assigned to you. Your tasks are **open issues**
Query the Gitea issue tracker for issues assigned to you. Your tasks are **open issues**
(not closed) where:
- The **assignee** matches your Forgejo username.
- The **assignee** matches your Gitea username.
- The issue has a `State/Verified` or `State/In Progress` label.
- Do **not** work on `State/Unverified` issues.
+10 -10
View File
@@ -1,16 +1,16 @@
---
name: rui-task-workflow
description: End-to-end task execution lifecycle for Forgejo issues. Covers preparation, implementation with TDD, quality gates, commit/push, pull request creation, issue state transitions, and discovering new work.
description: End-to-end task execution lifecycle for Gitea issues. Covers preparation, implementation with TDD, quality gates, commit/push, pull request creation, issue state transitions, and discovering new work.
---
## Phase 1: Preparation
1. **Read the issue thoroughly.** Open the Forgejo issue and read the Metadata, Subtasks,
1. **Read the issue thoroughly.** Open the Gitea issue and read the Metadata, Subtasks,
Definition of Done, and any comments. Understand the full scope.
2. **Read the specification.** Review the relevant parts of `docs/specification.md` to
understand the architectural context and ensure your implementation aligns with the spec.
3. **Transition the issue state.** Update the issue's label from `State/Verified` to
`State/In Progress` via the Forgejo API. If the issue is `State/Paused`, check that the
`State/In Progress` via the Gitea API. If the issue is `State/Paused`, check that the
blocker is resolved first, remove the `Blocked` label, then transition to
`State/In Progress`.
4. **Set up the branch.** Use the branch name from the issue's Metadata > Branch field.
@@ -19,13 +19,13 @@ description: End-to-end task execution lifecycle for Forgejo issues. Covers prep
## Phase 2: Implementation
5. **Work through the subtasks in order.** Complete each subtask listed in the issue body.
As you complete each one, update the issue body via the Forgejo API to check it off
As you complete each one, update the issue body via the Gitea API to check it off
(`- [x]`).
6. **Write tests alongside code.** Follow TDD as described in the `rui-coding-standards` skill.
7. **Handle obsolete tests.** See the `rui-coding-standards` skill for the policy on updating
vs. fixing tests during redesign.
8. **Add implementation notes as Forgejo issue comments.** Throughout your work, generously
and exhaustively append detailed comments to the Forgejo issue documenting:
8. **Add implementation notes as Gitea issue comments.** Throughout your work, generously
and exhaustively append detailed comments to the Gitea issue documenting:
- Design decisions made and their rationale.
- Discoveries, assumptions, and open questions.
- Implementation details (module ownership, patterns used, risk mitigations).
@@ -56,14 +56,14 @@ description: End-to-end task execution lifecycle for Forgejo issues. Covers prep
## Phase 5: Pull Request and Issue Closure
13. **Open a Pull Request** from the feature branch to `master` on Forgejo. The PR must
13. **Open a Pull Request** from the feature branch to `master` on Gitea. The PR must
include:
- A detailed description explaining the changes, motivation, and approach.
- A closing keyword referencing the issue (e.g., `Closes #<number>`).
- The same milestone as the issue.
- A `Type/` label matching the issue type.
- The linked issue added as a Forgejo dependency on the PR.
14. **Transition the issue** to `State/In Review` via the Forgejo API.
- The linked issue added as a Gitea dependency on the PR.
14. **Transition the issue** to `State/In Review` via the Gitea API.
15. **Wait for all required checks to pass** on the pull request.
16. **If any checks fail**, fix them, amend the appropriate commit on the branch, force push,
and repeat from step 15. **If checks pass**, do a final review of the PR ensuring it
@@ -76,7 +76,7 @@ If during implementation you discover work that needs to be done but is not trac
- **Small and directly related:** Add it as a new subtask on the current issue and complete
it within the same commit.
- **Separate unit of work:** Create a new Forgejo issue following the format in
- **Separate unit of work:** Create a new Gitea issue following the format in
`CONTRIBUTING.md` "Creating Issues". Assign appropriate labels and milestone, and link it
to a parent Epic (mandatory — orphan issues are not permitted per the ticket type
hierarchy). If it requires multiple commits, create it as an Epic with child issues. Note