blueprint-shared-templates 0.1.0-0 → 0.2.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 (100) hide show
  1. package/base/.github/CODEOWNERS.example +10 -0
  2. package/base/.github/ISSUE_TEMPLATE/bug.yml +15 -0
  3. package/base/.github/ISSUE_TEMPLATE/feature.yml +19 -0
  4. package/base/.github/ISSUE_TEMPLATE/hotfix.yml +17 -0
  5. package/base/.github/PULL_REQUEST_TEMPLATE.md +13 -0
  6. package/base/.github/actions/setup-workspace/action.yml +54 -0
  7. package/base/.github/version-control.md +22 -0
  8. package/base/.github/workflows/auto-merge.yml +138 -0
  9. package/base/.github/workflows/ci.yml +274 -0
  10. package/base/.github/workflows/main-commit-check.yml +42 -0
  11. package/base/.github/workflows/pr-message.yml +64 -0
  12. package/base/.gitignore +356 -0
  13. package/base/.oxlintrc.json +14 -0
  14. package/base/LICENSE +21 -0
  15. package/base/releases/release-plan.md +39 -0
  16. package/base/scripts/ci/affected.sh +15 -0
  17. package/base/scripts/ci/ai-attribution-list.txt +68 -0
  18. package/base/scripts/ci/check-commit-body.sh +110 -0
  19. package/base/scripts/ci/check-main-commits.sh +31 -0
  20. package/base/scripts/ci/check-pr-title.sh +10 -0
  21. package/base/scripts/ci/ci-scope.conf +23 -0
  22. package/base/scripts/ci/ci-scope.sh +106 -0
  23. package/base/scripts/ci/native-build.sh +40 -0
  24. package/base/scripts/ci/run-affected.sh +48 -0
  25. package/base/scripts/ci/run-units.sh +33 -0
  26. package/base/scripts/hooks/commit-msg +38 -0
  27. package/base/scripts/hooks/pre-push +63 -0
  28. package/base/scripts/lib/common.sh +233 -0
  29. package/base/scripts/lib/retry.mjs +178 -0
  30. package/base/scripts/merge/decide.mjs +130 -0
  31. package/base/scripts/setup/git-hooks.sh +16 -0
  32. package/base/scripts/setup/github-repo-settings.json +8 -0
  33. package/base/scripts/setup/github-repo-settings.sh +110 -0
  34. package/deploy/.github/workflows/deploy-prerelease.yml +157 -0
  35. package/deploy/.github/workflows/deploy-production.yml +173 -0
  36. package/deploy/scripts/deploy/build-bundle.sh +49 -0
  37. package/deploy/scripts/deploy/clone-ops.sh +14 -0
  38. package/deploy/scripts/deploy/plan-production.sh +43 -0
  39. package/deploy/scripts/deploy/promote.sh +35 -0
  40. package/deploy/scripts/deploy/publish-bundle.sh +21 -0
  41. package/deploy/scripts/deploy/route-tag.sh +65 -0
  42. package/deploy/scripts/deploy/run-prerelease.sh +49 -0
  43. package/deploy/scripts/deploy/run-production.sh +51 -0
  44. package/deploy/scripts/deploy/writeback-ops.sh +53 -0
  45. package/deploy/scripts/lib/bundle.sh +52 -0
  46. package/facts-describes.ts +53 -0
  47. package/facts-skeleton.mjs +84 -0
  48. package/hub/.github/workflows/open-release-lines.yml +63 -0
  49. package/hub/scripts/deploy/clone-ops.sh +14 -0
  50. package/hub/scripts/release/dispatch-release-lines.sh +54 -0
  51. package/hub/scripts/release/snapshot-members.sh +85 -0
  52. package/infra/.github/workflows/deploy-prerelease.yml +157 -0
  53. package/infra/.github/workflows/deploy-production.yml +173 -0
  54. package/infra/scripts/deploy/apply-infra.sh +46 -0
  55. package/infra/scripts/deploy/apply-prerelease.sh +22 -0
  56. package/infra/scripts/deploy/apply-production.sh +33 -0
  57. package/infra/scripts/deploy/route-tag.sh +65 -0
  58. package/ops/.github/workflows/ops-deploy.yml +88 -0
  59. package/ops/scripts/deploy/apply-ops.sh +100 -0
  60. package/ops/scripts/deploy/healthz.sh +16 -0
  61. package/ops/scripts/deploy/ops-run.sh +41 -0
  62. package/ops/scripts/deploy/smoke.sh +49 -0
  63. package/ops/scripts/lib/bundle.sh +52 -0
  64. package/package.json +21 -4
  65. package/publish/.github/workflows/publish.yml +299 -0
  66. package/publish/scripts/release/cleanup-private-packages.mjs +107 -0
  67. package/publish/scripts/release/mirror-units.sh +167 -0
  68. package/publish/scripts/release/publish-units.sh +489 -0
  69. package/release/.github/workflows/nightly.yml +93 -0
  70. package/release/.github/workflows/open-release-line.yml +70 -0
  71. package/release/.github/workflows/release-line-finalize.yml +101 -0
  72. package/release/.github/workflows/release-please.yml +148 -0
  73. package/release/release-please-config.json +39 -0
  74. package/release/release-policy.json +38 -0
  75. package/release/schemas/release-policy.schema.json +151 -0
  76. package/release/scripts/ci/check-facts-describes.sh +63 -0
  77. package/release/scripts/ci/check-facts.sh +46 -0
  78. package/release/scripts/ci/check-release-policy-schema.sh +59 -0
  79. package/release/scripts/ci/check-release-policy.sh +123 -0
  80. package/release/scripts/ci/pin-train.sh +29 -0
  81. package/release/scripts/ci/release-train.sh +39 -0
  82. package/release/scripts/ci/validate-json-schema.mjs +17 -0
  83. package/release/scripts/lib/docs.sh +71 -0
  84. package/release/scripts/lib/facts.sh +146 -0
  85. package/release/scripts/lib/release-plan.sh +128 -0
  86. package/release/scripts/lib/release-pr.sh +106 -0
  87. package/release/scripts/lib/release-stages.sh +903 -0
  88. package/release/scripts/release/advance-release.sh +86 -0
  89. package/release/scripts/release/cut-release.sh +313 -0
  90. package/release/scripts/release/dispatch-publish.sh +34 -0
  91. package/release/scripts/release/ensure-stage-deploys.sh +56 -0
  92. package/release/scripts/release/finalize-release.sh +351 -0
  93. package/release/scripts/release/merge-release-pr.sh +233 -0
  94. package/release/scripts/release/open-release-line.sh +22 -0
  95. package/release/scripts/release/plan.sh +45 -0
  96. package/release/scripts/release/snapshot.sh +57 -0
  97. package/release/scripts/release/verify-production.sh +63 -0
  98. package/transform.mjs +64 -0
  99. package/verify/.github/workflows/verify-production.yml +71 -0
  100. package/verify/scripts/release/verify-ops.sh +41 -0
