mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 13:34:15 -07:00
fix(core): enforce non-interactive flags for scaffolding commands
- Updated `newApplicationSteps` system prompt instructions to strongly require non-interactive flags (e.g. `--yes`, `-y`, or `--template`) when executing application scaffolding CLI tools. - Warned the model that omitting these flags for interactive tools will cause the environment to hang. - Added `ALWAYS_PASSES` evaluation case to `evals/interactive-hang.eval.ts` to assert that non-interactive flags are successfully provided for `npm create` and similar commands.
This commit is contained in:
@@ -44,4 +44,31 @@ describe('interactive_commands', () => {
|
||||
).toMatch(/\b(run|--run)\b/);
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Validates that the agent uses non-interactive flags when scaffolding a new project.
|
||||
*/
|
||||
evalTest('ALWAYS_PASSES', {
|
||||
name: 'should use non-interactive flags when scaffolding a new app',
|
||||
prompt: 'Create a new react application named my-app using vite.',
|
||||
assert: async (rig, result) => {
|
||||
const logs = rig.readToolLogs();
|
||||
const scaffoldCall = logs.find(
|
||||
(l) =>
|
||||
l.toolRequest.name === 'run_shell_command' &&
|
||||
/npm (init|create)|npx create-|yarn create|pnpm create/.test(
|
||||
l.toolRequest.args,
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
scaffoldCall,
|
||||
'Agent should have called a scaffolding command (e.g., npm create)',
|
||||
).toBeDefined();
|
||||
expect(
|
||||
scaffoldCall?.toolRequest.args,
|
||||
'Agent should have passed a non-interactive flag (-y, --yes, or a specific --template)',
|
||||
).toMatch(/(?:^|\s)(--yes|-y|--template\s+\S+)(?:\s|$|\\|")/);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user