create-dwy 0.14.7 → 0.15.0

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 (70) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/bin/index.js +4 -0
  3. package/package.json +1 -1
  4. package/src/skills-install.js +113 -0
  5. package/src/sync-all.js +19 -0
  6. package/templates/ai-tools/CLAUDE.md +1 -1
  7. package/templates/ai-tools/hooks/Git/pre-git-commit-sensitive-check.sh +10 -2
  8. package/templates/ai-tools/rules/HarmonyOS/dwy-arkts-strict.md +221 -0
  9. package/templates/ai-tools/rules/HarmonyOS/dwy-arkts-ui-build.md +193 -0
  10. package/templates/ai-tools/rules/iOS/dwy-ios-pitfalls.md +159 -0
  11. package/templates/ai-tools/rules/iOS/dwy-swift-core.md +35 -0
  12. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-acceptance/SKILL.md +23 -0
  13. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-architecture/SKILL.md +28 -0
  14. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-competitor/SKILL.md +22 -0
  15. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-ideate/SKILL.md +21 -0
  16. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-mvp/SKILL.md +23 -0
  17. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-poc/SKILL.md +24 -0
  18. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-prd/SKILL.md +22 -0
  19. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-product-launcher/SKILL.md +68 -0
  20. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-product-launcher/references/state-and-contract.md +103 -0
  21. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-prototype/SKILL.md +23 -0
  22. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-release/SKILL.md +26 -0
  23. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-stage-design/SKILL.md +23 -0
  24. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-stage-dev/SKILL.md +22 -0
  25. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-stage-launch/SKILL.md +25 -0
  26. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-stage-prd/SKILL.md +22 -0
  27. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-stage-ship/SKILL.md +21 -0
  28. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-tasks/SKILL.md +22 -0
  29. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-tdd-dev/SKILL.md +25 -0
  30. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-validate/SKILL.md +28 -0
  31. package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-version/SKILL.md +23 -0
  32. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-github-action-publish/SKILL.md +365 -0
  33. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-github-action-publish/references/electron-release-workflow-template.yml +98 -0
  34. package/templates/ai-tools/skills//{350/277/220/347/273/264/345/217/221/345/270/203/dwy-cibuildwheel → 345/217/221/345/270/203/345/217/221/347/211/210/dwy-github-action-publish}/references/release-workflow-template.yml +3 -3
  35. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/SKILL.md +31 -0
  36. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/android.md +31 -0
  37. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/backend-deploy.md +23 -0
  38. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/changelog.md +37 -0
  39. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/frontend-deploy.md +23 -0
  40. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/generic-release.md +27 -0
  41. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/harmony.md +25 -0
  42. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/ios.md +32 -0
  43. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/monitor-notify.md +36 -0
  44. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/publish-config.md +65 -0
  45. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references/version-sync.md +30 -0
  46. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/scripts/release_config.sh +115 -0
  47. package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/SKILL.md +31 -21
  48. package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/references/python-commercial-guide.md +1 -1
  49. package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/references/sensitive-patterns.md +1 -1
  50. package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-sdk-spec/scripts/init_config.sh +91 -0
  51. package/templates/ai-tools/skills//345/274/200/345/217/221/346/265/201/347/250/213/dwy-whiteboard-prototype/SKILL.md +70 -0
  52. package/templates/ai-tools/skills//345/274/200/345/217/221/346/265/201/347/250/213/dwy-whiteboard-prototype/assets/template.html +353 -0
  53. package/templates/ai-tools/skills//345/256/211/345/205/250/dwy-sdk-spec/scripts/init_config.sh +0 -97
  54. package/templates/ai-tools/skills//345/274/200/345/217/221/346/265/201/347/250/213/dwy-publish/SKILL.md +0 -50
  55. package/templates/ai-tools/skills//345/274/200/345/217/221/346/265/201/347/250/213/dwy-publish/references/application-release.md +0 -106
  56. package/templates/ai-tools/skills//345/274/200/345/217/221/346/265/201/347/250/213/dwy-publish/references/sdk-release.md +0 -93
  57. package/templates/ai-tools/skills//350/277/220/347/273/264/345/217/221/345/270/203/dwy-cibuildwheel/SKILL.md +0 -356
  58. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/assets/files-whitelist-snippet.json" +0 -0
  59. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/assets/js-commercial.npmignore" +0 -0
  60. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/assets/python-commercial-MANIFEST.in" +0 -0
  61. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/assets/python-commercial.gitignore" +0 -0
  62. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/references/js-commercial-guide.md" +0 -0
  63. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/references/publish-blacklist.md" +0 -0
  64. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/scripts/check_comments.py" +0 -0
  65. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/scripts/check_js_publish.sh" +0 -0
  66. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/scripts/check_python_publish.sh" +0 -0
  67. /package/templates/ai-tools/skills//345/{256/211/345/205/250 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-sdk-spec/scripts/detect_sdk.sh" +0 -0
  68. /package/templates/ai-tools/skills//345/{274/200/345/217/221/346/265/201/347/250/213 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-semver/SKILL.md" +0 -0
  69. /package/templates/ai-tools/skills//345/{274/200/345/217/221/346/265/201/347/250/213 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-semver/references/semver-spec.md" +0 -0
  70. /package/templates/ai-tools/skills//345/{274/200/345/217/221/346/265/201/347/250/213 → 217/221/345/270/203/345/217/221/347/211/210}/dwy-semver/scripts/bump.py" +0 -0
