@shinnodua/agent-workflows 0.0.0-stage → 0.2.8

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.
Files changed (190) hide show
  1. package/.agents/agents/backend-developer/agent.md +39 -0
  2. package/.agents/agents/frontend-developer/agent.md +42 -0
  3. package/.agents/agents/project-manager/agent.md +37 -0
  4. package/.agents/agents/tech-lead/agent.md +41 -0
  5. package/.agents/agents/ui-ux-designer/agent.md +41 -0
  6. package/.agents/skills/add-project/SKILL.md +90 -0
  7. package/.agents/skills/add-project/agents/openai.yaml +4 -0
  8. package/.agents/skills/add-project/references/save-protocol.md +90 -0
  9. package/.agents/skills/approve-plan/SKILL.md +86 -0
  10. package/.agents/skills/approve-plan/agents/openai.yaml +4 -0
  11. package/.agents/skills/approve-prd/SKILL.md +59 -0
  12. package/.agents/skills/approve-prd/agents/openai.yaml +4 -0
  13. package/.agents/skills/auto-mode/SKILL.md +103 -0
  14. package/.agents/skills/auto-mode/agents/openai.yaml +4 -0
  15. package/.agents/skills/create-design/SKILL.md +197 -0
  16. package/.agents/skills/create-design/agents/openai.yaml +4 -0
  17. package/.agents/skills/create-diagram/SKILL.md +83 -0
  18. package/.agents/skills/create-diagram/agents/openai.yaml +4 -0
  19. package/.agents/skills/create-plan/SKILL.md +104 -0
  20. package/.agents/skills/create-plan/agents/openai.yaml +4 -0
  21. package/.agents/skills/create-prd/SKILL.md +82 -0
  22. package/.agents/skills/create-prd/agents/openai.yaml +4 -0
  23. package/.agents/skills/griling-plan/SKILL.md +114 -0
  24. package/.agents/skills/griling-plan/agents/openai.yaml +4 -0
  25. package/.agents/skills/griling-prd/SKILL.md +91 -0
  26. package/.agents/skills/griling-prd/agents/openai.yaml +4 -0
  27. package/.agents/skills/package-installation/SKILL.md +67 -0
  28. package/.agents/skills/package-installation/agents/openai.yaml +4 -0
  29. package/.agents/skills/project-setup/SKILL.md +104 -0
  30. package/.agents/skills/project-setup/agents/openai.yaml +3 -0
  31. package/.agents/skills/research/SKILL.md +61 -0
  32. package/.agents/skills/research/agents/openai.yaml +4 -0
  33. package/.agents/skills/sprint-meeting/SKILL.md +230 -0
  34. package/.agents/skills/sprint-meeting/agents/openai.yaml +4 -0
  35. package/.claude/agents/backend-developer.md +7 -0
  36. package/.claude/agents/frontend-developer.md +7 -0
  37. package/.claude/agents/project-manager.md +7 -0
  38. package/.claude/agents/tech-lead.md +7 -0
  39. package/.claude/agents/ui-ux-designer.md +7 -0
  40. package/.claude/skills/add-project/SKILL.md +10 -0
  41. package/.claude/skills/approve-plan/SKILL.md +8 -0
  42. package/.claude/skills/approve-prd/SKILL.md +8 -0
  43. package/.claude/skills/auto-mode/SKILL.md +8 -0
  44. package/.claude/skills/create-design/SKILL.md +8 -0
  45. package/.claude/skills/create-diagram/SKILL.md +8 -0
  46. package/.claude/skills/create-plan/SKILL.md +8 -0
  47. package/.claude/skills/create-prd/SKILL.md +8 -0
  48. package/.claude/skills/griling-plan/SKILL.md +8 -0
  49. package/.claude/skills/griling-prd/SKILL.md +8 -0
  50. package/.claude/skills/package-installation/SKILL.md +8 -0
  51. package/.claude/skills/project-setup/SKILL.md +8 -0
  52. package/.claude/skills/research/SKILL.md +8 -0
  53. package/.claude/skills/sprint-meeting/SKILL.md +8 -0
  54. package/.codex/prompts/add-project.md +3 -0
  55. package/.codex/prompts/approve-plan.md +3 -0
  56. package/.codex/prompts/approve-prd.md +3 -0
  57. package/.codex/prompts/auto-mode.md +3 -0
  58. package/.codex/prompts/create-design.md +3 -0
  59. package/.codex/prompts/create-diagram.md +3 -0
  60. package/.codex/prompts/create-plan.md +3 -0
  61. package/.codex/prompts/create-prd.md +3 -0
  62. package/.codex/prompts/griling-plan.md +3 -0
  63. package/.codex/prompts/griling-prd.md +3 -0
  64. package/.codex/prompts/grilling-plan.md +3 -0
  65. package/.codex/prompts/project-setup.md +3 -0
  66. package/.codex/prompts/research.md +3 -0
  67. package/.codex/prompts/sprint-meeting.md +3 -0
  68. package/.gitmodules.example +9 -0
  69. package/AGENTS.md +84 -0
  70. package/CLAUDE.md +1 -0
  71. package/INSTALL.md +284 -0
  72. package/LICENSE +21 -0
  73. package/README.md +342 -2
  74. package/bin/postinstall.js +57 -0
  75. package/bin/workflows.js +1172 -0
  76. package/bin/workflows.test.mjs +682 -0
  77. package/commands/add-project.md +20 -0
  78. package/commands/approve-plan.md +25 -0
  79. package/commands/approve-prd.md +24 -0
  80. package/commands/auto-mode.md +15 -0
  81. package/commands/create-design.md +20 -0
  82. package/commands/create-diagram.md +16 -0
  83. package/commands/create-plan.md +22 -0
  84. package/commands/create-prd.md +16 -0
  85. package/commands/griling-plan.md +16 -0
  86. package/commands/griling-prd.md +16 -0
  87. package/commands/grilling-plan.md +16 -0
  88. package/commands/project-setup.md +16 -0
  89. package/commands/research.md +16 -0
  90. package/commands/sprint-meeting.md +16 -0
  91. package/dashboard/.agents/skills/coding-conventions/SKILL.md +76 -0
  92. package/dashboard/.agents/skills/coding-conventions/agents/openai.yaml +4 -0
  93. package/dashboard/.agents/skills/design-system-guideline/SKILL.md +51 -0
  94. package/dashboard/.agents/skills/design-system-guideline/agents/openai.yaml +4 -0
  95. package/dashboard/.agents/skills/lint-and-fix/SKILL.md +55 -0
  96. package/dashboard/.agents/skills/lint-and-fix/agents/openai.yaml +4 -0
  97. package/dashboard/.agents/skills/taste-ui/SKILL.md +45 -0
  98. package/dashboard/.agents/skills/taste-ui/agents/openai.yaml +4 -0
  99. package/dashboard/AGENTS.md +43 -0
  100. package/dashboard/bun.lock +352 -0
  101. package/dashboard/index.html +12 -0
  102. package/dashboard/package.json +32 -0
  103. package/dashboard/src/App.tsx +5 -0
  104. package/dashboard/src/features/task-status/components/ActionRequiredPanel/ActionRequiredPanel.module.css +85 -0
  105. package/dashboard/src/features/task-status/components/ActionRequiredPanel/ActionRequiredPanel.tsx +80 -0
  106. package/dashboard/src/features/task-status/components/ArtifactButton/ArtifactButton.module.css +25 -0
  107. package/dashboard/src/features/task-status/components/ArtifactButton/ArtifactButton.tsx +29 -0
  108. package/dashboard/src/features/task-status/components/ArtifactSummaryCards/ArtifactSummaryCards.module.css +29 -0
  109. package/dashboard/src/features/task-status/components/ArtifactSummaryCards/ArtifactSummaryCards.tsx +35 -0
  110. package/dashboard/src/features/task-status/components/CategoryPanel/CategoryPanel.module.css +85 -0
  111. package/dashboard/src/features/task-status/components/CategoryPanel/CategoryPanel.tsx +150 -0
  112. package/dashboard/src/features/task-status/components/DashboardHeader/DashboardHeader.module.css +41 -0
  113. package/dashboard/src/features/task-status/components/DashboardHeader/DashboardHeader.tsx +41 -0
  114. package/dashboard/src/features/task-status/components/FilesPanel/FilesPanel.module.css +25 -0
  115. package/dashboard/src/features/task-status/components/FilesPanel/FilesPanel.tsx +40 -0
  116. package/dashboard/src/features/task-status/components/HardnessEngineeringPanel/HardnessEngineeringPanel.module.css +330 -0
  117. package/dashboard/src/features/task-status/components/HardnessEngineeringPanel/HardnessEngineeringPanel.tsx +299 -0
  118. package/dashboard/src/features/task-status/components/LifecyclePanel/LifecyclePanel.module.css +74 -0
  119. package/dashboard/src/features/task-status/components/LifecyclePanel/LifecyclePanel.tsx +79 -0
  120. package/dashboard/src/features/task-status/components/MarkdownDialog/MarkdownDialog.module.css +133 -0
  121. package/dashboard/src/features/task-status/components/MarkdownDialog/MarkdownDialog.tsx +233 -0
  122. package/dashboard/src/features/task-status/components/Sidebar/Sidebar.module.css +53 -0
  123. package/dashboard/src/features/task-status/components/Sidebar/Sidebar.tsx +163 -0
  124. package/dashboard/src/features/task-status/components/StatusBadge/StatusBadge.module.css +41 -0
  125. package/dashboard/src/features/task-status/components/StatusBadge/StatusBadge.tsx +48 -0
  126. package/dashboard/src/features/task-status/components/TaskOverview/TaskOverview.module.css +97 -0
  127. package/dashboard/src/features/task-status/components/TaskOverview/TaskOverview.tsx +128 -0
  128. package/dashboard/src/features/task-status/components/TaskStatusDashboard/TaskStatusDashboard.module.css +9 -0
  129. package/dashboard/src/features/task-status/components/TaskStatusDashboard/TaskStatusDashboard.tsx +318 -0
  130. package/dashboard/src/features/task-status/components/WorkflowPanel/WorkflowPanel.module.css +221 -0
  131. package/dashboard/src/features/task-status/components/WorkflowPanel/WorkflowPanel.tsx +344 -0
  132. package/dashboard/src/features/task-status/taskStatusConfig.ts +100 -0
  133. package/dashboard/src/features/task-status/utils/actionItems.ts +247 -0
  134. package/dashboard/src/features/task-status/utils/artifactGrouping.ts +328 -0
  135. package/dashboard/src/features/task-status/utils/hardnessScanner.ts +406 -0
  136. package/dashboard/src/features/task-status/utils/lifecycle.ts +73 -0
  137. package/dashboard/src/features/task-status/utils/markdownInline/markdownInline.module.css +11 -0
  138. package/dashboard/src/features/task-status/utils/markdownInline/markdownInline.tsx +104 -0
  139. package/dashboard/src/features/task-status/utils/markdownLinks.ts +83 -0
  140. package/dashboard/src/features/task-status/utils/markdownRenderer/markdownRenderer.module.css +74 -0
  141. package/dashboard/src/features/task-status/utils/markdownRenderer/markdownRenderer.tsx +326 -0
  142. package/dashboard/src/features/task-status/utils/status.ts +7 -0
  143. package/dashboard/src/features/task-status/utils/test/actionItems.test.ts +134 -0
  144. package/dashboard/src/features/task-status/utils/test/artifactGrouping.test.ts +294 -0
  145. package/dashboard/src/features/task-status/utils/test/hardnessScanner.test.ts +138 -0
  146. package/dashboard/src/features/task-status/utils/test/lifecycle.test.ts +49 -0
  147. package/dashboard/src/features/task-status/utils/test/markdownInline.test.ts +41 -0
  148. package/dashboard/src/features/task-status/utils/test/markdownLinks.test.ts +158 -0
  149. package/dashboard/src/features/task-status/utils/test/workspaceMetadata.test.ts +37 -0
  150. package/dashboard/src/features/task-status/utils/workspaceMetadata.ts +175 -0
  151. package/dashboard/src/main.tsx +16 -0
  152. package/dashboard/src/shared/design-system.css +134 -0
  153. package/dashboard/src/shared/design-system.tsx +84 -0
  154. package/dashboard/src/styles.css +41 -0
  155. package/dashboard/src/types.ts +133 -0
  156. package/dashboard/src/workspace-artifacts.d.ts +9 -0
  157. package/dashboard/tsconfig.json +22 -0
  158. package/dashboard/vite.config.ts +579 -0
  159. package/designs/.gitkeep +1 -0
  160. package/docs/add-project-command-completion.md +117 -0
  161. package/docs/public-npm-registry-completion.md +104 -0
  162. package/docs/workflows.png +0 -0
  163. package/docs/workspace-template-setup.md +229 -0
  164. package/meeting-logs/.gitkeep +1 -0
  165. package/modules/.gitkeep +1 -0
  166. package/package.json +96 -5
  167. package/plans/.gitkeep +1 -0
  168. package/prds/.gitkeep +1 -0
  169. package/project/PROJECT.md +26 -0
  170. package/project/repositories.json +72 -0
  171. package/project/validation.json +9 -0
  172. package/project/workflows.json +20 -0
  173. package/research/.gitkeep +1 -0
  174. package/roles/backend-developer.md +26 -0
  175. package/roles/frontend-developer.md +25 -0
  176. package/roles/project-manager.md +42 -0
  177. package/roles/tech-lead.md +42 -0
  178. package/roles/ui-ux-designer.md +43 -0
  179. package/scripts/add-project.mjs +990 -0
  180. package/scripts/add-project.test.mjs +804 -0
  181. package/scripts/check-staged-security.mjs +97 -0
  182. package/scripts/check-staged-security.test.mjs +68 -0
  183. package/scripts/workspace-integrity.ts +220 -0
  184. package/templates/auto-mode-completion-summary-template.md +78 -0
  185. package/templates/meeting-log-template.md +177 -0
  186. package/templates/plan-template.md +219 -0
  187. package/templates/prd-template.md +106 -0
  188. package/templates/research-template.md +119 -0
  189. package/workflows.md +590 -0
  190. package/workspace.config.json +43 -0
