Feature Dependency Rework & Options Setting

This commit is contained in:
trueheads
2025-12-16 21:02:42 -06:00
parent e8e79d8446
commit f302234b0e
9 changed files with 691 additions and 117 deletions

View File

@@ -5,6 +5,7 @@ import { getElectronAPI } from "@/lib/electron";
import { toast } from "sonner";
import { useAutoMode } from "@/hooks/use-auto-mode";
import { truncateDescription } from "@/lib/utils";
import { getBlockingDependencies } from "@/lib/dependency-resolver";
interface UseBoardActionsProps {
currentProject: { path: string; id: string } | null;
@@ -53,7 +54,7 @@ export function useBoardActions({
inProgressFeaturesForShortcuts,
outputFeature,
}: UseBoardActionsProps) {
const { addFeature, updateFeature, removeFeature, moveFeature, useWorktrees } = useAppStore();
const { addFeature, updateFeature, removeFeature, moveFeature, useWorktrees, enableDependencyBlocking } = useAppStore();
const autoMode = useAutoMode();
const handleAddFeature = useCallback(
@@ -188,6 +189,21 @@ export function useBoardActions({
return false;
}
// Check for blocking dependencies and show warning if enabled
if (enableDependencyBlocking) {
const blockingDeps = getBlockingDependencies(feature, features);
if (blockingDeps.length > 0) {
const depDescriptions = blockingDeps.map(depId => {
const dep = features.find(f => f.id === depId);
return dep ? truncateDescription(dep.description, 40) : depId;
}).join(", ");
toast.warning("Starting feature with incomplete dependencies", {
description: `This feature depends on: ${depDescriptions}`,
});
}
}
const updates = {
status: "in_progress" as const,
startedAt: new Date().toISOString(),
@@ -198,7 +214,7 @@ export function useBoardActions({
await handleRunFeature(feature);
return true;
},
[autoMode, updateFeature, persistFeatureUpdate, handleRunFeature]
[autoMode, enableDependencyBlocking, features, updateFeature, persistFeatureUpdate, handleRunFeature]
);
const handleVerifyFeature = useCallback(