create-dwy 0.5.1 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/bin/index.js +6 -15
  2. package/package.json +3 -3
  3. package/src/create.js +61 -37
  4. package/src/sync.js +206 -61
  5. package/templates/claude-global/CLAUDE.md +92 -0
  6. package/templates/claude-global/rules/dwy-android-core.md +610 -0
  7. package/templates/claude-global/rules/dwy-api-design.md +110 -0
  8. package/templates/claude-global/rules/dwy-db-migration.md +46 -0
  9. package/templates/claude-global/rules/dwy-flutter-core.md +564 -0
  10. package/templates/claude-global/rules/dwy-flutter-network.md +222 -0
  11. package/templates/claude-global/rules/dwy-flutter-router.md +97 -0
  12. package/templates/claude-global/rules/dwy-flutter-testing.md +94 -0
  13. package/templates/claude-global/rules/dwy-git-commit-convention.md +82 -0
  14. package/templates/claude-global/rules/dwy-git-security.md +53 -0
  15. package/templates/claude-global/rules/dwy-payload-limits.md +178 -0
  16. package/templates/claude-global/rules/{prefer-open-source.md → dwy-prefer-open-source.md} +4 -0
  17. package/templates/claude-global/rules/dwy-project-structure.md +181 -0
  18. package/templates/claude-global/rules/{python-code-style.md → dwy-python-core.md} +292 -358
  19. package/templates/claude-global/rules/dwy-python-fastapi.md +272 -0
  20. package/templates/claude-global/rules/dwy-python-orm.md +61 -0
  21. package/templates/claude-global/rules/{backend-security.md → dwy-python-security.md} +99 -72
  22. package/templates/claude-global/rules/dwy-python-testing.md +53 -0
  23. package/templates/claude-global/rules/{server-security.md → dwy-server-security.md} +1 -2
  24. package/templates/claude-global/rules/dwy-tdd-development.md +70 -0
  25. package/templates/claude-global/rules/dwy-tech-stack.md +60 -0
  26. package/templates/claude-global/rules/dwy-vue-api.md +146 -0
  27. package/templates/claude-global/rules/{vue-code-style.md → dwy-vue-core.md} +338 -152
  28. package/templates/claude-global/rules/dwy-vue-pinia.md +75 -0
  29. package/templates/claude-global/rules/dwy-vue-testing.md +102 -0
  30. package/templates/claude-global/skills/dwy-deploy-audit/SKILL.md +481 -0
  31. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-data.md +117 -0
  32. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-network.md +74 -0
  33. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-runtime.md +184 -0
  34. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_base.sh +39 -0
  35. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_capacity.sh +278 -0
  36. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_db.sh +122 -0
  37. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_docker.sh +249 -0
  38. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_env.sh +64 -0
  39. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_https.sh +60 -0
  40. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_logs.sh +209 -0
  41. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_nginx.sh +92 -0
  42. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_resilience.sh +157 -0
  43. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_secrets.sh +327 -0
  44. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_services.sh +77 -0
  45. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_ssh.sh +56 -0
  46. package/templates/claude-global/skills/dwy-deploy-audit/scripts/run_all.sh +105 -0
  47. package/templates/claude-global/skills/dwy-docker/SKILL.md +187 -0
  48. package/templates/claude-global/skills/dwy-docker/references/ask-templates.md +142 -0
  49. package/templates/claude-global/skills/dwy-docker/references/templates.md +479 -0
  50. package/templates/claude-global/skills/dwy-docker/references/version-rules.md +76 -0
  51. package/templates/claude-global/skills/dwy-docker/scripts/query_dockerhub.py +204 -0
  52. package/templates/claude-global/skills/dwy-docker/scripts/scan_images.sh +185 -0
  53. package/templates/claude-global/skills/dwy-eapi/SKILL.md +433 -0
  54. package/templates/claude-global/skills/dwy-eapi/references/tasks-integration-guide.md +387 -0
  55. package/templates/claude-global/skills/dwy-ekit/SKILL.md +85 -0
  56. package/templates/claude-global/skills/dwy-ekit/references/data.md +135 -0
  57. package/templates/claude-global/skills/dwy-ekit/references/form.md +68 -0
  58. package/templates/claude-global/skills/dwy-ekit/references/request.md +183 -0
  59. package/templates/claude-global/skills/dwy-ekit/references/ui.md +109 -0
  60. package/templates/claude-global/skills/{dwy-frontend-eui → dwy-eui}/SKILL.md +129 -15
  61. package/templates/claude-global/skills/dwy-eui/references/eui-design-guide.md +257 -0
  62. package/templates/claude-global/skills/dwy-eui/references/eui-integration-guide.md +302 -0
  63. package/templates/claude-global/skills/dwy-eui/references/eui-landing-design-guide.md +437 -0
  64. package/templates/claude-global/skills/dwy-fullstack-scaffold/SKILL.md +214 -0
  65. package/templates/claude-global/skills/dwy-mirror-source/SKILL.md +275 -0
  66. package/templates/claude-global/skills/dwy-mirror-source/references/dockerfile-snippets.md +228 -0
  67. package/templates/claude-global/skills/dwy-mirror-source/references/mirror-providers.md +150 -0
  68. package/templates/claude-global/skills/dwy-mirror-source/scripts/__pycache__/check_mirrors.cpython-313.pyc +0 -0
  69. package/templates/claude-global/skills/dwy-mirror-source/scripts/apply_mirrors.py +666 -0
  70. package/templates/claude-global/skills/dwy-mirror-source/scripts/check_mirrors.py +868 -0
  71. package/templates/claude-global/skills/dwy-pentest/SKILL.md +344 -0
  72. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__init__.py +1 -0
  73. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/__init__.cpython-311.pyc +0 -0
  74. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/config.cpython-311.pyc +0 -0
  75. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/executor.cpython-311.pyc +0 -0
  76. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/severity.cpython-311.pyc +0 -0
  77. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/validator.cpython-311.pyc +0 -0
  78. package/templates/claude-global/skills/dwy-pentest/scripts/lib/config.py +109 -0
  79. package/templates/claude-global/skills/dwy-pentest/scripts/lib/executor.py +157 -0
  80. package/templates/claude-global/skills/dwy-pentest/scripts/lib/severity.py +96 -0
  81. package/templates/claude-global/skills/dwy-pentest/scripts/lib/validator.py +113 -0
  82. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_auth.py +289 -0
  83. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_recon.py +217 -0
  84. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_report.py +343 -0
  85. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_scan.py +205 -0
  86. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_ssl.py +208 -0
  87. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_vuln.py +205 -0
  88. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_web.py +330 -0
  89. package/templates/claude-global/skills/dwy-pentest/scripts/pyproject.toml +14 -0
  90. package/templates/claude-global/skills/dwy-pentest/scripts/setup_tools.sh +97 -0
  91. package/templates/claude-global/skills/dwy-pentest/scripts/uv.lock +415 -0
  92. package/templates/claude-global/skills/{dwy-release → dwy-publish}/SKILL.md +42 -18
  93. package/templates/claude-global/skills/dwy-vue-core/SKILL.md +890 -0
  94. package/templates/project/backend/.dwy.hbs +5 -0
  95. package/templates/project/backend/.python-version +1 -0
  96. package/templates/project/backend/CLAUDE.md.hbs +40 -0
  97. package/templates/project/{web/backend → backend}/alembic/script.py.mako +2 -0
  98. package/templates/project/{web/backend → backend}/alembic.ini.hbs +0 -1
  99. package/templates/project/backend/deploy.sh.hbs +18 -0
  100. package/templates/project/{web → backend}/docker-compose.prod.yml.hbs +1 -1
  101. package/templates/project/{web/backend → backend}/pyproject.toml.hbs +4 -5
  102. package/templates/project/{web/backend → backend}/src/app/config.py.hbs +1 -1
  103. package/templates/project/backend/src/app/database.py +10 -0
  104. package/templates/project/backend/src/app/dependencies.py +5 -0
  105. package/templates/project/{web/backend → backend}/src/app/main.py.hbs +3 -3
  106. package/templates/project/backend/src/app/models/base.py +5 -0
  107. package/templates/project/web/CLAUDE.md.hbs +29 -36
  108. package/templates/project/web/{frontend → apps/web}/index.html.hbs +1 -0
  109. package/templates/project/web/{frontend → apps/web}/package.json.hbs +4 -3
  110. package/templates/project/web/apps/web/src/App.vue +9 -0
  111. package/templates/project/web/apps/web/src/api/client.ts +5 -0
  112. package/templates/project/web/apps/web/src/composables/.gitkeep +0 -0
  113. package/templates/project/web/apps/web/src/layouts/DefaultLayout.vue +8 -0
  114. package/templates/project/web/{frontend → apps/web}/src/router/index.ts +1 -1
  115. package/templates/project/web/{frontend → apps/web}/src/stores/auth.ts +4 -2
  116. package/templates/project/web/apps/web/src/style.css +2 -0
  117. package/templates/project/web/apps/web/src/types/router.d.ts +8 -0
  118. package/templates/project/web/apps/web/src/views/HomeView.vue +8 -0
  119. package/templates/project/web/apps/web/tsconfig.app.json +18 -0
  120. package/templates/project/web/apps/web/tsconfig.json +6 -0
  121. package/templates/project/web/{frontend → apps/web}/vite.config.ts.hbs +7 -1
  122. package/templates/project/web/package.json.hbs +16 -0
  123. package/templates/project/web/packages/.gitkeep +0 -0
  124. package/templates/project/web/pnpm-workspace.yaml +3 -0
  125. package/templates/claude-global/hooks/post-sync-claude-global.sh +0 -72
  126. package/templates/claude-global/rules/agent-team-execution.md +0 -138
  127. package/templates/claude-global/rules/agent-team-patterns.md +0 -157
  128. package/templates/claude-global/rules/git-commit-convention.md +0 -106
  129. package/templates/claude-global/rules/git-security.md +0 -144
  130. package/templates/claude-global/skills/dwy-backend-base/SKILL.md +0 -279
  131. package/templates/claude-global/skills/dwy-frontend-core/SKILL.md +0 -181
  132. package/templates/project/web/.claude/commands/deploy.md +0 -4
  133. package/templates/project/web/backend/src/app/models/base.py +0 -5
  134. package/templates/project/web/deploy.sh.hbs +0 -113
  135. package/templates/project/web/frontend/src/App.vue +0 -3
  136. package/templates/project/web/frontend/src/api/client.ts +0 -13
  137. package/templates/project/web/frontend/src/style.css +0 -1
  138. package/templates/project/web/frontend/src/views/HomeView.vue +0 -5
  139. package/templates/project/web/frontend/tsconfig.app.json +0 -14
  140. package/templates/project/web/frontend/tsconfig.json +0 -4
  141. /package/templates/{project/web/backend → claude-global/skills/dwy-pentest/scripts}/.python-version +0 -0
  142. /package/templates/project/{web/backend → backend}/Dockerfile +0 -0
  143. /package/templates/project/{web/backend → backend}/alembic/env.py.hbs +0 -0
  144. /package/templates/{claude-global/skills → project/backend/alembic/versions}/.gitkeep +0 -0
  145. /package/templates/project/{web → backend}/docker-compose.dev.yml.hbs +0 -0
  146. /package/templates/project/{web/backend → backend}/src/app/__init__.py +0 -0
  147. /package/templates/project/{web/backend → backend}/src/app/models/__init__.py +0 -0
  148. /package/templates/project/{web/backend → backend}/src/app/routers/__init__.py +0 -0
  149. /package/templates/project/{web/backend → backend}/src/app/routers/health.py +0 -0
  150. /package/templates/project/{web/backend → backend}/src/app/schemas/__init__.py +0 -0
  151. /package/templates/project/{web/backend → backend}/src/app/services/__init__.py +0 -0
  152. /package/templates/project/{web/backend → backend}/tests/__init__.py +0 -0
  153. /package/templates/project/{web/backend → backend}/tests/conftest.py.hbs +0 -0
  154. /package/templates/project/{web/backend/alembic/versions → mobile}/.gitkeep +0 -0
  155. /package/templates/project/web/{frontend → apps/web}/src/components/.gitkeep +0 -0
  156. /package/templates/project/web/{frontend → apps/web}/src/main.ts +0 -0
