Skip to content

Commit 9dda9ff

Browse files
committed
chore(config): remove duplicated IDE rules from mcp, sync auth-web and docs
- Remove mcp/.agent, .claude, .clinerules, .codebuddy, .cursor, .kiro, .qoder, .trae, .windsurf and other IDE-specific rule/skill copies - Update config rules and skills (auth-web), doc/mcp-tools.md, doc/prompts/miniprogram-development.mdx - Update scripts/tools.json
1 parent df7ecc2 commit 9dda9ff

File tree

382 files changed

+579
-115701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

382 files changed

+579
-115701
lines changed

config/.agent/rules/auth-web/rule.md

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: auth-web-cloudbase
3-
description: CloudBase Auth v3 Web SDK - Quick Reference Guide
3+
description: CloudBase Web Authentication Quick Guide - Provides concise and practical Web frontend authentication solutions with multiple login methods and complete user management.
44
alwaysApply: false
55
---
66

@@ -11,11 +11,17 @@ alwaysApply: false
1111

1212
---
1313

14-
## When to Use
14+
## Core Capabilities
1515

16-
Web frontend authentication with `@cloudbase/[email protected]+`, Compatible with `supabase-js` Auth API and type declarations. **NOT for** server-side or direct HTTP API.
16+
**Use Case**: Web frontend projects using `@cloudbase/[email protected]+` for user authentication
17+
**Key Benefits**: Compatible with `supabase-js` API, supports phone, email, anonymous, username/password, and third-party login methods
18+
**`@cloudbase/js-sdk` cdn source**: `https://static.cloudbase.net/cloudbase-js-sdk/latest/cloudbase.full.js`
1719

18-
`@cloudbase/js-sdk` cdn source `https://static.cloudbase.net/cloudbase-js-sdk/latest/cloudbase.full.js`
20+
21+
## Prerequisites
22+
23+
- Automatically use `auth-tool-cloudbase` to get `publishable key` and configure login methods.
24+
- If `auth-tool-cloudbase` failed, let user go to `https://tcb.cloud.tencent.com/dev?envId={env}#/env/apikey` to get `publishable key` and `https://tcb.cloud.tencent.com/dev?envId={env}#/identity/login-manage` to set up login methods
1925

2026
## Quick Start
2127

@@ -25,60 +31,61 @@ import cloudbase from '@cloudbase/js-sdk'
2531
const app = cloudbase.init({
2632
env: `env`, // CloudBase environment ID
2733
region: `region`, // CloudBase environment Region, default 'ap-shanghai'
28-
accessKey: 'publishable key', // requiredget publishable key from auth-tool-cloudbase('Get Publishable Key')
29-
auth: { detectSessionInUrl: true },
34+
accessKey: 'publishable key', // required, get from auth-tool-cloudbase
35+
auth: { detectSessionInUrl: true }, // required
3036
})
3137

3238
const auth = app.auth
33-
```
34-
35-
**⚠️ Console Setup Required**: `https://tcb.cloud.tencent.com/dev?envId={envId}#/identity/login-manage`
36-
- Enable login methods, configure templates, add domain to whitelist
37-
38-
**Tokens**: `access_token` (2h), `refresh_token` (30d, auto-refresh), stored in localStorage
39+
``
3940

4041
---
4142

4243
## Login Methods
4344

4445
**1. Phone OTP (Recommended)**
46+
- Automatically use `auth-tool-cloudbase` turn on `SMS Login`
4547
```js
46-
const { data } = await auth.signInWithOtp({ phone: '13800138000' })
47-
const { data: loginData } = await data.verifyOtp({ token:'123456' })
48+
const { data, error } = await auth.signInWithOtp({ phone: '13800138000' })
49+
const { data: loginData, error: loginError } = await data.verifyOtp({ token:'123456' })
4850
```
4951

5052
**2. Email OTP**
53+
- Automatically use `auth-tool-cloudbase` turn on `Email Login`
5154
```js
52-
const { data } = await auth.signInWithOtp({ email: '[email protected]' })
53-
const { data: loginData } = await data.verifyOtp({ token: '654321' })
55+
const { data, error } = await auth.signInWithOtp({ email: '[email protected]' })
56+
const { data: loginData, error: loginError } = await data.verifyOtp({ token: '654321' })
5457
```
5558

5659
**3. Password**
5760
```js
58-
await auth.signInWithPassword({ username: 'test_user', password: 'pass123' })
59-
await auth.signInWithPassword({ email: '[email protected]', password: 'pass123' })
60-
await auth.signInWithPassword({ phone: '13800138000', password: 'pass123' })
61+
const { data, error } = await auth.signInWithPassword({ username: 'test_user', password: 'pass123' })
62+
const { data, error } = await auth.signInWithPassword({ email: '[email protected]', password: 'pass123' })
63+
const { data, error } = await auth.signInWithPassword({ phone: '13800138000', password: 'pass123' })
6164
```
6265

6366
**4. Registration (Smart: auto-login if exists)**
67+
- Only support email and phone otp registration
68+
- Automatically use `auth-tool-cloudbase` turn on `Email Login` or `SMS Login`
6469
```js
65-
// Email
66-
const { data } = await auth.signUp({ email: '[email protected]', nickname: 'User' })
67-
const { data: loginData } = await data.verifyOtp({ token: '123456' })
70+
// Email Otp
71+
const { data, error } = await auth.signUp({ email: '[email protected]', nickname: 'User' })
72+
const { data: loginData, error: loginError } = await data.verifyOtp({ token: '123456' })
6873
69-
// Phone
70-
const { data } = await auth.signUp({ phone: '13800138000', nickname: 'User' })
71-
const { data: loginData } = await data.verifyOtp({ token: '123456' })
74+
// Phone Otp
75+
const { data, error } = await auth.signUp({ phone: '13800138000', nickname: 'User' })
76+
const { data: loginData, error: loginError } = await data.verifyOtp({ token: '123456' })
7277
```
7378