@@ -0,0 +1,98 @@
1
+ # Electron 多平台打包 + GitHub Release workflow 模板
2
+ #
3
+ # 来源参考: 某 Electron 桌面应用多平台打包实战 (release.yml + pack.mjs)
4
+ #
5
+ # 使用前按项目实际情况替换:
6
+ # 1. node-version
7
+ # 2. 包管理器安装命令(npm ci / pnpm install --frozen-lockfile)
8
+ # 3. build / pack 命令
9
+ # 4. Linux 系统依赖
10
+ # 5. 签名 / 公证 secrets
11
+ # 6. artifact path 和文件命名
12
+
13
+ name: Build and Release
14
+
15
+ on:
16
+ push:
17
+ tags:
18
+ - "v*"
19
+ workflow_dispatch:
20
+
21
+ permissions:
22
+ contents: write
23
+
24
+ jobs:
25
+ build:
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ include:
30
+ - os: macos-15-intel
31
+ platform: mac-x64
32
+ packArgs: ""
33
+ - os: macos-latest
34
+ platform: mac-arm64
35
+ packArgs: "-- --arm64"
36
+ - os: windows-latest
37
+ platform: win
38
+ packArgs: ""
39
+ - os: ubuntu-latest
40
+ platform: linux
41
+ packArgs: "-- --linux"
42
+
43
+ runs-on: ${{ matrix.os }}
44
+
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ with:
48
+ submodules: true
49
+
50
+ - uses: actions/setup-node@v4
51
+ with:
52
+ node-version: 20
53
+
54
+ - name: Install Linux packaging dependencies
55
+ if: matrix.os == 'ubuntu-latest'
56
+ run: |
57
+ sudo rm -f /etc/apt/sources.list.d/azure-cli.list /etc/apt/sources.list.d/microsoft-prod.list
58
+ sudo apt-get update
59
+ sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils
60
+
61
+ - name: Install dependencies
62
+ run: npm ci
63
+
64
+ - name: Build
65
+ run: npm run build
66
+
67
+ - name: Package
68
+ run: npm run pack ${{ matrix.packArgs }}
69
+ env:
70
+ CSC_IDENTITY_AUTO_DISCOVERY: false
71
+
72
+ - name: Upload artifacts
73
+ uses: actions/upload-artifact@v4
74
+ with:
75
+ name: release-${{ matrix.platform }}
76
+ path: |
77
+ release/**/*.dmg
78
+ release/**/*.exe
79
+ release/**/*.AppImage
80
+
81
+ release:
82
+ needs: build
83
+ runs-on: ubuntu-latest
84
+ steps:
85
+ - uses: actions/download-artifact@v4
86
+ with:
87
+ path: artifacts
88
+ merge-multiple: true
89
+
90
+ - name: List release files
91
+ run: find artifacts -type f
92
+
93
+ - name: Create GitHub Release
94
+ uses: softprops/action-gh-release@v2
95
+ with:
96
+ files: artifacts/**/*
97
+ generate_release_notes: true
98
+ draft: false
@@ -1,6 +1,6 @@
1
1
  # Python Cython SDK 跨平台 wheel + PyPI Trusted Publisher 发版 workflow 模板
2
2
  #
3
- # 已内置 dwy-cibuildwheel skill 7 个避坑修复,开箱即用。
3
+ # 已内置 dwy-github-action-publish skill Python wheel 场景 8 个避坑修复,开箱即用。
4
4
  # 复制到项目 .github/workflows/release.yml,只改两处:
5
5
  # 1. package-dir: <PACKAGE_DIR> —— 实际 SDK 子目录(monorepo 必填,单包仓库填 . 或省略)
6
6
  # 2. CIBW_BUILD —— 按需调整 Python 版本枚举
@@ -42,7 +42,7 @@ jobs:
42
42
  include:
43
43
  - { os: ubuntu-latest, archs: x86_64 }
44
44
  - { os: ubuntu-24.04-arm, archs: aarch64 }
45
- # 坑 8: macos-13 已于 2025-12-04 退休,用 macos-15-intel(真 Intel runner)替代
45
+ # 坑 8: macos-13 已退休,用 macos-15-intel(真 Intel runner)替代
46
46
  # 如果不需要 x86_64 wheel,删掉下一行,Intel Mac 用户走 Rosetta 跑 arm64 wheel
47
47
  - { os: macos-15-intel, archs: x86_64 }
48
48
  - { os: macos-14, archs: arm64 }
@@ -66,7 +66,7 @@ jobs:
66
66
  CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
67
67
  CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2
68
68
  CIBW_TEST_REQUIRES: pytest pytest-asyncio respx
