@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,294 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import type { Artifact } from "../../../../types";
3
+ import {
4
+ buildTaskGroups,
5
+ countDocumentsByModule,
6
+ filterArtifacts,
7
+ filterDocumentsByModule,
8
+ getVisibleFiles,
9
+ } from "../artifactGrouping";
10
+
11
+ describe("artifactGrouping", () => {
12
+ test("groups artifacts by task key and prioritizes PRD title", () => {
13
+ const groups = buildTaskGroups([
14
+ createArtifact({
15
+ goal: "Build it from the plan.",
16
+ title: "Implementation plan",
17
+ type: "plan",
18
+ }),
19
+ createArtifact({
20
+ goal: "Solve the user problem.",
21
+ title: "Product requirements",
22
+ type: "prd",
23
+ }),
24
+ ]);
25
+
26
+ expect(groups).toHaveLength(1);
27
+ expect(groups[0]?.title).toBe("Product requirements");
28
+ expect(groups[0]?.description).toBe("Solve the user problem.");
29
+ expect(groups[0]?.byType.prd).toHaveLength(1);
30
+ expect(groups[0]?.byType.plan).toHaveLength(1);
31
+ });
32
+
33
+ test("uses plan goal when a grouped PRD goal is missing", () => {
34
+ const groups = buildTaskGroups([
35
+ createArtifact({
36
+ title: "Product requirements",
37
+ type: "prd",
38
+ }),
39
+ createArtifact({
40
+ goal: "Use the implementation goal.",
41
+ title: "Implementation plan",
42
+ type: "plan",
43
+ }),
44
+ ]);
45
+
46
+ expect(groups[0]?.description).toBe("Use the implementation goal.");
47
+ });
48
+
49
+ test("groups artifacts that reference another artifact ID", () => {
50
+ const groups = buildTaskGroups([
51
+ createArtifact({
52
+ id: "RESEARCH-20260816-app-performance-optimization",
53
+ relativePath:
54
+ "research/research-20260816-app-performance-optimization.md",
55
+ taskKey: "app-performance-optimization",
56
+ title:
57
+ "How desktop apps improve game experience, reduce lag, smooth gameplay, and stabilize FPS",
58
+ type: "research",
59
+ }),
60
+ createArtifact({
61
+ id: "PRD-20260816-performance-profiles-diagnostics",
62
+ relatedArtifactIds: ["RESEARCH-20260816-app-performance-optimization"],
63
+ relativePath: "prds/prd-20260816-performance-profiles-diagnostics.md",
64
+ taskKey: "performance-profiles-diagnostics",
65
+ title: "Example Project Performance Profiles And Diagnostics",
66
+ type: "prd",
67
+ }),
68
+ ]);
69
+
70
+ expect(groups).toHaveLength(1);
71
+ expect(groups[0]?.title).toBe(
72
+ "Example Project Performance Profiles And Diagnostics",
73
+ );
74
+ expect(groups[0]?.byType.research).toHaveLength(1);
75
+ expect(groups[0]?.byType.prd).toHaveLength(1);
76
+ });
77
+
78
+ test("allows multiple research, design, and plan artifacts in one task", () => {
79
+ const groups = buildTaskGroups([
80
+ createArtifact({
81
+ id: "PRD-20260816-performance-profiles-diagnostics",
82
+ taskKey: "performance-profiles-diagnostics",
83
+ type: "prd",
84
+ }),
85
+ createArtifact({
86
+ id: "RESEARCH-20260816-performance-a",
87
+ relatedArtifactIds: ["PRD-20260816-performance-profiles-diagnostics"],
88
+ taskKey: "performance-research-a",
89
+ title: "Performance research A",
90
+ type: "research",
91
+ }),
92
+ createArtifact({
93
+ id: "RESEARCH-20260816-performance-b",
94
+ relatedArtifactIds: ["PRD-20260816-performance-profiles-diagnostics"],
95
+ taskKey: "performance-research-b",
96
+ title: "Performance research B",
97
+ type: "research",
98
+ }),
99
+ createArtifact({
100
+ id: "DESIGN-20260816-performance-a",
101
+ relatedArtifactIds: ["PRD-20260816-performance-profiles-diagnostics"],
102
+ taskKey: "performance-design-a",
103
+ title: "Performance design A",
104
+ type: "design",
105
+ }),
106
+ createArtifact({
107
+ id: "DESIGN-20260816-performance-b",
108
+ relatedArtifactIds: ["PRD-20260816-performance-profiles-diagnostics"],
109
+ taskKey: "performance-design-b",
110
+ title: "Performance design B",
111
+ type: "design",
112
+ }),
113
+ createArtifact({
114
+ id: "PLAN-20260816-performance-a",
115
+ prdId: "PRD-20260816-performance-profiles-diagnostics",
116
+ taskKey: "performance-plan-a",
117
+ title: "Performance plan A",
118
+ type: "plan",
119
+ }),
120
+ createArtifact({
121
+ id: "PLAN-20260816-performance-b",
122
+ prdId: "PRD-20260816-performance-profiles-diagnostics",
123
+ taskKey: "performance-plan-b",
124
+ title: "Performance plan B",
125
+ type: "plan",
126
+ }),
127
+ ]);
128
+
129
+ expect(groups).toHaveLength(1);
130
+ expect(groups[0]?.byType.research).toHaveLength(2);
131
+ expect(groups[0]?.byType.design).toHaveLength(2);
132
+ expect(groups[0]?.byType.plan).toHaveLength(2);
133
+ });
134
+
135
+ test("filters artifacts by title, status, and path", () => {
136
+ const artifacts = [
137
+ createArtifact({ status: "approved", title: "Launcher Plan" }),
138
+ createArtifact({
139
+ relativePath: "docs/preferences.md",
140
+ status: "unknown",
141
+ title: "Settings",
142
+ }),
143
+ ];
144
+
145
+ expect(filterArtifacts(artifacts, "approved")).toHaveLength(1);
146
+ expect(filterArtifacts(artifacts, "preferences.md")).toHaveLength(1);
147
+ });
148
+
149
+ test("returns all files for task view and category files for artifact views", () => {
150
+ const artifacts = [
151
+ createArtifact({ type: "prd" }),
152
+ createArtifact({ type: "document" }),
153
+ ];
154
+
155
+ expect(getVisibleFiles(artifacts, "task")).toHaveLength(1);
156
+ expect(getVisibleFiles(artifacts, "document")).toHaveLength(1);
157
+ expect(getVisibleFiles(artifacts, "workflow")).toHaveLength(0);
158
+ });
159
+
160
+ test("does not create task groups from documents", () => {
161
+ const groups = buildTaskGroups([
162
+ createArtifact({ type: "document" }),
163
+ createArtifact({ type: "document" }),
164
+ ]);
165
+
166
+ expect(groups).toHaveLength(0);
167
+ });
168
+
169
+ test("filters documents by workspace module", () => {
170
+ const artifacts = [
171
+ createArtifact({
172
+ relativePath: "docs/workspace.md",
173
+ sourceModule: "workspace",
174
+ type: "document",
175
+ }),
176
+ createArtifact({
177
+ relativePath: "modules/example-web/docs/app.md",
178
+ sourceModule: "example-web",
179
+ type: "document",
180
+ }),
181
+ createArtifact({
182
+ relativePath: "plans/app.md",
183
+ sourceModule: "workspace",
184
+ type: "plan",
185
+ }),
186
+ ];
187
+
188
+ expect(filterDocumentsByModule(artifacts, "all")).toHaveLength(2);
189
+ expect(filterDocumentsByModule(artifacts, "workspace")).toHaveLength(1);
190
+ expect(filterDocumentsByModule(artifacts, "example-web")).toHaveLength(1);
191
+ expect(filterDocumentsByModule(artifacts, "example-core")).toHaveLength(0);
192
+ });
193
+
194
+ test("counts document tabs by workspace module", () => {
195
+ const counts = countDocumentsByModule(
196
+ [
197
+ createArtifact({
198
+ sourceModule: "workspace",
199
+ type: "document",
200
+ }),
201
+ createArtifact({
202
+ sourceModule: "example-web",
203
+ type: "document",
204
+ }),
205
+ createArtifact({
206
+ sourceModule: "example-web",
207
+ type: "document",
208
+ }),
209
+ ],
210
+ [
211
+ { module: "all", label: "All" },
212
+ { module: "workspace", label: "Workspace" },
213
+ { module: "example-web", label: "example-web" },
214
+ { module: "example-core", label: "example-core" },
215
+ ],
216
+ );
217
+
218
+ expect(counts.all).toBe(3);
219
+ expect(counts.workspace).toBe(1);
220
+ expect(counts["example-web"]).toBe(2);
221
+ expect(counts["example-core"]).toBe(0);
222
+ });
223
+
224
+ test("sorts visible artifact lists by latest time first", () => {
225
+ const artifacts = [
226
+ createArtifact({
227
+ modified: "2026-08-14T00:00:00.000Z",
228
+ relativePath: "plans/older.md",
229
+ title: "Older",
230
+ type: "plan",
231
+ }),
232
+ createArtifact({
233
+ created: "2026-08-16",
234
+ modified: "2026-08-13T00:00:00.000Z",
235
+ relativePath: "plans/newer.md",
236
+ title: "Newer",
237
+ type: "plan",
238
+ }),
239
+ createArtifact({
240
+ modified: "2026-08-15T00:00:00.000Z",
241
+ relativePath: "docs/middle.md",
242
+ title: "Middle",
243
+ type: "document",
244
+ }),
245
+ ];
246
+
247
+ expect(
248
+ filterArtifacts(artifacts, "").map((artifact) => artifact.title),
249
+ ).toEqual(["Newer", "Middle", "Older"]);
250
+ expect(
251
+ getVisibleFiles(filterArtifacts(artifacts, ""), "plan").map(
252
+ (artifact) => artifact.title,
253
+ ),
254
+ ).toEqual(["Newer", "Older"]);
255
+ });
256
+
257
+ test("sorts artifacts inside each task column by latest time first", () => {
258
+ const groups = buildTaskGroups([
259
+ createArtifact({
260
+ modified: "2026-08-14T00:00:00.000Z",
261
+ relativePath: "plans/older.md",
262
+ title: "Older",
263
+ type: "plan",
264
+ }),
265
+ createArtifact({
266
+ modified: "2026-08-16T00:00:00.000Z",
267
+ relativePath: "plans/newer.md",
268
+ title: "Newer",
269
+ type: "plan",
270
+ }),
271
+ ]);
272
+
273
+ expect(groups[0]?.byType.plan.map((artifact) => artifact.title)).toEqual([
274
+ "Newer",
275
+ "Older",
276
+ ]);
277
+ });
278
+ });
279
+
280
+ function createArtifact(overrides: Partial<Artifact> = {}): Artifact {
281
+ return {
282
+ content: "# Example",
283
+ modified: "2026-08-13T00:00:00.000Z",
284
+ relatedArtifactIds: [],
285
+ relativePath: "prds/example.md",
286
+ sourceModule: "workspace",
287
+ sourceHref: "/@fs/example.md",
288
+ status: "draft",
289
+ taskKey: "example",
290
+ title: "Example",
291
+ type: "prd",
292
+ ...overrides,
293
+ };
294
+ }
@@ -0,0 +1,138 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import {
3
+ buildScanReportFromResults,
4
+ type FileScanResult,
5
+ } from "../hardnessScanner";
6
+
7
+ describe("hardnessScanner", () => {
8
+ test("calculates overall health score and item status when all files pass", () => {
9
+ const mockFiles: FileScanResult[] = [
10
+ {
11
+ relativePath: "src/ComponentA.tsx",
12
+ lineCount: 150,
13
+ rawHtmlTagsCount: 0,
14
+ destructuredParamPropsCount: 0,
15
+ missingBlockBracesCount: 0,
16
+ useCallbackCount: 0,
17
+ rawUseEffectCount: 0,
18
+ stateSyncEffectCount: 0,
19
+ consoleErrorCount: 0,
20
+ longFunctionCount: 0,
21
+ hardcodedStringJsxCount: 0,
22
+ },
23
+ {
24
+ relativePath: "src/ComponentB.tsx",
25
+ lineCount: 200,
26
+ rawHtmlTagsCount: 0,
27
+ destructuredParamPropsCount: 0,
28
+ missingBlockBracesCount: 0,
29
+ useCallbackCount: 0,
30
+ rawUseEffectCount: 0,
31
+ stateSyncEffectCount: 0,
32
+ consoleErrorCount: 0,
33
+ longFunctionCount: 0,
34
+ hardcodedStringJsxCount: 0,
35
+ },
36
+ ];
37
+
38
+ const report = buildScanReportFromResults(
39
+ mockFiles,
40
+ "2026-08-18T12:00:00Z",
41
+ );
42
+
43
+ expect(report.healthScore).toBe("100%");
44
+ expect(report.totalChecked).toBeLessThan(report.totalItems);
45
+ expect(report.notScanned).toBeGreaterThan(0);
46
+ expect(report.items.length).toBeGreaterThan(0);
47
+
48
+ const dsItem = report.items.find(
49
+ (i) => i.id === "enforce-design-system-primitives",
50
+ );
51
+ expect(dsItem).toBeDefined();
52
+ expect(dsItem?.checked).toBe(true);
53
+ expect(dsItem?.state).toBe("pass");
54
+ expect(dsItem?.passCount).toBe(2);
55
+ });
56
+
57
+ test("detects violations and updates checked state accordingly", () => {
58
+ const mockFiles: FileScanResult[] = [
59
+ {
60
+ relativePath: "src/OverLimitFile.tsx",
61
+ lineCount: 420,
62
+ rawHtmlTagsCount: 3,
63
+ destructuredParamPropsCount: 1,
64
+ missingBlockBracesCount: 0,
65
+ useCallbackCount: 0,
66
+ rawUseEffectCount: 0,
67
+ stateSyncEffectCount: 0,
68
+ consoleErrorCount: 0,
69
+ longFunctionCount: 0,
70
+ hardcodedStringJsxCount: 0,
71
+ },
72
+ {
73
+ relativePath: "src/CleanFile.tsx",
74
+ lineCount: 100,
75
+ rawHtmlTagsCount: 0,
76
+ destructuredParamPropsCount: 0,
77
+ missingBlockBracesCount: 0,
78
+ useCallbackCount: 0,
79
+ rawUseEffectCount: 0,
80
+ stateSyncEffectCount: 0,
81
+ consoleErrorCount: 0,
82
+ longFunctionCount: 0,
83
+ hardcodedStringJsxCount: 0,
84
+ },
85
+ ];
86
+
87
+ const report = buildScanReportFromResults(
88
+ mockFiles,
89
+ "2026-08-18T12:00:00Z",
90
+ );
91
+
92
+ expect(report.healthScore).not.toBe("100%");
93
+
94
+ const fileSizeItem = report.items.find(
95
+ (i) => i.id === "file-size-limitations",
96
+ );
97
+ expect(fileSizeItem?.checked).toBe(false);
98
+ expect(fileSizeItem?.passCount).toBe(1);
99
+ expect(fileSizeItem?.totalCount).toBe(2);
100
+ expect(fileSizeItem?.score).toBe("50%");
101
+
102
+ const dsItem = report.items.find(
103
+ (i) => i.id === "enforce-design-system-primitives",
104
+ );
105
+ expect(dsItem?.checked).toBe(false);
106
+ expect(dsItem?.passCount).toBe(1);
107
+ expect(dsItem?.state).toBe("violation");
108
+ });
109
+
110
+ test("scans code-quality evidence instead of marking supported rules unknown", () => {
111
+ const report = buildScanReportFromResults([
112
+ {
113
+ relativePath: "src/Unsafe.tsx",
114
+ lineCount: 80,
115
+ rawHtmlTagsCount: 0,
116
+ destructuredParamPropsCount: 0,
117
+ missingBlockBracesCount: 0,
118
+ useCallbackCount: 0,
119
+ rawUseEffectCount: 1,
120
+ stateSyncEffectCount: 1,
121
+ consoleErrorCount: 1,
122
+ longFunctionCount: 1,
123
+ hardcodedStringJsxCount: 1,
124
+ },
125
+ ]);
126
+
127
+ for (const id of [
128
+ "enforce-i18n",
129
+ "restrict-use-effect",
130
+ "error-logging-redaction",
131
+ "keep-functions-simple",
132
+ ]) {
133
+ const item = report.items.find((candidate) => candidate.id === id);
134
+ expect(item?.state).toBe("violation");
135
+ expect(item?.evidence[0]?.status).toBe("violation");
136
+ }
137
+ });
138
+ });
@@ -0,0 +1,49 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import type { TaskGroup } from "../../../../types";
3
+ import { buildLifecycleStages } from "../lifecycle";
4
+
5
+ describe("lifecycle", () => {
6
+ test("marks explicit artifacts and missing evidence accurately", () => {
7
+ const prd = createArtifact("prd", "approved");
8
+ const plan = createArtifact("plan", "complete");
9
+ const group = {
10
+ artifacts: [prd, plan],
11
+ byType: {
12
+ design: [],
13
+ document: [],
14
+ plan: [plan],
15
+ prd: [prd],
16
+ research: [],
17
+ },
18
+ key: "example",
19
+ status: "complete",
20
+ title: "Example",
21
+ } as TaskGroup;
22
+
23
+ const stages = buildLifecycleStages(group);
24
+ expect(stages.find((stage) => stage.name === "PRD")?.state).toBe(
25
+ "complete",
26
+ );
27
+ expect(stages.find((stage) => stage.name === "Plan")?.state).toBe(
28
+ "complete",
29
+ );
30
+ expect(stages.find((stage) => stage.name === "Implementation")?.state).toBe(
31
+ "not-verified",
32
+ );
33
+ });
34
+ });
35
+
36
+ function createArtifact(type: "prd" | "plan", status: string) {
37
+ return {
38
+ content: "# Example",
39
+ modified: "2026-08-20T00:00:00.000Z",
40
+ relatedArtifactIds: [],
41
+ relativePath: `${type}s/example.md`,
42
+ sourceModule: "workspace" as const,
43
+ sourceHref: "/@fs/example.md",
44
+ status,
45
+ taskKey: "example",
46
+ title: "Example",
47
+ type,
48
+ };
49
+ }
@@ -0,0 +1,41 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import type { ReactElement } from "react";
3
+ import type { Artifact } from "../../../../types";
4
+ import { renderInlineMarkdown } from "../markdownInline/markdownInline";
5
+
6
+ const artifact: Artifact = {
7
+ content: "# Example",
8
+ modified: "2026-09-30T00:00:00.000Z",
9
+ relatedArtifactIds: [],
10
+ relativePath: "docs/example.md",
11
+ sourceModule: "workspace",
12
+ sourceHref: "/@fs/example.md",
13
+ status: "unknown",
14
+ taskKey: "example",
15
+ title: "Example",
16
+ type: "document",
17
+ };
18
+
19
+ function renderLink(markdown: string) {
20
+ return renderInlineMarkdown(markdown, {
21
+ artifacts: [artifact],
22
+ currentArtifact: artifact,
23
+ onNavigate: () => {},
24
+ });
25
+ }
26
+
27
+ describe("renderInlineMarkdown links", () => {
28
+ test("renders unsafe URLs as text", () => {
29
+ expect(renderLink("[Run](javascript:evil)")).toEqual(["Run"]);
30
+ expect(renderLink("[Embed](data:text/html,evil)")).toEqual(["Embed"]);
31
+ expect(renderLink("[Host](//example.com)")).toEqual(["Host"]);
32
+ });
33
+
34
+ test("keeps safe links clickable", () => {
35
+ const [link] = renderLink("[Docs](https://example.com/docs)");
36
+ expect((link as ReactElement<{ href: string }>).type).toBe("a");
37
+ expect((link as ReactElement<{ href: string }>).props.href).toBe(
38
+ "https://example.com/docs",
39
+ );
40
+ });
41
+ });
@@ -0,0 +1,158 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import type { Artifact } from "../../../../types";
3
+ import {
4
+ isSafeMarkdownHref,
5
+ normalizeWorkspacePath,
6
+ resolveLinkedArtifact,
7
+ } from "../markdownLinks";
8
+
9
+ describe("markdownLinks", () => {
10
+ test("accepts expected external and relative links", () => {
11
+ for (const href of [
12
+ "https://example.com",
13
+ "HTTP://example.com",
14
+ "mailto:team@example.com",
15
+ "../plans/plan.md",
16
+ "/docs/guide.md",
17
+ "#section",
18
+ ]) {
19
+ expect(isSafeMarkdownHref(href)).toBe(true);
20
+ }
21
+ });
22
+
23
+ test("rejects executable, embedded, and ambiguous links", () => {
24
+ for (const href of [
25
+ "javascript:alert(1)",
26
+ "JaVaScRiPt:alert(1)",
27
+ "data:text/html,test",
28
+ "vbscript:alert(1)",
29
+ "file:///etc/passwd",
30
+ "//example.com",
31
+ "\\\\example.com",
32
+ " https://example.com",
33
+ "java\nscript:alert(1)",
34
+ ]) {
35
+ expect(isSafeMarkdownHref(href)).toBe(false);
36
+ }
37
+ });
38
+
39
+ test("ignores malformed percent encoding instead of crashing", () => {
40
+ const current = createArtifact();
41
+ expect(
42
+ resolveLinkedArtifact([current], current, "%broken.md"),
43
+ ).toBeUndefined();
44
+ });
45
+
46
+ test("normalizes relative workspace paths", () => {
47
+ expect(
48
+ normalizeWorkspacePath(
49
+ "docs/example-web/features/app/../../../../modules/example-web/docs/API.md",
50
+ ),
51
+ ).toBe("modules/example-web/docs/API.md");
52
+ });
53
+
54
+ test("resolves a relative markdown link to a known artifact", () => {
55
+ const current = createArtifact({
56
+ relativePath: "docs/example-web/features/app/README.md",
57
+ });
58
+ const target = createArtifact({
59
+ relativePath: "modules/example-web/docs/features/app/README.md",
60
+ title: "Launcher Feature",
61
+ });
62
+
63
+ expect(
64
+ resolveLinkedArtifact(
65
+ [current, target],
66
+ current,
67
+ "../../../../modules/example-web/docs/features/app/README.md",
68
+ ),
69
+ ).toBe(target);
70
+ });
71
+
72
+ test("resolves a root plan table link to a submodule plan artifact", () => {
73
+ const current = createArtifact({
74
+ relativePath: "plans/plan-20260813-move-submodules-to-modules.md",
75
+ type: "plan",
76
+ });
77
+ const target = createArtifact({
78
+ relativePath:
79
+ "modules/example-core/plans/plan-20260813-move-submodules-to-modules-core.md",
80
+ title: "Move Submodules Core Plan",
81
+ type: "plan",
82
+ });
83
+
84
+ expect(
85
+ resolveLinkedArtifact(
86
+ [current, target],
87
+ current,
88
+ "../modules/example-core/plans/plan-20260813-move-submodules-to-modules-core.md",
89
+ ),
90
+ ).toBe(target);
91
+ });
92
+
93
+ test("resolves a root design mapping link to a submodule design artifact", () => {
94
+ const current = createArtifact({
95
+ relativePath: "designs/design-20260814-advanced-search-filters.md",
96
+ type: "design",
97
+ });
98
+ const target = createArtifact({
99
+ relativePath:
100
+ "modules/example-web/designs/design-20260814-advanced-search-filters.md",
101
+ title: "Advanced Mod Filters Design",
102
+ type: "design",
103
+ });
104
+
105
+ expect(
106
+ resolveLinkedArtifact(
107
+ [current, target],
108
+ current,
109
+ "../modules/example-web/designs/design-20260814-advanced-search-filters.md",
110
+ ),
111
+ ).toBe(target);
112
+ });
113
+
114
+ test("resolves a root research link to a submodule research artifact", () => {
115
+ const current = createArtifact({
116
+ relativePath: "research/research-20260813-catalog-filtering.md",
117
+ type: "research",
118
+ });
119
+ const target = createArtifact({
120
+ relativePath:
121
+ "modules/example-web/research/research-20260813-catalog-filtering.md",
122
+ title: "Submodule research",
123
+ type: "research",
124
+ });
125
+
126
+ expect(
127
+ resolveLinkedArtifact(
128
+ [current, target],
129
+ current,
130
+ "../modules/example-web/research/research-20260813-catalog-filtering.md",
131
+ ),
132
+ ).toBe(target);
133
+ });
134
+
135
+ test("ignores external links", () => {
136
+ const current = createArtifact();
137
+
138
+ expect(
139
+ resolveLinkedArtifact([current], current, "https://example.com/doc.md"),
140
+ ).toBeUndefined();
141
+ });
142
+ });
143
+
144
+ function createArtifact(overrides: Partial<Artifact> = {}): Artifact {
145
+ return {
146
+ content: "# Example",
147
+ modified: "2026-08-13T00:00:00.000Z",
148
+ relatedArtifactIds: [],
149
+ relativePath: "docs/example.md",
150
+ sourceModule: "workspace",
151
+ sourceHref: "/@fs/example.md",
152
+ status: "unknown",
153
+ taskKey: "example",
154
+ title: "Example",
155
+ type: "document",
156
+ ...overrides,
157
+ };
158
+ }