From 0bcc8fca5d5fde566e9a2e1caa96522118bf4929 Mon Sep 17 00:00:00 2001 From: Shirone Date: Sun, 28 Dec 2025 01:50:18 +0100 Subject: [PATCH] docs: Add guide for integrating new Cursor models in AutoMaker - Created a comprehensive documentation file detailing the steps to add new Cursor CLI models to AutoMaker. - Included an overview of the necessary types and configurations, along with a step-by-step guide for model integration. - Provided examples and a checklist to ensure proper implementation and verification of new models in the UI. --- docs/ADDING_CURSOR_MODELS.md | 154 ++++++++++++++++++++++++++++++++ libs/types/src/cursor-models.ts | 8 ++ 2 files changed, 162 insertions(+) create mode 100644 docs/ADDING_CURSOR_MODELS.md diff --git a/docs/ADDING_CURSOR_MODELS.md b/docs/ADDING_CURSOR_MODELS.md new file mode 100644 index 00000000..f12828bf --- /dev/null +++ b/docs/ADDING_CURSOR_MODELS.md @@ -0,0 +1,154 @@ +# Adding New Cursor Models to AutoMaker + +This guide explains how to add new Cursor CLI models to AutoMaker. The process involves updating a single file with automatic propagation to the UI. + +## Overview + +Cursor models are defined in `libs/types/src/cursor-models.ts`. This file contains: + +- `CursorModelId` - Union type of all valid model IDs +- `CursorModelConfig` - Interface for model metadata +- `CURSOR_MODEL_MAP` - Record mapping model IDs to their configs + +The UI automatically reads from `CURSOR_MODEL_MAP`, so adding a model there makes it available everywhere. + +--- + +## Step-by-Step Guide + +### Step 1: Add the Model ID to the Type + +Open `libs/types/src/cursor-models.ts` and add your model ID to the `CursorModelId` union type: + +```typescript +export type CursorModelId = + | 'auto' + | 'claude-sonnet-4' + | 'claude-sonnet-4-thinking' + | 'composer-1' + | 'gpt-4o' + | 'gpt-4o-mini' + | 'gemini-2.5-pro' + | 'o3-mini' + | 'your-new-model'; // <-- Add your model here +``` + +### Step 2: Add the Model Config to the Map + +In the same file, add an entry to `CURSOR_MODEL_MAP`: + +```typescript +export const CURSOR_MODEL_MAP: Record = { + // ... existing models ... + + 'your-new-model': { + id: 'your-new-model', + label: 'Your New Model', // Display name in UI + description: 'Description of the model capabilities', + hasThinking: false, // true if model has built-in reasoning + tier: 'pro', // 'free' or 'pro' + }, +}; +``` + +### Step 3: Rebuild the Types Package + +After making changes, rebuild the types package: + +```bash +npm run build -w @automaker/types +``` + +### Step 4: Verify the Changes + +The new model will automatically appear in: + +- **Add Feature Dialog** > Model tab > Cursor CLI section +- **Edit Feature Dialog** > Model tab > Cursor CLI section +- **AI Profiles** > Create/Edit Profile > Cursor provider > Model selection +- **Settings** > Cursor tab > Model configuration + +--- + +## Model Config Fields + +| Field | Type | Description | +| ------------- | ----------------- | -------------------------------------------------- | +| `id` | `string` | Must match the key in the map and the CLI model ID | +| `label` | `string` | Human-readable name shown in UI | +| `description` | `string` | Tooltip/help text explaining the model | +| `hasThinking` | `boolean` | Set `true` if model has built-in extended thinking | +| `tier` | `'free' \| 'pro'` | Subscription tier required to use this model | + +--- + +## How It Works + +### Automatic UI Integration + +The UI components read from `CURSOR_MODEL_MAP` at runtime: + +1. **model-constants.ts** imports `CURSOR_MODEL_MAP` and creates `CURSOR_MODELS` array +2. **ModelSelector** component renders Cursor models from this array +3. **ProfileForm** component uses the map for Cursor model selection + +### Provider Routing + +When a feature uses a Cursor model: + +1. The model string is stored as `cursor-{modelId}` (e.g., `cursor-composer-1`) +2. `ProviderFactory.getProviderNameForModel()` detects the `cursor-` prefix +3. `CursorProvider` is used for execution +4. The model ID (without prefix) is passed to the Cursor CLI + +--- + +## Example: Adding a Hypothetical Model + +Let's add a hypothetical "cursor-turbo" model: + +```typescript +// In libs/types/src/cursor-models.ts + +// Step 1: Add to type +export type CursorModelId = + | 'auto' + | 'claude-sonnet-4' + // ... other models ... + | 'cursor-turbo'; // New model + +// Step 2: Add to map +export const CURSOR_MODEL_MAP: Record = { + // ... existing entries ... + + 'cursor-turbo': { + id: 'cursor-turbo', + label: 'Cursor Turbo', + description: 'Optimized for speed with good quality balance', + hasThinking: false, + tier: 'pro', + }, +}; +``` + +After rebuilding, "Cursor Turbo" will appear in all model selection UIs. + +--- + +## Checklist + +- [ ] Added model ID to `CursorModelId` type +- [ ] Added config entry to `CURSOR_MODEL_MAP` +- [ ] Rebuilt types package (`npm run build -w @automaker/types`) +- [ ] Verified model appears in Add Feature dialog +- [ ] Verified model appears in AI Profiles form +- [ ] Tested execution with new model (if Cursor CLI supports it) + +--- + +## Notes + +- The model ID must exactly match what Cursor CLI expects +- Check Cursor's documentation for available models: https://cursor.com/docs +- Models with `hasThinking: true` display a "Thinking" badge in the UI +- The `tier` field is informational and shown as a badge in selection UI diff --git a/libs/types/src/cursor-models.ts b/libs/types/src/cursor-models.ts index 861796d4..1792da7e 100644 --- a/libs/types/src/cursor-models.ts +++ b/libs/types/src/cursor-models.ts @@ -6,6 +6,7 @@ export type CursorModelId = | 'auto' // Auto-select best model | 'claude-sonnet-4' // Claude Sonnet 4 | 'claude-sonnet-4-thinking' // Claude Sonnet 4 with extended thinking + | 'composer-1' // Cursor Composer agent model | 'gpt-4o' // GPT-4o | 'gpt-4o-mini' // GPT-4o Mini | 'gemini-2.5-pro' // Gemini 2.5 Pro @@ -47,6 +48,13 @@ export const CURSOR_MODEL_MAP: Record = { hasThinking: true, tier: 'pro', }, + 'composer-1': { + id: 'composer-1', + label: 'Composer 1', + description: 'Cursor Composer agent model optimized for multi-file edits', + hasThinking: false, + tier: 'pro', + }, 'gpt-4o': { id: 'gpt-4o', label: 'GPT-4o',