Skip to content

Commit e8d07af

Browse files
committed
fix: template initialization
- Initialize template cache during agent setup to avoid redundant fetches - Remove redundant project name prompt from template selection - Clean up default projectType fallback logic
1 parent 2aea3c7 commit e8d07af

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

worker/agents/core/behaviors/base.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,15 @@ export abstract class BaseCodingBehavior<TState extends BaseProjectState>
7878
}
7979

8080
public async initialize(
81-
_initArgs: AgentInitArgs,
81+
initArgs: AgentInitArgs,
8282
..._args: unknown[]
8383
): Promise<TState> {
8484
this.logger.info("Initializing agent");
85+
const {templateInfo} = initArgs;
86+
if (templateInfo) {
87+
this.templateDetailsCache = templateInfo.templateDetails;
88+
}
89+
await this.ensureTemplateDetails();
8590
return this.state;
8691
}
8792

worker/agents/git/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class GitVersionControl {
9393
}
9494
}
9595

96-
console.log(`[Git] Staged ${files.length} files`, files);
96+
console.log(`[Git] Staged ${files.length} files: ${files.map(f => f.filePath).join(', ')}`);
9797
}
9898

9999
private normalizePath(path: string): string {

worker/agents/planning/templateSelector.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export async function selectTemplate({ env, query, projectType, availableTemplat
195195
useCase: null,
196196
complexity: null,
197197
styleSelection: null,
198-
projectType: actualProjectType || 'app'
198+
projectType: actualProjectType
199199
};
200200
}
201201

@@ -242,7 +242,6 @@ Template detail: ${templateDescriptions}
242242
1. Template name (exact match from list)
243243
2. Clear reasoning for why it fits the user's needs
244244
${actualProjectType === 'app' ? '3. Appropriate style for the project type. Try to come up with unique styles that might look nice and unique. Be creative about your choices. But don\'t pick brutalist all the time.' : ''}
245-
${actualProjectType === 'app' ? '4' : '3'}. Descriptive project name
246245
247246
Analyze each template's features, frameworks, and architecture to make the best match.
248247
${images && images.length > 0 ? `\n**Note:** User provided ${images.length} image(s) - consider visual requirements and UI style from the images.` : ''}

0 commit comments

Comments
 (0)