Skip to content

Commit cda1a4d

Browse files
authored
Merge pull request #161 from drivecore/config-improvements
Config improvements: Rename variables and add warnings
2 parents c82916c + ef58590 commit cda1a4d

File tree

8 files changed

+58
-7
lines changed

8 files changed

+58
-7
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ jobs:
3939
run: cd packages/agent && pnpm exec playwright install --with-deps chromium
4040

4141
- name: Test
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
4245
run: pnpm test
4346

4447
- name: Lint

packages/cli/src/commands/$default.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,16 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
9696
tokenTracker.tokenCache =
9797
argv.tokenCache !== undefined ? argv.tokenCache : userConfig.tokenCache;
9898

99-
const userModelProvider = argv.modelProvider || userConfig.modelProvider;
100-
const userModelName = argv.modelName || userConfig.modelName;
99+
const userModelProvider =
100+
argv.provider ||
101+
argv.modelProvider ||
102+
userConfig.provider ||
103+
userConfig.modelProvider;
104+
const userModelName =
105+
argv.model ||
106+
argv.modelName ||
107+
userConfig.model ||
108+
userConfig.modelName;
101109
const userMaxTokens = argv.maxTokens || userConfig.maxTokens;
102110
const userTemperature = argv.temperature || userConfig.temperature;
103111

packages/cli/src/commands/config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,16 @@ export const command: CommandModule<SharedOptions, ConfigOptions> = {
146146
return;
147147
}
148148

149-
// Validate that the key exists in default config
149+
// Check if the key exists in default config
150150
const defaultConfig = getDefaultConfig();
151151
if (!(argv.key in defaultConfig)) {
152-
logger.error(`Invalid configuration key '${argv.key}'`);
152+
logger.warn(
153+
`Warning: '${argv.key}' is not a standard configuration key`,
154+
);
153155
logger.info(
154156
`Valid configuration keys: ${Object.keys(defaultConfig).join(', ')}`,
155157
);
156-
return;
158+
// Continue with the operation instead of returning
157159
}
158160

159161
// Check if this is an API key and add a warning

