fix: improve Cursor CLI implementation with type safety and security fixes

- Add getCliPath() public method to CursorProvider to avoid private field access
- Add path validation to cursor-config routes to prevent traversal attacks
- Add supportsVision field to CursorModelConfig (all false - CLI limitation)
- Consolidate duplicate types in providers/types.ts (re-export from @automaker/types)
- Add MCP servers warning log instead of error (not yet supported by Cursor CLI)
- Fix debug log type safety (replace 'as any' with proper type narrowing)
- Update docs to remove non-existent tier field, add supportsVision field
- Remove outdated TODO comment in sdk-options.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shirone
2026-01-03 03:35:33 +01:00
parent ec6d36bda5
commit 88aba360e3
7 changed files with 104 additions and 93 deletions

View File

@@ -46,7 +46,7 @@ export const CURSOR_MODEL_MAP: Record<CursorModelId, CursorModelConfig> = {
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'
supportsVision: false, // true if model supports image inputs (currently all false)
},
};
```
@@ -72,13 +72,13 @@ The new model will automatically appear in:
## 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 |
| 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 |
| `supportsVision` | `boolean` | Set `true` if model supports image inputs (all false currently) |
---
@@ -126,7 +126,7 @@ export const CURSOR_MODEL_MAP: Record<CursorModelId, CursorModelConfig> = {
label: 'Cursor Turbo',
description: 'Optimized for speed with good quality balance',
hasThinking: false,
tier: 'pro',
supportsVision: false,
},
};
```
@@ -151,4 +151,4 @@ After rebuilding, "Cursor Turbo" will appear in all model selection UIs.
- 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
- Currently all models have `supportsVision: false` as Cursor CLI doesn't pass images to models