bmad-visual 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/bmad-visual.js +255 -0
- package/package.json +31 -0
- package/templates/.agent/workflows/analyst.md +20 -0
- package/templates/.agent/workflows/architect.md +20 -0
- package/templates/.agent/workflows/bmad-advanced-elicitation.md +5 -0
- package/templates/.agent/workflows/bmad-brainstorming.md +5 -0
- package/templates/.agent/workflows/bmad-check-implementation-readiness.md +5 -0
- package/templates/.agent/workflows/bmad-checkpoint-preview.md +5 -0
- package/templates/.agent/workflows/bmad-code-review.md +5 -0
- package/templates/.agent/workflows/bmad-correct-course.md +5 -0
- package/templates/.agent/workflows/bmad-create-architecture.md +5 -0
- package/templates/.agent/workflows/bmad-create-epics-and-stories.md +5 -0
- package/templates/.agent/workflows/bmad-create-prd.md +5 -0
- package/templates/.agent/workflows/bmad-create-story.md +5 -0
- package/templates/.agent/workflows/bmad-create-ux-design.md +5 -0
- package/templates/.agent/workflows/bmad-dev-story.md +5 -0
- package/templates/.agent/workflows/bmad-distillator.md +5 -0
- package/templates/.agent/workflows/bmad-document-project.md +5 -0
- package/templates/.agent/workflows/bmad-domain-research.md +5 -0
- package/templates/.agent/workflows/bmad-edit-prd.md +5 -0
- package/templates/.agent/workflows/bmad-editorial-review-prose.md +5 -0
- package/templates/.agent/workflows/bmad-editorial-review-structure.md +5 -0
- package/templates/.agent/workflows/bmad-generate-project-context.md +5 -0
- package/templates/.agent/workflows/bmad-help-full.md +5 -0
- package/templates/.agent/workflows/bmad-help.md +5 -0
- package/templates/.agent/workflows/bmad-index-docs.md +5 -0
- package/templates/.agent/workflows/bmad-market-research.md +5 -0
- package/templates/.agent/workflows/bmad-party-mode.md +5 -0
- package/templates/.agent/workflows/bmad-prfaq.md +5 -0
- package/templates/.agent/workflows/bmad-product-brief.md +5 -0
- package/templates/.agent/workflows/bmad-qa-generate-e2e-tests.md +5 -0
- package/templates/.agent/workflows/bmad-quick-dev.md +5 -0
- package/templates/.agent/workflows/bmad-retrospective.md +5 -0
- package/templates/.agent/workflows/bmad-review-adversarial-general.md +5 -0
- package/templates/.agent/workflows/bmad-review-edge-case-hunter.md +5 -0
- package/templates/.agent/workflows/bmad-shard-doc.md +5 -0
- package/templates/.agent/workflows/bmad-sprint-planning.md +5 -0
- package/templates/.agent/workflows/bmad-sprint-status.md +5 -0
- package/templates/.agent/workflows/bmad-technical-research.md +5 -0
- package/templates/.agent/workflows/bmad-validate-prd.md +5 -0
- package/templates/.agent/workflows/dev.md +20 -0
- package/templates/.agent/workflows/pm.md +20 -0
- package/templates/.agent/workflows/qa.md +20 -0
- package/templates/.agent/workflows/sm.md +20 -0
- package/templates/.agent/workflows/solo-dev.md +20 -0
- package/templates/.agent/workflows/ux.md +20 -0
- package/templates/.claude/settings.local.json +50 -0
- package/templates/.claude/skills/analyst/SKILL.md +77 -0
- package/templates/.claude/skills/architect/SKILL.md +72 -0
- package/templates/.claude/skills/bmad-advanced-elicitation/SKILL.md +24 -0
- package/templates/.claude/skills/bmad-brainstorming/SKILL.md +26 -0
- package/templates/.claude/skills/bmad-check-implementation-readiness/SKILL.md +22 -0
- package/templates/.claude/skills/bmad-checkpoint-preview/SKILL.md +17 -0
- package/templates/.claude/skills/bmad-code-review/SKILL.md +22 -0
- package/templates/.claude/skills/bmad-correct-course/SKILL.md +17 -0
- package/templates/.claude/skills/bmad-create-architecture/SKILL.md +22 -0
- package/templates/.claude/skills/bmad-create-epics-and-stories/SKILL.md +22 -0
- package/templates/.claude/skills/bmad-create-prd/SKILL.md +30 -0
- package/templates/.claude/skills/bmad-create-story/SKILL.md +21 -0
- package/templates/.claude/skills/bmad-create-ux-design/SKILL.md +23 -0
- package/templates/.claude/skills/bmad-dev-story/SKILL.md +27 -0
- package/templates/.claude/skills/bmad-distillator/SKILL.md +22 -0
- package/templates/.claude/skills/bmad-document-project/SKILL.md +27 -0
- package/templates/.claude/skills/bmad-domain-research/SKILL.md +21 -0
- package/templates/.claude/skills/bmad-edit-prd/SKILL.md +18 -0
- package/templates/.claude/skills/bmad-editorial-review-prose/SKILL.md +21 -0
- package/templates/.claude/skills/bmad-editorial-review-structure/SKILL.md +25 -0
- package/templates/.claude/skills/bmad-generate-project-context/SKILL.md +20 -0
- package/templates/.claude/skills/bmad-help/SKILL.md +63 -0
- package/templates/.claude/skills/bmad-help-full/SKILL.md +23 -0
- package/templates/.claude/skills/bmad-index-docs/SKILL.md +16 -0
- package/templates/.claude/skills/bmad-market-research/SKILL.md +22 -0
- package/templates/.claude/skills/bmad-party-mode/SKILL.md +24 -0
- package/templates/.claude/skills/bmad-prfaq/SKILL.md +36 -0
- package/templates/.claude/skills/bmad-product-brief/SKILL.md +36 -0
- package/templates/.claude/skills/bmad-qa-generate-e2e-tests/SKILL.md +21 -0
- package/templates/.claude/skills/bmad-quick-dev/SKILL.md +23 -0
- package/templates/.claude/skills/bmad-retrospective/SKILL.md +17 -0
- package/templates/.claude/skills/bmad-review-adversarial-general/SKILL.md +21 -0
- package/templates/.claude/skills/bmad-review-edge-case-hunter/SKILL.md +22 -0
- package/templates/.claude/skills/bmad-shard-doc/SKILL.md +17 -0
- package/templates/.claude/skills/bmad-sprint-planning/SKILL.md +21 -0
- package/templates/.claude/skills/bmad-sprint-status/SKILL.md +17 -0
- package/templates/.claude/skills/bmad-technical-research/SKILL.md +21 -0
- package/templates/.claude/skills/bmad-validate-prd/SKILL.md +22 -0
- package/templates/.claude/skills/dev/SKILL.md +71 -0
- package/templates/.claude/skills/pm/SKILL.md +76 -0
- package/templates/.claude/skills/qa/SKILL.md +64 -0
- package/templates/.claude/skills/sm/SKILL.md +74 -0
- package/templates/.claude/skills/solo-dev/SKILL.md +64 -0
- package/templates/.claude/skills/ux/SKILL.md +71 -0
- package/templates/CLAUDE.md +60 -0
- package/templates/dashboard/index.html +15 -0
- package/templates/dashboard/package.json +30 -0
- package/templates/dashboard/public/assets/avatars/Female1_1wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female1_2wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female1_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female1_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female2_1wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female2_2wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female2_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female2_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female3_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female3_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female3_wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female4_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female4_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female4_wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female5_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female5_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female5_wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female6_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female6_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Female6_wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male1_1wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male1_2wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male1_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male1_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male2_1wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male2_2wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male2_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male2_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male3_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male3_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male3_wave.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male4_blink.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male4_talk.png +0 -0
- package/templates/dashboard/public/assets/avatars/Male4_wave.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_black_down.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_black_down_coding-1.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_black_down_coding.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_black_up.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_white_down.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_white_down_coding-1.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_white_down_coding.png +0 -0
- package/templates/dashboard/public/assets/desks/desktop_set_white_up.png +0 -0
- package/templates/dashboard/public/assets/furniture/armchair_tan.png +0 -0
- package/templates/dashboard/public/assets/furniture/armchair_tan_down.png +0 -0
- package/templates/dashboard/public/assets/furniture/backpack_blue.png +0 -0
- package/templates/dashboard/public/assets/furniture/backpack_red.png +0 -0
- package/templates/dashboard/public/assets/furniture/blinds.png +0 -0
- package/templates/dashboard/public/assets/furniture/blinds_large_closed_white.png +0 -0
- package/templates/dashboard/public/assets/furniture/bookshelf.png +0 -0
- package/templates/dashboard/public/assets/furniture/bookshelf_purple_tall.png +0 -0
- package/templates/dashboard/public/assets/furniture/bulletin_board.png +0 -0
- package/templates/dashboard/public/assets/furniture/clock.png +0 -0
- package/templates/dashboard/public/assets/furniture/coffee_mug.png +0 -0
- package/templates/dashboard/public/assets/furniture/coffee_mug_blue.png +0 -0
- package/templates/dashboard/public/assets/furniture/coffee_table.png +0 -0
- package/templates/dashboard/public/assets/furniture/coffeepot_right.png +0 -0
- package/templates/dashboard/public/assets/furniture/coffeetable_black_horizontal.png +0 -0
- package/templates/dashboard/public/assets/furniture/couch.png +0 -0
- package/templates/dashboard/public/assets/furniture/couch_tan_down.png +0 -0
- package/templates/dashboard/public/assets/furniture/cushion_blue.png +0 -0
- package/templates/dashboard/public/assets/furniture/cushion_tan.png +0 -0
- package/templates/dashboard/public/assets/furniture/desk_wood.png +0 -0
- package/templates/dashboard/public/assets/furniture/fancy_rug.png +0 -0
- package/templates/dashboard/public/assets/furniture/fancy_rug_wide.png +0 -0
- package/templates/dashboard/public/assets/furniture/flowers1.png +0 -0
- package/templates/dashboard/public/assets/furniture/flowers2.png +0 -0
- package/templates/dashboard/public/assets/furniture/lamp_tan.png +0 -0
- package/templates/dashboard/public/assets/furniture/lantern.png +0 -0
- package/templates/dashboard/public/assets/furniture/monstera.png +0 -0
- package/templates/dashboard/public/assets/furniture/monstera_small.png +0 -0
- package/templates/dashboard/public/assets/furniture/picture_frame.png +0 -0
- package/templates/dashboard/public/assets/furniture/plant1.png +0 -0
- package/templates/dashboard/public/assets/furniture/plant2.png +0 -0
- package/templates/dashboard/public/assets/furniture/plant3.png +0 -0
- package/templates/dashboard/public/assets/furniture/plant_poof.png +0 -0
- package/templates/dashboard/public/assets/furniture/plant_spindly.png +0 -0
- package/templates/dashboard/public/assets/furniture/poster_blue.png +0 -0
- package/templates/dashboard/public/assets/furniture/rug.png +0 -0
- package/templates/dashboard/public/assets/furniture/succulent_blue.png +0 -0
- package/templates/dashboard/public/assets/furniture/succulent_green.png +0 -0
- package/templates/dashboard/public/assets/furniture/treasurechest_closed_gold.png +0 -0
- package/templates/dashboard/public/assets/furniture/water_cooler_better.png +0 -0
- package/templates/dashboard/public/assets/furniture/whiteboard.png +0 -0
- package/templates/dashboard/public/assets/furniture/whiteboard_stand_graph.png +0 -0
- package/templates/dashboard/public/assets/furniture/window_blinds_open.png +0 -0
- package/templates/dashboard/public/assets/logo.png +0 -0
- package/templates/dashboard/src/App.tsx +119 -0
- package/templates/dashboard/src/components/SquadCard.tsx +47 -0
- package/templates/dashboard/src/components/SquadSelector.tsx +61 -0
- package/templates/dashboard/src/components/StatusBadge.tsx +32 -0
- package/templates/dashboard/src/components/StatusBar.tsx +97 -0
- package/templates/dashboard/src/hooks/useSquadSocket.ts +137 -0
- package/templates/dashboard/src/lib/formatTime.ts +16 -0
- package/templates/dashboard/src/lib/normalizeState.ts +25 -0
- package/templates/dashboard/src/main.tsx +14 -0
- package/templates/dashboard/src/office/AgentSprite.ts +249 -0
- package/templates/dashboard/src/office/OfficeScene.ts +577 -0
- package/templates/dashboard/src/office/PhaserGame.tsx +101 -0
- package/templates/dashboard/src/office/RoomBuilder.ts +190 -0
- package/templates/dashboard/src/office/assetKeys.ts +150 -0
- package/templates/dashboard/src/office/palette.ts +32 -0
- package/templates/dashboard/src/plugin/squadWatcher.ts +260 -0
- package/templates/dashboard/src/store/useSquadStore.ts +63 -0
- package/templates/dashboard/src/styles/globals.css +41 -0
- package/templates/dashboard/src/types/state.ts +69 -0
- package/templates/dashboard/src/vite-env.d.ts +1 -0
- package/templates/dashboard/tsconfig.json +24 -0
- package/templates/dashboard/tsconfig.tsbuildinfo +1 -0
- package/templates/dashboard/vite.config.ts +13 -0
- package/templates/squads/.gitkeep +0 -0
- package/templates/squads/bmad/agents/analyst.agent.md +87 -0
- package/templates/squads/bmad/agents/architect.agent.md +82 -0
- package/templates/squads/bmad/agents/developer.agent.md +91 -0
- package/templates/squads/bmad/agents/pm.agent.md +86 -0
- package/templates/squads/bmad/agents/qa-engineer.agent.md +84 -0
- package/templates/squads/bmad/agents/scrum-master.agent.md +84 -0
- package/templates/squads/bmad/agents/solo-dev.agent.md +81 -0
- package/templates/squads/bmad/agents/tech-writer.agent.md +86 -0
- package/templates/squads/bmad/agents/ux-designer.agent.md +81 -0
- package/templates/squads/bmad/squad.yaml +70 -0
- package/templates/squads/bmad/state.json +108 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { useSquadSocket } from "@/hooks/useSquadSocket";
|
|
3
|
+
import { PhaserGame } from "@/office/PhaserGame";
|
|
4
|
+
|
|
5
|
+
const HEADER_TEXT = "Infinity Squad";
|
|
6
|
+
const TYPE_SPEED = 80;
|
|
7
|
+
|
|
8
|
+
function TypewriterHeader() {
|
|
9
|
+
const [displayed, setDisplayed] = useState("");
|
|
10
|
+
const [done, setDone] = useState(false);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
let i = 0;
|
|
14
|
+
const interval = setInterval(() => {
|
|
15
|
+
i++;
|
|
16
|
+
setDisplayed(HEADER_TEXT.slice(0, i));
|
|
17
|
+
if (i >= HEADER_TEXT.length) {
|
|
18
|
+
clearInterval(interval);
|
|
19
|
+
setTimeout(() => setDone(true), 600);
|
|
20
|
+
}
|
|
21
|
+
}, TYPE_SPEED);
|
|
22
|
+
return () => clearInterval(interval);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<header
|
|
27
|
+
style={{
|
|
28
|
+
display: "flex",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
justifyContent: "space-between",
|
|
31
|
+
padding: "0 24px",
|
|
32
|
+
height: 56,
|
|
33
|
+
minHeight: 56,
|
|
34
|
+
borderBottom: "1px solid rgba(16, 185, 129, 0.15)",
|
|
35
|
+
background: "linear-gradient(90deg, #080c16 0%, #0f1629 50%, #080c16 100%)",
|
|
36
|
+
fontFamily: "'Inter', sans-serif",
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<div style={{ display: "flex", alignItems: "center", gap: 14 }}>
|
|
40
|
+
<img
|
|
41
|
+
src="/assets/logo.png"
|
|
42
|
+
alt="Logo"
|
|
43
|
+
style={{
|
|
44
|
+
height: 32,
|
|
45
|
+
width: 32,
|
|
46
|
+
objectFit: "contain",
|
|
47
|
+
filter: "drop-shadow(0 0 6px rgba(16, 185, 129, 0.4))",
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
<span
|
|
51
|
+
style={{
|
|
52
|
+
fontSize: 20,
|
|
53
|
+
fontWeight: 700,
|
|
54
|
+
letterSpacing: 1.5,
|
|
55
|
+
color: "#ffffff",
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{displayed}
|
|
59
|
+
{!done && (
|
|
60
|
+
<span
|
|
61
|
+
style={{
|
|
62
|
+
display: "inline-block",
|
|
63
|
+
width: 2,
|
|
64
|
+
height: "1.1em",
|
|
65
|
+
marginLeft: 3,
|
|
66
|
+
background: "#10b981",
|
|
67
|
+
animation: "blink-caret 0.6s step-end infinite",
|
|
68
|
+
verticalAlign: "text-bottom",
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div
|
|
76
|
+
style={{
|
|
77
|
+
display: "flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
gap: 8,
|
|
80
|
+
fontSize: 12,
|
|
81
|
+
color: "#6b7894",
|
|
82
|
+
fontWeight: 500,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<span
|
|
86
|
+
style={{
|
|
87
|
+
width: 6,
|
|
88
|
+
height: 6,
|
|
89
|
+
borderRadius: "50%",
|
|
90
|
+
background: "#10b981",
|
|
91
|
+
boxShadow: "0 0 6px #10b981",
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
BMAD Method
|
|
95
|
+
</div>
|
|
96
|
+
</header>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function App() {
|
|
101
|
+
useSquadSocket();
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<div
|
|
105
|
+
style={{
|
|
106
|
+
display: "flex",
|
|
107
|
+
flexDirection: "column",
|
|
108
|
+
height: "100%",
|
|
109
|
+
width: "100%",
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<TypewriterHeader />
|
|
113
|
+
|
|
114
|
+
<div style={{ display: "flex", flex: 1, overflow: "hidden" }}>
|
|
115
|
+
<PhaserGame />
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SquadInfo, SquadState } from "@/types/state";
|
|
2
|
+
import { StatusBadge } from "./StatusBadge";
|
|
3
|
+
|
|
4
|
+
interface SquadCardProps {
|
|
5
|
+
squad: SquadInfo;
|
|
6
|
+
state: SquadState | undefined;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
onSelect: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function SquadCard({ squad, state, isSelected, onSelect }: SquadCardProps) {
|
|
12
|
+
const isActive = !!state;
|
|
13
|
+
const status = state?.status ?? "inactive";
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<button
|
|
17
|
+
onClick={onSelect}
|
|
18
|
+
style={{
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
gap: 8,
|
|
22
|
+
width: "100%",
|
|
23
|
+
padding: "10px 12px",
|
|
24
|
+
border: "none",
|
|
25
|
+
borderLeft: isSelected ? "3px solid var(--accent-cyan)" : "3px solid transparent",
|
|
26
|
+
background: isSelected ? "var(--bg-secondary)" : "transparent",
|
|
27
|
+
color: isActive ? "var(--text-primary)" : "var(--text-secondary)",
|
|
28
|
+
cursor: "pointer",
|
|
29
|
+
textAlign: "left",
|
|
30
|
+
fontSize: 13,
|
|
31
|
+
fontFamily: "inherit",
|
|
32
|
+
transition: "all 0.15s ease",
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<StatusBadge status={status} />
|
|
36
|
+
<span style={{ marginRight: 4 }}>{squad.icon}</span>
|
|
37
|
+
<span style={{ flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
|
|
38
|
+
{squad.name}
|
|
39
|
+
</span>
|
|
40
|
+
{state?.step && (
|
|
41
|
+
<span style={{ fontSize: 11, color: "var(--text-secondary)" }}>
|
|
42
|
+
{state.step.current}/{state.step.total}
|
|
43
|
+
</span>
|
|
44
|
+
)}
|
|
45
|
+
</button>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useSquadStore } from "@/store/useSquadStore";
|
|
2
|
+
import { SquadCard } from "./SquadCard";
|
|
3
|
+
|
|
4
|
+
export function SquadSelector() {
|
|
5
|
+
const squads = useSquadStore((s) => s.squads);
|
|
6
|
+
const activeStates = useSquadStore((s) => s.activeStates);
|
|
7
|
+
const selectedSquad = useSquadStore((s) => s.selectedSquad);
|
|
8
|
+
const selectSquad = useSquadStore((s) => s.selectSquad);
|
|
9
|
+
|
|
10
|
+
// Sort: active squads first, then alphabetical
|
|
11
|
+
const squadList = Array.from(squads.values()).sort((a, b) => {
|
|
12
|
+
const aActive = activeStates.has(a.code) ? 0 : 1;
|
|
13
|
+
const bActive = activeStates.has(b.code) ? 0 : 1;
|
|
14
|
+
if (aActive !== bActive) return aActive - bActive;
|
|
15
|
+
return a.name.localeCompare(b.name);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<aside
|
|
20
|
+
style={{
|
|
21
|
+
width: 240,
|
|
22
|
+
minWidth: 240,
|
|
23
|
+
height: "100%",
|
|
24
|
+
background: "var(--bg-sidebar)",
|
|
25
|
+
borderRight: "1px solid var(--border)",
|
|
26
|
+
display: "flex",
|
|
27
|
+
flexDirection: "column",
|
|
28
|
+
overflow: "hidden",
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
style={{
|
|
33
|
+
padding: "16px 12px 8px",
|
|
34
|
+
fontSize: 11,
|
|
35
|
+
fontWeight: 600,
|
|
36
|
+
textTransform: "uppercase",
|
|
37
|
+
letterSpacing: 1,
|
|
38
|
+
color: "var(--text-secondary)",
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
Squads
|
|
42
|
+
</div>
|
|
43
|
+
<div style={{ flex: 1, overflowY: "auto" }}>
|
|
44
|
+
{squadList.length === 0 && (
|
|
45
|
+
<div style={{ padding: "16px 12px", color: "var(--text-secondary)", fontSize: 12 }}>
|
|
46
|
+
No squads found
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
{squadList.map((squad) => (
|
|
50
|
+
<SquadCard
|
|
51
|
+
key={squad.code}
|
|
52
|
+
squad={squad}
|
|
53
|
+
state={activeStates.get(squad.code)}
|
|
54
|
+
isSelected={selectedSquad === squad.code}
|
|
55
|
+
onSelect={() => selectSquad(squad.code)}
|
|
56
|
+
/>
|
|
57
|
+
))}
|
|
58
|
+
</div>
|
|
59
|
+
</aside>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SquadStatus } from "@/types/state";
|
|
2
|
+
|
|
3
|
+
const STATUS_COLORS: Record<SquadStatus | "inactive", string> = {
|
|
4
|
+
idle: "#888",
|
|
5
|
+
running: "var(--accent-cyan)",
|
|
6
|
+
completed: "var(--accent-green)",
|
|
7
|
+
checkpoint: "var(--accent-amber)",
|
|
8
|
+
inactive: "#444",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
interface StatusBadgeProps {
|
|
12
|
+
status: SquadStatus | "inactive";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function StatusBadge({ status }: StatusBadgeProps) {
|
|
16
|
+
const color = STATUS_COLORS[status];
|
|
17
|
+
const isPulsing = status === "running" || status === "checkpoint";
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<span
|
|
21
|
+
style={{
|
|
22
|
+
display: "inline-block",
|
|
23
|
+
width: 8,
|
|
24
|
+
height: 8,
|
|
25
|
+
borderRadius: "50%",
|
|
26
|
+
backgroundColor: color,
|
|
27
|
+
boxShadow: isPulsing ? `0 0 6px ${color}` : "none",
|
|
28
|
+
animation: isPulsing ? "pulse 1.5s ease-in-out infinite" : "none",
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useSquadStore } from "@/store/useSquadStore";
|
|
3
|
+
import { formatElapsed } from "@/lib/formatTime";
|
|
4
|
+
|
|
5
|
+
export function StatusBar() {
|
|
6
|
+
const selectedSquad = useSquadStore((s) => s.selectedSquad);
|
|
7
|
+
const state = useSquadStore((s) =>
|
|
8
|
+
s.selectedSquad ? s.activeStates.get(s.selectedSquad) : undefined
|
|
9
|
+
);
|
|
10
|
+
const isConnected = useSquadStore((s) => s.isConnected);
|
|
11
|
+
|
|
12
|
+
// Elapsed timer
|
|
13
|
+
const [elapsed, setElapsed] = useState(0);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!state?.startedAt) {
|
|
17
|
+
setElapsed(0);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const startTime = new Date(state.startedAt).getTime();
|
|
22
|
+
const tick = () => setElapsed(Date.now() - startTime);
|
|
23
|
+
tick();
|
|
24
|
+
const interval = setInterval(tick, 1000);
|
|
25
|
+
return () => clearInterval(interval);
|
|
26
|
+
}, [state?.startedAt]);
|
|
27
|
+
|
|
28
|
+
if (!selectedSquad || !state) {
|
|
29
|
+
return (
|
|
30
|
+
<footer style={footerStyle}>
|
|
31
|
+
<span style={{ color: "var(--text-secondary)" }}>
|
|
32
|
+
Select an active squad to monitor
|
|
33
|
+
</span>
|
|
34
|
+
<ConnectionDot connected={isConnected} />
|
|
35
|
+
</footer>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<footer style={footerStyle}>
|
|
41
|
+
<div style={{ display: "flex", alignItems: "center", gap: 16, flex: 1, minWidth: 0 }}>
|
|
42
|
+
<span>
|
|
43
|
+
Step {state.step.current}/{state.step.total}
|
|
44
|
+
{state.step.label ? ` — ${state.step.label}` : ""}
|
|
45
|
+
</span>
|
|
46
|
+
{state.startedAt && (
|
|
47
|
+
<span style={{ color: "var(--text-secondary)" }}>
|
|
48
|
+
{formatElapsed(elapsed)}
|
|
49
|
+
</span>
|
|
50
|
+
)}
|
|
51
|
+
{state.handoff && (
|
|
52
|
+
<span
|
|
53
|
+
style={{
|
|
54
|
+
flex: 1,
|
|
55
|
+
overflow: "hidden",
|
|
56
|
+
textOverflow: "ellipsis",
|
|
57
|
+
whiteSpace: "nowrap",
|
|
58
|
+
color: "var(--text-secondary)",
|
|
59
|
+
fontSize: 12,
|
|
60
|
+
}}
|
|
61
|
+
title={`${state.handoff.from} → ${state.handoff.to}: ${state.handoff.message}`}
|
|
62
|
+
>
|
|
63
|
+
{state.handoff.from} → {state.handoff.to}: {state.handoff.message}
|
|
64
|
+
</span>
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
<ConnectionDot connected={isConnected} />
|
|
68
|
+
</footer>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function ConnectionDot({ connected }: { connected: boolean }) {
|
|
73
|
+
return (
|
|
74
|
+
<span
|
|
75
|
+
title={connected ? "Connected" : "Disconnected"}
|
|
76
|
+
style={{
|
|
77
|
+
width: 8,
|
|
78
|
+
height: 8,
|
|
79
|
+
borderRadius: "50%",
|
|
80
|
+
backgroundColor: connected ? "var(--accent-green)" : "var(--accent-red)",
|
|
81
|
+
flexShrink: 0,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const footerStyle: React.CSSProperties = {
|
|
88
|
+
display: "flex",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
justifyContent: "space-between",
|
|
91
|
+
padding: "8px 16px",
|
|
92
|
+
borderTop: "1px solid var(--border)",
|
|
93
|
+
background: "var(--bg-sidebar)",
|
|
94
|
+
fontSize: 13,
|
|
95
|
+
height: 40,
|
|
96
|
+
minHeight: 40,
|
|
97
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useSquadStore } from "@/store/useSquadStore";
|
|
3
|
+
import type { WsMessage } from "@/types/state";
|
|
4
|
+
|
|
5
|
+
const RECONNECT_BASE_MS = 1000;
|
|
6
|
+
const RECONNECT_MAX_MS = 30000;
|
|
7
|
+
const WS_FAIL_THRESHOLD = 3;
|
|
8
|
+
const POLL_INTERVAL_MS = 3000;
|
|
9
|
+
|
|
10
|
+
export function useSquadSocket() {
|
|
11
|
+
const wsRef = useRef<WebSocket | null>(null);
|
|
12
|
+
const pollTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
13
|
+
|
|
14
|
+
const setConnected = useSquadStore((s) => s.setConnected);
|
|
15
|
+
const setSnapshot = useSquadStore((s) => s.setSnapshot);
|
|
16
|
+
const updateSquadState = useSquadStore((s) => s.updateSquadState);
|
|
17
|
+
const setSquadInactive = useSquadStore((s) => s.setSquadInactive);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
let disposed = false;
|
|
21
|
+
let reconnectTimer: ReturnType<typeof setTimeout> | undefined;
|
|
22
|
+
let reconnectDelay = RECONNECT_BASE_MS;
|
|
23
|
+
let wsFailCount = 0;
|
|
24
|
+
|
|
25
|
+
function dispatch(msg: WsMessage) {
|
|
26
|
+
if (disposed) return;
|
|
27
|
+
switch (msg.type) {
|
|
28
|
+
case "SNAPSHOT":
|
|
29
|
+
setSnapshot(msg.squads, msg.activeStates);
|
|
30
|
+
break;
|
|
31
|
+
case "SQUAD_UPDATE":
|
|
32
|
+
updateSquadState(msg.squad, msg.state);
|
|
33
|
+
break;
|
|
34
|
+
case "SQUAD_INACTIVE":
|
|
35
|
+
setSquadInactive(msg.squad);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ── HTTP polling fallback ───────────────────────────────────────────
|
|
41
|
+
|
|
42
|
+
function stopPolling() {
|
|
43
|
+
if (pollTimerRef.current) {
|
|
44
|
+
clearInterval(pollTimerRef.current);
|
|
45
|
+
pollTimerRef.current = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function startPolling() {
|
|
50
|
+
stopPolling();
|
|
51
|
+
|
|
52
|
+
const poll = async () => {
|
|
53
|
+
if (disposed) return;
|
|
54
|
+
try {
|
|
55
|
+
const res = await fetch("/api/snapshot", { cache: "no-store" });
|
|
56
|
+
if (!res.ok || disposed) return;
|
|
57
|
+
const msg: WsMessage = await res.json();
|
|
58
|
+
dispatch(msg);
|
|
59
|
+
setConnected(true);
|
|
60
|
+
} catch {
|
|
61
|
+
// Endpoint not available — will retry on next interval
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
poll();
|
|
66
|
+
pollTimerRef.current = setInterval(poll, POLL_INTERVAL_MS);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ── WebSocket connection ────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
function connect() {
|
|
72
|
+
if (disposed) return;
|
|
73
|
+
|
|
74
|
+
if (reconnectTimer !== undefined) {
|
|
75
|
+
clearTimeout(reconnectTimer);
|
|
76
|
+
reconnectTimer = undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
80
|
+
const ws = new WebSocket(
|
|
81
|
+
`${protocol}//${window.location.host}/__squads_ws`,
|
|
82
|
+
);
|
|
83
|
+
wsRef.current = ws;
|
|
84
|
+
|
|
85
|
+
ws.onopen = () => {
|
|
86
|
+
if (disposed) { ws.close(); return; }
|
|
87
|
+
setConnected(true);
|
|
88
|
+
reconnectDelay = RECONNECT_BASE_MS;
|
|
89
|
+
wsFailCount = 0;
|
|
90
|
+
stopPolling();
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
ws.onmessage = (event) => {
|
|
94
|
+
if (disposed) return;
|
|
95
|
+
try {
|
|
96
|
+
const msg: WsMessage = JSON.parse(event.data);
|
|
97
|
+
dispatch(msg);
|
|
98
|
+
} catch {
|
|
99
|
+
// Ignore malformed messages
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
ws.onclose = () => {
|
|
104
|
+
if (disposed) return;
|
|
105
|
+
|
|
106
|
+
setConnected(false);
|
|
107
|
+
wsFailCount++;
|
|
108
|
+
|
|
109
|
+
if (wsFailCount >= WS_FAIL_THRESHOLD) {
|
|
110
|
+
startPolling();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
reconnectTimer = setTimeout(() => {
|
|
114
|
+
reconnectDelay = Math.min(reconnectDelay * 2, RECONNECT_MAX_MS);
|
|
115
|
+
connect();
|
|
116
|
+
}, reconnectDelay);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
ws.onerror = () => {
|
|
120
|
+
// onerror is always followed by onclose — just let onclose handle it.
|
|
121
|
+
// Don't call ws.close() here to avoid "closed before established" in StrictMode.
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Start polling immediately as a reliable baseline, then upgrade to WS
|
|
126
|
+
startPolling();
|
|
127
|
+
connect();
|
|
128
|
+
|
|
129
|
+
return () => {
|
|
130
|
+
disposed = true;
|
|
131
|
+
if (reconnectTimer !== undefined) clearTimeout(reconnectTimer);
|
|
132
|
+
stopPolling();
|
|
133
|
+
wsRef.current?.close();
|
|
134
|
+
wsRef.current = null;
|
|
135
|
+
};
|
|
136
|
+
}, [setConnected, setSnapshot, updateSquadState, setSquadInactive]);
|
|
137
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats elapsed milliseconds as "MM:SS" or "HH:MM:SS" if over an hour.
|
|
3
|
+
*/
|
|
4
|
+
export function formatElapsed(ms: number): string {
|
|
5
|
+
const totalSeconds = Math.floor(ms / 1000);
|
|
6
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
7
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
8
|
+
const seconds = totalSeconds % 60;
|
|
9
|
+
|
|
10
|
+
const pad = (n: number) => n.toString().padStart(2, "0");
|
|
11
|
+
|
|
12
|
+
if (hours > 0) {
|
|
13
|
+
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
|
|
14
|
+
}
|
|
15
|
+
return `${pad(minutes)}:${pad(seconds)}`;
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SquadState, Agent } from "@/types/state";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns agents sorted by desk position (row first, then col).
|
|
5
|
+
*/
|
|
6
|
+
export function sortAgentsByDesk(agents: Agent[]): Agent[] {
|
|
7
|
+
return [...agents].sort((a, b) => {
|
|
8
|
+
if (a.desk.row !== b.desk.row) return a.desk.row - b.desk.row;
|
|
9
|
+
return a.desk.col - b.desk.col;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Find agent by id.
|
|
15
|
+
*/
|
|
16
|
+
export function findAgent(state: SquadState, agentId: string): Agent | undefined {
|
|
17
|
+
return state.agents.find((a) => a.id === agentId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns the currently working agent, if any.
|
|
22
|
+
*/
|
|
23
|
+
export function getWorkingAgent(state: SquadState): Agent | undefined {
|
|
24
|
+
return state.agents.find((a) => a.status === "working");
|
|
25
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
if (import.meta.env.DEV) {
|
|
2
|
+
import("react-grab");
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
import { StrictMode } from "react";
|
|
6
|
+
import { createRoot } from "react-dom/client";
|
|
7
|
+
import { App } from "./App";
|
|
8
|
+
import "./styles/globals.css";
|
|
9
|
+
|
|
10
|
+
createRoot(document.getElementById("root")!).render(
|
|
11
|
+
<StrictMode>
|
|
12
|
+
<App />
|
|
13
|
+
</StrictMode>
|
|
14
|
+
);
|