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,115 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { Play, Package } from 'lucide-react';
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogHeader,
|
|
7
|
+
DialogTitle,
|
|
8
|
+
DialogDescription,
|
|
9
|
+
} from '@/components/ui/dialog';
|
|
10
|
+
import { Button } from '@/components/ui/button';
|
|
11
|
+
import { formatScopeId } from '@/lib/utils';
|
|
12
|
+
import { useWorkflow } from '@/hooks/useWorkflow';
|
|
13
|
+
import type { Sprint } from '@/types';
|
|
14
|
+
|
|
15
|
+
interface BatchPreflightModalProps {
|
|
16
|
+
open: boolean;
|
|
17
|
+
batch: Sprint | null;
|
|
18
|
+
onConfirm: (mergeMode?: string) => void;
|
|
19
|
+
onCancel: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function BatchPreflightModal({ open, batch, onConfirm, onCancel }: BatchPreflightModalProps) {
|
|
23
|
+
const { engine } = useWorkflow();
|
|
24
|
+
const [dispatching, setDispatching] = useState(false);
|
|
25
|
+
const [mergeMode, setMergeMode] = useState<string>('push');
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (open) setDispatching(false);
|
|
29
|
+
}, [open]);
|
|
30
|
+
|
|
31
|
+
if (!batch) return null;
|
|
32
|
+
|
|
33
|
+
const totalScopes = batch.scope_ids.length;
|
|
34
|
+
// Get the batch target edge to derive the action description
|
|
35
|
+
const targetStatus = engine.getBatchTargetStatus(batch.target_column);
|
|
36
|
+
const edge = targetStatus ? engine.findEdge(batch.target_column, targetStatus) : undefined;
|
|
37
|
+
const action = edge?.description ?? 'Will dispatch this batch';
|
|
38
|
+
|
|
39
|
+
const handleConfirm = () => {
|
|
40
|
+
setDispatching(true);
|
|
41
|
+
onConfirm(mergeMode);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Dialog open={open} onOpenChange={(o) => !o && onCancel()}>
|
|
46
|
+
<DialogContent className="sm:max-w-md p-0 gap-0 overflow-hidden">
|
|
47
|
+
<DialogHeader className="px-4 pt-3 pb-2">
|
|
48
|
+
<DialogTitle className="flex items-center gap-2 text-sm">
|
|
49
|
+
<Package className="h-4 w-4 text-amber-400" />
|
|
50
|
+
Dispatch Batch: {batch.name}
|
|
51
|
+
</DialogTitle>
|
|
52
|
+
<DialogDescription className="text-xs">
|
|
53
|
+
{action} ({totalScopes} scope{totalScopes !== 1 ? 's' : ''})
|
|
54
|
+
</DialogDescription>
|
|
55
|
+
</DialogHeader>
|
|
56
|
+
|
|
57
|
+
{/* Scope list */}
|
|
58
|
+
<div className="max-h-48 overflow-y-auto space-y-1 bg-[#0a0a12] px-4 py-3">
|
|
59
|
+
{batch.scopes.map((ss) => (
|
|
60
|
+
<div key={ss.scope_id} className="flex items-center gap-2 text-xs">
|
|
61
|
+
<span className="font-mono text-muted-foreground w-8 shrink-0">
|
|
62
|
+
{formatScopeId(ss.scope_id)}
|
|
63
|
+
</span>
|
|
64
|
+
<span className="truncate flex-1">{ss.title}</span>
|
|
65
|
+
</div>
|
|
66
|
+
))}
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{/* Merge mode selector */}
|
|
70
|
+
<div className="px-4 py-2 border-t border-border/50 space-y-1.5">
|
|
71
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">Merge Mode</span>
|
|
72
|
+
<div className="flex gap-2">
|
|
73
|
+
{['push', 'pr', 'direct'].map((mode) => (
|
|
74
|
+
<button
|
|
75
|
+
key={mode}
|
|
76
|
+
onClick={() => setMergeMode(mode)}
|
|
77
|
+
className={`rounded px-2 py-1 text-xs transition-colors ${
|
|
78
|
+
mergeMode === mode
|
|
79
|
+
? 'bg-cyan-600/80 text-black'
|
|
80
|
+
: 'bg-muted text-muted-foreground hover:bg-accent'
|
|
81
|
+
}`}
|
|
82
|
+
>
|
|
83
|
+
{mode === 'push' ? 'Push' : mode === 'pr' ? 'PR' : 'Direct Merge'}
|
|
84
|
+
</button>
|
|
85
|
+
))}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
{/* Actions */}
|
|
90
|
+
<div className="flex justify-end gap-2 px-4 py-2 border-t border-border/50">
|
|
91
|
+
<Button variant="ghost" size="sm" onClick={onCancel} disabled={dispatching}>
|
|
92
|
+
Cancel
|
|
93
|
+
</Button>
|
|
94
|
+
<Button
|
|
95
|
+
size="sm"
|
|
96
|
+
onClick={handleConfirm}
|
|
97
|
+
disabled={dispatching || totalScopes === 0}
|
|
98
|
+
className="bg-cyan-600/80 hover:bg-cyan-500/80 transition-colors"
|
|
99
|
+
>
|
|
100
|
+
{dispatching ? (
|
|
101
|
+
<span className="flex items-center gap-1">
|
|
102
|
+
<span className="h-3 w-3 animate-spin rounded-full border border-white border-t-transparent" />
|
|
103
|
+
Dispatching...
|
|
104
|
+
</span>
|
|
105
|
+
) : (
|
|
106
|
+
<>
|
|
107
|
+
<Play className="h-3 w-3 mr-1" /> Dispatch
|
|
108
|
+
</>
|
|
109
|
+
)}
|
|
110
|
+
</Button>
|
|
111
|
+
</div>
|
|
112
|
+
</DialogContent>
|
|
113
|
+
</Dialog>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SlidersHorizontal } from 'lucide-react';
|
|
2
|
+
import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
import type { CardDisplayConfig } from '@/types';
|
|
6
|
+
|
|
7
|
+
interface CardDisplayToggleProps {
|
|
8
|
+
display: CardDisplayConfig;
|
|
9
|
+
onToggle: (field: keyof CardDisplayConfig) => void;
|
|
10
|
+
hiddenCount: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const FIELDS: { key: keyof CardDisplayConfig; label: string }[] = [
|
|
14
|
+
{ key: 'effort', label: 'Effort' },
|
|
15
|
+
{ key: 'category', label: 'Category' },
|
|
16
|
+
{ key: 'priority', label: 'Priority' },
|
|
17
|
+
{ key: 'tags', label: 'Tags' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export function CardDisplayToggle({ display, onToggle, hiddenCount }: CardDisplayToggleProps) {
|
|
21
|
+
return (
|
|
22
|
+
<Popover>
|
|
23
|
+
<PopoverTrigger asChild>
|
|
24
|
+
<Button
|
|
25
|
+
variant="outline"
|
|
26
|
+
size="sm"
|
|
27
|
+
className="gap-1.5 backdrop-blur-sm bg-white/[0.03] border-white/10"
|
|
28
|
+
aria-label="Toggle card display fields"
|
|
29
|
+
>
|
|
30
|
+
<SlidersHorizontal className="h-3 w-3" />
|
|
31
|
+
Display
|
|
32
|
+
{hiddenCount > 0 && (
|
|
33
|
+
<span className="ml-0.5 rounded-full bg-white/10 px-1.5 text-[10px]">
|
|
34
|
+
{hiddenCount}
|
|
35
|
+
</span>
|
|
36
|
+
)}
|
|
37
|
+
</Button>
|
|
38
|
+
</PopoverTrigger>
|
|
39
|
+
|
|
40
|
+
<PopoverContent align="end" className="filter-popover-glass !bg-transparent w-40">
|
|
41
|
+
<div className="space-y-0.5">
|
|
42
|
+
{FIELDS.map(({ key, label }) => {
|
|
43
|
+
const checked = display[key];
|
|
44
|
+
return (
|
|
45
|
+
<button
|
|
46
|
+
key={key}
|
|
47
|
+
onClick={() => onToggle(key)}
|
|
48
|
+
className={cn(
|
|
49
|
+
'flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors',
|
|
50
|
+
'hover:bg-white/[0.06]',
|
|
51
|
+
checked && 'bg-white/[0.06]',
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
<span
|
|
55
|
+
className={cn(
|
|
56
|
+
'flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border',
|
|
57
|
+
checked ? 'border-primary bg-primary text-primary-foreground' : 'border-white/15',
|
|
58
|
+
)}
|
|
59
|
+
>
|
|
60
|
+
{checked && (
|
|
61
|
+
<svg className="h-2.5 w-2.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={3}>
|
|
62
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" />
|
|
63
|
+
</svg>
|
|
64
|
+
)}
|
|
65
|
+
</span>
|
|
66
|
+
<span className={cn('capitalize', checked && 'text-foreground')}>{label}</span>
|
|
67
|
+
</button>
|
|
68
|
+
);
|
|
69
|
+
})}
|
|
70
|
+
</div>
|
|
71
|
+
</PopoverContent>
|
|
72
|
+
</Popover>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Plus } from 'lucide-react';
|
|
2
|
+
import { Button } from '@/components/ui/button';
|
|
3
|
+
import { useWorkflow } from '@/hooks/useWorkflow';
|
|
4
|
+
import type { Sprint } from '@/types';
|
|
5
|
+
|
|
6
|
+
interface ColumnHeaderActionsProps {
|
|
7
|
+
columnId: string;
|
|
8
|
+
dispatching?: boolean;
|
|
9
|
+
onOpenIdeaForm?: () => void;
|
|
10
|
+
onCreateGroup?: (name: string, options: { target_column: string; group_type: 'sprint' | 'batch' }) => Promise<Sprint | null>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function ColumnHeaderActions({ columnId, dispatching, onOpenIdeaForm, onCreateGroup }: ColumnHeaderActionsProps) {
|
|
14
|
+
const { engine } = useWorkflow();
|
|
15
|
+
|
|
16
|
+
const entryPointId = engine.getEntryPoint().id;
|
|
17
|
+
const list = engine.getList(columnId);
|
|
18
|
+
const isBatchColumn = list?.supportsBatch ?? false;
|
|
19
|
+
const isSprintColumn = list?.supportsSprint ?? false;
|
|
20
|
+
const isEntryPoint = columnId === entryPointId;
|
|
21
|
+
|
|
22
|
+
if (isEntryPoint && onOpenIdeaForm) {
|
|
23
|
+
return (
|
|
24
|
+
<Button
|
|
25
|
+
variant="ghost"
|
|
26
|
+
size="icon"
|
|
27
|
+
className="ml-1 h-5 w-5"
|
|
28
|
+
onClick={onOpenIdeaForm}
|
|
29
|
+
disabled={dispatching}
|
|
30
|
+
title="Add idea"
|
|
31
|
+
>
|
|
32
|
+
<Plus className="h-3 w-3" />
|
|
33
|
+
</Button>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if ((isSprintColumn || isBatchColumn) && onCreateGroup) {
|
|
38
|
+
const groupType = isBatchColumn ? 'batch' : 'sprint';
|
|
39
|
+
const label = isBatchColumn ? 'Batch' : 'Sprint';
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Button
|
|
43
|
+
variant="ghost"
|
|
44
|
+
size="icon"
|
|
45
|
+
className="ml-1 h-5 w-5"
|
|
46
|
+
onClick={() => onCreateGroup(`New ${label}`, { target_column: columnId, group_type: groupType })}
|
|
47
|
+
title={`Create ${label.toLowerCase()}`}
|
|
48
|
+
>
|
|
49
|
+
<Plus className="h-3 w-3" />
|
|
50
|
+
</Button>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { MoreVertical, ChevronUp, ChevronDown, Eye, EyeOff } from 'lucide-react';
|
|
2
|
+
import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
|
|
3
|
+
import { cn } from '@/lib/utils';
|
|
4
|
+
import type { SortField, SortDirection } from '@/hooks/useBoardSettings';
|
|
5
|
+
|
|
6
|
+
interface ColumnMenuProps {
|
|
7
|
+
sortField: SortField;
|
|
8
|
+
sortDirection: SortDirection;
|
|
9
|
+
onSetSort: (field: SortField) => void;
|
|
10
|
+
collapsed: boolean;
|
|
11
|
+
onToggleCollapse: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const SORT_OPTIONS: { field: SortField; label: string }[] = [
|
|
15
|
+
{ field: 'id', label: 'Scope ID' },
|
|
16
|
+
{ field: 'priority', label: 'Priority' },
|
|
17
|
+
{ field: 'effort', label: 'Effort' },
|
|
18
|
+
{ field: 'updated_at', label: 'Last Updated' },
|
|
19
|
+
{ field: 'created_at', label: 'Created' },
|
|
20
|
+
{ field: 'title', label: 'Alphabetical' },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export function ColumnMenu({
|
|
24
|
+
sortField,
|
|
25
|
+
sortDirection,
|
|
26
|
+
onSetSort,
|
|
27
|
+
collapsed,
|
|
28
|
+
onToggleCollapse,
|
|
29
|
+
}: ColumnMenuProps) {
|
|
30
|
+
const Arrow = sortDirection === 'asc' ? ChevronUp : ChevronDown;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Popover>
|
|
34
|
+
<PopoverTrigger asChild>
|
|
35
|
+
<button
|
|
36
|
+
className="ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-white/[0.06] hover:text-foreground"
|
|
37
|
+
aria-label="Column menu"
|
|
38
|
+
>
|
|
39
|
+
<MoreVertical className="h-3 w-3" />
|
|
40
|
+
</button>
|
|
41
|
+
</PopoverTrigger>
|
|
42
|
+
|
|
43
|
+
<PopoverContent className="filter-popover-glass !bg-transparent w-44" align="end">
|
|
44
|
+
{/* Sort options */}
|
|
45
|
+
<div className="space-y-0.5">
|
|
46
|
+
<p className="px-2 pb-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground">
|
|
47
|
+
Sort by
|
|
48
|
+
</p>
|
|
49
|
+
{SORT_OPTIONS.map((opt) => {
|
|
50
|
+
const isActive = sortField === opt.field;
|
|
51
|
+
return (
|
|
52
|
+
<button
|
|
53
|
+
key={opt.field}
|
|
54
|
+
onClick={() => onSetSort(opt.field)}
|
|
55
|
+
className={cn(
|
|
56
|
+
'flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors',
|
|
57
|
+
'hover:bg-white/[0.06]',
|
|
58
|
+
isActive && 'bg-white/[0.06]',
|
|
59
|
+
)}
|
|
60
|
+
>
|
|
61
|
+
{/* Radio indicator */}
|
|
62
|
+
<span
|
|
63
|
+
className={cn(
|
|
64
|
+
'flex h-3 w-3 shrink-0 items-center justify-center rounded-full border',
|
|
65
|
+
isActive ? 'border-primary bg-primary' : 'border-white/15',
|
|
66
|
+
)}
|
|
67
|
+
>
|
|
68
|
+
{isActive && <span className="h-1.5 w-1.5 rounded-full bg-white" />}
|
|
69
|
+
</span>
|
|
70
|
+
|
|
71
|
+
<span className={cn('flex-1 text-left', isActive && 'text-foreground')}>
|
|
72
|
+
{opt.label}
|
|
73
|
+
</span>
|
|
74
|
+
|
|
75
|
+
{isActive && <Arrow className="h-3 w-3 text-muted-foreground" />}
|
|
76
|
+
</button>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
{/* Separator */}
|
|
82
|
+
<div className="my-1.5 border-t border-white/10" />
|
|
83
|
+
|
|
84
|
+
{/* Collapse toggle */}
|
|
85
|
+
<button
|
|
86
|
+
onClick={onToggleCollapse}
|
|
87
|
+
className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors hover:bg-white/[0.06]"
|
|
88
|
+
>
|
|
89
|
+
{collapsed ? (
|
|
90
|
+
<Eye className="h-3 w-3 text-muted-foreground" />
|
|
91
|
+
) : (
|
|
92
|
+
<EyeOff className="h-3 w-3 text-muted-foreground" />
|
|
93
|
+
)}
|
|
94
|
+
<span>{collapsed ? 'Expand column' : 'Collapse column'}</span>
|
|
95
|
+
</button>
|
|
96
|
+
</PopoverContent>
|
|
97
|
+
</Popover>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { format, formatDistanceToNow } from 'date-fns';
|
|
3
|
+
import {
|
|
4
|
+
Rocket,
|
|
5
|
+
CheckCircle2,
|
|
6
|
+
XCircle,
|
|
7
|
+
Loader2,
|
|
8
|
+
} from 'lucide-react';
|
|
9
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
10
|
+
import { Badge } from '@/components/ui/badge';
|
|
11
|
+
import { cn } from '@/lib/utils';
|
|
12
|
+
import type { Deployment, DeployStatus } from '@/types';
|
|
13
|
+
|
|
14
|
+
const STATUS_CONFIG: Record<DeployStatus, {
|
|
15
|
+
icon: typeof CheckCircle2;
|
|
16
|
+
color: string;
|
|
17
|
+
label: string;
|
|
18
|
+
animate?: string;
|
|
19
|
+
}> = {
|
|
20
|
+
deploying: { icon: Loader2, color: 'text-accent-blue', label: 'Deploying', animate: 'animate-spin' },
|
|
21
|
+
healthy: { icon: CheckCircle2, color: 'text-bid-green', label: 'Healthy' },
|
|
22
|
+
failed: { icon: XCircle, color: 'text-ask-red', label: 'Failed' },
|
|
23
|
+
'rolled-back': { icon: XCircle, color: 'text-warning-amber', label: 'Rolled Back' },
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const DEFAULT_VISIBLE = 20;
|
|
27
|
+
|
|
28
|
+
interface Props {
|
|
29
|
+
deployments: Deployment[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function groupByDate(deployments: Deployment[]): Map<string, Deployment[]> {
|
|
33
|
+
const groups = new Map<string, Deployment[]>();
|
|
34
|
+
for (const d of deployments) {
|
|
35
|
+
const dateKey = d.started_at ? format(new Date(d.started_at), 'yyyy-MM-dd') : 'Unknown';
|
|
36
|
+
const existing = groups.get(dateKey);
|
|
37
|
+
if (existing) {
|
|
38
|
+
existing.push(d);
|
|
39
|
+
} else {
|
|
40
|
+
groups.set(dateKey, [d]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return groups;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function computeDuration(d: Deployment): string | null {
|
|
47
|
+
if (!d.started_at || !d.completed_at) return null;
|
|
48
|
+
const ms = new Date(d.completed_at).getTime() - new Date(d.started_at).getTime();
|
|
49
|
+
if (ms < 1000) return '<1s';
|
|
50
|
+
if (ms < 60_000) return `${Math.round(ms / 1000)}s`;
|
|
51
|
+
return `${Math.round(ms / 60_000)}m`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function DeployHistory({ deployments }: Props) {
|
|
55
|
+
const [showAll, setShowAll] = useState(false);
|
|
56
|
+
const visible = showAll ? deployments : deployments.slice(0, DEFAULT_VISIBLE);
|
|
57
|
+
const grouped = groupByDate(visible);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Card>
|
|
61
|
+
<CardHeader>
|
|
62
|
+
<CardTitle className="text-base">
|
|
63
|
+
Deployment History
|
|
64
|
+
<Badge variant="secondary" className="ml-2">
|
|
65
|
+
{deployments.length}
|
|
66
|
+
</Badge>
|
|
67
|
+
</CardTitle>
|
|
68
|
+
</CardHeader>
|
|
69
|
+
<CardContent>
|
|
70
|
+
{deployments.length === 0 ? (
|
|
71
|
+
<div className="py-8 text-center">
|
|
72
|
+
<Rocket className="mx-auto mb-3 h-10 w-10 text-muted-foreground/50" />
|
|
73
|
+
<p className="text-sm text-muted-foreground">
|
|
74
|
+
No deployments recorded yet.
|
|
75
|
+
</p>
|
|
76
|
+
</div>
|
|
77
|
+
) : (
|
|
78
|
+
<div className="space-y-4">
|
|
79
|
+
{[...grouped.entries()].map(([dateKey, deploys]) => (
|
|
80
|
+
<div key={dateKey}>
|
|
81
|
+
<div className="sticky top-0 z-10 bg-card pb-1 pt-0.5">
|
|
82
|
+
<span className="text-xxs font-medium uppercase tracking-wider text-muted-foreground">
|
|
83
|
+
{dateKey === 'Unknown' ? 'Unknown date' : format(new Date(dateKey), 'EEEE, MMM d')}
|
|
84
|
+
</span>
|
|
85
|
+
</div>
|
|
86
|
+
<div className="space-y-0.5">
|
|
87
|
+
{deploys.map((deploy) => {
|
|
88
|
+
const config = STATUS_CONFIG[deploy.status];
|
|
89
|
+
const Icon = config.icon;
|
|
90
|
+
const duration = computeDuration(deploy);
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
key={deploy.id}
|
|
94
|
+
className="flex items-center gap-4 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light"
|
|
95
|
+
>
|
|
96
|
+
<Icon className={cn('h-4 w-4 shrink-0', config.color, config.animate)} />
|
|
97
|
+
<Badge variant="outline" className="capitalize shrink-0">
|
|
98
|
+
{deploy.environment}
|
|
99
|
+
</Badge>
|
|
100
|
+
<span className="text-xs font-normal shrink-0">{config.label}</span>
|
|
101
|
+
{deploy.commit_sha && (
|
|
102
|
+
<code className="font-mono text-xs text-muted-foreground shrink-0">
|
|
103
|
+
{deploy.commit_sha.slice(0, 7)}
|
|
104
|
+
</code>
|
|
105
|
+
)}
|
|
106
|
+
{deploy.branch && (
|
|
107
|
+
<span className="truncate text-xs text-muted-foreground">
|
|
108
|
+
{deploy.branch}
|
|
109
|
+
</span>
|
|
110
|
+
)}
|
|
111
|
+
{duration && (
|
|
112
|
+
<span className="font-mono text-xs text-muted-foreground/60 shrink-0">
|
|
113
|
+
{duration}
|
|
114
|
+
</span>
|
|
115
|
+
)}
|
|
116
|
+
<span className="ml-auto text-xs text-muted-foreground/60 shrink-0">
|
|
117
|
+
{deploy.started_at
|
|
118
|
+
? formatDistanceToNow(new Date(deploy.started_at), { addSuffix: true })
|
|
119
|
+
: '—'}
|
|
120
|
+
</span>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
})}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
))}
|
|
127
|
+
|
|
128
|
+
{!showAll && deployments.length > DEFAULT_VISIBLE && (
|
|
129
|
+
<button
|
|
130
|
+
onClick={() => setShowAll(true)}
|
|
131
|
+
className="w-full rounded border border-border py-2 text-xs text-muted-foreground transition-colors hover:bg-surface-light hover:text-foreground"
|
|
132
|
+
>
|
|
133
|
+
Show all {deployments.length} deployments
|
|
134
|
+
</button>
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
)}
|
|
138
|
+
</CardContent>
|
|
139
|
+
</Card>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { ArrowRight, AlertTriangle, Terminal, Check } from 'lucide-react';
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogHeader,
|
|
7
|
+
DialogTitle,
|
|
8
|
+
DialogDescription,
|
|
9
|
+
} from '@/components/ui/dialog';
|
|
10
|
+
import { Button } from '@/components/ui/button';
|
|
11
|
+
import { Badge } from '@/components/ui/badge';
|
|
12
|
+
import { cn, formatScopeId } from '@/lib/utils';
|
|
13
|
+
import type { WorkflowEdge } from '../../shared/workflow-config';
|
|
14
|
+
import type { Scope } from '@/types';
|
|
15
|
+
|
|
16
|
+
interface DispatchModalProps {
|
|
17
|
+
open: boolean;
|
|
18
|
+
scope: Scope | null;
|
|
19
|
+
transition: WorkflowEdge | null;
|
|
20
|
+
hasActiveSession: boolean;
|
|
21
|
+
onConfirm: () => void;
|
|
22
|
+
onCancel: () => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function DispatchModal({
|
|
26
|
+
open,
|
|
27
|
+
scope,
|
|
28
|
+
transition,
|
|
29
|
+
hasActiveSession,
|
|
30
|
+
onConfirm,
|
|
31
|
+
onCancel,
|
|
32
|
+
}: DispatchModalProps) {
|
|
33
|
+
const [checked, setChecked] = useState<Set<number>>(new Set());
|
|
34
|
+
const [loading, setLoading] = useState(false);
|
|
35
|
+
|
|
36
|
+
const checklist = transition?.checklist ?? [];
|
|
37
|
+
const allChecked = checklist.length === 0 || checked.size === checklist.length;
|
|
38
|
+
|
|
39
|
+
// Reset state when modal opens
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (open) {
|
|
42
|
+
setChecked(new Set());
|
|
43
|
+
setLoading(false);
|
|
44
|
+
}
|
|
45
|
+
}, [open]);
|
|
46
|
+
|
|
47
|
+
if (!scope || !transition) return null;
|
|
48
|
+
|
|
49
|
+
const command = transition.command?.replace('{id}', String(scope.id)) ?? null;
|
|
50
|
+
|
|
51
|
+
function toggleCheck(idx: number) {
|
|
52
|
+
setChecked((prev) => {
|
|
53
|
+
const next = new Set(prev);
|
|
54
|
+
if (next.has(idx)) next.delete(idx);
|
|
55
|
+
else next.add(idx);
|
|
56
|
+
return next;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function handleConfirm() {
|
|
61
|
+
setLoading(true);
|
|
62
|
+
onConfirm();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Dialog open={open} onOpenChange={(isOpen) => { if (!isOpen) onCancel(); }}>
|
|
67
|
+
<DialogContent className="max-w-md p-0 gap-0">
|
|
68
|
+
<DialogHeader className="px-5 pt-4 pb-3">
|
|
69
|
+
{/* Transition arrow */}
|
|
70
|
+
<div className="flex items-center gap-2 mb-2">
|
|
71
|
+
<Badge variant="outline" className="text-xxs capitalize">{transition.from}</Badge>
|
|
72
|
+
<ArrowRight className="h-3.5 w-3.5 text-muted-foreground" />
|
|
73
|
+
<Badge variant="default" className="text-xxs capitalize [color:#000]">{transition.to}</Badge>
|
|
74
|
+
</div>
|
|
75
|
+
<DialogTitle className="text-sm font-normal">
|
|
76
|
+
{transition.label}
|
|
77
|
+
</DialogTitle>
|
|
78
|
+
<DialogDescription className="text-xs text-muted-foreground mt-1">
|
|
79
|
+
{transition.description}
|
|
80
|
+
</DialogDescription>
|
|
81
|
+
</DialogHeader>
|
|
82
|
+
|
|
83
|
+
<div className="px-5 pb-4 space-y-3">
|
|
84
|
+
{/* Scope info */}
|
|
85
|
+
<div className="flex items-center gap-2 text-xs">
|
|
86
|
+
<span className="font-mono text-muted-foreground">{formatScopeId(scope.id)}</span>
|
|
87
|
+
<span className="font-light truncate">{scope.title}</span>
|
|
88
|
+
{scope.category && (
|
|
89
|
+
<Badge variant="secondary" className="ml-auto text-xxs">{scope.category}</Badge>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
{/* Command block */}
|
|
94
|
+
{command && (
|
|
95
|
+
<div className="flex items-center gap-2 rounded border border-border bg-black/40 px-3 py-2">
|
|
96
|
+
<Terminal className="h-3.5 w-3.5 shrink-0 text-primary" />
|
|
97
|
+
<code className="text-xs font-mono text-primary">{command}</code>
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
{/* Checklist */}
|
|
102
|
+
{checklist.length > 0 && (
|
|
103
|
+
<div className="space-y-1.5">
|
|
104
|
+
<p className="text-xxs font-medium text-muted-foreground uppercase tracking-wider">
|
|
105
|
+
Pre-launch checklist
|
|
106
|
+
</p>
|
|
107
|
+
{checklist.map((item, idx) => (
|
|
108
|
+
<button
|
|
109
|
+
key={idx}
|
|
110
|
+
onClick={() => toggleCheck(idx)}
|
|
111
|
+
className={cn(
|
|
112
|
+
'flex w-full items-center gap-2 rounded px-2.5 py-1.5 text-xs text-left transition-colors',
|
|
113
|
+
checked.has(idx)
|
|
114
|
+
? 'bg-primary/10 text-foreground'
|
|
115
|
+
: 'bg-muted/30 text-muted-foreground hover:bg-muted/50'
|
|
116
|
+
)}
|
|
117
|
+
>
|
|
118
|
+
<div className={cn(
|
|
119
|
+
'flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border transition-colors',
|
|
120
|
+
checked.has(idx)
|
|
121
|
+
? 'border-primary bg-primary text-primary-foreground'
|
|
122
|
+
: 'border-muted-foreground/30'
|
|
123
|
+
)}>
|
|
124
|
+
{checked.has(idx) && <Check className="h-2.5 w-2.5" />}
|
|
125
|
+
</div>
|
|
126
|
+
<span className="font-light">{item}</span>
|
|
127
|
+
</button>
|
|
128
|
+
))}
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
|
|
132
|
+
{/* Active session warning */}
|
|
133
|
+
{hasActiveSession && (
|
|
134
|
+
<div className={cn(
|
|
135
|
+
'flex items-start gap-2 rounded border px-3 py-2 text-xs',
|
|
136
|
+
'border-warning-amber/30 bg-warning-amber/10 text-warning-amber'
|
|
137
|
+
)}>
|
|
138
|
+
<AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" />
|
|
139
|
+
<span>A CLI session is already running for this scope. Launching will start a new one.</span>
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
{/* Actions */}
|
|
144
|
+
<div className="flex items-center gap-2 pt-1">
|
|
145
|
+
<Button
|
|
146
|
+
onClick={handleConfirm}
|
|
147
|
+
disabled={!allChecked || loading}
|
|
148
|
+
className="flex-1"
|
|
149
|
+
>
|
|
150
|
+
{loading ? 'Launching...' : command ? 'Launch in iTerm' : 'Confirm Move'}
|
|
151
|
+
</Button>
|
|
152
|
+
<Button
|
|
153
|
+
variant="ghost"
|
|
154
|
+
onClick={onCancel}
|
|
155
|
+
disabled={loading}
|
|
156
|
+
>
|
|
157
|
+
Cancel
|
|
158
|
+
</Button>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</DialogContent>
|
|
162
|
+
</Dialog>
|
|
163
|
+
);
|
|
164
|
+
}
|