Context
The AI generation workflow currently lacks awareness of project-specific Issue and Pull Request templates, resulting in content that may not align with project standards. Additionally, the parsing of AI responses has proven fragile, necessitating strict JSON schema enforcement to prevent formatting errors and ensure reliable output parsing.
Technical Details
- Integrated
IssueTemplateService into PRService and IssueGeneratorService to support auto-detection and usage of templates.
- Refactored AI prompts in
internal/ai/prompts.go to include strict JSON schemas, type rules, and prohibited actions.
- Implemented logic to format and inject template instructions dynamically into AI prompts via
FormatTemplateForPrompt.
- Added support for discovering and loading PR templates from
.github/PULL_REQUEST_TEMPLATE.
- Updated dependency injection in
cmd/main.go to wire the template service correctly.
- Added extensive unit tests covering prompt rendering, template integration, and service logic.
Impact
- Standardization: AI-generated content now automatically adheres to the structure defined in project templates.
- Reliability: Strict JSON enforcement eliminates parsing failures caused by malformed AI responses.
- Efficiency: Reduces manual editing time by producing compliant content straight from the generation step.
Related PR: #64
Context
The AI generation workflow currently lacks awareness of project-specific Issue and Pull Request templates, resulting in content that may not align with project standards. Additionally, the parsing of AI responses has proven fragile, necessitating strict JSON schema enforcement to prevent formatting errors and ensure reliable output parsing.
Technical Details
IssueTemplateServiceintoPRServiceandIssueGeneratorServiceto support auto-detection and usage of templates.internal/ai/prompts.goto include strict JSON schemas, type rules, and prohibited actions.FormatTemplateForPrompt..github/PULL_REQUEST_TEMPLATE.cmd/main.goto wire the template service correctly.Impact
Related PR: #64