{ "swagger": "2.0", "info": { "contact": {} }, "paths": { "/admin/gitfiles": { "get": { "summary": "Get Git File List", "parameters": [ { "type": "string", "description": "Git link", "name": "link", "in": "query" }, { "type": "integer", "description": "Filter, 0: no filter, 1: success, 2: fail, 3: never success", "name": "filter", "in": "query" }, { "type": "integer", "description": "Skip count", "name": "skip", "in": "query" }, { "type": "integer", "description": "Take count", "name": "take", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.PageDTO-model_GitFileDTO" } } } } }, "/admin/gitfiles/manual": { "post": { "consumes": [ "application/json" ], "summary": "Append to collector manual list", "parameters": [ { "description": "Append manual request", "name": "req", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.GitFileAppendManualReq" } } ], "responses": { "204": { "description": "No Content", "schema": { "type": "string" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/gitfiles/start": { "post": { "description": "Starts the Git File collection process", "summary": "Start Git File Collector", "responses": { "204": { "description": "No Content", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/gitfiles/status": { "get": { "summary": "Get git files statistics and collector status", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.GitFileStatusResp" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/gitfiles/stop": { "post": { "description": "Stops the Git File collection process", "summary": "Stop Git File Collector", "responses": { "204": { "description": "No Content", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/label/distributions": { "get": { "description": "根据发行版、链接、置信度等条件分页查询包列表", "produces": [ "application/json" ], "tags": [ "label" ], "summary": "查询发行版包列表", "parameters": [ { "type": "string", "description": "发行版名称", "name": "distribution", "in": "query", "required": true }, { "type": "integer", "description": "跳过数量", "name": "skip", "in": "query" }, { "type": "integer", "description": "返回数量", "name": "take", "in": "query" }, { "type": "string", "description": "链接过滤", "name": "search", "in": "query" }, { "type": "integer", "description": "置信度过滤(0:全部, 1:已标注, 2:未标注)", "name": "confidence", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.PageDTO-model_DistributionPackageDTO" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/label/distributions/ai-completion": { "post": { "description": "使用 AI 补全指定发行版包的 Git 仓库链接,返回 JSON 流", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "label" ], "summary": "AI 补全发行版包 Git 链接", "parameters": [ { "description": "AI 补全参数", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.GitLinkAICompletionReq" } } ], "responses": { "200": { "description": "JSON 流,每行为一个结果", "schema": { "type": "object" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/label/distributions/all": { "get": { "description": "获取所有支持的发行版包前缀列表", "produces": [ "application/json" ], "tags": [ "label" ], "summary": "获取所有发行版包的前缀", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "type": "string" } } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/label/distributions/gitlink": { "put": { "description": "更新指定发行版包的 Git 仓库链接和置信度", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "label" ], "summary": "更新发行版包的 Git 链接", "parameters": [ { "description": "Git 链接参数", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.UpdateDistributionGitLinkReq" } } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/session/github/callback": { "get": { "description": "Handles the GitHub OAuth callback and returns JWT token if user is authorized", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "GitHub OAuth callback", "parameters": [ { "type": "string", "description": "GitHub OAuth Code", "name": "code", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.GitHubCallbackResp" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/admin/session/github/clientid": { "get": { "description": "Get github client id", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get github client id", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.GitHubClientIDResp" } } } } }, "/admin/session/userinfo": { "get": { "description": "Returns the authenticated user's username and policy", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get user information", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.UserInfoResp" } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/admin/toolset/instances": { "get": { "description": "获取所有运行中的工具实例的信息", "produces": [ "application/json" ], "tags": [ "toolset" ], "summary": "获取运行中的工具实例列表", "parameters": [ { "type": "boolean", "description": "是否获取所有实例,默认只获取运行中的实例", "name": "all", "in": "query" }, { "type": "integer", "description": "跳过的实例数量,默认0", "name": "skip", "in": "query" }, { "type": "integer", "description": "获取的实例数量,默认10", "name": "take", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.PageDTO-model_ToolInstanceHistoryDTO" } } } }, "post": { "description": "根据工具ID和参数创建并运行工具实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "toolset" ], "summary": "创建工具实例", "parameters": [ { "description": "工具实例创建参数", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.ToolCreateInstanceReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.ToolInstanceHistoryDTO" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/toolset/instances/{id}": { "get": { "description": "获取指定ID的工具实例的详细信息", "produces": [ "application/json" ], "tags": [ "toolset" ], "summary": "获取单个工具实例详情", "parameters": [ { "type": "string", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.ToolInstanceHistoryDTO" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/toolset/instances/{id}/kill": { "post": { "description": "杀死指定工具实例", "tags": [ "toolset" ], "summary": "杀死工具实例", "parameters": [ { "type": "string", "description": "实例ID", "name": "id", "in": "path", "required": true }, { "description": "工具实例杀死参数", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.KillToolInstanceReq" } } ], "responses": { "204": { "description": "No Content", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/toolset/instances/{id}/log": { "get": { "description": "获取指定工具实例的日志", "produces": [ "application/json" ], "tags": [ "toolset" ], "summary": "获取工具实例日志", "parameters": [ { "type": "string", "description": "实例ID", "name": "id", "in": "path", "required": true }, { "type": "boolean", "description": "是否获取所有日志,默认只获取最后1MB", "name": "all", "in": "query" } ], "responses": { "200": { "description": "日志内容", "schema": { "type": "array", "items": { "type": "integer" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/toolset/list": { "get": { "description": "获取所有可用工具的信息", "produces": [ "application/json" ], "tags": [ "toolset" ], "summary": "获取工具列表", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/model.ToolDTO" } } } } } }, "/admin/workflows/kill": { "post": { "description": "杀死当前运行中的 workflow 任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "workflow" ], "summary": "杀死 workflow 任务", "parameters": [ { "description": "kill 参数", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.KillWorkflowJobReq" } } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/workflows/maxRounds": { "get": { "description": "获取当前最大的 workflow 轮次 ID", "produces": [ "application/json" ], "tags": [ "workflow" ], "summary": "获取最大 workflow 轮次 ID", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/rpc.RoundResp" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/workflows/rounds/{id}": { "get": { "description": "根据轮次 ID 获取 workflow 详情", "produces": [ "application/json" ], "tags": [ "workflow" ], "summary": "获取指定 workflow 轮次详情", "parameters": [ { "type": "integer", "description": "轮次ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/rpc.RoundDTO" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/workflows/rounds/{id}/logs/{name}": { "get": { "description": "获取指定轮次和名称的 workflow 日志文件", "produces": [ "application/octet-stream" ], "tags": [ "workflow" ], "summary": "获取 workflow 日志", "parameters": [ { "type": "integer", "description": "轮次ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "日志名称", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "file" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/admin/workflows/status": { "post": { "description": "启动或停止 workflow 运行状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "workflow" ], "summary": "启动或停止 workflow", "parameters": [ { "description": "workflow 状态参数", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.UpdateWorkflowStatusReq" } } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/histories": { "get": { "description": "Get score histories by git link", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Get score histories", "parameters": [ { "type": "string", "description": "Git link", "name": "link", "in": "query", "required": true }, { "type": "integer", "description": "Skip count", "name": "start", "in": "query" }, { "type": "integer", "description": "Take count", "name": "take", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.PageDTO-model_ResultDTO" } } } } }, "/rankings": { "get": { "description": "Get ranking results, optionally including all details", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Get ranking results", "parameters": [ { "type": "integer", "description": "Skip count", "name": "start", "in": "query" }, { "type": "integer", "description": "Take count", "name": "take", "in": "query" }, { "type": "boolean", "description": "Include details", "name": "detail", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.PageDTO-model_RankingResultDTO" } } } } }, "/results": { "get": { "description": "Search score results by git link\nNOTE: All details are ignored, should use /results/:scoreid to get details\nNOTE: Maxium take count is 1000", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Search score results by git link", "parameters": [ { "type": "string", "description": "Search query", "name": "q", "in": "query", "required": true }, { "type": "integer", "description": "Skip count", "name": "start", "in": "query" }, { "type": "integer", "description": "Take count", "name": "take", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.PageDTO-model_ResultDTO" } } } } }, "/results/{scoreid}": { "get": { "description": "Get score results, including all details by scoreid", "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Get score results", "parameters": [ { "type": "integer", "description": "Score ID", "name": "scoreid", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.ResultDTO" } } } } } }, "definitions": { "gin.H": { "type": "object", "additionalProperties": {} }, "model.DistributionPackageDTO": { "type": "object", "properties": { "description": { "type": "string" }, "gitLink": { "type": "string" }, "homePage": { "type": "string" }, "linkConfidence": { "type": "number" }, "package": { "type": "string" }, "version": { "type": "string" } } }, "model.GitFileAppendManualReq": { "type": "object", "properties": { "gitLink": { "type": "string" } } }, "model.GitFileDTO": { "type": "object", "properties": { "failedTimes": { "type": "integer" }, "filePath": { "type": "string" }, "gitLink": { "type": "string" }, "lastSuccess": { "type": "string" }, "message": { "type": "string" }, "success": { "type": "boolean" }, "takeStorage": { "type": "integer" }, "takeTimeMs": { "type": "integer" }, "updateTime": { "type": "string" } } }, "model.GitFileStatisticsResultDTO": { "type": "object", "properties": { "fail": { "type": "integer" }, "neverSuccess": { "type": "integer" }, "success": { "type": "integer" }, "total": { "type": "integer" } } }, "model.GitFileStatusResp": { "type": "object", "properties": { "collector": { "$ref": "#/definitions/rpc.StatusResp" }, "gitFile": { "$ref": "#/definitions/model.GitFileStatisticsResultDTO" } } }, "model.GitHubCallbackResp": { "type": "object", "properties": { "token": { "type": "string" } } }, "model.GitHubClientIDResp": { "type": "object", "properties": { "clientId": { "type": "string" } } }, "model.GitLinkAICompletionReq": { "type": "object", "required": [ "distribution", "packageName" ], "properties": { "description": { "type": "string" }, "distribution": { "type": "string" }, "homePage": { "type": "string" }, "packageName": { "type": "string" } } }, "model.KillToolInstanceReq": { "type": "object", "required": [ "signal" ], "properties": { "signal": { "type": "integer" } } }, "model.KillWorkflowJobReq": { "type": "object", "required": [ "type" ], "properties": { "type": { "description": "\"stop\" or \"kill\"", "type": "string" } } }, "model.PageDTO-model_DistributionPackageDTO": { "type": "object", "properties": { "count": { "type": "integer" }, "items": { "type": "array", "items": { "$ref": "#/definitions/model.DistributionPackageDTO" } }, "start": { "type": "integer" }, "total": { "type": "integer" } } }, "model.PageDTO-model_GitFileDTO": { "type": "object", "properties": { "count": { "type": "integer" }, "items": { "type": "array", "items": { "$ref": "#/definitions/model.GitFileDTO" } }, "start": { "type": "integer" }, "total": { "type": "integer" } } }, "model.PageDTO-model_RankingResultDTO": { "type": "object", "properties": { "count": { "type": "integer" }, "items": { "type": "array", "items": { "$ref": "#/definitions/model.RankingResultDTO" } }, "start": { "type": "integer" }, "total": { "type": "integer" } } }, "model.PageDTO-model_ResultDTO": { "type": "object", "properties": { "count": { "type": "integer" }, "items": { "type": "array", "items": { "$ref": "#/definitions/model.ResultDTO" } }, "start": { "type": "integer" }, "total": { "type": "integer" } } }, "model.PageDTO-model_ToolInstanceHistoryDTO": { "type": "object", "properties": { "count": { "type": "integer" }, "items": { "type": "array", "items": { "$ref": "#/definitions/model.ToolInstanceHistoryDTO" } }, "start": { "type": "integer" }, "total": { "type": "integer" } } }, "model.RankingResultDTO": { "type": "object", "properties": { "distDetail": { "type": "array", "items": { "$ref": "#/definitions/model.ResultDistDetailDTO" } }, "distroScore": { "type": "number" }, "gitDetail": { "type": "array", "items": { "$ref": "#/definitions/model.ResultGitMetadataDTO" } }, "gitScore": { "type": "number" }, "langDetail": { "type": "array", "items": { "$ref": "#/definitions/model.ResultLangDetailDTO" } }, "langScore": { "type": "number" }, "link": { "type": "string" }, "ranking": { "type": "integer" }, "score": { "type": "number" }, "scoreID": { "type": "integer" }, "updateTime": { "type": "string" } } }, "model.ResultDTO": { "type": "object", "properties": { "distDetail": { "type": "array", "items": { "$ref": "#/definitions/model.ResultDistDetailDTO" } }, "distroScore": { "type": "number" }, "gitDetail": { "type": "array", "items": { "$ref": "#/definitions/model.ResultGitMetadataDTO" } }, "gitScore": { "type": "number" }, "langDetail": { "type": "array", "items": { "$ref": "#/definitions/model.ResultLangDetailDTO" } }, "langScore": { "type": "number" }, "link": { "type": "string" }, "score": { "type": "number" }, "scoreID": { "type": "integer" }, "updateTime": { "type": "string" } } }, "model.ResultDistDetailDTO": { "type": "object", "properties": { "count": { "type": "integer" }, "impact": { "type": "number" }, "pageRank": { "type": "number" }, "type": { "type": "integer" }, "updateTime": { "type": "string" } } }, "model.ResultGitMetadataDTO": { "type": "object", "properties": { "commitFrequency": { "type": "number" }, "contributorCount": { "type": "integer" }, "createdSince": { "type": "string" }, "language": { "type": "array", "items": { "type": "string" } }, "license": { "type": "array", "items": { "type": "string" } }, "orgCount": { "type": "integer" }, "updateTime": { "type": "string" }, "updatedSince": { "type": "string" } } }, "model.ResultLangDetailDTO": { "type": "object", "properties": { "depCount": { "type": "integer" }, "langEcoImpact": { "type": "number" }, "type": { "type": "integer" }, "updateTime": { "type": "string" } } }, "model.ToolArgDTO": { "type": "object", "properties": { "default": {}, "description": { "type": "string" }, "name": { "description": "Name is the name of the argument.", "type": "string" }, "type": { "type": "string" } } }, "model.ToolCreateInstanceReq": { "type": "object", "properties": { "args": { "type": "object", "additionalProperties": {} }, "toolId": { "type": "string" } } }, "model.ToolDTO": { "type": "object", "properties": { "allowedSignals": { "type": "array", "items": { "$ref": "#/definitions/model.ToolSignalDTO" } }, "args": { "type": "array", "items": { "$ref": "#/definitions/model.ToolArgDTO" } }, "description": { "type": "string" }, "group": { "type": "string" }, "id": { "description": "ID is the unique identifier for the toolset.", "type": "string" }, "name": { "type": "string" } } }, "model.ToolInstanceHistoryDTO": { "type": "object", "properties": { "endTime": { "type": "string" }, "err": { "type": "string" }, "id": { "type": "string" }, "isRunning": { "type": "boolean" }, "launchUserName": { "type": "string" }, "ret": { "type": "integer" }, "startTime": { "type": "string" }, "tool": { "$ref": "#/definitions/model.ToolDTO" }, "toolId": { "type": "string" }, "toolName": { "type": "string" } } }, "model.ToolSignalDTO": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" }, "value": { "type": "integer" } } }, "model.UpdateDistributionGitLinkReq": { "type": "object", "required": [ "distribution", "packageName" ], "properties": { "confidence": { "type": "number" }, "distribution": { "type": "string" }, "link": { "type": "string" }, "packageName": { "type": "string" } } }, "model.UpdateWorkflowStatusReq": { "type": "object", "required": [ "running" ], "properties": { "running": { "type": "boolean" } } }, "model.UserInfoResp": { "type": "object", "properties": { "policy": { "type": "array", "items": { "type": "string" } }, "username": { "type": "string" } } }, "rpc.RoundDTO": { "type": "object", "properties": { "endTime": { "type": "string" }, "id": { "type": "string" }, "startTime": { "type": "string" }, "tasks": { "type": "array", "items": { "$ref": "#/definitions/rpc.TaskDTO" } } } }, "rpc.RoundResp": { "type": "object", "properties": { "currentRound": { "type": "integer" } } }, "rpc.RunningTaskDTO": { "type": "object", "properties": { "link": { "type": "string" }, "progress": { "type": "string" }, "start": { "type": "string" } } }, "rpc.StatusResp": { "type": "object", "properties": { "currentTasks": { "type": "array", "items": { "$ref": "#/definitions/rpc.RunningTaskDTO" } }, "isRunning": { "type": "boolean" }, "pendingTasks": { "type": "array", "items": { "type": "string" } } } }, "rpc.TaskDTO": { "type": "object", "properties": { "args": { "type": "string" }, "dependencies": { "type": "array", "items": { "type": "string" } }, "description": { "type": "string" }, "endTime": { "type": "string" }, "name": { "type": "string" }, "startTime": { "type": "string" }, "status": { "$ref": "#/definitions/rpc.TaskStatus" }, "title": { "type": "string" }, "type": { "type": "string" } } }, "rpc.TaskStatus": { "type": "string", "enum": [ "pending", "running", "success", "failed" ], "x-enum-varnames": [ "TaskStatusPending", "TaskStatusRunning", "TaskStatusSuccess", "TaskStatusFailed" ] } } }