packages/cli/src/options.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export type SharedOptions = {
77
readonly userSession?: boolean;
88
readonly pageFilter?: 'simple' | 'none' | 'readability';
99
readonly sentryDsn?: string;
10+
readonly provider?: string;
11+
readonly model?: string;
12+
// Legacy options - will be removed in a future version
1013
readonly modelProvider?: string;
1114
readonly modelName?: string;
1215
readonly maxTokens?: number;
@@ -28,15 +31,27 @@ export const sharedOptions = {
2831
description: 'Enable performance profiling of CLI startup',
2932
default: false,
3033
} as const,
31-
modelProvider: {
34+
provider: {
3235
type: 'string',
3336
description: 'AI model provider to use',
3437
choices: ['anthropic', 'openai', 'ollama', 'xai', 'mistral'],
3538
} as const,
36-
modelName: {
39+
model: {
3740
type: 'string',
3841
description: 'AI model name to use',
3942
} as const,
43+
// Legacy options - will be removed in a future version
44+
modelProvider: {
45+
type: 'string',
46+
description: 'AI model provider to use (deprecated, use provider instead)',
47+
choices: ['anthropic', 'openai', 'ollama', 'xai', 'mistral'],
48+
hidden: true,
49+
} as const,
50+
modelName: {
51+
type: 'string',
52+
description: 'AI model name to use (deprecated, use model instead)',
53+
hidden: true,
54+
} as const,
4055
maxTokens: {
4156
type: 'number',
4257
description: 'Maximum number of tokens to generate',

packages/cli/src/settings/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const defaultConfig = {
1212
headless: true,
1313
userSession: false,
1414
pageFilter: 'none' as 'simple' | 'none' | 'readability',
15+
provider: 'anthropic',
16+
model: 'claude-3-7-sonnet-20250219',
17+
// Legacy names - will be removed in a future version
1518
modelProvider: 'anthropic',
1619
modelName: 'claude-3-7-sonnet-20250219',
1720
maxTokens: 4096,

packages/cli/tests/settings/config-defaults.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ describe('Config Defaults for CLI Options', () => {
5858
headless: true,
5959
userSession: false,
6060
pageFilter: 'none',
61+
provider: 'anthropic',
62+
model: 'claude-3-7-sonnet-20250219',
6163
modelProvider: 'anthropic',
6264
modelName: 'claude-3-7-sonnet-20250219',
6365
ollamaBaseUrl: 'http://localhost:11434/api',
@@ -95,6 +97,8 @@ describe('Config Defaults for CLI Options', () => {
9597
headless: true, // Default is true
9698
userSession: false, // Default is false
9799
pageFilter: 'none', // Default is none
100+
provider: 'anthropic',
101+
model: 'claude-3-7-sonnet-20250219',
98102
modelProvider: 'anthropic',
99103
modelName: 'claude-3-7-sonnet-20250219',
100104
ollamaBaseUrl: 'http://localhost:11434/api',
@@ -132,6 +136,8 @@ describe('Config Defaults for CLI Options', () => {
132136
headless: true,
133137
userSession: false,
134138
pageFilter: 'none',
139+
provider: 'anthropic',
140+
model: 'claude-3-7-sonnet-20250219',
135141
modelProvider: 'anthropic',
136142
modelName: 'claude-3-7-sonnet-20250219',
137143
ollamaBaseUrl: 'http://localhost:11434/api',
@@ -181,6 +187,8 @@ describe('Config Defaults for CLI Options', () => {
181187
headless: true, // Default is true
182188
userSession: false, // Default is false
183189
pageFilter: 'none', // Default is none
190+
provider: 'anthropic',
191+
model: 'claude-3-7-sonnet-20250219',
184192
modelProvider: 'anthropic',
185193
modelName: 'claude-3-7-sonnet-20250219',
186194
ollamaBaseUrl: 'http://localhost:11434/api',

packages/cli/tests/settings/config.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ describe('Config', () => {
4141
headless: true,
4242
userSession: false,
4343
pageFilter: 'none',
44+
provider: 'anthropic',
45+
model: 'claude-3-7-sonnet-20250219',
4446
modelProvider: 'anthropic',
4547
modelName: 'claude-3-7-sonnet-20250219',
4648
maxTokens: 4096,
@@ -83,6 +85,8 @@ describe('Config', () => {
8385
headless: true,
8486
userSession: false,
8587
pageFilter: 'none',
88+
provider: 'anthropic',
89+
model: 'claude-3-7-sonnet-20250219',
8690
modelProvider: 'anthropic',
8791
modelName: 'claude-3-7-sonnet-20250219',
8892
maxTokens: 4096,

packages/cli/tests/settings/configDefaults.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ describe('Config Defaults for CLI Options', () => {
5858
headless: true,
5959
userSession: false,
6060
pageFilter: 'none',
61+
provider: 'anthropic',
62+
model: 'claude-3-7-sonnet-20250219',
6163
modelProvider: 'anthropic',
6264
modelName: 'claude-3-7-sonnet-20250219',
6365
ollamaBaseUrl: 'http://localhost:11434/api',
@@ -95,6 +97,8 @@ describe('Config Defaults for CLI Options', () => {
9597
headless: true, // Default is true
9698
userSession: false, // Default is false
9799
pageFilter: 'none', // Default is none
100+
provider: 'anthropic',
101+
model: 'claude-3-7-sonnet-20250219',
98102
modelProvider: 'anthropic',
99103
modelName: 'claude-3-7-sonnet-20250219',
100104
ollamaBaseUrl: 'http://localhost:11434/api',
@@ -132,6 +136,8 @@ describe('Config Defaults for CLI Options', () => {
132136
headless: true,
133137
userSession: false,
134138
pageFilter: 'none',
139+
provider: 'anthropic',
140+
model: 'claude-3-7-sonnet-20250219',
135141
modelProvider: 'anthropic',
136142
modelName: 'claude-3-7-sonnet-20250219',
137143
ollamaBaseUrl: 'http://localhost:11434/api',
@@ -181,6 +187,8 @@ describe('Config Defaults for CLI Options', () => {
181187
headless: true, // Default is true
182188
userSession: false, // Default is false
183189
pageFilter: 'none', // Default is none
190+
provider: 'anthropic',
191+
model: 'claude-3-7-sonnet-20250219',
184192
modelProvider: 'anthropic',
185193
modelName: 'claude-3-7-sonnet-20250219',
186194
ollamaBaseUrl: 'http://localhost:11434/api',

0 commit comments

Comments
 (0)