Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes the project’s migration from a Cloudflare Workers/Bun/TypeScript implementation to a self-hosted Go service, updating build/deploy automation and operational documentation accordingly.
Changes:
- Removed legacy Cloudflare Workers + Bun + TypeScript source/config (Wrangler, TS config, worker entrypoint and features).
- Added Go implementation (bot handlers, DB schema/migrations, admin panel via
templ/Chi, utilities). - Added self-host deployment assets (systemd + Nginx), GitHub Actions deploy workflow, Makefile-based DX, and
.env-based configuration/docs.
Reviewed changes
Copilot reviewed 126 out of 136 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| wrangler.toml | Removed legacy Cloudflare Workers configuration. |
| wrangler.example.toml | Removed legacy example Wrangler configuration. |
| tsconfig.json | Removed TypeScript compiler configuration. |
| src/types.ts | Removed Workers/Bun TypeScript types. |
| src/shared/utils/time.ts | Removed TS time utility (replaced by Go util). |
| src/shared/utils/telegram-send-queue.ts | Removed TS send queue (replaced by Go util). |
| src/shared/utils/reply.ts | Removed TS reply helpers (replaced by Go util). |
| src/shared/utils/placeholders.ts | Removed TS placeholder replacement (replaced by Go util). |
| src/shared/utils/permissions.ts | Removed TS permission helpers (replaced by Go util). |
| src/shared/utils/nickname.ts | Removed TS nickname helper (replaced by Go util). |
| src/shared/utils/markdown.ts | Removed TS MarkdownV2 helpers (replaced by Go util). |
| src/shared/utils/command-guards.ts | Removed TS command guards (replaced by Go handler helpers). |
| src/shared/utils/botInfo.ts | Removed TS bot info cache helper (replaced by Go helper). |
| src/shared/db/schema.sql | Removed legacy SQL schema file (replaced by Go schema/migrations). |
| src/index.ts | Removed Workers fetch handler entrypoint. |
| src/features/welcome/index.ts | Removed TS welcome feature registration. |
| src/features/welcome/handlers.ts | Removed TS welcome handlers. |
| src/features/welcome/commands.ts | Removed TS welcome commands. |
| src/features/warn/index.ts | Removed TS warn feature registration. |
| src/features/warn/commands.ts | Removed TS warn command. |
| src/features/votekick/vote.ts | Removed TS votekick text builder. |
| src/features/votekick/index.ts | Removed TS votekick feature registration. |
| src/features/votekick/handlers.ts | Removed TS votekick callback handler. |
| src/features/votekick/commands.ts | Removed TS votekick commands. |
| src/features/verify/index.ts | Removed TS verify feature registration. |
| src/features/verify/handlers.ts | Removed TS verify handlers (start/rule ack/captcha send). |
| src/features/verify/commands.ts | Removed TS verify commands. |
| src/features/verify/captcha-handler.ts | Removed TS captcha reply handler. |
| src/features/rule/index.ts | Removed TS rule feature registration. |
| src/features/rule/commands.ts | Removed TS rule command. |
| src/features/report/index.ts | Removed TS report feature registration. |
| src/features/report/commands.ts | Removed TS report command. |
| src/features/ping/index.ts | Removed TS ping feature registration. |
| src/features/ping/commands.ts | Removed TS ping command. |
| src/features/message-orchestrator.ts | Removed TS message orchestrator. |
| src/features/keywords/index.ts | Removed TS keywords feature registration. |
| src/features/keywords/handlers.ts | Removed TS keyword matching handler. |
| src/features/keywords/commands.ts | Removed TS keyword commands. |
| src/features/index.ts | Removed TS feature registry. |
| src/features/help/index.ts | Removed TS help feature registration. |
| src/features/github-release/index.ts | Removed TS GitHub release feature export. |
| src/features/github-release/github-release.ts | Removed TS GitHub release webhook handler logic. |
| src/features/ai-chat/skills.ts | Removed TS AI skills parsing/matching. |
| src/features/ai-chat/index.ts | Removed TS AI chat export. |
| src/features/ai-chat/handlers.ts | Removed TS AI chat handler pipeline. |
| src/features/admin/index.ts | Removed TS admin feature registration. |
| src/features/admin/commands.ts | Removed TS admin commands. |
| src/features/admin-panel/types.ts | Removed TS admin panel types. |
| src/features/admin-panel/modules/warnings.ts | Removed TS warnings module routes. |
| src/features/admin-panel/modules/reports.ts | Removed TS reports module routes. |
| src/features/admin-panel/index.ts | Removed TS admin panel router. |
| src/features/admin-panel/html/styles.ts | Removed TS inline admin CSS builder. |
| src/features/admin-panel/html/scripts/warnings.ts | Removed TS warnings page script. |
| src/features/admin-panel/html/scripts/sidebar.ts | Removed TS sidebar script. |
| src/features/admin-panel/html/scripts/reports.ts | Removed TS reports page script. |
| src/features/admin-panel/html/scripts/login.ts | Removed TS login script. |
| src/features/admin-panel/html/scripts/index.ts | Removed TS scripts bundle builder. |
| src/features/admin-panel/html/scripts/api.ts | Removed TS API helper script. |
| src/features/admin-panel/html/layout.ts | Removed TS admin layout builder. |
| src/features/admin-panel/html/index.ts | Removed TS admin HTML renderer. |
| src/features/admin-panel/auth.ts | Removed TS admin auth helpers. |
| src/features/admin-panel/auth-helpers.ts | Removed TS admin auth helper utilities. |
| src/bot.ts | Removed TS bot bootstrap. |
| README.md | Updated README for Go + VPS deployment flow. |
| package.json | Removed Bun/Node package metadata and scripts. |
| Makefile | Added Go build/test/lint/generate + deploy helpers. |
| internal/util/time.go | Added Go time + random string utilities. |
| internal/util/sendqueue.go | Added Go rate-limited send queue. |
| internal/util/reply.go | Added Go reply params + command args parsing. |
| internal/util/placeholder.go | Added Go placeholder replacement. |
| internal/util/permission.go | Added Go admin permission checks. |
| internal/util/nickname.go | Added Go nickname helper. |
| internal/util/markdown.go | Added Go MarkdownV2 formatting/escaping utilities. |
| internal/util/chinese.go | Added Chinese conversion utilities (OpenCC). |
| internal/model/model.go | Added Go domain/config models. |
| internal/handler/warn.go | Added Go /warn handler. |
| internal/handler/rule.go | Added Go /rule handler. |
| internal/handler/report.go | Added Go /report handler. |
| internal/handler/ping.go | Added Go /ping handler. |
| internal/handler/orchestrator.go | Added Go message dispatch/orchestration handler. |
| internal/handler/helpers.go | Added shared handler guard/helpers and bot username caching. |
| internal/handler/help.go | Added Go /help handler + help text. |
| internal/handler/data/system-prompt.json | Added system prompt data for AI persona/behavior. |
| internal/handler/captcha_handler.go | Added Go captcha reply verification handler. |
| internal/db/schema.go | Added Go schema initialization + migration runner. |
| internal/db/db.go | Added SQLite connection wrapper with WAL settings. |
| internal/bot/middleware.go | Added Go bot middlewares (logging, recovery, group init). |
| internal/bot/bot.go | Added Go bot wiring (handlers, callbacks, command registration). |
| internal/adminpanel/server.go | Added Go admin panel server/router (Chi + templ). |
| internal/adminpanel/middleware.go | Added admin session auth middleware/context injection. |
| internal/adminpanel/handler/warnings.go | Added warnings list handler (HTMX fragment). |
| internal/adminpanel/handler/reports.go | Added reports list + resolve handlers (HTMX + side effects). |
| internal/adminpanel/handler/helpers.go | Added report resolution side-effect helpers + Telegram API calls. |
| internal/adminpanel/components/warnings.templ | Added templ warnings table fragment. |
| internal/adminpanel/components/reports.templ | Added templ reports cards fragment. |
| internal/adminpanel/components/helpers.go | Added time-ago formatting helper. |
| internal/adminpanel/components/common.templ | Added shared UI components (badges, empty state, filters). |
| internal/adminpanel/auth.go | Added Telegram Login verification + session signing/verification. |
| go.mod | Added Go module definition + dependencies. |
| deploy/register-webhook.sh | Added webhook registration + command sync script. |
| deploy/nginx.conf | Added Nginx reverse proxy config + rate limits + headers. |
| deploy/neptune.service | Added systemd unit with hardening options. |
| deploy/migrate-r2-captcha.sh | Added helper to migrate old R2 captcha assets to filesystem. |
| deploy/e2e-test.sh | Added basic HTTP/Telegram API E2E validation script. |
| DEPLOY.md | Added VPS deployment guide for the Go service. |
| cmd/neptune/main.go | Added Go main program (HTTP server + bot webhook + admin panel + GitHub webhook). |
| biome.json | Removed Biome config (TS tooling). |
| .gitignore | Updated ignores for Go artifacts and .env. |
| .github/workflows/deploy.yml | Added GitHub Actions workflow for building and deploying to VPS. |
| .env.example | Added Go-centric environment variable template. |
Files not reviewed (3)
- internal/adminpanel/components/common_templ.go: Language not supported
- internal/adminpanel/components/layout_templ.go: Language not supported
- internal/adminpanel/components/reports_templ.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+22
| if update.Message != nil { | ||
| slog.Info("Message", | ||
| "chat_id", update.Message.Chat.ID, | ||
| "chat_type", update.Message.Chat.Type, | ||
| "user_id", update.Message.From.ID, | ||
| "text", update.Message.Text, | ||
| ) |
Comment on lines
+18
to
+19
| build: | ||
| go build -o $(BUILD_DIR)/$(BINARY_NAME) -v $(CMD_DIR) |
Comment on lines
+59
to
+60
| build-prod: | ||
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME) -ldflags="-w -s" $(CMD_DIR) |
Comment on lines
+20
to
+22
| log() { echo -e "${GREEN}[webhook]${NC} $*"; } | ||
| err() { echo -e "${RED}[error]${NC} $*" >&2; } | ||
|
|
Comment on lines
+70
to
+72
| log "Testing webhook endpoint..." | ||
| test_endpoint POST /webhook 405 "Webhook rejects GET" "" | ||
| # A proper webhook test would send a Telegram update, but that requires a real chat |
| }) | ||
| } | ||
|
|
||
| _ = database.AddWarning(report.GroupID, report.ReportedUserID, 0, fmt.Sprintf("举报通过: %s", report.Content)) |
Comment on lines
+54
to
+58
| // Apply schema | ||
| if err := database.ApplySchema(); err != nil { | ||
| slog.Error("Failed to apply schema", "error", err) | ||
| os.Exit(1) | ||
| } |
Comment on lines
+14
to
+21
| func RandomString(n int) string { | ||
| const letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ||
| b := make([]byte, n) | ||
| _, _ = rand.Read(b) | ||
| for i := range b { | ||
| b[i] = letters[b[i]%byte(len(letters))] | ||
| } | ||
| return string(b) |
Comment on lines
+109
to
+110
|
|
||
| writeJSON(w, http.StatusOK, map[string]any{"ok": true, "user": user, "token": session}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant updates to the project documentation and configuration, reflecting the migration from a Cloudflare Workers/Bun/TypeScript stack to a Go-based, self-hosted architecture. It adds a new deployment workflow, updates environment variable handling, and provides comprehensive, Go-centric instructions for development, deployment, and architecture.
Key changes include:
Deployment & Environment Configuration
.github/workflows/deploy.yml) to automate building, uploading, and deploying the Go binary and related assets to a remote server, including service restarts and health checks..env.examplefile with detailed environment variable documentation, replacing previous Cloudflare Workers secrets and aligning with the Go server's needs.Documentation Overhaul
AGENTS.mdto document the Go-based server: build/test/lint commands, environment variables, database schema/migrations, feature structure, and deployment instructions, removing legacy Bun/TypeScript/Cloudflare Workers content.CONTRIBUTING.mdto remove references to the previous Feature-Driven TypeScript structure and adjust bug report instructions for the Go environment. [1] [2]These changes collectively modernize the project's documentation and deployment process, ensuring contributors and users have accurate, up-to-date guidance for the Go implementation.