From 74f75a55ca55b6057ea06730bca7c8dbf6648ef7 Mon Sep 17 00:00:00 2001 From: chroe <454604461@qq.com> Date: Thu, 28 May 2026 15:59:54 +0800 Subject: [PATCH] feat(showcase): add interactive dashboard with Dockerfile and CI/CD pipeline Interactive web dashboard that demonstrates new CLI commands with real API calls. Includes: - Go web server with embedded HTML (showcase/main.go) - Dashboard UI with 4 modules, Chinese descriptions, live execution - Dockerfile for multi-stage build - Pipeline config for automated deployment on push Access at http://121.41.210.165:9090 after deployment --- showcase/Dockerfile | 28 ++ showcase/index.html | 587 +++++++++++++++++++----------------------- showcase/main.go | 113 ++++++++ showcase/pipeline.yml | 56 ++++ 4 files changed, 458 insertions(+), 326 deletions(-) create mode 100644 showcase/Dockerfile create mode 100644 showcase/main.go create mode 100644 showcase/pipeline.yml diff --git a/showcase/Dockerfile b/showcase/Dockerfile new file mode 100644 index 0000000..794e2ea --- /dev/null +++ b/showcase/Dockerfile @@ -0,0 +1,28 @@ +# Stage 1: Build +FROM golang:1.26-alpine AS builder + +WORKDIR /build +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . + +# Build gitlink-cli binary +RUN CGO_ENABLED=0 GOOS=linux go build -o gitlink-cli . + +# Build showcase server binary +RUN CGO_ENABLED=0 GOOS=linux go build -o showcase-server ./showcase/ + +# Stage 2: Runtime +FROM alpine:latest + +RUN apk add --no-cache ca-certificates git + +WORKDIR /app + +COPY --from=builder /build/gitlink-cli . +COPY --from=builder /build/showcase-server . + +EXPOSE 9090 + +CMD ["./showcase-server"] diff --git a/showcase/index.html b/showcase/index.html index e70db5a..887267c 100644 --- a/showcase/index.html +++ b/showcase/index.html @@ -6,337 +6,272 @@
软件演化与运维 课程实践 — 进阶任务 子任务一
- -软件演化与运维 课程实践 — 进阶任务 子任务一
+chroe/gitlink-cli — 点击下方命令按钮查看真实运行结果-┌──────────────────────────────────────────────────────────┐ -│ Shortcuts Layer(人 + AI 友好) │ -│ │ -│ milestone · webhook · label · commit · file · member │ -│ watch · star · batch-label · batch-milestone · ... │ -├──────────────────────────────────────────────────────────┤ -│ Raw API Layer(全覆盖) │ -│ │ -│ gitlink-cli api GET /v1/{owner}/{repo}/... │ -├──────────────────────────────────────────────────────────┤ -│ Config Layer(配置管理) │ -│ │ -│ auth login · config set · GITLINK_TOKEN 环境变量 │ -└──────────────────────────────────────────────────────────┘ --
| 模块 | -新增命令 | -API 端点 | -负责人 | -
|---|---|---|---|
| milestone | -list, view, create, update, close, delete | -/v1/{owner}/{repo}/milestones |
- A | -
| webhook | -list, create, view, update, delete, test | -/v1/{owner}/{repo}/webhooks |
- A | -
| label | -list, create, update, delete | -/v1/{owner}/{repo}/issue_tags |
- A | -
| commit | -list, view, diff, blame | -/v1/{owner}/{repo}/commits, blame |
- A | -
| file | -list, tree, get, create, delete | -/{owner}/{repo}/files, create_file, delete_file |
- B | -
| member | -list, add, remove, update | -/{owner}/{repo}/collaborators |
- B | -
| watch/star | -watch, unwatch, star, unstar, watchers, stars | -/watchers/follow, /praise_tread |
- B | -
| batch 增强 | -batch-label, batch-milestone, batch-assign, batch-close 优化 | -基于现有 issue batch 框架扩展 | -C | -
| 全局优化 | -table 输出格式增强、错误提示优化、测试补全 | -跨所有模块 | -C | -
$ gitlink-cli milestone +list --owner chroe --repo gitlink_help_center
-{
- "ok": true,
- "data": {
- "milestones": [
- {"id": 2756, "name": "v2.0", "status": "open", "effective_date": "2026-06-30", "issues_count": 0}
- ],
- "opening_milestone_count": 1,
- "total_count": 1
- }
-}
- $ gitlink-cli milestone +create --owner chroe --repo gitlink_help_center --name "v2.0" --description "CLI test milestone" --due "2026-06-30"
-{
- "ok": true,
- "data": {"status": 0, "message": "success"}
-}
- $ gitlink-cli webhook +list --owner chroe --repo gitlink_help_center
-{
- "ok": true,
- "data": {
- "total_count": 3,
- "webhooks": [
- {"id": 50035, "url": "https://jianmu.gitlink.org.cn/webhook/projects/sync", "is_active": true, "last_status": "succeed"},
- {"id": 50201, "url": "https://jianmu.gitlink.org.cn/webhook/50201", "is_active": true, "last_status": "fail"}
- ]
- }
-}
- $ gitlink-cli label +list --owner chroe --repo gitlink_help_center
-{
- "ok": true,
- "data": {
- "total_count": 0,
- "issue_tags": []
- }
-}
- $ gitlink-cli commit +list --owner chroe --repo gitlink_help_center --limit 2
-{
- "ok": true,
- "data": {
- "total_count": 500,
- "commits": [
- {"sha": "af3b0d4...", "commit_message": "refactor: delete .devops/...", "author": {"login": "yetja"}},
- {"sha": "854ce5d...", "commit_message": "feat: .devops/...", "author": {"login": "yetja"}}
- ]
- }
-}
- $ gitlink-cli commit +view --owner chroe --repo gitlink_help_center --sha af3b0d4
-{
- "ok": true,
- "data": {
- "file_nums": 1,
- "total_addition": 0,
- "total_deletion": 43,
- "files": [
- {"filename": ".devops/灵枢自动部署.yml", "additions": 0, "deletions": 43, "is_deleted": true}
- ]
- }
-}
- $ gitlink-cli commit +blame --owner chroe --repo gitlink_help_center --path README.md
-{
- "ok": true,
- "data": {
- "file_name": "README.md",
- "num_lines": 28,
- "blame_parts": [
- {"commit": {"sha": "8679343...", "author": {"login": "caishi"}, "commit_message": "search"}, "lines": ["# gitlink_help_center", ...]}
- ]
- }
-}
- $ go test ./... -v -=== RUN TestCommitList --- PASS -=== RUN TestCommitListWithSHA --- PASS -=== RUN TestCommitView --- PASS -=== RUN TestCommitDiff --- PASS -=== RUN TestCommitBlame --- PASS -=== RUN TestMilestoneList --- PASS -=== RUN TestMilestoneCreate --- PASS -=== RUN TestMilestoneUpdate --- PASS -=== RUN TestMilestoneClose --- PASS -=== RUN TestMilestoneDelete --- PASS -=== RUN TestMilestoneUpdateRequiresAtLeastOneField --- PASS -=== RUN TestWebhookList --- PASS -=== RUN TestWebhookCreate --- PASS -=== RUN TestWebhookDelete --- PASS -=== RUN TestWebhookTest --- PASS -=== RUN TestWebhookUpdateRequiresAtLeastOneField --- PASS -=== RUN TestLabelList --- PASS -=== RUN TestLabelCreate --- PASS -=== RUN TestLabelCreateWithDefaultColor --- PASS -=== RUN TestLabelUpdate --- PASS -=== RUN TestLabelUpdateRequiresAtLeastOneField --- PASS -=== RUN TestLabelDelete --- PASS -=== RUN TestIssueClosePreservesCurrentDescription --- PASS -=== RUN TestIssueUpdatePreservesCurrentDescriptionWhenChangingTitleAndState --- PASS -=== RUN TestIssueUpdatePreservesCurrentSubjectWhenChangingDescription --- PASS -=== RUN TestBatchClosePreservesCurrentDescription --- PASS -=== RUN TestPRCommentPostsToCorrectIssueJournal --- PASS -=== RUN TestPRCommentFailsWhenPRNotFound --- PASS -=== RUN TestPRCommentFailsWhenIssueFieldMissing --- PASS -=== RUN TestMountShortcutSupportsBoolFlags --- PASS - -36 tests — ALL PASSED- - + + +