mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
feat(backlog): add branchName support to apply handler and UI components
- Updated apply handler to accept an optional branchName from the request body. - Modified BoardView and BacklogPlanDialog components to pass currentBranch to the apply API. - Enhanced ElectronAPI and HttpApiClient to include branchName in the apply method. This change allows users to specify a branch when applying backlog plans, improving flexibility in feature management.
This commit is contained in:
@@ -12,9 +12,10 @@ const featureLoader = new FeatureLoader();
|
|||||||
export function createApplyHandler() {
|
export function createApplyHandler() {
|
||||||
return async (req: Request, res: Response): Promise<void> => {
|
return async (req: Request, res: Response): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const { projectPath, plan } = req.body as {
|
const { projectPath, plan, branchName } = req.body as {
|
||||||
projectPath: string;
|
projectPath: string;
|
||||||
plan: BacklogPlanResult;
|
plan: BacklogPlanResult;
|
||||||
|
branchName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!projectPath) {
|
if (!projectPath) {
|
||||||
@@ -82,6 +83,7 @@ export function createApplyHandler() {
|
|||||||
dependencies: change.feature.dependencies,
|
dependencies: change.feature.dependencies,
|
||||||
priority: change.feature.priority,
|
priority: change.feature.priority,
|
||||||
status: 'backlog',
|
status: 'backlog',
|
||||||
|
branchName,
|
||||||
});
|
});
|
||||||
|
|
||||||
appliedChanges.push(`added:${newFeature.id}`);
|
appliedChanges.push(`added:${newFeature.id}`);
|
||||||
|
|||||||
@@ -1449,6 +1449,7 @@ export function BoardView() {
|
|||||||
setPendingPlanResult={setPendingBacklogPlan}
|
setPendingPlanResult={setPendingBacklogPlan}
|
||||||
isGeneratingPlan={isGeneratingPlan}
|
isGeneratingPlan={isGeneratingPlan}
|
||||||
setIsGeneratingPlan={setIsGeneratingPlan}
|
setIsGeneratingPlan={setIsGeneratingPlan}
|
||||||
|
currentBranch={selectedWorktreeBranch}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Plan Approval Dialog */}
|
{/* Plan Approval Dialog */}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ interface BacklogPlanDialogProps {
|
|||||||
setPendingPlanResult: (result: BacklogPlanResult | null) => void;
|
setPendingPlanResult: (result: BacklogPlanResult | null) => void;
|
||||||
isGeneratingPlan: boolean;
|
isGeneratingPlan: boolean;
|
||||||
setIsGeneratingPlan: (generating: boolean) => void;
|
setIsGeneratingPlan: (generating: boolean) => void;
|
||||||
|
// Branch to use for created features (defaults to main if not provided)
|
||||||
|
currentBranch?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type DialogMode = 'input' | 'review' | 'applying';
|
type DialogMode = 'input' | 'review' | 'applying';
|
||||||
@@ -76,6 +78,7 @@ export function BacklogPlanDialog({
|
|||||||
setPendingPlanResult,
|
setPendingPlanResult,
|
||||||
isGeneratingPlan,
|
isGeneratingPlan,
|
||||||
setIsGeneratingPlan,
|
setIsGeneratingPlan,
|
||||||
|
currentBranch,
|
||||||
}: BacklogPlanDialogProps) {
|
}: BacklogPlanDialogProps) {
|
||||||
const [mode, setMode] = useState<DialogMode>('input');
|
const [mode, setMode] = useState<DialogMode>('input');
|
||||||
const [prompt, setPrompt] = useState('');
|
const [prompt, setPrompt] = useState('');
|
||||||
@@ -167,7 +170,7 @@ export function BacklogPlanDialog({
|
|||||||
}) || [],
|
}) || [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await api.backlogPlan.apply(projectPath, filteredPlanResult);
|
const result = await api.backlogPlan.apply(projectPath, filteredPlanResult, currentBranch);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
toast.success(`Applied ${result.appliedChanges?.length || 0} changes`);
|
toast.success(`Applied ${result.appliedChanges?.length || 0} changes`);
|
||||||
setPendingPlanResult(null);
|
setPendingPlanResult(null);
|
||||||
@@ -184,6 +187,7 @@ export function BacklogPlanDialog({
|
|||||||
setPendingPlanResult,
|
setPendingPlanResult,
|
||||||
onPlanApplied,
|
onPlanApplied,
|
||||||
onClose,
|
onClose,
|
||||||
|
currentBranch,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const handleDiscard = useCallback(() => {
|
const handleDiscard = useCallback(() => {
|
||||||
|
|||||||
@@ -651,7 +651,8 @@ export interface ElectronAPI {
|
|||||||
removedDependencies: string[];
|
removedDependencies: string[];
|
||||||
addedDependencies: string[];
|
addedDependencies: string[];
|
||||||
}>;
|
}>;
|
||||||
}
|
},
|
||||||
|
branchName?: string
|
||||||
) => Promise<{ success: boolean; appliedChanges?: string[]; error?: string }>;
|
) => Promise<{ success: boolean; appliedChanges?: string[]; error?: string }>;
|
||||||
onEvent: (callback: (data: unknown) => void) => () => void;
|
onEvent: (callback: (data: unknown) => void) => () => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2202,9 +2202,10 @@ export class HttpApiClient implements ElectronAPI {
|
|||||||
removedDependencies: string[];
|
removedDependencies: string[];
|
||||||
addedDependencies: string[];
|
addedDependencies: string[];
|
||||||
}>;
|
}>;
|
||||||
}
|
},
|
||||||
|
branchName?: string
|
||||||
): Promise<{ success: boolean; appliedChanges?: string[]; error?: string }> =>
|
): Promise<{ success: boolean; appliedChanges?: string[]; error?: string }> =>
|
||||||
this.post('/api/backlog-plan/apply', { projectPath, plan }),
|
this.post('/api/backlog-plan/apply', { projectPath, plan, branchName }),
|
||||||
|
|
||||||
onEvent: (callback: (data: unknown) => void): (() => void) => {
|
onEvent: (callback: (data: unknown) => void): (() => void) => {
|
||||||
return this.subscribeToEvent('backlog-plan:event', callback as EventCallback);
|
return this.subscribeToEvent('backlog-plan:event', callback as EventCallback);
|
||||||
|
|||||||
Reference in New Issue
Block a user