feat: Implement GitHub issue validation management and UI enhancements

- Introduced CRUD operations for GitHub issue validation results, including storage and retrieval.
- Added new endpoints for checking validation status, stopping validations, and deleting stored validations.
- Enhanced the GitHub routes to support validation management features.
- Updated the UI to display validation results and manage validation states for GitHub issues.
- Integrated event handling for validation progress and completion notifications.
This commit is contained in:
Kacper
2025-12-23 18:15:30 +01:00
parent 5f0ecc8dd6
commit 6acb751eb3
19 changed files with 1279 additions and 137 deletions

View File

@@ -13,6 +13,9 @@ export {
getImagesDir,
getContextDir,
getWorktreesDir,
getValidationsDir,
getValidationDir,
getValidationPath,
getAppSpecPath,
getBranchTrackingPath,
ensureAutomakerDir,

View File

@@ -111,6 +111,44 @@ export function getWorktreesDir(projectPath: string): string {
return path.join(getAutomakerDir(projectPath), 'worktrees');
}
/**
* Get the validations directory for a project
*
* Stores GitHub issue validation results, organized by issue number.
*
* @param projectPath - Absolute path to project directory
* @returns Absolute path to {projectPath}/.automaker/validations
*/
export function getValidationsDir(projectPath: string): string {
return path.join(getAutomakerDir(projectPath), 'validations');
}
/**
* Get the directory for a specific issue validation
*
* Contains validation result and metadata for a GitHub issue.
*
* @param projectPath - Absolute path to project directory
* @param issueNumber - GitHub issue number
* @returns Absolute path to {projectPath}/.automaker/validations/{issueNumber}
*/
export function getValidationDir(projectPath: string, issueNumber: number): string {
return path.join(getValidationsDir(projectPath), String(issueNumber));
}
/**
* Get the validation result file path for a GitHub issue
*
* Stores the JSON validation result including verdict, analysis, and metadata.
*
* @param projectPath - Absolute path to project directory
* @param issueNumber - GitHub issue number
* @returns Absolute path to {projectPath}/.automaker/validations/{issueNumber}/validation.json
*/
export function getValidationPath(projectPath: string, issueNumber: number): string {
return path.join(getValidationDir(projectPath, issueNumber), 'validation.json');
}
/**
* Get the app spec file path for a project
*

View File

@@ -24,6 +24,7 @@ export type EventType =
| 'project:analysis-completed'
| 'project:analysis-error'
| 'suggestions:event'
| 'spec-regeneration:event';
| 'spec-regeneration:event'
| 'issue-validation:event';
export type EventCallback = (type: EventType, payload: unknown) => void;

View File

@@ -92,4 +92,6 @@ export type {
IssueValidationResult,
IssueValidationResponse,
IssueValidationErrorResponse,
IssueValidationEvent,
StoredValidation,
} from './issue-validation.js';

View File

@@ -4,6 +4,8 @@
* Types for validating GitHub issues against the codebase using Claude SDK.
*/
import type { AgentModel } from './model.js';
/**
* Verdict from issue validation
*/
@@ -76,3 +78,49 @@ export interface IssueValidationErrorResponse {
success: false;
error: string;
}
/**
* Events emitted during async issue validation
*/
export type IssueValidationEvent =
| {
type: 'issue_validation_start';
issueNumber: number;
issueTitle: string;
projectPath: string;
}
| {
type: 'issue_validation_progress';
issueNumber: number;
content: string;
projectPath: string;
}
| {
type: 'issue_validation_complete';
issueNumber: number;
issueTitle: string;
result: IssueValidationResult;
projectPath: string;
}
| {
type: 'issue_validation_error';
issueNumber: number;
error: string;
projectPath: string;
};
/**
* Stored validation data with metadata for cache
*/
export interface StoredValidation {
/** GitHub issue number */
issueNumber: number;
/** Issue title at time of validation */
issueTitle: string;
/** ISO timestamp when validation was performed */
validatedAt: string;
/** Model used for validation (opus, sonnet, haiku) */
model: AgentModel;
/** The validation result */
result: IssueValidationResult;
}

View File

@@ -261,6 +261,8 @@ export interface GlobalSettings {
// AI Model Selection
/** Which model to use for feature name/description enhancement */
enhancementModel: AgentModel;
/** Which model to use for GitHub issue validation */
validationModel: AgentModel;
// Input Configuration
/** User's keyboard shortcut bindings */
@@ -437,6 +439,7 @@ export const DEFAULT_GLOBAL_SETTINGS: GlobalSettings = {
defaultAIProfileId: null,
muteDoneSound: false,
enhancementModel: 'sonnet',
validationModel: 'opus',
keyboardShortcuts: DEFAULT_KEYBOARD_SHORTCUTS,
aiProfiles: [],
projects: [],