@mrpatronz/nexusflow 0.2.18 → 0.2.19
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/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +37 -50
- package/dist/commands/sync.js.map +1 -1
- package/dist/core/sync.d.ts +44 -0
- package/dist/core/sync.d.ts.map +1 -0
- package/dist/core/sync.js +82 -0
- package/dist/core/sync.js.map +1 -0
- package/dist/core/workspace-state.d.ts +51 -0
- package/dist/core/workspace-state.d.ts.map +1 -0
- package/dist/core/workspace-state.js +108 -0
- package/dist/core/workspace-state.js.map +1 -0
- package/dist/core/workspace-state.test.d.ts +2 -0
- package/dist/core/workspace-state.test.d.ts.map +1 -0
- package/dist/core/workspace-state.test.js +84 -0
- package/dist/core/workspace-state.test.js.map +1 -0
- package/dist/gui/assets/index-Bdbld6yY.css +1 -0
- package/dist/gui/assets/index-D8iJPvnk.js +26 -0
- package/dist/gui/index.html +2 -2
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +42 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +94 -13
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/multi-git.d.ts +33 -8
- package/dist/utils/multi-git.d.ts.map +1 -1
- package/dist/utils/multi-git.js +91 -19
- package/dist/utils/multi-git.js.map +1 -1
- package/dist/utils/multi-git.test.d.ts +2 -0
- package/dist/utils/multi-git.test.d.ts.map +1 -0
- package/dist/utils/multi-git.test.js +125 -0
- package/dist/utils/multi-git.test.js.map +1 -0
- package/gui/e2e/dashboard.spec.ts +61 -0
- package/gui/e2e/wizard.spec.ts +2 -2
- package/gui/package-lock.json +62 -4
- package/gui/package.json +2 -1
- package/gui/src/App.tsx +168 -227
- package/gui/src/app/AppSidebar.tsx +69 -0
- package/gui/src/components/AddRepoPicker.tsx +81 -0
- package/gui/src/components/ui/Button.tsx +40 -0
- package/gui/src/components/ui/Card.tsx +6 -0
- package/gui/src/components/ui/EmptyState.tsx +22 -0
- package/gui/src/components/ui/Input.tsx +21 -0
- package/gui/src/components/ui/Menu.tsx +71 -0
- package/gui/src/components/ui/Modal.tsx +39 -0
- package/gui/src/components/ui/PageHeader.tsx +21 -0
- package/gui/src/components/ui/RepoStatusStrip.tsx +33 -0
- package/gui/src/components/ui/Skeleton.tsx +5 -0
- package/gui/src/components/ui/StatusPill.tsx +36 -0
- package/gui/src/components/ui/Tabs.tsx +40 -0
- package/gui/src/components/ui/cn.ts +4 -0
- package/gui/src/components/ui/index.ts +16 -0
- package/gui/src/features/services/ServiceConsole.tsx +4 -39
- package/gui/src/index.css +140 -125
- package/gui/src/lib/status.ts +24 -0
- package/gui/src/pages/DashboardPage.tsx +129 -0
- package/gui/src/pages/WorkspacesPage.tsx +352 -0
- package/gui/src/types.ts +19 -0
- package/package.json +1 -1
- package/src/commands/sync.ts +36 -58
- package/src/core/sync.ts +121 -0
- package/src/core/workspace-state.test.ts +108 -0
- package/src/core/workspace-state.ts +130 -0
- package/src/mcp/server.ts +44 -0
- package/src/server.ts +103 -15
- package/src/types.ts +36 -0
- package/src/utils/multi-git.test.ts +158 -0
- package/src/utils/multi-git.ts +117 -25
- package/dist/gui/assets/index-CB-jWded.css +0 -1
- package/dist/gui/assets/index-DDXpZZu3.js +0 -25
- package/gui/src/features/workspace/WorkspaceList.tsx +0 -666
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LayoutDashboard, FolderGit2, Workflow, Settings as SettingsIcon, BookOpen, Plus, type LucideIcon } from 'lucide-react';
|
|
2
|
+
import { cn } from '../components/ui/index.js';
|
|
3
|
+
|
|
4
|
+
interface NavItem {
|
|
5
|
+
label: string;
|
|
6
|
+
to: string;
|
|
7
|
+
icon: LucideIcon;
|
|
8
|
+
match: (p: string) => boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ITEMS: NavItem[] = [
|
|
12
|
+
{ label: 'Overview', to: '/', icon: LayoutDashboard, match: (p) => p === '/' },
|
|
13
|
+
{ label: 'Workspaces', to: '/workspaces', icon: FolderGit2, match: (p) => p.startsWith('/workspaces') },
|
|
14
|
+
{ label: 'Strategies', to: '/strategies', icon: Workflow, match: (p) => p.startsWith('/strategies') },
|
|
15
|
+
{ label: 'Settings', to: '/settings', icon: SettingsIcon, match: (p) => p.startsWith('/settings') },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export function AppSidebar({
|
|
19
|
+
pathname,
|
|
20
|
+
appVersion,
|
|
21
|
+
onNavigate,
|
|
22
|
+
onNewWorkspace,
|
|
23
|
+
}: {
|
|
24
|
+
pathname: string;
|
|
25
|
+
appVersion: string;
|
|
26
|
+
onNavigate: (to: string) => void;
|
|
27
|
+
onNewWorkspace: () => void;
|
|
28
|
+
}) {
|
|
29
|
+
const linkClass = (active: boolean) =>
|
|
30
|
+
cn(
|
|
31
|
+
'flex items-center gap-2.5 rounded-md px-3 py-2 text-sm font-medium transition-colors cursor-pointer',
|
|
32
|
+
active ? 'bg-accent-soft text-accent' : 'text-content-muted hover:bg-raised hover:text-content',
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<aside className="flex w-60 shrink-0 flex-col border-r border-hairline bg-surface/40 p-4">
|
|
37
|
+
<div className="mb-5 flex items-center gap-2.5 px-2 py-1">
|
|
38
|
+
<div className="grid h-8 w-8 place-items-center rounded-md bg-accent font-display text-sm font-bold text-white">NF</div>
|
|
39
|
+
<span className="font-display text-sm font-semibold text-content">NexusFlow</span>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<button
|
|
43
|
+
onClick={onNewWorkspace}
|
|
44
|
+
className="mb-5 inline-flex items-center justify-center gap-2 rounded-md bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover cursor-pointer"
|
|
45
|
+
>
|
|
46
|
+
<Plus size={16} /> New workspace
|
|
47
|
+
</button>
|
|
48
|
+
|
|
49
|
+
<nav className="flex flex-1 flex-col gap-1">
|
|
50
|
+
{ITEMS.map((it) => {
|
|
51
|
+
const Icon = it.icon;
|
|
52
|
+
return (
|
|
53
|
+
<button key={it.to} onClick={() => onNavigate(it.to)} className={linkClass(it.match(pathname))}>
|
|
54
|
+
<Icon size={16} /> {it.label}
|
|
55
|
+
</button>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
58
|
+
</nav>
|
|
59
|
+
|
|
60
|
+
<button onClick={() => onNavigate('/guide')} className={linkClass(pathname.startsWith('/guide'))}>
|
|
61
|
+
<BookOpen size={16} /> Getting started
|
|
62
|
+
</button>
|
|
63
|
+
|
|
64
|
+
<div className="mt-3 border-t border-hairline pt-3 text-center text-[10px] font-medium uppercase tracking-wider text-content-faint">
|
|
65
|
+
NexusFlow v{appVersion}
|
|
66
|
+
</div>
|
|
67
|
+
</aside>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
|
+
import { Plus, Search } from 'lucide-react';
|
|
3
|
+
import type { RepoInfo } from '../types.js';
|
|
4
|
+
import { Input } from './ui/index.js';
|
|
5
|
+
|
|
6
|
+
/** A searchable popover for attaching another repository to a workspace. */
|
|
7
|
+
export function AddRepoPicker({
|
|
8
|
+
repos,
|
|
9
|
+
disabled,
|
|
10
|
+
onAdd,
|
|
11
|
+
}: {
|
|
12
|
+
repos: RepoInfo[];
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onAdd: (repoPath: string) => void;
|
|
15
|
+
}) {
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const [query, setQuery] = useState('');
|
|
18
|
+
|
|
19
|
+
const filtered = useMemo(() => {
|
|
20
|
+
const q = query.trim().toLowerCase();
|
|
21
|
+
if (!q) return repos;
|
|
22
|
+
return repos.filter((r) => r.name.toLowerCase().includes(q) || r.path.toLowerCase().includes(q));
|
|
23
|
+
}, [repos, query]);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className="relative">
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
disabled={disabled}
|
|
30
|
+
aria-haspopup="listbox"
|
|
31
|
+
aria-expanded={open}
|
|
32
|
+
onClick={() => {
|
|
33
|
+
setQuery('');
|
|
34
|
+
setOpen((o) => !o);
|
|
35
|
+
}}
|
|
36
|
+
className="inline-flex items-center gap-1.5 rounded-md border border-hairline bg-surface px-3 py-1.5 text-xs font-medium text-content-muted transition-colors hover:bg-raised hover:text-content disabled:cursor-not-allowed disabled:opacity-40 cursor-pointer"
|
|
37
|
+
>
|
|
38
|
+
<Plus size={14} /> Add repository
|
|
39
|
+
</button>
|
|
40
|
+
|
|
41
|
+
{open && (
|
|
42
|
+
<>
|
|
43
|
+
<div className="fixed inset-0 z-40" aria-hidden="true" onClick={() => setOpen(false)} />
|
|
44
|
+
<div className="absolute right-0 z-50 mt-1.5 w-72 overflow-hidden rounded-lg border border-hairline bg-raised shadow-xl animate-fade-in">
|
|
45
|
+
<div className="relative border-b border-hairline p-2">
|
|
46
|
+
<Search size={14} className="pointer-events-none absolute left-4 top-1/2 -translate-y-1/2 text-content-faint" />
|
|
47
|
+
<Input
|
|
48
|
+
autoFocus
|
|
49
|
+
value={query}
|
|
50
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
51
|
+
placeholder="Search repositories"
|
|
52
|
+
className="pl-8"
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
<div role="listbox" className="max-h-64 overflow-y-auto py-1">
|
|
56
|
+
{filtered.length === 0 ? (
|
|
57
|
+
<div className="px-3 py-4 text-center text-xs text-content-faint">No repositories found.</div>
|
|
58
|
+
) : (
|
|
59
|
+
filtered.map((r) => (
|
|
60
|
+
<button
|
|
61
|
+
key={r.path}
|
|
62
|
+
role="option"
|
|
63
|
+
aria-selected={false}
|
|
64
|
+
onClick={() => {
|
|
65
|
+
setOpen(false);
|
|
66
|
+
onAdd(r.path);
|
|
67
|
+
}}
|
|
68
|
+
className="flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-surface cursor-pointer"
|
|
69
|
+
>
|
|
70
|
+
<span className="font-mono text-xs font-semibold text-content">{r.name}</span>
|
|
71
|
+
<span className="w-full truncate text-[10px] text-content-faint">{r.path}</span>
|
|
72
|
+
</button>
|
|
73
|
+
))
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { cn } from './cn.js';
|
|
3
|
+
|
|
4
|
+
type Variant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
5
|
+
type Size = 'sm' | 'md';
|
|
6
|
+
|
|
7
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
variant?: Variant;
|
|
9
|
+
size?: Size;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const VARIANTS: Record<Variant, string> = {
|
|
14
|
+
primary: 'bg-accent text-white hover:bg-accent-hover border border-transparent',
|
|
15
|
+
secondary: 'bg-surface text-content border border-hairline hover:bg-raised hover:border-hairline-strong',
|
|
16
|
+
ghost: 'bg-transparent text-content-muted hover:text-content hover:bg-raised border border-transparent',
|
|
17
|
+
danger: 'bg-transparent text-danger border border-danger/40 hover:bg-danger/10',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const SIZES: Record<Size, string> = {
|
|
21
|
+
sm: 'text-xs px-2.5 py-1.5 gap-1.5 rounded-md',
|
|
22
|
+
md: 'text-sm px-3.5 py-2 gap-2 rounded-md',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function Button({ variant = 'secondary', size = 'md', icon, className, children, ...rest }: ButtonProps) {
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
className={cn(
|
|
29
|
+
'inline-flex items-center justify-center font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed',
|
|
30
|
+
VARIANTS[variant],
|
|
31
|
+
SIZES[size],
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...rest}
|
|
35
|
+
>
|
|
36
|
+
{icon}
|
|
37
|
+
{children}
|
|
38
|
+
</button>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export function EmptyState({
|
|
4
|
+
icon,
|
|
5
|
+
title,
|
|
6
|
+
description,
|
|
7
|
+
action,
|
|
8
|
+
}: {
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
action?: ReactNode;
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<div className="flex flex-col items-center justify-center px-6 py-16 text-center">
|
|
16
|
+
{icon && <div className="mb-3 text-content-faint">{icon}</div>}
|
|
17
|
+
<h3 className="font-display text-lg font-semibold text-content">{title}</h3>
|
|
18
|
+
{description && <p className="mt-1 max-w-sm text-sm text-content-muted">{description}</p>}
|
|
19
|
+
{action && <div className="mt-4">{action}</div>}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { cn } from './cn.js';
|
|
3
|
+
|
|
4
|
+
const base =
|
|
5
|
+
'w-full bg-base border border-hairline rounded-md px-3 py-2 text-sm text-content placeholder:text-content-faint outline-none focus:border-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed';
|
|
6
|
+
|
|
7
|
+
export function Input({ className, ...rest }: InputHTMLAttributes<HTMLInputElement>) {
|
|
8
|
+
return <input className={cn(base, className)} {...rest} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function Textarea({ className, ...rest }: TextareaHTMLAttributes<HTMLTextAreaElement>) {
|
|
12
|
+
return <textarea className={cn(base, 'resize-y leading-relaxed', className)} {...rest} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Select({ className, children, ...rest }: SelectHTMLAttributes<HTMLSelectElement>) {
|
|
16
|
+
return (
|
|
17
|
+
<select className={cn(base, 'cursor-pointer', className)} {...rest}>
|
|
18
|
+
{children}
|
|
19
|
+
</select>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useState, type ReactNode } from 'react';
|
|
2
|
+
import { cn } from './cn.js';
|
|
3
|
+
|
|
4
|
+
export interface MenuItem {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
danger?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Menu({
|
|
13
|
+
trigger,
|
|
14
|
+
items,
|
|
15
|
+
align = 'right',
|
|
16
|
+
label,
|
|
17
|
+
}: {
|
|
18
|
+
trigger: ReactNode;
|
|
19
|
+
items: MenuItem[];
|
|
20
|
+
align?: 'left' | 'right';
|
|
21
|
+
label?: string;
|
|
22
|
+
}) {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
return (
|
|
25
|
+
<div className="relative">
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
aria-haspopup="menu"
|
|
29
|
+
aria-expanded={open}
|
|
30
|
+
aria-label={label}
|
|
31
|
+
onClick={() => setOpen((o) => !o)}
|
|
32
|
+
className="inline-flex items-center justify-center cursor-pointer"
|
|
33
|
+
>
|
|
34
|
+
{trigger}
|
|
35
|
+
</button>
|
|
36
|
+
{open && (
|
|
37
|
+
<>
|
|
38
|
+
<div className="fixed inset-0 z-40" aria-hidden="true" onClick={() => setOpen(false)} />
|
|
39
|
+
<div
|
|
40
|
+
role="menu"
|
|
41
|
+
className={cn(
|
|
42
|
+
'absolute z-50 mt-1.5 min-w-48 rounded-lg border border-hairline bg-raised py-1 shadow-xl animate-fade-in',
|
|
43
|
+
align === 'right' ? 'right-0' : 'left-0',
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
{items.map((it, i) => (
|
|
47
|
+
<div key={i}>
|
|
48
|
+
{it.danger && <div className="my-1 h-px bg-hairline" />}
|
|
49
|
+
<button
|
|
50
|
+
role="menuitem"
|
|
51
|
+
disabled={it.disabled}
|
|
52
|
+
onClick={() => {
|
|
53
|
+
setOpen(false);
|
|
54
|
+
it.onClick();
|
|
55
|
+
}}
|
|
56
|
+
className={cn(
|
|
57
|
+
'flex w-full items-center gap-2.5 px-3 py-2 text-sm font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed',
|
|
58
|
+
it.danger ? 'text-danger hover:bg-danger/10' : 'text-content-muted hover:bg-surface hover:text-content',
|
|
59
|
+
)}
|
|
60
|
+
>
|
|
61
|
+
{it.icon}
|
|
62
|
+
{it.label}
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
))}
|
|
66
|
+
</div>
|
|
67
|
+
</>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { X } from 'lucide-react';
|
|
3
|
+
import { cn } from './cn.js';
|
|
4
|
+
|
|
5
|
+
export function Modal({
|
|
6
|
+
open,
|
|
7
|
+
onClose,
|
|
8
|
+
title,
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
}: {
|
|
12
|
+
open: boolean;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
}) {
|
|
18
|
+
if (!open) return null;
|
|
19
|
+
return (
|
|
20
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
|
|
21
|
+
<div className="absolute inset-0 bg-black/70" onClick={onClose} aria-hidden="true" />
|
|
22
|
+
<div
|
|
23
|
+
role="dialog"
|
|
24
|
+
aria-modal="true"
|
|
25
|
+
className={cn('relative z-10 w-full max-w-lg rounded-lg border border-hairline bg-surface shadow-2xl animate-rise', className)}
|
|
26
|
+
>
|
|
27
|
+
{title && (
|
|
28
|
+
<div className="flex items-center justify-between border-b border-hairline px-5 py-3.5">
|
|
29
|
+
<h3 className="font-display font-semibold text-content">{title}</h3>
|
|
30
|
+
<button onClick={onClose} className="cursor-pointer text-content-faint hover:text-content" aria-label="Close">
|
|
31
|
+
<X size={16} />
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
)}
|
|
35
|
+
{children}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export function PageHeader({
|
|
4
|
+
title,
|
|
5
|
+
subtitle,
|
|
6
|
+
actions,
|
|
7
|
+
}: {
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
subtitle?: ReactNode;
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<div className="mb-6 flex items-start justify-between gap-4">
|
|
14
|
+
<div className="min-w-0">
|
|
15
|
+
<h1 className="font-display text-2xl font-bold tracking-tight text-content">{title}</h1>
|
|
16
|
+
{subtitle && <p className="mt-1 text-sm text-content-muted">{subtitle}</p>}
|
|
17
|
+
</div>
|
|
18
|
+
{actions && <div className="flex shrink-0 items-center gap-2">{actions}</div>}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn } from './cn.js';
|
|
2
|
+
|
|
3
|
+
export type RepoState = 'clean' | 'changes' | 'conflict' | 'unknown';
|
|
4
|
+
|
|
5
|
+
const STATE_DOT: Record<RepoState, string> = {
|
|
6
|
+
clean: 'bg-success',
|
|
7
|
+
changes: 'bg-warning',
|
|
8
|
+
conflict: 'bg-danger',
|
|
9
|
+
unknown: 'bg-idle',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface RepoDot {
|
|
13
|
+
name: string;
|
|
14
|
+
state?: RepoState;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Signature element: a row of per-repo status dots, reused across dashboard, list and detail. */
|
|
18
|
+
export function RepoStatusStrip({ repos, className }: { repos: RepoDot[]; className?: string }) {
|
|
19
|
+
return (
|
|
20
|
+
<div className={cn('flex flex-wrap items-center gap-1.5', className)}>
|
|
21
|
+
{repos.map((r) => (
|
|
22
|
+
<span
|
|
23
|
+
key={r.name}
|
|
24
|
+
title={`${r.name}${r.state ? ` · ${r.state}` : ''}`}
|
|
25
|
+
className="inline-flex items-center gap-1.5 rounded border border-hairline bg-base px-2 py-0.5 font-mono text-[11px] font-medium text-content-muted"
|
|
26
|
+
>
|
|
27
|
+
<span className={cn('h-1.5 w-1.5 rounded-full', STATE_DOT[r.state ?? 'unknown'])} />
|
|
28
|
+
{r.name}
|
|
29
|
+
</span>
|
|
30
|
+
))}
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { cn } from './cn.js';
|
|
3
|
+
|
|
4
|
+
export type Tone = 'success' | 'warning' | 'danger' | 'running' | 'idle' | 'accent' | 'neutral';
|
|
5
|
+
|
|
6
|
+
const TONES: Record<Tone, string> = {
|
|
7
|
+
success: 'text-success border-success/30 bg-success/10',
|
|
8
|
+
warning: 'text-warning border-warning/30 bg-warning/10',
|
|
9
|
+
danger: 'text-danger border-danger/30 bg-danger/10',
|
|
10
|
+
running: 'text-running border-running/30 bg-running/10',
|
|
11
|
+
idle: 'text-content-faint border-hairline bg-surface',
|
|
12
|
+
accent: 'text-accent border-accent/30 bg-accent-soft',
|
|
13
|
+
neutral: 'text-content-muted border-hairline bg-raised',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function StatusPill({
|
|
17
|
+
tone = 'neutral',
|
|
18
|
+
dot,
|
|
19
|
+
title,
|
|
20
|
+
children,
|
|
21
|
+
}: {
|
|
22
|
+
tone?: Tone;
|
|
23
|
+
dot?: boolean;
|
|
24
|
+
title?: string;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<span
|
|
29
|
+
title={title}
|
|
30
|
+
className={cn('inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-0.5 rounded-md border whitespace-nowrap', TONES[tone])}
|
|
31
|
+
>
|
|
32
|
+
{dot && <span className="h-1.5 w-1.5 rounded-full bg-current" />}
|
|
33
|
+
{children}
|
|
34
|
+
</span>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cn } from './cn.js';
|
|
2
|
+
|
|
3
|
+
export interface TabItem {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function Tabs({
|
|
9
|
+
items,
|
|
10
|
+
value,
|
|
11
|
+
onChange,
|
|
12
|
+
className,
|
|
13
|
+
}: {
|
|
14
|
+
items: TabItem[];
|
|
15
|
+
value: string;
|
|
16
|
+
onChange: (v: string) => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
}) {
|
|
19
|
+
return (
|
|
20
|
+
<div role="tablist" className={cn('flex items-center gap-1 border-b border-hairline overflow-x-auto', className)}>
|
|
21
|
+
{items.map((it) => {
|
|
22
|
+
const active = it.value === value;
|
|
23
|
+
return (
|
|
24
|
+
<button
|
|
25
|
+
key={it.value}
|
|
26
|
+
role="tab"
|
|
27
|
+
aria-selected={active}
|
|
28
|
+
onClick={() => onChange(it.value)}
|
|
29
|
+
className={cn(
|
|
30
|
+
'-mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm font-medium transition-colors cursor-pointer',
|
|
31
|
+
active ? 'text-content border-accent' : 'text-content-faint border-transparent hover:text-content',
|
|
32
|
+
)}
|
|
33
|
+
>
|
|
34
|
+
{it.label}
|
|
35
|
+
</button>
|
|
36
|
+
);
|
|
37
|
+
})}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { cn } from './cn.js';
|
|
2
|
+
export { Button } from './Button.js';
|
|
3
|
+
export { Card } from './Card.js';
|
|
4
|
+
export { StatusPill } from './StatusPill.js';
|
|
5
|
+
export type { Tone } from './StatusPill.js';
|
|
6
|
+
export { Tabs } from './Tabs.js';
|
|
7
|
+
export type { TabItem } from './Tabs.js';
|
|
8
|
+
export { Input, Textarea, Select } from './Input.js';
|
|
9
|
+
export { Menu } from './Menu.js';
|
|
10
|
+
export type { MenuItem } from './Menu.js';
|
|
11
|
+
export { Modal } from './Modal.js';
|
|
12
|
+
export { Skeleton } from './Skeleton.js';
|
|
13
|
+
export { EmptyState } from './EmptyState.js';
|
|
14
|
+
export { PageHeader } from './PageHeader.js';
|
|
15
|
+
export { RepoStatusStrip } from './RepoStatusStrip.js';
|
|
16
|
+
export type { RepoDot, RepoState } from './RepoStatusStrip.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Play, Square, AlertTriangle, Terminal, Maximize2, Minimize2, Trash2,
|
|
2
|
+
import { Play, Square, AlertTriangle, Terminal, Maximize2, Minimize2, Trash2, RefreshCw } from 'lucide-react';
|
|
3
3
|
import type { Feature, ServiceConfig, RunningService, OrchestrationDetection } from '../../types.js';
|
|
4
4
|
|
|
5
5
|
interface ServiceConsoleProps {
|
|
@@ -74,43 +74,8 @@ export const ServiceConsole: React.FC<ServiceConsoleProps> = ({
|
|
|
74
74
|
</div>
|
|
75
75
|
)}
|
|
76
76
|
|
|
77
|
-
{/*
|
|
78
|
-
<div className="
|
|
79
|
-
{/* Telemetry 1: CPU */}
|
|
80
|
-
<div className="glass-card p-5 rounded-2xl border border-slate-800/40 relative overflow-hidden transition-all duration-300 before:absolute before:inset-x-0 before:top-0 before:h-[1px] before:bg-gradient-to-r before:from-indigo-500/10 via-purple-500/10 to-transparent">
|
|
81
|
-
<div className="flex justify-between items-center text-xs font-semibold text-slate-400 mb-3">
|
|
82
|
-
<span className="flex items-center gap-1.5"><Cpu size={14} className="text-indigo-400" /> Simulated CPU Load</span>
|
|
83
|
-
<span className={isAnyRunning ? "text-emerald-400 font-mono font-bold" : "text-slate-550 font-mono"}>
|
|
84
|
-
{isAnyRunning ? '4.8%' : '0%'}
|
|
85
|
-
</span>
|
|
86
|
-
</div>
|
|
87
|
-
<div className="w-full bg-slate-900 rounded-full h-1.5 mb-2 overflow-hidden border border-white/5">
|
|
88
|
-
<div
|
|
89
|
-
className={`h-1.5 rounded-full transition-all duration-500 ${isAnyRunning ? "bg-gradient-to-r from-emerald-500 to-teal-400" : "bg-slate-800"}`}
|
|
90
|
-
style={{ width: isAnyRunning ? '48%' : '0%' }}
|
|
91
|
-
></div>
|
|
92
|
-
</div>
|
|
93
|
-
<span className="text-[10px] text-slate-550">Fluctuating active worker processes</span>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
{/* Telemetry 2: Memory */}
|
|
97
|
-
<div className="glass-card p-5 rounded-2xl border border-slate-800/40 relative overflow-hidden transition-all duration-300 before:absolute before:inset-x-0 before:top-0 before:h-[1px] before:bg-gradient-to-r before:from-indigo-500/10 via-purple-500/10 to-transparent">
|
|
98
|
-
<div className="flex justify-between items-center text-xs font-semibold text-slate-400 mb-3">
|
|
99
|
-
<span className="flex items-center gap-1.5"><Activity size={14} className="text-indigo-400" /> Simulated Memory</span>
|
|
100
|
-
<span className={isAnyRunning ? "text-cyan-400 font-mono font-bold" : "text-slate-550 font-mono"}>
|
|
101
|
-
{isAnyRunning ? '192 MB' : '0 MB'}
|
|
102
|
-
</span>
|
|
103
|
-
</div>
|
|
104
|
-
<div className="w-full bg-slate-900 rounded-full h-1.5 mb-2 overflow-hidden border border-white/5">
|
|
105
|
-
<div
|
|
106
|
-
className={`h-1.5 rounded-full transition-all duration-500 ${isAnyRunning ? "bg-gradient-to-r from-cyan-500 to-indigo-400" : "bg-slate-800"}`}
|
|
107
|
-
style={{ width: isAnyRunning ? '65%' : '0%' }}
|
|
108
|
-
></div>
|
|
109
|
-
</div>
|
|
110
|
-
<span className="text-[10px] text-slate-550">Working set size for spawned servers</span>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
{/* Telemetry 3: Environment Health */}
|
|
77
|
+
{/* Workspace service status (real running-process state) */}
|
|
78
|
+
<div className="mb-6">
|
|
114
79
|
<div className="glass-card p-5 rounded-2xl border border-slate-800/40 relative overflow-hidden transition-all duration-300 before:absolute before:inset-x-0 before:top-0 before:h-[1px] before:bg-gradient-to-r before:from-indigo-500/10 via-purple-500/10 to-transparent">
|
|
115
80
|
<div className="flex justify-between items-center text-xs font-semibold text-slate-400 mb-3">
|
|
116
81
|
<span>Workspace Status</span>
|
|
@@ -122,7 +87,7 @@ export const ServiceConsole: React.FC<ServiceConsoleProps> = ({
|
|
|
122
87
|
<div className="text-xs text-white font-semibold mb-2">
|
|
123
88
|
{isAnyRunning ? `${runningServices.filter(rs => rs.pid > 0).length} processes active` : "All processes offline"}
|
|
124
89
|
</div>
|
|
125
|
-
<span className="text-[10px] text-slate-550">
|
|
90
|
+
<span className="text-[10px] text-slate-550">Live service state for this workspace</span>
|
|
126
91
|
</div>
|
|
127
92
|
</div>
|
|
128
93
|
|