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,363 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Shield, Zap, Bot, ShieldCheck, AlertTriangle, Cog, Eye,
|
|
4
|
+
ChevronRight, Clock,
|
|
5
|
+
} from 'lucide-react';
|
|
6
|
+
import type {
|
|
7
|
+
WorkflowEdge, HookCategory, UnifiedHook, CcHookEvent,
|
|
8
|
+
} from '../../../shared/workflow-config';
|
|
9
|
+
import { HookExecutionLog } from './HookExecutionLog';
|
|
10
|
+
|
|
11
|
+
// ─── Types ──────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
interface HooksDashboardProps {
|
|
14
|
+
hooks: UnifiedHook[];
|
|
15
|
+
edges: WorkflowEdge[];
|
|
16
|
+
onHookClick: (hook: UnifiedHook) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface MatcherGroup {
|
|
20
|
+
matcher: string;
|
|
21
|
+
hooks: UnifiedHook[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ─── Constants ──────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
const CATEGORY_CONFIG: Record<HookCategory, { icon: typeof Shield; color: string; label: string }> = {
|
|
27
|
+
guard: { icon: ShieldCheck, color: '#ef4444', label: 'Guards' },
|
|
28
|
+
gate: { icon: AlertTriangle, color: '#f59e0b', label: 'Gates' },
|
|
29
|
+
lifecycle: { icon: Cog, color: '#3b82f6', label: 'Lifecycle' },
|
|
30
|
+
observer: { icon: Eye, color: '#6b7280', label: 'Observers' },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const CATEGORY_ORDER: HookCategory[] = ['guard', 'gate', 'lifecycle', 'observer'];
|
|
34
|
+
|
|
35
|
+
const CC_EVENT_ORDER: CcHookEvent[] = ['SessionStart', 'PreToolUse', 'PostToolUse', 'SessionEnd'];
|
|
36
|
+
|
|
37
|
+
const CC_EVENT_COLORS: Record<CcHookEvent, string> = {
|
|
38
|
+
SessionStart: '#22c55e',
|
|
39
|
+
PreToolUse: '#eab308',
|
|
40
|
+
PostToolUse: '#3b82f6',
|
|
41
|
+
SessionEnd: '#ef4444',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// ─── Component ──────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
export function HooksDashboard({ hooks, edges, onHookClick }: HooksDashboardProps) {
|
|
47
|
+
// Split hooks into workflow (including shared) and CC-only
|
|
48
|
+
const { workflowHooks, ccOnlyHooks, stats } = useMemo(() => {
|
|
49
|
+
const wf: UnifiedHook[] = [];
|
|
50
|
+
const cc: UnifiedHook[] = [];
|
|
51
|
+
let sharedCount = 0;
|
|
52
|
+
|
|
53
|
+
for (const h of hooks) {
|
|
54
|
+
if (h.source === 'workflow' || h.source === 'both') {
|
|
55
|
+
wf.push(h);
|
|
56
|
+
if (h.source === 'both') sharedCount++;
|
|
57
|
+
} else {
|
|
58
|
+
cc.push(h);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const edgesWithHooks = edges.filter((e) => (e.hooks ?? []).length > 0).length;
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
workflowHooks: wf,
|
|
66
|
+
ccOnlyHooks: cc,
|
|
67
|
+
stats: {
|
|
68
|
+
total: hooks.length,
|
|
69
|
+
workflow: wf.length,
|
|
70
|
+
ccOnly: cc.length,
|
|
71
|
+
shared: sharedCount,
|
|
72
|
+
edgesWithHooks,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}, [hooks, edges]);
|
|
76
|
+
|
|
77
|
+
// Group workflow hooks by category
|
|
78
|
+
const categoryGroups = useMemo(() => {
|
|
79
|
+
const groups = new Map<HookCategory, UnifiedHook[]>();
|
|
80
|
+
for (const h of workflowHooks) {
|
|
81
|
+
if (!h.workflow) continue;
|
|
82
|
+
const cat = h.workflow.category;
|
|
83
|
+
const arr = groups.get(cat);
|
|
84
|
+
if (arr) arr.push(h);
|
|
85
|
+
else groups.set(cat, [h]);
|
|
86
|
+
}
|
|
87
|
+
return groups;
|
|
88
|
+
}, [workflowHooks]);
|
|
89
|
+
|
|
90
|
+
// Group CC-only hooks by event, then by matcher within each event
|
|
91
|
+
const eventGroups = useMemo(() => {
|
|
92
|
+
const groups = new Map<CcHookEvent, MatcherGroup[]>();
|
|
93
|
+
for (const h of ccOnlyHooks) {
|
|
94
|
+
if (!h.ccTriggers?.length) continue;
|
|
95
|
+
// Use the first trigger's event as the primary grouping
|
|
96
|
+
const primaryTrigger = h.ccTriggers[0];
|
|
97
|
+
const event = primaryTrigger.event;
|
|
98
|
+
const matcher = primaryTrigger.matcher ?? '(all)';
|
|
99
|
+
|
|
100
|
+
if (!groups.has(event)) groups.set(event, []);
|
|
101
|
+
const matcherGroups = groups.get(event)!;
|
|
102
|
+
const existing = matcherGroups.find((g) => g.matcher === matcher);
|
|
103
|
+
if (existing) existing.hooks.push(h);
|
|
104
|
+
else matcherGroups.push({ matcher, hooks: [h] });
|
|
105
|
+
}
|
|
106
|
+
return groups;
|
|
107
|
+
}, [ccOnlyHooks]);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<div className="flex-1 overflow-y-auto p-4 space-y-6">
|
|
111
|
+
{/* Stats Bar */}
|
|
112
|
+
<StatsBar stats={stats} />
|
|
113
|
+
|
|
114
|
+
{/* Transition Enforcement Section */}
|
|
115
|
+
<section>
|
|
116
|
+
<div className="mb-3 flex items-center gap-2">
|
|
117
|
+
<Shield className="h-4 w-4 text-orange-400" />
|
|
118
|
+
<h2 className="text-sm font-medium text-zinc-200">Transition Enforcement</h2>
|
|
119
|
+
<span className="text-[10px] text-zinc-500">
|
|
120
|
+
{workflowHooks.length} hooks on {stats.edgesWithHooks} edges
|
|
121
|
+
</span>
|
|
122
|
+
</div>
|
|
123
|
+
<p className="mb-4 text-[11px] text-zinc-500">
|
|
124
|
+
Hooks that fire during scope transitions
|
|
125
|
+
</p>
|
|
126
|
+
|
|
127
|
+
<div className="flex gap-1 items-stretch">
|
|
128
|
+
{/* BEFORE label */}
|
|
129
|
+
<div className="flex items-center">
|
|
130
|
+
<span className="rounded-l bg-yellow-500/10 px-2 py-1 text-[9px] font-semibold uppercase tracking-wider text-yellow-500 [writing-mode:vertical-lr] rotate-180">
|
|
131
|
+
Before
|
|
132
|
+
</span>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
{/* First 3 columns: Guards, Gates, Lifecycle */}
|
|
136
|
+
<div className="grid flex-1 grid-cols-3 gap-3">
|
|
137
|
+
{CATEGORY_ORDER.slice(0, 3).map((cat, i) => (
|
|
138
|
+
<PipelineColumn
|
|
139
|
+
key={cat}
|
|
140
|
+
category={cat}
|
|
141
|
+
hooks={categoryGroups.get(cat) ?? []}
|
|
142
|
+
onHookClick={onHookClick}
|
|
143
|
+
showArrow={i < 2}
|
|
144
|
+
/>
|
|
145
|
+
))}
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
{/* BEFORE/AFTER divider */}
|
|
149
|
+
<div className="flex flex-col items-center justify-center px-2">
|
|
150
|
+
<div className="h-full w-px bg-zinc-800" />
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
{/* AFTER label */}
|
|
154
|
+
<div className="flex items-center">
|
|
155
|
+
<span className="rounded-l bg-cyan-500/10 px-2 py-1 text-[9px] font-semibold uppercase tracking-wider text-cyan-500 [writing-mode:vertical-lr] rotate-180">
|
|
156
|
+
After
|
|
157
|
+
</span>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
{/* Last column: Observers */}
|
|
161
|
+
<div className="w-56">
|
|
162
|
+
<PipelineColumn
|
|
163
|
+
category="observer"
|
|
164
|
+
hooks={categoryGroups.get('observer') ?? []}
|
|
165
|
+
onHookClick={onHookClick}
|
|
166
|
+
showArrow={false}
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</section>
|
|
171
|
+
|
|
172
|
+
{/* Session Enforcement Section */}
|
|
173
|
+
<section>
|
|
174
|
+
<div className="mb-3 flex items-center gap-2">
|
|
175
|
+
<Bot className="h-4 w-4 text-emerald-400" />
|
|
176
|
+
<h2 className="text-sm font-medium text-zinc-200">Session Enforcement</h2>
|
|
177
|
+
<span className="text-[10px] text-zinc-500">
|
|
178
|
+
{ccOnlyHooks.length} CC hooks
|
|
179
|
+
</span>
|
|
180
|
+
</div>
|
|
181
|
+
<p className="mb-4 text-[11px] text-zinc-500">
|
|
182
|
+
Hooks that fire on Claude Code tool events
|
|
183
|
+
</p>
|
|
184
|
+
|
|
185
|
+
<div className="grid grid-cols-4 gap-3">
|
|
186
|
+
{CC_EVENT_ORDER.map((event, i) => (
|
|
187
|
+
<EventColumn
|
|
188
|
+
key={event}
|
|
189
|
+
event={event}
|
|
190
|
+
matcherGroups={eventGroups.get(event) ?? []}
|
|
191
|
+
onHookClick={onHookClick}
|
|
192
|
+
showArrow={i < 3}
|
|
193
|
+
/>
|
|
194
|
+
))}
|
|
195
|
+
</div>
|
|
196
|
+
</section>
|
|
197
|
+
|
|
198
|
+
{/* Execution Log Placeholder */}
|
|
199
|
+
<section>
|
|
200
|
+
<div className="mb-3 flex items-center gap-2">
|
|
201
|
+
<Clock className="h-4 w-4 text-zinc-500" />
|
|
202
|
+
<h2 className="text-sm font-medium text-zinc-200">Execution Log</h2>
|
|
203
|
+
<span className="rounded bg-zinc-800 px-1.5 py-0.5 text-[9px] text-zinc-500">scope 079</span>
|
|
204
|
+
</div>
|
|
205
|
+
<HookExecutionLog />
|
|
206
|
+
</section>
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ─── Sub-components ─────────────────────────────────────
|
|
212
|
+
|
|
213
|
+
function StatsBar({ stats }: { stats: { total: number; workflow: number; ccOnly: number; shared: number; edgesWithHooks: number } }) {
|
|
214
|
+
return (
|
|
215
|
+
<div className="flex items-center gap-4 rounded-lg border border-zinc-800 bg-zinc-900/50 px-4 py-2.5">
|
|
216
|
+
<Stat icon={Zap} color="#f97316" label="hooks" value={stats.total} />
|
|
217
|
+
<Divider />
|
|
218
|
+
<Stat icon={Shield} color="#f97316" label="workflow" value={stats.workflow} />
|
|
219
|
+
<Divider />
|
|
220
|
+
<Stat icon={Bot} color="#10b981" label="CC-only" value={stats.ccOnly} />
|
|
221
|
+
<Divider />
|
|
222
|
+
<span className="text-[10px] text-zinc-500">
|
|
223
|
+
{stats.shared} shared scripts
|
|
224
|
+
</span>
|
|
225
|
+
</div>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function Stat({ icon: Icon, color, label, value }: {
|
|
230
|
+
icon: typeof Zap; color: string; label: string; value: number;
|
|
231
|
+
}) {
|
|
232
|
+
return (
|
|
233
|
+
<div className="flex items-center gap-1.5">
|
|
234
|
+
<Icon className="h-3.5 w-3.5" style={{ color }} />
|
|
235
|
+
<span className="text-sm font-semibold text-zinc-200">{value}</span>
|
|
236
|
+
<span className="text-[10px] text-zinc-500">{label}</span>
|
|
237
|
+
</div>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function Divider() {
|
|
242
|
+
return <div className="h-4 w-px bg-zinc-800" />;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function PipelineColumn({ category, hooks, onHookClick, showArrow }: {
|
|
246
|
+
category: HookCategory;
|
|
247
|
+
hooks: UnifiedHook[];
|
|
248
|
+
onHookClick: (hook: UnifiedHook) => void;
|
|
249
|
+
showArrow: boolean;
|
|
250
|
+
}) {
|
|
251
|
+
const config = CATEGORY_CONFIG[category];
|
|
252
|
+
const CatIcon = config.icon;
|
|
253
|
+
|
|
254
|
+
return (
|
|
255
|
+
<div className="relative">
|
|
256
|
+
{/* Column header */}
|
|
257
|
+
<div className="mb-2 flex items-center gap-1.5">
|
|
258
|
+
<CatIcon className="h-3 w-3" style={{ color: config.color }} />
|
|
259
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider" style={{ color: config.color }}>
|
|
260
|
+
{config.label}
|
|
261
|
+
</span>
|
|
262
|
+
<span className="text-[9px] text-zinc-600">({hooks.length})</span>
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
{/* Hook cards */}
|
|
266
|
+
<div className="space-y-1.5">
|
|
267
|
+
{hooks.length === 0 ? (
|
|
268
|
+
<div className="rounded border border-dashed border-zinc-800 px-3 py-4 text-center text-[10px] text-zinc-700">
|
|
269
|
+
No {config.label.toLowerCase()}
|
|
270
|
+
</div>
|
|
271
|
+
) : (
|
|
272
|
+
hooks.map((h) => (
|
|
273
|
+
<CompactHookCard key={h.id} hook={h} onHookClick={onHookClick} />
|
|
274
|
+
))
|
|
275
|
+
)}
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
{/* Flow arrow */}
|
|
279
|
+
{showArrow && (
|
|
280
|
+
<div className="absolute -right-2.5 top-1/2 -translate-y-1/2 text-zinc-700">
|
|
281
|
+
<ChevronRight className="h-4 w-4" />
|
|
282
|
+
</div>
|
|
283
|
+
)}
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function EventColumn({ event, matcherGroups, onHookClick, showArrow }: {
|
|
289
|
+
event: CcHookEvent;
|
|
290
|
+
matcherGroups: MatcherGroup[];
|
|
291
|
+
onHookClick: (hook: UnifiedHook) => void;
|
|
292
|
+
showArrow: boolean;
|
|
293
|
+
}) {
|
|
294
|
+
const color = CC_EVENT_COLORS[event];
|
|
295
|
+
const totalHooks = matcherGroups.reduce((sum, g) => sum + g.hooks.length, 0);
|
|
296
|
+
|
|
297
|
+
return (
|
|
298
|
+
<div className="relative">
|
|
299
|
+
{/* Column header */}
|
|
300
|
+
<div className="mb-2 flex items-center gap-1.5">
|
|
301
|
+
<div className="h-2 w-2 rounded-full" style={{ backgroundColor: color }} />
|
|
302
|
+
<span className="text-[10px] font-semibold uppercase tracking-wider" style={{ color }}>
|
|
303
|
+
{event}
|
|
304
|
+
</span>
|
|
305
|
+
{totalHooks > 0 && <span className="text-[9px] text-zinc-600">({totalHooks})</span>}
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
{/* Matcher sub-groups */}
|
|
309
|
+
<div className="space-y-2">
|
|
310
|
+
{matcherGroups.length === 0 ? (
|
|
311
|
+
<div className="rounded border border-dashed border-zinc-800 px-3 py-4 text-center text-[10px] text-zinc-700">
|
|
312
|
+
No hooks
|
|
313
|
+
</div>
|
|
314
|
+
) : (
|
|
315
|
+
matcherGroups.map((group) => (
|
|
316
|
+
<div key={group.matcher}>
|
|
317
|
+
{group.matcher !== '(all)' && (
|
|
318
|
+
<div className="mb-1 rounded bg-zinc-800/50 px-1.5 py-0.5 font-mono text-[9px] text-zinc-500 w-fit">
|
|
319
|
+
{group.matcher}
|
|
320
|
+
</div>
|
|
321
|
+
)}
|
|
322
|
+
<div className="space-y-1.5">
|
|
323
|
+
{group.hooks.map((h) => (
|
|
324
|
+
<CompactHookCard key={h.id} hook={h} onHookClick={onHookClick} />
|
|
325
|
+
))}
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
))
|
|
329
|
+
)}
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
{/* Flow arrow */}
|
|
333
|
+
{showArrow && (
|
|
334
|
+
<div className="absolute -right-2.5 top-1/2 -translate-y-1/2 text-zinc-700">
|
|
335
|
+
<ChevronRight className="h-4 w-4" />
|
|
336
|
+
</div>
|
|
337
|
+
)}
|
|
338
|
+
</div>
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function CompactHookCard({ hook, onHookClick }: { hook: UnifiedHook; onHookClick: (hook: UnifiedHook) => void }) {
|
|
343
|
+
const isBlocking = hook.workflow?.blocking;
|
|
344
|
+
const hasCC = hook.source === 'both';
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<button
|
|
348
|
+
onClick={() => onHookClick(hook)}
|
|
349
|
+
className="w-full rounded border bg-zinc-950/50 px-2.5 py-2 text-left transition-colors hover:border-zinc-600 hover:bg-zinc-900/70"
|
|
350
|
+
style={{ borderColor: isBlocking ? '#ef444440' : '#27272a' }}
|
|
351
|
+
>
|
|
352
|
+
<div className="flex items-center gap-1.5">
|
|
353
|
+
<span className="text-[11px] font-medium text-zinc-300 truncate">{hook.label}</span>
|
|
354
|
+
{isBlocking && <Shield className="h-2.5 w-2.5 shrink-0 text-red-400" />}
|
|
355
|
+
{hasCC && (
|
|
356
|
+
<span className="ml-auto shrink-0 rounded bg-emerald-500/15 px-1 py-0.5 text-[8px] font-bold text-emerald-400">
|
|
357
|
+
+CC
|
|
358
|
+
</span>
|
|
359
|
+
)}
|
|
360
|
+
</div>
|
|
361
|
+
</button>
|
|
362
|
+
);
|
|
363
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import { X, Trash2, Check } from 'lucide-react';
|
|
3
|
+
import type { WorkflowList, WorkflowConfig } from '../../../shared/workflow-config';
|
|
4
|
+
|
|
5
|
+
// ─── Types ──────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
interface ListPropertyEditorProps {
|
|
8
|
+
list: WorkflowList;
|
|
9
|
+
config: WorkflowConfig;
|
|
10
|
+
isNew?: boolean;
|
|
11
|
+
onSave: (updated: WorkflowList) => void;
|
|
12
|
+
onDelete: () => void;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// ─── Color Utilities ────────────────────────────────────
|
|
17
|
+
|
|
18
|
+
function hexToHsl(hex: string): string {
|
|
19
|
+
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
20
|
+
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
21
|
+
const b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
22
|
+
const max = Math.max(r, g, b);
|
|
23
|
+
const min = Math.min(r, g, b);
|
|
24
|
+
const l = (max + min) / 2;
|
|
25
|
+
if (max === min) return `0 0% ${Math.round(l * 100)}%`;
|
|
26
|
+
const d = max - min;
|
|
27
|
+
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
28
|
+
let h = 0;
|
|
29
|
+
if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
30
|
+
else if (max === g) h = ((b - r) / d + 2) / 6;
|
|
31
|
+
else h = ((r - g) / d + 4) / 6;
|
|
32
|
+
return `${Math.round(h * 360)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ─── Component ──────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
export function ListPropertyEditor({ list, config, isNew, onSave, onDelete, onClose }: ListPropertyEditorProps) {
|
|
38
|
+
const [draft, setDraft] = useState<WorkflowList>(() => structuredClone(list));
|
|
39
|
+
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
|
40
|
+
|
|
41
|
+
const existingGroups = useMemo(() => {
|
|
42
|
+
const groups = new Set(config.lists.map((l) => l.group).filter(Boolean));
|
|
43
|
+
return [...groups] as string[];
|
|
44
|
+
}, [config.lists]);
|
|
45
|
+
|
|
46
|
+
const errors = useMemo(() => {
|
|
47
|
+
const errs: string[] = [];
|
|
48
|
+
if (!draft.label.trim()) errs.push('Label is required');
|
|
49
|
+
if (!/^[a-z0-9-]+$/.test(draft.id)) errs.push('ID must be lowercase alphanumeric + hyphens');
|
|
50
|
+
if (!draft.id) errs.push('ID is required');
|
|
51
|
+
// Check unique ID (skip self)
|
|
52
|
+
if (config.lists.some((l) => l.id === draft.id && l.id !== list.id)) {
|
|
53
|
+
errs.push('ID already exists');
|
|
54
|
+
}
|
|
55
|
+
// Only one entry point
|
|
56
|
+
if (draft.isEntryPoint && config.lists.some((l) => l.isEntryPoint && l.id !== list.id)) {
|
|
57
|
+
errs.push('Another list is already the entry point');
|
|
58
|
+
}
|
|
59
|
+
return errs;
|
|
60
|
+
}, [draft, config.lists, list.id]);
|
|
61
|
+
|
|
62
|
+
const updateField = useCallback(<K extends keyof WorkflowList>(key: K, value: WorkflowList[K]) => {
|
|
63
|
+
setDraft((prev) => ({ ...prev, [key]: value }));
|
|
64
|
+
}, []);
|
|
65
|
+
|
|
66
|
+
const handleHexChange = useCallback((hex: string) => {
|
|
67
|
+
setDraft((prev) => ({ ...prev, hex, color: hexToHsl(hex) }));
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const handleSave = useCallback(() => {
|
|
71
|
+
if (errors.length > 0) return;
|
|
72
|
+
onSave(draft);
|
|
73
|
+
}, [draft, errors, onSave]);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="flex h-full w-80 shrink-0 flex-col rounded-lg border border-cyan-500/30 bg-zinc-900/95 backdrop-blur">
|
|
77
|
+
{/* Header */}
|
|
78
|
+
<div className="flex items-center justify-between border-b border-zinc-800 px-4 py-3">
|
|
79
|
+
<div className="flex items-center gap-2">
|
|
80
|
+
<div className="h-3 w-3 rounded-full" style={{ backgroundColor: draft.hex }} />
|
|
81
|
+
<span className="text-sm font-medium">{isNew ? 'New List' : 'Edit List'}</span>
|
|
82
|
+
</div>
|
|
83
|
+
<button onClick={onClose} className="rounded p-1 text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300">
|
|
84
|
+
<X className="h-4 w-4" />
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
{/* Form */}
|
|
89
|
+
<div className="flex-1 space-y-3 overflow-y-auto p-4 text-xs">
|
|
90
|
+
{/* ID */}
|
|
91
|
+
<FieldGroup label="ID">
|
|
92
|
+
<input
|
|
93
|
+
value={draft.id}
|
|
94
|
+
onChange={(e) => updateField('id', e.target.value)}
|
|
95
|
+
disabled={!isNew}
|
|
96
|
+
className="w-full rounded border border-zinc-700 bg-zinc-800 px-2.5 py-1.5 font-mono text-zinc-200 outline-none placeholder:text-zinc-600 focus:border-zinc-500 disabled:opacity-50"
|
|
97
|
+
placeholder="e.g. review"
|
|
98
|
+
/>
|
|
99
|
+
</FieldGroup>
|
|
100
|
+
|
|
101
|
+
{/* Label */}
|
|
102
|
+
<FieldGroup label="Label">
|
|
103
|
+
<input
|
|
104
|
+
value={draft.label}
|
|
105
|
+
onChange={(e) => updateField('label', e.target.value)}
|
|
106
|
+
className="w-full rounded border border-zinc-700 bg-zinc-800 px-2.5 py-1.5 text-zinc-200 outline-none placeholder:text-zinc-600 focus:border-zinc-500"
|
|
107
|
+
placeholder="e.g. Review"
|
|
108
|
+
/>
|
|
109
|
+
</FieldGroup>
|
|
110
|
+
|
|
111
|
+
{/* Color */}
|
|
112
|
+
<FieldGroup label="Color">
|
|
113
|
+
<div className="flex items-center gap-2">
|
|
114
|
+
<input
|
|
115
|
+
type="color"
|
|
116
|
+
value={draft.hex}
|
|
117
|
+
onChange={(e) => handleHexChange(e.target.value)}
|
|
118
|
+
className="h-8 w-8 cursor-pointer rounded border border-zinc-700 bg-zinc-800 p-0.5"
|
|
119
|
+
/>
|
|
120
|
+
<input
|
|
121
|
+
value={draft.hex}
|
|
122
|
+
onChange={(e) => handleHexChange(e.target.value)}
|
|
123
|
+
className="flex-1 rounded border border-zinc-700 bg-zinc-800 px-2.5 py-1.5 font-mono text-zinc-200 outline-none focus:border-zinc-500"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
</FieldGroup>
|
|
127
|
+
|
|
128
|
+
{/* Order */}
|
|
129
|
+
<FieldGroup label="Order">
|
|
130
|
+
<input
|
|
131
|
+
type="number"
|
|
132
|
+
value={draft.order}
|
|
133
|
+
onChange={(e) => updateField('order', parseInt(e.target.value, 10) || 0)}
|
|
134
|
+
className="w-full rounded border border-zinc-700 bg-zinc-800 px-2.5 py-1.5 text-zinc-200 outline-none focus:border-zinc-500"
|
|
135
|
+
/>
|
|
136
|
+
</FieldGroup>
|
|
137
|
+
|
|
138
|
+
{/* Group */}
|
|
139
|
+
<FieldGroup label="Group">
|
|
140
|
+
<select
|
|
141
|
+
value={draft.group ?? ''}
|
|
142
|
+
onChange={(e) => updateField('group', e.target.value || undefined)}
|
|
143
|
+
className="w-full rounded border border-zinc-700 bg-zinc-800 px-2.5 py-1.5 text-zinc-200 outline-none focus:border-zinc-500"
|
|
144
|
+
>
|
|
145
|
+
<option value="">None</option>
|
|
146
|
+
{existingGroups.map((g) => (
|
|
147
|
+
<option key={g} value={g}>{g}</option>
|
|
148
|
+
))}
|
|
149
|
+
</select>
|
|
150
|
+
</FieldGroup>
|
|
151
|
+
|
|
152
|
+
{/* Git Branch */}
|
|
153
|
+
<FieldGroup label="Git Branch (optional)">
|
|
154
|
+
<input
|
|
155
|
+
value={draft.gitBranch ?? ''}
|
|
156
|
+
onChange={(e) => updateField('gitBranch', e.target.value || undefined)}
|
|
157
|
+
className="w-full rounded border border-zinc-700 bg-zinc-800 px-2.5 py-1.5 font-mono text-zinc-200 outline-none placeholder:text-zinc-600 focus:border-zinc-500"
|
|
158
|
+
placeholder="e.g. dev"
|
|
159
|
+
/>
|
|
160
|
+
</FieldGroup>
|
|
161
|
+
|
|
162
|
+
{/* Session Key */}
|
|
163
|
+
<FieldGroup label="Session Key (optional)">
|
|
164
|
+
<input
|
|
165
|
+
value={draft.sessionKey ?? ''}
|
|
166
|
+
onChange={(e) => updateField('sessionKey', e.target.value || undefined)}
|
|
167
|
+
className="w-full rounded border border-zinc-700 bg-zinc-800 px-2.5 py-1.5 font-mono text-zinc-200 outline-none placeholder:text-zinc-600 focus:border-zinc-500"
|
|
168
|
+
placeholder="e.g. COMMIT_SESSION"
|
|
169
|
+
/>
|
|
170
|
+
</FieldGroup>
|
|
171
|
+
|
|
172
|
+
{/* Flags */}
|
|
173
|
+
<FieldGroup label="Flags">
|
|
174
|
+
<div className="space-y-2">
|
|
175
|
+
<ToggleFlag label="Entry Point" checked={draft.isEntryPoint ?? false} onChange={(v) => updateField('isEntryPoint', v || undefined)} />
|
|
176
|
+
<ToggleFlag label="Has Directory" checked={draft.hasDirectory} onChange={(v) => updateField('hasDirectory', v)} />
|
|
177
|
+
<ToggleFlag label="Supports Batch" checked={draft.supportsBatch ?? false} onChange={(v) => updateField('supportsBatch', v || undefined)} />
|
|
178
|
+
<ToggleFlag label="Supports Sprint" checked={draft.supportsSprint ?? false} onChange={(v) => updateField('supportsSprint', v || undefined)} />
|
|
179
|
+
</div>
|
|
180
|
+
</FieldGroup>
|
|
181
|
+
|
|
182
|
+
{/* Validation errors */}
|
|
183
|
+
{errors.length > 0 && (
|
|
184
|
+
<div className="rounded border border-red-500/30 bg-red-500/10 p-2.5">
|
|
185
|
+
{errors.map((e) => (
|
|
186
|
+
<p key={e} className="text-[10px] text-red-400">{e}</p>
|
|
187
|
+
))}
|
|
188
|
+
</div>
|
|
189
|
+
)}
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
{/* Footer */}
|
|
193
|
+
<div className="flex items-center gap-2 border-t border-zinc-800 px-4 py-3">
|
|
194
|
+
{!isNew && (
|
|
195
|
+
showDeleteConfirm ? (
|
|
196
|
+
<div className="flex items-center gap-1.5">
|
|
197
|
+
<span className="text-[10px] text-red-400">Confirm?</span>
|
|
198
|
+
<button onClick={onDelete} className="rounded bg-red-500/20 px-2 py-1 text-[10px] text-red-400 hover:bg-red-500/30">
|
|
199
|
+
Delete
|
|
200
|
+
</button>
|
|
201
|
+
<button onClick={() => setShowDeleteConfirm(false)} className="rounded px-2 py-1 text-[10px] text-zinc-500 hover:text-zinc-300">
|
|
202
|
+
Cancel
|
|
203
|
+
</button>
|
|
204
|
+
</div>
|
|
205
|
+
) : (
|
|
206
|
+
<button
|
|
207
|
+
onClick={() => setShowDeleteConfirm(true)}
|
|
208
|
+
className="rounded p-1.5 text-zinc-600 hover:bg-red-500/10 hover:text-red-400"
|
|
209
|
+
>
|
|
210
|
+
<Trash2 className="h-3.5 w-3.5" />
|
|
211
|
+
</button>
|
|
212
|
+
)
|
|
213
|
+
)}
|
|
214
|
+
<div className="flex-1" />
|
|
215
|
+
<button
|
|
216
|
+
onClick={handleSave}
|
|
217
|
+
disabled={errors.length > 0}
|
|
218
|
+
className="flex items-center gap-1.5 rounded bg-cyan-600 px-3 py-1.5 text-[11px] font-medium text-white hover:bg-cyan-500 disabled:opacity-40"
|
|
219
|
+
>
|
|
220
|
+
<Check className="h-3 w-3" />
|
|
221
|
+
Apply
|
|
222
|
+
</button>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ─── Sub-components ─────────────────────────────────────
|
|
229
|
+
|
|
230
|
+
function FieldGroup({ label, children }: { label: string; children: React.ReactNode }) {
|
|
231
|
+
return (
|
|
232
|
+
<div>
|
|
233
|
+
<label className="mb-1 block text-[10px] font-semibold uppercase tracking-wider text-zinc-500">{label}</label>
|
|
234
|
+
{children}
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function ToggleFlag({ label, checked, onChange }: { label: string; checked: boolean; onChange: (v: boolean) => void }) {
|
|
240
|
+
return (
|
|
241
|
+
<label className="flex cursor-pointer items-center gap-2">
|
|
242
|
+
<input
|
|
243
|
+
type="checkbox"
|
|
244
|
+
checked={checked}
|
|
245
|
+
onChange={(e) => onChange(e.target.checked)}
|
|
246
|
+
className="h-3.5 w-3.5 rounded border-zinc-600 bg-zinc-800 text-cyan-500 focus:ring-0 focus:ring-offset-0"
|
|
247
|
+
/>
|
|
248
|
+
<span className="text-zinc-300">{label}</span>
|
|
249
|
+
</label>
|
|
250
|
+
);
|
|
251
|
+
}
|