Skip to content

Commit 1cb6af4

Browse files
shivasuryaclaude
andauthored
fix: Add TypeScript type annotations to generated model config (#370)
Fixed TypeScript compilation errors by adding proper type annotations to the model config generator. The generator now produces PROVIDER_INFO with Record<string, ...> type and includes documentation about re-exporting AIModel type. Also updated settings-manager to re-export AIModel type for use in other modules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 639178c commit 1cb6af4

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

extension/secureflow/packages/secureflow-cli/lib/generated/model-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
33
* Generated by scripts/generate-model-config.js from config/models.json
4-
* Last updated: 2025-11-15T04:48:13.557Z
4+
* Last updated: 2025-11-15T05:09:52.606Z
55
*/
66

77
const MODELS = [

extension/secureflow/packages/secureflow-cli/lib/generated/model-types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
33
* Generated by scripts/generate-model-config.js from config/models.json
4-
* Last updated: 2025-11-15T04:48:13.555Z
4+
* Last updated: 2025-11-15T05:09:52.605Z
55
*/
66

77
export type AIModel =

extension/secureflow/packages/secureflow-cli/lib/generated/model-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
33
* Generated by scripts/generate-model-config.js from config/models.json
4-
* Last updated: 2025-11-15T04:48:13.557Z
4+
* Last updated: 2025-11-15T05:09:52.606Z
55
*/
66

77
/**

extension/secureflow/packages/secureflow-cli/scripts/generate-model-config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,14 @@ function generateExtensionConfig() {
244244
const modelsArray = JSON.stringify(models, null, 2);
245245
const providerInfo = JSON.stringify(modelsConfig.providerInfo, null, 2);
246246
const modelIds = activeModels.map(m => ` | '${m.id}'`).join('\n');
247-
247+
248248
const content = `/**
249249
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
250250
* Generated by scripts/generate-model-config.js from config/models.json
251251
* Last updated: ${new Date().toISOString()}
252+
*
253+
* NOTE: If you need to use AIModel in other files, import it from this file
254+
* or re-export it (e.g., in settings-manager.ts: export type { AIModel } from './generated/model-config')
252255
*/
253256
254257
export type AIModel =
@@ -271,7 +274,7 @@ export interface ModelConfigType {
271274
272275
const MODELS: ModelConfigType[] = ${modelsArray};
273276
274-
const PROVIDER_INFO = ${providerInfo};
277+
const PROVIDER_INFO: Record<string, { name: string; apiKeyEnvVar: string | null }> = ${providerInfo};
275278
276279
/**
277280
* Model configuration manager for VS Code extension

extension/secureflow/src/generated/model-config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/**
22
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
33
* Generated by scripts/generate-model-config.js from config/models.json
4-
* Last updated: 2025-11-15T04:48:13.557Z
4+
* Last updated: 2025-11-15T05:09:52.606Z
5+
*
6+
* NOTE: If you need to use AIModel in other files, import it from this file
7+
* or re-export it (e.g., in settings-manager.ts: export type { AIModel } from './generated/model-config')
58
*/
69

710
export type AIModel =
@@ -363,7 +366,7 @@ const MODELS: ModelConfigType[] = [
363366
}
364367
];
365368

366-
const PROVIDER_INFO = {
369+
const PROVIDER_INFO: Record<string, { name: string; apiKeyEnvVar: string | null }> = {
367370
"openai": {
368371
"name": "OpenAI",
369372
"apiKeyEnvVar": "OPENAI_API_KEY"

extension/secureflow/src/settings/settings-manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import * as vscode from 'vscode';
1010
* Run `npm run generate:models` from the CLI package to update
1111
*/
1212

13-
// Import AIModel type from generated configuration
13+
// Import and re-export AIModel type from generated configuration
1414
import type { AIModel } from '../generated/model-config';
15+
export type { AIModel };
1516

1617
/**
1718
* Settings manager for SecureFlow extension

0 commit comments

Comments
 (0)