@@ -0,0 +1,79 @@
1
+ import {
2
+ Check,
3
+ CircleDashed,
4
+ CircleX,
5
+ Clock3,
6
+ ShieldAlert,
7
+ } from "lucide-react";
8
+ import { Card } from "../../../../shared/design-system";
9
+ import type { TaskGroup } from "../../../../types";
10
+ import { buildLifecycleStages } from "../../utils/lifecycle";
11
+ import styles from "./LifecyclePanel.module.css";
12
+
13
+ type LifecyclePanelProps = {
14
+ taskGroups: TaskGroup[];
15
+ onSelectArtifact: (artifact: TaskGroup["artifacts"][number]) => void;
16
+ };
17
+
18
+ export function LifecyclePanel(props: LifecyclePanelProps) {
19
+ const { taskGroups, onSelectArtifact } = props;
20
+
21
+ return (
22
+ <section className={styles.section}>
23
+ <header>
24
+ <p className={styles.eyebrow}>Task progression</p>
25
+ <h2 className={styles.title}>Project lifecycle</h2>
26
+ <p className={styles.description}>
27
+ See the evidence-backed stage coverage for every grouped task.
28
+ </p>
29
+ </header>
30
+ {taskGroups.length === 0 ? (
31
+ <Card className={styles.empty} variant="white">
32
+ No grouped tasks match the current filter.
33
+ </Card>
34
+ ) : (
35
+ <div className={styles.list}>
36
+ {taskGroups.map((group) => (
37
+ <Card className={styles.card} key={group.key} variant="white">
38
+ <div className={styles.cardHeader}>
39
+ <div>
40
+ <p className={styles.taskLabel}>Task</p>
41
+ <h3 className={styles.taskTitle}>{group.title}</h3>
42
+ </div>
43
+ <span className={styles.taskStatus}>{group.status}</span>
44
+ </div>
45
+ <div className={styles.stageScroller}>
46
+ <div className={styles.stageGrid}>
47
+ {buildLifecycleStages(group).map((stage) => (
48
+ <button
49
+ className={`${styles.stage} ${styles[stage.state]}`}
50
+ key={stage.name}
51
+ onClick={() => {
52
+ const artifact = stage.artifacts[0];
53
+ if (artifact) onSelectArtifact(artifact);
54
+ }}
55
+ type="button"
56
+ >
57
+ <StageIcon state={stage.state} />
58
+ <span>{stage.name}</span>
59
+ <small>{stage.state.replace("-", " ")}</small>
60
+ </button>
61
+ ))}
62
+ </div>
63
+ </div>
64
+ </Card>
65
+ ))}
66
+ </div>
67
+ )}
68
+ </section>
69
+ );
70
+ }
71
+
72
+ function StageIcon(props: { state: string }) {
73
+ const { state } = props;
74
+ if (state === "complete") return <Check className={styles.icon} />;
75
+ if (state === "current") return <Clock3 className={styles.icon} />;
76
+ if (state === "blocked") return <ShieldAlert className={styles.icon} />;
77
+ if (state === "missing") return <CircleX className={styles.icon} />;
78
+ return <CircleDashed className={styles.icon} />;
79
+ }
@@ -0,0 +1,133 @@
1
+ @reference "../../../../styles.css";
2
+
3
+ .backdrop {
4
+ @apply fixed inset-0 z-40 cursor-default bg-black/20;
5
+ }
6
+
7
+ .drawer {
8
+ @apply fixed inset-y-0 right-0 z-50 min-w-[420px] max-w-[calc(100vw-48px)] overflow-hidden border-l-[4px] border-black bg-background shadow-neo-lg;
9
+ }
10
+
11
+ .resizeHandle {
12
+ @apply absolute inset-y-0 left-0 z-20 w-3 -translate-x-1/2 cursor-ew-resize touch-none appearance-none border-0 bg-transparent p-0 focus-visible:outline focus-visible:outline-[4px] focus-visible:outline-offset-2 focus-visible:outline-neo-blue;
13
+ }
14
+
15
+ .resizeIndicator {
16
+ @apply mx-auto block h-full w-1 bg-black opacity-0 transition-opacity;
17
+ }
18
+
19
+ .resizeHandle:hover .resizeIndicator,
20
+ .resizeHandle:focus-visible .resizeIndicator {
21
+ @apply opacity-100;
22
+ }
23
+
24
+ .card {
25
+ @apply flex h-full min-w-0 flex-col rounded-none border-0 p-0 shadow-none;
26
+ }
27
+
28
+ .body {
29
+ @apply grid min-w-0 flex-1 content-start gap-4 overflow-y-auto overflow-x-hidden p-5;
30
+ }
31
+
32
+ .header {
33
+ @apply sticky top-0 z-10 flex flex-col gap-3 border-b-[4px] border-black bg-surface p-5;
34
+ }
35
+
36
+ .headerTop {
37
+ @apply flex items-start justify-between gap-3;
38
+ }
39
+
40
+ .meta {
41
+ @apply flex flex-wrap items-center gap-2;
42
+ }
43
+
44
+ .typeBadge {
45
+ @apply rounded-full border-[3px] border-black bg-neo-blue px-3 py-1 text-xs font-black uppercase;
46
+ }
47
+
48
+ .title {
49
+ @apply mt-3 text-2xl font-black leading-tight;
50
+ }
51
+
52
+ .path {
53
+ @apply mt-1 break-all text-sm font-bold text-black/60;
54
+ }
55
+
56
+ .actions {
57
+ @apply flex shrink-0 gap-2;
58
+ }
59
+
60
+ .icon {
61
+ @apply size-5;
62
+ }
63
+
64
+ .rawLink {
65
+ @apply w-fit;
66
+ }
67
+
68
+ .drawerEnter {
69
+ animation: markdown-drawer-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
70
+ will-change: transform;
71
+ }
72
+
73
+ .drawerExit {
74
+ animation: markdown-drawer-exit 180ms cubic-bezier(0.4, 0, 1, 1) both;
75
+ will-change: transform;
76
+ }
77
+
78
+ .backdropEnter {
79
+ animation: drawer-backdrop-enter 180ms ease-out both;
80
+ }
81
+
82
+ .backdropExit {
83
+ animation: drawer-backdrop-exit 180ms ease-in both;
84
+ }
85
+
86
+ @keyframes markdown-drawer-enter {
87
+ from {
88
+ transform: translate3d(100%, 0, 0);
89
+ }
90
+
91
+ to {
92
+ transform: translate3d(0, 0, 0);
93
+ }
94
+ }
95
+
96
+ @keyframes markdown-drawer-exit {
97
+ from {
98
+ transform: translate3d(0, 0, 0);
99
+ }
100
+
101
+ to {
102
+ transform: translate3d(100%, 0, 0);
103
+ }
104
+ }
105
+
106
+ @keyframes drawer-backdrop-enter {
107
+ from {
108
+ opacity: 0;
109
+ }
110
+
111
+ to {
112
+ opacity: 1;
113
+ }
114
+ }
115
+
116
+ @keyframes drawer-backdrop-exit {
117
+ from {
118
+ opacity: 1;
119
+ }
120
+
121
+ to {
122
+ opacity: 0;
123
+ }
124
+ }
125
+
126
+ @media (prefers-reduced-motion: reduce) {
127
+ .drawerEnter,
128
+ .drawerExit,
129
+ .backdropEnter,
130
+ .backdropExit {
131
+ animation-duration: 1ms;
132
+ }
133
+ }
@@ -0,0 +1,233 @@
1
+ import { ArrowLeft, X } from "lucide-react";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { Button, Card } from "../../../../shared/design-system";
4
+ import type { Artifact } from "../../../../types";
5
+ import { renderMarkdownBlocks } from "../../utils/markdownRenderer/markdownRenderer";
6
+ import { StatusBadge } from "../StatusBadge/StatusBadge";
7
+ import styles from "./MarkdownDialog.module.css";
8
+
9
+ type MarkdownDialogProps = {
10
+ artifact: Artifact;
11
+ artifacts: Artifact[];
12
+ canGoBack: boolean;
13
+ onBack: () => void;
14
+ onClose: () => void;
15
+ onNavigate: (artifact: Artifact) => void;
16
+ };
17
+
18
+ const defaultDialogWidth = 640;
19
+ const minDialogWidth = 420;
20
+ const viewportGutter = 48;
21
+ const keyboardResizeStep = 32;
22
+ const drawerAnimationMs = 180;
23
+
24
+ export function MarkdownDialog(props: MarkdownDialogProps) {
25
+ const { artifact, artifacts, canGoBack, onBack, onClose, onNavigate } = props;
26
+ const [dialogWidth, setDialogWidth] = useState(defaultDialogWidth);
27
+ const [isClosing, setIsClosing] = useState(false);
28
+ const resizeState = useRef<{
29
+ startWidth: number;
30
+ startX: number;
31
+ } | null>(null);
32
+ const closeTimeout = useRef<number | null>(null);
33
+ const blocks = renderMarkdownBlocks(artifact.content, {
34
+ artifacts,
35
+ currentArtifact: artifact,
36
+ onNavigate,
37
+ });
38
+
39
+ useEffect(
40
+ () => () => {
41
+ if (closeTimeout.current) {
42
+ window.clearTimeout(closeTimeout.current);
43
+ }
44
+ },
45
+ [],
46
+ );
47
+
48
+ useEffect(() => {
49
+ function handleWindowResize() {
50
+ setDialogWidth((currentWidth) => clampDialogWidth(currentWidth));
51
+ }
52
+
53
+ window.addEventListener("resize", handleWindowResize);
54
+
55
+ return () => window.removeEventListener("resize", handleWindowResize);
56
+ }, []);
57
+
58
+ useEffect(() => {
59
+ function handleEscapeKey(event: KeyboardEvent) {
60
+ if (event.key === "Escape") {
61
+ requestClose();
62
+ }
63
+ }
64
+
65
+ window.addEventListener("keydown", handleEscapeKey);
66
+
67
+ return () => window.removeEventListener("keydown", handleEscapeKey);
68
+ });
69
+
70
+ function requestClose() {
71
+ if (isClosing) {
72
+ return;
73
+ }
74
+
75
+ setIsClosing(true);
76
+ closeTimeout.current = window.setTimeout(onClose, drawerAnimationMs);
77
+ }
78
+
79
+ function handleResizePointerDown(
80
+ event: React.PointerEvent<HTMLButtonElement>,
81
+ ) {
82
+ event.preventDefault();
83
+ resizeState.current = {
84
+ startWidth: dialogWidth,
85
+ startX: event.clientX,
86
+ };
87
+ document.body.style.cursor = "ew-resize";
88
+ document.body.style.userSelect = "none";
89
+ window.addEventListener("pointermove", handleResizePointerMove);
90
+ window.addEventListener("pointerup", handleResizePointerUp, { once: true });
91
+ }
92
+
93
+ function handleResizePointerMove(event: PointerEvent) {
94
+ const currentResize = resizeState.current;
95
+
96
+ if (!currentResize) {
97
+ return;
98
+ }
99
+
100
+ setDialogWidth(
101
+ clampDialogWidth(
102
+ currentResize.startWidth + currentResize.startX - event.clientX,
103
+ ),
104
+ );
105
+ }
106
+
107
+ function handleResizePointerUp() {
108
+ resizeState.current = null;
109
+ document.body.style.cursor = "";
110
+ document.body.style.userSelect = "";
111
+ window.removeEventListener("pointermove", handleResizePointerMove);
112
+ }
113
+
114
+ function handleResizeKeyDown(event: React.KeyboardEvent<HTMLButtonElement>) {
115
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") {
116
+ return;
117
+ }
118
+
119
+ event.preventDefault();
120
+ setDialogWidth((currentWidth) =>
121
+ clampDialogWidth(
122
+ event.key === "ArrowLeft"
123
+ ? currentWidth + keyboardResizeStep
124
+ : currentWidth - keyboardResizeStep,
125
+ ),
126
+ );
127
+ }
128
+
129
+ return (
130
+ <>
131
+ <button
132
+ aria-label="Close markdown preview"
133
+ className={`${styles.backdrop} ${
134
+ isClosing ? styles.backdropExit : styles.backdropEnter
135
+ }`}
136
+ onClick={requestClose}
137
+ type="button"
138
+ />
139
+ <aside
140
+ aria-label={`Markdown preview for ${artifact.title}`}
141
+ aria-modal="true"
142
+ className={`${styles.drawer} ${
143
+ isClosing ? styles.drawerExit : styles.drawerEnter
144
+ }`}
145
+ role="dialog"
146
+ style={{ width: dialogWidth }}
147
+ >
148
+ <button
149
+ aria-label="Resize markdown preview width"
150
+ className={styles.resizeHandle}
151
+ onKeyDown={handleResizeKeyDown}
152
+ onPointerDown={handleResizePointerDown}
153
+ title="Resize markdown preview"
154
+ type="button"
155
+ >
156
+ <span className={styles.resizeIndicator} />
157
+ </button>
158
+ <Card variant="white" className={styles.card}>
159
+ <MarkdownDialogHeader
160
+ artifact={artifact}
161
+ canGoBack={canGoBack}
162
+ onBack={onBack}
163
+ onClose={requestClose}
164
+ />
165
+ <div className={styles.body}>{blocks}</div>
166
+ </Card>
167
+ </aside>
168
+ </>
169
+ );
170
+ }
171
+
172
+ function clampDialogWidth(width: number) {
173
+ const maxWidth =
174
+ typeof window === "undefined"
175
+ ? defaultDialogWidth
176
+ : Math.max(minDialogWidth, window.innerWidth - viewportGutter);
177
+
178
+ return Math.min(Math.max(width, minDialogWidth), maxWidth);
179
+ }
180
+
181
+ function MarkdownDialogHeader(props: {
182
+ artifact: Artifact;
183
+ canGoBack: boolean;
184
+ onBack: () => void;
185
+ onClose: () => void;
186
+ }) {
187
+ const { artifact, canGoBack, onBack, onClose } = props;
188
+
189
+ return (
190
+ <div className={styles.header}>
191
+ <div className={styles.headerTop}>
192
+ <div>
193
+ <div className={styles.meta}>
194
+ <span className={styles.typeBadge}>{artifact.type}</span>
195
+ <StatusBadge status={artifact.status} />
196
+ </div>
197
+ <h2 className={styles.title}>{artifact.title}</h2>
198
+ <p className={styles.path}>{artifact.relativePath}</p>
199
+ </div>
200
+ <div className={styles.actions}>
201
+ {canGoBack ? (
202
+ <Button
203
+ aria-label="Go back to previous markdown document"
204
+ onClick={onBack}
205
+ size="icon"
206
+ variant="white"
207
+ >
208
+ <ArrowLeft className={styles.icon} />
209
+ </Button>
210
+ ) : null}
211
+ <Button
212
+ aria-label="Close markdown preview"
213
+ onClick={onClose}
214
+ size="icon"
215
+ variant="red"
216
+ >
217
+ <X className={styles.icon} />
218
+ </Button>
219
+ </div>
220
+ </div>
221
+ <a
222
+ className={styles.rawLink}
223
+ href={artifact.sourceHref}
224
+ target="_blank"
225
+ rel="noreferrer"
226
+ >
227
+ <Button size="sm" variant="white">
228
+ Open raw
229
+ </Button>
230
+ </a>
231
+ </div>
232
+ );
233
+ }
@@ -0,0 +1,53 @@
1
+ @reference "../../../../styles.css";
2
+
3
+ .sidebar {
4
+ @apply sticky top-4 left-4 z-20 self-start max-h-[calc(100vh-2rem)] overflow-auto;
5
+ }
6
+
7
+ .card {
8
+ @apply p-4;
9
+ }
10
+
11
+ .search {
12
+ @apply mb-4;
13
+ }
14
+
15
+ .nav {
16
+ @apply grid gap-2;
17
+ }
18
+
19
+ .navGroup {
20
+ @apply grid gap-2;
21
+ }
22
+
23
+ .item {
24
+ @apply flex items-center justify-between gap-3 rounded-xl border-[3px] border-black px-3 py-2 font-black transition-transform hover:-translate-y-0.5;
25
+ }
26
+
27
+ .submenu {
28
+ @apply ml-4 grid gap-2 border-l-[3px] border-black pl-3;
29
+ }
30
+
31
+ .submenuItem {
32
+ @apply flex items-center justify-between gap-3 rounded-xl border-[3px] border-black px-3 py-2 text-sm font-black transition-transform hover:-translate-y-0.5;
33
+ }
34
+
35
+ .itemActive {
36
+ @apply bg-neo-yellow shadow-neo-active;
37
+ }
38
+
39
+ .itemInactive {
40
+ @apply bg-surface;
41
+ }
42
+
43
+ .itemLabel {
44
+ @apply flex items-center gap-2;
45
+ }
46
+
47
+ .itemIcon {
48
+ @apply size-4;
49
+ }
50
+
51
+ .itemCount {
52
+ @apply text-sm;
53
+ }
@@ -0,0 +1,163 @@
1
+ import { Card, Input } from "../../../../shared/design-system";
2
+ import type {
3
+ ActionItem,
4
+ Artifact,
5
+ DashboardView,
6
+ HardnessScanReport,
7
+ } from "../../../../types";
8
+ import { navItems, taskSubmenuItems } from "../../taskStatusConfig";
9
+ import styles from "./Sidebar.module.css";
10
+
11
+ type SidebarProps = {
12
+ activeView: DashboardView;
13
+ filteredArtifacts: Artifact[];
14
+ hardnessReport?: HardnessScanReport;
15
+ actionItems: ActionItem[];
16
+ onSelectView: (view: DashboardView) => void;
17
+ query: string;
18
+ setQuery: (query: string) => void;
19
+ };
20
+
21
+ export function Sidebar(props: SidebarProps) {
22
+ const {
23
+ activeView,
24
+ filteredArtifacts,
25
+ actionItems,
26
+ hardnessReport,
27
+ onSelectView,
28
+ query,
29
+ setQuery,
30
+ } = props;
31
+
32
+ return (
33
+ <aside className={styles.sidebar}>
34
+ <Card className={styles.card} variant="white">
35
+ <div className={styles.search}>
36
+ <Input
37
+ label="Filter tasks and artifacts"
38
+ placeholder="Search title, status, ID, path"
39
+ value={query}
40
+ onChange={(event) => setQuery(event.currentTarget.value)}
41
+ />
42
+ </div>
43
+
44
+ <nav className={styles.nav}>
45
+ {navItems.map((item) => (
46
+ <div className={styles.navGroup} key={item.view}>
47
+ <SidebarItem
48
+ activeView={activeView}
49
+ filteredArtifacts={filteredArtifacts}
50
+ hardnessReport={hardnessReport}
51
+ actionItems={actionItems}
52
+ item={item}
53
+ isActive={isNavItemActive(activeView, item.view)}
54
+ onSelectView={onSelectView}
55
+ />
56
+ {item.view === "task" ? (
57
+ <div className={styles.submenu}>
58
+ {taskSubmenuItems.map((submenuItem) => (
59
+ <SidebarItem
60
+ activeView={activeView}
61
+ filteredArtifacts={filteredArtifacts}
62
+ hardnessReport={hardnessReport}
63
+ actionItems={actionItems}
64
+ item={submenuItem}
65
+ isActive={activeView === submenuItem.view}
66
+ isSubmenu
67
+ key={submenuItem.view}
68
+ onSelectView={onSelectView}
69
+ />
70
+ ))}
71
+ </div>
72
+ ) : null}
73
+ </div>
74
+ ))}
75
+ </nav>
76
+ </Card>
77
+ </aside>
78
+ );
79
+ }
80
+
81
+ function SidebarItem(props: {
82
+ activeView: DashboardView;
83
+ filteredArtifacts: Artifact[];
84
+ hardnessReport?: HardnessScanReport;
85
+ actionItems: ActionItem[];
86
+ item: (typeof navItems)[number];
87
+ isActive: boolean;
88
+ isSubmenu?: boolean;
89
+ onSelectView: (view: DashboardView) => void;
90
+ }) {
91
+ const {
92
+ filteredArtifacts,
93
+ hardnessReport,
94
+ actionItems,
95
+ isActive,
96
+ isSubmenu = false,
97
+ item,
98
+ onSelectView,
99
+ } = props;
100
+ const Icon = item.icon;
101
+ const count = getViewCount(
102
+ filteredArtifacts,
103
+ item.view,
104
+ actionItems,
105
+ hardnessReport,
106
+ );
107
+
108
+ return (
109
+ <button
110
+ className={`${isSubmenu ? styles.submenuItem : styles.item} ${
111
+ isActive ? styles.itemActive : styles.itemInactive
112
+ }`}
113
+ onClick={() => onSelectView(item.view)}
114
+ type="button"
115
+ >
116
+ <span className={styles.itemLabel}>
117
+ <Icon className={styles.itemIcon} />
118
+ {item.label}
119
+ </span>
120
+ <span className={styles.itemCount}>{count}</span>
121
+ </button>
122
+ );
123
+ }
124
+
125
+ function isNavItemActive(activeView: DashboardView, itemView: DashboardView) {
126
+ if (itemView === "task") {
127
+ return (
128
+ activeView === "task" ||
129
+ taskSubmenuItems.some((item) => item.view === activeView)
130
+ );
131
+ }
132
+
133
+ return activeView === itemView;
134
+ }
135
+
136
+ function getViewCount(
137
+ artifacts: Artifact[],
138
+ view: DashboardView,
139
+ actionItems: ActionItem[],
140
+ hardnessReport?: HardnessScanReport,
141
+ ) {
142
+ if (view === "action-required") {
143
+ return actionItems.length;
144
+ }
145
+ if (view === "lifecycle") {
146
+ return new Set(artifacts.map((artifact) => artifact.taskKey)).size;
147
+ }
148
+ if (view === "task") {
149
+ return artifacts.filter((artifact) => artifact.type !== "document").length;
150
+ }
151
+
152
+ if (view === "workflow") {
153
+ return 9;
154
+ }
155
+
156
+ if (view === "hardness") {
157
+ return hardnessReport
158
+ ? `${hardnessReport.totalChecked}/${hardnessReport.totalItems}`
159
+ : "18";
160
+ }
161
+
162
+ return artifacts.filter((artifact) => artifact.type === view).length;
163
+ }
@@ -0,0 +1,41 @@
1
+ @reference "../../../../styles.css";
2
+
3
+ .badge {
4
+ @apply inline-flex rounded-full border-[3px] border-black px-3 py-1 text-xs font-black uppercase leading-none;
5
+ }
6
+
7
+ .approved {
8
+ @apply bg-neo-lime;
9
+ }
10
+
11
+ .blocked {
12
+ @apply bg-neo-red text-white;
13
+ }
14
+
15
+ .complete {
16
+ @apply bg-neo-blue;
17
+ }
18
+
19
+ .draft {
20
+ @apply bg-neo-yellow;
21
+ }
22
+
23
+ .needDesign {
24
+ @apply bg-neo-pink;
25
+ }
26
+
27
+ .designDone {
28
+ @apply bg-neo-blue;
29
+ }
30
+
31
+ .inProgress {
32
+ @apply bg-neo-orange;
33
+ }
34
+
35
+ .superseded {
36
+ @apply bg-neo-pink;
37
+ }
38
+
39
+ .unknown {
40
+ @apply bg-surface;
41
+ }