orbital-command 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +396 -0
- package/bin/orbital.js +362 -0
- package/dist/assets/WorkflowVisualizer-BZ21PIIF.js +84 -0
- package/dist/assets/WorkflowVisualizer-BZV40eAE.css +1 -0
- package/dist/assets/charts-D__PA1zp.js +72 -0
- package/dist/assets/index-D1G6i0nS.css +1 -0
- package/dist/assets/index-DpItvKpf.js +419 -0
- package/dist/assets/ui-BvF022GT.js +53 -0
- package/dist/assets/vendor-Dzv9lrRc.js +59 -0
- package/dist/index.html +19 -0
- package/dist/scanner-sweep.png +0 -0
- package/dist/server/server/adapters/index.js +34 -0
- package/dist/server/server/adapters/iterm2-adapter.js +29 -0
- package/dist/server/server/adapters/subprocess-adapter.js +21 -0
- package/dist/server/server/adapters/terminal-adapter.js +1 -0
- package/dist/server/server/config.js +156 -0
- package/dist/server/server/database.js +90 -0
- package/dist/server/server/index.js +372 -0
- package/dist/server/server/init.js +811 -0
- package/dist/server/server/parsers/event-parser.js +64 -0
- package/dist/server/server/parsers/scope-parser.js +188 -0
- package/dist/server/server/routes/config-routes.js +163 -0
- package/dist/server/server/routes/data-routes.js +461 -0
- package/dist/server/server/routes/dispatch-routes.js +215 -0
- package/dist/server/server/routes/git-routes.js +92 -0
- package/dist/server/server/routes/scope-routes.js +215 -0
- package/dist/server/server/routes/sprint-routes.js +116 -0
- package/dist/server/server/routes/version-routes.js +130 -0
- package/dist/server/server/routes/workflow-routes.js +185 -0
- package/dist/server/server/schema.js +90 -0
- package/dist/server/server/services/batch-orchestrator.js +253 -0
- package/dist/server/server/services/claude-session-service.js +352 -0
- package/dist/server/server/services/config-service.js +132 -0
- package/dist/server/server/services/deploy-service.js +51 -0
- package/dist/server/server/services/event-service.js +63 -0
- package/dist/server/server/services/gate-service.js +83 -0
- package/dist/server/server/services/git-service.js +309 -0
- package/dist/server/server/services/github-service.js +145 -0
- package/dist/server/server/services/readiness-service.js +184 -0
- package/dist/server/server/services/scope-cache.js +72 -0
- package/dist/server/server/services/scope-service.js +424 -0
- package/dist/server/server/services/sprint-orchestrator.js +312 -0
- package/dist/server/server/services/sprint-service.js +293 -0
- package/dist/server/server/services/workflow-service.js +397 -0
- package/dist/server/server/utils/cc-hooks-parser.js +49 -0
- package/dist/server/server/utils/dispatch-utils.js +305 -0
- package/dist/server/server/utils/logger.js +86 -0
- package/dist/server/server/utils/terminal-launcher.js +388 -0
- package/dist/server/server/utils/worktree-manager.js +98 -0
- package/dist/server/server/watchers/event-watcher.js +81 -0
- package/dist/server/server/watchers/scope-watcher.js +33 -0
- package/dist/server/shared/api-types.js +5 -0
- package/dist/server/shared/default-workflow.json +616 -0
- package/dist/server/shared/workflow-config.js +44 -0
- package/dist/server/shared/workflow-engine.js +353 -0
- package/index.html +15 -0
- package/package.json +110 -0
- package/postcss.config.js +6 -0
- package/schemas/orbital.config.schema.json +83 -0
- package/scripts/postinstall.js +24 -0
- package/scripts/start.sh +20 -0
- package/server/adapters/index.ts +41 -0
- package/server/adapters/iterm2-adapter.ts +37 -0
- package/server/adapters/subprocess-adapter.ts +25 -0
- package/server/adapters/terminal-adapter.ts +24 -0
- package/server/config.ts +234 -0
- package/server/database.ts +107 -0
- package/server/index.ts +452 -0
- package/server/init.ts +891 -0
- package/server/parsers/event-parser.ts +74 -0
- package/server/parsers/scope-parser.ts +240 -0
- package/server/routes/config-routes.ts +182 -0
- package/server/routes/data-routes.ts +548 -0
- package/server/routes/dispatch-routes.ts +275 -0
- package/server/routes/git-routes.ts +112 -0
- package/server/routes/scope-routes.ts +262 -0
- package/server/routes/sprint-routes.ts +142 -0
- package/server/routes/version-routes.ts +156 -0
- package/server/routes/workflow-routes.ts +198 -0
- package/server/schema.ts +90 -0
- package/server/services/batch-orchestrator.ts +286 -0
- package/server/services/claude-session-service.ts +441 -0
- package/server/services/config-service.ts +151 -0
- package/server/services/deploy-service.ts +98 -0
- package/server/services/event-service.ts +98 -0
- package/server/services/gate-service.ts +126 -0
- package/server/services/git-service.ts +391 -0
- package/server/services/github-service.ts +183 -0
- package/server/services/readiness-service.ts +250 -0
- package/server/services/scope-cache.ts +81 -0
- package/server/services/scope-service.ts +476 -0
- package/server/services/sprint-orchestrator.ts +361 -0
- package/server/services/sprint-service.ts +415 -0
- package/server/services/workflow-service.ts +461 -0
- package/server/utils/cc-hooks-parser.ts +70 -0
- package/server/utils/dispatch-utils.ts +395 -0
- package/server/utils/logger.ts +109 -0
- package/server/utils/terminal-launcher.ts +462 -0
- package/server/utils/worktree-manager.ts +104 -0
- package/server/watchers/event-watcher.ts +100 -0
- package/server/watchers/scope-watcher.ts +38 -0
- package/shared/api-types.ts +20 -0
- package/shared/default-workflow.json +616 -0
- package/shared/workflow-config.ts +170 -0
- package/shared/workflow-engine.ts +427 -0
- package/src/App.tsx +33 -0
- package/src/components/AgentBadge.tsx +40 -0
- package/src/components/BatchPreflightModal.tsx +115 -0
- package/src/components/CardDisplayToggle.tsx +74 -0
- package/src/components/ColumnHeaderActions.tsx +55 -0
- package/src/components/ColumnMenu.tsx +99 -0
- package/src/components/DeployHistory.tsx +141 -0
- package/src/components/DispatchModal.tsx +164 -0
- package/src/components/DispatchPopover.tsx +139 -0
- package/src/components/DragOverlay.tsx +25 -0
- package/src/components/DriftSidebar.tsx +140 -0
- package/src/components/EnvironmentStrip.tsx +88 -0
- package/src/components/ErrorBoundary.tsx +62 -0
- package/src/components/FilterChip.tsx +105 -0
- package/src/components/GateIndicator.tsx +33 -0
- package/src/components/IdeaDetailModal.tsx +190 -0
- package/src/components/IdeaFormDialog.tsx +113 -0
- package/src/components/KanbanColumn.tsx +201 -0
- package/src/components/MarkdownRenderer.tsx +114 -0
- package/src/components/NeonGrid.tsx +128 -0
- package/src/components/PromotionQueue.tsx +89 -0
- package/src/components/ScopeCard.tsx +234 -0
- package/src/components/ScopeDetailModal.tsx +255 -0
- package/src/components/ScopeFilterBar.tsx +152 -0
- package/src/components/SearchInput.tsx +102 -0
- package/src/components/SessionPanel.tsx +335 -0
- package/src/components/SprintContainer.tsx +303 -0
- package/src/components/SprintDependencyDialog.tsx +78 -0
- package/src/components/SprintPreflightModal.tsx +138 -0
- package/src/components/StatusBar.tsx +168 -0
- package/src/components/SwimCell.tsx +67 -0
- package/src/components/SwimLaneRow.tsx +94 -0
- package/src/components/SwimlaneBoardView.tsx +108 -0
- package/src/components/VersionBadge.tsx +139 -0
- package/src/components/ViewModeSelector.tsx +114 -0
- package/src/components/config/AgentChip.tsx +53 -0
- package/src/components/config/AgentCreateDialog.tsx +321 -0
- package/src/components/config/AgentEditor.tsx +175 -0
- package/src/components/config/DirectoryTree.tsx +582 -0
- package/src/components/config/FileEditor.tsx +550 -0
- package/src/components/config/HookChip.tsx +50 -0
- package/src/components/config/StageCard.tsx +198 -0
- package/src/components/config/TransitionZone.tsx +173 -0
- package/src/components/config/UnifiedWorkflowPipeline.tsx +216 -0
- package/src/components/config/WorkflowPipeline.tsx +161 -0
- package/src/components/source-control/BranchList.tsx +93 -0
- package/src/components/source-control/BranchPanel.tsx +105 -0
- package/src/components/source-control/CommitLog.tsx +100 -0
- package/src/components/source-control/CommitRow.tsx +47 -0
- package/src/components/source-control/GitHubPanel.tsx +110 -0
- package/src/components/source-control/GitHubSetupGuide.tsx +52 -0
- package/src/components/source-control/GitOverviewBar.tsx +101 -0
- package/src/components/source-control/PullRequestList.tsx +69 -0
- package/src/components/source-control/WorktreeList.tsx +80 -0
- package/src/components/ui/badge.tsx +41 -0
- package/src/components/ui/button.tsx +55 -0
- package/src/components/ui/card.tsx +78 -0
- package/src/components/ui/dialog.tsx +94 -0
- package/src/components/ui/popover.tsx +33 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/tabs.tsx +52 -0
- package/src/components/ui/toggle-switch.tsx +35 -0
- package/src/components/ui/tooltip.tsx +27 -0
- package/src/components/workflow/AddEdgeDialog.tsx +217 -0
- package/src/components/workflow/AddListDialog.tsx +201 -0
- package/src/components/workflow/ChecklistEditor.tsx +239 -0
- package/src/components/workflow/CommandPrefixManager.tsx +118 -0
- package/src/components/workflow/ConfigSettingsPanel.tsx +189 -0
- package/src/components/workflow/DirectionSelector.tsx +133 -0
- package/src/components/workflow/DispatchConfigPanel.tsx +180 -0
- package/src/components/workflow/EdgeDetailPanel.tsx +236 -0
- package/src/components/workflow/EdgePropertyEditor.tsx +251 -0
- package/src/components/workflow/EditToolbar.tsx +138 -0
- package/src/components/workflow/HookDetailPanel.tsx +250 -0
- package/src/components/workflow/HookExecutionLog.tsx +24 -0
- package/src/components/workflow/HookSourceModal.tsx +129 -0
- package/src/components/workflow/HooksDashboard.tsx +363 -0
- package/src/components/workflow/ListPropertyEditor.tsx +251 -0
- package/src/components/workflow/MigrationPreviewDialog.tsx +237 -0
- package/src/components/workflow/MovementRulesPanel.tsx +188 -0
- package/src/components/workflow/NodeDetailPanel.tsx +245 -0
- package/src/components/workflow/PresetSelector.tsx +414 -0
- package/src/components/workflow/SkillCommandBuilder.tsx +174 -0
- package/src/components/workflow/WorkflowEdgeComponent.tsx +145 -0
- package/src/components/workflow/WorkflowNode.tsx +147 -0
- package/src/components/workflow/graphLayout.ts +186 -0
- package/src/components/workflow/mergeHooks.ts +85 -0
- package/src/components/workflow/useEditHistory.ts +88 -0
- package/src/components/workflow/useWorkflowEditor.ts +262 -0
- package/src/components/workflow/validateConfig.ts +70 -0
- package/src/hooks/useActiveDispatches.ts +198 -0
- package/src/hooks/useBoardSettings.ts +170 -0
- package/src/hooks/useCardDisplay.ts +57 -0
- package/src/hooks/useCcHooks.ts +24 -0
- package/src/hooks/useConfigTree.ts +51 -0
- package/src/hooks/useEnforcementRules.ts +46 -0
- package/src/hooks/useEvents.ts +59 -0
- package/src/hooks/useFileEditor.ts +165 -0
- package/src/hooks/useGates.ts +57 -0
- package/src/hooks/useIdeaActions.ts +53 -0
- package/src/hooks/useKanbanDnd.ts +410 -0
- package/src/hooks/useOrbitalConfig.ts +54 -0
- package/src/hooks/usePipeline.ts +47 -0
- package/src/hooks/usePipelineData.ts +338 -0
- package/src/hooks/useReconnect.ts +25 -0
- package/src/hooks/useScopeFilters.ts +125 -0
- package/src/hooks/useScopeSessions.ts +44 -0
- package/src/hooks/useScopes.ts +67 -0
- package/src/hooks/useSearch.ts +67 -0
- package/src/hooks/useSettings.tsx +187 -0
- package/src/hooks/useSocket.ts +25 -0
- package/src/hooks/useSourceControl.ts +105 -0
- package/src/hooks/useSprintPreflight.ts +55 -0
- package/src/hooks/useSprints.ts +154 -0
- package/src/hooks/useStatusBarHighlight.ts +18 -0
- package/src/hooks/useSwimlaneBoardSettings.ts +104 -0
- package/src/hooks/useTheme.ts +9 -0
- package/src/hooks/useTransitionReadiness.ts +53 -0
- package/src/hooks/useVersion.ts +155 -0
- package/src/hooks/useViolations.ts +65 -0
- package/src/hooks/useWorkflow.tsx +125 -0
- package/src/hooks/useZoomModifier.ts +19 -0
- package/src/index.css +797 -0
- package/src/layouts/DashboardLayout.tsx +113 -0
- package/src/lib/collisionDetection.ts +20 -0
- package/src/lib/scope-fields.ts +61 -0
- package/src/lib/swimlane.ts +146 -0
- package/src/lib/utils.ts +15 -0
- package/src/main.tsx +19 -0
- package/src/socket.ts +11 -0
- package/src/types/index.ts +497 -0
- package/src/views/AgentFeed.tsx +339 -0
- package/src/views/DeployPipeline.tsx +59 -0
- package/src/views/EnforcementView.tsx +378 -0
- package/src/views/PrimitivesConfig.tsx +500 -0
- package/src/views/QualityGates.tsx +1012 -0
- package/src/views/ScopeBoard.tsx +454 -0
- package/src/views/SessionTimeline.tsx +516 -0
- package/src/views/Settings.tsx +183 -0
- package/src/views/SourceControl.tsx +95 -0
- package/src/views/WorkflowVisualizer.tsx +382 -0
- package/tailwind.config.js +161 -0
- package/templates/agents/AUTO-INVOKE.md +180 -0
- package/templates/agents/CONFLICT-RESOLUTION.md +128 -0
- package/templates/agents/QUICK-REFERENCE.md +122 -0
- package/templates/agents/README.md +188 -0
- package/templates/agents/SKILL-TRIGGERS.md +100 -0
- package/templates/agents/blue-team/frontend-designer.md +424 -0
- package/templates/agents/green-team/architect.md +526 -0
- package/templates/agents/green-team/rules-enforcer.md +131 -0
- package/templates/agents/red-team/attacker-learned.md +24 -0
- package/templates/agents/red-team/attacker.md +486 -0
- package/templates/agents/red-team/chaos.md +548 -0
- package/templates/agents/reference/component-registry.md +82 -0
- package/templates/agents/workflows/full-mode.md +218 -0
- package/templates/agents/workflows/quick-mode.md +118 -0
- package/templates/agents/workflows/security-mode.md +283 -0
- package/templates/anti-patterns/dangerous-shortcuts.md +427 -0
- package/templates/config/agent-triggers.json +92 -0
- package/templates/hooks/agent-team-gate.sh +31 -0
- package/templates/hooks/agent-trigger.sh +97 -0
- package/templates/hooks/block-push.sh +66 -0
- package/templates/hooks/block-workarounds.sh +61 -0
- package/templates/hooks/blocker-check.sh +28 -0
- package/templates/hooks/completion-checklist.sh +28 -0
- package/templates/hooks/decision-capture.sh +15 -0
- package/templates/hooks/dependency-check.sh +27 -0
- package/templates/hooks/end-session.sh +31 -0
- package/templates/hooks/exploration-logger.sh +37 -0
- package/templates/hooks/files-changed-summary.sh +37 -0
- package/templates/hooks/get-session-id.sh +49 -0
- package/templates/hooks/git-commit-guard.sh +34 -0
- package/templates/hooks/init-session.sh +93 -0
- package/templates/hooks/orbital-emit.sh +79 -0
- package/templates/hooks/orbital-report-deploy.sh +78 -0
- package/templates/hooks/orbital-report-gates.sh +40 -0
- package/templates/hooks/orbital-report-violation.sh +36 -0
- package/templates/hooks/orbital-scope-update.sh +53 -0
- package/templates/hooks/phase-verify-reminder.sh +26 -0
- package/templates/hooks/review-gate-check.sh +82 -0
- package/templates/hooks/scope-commit-logger.sh +37 -0
- package/templates/hooks/scope-create-cleanup.sh +36 -0
- package/templates/hooks/scope-create-gate.sh +80 -0
- package/templates/hooks/scope-create-tracker.sh +17 -0
- package/templates/hooks/scope-file-sync.sh +53 -0
- package/templates/hooks/scope-gate.sh +35 -0
- package/templates/hooks/scope-helpers.sh +188 -0
- package/templates/hooks/scope-lifecycle-gate.sh +139 -0
- package/templates/hooks/scope-prepare.sh +244 -0
- package/templates/hooks/scope-transition.sh +172 -0
- package/templates/hooks/session-enforcer.sh +143 -0
- package/templates/hooks/time-tracker.sh +33 -0
- package/templates/lessons-learned.md +15 -0
- package/templates/orbital.config.json +35 -0
- package/templates/presets/development.json +42 -0
- package/templates/presets/gitflow.json +712 -0
- package/templates/presets/minimal.json +23 -0
- package/templates/quick/rules.md +218 -0
- package/templates/scopes/_template.md +255 -0
- package/templates/settings-hooks.json +98 -0
- package/templates/skills/git-commit/SKILL.md +85 -0
- package/templates/skills/git-dev/SKILL.md +99 -0
- package/templates/skills/git-hotfix/SKILL.md +223 -0
- package/templates/skills/git-main/SKILL.md +84 -0
- package/templates/skills/git-production/SKILL.md +165 -0
- package/templates/skills/git-staging/SKILL.md +112 -0
- package/templates/skills/scope-create/SKILL.md +81 -0
- package/templates/skills/scope-fix-review/SKILL.md +168 -0
- package/templates/skills/scope-implement/SKILL.md +110 -0
- package/templates/skills/scope-post-review/SKILL.md +144 -0
- package/templates/skills/scope-pre-review/SKILL.md +211 -0
- package/templates/skills/scope-verify/SKILL.md +201 -0
- package/templates/skills/session-init/SKILL.md +62 -0
- package/templates/skills/session-resume/SKILL.md +201 -0
- package/templates/skills/test-checks/SKILL.md +171 -0
- package/templates/skills/test-code-review/SKILL.md +252 -0
- package/tsconfig.json +25 -0
- package/vite.config.ts +38 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useDraggable, useDroppable } from '@dnd-kit/core';
|
|
3
|
+
import { ChevronDown, ChevronRight, Star, Zap, Bot, GitBranch, Layers, Timer } from 'lucide-react';
|
|
4
|
+
import { Card } from '@/components/ui/card';
|
|
5
|
+
import { Badge } from '@/components/ui/badge';
|
|
6
|
+
import { HookChip } from './HookChip';
|
|
7
|
+
import { AgentChip } from './AgentChip';
|
|
8
|
+
import { cn } from '@/lib/utils';
|
|
9
|
+
import type { StageData, ConfigPrimitiveType, ResolvedHook } from '@/types';
|
|
10
|
+
|
|
11
|
+
/** Wraps a HookChip to make it draggable out of the pipeline */
|
|
12
|
+
function DraggableHookChip({ hook, dragId, selected, onClick, onRemove, editable }: {
|
|
13
|
+
hook: ResolvedHook;
|
|
14
|
+
dragId: string;
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
onRemove?: () => void;
|
|
18
|
+
editable?: boolean;
|
|
19
|
+
}) {
|
|
20
|
+
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
|
21
|
+
id: dragId,
|
|
22
|
+
disabled: !editable,
|
|
23
|
+
data: { hookId: hook.id },
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div ref={setNodeRef} className={cn('cursor-pointer', isDragging && 'opacity-40')} onClick={onClick} {...listeners} {...attributes}>
|
|
28
|
+
<HookChip hook={hook} selected={selected} onRemove={onRemove} />
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface StageCardProps {
|
|
34
|
+
stage: StageData;
|
|
35
|
+
selectedPath: string | null;
|
|
36
|
+
onSelectItem: (type: ConfigPrimitiveType, path: string) => void;
|
|
37
|
+
editable?: boolean;
|
|
38
|
+
onRemoveHook?: (listId: string, hookId: string) => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function StageCard({ stage, selectedPath, onSelectItem, editable, onRemoveHook }: StageCardProps) {
|
|
42
|
+
const { list, stageHooks, alwaysOnAgents, reviewTeams } = stage;
|
|
43
|
+
const [hooksOpen, setHooksOpen] = useState(true);
|
|
44
|
+
const [agentsOpen, setAgentsOpen] = useState(true);
|
|
45
|
+
|
|
46
|
+
const hasHooks = stageHooks.length > 0;
|
|
47
|
+
const hasAgents = alwaysOnAgents.length > 0 || reviewTeams.length > 0;
|
|
48
|
+
const showHooksSection = hasHooks || editable;
|
|
49
|
+
|
|
50
|
+
const dropId = `drop::stage-hooks::${list.id}`;
|
|
51
|
+
const { setNodeRef, isOver } = useDroppable({ id: dropId, disabled: !editable });
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Card className="overflow-hidden border-border/60">
|
|
55
|
+
{/* Header */}
|
|
56
|
+
<div className="flex items-center gap-2 px-3 py-2">
|
|
57
|
+
<div
|
|
58
|
+
className="h-3 w-3 shrink-0 rounded-full"
|
|
59
|
+
style={{ backgroundColor: list.hex }}
|
|
60
|
+
/>
|
|
61
|
+
<span className="text-xs font-semibold text-foreground uppercase tracking-wide">
|
|
62
|
+
{list.label}
|
|
63
|
+
</span>
|
|
64
|
+
<span className="text-[10px] text-muted-foreground/40 font-mono">{list.id}</span>
|
|
65
|
+
|
|
66
|
+
<div className="ml-auto flex items-center gap-1">
|
|
67
|
+
{list.isEntryPoint && (
|
|
68
|
+
<Badge variant="outline" className="text-[9px] gap-0.5 px-1 py-0 border-amber-500/30 text-amber-400">
|
|
69
|
+
<Star className="h-2.5 w-2.5" /> entry
|
|
70
|
+
</Badge>
|
|
71
|
+
)}
|
|
72
|
+
{list.gitBranch && (
|
|
73
|
+
<Badge variant="outline" className="text-[9px] gap-0.5 px-1 py-0 border-green-500/30 text-green-400">
|
|
74
|
+
<GitBranch className="h-2.5 w-2.5" /> {list.gitBranch}
|
|
75
|
+
</Badge>
|
|
76
|
+
)}
|
|
77
|
+
{list.supportsBatch && (
|
|
78
|
+
<Badge variant="outline" className="text-[9px] gap-0.5 px-1 py-0 border-cyan-500/30 text-cyan-400">
|
|
79
|
+
<Layers className="h-2.5 w-2.5" /> batch
|
|
80
|
+
</Badge>
|
|
81
|
+
)}
|
|
82
|
+
{list.supportsSprint && (
|
|
83
|
+
<Badge variant="outline" className="text-[9px] gap-0.5 px-1 py-0 border-indigo-500/30 text-indigo-400">
|
|
84
|
+
<Timer className="h-2.5 w-2.5" /> sprint
|
|
85
|
+
</Badge>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
{/* Stage Hooks */}
|
|
91
|
+
{showHooksSection && (
|
|
92
|
+
<div className="border-t border-border/40">
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
onClick={() => setHooksOpen(!hooksOpen)}
|
|
96
|
+
className="flex w-full items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors"
|
|
97
|
+
>
|
|
98
|
+
{hooksOpen ? <ChevronDown className="h-3 w-3" /> : <ChevronRight className="h-3 w-3" />}
|
|
99
|
+
<Zap className="h-3 w-3" />
|
|
100
|
+
Stage Hooks
|
|
101
|
+
<span className="text-muted-foreground/50">({stageHooks.length})</span>
|
|
102
|
+
</button>
|
|
103
|
+
{hooksOpen && (
|
|
104
|
+
<div
|
|
105
|
+
ref={setNodeRef}
|
|
106
|
+
className={cn(
|
|
107
|
+
'flex flex-wrap gap-1 px-3 pb-2 min-h-[28px]',
|
|
108
|
+
editable && 'border border-dashed border-transparent rounded-md mx-2 mb-1 p-1',
|
|
109
|
+
isOver && 'border-accent-blue bg-accent-blue/10',
|
|
110
|
+
)}
|
|
111
|
+
>
|
|
112
|
+
{stageHooks.map(hook => (
|
|
113
|
+
<DraggableHookChip
|
|
114
|
+
key={hook.id}
|
|
115
|
+
hook={hook}
|
|
116
|
+
dragId={`pipeline::stage-hook::${list.id}::${hook.id}`}
|
|
117
|
+
selected={hook.filePath != null && hook.filePath === selectedPath}
|
|
118
|
+
onClick={() => hook.filePath && onSelectItem('hooks', hook.filePath)}
|
|
119
|
+
onRemove={editable && onRemoveHook ? () => onRemoveHook(list.id, hook.id) : undefined}
|
|
120
|
+
editable={editable}
|
|
121
|
+
/>
|
|
122
|
+
))}
|
|
123
|
+
{editable && stageHooks.length === 0 && (
|
|
124
|
+
<span className="text-[9px] text-muted-foreground/40 italic py-0.5">drop hooks here</span>
|
|
125
|
+
)}
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
{/* Agents */}
|
|
132
|
+
{hasAgents && (
|
|
133
|
+
<div className="border-t border-border/40">
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
onClick={() => setAgentsOpen(!agentsOpen)}
|
|
137
|
+
className="flex w-full items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors"
|
|
138
|
+
>
|
|
139
|
+
{agentsOpen ? <ChevronDown className="h-3 w-3" /> : <ChevronRight className="h-3 w-3" />}
|
|
140
|
+
<Bot className="h-3 w-3" />
|
|
141
|
+
Agents
|
|
142
|
+
<span className="text-muted-foreground/50">
|
|
143
|
+
({alwaysOnAgents.length + reviewTeams.reduce((s, t) => s + t.agents.length, 0)})
|
|
144
|
+
</span>
|
|
145
|
+
</button>
|
|
146
|
+
{agentsOpen && (
|
|
147
|
+
<div className="px-3 pb-2 space-y-2">
|
|
148
|
+
{/* Always-On */}
|
|
149
|
+
{alwaysOnAgents.length > 0 && (
|
|
150
|
+
<div>
|
|
151
|
+
<div className="text-[9px] uppercase tracking-wider text-muted-foreground/50 mb-1">Always-On</div>
|
|
152
|
+
<div className="flex flex-wrap gap-1">
|
|
153
|
+
{alwaysOnAgents.map(agent => (
|
|
154
|
+
<AgentChip
|
|
155
|
+
key={agent.id}
|
|
156
|
+
agent={agent}
|
|
157
|
+
mode="always-on"
|
|
158
|
+
selected={agent.filePath != null && agent.filePath === selectedPath}
|
|
159
|
+
onClick={() => agent.filePath && onSelectItem('agents', agent.filePath)}
|
|
160
|
+
/>
|
|
161
|
+
))}
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
)}
|
|
165
|
+
|
|
166
|
+
{/* Review Teams */}
|
|
167
|
+
{reviewTeams.map(team => (
|
|
168
|
+
<div key={team.skillCommand}>
|
|
169
|
+
<div className="flex items-center gap-1 text-[9px] uppercase tracking-wider text-muted-foreground/50 mb-1">
|
|
170
|
+
<span>{team.skillCommand} team:</span>
|
|
171
|
+
</div>
|
|
172
|
+
<div className="flex flex-wrap gap-1">
|
|
173
|
+
{team.agents.map(agent => (
|
|
174
|
+
<AgentChip
|
|
175
|
+
key={agent.id}
|
|
176
|
+
agent={agent}
|
|
177
|
+
mode="review"
|
|
178
|
+
selected={agent.filePath != null && agent.filePath === selectedPath}
|
|
179
|
+
onClick={() => agent.filePath && onSelectItem('agents', agent.filePath)}
|
|
180
|
+
/>
|
|
181
|
+
))}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
))}
|
|
185
|
+
</div>
|
|
186
|
+
)}
|
|
187
|
+
</div>
|
|
188
|
+
)}
|
|
189
|
+
|
|
190
|
+
{/* Empty state */}
|
|
191
|
+
{!showHooksSection && !hasAgents && (
|
|
192
|
+
<div className="border-t border-border/40 px-3 py-2">
|
|
193
|
+
<span className="text-[10px] text-muted-foreground/40 italic">No stage-specific hooks or agents</span>
|
|
194
|
+
</div>
|
|
195
|
+
)}
|
|
196
|
+
</Card>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { useDraggable, useDroppable } from '@dnd-kit/core';
|
|
2
|
+
import { ArrowDown, Terminal, Zap } from 'lucide-react';
|
|
3
|
+
import { cn } from '@/lib/utils';
|
|
4
|
+
import { HookChip } from './HookChip';
|
|
5
|
+
import type { EdgeData, ConfigPrimitiveType, ResolvedHook } from '@/types';
|
|
6
|
+
|
|
7
|
+
/** Wraps a HookChip to make it draggable out of the pipeline */
|
|
8
|
+
function DraggableHookChip({ hook, dragId, selected, onClick, onRemove, editable }: {
|
|
9
|
+
hook: ResolvedHook;
|
|
10
|
+
dragId: string;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
onRemove?: () => void;
|
|
14
|
+
editable?: boolean;
|
|
15
|
+
}) {
|
|
16
|
+
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
|
17
|
+
id: dragId,
|
|
18
|
+
disabled: !editable,
|
|
19
|
+
data: { hookId: hook.id },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div ref={setNodeRef} className={cn('cursor-pointer', isDragging && 'opacity-40')} onClick={onClick} {...listeners} {...attributes}>
|
|
24
|
+
<HookChip hook={hook} selected={selected} onRemove={onRemove} />
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface TransitionZoneProps {
|
|
30
|
+
edges: EdgeData[];
|
|
31
|
+
selectedPath: string | null;
|
|
32
|
+
onSelectItem: (type: ConfigPrimitiveType, path: string) => void;
|
|
33
|
+
editable?: boolean;
|
|
34
|
+
onRemoveHook?: (from: string, to: string, hookId: string) => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const DIRECTION_STYLE: Record<string, { arrow: string; label: string; border: string; bg: string }> = {
|
|
38
|
+
forward: { arrow: 'text-green-500', label: 'text-green-400', border: 'border-green-500/20', bg: 'bg-green-500/5' },
|
|
39
|
+
backward: { arrow: 'text-amber-500', label: 'text-amber-400', border: 'border-amber-500/20', bg: 'bg-amber-500/5' },
|
|
40
|
+
shortcut: { arrow: 'text-indigo-500', label: 'text-indigo-400', border: 'border-indigo-500/20', bg: 'bg-indigo-500/5' },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function EdgeRow({ edgeData, selectedPath, onSelectItem, editable, onRemoveHook }: {
|
|
44
|
+
edgeData: EdgeData;
|
|
45
|
+
selectedPath: string | null;
|
|
46
|
+
onSelectItem: (type: ConfigPrimitiveType, path: string) => void;
|
|
47
|
+
editable?: boolean;
|
|
48
|
+
onRemoveHook?: (from: string, to: string, hookId: string) => void;
|
|
49
|
+
}) {
|
|
50
|
+
const { edge, skillPath, edgeHooks } = edgeData;
|
|
51
|
+
const style = DIRECTION_STYLE[edge.direction] ?? DIRECTION_STYLE.forward;
|
|
52
|
+
|
|
53
|
+
const skillDropId = `drop::edge-skill::${edge.from}:${edge.to}`;
|
|
54
|
+
const { setNodeRef: setSkillRef, isOver: isSkillOver } = useDroppable({ id: skillDropId, disabled: !editable });
|
|
55
|
+
|
|
56
|
+
const hooksDropId = `drop::edge-hooks::${edge.from}:${edge.to}`;
|
|
57
|
+
const { setNodeRef: setHooksRef, isOver: isHooksOver } = useDroppable({ id: hooksDropId, disabled: !editable });
|
|
58
|
+
|
|
59
|
+
const directionLabel = edge.direction === 'shortcut' ? 'SHORTCUT' : 'DEFAULT';
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className={cn(
|
|
63
|
+
'flex items-center rounded-lg border overflow-hidden',
|
|
64
|
+
style.border, 'bg-card',
|
|
65
|
+
)}>
|
|
66
|
+
{/* Direction label */}
|
|
67
|
+
<div className={cn('shrink-0 self-stretch flex items-center px-2.5', style.bg)}>
|
|
68
|
+
<span className={cn('text-[9px] font-semibold uppercase tracking-wider whitespace-nowrap', style.label)}>
|
|
69
|
+
{directionLabel}
|
|
70
|
+
</span>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
{/* Skill + Hooks inline */}
|
|
74
|
+
<div className="flex items-center flex-1 min-w-0 border-l" style={{ borderColor: 'inherit' }}>
|
|
75
|
+
{/* Skill */}
|
|
76
|
+
<div
|
|
77
|
+
ref={setSkillRef}
|
|
78
|
+
className={cn(
|
|
79
|
+
'flex items-center gap-1.5 px-2 py-1 shrink-0',
|
|
80
|
+
isSkillOver && 'bg-green-500/10',
|
|
81
|
+
)}
|
|
82
|
+
>
|
|
83
|
+
{edge.command ? (
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
onClick={() => skillPath && onSelectItem('skills', skillPath)}
|
|
87
|
+
data-pipeline-path={skillPath ?? undefined}
|
|
88
|
+
className={cn(
|
|
89
|
+
'inline-flex items-center gap-1 text-[11px] font-semibold transition-colors whitespace-nowrap rounded-md px-1 -mx-1',
|
|
90
|
+
style.label,
|
|
91
|
+
skillPath && 'hover:brightness-125 cursor-pointer',
|
|
92
|
+
!skillPath && 'cursor-default opacity-60',
|
|
93
|
+
skillPath != null && skillPath === selectedPath && 'glow-selected-pulse',
|
|
94
|
+
)}
|
|
95
|
+
style={skillPath != null && skillPath === selectedPath ? { '--glow-color': '#22c55eA0', '--glow-color-wide': '#22c55e40' } as React.CSSProperties : undefined}
|
|
96
|
+
>
|
|
97
|
+
<Terminal className="h-3 w-3 shrink-0" />
|
|
98
|
+
{edge.command.replace(/\s+\{.*\}$/, '')}
|
|
99
|
+
</button>
|
|
100
|
+
) : (
|
|
101
|
+
<span className={cn(
|
|
102
|
+
'text-[10px] text-muted-foreground/40 italic whitespace-nowrap',
|
|
103
|
+
editable && 'border border-dashed border-muted-foreground/20 rounded px-1.5 py-0.5',
|
|
104
|
+
)}>
|
|
105
|
+
{editable ? 'drop skill' : 'no skill'}
|
|
106
|
+
</span>
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
{/* Divider */}
|
|
111
|
+
<div className={cn('w-px self-stretch', style.border.replace('border-', 'bg-'))} />
|
|
112
|
+
|
|
113
|
+
{/* Hooks */}
|
|
114
|
+
<div
|
|
115
|
+
ref={setHooksRef}
|
|
116
|
+
className={cn(
|
|
117
|
+
'flex items-center gap-1 px-2 py-1 flex-1 min-w-0',
|
|
118
|
+
isHooksOver && 'bg-[#00bcd4]/10',
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
<Zap className="h-3 w-3 shrink-0 text-muted-foreground/30" />
|
|
122
|
+
{edgeHooks.map(hook => (
|
|
123
|
+
<DraggableHookChip
|
|
124
|
+
key={hook.id}
|
|
125
|
+
hook={hook}
|
|
126
|
+
dragId={`pipeline::edge-hook::${edge.from}:${edge.to}::${hook.id}`}
|
|
127
|
+
selected={hook.filePath != null && hook.filePath === selectedPath}
|
|
128
|
+
onClick={() => hook.filePath && onSelectItem('hooks', hook.filePath)}
|
|
129
|
+
onRemove={editable && onRemoveHook ? () => onRemoveHook(edge.from, edge.to, hook.id) : undefined}
|
|
130
|
+
editable={editable}
|
|
131
|
+
/>
|
|
132
|
+
))}
|
|
133
|
+
{edgeHooks.length === 0 && (
|
|
134
|
+
<span className={cn(
|
|
135
|
+
'text-[10px] text-muted-foreground/40 italic',
|
|
136
|
+
editable && 'border border-dashed border-muted-foreground/20 rounded px-1.5 py-0.5',
|
|
137
|
+
)}>
|
|
138
|
+
{editable ? 'drop hooks' : 'none'}
|
|
139
|
+
</span>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function TransitionZone({ edges, selectedPath, onSelectItem, editable, onRemoveHook }: TransitionZoneProps) {
|
|
148
|
+
if (edges.length === 0) return null;
|
|
149
|
+
|
|
150
|
+
const arrowStyle = DIRECTION_STYLE.forward.arrow;
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<div className="flex flex-col items-center py-1">
|
|
154
|
+
<ArrowDown className={cn('h-7 w-4', arrowStyle)} />
|
|
155
|
+
|
|
156
|
+
{/* Edge rows */}
|
|
157
|
+
<div className="flex w-full flex-wrap justify-center gap-1 px-1 my-0.5">
|
|
158
|
+
{edges.map(edgeData => (
|
|
159
|
+
<EdgeRow
|
|
160
|
+
key={`${edgeData.edge.from}:${edgeData.edge.to}`}
|
|
161
|
+
edgeData={edgeData}
|
|
162
|
+
selectedPath={selectedPath}
|
|
163
|
+
onSelectItem={onSelectItem}
|
|
164
|
+
editable={editable}
|
|
165
|
+
onRemoveHook={onRemoveHook}
|
|
166
|
+
/>
|
|
167
|
+
))}
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<ArrowDown className={cn('h-7 w-4', arrowStyle)} />
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
3
|
+
import { ChevronDown, ChevronRight, CornerDownLeft } from 'lucide-react';
|
|
4
|
+
import { Badge } from '@/components/ui/badge';
|
|
5
|
+
import { Card } from '@/components/ui/card';
|
|
6
|
+
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
import { usePipelineData } from '@/hooks/usePipelineData';
|
|
9
|
+
import { HookChip } from './HookChip';
|
|
10
|
+
import { StageCard } from './StageCard';
|
|
11
|
+
import { TransitionZone } from './TransitionZone';
|
|
12
|
+
import type { ConfigPrimitiveType, ResolvedHook } from '@/types';
|
|
13
|
+
import type { WorkflowConfig, WorkflowEdge } from '../../../shared/workflow-config';
|
|
14
|
+
|
|
15
|
+
function DraggableHookChip({ hook, dragId, selected, onClick, onRemove, editable }: {
|
|
16
|
+
hook: ResolvedHook;
|
|
17
|
+
dragId: string;
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
onClick?: () => void;
|
|
20
|
+
onRemove?: () => void;
|
|
21
|
+
editable?: boolean;
|
|
22
|
+
}) {
|
|
23
|
+
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
|
24
|
+
id: dragId,
|
|
25
|
+
disabled: !editable,
|
|
26
|
+
data: { hookId: hook.id },
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div ref={setNodeRef} className={cn('cursor-pointer', isDragging && 'opacity-40')} onClick={onClick} {...listeners} {...attributes}>
|
|
31
|
+
<HookChip hook={hook} selected={selected} onRemove={onRemove} />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface UnifiedWorkflowPipelineProps {
|
|
37
|
+
selectedPath: string | null;
|
|
38
|
+
onSelectItem: (type: ConfigPrimitiveType, path: string) => void;
|
|
39
|
+
editConfig?: WorkflowConfig;
|
|
40
|
+
editable?: boolean;
|
|
41
|
+
onRemoveEdgeHook?: (from: string, to: string, hookId: string) => void;
|
|
42
|
+
onRemoveStageHook?: (listId: string, hookId: string) => void;
|
|
43
|
+
onRemoveGlobalHook?: (hookId: string) => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function UnifiedWorkflowPipeline({ selectedPath, onSelectItem, editConfig, editable, onRemoveEdgeHook, onRemoveStageHook, onRemoveGlobalHook }: UnifiedWorkflowPipelineProps) {
|
|
47
|
+
const data = usePipelineData(editConfig);
|
|
48
|
+
const [reworkOpen, setReworkOpen] = useState(false);
|
|
49
|
+
|
|
50
|
+
// Scroll selected pipeline item into view
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!selectedPath) return;
|
|
53
|
+
requestAnimationFrame(() => {
|
|
54
|
+
const el = document.querySelector(`[data-pipeline-path="${CSS.escape(selectedPath)}"]`);
|
|
55
|
+
el?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
56
|
+
});
|
|
57
|
+
}, [selectedPath]);
|
|
58
|
+
|
|
59
|
+
// Collect all backward edges across stages
|
|
60
|
+
const allBackwardEdges: WorkflowEdge[] = data.stages.flatMap(s => s.backwardEdges);
|
|
61
|
+
|
|
62
|
+
// Compute stats
|
|
63
|
+
const totalHooks = new Set([
|
|
64
|
+
...data.globalHooks.map(h => h.id),
|
|
65
|
+
...data.stages.flatMap(s => s.stageHooks.map(h => h.id)),
|
|
66
|
+
]).size;
|
|
67
|
+
const totalSkills = new Set(
|
|
68
|
+
data.stages.flatMap(s => s.forwardEdges.filter(e => e.edge.command).map(e => e.edge.command)),
|
|
69
|
+
).size;
|
|
70
|
+
const totalAgents = new Set([
|
|
71
|
+
...data.stages.flatMap(s => s.alwaysOnAgents.map(a => a.id)),
|
|
72
|
+
...data.stages.flatMap(s => s.reviewTeams.flatMap(t => t.agents.map(a => a.id))),
|
|
73
|
+
]).size;
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="flex h-full flex-col">
|
|
77
|
+
{/* Header */}
|
|
78
|
+
<div className="flex items-center justify-between border-b border-border px-3 py-2">
|
|
79
|
+
<span className="text-xxs font-medium uppercase tracking-wider text-muted-foreground">
|
|
80
|
+
Workflow Pipeline
|
|
81
|
+
</span>
|
|
82
|
+
<div className="flex items-center gap-1.5">
|
|
83
|
+
<Badge variant="secondary" className="text-[10px]">
|
|
84
|
+
{data.stages.length} stages
|
|
85
|
+
</Badge>
|
|
86
|
+
{totalSkills > 0 && (
|
|
87
|
+
<Badge variant="secondary" className="text-[10px]">
|
|
88
|
+
{totalSkills} skills
|
|
89
|
+
</Badge>
|
|
90
|
+
)}
|
|
91
|
+
{totalHooks > 0 && (
|
|
92
|
+
<Badge variant="secondary" className="text-[10px]">
|
|
93
|
+
{totalHooks} hooks
|
|
94
|
+
</Badge>
|
|
95
|
+
)}
|
|
96
|
+
{totalAgents > 0 && (
|
|
97
|
+
<Badge variant="secondary" className="text-[10px]">
|
|
98
|
+
{totalAgents} agents
|
|
99
|
+
</Badge>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
{/* Pipeline */}
|
|
105
|
+
<ScrollArea className="flex-1">
|
|
106
|
+
<div className="p-3 space-y-0">
|
|
107
|
+
{/* Global Hooks */}
|
|
108
|
+
{data.globalHooks.length > 0 && (
|
|
109
|
+
<>
|
|
110
|
+
<Card className="overflow-hidden border-border/60">
|
|
111
|
+
<div className="flex items-center gap-2 px-3 py-2">
|
|
112
|
+
<span className="text-sm">🌐</span>
|
|
113
|
+
<span className="text-xs font-semibold text-foreground uppercase tracking-wide">
|
|
114
|
+
Global Hooks
|
|
115
|
+
</span>
|
|
116
|
+
<span className="text-[10px] text-muted-foreground/40">active in all stages</span>
|
|
117
|
+
</div>
|
|
118
|
+
<div className="border-t border-border/40">
|
|
119
|
+
<div className="flex flex-wrap gap-1 px-3 py-2">
|
|
120
|
+
{data.globalHooks.map(hook => (
|
|
121
|
+
<DraggableHookChip
|
|
122
|
+
key={hook.id}
|
|
123
|
+
hook={hook}
|
|
124
|
+
dragId={`pipeline::global-hook::${hook.id}`}
|
|
125
|
+
selected={hook.filePath != null && hook.filePath === selectedPath}
|
|
126
|
+
onClick={() => hook.filePath && onSelectItem('hooks', hook.filePath)}
|
|
127
|
+
onRemove={editable && onRemoveGlobalHook ? () => onRemoveGlobalHook(hook.id) : undefined}
|
|
128
|
+
editable={editable}
|
|
129
|
+
/>
|
|
130
|
+
))}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</Card>
|
|
134
|
+
|
|
135
|
+
{/* Separator between global hooks and stage cards */}
|
|
136
|
+
<div className="flex items-center gap-2 py-2 px-4">
|
|
137
|
+
<div className="flex-1 border-t border-border/40" />
|
|
138
|
+
<span className="text-[9px] text-muted-foreground/30 uppercase tracking-wider">stages</span>
|
|
139
|
+
<div className="flex-1 border-t border-border/40" />
|
|
140
|
+
</div>
|
|
141
|
+
</>
|
|
142
|
+
)}
|
|
143
|
+
|
|
144
|
+
{/* Stage cards + transition zones */}
|
|
145
|
+
{data.stages.map((stage, i) => (
|
|
146
|
+
<div key={stage.list.id}>
|
|
147
|
+
<StageCard
|
|
148
|
+
stage={stage}
|
|
149
|
+
selectedPath={selectedPath}
|
|
150
|
+
onSelectItem={onSelectItem}
|
|
151
|
+
editable={editable}
|
|
152
|
+
onRemoveHook={onRemoveStageHook}
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
{/* Transition zone: all forward/shortcut edges in a single row */}
|
|
156
|
+
{stage.forwardEdges.length > 0 && (
|
|
157
|
+
<TransitionZone
|
|
158
|
+
edges={stage.forwardEdges}
|
|
159
|
+
selectedPath={selectedPath}
|
|
160
|
+
onSelectItem={onSelectItem}
|
|
161
|
+
editable={editable}
|
|
162
|
+
onRemoveHook={onRemoveEdgeHook}
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
165
|
+
|
|
166
|
+
{/* Spacer between stages if no edges (last stage) */}
|
|
167
|
+
{stage.forwardEdges.length === 0 && i < data.stages.length - 1 && (
|
|
168
|
+
<div className="h-2" />
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
))}
|
|
172
|
+
|
|
173
|
+
{/* Backward edges summary */}
|
|
174
|
+
{allBackwardEdges.length > 0 && (
|
|
175
|
+
<div className="mt-3 border-t border-border/30 pt-2">
|
|
176
|
+
<button
|
|
177
|
+
type="button"
|
|
178
|
+
onClick={() => setReworkOpen(!reworkOpen)}
|
|
179
|
+
className="flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[10px] font-medium text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors"
|
|
180
|
+
>
|
|
181
|
+
{reworkOpen ? <ChevronDown className="h-3 w-3" /> : <ChevronRight className="h-3 w-3" />}
|
|
182
|
+
<CornerDownLeft className="h-3 w-3" />
|
|
183
|
+
{allBackwardEdges.length} rework paths
|
|
184
|
+
</button>
|
|
185
|
+
{reworkOpen && (
|
|
186
|
+
<div className="space-y-1 px-2 pt-1">
|
|
187
|
+
{allBackwardEdges.map(edge => (
|
|
188
|
+
<div
|
|
189
|
+
key={`${edge.from}:${edge.to}`}
|
|
190
|
+
className="flex items-center gap-2 text-[10px] text-muted-foreground/70 py-0.5"
|
|
191
|
+
>
|
|
192
|
+
<CornerDownLeft className="h-2.5 w-2.5 text-amber-500/50" />
|
|
193
|
+
<span className="font-mono">{edge.from}</span>
|
|
194
|
+
<span className="text-muted-foreground/30">→</span>
|
|
195
|
+
<span className="font-mono">{edge.to}</span>
|
|
196
|
+
<span className="text-muted-foreground/40 truncate">{edge.label}</span>
|
|
197
|
+
</div>
|
|
198
|
+
))}
|
|
199
|
+
</div>
|
|
200
|
+
)}
|
|
201
|
+
</div>
|
|
202
|
+
)}
|
|
203
|
+
|
|
204
|
+
{/* Footer hint */}
|
|
205
|
+
<div className="mt-4 px-2 text-center">
|
|
206
|
+
<span className="text-[9px] text-muted-foreground/30">
|
|
207
|
+
{editable
|
|
208
|
+
? 'Drag items from the tree onto stages or edges'
|
|
209
|
+
: 'Click any hook, agent, or skill to open in editor'}
|
|
210
|
+
</span>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</ScrollArea>
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
}
|