mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
refactor(types): Use ModelProvider type instead of hardcoded union
Replace 'claude' | 'cursor' literal unions with ModelProvider type from @automaker/types for better extensibility when adding new providers. - Update ProviderFactory.getProviderNameForModel() return type - Update RunningFeature.provider type in auto-mode-service - Update getRunningAgents() return type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,16 +10,16 @@ import { BaseProvider } from './base-provider.js';
|
||||
import { ClaudeProvider } from './claude-provider.js';
|
||||
import { CursorProvider } from './cursor-provider.js';
|
||||
import type { InstallationStatus, ModelDefinition } from './types.js';
|
||||
import { CURSOR_MODEL_MAP } from '@automaker/types';
|
||||
import { CURSOR_MODEL_MAP, type ModelProvider } from '@automaker/types';
|
||||
|
||||
export class ProviderFactory {
|
||||
/**
|
||||
* Determine which provider to use for a given model
|
||||
*
|
||||
* @param model Model identifier
|
||||
* @returns Provider name ('claude' | 'cursor')
|
||||
* @returns Provider name (ModelProvider type)
|
||||
*/
|
||||
static getProviderNameForModel(model: string): 'claude' | 'cursor' {
|
||||
static getProviderNameForModel(model: string): ModelProvider {
|
||||
const lowerModel = model.toLowerCase();
|
||||
|
||||
// Check for explicit cursor prefix
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
import { ProviderFactory } from '../providers/provider-factory.js';
|
||||
import type { ExecuteOptions, Feature } from '@automaker/types';
|
||||
import type { ExecuteOptions, Feature, ModelProvider } from '@automaker/types';
|
||||
import {
|
||||
buildPromptWithImages,
|
||||
isAbortError,
|
||||
@@ -317,7 +317,7 @@ interface RunningFeature {
|
||||
isAutoMode: boolean;
|
||||
startTime: number;
|
||||
model?: string;
|
||||
provider?: 'claude' | 'cursor';
|
||||
provider?: ModelProvider;
|
||||
}
|
||||
|
||||
interface AutoLoopState {
|
||||
@@ -1238,7 +1238,7 @@ Format your response as a structured markdown document.`;
|
||||
projectName: string;
|
||||
isAutoMode: boolean;
|
||||
model?: string;
|
||||
provider?: 'claude' | 'cursor';
|
||||
provider?: ModelProvider;
|
||||
}> {
|
||||
return Array.from(this.runningFeatures.values()).map((rf) => ({
|
||||
featureId: rf.featureId,
|
||||
|
||||
Reference in New Issue
Block a user