Skip to content

Commit dbc8f2e

Browse files
author
sunzhongyi
committed
chore: support cursor marketplace
1 parent 04947b2 commit dbc8f2e

File tree

5 files changed

+85
-31
lines changed

5 files changed

+85
-31
lines changed

.github/workflows/README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,18 @@ You need to set up a `VSCE_TOKEN` secret in your GitHub repository:
4545
5. In your GitHub repository, go to Settings → Secrets and variables → Actions
4646
6. Add a new repository secret named `VSCE_TOKEN` with your PAT as the value
4747

48-
### 2. Update package.json
48+
### 2. OpenVSX Registry Token (for Cursor Marketplace)
49+
50+
To publish to Cursor Marketplace, you need an OpenVSX token:
51+
52+
1. Go to [OpenVSX Registry](https://open-vsx.org/)
53+
2. Sign in with your GitHub account
54+
3. Go to your user settings
55+
4. Generate a new Access Token
56+
5. In your GitHub repository, go to Settings → Secrets and variables → Actions
57+
6. Add a new repository secret named `OVSX_TOKEN` with your OpenVSX token as the value
58+
59+
### 3. Update package.json
4960

5061
Make sure your `package.json` has the correct publisher name:
5162

@@ -55,7 +66,7 @@ Make sure your `package.json` has the correct publisher name:
5566
}
5667
```
5768

58-
### 3. Repository URL
69+
### 4. Repository URL
5970

6071
Update the repository URL in `package.json`:
6172

@@ -70,30 +81,23 @@ Update the repository URL in `package.json`:
7081

7182
## Publishing Process
7283

73-
### Regular Release
74-
75-
1. Update the version in `package.json`
76-
2. Commit your changes
77-
3. Create and push a tag:
78-
```bash
79-
git tag v1.0.0
80-
git push origin v1.0.0
81-
```
82-
4. The workflow will automatically publish to the marketplace
83-
84-
### Pre-release
85-
86-
1. Go to Actions tab in your GitHub repository
87-
2. Select "Publish to VS Code Marketplace"
88-
3. Click "Run workflow"
89-
4. Leave the version input empty to publish as pre-release
90-
91-
### Manual Release
84+
### Manual Release (Recommended)
9285

9386
1. Go to Actions tab in your GitHub repository
9487
2. Select "Publish to VS Code Marketplace"
9588
3. Click "Run workflow"
96-
4. Enter a version (e.g., `v1.0.0`) if needed
89+
4. Fill in the required fields:
90+
- **Version**: Enter version number (e.g., `1.0.0`)
91+
- **Release type**: Choose `release` or `pre-release`
92+
- **Publish to OpenVSX**: Check if you want to publish to Cursor Marketplace
93+
5. Click "Run workflow"
94+
95+
The workflow will:
96+
- Update the version in `package.json`
97+
- Build and package the extension
98+
- Publish to VS Code Marketplace
99+
- Optionally publish to OpenVSX Registry (Cursor Marketplace)
100+
- Create GitHub release (for regular releases)
97101

98102
## Artifacts
99103

.github/workflows/publish.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
- 'release'
1616
- 'pre-release'
1717
default: 'release'
18+
publish_to_openvsx:
19+
description: 'Also publish to OpenVSX Registry (Cursor Marketplace)'
20+
required: false
21+
type: boolean
22+
default: true
1823

1924
jobs:
2025
publish:
@@ -44,8 +49,10 @@ jobs:
4449
- name: Build project
4550
run: npm run build
4651

47-
- name: Install VSCE
48-
run: npm install -g @vscode/vsce
52+
- name: Install VSCE and OVSX
53+
run: |
54+
npm install -g @vscode/vsce
55+
npm install -g ovsx
4956
5057
- name: Package extension
5158
run: |
@@ -65,6 +72,18 @@ jobs:
6572
env:
6673
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
6774

75+
- name: Publish to OpenVSX Registry (Cursor Marketplace)
76+
if: github.event.inputs.publish_to_openvsx == 'true'
77+
run: |
78+
if [ "${{ github.event.inputs.release_type }}" = "pre-release" ]; then
79+
ovsx publish --pre-release -p "$OVSX_TOKEN"
80+
else
81+
ovsx publish -p "$OVSX_TOKEN"
82+
fi
83+
env:
84+
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
85+
continue-on-error: true
86+
6887
- name: Create Git Tag (for releases only)
6988
if: github.event.inputs.release_type == 'release'
7089
uses: actions/github-script@v7

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "commit-assistant",
33
"displayName": "Commit Assistant",
44
"description": "Smart commit message editor that helps you write better commit messages",
5-
"version": "0.1.2",
5+
"version": "1.0.0",
66
"publisher": "sunzhongyi",
77
"license": "MIT",
88
"engines": {

webviews/commit-editor/components/FormView.svelte

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,40 @@
3535
commitData.selectedFlags = event.detail
3636
dispatch('change', commitData)
3737
}
38+
39+
function handleAIGenerate() {
40+
// 清除将要被 AI 生成的字段
41+
const clearedData = { ...commitData }
42+
43+
// 根据 aiFieldConfig 清除相应字段
44+
if (aiFieldConfig.scope) {
45+
clearedData.scope = ''
46+
}
47+
if (aiFieldConfig.body) {
48+
clearedData.body = ''
49+
}
50+
51+
// 总是清除 description,因为 AI 总是会生成它
52+
clearedData.description = ''
53+
54+
// 可选:也清除 footer,如果你希望 AI 重新生成
55+
// clearedData.footer = ''
56+
57+
dispatch('change', clearedData)
58+
59+
// 发送 AI 生成请求
60+
vscode.postMessage({
61+
command: 'generateAiCommitForForm',
62+
config: aiFieldConfig,
63+
})
64+
}
3865
</script>
3966

4067
<div class="space-y-4">
4168
<div class="flex justify-between items-center">
4269
<h3 class="text-base font-medium">Form</h3>
4370
<AITrigger
44-
on:click={() =>
45-
vscode.postMessage({
46-
command: 'generateAiCommitForForm',
47-
config: aiFieldConfig,
48-
})}
71+
on:click={handleAIGenerate}
4972
{disabled}
5073
{loading}
5174
/>

webviews/commit-editor/components/TextView.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,20 @@
3434
autoGrow()
3535
}
3636
}
37+
38+
function handleAIGenerate() {
39+
// 清除当前的文本内容
40+
value = ''
41+
42+
// 发送 AI 生成请求
43+
vscode.postMessage({ command: 'generateAiCommitForText' })
44+
}
3745
</script>
3846

3947
<div>
4048
<div class="flex justify-between items-center mb-1">
4149
<label for="commit-text" class="block text-sm font-medium">Commit Message</label>
42-
<AITrigger on:click={() => vscode.postMessage({ command: 'generateAiCommitForText' })} {disabled} {loading} />
50+
<AITrigger on:click={handleAIGenerate} {disabled} {loading} />
4351
</div>
4452
<textarea bind:this={textarea} id="commit-text" rows="4" bind:value on:input={autoGrow} placeholder="Write your commit message here..." class="w-full resize-none overflow-hidden"></textarea>
4553

0 commit comments

Comments
 (0)