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
|
@@ -1,516 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState, useCallback, useRef } from 'react';
|
|
2
|
-
import { motion } from 'framer-motion';
|
|
3
|
-
import { Clock, ExternalLink, FileText, Terminal } from 'lucide-react';
|
|
4
|
-
import { format } from 'date-fns';
|
|
5
|
-
import { socket } from '@/socket';
|
|
6
|
-
import { useTheme } from '@/hooks/useTheme';
|
|
7
|
-
import { Badge } from '@/components/ui/badge';
|
|
8
|
-
import { Button } from '@/components/ui/button';
|
|
9
|
-
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
10
|
-
import { Separator } from '@/components/ui/separator';
|
|
11
|
-
import { cn, formatScopeId } from '@/lib/utils';
|
|
12
|
-
import type { Session } from '@/types';
|
|
13
|
-
|
|
14
|
-
const sessionStagger = { show: { transition: { staggerChildren: 0.04 } } };
|
|
15
|
-
const sessionItem = {
|
|
16
|
-
hidden: { opacity: 0, y: 10 },
|
|
17
|
-
show: { opacity: 1, y: 0, transition: { type: 'spring', stiffness: 300, damping: 25 } },
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
interface SessionMeta {
|
|
21
|
-
slug: string;
|
|
22
|
-
branch: string;
|
|
23
|
-
fileSize: number;
|
|
24
|
-
summary: string | null;
|
|
25
|
-
startedAt: string;
|
|
26
|
-
lastActiveAt: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface SessionStatsUser {
|
|
30
|
-
totalMessages: number;
|
|
31
|
-
metaMessages: number;
|
|
32
|
-
toolResults: number;
|
|
33
|
-
commands: string[];
|
|
34
|
-
permissionModes: string[];
|
|
35
|
-
cwd: string | null;
|
|
36
|
-
version: string | null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface SessionStatsAssistant {
|
|
40
|
-
totalMessages: number;
|
|
41
|
-
models: string[];
|
|
42
|
-
totalInputTokens: number;
|
|
43
|
-
totalOutputTokens: number;
|
|
44
|
-
totalCacheReadTokens: number;
|
|
45
|
-
totalCacheCreationTokens: number;
|
|
46
|
-
toolsUsed: Record<string, number>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface SessionStatsSystem {
|
|
50
|
-
totalMessages: number;
|
|
51
|
-
subtypes: string[];
|
|
52
|
-
stopReasons: string[];
|
|
53
|
-
totalDurationMs: number;
|
|
54
|
-
hookCount: number;
|
|
55
|
-
hookErrors: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface SessionStats {
|
|
59
|
-
typeCounts: Record<string, number>;
|
|
60
|
-
user: SessionStatsUser;
|
|
61
|
-
assistant: SessionStatsAssistant;
|
|
62
|
-
system: SessionStatsSystem;
|
|
63
|
-
progress: { totalLines: number };
|
|
64
|
-
timing: { firstTimestamp: string | null; lastTimestamp: string | null; durationMs: number };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface SessionDetail {
|
|
68
|
-
id: string;
|
|
69
|
-
content: string;
|
|
70
|
-
claude_session_id: string | null;
|
|
71
|
-
meta: SessionMeta | null;
|
|
72
|
-
stats: SessionStats | null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** Session with aggregated scope_ids and actions from deduplicated backend response */
|
|
76
|
-
interface TimelineSession extends Session {
|
|
77
|
-
scope_ids: number[];
|
|
78
|
-
actions: string[];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const ACTION_LABELS: Record<string, string> = {
|
|
82
|
-
createScope: 'Created',
|
|
83
|
-
reviewScope: 'Reviewed',
|
|
84
|
-
implementScope: 'Implemented',
|
|
85
|
-
verifyScope: 'Verified',
|
|
86
|
-
reviewGate: 'Review Gate',
|
|
87
|
-
fixReview: 'Fix Review',
|
|
88
|
-
commit: 'Committed',
|
|
89
|
-
pushToMain: 'Pushed to Main',
|
|
90
|
-
pushToDev: 'Pushed to Dev',
|
|
91
|
-
pushToStaging: 'PR to Staging',
|
|
92
|
-
pushToProduction: 'PR to Production',
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
function actionLabel(action: string): string {
|
|
96
|
-
return ACTION_LABELS[action] ?? action;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// ─── Main Component ────────────────────────────────────────
|
|
100
|
-
|
|
101
|
-
export function SessionTimeline() {
|
|
102
|
-
const [sessions, setSessions] = useState<TimelineSession[]>([]);
|
|
103
|
-
const [loading, setLoading] = useState(true);
|
|
104
|
-
const [selected, setSelected] = useState<TimelineSession | null>(null);
|
|
105
|
-
const [detail, setDetail] = useState<SessionDetail | null>(null);
|
|
106
|
-
const [detailLoading, setDetailLoading] = useState(false);
|
|
107
|
-
const [resuming, setResuming] = useState(false);
|
|
108
|
-
const { neonGlass } = useTheme();
|
|
109
|
-
const autoSelected = useRef(false);
|
|
110
|
-
|
|
111
|
-
const selectSession = useCallback(async (session: TimelineSession) => {
|
|
112
|
-
setSelected(session);
|
|
113
|
-
setDetail(null);
|
|
114
|
-
setDetailLoading(true);
|
|
115
|
-
try {
|
|
116
|
-
const res = await fetch(`/api/orbital/sessions/${session.id}/content`);
|
|
117
|
-
if (res.ok) setDetail(await res.json());
|
|
118
|
-
} catch { /* silent */ }
|
|
119
|
-
finally { setDetailLoading(false); }
|
|
120
|
-
}, []);
|
|
121
|
-
|
|
122
|
-
const fetchSessions = useCallback(async () => {
|
|
123
|
-
try {
|
|
124
|
-
const res = await fetch('/api/orbital/sessions');
|
|
125
|
-
if (res.ok) setSessions(await res.json());
|
|
126
|
-
} catch { /* silent */ }
|
|
127
|
-
finally { setLoading(false); }
|
|
128
|
-
}, []);
|
|
129
|
-
|
|
130
|
-
useEffect(() => { fetchSessions(); }, [fetchSessions]);
|
|
131
|
-
|
|
132
|
-
// Auto-select first session on initial load
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (!autoSelected.current && sessions.length > 0) {
|
|
135
|
-
autoSelected.current = true;
|
|
136
|
-
selectSession(sessions[0]);
|
|
137
|
-
}
|
|
138
|
-
}, [sessions, selectSession]);
|
|
139
|
-
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
const onUpdate = () => fetchSessions();
|
|
142
|
-
socket.on('session:updated', onUpdate);
|
|
143
|
-
return () => { socket.off('session:updated', onUpdate); };
|
|
144
|
-
}, [fetchSessions]);
|
|
145
|
-
|
|
146
|
-
const handleResume = useCallback(async () => {
|
|
147
|
-
const sessionId = detail?.claude_session_id;
|
|
148
|
-
if (!selected || !sessionId) return;
|
|
149
|
-
setResuming(true);
|
|
150
|
-
try {
|
|
151
|
-
await fetch(`/api/orbital/sessions/${selected.id}/resume`, {
|
|
152
|
-
method: 'POST',
|
|
153
|
-
headers: { 'Content-Type': 'application/json' },
|
|
154
|
-
body: JSON.stringify({ claude_session_id: sessionId }),
|
|
155
|
-
});
|
|
156
|
-
} catch { /* silent */ }
|
|
157
|
-
finally { setTimeout(() => setResuming(false), 2000); }
|
|
158
|
-
}, [selected, detail]);
|
|
159
|
-
|
|
160
|
-
if (loading) {
|
|
161
|
-
return (
|
|
162
|
-
<div className="flex h-64 items-center justify-center">
|
|
163
|
-
<div className="h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
|
164
|
-
</div>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<div className="flex flex-1 min-h-0 flex-col">
|
|
170
|
-
<div className="mb-4 flex items-center gap-3">
|
|
171
|
-
<Clock className="h-4 w-4 text-primary" />
|
|
172
|
-
<h1 className="text-xl font-light">Sessions</h1>
|
|
173
|
-
<Badge variant="secondary">{sessions.length} sessions</Badge>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
{sessions.length === 0 ? (
|
|
177
|
-
<div className="flex flex-1 items-center justify-center">
|
|
178
|
-
<div className="text-center">
|
|
179
|
-
<Clock className="mx-auto mb-3 h-10 w-10 text-muted-foreground/30" />
|
|
180
|
-
<p className="text-sm text-muted-foreground">
|
|
181
|
-
No session history yet. Sessions are recorded from handoff files.
|
|
182
|
-
</p>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
) : (
|
|
186
|
-
<div className="flex flex-1 gap-0 overflow-hidden rounded-lg border border-border/50">
|
|
187
|
-
{/* Left: session list */}
|
|
188
|
-
<div className="w-[40%] border-r border-border/50 overflow-hidden">
|
|
189
|
-
<ScrollArea className="h-full">
|
|
190
|
-
<div className="relative p-3">
|
|
191
|
-
<div className="absolute left-6 top-3 bottom-3 w-px bg-border" />
|
|
192
|
-
{neonGlass ? (
|
|
193
|
-
<motion.div className="space-y-1" variants={sessionStagger} initial="hidden" animate="show">
|
|
194
|
-
{sessions.map((s) => (
|
|
195
|
-
<motion.div key={s.id} variants={sessionItem}>
|
|
196
|
-
<SessionListItem session={s} isSelected={selected?.id === s.id} neonGlass onClick={() => selectSession(s)} />
|
|
197
|
-
</motion.div>
|
|
198
|
-
))}
|
|
199
|
-
</motion.div>
|
|
200
|
-
) : (
|
|
201
|
-
<div className="space-y-1">
|
|
202
|
-
{sessions.map((s) => (
|
|
203
|
-
<SessionListItem key={s.id} session={s} isSelected={selected?.id === s.id} neonGlass={false} onClick={() => selectSession(s)} />
|
|
204
|
-
))}
|
|
205
|
-
</div>
|
|
206
|
-
)}
|
|
207
|
-
</div>
|
|
208
|
-
</ScrollArea>
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
{/* Right: detail pane */}
|
|
212
|
-
<div className="w-[60%] overflow-hidden">
|
|
213
|
-
{selected ? (
|
|
214
|
-
<DetailPane session={selected} detail={detail} loading={detailLoading} resuming={resuming} onResume={handleResume} />
|
|
215
|
-
) : (
|
|
216
|
-
<div className="flex h-full items-center justify-center">
|
|
217
|
-
<div className="text-center">
|
|
218
|
-
<Clock className="mx-auto mb-3 h-10 w-10 text-muted-foreground/30" />
|
|
219
|
-
<p className="text-sm text-muted-foreground">Select a session to view details</p>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
|
-
)}
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
)}
|
|
226
|
-
</div>
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// ─── Session List Item ─────────────────────────────────────
|
|
231
|
-
|
|
232
|
-
function SessionListItem({ session, isSelected, neonGlass, onClick }: {
|
|
233
|
-
session: TimelineSession; isSelected: boolean; neonGlass: boolean; onClick: () => void;
|
|
234
|
-
}) {
|
|
235
|
-
const scopeIds = session.scope_ids;
|
|
236
|
-
const discoveries = Array.isArray(session.discoveries) ? session.discoveries : [];
|
|
237
|
-
const nextSteps = Array.isArray(session.next_steps) ? session.next_steps : [];
|
|
238
|
-
|
|
239
|
-
return (
|
|
240
|
-
<div className="relative pl-8 cursor-pointer" onClick={onClick}>
|
|
241
|
-
<div className={cn(
|
|
242
|
-
'absolute left-1.5 top-3 h-2.5 w-2.5 rounded-full border-2',
|
|
243
|
-
isSelected ? 'border-primary bg-primary' : 'border-muted-foreground/40 bg-background',
|
|
244
|
-
neonGlass && 'timeline-dot-glow glow-blue',
|
|
245
|
-
)} />
|
|
246
|
-
<div className={cn(
|
|
247
|
-
'rounded-md px-3 py-2 transition-colors',
|
|
248
|
-
isSelected ? 'bg-primary/10 border border-primary/30' : 'hover:bg-muted/50',
|
|
249
|
-
)}>
|
|
250
|
-
<div className="flex items-center gap-1.5 flex-wrap">
|
|
251
|
-
{session.started_at && (
|
|
252
|
-
<span className="text-xxs text-muted-foreground">{format(new Date(session.started_at), 'MMM d')}</span>
|
|
253
|
-
)}
|
|
254
|
-
{scopeIds.slice(0, 3).map((id) => (
|
|
255
|
-
<Badge key={id} variant="outline" className="font-mono text-xxs px-1 py-0">{formatScopeId(id)}</Badge>
|
|
256
|
-
))}
|
|
257
|
-
{scopeIds.length > 3 && (
|
|
258
|
-
<span className="text-xxs text-muted-foreground">+{scopeIds.length - 3}</span>
|
|
259
|
-
)}
|
|
260
|
-
{session.actions?.slice(0, 2).map((a) => (
|
|
261
|
-
<Badge key={a} variant="secondary" className="text-xxs px-1 py-0 font-light">{actionLabel(a)}</Badge>
|
|
262
|
-
))}
|
|
263
|
-
</div>
|
|
264
|
-
<p className={cn('mt-0.5 text-xs font-normal truncate', isSelected ? 'text-foreground' : 'text-foreground/80')}>
|
|
265
|
-
{session.summary ? truncate(session.summary, 80) : 'Untitled Session'}
|
|
266
|
-
</p>
|
|
267
|
-
<div className="mt-1 flex items-center gap-3 text-xxs text-muted-foreground">
|
|
268
|
-
{discoveries.length > 0 && <span className="text-bid-green">{discoveries.length} completed</span>}
|
|
269
|
-
{nextSteps.length > 0 && <span className="text-accent-blue">{nextSteps.length} next</span>}
|
|
270
|
-
</div>
|
|
271
|
-
</div>
|
|
272
|
-
</div>
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// ─── Detail Pane ───────────────────────────────────────────
|
|
277
|
-
|
|
278
|
-
function DetailPane({ session, detail, loading, resuming, onResume }: {
|
|
279
|
-
session: TimelineSession; detail: SessionDetail | null; loading: boolean; resuming: boolean; onResume: () => void;
|
|
280
|
-
}) {
|
|
281
|
-
const scopeIds = session.scope_ids;
|
|
282
|
-
const discoveries = Array.isArray(session.discoveries) ? session.discoveries : [];
|
|
283
|
-
const nextSteps = Array.isArray(session.next_steps) ? session.next_steps : [];
|
|
284
|
-
const meta = detail?.meta ?? null;
|
|
285
|
-
const canResume = !!detail?.claude_session_id;
|
|
286
|
-
const displayName = meta?.summary ?? session.summary ?? null;
|
|
287
|
-
|
|
288
|
-
// Build metadata rows as [label, value, className?, actionUrl?] tuples
|
|
289
|
-
const rows: [string, string, string?, string?][] = [];
|
|
290
|
-
if (scopeIds.length > 0) rows.push(['Scopes', scopeIds.map((id) => formatScopeId(id)).join(', ')]);
|
|
291
|
-
if (session.actions?.length > 0) rows.push(['Actions', session.actions.map(actionLabel).join(', ')]);
|
|
292
|
-
if (session.summary) rows.push(['Summary', truncate(session.summary, 200)]);
|
|
293
|
-
rows.push(['Started', session.started_at ? format(new Date(session.started_at), 'MMM d, h:mm a') : '—']);
|
|
294
|
-
rows.push(['Ended', session.ended_at ? format(new Date(session.ended_at), 'MMM d, h:mm a') : '—']);
|
|
295
|
-
if (meta?.branch && meta.branch !== 'unknown') rows.push(['Branch', meta.branch, 'font-mono text-xxs']);
|
|
296
|
-
if (meta && meta.fileSize > 0) rows.push(['File size', formatFileSize(meta.fileSize)]);
|
|
297
|
-
if (meta) rows.push(['Plan', meta.slug, 'text-muted-foreground', `/api/orbital/open-file?path=scopes/${meta.slug}.md`]);
|
|
298
|
-
if (session.handoff_file) rows.push(['Handoff', session.handoff_file, 'font-mono text-xxs']);
|
|
299
|
-
if (detail?.claude_session_id) rows.push(['Session ID', detail.claude_session_id, 'font-mono text-xxs text-muted-foreground']);
|
|
300
|
-
|
|
301
|
-
return (
|
|
302
|
-
<div className="flex h-full flex-col">
|
|
303
|
-
<div className="px-5 pt-4 pb-3">
|
|
304
|
-
<p className="text-xxs text-muted-foreground">
|
|
305
|
-
{session.started_at && format(new Date(session.started_at), 'MMM d, yyyy — h:mm a')}
|
|
306
|
-
{scopeIds.length > 0 && scopeIds.slice(0, 4).map((id) => (
|
|
307
|
-
<span key={id} className="ml-1.5">
|
|
308
|
-
<Badge variant="outline" className="font-mono text-xxs">{formatScopeId(id)}</Badge>
|
|
309
|
-
</span>
|
|
310
|
-
))}
|
|
311
|
-
{scopeIds.length > 4 && <span className="ml-1 text-xxs">+{scopeIds.length - 4}</span>}
|
|
312
|
-
</p>
|
|
313
|
-
<h2 className="mt-1 text-sm font-light">{displayName ? truncate(displayName, 120) : 'Untitled Session'}</h2>
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
<Separator />
|
|
317
|
-
|
|
318
|
-
<ScrollArea className="flex-1">
|
|
319
|
-
<div className="px-5 py-4">
|
|
320
|
-
{loading ? (
|
|
321
|
-
<div className="flex h-20 items-center justify-center">
|
|
322
|
-
<div className="h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
|
323
|
-
</div>
|
|
324
|
-
) : (
|
|
325
|
-
<>
|
|
326
|
-
<table className="w-full table-fixed text-xs">
|
|
327
|
-
<colgroup><col className="w-28" /><col /></colgroup>
|
|
328
|
-
<tbody className="[&_td]:border-b [&_td]:border-border/30 [&_td]:py-2 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap [&_td:last-child]:break-all">
|
|
329
|
-
{rows.map(([label, value, cls, action]) => (
|
|
330
|
-
<tr key={label}>
|
|
331
|
-
<td>{label}</td>
|
|
332
|
-
<td className={cls}>
|
|
333
|
-
{action ? (
|
|
334
|
-
<button
|
|
335
|
-
onClick={() => { fetch(action, { method: 'POST' }); }}
|
|
336
|
-
className="inline-flex items-center gap-1.5 hover:text-accent-blue transition-colors"
|
|
337
|
-
title="Open file"
|
|
338
|
-
>
|
|
339
|
-
{value}
|
|
340
|
-
<ExternalLink className="h-3 w-3 opacity-50" />
|
|
341
|
-
</button>
|
|
342
|
-
) : value}
|
|
343
|
-
</td>
|
|
344
|
-
</tr>
|
|
345
|
-
))}
|
|
346
|
-
</tbody>
|
|
347
|
-
</table>
|
|
348
|
-
|
|
349
|
-
<BulletSection title="Completed" items={discoveries} color="text-bid-green" />
|
|
350
|
-
<BulletSection title="Next Steps" items={nextSteps} color="text-accent-blue" />
|
|
351
|
-
|
|
352
|
-
{detail?.stats && <StatsSection stats={detail.stats} />}
|
|
353
|
-
|
|
354
|
-
{session.handoff_file && (
|
|
355
|
-
<div className="mt-4 flex items-center gap-1.5 text-xxs text-muted-foreground/60">
|
|
356
|
-
<FileText className="h-3 w-3" />
|
|
357
|
-
<span className="truncate">{session.handoff_file}</span>
|
|
358
|
-
</div>
|
|
359
|
-
)}
|
|
360
|
-
</>
|
|
361
|
-
)}
|
|
362
|
-
</div>
|
|
363
|
-
</ScrollArea>
|
|
364
|
-
|
|
365
|
-
{!loading && (
|
|
366
|
-
<div className="border-t border-border/50 px-5 py-3">
|
|
367
|
-
<Button className="w-full" disabled={!canResume || resuming} onClick={onResume}
|
|
368
|
-
title={canResume ? 'Open in iTerm' : 'No Claude Code session found'}>
|
|
369
|
-
<Terminal className="mr-2 h-4 w-4" />
|
|
370
|
-
{resuming ? 'Opening iTerm...' : 'Resume Session'}
|
|
371
|
-
</Button>
|
|
372
|
-
{!canResume && <p className="mt-1.5 text-center text-xxs text-muted-foreground">No matching Claude Code session found</p>}
|
|
373
|
-
</div>
|
|
374
|
-
)}
|
|
375
|
-
</div>
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// ─── Stats Section ─────────────────────────────────────────
|
|
380
|
-
|
|
381
|
-
function StatsSection({ stats }: { stats: SessionStats }) {
|
|
382
|
-
const { user, assistant, system, timing } = stats;
|
|
383
|
-
const toolEntries = Object.entries(assistant.toolsUsed).sort((a, b) => b[1] - a[1]);
|
|
384
|
-
|
|
385
|
-
return (
|
|
386
|
-
<div className="mt-5 space-y-4">
|
|
387
|
-
<Separator />
|
|
388
|
-
|
|
389
|
-
{/* Timing */}
|
|
390
|
-
<StatsGroup title="Timing">
|
|
391
|
-
{timing.durationMs > 0 && <StatsRow label="Duration" value={formatDuration(timing.durationMs)} />}
|
|
392
|
-
{timing.firstTimestamp && <StatsRow label="First event" value={format(new Date(timing.firstTimestamp), 'MMM d, h:mm:ss a')} />}
|
|
393
|
-
{timing.lastTimestamp && <StatsRow label="Last event" value={format(new Date(timing.lastTimestamp), 'MMM d, h:mm:ss a')} />}
|
|
394
|
-
</StatsGroup>
|
|
395
|
-
|
|
396
|
-
{/* User */}
|
|
397
|
-
<StatsGroup title="User">
|
|
398
|
-
<StatsRow label="Messages" value={`${user.totalMessages - user.metaMessages - user.toolResults} direct, ${user.metaMessages} meta, ${user.toolResults} tool results`} />
|
|
399
|
-
{user.commands.length > 0 && <StatsRow label="Commands" value={user.commands.join(', ')} cls="font-mono" />}
|
|
400
|
-
{user.permissionModes.length > 0 && <StatsRow label="Permission modes" value={user.permissionModes.join(', ')} />}
|
|
401
|
-
{user.version && <StatsRow label="Claude Code version" value={user.version} cls="font-mono" />}
|
|
402
|
-
{user.cwd && <StatsRow label="Working directory" value={user.cwd} cls="font-mono text-xxs" />}
|
|
403
|
-
</StatsGroup>
|
|
404
|
-
|
|
405
|
-
{/* Assistant */}
|
|
406
|
-
<StatsGroup title="Assistant">
|
|
407
|
-
<StatsRow label="Responses" value={String(assistant.totalMessages)} />
|
|
408
|
-
{assistant.models.length > 0 && <StatsRow label="Models" value={assistant.models.join(', ')} cls="font-mono" />}
|
|
409
|
-
<StatsRow label="Input tokens" value={formatNumber(assistant.totalInputTokens)} />
|
|
410
|
-
<StatsRow label="Output tokens" value={formatNumber(assistant.totalOutputTokens)} />
|
|
411
|
-
{assistant.totalCacheReadTokens > 0 && <StatsRow label="Cache read tokens" value={formatNumber(assistant.totalCacheReadTokens)} />}
|
|
412
|
-
{assistant.totalCacheCreationTokens > 0 && <StatsRow label="Cache creation tokens" value={formatNumber(assistant.totalCacheCreationTokens)} />}
|
|
413
|
-
{toolEntries.length > 0 && (
|
|
414
|
-
<tr>
|
|
415
|
-
<td className="pr-3 text-muted-foreground whitespace-nowrap align-top">Tools used</td>
|
|
416
|
-
<td>
|
|
417
|
-
<div className="flex flex-wrap gap-1">
|
|
418
|
-
{toolEntries.map(([name, count]) => (
|
|
419
|
-
<Badge key={name} variant="outline" className="font-mono text-xxs px-1.5 py-0">
|
|
420
|
-
{name} <span className="ml-1 text-muted-foreground">{count}</span>
|
|
421
|
-
</Badge>
|
|
422
|
-
))}
|
|
423
|
-
</div>
|
|
424
|
-
</td>
|
|
425
|
-
</tr>
|
|
426
|
-
)}
|
|
427
|
-
</StatsGroup>
|
|
428
|
-
|
|
429
|
-
{/* System */}
|
|
430
|
-
{system.totalMessages > 0 && (
|
|
431
|
-
<StatsGroup title="System">
|
|
432
|
-
<StatsRow label="Events" value={String(system.totalMessages)} />
|
|
433
|
-
{system.subtypes.length > 0 && <StatsRow label="Subtypes" value={system.subtypes.join(', ')} />}
|
|
434
|
-
{system.stopReasons.length > 0 && <StatsRow label="Stop reasons" value={system.stopReasons.join(', ')} />}
|
|
435
|
-
{system.totalDurationMs > 0 && <StatsRow label="Total processing" value={formatDuration(system.totalDurationMs)} />}
|
|
436
|
-
{system.hookCount > 0 && <StatsRow label="Hooks fired" value={`${system.hookCount}${system.hookErrors > 0 ? ` (${system.hookErrors} errors)` : ''}`} />}
|
|
437
|
-
</StatsGroup>
|
|
438
|
-
)}
|
|
439
|
-
|
|
440
|
-
{/* Line counts */}
|
|
441
|
-
<StatsGroup title="Raw Counts">
|
|
442
|
-
{Object.entries(stats.typeCounts).sort((a, b) => b[1] - a[1]).map(([type, count]) => (
|
|
443
|
-
<StatsRow key={type} label={type} value={String(count)} />
|
|
444
|
-
))}
|
|
445
|
-
</StatsGroup>
|
|
446
|
-
</div>
|
|
447
|
-
);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function StatsGroup({ title, children }: { title: string; children: React.ReactNode }) {
|
|
451
|
-
return (
|
|
452
|
-
<div>
|
|
453
|
-
<h4 className="mb-2 text-xxs font-medium uppercase tracking-wider text-foreground">{title}</h4>
|
|
454
|
-
<table className="w-full table-fixed text-xs">
|
|
455
|
-
<colgroup><col className="w-40" /><col /></colgroup>
|
|
456
|
-
<tbody className="[&_td]:border-b [&_td]:border-border/20 [&_td]:py-1.5 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap">
|
|
457
|
-
{children}
|
|
458
|
-
</tbody>
|
|
459
|
-
</table>
|
|
460
|
-
</div>
|
|
461
|
-
);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function StatsRow({ label, value, cls }: { label: string; value: string; cls?: string }) {
|
|
465
|
-
return (
|
|
466
|
-
<tr>
|
|
467
|
-
<td>{label}</td>
|
|
468
|
-
<td className={cls}>{value}</td>
|
|
469
|
-
</tr>
|
|
470
|
-
);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// ─── Shared Helpers ────────────────────────────────────────
|
|
474
|
-
|
|
475
|
-
function BulletSection({ title, items, color }: { title: string; items: string[]; color: string }) {
|
|
476
|
-
if (items.length === 0) return null;
|
|
477
|
-
return (
|
|
478
|
-
<div className="mt-5">
|
|
479
|
-
<h4 className="mb-2 text-xxs font-medium uppercase tracking-wider text-foreground">{title}</h4>
|
|
480
|
-
<ul className="space-y-1.5">
|
|
481
|
-
{items.map((item, idx) => (
|
|
482
|
-
<li key={idx} className="flex items-start gap-2 text-xs">
|
|
483
|
-
<span className={cn('mt-0.5', color)}>{'•'}</span>
|
|
484
|
-
<span>{item}</span>
|
|
485
|
-
</li>
|
|
486
|
-
))}
|
|
487
|
-
</ul>
|
|
488
|
-
</div>
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
function truncate(text: string, max: number): string {
|
|
493
|
-
return text.length > max ? text.slice(0, max) + '...' : text;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
function formatFileSize(bytes: number): string {
|
|
497
|
-
if (bytes < 1024) return `${bytes} B`;
|
|
498
|
-
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
499
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
function formatDuration(ms: number): string {
|
|
503
|
-
if (ms < 1000) return `${ms}ms`;
|
|
504
|
-
const secs = Math.floor(ms / 1000);
|
|
505
|
-
if (secs < 60) return `${secs}s`;
|
|
506
|
-
const mins = Math.floor(secs / 60);
|
|
507
|
-
const remSecs = secs % 60;
|
|
508
|
-
if (mins < 60) return `${mins}m ${remSecs}s`;
|
|
509
|
-
const hrs = Math.floor(mins / 60);
|
|
510
|
-
const remMins = mins % 60;
|
|
511
|
-
return `${hrs}h ${remMins}m`;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
function formatNumber(n: number): string {
|
|
515
|
-
return n.toLocaleString();
|
|
516
|
-
}
|