Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/js/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,15 @@ export function generateAgentPrompt(answers, patterns) {
instructionSet.forEach((url) => { prompt += `- ${ url }\n`; });
prompt += '\n';
prompt += `The purpose of ${ multiple ? 'the workflows' : 'the workflow' } is: ${ description }\n\n`;
const intent = typeof answers.intent === 'string' ? answers.intent.trim() : '';
prompt += `First, analyze this repository so the ${ multiple ? 'workflows are' : 'workflow is' } optimized for it:\n`;
prompt += '- Read the README, AGENTS.md (and any CONTRIBUTING or docs files) to understand the project purpose and conventions\n';
prompt += '- Identify the languages, package managers, build/test/lint commands and CI setup actually used\n';
prompt += '- Note repository conventions such as labels, issue/PR templates and branch naming\n';
prompt += '- Use those findings to tailor the workflow prompt, tools, and instructions to this repository\n\n';
if (intent) {
prompt += `## Intent\n${ intent }\n\n`;
}
prompt += 'Requirements:\n';
if (multiple) {
prompt += `- Generate exactly ${ workflows.length } independent workflow files:\n`;
Expand Down Expand Up @@ -446,7 +450,6 @@ export function generateAgentPrompt(answers, patterns) {
duplicateTips.join('; ')
}\n`;
}
const intent = typeof answers.intent === 'string' ? answers.intent.trim() : '';
if (intent) {
intentRequirements(intent).forEach((requirement) => { prompt += `${requirement}\n`; });
}
Expand Down
13 changes: 12 additions & 1 deletion test/workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ describe('generateAgentPrompt', () => {
expect(prompt).toContain('id: operational_value');
expect(prompt).toContain('- Add BinEval evaluations for the intent');
expect(prompt).toContain('`evals:`');
expect(prompt.indexOf('Keep release notes accurate')).toBeGreaterThan(prompt.indexOf('Requirements:'));
expect(prompt.indexOf('## Intent')).toBeLessThan(prompt.indexOf('Requirements:'));
});

it('asks the agent to analyze the repository first', () => {
Expand Down Expand Up @@ -622,6 +622,17 @@ describe('generateAgentPrompt', () => {
expect(prompt).not.toContain('Your job is to read every newly opened issue');
});

it('adds the collected intent in a clearly labeled section', () => {
const prompt = generateAgentPrompt(
answers({ intent: 'Keep release notes accurate for on-call engineers.' }),
patterns
);

expect(prompt).toContain(
'## Intent\nKeep release notes accurate for on-call engineers.\n\n'
);
});

it('preserves explicit data-fetch settings in single-workflow suggestions', () => {
const prompt = generateAgentPrompt(
answers({ archetype: 'status-report', needsData: false }),
Expand Down