More cleanup

This commit is contained in:
Matt Rubens 2025-03-05 09:43:24 -05:00
parent 96945cd004
commit c3da5b0aa3
2 changed files with 12 additions and 110 deletions

View file

@ -182,16 +182,6 @@ jest.mock("../../../utils/sound", () => ({
setSoundEnabled: jest.fn(),
}))
// Mock logger
jest.mock("../../../utils/logging", () => ({
logger: {
debug: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
info: jest.fn(),
},
}))
// Mock ESM modules
jest.mock("p-wait-for", () => ({
__esModule: true,
@ -1527,7 +1517,6 @@ describe("ClineProvider", () => {
apiConfiguration: testApiConfig,
})
// Reset jest.mock calls tracking
// Verify config was saved
expect(provider.configManager.saveConfig).toHaveBeenCalledWith("test-config", testApiConfig)
@ -1538,9 +1527,6 @@ describe("ClineProvider", () => {
expect(mockContextProxy.updateGlobalState).toHaveBeenCalledWith("listApiConfigMeta", [
{ name: "test-config", id: "test-id", apiProvider: "anthropic" },
])
// Reset jest.mock calls tracking for subsequent tests
jest.clearAllMocks()
})
})
})

View file

@ -1,19 +1,5 @@
export type SecretKey =
| "apiKey"
| "glamaApiKey"
| "openRouterApiKey"
| "awsAccessKey"
| "awsSecretKey"
| "awsSessionToken"
| "openAiApiKey"
| "geminiApiKey"
| "openAiNativeApiKey"
| "deepSeekApiKey"
| "mistralApiKey"
| "unboundApiKey"
| "requestyApiKey"
export const SECRET_KEYS: SecretKey[] = [
// Define the array first with 'as const' to create a readonly tuple type
export const SECRET_KEYS = [
"apiKey",
"glamaApiKey",
"openRouterApiKey",
@ -27,87 +13,13 @@ export const SECRET_KEYS: SecretKey[] = [
"mistralApiKey",
"unboundApiKey",
"requestyApiKey",
]
] as const
export type GlobalStateKey =
| "apiProvider"
| "apiModelId"
| "glamaModelId"
| "glamaModelInfo"
| "awsRegion"
| "awsUseCrossRegionInference"
| "awsProfile"
| "awsUseProfile"
| "vertexProjectId"
| "vertexRegion"
| "lastShownAnnouncementId"
| "customInstructions"
| "alwaysAllowReadOnly"
| "alwaysAllowWrite"
| "alwaysAllowExecute"
| "alwaysAllowBrowser"
| "alwaysAllowMcp"
| "alwaysAllowModeSwitch"
| "taskHistory"
| "openAiBaseUrl"
| "openAiModelId"
| "openAiCustomModelInfo"
| "openAiUseAzure"
| "ollamaModelId"
| "ollamaBaseUrl"
| "lmStudioModelId"
| "lmStudioBaseUrl"
| "lmStudioDraftModelId"
| "lmStudioSpeculativeDecodingEnabled"
| "anthropicBaseUrl"
| "azureApiVersion"
| "openAiStreamingEnabled"
| "openRouterModelId"
| "openRouterModelInfo"
| "openRouterBaseUrl"
| "openRouterUseMiddleOutTransform"
| "allowedCommands"
| "soundEnabled"
| "soundVolume"
| "diffEnabled"
| "enableCheckpoints"
| "checkpointStorage"
| "browserViewportSize"
| "screenshotQuality"
| "fuzzyMatchThreshold"
| "preferredLanguage" // Language setting for Cline's communication
| "writeDelayMs"
| "terminalOutputLineLimit"
| "mcpEnabled"
| "enableMcpServerCreation"
| "alwaysApproveResubmit"
| "requestDelaySeconds"
| "rateLimitSeconds"
| "currentApiConfigName"
| "listApiConfigMeta"
| "vsCodeLmModelSelector"
| "mode"
| "modeApiConfigs"
| "customModePrompts"
| "customSupportPrompts"
| "enhancementApiConfigId"
| "experiments" // Map of experiment IDs to their enabled state
| "autoApprovalEnabled"
| "customModes" // Array of custom modes
| "unboundModelId"
| "requestyModelId"
| "requestyModelInfo"
| "unboundModelInfo"
| "modelTemperature"
| "modelMaxTokens"
| "modelMaxThinkingTokens"
| "mistralCodestralUrl"
| "maxOpenTabsContext"
| "browserToolEnabled"
| "lmStudioSpeculativeDecodingEnabled"
| "lmStudioDraftModelId"
// Derive the type from the array - creates a union of string literals
export type SecretKey = (typeof SECRET_KEYS)[number]
export const GLOBAL_STATE_KEYS: GlobalStateKey[] = [
// Define the array first with 'as const' to create a readonly tuple type
export const GLOBAL_STATE_KEYS = [
"apiProvider",
"apiModelId",
"glamaModelId",
@ -148,6 +60,7 @@ export const GLOBAL_STATE_KEYS: GlobalStateKey[] = [
"soundVolume",
"diffEnabled",
"enableCheckpoints",
"checkpointStorage",
"browserViewportSize",
"screenshotQuality",
"fuzzyMatchThreshold",
@ -181,4 +94,7 @@ export const GLOBAL_STATE_KEYS: GlobalStateKey[] = [
"browserToolEnabled",
"lmStudioSpeculativeDecodingEnabled",
"lmStudioDraftModelId",
]
] as const
// Derive the type from the array - creates a union of string literals
export type GlobalStateKey = (typeof GLOBAL_STATE_KEYS)[number]