# Publishing to Cursor Marketplace

This guide will walk you through publishing your Cerebras Code Completion extension to the Cursor marketplace.

## Prerequisites

1. **Microsoft Account**: You need a Microsoft account to publish extensions
2. **Publisher Account**: Create a publisher account on the Visual Studio Marketplace
3. **VS Code Extension Packager (vsce)**: Install the packaging tool

## Step 1: Install vsce

```bash
npm install -g @vscode/vsce
```

## Step 2: Create Publisher Account

1. Go to [Visual Studio Marketplace](https://marketplace.visualstudio.com/)
2. Click "Publish extensions"
3. Sign in with your Microsoft account
4. Create a new publisher account
5. Note your publisher ID (you'll need this)

## Step 3: Update Configuration

1. **Update `package.json`**:
   - Replace `"your-publisher-name"` with your actual publisher ID
   - Update the repository URLs with your actual GitHub repository
   - Update version number as needed

2. **Create Extension Icon**:
   - Create a `images/` folder
   - Add a 128x128 PNG icon named `icon.png`
   - This will be displayed in the marketplace

## Step 4: Test Your Extension

1. **Package the extension**:
   ```bash
   npm run package
   ```

2. **Install locally for testing**:
   - In Cursor, go to Extensions (Ctrl+Shift+X)
   - Click the "..." menu and select "Install from VSIX"
   - Select your generated `.vsix` file

3. **Test functionality**:
   - Set your `CEREBRAS_API_KEY` environment variable
   - Try the code completion feature
   - Verify everything works correctly

## Step 5: Publish to Marketplace

1. **Login to vsce**:
   ```bash
   vsce login your-publisher-name
   ```

2. **Publish the extension**:
   ```bash
   npm run publish
   ```

3. **Verify publication**:
   - Check the marketplace listing
   - Test installation from the marketplace
   - Verify all features work correctly

## Step 6: Update and Maintain

### Updating the Extension

1. **Increment version** in `package.json`
2. **Make your changes**
3. **Test thoroughly**
4. **Publish update**:
   ```bash
   npm run publish
   ```

### Best Practices

1. **Version Management**:
   - Use semantic versioning (MAJOR.MINOR.PATCH)
   - Document changes in CHANGELOG.md

2. **Testing**:
   - Test on different operating systems
   - Test with various file types
   - Test error scenarios

3. **Documentation**:
   - Keep README.md updated
   - Include clear setup instructions
   - Document any breaking changes

## Troubleshooting

### Common Issues

1. **Authentication Errors**:
   - Ensure you're logged in with the correct publisher account
   - Check that your publisher ID matches

2. **Package Errors**:
   - Verify all required files are present
   - Check that `.vscodeignore` excludes unnecessary files

3. **Installation Issues**:
   - Test the VSIX file locally first
   - Verify all dependencies are included

### Support

- **Marketplace Support**: [Visual Studio Marketplace Help](https://docs.microsoft.com/en-us/azure/devops/extend/publish/overview)
- **Extension Development**: [VS Code Extension API](https://code.visualstudio.com/api)

## Marketing Your Extension

1. **Create a compelling description** in `package.json`
2. **Add screenshots** to your marketplace listing
3. **Include usage examples** in your README
4. **Add appropriate tags** for discoverability
5. **Consider creating a demo video**

## Legal Considerations

- Ensure you have the right to use the Cerebras API
- Include appropriate disclaimers about API usage
- Consider privacy implications of code being sent to external APIs
- Include terms of service and privacy policy if needed 