@@ -0,0 +1,64 @@
1
+ name: pr-message
2
+
3
+ # Squash-merge makes the PR title the commit subject and the PR body the commit body
4
+ # (squash_merge_commit_title: PR_TITLE, squash_merge_commit_message: PR_BODY), so both get the same
5
+ # rules as a local commit on main, from the same scripts the hooks call (docs/git-flow.md, 進入 main).
6
+ #
7
+ # A separate workflow because it also runs on "edited": fixing the title or body re-runs only this
8
+ # cheap check. Putting "edited" on ci.yml would either rebuild for a text change or record skipped
9
+ # static/build-test checks, and gh pr checks keeps only the newest check per name, workflow and event,
10
+ # so a skipped one would hide an earlier failure from the merge gate (merge_pr_when_green).
11
+ on:
12
+ pull_request:
13
+ types: [opened, synchronize, reopened, edited]
14
+
15
+ permissions:
16
+ contents: read
17
+ pull-requests: read
18
+
19
+ defaults:
20
+ run:
21
+ shell: bash
22
+
23
+ concurrency:
24
+ group: pr-message-${{ github.ref }}
25
+ cancel-in-progress: true
26
+
27
+ env:
28
+ # a loop of a template script asks twice at most and the CI gate asks twice (decision self-hosted-job-no-wait)
29
+ POLL_TRIES: "2"
30
+ CI_GATE_TRIES: "2"
31
+ CI_GATE_QUEUE_TRIES: "0"
32
+
33
+ jobs:
34
+ # release-please opens its PRs with GITHUB_TOKEN; GitHub does not run workflows for them, so they
35
+ # would sit as "Action required". Their title and body are generated, so skip them explicitly.
36
+ pr-title:
37
+ if: ${{ !startsWith(github.head_ref, 'release-please--') }}
38
+ runs-on: self-hosted-linux
39
+ timeout-minutes: 5
40
+ steps:
41
+ - uses: actions/checkout@v7
42
+ with:
43
+ fetch-depth: 0
44
+ persist-credentials: false
45
+ - uses: ./.github/actions/setup-workspace
46
+ with:
47
+ node: "false"
48
+ - name: PR title follows Conventional Commits (squash-merge makes it the releasable unit)
49
+ run: bash scripts/ci/check-pr-title.sh "$PR_TITLE"
50
+ env:
51
+ PR_TITLE: ${{ github.event.pull_request.title }}
52
+ # 內文即時讀取而不取事件內容:手動重跑這個 job 時,檢查的也是目前的內文。
53
+ # release PR 本來就帶著整班的單元,只查 AI 署名。
54
+ - name: PR body has no AI attribution, and a cross-unit change declares Coupled-Change
55
+ env:
56
+ GH_TOKEN: ${{ github.token }}
57
+ PR_NUMBER: ${{ github.event.pull_request.number }}
58
+ BASE_REF: ${{ github.base_ref }}
59
+ HEAD_REF: ${{ github.head_ref }}
60
+ run: |
61
+ only=()
62
+ if [[ "$HEAD_REF" == release/* ]]; then only=(--only attribution); fi
63
+ gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json body --jq .body \
64
+ | bash scripts/ci/check-commit-body.sh "${only[@]}" --message - --diff "origin/$BASE_REF...HEAD"
@@ -0,0 +1,356 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ lerna-debug.log*
8
+
9
+ # Diagnostic reports (https://nodejs.org/api/report.html)
10
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11
+
12
+ # Runtime data
13
+ pids
14
+ *.pid
15
+ *.seed
16
+ *.pid.lock
17
+
18
+ # Directory for instrumented libs generated by jscoverage/JSCover
19
+ lib-cov
20
+
21
+ # Coverage directory used by tools like istanbul
22
+ coverage
23
+ *.lcov
24
+
25
+ # nyc test coverage
26
+ .nyc_output
27
+
28
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29
+ .grunt
30
+
31
+ # Bower dependency directory (https://bower.io/)
32
+ bower_components
33
+
34
+ # node-waf configuration
35
+ .lock-wscript
36
+
37
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
38
+ build/Release
39
+
40
+ # Dependency directories
41
+ node_modules/
42
+ jspm_packages/
43
+
44
+ # Snowpack dependency directory (https://snowpack.dev/)
45
+ web_modules/
46
+
47
+ # TypeScript cache
48
+ *.tsbuildinfo
49
+
50
+ # Optional npm cache directory
51
+ .npm
52
+
53
+ # Optional eslint cache
54
+ .eslintcache
55
+
56
+ # Optional stylelint cache
57
+ .stylelintcache
58
+
59
+ # Optional REPL history
60
+ .node_repl_history
61
+
62
+ # Output of 'npm pack'
63
+ *.tgz
64
+
65
+ # Yarn Integrity file
66
+ .yarn-integrity
67
+
68
+ # dotenv environment variable files
69
+ .env
70
+ .env.*
71
+ !.env.example
72
+
73
+ # parcel-bundler cache (https://parceljs.org/)
74
+ .cache
75
+ .parcel-cache
76
+
77
+ # Next.js build output
78
+ .next
79
+ out
80
+
81
+ # Nuxt.js build / generate output
82
+ .nuxt
83
+ dist
84
+ .output
85
+
86
+ # Gatsby files
87
+ .cache/
88
+ # Comment in the public line in if your project uses Gatsby and not Next.js
89
+ # https://nextjs.org/blog/next-9-1#public-directory-support
90
+ # public
91
+
92
+ # vuepress build output
93
+ .vuepress/dist
94
+
95
+ # vuepress v2.x temp directory
96
+ .temp
97
+
98
+ # Sveltekit cache directory
99
+ .svelte-kit/
100
+
101
+ # vitepress build output
102
+ **/.vitepress/dist
103
+
104
+ # vitepress cache directory
105
+ **/.vitepress/cache
106
+
107
+ # Docusaurus cache and generated files
108
+ .docusaurus
109
+
110
+ # Serverless directories
111
+ .serverless/
112
+
113
+ # FuseBox cache
114
+ .fusebox/
115
+
116
+ # DynamoDB Local files
117
+ .dynamodb/
118
+
119
+ # Firebase cache directory
120
+ .firebase/
121
+
122
+ # TernJS port file
123
+ .tern-port
124
+
125
+ # Stores VSCode versions used for testing VSCode extensions
126
+ .vscode-test
127
+
128
+ # pnpm
129
+ .pnpm-store
130
+
131
+ # yarn v3
132
+ .pnp.*
133
+ .yarn/*
134
+ !.yarn/patches
135
+ !.yarn/plugins
136
+ !.yarn/releases
137
+ !.yarn/sdks
138
+ !.yarn/versions
139
+
140
+ # Vite files
141
+ vite.config.js.timestamp-*
142
+ vite.config.ts.timestamp-*
143
+ .vite/
144
+
145
+ # 專案暫存(主脈絡、部署記錄、稽核)
146
+ tmp/
147
+
148
+ # ---------------------------------------------------------------------------
149
+ # 以下各段照出處原樣複製。github/gitignore 的範本取自 commit 41862c835a7bd7e03373f1dbe1d2350f47063b71。
150
+ # 沒收 Global/Vim.gitignore 與 Global/Emacs.gitignore:它們的 [._]*.s[a-v][a-z]、tags、dist/、/server/
151
+ # 會擋到一般的原始碼檔名,例如 _index.scss。
152
+
153
+ # 作業系統:macOS(github/gitignore Global/macOS.gitignore,全部規則)
154
+ .DS_Store
155
+ .localized
156
+ __MACOSX/
157
+ .AppleDouble
158
+ .LSOverride
159
+ Icon[
160
+ ._*
161
+ .DocumentRevisions-V100
162
+ .fseventsd
163
+ .Spotlight-V100
164
+ .TemporaryItems
165
+ .Trashes
166
+ .VolumeIcon.icns
167
+ .com.apple.timemachine.donotpresent
168
+ .com.apple.timemachine.supported
169
+ .PKInstallSandboxManager
170
+ .PKInstallSandboxManager-SystemSoftware
171
+ .hotfiles.btree
172
+ .vol
173
+ .file
174
+ .disk_label*
175
+ lost+found
176
+ .HFS+ Private Directory Data[
177
+ .AppleDB
178
+ .AppleDesktop
179
+ Network Trash Folder
180
+ Temporary Items
181
+ .apdisk
182
+ Desktop DB
183
+ Desktop DF
184
+ TheFindByContentFolder
185
+ TheVolumeSettingsFolder
186
+ .FBCIndex
187
+ .FBCSemaphoreFile
188
+ .FBCLockFolder
189
+ .quota.group
190
+ .quota.user
191
+ .quota.ops.group
192
+ .quota.ops.user
193
+ Backups.backupdb
194
+ .MobileBackups
195
+ .MobileBackups.trash
196
+ MobileBackups.trash
197
+ tmbootpicker.efi
198
+
199
+ # 作業系統:Windows(github/gitignore Global/Windows.gitignore,全部規則)
200
+ Thumbs.db
201
+ Thumbs.db:encryptable
202
+ ehthumbs.db
203
+ ehthumbs_vista.db
204
+ *.stackdump
205
+ [Dd]esktop.ini
206
+ $RECYCLE.BIN/
207
+ *.cab
208
+ *.msi
209
+ *.msix
210
+ *.msm
211
+ *.msp
212
+ *.lnk
213
+
214
+ # 作業系統:Linux(github/gitignore Global/Linux.gitignore,全部規則)
215
+ *~
216
+ .fuse_hidden*
217
+ .directory
218
+ .Trash-*
219
+ .nfs*
220
+ nohup.out
221
+
222
+ # 編輯器:VS Code(github/gitignore Global/VisualStudioCode.gitignore,全部規則)
223
+ .vscode/*
224
+ !.vscode/settings.json
225
+ !.vscode/tasks.json
226
+ !.vscode/launch.json
227
+ !.vscode/extensions.json
228
+ !.vscode/*.code-snippets
229
+ !*.code-workspace
230
+ *.vsix
231
+
232
+ # 編輯器:JetBrains(github/gitignore Global/JetBrains.gitignore,全部規則)
233
+ .idea/**/workspace.xml
234
+ .idea/**/tasks.xml
235
+ .idea/**/usage.statistics.xml
236
+ .idea/**/dictionaries
237
+ .idea/**/shelf
238
+ .idea/**/aws.xml
239
+ .idea/**/contentModel.xml
240
+ .idea/**/dataSources/
241
+ .idea/**/dataSources.ids
242
+ .idea/**/dataSources.local.xml
243
+ .idea/**/sqlDataSources.xml
244
+ .idea/**/dynamic.xml
245
+ .idea/**/uiDesigner.xml
246
+ .idea/**/dbnavigator.xml
247
+ .idea/**/gradle.xml
248
+ .idea/**/libraries
249
+ cmake-build-*/
250
+ .idea/**/mongoSettings.xml
251
+ *.iws
252
+ out/
253
+ .idea_modules/
254
+ atlassian-ide-plugin.xml
255
+ .idea/replstate.xml
256
+ .idea/sonarlint/
257
+ .idea/sonarlint.xml
258
+ com_crashlytics_export_strings.xml
259
+ crashlytics.properties
260
+ crashlytics-build.properties
261
+ fabric.properties
262
+ .idea/httpRequests
263
+ http-client.private.env.json
264
+ .idea/caches/build_file_checksums.ser
265
+ .idea/.cache/.Apifox_Helper
266
+ .idea/ApifoxUploaderProjectSetting.xml
267
+ .idea/**/copilot.data.migration.*.xml
268
+ .idea/kubernetes/configs/kubeconfig_*
269
+
270
+ # Go(github/gitignore Go.gitignore)
271
+ # 略去 .env:Node 段已有。
272
+ *.exe
273
+ *.exe~
274
+ *.dll
275
+ *.so
276
+ *.dylib
277
+ *.test
278
+ *.out
279
+ coverage.html
280
+ coverage.txt
281
+ coverage.xml
282
+ *.coverprofile
283
+ profile.cov
284
+ go.work
285
+ go.work.sum
286
+
287
+ # Swift 與 Xcode(github/gitignore Swift.gitignore 全部規則;.swiftpm/ 出自 notchhub 與 fact-kit 的 .gitignore)
288
+ xcuserdata/
289
+ *.hmap
290
+ *.ipa
291
+ *.dSYM.zip
292
+ *.dSYM
293
+ timeline.xctimeline
294
+ playground.xcworkspace
295
+ .build/
296
+ Carthage/Build/
297
+ fastlane/report.xml
298
+ fastlane/Preview.html
299
+ fastlane/screenshots/**/*.png
300
+ fastlane/test_output
301
+ .swiftpm/
302
+
303
+ # Rust(github/gitignore Rust.gitignore)
304
+ # 略去 debug:它會忽略任何名為 debug 的檔或目錄,cargo 的輸出已在 target 底下。
305
+ target
306
+ **/*.rs.bk
307
+ *.pdb
308
+ **/mutants.out*/
309
+ rustc-ice-*.txt
310
+
311
+ # Python(github/gitignore Python.gitignore 中 pip、venv、pytest、coverage、tox、nox、pdm、型別檢查與 ruff 的規則)
312
+ # 略去 build/、dist/、lib/、lib64/、parts/、var/、wheels/、eggs/、downloads/、sdist/、env/ 這類通用目錄名,因為會擋到 scripts/lib 這類原始碼目錄。
313
+ # 略去 Django、Flask、Scrapy、Celery、Jupyter、Sphinx、PyInstaller 等示範倉沒用到的工具的規則。*.so、coverage.xml、.env、*.log 已在前面的段落。
314
+ __pycache__/
315
+ *.py[codz]
316
+ *$py.class
317
+ .Python
318
+ .eggs/
319
+ *.egg-info/
320
+ .installed.cfg
321
+ *.egg
322
+ pip-log.txt
323
+ pip-delete-this-directory.txt
324
+ htmlcov/
325
+ .tox/
326
+ .nox/
327
+ .coverage
328
+ .coverage.*
329
+ nosetests.xml
330
+ *.cover
331
+ *.py.cover
332
+ .hypothesis/
333
+ .pytest_cache/
334
+ __pypackages__/
335
+ .pdm-python
336
+ .pdm-build/
337
+ .envrc
338
+ .venv
339
+ venv/
340
+ .mypy_cache/
341
+ .dmypy.json
342
+ dmypy.json
343
+ .pyre/
344
+ .pytype/
345
+ .ruff_cache/
346
+ .pypirc
347
+
348
+ # wrangler 與 Cloudflare Workers(agent-telemetry 的 .gitignore)
349
+ .wrangler/
350
+ .dev.vars
351
+ .dev.vars.*
352
+ !.dev.vars.example
353
+
354
+ # pnpm 除錯紀錄
355
+ .pnpm-debug.log*
356
+ pnpm-debug.log*
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "plugins": ["typescript", "import", "unicorn", "oxc"],
4
+ "categories": {
5
+ "correctness": "error",
6
+ "suspicious": "error",
7
+ "perf": "warn",
8
+ "style": "off",
9
+ "pedantic": "off",
10
+ "restriction": "off",
11
+ "nursery": "off"
12
+ },
13
+ "ignorePatterns": ["**/dist/**", "**/node_modules/**", "tmp/**", "ops/**", "examples/**"]
14
+ }
package/base/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 @@licenseHolder@@
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # 發布規劃 v{X.Y.Z}
2
+
3
+ - 類型:milestone
4
+ - 狀態:draft
5
+ - 產品版號:`v{X.Y.Z}`(本文件是產品版號的唯一指派點,Issue 的版號 label 由此回填,label 名稱依設定 `workitem`)
6
+ - Milestone:{Milestone 名稱}
7
+ - 發布分支:`{發布分支名}`(預設 `release/v{X.Y}`)
8
+ - 這次發布的單元:{單元清單}
9
+ - 階段路徑:發布線的起始階段與各單元的階段由政策檔 `release-policy.json` 決定,沒有單元走的階段會自動跳過,不在本文件另訂
10
+
11
+ ## 含哪些工作
12
+
13
+ | Issue | 單元 | 狀態 |
14
+ | :--- | :--- | :--- |
15
+ | #{N} {標題} | {單元} | {狀態} |
16
+
17
+ ## 各單元版號
18
+
19
+ GA 當下由工具產出後貼入,不手抄。
20
+
21
+ | 單元 | 實作版號 | tag |
22
+ | :--- | :--- | :--- |
23
+ | product | {X.Y.Z} | v{X.Y.Z} |
24
+
25
+ ## 破壞性變更
26
+
27
+ {沒有就寫「無」,並說明為什麼沒有。}
28
+
29
+ ## 怎麼退
30
+
31
+ - 可回退:{例如以前一個產品 tag 重新部署}
32
+ - 不可回退:{例如已推送的 tag、已送審的行動端版本},補救走上線後修補
33
+
34
+ ## 變更過程
35
+
36
+ - {X.Y.Z}-{單元的第一個階段}.1:切發布分支(#{N})
37
+ - {X.Y.Z}-{單元的第一個階段}.{N}:#{N} 的修補
38
+ - {X.Y.Z}-{下一個階段}.1:推進到 {下一個階段}
39
+ - {X.Y.Z}:GA
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env bash
2
+ # Print the git ref that a pull request should be compared against, or nothing for a full run.
3
+ #
4
+ # On a pull request the base branch is the comparison point; run-affected.sh turns it into pnpm's
5
+ # "...[<ref>]" filter (packages changed since <ref> plus every package depending on one of them), so
6
+ # a change in libs/product-shared-utils still exercises web and api. Any other event (push to main or to a
7
+ # train) prints nothing and runs the full set: those are the points where release-please reads
8
+ # history, and the whole tree must be known good there.
9
+ #
10
+ # usage: since="$(scripts/ci/affected.sh)" (env: GITHUB_EVENT_NAME, GITHUB_BASE_REF from Actions)
11
+ set -euo pipefail
12
+ if [[ "${GITHUB_EVENT_NAME:-}" != "pull_request" || -z "${GITHUB_BASE_REF:-}" ]]; then exit 0; fi
13
+ base="origin/${GITHUB_BASE_REF}"
14
+ git rev-parse -q --verify "$base" >/dev/null || { printf '%s\n' >&2 "affected: $base 不存在,改跑全量(checkout 需 fetch-depth: 0)"; exit 0; }
15
+ printf '%s\n' "$base"
@@ -0,0 +1,68 @@
1
+ # AI-platform attribution list for check-commit-body.sh. A message line is AI attribution when it starts
2
+ # (after any list marker or emoji) with Co-authored-by:, Assisted-by:, Generated-by:, Made-with:,
3
+ # "Generated with" or "Made with", and it names an entry below. Co-authors that match no entry are humans
4
+ # and pass.
5
+ #
6
+ # Format: one entry per line, "<kind> <value>", compared case-insensitively.
7
+ # name matched as whole words anywhere in the line, so "Claude" also covers "Claude Sonnet 5"; a
8
+ # value may hold several words ("amazon q")
9
+ # email matched as a substring of the line
10
+ # Every entry carries a source comment. "未查證" means no official source was found; the entry stays
11
+ # because the platform is in the required list, and should be confirmed or dropped when one turns up.
12
+ # Known false positive: a human co-author whose name contains a listed word (for example a person named
13
+ # Claude) is blocked too. Credit that person in the message text instead of a Co-authored-by trailer.
14
+
15
+ # Claude Code: default commit trailer "Co-Authored-By: <model name> <noreply@anthropic.com>", the name
16
+ # being "Claude", "Claude <model>" or "Claude Code"; default PR line
17
+ # "🤖 Generated with [Claude Code](https://claude.com/claude-code)".
18
+ # 出處:https://code.claude.com/docs/en/settings-reference.md(attribution.commit、attribution.pr,2026-10-01 讀取)
19
+ name claude
20
+ email noreply@anthropic.com
21
+ # Anthropic as a name, for trailers that spell the vendor instead of the product. 未查證
22
+ name anthropic
23
+
24
+ # GitHub Copilot in VS Code (git.addAICoAuthor): "Co-authored-by: Copilot <copilot@github.com>".
25
+ # 出處:https://github.com/microsoft/vscode/blob/main/extensions/git/src/repository.ts(AI_CO_AUTHOR_TRAILER,2026-10-01 讀取)
26
+ name copilot
27
+ email copilot@github.com
28
+
29
+ # Cursor: Agent adds a "Made with Cursor" trailer to commits and to PRs opened with gh pr create.
30
+ # 出處:https://cursor.com/docs/integrations/git(How does Agent attribution work?,2026-10-01 讀取)
31
+ name cursor
32
+ # Cursor cloud agents commit as "Cursor Agent <cursoragent@cursor.com>" and add Co-authored-by. Only
33
+ # seen in user reports on forum.cursor.com, not in Cursor's docs. 未查證
34
+ email cursoragent@cursor.com
35
+
36
+ # OpenAI Codex: commit trailer "Co-authored-by: Codex <noreply@openai.com>".
37
+ # 出處:https://github.com/openai/codex/blob/main/codex-rs/ext/git-attribution/src/world_state.rs(2026-10-01 讀取)
38
+ name codex
39
+ email noreply@openai.com
40
+ # OpenAI as a name, for trailers that spell the vendor instead of the product. 未查證
41
+ name openai
42
+
43
+ # Google Gemini (Gemini CLI, Gemini Code Assist): no attribution trailer found in the gemini-cli source
44
+ # or Google's docs. 未查證
45
+ name gemini
46
+
47
+ # Aider: --attribute-co-authored-by adds "Co-authored-by: aider (<model>) <aider@aider.chat>".
48
+ # 出處:https://aider.chat/docs/git.html 與 https://github.com/Aider-AI/aider/blob/main/aider/repo.py(2026-10-01 讀取)
49
+ name aider
50
+ email aider@aider.chat
51
+
52
+ # Devin: the "Git commit attribution" setting has a "Co-authored (Devin + you)" mode. The docs do not
53
+ # give the exact trailer text or e-mail, so only the name is listed.
54
+ # 出處:https://docs.devin.ai/integrations/gh(GPG signing 一節的 Commit authoring 模式,2026-10-01 讀取)
55
+ name devin
56
+
57
+ # Windsurf (Cascade): no commit or PR attribution found in docs.windsurf.com. 未查證
58
+ name windsurf
59
+
60
+ # Amazon Q Developer: no commit or PR attribution found in AWS docs or the amazon-q-developer-cli
61
+ # source. 未查證
62
+ name amazon q
63
+
64
+ # Amp: commits made by the agent carry "Co-authored-by: Amp <amp@ampcode.com>" (and an Amp-Thread-ID:
65
+ # trailer, which names no co-author and is not checked here).
66
+ # 出處:https://ampcode.com/docs/github(2026-10-01 讀取)
67
+ name amp
68
+ email amp@ampcode.com
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env bash
2
+ # Body checks for a message entering main (docs/git-flow.md, commit 與 PR 訊息格式). Two rules:
3
+ # attribution no AI-platform attribution: a line starting with Co-authored-by:, Assisted-by:,
4
+ # Generated-by:, Made-with:, "Generated with" or "Made with" (list markers and emoji before
5
+ # it allowed) that names an entry of ai-attribution-list.txt. Human co-authors pass.
6
+ # units a change touching two or more release units (the packages paths in
7
+ # release-please-config.json) declares "Coupled-Change: <why>" in the message's last
8
+ # paragraph. A repository without that file has no units and skips this rule.
9
+ # The single source of both rules for the commit-msg and pre-push hooks, ci.yml's PR check and nightly.
10
+ #
11
+ # usage: check-commit-body.sh [--only attribution|units] --commit <sha>
12
+ # check-commit-body.sh [--only attribution|units] --message <file|-> [--cached | --diff <rev-range>]
13
+ # --commit <sha> message and changed files both from the commit
14
+ # --message message from a file, or - for stdin; changed files from the index (--cached) or a
15
+ # diff (--diff origin/main...HEAD). Without either, the units rule is skipped.
16
+ # Exit 1 on a violation, each one reported on stderr.
17
+ set -euo pipefail
18
+ here="$(cd "$(dirname "$0")" && pwd)"
19
+ source "$(dirname "$0")/../lib/common.sh"
20
+ usage() { die "usage: check-commit-body.sh [--only attribution|units] (--commit <sha> | --message <file|-> [--cached | --diff <rev-range>])"; }
21
+
22
+ only="" commit="" msg_src="" files_from=""
23
+ while [[ $# -gt 0 ]]; do
24
+ case "$1" in
25
+ --only) only="${2:-}"; [[ "$only" == attribution || "$only" == units ]] || usage; shift 2 ;;
26
+ --commit) commit="${2:?}"; files_from=commit; shift 2 ;;
27
+ --message) msg_src="${2:?}"; shift 2 ;;
28
+ --cached) files_from=cached; shift ;;
29
+ --diff) files_from="diff"; diff_range="${2:?}"; shift 2 ;;
30
+ *) usage ;;
31
+ esac
32
+ done
33
+ [[ -n "$commit" || -n "$msg_src" ]] || usage
34
+
35
+ # Read the message before changing directory: a hook gets a path relative to where git started it.
36
+ if [[ -n "$commit" ]]; then message="$(git log -1 --format=%B "$commit")"
37
+ elif [[ "$msg_src" == - ]]; then message="$(cat)"
38
+ else message="$(cat "$msg_src")"; fi
39
+ cd "$REPO_ROOT"
40
+ # A PR body arrives with CRLF line ends. Under commit.cleanup scissors, git drops everything from its
41
+ # scissors line on, so only the part above it becomes the commit message.
42
+ message="${message//$'\r'/}"
43
+ message="$(sed -E '/^[#;] -+ >8 -+$/,$d' <<<"$message")"
44
+
45
+ bad=0
46
+
47
+ check_attribution() {
48
+ local list="$here/ai-attribution-list.txt" kind value line l words n=0 hit
49
+ local -a names=() emails=()
50
+ while read -r kind value; do
51
+ case "$kind" in name) names+=("${value,,}") ;; email) emails+=("${value,,}") ;; esac
52
+ done < <(grep -vE '^[[:space:]]*(#|$)' "$list")
53
+ while IFS= read -r line; do
54
+ n=$((n + 1))
55
+ # Only a line that starts with an attribution form counts, after any leading list marker, emoji or
56
+ # other non-alphanumeric characters ("- Co-authored-by:", "🤖 Generated with"). Prose that merely
57
+ # contains "generated with" or "made with" mid-sentence is not attribution.
58
+ l="${line,,}"; l="${l#"${l%%[[:alnum:]]*}"}"
59
+ [[ "$l" =~ ^(co-authored-by|assisted-by|generated-by|made-with):|^(generated|made)\ with\ ]] || continue
60
+ # whole-word match for names: every non-alphanumeric character becomes a space
61
+ words=" ${l//[^[:alnum:]]/ } " hit=""
62
+ for value in "${names[@]}"; do [[ "$words" == *" $value "* ]] && { hit="$value"; break; }; done
63
+ if [[ -z "$hit" ]]; then
64
+ for value in "${emails[@]}"; do [[ "$l" == *"$value"* ]] && { hit="$value"; break; }; done
65
+ fi
66
+ [[ -n "$hit" ]] || continue
67
+ printf '%s\n' >&2 "✗ 第 $n 行是 AI 平台署名(名單項目 ${hit}):$line" \
68
+ " commit 與 PR 不加 AI 平台署名,刪掉這一行。人類 co-author 照留。"
69
+ bad=1
70
+ done <<<"$message"
71
+ }
72
+
73
+ # The release unit of a file is the longest packages path it sits under; "." would match every file, so
74
+ # it only takes files no other path claims.
75
+ check_units() {
76
+ [[ -f "$CONFIG" && -n "$files_from" ]] || return 0
77
+ local -a paths=() files=()
78
+ local f p best
79
+ mapfile -t paths < <(jq -r '.packages | keys[]' "$CONFIG")
80
+ case "$files_from" in
81
+ commit) mapfile -t files < <(git diff-tree --root --no-commit-id --name-only -r "$commit") ;;
82
+ cached) mapfile -t files < <(git diff --cached --name-only) ;;
83
+ diff) mapfile -t files < <(git diff --name-only "$diff_range") ;;
84
+ esac
85
+ declare -A units=()
86
+ for f in "${files[@]}"; do
87
+ [[ -n "$f" ]] || continue
88
+ best=""
89
+ for p in "${paths[@]}"; do
90
+ p="${p%/}"
91
+ if [[ "$p" == . || "$f" == "$p" || "$f" == "$p"/* ]] && (( ${#p} > ${#best} )); then best="$p"; fi
92
+ done
93
+ [[ -n "$best" ]] && units["$best"]=1
94
+ done
95
+ (( ${#units[@]} > 1 )) || return 0
96
+ # the last paragraph after trailing blank lines and git's own "#" help lines are dropped
97
+ if awk 'NF && !/^#/ { last = NR } { line[NR] = $0 }
98
+ END { s = last; while (s > 1 && line[s - 1] ~ /[^[:space:]]/) s--; for (i = s; i <= last; i++) print line[i] }' \
99
+ <<<"$message" | grep -qiE '^Coupled-Change:[[:space:]]*[^[:space:]]'; then
100
+ return 0
101
+ fi
102
+ printf '%s\n' >&2 "✗ 這個變更改到 ${#units[@]} 個單元($(printf '%s\n' "${!units[@]}" | sort | paste -sd, - | sed 's/,/、/g')),訊息最後一段沒有 Coupled-Change:" \
103
+ " 本質上必須一起合時,在最後一段加 Coupled-Change: <為什麼必須一起合>;否則照 Parallel Change 拆成每個單元各一個 commit(docs/git-flow.md 的「PR 怎麼切」)。"
104
+ bad=1
105
+ }
106
+
107
+ [[ "$only" == units ]] || check_attribution
108
+ [[ "$only" == attribution ]] || check_units
109
+ (( bad == 0 )) && printf '%s\n' "✓ 訊息內文符合規則${only:+(只查 ${only})}"
110
+ exit "$bad"