docs(skill): update router packaging and categorization guidelines in documentation

- Updated `new-api` skill `SKILL.md` to document the centralized v1.go route registration and domain-driven sub-routing patterns
- Updated `AGENTS.md` instructions with the new router subpackages (`root`, `v1`) and route file layout guidelines
This commit is contained in:
ryan
2026-06-15 23:44:03 +08:00
parent 0adc5e8189
commit e50e600bc8
6 changed files with 158 additions and 204 deletions
+27 -5
View File
@@ -8,6 +8,7 @@ import (
"context"
capApp "github.com/Rain-kl/Wavelet/internal/apps/cap"
publicconfig "github.com/Rain-kl/Wavelet/internal/apps/config"
"github.com/Rain-kl/Wavelet/internal/apps/oauth"
"github.com/Rain-kl/Wavelet/internal/apps/upload"
"github.com/Rain-kl/Wavelet/internal/apps/user"
@@ -15,18 +16,39 @@ import (
"github.com/gin-gonic/gin"
)
// RegisterUserRoutes registers all user-related, oauth and upload routes.
func RegisterUserRoutes(apiV1Router *gin.RouterGroup) {
// OAuth
// RegisterUserRoutes registers all user-related, oauth, upload, and public routes.
func RegisterUserRoutes(apiV1Router *gin.RouterGroup, apiGroup *gin.RouterGroup) {
// 1. CAPTCHA
registerCaptchaRoutes(apiGroup)
// 2. Config (public)
registerConfigRoutes(apiV1Router)
// 3. OAuth
registerOAuthRoutes(apiV1Router)
// User
// 4. User
registerUserRoutes(apiV1Router)
// Upload
// 5. Upload
registerUploadRoutes(apiV1Router)
}
func registerCaptchaRoutes(apiGroup *gin.RouterGroup) {
capGroup := apiGroup.Group("/cap")
{
capGroup.POST("/challenge", capApp.Challenge)
capGroup.POST("/redeem", capApp.Redeem)
}
}
func registerConfigRoutes(apiV1Router *gin.RouterGroup) {
configRouter := apiV1Router.Group("/config")
{
configRouter.GET("/public", publicconfig.GetPublicConfig)
}
}
func registerOAuthRoutes(apiV1Router *gin.RouterGroup) {
apiV1Router.GET("/oauth/sources", oauth.GetLoginSources)
apiV1Router.GET("/oauth/login", oauth.GetLoginURL)