orbital-command 0.2.0 → 1.0.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/README.md +67 -42
- package/bin/commands/config.js +19 -0
- package/bin/commands/events.js +40 -0
- package/bin/commands/launch.js +126 -0
- package/bin/commands/manifest.js +283 -0
- package/bin/commands/registry.js +104 -0
- package/bin/commands/update.js +24 -0
- package/bin/lib/helpers.js +229 -0
- package/bin/orbital.js +147 -319
- package/dist/assets/Landing-CfQdHR0N.js +11 -0
- package/dist/assets/PrimitivesConfig-DThSipFy.js +32 -0
- package/dist/assets/QualityGates-B4kxM5UU.js +26 -0
- package/dist/assets/SessionTimeline-Bz1iZnmg.js +1 -0
- package/dist/assets/Settings-DLcZwbCT.js +12 -0
- package/dist/assets/SourceControl-BMNIz7Lt.js +36 -0
- package/dist/assets/WorkflowVisualizer-CxuSBOYu.js +69 -0
- package/dist/assets/arrow-down-DVPp6_qp.js +6 -0
- package/dist/assets/bot-NFaJBDn_.js +6 -0
- package/dist/assets/charts-LGLb8hyU.js +68 -0
- package/dist/assets/circle-x-IsFCkBZu.js +6 -0
- package/dist/assets/file-text-J1cebZXF.js +6 -0
- package/dist/assets/globe-WzeyHsUc.js +6 -0
- package/dist/assets/index-BdJ57EhC.css +1 -0
- package/dist/assets/index-o4ScMAuR.js +349 -0
- package/dist/assets/key-CKR8JJSj.js +6 -0
- package/dist/assets/minus-CHBsJyjp.js +6 -0
- package/dist/assets/radio-xqZaR-Uk.js +6 -0
- package/dist/assets/rocket-D_xvvNG6.js +6 -0
- package/dist/assets/shield-TdB1yv_a.js +6 -0
- package/dist/assets/ui-BmsSg9jU.js +53 -0
- package/dist/assets/useSocketListener-0L5yiN5i.js +1 -0
- package/dist/assets/useWorkflowEditor-CqeRWVQX.js +11 -0
- package/dist/assets/{vendor-Dzv9lrRc.js → vendor-Bqt8AJn2.js} +1 -1
- package/dist/assets/workflow-constants-Rw-GmgHZ.js +6 -0
- package/dist/assets/zap-C9wqYMpl.js +6 -0
- package/dist/favicon.svg +1 -0
- package/dist/index.html +6 -5
- package/dist/server/server/__tests__/data-routes.test.js +126 -0
- package/dist/server/server/__tests__/helpers/db.js +17 -0
- package/dist/server/server/__tests__/helpers/mock-emitter.js +8 -0
- package/dist/server/server/__tests__/scope-routes.test.js +138 -0
- package/dist/server/server/__tests__/sprint-routes.test.js +102 -0
- package/dist/server/server/__tests__/workflow-routes.test.js +107 -0
- package/dist/server/server/config-migrator.js +135 -0
- package/dist/server/server/config.js +51 -7
- package/dist/server/server/database.js +21 -28
- package/dist/server/server/global-config.js +143 -0
- package/dist/server/server/index.js +118 -276
- package/dist/server/server/init.js +243 -225
- package/dist/server/server/launch.js +29 -0
- package/dist/server/server/manifest-types.js +8 -0
- package/dist/server/server/manifest.js +454 -0
- package/dist/server/server/migrate-legacy.js +229 -0
- package/dist/server/server/parsers/event-parser.js +4 -1
- package/dist/server/server/parsers/event-parser.test.js +117 -0
- package/dist/server/server/parsers/scope-parser.js +74 -28
- package/dist/server/server/parsers/scope-parser.test.js +230 -0
- package/dist/server/server/project-context.js +265 -0
- package/dist/server/server/project-emitter.js +41 -0
- package/dist/server/server/project-manager.js +297 -0
- package/dist/server/server/routes/aggregate-routes.js +871 -0
- package/dist/server/server/routes/config-routes.js +41 -90
- package/dist/server/server/routes/data-routes.js +25 -123
- package/dist/server/server/routes/dispatch-routes.js +37 -15
- package/dist/server/server/routes/git-routes.js +74 -0
- package/dist/server/server/routes/manifest-routes.js +319 -0
- package/dist/server/server/routes/scope-routes.js +45 -28
- package/dist/server/server/routes/sync-routes.js +134 -0
- package/dist/server/server/routes/version-routes.js +1 -15
- package/dist/server/server/routes/workflow-routes.js +9 -3
- package/dist/server/server/schema.js +3 -0
- package/dist/server/server/services/batch-orchestrator.js +41 -17
- package/dist/server/server/services/claude-session-service.js +17 -14
- package/dist/server/server/services/config-service.js +10 -1
- package/dist/server/server/services/deploy-service.test.js +119 -0
- package/dist/server/server/services/event-service.js +64 -1
- package/dist/server/server/services/event-service.test.js +191 -0
- package/dist/server/server/services/gate-service.test.js +105 -0
- package/dist/server/server/services/git-service.js +108 -4
- package/dist/server/server/services/github-service.js +110 -2
- package/dist/server/server/services/readiness-service.test.js +190 -0
- package/dist/server/server/services/scope-cache.js +5 -1
- package/dist/server/server/services/scope-cache.test.js +142 -0
- package/dist/server/server/services/scope-service.js +222 -131
- package/dist/server/server/services/scope-service.test.js +137 -0
- package/dist/server/server/services/sprint-orchestrator.js +29 -15
- package/dist/server/server/services/sprint-service.js +23 -3
- package/dist/server/server/services/sprint-service.test.js +238 -0
- package/dist/server/server/services/sync-service.js +434 -0
- package/dist/server/server/services/sync-types.js +2 -0
- package/dist/server/server/services/workflow-service.js +26 -5
- package/dist/server/server/services/workflow-service.test.js +159 -0
- package/dist/server/server/settings-sync.js +284 -0
- package/dist/server/server/uninstall.js +195 -0
- package/dist/server/server/update-planner.js +279 -0
- package/dist/server/server/update.js +212 -0
- package/dist/server/server/utils/cc-hooks-parser.js +3 -0
- package/dist/server/server/utils/cc-hooks-parser.test.js +86 -0
- package/dist/server/server/utils/dispatch-utils.js +83 -24
- package/dist/server/server/utils/dispatch-utils.test.js +182 -0
- package/dist/server/server/utils/flag-builder.js +54 -0
- package/dist/server/server/utils/json-fields.js +14 -0
- package/dist/server/server/utils/json-fields.test.js +73 -0
- package/dist/server/server/utils/logger.js +37 -3
- package/dist/server/server/utils/package-info.js +30 -0
- package/dist/server/server/utils/route-helpers.js +47 -0
- package/dist/server/server/utils/route-helpers.test.js +115 -0
- package/dist/server/server/utils/terminal-launcher.js +79 -25
- package/dist/server/server/utils/worktree-manager.js +13 -4
- package/dist/server/server/validator.js +230 -0
- package/dist/server/server/watchers/event-watcher.js +28 -13
- package/dist/server/server/watchers/global-watcher.js +63 -0
- package/dist/server/server/watchers/scope-watcher.js +27 -12
- package/dist/server/server/wizard/config-editor.js +237 -0
- package/dist/server/server/wizard/detect.js +96 -0
- package/dist/server/server/wizard/doctor.js +115 -0
- package/dist/server/server/wizard/index.js +340 -0
- package/dist/server/server/wizard/phases/confirm.js +39 -0
- package/dist/server/server/wizard/phases/project-setup.js +90 -0
- package/dist/server/server/wizard/phases/setup-wizard.js +66 -0
- package/dist/server/server/wizard/phases/welcome.js +32 -0
- package/dist/server/server/wizard/phases/workflow-setup.js +22 -0
- package/dist/server/server/wizard/types.js +29 -0
- package/dist/server/server/wizard/ui.js +73 -0
- package/dist/server/shared/__fixtures__/workflow-configs.js +75 -0
- package/dist/server/shared/api-types.js +80 -1
- package/dist/server/shared/default-workflow.json +65 -0
- package/dist/server/shared/onboarding-tour.test.js +81 -0
- package/dist/server/shared/project-colors.js +24 -0
- package/dist/server/shared/workflow-config.test.js +84 -0
- package/dist/server/shared/workflow-engine.js +1 -1
- package/dist/server/shared/workflow-engine.test.js +302 -0
- package/dist/server/shared/workflow-normalizer.js +101 -0
- package/dist/server/shared/workflow-normalizer.test.js +100 -0
- package/dist/server/src/components/onboarding/tour-steps.js +84 -0
- package/package.json +34 -29
- package/schemas/orbital.config.schema.json +2 -5
- package/scripts/postinstall.js +18 -6
- package/scripts/release.sh +53 -0
- package/server/__tests__/data-routes.test.ts +151 -0
- package/server/__tests__/helpers/db.ts +19 -0
- package/server/__tests__/helpers/mock-emitter.ts +10 -0
- package/server/__tests__/scope-routes.test.ts +158 -0
- package/server/__tests__/sprint-routes.test.ts +118 -0
- package/server/__tests__/workflow-routes.test.ts +120 -0
- package/server/config-migrator.ts +160 -0
- package/server/config.ts +64 -12
- package/server/database.ts +22 -31
- package/server/global-config.ts +204 -0
- package/server/index.ts +139 -316
- package/server/init.ts +266 -234
- package/server/launch.ts +32 -0
- package/server/manifest-types.ts +145 -0
- package/server/manifest.ts +494 -0
- package/server/migrate-legacy.ts +290 -0
- package/server/parsers/event-parser.test.ts +135 -0
- package/server/parsers/event-parser.ts +4 -1
- package/server/parsers/scope-parser.test.ts +270 -0
- package/server/parsers/scope-parser.ts +79 -31
- package/server/project-context.ts +325 -0
- package/server/project-emitter.ts +50 -0
- package/server/project-manager.ts +368 -0
- package/server/routes/aggregate-routes.ts +968 -0
- package/server/routes/config-routes.ts +43 -85
- package/server/routes/data-routes.ts +34 -156
- package/server/routes/dispatch-routes.ts +46 -17
- package/server/routes/git-routes.ts +77 -0
- package/server/routes/manifest-routes.ts +388 -0
- package/server/routes/scope-routes.ts +39 -30
- package/server/routes/sync-routes.ts +175 -0
- package/server/routes/version-routes.ts +1 -16
- package/server/routes/workflow-routes.ts +9 -3
- package/server/schema.ts +3 -0
- package/server/services/batch-orchestrator.ts +41 -17
- package/server/services/claude-session-service.ts +16 -14
- package/server/services/config-service.ts +10 -1
- package/server/services/deploy-service.test.ts +145 -0
- package/server/services/deploy-service.ts +2 -2
- package/server/services/event-service.test.ts +242 -0
- package/server/services/event-service.ts +92 -3
- package/server/services/gate-service.test.ts +131 -0
- package/server/services/gate-service.ts +2 -2
- package/server/services/git-service.ts +137 -4
- package/server/services/github-service.ts +120 -2
- package/server/services/readiness-service.test.ts +217 -0
- package/server/services/scope-cache.test.ts +167 -0
- package/server/services/scope-cache.ts +4 -1
- package/server/services/scope-service.test.ts +169 -0
- package/server/services/scope-service.ts +224 -130
- package/server/services/sprint-orchestrator.ts +30 -15
- package/server/services/sprint-service.test.ts +271 -0
- package/server/services/sprint-service.ts +29 -5
- package/server/services/sync-service.ts +482 -0
- package/server/services/sync-types.ts +77 -0
- package/server/services/workflow-service.test.ts +190 -0
- package/server/services/workflow-service.ts +29 -9
- package/server/settings-sync.ts +359 -0
- package/server/uninstall.ts +214 -0
- package/server/update-planner.ts +346 -0
- package/server/update.ts +263 -0
- package/server/utils/cc-hooks-parser.test.ts +96 -0
- package/server/utils/cc-hooks-parser.ts +4 -0
- package/server/utils/dispatch-utils.test.ts +245 -0
- package/server/utils/dispatch-utils.ts +102 -30
- package/server/utils/flag-builder.ts +56 -0
- package/server/utils/json-fields.test.ts +83 -0
- package/server/utils/json-fields.ts +14 -0
- package/server/utils/logger.ts +40 -3
- package/server/utils/package-info.ts +32 -0
- package/server/utils/route-helpers.test.ts +144 -0
- package/server/utils/route-helpers.ts +50 -0
- package/server/utils/terminal-launcher.ts +85 -25
- package/server/utils/worktree-manager.ts +9 -4
- package/server/validator.ts +270 -0
- package/server/watchers/event-watcher.ts +24 -12
- package/server/watchers/global-watcher.ts +77 -0
- package/server/watchers/scope-watcher.ts +21 -9
- package/server/wizard/config-editor.ts +248 -0
- package/server/wizard/detect.ts +104 -0
- package/server/wizard/doctor.ts +114 -0
- package/server/wizard/index.ts +438 -0
- package/server/wizard/phases/confirm.ts +45 -0
- package/server/wizard/phases/project-setup.ts +106 -0
- package/server/wizard/phases/setup-wizard.ts +78 -0
- package/server/wizard/phases/welcome.ts +39 -0
- package/server/wizard/phases/workflow-setup.ts +28 -0
- package/server/wizard/types.ts +56 -0
- package/server/wizard/ui.ts +92 -0
- package/shared/__fixtures__/workflow-configs.ts +80 -0
- package/shared/api-types.ts +106 -0
- package/shared/onboarding-tour.test.ts +94 -0
- package/shared/project-colors.ts +24 -0
- package/shared/workflow-config.test.ts +111 -0
- package/shared/workflow-config.ts +7 -0
- package/shared/workflow-engine.test.ts +388 -0
- package/shared/workflow-engine.ts +1 -1
- package/shared/workflow-normalizer.test.ts +119 -0
- package/shared/workflow-normalizer.ts +118 -0
- package/templates/agents/QUICK-REFERENCE.md +1 -0
- package/templates/agents/README.md +1 -0
- package/templates/agents/SKILL-TRIGGERS.md +11 -0
- package/templates/agents/green-team/deep-dive.md +361 -0
- package/templates/hooks/end-session.sh +4 -1
- package/templates/hooks/init-session.sh +1 -0
- package/templates/hooks/orbital-emit.sh +2 -2
- package/templates/hooks/orbital-report-deploy.sh +4 -4
- package/templates/hooks/orbital-report-gates.sh +4 -4
- package/templates/hooks/orbital-scope-update.sh +1 -1
- package/templates/hooks/scope-commit-logger.sh +2 -2
- package/templates/hooks/scope-create-cleanup.sh +2 -2
- package/templates/hooks/scope-create-gate.sh +2 -5
- package/templates/hooks/scope-gate.sh +4 -6
- package/templates/hooks/scope-helpers.sh +28 -1
- package/templates/hooks/scope-lifecycle-gate.sh +14 -5
- package/templates/hooks/scope-prepare.sh +67 -12
- package/templates/hooks/scope-transition.sh +14 -6
- package/templates/hooks/time-tracker.sh +2 -5
- package/templates/migrations/renames.json +1 -0
- package/templates/orbital.config.json +8 -6
- package/{shared/default-workflow.json → templates/presets/default.json} +65 -0
- package/templates/presets/development.json +4 -4
- package/templates/presets/gitflow.json +7 -0
- package/templates/prompts/README.md +23 -0
- package/templates/prompts/deep-dive-audit.md +94 -0
- package/templates/quick/rules.md +56 -5
- package/templates/settings-hooks.json +1 -1
- package/templates/skills/git-commit/SKILL.md +27 -7
- package/templates/skills/git-dev/SKILL.md +13 -4
- package/templates/skills/git-main/SKILL.md +13 -3
- package/templates/skills/git-production/SKILL.md +9 -2
- package/templates/skills/git-staging/SKILL.md +11 -3
- package/templates/skills/scope-create/SKILL.md +17 -3
- package/templates/skills/scope-fix-review/SKILL.md +14 -7
- package/templates/skills/scope-implement/SKILL.md +15 -4
- package/templates/skills/scope-post-review/SKILL.md +77 -7
- package/templates/skills/scope-pre-review/SKILL.md +11 -4
- package/templates/skills/scope-verify/SKILL.md +5 -3
- package/templates/skills/test-code-review/SKILL.md +41 -33
- package/templates/skills/test-scaffold/SKILL.md +222 -0
- package/dist/assets/WorkflowVisualizer-BZ21PIIF.js +0 -84
- package/dist/assets/charts-D__PA1zp.js +0 -72
- package/dist/assets/index-D1G6i0nS.css +0 -1
- package/dist/assets/index-DpItvKpf.js +0 -419
- package/dist/assets/ui-BvF022GT.js +0 -53
- package/index.html +0 -15
- package/postcss.config.js +0 -6
- package/src/App.tsx +0 -33
- package/src/components/AgentBadge.tsx +0 -40
- package/src/components/BatchPreflightModal.tsx +0 -115
- package/src/components/CardDisplayToggle.tsx +0 -74
- package/src/components/ColumnHeaderActions.tsx +0 -55
- package/src/components/ColumnMenu.tsx +0 -99
- package/src/components/DeployHistory.tsx +0 -141
- package/src/components/DispatchModal.tsx +0 -164
- package/src/components/DispatchPopover.tsx +0 -139
- package/src/components/DragOverlay.tsx +0 -25
- package/src/components/DriftSidebar.tsx +0 -140
- package/src/components/EnvironmentStrip.tsx +0 -88
- package/src/components/ErrorBoundary.tsx +0 -62
- package/src/components/FilterChip.tsx +0 -105
- package/src/components/GateIndicator.tsx +0 -33
- package/src/components/IdeaDetailModal.tsx +0 -190
- package/src/components/IdeaFormDialog.tsx +0 -113
- package/src/components/KanbanColumn.tsx +0 -201
- package/src/components/MarkdownRenderer.tsx +0 -114
- package/src/components/NeonGrid.tsx +0 -128
- package/src/components/PromotionQueue.tsx +0 -89
- package/src/components/ScopeCard.tsx +0 -234
- package/src/components/ScopeDetailModal.tsx +0 -255
- package/src/components/ScopeFilterBar.tsx +0 -152
- package/src/components/SearchInput.tsx +0 -102
- package/src/components/SessionPanel.tsx +0 -335
- package/src/components/SprintContainer.tsx +0 -303
- package/src/components/SprintDependencyDialog.tsx +0 -78
- package/src/components/SprintPreflightModal.tsx +0 -138
- package/src/components/StatusBar.tsx +0 -168
- package/src/components/SwimCell.tsx +0 -67
- package/src/components/SwimLaneRow.tsx +0 -94
- package/src/components/SwimlaneBoardView.tsx +0 -108
- package/src/components/VersionBadge.tsx +0 -139
- package/src/components/ViewModeSelector.tsx +0 -114
- package/src/components/config/AgentChip.tsx +0 -53
- package/src/components/config/AgentCreateDialog.tsx +0 -321
- package/src/components/config/AgentEditor.tsx +0 -175
- package/src/components/config/DirectoryTree.tsx +0 -582
- package/src/components/config/FileEditor.tsx +0 -550
- package/src/components/config/HookChip.tsx +0 -50
- package/src/components/config/StageCard.tsx +0 -198
- package/src/components/config/TransitionZone.tsx +0 -173
- package/src/components/config/UnifiedWorkflowPipeline.tsx +0 -216
- package/src/components/config/WorkflowPipeline.tsx +0 -161
- package/src/components/source-control/BranchList.tsx +0 -93
- package/src/components/source-control/BranchPanel.tsx +0 -105
- package/src/components/source-control/CommitLog.tsx +0 -100
- package/src/components/source-control/CommitRow.tsx +0 -47
- package/src/components/source-control/GitHubPanel.tsx +0 -110
- package/src/components/source-control/GitHubSetupGuide.tsx +0 -52
- package/src/components/source-control/GitOverviewBar.tsx +0 -101
- package/src/components/source-control/PullRequestList.tsx +0 -69
- package/src/components/source-control/WorktreeList.tsx +0 -80
- package/src/components/ui/badge.tsx +0 -41
- package/src/components/ui/button.tsx +0 -55
- package/src/components/ui/card.tsx +0 -78
- package/src/components/ui/dialog.tsx +0 -94
- package/src/components/ui/popover.tsx +0 -33
- package/src/components/ui/scroll-area.tsx +0 -54
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/tabs.tsx +0 -52
- package/src/components/ui/toggle-switch.tsx +0 -35
- package/src/components/ui/tooltip.tsx +0 -27
- package/src/components/workflow/AddEdgeDialog.tsx +0 -217
- package/src/components/workflow/AddListDialog.tsx +0 -201
- package/src/components/workflow/ChecklistEditor.tsx +0 -239
- package/src/components/workflow/CommandPrefixManager.tsx +0 -118
- package/src/components/workflow/ConfigSettingsPanel.tsx +0 -189
- package/src/components/workflow/DirectionSelector.tsx +0 -133
- package/src/components/workflow/DispatchConfigPanel.tsx +0 -180
- package/src/components/workflow/EdgeDetailPanel.tsx +0 -236
- package/src/components/workflow/EdgePropertyEditor.tsx +0 -251
- package/src/components/workflow/EditToolbar.tsx +0 -138
- package/src/components/workflow/HookDetailPanel.tsx +0 -250
- package/src/components/workflow/HookExecutionLog.tsx +0 -24
- package/src/components/workflow/HookSourceModal.tsx +0 -129
- package/src/components/workflow/HooksDashboard.tsx +0 -363
- package/src/components/workflow/ListPropertyEditor.tsx +0 -251
- package/src/components/workflow/MigrationPreviewDialog.tsx +0 -237
- package/src/components/workflow/MovementRulesPanel.tsx +0 -188
- package/src/components/workflow/NodeDetailPanel.tsx +0 -245
- package/src/components/workflow/PresetSelector.tsx +0 -414
- package/src/components/workflow/SkillCommandBuilder.tsx +0 -174
- package/src/components/workflow/WorkflowEdgeComponent.tsx +0 -145
- package/src/components/workflow/WorkflowNode.tsx +0 -147
- package/src/components/workflow/graphLayout.ts +0 -186
- package/src/components/workflow/mergeHooks.ts +0 -85
- package/src/components/workflow/useEditHistory.ts +0 -88
- package/src/components/workflow/useWorkflowEditor.ts +0 -262
- package/src/components/workflow/validateConfig.ts +0 -70
- package/src/hooks/useActiveDispatches.ts +0 -198
- package/src/hooks/useBoardSettings.ts +0 -170
- package/src/hooks/useCardDisplay.ts +0 -57
- package/src/hooks/useCcHooks.ts +0 -24
- package/src/hooks/useConfigTree.ts +0 -51
- package/src/hooks/useEnforcementRules.ts +0 -46
- package/src/hooks/useEvents.ts +0 -59
- package/src/hooks/useFileEditor.ts +0 -165
- package/src/hooks/useGates.ts +0 -57
- package/src/hooks/useIdeaActions.ts +0 -53
- package/src/hooks/useKanbanDnd.ts +0 -410
- package/src/hooks/useOrbitalConfig.ts +0 -54
- package/src/hooks/usePipeline.ts +0 -47
- package/src/hooks/usePipelineData.ts +0 -338
- package/src/hooks/useReconnect.ts +0 -25
- package/src/hooks/useScopeFilters.ts +0 -125
- package/src/hooks/useScopeSessions.ts +0 -44
- package/src/hooks/useScopes.ts +0 -67
- package/src/hooks/useSearch.ts +0 -67
- package/src/hooks/useSettings.tsx +0 -187
- package/src/hooks/useSocket.ts +0 -25
- package/src/hooks/useSourceControl.ts +0 -105
- package/src/hooks/useSprintPreflight.ts +0 -55
- package/src/hooks/useSprints.ts +0 -154
- package/src/hooks/useStatusBarHighlight.ts +0 -18
- package/src/hooks/useSwimlaneBoardSettings.ts +0 -104
- package/src/hooks/useTheme.ts +0 -9
- package/src/hooks/useTransitionReadiness.ts +0 -53
- package/src/hooks/useVersion.ts +0 -155
- package/src/hooks/useViolations.ts +0 -65
- package/src/hooks/useWorkflow.tsx +0 -125
- package/src/hooks/useZoomModifier.ts +0 -19
- package/src/index.css +0 -797
- package/src/layouts/DashboardLayout.tsx +0 -113
- package/src/lib/collisionDetection.ts +0 -20
- package/src/lib/scope-fields.ts +0 -61
- package/src/lib/swimlane.ts +0 -146
- package/src/lib/utils.ts +0 -15
- package/src/main.tsx +0 -19
- package/src/socket.ts +0 -11
- package/src/types/index.ts +0 -497
- package/src/views/AgentFeed.tsx +0 -339
- package/src/views/DeployPipeline.tsx +0 -59
- package/src/views/EnforcementView.tsx +0 -378
- package/src/views/PrimitivesConfig.tsx +0 -500
- package/src/views/QualityGates.tsx +0 -1012
- package/src/views/ScopeBoard.tsx +0 -454
- package/src/views/SessionTimeline.tsx +0 -516
- package/src/views/Settings.tsx +0 -183
- package/src/views/SourceControl.tsx +0 -95
- package/src/views/WorkflowVisualizer.tsx +0 -382
- package/tailwind.config.js +0 -161
- package/tsconfig.json +0 -25
- package/vite.config.ts +0 -38
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{j as e}from"./ui-BmsSg9jU.js";import{a as i}from"./vendor-Bqt8AJn2.js";import{c as D,e as G,V as Pe,s as W,j as Me,o as k,O as S,G as B,Y as z,Z as Q,_ as T,$ as J,B as f,a0 as _,q as ge,R as I,M as A,N as R,I as xe,g as je,a as w,J as He,a1 as Ee,a2 as Te,h as V,a3 as _e,a4 as $e,a5 as Ie,a6 as Ge,a7 as pe,a8 as ee,i as Oe,C as te,b as ae,X as Ue,U as Fe,T as Ne,a9 as be,F as Le,w as he}from"./index-o4ScMAuR.js";import{u as qe,f as O}from"./useSocketListener-0L5yiN5i.js";import{R as Ve,A as We,a as ze}from"./charts-LGLb8hyU.js";import{A as ye}from"./arrow-down-DVPp6_qp.js";import{G as we}from"./globe-WzeyHsUc.js";import{K as Qe}from"./key-CKR8JJSj.js";import{R as se}from"./rocket-D_xvvNG6.js";import{C as me}from"./circle-x-IsFCkBZu.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Je=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ke=D("activity",Je);/**
|
|
7
|
+
* @license lucide-react v0.577.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Xe=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],ke=D("arrow-up-down",Xe);/**
|
|
12
|
+
* @license lucide-react v0.577.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Ze=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ve=D("arrow-up",Ze);/**
|
|
17
|
+
* @license lucide-react v0.577.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Ye=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],re=D("git-pull-request",Ye);/**
|
|
22
|
+
* @license lucide-react v0.577.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const es=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],K=D("github",es);/**
|
|
27
|
+
* @license lucide-react v0.577.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const ss=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],ts=D("lock",ss);/**
|
|
32
|
+
* @license lucide-react v0.577.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const as=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],rs=D("log-out",as),L=50;function ns(s=!0){const t=G(),[a,r]=i.useState(null),[o,c]=i.useState([]),[h,n]=i.useState([]),[l,x]=i.useState([]),[u,d]=i.useState(null),[m,g]=i.useState(!0),[b,p]=i.useState([]),[v,P]=i.useState(null),[M,H]=i.useState([]),[C,y]=i.useState(!0),[$,X]=i.useState(!0),Z=i.useRef(0),E=i.useCallback(async j=>{if(s)try{const[N,F,ce,ie,oe,le,de]=await Promise.all([fetch(t("/git/overview"),{signal:j}),fetch(t(`/git/commits?limit=${L}&offset=0`),{signal:j}),fetch(t("/git/branches"),{signal:j}),fetch(t("/git/worktrees"),{signal:j}),fetch(t("/git/drift"),{signal:j}),fetch(t("/git/health"),{signal:j}),fetch(t("/git/activity?days=30"),{signal:j})]);if(N.ok&&r(await N.json()),F.ok){const Y=await F.json();c(Y),Z.current=Y.length,X(Y.length>=L)}ce.ok&&n(await ce.json()),ie.ok&&x(await ie.json()),oe.ok&&p(await oe.json()),le.ok&&P(await le.json()),de.ok&&H(await de.json())}catch(N){if(N instanceof DOMException&&N.name==="AbortError")return}finally{j!=null&&j.aborted||y(!1)}},[t,s]),U=i.useCallback(async j=>{if(s){g(!0);try{const N=await fetch(t("/github/status"),{signal:j});N.ok&&d(await N.json())}catch(N){if(N instanceof DOMException&&N.name==="AbortError")return}finally{j!=null&&j.aborted||g(!1)}}},[t,s]),ne=i.useCallback(()=>{E(),U()},[E,U]),De=i.useCallback(async()=>{try{const j=await fetch(t(`/git/commits?limit=${L}&offset=${Z.current}`));if(j.ok){const N=await j.json();c(F=>[...F,...N]),Z.current+=N.length,X(N.length>=L)}}catch{}},[t]);return i.useEffect(()=>{if(!s){y(!1),g(!1);return}const j=new AbortController;return E(j.signal),U(j.signal),()=>j.abort()},[s,E,U]),Pe(ne),i.useEffect(()=>{function j(){E()}return W.on("git:status:changed",j),()=>{W.off("git:status:changed",j)}},[E]),{overview:a,commits:o,branches:h,worktrees:l,github:u,githubChecking:m,drift:b,health:v,activity:M,loading:C,refetch:ne,loadMoreCommits:De,hasMoreCommits:$,buildUrl:t}}function cs(s){const[t,a]=i.useState([]),[r,o]=i.useState([]),[c,h]=i.useState([]),[n,l]=i.useState([]),[x,u]=i.useState(new Map),[d,m]=i.useState(!0),g=i.useCallback(async()=>{if(s)try{const[p,v,P,M,H]=await Promise.all([fetch("/api/orbital/aggregate/git/overview"),fetch("/api/orbital/aggregate/git/commits?limit=50"),fetch("/api/orbital/aggregate/github/prs"),fetch("/api/orbital/aggregate/git/health"),fetch("/api/orbital/aggregate/git/activity?days=30")]);if(p.ok&&a(await p.json()),v.ok&&o(await v.json()),P.ok&&h(await P.json()),M.ok&&l(await M.json()),H.ok){const C=await H.json(),y=new Map;for(const $ of C)y.set($.projectId,$.series);u(y)}}catch{}finally{m(!1)}},[s]),b=i.useCallback(()=>{g()},[g]);return i.useEffect(()=>{s&&(m(!0),g())},[s,g]),i.useEffect(()=>{if(!s)return;function p(){g()}return W.on("git:status:changed",p),()=>{W.off("git:status:changed",p)}},[s,g]),{projectOverviews:t,commits:r,prs:c,branchHealth:n,activitySeries:x,loading:d,refetch:b}}function is(s=!0){const t=G(),[a,r]=i.useState(null),[o,c]=i.useState([]),[h,n]=i.useState([]),l=i.useCallback(async()=>{if(!s)return;const[u,d,m]=await Promise.all([fetch(t("/pipeline/drift")),fetch(t("/deployments/frequency")),fetch(t("/deployments"))]);u.ok&&r(await u.json()),d.ok&&c(await d.json()),m.ok&&n(await m.json())},[t,s]),{loading:x}=Me(l);return qe("deploy:updated",()=>{l()},[l]),{drift:a,frequency:o,deployments:h,loading:x,refetch:l}}function Ce({data:s,color:t="210 80% 55%",height:a=28}){if(s.length===0)return null;const r=`hsl(${t})`;return e.jsx("div",{style:{width:"100%",height:a},children:e.jsx(Ve,{width:"100%",height:"100%",children:e.jsxs(We,{data:s,margin:{top:0,right:0,bottom:0,left:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`sparkFill-${t.replace(/\s/g,"")}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:r,stopOpacity:.25}),e.jsx("stop",{offset:"100%",stopColor:r,stopOpacity:.02})]})}),e.jsx(ze,{type:"monotone",dataKey:"count",stroke:r,strokeWidth:1.5,fill:`url(#sparkFill-${t.replace(/\s/g,"")})`,isAnimationActive:!1})]})})})}function os({overview:s,github:t,githubChecking:a,activity:r}){var o;return e.jsx(k,{className:"mb-6",children:e.jsxs(S,{className:"flex flex-wrap items-center gap-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),e.jsx("code",{className:"font-mono text-sm",children:s.currentBranch}),s.dirty&&e.jsxs(z,{children:[e.jsx(Q,{children:e.jsx(T,{className:"h-2.5 w-2.5 fill-warning-amber text-warning-amber"})}),e.jsx(J,{children:"Uncommitted changes"})]})]}),e.jsx(f,{variant:"outline",className:"text-xs",children:s.branchingMode}),s.mainHead&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:"HEAD"}),e.jsx("code",{className:"font-mono text-xs",children:s.mainHead.sha.slice(0,7)}),e.jsx("span",{className:"max-w-[200px] truncate",children:s.mainHead.message})]}),s.aheadBehind&&(s.aheadBehind.ahead>0||s.aheadBehind.behind>0)&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(ke,{className:"h-3 w-3 text-muted-foreground"}),s.aheadBehind.ahead>0&&e.jsxs("span",{className:"text-bid-green",children:[s.aheadBehind.ahead,"↑"]}),s.aheadBehind.behind>0&&e.jsxs("span",{className:"text-ask-red",children:[s.aheadBehind.behind,"↓"]})]}),s.branchingMode==="worktree"&&s.worktreeCount>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(_,{className:"h-3 w-3"}),e.jsxs("span",{children:[s.worktreeCount," worktree",s.worktreeCount!==1?"s":""]})]}),s.branchingMode==="trunk"&&s.featureBranchCount>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(B,{className:"h-3 w-3"}),e.jsxs("span",{children:[s.featureBranchCount," feature branch",s.featureBranchCount!==1?"es":""]})]}),r&&r.length>0&&e.jsx("div",{className:"w-20",children:e.jsx(Ce,{data:r,height:22})}),e.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-muted-foreground"}),a?e.jsxs(f,{variant:"outline",className:"text-xs text-muted-foreground gap-1.5",children:[e.jsx("span",{className:"h-2 w-2 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"Checking…"]}):t!=null&&t.connected?e.jsxs(z,{children:[e.jsx(Q,{children:e.jsxs(f,{variant:"secondary",className:"text-xs gap-1",children:[e.jsx(T,{className:"h-1.5 w-1.5 fill-bid-green text-bid-green"}),((o=t.repo)==null?void 0:o.fullName)??"Connected"]})}),e.jsx(J,{children:t.authUser?`Signed in as ${t.authUser}`:"Connected to GitHub"})]}):e.jsx(f,{variant:"outline",className:"text-xs text-muted-foreground",children:"Not connected"})]})]})})}function Se({projectId:s,className:t}){const{hasMultipleProjects:a,getProjectColor:r,getProjectName:o}=ge();if(!a||!s)return null;const c=r(s),h=o(s);return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded px-1.5 py-0 text-[10px] ${t??""}`,style:{borderColor:`hsl(${c} / 0.4)`,color:`hsl(${c})`,borderWidth:"1px",borderStyle:"solid"},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:`hsl(${c})`}}),h]})}const ue=new Map,ls=6e4;function Be({commitSha:s,pr:t}){const a=G(),[r,o]=i.useState(null),[c,h]=i.useState(!1),n=i.useRef(!1),l=s??(t==null?void 0:t.branch);if(!l)return null;const x=async()=>{if(n.current||c)return;const m=ue.get(l);if(m&&Date.now()-m.ts<ls){o(m.data),n.current=!0;return}h(!0);try{const g=await fetch(a(`/github/checks/${l}`));if(g.ok){const b=await g.json();ue.set(l,{data:b,ts:Date.now()}),o(b)}}catch{}h(!1),n.current=!0};let u="text-muted-foreground/30",d="CI";if(r&&r.length>0){const m=r.some(p=>p.conclusion==="failure"),g=r.some(p=>p.status==="in_progress"||p.status==="queued"),b=r.every(p=>p.conclusion==="success"||p.conclusion==="neutral");m?(u="text-ask-red",d=`${r.filter(p=>p.conclusion==="failure").length} failing`):g?(u="text-warning-amber",d="Running"):b&&(u="text-bid-green",d="Passed")}return e.jsxs(z,{children:[e.jsx(Q,{className:"shrink-0",onMouseEnter:x,children:c?e.jsx(I,{className:"h-3 w-3 animate-spin text-muted-foreground/50"}):e.jsx(T,{className:`h-2.5 w-2.5 fill-current ${u}`})}),e.jsx(J,{side:"top",className:"max-w-xs",children:r===null?e.jsx("span",{className:"text-xs",children:"Hover to load CI status"}):r.length===0?e.jsx("span",{className:"text-xs",children:"No CI checks"}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:d}),r.slice(0,5).map((m,g)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(T,{className:`h-1.5 w-1.5 fill-current ${m.conclusion==="success"?"text-bid-green":m.conclusion==="failure"?"text-ask-red":"text-warning-amber"}`}),e.jsx("span",{className:"truncate",children:m.name})]},g)),r.length>5&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",r.length-5," more"]})]})})]})}function ds({commit:s}){return e.jsxs("div",{className:"flex items-center gap-3 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light",children:[e.jsx(Be,{commitSha:s.sha}),e.jsx("code",{className:"shrink-0 font-mono text-xs text-primary",children:s.shortSha}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:s.message}),e.jsx(Se,{projectId:s.project_id}),s.branch&&e.jsx(f,{variant:"outline",className:"shrink-0 text-xs font-normal",children:s.branch}),s.scopeId&&e.jsxs(f,{variant:"secondary",className:"shrink-0 text-xs",children:["#",s.scopeId]}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:s.author}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground/60",children:O(new Date(s.date),{addSuffix:!0})})]})}function Ae({commits:s,branches:t,hasMore:a,onLoadMore:r}){const[o,c]=i.useState("all"),h=i.useMemo(()=>{const x=new Set(["main","master","dev","develop","staging","production"]);for(const u of t)!u.isRemote&&!u.name.startsWith("feat/")&&!u.name.startsWith("fix/")&&x.add(u.name);return x},[t]),n=i.useMemo(()=>o==="all"?s:o==="main"?s.filter(x=>!x.branch||h.has(x.branch)):s.filter(x=>x.branch&&!h.has(x.branch)),[s,o,h]),l=[{key:"all",label:"All"},{key:"main",label:"Main"},{key:"feature",label:"Feature"}];return e.jsxs(k,{className:"lg:col-span-2",children:[e.jsx(A,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(xe,{className:"h-4 w-4 text-primary"}),"Commits"," ",e.jsx(f,{variant:"secondary",children:n.length})]}),e.jsx("div",{className:"flex gap-1",children:l.map(x=>e.jsx("button",{onClick:()=>c(x.key),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${o===x.key?"bg-surface-light text-foreground":"text-muted-foreground hover:text-foreground"}`,children:x.label},x.key))})]})}),e.jsx(S,{children:n.length===0?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(xe,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No commits found."})]}):e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"max-h-[600px]",children:e.jsx("div",{className:"space-y-0.5",children:n.map(x=>e.jsx(ds,{commit:x},x.sha))})}),a&&e.jsx("button",{onClick:r,className:"mt-3 w-full rounded border border-border py-2 text-xs text-muted-foreground transition-colors hover:bg-surface-light hover:text-foreground",children:"Load more commits"})]})})]})}function xs({branches:s}){const t=[...s].filter(a=>!a.isRemote).sort((a,r)=>a.isCurrent?-1:r.isCurrent?1:a.isStale!==r.isStale?a.isStale?1:-1:new Date(r.headDate).getTime()-new Date(a.headDate).getTime());return t.length===0?e.jsxs("div",{className:"py-6 text-center",children:[e.jsx(B,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No branches found."})]}):e.jsx("div",{className:"space-y-0.5",children:t.map(a=>e.jsxs("div",{className:w("flex items-center gap-2 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light",a.isStale&&"opacity-50"),children:[e.jsx(B,{className:w("h-3.5 w-3.5 shrink-0",a.isCurrent?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:w("min-w-0 flex-1 truncate font-mono text-xs",a.isCurrent&&"text-foreground font-medium"),children:a.name}),a.scopeId&&e.jsxs(f,{variant:"secondary",className:"shrink-0 text-xs",children:["#",a.scopeId]}),a.aheadBehind&&e.jsxs("div",{className:"flex shrink-0 items-center gap-1 text-xs",children:[a.aheadBehind.ahead>0&&e.jsxs("span",{className:"flex items-center gap-0.5 text-bid-green",children:[e.jsx(ve,{className:"h-2.5 w-2.5"}),a.aheadBehind.ahead]}),a.aheadBehind.behind>0&&e.jsxs("span",{className:"flex items-center gap-0.5 text-ask-red",children:[e.jsx(ye,{className:"h-2.5 w-2.5"}),a.aheadBehind.behind]})]}),e.jsx("code",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:a.headSha}),a.headDate&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground/60",children:O(new Date(a.headDate),{addSuffix:!0})})]},a.name))})}function hs({worktrees:s}){return s.length===0?e.jsxs("div",{className:"py-6 text-center",children:[e.jsx(_,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No active worktrees."})]}):e.jsx("div",{className:"space-y-1",children:s.map(t=>e.jsxs("div",{className:"rounded border border-border/50 px-3 py-2 transition-colors hover:bg-surface-light",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),e.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t.branch}),t.dirty&&e.jsx(T,{className:"h-2 w-2 shrink-0 fill-warning-amber text-warning-amber"}),e.jsx("code",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:t.head})]}),t.scopeId&&e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsxs(f,{variant:"secondary",className:"text-xs",children:["#",t.scopeId]}),t.scopeTitle&&e.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:t.scopeTitle}),t.scopeStatus&&e.jsx(f,{variant:"outline",className:w("shrink-0 text-xs capitalize"),children:t.scopeStatus})]}),t.aheadBehind&&(t.aheadBehind.ahead>0||t.aheadBehind.behind>0)&&e.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs",children:[t.aheadBehind.ahead>0&&e.jsxs("span",{className:"flex items-center gap-0.5 text-bid-green",children:[e.jsx(ve,{className:"h-2.5 w-2.5"}),t.aheadBehind.ahead," ahead"]}),t.aheadBehind.behind>0&&e.jsxs("span",{className:"flex items-center gap-0.5 text-ask-red",children:[e.jsx(ye,{className:"h-2.5 w-2.5"}),t.aheadBehind.behind," behind"]})]})]},t.path))})}function ms(s){return s===0?"text-bid-green":s<=5?"text-accent-blue":s<=20?"text-warning-amber":"text-ask-red"}function us({branches:s,worktrees:t,drift:a,branchingMode:r}){const o=r==="worktree",[c,h]=i.useState("branches");return e.jsxs(k,{children:[e.jsx(A,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),o?c==="branches"?"Branches":"Worktrees":"Branches",e.jsx(f,{variant:"secondary",children:c==="branches"?s.filter(n=>!n.isRemote).length:t.length})]}),o&&e.jsxs("div",{className:"flex gap-1",children:[e.jsxs("button",{onClick:()=>h("branches"),className:w("rounded-md px-2.5 py-1 text-xs transition-colors",c==="branches"?"bg-surface-light text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.jsx(B,{className:"inline h-3 w-3 mr-1"}),"Branches"]}),e.jsxs("button",{onClick:()=>h("worktrees"),className:w("rounded-md px-2.5 py-1 text-xs transition-colors",c==="worktrees"?"bg-surface-light text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.jsx(_,{className:"inline h-3 w-3 mr-1"}),"Worktrees"]})]})]})}),e.jsxs(S,{children:[e.jsx(je,{className:"max-h-[400px]",children:c==="branches"?e.jsx(xs,{branches:s}):e.jsx(hs,{worktrees:t})}),a.length>0&&e.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[e.jsx("h4",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Branch Drift"}),e.jsx("div",{className:"space-y-1.5",children:a.map(n=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("code",{className:"font-mono text-muted-foreground",children:n.from}),e.jsx(He,{className:"h-3 w-3 text-muted-foreground/50"}),e.jsx("code",{className:"font-mono text-muted-foreground",children:n.to}),e.jsx(f,{variant:"outline",className:w("ml-auto text-xs",ms(n.count)),children:n.count===0?"in sync":`${n.count} commit${n.count!==1?"s":""}`})]},`${n.from}-${n.to}`))})]})]})]})}function fs({error:s,onConnected:t}){const a=G(),[r,o]=i.useState(!1),[c,h]=i.useState("oauth"),[n,l]=i.useState("idle"),[x,u]=i.useState(""),[d,m]=i.useState(""),g=i.useRef(),b=i.useRef(),p=s==null?void 0:s.includes("not installed"),v=i.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=void 0)},[]);i.useEffect(()=>()=>{v(),clearTimeout(b.current)},[v]);const P=async()=>{l("connecting"),m("");try{const y=await(await fetch(a("/github/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"oauth"})})).json();y.success?(l("polling"),g.current=setInterval(async()=>{try{(await(await fetch(a("/github/auth-status"))).json()).authenticated&&(v(),clearTimeout(b.current),l("success"),setTimeout(()=>{o(!1),t()},1e3))}catch{}},2e3),b.current=setTimeout(()=>{g.current&&(v(),l("error"),m("Authentication timed out. Please try again."))},12e4)):(l("error"),m(y.error??"Failed to start OAuth flow"))}catch{l("error"),m("Failed to connect to server")}},M=async()=>{if(x.trim()){l("connecting"),m("");try{const y=await(await fetch(a("/github/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"pat",token:x.trim()})})).json();y.success?(l("success"),u(""),setTimeout(()=>{o(!1),t()},1e3)):(l("error"),m(y.error??"Authentication failed"))}catch{l("error"),m("Failed to connect to server")}}},H=C=>{o(C),C||(v(),l("idle"),m(""),u(""))};return e.jsxs(Ee,{open:r,onOpenChange:H,children:[e.jsx(Te,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(K,{className:"h-4 w-4"}),"Connect GitHub"]})}),e.jsxs(_e,{className:"sm:max-w-md",children:[e.jsxs($e,{children:[e.jsxs(Ie,{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-5 w-5"}),"Connect to GitHub"]}),e.jsx(Ge,{children:p?"The GitHub CLI (gh) is required. Install it first, then authenticate.":"Authenticate with GitHub to see PRs, CI status, and repo info."})]}),p?e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"rounded border border-border bg-surface-light p-3",children:[e.jsx("p",{className:"text-sm mb-2",children:"Install the GitHub CLI:"}),e.jsx("code",{className:"text-xs font-mono bg-background px-2 py-1 rounded",children:"brew install gh"}),e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Or visit"," ",e.jsxs("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-primary hover:underline",children:["cli.github.com ",e.jsx(pe,{className:"h-2.5 w-2.5"})]})]})]})}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-1 rounded-md bg-surface-light p-1",children:[e.jsxs("button",{onClick:()=>h("oauth"),className:`flex-1 flex items-center justify-center gap-2 rounded px-3 py-2 text-sm transition-colors ${c==="oauth"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(we,{className:"h-4 w-4"}),"Browser OAuth"]}),e.jsxs("button",{onClick:()=>h("pat"),className:`flex-1 flex items-center justify-center gap-2 rounded px-3 py-2 text-sm transition-colors ${c==="pat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Qe,{className:"h-4 w-4"}),"Access Token"]})]}),c==="oauth"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Opens your browser to authenticate with GitHub. This is the recommended method."}),e.jsxs(V,{onClick:P,disabled:n==="connecting"||n==="polling"||n==="success",className:"w-full gap-2",children:[n==="connecting"&&e.jsx(I,{className:"h-4 w-4 animate-spin"}),n==="polling"&&e.jsx(I,{className:"h-4 w-4 animate-spin"}),n==="success"&&e.jsx(ee,{className:"h-4 w-4"}),n==="polling"?"Waiting for browser...":n==="success"?"Connected!":"Connect with GitHub"]})]}),c==="pat"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paste a GitHub Personal Access Token. Needs ",e.jsx("code",{className:"text-xs",children:"repo"})," and ",e.jsx("code",{className:"text-xs",children:"read:org"})," scopes."]}),e.jsx("input",{type:"password",placeholder:"ghp_xxxxxxxxxxxxxxxxxxxx",value:x,onChange:C=>u(C.target.value),disabled:n==="connecting"||n==="success",className:"flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50"}),e.jsxs(V,{onClick:M,disabled:!x.trim()||n==="connecting"||n==="success",className:"w-full gap-2",children:[n==="connecting"&&e.jsx(I,{className:"h-4 w-4 animate-spin"}),n==="success"&&e.jsx(ee,{className:"h-4 w-4"}),n==="success"?"Connected!":"Authenticate"]})]}),n==="error"&&d&&e.jsxs("div",{className:"flex items-center gap-2 rounded bg-ask-red/10 px-3 py-2 text-xs text-ask-red",children:[e.jsx(Oe,{className:"h-4 w-4 shrink-0"}),d]}),e.jsx("p",{className:"text-[10px] text-muted-foreground/60",children:"GitHub authentication is global — connecting here applies to all projects."})]})]})]})}function gs({github:s,githubChecking:t,onConnectionChange:a}){var l;const r=G(),[o,c]=i.useState(!0),h=i.useCallback(async()=>{try{await fetch(r("/github/disconnect"),{method:"POST"}),a==null||a()}catch{}},[r,a]),n=((l=s==null?void 0:s.repo)==null?void 0:l.visibility)==="public"?we:ts;return e.jsxs(k,{className:"mt-6",children:[e.jsx(A,{className:"cursor-pointer select-none",onClick:()=>c(!o),children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[o?e.jsx(te,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ae,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(K,{className:"h-4 w-4 text-primary"}),"GitHub",(s==null?void 0:s.connected)&&s.repo&&e.jsxs(f,{variant:"secondary",className:"ml-1 text-xs gap-1",children:[e.jsx(n,{className:"h-2.5 w-2.5"}),s.repo.fullName]}),s!=null&&s.openPRs?e.jsxs(f,{variant:"outline",className:"text-xs",children:[s.openPRs," open PR",s.openPRs!==1?"s":""]}):null]})}),o&&e.jsx(S,{children:t?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"Checking GitHub connection…"]}):!s||!s.connected?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect to GitHub to see repository info, pull requests, and CI status."}),e.jsx(fs,{error:(s==null?void 0:s.error)??null,onConnected:()=>a==null?void 0:a()})]}):e.jsxs("div",{className:"space-y-4",children:[s.repo&&e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Repository"}),e.jsx("a",{href:s.repo.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.repo.fullName}),e.jsx("span",{className:"text-muted-foreground",children:"Default branch"}),e.jsx("code",{className:"font-mono",children:s.repo.defaultBranch}),e.jsx("span",{className:"text-muted-foreground",children:"Visibility"}),e.jsxs("span",{className:"flex items-center gap-1 capitalize",children:[e.jsx(n,{className:"h-3 w-3"}),s.repo.visibility]}),s.authUser&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Signed in as"}),e.jsx("span",{children:s.authUser})]})]}),e.jsx("div",{className:"border-t border-border pt-3",children:e.jsxs(V,{variant:"ghost",size:"sm",onClick:x=>{x.stopPropagation(),h()},className:"gap-2 text-xs text-muted-foreground hover:text-ask-red",children:[e.jsx(rs,{className:"h-3 w-3"}),"Disconnect"]})})]})})]})}function js({decision:s}){return s==="APPROVED"?e.jsx(ee,{className:"h-3.5 w-3.5 text-bid-green"}):s==="CHANGES_REQUESTED"?e.jsx(Ue,{className:"h-3.5 w-3.5 text-ask-red"}):e.jsx(Fe,{className:"h-3.5 w-3.5 text-warning-amber"})}function Re(s){const[t,a]=i.useState(!0),[r,o]=i.useState("all"),[c,h]=i.useState([]),n=i.useCallback(async()=>{if(!(s.isAggregate||!s.buildUrl))try{const d=await fetch(s.buildUrl("/github/prs"));d.ok&&h(await d.json())}catch{}},[s.isAggregate,s.buildUrl]);i.useEffect(()=>{s.isAggregate||n()},[s.isAggregate,n]);const l=s.isAggregate?s.prs:c,x=l.filter(d=>r==="all"?!0:r==="pending"?!d.reviewDecision||d.reviewDecision==="REVIEW_REQUIRED":r==="approved"?d.reviewDecision==="APPROVED":r==="changes"?d.reviewDecision==="CHANGES_REQUESTED":!0);if(l.length===0)return null;const u=[{key:"all",label:"All"},{key:"pending",label:"Pending"},{key:"approved",label:"Approved"},{key:"changes",label:"Changes"}];return e.jsxs(k,{className:"mb-6",children:[e.jsx(A,{className:"cursor-pointer select-none pb-2",onClick:()=>a(!t),children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[t?e.jsx(te,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ae,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(re,{className:"h-4 w-4 text-primary"}),"Pull Requests",e.jsx(f,{variant:"secondary",children:l.length})]})}),t&&e.jsxs(S,{children:[e.jsx("div",{className:"mb-3 flex gap-1",children:u.map(d=>e.jsx("button",{onClick:m=>{m.stopPropagation(),o(d.key)},className:`rounded-md px-2.5 py-1 text-xs transition-colors ${r===d.key?"bg-surface-light text-foreground":"text-muted-foreground hover:text-foreground"}`,children:d.label},d.key))}),e.jsx("div",{className:"space-y-0.5",children:x.map(d=>e.jsxs("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light group",children:[e.jsx(js,{decision:d.reviewDecision}),e.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["#",d.number]}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:d.title}),e.jsx(Se,{projectId:d.project_id}),e.jsx(f,{variant:"outline",className:"shrink-0 text-xs font-normal",children:d.branch}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"→"}),e.jsx(f,{variant:"outline",className:"shrink-0 text-xs font-normal",children:d.baseBranch}),d.scopeIds.map(m=>e.jsxs(f,{variant:"secondary",className:"shrink-0 text-xs",children:["#",m]},m)),e.jsx(Be,{pr:d}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:d.author}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground/60",children:O(new Date(d.lastActivityAt??d.createdAt),{addSuffix:!0})}),e.jsx(pe,{className:"h-3 w-3 shrink-0 text-muted-foreground/40 opacity-0 group-hover:opacity-100 transition-opacity"})]},`${d.project_id??""}-${d.number}`))}),x.length===0&&e.jsx("p",{className:"py-4 text-center text-xs text-muted-foreground",children:"No PRs match this filter."})]})]})}function ps({overviews:s,activitySeries:t}){return s.length===0?null:e.jsx("div",{className:"mb-6 grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:s.map(a=>e.jsx(Ns,{project:a,activity:t.get(a.projectId)??[]},a.projectId))})}function Ns({project:s,activity:t}){const{projectName:a,projectColor:r,status:o,overview:c,error:h}=s;return e.jsx(k,{className:"overflow-hidden",children:e.jsxs(S,{className:"py-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{backgroundColor:`hsl(${r})`}}),e.jsx("span",{className:"font-medium text-sm",style:{color:`hsl(${r})`},children:a}),o==="error"&&e.jsx(f,{variant:"destructive",className:"text-xs ml-auto",children:"Error"})]}),o==="error"?e.jsx("p",{className:"text-xs text-muted-foreground",children:h}):c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"font-mono text-xs",children:c.currentBranch}),c.dirty&&e.jsxs(z,{children:[e.jsx(Q,{children:e.jsx(T,{className:"h-2 w-2 fill-warning-amber text-warning-amber"})}),e.jsx(J,{children:"Uncommitted changes"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[c.aheadBehind&&(c.aheadBehind.ahead>0||c.aheadBehind.behind>0)&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ke,{className:"h-3 w-3"}),c.aheadBehind.ahead>0&&e.jsxs("span",{className:"text-bid-green",children:[c.aheadBehind.ahead,"↑"]}),c.aheadBehind.behind>0&&e.jsxs("span",{className:"text-ask-red",children:[c.aheadBehind.behind,"↓"]})]}),c.featureBranchCount>0&&e.jsxs("span",{children:[c.featureBranchCount," branch",c.featureBranchCount!==1?"es":""]}),e.jsx(f,{variant:"outline",className:"text-[10px] py-0",children:c.branchingMode})]}),c.mainHead&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(re,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:c.mainHead.message}),e.jsx("span",{className:"shrink-0 text-muted-foreground/60",children:O(new Date(c.mainHead.date),{addSuffix:!0})})]}),t.length>0&&e.jsx(Ce,{data:t,color:r})]}):null]})})}function bs(s){return s==="clean"?"text-bid-green":s==="low"?"text-accent-blue":s==="moderate"?"text-warning-amber":"text-ask-red"}function ys({health:s}){return s.length===0?e.jsxs(k,{children:[e.jsx(A,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),"Branch Health"]})}),e.jsx(S,{children:e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No branch data available."})})]}):e.jsxs(k,{children:[e.jsx(A,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(B,{className:"h-4 w-4 text-primary"}),"Branch Health"]})}),e.jsx(S,{children:e.jsx("div",{className:"space-y-2",children:s.map(t=>e.jsxs("div",{className:"flex items-center gap-3 rounded px-2.5 py-2 transition-colors hover:bg-surface-light",children:[e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:`hsl(${t.projectColor})`}}),e.jsx("span",{className:"text-sm font-medium min-w-[100px]",style:{color:`hsl(${t.projectColor})`},children:t.projectName}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.branchCount," branch",t.branchCount!==1?"es":""]}),t.staleBranchCount>0&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-warning-amber",children:[e.jsx(Ne,{className:"h-3 w-3"}),t.staleBranchCount," stale"]}),t.featureBranchCount>0&&e.jsxs(f,{variant:"secondary",className:"text-xs",children:[t.featureBranchCount," feature"]}),e.jsx(f,{variant:"outline",className:w("ml-auto text-xs",bs(t.maxDriftSeverity)),children:t.maxDriftSeverity==="clean"?"in sync":`${t.maxDriftSeverity} drift`})]},t.projectId))})})]})}function ws(s){return s==="A"?"text-bid-green":s==="B"?"text-accent-blue":s==="C"?"text-warning-amber":"text-ask-red"}function ks(s){return s==="A"?"bg-bid-green/10":s==="B"?"bg-accent-blue/10":s==="C"?"bg-warning-amber/10":"bg-ask-red/10"}function vs({health:s}){return e.jsx(k,{className:"mb-6",children:e.jsxs(S,{className:"flex items-center gap-6 py-3",children:[e.jsx("div",{className:w("flex items-center justify-center h-12 w-12 rounded-lg text-2xl font-bold shrink-0",ks(s.grade),ws(s.grade)),children:s.grade}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-1",children:[e.jsx(q,{icon:e.jsx(Ke,{className:"h-3.5 w-3.5"}),label:"Commits/week",value:String(s.commitsPerWeek),warn:s.commitsPerWeek<5}),e.jsx(q,{icon:e.jsx(re,{className:"h-3.5 w-3.5"}),label:"Avg PR age",value:s.avgPrAgeDays>0?`${s.avgPrAgeDays}d`:"--",warn:s.avgPrAgeDays>3}),e.jsx(q,{icon:e.jsx(B,{className:"h-3.5 w-3.5"}),label:"Stale branches",value:String(s.staleBranchCount),warn:s.staleBranchCount>0}),e.jsx(q,{icon:e.jsx(Ne,{className:"h-3.5 w-3.5"}),label:"Drift",value:s.driftSeverity,warn:s.driftSeverity!=="clean"})]})]})})}function q({icon:s,label:t,value:a,warn:r}){return e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:r?"text-warning-amber":"text-muted-foreground",children:s}),e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("span",{className:w("font-medium",r?"text-warning-amber":"text-foreground"),children:a})]})}const Cs={deploying:{icon:I,color:"text-accent-blue",label:"Deploying",animate:"animate-spin"},healthy:{icon:Le,color:"text-bid-green",label:"Healthy"},failed:{icon:me,color:"text-ask-red",label:"Failed"},"rolled-back":{icon:me,color:"text-warning-amber",label:"Rolled Back"}},fe=20;function Ss(s){const t=new Map;for(const a of s){const r=a.started_at?be(new Date(a.started_at),"yyyy-MM-dd"):"Unknown",o=t.get(r);o?o.push(a):t.set(r,[a])}return t}function Bs(s){if(!s.started_at||!s.completed_at)return null;const t=new Date(s.completed_at).getTime()-new Date(s.started_at).getTime();return t<1e3?"<1s":t<6e4?`${Math.round(t/1e3)}s`:`${Math.round(t/6e4)}m`}function As({deployments:s}){const[t,a]=i.useState(!1),r=t?s:s.slice(0,fe),o=Ss(r);return e.jsxs(k,{children:[e.jsx(A,{children:e.jsxs(R,{className:"text-base",children:["Deployment History",e.jsx(f,{variant:"secondary",className:"ml-2",children:s.length})]})}),e.jsx(S,{children:s.length===0?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(se,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No deployments recorded yet."})]}):e.jsxs("div",{className:"space-y-4",children:[[...o.entries()].map(([c,h])=>e.jsxs("div",{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-card pb-1 pt-0.5",children:e.jsx("span",{className:"text-xxs font-medium uppercase tracking-wider text-muted-foreground",children:c==="Unknown"?"Unknown date":be(new Date(c),"EEEE, MMM d")})}),e.jsx("div",{className:"space-y-0.5",children:h.map(n=>{const l=Cs[n.status],x=l.icon,u=Bs(n);return e.jsxs("div",{className:"flex items-center gap-4 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light",children:[e.jsx(x,{className:w("h-4 w-4 shrink-0",l.color,l.animate)}),e.jsx(f,{variant:"outline",className:"capitalize shrink-0",children:n.environment}),e.jsx("span",{className:"text-xs font-normal shrink-0",children:l.label}),n.commit_sha&&e.jsx("code",{className:"font-mono text-xs text-muted-foreground shrink-0",children:n.commit_sha.slice(0,7)}),n.branch&&e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.branch}),u&&e.jsx("span",{className:"font-mono text-xs text-muted-foreground/60 shrink-0",children:u}),e.jsx("span",{className:"ml-auto text-xs text-muted-foreground/60 shrink-0",children:n.started_at?O(new Date(n.started_at),{addSuffix:!0}):"—"})]},n.id)})})]},c)),!t&&s.length>fe&&e.jsxs("button",{onClick:()=>a(!0),className:"w-full rounded border border-border py-2 text-xs text-muted-foreground transition-colors hover:bg-surface-light hover:text-foreground",children:["Show all ",s.length," deployments"]})]})})]})}function Us(){const{activeProjectId:s,hasMultipleProjects:t}=ge(),a=t&&s===null,r=ns(!a),o=cs(a),{deployments:c}=is(!a),[h,n]=i.useState(!0);return(a?o.loading:r.loading)?e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col",children:[e.jsx(he,{}),e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"})})]}):e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col",children:[e.jsx(he,{}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:a?e.jsx(Ds,{aggregate:o}):e.jsx(Rs,{sourceControl:r,deployments:c,deployExpanded:h,setDeployExpanded:n})})]})}function Rs({sourceControl:s,deployments:t,deployExpanded:a,setDeployExpanded:r}){const{overview:o,commits:c,branches:h,worktrees:n,github:l,githubChecking:x,drift:u,loadMoreCommits:d,hasMoreCommits:m,health:g,activity:b,refetch:p}=s;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx(_,{className:"h-4 w-4 text-primary"}),e.jsx("h1",{className:"text-xl font-light",children:"Repo"}),o&&e.jsx(f,{variant:"secondary",children:o.currentBranch})]}),o&&e.jsx(os,{overview:o,github:l,githubChecking:x,activity:b}),g&&e.jsx(vs,{health:g}),(l==null?void 0:l.connected)&&e.jsx(Re,{buildUrl:s.buildUrl}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsx(Ae,{commits:c,branches:h,hasMore:m,onLoadMore:d}),e.jsx(us,{branches:h,worktrees:n,drift:u,branchingMode:(o==null?void 0:o.branchingMode)??"trunk"})]}),e.jsx(gs,{github:l,githubChecking:x,onConnectionChange:p}),t.length>0&&e.jsx("div",{className:"mt-6",children:a?e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>r(!1),className:"mb-2 flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(te,{className:"h-4 w-4"}),e.jsx(se,{className:"h-4 w-4"}),"Deploy History"]}),e.jsx(As,{deployments:t})]}):e.jsx(k,{className:"cursor-pointer select-none",onClick:()=>r(!0),children:e.jsx(A,{children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(ae,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(se,{className:"h-4 w-4 text-primary"}),"Deploy History",e.jsx(f,{variant:"secondary",children:t.length})]})})})})]})}function Ds({aggregate:s}){const{projectOverviews:t,commits:a,prs:r,branchHealth:o,activitySeries:c}=s;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx(_,{className:"h-4 w-4 text-primary"}),e.jsx("h1",{className:"text-xl font-light",children:"Repo"}),e.jsx(f,{variant:"secondary",children:"All Projects"})]}),e.jsx(ps,{overviews:t,activitySeries:c}),r.length>0&&e.jsx(Re,{prs:r,isAggregate:!0}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsx(Ae,{commits:a,branches:[],hasMore:!1,onLoadMore:()=>{}}),e.jsx(ys,{health:o})]})]})}export{Us as SourceControl};
|