@@ -17,15 +17,25 @@ describe("aider", async () => {
1717 const testPrompt = "Add a hello world function" ;
1818 const state = await runTerraformApply ( import . meta. dir , {
1919 agent_id : "foo" ,
20+ task_prompt : testPrompt ,
2021 } ) ;
2122
2223 const instance = findResourceInstance ( state , "coder_script" ) ;
2324 expect ( instance . script ) . toContain (
24- 'if [ -n "$CODER_MCP_AIDER_TASK_PROMPT" ]' ,
25- ) ;
26- expect ( instance . script ) . toContain (
27- "aider --architect --yes-always --read CONVENTIONS.md --message" ,
25+ `This is your current task: ${ testPrompt } ` ,
2826 ) ;
27+ expect ( instance . script ) . toContain ( "aider --architect --yes-always" ) ;
28+ } ) ;
29+
30+ it ( "handles custom system prompt" , async ( ) => {
31+ const customPrompt = "Report all tasks with state: working" ;
32+ const state = await runTerraformApply ( import . meta. dir , {
33+ agent_id : "foo" ,
34+ system_prompt : customPrompt ,
35+ } ) ;
36+
37+ const instance = findResourceInstance ( state , "coder_script" ) ;
38+ expect ( instance . script ) . toContain ( customPrompt ) ;
2939 } ) ;
3040
3141 it ( "handles pre and post install scripts" , async ( ) => {
@@ -57,4 +67,41 @@ describe("aider", async () => {
5767 ) ;
5868 expect ( instance . script ) . toContain ( "exit 1" ) ;
5969 } ) ;
70+
71+ it ( "configures Aider with known provider and model" , async ( ) => {
72+ const state = await runTerraformApply ( import . meta. dir , {
73+ agent_id : "foo" ,
74+ ai_provider : "anthropic" ,
75+ ai_model : "sonnet" ,
76+ ai_api_key : "test-anthropic-key" ,
77+ } ) ;
78+
79+ const instance = findResourceInstance ( state , "coder_script" ) ;
80+ expect ( instance . script ) . toContain (
81+ 'export ANTHROPIC_API_KEY=\\"test-anthropic-key\\"' ,
82+ ) ;
83+ expect ( instance . script ) . toContain ( "--model sonnet" ) ;
84+ expect ( instance . script ) . toContain (
85+ "Starting Aider using anthropic provider and model: sonnet" ,
86+ ) ;
87+ } ) ;
88+
89+ it ( "handles custom provider with custom env var and API key" , async ( ) => {
90+ const state = await runTerraformApply ( import . meta. dir , {
91+ agent_id : "foo" ,
92+ ai_provider : "custom" ,
93+ custom_env_var_name : "MY_CUSTOM_API_KEY" ,
94+ ai_model : "custom-model" ,
95+ ai_api_key : "test-custom-key" ,
96+ } ) ;
97+
98+ const instance = findResourceInstance ( state , "coder_script" ) ;
99+ expect ( instance . script ) . toContain (
100+ 'export MY_CUSTOM_API_KEY=\\"test-custom-key\\"' ,
101+ ) ;
102+ expect ( instance . script ) . toContain ( "--model custom-model" ) ;
103+ expect ( instance . script ) . toContain (
104+ "Starting Aider using custom provider and model: custom-model" ,
105+ ) ;
106+ } ) ;
60107} ) ;
0 commit comments