@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/.husky/post-checkout
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# post-checkout receives: prev_HEAD new_HEAD checkout_type
|
|
2
|
-
# checkout_type: 1 = branch checkout, 0 = file checkout
|
|
3
|
-
CHECKOUT_TYPE=$3
|
|
4
|
-
|
|
5
|
-
# Only run on branch checkout, skip file checkout
|
|
6
|
-
[ "$CHECKOUT_TYPE" != "1" ] && exit 0
|
|
7
|
-
|
|
8
|
-
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
9
|
-
|
|
10
|
-
TARGET_BRANCHES="dev qa"
|
|
11
|
-
match=0
|
|
12
|
-
for branch in $TARGET_BRANCHES; do
|
|
13
|
-
[ "$CURRENT_BRANCH" = "$branch" ] && match=1 && break
|
|
14
|
-
done
|
|
15
|
-
|
|
16
|
-
if [ "$match" = "1" ]; then
|
|
17
|
-
LOCAL_AHEAD=$(git rev-list --count origin/"$CURRENT_BRANCH"..HEAD 2>/dev/null || echo 0)
|
|
18
|
-
if [ "$LOCAL_AHEAD" -gt 0 ]; then
|
|
19
|
-
echo "You have $LOCAL_AHEAD unpushed commit(s) on '$CURRENT_BRANCH'. Skipping auto-pull."
|
|
20
|
-
exit 0
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
echo "Auto pulling '$CURRENT_BRANCH' from remote..."
|
|
24
|
-
git pull --rebase origin "$CURRENT_BRANCH" || {
|
|
25
|
-
echo "Failed to pull '$CURRENT_BRANCH'. Please resolve manually."
|
|
26
|
-
exit 1
|
|
27
|
-
}
|
|
28
|
-
fi
|
package/.husky/pre-push
DELETED
package/scripts/auto-version.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Auto version bump for dev/qa branches
|
|
4
|
-
// Format: {master version}-{branch}.{number}
|
|
5
|
-
// Example: master=2.1.1, dev 5th push → 2.1.1-dev.5
|
|
6
|
-
//
|
|
7
|
-
// Called by auto-version.sh (pre-push hook)
|
|
8
|
-
// Outputs new version to stdout; silent exit if no change needed
|
|
9
|
-
|
|
10
|
-
import { execSync } from 'node:child_process'
|
|
11
|
-
import { readFileSync } from 'node:fs'
|
|
12
|
-
|
|
13
|
-
// Only run on dev / qa branches
|
|
14
|
-
const branch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim()
|
|
15
|
-
|
|
16
|
-
if (branch !== 'dev' && branch !== 'qa') {
|
|
17
|
-
process.exit(0)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Get base version from origin/master, fallback to local master
|
|
21
|
-
let masterVersion
|
|
22
|
-
try {
|
|
23
|
-
masterVersion = JSON.parse(execSync('git show origin/master:package.json', { encoding: 'utf8' })).version
|
|
24
|
-
} catch {
|
|
25
|
-
try {
|
|
26
|
-
masterVersion = JSON.parse(execSync('git show master:package.json', { encoding: 'utf8' })).version
|
|
27
|
-
} catch {
|
|
28
|
-
console.error('Cannot read master package.json version')
|
|
29
|
-
process.exit(1)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const currentVersion = JSON.parse(readFileSync('package.json', 'utf8')).version
|
|
34
|
-
const prefix = `${masterVersion}-${branch}.`
|
|
35
|
-
let nextNum = 0
|
|
36
|
-
|
|
37
|
-
// Derive next number from current version
|
|
38
|
-
// e.g. currentVersion="2.1.1-dev.4" → nextNum=5
|
|
39
|
-
if (currentVersion.startsWith(prefix)) {
|
|
40
|
-
const num = parseInt(currentVersion.slice(prefix.length), 10)
|
|
41
|
-
if (!isNaN(num)) nextNum = num + 1
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Scan git log for the highest number ever used with this prefix
|
|
45
|
-
// Prevents regression when merges overwrite currentVersion
|
|
46
|
-
// e.g. after merge currentVersion="2.0.9-dev.20", but history has "2.1.1-dev.4"
|
|
47
|
-
// → historyMax=4, nextNum=5 (instead of restarting from 0)
|
|
48
|
-
try {
|
|
49
|
-
const log = execSync(`git log ${branch} --pretty=%s --grep="^${masterVersion}-${branch}\\\\." -n 50`, {
|
|
50
|
-
encoding: 'utf8',
|
|
51
|
-
})
|
|
52
|
-
for (const line of log.trim().split('\n')) {
|
|
53
|
-
if (!line.startsWith(prefix)) continue
|
|
54
|
-
const n = parseInt(line.slice(prefix.length), 10)
|
|
55
|
-
if (!isNaN(n) && n >= nextNum) nextNum = n + 1
|
|
56
|
-
}
|
|
57
|
-
} catch {}
|
|
58
|
-
|
|
59
|
-
const newVersion = `${prefix}${nextNum}`
|
|
60
|
-
|
|
61
|
-
// No change needed
|
|
62
|
-
if (currentVersion === newVersion) {
|
|
63
|
-
process.exit(0)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.log(newVersion)
|
package/scripts/auto-version.sh
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
|
|
3
|
-
# Auto version bump on dev/qa branches
|
|
4
|
-
# Called from pre-push hook — receives remote name as $1
|
|
5
|
-
|
|
6
|
-
REMOTE=${1:-origin}
|
|
7
|
-
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
8
|
-
|
|
9
|
-
if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
|
|
10
|
-
# Compute next prerelease version (scans git log to prevent regression)
|
|
11
|
-
NEXT_VERSION=$(node scripts/auto-version.js)
|
|
12
|
-
|
|
13
|
-
if [ -z "$NEXT_VERSION" ]; then
|
|
14
|
-
echo "Version unchanged, skipping release."
|
|
15
|
-
exit 0
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
echo "Branch: $BRANCH"
|
|
19
|
-
echo "Next version: $NEXT_VERSION"
|
|
20
|
-
|
|
21
|
-
# Bump version, update CHANGELOG, create commit + tag
|
|
22
|
-
npx standard-version --release-as "$NEXT_VERSION"
|
|
23
|
-
|
|
24
|
-
# Push + npm publish
|
|
25
|
-
node scripts/branch-auto-npm-publish.js "$REMOTE" "$BRANCH"
|
|
26
|
-
|
|
27
|
-
# Abort the original git push (scripts already pushed)
|
|
28
|
-
exit 1
|
|
29
|
-
fi
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process'
|
|
2
|
-
import { readFileSync } from 'node:fs'
|
|
3
|
-
|
|
4
|
-
const remote = process.argv[2] || 'origin'
|
|
5
|
-
const branch = process.argv[3] || execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim()
|
|
6
|
-
|
|
7
|
-
const { version } = JSON.parse(readFileSync('package.json', 'utf8'))
|
|
8
|
-
|
|
9
|
-
console.log(`Branch: ${branch}`)
|
|
10
|
-
console.log(`Version: ${version}`)
|
|
11
|
-
|
|
12
|
-
// Pull remote changes before push (avoid rejection)
|
|
13
|
-
execSync(`git pull --rebase --no-verify ${remote} ${branch}`, { stdio: 'inherit' })
|
|
14
|
-
|
|
15
|
-
// Push commit and tags
|
|
16
|
-
execSync(`git push --no-verify --follow-tags ${remote} ${branch}`, { stdio: 'inherit' })
|
|
17
|
-
|
|
18
|
-
// Publish to npm with branch dist-tag
|
|
19
|
-
try {
|
|
20
|
-
execSync(`npm publish --tag ${branch}`, { stdio: 'inherit' })
|
|
21
|
-
console.log(`✅ npm publish succeeded: ${version} (tag: ${branch})`)
|
|
22
|
-
} catch {
|
|
23
|
-
console.error(`❌ npm publish failed for ${version}. Please run "npm publish --tag ${branch}" manually.`)
|
|
24
|
-
process.exit(1)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
console.log(`Released ${version} on ${branch}`)
|
package/scripts/clean-tags.sh
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
|
|
3
|
-
# Delete local and remote tags that do NOT match the compliant pattern
|
|
4
|
-
# Compliant pattern: v1.2.3 (e.g., v0.1.0, v1.12.123)
|
|
5
|
-
#
|
|
6
|
-
# Deletion rules (any match triggers deletion):
|
|
7
|
-
# 1. Current branch is dev or qa
|
|
8
|
-
# 2. Tag's commit is not reachable from any branch
|
|
9
|
-
# 3. Tag's commit is already merged into master
|
|
10
|
-
PATTERN="^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
|
|
11
|
-
|
|
12
|
-
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
13
|
-
|
|
14
|
-
# Find the latest tag (by creation date) regardless of format
|
|
15
|
-
LATEST_TAG=$(git tag -l --sort=-creatordate | head -n 1)
|
|
16
|
-
|
|
17
|
-
# Collect non-compliant tags
|
|
18
|
-
TAGS=$(git tag -l | grep -vE "$PATTERN")
|
|
19
|
-
|
|
20
|
-
if [ -z "$TAGS" ]; then
|
|
21
|
-
echo "No non-compliant tags found."
|
|
22
|
-
exit 0
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
echo "Latest tag (preserved): $LATEST_TAG"
|
|
26
|
-
|
|
27
|
-
for TAG in $TAGS; do
|
|
28
|
-
if [ "$TAG" = "$LATEST_TAG" ]; then
|
|
29
|
-
echo "Skipping tag $TAG (latest tag)"
|
|
30
|
-
continue
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
SHOULD_DELETE=false
|
|
34
|
-
REASON=""
|
|
35
|
-
|
|
36
|
-
# Rule 1: Current branch is dev or qa
|
|
37
|
-
if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
|
|
38
|
-
SHOULD_DELETE=true
|
|
39
|
-
REASON="on $BRANCH branch"
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
# Rule 2: Tag's commit is not reachable from any branch
|
|
43
|
-
if [ "$SHOULD_DELETE" = false ]; then
|
|
44
|
-
BRANCHES=$(git branch -a --contains "$TAG" 2>/dev/null)
|
|
45
|
-
if [ -z "$BRANCHES" ]; then
|
|
46
|
-
SHOULD_DELETE=true
|
|
47
|
-
REASON="not on any branch"
|
|
48
|
-
fi
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# Rule 3: Tag's commit is already merged into master
|
|
52
|
-
if [ "$SHOULD_DELETE" = false ]; then
|
|
53
|
-
if git merge-base --is-ancestor "$TAG" master 2>/dev/null; then
|
|
54
|
-
SHOULD_DELETE=true
|
|
55
|
-
REASON="merged into master"
|
|
56
|
-
fi
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
if [ "$SHOULD_DELETE" = true ]; then
|
|
60
|
-
echo "Deleting tag $TAG ($REASON)"
|
|
61
|
-
git push origin --delete "$TAG" --no-verify 2>/dev/null || true
|
|
62
|
-
git tag -d "$TAG"
|
|
63
|
-
else
|
|
64
|
-
echo "Keeping tag $TAG"
|
|
65
|
-
fi
|
|
66
|
-
done
|