7479
**5. Anonymous**
80+
- Automatically use `auth-tool-cloudbase` turn on `Anonymous Login`
7581
```js
76-
const { data } = await auth.signInAnonymously()
82+
const { data, error } = await auth.signInAnonymously()
7783
```
7884

7985
**6. OAuth (Google/WeChat)**
86+
- Automatically use `auth-tool-cloudbase` turn on `Google Login` or `WeChat Login`
8087
```js
81-
const { data } = await auth.signInWithOAuth({ provider: 'google' })
88+
const { data, error } = await auth.signInWithOAuth({ provider: 'google' })
8289
window.location.href = data.url // Auto-complete after callback
8390
```
8491

@@ -92,8 +99,8 @@ await auth.signInWithCustomTicket(async () => {
9299

93100
**8. Upgrade Anonymous**
94101
```js
95-
const { data } = await auth.getSession()
96-
const { data: signUpData } = await auth.signUp({
102+
const { data, error } = await auth.getSession()
103+
const { data: signUpData, error: signUpError} = await auth.signUp({
97104
phone: '13800000000',
98105
anonymous_token: data.session.access_token,
99106
})
@@ -106,47 +113,47 @@ await signUpData.verifyOtp({ token: '123456' })
106113

107114
```js
108115
// Sign out
109-
await auth.signOut()
116+
const { data, error } = await auth.signOut()
110117
111118
// Get user
112-
const { data } = await auth.getUser()
119+
const { data, error } = await auth.getUser()
113120
console.log(data.user.email, data.user.phone, data.user.user_metadata?.nickName)
114121
115122
// Update user (except email, phone)
116-
await auth.updateUser({ nickname: 'New Name', gender: 'MALE', avatar_url: 'url' })
123+
const { data, error } = await auth.updateUser({ nickname: 'New Name', gender: 'MALE', avatar_url: 'url' })
117124
118125
// Update user (email or phone)
119-
const { data } = await auth.updateUser({ email: '[email protected]' })
120-
await data.verifyOtp({ email: "[email protected]", token: "123456" });
126+
const { data, error } = await auth.updateUser({ email: '[email protected]' })
127+
const { data, error } = await data.verifyOtp({ email: "[email protected]", token: "123456" });
121128
122129
// Change password (logged in)
123-
await auth.resetPasswordForOld({ old_password: 'old', new_password: 'new' })
130+
const { data, error } = await auth.resetPasswordForOld({ old_password: 'old', new_password: 'new' })
124131
125132
// Reset password (forgot)
126-
const { data } = await auth.reauthenticate()
127-
await data.updateUser({ nonce: '123456', password: 'new' })
133+
const { data, error } = await auth.reauthenticate()
134+
const { data, error } = await data.updateUser({ nonce: '123456', password: 'new' })
128135
129136
// Link third-party
130-
const { data } = await auth.linkIdentity({ provider: 'google' })
137+
const { data, error } = await auth.linkIdentity({ provider: 'google' })
131138
132139
// View/Unlink identities
133-
const { data } = await auth.getUserIdentities()
134-
await auth.unlinkIdentity({ provider: data.identities[0].id })
140+
const { data, error } = await auth.getUserIdentities()
141+
const { data, error } = await auth.unlinkIdentity({ provider: data.identities[0].id })
135142
136143
// Delete account
137-
await auth.deleteMe({ password: 'current' })
144+
const { data, error } = await auth.deleteMe({ password: 'current' })
138145
139146
// Listen to state changes
140-
auth.onAuthStateChange((event, session, info) => {
147+
const { data, error } = auth.onAuthStateChange((event, session, info) => {
141148
// INITIAL_SESSION, SIGNED_IN, SIGNED_OUT, TOKEN_REFRESHED, USER_UPDATED, PASSWORD_RECOVERY, BIND_IDENTITY
142149
})
143150
144151
// Get access token
145-
const { data } = await auth.getSession()
152+
const { data, error } = const { data, error } = await auth.getSession()
146153
fetch('/api/protected', { headers: { Authorization: `Bearer ${data.session?.access_token}` } })
147154
148155
// Refresh user
149-
await auth.refreshUser()
156+
const { data, error } = await auth.refreshUser()
150157
```
151158

152159
---
@@ -240,11 +247,11 @@ class PhoneLoginPage {
240247

241248
```js
242249
// Silent login with OpenID
243-
await auth.signInWithOpenId() // WeChat Cloud mode (default)
244-
await auth.signInWithOpenId({ useWxCloud: false }) // HTTP mode
250+
const { data, error } = await auth.signInWithOpenId() // WeChat Cloud mode (default)
251+
const { data, error } = await auth.signInWithOpenId({ useWxCloud: false }) // HTTP mode
245252
246253
// Phone authorization login
247-
await auth.signInWithPhoneAuth({ phoneCode: 'xxx' })
254+
const { data, error } = await auth.signInWithPhoneAuth({ phoneCode: 'xxx' })
248255
```
249256

250257
---

0 commit comments

Comments
 (0)