mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
feat: enhance CodexProvider argument handling and configuration
- Added approval policy and web search features to the CodexProvider's argument construction, improving flexibility in command execution. - Updated unit tests to validate the new configuration handling for approval and search features, ensuring accurate argument parsing. These changes enhance the functionality of the CodexProvider, allowing for more dynamic command configurations and improving test coverage.
This commit is contained in:
@@ -743,13 +743,17 @@ export class CodexProvider extends BaseProvider {
|
||||
overrides.push({ key: CODEX_REASONING_EFFORT_KEY, value: options.reasoningEffort });
|
||||
}
|
||||
|
||||
// Add approval policy
|
||||
overrides.push({ key: 'approval_policy', value: approvalPolicy });
|
||||
|
||||
// Add web search if enabled
|
||||
if (searchEnabled) {
|
||||
overrides.push({ key: 'features.web_search_request', value: true });
|
||||
}
|
||||
|
||||
const configOverrides = buildConfigOverrides(overrides);
|
||||
const preExecArgs: string[] = [];
|
||||
|
||||
if (searchEnabled) {
|
||||
preExecArgs.push(CODEX_SEARCH_FLAG);
|
||||
}
|
||||
|
||||
// Add additional directories with write access
|
||||
if (codexSettings.additionalDirs && codexSettings.additionalDirs.length > 0) {
|
||||
for (const dir of codexSettings.additionalDirs) {
|
||||
@@ -760,8 +764,6 @@ export class CodexProvider extends BaseProvider {
|
||||
const args = [
|
||||
CODEX_EXEC_SUBCOMMAND,
|
||||
CODEX_SKIP_GIT_REPO_CHECK_FLAG,
|
||||
CODEX_APPROVAL_FLAG,
|
||||
approvalPolicy,
|
||||
...preExecArgs,
|
||||
CODEX_MODEL_FLAG,
|
||||
options.model,
|
||||
|
||||
@@ -187,15 +187,19 @@ describe('codex-provider.ts', () => {
|
||||
);
|
||||
|
||||
const call = vi.mocked(spawnJSONLProcess).mock.calls[0][0];
|
||||
const approvalIndex = call.args.indexOf('--ask-for-approval');
|
||||
const approvalConfigIndex = call.args.indexOf('--config');
|
||||
const execIndex = call.args.indexOf(EXEC_SUBCOMMAND);
|
||||
const searchIndex = call.args.indexOf('--search');
|
||||
expect(call.args[approvalIndex + 1]).toBe('never');
|
||||
expect(approvalIndex).toBeGreaterThan(-1);
|
||||
const searchConfigIndex = call.args.indexOf('--config');
|
||||
expect(call.args[approvalConfigIndex + 1]).toBe('approval_policy=never');
|
||||
expect(approvalConfigIndex).toBeGreaterThan(-1);
|
||||
expect(execIndex).toBeGreaterThan(-1);
|
||||
expect(approvalIndex).toBeGreaterThan(execIndex);
|
||||
expect(searchIndex).toBeGreaterThan(-1);
|
||||
expect(searchIndex).toBeGreaterThan(execIndex);
|
||||
expect(approvalConfigIndex).toBeGreaterThan(execIndex);
|
||||
// Search should be in config, not as direct flag
|
||||
const hasSearchConfig = call.args.some(
|
||||
(arg, index) =>
|
||||
arg === '--config' && call.args[index + 1] === 'features.web_search_request=true'
|
||||
);
|
||||
expect(hasSearchConfig).toBe(true);
|
||||
});
|
||||
|
||||
it('injects user and project instructions when auto-load is enabled', async () => {
|
||||
|
||||
Reference in New Issue
Block a user