From 353b31362344e8c56369bfd7a16be8b40ff78d66 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 30 Jul 2026 22:42:02 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 27b8841..7b43353 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ 当前范围包括地图拖动缩放、POI 分类、marker 与摘要联动、用户主动授权后的前台实时定位、POI 详情、AI 文旅助手交互和推荐行程展示。路线规划支持基于当前位置的快速规划,以及用户自选 2–8 个 POI、2–10 小时时长的自定义规划;本地规划器按时间预算动态排程,配置服务端后可由受控 AI 在审核白名单内推荐点位与顺序。当前不是道路级实时导航,也不包含打卡、登录或个人中心。 +## Todo:还需要再次合并打卡功能至main branch. + ## 微信开发者工具 本仓库是 uni-app 源码工程,微信开发者工具不能直接编译 `src/**/*.vue`。正确流程是由 Vite/uni-app 持续编译,再由微信开发者工具加载编译产物: From e896e7d1722309a7d26b419b4b569f29783cba2f Mon Sep 17 00:00:00 2001 From: gitea-bot Date: Fri, 31 Jul 2026 00:19:58 +0800 Subject: [PATCH 2/5] ci: sync hardened workflow (fork-PR graceful skip) --- .gitea/workflows/ai-review.yml | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/ai-review.yml b/.gitea/workflows/ai-review.yml index 06ee1d3..6206dae 100644 --- a/.gitea/workflows/ai-review.yml +++ b/.gitea/workflows/ai-review.yml @@ -1,5 +1,6 @@ # AI 代码审查:每次 PR 触发,用 Claude Code 调用智谱 GLM(glm-5.2) 审查 diff, # 并把结论评论到 PR。走 GLM 的 Anthropic 兼容端点,无需访问 Anthropic 官方。 +# 注意:来自 fork 的跨仓库 PR 会被 Gitea 隐藏密钥,无法审查——请在团队仓库内开同仓库 PR。 name: AI Code Review on: pull_request: @@ -9,33 +10,46 @@ jobs: review: runs-on: ubuntu-latest env: - # 关键:把 Claude Code 指向智谱 GLM 的 Anthropic 兼容端点(已验证可用) ANTHROPIC_BASE_URL: https://open.bigmodel.cn/api/anthropic ANTHROPIC_API_KEY: ${{ secrets.ZHIPU_API_KEY }} ANTHROPIC_MODEL: glm-5.2 - CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1" # 关闭遥测,避免访问被墙地址 + CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1" DISABLE_AUTOUPDATER: "1" IS_SANDBOX: "1" # CI 容器以 root 运行,需此项才能用 --dangerously-skip-permissions steps: - name: 检出代码 - # 手动克隆,避免从 github.com 下载 actions/checkout(内网不可达) + # 用 http.extraHeader 传凭据,避免 PAT 出现在 clone URL(防日志/报错泄漏) env: REVIEW_PAT: ${{ secrets.REVIEW_PAT }} run: | - git clone "http://oauth2:${REVIEW_PAT}@gitea:3000/${{ gitea.repository }}.git" . + if [ -z "$REVIEW_PAT" ]; then + echo "::warning::REVIEW_PAT 为空:通常是来自 fork 的跨仓库 PR(Gitea 会隐藏密钥)。请在团队仓库内开同仓库 PR。本次跳过审查。" + echo "SKIP_REVIEW=1" >> "$GITHUB_ENV" + exit 0 + fi + git config --global http.extraHeader "Authorization: Basic $(printf 'oauth2:%s' "$REVIEW_PAT" | base64 -w0)" + git clone "http://gitea:3000/${{ gitea.repository }}.git" . git checkout "${{ gitea.event.pull_request.head.ref }}" - name: 生成 PR diff + if: env.SKIP_REVIEW != '1' run: | BASE="${{ gitea.event.pull_request.base.ref }}" git fetch origin "$BASE" git diff "origin/$BASE...HEAD" > pr.diff echo "diff 行数: $(wc -l < pr.diff)" - - name: 安装 Claude Code - run: npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com + - name: 安装 Claude Code(已装则跳过) + if: env.SKIP_REVIEW != '1' + run: | + if command -v claude >/dev/null 2>&1; then + echo "claude 已存在,跳过安装" + else + npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com + fi - name: 运行 AI 审查 + if: env.SKIP_REVIEW != '1' # Claude Code 会自动读取本仓库 CLAUDE.md 与 .claude/skills/* run: | claude -p "$(cat .claude/review-prompt.md)" \ @@ -45,6 +59,7 @@ jobs: --max-turns 15 > review.md || true - name: 把审查结论评论到 PR + if: env.SKIP_REVIEW != '1' env: REVIEW_PAT: ${{ secrets.REVIEW_PAT }} API: ${{ vars.MAIN_API }} @@ -52,11 +67,12 @@ jobs: PR: ${{ gitea.event.pull_request.number }} run: | if [ -s review.md ]; then - BODY=$(node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>process.stdout.write(JSON.stringify({body:d})))' < review.md) + # 写到临时文件再 --data @,避免超长 review 触发 ARG_MAX + node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>process.stdout.write(JSON.stringify({body:d})))' < review.md > /tmp/body.json curl -fsS -X POST "$API/repos/$REPO/issues/$PR/comments" \ -H "Authorization: token $REVIEW_PAT" \ -H "Content-Type: application/json" \ - -d "$BODY" + --data @/tmp/body.json else echo "review.md 为空,跳过评论" fi From b8be62d6d0ef02ca5e52a704b5d6f839cc46d2c9 Mon Sep 17 00:00:00 2001 From: gitea-bot Date: Fri, 31 Jul 2026 08:08:40 +0800 Subject: [PATCH 3/5] ci: runner-envs + fork-aware checkout (review any PR) --- .gitea/workflows/ai-review.yml | 51 ++++++++++++---------------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/.gitea/workflows/ai-review.yml b/.gitea/workflows/ai-review.yml index 6206dae..8e89541 100644 --- a/.gitea/workflows/ai-review.yml +++ b/.gitea/workflows/ai-review.yml @@ -1,6 +1,6 @@ -# AI 代码审查:每次 PR 触发,用 Claude Code 调用智谱 GLM(glm-5.2) 审查 diff, -# 并把结论评论到 PR。走 GLM 的 Anthropic 兼容端点,无需访问 Anthropic 官方。 -# 注意:来自 fork 的跨仓库 PR 会被 Gitea 隐藏密钥,无法审查——请在团队仓库内开同仓库 PR。 +# AI 代码审查:每次 PR 触发(含 fork 跨仓库 PR),用 Claude Code 调用智谱 GLM(glm-5.2) 审查 diff, +# 把结论评论到 PR。ANTHROPIC_API_KEY / REVIEW_PAT 由 runner 的 envs 注入(不经 Gitea secret, +# 故 fork PR 也能拿到);MAIN_API 用组织变量。 name: AI Code Review on: pull_request: @@ -11,46 +11,34 @@ jobs: runs-on: ubuntu-latest env: ANTHROPIC_BASE_URL: https://open.bigmodel.cn/api/anthropic - ANTHROPIC_API_KEY: ${{ secrets.ZHIPU_API_KEY }} ANTHROPIC_MODEL: glm-5.2 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1" DISABLE_AUTOUPDATER: "1" - IS_SANDBOX: "1" # CI 容器以 root 运行,需此项才能用 --dangerously-skip-permissions + IS_SANDBOX: "1" + # ANTHROPIC_API_KEY 和 REVIEW_PAT 不要写在这里 —— 由 runner envs 注入 steps: - - name: 检出代码 - # 用 http.extraHeader 传凭据,避免 PAT 出现在 clone URL(防日志/报错泄漏) - env: - REVIEW_PAT: ${{ secrets.REVIEW_PAT }} + - name: 检出代码(兼容 fork PR:克隆 head 仓库) run: | - if [ -z "$REVIEW_PAT" ]; then - echo "::warning::REVIEW_PAT 为空:通常是来自 fork 的跨仓库 PR(Gitea 会隐藏密钥)。请在团队仓库内开同仓库 PR。本次跳过审查。" - echo "SKIP_REVIEW=1" >> "$GITHUB_ENV" - exit 0 - fi git config --global http.extraHeader "Authorization: Basic $(printf 'oauth2:%s' "$REVIEW_PAT" | base64 -w0)" - git clone "http://gitea:3000/${{ gitea.repository }}.git" . - git checkout "${{ gitea.event.pull_request.head.ref }}" + git clone "${{ gitea.event.pull_request.head.repo.clone_url }}" . + git checkout "${{ gitea.event.pull_request.head.sha }}" - - name: 生成 PR diff - if: env.SKIP_REVIEW != '1' + - name: 生成 PR diff(从 base 仓库取目标分支做对比) run: | - BASE="${{ gitea.event.pull_request.base.ref }}" - git fetch origin "$BASE" - git diff "origin/$BASE...HEAD" > pr.diff + BASE_REPO="${{ gitea.event.pull_request.base.repo.clone_url }}" + BASE_REF="${{ gitea.event.pull_request.base.ref }}" + git remote add base "$BASE_REPO" + git fetch base "$BASE_REF" + git diff "base/$BASE_REF...HEAD" > pr.diff echo "diff 行数: $(wc -l < pr.diff)" - name: 安装 Claude Code(已装则跳过) - if: env.SKIP_REVIEW != '1' run: | - if command -v claude >/dev/null 2>&1; then - echo "claude 已存在,跳过安装" - else - npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com + if command -v claude >/dev/null 2>&1; then echo "claude 已存在,跳过安装" + else npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com fi - name: 运行 AI 审查 - if: env.SKIP_REVIEW != '1' - # Claude Code 会自动读取本仓库 CLAUDE.md 与 .claude/skills/* run: | claude -p "$(cat .claude/review-prompt.md)" \ --model glm-5.2 \ @@ -59,17 +47,12 @@ jobs: --max-turns 15 > review.md || true - name: 把审查结论评论到 PR - if: env.SKIP_REVIEW != '1' env: - REVIEW_PAT: ${{ secrets.REVIEW_PAT }} API: ${{ vars.MAIN_API }} - REPO: ${{ gitea.repository }} - PR: ${{ gitea.event.pull_request.number }} run: | if [ -s review.md ]; then - # 写到临时文件再 --data @,避免超长 review 触发 ARG_MAX node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>process.stdout.write(JSON.stringify({body:d})))' < review.md > /tmp/body.json - curl -fsS -X POST "$API/repos/$REPO/issues/$PR/comments" \ + curl -fsS -X POST "$API/repos/${{ gitea.repository }}/issues/${{ gitea.event.pull_request.number }}/comments" \ -H "Authorization: token $REVIEW_PAT" \ -H "Content-Type: application/json" \ --data @/tmp/body.json From 7f2fdc86b9dd5254260ffb0a2c035f7d6e8c5ecd Mon Sep 17 00:00:00 2001 From: gitea-bot Date: Fri, 31 Jul 2026 08:10:59 +0800 Subject: [PATCH 4/5] ci: normalize clone URL host to gitea:3000 (container-reachable) --- .gitea/workflows/ai-review.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ai-review.yml b/.gitea/workflows/ai-review.yml index 8e89541..afb6d30 100644 --- a/.gitea/workflows/ai-review.yml +++ b/.gitea/workflows/ai-review.yml @@ -20,12 +20,13 @@ jobs: - name: 检出代码(兼容 fork PR:克隆 head 仓库) run: | git config --global http.extraHeader "Authorization: Basic $(printf 'oauth2:%s' "$REVIEW_PAT" | base64 -w0)" - git clone "${{ gitea.event.pull_request.head.repo.clone_url }}" . + HEAD_URL=$(echo "${{ gitea.event.pull_request.head.repo.clone_url }}" | sed 's|http://[^/]*/|http://gitea:3000/|') + git clone "$HEAD_URL" . git checkout "${{ gitea.event.pull_request.head.sha }}" - name: 生成 PR diff(从 base 仓库取目标分支做对比) run: | - BASE_REPO="${{ gitea.event.pull_request.base.repo.clone_url }}" + BASE_REPO=$(echo "${{ gitea.event.pull_request.base.repo.clone_url }}" | sed 's|http://[^/]*/|http://gitea:3000/|') BASE_REF="${{ gitea.event.pull_request.base.ref }}" git remote add base "$BASE_REPO" git fetch base "$BASE_REF" From 310063ac9dab2e71e9634bc0226a21aea2f74c8b Mon Sep 17 00:00:00 2001 From: gitea-bot Date: Fri, 31 Jul 2026 08:32:30 +0800 Subject: [PATCH 5/5] ci: revert to secure same-repo PR review --- .gitea/workflows/ai-review.yml | 51 ++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/ai-review.yml b/.gitea/workflows/ai-review.yml index afb6d30..81c76df 100644 --- a/.gitea/workflows/ai-review.yml +++ b/.gitea/workflows/ai-review.yml @@ -1,6 +1,7 @@ -# AI 代码审查:每次 PR 触发(含 fork 跨仓库 PR),用 Claude Code 调用智谱 GLM(glm-5.2) 审查 diff, -# 把结论评论到 PR。ANTHROPIC_API_KEY / REVIEW_PAT 由 runner 的 envs 注入(不经 Gitea secret, -# 故 fork PR 也能拿到);MAIN_API 用组织变量。 +# AI 代码审查:每次 PR 触发,用 Claude Code 调用智谱 GLM(glm-5.2) 审查 diff, +# 并把结论评论到 PR。走 GLM 的 Anthropic 兼容端点,无需访问 Anthropic 官方。 +# 密钥用 Gitea 的 ${{ secrets.* }}(同仓库 PR 正常下发;来自 fork 的跨仓库 PR 会被 +# Gitea 隐藏密钥 → 自动跳过审查,不报错)。请在团队仓库内开同仓库 PR。 name: AI Code Review on: pull_request: @@ -11,35 +12,45 @@ jobs: runs-on: ubuntu-latest env: ANTHROPIC_BASE_URL: https://open.bigmodel.cn/api/anthropic + ANTHROPIC_API_KEY: ${{ secrets.ZHIPU_API_KEY }} ANTHROPIC_MODEL: glm-5.2 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1" DISABLE_AUTOUPDATER: "1" - IS_SANDBOX: "1" - # ANTHROPIC_API_KEY 和 REVIEW_PAT 不要写在这里 —— 由 runner envs 注入 + IS_SANDBOX: "1" # CI 容器以 root 运行,需此项才能用 --dangerously-skip-permissions steps: - - name: 检出代码(兼容 fork PR:克隆 head 仓库) + - name: 检出代码 + env: + REVIEW_PAT: ${{ secrets.REVIEW_PAT }} run: | + if [ -z "$REVIEW_PAT" ]; then + echo "::warning::REVIEW_PAT 为空:通常是来自 fork 的跨仓库 PR(Gitea 会隐藏密钥)。请在团队仓库内开同仓库 PR。本次跳过审查。" + echo "SKIP_REVIEW=1" >> "$GITHUB_ENV" + exit 0 + fi git config --global http.extraHeader "Authorization: Basic $(printf 'oauth2:%s' "$REVIEW_PAT" | base64 -w0)" - HEAD_URL=$(echo "${{ gitea.event.pull_request.head.repo.clone_url }}" | sed 's|http://[^/]*/|http://gitea:3000/|') - git clone "$HEAD_URL" . - git checkout "${{ gitea.event.pull_request.head.sha }}" + git clone "http://gitea:3000/${{ gitea.repository }}.git" . + git checkout "${{ gitea.event.pull_request.head.ref }}" - - name: 生成 PR diff(从 base 仓库取目标分支做对比) + - name: 生成 PR diff + if: env.SKIP_REVIEW != '1' run: | - BASE_REPO=$(echo "${{ gitea.event.pull_request.base.repo.clone_url }}" | sed 's|http://[^/]*/|http://gitea:3000/|') - BASE_REF="${{ gitea.event.pull_request.base.ref }}" - git remote add base "$BASE_REPO" - git fetch base "$BASE_REF" - git diff "base/$BASE_REF...HEAD" > pr.diff + BASE="${{ gitea.event.pull_request.base.ref }}" + git fetch origin "$BASE" + git diff "origin/$BASE...HEAD" > pr.diff echo "diff 行数: $(wc -l < pr.diff)" - name: 安装 Claude Code(已装则跳过) + if: env.SKIP_REVIEW != '1' run: | - if command -v claude >/dev/null 2>&1; then echo "claude 已存在,跳过安装" - else npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com + if command -v claude >/dev/null 2>&1; then + echo "claude 已存在,跳过安装" + else + npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com fi - name: 运行 AI 审查 + if: env.SKIP_REVIEW != '1' + # Claude Code 会自动读取本仓库 CLAUDE.md 与 .claude/skills/* run: | claude -p "$(cat .claude/review-prompt.md)" \ --model glm-5.2 \ @@ -48,12 +59,16 @@ jobs: --max-turns 15 > review.md || true - name: 把审查结论评论到 PR + if: env.SKIP_REVIEW != '1' env: + REVIEW_PAT: ${{ secrets.REVIEW_PAT }} API: ${{ vars.MAIN_API }} + REPO: ${{ gitea.repository }} + PR: ${{ gitea.event.pull_request.number }} run: | if [ -s review.md ]; then node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>process.stdout.write(JSON.stringify({body:d})))' < review.md > /tmp/body.json - curl -fsS -X POST "$API/repos/${{ gitea.repository }}/issues/${{ gitea.event.pull_request.number }}/comments" \ + curl -fsS -X POST "$API/repos/$REPO/issues/$PR/comments" \ -H "Authorization: token $REVIEW_PAT" \ -H "Content-Type: application/json" \ --data @/tmp/body.json