@kaitranntt/ccs 7.55.0-dev.3 → 7.56.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,6 +32,13 @@ Run Claude, Gemini, GLM, and any Anthropic-compatible API - concurrently, withou
32
32
  Looking for the full setup guide, command reference, provider guides, or troubleshooting?
33
33
  Start at **https://docs.ccs.kaitran.ca**.
34
34
 
35
+ ## Contribute And Report Safely
36
+
37
+ - Contributing guide: [CONTRIBUTING.md](./CONTRIBUTING.md)
38
+ - Starter work: [good first issue](https://github.com/kaitranntt/ccs/labels/good%20first%20issue), [help wanted](https://github.com/kaitranntt/ccs/labels/help%20wanted)
39
+ - Questions: [open a question issue](https://github.com/kaitranntt/ccs/issues/new/choose)
40
+ - Security reports: [SECURITY.md](./SECURITY.md) and the [private advisory form](https://github.com/kaitranntt/ccs/security/advisories/new)
41
+
35
42
  ### 1. Install
36
43
 
37
44
  ```bash
@@ -665,7 +672,7 @@ bun remove -g @kaitranntt/ccs
665
672
 
666
673
  ## Contributing
667
674
 
668
- See [CONTRIBUTING.md](./CONTRIBUTING.md).
675
+ See [CONTRIBUTING.md](./CONTRIBUTING.md). For suspected vulnerabilities, use [SECURITY.md](./SECURITY.md) instead of a public issue.
669
676
 
670
677
  <br>
671
678
 
@@ -683,6 +690,6 @@ MIT License - see [LICENSE](LICENSE).
683
690
 
684
691
  ---
685
692
 
686
- **[ccs.kaitran.ca](https://ccs.kaitran.ca)** | **[docs.ccs.kaitran.ca](https://docs.ccs.kaitran.ca)** | [Report Issues](https://github.com/kaitranntt/ccs/issues) | [Star on GitHub](https://github.com/kaitranntt/ccs)
693
+ **[ccs.kaitran.ca](https://ccs.kaitran.ca)** | **[docs.ccs.kaitran.ca](https://docs.ccs.kaitran.ca)** | [Issue Templates](https://github.com/kaitranntt/ccs/issues/new/choose) | [Private Security Report](https://github.com/kaitranntt/ccs/security/advisories/new) | [Star on GitHub](https://github.com/kaitranntt/ccs)
687
694
 
688
695
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "7.55.0-dev.3",
3
+ "version": "7.56.0-dev.1",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude, GLM, Kimi, and more",
5
5
  "keywords": [
6
6
  "cli",
@@ -26,8 +26,8 @@ log_info() { echo -e "${GREEN}[i]${NC} $1"; }
26
26
  log_warn() { echo -e "${YELLOW}[!]${NC} $1"; }
27
27
  log_error() { echo -e "${RED}[X]${NC} $1"; }
28
28
 
29
- # Ensure we have the latest tags
30
- git fetch --tags origin main
29
+ # Ensure we have the latest tags and branch refs
30
+ git fetch --tags origin main dev
31
31
 
32
32
  # Get latest stable tag from main (exclude prereleases like -dev, -beta, -rc)
33
33
  # Match only clean semver tags: vX.Y.Z
@@ -39,58 +39,100 @@ if [ -z "$STABLE_TAG" ]; then
39
39
  fi
40
40
 
41
41
  STABLE=${STABLE_TAG#v}
42
- log_info "Current stable version: ${STABLE}"
42
+ CURRENT_VERSION=$(jq -r '.version' package.json)
43
+ HEAD_SUBJECT=$(git log -1 --pretty=%s 2>/dev/null || echo "")
44
+ DEV_VERSION_REGEX="^${STABLE//./\\.}-dev\\.[0-9]+$"
45
+ PREVIOUS_DEV_TAG=""
46
+ RECOVERY_MODE=false
43
47
 
44
- # Find latest dev tag for this stable version
45
- LATEST_DEV=$(git tag -l "v${STABLE}-dev.*" --sort=-v:refname | head -1 || echo "")
48
+ log_info "Current stable version: ${STABLE}"
46
49
 
47
- # Calculate next dev number
48
- if [ -z "$LATEST_DEV" ]; then
49
- DEV_NUM=1
50
- log_info "No existing dev tags for ${STABLE}, starting at dev.1"
50
+ if [[ "$CURRENT_VERSION" =~ $DEV_VERSION_REGEX ]] && [[ "$HEAD_SUBJECT" == "chore(release): ${CURRENT_VERSION} [skip ci]" ]]; then
51
+ VERSION="$CURRENT_VERSION"
52
+ CURRENT_TAG="v${VERSION}"
53
+ PREVIOUS_DEV_TAG=$(git tag -l "v${STABLE}-dev.*" --sort=-v:refname | grep -vx "$CURRENT_TAG" | head -1 || echo "")
54
+ RECOVERY_MODE=true
55
+ log_warn "Recovery mode for ${VERSION}"
56
+
57
+ if git rev-parse "${CURRENT_TAG}" >/dev/null 2>&1; then
58
+ TAG_COMMIT=$(git rev-parse "${CURRENT_TAG}^{commit}")
59
+ HEAD_COMMIT=$(git rev-parse HEAD)
60
+ if [[ "$TAG_COMMIT" != "$HEAD_COMMIT" ]]; then
61
+ log_error "Tag ${CURRENT_TAG} exists but does not point to HEAD"
62
+ exit 1
63
+ fi
64
+ log_info "Reusing existing tag ${CURRENT_TAG}"
65
+ else
66
+ git tag "${CURRENT_TAG}"
67
+ log_warn "Recreated missing tag ${CURRENT_TAG} on release commit"
68
+ fi
51
69
  else
52
- DEV_NUM=$(echo "$LATEST_DEV" | sed 's/.*dev\.\([0-9]*\)/\1/')
53
- DEV_NUM=$((DEV_NUM + 1))
54
- log_info "Latest dev tag: ${LATEST_DEV}, incrementing to dev.${DEV_NUM}"
70
+ # Find latest dev tag for this stable version
71
+ LATEST_DEV=$(git tag -l "v${STABLE}-dev.*" --sort=-v:refname | head -1 || echo "")
72
+ PREVIOUS_DEV_TAG="$LATEST_DEV"
73
+
74
+ # Calculate next dev number
75
+ if [ -z "$LATEST_DEV" ]; then
76
+ DEV_NUM=1
77
+ log_info "No existing dev tags for ${STABLE}, starting at dev.1"
78
+ else
79
+ DEV_NUM=$(echo "$LATEST_DEV" | sed 's/.*dev\.\([0-9]*\)/\1/')
80
+ DEV_NUM=$((DEV_NUM + 1))
81
+ log_info "Latest dev tag: ${LATEST_DEV}, incrementing to dev.${DEV_NUM}"
82
+ fi
83
+
84
+ VERSION="${STABLE}-dev.${DEV_NUM}"
85
+ CURRENT_TAG="v${VERSION}"
86
+ log_info "New version: ${VERSION}"
87
+
88
+ # Check if tag already exists (safety check)
89
+ if git rev-parse "${CURRENT_TAG}" >/dev/null 2>&1; then
90
+ log_error "Tag ${CURRENT_TAG} already exists!"
91
+ exit 1
92
+ fi
93
+
94
+ # Update package.json
95
+ npm version "$VERSION" --no-git-tag-version
96
+ log_info "Updated package.json to ${VERSION}"
97
+
98
+ # Configure git for GitHub Actions
99
+ git config user.name "github-actions[bot]"
100
+ git config user.email "github-actions[bot]@users.noreply.github.com"
101
+
102
+ # Commit version change
103
+ git add package.json
104
+ git commit -m "chore(release): ${VERSION} [skip ci]"
105
+ log_info "Created release commit"
106
+
107
+ # Create tag
108
+ git tag "${CURRENT_TAG}"
109
+ log_info "Created tag ${CURRENT_TAG}"
55
110
  fi
56
111
 
57
- VERSION="${STABLE}-dev.${DEV_NUM}"
58
- log_info "New version: ${VERSION}"
59
-
60
- # Check if tag already exists (safety check)
61
- if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
62
- log_error "Tag v${VERSION} already exists!"
63
- exit 1
112
+ PACKAGE_NAME=$(jq -r '.name' package.json)
113
+ if npm view "${PACKAGE_NAME}@${VERSION}" version >/dev/null 2>&1; then
114
+ log_info "npm already has ${PACKAGE_NAME}@${VERSION}, skipping publish"
115
+ else
116
+ npm publish --tag dev
117
+ log_info "Published to npm with @dev tag"
64
118
  fi
65
119
 
66
- # Update package.json
67
- npm version "$VERSION" --no-git-tag-version
68
- log_info "Updated package.json to ${VERSION}"
69
-
70
- # Configure git for GitHub Actions
71
- git config user.name "github-actions[bot]"
72
- git config user.email "github-actions[bot]@users.noreply.github.com"
73
-
74
- # Commit version change
75
- git add package.json
76
- git commit -m "chore(release): ${VERSION} [skip ci]"
77
- log_info "Created release commit"
78
-
79
- # Create tag
80
- git tag "v${VERSION}"
81
- log_info "Created tag v${VERSION}"
82
-
83
- # Push commit and tag
84
- git push origin dev
85
- git push origin "v${VERSION}"
86
- log_info "Pushed to origin"
120
+ if git merge-base --is-ancestor HEAD origin/dev >/dev/null 2>&1; then
121
+ log_info "origin/dev already contains release commit"
122
+ else
123
+ git push origin HEAD:dev
124
+ log_info "Pushed release commit to origin/dev"
125
+ fi
87
126
 
88
- # Publish to npm with dev tag
89
- npm publish --tag dev
90
- log_info "Published to npm with @dev tag"
127
+ if git ls-remote --exit-code --tags origin "refs/tags/${CURRENT_TAG}" >/dev/null 2>&1; then
128
+ log_info "Remote tag ${CURRENT_TAG} already exists"
129
+ else
130
+ git push origin "${CURRENT_TAG}"
131
+ log_info "Pushed tag ${CURRENT_TAG}"
132
+ fi
91
133
 
92
134
  # Generate release notes from commits since last tag
93
- PREV_TAG=$(git tag -l "v*" --sort=-v:refname | sed -n '2p' || echo "")
135
+ PREV_TAG="${PREVIOUS_DEV_TAG:-$STABLE_TAG}"
94
136
  if [ -n "$PREV_TAG" ]; then
95
137
  # Get commits between previous tag and the one before our release commit
96
138
  NOTES=$(git log --pretty=format:"- %s" "${PREV_TAG}..HEAD~1" 2>/dev/null | grep -v "chore(release):" | head -15 || echo "- Dev release")
@@ -99,12 +141,16 @@ else
99
141
  fi
100
142
 
101
143
  # Create GitHub prerelease
102
- gh release create "v${VERSION}" \
103
- --title "v${VERSION}" \
104
- --notes "${NOTES}" \
105
- --prerelease
144
+ if gh release view "${CURRENT_TAG}" >/dev/null 2>&1; then
145
+ log_info "GitHub prerelease ${CURRENT_TAG} already exists"
146
+ else
147
+ gh release create "${CURRENT_TAG}" \
148
+ --title "${CURRENT_TAG}" \
149
+ --notes "${NOTES}" \
150
+ --prerelease
106
151
 
107
- log_info "Created GitHub prerelease"
152
+ log_info "Created GitHub prerelease"
153
+ fi
108
154
 
109
155
  # Save release info for Discord notification
110
156
  # This file is read by send-discord-release.cjs for dev releases
@@ -117,7 +163,13 @@ EOF
117
163
  log_info "Saved release info for Discord notification"
118
164
 
119
165
  # Output for GitHub Actions
120
- echo "version=${VERSION}" >> "${GITHUB_OUTPUT:-/dev/null}"
121
- echo "released=true" >> "${GITHUB_OUTPUT:-/dev/null}"
166
+ {
167
+ echo "current_tag=${CURRENT_TAG}"
168
+ echo "previous_dev_tag=${PREVIOUS_DEV_TAG}"
169
+ echo "recovery_mode=${RECOVERY_MODE}"
170
+ echo "released=true"
171
+ echo "stable_tag=${STABLE_TAG}"
172
+ echo "version=${VERSION}"
173
+ } >> "${GITHUB_OUTPUT:-/dev/null}"
122
174
 
123
175
  log_info "Dev release ${VERSION} complete!"