@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,48 @@
1
+ import { displayStatus, normalizeStatus } from "../../utils/status";
2
+ import styles from "./StatusBadge.module.css";
3
+
4
+ type StatusBadgeProps = {
5
+ status: string;
6
+ };
7
+
8
+ export function StatusBadge(props: StatusBadgeProps) {
9
+ const { status } = props;
10
+
11
+ return (
12
+ <span className={`${styles.badge} ${getStatusClasses(status)}`}>
13
+ {displayStatus(status)}
14
+ </span>
15
+ );
16
+ }
17
+
18
+ function getStatusClasses(status: string) {
19
+ switch (normalizeStatus(status)) {
20
+ case "approved": {
21
+ return styles.approved;
22
+ }
23
+ case "blocked": {
24
+ return styles.blocked;
25
+ }
26
+ case "complete": {
27
+ return styles.complete;
28
+ }
29
+ case "draft": {
30
+ return styles.draft;
31
+ }
32
+ case "need-design": {
33
+ return styles.needDesign;
34
+ }
35
+ case "design-done": {
36
+ return styles.designDone;
37
+ }
38
+ case "in-progress": {
39
+ return styles.inProgress;
40
+ }
41
+ case "superseded": {
42
+ return styles.superseded;
43
+ }
44
+ default: {
45
+ return styles.unknown;
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,97 @@
1
+ @reference "../../../../styles.css";
2
+
3
+ .sectionHeader {
4
+ @apply mb-3 flex items-center gap-2;
5
+ }
6
+
7
+ .sectionIcon {
8
+ @apply size-5;
9
+ }
10
+
11
+ .sectionTitle {
12
+ @apply text-2xl font-black;
13
+ }
14
+
15
+ .taskGrid {
16
+ @apply grid gap-4;
17
+ }
18
+
19
+ .emptyCard {
20
+ @apply p-5;
21
+ }
22
+
23
+ .emptyTitle {
24
+ @apply font-black;
25
+ }
26
+
27
+ .emptyCopy {
28
+ @apply mt-1 text-sm font-bold text-black/60;
29
+ }
30
+
31
+ .taskCard {
32
+ @apply p-4;
33
+ }
34
+
35
+ .columns {
36
+ @apply mt-4 grid gap-2 md:grid-cols-4;
37
+ }
38
+
39
+ .header {
40
+ @apply grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-start;
41
+ }
42
+
43
+ .headerMain {
44
+ @apply min-w-0;
45
+ }
46
+
47
+ .meta {
48
+ @apply flex flex-wrap items-center gap-2;
49
+ }
50
+
51
+ .artifactCount {
52
+ @apply rounded-full border-[3px] border-black bg-surface px-3 py-1 text-xs font-black uppercase;
53
+ }
54
+
55
+ .title {
56
+ @apply mt-3 text-xl font-black leading-tight;
57
+ }
58
+
59
+ .description {
60
+ @apply mt-2 w-full text-sm font-bold leading-relaxed text-black/70;
61
+ }
62
+
63
+ .key {
64
+ @apply mt-1 break-all text-sm font-bold text-black/60;
65
+ }
66
+
67
+ .updated {
68
+ @apply inline-flex w-fit items-center gap-2 text-sm font-black lg:justify-self-end;
69
+ }
70
+
71
+ .updatedIcon {
72
+ @apply size-4;
73
+ }
74
+
75
+ .column {
76
+ @apply min-h-24 rounded-xl border-[3px] border-black bg-background p-3;
77
+ }
78
+
79
+ .columnHeader {
80
+ @apply flex items-center justify-between gap-2;
81
+ }
82
+
83
+ .columnLabel {
84
+ @apply text-xs font-black uppercase;
85
+ }
86
+
87
+ .columnItems {
88
+ @apply mt-2 flex flex-col gap-2;
89
+ }
90
+
91
+ .artifactButton {
92
+ @apply block w-full rounded-lg bg-white px-2 py-1 text-left text-sm font-black underline decoration-[3px] underline-offset-2;
93
+ }
94
+
95
+ .missing {
96
+ @apply text-sm font-bold text-black/50;
97
+ }
@@ -0,0 +1,128 @@
1
+ import { CalendarDays, Search } from "lucide-react";
2
+ import { Card } from "../../../../shared/design-system";
3
+ import type { Artifact, TaskGroup } from "../../../../types";
4
+ import { type artifactTypes, taskArtifactTypes } from "../../taskStatusConfig";
5
+ import { StatusBadge } from "../StatusBadge/StatusBadge";
6
+ import styles from "./TaskOverview.module.css";
7
+
8
+ type TaskOverviewProps = {
9
+ onSelectArtifact: (artifact: Artifact) => void;
10
+ taskGroups: TaskGroup[];
11
+ };
12
+
13
+ export function TaskOverview(props: TaskOverviewProps) {
14
+ const { onSelectArtifact, taskGroups } = props;
15
+
16
+ return (
17
+ <section>
18
+ <div className={styles.sectionHeader}>
19
+ <Search className={styles.sectionIcon} />
20
+ <h2 className={styles.sectionTitle}>Task overview</h2>
21
+ </div>
22
+ <div className={styles.taskGrid}>
23
+ {taskGroups.length > 0 ? (
24
+ taskGroups.map((task) => (
25
+ <TaskCard
26
+ key={task.key}
27
+ onSelectArtifact={onSelectArtifact}
28
+ task={task}
29
+ />
30
+ ))
31
+ ) : (
32
+ <Card className={styles.emptyCard} variant="white">
33
+ <p className={styles.emptyTitle}>No matching tasks found.</p>
34
+ <p className={styles.emptyCopy}>
35
+ Try a broader search or clear the filter.
36
+ </p>
37
+ </Card>
38
+ )}
39
+ </div>
40
+ </section>
41
+ );
42
+ }
43
+
44
+ function TaskCard(props: {
45
+ onSelectArtifact: (artifact: Artifact) => void;
46
+ task: TaskGroup;
47
+ }) {
48
+ const { onSelectArtifact, task } = props;
49
+
50
+ return (
51
+ <Card variant="white" className={styles.taskCard}>
52
+ <TaskCardHeader task={task} />
53
+ <div className={styles.columns}>
54
+ {taskArtifactTypes.map((artifactType) => (
55
+ <TaskArtifactColumn
56
+ artifactType={artifactType}
57
+ key={artifactType.type}
58
+ onSelectArtifact={onSelectArtifact}
59
+ task={task}
60
+ />
61
+ ))}
62
+ </div>
63
+ </Card>
64
+ );
65
+ }
66
+
67
+ function TaskCardHeader(props: { task: TaskGroup }) {
68
+ const { task } = props;
69
+
70
+ return (
71
+ <div className={styles.header}>
72
+ <div className={styles.headerMain}>
73
+ <div className={styles.meta}>
74
+ <StatusBadge status={task.status} />
75
+ <span className={styles.artifactCount}>
76
+ {task.artifacts.length} artifacts
77
+ </span>
78
+ </div>
79
+ <h2 className={styles.title}>{task.title}</h2>
80
+ {task.description ? (
81
+ <p className={styles.description}>{task.description}</p>
82
+ ) : null}
83
+ <p className={styles.key}>{task.key}</p>
84
+ </div>
85
+ {task.updated ? (
86
+ <div className={styles.updated}>
87
+ <CalendarDays className={styles.updatedIcon} />
88
+ {task.updated}
89
+ </div>
90
+ ) : null}
91
+ </div>
92
+ );
93
+ }
94
+
95
+ function TaskArtifactColumn(props: {
96
+ artifactType: (typeof artifactTypes)[number];
97
+ onSelectArtifact: (artifact: Artifact) => void;
98
+ task: TaskGroup;
99
+ }) {
100
+ const { artifactType, onSelectArtifact, task } = props;
101
+ const items = task.byType[artifactType.type];
102
+ const firstStatus = items[0]?.status ?? "missing";
103
+
104
+ return (
105
+ <div className={styles.column}>
106
+ <div className={styles.columnHeader}>
107
+ <div className={styles.columnLabel}>{artifactType.label}</div>
108
+ <StatusBadge status={firstStatus} />
109
+ </div>
110
+ <div className={styles.columnItems}>
111
+ {items.length > 0 ? (
112
+ items.map((artifact) => (
113
+ <button
114
+ className={styles.artifactButton}
115
+ key={artifact.relativePath}
116
+ onClick={() => onSelectArtifact(artifact)}
117
+ type="button"
118
+ >
119
+ {artifact.title}
120
+ </button>
121
+ ))
122
+ ) : (
123
+ <span className={styles.missing}>Missing</span>
124
+ )}
125
+ </div>
126
+ </div>
127
+ );
128
+ }
@@ -0,0 +1,9 @@
1
+ @reference "../../../../styles.css";
2
+
3
+ .layout {
4
+ @apply grid min-w-[920px] grid-cols-[280px_minmax(0,1fr)] gap-5 px-4 py-5;
5
+ }
6
+
7
+ .content {
8
+ @apply grid min-w-0 gap-5;
9
+ }
@@ -0,0 +1,318 @@
1
+ import {
2
+ artifactEndpoint,
3
+ artifacts as initialArtifacts,
4
+ generatedAt as initialGeneratedAt,
5
+ hardnessReport as initialHardnessReport,
6
+ projectProfile as initialProjectProfile,
7
+ } from "virtual:workspace-artifacts";
8
+ import { useEffect, useState } from "react";
9
+ import type {
10
+ ActionItem,
11
+ Artifact,
12
+ DashboardView,
13
+ DocumentModuleFilter,
14
+ DocumentModuleTab,
15
+ HardnessScanReport,
16
+ ProjectProfile,
17
+ } from "../../../../types";
18
+ import { artifactTypes } from "../../taskStatusConfig";
19
+ import { buildActionItems, filterActionItems } from "../../utils/actionItems";
20
+ import {
21
+ buildTaskGroups,
22
+ countDocumentsByModule,
23
+ filterArtifacts,
24
+ filterDocumentsByModule,
25
+ getVisibleFiles,
26
+ } from "../../utils/artifactGrouping";
27
+ import { ActionRequiredPanel } from "../ActionRequiredPanel/ActionRequiredPanel";
28
+ import { ArtifactSummaryCards } from "../ArtifactSummaryCards/ArtifactSummaryCards";
29
+ import { CategoryPanel } from "../CategoryPanel/CategoryPanel";
30
+ import { DashboardHeader } from "../DashboardHeader/DashboardHeader";
31
+ import { FilesPanel } from "../FilesPanel/FilesPanel";
32
+ import { HardnessEngineeringPanel } from "../HardnessEngineeringPanel/HardnessEngineeringPanel";
33
+ import { LifecyclePanel } from "../LifecyclePanel/LifecyclePanel";
34
+ import { MarkdownDialog } from "../MarkdownDialog/MarkdownDialog";
35
+ import { Sidebar } from "../Sidebar/Sidebar";
36
+ import { TaskOverview } from "../TaskOverview/TaskOverview";
37
+ import { WorkflowPanel } from "../WorkflowPanel/WorkflowPanel";
38
+ import styles from "./TaskStatusDashboard.module.css";
39
+
40
+ type WorkspaceArtifactPayload = {
41
+ artifacts: Artifact[];
42
+ hardnessReport?: HardnessScanReport;
43
+ projectProfile: ProjectProfile;
44
+ generatedAt: string;
45
+ };
46
+
47
+ export function TaskStatusDashboard() {
48
+ const [activeView, setActiveView] = useState<DashboardView>("task");
49
+ const [artifactHistory, setArtifactHistory] = useState<Artifact[]>([]);
50
+ const [activeDocumentModule, setActiveDocumentModule] =
51
+ useState<DocumentModuleFilter>("all");
52
+ const [artifactPayload, setArtifactPayload] =
53
+ useState<WorkspaceArtifactPayload>({
54
+ artifacts: initialArtifacts,
55
+ hardnessReport: initialHardnessReport,
56
+ projectProfile: initialProjectProfile,
57
+ generatedAt: initialGeneratedAt,
58
+ });
59
+ const [query, setQuery] = useState("");
60
+ const {
61
+ artifacts,
62
+ generatedAt,
63
+ hardnessReport = initialHardnessReport,
64
+ projectProfile,
65
+ } = artifactPayload;
66
+ const activeArtifact = artifactHistory.at(-1) ?? null;
67
+ const filteredArtifacts = filterArtifacts(artifacts, query);
68
+ const actionItems = filterActionItems(
69
+ buildActionItems(artifacts, projectProfile.repositories),
70
+ query,
71
+ );
72
+ const markdownMetadataCount = artifacts.filter(
73
+ (artifact) => artifact.metadataFormat === "markdown",
74
+ ).length;
75
+ const taskGroups = buildTaskGroups(filteredArtifacts);
76
+ const selectedType = artifactTypes.find((type) => type.type === activeView);
77
+ const visibleFiles = getVisibleFiles(filteredArtifacts, activeView);
78
+ const documentModuleTabs = buildDocumentModuleTabs(projectProfile);
79
+ const documentModuleCounts = countDocumentsByModule(
80
+ getVisibleFiles(filteredArtifacts, "document"),
81
+ documentModuleTabs,
82
+ );
83
+ const visibleFilesForView =
84
+ activeView === "document"
85
+ ? filterDocumentsByModule(visibleFiles, activeDocumentModule)
86
+ : visibleFiles;
87
+ const visibleFilesTitle =
88
+ activeView === "task"
89
+ ? "Task files"
90
+ : activeView === "workflow"
91
+ ? "Workflow files"
92
+ : `${selectedType?.label ?? "Selected"} files`;
93
+
94
+ useEffect(() => {
95
+ const controller = new AbortController();
96
+
97
+ async function refreshArtifacts() {
98
+ try {
99
+ const response = await fetch(
100
+ `${artifactEndpoint}?updated=${Date.now().toString()}`,
101
+ {
102
+ cache: "no-store",
103
+ signal: controller.signal,
104
+ },
105
+ );
106
+
107
+ if (!response.ok) {
108
+ return;
109
+ }
110
+
111
+ const nextPayload = (await response.json()) as WorkspaceArtifactPayload;
112
+ setArtifactPayload(nextPayload);
113
+ } catch (error) {
114
+ if (!controller.signal.aborted) {
115
+ console.warn("Unable to refresh workspace artifacts.", error);
116
+ }
117
+ }
118
+ }
119
+
120
+ refreshArtifacts();
121
+
122
+ return () => controller.abort();
123
+ }, []);
124
+
125
+ function handleSelectView(view: DashboardView) {
126
+ setActiveView(view);
127
+ setArtifactHistory([]);
128
+ }
129
+
130
+ function handleSelectArtifact(artifact: Artifact) {
131
+ setArtifactHistory([artifact]);
132
+ }
133
+
134
+ function handleNavigateArtifact(artifact: Artifact) {
135
+ setArtifactHistory((currentHistory) => {
136
+ const currentArtifact = currentHistory.at(-1);
137
+
138
+ if (currentArtifact?.relativePath === artifact.relativePath) {
139
+ return currentHistory;
140
+ }
141
+
142
+ return [...currentHistory, artifact];
143
+ });
144
+ }
145
+
146
+ function handleBackArtifact() {
147
+ setArtifactHistory((currentHistory) => currentHistory.slice(0, -1));
148
+ }
149
+
150
+ function handleCloseDialog() {
151
+ setArtifactHistory([]);
152
+ }
153
+
154
+ return (
155
+ <>
156
+ <main className={styles.layout}>
157
+ <Sidebar
158
+ activeView={activeView}
159
+ filteredArtifacts={filteredArtifacts}
160
+ actionItems={actionItems}
161
+ hardnessReport={hardnessReport}
162
+ onSelectView={handleSelectView}
163
+ query={query}
164
+ setQuery={setQuery}
165
+ />
166
+
167
+ <section className={styles.content}>
168
+ <DashboardHeader
169
+ artifactCount={artifacts.length}
170
+ generatedAt={generatedAt}
171
+ markdownMetadataCount={markdownMetadataCount}
172
+ />
173
+ <ContentPanel
174
+ activeArtifact={activeArtifact}
175
+ actionItems={actionItems}
176
+ activeView={activeView}
177
+ activeDocumentModule={activeDocumentModule}
178
+ artifacts={artifacts}
179
+ documentModuleCounts={documentModuleCounts}
180
+ documentModuleTabs={documentModuleTabs}
181
+ hardnessReport={hardnessReport}
182
+ onSelectArtifact={handleSelectArtifact}
183
+ onSelectDocumentModule={setActiveDocumentModule}
184
+ selectedType={selectedType}
185
+ taskGroups={taskGroups}
186
+ visibleFiles={visibleFilesForView}
187
+ visibleFilesTitle={visibleFilesTitle}
188
+ />
189
+ </section>
190
+ </main>
191
+ {activeArtifact ? (
192
+ <MarkdownDialog
193
+ artifact={activeArtifact}
194
+ artifacts={artifacts}
195
+ canGoBack={artifactHistory.length > 1}
196
+ onBack={handleBackArtifact}
197
+ onClose={handleCloseDialog}
198
+ onNavigate={handleNavigateArtifact}
199
+ />
200
+ ) : null}
201
+ </>
202
+ );
203
+ }
204
+
205
+ function ContentPanel(props: {
206
+ activeArtifact: Artifact | null;
207
+ actionItems: ActionItem[];
208
+ activeView: DashboardView;
209
+ activeDocumentModule: DocumentModuleFilter;
210
+ artifacts: Artifact[];
211
+ documentModuleCounts: Record<DocumentModuleFilter, number>;
212
+ documentModuleTabs: DocumentModuleTab[];
213
+ hardnessReport: HardnessScanReport;
214
+ onSelectArtifact: (artifact: Artifact) => void;
215
+ onSelectDocumentModule: (module: DocumentModuleFilter) => void;
216
+ selectedType: (typeof artifactTypes)[number] | undefined;
217
+ taskGroups: ReturnType<typeof buildTaskGroups>;
218
+ visibleFiles: Artifact[];
219
+ visibleFilesTitle: string;
220
+ }) {
221
+ const {
222
+ activeArtifact,
223
+ actionItems,
224
+ activeView,
225
+ activeDocumentModule,
226
+ artifacts,
227
+ documentModuleCounts,
228
+ documentModuleTabs,
229
+ hardnessReport,
230
+ onSelectArtifact,
231
+ onSelectDocumentModule,
232
+ selectedType,
233
+ taskGroups,
234
+ visibleFiles,
235
+ visibleFilesTitle,
236
+ } = props;
237
+
238
+ if (activeView === "task") {
239
+ return (
240
+ <>
241
+ <ArtifactSummaryCards artifacts={artifacts} />
242
+ <TaskOverview
243
+ onSelectArtifact={onSelectArtifact}
244
+ taskGroups={taskGroups}
245
+ />
246
+ <FilesPanel
247
+ activeArtifact={activeArtifact}
248
+ files={visibleFiles}
249
+ onSelectArtifact={onSelectArtifact}
250
+ title={visibleFilesTitle}
251
+ />
252
+ </>
253
+ );
254
+ }
255
+
256
+ if (activeView === "workflow") {
257
+ return <WorkflowPanel />;
258
+ }
259
+
260
+ if (activeView === "action-required") {
261
+ return (
262
+ <ActionRequiredPanel
263
+ items={actionItems}
264
+ onSelectArtifact={(item) => onSelectArtifact(item.artifact)}
265
+ />
266
+ );
267
+ }
268
+
269
+ if (activeView === "lifecycle") {
270
+ return (
271
+ <LifecyclePanel
272
+ onSelectArtifact={onSelectArtifact}
273
+ taskGroups={taskGroups}
274
+ />
275
+ );
276
+ }
277
+
278
+ if (activeView === "hardness") {
279
+ return <HardnessEngineeringPanel report={hardnessReport} />;
280
+ }
281
+
282
+ if (!selectedType) {
283
+ return null;
284
+ }
285
+
286
+ return (
287
+ <>
288
+ <CategoryPanel
289
+ activeDocumentModule={activeDocumentModule}
290
+ artifactsForType={visibleFiles}
291
+ documentModuleCounts={documentModuleCounts}
292
+ documentModuleTabs={documentModuleTabs}
293
+ onSelectArtifact={onSelectArtifact}
294
+ onSelectDocumentModule={onSelectDocumentModule}
295
+ type={selectedType}
296
+ />
297
+ <FilesPanel
298
+ activeArtifact={activeArtifact}
299
+ files={visibleFiles}
300
+ onSelectArtifact={onSelectArtifact}
301
+ title={visibleFilesTitle}
302
+ />
303
+ </>
304
+ );
305
+ }
306
+
307
+ function buildDocumentModuleTabs(
308
+ projectProfile: ProjectProfile,
309
+ ): DocumentModuleTab[] {
310
+ return [
311
+ { module: "all", label: "All" },
312
+ { module: "workspace", label: "Workspace" },
313
+ ...projectProfile.repositories.map((repository) => ({
314
+ module: repository.id,
315
+ label: repository.name,
316
+ })),
317
+ ];
318
+ }