@shinnodua/agent-workflows 0.0.0-stage → 0.2.6

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,74 @@
1
+ @reference "../../../../styles.css";
2
+
3
+ .divider {
4
+ @apply border-t-[4px] border-black;
5
+ }
6
+
7
+ .codeBlock {
8
+ @apply max-w-full overflow-x-auto rounded-xl border-[3px] border-black bg-black p-4 text-sm font-bold text-white;
9
+ }
10
+
11
+ .code {
12
+ @apply block min-w-0 whitespace-pre;
13
+ }
14
+
15
+ .heading {
16
+ @apply min-w-0 font-black leading-tight;
17
+ overflow-wrap: anywhere;
18
+ }
19
+
20
+ .headingLevelOne {
21
+ @apply text-3xl;
22
+ }
23
+
24
+ .headingLevelTwo {
25
+ @apply text-2xl;
26
+ }
27
+
28
+ .headingLevelDefault {
29
+ @apply text-xl;
30
+ }
31
+
32
+ .orderedList {
33
+ @apply grid min-w-0 list-decimal gap-2 pl-6 font-bold;
34
+ overflow-wrap: anywhere;
35
+ }
36
+
37
+ .unorderedList {
38
+ @apply grid min-w-0 list-disc gap-2 pl-6 font-bold;
39
+ overflow-wrap: anywhere;
40
+ }
41
+
42
+ .quote {
43
+ @apply min-w-0 rounded-xl border-[3px] border-black bg-neo-blue p-4 font-black;
44
+ overflow-wrap: anywhere;
45
+ }
46
+
47
+ .tableWrap {
48
+ @apply max-w-full overflow-x-auto rounded-xl border-[3px] border-black;
49
+ }
50
+
51
+ .table {
52
+ @apply w-full border-collapse bg-white text-sm font-bold;
53
+ }
54
+
55
+ .tableHead {
56
+ @apply bg-neo-yellow;
57
+ }
58
+
59
+ .tableHeader {
60
+ @apply border-b-[3px] border-r-[3px] border-black p-3 text-left font-black last:border-r-0;
61
+ }
62
+
63
+ .tableRow {
64
+ @apply border-b-[3px] border-black last:border-b-0;
65
+ }
66
+
67
+ .tableCell {
68
+ @apply min-w-48 max-w-96 border-r-[3px] border-black p-3 align-top last:border-r-0;
69
+ overflow-wrap: anywhere;
70
+ }
71
+
72
+ .paragraph {
73
+ @apply font-bold leading-relaxed;
74
+ }
@@ -0,0 +1,326 @@
1
+ import type { ReactNode } from "react";
2
+ import {
3
+ type MarkdownRenderContext,
4
+ renderInlineMarkdown,
5
+ } from "../markdownInline/markdownInline";
6
+ import styles from "./markdownRenderer.module.css";
7
+
8
+ type MarkdownBlockResult = {
9
+ nextIndex: number;
10
+ node?: ReactNode;
11
+ };
12
+
13
+ export function renderMarkdownBlocks(
14
+ markdown: string,
15
+ context: MarkdownRenderContext,
16
+ ) {
17
+ const lines = markdown.replace(/\r\n/g, "\n").split("\n");
18
+ const blocks: ReactNode[] = [];
19
+ let index = 0;
20
+
21
+ while (index < lines.length) {
22
+ const result = parseMarkdownBlock(lines, index, context);
23
+ index = result.nextIndex;
24
+
25
+ if (result.node) {
26
+ blocks.push(result.node);
27
+ }
28
+ }
29
+
30
+ return blocks;
31
+ }
32
+
33
+ function parseMarkdownBlock(
34
+ lines: string[],
35
+ index: number,
36
+ context: MarkdownRenderContext,
37
+ ): MarkdownBlockResult {
38
+ const line = lines[index] ?? "";
39
+
40
+ if (!line.trim()) {
41
+ return { nextIndex: index + 1 };
42
+ }
43
+
44
+ if (line.startsWith("```")) {
45
+ return parseCodeBlock(lines, index);
46
+ }
47
+
48
+ if (/^(#{1,4})\s+/.test(line)) {
49
+ return parseHeading(line, index, context);
50
+ }
51
+
52
+ if (/^[-*]\s+/.test(line)) {
53
+ return parseList(lines, index, context, "unordered");
54
+ }
55
+
56
+ if (/^\d+\.\s+/.test(line)) {
57
+ return parseList(lines, index, context, "ordered");
58
+ }
59
+
60
+ if (line.startsWith(">")) {
61
+ return parseQuote(lines, index, context);
62
+ }
63
+
64
+ if (/^-{3,}$/.test(line.trim())) {
65
+ return {
66
+ nextIndex: index + 1,
67
+ node: <hr className={styles.divider} key={`hr-${index}`} />,
68
+ };
69
+ }
70
+
71
+ if (isTableStart(lines, index)) {
72
+ return parseTable(lines, index, context);
73
+ }
74
+
75
+ return parseParagraph(lines, index, context);
76
+ }
77
+
78
+ function parseCodeBlock(lines: string[], index: number) {
79
+ const codeLines: string[] = [];
80
+ let nextIndex = index + 1;
81
+
82
+ while (nextIndex < lines.length && !lines[nextIndex]?.startsWith("```")) {
83
+ codeLines.push(lines[nextIndex] ?? "");
84
+ nextIndex += 1;
85
+ }
86
+
87
+ return {
88
+ nextIndex: nextIndex + 1,
89
+ node: (
90
+ <pre className={styles.codeBlock} key={`code-${nextIndex}`}>
91
+ <code className={styles.code}>{codeLines.join("\n")}</code>
92
+ </pre>
93
+ ),
94
+ };
95
+ }
96
+
97
+ function parseHeading(
98
+ line: string,
99
+ index: number,
100
+ context: MarkdownRenderContext,
101
+ ) {
102
+ const heading = line.match(/^(#{1,4})\s+(.+)$/);
103
+ const level = heading?.[1].length ?? 3;
104
+ const text = heading?.[2] ?? line;
105
+ const className = `${styles.heading} ${getHeadingClassName(level)}`;
106
+
107
+ return {
108
+ nextIndex: index + 1,
109
+ node: (
110
+ <h3 className={className} key={`h-${index}`}>
111
+ {renderInlineMarkdown(text, context)}
112
+ </h3>
113
+ ),
114
+ };
115
+ }
116
+
117
+ function parseList(
118
+ lines: string[],
119
+ index: number,
120
+ context: MarkdownRenderContext,
121
+ type: "ordered" | "unordered",
122
+ ) {
123
+ const items = collectListItems(lines, index, type);
124
+ const children = items.values.map((item) => (
125
+ <li key={item}>{renderInlineMarkdown(item, context)}</li>
126
+ ));
127
+
128
+ return {
129
+ nextIndex: items.nextIndex,
130
+ node:
131
+ type === "ordered" ? (
132
+ <ol className={styles.orderedList} key={`ol-${items.nextIndex}`}>
133
+ {children}
134
+ </ol>
135
+ ) : (
136
+ <ul className={styles.unorderedList} key={`ul-${items.nextIndex}`}>
137
+ {children}
138
+ </ul>
139
+ ),
140
+ };
141
+ }
142
+
143
+ function parseQuote(
144
+ lines: string[],
145
+ index: number,
146
+ context: MarkdownRenderContext,
147
+ ) {
148
+ const quote = collectQuoteLines(lines, index);
149
+
150
+ return {
151
+ nextIndex: quote.nextIndex,
152
+ node: (
153
+ <blockquote className={styles.quote} key={`quote-${quote.nextIndex}`}>
154
+ {quote.values.map((line) => (
155
+ <p key={line}>{renderInlineMarkdown(line, context)}</p>
156
+ ))}
157
+ </blockquote>
158
+ ),
159
+ };
160
+ }
161
+
162
+ function parseTable(
163
+ lines: string[],
164
+ index: number,
165
+ context: MarkdownRenderContext,
166
+ ) {
167
+ const tableLines = collectTableLines(lines, index);
168
+ const [headerLine, , ...bodyLines] = tableLines.rows;
169
+ const headers = splitTableRow(headerLine ?? "");
170
+
171
+ return {
172
+ nextIndex: tableLines.nextIndex,
173
+ node: (
174
+ <div className={styles.tableWrap} key={`table-${tableLines.nextIndex}`}>
175
+ <table className={styles.table}>
176
+ <thead className={styles.tableHead}>
177
+ <tr>
178
+ {headers.map((header) => (
179
+ <th className={styles.tableHeader} key={header}>
180
+ {renderInlineMarkdown(header, context)}
181
+ </th>
182
+ ))}
183
+ </tr>
184
+ </thead>
185
+ <tbody>
186
+ {bodyLines.map((row) => (
187
+ <TableRow context={context} key={row} row={row} />
188
+ ))}
189
+ </tbody>
190
+ </table>
191
+ </div>
192
+ ),
193
+ };
194
+ }
195
+
196
+ function TableRow(props: { context: MarkdownRenderContext; row: string }) {
197
+ const { context, row } = props;
198
+
199
+ return (
200
+ <tr className={styles.tableRow}>
201
+ {splitTableRow(row).map((cell) => (
202
+ <td className={styles.tableCell} key={`${row}-${cell}`}>
203
+ {renderInlineMarkdown(cell, context)}
204
+ </td>
205
+ ))}
206
+ </tr>
207
+ );
208
+ }
209
+
210
+ function parseParagraph(
211
+ lines: string[],
212
+ index: number,
213
+ context: MarkdownRenderContext,
214
+ ) {
215
+ const paragraph = collectParagraphLines(lines, index);
216
+
217
+ return {
218
+ nextIndex: paragraph.nextIndex,
219
+ node: (
220
+ <p className={styles.paragraph} key={`p-${paragraph.nextIndex}`}>
221
+ {renderInlineMarkdown(paragraph.values.join(" "), context)}
222
+ </p>
223
+ ),
224
+ };
225
+ }
226
+
227
+ function collectListItems(
228
+ lines: string[],
229
+ index: number,
230
+ type: "ordered" | "unordered",
231
+ ) {
232
+ const values: string[] = [];
233
+ const pattern = type === "ordered" ? /^\d+\.\s+/ : /^[-*]\s+/;
234
+ let nextIndex = index;
235
+
236
+ while (nextIndex < lines.length && pattern.test(lines[nextIndex] ?? "")) {
237
+ values.push((lines[nextIndex] ?? "").replace(pattern, ""));
238
+ nextIndex += 1;
239
+ }
240
+
241
+ return { nextIndex, values };
242
+ }
243
+
244
+ function collectQuoteLines(lines: string[], index: number) {
245
+ const values: string[] = [];
246
+ let nextIndex = index;
247
+
248
+ while (nextIndex < lines.length && lines[nextIndex]?.startsWith(">")) {
249
+ values.push((lines[nextIndex] ?? "").replace(/^>\s?/, ""));
250
+ nextIndex += 1;
251
+ }
252
+
253
+ return { nextIndex, values };
254
+ }
255
+
256
+ function collectTableLines(lines: string[], index: number) {
257
+ const rows: string[] = [];
258
+ let nextIndex = index;
259
+
260
+ while (
261
+ nextIndex < lines.length &&
262
+ /^\s*\|.+\|\s*$/.test(lines[nextIndex] ?? "")
263
+ ) {
264
+ rows.push(lines[nextIndex] ?? "");
265
+ nextIndex += 1;
266
+ }
267
+
268
+ return { nextIndex, rows };
269
+ }
270
+
271
+ function collectParagraphLines(lines: string[], index: number) {
272
+ const values: string[] = [];
273
+ let nextIndex = index;
274
+
275
+ while (canContinueParagraph(lines, nextIndex)) {
276
+ values.push(lines[nextIndex] ?? "");
277
+ nextIndex += 1;
278
+ }
279
+
280
+ return { nextIndex, values };
281
+ }
282
+
283
+ function canContinueParagraph(lines: string[], index: number) {
284
+ const line = lines[index] ?? "";
285
+
286
+ return (
287
+ Boolean(line.trim()) &&
288
+ !line.startsWith("```") &&
289
+ !line.match(/^(#{1,4})\s+/) &&
290
+ !/^[-*]\s+/.test(line) &&
291
+ !/^\d+\.\s+/.test(line) &&
292
+ !line.startsWith(">") &&
293
+ !/^-{3,}$/.test(line.trim()) &&
294
+ !isTableStart(lines, index)
295
+ );
296
+ }
297
+
298
+ function isTableStart(lines: string[], index: number) {
299
+ const current = lines[index] ?? "";
300
+ const next = lines[index + 1] ?? "";
301
+
302
+ return (
303
+ /^\s*\|.+\|\s*$/.test(current) && /^\s*\|[\s:-]+\|[\s|:-]*$/.test(next)
304
+ );
305
+ }
306
+
307
+ function splitTableRow(row: string) {
308
+ return row
309
+ .trim()
310
+ .replace(/^\|/, "")
311
+ .replace(/\|$/, "")
312
+ .split("|")
313
+ .map((cell) => cell.trim());
314
+ }
315
+
316
+ function getHeadingClassName(level: number) {
317
+ if (level === 1) {
318
+ return styles.headingLevelOne;
319
+ }
320
+
321
+ if (level === 2) {
322
+ return styles.headingLevelTwo;
323
+ }
324
+
325
+ return styles.headingLevelDefault;
326
+ }
@@ -0,0 +1,7 @@
1
+ export function normalizeStatus(status: string) {
2
+ return status.toLowerCase().trim() || "unknown";
3
+ }
4
+
5
+ export function displayStatus(status: string) {
6
+ return normalizeStatus(status).replace(/-/g, " ");
7
+ }
@@ -0,0 +1,134 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import type { Artifact, ProjectRepository } from "../../../../types";
3
+ import { buildActionItems, STALE_DRAFT_DAYS } from "../actionItems";
4
+
5
+ const NOW = new Date("2026-08-20T00:00:00.000Z");
6
+
7
+ describe("actionItems", () => {
8
+ test("finds approved PRDs without a linked plan", () => {
9
+ const items = buildActionItems(
10
+ [
11
+ createArtifact({
12
+ id: "PRD-20260820-example",
13
+ status: "approved",
14
+ type: "prd",
15
+ }),
16
+ ],
17
+ NOW,
18
+ );
19
+
20
+ expect(
21
+ items.some((item) => item.title === "Needs implementation plan"),
22
+ ).toBe(true);
23
+ });
24
+
25
+ test("finds missing detail plans for affected submodules", () => {
26
+ const items = buildActionItems(
27
+ [
28
+ createArtifact({
29
+ content:
30
+ "# Plan\n\n- Status: `approved`\n\n| `example-core` | Shared work |",
31
+ id: "PLAN-20260820-example",
32
+ status: "approved",
33
+ type: "plan",
34
+ }),
35
+ ],
36
+ [
37
+ createRepository({
38
+ id: "example-core",
39
+ name: "example-core",
40
+ path: "modules/example-core",
41
+ }),
42
+ ],
43
+ NOW,
44
+ );
45
+
46
+ expect(items.some((item) => item.title === "Missing submodule plan")).toBe(
47
+ true,
48
+ );
49
+ });
50
+
51
+ test("finds stale non-document drafts", () => {
52
+ const items = buildActionItems(
53
+ [
54
+ createArtifact({
55
+ created: `2026-08-${String(20 - STALE_DRAFT_DAYS - 1).padStart(2, "0")}`,
56
+ type: "design",
57
+ }),
58
+ createArtifact({
59
+ created: "2026-07-01",
60
+ type: "document",
61
+ }),
62
+ ],
63
+ NOW,
64
+ );
65
+
66
+ expect(items.filter((item) => item.title === "Stale draft")).toHaveLength(
67
+ 1,
68
+ );
69
+ });
70
+
71
+ test("finds unresolved local Markdown links", () => {
72
+ const items = buildActionItems(
73
+ [
74
+ createArtifact({
75
+ content: "# Example\n\n[Missing](../plans/missing.md)",
76
+ }),
77
+ ],
78
+ NOW,
79
+ );
80
+
81
+ expect(items.some((item) => item.title === "Broken workspace link")).toBe(
82
+ true,
83
+ );
84
+ });
85
+
86
+ test("returns no issues for a current complete artifact set", () => {
87
+ const prd = createArtifact({
88
+ id: "PRD-20260820-example",
89
+ status: "approved",
90
+ type: "prd",
91
+ });
92
+
93
+ const plan = createArtifact({
94
+ content: "# Plan\n\n- Status: `complete`",
95
+ id: "PLAN-20260820-example",
96
+ prdId: prd.id,
97
+ status: "complete",
98
+ type: "plan",
99
+ });
100
+
101
+ expect(buildActionItems([prd, plan], NOW)).toHaveLength(0);
102
+ });
103
+ });
104
+
105
+ function createRepository(
106
+ overrides: Partial<ProjectRepository> = {},
107
+ ): ProjectRepository {
108
+ return {
109
+ id: "example-web",
110
+ name: "example-web",
111
+ path: "modules/example-web",
112
+ platforms: [],
113
+ purpose: "Desktop app",
114
+ scope: [],
115
+ ...overrides,
116
+ };
117
+ }
118
+
119
+ function createArtifact(overrides: Partial<Artifact> = {}): Artifact {
120
+ return {
121
+ content: "# Example",
122
+ created: "2026-08-20",
123
+ modified: "2026-08-20T00:00:00.000Z",
124
+ relatedArtifactIds: [],
125
+ relativePath: "prds/example.md",
126
+ sourceModule: "workspace",
127
+ sourceHref: "/@fs/example.md",
128
+ status: "draft",
129
+ taskKey: "example",
130
+ title: "Example",
131
+ type: "prd",
132
+ ...overrides,
133
+ };
134
+ }