Yaju senpai is always watching you 👀. DO NOT WRITE FUCKING CODE. IT GOES WITHOUT SAYING FOR THE CODE, BUT THE SAME APPIES TO THE COMMENTS.
Find a file
awayatan e95794680b
Some checks failed
CI / test (push) Has been cancelled
Log every webhook request, not just dispatch failures
The handler was silent on success, unauthorized signatures, and unhandled
events, making it impossible to tell from server logs alone whether a
delivery even arrived. Now every request logs its event type and resulting
status code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-27 00:06:43 +09:00
.forgejo/workflows Fix CI: runner label should be ubuntu-latest, not docker 2026-07-26 22:55:14 +09:00
cmd/yaju-is-always-watching-you Add yaju-is-always-watching-you: Forgejo goroku-check webhook bot 2026-07-26 22:47:12 +09:00
internal Log every webhook request, not just dispatch failures 2026-07-27 00:06:43 +09:00
.gitignore Add yaju-is-always-watching-you: Forgejo goroku-check webhook bot 2026-07-26 22:47:12 +09:00
config.example.yaml Split phrase list out into community-editable phrases.yaml 2026-07-26 23:27:27 +09:00
Dockerfile Bake phrases.yaml into the runtime image 2026-07-26 23:44:28 +09:00
go.mod Add yaju-is-always-watching-you: Forgejo goroku-check webhook bot 2026-07-26 22:47:12 +09:00
go.sum Add yaju-is-always-watching-you: Forgejo goroku-check webhook bot 2026-07-26 22:47:12 +09:00
LICENSE Add yaju-is-always-watching-you: Forgejo goroku-check webhook bot 2026-07-26 22:47:12 +09:00
phrases.yaml Fix unterminated quote on the last line of phrases.yaml 2026-07-26 23:50:36 +09:00
README.md Split phrase list out into community-editable phrases.yaml 2026-07-26 23:27:27 +09:00

yaju-is-always-watching-you (語録警察)

Forgejo用の言葉遣い是正bot。淫夢語録その他のネタ言葉遣いをissue/PRコメントやpushされたファイルから検知し、

  • コメント/PRへの投稿 → 投稿者に @mention して警告リプライ
  • push → 該当箇所を伏字にした修正ブランチを自動で切り、是正PRをオープン(原文のgit pushやコミット履歴は一切書き換えない)

を行う、クソ真面目にクソどうでもいい機能を実装したbotです。野獣はいつもお前を見ている。

仕組み

Forgejoのwebhook(issue_comment / push)を受け取るだけの単純なHTTPサーバーです。リポジトリごとに何かを仕込む必要はなく、Organization/インスタンス全体のwebhookとして1箇所に登録するだけで全リポジトリに効きます。

Forgejo --webhook--> yaju-keisatsu --Forgejo API--> コメント投稿 / 是正PR作成

セットアップ

1. bot用アカウントとトークンを作る

Forgejo上にbot専用アカウント(例: yaju-keisatsu-bot)を作り、そのアカウントで Settings > Applications からAPIトークンを発行する。対象リポジトリへの読み書き・issue・pull request権限があれば十分。

2. 設定ファイルを用意

cp config.example.yaml config.yaml

config.yaml を編集し、forgejo.base_url / forgejo.token / webhook_secret / bot.username を埋める。

語録リストは phrases.yaml にコミュニティ管理のものが同梱されており、config.yamlphrases_file: ./phrases.yaml で読み込む(デフォルトで設定済み)。追加・削除の提案はPRで歓迎。自分の運用だけで使いたい追加語録があれば、それとは別に config.yamlphrases: に書けば phrases_file の内容とマージされる。

config.yaml は秘密情報を含むため絶対にコミットしないこと(.gitignore 済み)。

3. 起動

go run ./cmd/yaju-is-always-watching-you -config config.yaml

または Docker で:

docker build -t yaju-keisatsu .
docker run -p 8080:8080 -v $(pwd)/config.yaml:/etc/yaju-keisatsu/config.yaml yaju-keisatsu

4. Forgejoにwebhookを登録

インスタンス管理画面(サイト全体)、または Organization / リポジトリ単位の Settings > Webhooks から新規Webhookを追加:

  • Target URL: https://<yaju-keisatsuを立てたホスト>/webhook
  • HTTP Method: POST
  • Trigger On: Issue Comment, Push
  • Secret: config.yamlwebhook_secret と同じ値

動作の安全設計

  • 削除や強制pushは一切行わない。 コメントは削除せず警告リプライのみ、pushされたコミット履歴も書き換えず、常に新規ブランチ+PRという提案どまりの形にしている。
  • 自己ループ防止。 bot.username に設定したアカウント自身のコメント/pushには反応しない。これがないとbotの警告リプライ自体に語録が含まれて無限に自己反応してしまう。

ライセンス

MIT License。LICENSE 参照。Issue・PR歓迎。