@@ -0,0 +1,275 @@
1
+ ---
2
+ name: dwy-mirror-source
3
+ description: "国内镜像源加速配置检查与修复:扫描 pip/uv/poetry/npm/pnpm/yarn/Docker/Go/Cargo/Maven/Gradle/Homebrew/Flutter 等 13 类工具的用户级和项目级配置,识别使用境外默认源或缺失配置的项,提供阿里云/清华/中科大镜像源切换。触发条件:用户说'检查镜像源'、'配置加速'、'换镜像源'、'mirror 检查'、'安装慢'、'下载慢' 时。"
4
+ ---
5
+
6
+ # 镜像源加速配置(mirror-source)
7
+
8
+ 国内开发环境下,pip/npm/Docker 等工具默认境外源会让安装/拉取拖慢数倍甚至失败。本 skill 统一检查所有支持工具的镜像源配置,识别问题并辅助切换到国内加速源。
9
+
10
+ **脚本目录:** `~/.claude/skills/dwy-mirror-source/scripts/`(以下简称 `{scripts}`)
11
+
12
+ ---
13
+
14
+ ## 强制原则
15
+
16
+ 1. **检查与修复分离** — 默认只检查输出报告,修复必须由用户**显式确认**。禁止自动改用户配置文件。
17
+ 2. **先 diff 后落盘** — 任何配置文件修改前必须输出 diff 让用户审阅。
18
+ 3. **保留私服配置** — 检测到企业内网私服(如 `nexus.company.com`、`pypi.internal`、`registry.company.com` 等非公网域名)时跳过修改,避免覆盖团队配置。
19
+ 4. **不自动重启 Docker daemon** — 修改 `daemon.json` 后只**提示**用户重启,禁止自动跑 `systemctl restart docker` / 重启 Docker Desktop。
20
+ 5. **不动 CI/CD 配置** — 本 skill 只处理本地开发环境,不修改 `.github/workflows/` / `.gitlab-ci.yml` 等。
21
+
22
+ ---
23
+
24
+ ## 默认首选镜像源
25
+
26
+ **阿里云**(覆盖最全,BGP 多线,全国质量稳定)。
27
+
28
+ 可通过 `~/.claude/skills/dwy-mirror-source/preference.json` 修改:
29
+
30
+ ```json
31
+ {
32
+ "preferred_provider": "aliyun"
33
+ }
34
+ ```
35
+
36
+ 可选值:`aliyun` / `tsinghua` / `ustc`。详细 URL 表见 `references/mirror-providers.md`。
37
+
38
+ ---
39
+
40
+ ## 支持的工具范围
41
+
42
+ | 类别 | 工具 | 用户级配置 | 项目级配置 |
43
+ |------|------|-----------|-----------|
44
+ | **Python** | pip | `~/.config/pip/pip.conf` 或 macOS 的 `~/Library/Application Support/pip/pip.conf` | — |
45
+ | | uv(**双源**) | `~/.config/uv/uv.toml` 同时含 `[[index]]` + `python-install-mirror` | `pyproject.toml` 的 `[[tool.uv.index]]` |
46
+ | | poetry | `~/Library/Application Support/pypoetry/auth.toml` 等 | `pyproject.toml` 的 `[[tool.poetry.source]]` |
47
+ | **Node** | npm | `~/.npmrc` | `.npmrc` |
48
+ | | pnpm | `~/.npmrc`(共用) | `.npmrc` |
49
+ | | yarn | `~/.yarnrc.yml` 或 `~/.yarnrc` | 同名项目级文件 |
50
+ | **Docker(双层)** | daemon registry-mirrors(**仅对 docker.io 生效**) | `~/.docker/daemon.json`(macOS Docker Desktop)/ `/etc/docker/daemon.json`(Linux) | — |
51
+ | | gcr/ghcr/quay/k8s 等其他 registry 加速(必须改 image 引用) | 用户在 Dockerfile / k8s yaml 中直接换前缀 | 同左 |
52
+ | **Go** | GOPROXY | `~/.config/go/env` 或 `~/Library/Application Support/go/env` | — |
53
+ | **Rust** | cargo | `~/.cargo/config.toml` | `.cargo/config.toml` |
54
+ | **JVM** | Maven | `~/.m2/settings.xml` | — |
55
+ | | Gradle | `~/.gradle/init.gradle.kts` 或 `init.gradle` | — |
56
+ | **macOS** | Homebrew | `git -C $(brew --repo) remote` + `HOMEBREW_BOTTLE_DOMAIN` | — |
57
+ | **Flutter** | PUB_HOSTED_URL | `~/.zshrc` / `~/.bashrc` 环境变量 | — |
58
+
59
+ **Linux 包管理(apt/apk/yum/dnf)** 不在自动检查范围。它们一般出现在 Dockerfile 内,是代码而非用户配置。如需在 Dockerfile 中换源,参考 `references/dockerfile-snippets.md`。
60
+
61
+ ---
62
+
63
+ ## 工作流
64
+
65
+ ### 模式 A:检查(check)
66
+
67
+ 用户说「检查镜像源」时执行。
68
+
69
+ ```bash
70
+ python3 {scripts}/check_mirrors.py [--scope user|project|both] [--project-path .]
71
+ ```
72
+
73
+ **默认行为**:扫描用户级 + 当前项目,输出分级报告。
74
+
75
+ **状态分级:**
76
+
77
+ | 状态 | 含义 | 处理 |
78
+ |------|------|------|
79
+ | ✅ ok | 已用国内推荐源 | 无需操作 |
80
+ | ⚠️ warn | 用了官方默认源(境外) | 提示可切换 |
81
+ | ⚠️ private | 用了企业私服 | 跳过,不动 |
82
+ | ❌ missing | 工具已安装但无配置 | 提示创建 |
83
+ | ➖ not_installed | 工具未安装 | 跳过 |
84
+
85
+ 输出示例:
86
+
87
+ ```
88
+ =================== 镜像源检查报告 ===================
89
+ [Python]
90
+ pip (user) ⚠️ warn 默认 PyPI → 建议: aliyun
91
+ uv (user) ✅ ok aliyun
92
+ uv (project) ➖ no_config pyproject.toml 未声明 [[tool.uv.index]]
93
+
94
+ [Node]
95
+ npm (user) ✅ ok npmmirror.com
96
+ pnpm (project) ⚠️ warn 默认 registry → 建议: aliyun
97
+
98
+ [Docker]
99
+ daemon ❌ missing ~/.docker/daemon.json 不存在 registry-mirrors
100
+
101
+ ...
102
+
103
+ 汇总: 13 项检查 / 5 项需修复 / 2 项私服跳过
104
+
105
+ 下一步: 让 Claude 帮你逐项修复,或运行
106
+ python3 apply_mirrors.py --dry-run
107
+ ```
108
+
109
+ ### 模式 B:修复(apply)
110
+
111
+ 用户确认后执行。**不允许在用户没看 diff 之前直接落盘**。
112
+
113
+ ```bash
114
+ # 第一步:dry-run 输出 diff
115
+ python3 {scripts}/apply_mirrors.py --dry-run [--tools pip,npm,docker] [--scope user]
116
+
117
+ # 第二步:用户确认后落盘
118
+ python3 {scripts}/apply_mirrors.py [--tools pip,npm,docker] [--scope user]
119
+ ```
120
+
121
+ **参数:**
122
+ - `--tools` — 逗号分隔的工具列表(`pip,uv,npm,pnpm,docker,go,cargo,maven,gradle,brew,flutter`),默认全部
123
+ - `--scope` — `user` / `project` / `both`,默认 `both`
124
+ - `--provider` — `aliyun` / `tsinghua` / `ustc`,默认读 preference.json
125
+ - `--dry-run` — 只输出 diff,不写文件
126
+ - `--project-path` — 项目级配置的根目录,默认当前目录
127
+
128
+ **修复行为:**
129
+ - 文件不存在 → 创建
130
+ - 文件存在但缺字段 → 追加(保留其他配置)
131
+ - 文件存在且字段已存在但是境外源 → 替换
132
+ - 检测到私服 → 跳过该项,输出 `[skipped: private registry]`
133
+
134
+ ### 模式 C:诊断单个工具(debug)
135
+
136
+ ```bash
137
+ python3 {scripts}/check_mirrors.py --only npm --verbose
138
+ ```
139
+
140
+ 输出该工具所有相关配置位置、当前值、解析结果,用于诊断「我配过了为什么还是慢」类问题。
141
+
142
+ ---
143
+
144
+ ## Claude 调用流程
145
+
146
+ 用户说「检查镜像源」/「配置加速」时:
147
+
148
+ 1. 跑 `check_mirrors.py` 输出报告
149
+ 2. 把报告里 `warn` / `missing` 项列出来给用户看
150
+ 3. 询问要修复哪些(默认全部 `warn` + `missing`,私服项不动)
151
+ 4. 跑 `apply_mirrors.py --dry-run --tools <user-selected>` 输出 diff
152
+ 5. 等用户确认 → 跑去掉 `--dry-run` 的版本写入
153
+ 6. 修改了 Docker daemon.json → 提示用户**重启 Docker**,本 skill 不自动重启
154
+ 7. 修改了 shell rc 文件(Flutter / Homebrew)→ 提示用户 `source ~/.zshrc` 或重开终端
155
+
156
+ **禁止行为:**
157
+ - ❌ 不询问就修改用户全局配置
158
+ - ❌ 不输出 diff 就 apply
159
+ - ❌ 自动跑 `systemctl restart docker` / `osascript -e 'quit app "Docker"'`
160
+ - ❌ 替换企业私服 URL
161
+
162
+ ---
163
+
164
+ ## uv 镜像源(多层)
165
+
166
+ uv 实际有 **3 个独立的镜像源**,缺一个都会拖慢:
167
+
168
+ | 层 | 配置项 | 作用 | 国内推荐源 |
169
+ |----|--------|------|-----------|
170
+ | 1. 包索引 | `[[index]]` 或 `UV_DEFAULT_INDEX` | 装 PyPI 包 | `https://mirrors.aliyun.com/pypi/simple/` |
171
+ | 2. **Python 解释器下载** ⭐ | `python-install-mirror` 或 `UV_PYTHON_INSTALL_MIRROR` | `uv python install 3.12` 时下载解释器 | `https://registry.npmmirror.com/-/binary/python-build-standalone` |
172
+ | 3. PyPy 解释器下载 | `pypy-install-mirror` 或 `UV_PYPY_INSTALL_MIRROR` | 下载 PyPy 解释器 | 国内**无可用镜像**,保留默认 |
173
+
174
+ **关键点:** 第 2 层(Python 解释器)默认走 `github.com/astral-sh/python-build-standalone/releases`,国内不挂代理几乎无法下载。这是 `uv venv --python 3.12` 卡住的常见原因。
175
+
176
+ 完整 `~/.config/uv/uv.toml` 示例:
177
+
178
+ ```toml
179
+ python-install-mirror = "https://registry.npmmirror.com/-/binary/python-build-standalone"
180
+
181
+ [[index]]
182
+ url = "https://mirrors.aliyun.com/pypi/simple/"
183
+ default = true
184
+ ```
185
+
186
+ `apply_mirrors.py --tools uv` 会同时写入这两层。第 3 层 PyPy 不强制配置(国内无源)。
187
+
188
+ ---
189
+
190
+ ## Docker 镜像源(多层)
191
+
192
+ Docker 镜像加速分**两类,互不替代**:
193
+
194
+ ### 类型 1:docker.io 加速 — `registry-mirrors`
195
+
196
+ 唯一作用于 `docker.io`(Docker Hub)。配置在 `~/.docker/daemon.json`:
197
+
198
+ ```json
199
+ {
200
+ "registry-mirrors": [
201
+ "https://docker.m.daocloud.io",
202
+ "https://docker.mirrors.ustc.edu.cn"
203
+ ]
204
+ }
205
+ ```
206
+
207
+ `apply_mirrors.py --tools docker` 自动配置这一层。
208
+
209
+ ### 类型 2:gcr / ghcr / quay / k8s 等加速 — 改 image 引用
210
+
211
+ **`registry-mirrors` 字段对它们完全无效**。必须把 image 名改前缀域名:
212
+
213
+ | 源 registry | 镜像域名 | 用途 |
214
+ |-------------|---------|------|
215
+ | `gcr.io` | `gcr.m.daocloud.io` | Google Container Registry |
216
+ | `ghcr.io` | `ghcr.m.daocloud.io` | GitHub Container Registry |
217
+ | `quay.io` | `quay.m.daocloud.io` | Red Hat Quay |
218
+ | `registry.k8s.io` | `k8s.m.daocloud.io` | Kubernetes 当前官方 registry |
219
+ | `k8s.gcr.io` | `k8s-gcr.m.daocloud.io` | Kubernetes 旧仓库 |
220
+ | `mcr.microsoft.com` | `mcr.m.daocloud.io` | Microsoft Container Registry |
221
+ | `nvcr.io` | `nvcr.m.daocloud.io` | NVIDIA Container Registry |
222
+ | `docker.elastic.co` | `elastic.m.daocloud.io` | Elastic 官方镜像 |
223
+ | `registry.ollama.ai` | `ollama.m.daocloud.io` | Ollama 模型 |
224
+
225
+ 完整列表见 `references/mirror-providers.md`。
226
+
227
+ **用法:**
228
+
229
+ ```bash
230
+ # 原本(国内拉不动)
231
+ docker pull gcr.io/google-containers/pause:3.9
232
+ docker pull ghcr.io/astral-sh/uv:0.5.0
233
+
234
+ # 改前缀域名走加速
235
+ docker pull gcr.m.daocloud.io/google-containers/pause:3.9
236
+ docker pull ghcr.m.daocloud.io/astral-sh/uv:0.5.0
237
+ ```
238
+
239
+ ```dockerfile
240
+ # Dockerfile 同理
241
+ FROM ghcr.m.daocloud.io/astral-sh/uv:0.5.0 AS uv
242
+ FROM gcr.m.daocloud.io/distroless/python3:nonroot
243
+ ```
244
+
245
+ **为什么不能自动配置?** 这层加速无法在 daemon.json 实现透明代理,必须显式改 image 字符串。Claude 在用户写 Dockerfile / k8s yaml 时,如发现使用了 gcr/ghcr/quay 等域名,**应主动提示**改前缀(可与 dwy-docker-image skill 协同:固定 tag 时一并替换 registry 域名)。
246
+
247
+ > 提示:containerd(不是 Docker)支持 `[plugins."io.containerd.grpc.v1.cri".registry.mirrors]` 全局映射;Kubernetes 节点用 containerd 时可写到 `/etc/containerd/config.toml` 实现透明代理。Docker 引擎本身不支持。
248
+
249
+ ---
250
+
251
+ ## 与其他 skill 的关系
252
+
253
+ - **dwy-docker-image**:固定镜像版本(FROM 指令的 tag)
254
+ - **本 skill**:配置 docker pull 时走哪个 registry mirror
255
+ - **dwy-deploy-audit**:检查生产服务器的镜像源配置
256
+
257
+ 三者协作:本地用 dwy-mirror-source 配好镜像加速 → 写代码用 dwy-docker-image 固定 tag → 部署后用 dwy-deploy-audit 检查线上
258
+
259
+ ---
260
+
261
+ ## 违规检测速查
262
+
263
+ | 检测项 | 严重程度 | 说明 |
264
+ |--------|---------|------|
265
+ | Python pip 用 `pypi.org/simple` 默认源 | warn | 改 `mirrors.aliyun.com/pypi/simple/` |
266
+ | uv 缺 `python-install-mirror` | warn | `uv python install` 卡顿,添加 npmmirror 二进制源 |
267
+ | uv 用了不稳定 GitHub 代理(如 ghfast/gh-proxy) | warn | 改用更稳定的 npmmirror.com/-/binary |
268
+ | npm/pnpm 用 `registry.npmjs.org` | warn | 改 `registry.npmmirror.com` |
269
+ | Docker 无 `registry-mirrors` | warn | 添加 `docker.m.daocloud.io` |
270
+ | Dockerfile / k8s 用 `gcr.io/...`、`ghcr.io/...`、`registry.k8s.io/...` | warn | 改前缀为 `gcr.m.daocloud.io/...` 等(改 image 字符串) |
271
+ | Go 未设 GOPROXY 或为 `direct` | warn | 改 `https://goproxy.cn,direct` |
272
+ | Maven 默认 Central | warn | 添加 aliyun mirror |
273
+ | Cargo 默认 crates.io | warn | 改 `rsproxy.cn` |
274
+ | 用 npm registry 但没用 https | high | 安全问题,强制换 https |
275
+ | 镜像源 URL 已弃用(如 `npm.taobao.org`) | high | 已 EOL,必须迁移到 npmmirror.com |
@@ -0,0 +1,228 @@
1
+ # Dockerfile 内换源代码片段
2
+
3
+ Linux 包管理(apt/apk/yum/dnf)和 Python pip 在 Dockerfile 内的换源代码片段。这些是**镜像构建时**的源,与本机用户配置无关,需要写到 Dockerfile 里。
4
+
5
+ ## 通用原则
6
+
7
+ 1. **基础镜像确定后再换源** — 不同 base image 用不同包管理(Ubuntu/Debian 用 apt,Alpine 用 apk,CentOS/RockyLinux 用 yum/dnf)
8
+ 2. **多阶段构建只在需要安装包的阶段换** — 最终运行阶段如果不装包,不必加这些
9
+ 3. **CI/CD 镜像构建可能不需要换源** — 部分 CI 已在境内或自建 mirror,按团队约定
10
+
11
+ ---
12
+
13
+ ## Debian / Ubuntu (apt)
14
+
15
+ ### Ubuntu 22.04 / 24.04(Noble / Jammy)
16
+
17
+ Ubuntu 24.04 起 sources.list 改为 deb822 格式(`/etc/apt/sources.list.d/ubuntu.sources`),22.04 仍是老格式。
18
+
19
+ ```dockerfile
20
+ # Ubuntu 22.04 (jammy)
21
+ RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g; \
22
+ s|http://security.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g' \
23
+ /etc/apt/sources.list \
24
+ && apt-get update
25
+ ```
26
+
27
+ ```dockerfile
28
+ # Ubuntu 24.04 (noble)
29
+ RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g; \
30
+ s|http://security.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g' \
31
+ /etc/apt/sources.list.d/ubuntu.sources \
32
+ && apt-get update
33
+ ```
34
+
35
+ ### Debian 11 / 12(Bullseye / Bookworm)
36
+
37
+ Debian 12 起也用了 deb822 格式(`/etc/apt/sources.list.d/debian.sources`)。
38
+
39
+ ```dockerfile
40
+ # Debian 11 (bullseye)
41
+ RUN sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g; \
42
+ s|http://security.debian.org|https://mirrors.aliyun.com/debian-security|g' \
43
+ /etc/apt/sources.list \
44
+ && apt-get update
45
+ ```
46
+
47
+ ```dockerfile
48
+ # Debian 12 (bookworm)
49
+ RUN sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' \
50
+ /etc/apt/sources.list.d/debian.sources \
51
+ && apt-get update
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Alpine (apk)
57
+
58
+ ```dockerfile
59
+ RUN sed -i 's|https://dl-cdn.alpinelinux.org|https://mirrors.aliyun.com|g' \
60
+ /etc/apk/repositories \
61
+ && apk update
62
+ ```
63
+
64
+ ---
65
+
66
+ ## CentOS / RockyLinux / AlmaLinux (yum / dnf)
67
+
68
+ ### RockyLinux 9 / AlmaLinux 9
69
+
70
+ ```dockerfile
71
+ RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' \
72
+ -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
73
+ -i.bak /etc/yum.repos.d/rocky-*.repo \
74
+ && dnf clean all
75
+ ```
76
+
77
+ ### CentOS 7(已 EOL,仍有遗留)
78
+
79
+ ```dockerfile
80
+ RUN curl -o /etc/yum.repos.d/CentOS-Base.repo \
81
+ https://mirrors.aliyun.com/repo/Centos-7.repo \
82
+ && yum clean all && yum makecache
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Python pip 在 Dockerfile 内
88
+
89
+ 不依赖容器内 `~/.config/pip/pip.conf`,直接在 RUN 命令中指定 `-i`:
90
+
91
+ ```dockerfile
92
+ RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ \
93
+ --trusted-host mirrors.aliyun.com \
94
+ -r requirements.txt
95
+ ```
96
+
97
+ 或写到环境变量供后续 RUN 沿用:
98
+
99
+ ```dockerfile
100
+ ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
101
+ ENV PIP_TRUSTED_HOST=mirrors.aliyun.com
102
+ RUN pip install --no-cache-dir -r requirements.txt
103
+ ```
104
+
105
+ ---
106
+
107
+ ## uv 在 Dockerfile 内
108
+
109
+ ```dockerfile
110
+ ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
111
+ RUN uv pip install --system -r requirements.txt
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Node 在 Dockerfile 内
117
+
118
+ ```dockerfile
119
+ RUN npm config set registry https://registry.npmmirror.com \
120
+ && npm install --production
121
+ ```
122
+
123
+ 或 pnpm:
124
+
125
+ ```dockerfile
126
+ RUN pnpm config set registry https://registry.npmmirror.com \
127
+ && pnpm install --frozen-lockfile
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Go 在 Dockerfile 内
133
+
134
+ ```dockerfile
135
+ ENV GOPROXY=https://goproxy.cn,direct
136
+ RUN go mod download
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Rust / Cargo 在 Dockerfile 内
142
+
143
+ ```dockerfile
144
+ RUN mkdir -p ~/.cargo \
145
+ && echo '[source.crates-io]' > ~/.cargo/config.toml \
146
+ && echo 'replace-with = "rsproxy-sparse"' >> ~/.cargo/config.toml \
147
+ && echo '' >> ~/.cargo/config.toml \
148
+ && echo '[source.rsproxy-sparse]' >> ~/.cargo/config.toml \
149
+ && echo 'registry = "sparse+https://rsproxy.cn/index/"' >> ~/.cargo/config.toml
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Maven 在 Dockerfile 内
155
+
156
+ ```dockerfile
157
+ COPY <<'EOF' /root/.m2/settings.xml
158
+ <settings>
159
+ <mirrors>
160
+ <mirror>
161
+ <id>aliyun</id>
162
+ <mirrorOf>*</mirrorOf>
163
+ <url>https://maven.aliyun.com/repository/public</url>
164
+ </mirror>
165
+ </mirrors>
166
+ </settings>
167
+ EOF
168
+ ```
169
+
170
+ ---
171
+
172
+ ## 完整组合示例:Python 后端镜像
173
+
174
+ ```dockerfile
175
+ FROM python:3.12-slim-bookworm
176
+
177
+ # 1. apt 换源
178
+ RUN sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' \
179
+ /etc/apt/sources.list.d/debian.sources \
180
+ && apt-get update \
181
+ && apt-get install -y --no-install-recommends gcc libpq-dev \
182
+ && rm -rf /var/lib/apt/lists/*
183
+
184
+ # 2. pip 换源
185
+ ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
186
+ PIP_TRUSTED_HOST=mirrors.aliyun.com
187
+
188
+ WORKDIR /app
189
+ COPY requirements.txt .
190
+ RUN pip install --no-cache-dir -r requirements.txt
191
+
192
+ COPY . .
193
+ CMD ["python", "main.py"]
194
+ ```
195
+
196
+ ---
197
+
198
+ ## 完整组合示例:Node 前端镜像
199
+
200
+ ```dockerfile
201
+ FROM node:20.18.0-bookworm-slim AS builder
202
+
203
+ # 1. apt 换源(可选,build stage 用得多就加)
204
+ RUN sed -i 's|http://deb.debian.org|https://mirrors.aliyun.com|g' \
205
+ /etc/apt/sources.list.d/debian.sources
206
+
207
+ # 2. pnpm 换源
208
+ RUN corepack enable && pnpm config set registry https://registry.npmmirror.com
209
+
210
+ WORKDIR /app
211
+ COPY package.json pnpm-lock.yaml ./
212
+ RUN pnpm install --frozen-lockfile
213
+
214
+ COPY . .
215
+ RUN pnpm build
216
+
217
+ FROM nginx:1.26.2-alpine
218
+ COPY --from=builder /app/dist /usr/share/nginx/html
219
+ ```
220
+
221
+ ---
222
+
223
+ ## 注意事项
224
+
225
+ 1. **不要在 Dockerfile 里写 `latest` 镜像 tag** — 见 `dwy-docker-image` skill
226
+ 2. **`--trusted-host` 仅在 http 镜像源时需要** — https 镜像不需要这个参数,但加上无害
227
+ 3. **多阶段构建复制配置** — 如果 builder 阶段配了源,runtime 阶段需要再配一次(不会自动继承)
228
+ 4. **生产构建不要把 token / 私服密码写进 Dockerfile** — 用 BuildKit secrets 或 build-args
@@ -0,0 +1,150 @@
1
+ # 镜像源 URL 对照表
2
+
3
+ 各加速服务的 URL 由 `check_mirrors.py` / `apply_mirrors.py` 中的 `MIRRORS` 字典维护。本文件作为**人类可读的索引**,便于审阅、迁移、扩展新工具。
4
+
5
+ 如需更新 URL,请同时改脚本里的 `MIRRORS` 字典和本文档,保持一致。
6
+
7
+ ## 默认推荐:阿里云
8
+
9
+ 阿里云覆盖最全、BGP 多线、对外网无依赖、稳定性高,故作默认。
10
+
11
+ | 工具 | URL | 说明 |
12
+ |------|-----|------|
13
+ | pip | `https://mirrors.aliyun.com/pypi/simple/` | PyPI 镜像 |
14
+ | uv | `https://mirrors.aliyun.com/pypi/simple/` | 与 pip 共用 |
15
+ | poetry | `https://mirrors.aliyun.com/pypi/simple/` | 同上 |
16
+ | npm | `https://registry.npmmirror.com` | npmmirror(原 npm.taobao 已迁移) |
17
+ | pnpm | `https://registry.npmmirror.com` | 共用 |
18
+ | yarn | `https://registry.npmmirror.com` | 共用 |
19
+ | Docker | `https://docker.m.daocloud.io` | DaoCloud 加速器,免登录 |
20
+ | Go (GOPROXY) | `https://goproxy.cn,direct` | 七牛云维护 |
21
+ | Cargo | `sparse+https://rsproxy.cn/index/` | 字节跳动维护 |
22
+ | Maven | `https://maven.aliyun.com/repository/public` | 综合公共仓库 |
23
+ | Gradle plugin | `https://maven.aliyun.com/repository/gradle-plugin` | gradle 插件库 |
24
+ | Homebrew brew.git | `https://mirrors.aliyun.com/homebrew/brew.git` | brew 仓库 |
25
+ | Homebrew core | `https://mirrors.aliyun.com/homebrew/homebrew-core.git` | core formulae |
26
+ | Homebrew bottles | `https://mirrors.aliyun.com/homebrew/homebrew-bottles` | 二进制包 |
27
+ | Flutter PUB | `https://pub.flutter-io.cn` | flutter pub |
28
+ | Flutter STORAGE | `https://storage.flutter-io.cn` | flutter SDK |
29
+
30
+ ## 备选:清华 TUNA
31
+
32
+ 教育网友好,混合源最完整。Homebrew 上清华源比阿里维护更新更勤。
33
+
34
+ | 工具 | URL |
35
+ |------|-----|
36
+ | pip | `https://pypi.tuna.tsinghua.edu.cn/simple` |
37
+ | npm | `https://registry.npmmirror.com`(清华无 npm 镜像,回退 npmmirror) |
38
+ | Docker | `https://docker.m.daocloud.io`(清华无 docker 镜像,回退 daocloud) |
39
+ | Go | `https://goproxy.cn,direct`(清华无 GOPROXY,回退 goproxy.cn) |
40
+ | Cargo | `sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/` |
41
+ | Maven | `https://maven.aliyun.com/repository/public`(清华无 maven,回退 aliyun) |
42
+ | Homebrew brew.git | `https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git` |
43
+ | Homebrew core | `https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git` |
44
+ | Homebrew bottles | `https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles` |
45
+ | Flutter PUB | `https://pub.flutter-io.cn`(沿用) |
46
+
47
+ ## 备选:中科大 USTC
48
+
49
+ | 工具 | URL |
50
+ |------|-----|
51
+ | pip | `https://mirrors.ustc.edu.cn/pypi/simple/` |
52
+ | npm | `https://registry.npmmirror.com` |
53
+ | Docker | `https://docker.m.daocloud.io` |
54
+ | Go | `https://goproxy.cn,direct` |
55
+ | Cargo | `sparse+https://mirrors.ustc.edu.cn/crates.io-index/` |
56
+ | Maven | `https://maven.aliyun.com/repository/public` |
57
+ | Homebrew brew.git | `https://mirrors.ustc.edu.cn/brew.git` |
58
+ | Homebrew core | `https://mirrors.ustc.edu.cn/homebrew-core.git` |
59
+ | Homebrew bottles | `https://mirrors.ustc.edu.cn/homebrew-bottles` |
60
+ | Flutter PUB | `https://pub.flutter-io.cn` |
61
+
62
+ ## 已弃用(必须迁移)
63
+
64
+ | 旧 URL | 状态 | 替代 |
65
+ |--------|------|------|
66
+ | `https://registry.npm.taobao.org` | 2022-05 已停止维护,证书过期 | `https://registry.npmmirror.com` |
67
+ | `https://registry.npmjs.cf` | 已停止 | `https://registry.npmmirror.com` |
68
+ | `https://mirrors.aliyun.com/pypi/`(无 `simple/`)| 路径错误 | `https://mirrors.aliyun.com/pypi/simple/` |
69
+ | `http://...` 任何镜像源 | 不安全 | 一律 `https://` |
70
+
71
+ ## Docker 加速器(重点)
72
+
73
+ Docker 镜像加速分**两类**,互不替代:
74
+
75
+ ### 类型 1:docker.io 加速(registry-mirrors)
76
+
77
+ 仅作用于 Docker Hub(`docker.io`)。配置在 `~/.docker/daemon.json`:
78
+
79
+ ```json
80
+ {
81
+ "registry-mirrors": [
82
+ "https://docker.m.daocloud.io",
83
+ "https://docker.mirrors.ustc.edu.cn"
84
+ ]
85
+ }
86
+ ```
87
+
88
+ 可选加速器:
89
+
90
+ | 加速器 | URL | 备注 |
91
+ |--------|-----|------|
92
+ | DaoCloud | `https://docker.m.daocloud.io` | **首选**,免登录、稳定 |
93
+ | 中科大 | `https://docker.mirrors.ustc.edu.cn` | 高校镜像 |
94
+ | 网易 | `https://hub-mirror.c.163.com` | 偶尔波动 |
95
+ | 阿里云专属 | `https://<your-id>.mirror.aliyuncs.com` | 阿里云用户专属,需登录获取 |
96
+ | 腾讯云 | `https://mirror.ccs.tencentyun.com` | 仅腾讯云内网 |
97
+
98
+ ### 类型 2:非 docker.io registry 加速
99
+
100
+ **`registry-mirrors` 字段对 gcr/ghcr/quay/k8s/mcr/nvcr 等其他 registry 完全无效**。要加速这类 image,必须**改 image 引用本身**。
101
+
102
+ DaoCloud 维护的 11 个 registry 镜像(实测全部可达):
103
+
104
+ | 源 registry | 镜像域名 | 用途 |
105
+ |-------------|---------|------|
106
+ | `docker.io` | `docker.m.daocloud.io` | Docker Hub(也可走 registry-mirrors) |
107
+ | `gcr.io` | `gcr.m.daocloud.io` | Google Container Registry |
108
+ | `ghcr.io` | `ghcr.m.daocloud.io` | GitHub Container Registry |
109
+ | `quay.io` | `quay.m.daocloud.io` | Red Hat Quay |
110
+ | `k8s.gcr.io` | `k8s-gcr.m.daocloud.io` | Kubernetes 旧仓库(已迁出) |
111
+ | `registry.k8s.io` | `k8s.m.daocloud.io` | Kubernetes 当前官方 registry |
112
+ | `mcr.microsoft.com` | `mcr.m.daocloud.io` | Microsoft Container Registry |
113
+ | `nvcr.io` | `nvcr.m.daocloud.io` | NVIDIA Container Registry |
114
+ | `docker.elastic.co` | `elastic.m.daocloud.io` | Elastic 官方镜像 |
115
+ | `dhi.io` | `dhi.m.daocloud.io` | Docker Hub Images |
116
+ | `registry.ollama.ai` | `ollama.m.daocloud.io` | Ollama 模型(beta) |
117
+
118
+ **用法示例:**
119
+
120
+ ```bash
121
+ # 原本(拉不动)
122
+ docker pull gcr.io/google-containers/pause:3.9
123
+ docker pull ghcr.io/astral-sh/uv:latest
124
+ docker pull registry.k8s.io/kube-apiserver:v1.30.0
125
+
126
+ # 走加速(改前缀域名)
127
+ docker pull gcr.m.daocloud.io/google-containers/pause:3.9
128
+ docker pull ghcr.m.daocloud.io/astral-sh/uv:0.5.0
129
+ docker pull k8s.m.daocloud.io/kube-apiserver:v1.30.0
130
+ ```
131
+
132
+ ```dockerfile
133
+ # Dockerfile 内同样改前缀
134
+ FROM ghcr.m.daocloud.io/astral-sh/uv:0.5.0 AS uv
135
+ FROM gcr.m.daocloud.io/distroless/python3:nonroot
136
+ ```
137
+
138
+ **关键限制:**
139
+ - 这套加速**不能配在 daemon.json 里实现透明代理**(registry-mirrors 字段只识别 docker.io)
140
+ - 必须显式写入 image 引用,无法自动改写
141
+ - containerd / Kubernetes 可以用 `mirrors` 配置全局映射,但 Docker 不行
142
+
143
+ ## 私服识别规则
144
+
145
+ `check_mirrors.py` 检测到以下模式时识别为企业私服,**不修改**:
146
+
147
+ - 域名包含 `nexus`、`artifactory`、`harbor`、`internal`、`corp`、`company`、`pypi.local`、`registry.local`
148
+ - IP 地址形式(不论公网还是内网)
149
+ - 端口 `8081`、`8082`、`5000`(Nexus / Harbor 常见端口)
150
+ - 路径包含 `/repository/`(Nexus 标志路径)