69
- # 坑 3 + 坑 7: 整行加双引号避免 YAML 冒号歧义;强制 binary 防止源码 build 链
69
+ # 坑 3 + 坑 7: 整行加双引号避免 YAML 冒号歧义; 强制 binary 防止源码 build 链
70
70
  CIBW_BEFORE_TEST: "pip install --only-binary=:all: pyarrow pandas"
71
71
  # 坑 4 + 坑 5: monorepo 用 {package} 而非 {project};外单内双跨平台兼容
72
72
  CIBW_TEST_COMMAND: 'pytest {package}/tests -v -k "not requires_server"'
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: dwy-publish
3
+ description: "发版/部署编排器。触发条件:用户说\"发版\"\"部署\"\"发布上线\"\"release\"\"publish\"\"走发版流程\"时。按应用目录确认发布方式并缓存,串起定版本→changelog→安全检查→build/发布→监控→通知。版本号决策单独走 dwy-semver,GA 打包走 dwy-github-action-publish,发布前安全检查走 dwy-sdk-spec——本 skill 负责编排,按路径主动调它们。"
4
+ ---
5
+
6
+ # 发版编排器
7
+
8
+ 一条发版链的编排执行。进入前测试已完成。
9
+
10
+ **先**读仓库上下文,判目标平台(前端/后端/Android/iOS/鸿蒙/通用)+ 定位应用目录(相对项目根的相对路径)。**再**按下表执行 8 步。
11
+
12
+ | # | 步骤 | 类型 | 调用 |
13
+ |---|------|------|------|
14
+ | 1 | 确认发布方式 + 探测 build/publish 命令 | 项目步 | `scripts/release_config.sh` + `references/publish-config.md` |
15
+ | 2 | 写/校验发布配置(GA workflow / TestFlight 就绪) | 项目步 | `references/publish-config.md` |
16
+ | 3 | 定版本号 + 多文件同步 | 通用步 | `../dwy-semver` + `references/version-sync.md` |
17
+ | 4 | 写 changelog(按平台子目录) | 通用步 | `references/changelog.md` |
18
+ | 5 | 安全检查(闸门,未过不发) | 通用步 | `../dwy-sdk-spec` |
19
+ | 6 | build + 触发发布 | 项目步 | `references/<平台>.md`;走 GA 引 `../dwy-github-action-publish` |
20
+ | 7 | 监控发布进程 | 项目步 | `references/monitor-notify.md` |
21
+ | 8 | 通知结果(输出结果文本) | — | `references/monitor-notify.md` |
22
+
23
+ 平台流程文件:`frontend-deploy.md` / `backend-deploy.md` / `ios.md` / `android.md` / `harmony.md` / `generic-release.md`。
24
+
25
+ ## 编排约束
26
+
27
+ - **通用步固化**(定版本/changelog/安全检查跨项目一致,走子 skill/脚本);**项目步读上下文+缓存**(build/deploy/监控命令因项目而异,**绝不写死**,探测不到问用户后缓存)。
28
+ - 安全检查(第 5 步)是闸门,未过不进发布。
29
+ - 全程 AI 自动判断、自动跑,仅搞不定时才问用户(版本级别拿不准、命令探测不到、配置缺失、构建/发布失败)。
30
+ - 编排时按文件路径主动加载子 skill(`../dwy-semver`、`../dwy-sdk-spec`、`../dwy-github-action-publish`);这些 skill 也可被用户独立触发。
31
+ - `.dwy/` 缓存提醒用户加进 `.gitignore`。
@@ -0,0 +1,31 @@
1
+ # Android 发布流程
2
+
3
+ 适用:Android 产物——**应用包(apk/aab→分发/商店)** 或 **SDK(aar→maven)**。
4
+
5
+ ## 先判产物形态
6
+
7
+ - 应用包:有 application module、产出 apk/aab → 走 app 路径
8
+ - SDK:library module、产出 aar、有 maven publish 配置 → 走 SDK 路径
9
+
10
+ ## 版本(通用步,固化)
11
+
12
+ - `versionName` = 语义版本号,走 `../dwy-semver` 决策 + bump.py。
13
+ - `versionCode` = 单调递增整数,每次发布 +1。
14
+ - 多文件同步见 `version-sync.md`。
15
+
16
+ ## build / publish(项目步,不写死命令)
17
+
18
+ 命令来自缓存(build_cmd/publish_cmd),缓存缺则按 `publish-config.md` 探测:
19
+ - 探测线索:`build.gradle(.kts)` task、`gradlew`、`fastlane/`、CI workflow
20
+ - 探测不到→问用户→缓存
21
+
22
+ 按缓存 method 分流:
23
+ - `maven` → 用项目实际的 maven 发布命令(gradle publish task / 私有源)
24
+ - `github-action` → 引 `../dwy-github-action-publish`(先过通用检查)
25
+ - `local` → 缓存的本地构建/发布命令
26
+
27
+ ## changelog / 安全检查 / 监控
28
+
29
+ - changelog → `changelog.md`(写 `android/CHANGELOG.md`)
30
+ - 安全检查 → `../dwy-sdk-spec`
31
+ - 监控 + 结果 → `monitor-notify.md`
@@ -0,0 +1,23 @@
1
+ # 后端部署流程
2
+
3
+ 适用:后端服务、API、容器或镜像、线上后端环境。
4
+
5
+ ## 版本(通用步,固化)
6
+
7
+ - 走 `../dwy-semver` 决策 + bump.py;多文件同步见 `version-sync.md`(Python 须同步 `pyproject.toml` 的 `version` 和包 `__init__.py` 的 `__version__`)。
8
+ - 纯重发、仅重跑 workflow、仅补环境配置、仅回滚已有构建时可不 bump。
9
+
10
+ ## build / deploy(项目步,不写死命令)
11
+
12
+ 命令来自缓存(build_cmd/publish_cmd),缓存缺则按 `publish-config.md` 探测:
13
+ - 探测线索:`Dockerfile`、`docker-compose`、部署脚本、`Makefile`、`pyproject.toml`、CI workflow
14
+ - 探测不到→问用户→缓存
15
+
16
+ 按缓存 method 分流:
17
+ - `github-action` → 引 `../dwy-github-action-publish`(CI 推荐 OIDC,先过通用检查)
18
+ - `local` → 缓存的本地构建/部署命令(打镜像 / 部署脚本)
19
+
20
+ ## changelog / 监控
21
+
22
+ - changelog → `changelog.md`(写 `backend/CHANGELOG.md`)
23
+ - 监控 + verify → `monitor-notify.md`(后端信号:健康检查 / 版本接口 / 运行日志 / 镜像 tag)
@@ -0,0 +1,37 @@
1
+ # CHANGELOG 按平台子目录各写一份
2
+
3
+ monorepo 下一个仓库可能同时含 android / ios / harmony / frontend / backend 多平台。**每个平台维护自己的 CHANGELOG,不写全局单份**。发哪个平台,只写哪个平台那份。
4
+
5
+ ## 各平台 CHANGELOG 位置
6
+
7
+ - `android/CHANGELOG.md`
8
+ - `ios/CHANGELOG.md`
9
+ - `harmony/CHANGELOG.md`
10
+ - `frontend/CHANGELOG.md`
11
+ - `backend/CHANGELOG.md`
12
+
13
+ 子目录名按仓库实际结构定(先在第 0 步识别平台目录)。
14
+
15
+ ## 写法
16
+
17
+ 1. 找该平台上一个 release tag
18
+ 2. 按平台子目录过滤 commit:
19
+
20
+ ```bash
21
+ git log <last-tag>..HEAD --oneline -- <平台子目录>/
22
+ ```
23
+
24
+ 3. 按 `feat` / `fix` / `refactor` / `chore` 分组
25
+ 4. 写入该平台 `CHANGELOG.md`,标注新版本号
26
+
27
+ 如果仓库已有自动生成命令(changelogen 等),优先使用,但仍按平台目录过滤范围。
28
+
29
+ ## 自动执行
30
+
31
+ changelog 由 AI 自动生成并写入,不强制逐步确认。仅当 commit 历史无法清晰归类、或平台目录边界不明时才停下问用户。
32
+
33
+ ## 禁止
34
+
35
+ - 禁止写一份全局 CHANGELOG 混入多平台变更
36
+ - 禁止 changelog 未写完就进入部署
37
+ - 禁止把其他平台的 commit 写进当前平台 CHANGELOG(必须按目录过滤)
@@ -0,0 +1,23 @@
1
+ # 前端部署流程
2
+
3
+ 适用:站点、SPA、SSR、前端容器镜像或线上前端环境。
4
+
5
+ ## 版本(通用步,固化)
6
+
7
+ - 走 `../dwy-semver` 决策 + bump.py;多文件同步见 `version-sync.md`(前端改 `package.json` 的 `version`)。
8
+ - 纯重发、仅重跑 workflow、仅回滚已有构建时可不 bump。
9
+
10
+ ## build / deploy(项目步,不写死命令)
11
+
12
+ 命令来自缓存(build_cmd/publish_cmd),缓存缺则按 `publish-config.md` 探测:
13
+ - 探测线索:`package.json` scripts(build/deploy)、`vite.config.*`、`Dockerfile`、`Makefile`、CI workflow
14
+ - 探测不到→问用户→缓存
15
+
16
+ 按缓存 method 分流:
17
+ - `github-action` → 引 `../dwy-github-action-publish`(CI 推荐 OIDC,先过通用检查)
18
+ - `local` → 缓存的本地构建/部署命令(推镜像 / 传 CDN·OSS / 部署脚本)
19
+
20
+ ## changelog / 监控
21
+
22
+ - changelog → `changelog.md`(写 `frontend/CHANGELOG.md`)
23
+ - 监控 + verify → `monitor-notify.md`(前端信号:页面访问 / 版本接口 / 产物 hash / CDN 刷新)
@@ -0,0 +1,27 @@
1
+ # 通用发布流程(兜底)
2
+
3
+ 适用:不属于前端 / 后端 / Android / iOS / 鸿蒙 五类的发布——CLI 二进制、Docker 镜像、纯 PyPI / npm 库、其他对外包或环境。dwy-shared 自身的 eui / ekit / eapi / cli 走这条。
4
+
5
+ ## 版本(通用步,固化)
6
+
7
+ - 走 `../dwy-semver` 决策 + bump.py;多文件同步见 `version-sync.md`(Python 同步 `pyproject.toml` + `__init__.py`,Node 同步 `package.json`)。
8
+ - 纯重发、仅重跑 workflow、仅回滚已有构建时可不 bump。
9
+
10
+ ## build / publish(项目步,不写死命令)
11
+
12
+ 命令来自缓存(build_cmd/publish_cmd),缓存缺则按 `publish-config.md` 探测:
13
+ - 探测线索:`package.json` scripts、`pyproject.toml`、`Makefile`、发布脚本、CI workflow
14
+ - 探测不到→问用户→缓存
15
+
16
+ 按缓存 method 分流:
17
+ - `github-action-oidc` → **PyPI/npm 首选**,引 `../dwy-github-action-publish`(OIDC + Trusted Publisher)
18
+ - `github-action` → Cython wheel / Electron / 镜像,引 `../dwy-github-action-publish`
19
+ - `local` → 缓存的本地发包命令(`uv publish` / `pnpm publish` 等)
20
+
21
+ **PyPI/npm 未配置 GA 时按 `publish-config.md` 主动推荐 OIDC。**
22
+
23
+ ## changelog / 安全检查 / 监控
24
+
25
+ - changelog → `changelog.md`(单包仓库根目录一份;monorepo 按包目录过滤)
26
+ - 安全检查 → `../dwy-sdk-spec`(对外包必查泄露/产物)
27
+ - 监控 + verify → `monitor-notify.md`(包仓库版本查询 / GitHub Release)
@@ -0,0 +1,25 @@
1
+ # 鸿蒙发布流程
2
+
3
+ 适用:HarmonyOS ArkTS 产物——**应用包(har app / hap)** 或 **SDK(har→ohpm)**。
4
+
5
+ ## 版本(通用步,固化)
6
+
7
+ - `oh-package.json5` 的 `version` = 语义版本号,走 `../dwy-semver` 决策 + bump.py。
8
+ - 多文件同步见 `version-sync.md`。
9
+
10
+ ## build / publish(项目步,不写死命令)
11
+
12
+ 命令来自缓存(build_cmd/publish_cmd),缓存缺则按 `publish-config.md` 探测:
13
+ - 探测线索:`build-profile.json5`、ohpm 脚本、DevEco 构建配置、CI workflow
14
+ - 探测不到→问用户→缓存
15
+
16
+ 按缓存 method 分流:
17
+ - `ohpm` → 用项目实际的 ohpm 发布命令(中心仓 / 私有源)
18
+ - `github-action` → 引 `../dwy-github-action-publish`(先过通用检查)
19
+ - `local` → 缓存的本地构建/发布命令
20
+
21
+ ## changelog / 安全检查 / 监控
22
+
23
+ - changelog → `changelog.md`(写 `harmony/CHANGELOG.md`)
24
+ - 安全检查 → `../dwy-sdk-spec`
25
+ - 监控 + 结果 → `monitor-notify.md`
@@ -0,0 +1,32 @@
1
+ # iOS 发布流程
2
+
3
+ 适用:iOS 产物——**应用包(ipa→TestFlight/App Store)** 或 **SDK(framework/xcframework→CocoaPods/SPM)**。
4
+
5
+ ## 先判产物形态
6
+
7
+ - 应用包:有 app target、`fastlane/` beta/release lane、TestFlight 上传 → 走 app 路径
8
+ - SDK:产出 framework/xcframework、有 podspec / `Package.swift` → 走 SDK 路径
9
+
10
+ ## 版本(通用步,固化)
11
+
12
+ - 语义版本号 `CFBundleShortVersionString`,走 `../dwy-semver` 决策 + bump.py。
13
+ - **build 号 `CFBundleVersion` = 时间戳 `yyyyMMddHHmm` 12 位**(如 `202606231430`,`date +%Y%m%d%H%M`),每次发布重新生成,单调递增。app 和 SDK 都适用。
14
+ - 多文件同步见 `version-sync.md`。
15
+
16
+ ## build / publish(项目步,不写死命令)
17
+
18
+ 命令来自缓存(`release_config.sh` 的 build_cmd/publish_cmd),缓存缺则按 `publish-config.md` 探测:
19
+ - 探测线索:`fastlane/Fastfile`、`*.xcodeproj`/`*.xcworkspace`、`Makefile`、CI workflow、`package.json` scripts
20
+ - 探测不到→问用户→缓存
21
+
22
+ 按缓存 method 分流:
23
+ - `testflight` → 用项目实际的 TestFlight 上传命令(fastlane lane / Transporter / altool)
24
+ - `cocoapods` / `spm` → 用项目实际的 pod 发布 / git tag 命令(SPM 以 tag 为版本,tag 须等于 `CFBundleShortVersionString`)
25
+ - `github-action` → 引 `../dwy-github-action-publish`(先过其通用检查)
26
+ - `local` → 缓存的本地命令
27
+
28
+ ## changelog / 安全检查 / 监控
29
+
30
+ - changelog → `changelog.md`(写 `ios/CHANGELOG.md`)
31
+ - 安全检查 → `../dwy-sdk-spec`(SDK 发布尤其要查泄露)
32
+ - 监控 + 结果 → `monitor-notify.md`
@@ -0,0 +1,36 @@
1
+ # 监控发布进程 + 通知结果
2
+
3
+ 发布触发后监控进程直到终态,再输出结果文本。监控方式因 CI / 本地而异(项目步)。
4
+
5
+ ## 监控
6
+
7
+ 发布方式来自缓存 method:
8
+
9
+ - **CI(github-action / github-action-oidc)**:
10
+ ```bash
11
+ gh run watch "$(gh run list --workflow=<release.yml> --limit=1 --json databaseId --jq '.[0].databaseId')" --exit-status
12
+ ```
13
+ 观察到失败时拉日志定位失败 job:`gh run view <run-id> --json jobs,conclusion`。
14
+ - **本地(local / testflight / maven / cocoapods / ohpm)**:用缓存的 `publish_cmd` 退出码判断,再做产物 / 渠道检查。
15
+
16
+ ## verify
17
+
18
+ 用缓存 `verify_cmd`,或按渠道验证新版本可见:
19
+
20
+ - npm:`npm view <pkg> version`
21
+ - PyPI:`pip index versions <pkg>`
22
+ - maven / ohpm / cocoapods:对应渠道版本查询
23
+ - TestFlight:App Store Connect 构建状态
24
+ - GitHub Release:`gh release view <tag>`
25
+ - 前端 / 后端:页面访问 / 版本接口 / 健康检查
26
+
27
+ verify 失败,发布不算完成。
28
+
29
+ ## 通知结果(输出结果文本)
30
+
31
+ 发布终态后在对话里输出结果摘要,不接外部通知:
32
+
33
+ - **成功**:平台 / 应用目录、版本号、产物、渠道、verify 结果
34
+ - **失败**:失败阶段、关键报错、下一步建议(重发 / bump / 修配置)
35
+
36
+ 涉及删除远端 release / tag 的重发,必须先确认用户允许。
@@ -0,0 +1,65 @@
1
+ # 发布方式缓存 + 命令探测
2
+
3
+ 发布方式与 build/publish 命令**因项目而异,不写死**。按应用目录探测 → 问 → 缓存复用。
4
+
5
+ ## 缓存机制
6
+
7
+ - 缓存文件:`<project_root>/.dwy/publish/config.json`,读写走 `scripts/release_config.sh`。
8
+ - key = **相对项目根的相对目录**(如 `ios`、`apps/electron`,根用 `.`)。
9
+ - `.dwy/` 是本机判断缓存,**提醒用户加进 `.gitignore`**,不入版本库。
10
+
11
+ ## 读写流程
12
+
13
+ 1. 确定本次要发的**应用目录**(相对路径)。
14
+ 2. `release_config.sh get <root> <rel_dir>`:
15
+ - 命中且 `configured=true` → 用缓存的 method + build_cmd/publish_cmd/verify_cmd
16
+ - 比对 `cmd_source`:若项目里对应命令源(package.json scripts / Fastfile / workflow 等)已变 → 重新探测+问用户+更新缓存
17
+ - 未命中(首次进入该目录)→ 走第 3 步
18
+ 3. 首次配置:
19
+ - 探测真实命令(见下方探测线索)
20
+ - AskUserQuestion 问发布方式(见下方各平台候选)
21
+ - 检查对应配置就绪(GA workflow 是否存在 / TestFlight 凭据线索 / maven·pod publish 配置)
22
+ - `release_config.sh set <root> <rel_dir> <platform> <method> <channel> <configured> [build_cmd] [publish_cmd] [verify_cmd] [cmd_source]`
23
+ - 提醒把 `.dwy/` 加进 `.gitignore`
24
+ 4. 目录与缓存对不上(仓库结构变了):先 AI 自助判断目录是否仍正确,判不准再问用户,必要时 `reset` 重建。
25
+
26
+ 全程 AI 自动跑,仅探测不到 / 命令歧义 / 配置缺失时才问用户。
27
+
28
+ ## build/publish 命令探测线索(不写死,按项目找)
29
+
30
+ | 平台 | 去哪找真实命令 |
31
+ |------|---------------|
32
+ | 前端 | `package.json` scripts(build/deploy)、`vite.config.*`、`.github/workflows/`、`Makefile` |
33
+ | 后端 | `Dockerfile`、`docker-compose`、部署脚本、`Makefile`、`pyproject.toml`、`.github/workflows/` |
34
+ | iOS | `fastlane/Fastfile`、`*.xcodeproj` / `*.xcworkspace`、`Makefile`、CI workflow、`package.json` scripts |
35
+ | Android | `build.gradle(.kts)` task、`gradlew`、`fastlane/`、CI workflow |
36
+ | 鸿蒙 | `build-profile.json5`、ohpm 脚本、DevEco 构建配置、CI workflow |
37
+ | 通用包 | `package.json` scripts、`pyproject.toml`、`Makefile`、发布脚本、`.github/workflows/` |
38
+
39
+ 探测到多个候选时问用户选;探测不到时问用户给命令。命令存进缓存的 `build_cmd`/`publish_cmd`/`verify_cmd`。
40
+
41
+ ## 各平台发布方式候选(AskUserQuestion)
42
+
43
+ 先按平台 + 产物形态(应用包 vs SDK)裁剪候选,推荐项标注:
44
+
45
+ | platform / 产物 | method 候选 |
46
+ |------|------|
47
+ | ios 应用包(ipa) | `testflight`(推荐) / `github-action` / `local` / `manual` |
48
+ | ios SDK(framework/xcframework) | `cocoapods` / `spm` / `github-action` / `local` |
49
+ | android 应用包(apk/aab) | `github-action`(推荐) / `local` |
50
+ | android SDK(aar) | `maven`(推荐) / `github-action` / `local` |
51
+ | harmony(har / har app) | `ohpm`(推荐) / `github-action` / `local` |
52
+ | frontend | `github-action`(CI,推荐 OIDC) / `local` |
53
+ | backend | `github-action`(CI,推荐 OIDC) / `local` |
54
+ | generic — PyPI/npm | `github-action-oidc`(**推荐**,无静态凭据、符合团队准则) / `local` |
55
+ | generic — Cython wheel | `github-action`(cibuildwheel) / `local` |
56
+ | generic — Electron | `github-action`(多平台 runner) / `local` |
57
+ | generic — Docker/二进制 | `github-action` / `local` |
58
+
59
+ ## PyPI / npm 首次配置:主动推荐 GitHub Action OIDC
60
+
61
+ PyPI / npm 且未配置 GA 时,**主动推荐 `github-action-oidc`**(OIDC Trusted Publishing,无长期静态凭据):
62
+
63
+ - 给 workflow 模板:见 `../dwy-github-action-publish`(Python wheel / 纯包 OIDC)。
64
+ - 给 Trusted Publisher 网页配置步骤:PyPI/npmjs 后台绑定 repo + workflow 文件名 + environment。
65
+ - 用户仍可选 `local`(`uv publish` / `pnpm publish` 等),按其选择缓存。
@@ -0,0 +1,30 @@
1
+ # 版本号多文件同步
2
+
3
+ 版本号定好后,**同一次发布的所有版本来源文件必须改到完全一致**。一个技术栈往往有多处版本声明,漏改一处就会导致包内版本不一致、构建产物版本错乱。
4
+
5
+ ## 各技术栈版本来源清单
6
+
7
+ | 技术栈 | 版本来源文件 | 字段 |
8
+ |------|------|------|
9
+ | Python | `pyproject.toml` + 包 `__init__.py` | `version` / `__version__` |
10
+ | Node/Vue | `package.json` | `version` |
11
+ | Android | `build.gradle(.kts)` | `versionName`(语义号)+ `versionCode`(整数,每次发布递增) |
12
+ | iOS | `Info.plist` 或 `project.pbxproj` | `CFBundleShortVersionString`(语义号)+ `CFBundleVersion`(build 号,见 `sdk-ios.md`) |
13
+ | 鸿蒙 | `oh-package.json5` | `version` |
14
+
15
+ ## 规则
16
+
17
+ - **Python**:`pyproject.toml` 的 `version` 与包 `__init__.py` 的 `__version__` 两处必须一致。
18
+ - **Android**:`versionName` 用语义版本号;`versionCode` 是单调递增整数,与语义号无关,每次发布 +1。
19
+ - **iOS**:`CFBundleShortVersionString` 用语义版本号;`CFBundleVersion`(build 号)用时间戳,规则见 `sdk-ios.md`。
20
+ - 改完后用 grep 全仓库扫一遍旧版本号,确认无遗漏:
21
+
22
+ ```bash
23
+ grep -rn "<旧版本号>" --include=pyproject.toml --include=package.json --include="*.gradle*" --include="*.plist" --include="oh-package.json5" .
24
+ ```
25
+
26
+ ## 禁止
27
+
28
+ - 禁止只改一处版本来源就发布(如只改 `pyproject.toml` 漏改 `__init__.py`)
29
+ - 禁止用会自动 commit 的版本命令(`npm version` / `bumpversion` 等),直接编辑文件,保持提交边界可控
30
+ - 禁止 `versionCode` / `CFBundleVersion` 不递增就重发(应用商店会拒)
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env bash
2
+ # dwy-publish 发布方式缓存读写
3
+ # 缓存写项目内 <project_root>/.dwy/publish/config.json,key 用相对项目根的相对目录
4
+ # 用法:
5
+ # release_config.sh get <project_root> <rel_dir>
6
+ # release_config.sh set <project_root> <rel_dir> <platform> <method> <channel> <configured> [build_cmd] [publish_cmd] [verify_cmd] [cmd_source]
7
+ # release_config.sh reset <project_root> <rel_dir>
8
+ # release_config.sh list <project_root>
9
+ #
10
+ # 设计要点(与发布编排配套):
11
+ # - 通用步(定版本/changelog/安全检查)不进缓存,走固化流程
12
+ # - 项目步(build/publish/verify)命令因项目而异,探测/确认后存这里复用
13
+ # - cmd_source 是命令来源指纹,编排器 get 后比对,变更则重新问用户更新
14
+
15
+ set -euo pipefail
16
+
17
+ config_file() {
18
+ echo "${1%/}/.dwy/publish/config.json"
19
+ }
20
+
21
+ ensure_config() {
22
+ local root="$1"
23
+ local dir="${root%/}/.dwy/publish"
24
+ local file
25
+ file="$(config_file "$root")"
26
+ mkdir -p "$dir"
27
+ if [[ ! -f "$file" ]]; then
28
+ echo '{"version":"1","apps":{}}' > "$file"
29
+ fi
30
+ # 检测损坏
31
+ if ! jq empty "$file" 2>/dev/null; then
32
+ echo "ERROR: $file is corrupted. Back it up and delete to reset." >&2
33
+ exit 2
34
+ fi
35
+ }
36
+
37
+ cmd_get() {
38
+ local root="$1" rel="$2"
39
+ ensure_config "$root"
40
+ jq --arg p "$rel" '.apps[$p] // null' "$(config_file "$root")"
41
+ }
42
+
43
+ cmd_set() {
44
+ local root="$1" rel="$2" platform="$3" method="$4" channel="$5" configured="$6"
45
+ local build_cmd="${7:-}" publish_cmd="${8:-}" verify_cmd="${9:-}" cmd_source="${10:-}"
46
+
47
+ case "$platform" in
48
+ frontend|backend|ios|android|harmony|generic) ;;
49
+ *) echo "ERROR: platform must be one of frontend|backend|ios|android|harmony|generic, got: $platform" >&2; exit 2 ;;
50
+ esac
51
+ case "$configured" in
52
+ true|false) ;;
53
+ *) echo "ERROR: configured must be 'true' or 'false', got: $configured" >&2; exit 2 ;;
54
+ esac
55
+ if [[ -z "$method" ]]; then
56
+ echo "ERROR: method must not be empty" >&2; exit 2
57
+ fi
58
+
59
+ ensure_config "$root"
60
+ local now file tmp
61
+ now=$(date -u +%Y-%m-%dT%H:%M:%SZ)
62
+ file="$(config_file "$root")"
63
+ tmp=$(mktemp)
64
+ jq \
65
+ --arg p "$rel" \
66
+ --arg pl "$platform" \
67
+ --arg m "$method" \
68
+ --arg c "$channel" \
69
+ --arg b "$build_cmd" \
70
+ --arg pub "$publish_cmd" \
71
+ --arg v "$verify_cmd" \
72
+ --arg cs "$cmd_source" \
73
+ --argjson cfg "$configured" \
74
+ --arg t "$now" \
75
+ '.apps[$p] = {platform:$pl, method:$m, channel:$c, build_cmd:$b, publish_cmd:$pub, verify_cmd:$v, cmd_source:$cs, configured:$cfg, configured_at:$t}' \
76
+ "$file" > "$tmp"
77
+ mv "$tmp" "$file"
78
+
79
+ echo "OK: cached $rel -> $platform/$method"
80
+ echo "Remember to add .dwy/ to .gitignore (本机判断缓存,不入版本库)"
81
+ }
82
+
83
+ cmd_reset() {
84
+ local root="$1" rel="$2"
85
+ ensure_config "$root"
86
+ local file tmp
87
+ file="$(config_file "$root")"
88
+ tmp=$(mktemp)
89
+ jq --arg p "$rel" 'del(.apps[$p])' "$file" > "$tmp"
90
+ mv "$tmp" "$file"
91
+ echo "OK: removed $rel from cache"
92
+ }
93
+
94
+ cmd_list() {
95
+ local root="$1"
96
+ ensure_config "$root"
97
+ jq '.apps | to_entries | map({dir: .key, platform: .value.platform, method: .value.method, configured: .value.configured})' "$(config_file "$root")"
98
+ }
99
+
100
+ main() {
101
+ if [[ $# -lt 1 ]]; then
102
+ echo "Usage: $0 {get|set|reset|list} <project_root> [args...]" >&2
103
+ exit 2
104
+ fi
105
+ local action="$1"; shift
106
+ case "$action" in
107
+ get) cmd_get "$@" ;;
108
+ set) cmd_set "$@" ;;
109
+ reset) cmd_reset "$@" ;;
110
+ list) cmd_list "$@" ;;
111
+ *) echo "ERROR: unknown action: $action" >&2; exit 2 ;;
112
+ esac
113
+ }
114
+
115
+ main "$@"