mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-19 10:43:08 +00:00
Add orphaned features management routes and UI integration (#819)
* test(copilot): add edge case test for error with code field Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Changes from fix/bug-fixes-1-0 * refactor(auto-mode): enhance orphaned feature detection and improve project initialization - Updated detectOrphanedFeatures method to accept preloaded features, reducing redundant disk reads. - Improved project initialization by creating required directories and files in parallel for better performance. - Adjusted planning mode handling in UI components to clarify approval requirements for different modes. - Added refresh functionality for file editor tabs to ensure content consistency with disk state. These changes enhance performance, maintainability, and user experience across the application. * feat(orphaned-features): add orphaned features management routes and UI integration - Introduced new routes for managing orphaned features, including listing, resolving, and bulk resolving. - Updated the UI to include an Orphaned Features section in project settings and navigation. - Enhanced the execution service to support new orphaned feature functionalities. These changes improve the application's capability to handle orphaned features effectively, enhancing user experience and project management. * fix: Normalize line endings and resolve stale dirty states in file editor * chore: Update .gitignore and enhance orphaned feature handling - Added a blank line in .gitignore for better readability. - Introduced a hash to worktree paths in orphaned feature resolution to prevent conflicts. - Added validation for target branch existence during orphaned feature resolution. - Improved prompt formatting in execution service for clarity. - Enhanced error handling in project selector for project initialization failures. - Refactored orphaned features section to improve state management and UI responsiveness. These changes improve code maintainability and user experience when managing orphaned features. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -232,9 +232,10 @@ export class AutoModeServiceCompat {
|
||||
}
|
||||
|
||||
async detectOrphanedFeatures(
|
||||
projectPath: string
|
||||
projectPath: string,
|
||||
preloadedFeatures?: Feature[]
|
||||
): Promise<Array<{ feature: Feature; missingBranch: string }>> {
|
||||
const facade = this.createFacade(projectPath);
|
||||
return facade.detectOrphanedFeatures();
|
||||
return facade.detectOrphanedFeatures(preloadedFeatures);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,9 +463,25 @@ export class AutoModeServiceFacade {
|
||||
(pPath, featureId, status) =>
|
||||
featureStateManager.updateFeatureStatus(pPath, featureId, status),
|
||||
(pPath, featureId) => featureStateManager.loadFeature(pPath, featureId),
|
||||
async (_feature) => {
|
||||
// getPlanningPromptPrefixFn - planning prompts handled by AutoModeService
|
||||
return '';
|
||||
async (feature) => {
|
||||
// getPlanningPromptPrefixFn - select appropriate planning prompt based on feature's planningMode
|
||||
if (!feature.planningMode || feature.planningMode === 'skip') {
|
||||
return '';
|
||||
}
|
||||
const prompts = await getPromptCustomization(settingsService, '[PlanningPromptPrefix]');
|
||||
const autoModePrompts = prompts.autoMode;
|
||||
switch (feature.planningMode) {
|
||||
case 'lite':
|
||||
return feature.requirePlanApproval
|
||||
? autoModePrompts.planningLiteWithApproval + '\n\n'
|
||||
: autoModePrompts.planningLite + '\n\n';
|
||||
case 'spec':
|
||||
return autoModePrompts.planningSpec + '\n\n';
|
||||
case 'full':
|
||||
return autoModePrompts.planningFull + '\n\n';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
},
|
||||
(pPath, featureId, summary) =>
|
||||
featureStateManager.saveFeatureSummary(pPath, featureId, summary),
|
||||
@@ -1117,12 +1133,13 @@ export class AutoModeServiceFacade {
|
||||
|
||||
/**
|
||||
* Detect orphaned features (features with missing branches)
|
||||
* @param preloadedFeatures - Optional pre-loaded features to avoid redundant disk reads
|
||||
*/
|
||||
async detectOrphanedFeatures(): Promise<OrphanedFeatureInfo[]> {
|
||||
async detectOrphanedFeatures(preloadedFeatures?: Feature[]): Promise<OrphanedFeatureInfo[]> {
|
||||
const orphanedFeatures: OrphanedFeatureInfo[] = [];
|
||||
|
||||
try {
|
||||
const allFeatures = await this.featureLoader.getAll(this.projectPath);
|
||||
const allFeatures = preloadedFeatures ?? (await this.featureLoader.getAll(this.projectPath));
|
||||
const featuresWithBranches = allFeatures.filter(
|
||||
(f) => f.branchName && f.branchName.trim() !== ''
|
||||
);
|
||||
|
||||
@@ -108,16 +108,14 @@ export class ExecutionService {
|
||||
return firstLine.length <= 60 ? firstLine : firstLine.substring(0, 57) + '...';
|
||||
}
|
||||
|
||||
buildFeaturePrompt(
|
||||
feature: Feature,
|
||||
taskExecutionPrompts: {
|
||||
implementationInstructions: string;
|
||||
playwrightVerificationInstructions: string;
|
||||
}
|
||||
): string {
|
||||
/**
|
||||
* Build feature description section (without implementation instructions).
|
||||
* Used when planning mode is active — the planning prompt provides its own instructions.
|
||||
*/
|
||||
buildFeatureDescription(feature: Feature): string {
|
||||
const title = this.extractTitleFromDescription(feature.description);
|
||||
|
||||
let prompt = `## Feature Implementation Task
|
||||
let prompt = `## Feature Task
|
||||
|
||||
**Feature ID:** ${feature.id}
|
||||
**Title:** ${title}
|
||||
@@ -146,6 +144,18 @@ ${feature.spec}
|
||||
prompt += `\n**Context Images Attached:**\n${feature.imagePaths.length} image(s) attached:\n${imagesList}\n`;
|
||||
}
|
||||
|
||||
return prompt;
|
||||
}
|
||||
|
||||
buildFeaturePrompt(
|
||||
feature: Feature,
|
||||
taskExecutionPrompts: {
|
||||
implementationInstructions: string;
|
||||
playwrightVerificationInstructions: string;
|
||||
}
|
||||
): string {
|
||||
let prompt = this.buildFeatureDescription(feature);
|
||||
|
||||
prompt += feature.skipTests
|
||||
? `\n${taskExecutionPrompts.implementationInstructions}`
|
||||
: `\n${taskExecutionPrompts.implementationInstructions}\n\n${taskExecutionPrompts.playwrightVerificationInstructions}`;
|
||||
@@ -273,9 +283,15 @@ ${feature.spec}
|
||||
if (options?.continuationPrompt) {
|
||||
prompt = options.continuationPrompt;
|
||||
} else {
|
||||
prompt =
|
||||
(await this.getPlanningPromptPrefixFn(feature)) +
|
||||
this.buildFeaturePrompt(feature, prompts.taskExecution);
|
||||
const planningPrefix = await this.getPlanningPromptPrefixFn(feature);
|
||||
if (planningPrefix) {
|
||||
// Planning mode active: use planning instructions + feature description only.
|
||||
// Do NOT include implementationInstructions — they conflict with the planning
|
||||
// prompt's "DO NOT proceed with implementation until approval" directive.
|
||||
prompt = planningPrefix + '\n\n' + this.buildFeatureDescription(feature);
|
||||
} else {
|
||||
prompt = this.buildFeaturePrompt(feature, prompts.taskExecution);
|
||||
}
|
||||
if (feature.planningMode && feature.planningMode !== 'skip') {
|
||||
this.eventBus.emitAutoModeEvent('planning_started', {
|
||||
featureId: feature.id,
|
||||
|
||||
Reference in New Issue
Block a user