@jetthai/cuora 1.1.425-dev.4 → 1.1.425
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.
- package/AI_PROMPT_SOURCE.md +35 -415
- package/CHANGELOG.md +1 -101
- package/README.md +2 -36
- package/package.json +1 -3
- package/src/api/activity.js +0 -6
- package/src/machine/auth.js +0 -22
- package/src/machine/deposit/crypto_bank_cash.js +2 -8
- package/src/machine/leaderboard.js +11 -8
- package/.claude/commands/auto-git-flow.md +0 -45
- package/.claude/commands/commit-push.md +0 -129
- package/.claude/commands/sync-ai-prompts.md +0 -180
- package/.claude/settings.local.json +0 -25
- package/.husky/post-checkout +0 -28
- package/.husky/pre-push +0 -5
- package/scripts/auto-version.js +0 -66
- package/scripts/auto-version.sh +0 -29
- package/scripts/branch-auto-npm-publish.js +0 -27
- package/scripts/clean-tags.sh +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -2,111 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [1.1.425-dev.4](https://github.com/jetthai/cuora-module/compare/v1.1.425-dev.3...v1.1.425-dev.4) (2026-03-31)
|
|
6
|
-
|
|
7
|
-
### [1.1.425-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.425...v1.1.425-dev.3) (2026-03-31)
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
- **scripts:** auto pull --rebase before push in branch-auto-npm-publish ([761f5c8](https://github.com/jetthai/cuora-module/commit/761f5c8ac653d0a1578cbc610b7c9b1798066875))
|
|
12
|
-
- **scripts:** extend clean-tags to delete orphan and master-merged tags ([f24bc33](https://github.com/jetthai/cuora-module/commit/f24bc3337bcf558e67e613818ba5a79983675a26))
|
|
13
|
-
|
|
14
|
-
### Bug Fixes
|
|
15
|
-
|
|
16
|
-
- **scripts:** add --no-verify to git push in branch-auto-npm-publish to prevent pre-push hook infinite recursion ([4214aee](https://github.com/jetthai/cuora-module/commit/4214aeeed05834bce2537acd6ef816719c388b64))
|
|
17
|
-
- **scripts:** prevent infinite recursion in clean-tags pre-push hook ([5e9db84](https://github.com/jetthai/cuora-module/commit/5e9db84f1a655318b73839ab9a215f4dbe980772))
|
|
18
|
-
|
|
19
|
-
### [1.1.425-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.425-dev.1...v1.1.425-dev.2) (2026-03-31)
|
|
20
|
-
|
|
21
|
-
### [1.1.425-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.425-dev.0...v1.1.425-dev.1) (2026-03-30)
|
|
22
|
-
|
|
23
|
-
### [1.1.425-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.425...v1.1.425-dev.0) (2026-03-30)
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
- **scripts:** auto pull --rebase before push in branch-auto-npm-publish ([761f5c8](https://github.com/jetthai/cuora-module/commit/761f5c8ac653d0a1578cbc610b7c9b1798066875))
|
|
28
|
-
- **scripts:** extend clean-tags to delete orphan and master-merged tags ([f24bc33](https://github.com/jetthai/cuora-module/commit/f24bc3337bcf558e67e613818ba5a79983675a26))
|
|
29
|
-
|
|
30
|
-
### Bug Fixes
|
|
31
|
-
|
|
32
|
-
- **scripts:** add --no-verify to git push in branch-auto-npm-publish to prevent pre-push hook infinite recursion ([4214aee](https://github.com/jetthai/cuora-module/commit/4214aeeed05834bce2537acd6ef816719c388b64))
|
|
33
|
-
- **scripts:** prevent infinite recursion in clean-tags pre-push hook ([5e9db84](https://github.com/jetthai/cuora-module/commit/5e9db84f1a655318b73839ab9a215f4dbe980772))
|
|
34
|
-
|
|
35
5
|
### [1.1.425](https://github.com/jetthai/cuora-module/compare/v1.1.424...v1.1.425) (2026-03-23)
|
|
36
6
|
|
|
37
7
|
### [1.1.424](https://github.com/jetthai/cuora-module/compare/v1.1.423...v1.1.424) (2026-03-17)
|
|
38
8
|
|
|
39
|
-
### [1.1.
|
|
40
|
-
|
|
41
|
-
### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
|
|
42
|
-
|
|
43
|
-
### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
|
|
44
|
-
|
|
45
|
-
### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
|
|
46
|
-
|
|
47
|
-
### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
|
|
48
|
-
|
|
49
|
-
### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
|
|
50
|
-
|
|
51
|
-
### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
|
|
52
|
-
|
|
53
|
-
### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
|
|
54
|
-
|
|
55
|
-
### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
|
|
56
|
-
|
|
57
|
-
### [1.1.422-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.422-dev-1...v1.1.422-dev-2) (2026-03-17)
|
|
58
|
-
|
|
59
|
-
### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
|
|
60
|
-
|
|
61
|
-
### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
|
|
62
|
-
|
|
63
|
-
### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
|
|
64
|
-
|
|
65
|
-
### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
|
|
66
|
-
|
|
67
|
-
### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
|
|
68
|
-
|
|
69
|
-
### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
|
|
70
|
-
|
|
71
|
-
### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
|
|
72
|
-
|
|
73
|
-
### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
|
|
74
|
-
|
|
75
|
-
### [1.1.422-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.422-dev-1...v1.1.422-dev-2) (2026-03-17)
|
|
76
|
-
|
|
77
|
-
### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
|
|
78
|
-
|
|
79
|
-
### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
|
|
80
|
-
|
|
81
|
-
### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
|
|
82
|
-
|
|
83
|
-
### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
|
|
84
|
-
|
|
85
|
-
### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
|
|
86
|
-
|
|
87
|
-
### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
|
|
88
|
-
|
|
89
|
-
### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
|
|
90
|
-
|
|
91
|
-
### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
|
|
92
|
-
|
|
93
|
-
### [1.1.422-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.422-dev-1...v1.1.422-dev-2) (2026-03-17)
|
|
94
|
-
|
|
95
|
-
### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
|
|
96
|
-
|
|
97
|
-
### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
|
|
98
|
-
|
|
99
|
-
### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
|
|
100
|
-
|
|
101
|
-
### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
|
|
102
|
-
|
|
103
|
-
### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
|
|
104
|
-
|
|
105
|
-
### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
|
|
106
|
-
|
|
107
|
-
### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
|
|
108
|
-
|
|
109
|
-
### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
|
|
9
|
+
### [1.1.423](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.423) (2026-03-17)
|
|
110
10
|
|
|
111
11
|
### [1.1.422](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.422) (2026-03-16)
|
|
112
12
|
|
package/README.md
CHANGED
|
@@ -167,45 +167,11 @@ src/
|
|
|
167
167
|
# 格式化程式碼(Prettier)
|
|
168
168
|
npm run format
|
|
169
169
|
|
|
170
|
-
#
|
|
170
|
+
# 發佈新版本(standard-version + git push + npm publish)
|
|
171
171
|
npm run release
|
|
172
172
|
|
|
173
|
-
#
|
|
173
|
+
# 發佈並標記為 latest
|
|
174
174
|
npm run release:latest
|
|
175
|
-
|
|
176
|
-
# dev/qa 分支:手動觸發版本發佈
|
|
177
|
-
npm run release:dev
|
|
178
|
-
npm run release:qa
|
|
179
175
|
```
|
|
180
176
|
|
|
181
177
|
程式碼風格由 Prettier 管理(無分號、單引號、尾隨逗號 ES5、2 空格縮排、150 字元行寬),Husky pre-commit hook 會在每次提交時自動格式化。
|
|
182
|
-
|
|
183
|
-
### dev / qa 分支版本發佈
|
|
184
|
-
|
|
185
|
-
在 `dev` 或 `qa` 分支執行 `git push` 時,Husky `pre-push` hook 會自動觸發三階段流程:
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
git push → auto-version.sh(流程控制)
|
|
189
|
-
├─ ① auto-version.js → 計算版號(含 historyMax 防倒退)
|
|
190
|
-
├─ ② standard-version → 更新 CHANGELOG + commit + tag
|
|
191
|
-
└─ ③ branch-auto-npm-publish.js → git push + npm publish
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**腳本權責:**
|
|
195
|
-
|
|
196
|
-
| 腳本 | 職責 | 說明 |
|
|
197
|
-
| ------------------------------------ | ---------- | --------------------------------------------------------- |
|
|
198
|
-
| `scripts/auto-version.sh` | 流程控制 | pre-push 入口,串接版號計算 → standard-version → 發佈 |
|
|
199
|
-
| `scripts/auto-version.js` | 版號計算 | 讀取 master 版本 + 掃描 git log 防倒退,stdout 輸出新版號 |
|
|
200
|
-
| `scripts/branch-auto-npm-publish.js` | 推送與發佈 | `git push --follow-tags` + `npm publish --tag {branch}` |
|
|
201
|
-
|
|
202
|
-
**版本號規則:**
|
|
203
|
-
|
|
204
|
-
| 情境 | 範例 |
|
|
205
|
-
| ------------------------------------ | ------------------------------------- |
|
|
206
|
-
| master 為 `1.1.425`,dev 第一次 push | `1.1.425-dev.0` |
|
|
207
|
-
| dev 再次 push | `1.1.425-dev.1`、`1.1.425-dev.2`、... |
|
|
208
|
-
| master 升版至 `1.1.426` 後 | dev 重置為 `1.1.426-dev.0` |
|
|
209
|
-
| qa 分支 | `1.1.425-qa.0`、`1.1.425-qa.1`、... |
|
|
210
|
-
|
|
211
|
-
> **注意**:`pre-push` hook 完成推送後會以 `exit 1` 中止原始 push(因為已推送完成),終端會顯示 push 失敗訊息,但實際發佈已成功。以 `Released x.x.x on {branch}` 訊息為準。
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetthai/cuora",
|
|
3
|
-
"version": "1.1.425
|
|
3
|
+
"version": "1.1.425",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"release": "standard-version && git push --follow-tags origin master && npm publish",
|
|
9
9
|
"release:latest": "standard-version && git push --follow-tags origin master && npm publish && npm dist-tag add @jetthai/cuora@$(node -p \"require('./package.json').version\") latest",
|
|
10
|
-
"release:dev": "node scripts/branch-auto-npm-publish.js",
|
|
11
|
-
"release:qa": "node scripts/branch-auto-npm-publish.js",
|
|
12
10
|
"format": "prettier --write .",
|
|
13
11
|
"prepare": "husky install"
|
|
14
12
|
},
|
package/src/api/activity.js
CHANGED
|
@@ -87,12 +87,6 @@ export default {
|
|
|
87
87
|
getVipTable: ({ appSecret }) => ({ url: 'activities/viptable', method: 'get', params: { appSecret } }),
|
|
88
88
|
getLevelBonusInfo: () => ({ url: 'activities/level-bonus/info', method: 'get' }),
|
|
89
89
|
getRankingList: () => ({ url: 'activities/ranking', method: 'get' }),
|
|
90
|
-
getPublicRankingList: ({ appSecret }) => ({
|
|
91
|
-
url: 'activities/ranking/public/promotion-ranking',
|
|
92
|
-
method: 'get',
|
|
93
|
-
isPublic: true,
|
|
94
|
-
params: { appSecret },
|
|
95
|
-
}),
|
|
96
90
|
exchangeDiamond: ({ activityNo, exchangeAward = [] }) => ({
|
|
97
91
|
url: 'activities/exchange/diamond',
|
|
98
92
|
method: 'post',
|
package/src/machine/auth.js
CHANGED
|
@@ -110,28 +110,6 @@ export default function (request) {
|
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
otpChecking: {
|
|
113
|
-
initial: 'pending',
|
|
114
|
-
states: {
|
|
115
|
-
pending: {
|
|
116
|
-
after: {
|
|
117
|
-
TIMEOUT: {
|
|
118
|
-
target: 'fetching',
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
fetching: {
|
|
123
|
-
invoke: {
|
|
124
|
-
src: 'fetchUserInfo',
|
|
125
|
-
onDone: {
|
|
126
|
-
target: 'pending',
|
|
127
|
-
actions: ['setUserInfo', 'extendToken'],
|
|
128
|
-
},
|
|
129
|
-
onError: {
|
|
130
|
-
target: 'pending',
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
113
|
on: {
|
|
136
114
|
OTP_VERIFIED: {
|
|
137
115
|
target: 'loginSuccess',
|
|
@@ -251,14 +251,8 @@ export default function (request, context) {
|
|
|
251
251
|
},
|
|
252
252
|
guards: {
|
|
253
253
|
isCalculable: (context, event) => {
|
|
254
|
-
const { selectedCrypto, selectedAddress, selectedAmount } = context
|
|
255
|
-
return
|
|
256
|
-
selectedCrypto &&
|
|
257
|
-
selectedAddress &&
|
|
258
|
-
selectedAmount &&
|
|
259
|
-
selectedCrypto.minimum <= +selectedAmount &&
|
|
260
|
-
+selectedAmount <= selectedCrypto.maximum
|
|
261
|
-
)
|
|
254
|
+
const { selectedCrypto, selectedAddress, cryptoBank, selectedAmount } = context
|
|
255
|
+
return selectedCrypto && selectedAddress && selectedAmount && cryptoBank.minimum <= +selectedAmount && +selectedAmount <= cryptoBank.maximum
|
|
262
256
|
},
|
|
263
257
|
isSubmittable: (context, event) => {
|
|
264
258
|
const { selectedCrypto, selectedAddress, selectedAmount, depositTime, receipt, calculation, siteConfig } = context
|
|
@@ -37,13 +37,12 @@ export default function (request) {
|
|
|
37
37
|
checking: {
|
|
38
38
|
always: [
|
|
39
39
|
{ target: 'idle', actions: 'setActivityDetail', cond: 'isExist' },
|
|
40
|
-
{ target: 'loading', cond: '
|
|
41
|
-
{ target: 'idle' },
|
|
40
|
+
{ target: 'loading', cond: 'hasActivityNo' },
|
|
42
41
|
],
|
|
43
42
|
},
|
|
44
43
|
loading: {
|
|
45
44
|
invoke: {
|
|
46
|
-
src: '
|
|
45
|
+
src: 'fetchPublicActivityDetail',
|
|
47
46
|
onDone: {
|
|
48
47
|
target: 'idle',
|
|
49
48
|
actions: ['setActivityMap', 'setActivityDetail'],
|
|
@@ -101,9 +100,8 @@ export default function (request) {
|
|
|
101
100
|
const { activityMap, activityNo } = context
|
|
102
101
|
return activityMap[activityNo]
|
|
103
102
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return !!context.activityNo && hasToken
|
|
103
|
+
hasActivityNo: (context, event) => {
|
|
104
|
+
return !!context.activityNo
|
|
107
105
|
},
|
|
108
106
|
},
|
|
109
107
|
services: {
|
|
@@ -118,10 +116,15 @@ export default function (request) {
|
|
|
118
116
|
const { data } = await request.send(hasToken ? api.getActivityList({ appSecret }) : api.getAllActivityList({ appSecret }))
|
|
119
117
|
return data
|
|
120
118
|
},
|
|
121
|
-
|
|
119
|
+
fetchPublicActivityDetail: async (context, event) => {
|
|
120
|
+
const hasToken = request.getToken()
|
|
122
121
|
const { activityNo } = context
|
|
123
122
|
let result = {}
|
|
124
|
-
|
|
123
|
+
if (hasToken) {
|
|
124
|
+
result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
|
|
125
|
+
} else {
|
|
126
|
+
result = await request.send(api.getTournamentDetail({ activityNo, appSecret }))
|
|
127
|
+
}
|
|
125
128
|
return result.data
|
|
126
129
|
},
|
|
127
130
|
},
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# Auto Git Flow
|
|
2
|
-
|
|
3
|
-
請依序執行每個步驟進行完整的清理流程,每步執行前先告知使用者當前進度。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Phase 1: 清理
|
|
8
|
-
|
|
9
|
-
### Step 1 — 刪除已合併到 master 的分支
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
git checkout master
|
|
13
|
-
git fetch --prune
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
刪除已合併的 remote 分支(排除 master/dev/qa/HEAD):
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
git branch -r --merged master | grep -v -E "(master|dev|qa|HEAD)" | sed 's/origin\///' | xargs -r -I {} git push origin --delete {}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
刪除已合併的 local 分支(排除 master/dev/qa):
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
git branch --merged master | grep -v -E "^\*?\s*(master|dev|qa)$" | xargs -r git branch -d
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
> ⚠️ 衝突處理:如果刪除分支時遇到任何錯誤,立即暫停所有動作,列出錯誤訊息,等待使用者確認後再繼續。
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Phase 2: 完成
|
|
33
|
-
|
|
34
|
-
### Step 2 — 回報結果
|
|
35
|
-
|
|
36
|
-
切回 master 分支,顯示完成摘要:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
git checkout master
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
回報以下資訊:
|
|
43
|
-
|
|
44
|
-
- 刪除了多少已合併分支
|
|
45
|
-
- 當前所在分支
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# Commit & Push
|
|
2
|
-
|
|
3
|
-
執行 git commit 和 push 流程,支援多種 commit message 生成方式。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Step 1 — 檢查工作區狀態
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
git status
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
如果沒有任何變更(工作區乾淨),告知使用者「沒有需要提交的變更」並停止。
|
|
14
|
-
|
|
15
|
-
如果有變更,顯示變更檔案清單給使用者確認。
|
|
16
|
-
|
|
17
|
-
出現錯誤則停止,詢問使用者要怎麼做。
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Step 2 — Stage 變更
|
|
22
|
-
|
|
23
|
-
將所有變更加入 staging area:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
git add -A
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
出現錯誤則停止,詢問使用者要怎麼做。
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Step 3 — 選擇 Commit Message 方式
|
|
34
|
-
|
|
35
|
-
使用 `AskUserQuestion` 工具顯示選單,讓使用者從以下選項中選擇:
|
|
36
|
-
|
|
37
|
-
- **自動生成** — AI 根據異動自動生成,直接使用
|
|
38
|
-
- **自動生成 + 修改** — AI 自動生成後,顯示給使用者確認或修改
|
|
39
|
-
- **手動輸入** — 完全由使用者手動輸入 commit message
|
|
40
|
-
|
|
41
|
-
使用者也可以選擇「Other」輸入自訂指示,AI 會根據指示和異動內容生成 commit message 並顯示給使用者確認。
|
|
42
|
-
|
|
43
|
-
等待使用者選擇。
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Step 4 — 生成 Commit Message
|
|
48
|
-
|
|
49
|
-
根據使用者在 Step 3 的選擇執行:
|
|
50
|
-
|
|
51
|
-
### 選項 1 或 2:自動生成
|
|
52
|
-
|
|
53
|
-
分析 `git diff --cached` 的內容,生成符合 Conventional Commits 格式的 commit message:
|
|
54
|
-
|
|
55
|
-
- 格式:`type(scope): description`
|
|
56
|
-
- type:feat / fix / refactor / style / docs / chore / perf / test
|
|
57
|
-
- scope:根據變更的主要目錄或功能模組決定(可省略)
|
|
58
|
-
- description:簡潔描述變更內容(英文)
|
|
59
|
-
|
|
60
|
-
如果是選項 2,將生成的 message 顯示給使用者,等待使用者確認或提供修改後的版本。
|
|
61
|
-
|
|
62
|
-
### 選項 3:手動輸入
|
|
63
|
-
|
|
64
|
-
等待使用者輸入完整的 commit message。
|
|
65
|
-
|
|
66
|
-
### 選項 4:其他
|
|
67
|
-
|
|
68
|
-
等待使用者輸入自訂指示,然後結合 `git diff --cached` 的異動內容,根據使用者的指示生成 commit message,顯示給使用者確認或修改。
|
|
69
|
-
|
|
70
|
-
出現錯誤則停止,詢問使用者要怎麼做。
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Step 5 — 執行 Commit
|
|
75
|
-
|
|
76
|
-
使用確定的 commit message 執行 commit:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
git commit -m "<commit_message>"
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
如果 commit message 包含多行,使用:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
git commit -m "<title>" -m "<body>"
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
出現錯誤則停止,詢問使用者要怎麼做。
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Step 6 — 確認是否 Push
|
|
93
|
-
|
|
94
|
-
使用 `AskUserQuestion` 工具顯示選單,讓使用者從以下選項中選擇:
|
|
95
|
-
|
|
96
|
-
- **Push** — 立即 push 到遠端
|
|
97
|
-
- **不 Push** — 只 commit,不 push
|
|
98
|
-
|
|
99
|
-
等待使用者選擇。
|
|
100
|
-
|
|
101
|
-
如果使用者選擇「不 Push」,跳過 push 直接進入 Step 8 完成回報。
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## Step 7 — 執行 Push
|
|
106
|
-
|
|
107
|
-
將 commit push 到遠端:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
git push
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
如果當前分支沒有設定 upstream,使用:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
git push --set-upstream origin <current_branch>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
出現錯誤則停止,詢問使用者要怎麼做。
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Step 8 — 完成回報
|
|
124
|
-
|
|
125
|
-
顯示以下資訊:
|
|
126
|
-
|
|
127
|
-
- 分支名稱
|
|
128
|
-
- Commit message 內容
|
|
129
|
-
- Push 結果(成功/失敗)
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
# Sync AI Prompts
|
|
2
|
-
|
|
3
|
-
將 `AI_PROMPT_SOURCE.md` 的內容同步到各 AI 工具的指令檔。
|
|
4
|
-
|
|
5
|
-
⚠️ 只修改 `AI_PROMPT_SOURCE.md` 作為唯一來源,其他檔案皆由此指令自動生成。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Step 0 — 分析專案並更新 AI_PROMPT_SOURCE.md
|
|
10
|
-
|
|
11
|
-
在同步之前,先掃描專案的實際狀態,確保 `AI_PROMPT_SOURCE.md` 中的數據與程式碼一致。
|
|
12
|
-
|
|
13
|
-
### Part A — 數據校準
|
|
14
|
-
|
|
15
|
-
驗證並更新文件中的統計數據,確保與程式碼一致:
|
|
16
|
-
|
|
17
|
-
1. **版本號**:讀取 `package.json` 的 `version` 欄位,更新文件中的版本號
|
|
18
|
-
2. **檔案數量統計**:
|
|
19
|
-
- `src/` 下的 `.js` 檔案總數
|
|
20
|
-
- `src/api/` 檔案數
|
|
21
|
-
- `src/machine/` 檔案總數(含子目錄),以及狀態機數量(= 總數 - index 檔案數)
|
|
22
|
-
- `src/machine/activity/`、`src/machine/deposit/`、`src/machine/withdraw/` 各自檔案數
|
|
23
|
-
- `src/util/` 檔案數
|
|
24
|
-
3. **API 函式數量**:對每個 `src/api/*.js` 模組,計算 `=>` 的出現次數以統計函式數
|
|
25
|
-
4. **行數驗證**:驗證以下檔案的實際行數:
|
|
26
|
-
- `src/request/request.js`、`src/request/config.js`
|
|
27
|
-
- 所有超過 300 行的狀態機檔案(用於「大型狀態機檔案」表格)
|
|
28
|
-
5. **supportVersion2List 端點數**:計算 `request.js` 中 `supportVersion2List` 陣列的實際項目數
|
|
29
|
-
6. **specifyingPath 映射數**:計算 `_convertUrlToKebabCase` 中 `specifyingPath` 的 key 數量
|
|
30
|
-
7. **關鍵行號參照**:驗證文件中引用的行號(如 `request.js:207`、`request.js:254` 等)是否仍然正確,若偏移則更新
|
|
31
|
-
8. **依賴套件版本**:讀取 `package.json` 的 `dependencies`,更新版本號
|
|
32
|
-
|
|
33
|
-
### Part B — Know-How 與架構驗證
|
|
34
|
-
|
|
35
|
-
檢查 `1.7 核心業務流程與關鍵 Know-How` 章節的內容是否仍然反映程式碼的實際行為:
|
|
36
|
-
|
|
37
|
-
1. **認證流程**:讀取 `src/machine/auth.js`,驗證:
|
|
38
|
-
|
|
39
|
-
- Token TTL、輪詢間隔、延展機制是否有變
|
|
40
|
-
- inline vs login 狀態判斷邏輯(`rank >= 0`)是否有變
|
|
41
|
-
- 登入方式是否有新增或移除(檢查全域 `on:` 事件列表)
|
|
42
|
-
- OTP 流程是否有調整
|
|
43
|
-
|
|
44
|
-
2. **存款流程**:抽樣讀取 2-3 個 deposit 狀態機,驗證:
|
|
45
|
-
|
|
46
|
-
- canonical 流程(loading → promotion → loaded → debouncing → calculating → submitting → submitted)是否有變
|
|
47
|
-
- Cash vs Non-Cash 變體的差異描述是否仍然正確
|
|
48
|
-
- 是否有新增的存款類型或支付方式
|
|
49
|
-
|
|
50
|
-
3. **提款流程**:讀取 `src/machine/withdraw/withdraw_manual.js`,驗證:
|
|
51
|
-
|
|
52
|
-
- 五步驟資格驗證鏈是否有調整
|
|
53
|
-
- OTP 平行狀態是否有變
|
|
54
|
-
|
|
55
|
-
4. **WebSocket**:讀取 `src/machine/websocket.js`,驗證:
|
|
56
|
-
|
|
57
|
-
- 連線參數、重連策略是否有變
|
|
58
|
-
- 事件轉發映射表是否有新增事件
|
|
59
|
-
|
|
60
|
-
5. **Error Machine**:讀取 `src/machine/error.js`,驗證:
|
|
61
|
-
|
|
62
|
-
- 錯誤代碼分類是否有新增
|
|
63
|
-
- 路由邏輯是否有調整
|
|
64
|
-
|
|
65
|
-
6. **Common Machine**:讀取 `src/machine/common.js`,驗證:
|
|
66
|
-
|
|
67
|
-
- 4 個平行子機器的結構是否有變
|
|
68
|
-
- siteConfig 解碼方式是否有變
|
|
69
|
-
|
|
70
|
-
7. **API 請求生命週期**:讀取 `src/request/request.js`,驗證:
|
|
71
|
-
|
|
72
|
-
- 攔截器邏輯、V2 轉換流程是否有變
|
|
73
|
-
- isBlocked 維護模式機制是否有變
|
|
74
|
-
|
|
75
|
-
8. **新增狀態機**:比對 `src/machine/` 目錄與文件中的狀態機分類表,若有新增檔案:
|
|
76
|
-
- 判斷歸類(核心/存款/提款/活動/遊戲/使用者/UI)
|
|
77
|
-
- 更新分類表中的數量與代表檔案
|
|
78
|
-
|
|
79
|
-
### Part C — Clean Code 規範驗證
|
|
80
|
-
|
|
81
|
-
檢查「二、程式碼品質標準」中列出的問題是否已修正:
|
|
82
|
-
|
|
83
|
-
1. **已修正的問題**:若問題已被修正(如 HTTP 方法大小寫已統一),將該項標記為已修正或移除
|
|
84
|
-
2. **新增的問題**:若發現新的程式碼品質問題,添加到對應章節
|
|
85
|
-
|
|
86
|
-
### 執行方式
|
|
87
|
-
|
|
88
|
-
- 使用 shell 指令(`wc -l`、`grep -c`、`find` 等)取得實際數據
|
|
89
|
-
- 使用 Agent subagent 平行分析多個核心檔案
|
|
90
|
-
- 將每項差異直接修正到 `AI_PROMPT_SOURCE.md` 中
|
|
91
|
-
- 若無差異則跳過,不做無意義修改
|
|
92
|
-
- 完成後簡短回報哪些項目有更新
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Step 1 — 讀取來源檔
|
|
97
|
-
|
|
98
|
-
讀取 `AI_PROMPT_SOURCE.md` 完整內容(此時已是 Step 0 更新後的最新版本)。
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Step 2 — 同步 CLAUDE.md
|
|
103
|
-
|
|
104
|
-
將 `AI_PROMPT_SOURCE.md` 的內容**翻譯成英文**,並轉換為 CLAUDE.md 格式:
|
|
105
|
-
|
|
106
|
-
**翻譯規則**:同 Step 3。
|
|
107
|
-
|
|
108
|
-
**格式調整**:
|
|
109
|
-
|
|
110
|
-
- 第一行標題改為 `# CLAUDE.md`
|
|
111
|
-
- 第二行加上 `<!-- AUTO-SYNCED FROM AI_PROMPT_SOURCE.md — DO NOT EDIT DIRECTLY -->`
|
|
112
|
-
- 描述行改為:`This file provides guidance for Claude Code (claude.ai/code) when working in this project.`
|
|
113
|
-
- 其餘結構不變
|
|
114
|
-
|
|
115
|
-
寫入 `CLAUDE.md`。
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Step 3 — 同步 AGENTS.md(OpenAI Codex / Cursor / Windsurf)
|
|
120
|
-
|
|
121
|
-
將 `AI_PROMPT_SOURCE.md` 的內容**翻譯成英文**,並轉換為 AGENTS.md 格式:
|
|
122
|
-
|
|
123
|
-
**翻譯規則**:
|
|
124
|
-
|
|
125
|
-
- 所有繁體中文文字翻譯成英文
|
|
126
|
-
- 程式碼區塊中的**註解**翻譯成英文,**程式碼本身不動**
|
|
127
|
-
- 檔案路徑、變數名、函式名等技術名詞保持不變
|
|
128
|
-
- Markdown 結構(標題層級、列表、表格)保持不變
|
|
129
|
-
|
|
130
|
-
**格式調整**:
|
|
131
|
-
|
|
132
|
-
- 第一行標題改為 `# AGENTS.md`
|
|
133
|
-
- 第二行加上 `<!-- AUTO-SYNCED FROM AI_PROMPT_SOURCE.md — DO NOT EDIT DIRECTLY -->`
|
|
134
|
-
- 描述行改為:`This file provides guidance for AI coding agents when working on this project.`
|
|
135
|
-
- 其餘結構不變
|
|
136
|
-
|
|
137
|
-
寫入 `AGENTS.md`。
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## Step 4 — 同步 GEMINI.md(Gemini CLI)
|
|
142
|
-
|
|
143
|
-
將 `AI_PROMPT_SOURCE.md` 的內容**翻譯成英文**,並轉換為 GEMINI.md 格式:
|
|
144
|
-
|
|
145
|
-
**翻譯規則**:同 Step 3。
|
|
146
|
-
|
|
147
|
-
**格式調整**:
|
|
148
|
-
|
|
149
|
-
- 第一行標題改為 `# GEMINI.md`
|
|
150
|
-
- 第二行加上 `<!-- AUTO-SYNCED FROM AI_PROMPT_SOURCE.md — DO NOT EDIT DIRECTLY -->`
|
|
151
|
-
- 描述行改為:`This file provides guidance for Gemini CLI when working on this project.`
|
|
152
|
-
- 其餘結構不變
|
|
153
|
-
|
|
154
|
-
寫入 `GEMINI.md`。
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## Step 5 — 同步 .github/copilot-instructions.md(GitHub Copilot)
|
|
159
|
-
|
|
160
|
-
將 `AI_PROMPT_SOURCE.md` 的內容**翻譯成英文**,並轉換為 copilot-instructions.md 格式:
|
|
161
|
-
|
|
162
|
-
**翻譯規則**:同 Step 3。
|
|
163
|
-
|
|
164
|
-
**格式調整**:
|
|
165
|
-
|
|
166
|
-
- 第一行標題改為 `# Copilot Instructions`
|
|
167
|
-
- 第二行加上 `<!-- AUTO-SYNCED FROM AI_PROMPT_SOURCE.md — DO NOT EDIT DIRECTLY -->`
|
|
168
|
-
- 描述行改為:`This file provides guidance for GitHub Copilot when working on this project.`
|
|
169
|
-
- 其餘結構不變
|
|
170
|
-
|
|
171
|
-
寫入 `.github/copilot-instructions.md`。
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Step 6 — 回報結果
|
|
176
|
-
|
|
177
|
-
顯示完成摘要:
|
|
178
|
-
|
|
179
|
-
- 列出已同步的檔案及各自的行數/大小
|
|
180
|
-
- 提醒使用者需要 commit 這些變更
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Read(*)",
|
|
5
|
-
"Bash(*)",
|
|
6
|
-
"WebFetch(domain:docs.qingque.cn)",
|
|
7
|
-
"WebFetch(domain:github.com)",
|
|
8
|
-
"WebFetch(domain:medium.com)",
|
|
9
|
-
"WebFetch(domain:nitro.build)",
|
|
10
|
-
"WebFetch(domain:raw.githubusercontent.com)",
|
|
11
|
-
"WebFetch(domain:unstorage.unjs.io)",
|
|
12
|
-
"WebFetch(domain:www.yungoucms.com)",
|
|
13
|
-
"mcp__chrome-devtools__list_console_messages",
|
|
14
|
-
"mcp__chrome-devtools__list_pages",
|
|
15
|
-
"mcp__sentry__find_organizations",
|
|
16
|
-
"mcp__sentry__find_projects",
|
|
17
|
-
"mcp__sentry__get_issue_details",
|
|
18
|
-
"mcp__sentry__search_issues",
|
|
19
|
-
"Bash(git add:*)",
|
|
20
|
-
"Bash(git commit:*)",
|
|
21
|
-
"Bash(git branch:*)",
|
|
22
|
-
"Bash(git merge:*)"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
}
|