claude-code-workflow 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/.claude/agents/action-planning-agent.md +778 -0
  2. package/.claude/agents/cli-execution-agent.md +270 -0
  3. package/.claude/agents/cli-explore-agent.md +182 -0
  4. package/.claude/agents/cli-lite-planning-agent.md +396 -0
  5. package/.claude/agents/cli-planning-agent.md +558 -0
  6. package/.claude/agents/code-developer.md +310 -0
  7. package/.claude/agents/conceptual-planning-agent.md +308 -0
  8. package/.claude/agents/context-search-agent.md +582 -0
  9. package/.claude/agents/doc-generator.md +330 -0
  10. package/.claude/agents/memory-bridge.md +94 -0
  11. package/.claude/agents/test-context-search-agent.md +399 -0
  12. package/.claude/agents/test-fix-agent.md +343 -0
  13. package/.claude/agents/ui-design-agent.md +593 -0
  14. package/.claude/agents/universal-executor.md +131 -0
  15. package/.claude/commands/cli/cli-init.md +440 -0
  16. package/.claude/commands/enhance-prompt.md +93 -0
  17. package/.claude/commands/memory/code-map-memory.md +687 -0
  18. package/.claude/commands/memory/docs-full-cli.md +471 -0
  19. package/.claude/commands/memory/docs-related-cli.md +386 -0
  20. package/.claude/commands/memory/docs.md +615 -0
  21. package/.claude/commands/memory/load-skill-memory.md +182 -0
  22. package/.claude/commands/memory/load.md +240 -0
  23. package/.claude/commands/memory/skill-memory.md +525 -0
  24. package/.claude/commands/memory/style-skill-memory.md +396 -0
  25. package/.claude/commands/memory/tech-research.md +477 -0
  26. package/.claude/commands/memory/update-full.md +332 -0
  27. package/.claude/commands/memory/update-related.md +332 -0
  28. package/.claude/commands/memory/workflow-skill-memory.md +517 -0
  29. package/.claude/commands/task/breakdown.md +204 -0
  30. package/.claude/commands/task/create.md +152 -0
  31. package/.claude/commands/task/execute.md +270 -0
  32. package/.claude/commands/task/replan.md +437 -0
  33. package/.claude/commands/version.md +254 -0
  34. package/.claude/commands/workflow/action-plan-verify.md +447 -0
  35. package/.claude/commands/workflow/brainstorm/api-designer.md +585 -0
  36. package/.claude/commands/workflow/brainstorm/artifacts.md +452 -0
  37. package/.claude/commands/workflow/brainstorm/auto-parallel.md +443 -0
  38. package/.claude/commands/workflow/brainstorm/data-architect.md +220 -0
  39. package/.claude/commands/workflow/brainstorm/product-manager.md +200 -0
  40. package/.claude/commands/workflow/brainstorm/product-owner.md +200 -0
  41. package/.claude/commands/workflow/brainstorm/scrum-master.md +200 -0
  42. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +200 -0
  43. package/.claude/commands/workflow/brainstorm/synthesis.md +398 -0
  44. package/.claude/commands/workflow/brainstorm/system-architect.md +387 -0
  45. package/.claude/commands/workflow/brainstorm/ui-designer.md +221 -0
  46. package/.claude/commands/workflow/brainstorm/ux-expert.md +221 -0
  47. package/.claude/commands/workflow/execute.md +460 -0
  48. package/.claude/commands/workflow/init.md +164 -0
  49. package/.claude/commands/workflow/lite-execute.md +686 -0
  50. package/.claude/commands/workflow/lite-fix.md +621 -0
  51. package/.claude/commands/workflow/lite-plan.md +592 -0
  52. package/.claude/commands/workflow/plan.md +551 -0
  53. package/.claude/commands/workflow/replan.md +515 -0
  54. package/.claude/commands/workflow/review-fix.md +646 -0
  55. package/.claude/commands/workflow/review-module-cycle.md +795 -0
  56. package/.claude/commands/workflow/review-session-cycle.md +805 -0
  57. package/.claude/commands/workflow/review.md +291 -0
  58. package/.claude/commands/workflow/session/complete.md +500 -0
  59. package/.claude/commands/workflow/session/list.md +96 -0
  60. package/.claude/commands/workflow/session/resume.md +61 -0
  61. package/.claude/commands/workflow/session/start.md +200 -0
  62. package/.claude/commands/workflow/status.md +352 -0
  63. package/.claude/commands/workflow/tdd-plan.md +460 -0
  64. package/.claude/commands/workflow/tdd-verify.md +386 -0
  65. package/.claude/commands/workflow/test-cycle-execute.md +498 -0
  66. package/.claude/commands/workflow/test-fix-gen.md +699 -0
  67. package/.claude/commands/workflow/test-gen.md +529 -0
  68. package/.claude/commands/workflow/tools/conflict-resolution.md +680 -0
  69. package/.claude/commands/workflow/tools/context-gather.md +434 -0
  70. package/.claude/commands/workflow/tools/task-generate-agent.md +291 -0
  71. package/.claude/commands/workflow/tools/task-generate-tdd.md +518 -0
  72. package/.claude/commands/workflow/tools/tdd-coverage-analysis.md +309 -0
  73. package/.claude/commands/workflow/tools/test-concept-enhanced.md +163 -0
  74. package/.claude/commands/workflow/tools/test-context-gather.md +235 -0
  75. package/.claude/commands/workflow/tools/test-task-generate.md +256 -0
  76. package/.claude/commands/workflow/ui-design/animation-extract.md +1150 -0
  77. package/.claude/commands/workflow/ui-design/codify-style.md +652 -0
  78. package/.claude/commands/workflow/ui-design/design-sync.md +454 -0
  79. package/.claude/commands/workflow/ui-design/explore-auto.md +678 -0
  80. package/.claude/commands/workflow/ui-design/generate.md +504 -0
  81. package/.claude/commands/workflow/ui-design/imitate-auto.md +745 -0
  82. package/.claude/commands/workflow/ui-design/import-from-code.md +537 -0
  83. package/.claude/commands/workflow/ui-design/layout-extract.md +788 -0
  84. package/.claude/commands/workflow/ui-design/reference-page-generator.md +356 -0
  85. package/.claude/commands/workflow/ui-design/style-extract.md +773 -0
  86. package/.claude/scripts/classify-folders.sh +35 -0
  87. package/.claude/scripts/convert_tokens_to_css.sh +225 -0
  88. package/.claude/scripts/detect_changed_modules.sh +157 -0
  89. package/.claude/scripts/discover-design-files.sh +83 -0
  90. package/.claude/scripts/extract-animations.js +243 -0
  91. package/.claude/scripts/extract-computed-styles.js +118 -0
  92. package/.claude/scripts/extract-layout-structure.js +411 -0
  93. package/.claude/scripts/generate_module_docs.sh +713 -0
  94. package/.claude/scripts/get_modules_by_depth.sh +166 -0
  95. package/.claude/scripts/ui-generate-preview.sh +391 -0
  96. package/.claude/scripts/ui-instantiate-prototypes.sh +811 -0
  97. package/.claude/scripts/update_module_claude.sh +333 -0
  98. package/.claude/skills/command-guide/SKILL.md +388 -0
  99. package/.claude/skills/command-guide/UPDATE-GUIDELINE.md +592 -0
  100. package/.claude/skills/command-guide/guides/cli-tools-guide.md +410 -0
  101. package/.claude/skills/command-guide/guides/examples.md +537 -0
  102. package/.claude/skills/command-guide/guides/getting-started.md +242 -0
  103. package/.claude/skills/command-guide/guides/implementation-details.md +1010 -0
  104. package/.claude/skills/command-guide/guides/index-structure.md +326 -0
  105. package/.claude/skills/command-guide/guides/troubleshooting.md +92 -0
  106. package/.claude/skills/command-guide/guides/ui-design-workflow-guide.md +316 -0
  107. package/.claude/skills/command-guide/guides/workflow-patterns.md +662 -0
  108. package/.claude/skills/command-guide/index/all-commands.json +783 -0
  109. package/.claude/skills/command-guide/index/by-category.json +811 -0
  110. package/.claude/skills/command-guide/index/by-use-case.json +797 -0
  111. package/.claude/skills/command-guide/index/command-relationships.json +307 -0
  112. package/.claude/skills/command-guide/index/essential-commands.json +123 -0
  113. package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +722 -0
  114. package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +270 -0
  115. package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +182 -0
  116. package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +396 -0
  117. package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +558 -0
  118. package/.claude/skills/command-guide/reference/agents/code-developer.md +310 -0
  119. package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +328 -0
  120. package/.claude/skills/command-guide/reference/agents/context-search-agent.md +577 -0
  121. package/.claude/skills/command-guide/reference/agents/doc-generator.md +330 -0
  122. package/.claude/skills/command-guide/reference/agents/memory-bridge.md +94 -0
  123. package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +399 -0
  124. package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +343 -0
  125. package/.claude/skills/command-guide/reference/agents/ui-design-agent.md +593 -0
  126. package/.claude/skills/command-guide/reference/agents/universal-executor.md +131 -0
  127. package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +440 -0
  128. package/.claude/skills/command-guide/reference/commands/enhance-prompt.md +93 -0
  129. package/.claude/skills/command-guide/reference/commands/memory/code-map-memory.md +687 -0
  130. package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -0
  131. package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -0
  132. package/.claude/skills/command-guide/reference/commands/memory/docs.md +610 -0
  133. package/.claude/skills/command-guide/reference/commands/memory/load-skill-memory.md +182 -0
  134. package/.claude/skills/command-guide/reference/commands/memory/load.md +240 -0
  135. package/.claude/skills/command-guide/reference/commands/memory/skill-memory.md +525 -0
  136. package/.claude/skills/command-guide/reference/commands/memory/style-skill-memory.md +396 -0
  137. package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +477 -0
  138. package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -0
  139. package/.claude/skills/command-guide/reference/commands/memory/update-related.md +332 -0
  140. package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +517 -0
  141. package/.claude/skills/command-guide/reference/commands/task/breakdown.md +204 -0
  142. package/.claude/skills/command-guide/reference/commands/task/create.md +152 -0
  143. package/.claude/skills/command-guide/reference/commands/task/execute.md +270 -0
  144. package/.claude/skills/command-guide/reference/commands/task/replan.md +437 -0
  145. package/.claude/skills/command-guide/reference/commands/version.md +254 -0
  146. package/.claude/skills/command-guide/reference/commands/workflow/action-plan-verify.md +447 -0
  147. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +585 -0
  148. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +604 -0
  149. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +466 -0
  150. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +220 -0
  151. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +200 -0
  152. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +200 -0
  153. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +200 -0
  154. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +200 -0
  155. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +496 -0
  156. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +387 -0
  157. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +221 -0
  158. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +221 -0
  159. package/.claude/skills/command-guide/reference/commands/workflow/execute.md +460 -0
  160. package/.claude/skills/command-guide/reference/commands/workflow/init.md +164 -0
  161. package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +634 -0
  162. package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +602 -0
  163. package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +582 -0
  164. package/.claude/skills/command-guide/reference/commands/workflow/plan.md +551 -0
  165. package/.claude/skills/command-guide/reference/commands/workflow/replan.md +515 -0
  166. package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +646 -0
  167. package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +795 -0
  168. package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +805 -0
  169. package/.claude/skills/command-guide/reference/commands/workflow/review.md +291 -0
  170. package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +500 -0
  171. package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +96 -0
  172. package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +61 -0
  173. package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +180 -0
  174. package/.claude/skills/command-guide/reference/commands/workflow/status.md +352 -0
  175. package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +460 -0
  176. package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +386 -0
  177. package/.claude/skills/command-guide/reference/commands/workflow/test-cycle-execute.md +498 -0
  178. package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +699 -0
  179. package/.claude/skills/command-guide/reference/commands/workflow/test-gen.md +529 -0
  180. package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +680 -0
  181. package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -0
  182. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +151 -0
  183. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +518 -0
  184. package/.claude/skills/command-guide/reference/commands/workflow/tools/tdd-coverage-analysis.md +309 -0
  185. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +163 -0
  186. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-context-gather.md +235 -0
  187. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +256 -0
  188. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/animation-extract.md +1150 -0
  189. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/codify-style.md +652 -0
  190. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/design-sync.md +454 -0
  191. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/explore-auto.md +678 -0
  192. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +504 -0
  193. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/imitate-auto.md +745 -0
  194. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +537 -0
  195. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/layout-extract.md +788 -0
  196. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/reference-page-generator.md +356 -0
  197. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/style-extract.md +773 -0
  198. package/.claude/skills/command-guide/scripts/analyze_commands.py +502 -0
  199. package/.claude/skills/command-guide/scripts/update-index.sh +130 -0
  200. package/.claude/skills/command-guide/templates/issue-bug.md +104 -0
  201. package/.claude/skills/command-guide/templates/issue-diagnosis.md +275 -0
  202. package/.claude/skills/command-guide/templates/issue-feature.md +97 -0
  203. package/.claude/skills/command-guide/templates/issue-question.md +141 -0
  204. package/.claude/skills/prompt-enhancer/SKILL.md +124 -0
  205. package/.claude/workflows/_template-compare-matrix.html +692 -0
  206. package/.claude/workflows/cli-templates/fix-plan-template.json +75 -0
  207. package/.claude/workflows/cli-templates/fix-progress-template.json +48 -0
  208. package/.claude/workflows/cli-templates/memory/style-skill-memory/skill-md-template.md +299 -0
  209. package/.claude/workflows/cli-templates/planning-roles/data-architect.md +120 -0
  210. package/.claude/workflows/cli-templates/planning-roles/product-manager.md +119 -0
  211. package/.claude/workflows/cli-templates/planning-roles/product-owner.md +261 -0
  212. package/.claude/workflows/cli-templates/planning-roles/scrum-master.md +186 -0
  213. package/.claude/workflows/cli-templates/planning-roles/subject-matter-expert.md +281 -0
  214. package/.claude/workflows/cli-templates/planning-roles/synthesis-role.md +414 -0
  215. package/.claude/workflows/cli-templates/planning-roles/system-architect.md +106 -0
  216. package/.claude/workflows/cli-templates/planning-roles/test-strategist.md +124 -0
  217. package/.claude/workflows/cli-templates/planning-roles/ui-designer.md +379 -0
  218. package/.claude/workflows/cli-templates/planning-roles/ux-expert.md +240 -0
  219. package/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt +127 -0
  220. package/.claude/workflows/cli-templates/prompts/analysis/01-trace-code-execution.txt +115 -0
  221. package/.claude/workflows/cli-templates/prompts/analysis/02-analyze-code-patterns.txt +37 -0
  222. package/.claude/workflows/cli-templates/prompts/analysis/02-analyze-technical-document.txt +33 -0
  223. package/.claude/workflows/cli-templates/prompts/analysis/02-review-architecture.txt +29 -0
  224. package/.claude/workflows/cli-templates/prompts/analysis/02-review-code-quality.txt +28 -0
  225. package/.claude/workflows/cli-templates/prompts/analysis/03-analyze-performance.txt +29 -0
  226. package/.claude/workflows/cli-templates/prompts/analysis/03-assess-security-risks.txt +29 -0
  227. package/.claude/workflows/cli-templates/prompts/analysis/03-review-quality-standards.txt +29 -0
  228. package/.claude/workflows/cli-templates/prompts/development/02-generate-tests.txt +70 -0
  229. package/.claude/workflows/cli-templates/prompts/development/02-implement-component-ui.txt +55 -0
  230. package/.claude/workflows/cli-templates/prompts/development/02-implement-feature.txt +58 -0
  231. package/.claude/workflows/cli-templates/prompts/development/02-refactor-codebase.txt +55 -0
  232. package/.claude/workflows/cli-templates/prompts/development/03-debug-runtime-issues.txt +55 -0
  233. package/.claude/workflows/cli-templates/prompts/documentation/api.txt +15 -0
  234. package/.claude/workflows/cli-templates/prompts/documentation/folder-navigation.txt +27 -0
  235. package/.claude/workflows/cli-templates/prompts/documentation/module-readme.txt +49 -0
  236. package/.claude/workflows/cli-templates/prompts/documentation/project-architecture.txt +41 -0
  237. package/.claude/workflows/cli-templates/prompts/documentation/project-examples.txt +35 -0
  238. package/.claude/workflows/cli-templates/prompts/documentation/project-readme.txt +35 -0
  239. package/.claude/workflows/cli-templates/prompts/memory/02-document-module-structure.txt +165 -0
  240. package/.claude/workflows/cli-templates/prompts/planning/01-plan-architecture-design.txt +109 -0
  241. package/.claude/workflows/cli-templates/prompts/planning/02-breakdown-task-steps.txt +30 -0
  242. package/.claude/workflows/cli-templates/prompts/planning/02-design-component-spec.txt +28 -0
  243. package/.claude/workflows/cli-templates/prompts/planning/03-evaluate-concept-feasibility.txt +127 -0
  244. package/.claude/workflows/cli-templates/prompts/planning/03-plan-migration-strategy.txt +30 -0
  245. package/.claude/workflows/cli-templates/prompts/tech/tech-module-format.txt +359 -0
  246. package/.claude/workflows/cli-templates/prompts/tech/tech-skill-index.txt +185 -0
  247. package/.claude/workflows/cli-templates/prompts/test/test-concept-analysis.txt +179 -0
  248. package/.claude/workflows/cli-templates/prompts/universal/00-universal-creative-style.txt +95 -0
  249. package/.claude/workflows/cli-templates/prompts/universal/00-universal-rigorous-style.txt +92 -0
  250. package/.claude/workflows/cli-templates/prompts/verification/codex-technical.txt +28 -0
  251. package/.claude/workflows/cli-templates/prompts/verification/cross-validation.txt +28 -0
  252. package/.claude/workflows/cli-templates/prompts/verification/gemini-strategic.txt +27 -0
  253. package/.claude/workflows/cli-templates/prompts/workflow/analysis-results-structure.txt +224 -0
  254. package/.claude/workflows/cli-templates/prompts/workflow/codex-feasibility-validation.txt +176 -0
  255. package/.claude/workflows/cli-templates/prompts/workflow/gemini-solution-design.txt +131 -0
  256. package/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt +286 -0
  257. package/.claude/workflows/cli-templates/prompts/workflow/skill-aggregation.txt +172 -0
  258. package/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt +98 -0
  259. package/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt +224 -0
  260. package/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt +98 -0
  261. package/.claude/workflows/cli-templates/prompts/workflow/skill-sessions-timeline.txt +53 -0
  262. package/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt +123 -0
  263. package/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt +182 -0
  264. package/.claude/workflows/cli-templates/schemas/diagnosis-json-schema.json +234 -0
  265. package/.claude/workflows/cli-templates/schemas/explore-json-schema.json +124 -0
  266. package/.claude/workflows/cli-templates/schemas/fix-plan-json-schema.json +273 -0
  267. package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +219 -0
  268. package/.claude/workflows/cli-templates/schemas/project-json-schema.json +221 -0
  269. package/.claude/workflows/cli-templates/schemas/review-deep-dive-results-schema.json +82 -0
  270. package/.claude/workflows/cli-templates/schemas/review-dimension-results-schema.json +51 -0
  271. package/.claude/workflows/cli-templates/tech-stacks/go-dev.md +91 -0
  272. package/.claude/workflows/cli-templates/tech-stacks/java-dev.md +107 -0
  273. package/.claude/workflows/cli-templates/tech-stacks/javascript-dev.md +58 -0
  274. package/.claude/workflows/cli-templates/tech-stacks/python-dev.md +79 -0
  275. package/.claude/workflows/cli-templates/tech-stacks/react-dev.md +103 -0
  276. package/.claude/workflows/cli-templates/tech-stacks/typescript-dev.md +83 -0
  277. package/.claude/workflows/cli-templates/ui-design/systems/animation-tokens.json +247 -0
  278. package/.claude/workflows/cli-templates/ui-design/systems/design-tokens.json +342 -0
  279. package/.claude/workflows/cli-templates/ui-design/systems/layout-templates.json +145 -0
  280. package/.claude/workflows/context-search-strategy.md +77 -0
  281. package/.claude/workflows/intelligent-tools-strategy.md +662 -0
  282. package/.claude/workflows/review-directory-specification.md +336 -0
  283. package/.claude/workflows/task-core.md +214 -0
  284. package/.claude/workflows/tool-strategy.md +71 -0
  285. package/.claude/workflows/workflow-architecture.md +942 -0
  286. package/.codex/AGENTS.md +330 -0
  287. package/.gemini/GEMINI.md +164 -0
  288. package/.qwen/QWEN.md +164 -0
  289. package/CLAUDE.md +91 -0
  290. package/LICENSE +21 -0
  291. package/README.md +219 -0
  292. package/ccw/README.md +121 -0
  293. package/ccw/bin/ccw.js +10 -0
  294. package/ccw/src/cli.js +100 -0
  295. package/ccw/src/commands/install.js +324 -0
  296. package/ccw/src/commands/list.js +37 -0
  297. package/ccw/src/commands/serve.js +67 -0
  298. package/ccw/src/commands/uninstall.js +238 -0
  299. package/ccw/src/commands/upgrade.js +307 -0
  300. package/ccw/src/commands/view.js +14 -0
  301. package/ccw/src/core/dashboard-generator-patch.js +29 -0
  302. package/ccw/src/core/dashboard-generator.js +667 -0
  303. package/ccw/src/core/data-aggregator.js +409 -0
  304. package/ccw/src/core/lite-scanner.js +290 -0
  305. package/ccw/src/core/manifest.js +201 -0
  306. package/ccw/src/core/server.js +1327 -0
  307. package/ccw/src/core/server.js.bak +385 -0
  308. package/ccw/src/core/server_original.bak +385 -0
  309. package/ccw/src/core/session-scanner.js +235 -0
  310. package/ccw/src/index.js +9 -0
  311. package/ccw/src/templates/dashboard-js/api.js +200 -0
  312. package/ccw/src/templates/dashboard-js/components/_conflict_tab.js +112 -0
  313. package/ccw/src/templates/dashboard-js/components/_exp_helpers.js +54 -0
  314. package/ccw/src/templates/dashboard-js/components/_review_tab.js +640 -0
  315. package/ccw/src/templates/dashboard-js/components/carousel.js +398 -0
  316. package/ccw/src/templates/dashboard-js/components/flowchart.js +493 -0
  317. package/ccw/src/templates/dashboard-js/components/hook-manager.js +273 -0
  318. package/ccw/src/templates/dashboard-js/components/mcp-manager.js +506 -0
  319. package/ccw/src/templates/dashboard-js/components/modals.js +260 -0
  320. package/ccw/src/templates/dashboard-js/components/navigation.js +239 -0
  321. package/ccw/src/templates/dashboard-js/components/notifications.js +194 -0
  322. package/ccw/src/templates/dashboard-js/components/sidebar.js +31 -0
  323. package/ccw/src/templates/dashboard-js/components/tabs-context.js +1093 -0
  324. package/ccw/src/templates/dashboard-js/components/tabs-other.js +273 -0
  325. package/ccw/src/templates/dashboard-js/components/task-drawer-core.js +477 -0
  326. package/ccw/src/templates/dashboard-js/components/task-drawer-renderers.js +447 -0
  327. package/ccw/src/templates/dashboard-js/components/theme.js +21 -0
  328. package/ccw/src/templates/dashboard-js/main.js +57 -0
  329. package/ccw/src/templates/dashboard-js/state.js +37 -0
  330. package/ccw/src/templates/dashboard-js/utils.js +153 -0
  331. package/ccw/src/templates/dashboard-js/views/fix-session.js +180 -0
  332. package/ccw/src/templates/dashboard-js/views/home.js +193 -0
  333. package/ccw/src/templates/dashboard-js/views/hook-manager.js +387 -0
  334. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +390 -0
  335. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +271 -0
  336. package/ccw/src/templates/dashboard-js/views/project-overview.js +246 -0
  337. package/ccw/src/templates/dashboard-js/views/review-session.js +711 -0
  338. package/ccw/src/templates/dashboard-js/views/session-detail.js +770 -0
  339. package/ccw/src/templates/dashboard.css +7660 -0
  340. package/ccw/src/templates/dashboard.html +630 -0
  341. package/ccw/src/templates/dashboard_tailwind.html +42 -0
  342. package/ccw/src/templates/dashboard_test.html +37 -0
  343. package/ccw/src/templates/review-cycle-dashboard.html +1930 -0
  344. package/ccw/src/templates/tailwind-base.css +212 -0
  345. package/ccw/src/templates/workflow-dashboard.html +401 -0
  346. package/ccw/src/utils/browser-launcher.js +49 -0
  347. package/ccw/src/utils/file-utils.js +48 -0
  348. package/ccw/src/utils/path-resolver.js +279 -0
  349. package/ccw/src/utils/ui.js +148 -0
  350. package/package.json +66 -0
@@ -0,0 +1,1930 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="light">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Code Review Dashboard - {{SESSION_ID}}</title>
7
+ <!-- Google Fonts: Inter -->
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
11
+ <!-- Tailwind CSS CDN -->
12
+ <script src="https://cdn.tailwindcss.com"></script>
13
+ <script>
14
+ tailwind.config = {
15
+ darkMode: ['class', '[data-theme="dark"]'],
16
+ safelist: [
17
+ 'bg-card', 'bg-background', 'bg-hover', 'bg-accent', 'bg-muted', 'bg-primary', 'bg-success', 'bg-warning',
18
+ 'bg-success-light', 'bg-warning-light', 'bg-red-100', 'bg-orange-100', 'bg-blue-100', 'bg-gray-100',
19
+ 'text-foreground', 'text-muted-foreground', 'text-primary', 'text-success', 'text-warning',
20
+ 'text-red-700', 'text-orange-700', 'text-blue-700', 'text-gray-700', 'text-primary-foreground',
21
+ 'border', 'border-border', 'border-l-4', 'rounded', 'rounded-lg', 'rounded-full',
22
+ 'shadow', 'shadow-sm', 'shadow-md', 'p-2', 'p-3', 'p-4', 'p-5', 'px-3', 'px-4', 'py-2',
23
+ 'mb-2', 'mb-4', 'mt-4', 'gap-2', 'gap-4', 'space-y-2', 'space-y-4',
24
+ 'flex', 'flex-1', 'flex-col', 'flex-wrap', 'items-center', 'justify-between', 'justify-center',
25
+ 'grid', 'w-full', 'text-xs', 'text-sm', 'text-lg', 'text-xl', 'text-2xl',
26
+ 'font-medium', 'font-semibold', 'font-bold', 'font-mono', 'truncate',
27
+ 'hover:shadow-md', 'hover:bg-hover', 'transition-all', 'duration-200', 'cursor-pointer',
28
+ 'hidden', 'block', 'relative', 'fixed', 'z-50', 'overflow-hidden', 'min-h-screen', 'max-w-6xl', 'mx-auto',
29
+ ],
30
+ theme: {
31
+ extend: {
32
+ colors: {
33
+ background: 'hsl(var(--background))',
34
+ foreground: 'hsl(var(--foreground))',
35
+ card: 'hsl(var(--card))',
36
+ 'card-foreground': 'hsl(var(--card-foreground))',
37
+ border: 'hsl(var(--border))',
38
+ input: 'hsl(var(--input))',
39
+ ring: 'hsl(var(--ring))',
40
+ primary: 'hsl(var(--primary))',
41
+ 'primary-foreground': 'hsl(var(--primary-foreground))',
42
+ secondary: 'hsl(var(--secondary))',
43
+ 'secondary-foreground': 'hsl(var(--secondary-foreground))',
44
+ accent: 'hsl(var(--accent))',
45
+ 'accent-foreground': 'hsl(var(--accent-foreground))',
46
+ destructive: 'hsl(var(--destructive))',
47
+ 'destructive-foreground': 'hsl(var(--destructive-foreground))',
48
+ muted: 'hsl(var(--muted))',
49
+ 'muted-foreground': 'hsl(var(--muted-foreground))',
50
+ hover: 'hsl(var(--hover))',
51
+ success: 'hsl(var(--success))',
52
+ 'success-light': 'hsl(var(--success-light))',
53
+ warning: 'hsl(var(--warning))',
54
+ 'warning-light': 'hsl(var(--warning-light))',
55
+ },
56
+ fontFamily: {
57
+ sans: ['Inter', 'system-ui', '-apple-system', 'sans-serif'],
58
+ mono: ['Consolas', 'Monaco', 'Courier New', 'monospace'],
59
+ },
60
+ boxShadow: {
61
+ 'sm': '0 1px 2px 0 rgb(0 0 0 / 0.05)',
62
+ 'DEFAULT': '0 2px 8px rgb(0 0 0 / 0.08)',
63
+ 'md': '0 4px 12px rgb(0 0 0 / 0.1)',
64
+ 'lg': '0 8px 24px rgb(0 0 0 / 0.12)',
65
+ },
66
+ },
67
+ },
68
+ }
69
+ </script>
70
+ <style>
71
+ /* CSS Custom Properties - Light Mode */
72
+ :root {
73
+ --background: 0 0% 98%;
74
+ --foreground: 0 0% 13%;
75
+ --card: 0 0% 100%;
76
+ --card-foreground: 0 0% 13%;
77
+ --border: 0 0% 90%;
78
+ --input: 0 0% 90%;
79
+ --ring: 220 65% 50%;
80
+ --primary: 220 65% 50%;
81
+ --primary-foreground: 0 0% 100%;
82
+ --secondary: 220 60% 65%;
83
+ --secondary-foreground: 0 0% 100%;
84
+ --accent: 220 40% 95%;
85
+ --accent-foreground: 0 0% 13%;
86
+ --destructive: 8 75% 55%;
87
+ --destructive-foreground: 0 0% 100%;
88
+ --muted: 0 0% 96%;
89
+ --muted-foreground: 0 0% 45%;
90
+ --hover: 0 0% 93%;
91
+ --success: 142 71% 45%;
92
+ --success-light: 142 76% 90%;
93
+ --warning: 38 92% 50%;
94
+ --warning-light: 48 96% 89%;
95
+ }
96
+
97
+ /* Dark Mode */
98
+ [data-theme="dark"] {
99
+ --background: 220 13% 10%;
100
+ --foreground: 0 0% 90%;
101
+ --card: 220 13% 14%;
102
+ --card-foreground: 0 0% 90%;
103
+ --border: 220 13% 20%;
104
+ --input: 220 13% 20%;
105
+ --ring: 220 65% 55%;
106
+ --primary: 220 65% 55%;
107
+ --primary-foreground: 0 0% 100%;
108
+ --secondary: 220 60% 60%;
109
+ --secondary-foreground: 0 0% 100%;
110
+ --accent: 220 30% 20%;
111
+ --accent-foreground: 0 0% 90%;
112
+ --destructive: 8 70% 50%;
113
+ --destructive-foreground: 0 0% 100%;
114
+ --muted: 220 13% 18%;
115
+ --muted-foreground: 0 0% 55%;
116
+ --hover: 220 13% 22%;
117
+ --success: 142 71% 40%;
118
+ --success-light: 142 50% 20%;
119
+ --warning: 38 85% 45%;
120
+ --warning-light: 40 50% 20%;
121
+ }
122
+
123
+ /* Scrollbar styling */
124
+ ::-webkit-scrollbar { width: 6px; height: 6px; }
125
+ ::-webkit-scrollbar-track { background: transparent; }
126
+ ::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 3px; }
127
+ ::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground)); }
128
+
129
+ /* Animations */
130
+ @keyframes pulse {
131
+ 0%, 100% { opacity: 1; }
132
+ 50% { opacity: 0.6; }
133
+ }
134
+
135
+ @keyframes spin {
136
+ to { transform: rotate(360deg); }
137
+ }
138
+
139
+ .pulse { animation: pulse 2s ease-in-out infinite; }
140
+ .spin { animation: spin 1s linear infinite; }
141
+
142
+ /* History drawer */
143
+ .history-drawer {
144
+ transform: translateX(100%);
145
+ transition: transform 0.3s ease;
146
+ }
147
+ .history-drawer.active {
148
+ transform: translateX(0);
149
+ }
150
+
151
+ /* Detail drawer */
152
+ .drawer {
153
+ transform: translateX(100%);
154
+ transition: transform 0.3s ease;
155
+ }
156
+ .drawer.open {
157
+ transform: translateX(0);
158
+ }
159
+ </style>
160
+
161
+ /* JavaScript-generated element styles */
162
+
163
+ /* Finding items */
164
+ .finding-item {
165
+ padding: 1rem;
166
+ background-color: hsl(var(--card));
167
+ border-left: 4px solid;
168
+ border-radius: 0.5rem;
169
+ cursor: pointer;
170
+ transition: all 0.2s;
171
+ }
172
+ .finding-item:hover {
173
+ box-shadow: 0 4px 12px rgb(0 0 0 / 0.1);
174
+ }
175
+ .finding-item.critical { border-left-color: #ef4444; background-color: #fef2f2; }
176
+ .finding-item.high { border-left-color: #f97316; background-color: #fff7ed; }
177
+ .finding-item.medium { border-left-color: #3b82f6; background-color: #eff6ff; }
178
+ .finding-item.low { border-left-color: #6b7280; background-color: #f9fafb; }
179
+ [data-theme="dark"] .finding-item.critical { background-color: rgba(127, 29, 29, 0.1); }
180
+ [data-theme="dark"] .finding-item.high { background-color: rgba(154, 52, 18, 0.1); }
181
+ [data-theme="dark"] .finding-item.medium { background-color: rgba(30, 58, 138, 0.1); }
182
+ [data-theme="dark"] .finding-item.low { background-color: rgba(55, 65, 81, 0.1); }
183
+
184
+ /* Severity badges */
185
+ .severity-badge {
186
+ display: inline-block;
187
+ padding: 0.25rem 0.5rem;
188
+ font-size: 0.75rem;
189
+ font-weight: 600;
190
+ border-radius: 0.25rem;
191
+ text-transform: uppercase;
192
+ }
193
+ .severity-badge.critical { background-color: #fee2e2; color: #b91c1c; }
194
+ .severity-badge.high { background-color: #ffedd5; color: #c2410c; }
195
+ .severity-badge.medium { background-color: #dbeafe; color: #1e40af; }
196
+ .severity-badge.low { background-color: #f3f4f6; color: #374151; }
197
+ [data-theme="dark"] .severity-badge.critical { background-color: rgba(127, 29, 29, 0.3); color: #fca5a5; }
198
+ [data-theme="dark"] .severity-badge.high { background-color: rgba(154, 52, 18, 0.3); color: #fb923c; }
199
+ [data-theme="dark"] .severity-badge.medium { background-color: rgba(30, 58, 138, 0.3); color: #60a5fa; }
200
+ [data-theme="dark"] .severity-badge.low { background-color: rgba(55, 65, 81, 0.5); color: #9ca3af; }
201
+
202
+ /* Dimension badge */
203
+ .dimension-badge {
204
+ display: inline-block;
205
+ padding: 0.25rem 0.5rem;
206
+ font-size: 0.75rem;
207
+ font-weight: 500;
208
+ border-radius: 0.25rem;
209
+ background-color: hsl(var(--muted));
210
+ color: hsl(var(--muted-foreground));
211
+ }
212
+
213
+ /* Finding details */
214
+ .finding-title { font-size: 1rem; font-weight: 600; color: hsl(var(--foreground)); margin-bottom: 0.25rem; }
215
+ .finding-file { font-size: 0.875rem; color: hsl(var(--muted-foreground)); margin-bottom: 0.5rem; }
216
+ .finding-description { font-size: 0.875rem; color: hsl(var(--foreground)); line-height: 1.6; }
217
+ .finding-badges { display: flex; gap: 0.5rem; }
218
+ .finding-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.5rem; }
219
+ .finding-checkbox { width: 20px; height: 20px; cursor: pointer; accent-color: hsl(var(--primary)); }
220
+
221
+ /* Drawer sections */
222
+ .drawer-section { margin-bottom: 1.5rem; }
223
+ .drawer-section:last-child { margin-bottom: 0; }
224
+ .drawer-section-title { font-size: 0.875rem; font-weight: 600; color: hsl(var(--foreground)); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
225
+
226
+ /* Other dynamically generated elements */
227
+ .code-snippet { padding: 0.75rem; background-color: hsl(var(--muted)); border-radius: 0.375rem; font-size: 0.875rem; font-family: Consolas, Monaco, 'Courier New', monospace; overflow-x: auto; }
228
+ .recommendation-box { padding: 1rem; background-color: hsl(var(--success-light)); border-radius: 0.5rem; font-size: 0.875rem; line-height: 1.6; }
229
+ .metadata-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
230
+ .metadata-item { display: flex; flex-direction: column; gap: 0.25rem; }
231
+ .metadata-label { font-size: 0.75rem; font-weight: 500; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.05em; }
232
+ .metadata-value { font-size: 0.875rem; color: hsl(var(--foreground)); }
233
+ .reference-list { list-style: disc; padding-left: 1.25rem; }
234
+ .reference-list li { font-size: 0.875rem; color: hsl(var(--foreground)); margin-bottom: 0.25rem; }
235
+ .reference-list a { color: hsl(var(--primary)); text-decoration: none; }
236
+ .reference-list a:hover { text-decoration: underline; }
237
+
238
+ /* Fix status badges */
239
+ .fix-status-badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; margin-top: 0.5rem; }
240
+ .fix-status-badge.status-pending { background-color: transparent; color: hsl(var(--muted-foreground)); border: 1px solid hsl(var(--border)); }
241
+ .fix-status-badge.status-in-progress { background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
242
+ .fix-status-badge.status-fixed { background-color: hsl(var(--success)); color: white; }
243
+ .fix-status-badge.status-failed { background-color: hsl(var(--destructive)); color: white; }
244
+
245
+ /* Dimension table */
246
+ .dimension-name { display: flex; align-items: center; gap: 0.5rem; }
247
+ .dimension-icon { font-size: 1.125rem; }
248
+ .count-badge { display: inline-block; padding: 0.25rem 0.5rem; font-size: 0.75rem; font-weight: 600; border-radius: 0.25rem; }
249
+ .count-badge.critical { background-color: #fee2e2; color: #b91c1c; }
250
+ .count-badge.high { background-color: #ffedd5; color: #c2410c; }
251
+ .count-badge.medium { background-color: #dbeafe; color: #1e40af; }
252
+ .count-badge.low { background-color: #f3f4f6; color: #374151; }
253
+ .count-badge.total { background-color: rgba(59, 130, 246, 0.1); color: hsl(var(--primary)); font-weight: 700; }
254
+ .count-badge.zero { opacity: 0.5; }
255
+ [data-theme="dark"] .count-badge.critical { background-color: rgba(127, 29, 29, 0.3); color: #fca5a5; }
256
+ [data-theme="dark"] .count-badge.high { background-color: rgba(154, 52, 18, 0.3); color: #fb923c; }
257
+ [data-theme="dark"] .count-badge.medium { background-color: rgba(30, 58, 138, 0.3); color: #60a5fa; }
258
+ [data-theme="dark"] .count-badge.low { background-color: rgba(55, 65, 81, 0.5); color: #9ca3af; }
259
+ .status-indicator { display: inline-flex; align-items: center; justify-center; width: 1.5rem; height: 1.5rem; border-radius: 9999px; font-size: 0.875rem; }
260
+ .status-indicator.reviewed { background-color: rgba(34, 197, 94, 0.2); color: hsl(var(--success)); }
261
+ .status-indicator.pending { background-color: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
262
+
263
+ /* Active group/agent cards */
264
+ .active-group-card { background-color: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 0.5rem; padding: 1rem; }
265
+ .group-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
266
+ .group-id { font-size: 0.875rem; font-weight: 600; color: hsl(var(--foreground)); }
267
+ .group-status { font-size: 0.75rem; padding: 0.25rem 0.5rem; border-radius: 9999px; background-color: rgba(59, 130, 246, 0.1); color: hsl(var(--primary)); font-weight: 500; }
268
+ .group-findings { font-size: 0.875rem; color: hsl(var(--muted-foreground)); }
269
+ .group-active-items { margin-top: 0.5rem; padding: 0.5rem; background-color: rgba(59, 130, 246, 0.1); border-left: 4px solid hsl(var(--primary)); border-radius: 0.25rem; font-size: 0.875rem; color: hsl(var(--foreground)); }
270
+ .active-agent-item { padding: 0.75rem; background-color: hsl(var(--muted)); border-radius: 0.5rem; margin-bottom: 0.5rem; }
271
+ .agent-status { font-size: 0.875rem; font-weight: 500; color: hsl(var(--foreground)); }
272
+ .agent-status-badge { display: inline-block; padding: 0.125rem 0.5rem; margin-left: 0.5rem; font-size: 0.75rem; background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-radius: 9999px; font-weight: 500; }
273
+ .agent-task { font-size: 0.875rem; color: hsl(var(--foreground)); margin-top: 0.25rem; }
274
+ .agent-file { font-size: 0.75rem; color: hsl(var(--muted-foreground)); margin-top: 0.25rem; }
275
+
276
+ /* Flow control & stages */
277
+ .flow-control-container { margin-top: 0.75rem; padding: 0.625rem; background-color: rgba(139, 92, 246, 0.05); border-radius: 0.5rem; border: 1px solid rgba(139, 92, 246, 0.2); }
278
+ .flow-control-header { font-size: 0.75rem; font-weight: 600; color: hsl(var(--muted-foreground)); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
279
+ .flow-steps { display: flex; flex-direction: column; gap: 0.375rem; }
280
+ .flow-step { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.625rem; border-radius: 0.25rem; font-size: 0.875rem; transition: all 0.2s; }
281
+ .flow-step-completed { background-color: rgba(34, 197, 94, 0.1); color: #22c55e; }
282
+ .flow-step-in-progress { background-color: rgba(59, 130, 246, 0.1); color: hsl(var(--primary)); }
283
+ .flow-step-failed { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }
284
+ .flow-step-pending { background-color: rgba(156, 163, 175, 0.1); color: hsl(var(--muted-foreground)); }
285
+ .flow-step-icon { font-size: 1rem; }
286
+ .flow-step-name { font-weight: 500; }
287
+ .stage-item { flex: 1; min-width: 150px; padding: 0.75rem; background-color: hsl(var(--card)); border-radius: 0.375rem; border: 2px solid; text-align: center; transition: all 0.3s; }
288
+ .stage-item.pending { opacity: 0.6; border-color: hsl(var(--border)); }
289
+ .stage-item.in-progress { border-color: hsl(var(--primary)); box-shadow: 0 0 10px rgba(59, 130, 246, 0.3); }
290
+ .stage-item.completed { border-color: hsl(var(--success)); background-color: rgba(34, 197, 94, 0.05); }
291
+ .stage-number { font-size: 0.875rem; font-weight: 600; color: hsl(var(--muted-foreground)); margin-bottom: 0.25rem; }
292
+ .stage-mode { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
293
+ .stage-groups { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
294
+
295
+ /* Phase & status badges */
296
+ .phase-badge { padding: 0.25rem 0.75rem; font-size: 0.75rem; font-weight: 600; border-radius: 9999px; text-transform: uppercase; }
297
+ .phase-badge.phase-planning { background-color: hsl(var(--warning)); color: white; }
298
+ .phase-badge.phase-execution { background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
299
+ .phase-badge.phase-completion { background-color: hsl(var(--success)); color: white; }
300
+ .phase-badge.phase-parallel { background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
301
+ .phase-badge.phase-iterate { background-color: hsl(var(--warning)); color: white; }
302
+ .phase-badge.phase-aggregate { background-color: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
303
+ .phase-badge.phase-complete { background-color: hsl(var(--success)); color: white; }
304
+
305
+ /* History items */
306
+ .history-item { padding: 1rem; background-color: hsl(var(--muted)); border-radius: 0.5rem; margin-bottom: 1rem; border-left: 4px solid hsl(var(--primary)); }
307
+ .history-item.status-fixed { border-left-color: hsl(var(--success)); }
308
+ .history-item.status-failed { border-left-color: hsl(var(--destructive)); }
309
+ .history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
310
+ .history-status { font-weight: 600; color: hsl(var(--foreground)); }
311
+ .history-time { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
312
+ .history-details { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; }
313
+
314
+ /* Empty state */
315
+ .empty-state { text-center: center; padding: 3rem 0; }
316
+ .empty-state-icon { font-size: 4rem; margin-bottom: 1rem; }
317
+
318
+ /* Tab active state */
319
+ .tab { padding: 0.5rem 1rem; border-radius: 0.5rem; font-weight: 500; font-size: 0.875rem; white-space: nowrap; transition: all 0.2s; border: 1px solid hsl(var(--border)); background-color: hsl(var(--card)); cursor: pointer; }
320
+ .tab:hover { background-color: hsl(var(--hover)); }
321
+ .tab.active { background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); }
322
+
323
+ /* Drawer overlay states */
324
+ #drawerOverlay.show, #historyDrawerOverlay.active { display: block !important; }
325
+ </head>
326
+ <body class="font-sans bg-background text-foreground leading-normal">
327
+ <div class="max-w-[1600px] mx-auto p-5">
328
+ <!-- Header -->
329
+ <header class="bg-card shadow rounded-lg p-5 mb-8">
330
+ <div class="flex items-center justify-between mb-4">
331
+ <h1 class="text-3xl font-bold text-primary flex items-center gap-2">
332
+ <span>🔍</span>
333
+ <span>Code Review Dashboard</span>
334
+ </h1>
335
+ <button class="p-2 text-xl hover:bg-hover rounded transition-colors" id="themeToggle" title="Toggle theme">🌙</button>
336
+ </div>
337
+
338
+ <div class="flex gap-5 flex-wrap items-center text-sm text-muted-foreground mb-4">
339
+ <span>📋 Session: <strong class="text-foreground" id="sessionId">Loading...</strong></span>
340
+ <span>🆔 Review ID: <strong class="text-foreground" id="reviewId">Loading...</strong></span>
341
+ <span>🕒 Last Updated: <strong class="text-foreground" id="lastUpdate">Loading...</strong></span>
342
+ </div>
343
+
344
+ <div class="flex gap-4 flex-wrap items-center">
345
+ <div class="flex-1 min-w-[250px] relative">
346
+ <input type="text" id="searchInput" placeholder="🔍 Search findings..."
347
+ class="w-full px-4 py-2.5 border border-border rounded-lg bg-background text-foreground text-sm focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all">
348
+ </div>
349
+
350
+ <div class="flex gap-2.5 items-center">
351
+ <span class="text-sm text-muted-foreground font-medium" id="selectionCounter">0 findings selected</span>
352
+ <button class="px-3 py-1.5 text-xs border border-border rounded-lg bg-card text-foreground hover:bg-hover transition-all" onclick="selectAll()">Select All</button>
353
+ <button class="px-3 py-1.5 text-xs border border-border rounded-lg bg-card text-foreground hover:bg-hover transition-all" onclick="deselectAll()">Deselect All</button>
354
+ </div>
355
+
356
+ <button class="px-5 py-2.5 border border-border rounded-lg bg-card text-foreground font-medium text-sm hover:bg-hover hover:shadow transition-all" onclick="exportToMarkdown()">đŸ“Ĩ Export Report</button>
357
+ <button class="px-5 py-2.5 rounded-lg bg-success text-white font-medium text-sm hover:bg-success/90 transition-all disabled:opacity-50 disabled:cursor-not-allowed" id="exportFixBtn" onclick="exportSelectedFindings()" disabled>🔧 Export Selected for Fixing</button>
358
+ </div>
359
+ </header>
360
+
361
+ <!-- Fix Progress Section -->
362
+ <div class="hidden bg-card rounded-lg shadow p-5 mb-5" id="fixProgressSection">
363
+ <div class="flex justify-between items-center mb-4">
364
+ <h3 class="text-lg font-semibold text-foreground">Fix Progress</h3>
365
+ <div class="flex items-center gap-2.5">
366
+ <span class="px-3 py-1 text-xs font-semibold rounded-full bg-primary text-primary-foreground uppercase" id="fixPhaseBadge">PLANNING</span>
367
+ <button class="px-3 py-1.5 text-xs border border-border rounded-lg bg-card text-foreground hover:bg-hover transition-all" onclick="toggleFixProgress()">Collapse</button>
368
+ <button class="px-3 py-1.5 text-xs border border-border rounded-lg bg-card text-foreground hover:bg-hover transition-all" onclick="openHistoryDrawer()">📜 View Fix History</button>
369
+ </div>
370
+ </div>
371
+
372
+ <!-- Planning Phase Indicator -->
373
+ <div id="planningPhase" class="hidden text-center py-5">
374
+ <div class="text-4xl mb-2.5">🤖</div>
375
+ <div class="text-lg font-semibold mb-1.5">Planning Fixes</div>
376
+ <div class="text-muted-foreground">AI is analyzing findings and generating fix plan...</div>
377
+ </div>
378
+
379
+ <!-- Stage Timeline -->
380
+ <div id="stageTimeline" class="hidden flex gap-2.5 my-5 p-4 bg-muted rounded-lg overflow-x-auto">
381
+ <!-- Stages populated by JavaScript -->
382
+ </div>
383
+
384
+ <!-- Execution Phase UI -->
385
+ <div id="executionPhase" class="hidden">
386
+ <!-- Progress Bar -->
387
+ <div class="h-2 bg-muted rounded overflow-hidden mb-4">
388
+ <div class="h-full bg-success transition-all duration-300" id="fixProgressFill" style="width: 0%"></div>
389
+ </div>
390
+ <div class="text-center text-sm text-muted-foreground mt-2.5">
391
+ <span id="fixProgressText">No active fix session</span>
392
+ </div>
393
+
394
+ <!-- Active Groups -->
395
+ <div id="activeGroupsList" class="grid grid-cols-[repeat(auto-fit,minmax(300px,1fr))] gap-4 my-5">
396
+ <!-- Active groups populated by JavaScript -->
397
+ </div>
398
+
399
+ <!-- Active Agents -->
400
+ <div id="activeAgentsList" class="mt-4 border-t border-border pt-4">
401
+ <!-- Active agents populated by JavaScript -->
402
+ </div>
403
+ </div>
404
+ </div>
405
+
406
+ <!-- Progress Section -->
407
+ <div class="bg-card rounded-lg shadow p-5 mb-5">
408
+ <div class="flex justify-between items-center mb-4">
409
+ <h3 class="text-lg font-semibold text-foreground">Review Progress</h3>
410
+ <span class="px-3 py-1 text-xs font-semibold rounded-full bg-primary text-primary-foreground uppercase" id="phaseBadge">LOADING</span>
411
+ </div>
412
+
413
+ <div class="h-2 bg-muted rounded overflow-hidden mb-4">
414
+ <div class="h-full bg-primary transition-all duration-300" id="progressFill" style="width: 0%"></div>
415
+ </div>
416
+
417
+ <div class="text-center text-sm text-muted-foreground">
418
+ <span id="progressText">Initializing...</span>
419
+ </div>
420
+ </div>
421
+
422
+ <!-- Severity Summary Cards -->
423
+ <div class="grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4 mb-5">
424
+ <div class="text-center p-5 bg-red-100 dark:bg-red-900/20 rounded-lg cursor-pointer hover:shadow-md transition-all" onclick="filterBySeverity('critical')">
425
+ <div class="text-3xl mb-2">🔴</div>
426
+ <div class="text-3xl font-bold text-red-700 dark:text-red-400" id="criticalCount">0</div>
427
+ <div class="text-sm text-muted-foreground mt-1">Critical</div>
428
+ </div>
429
+ <div class="text-center p-5 bg-orange-100 dark:bg-orange-900/20 rounded-lg cursor-pointer hover:shadow-md transition-all" onclick="filterBySeverity('high')">
430
+ <div class="text-3xl mb-2">🟠</div>
431
+ <div class="text-3xl font-bold text-orange-700 dark:text-orange-400" id="highCount">0</div>
432
+ <div class="text-sm text-muted-foreground mt-1">High</div>
433
+ </div>
434
+ <div class="text-center p-5 bg-blue-100 dark:bg-blue-900/20 rounded-lg cursor-pointer hover:shadow-md transition-all" onclick="filterBySeverity('medium')">
435
+ <div class="text-3xl mb-2">🟡</div>
436
+ <div class="text-3xl font-bold text-blue-700 dark:text-blue-400" id="mediumCount">0</div>
437
+ <div class="text-sm text-muted-foreground mt-1">Medium</div>
438
+ </div>
439
+ <div class="text-center p-5 bg-gray-100 dark:bg-gray-800/50 rounded-lg cursor-pointer hover:shadow-md transition-all" onclick="filterBySeverity('low')">
440
+ <div class="text-3xl mb-2">đŸŸĸ</div>
441
+ <div class="text-3xl font-bold text-gray-700 dark:text-gray-400" id="lowCount">0</div>
442
+ <div class="text-sm text-muted-foreground mt-1">Low</div>
443
+ </div>
444
+ </div>
445
+
446
+ <!-- Dimension Summary Table -->
447
+ <div class="bg-card rounded-lg shadow p-5 mb-5">
448
+ <div class="text-lg font-semibold text-foreground mb-4">Findings by Dimension</div>
449
+ <div class="overflow-x-auto">
450
+ <table class="w-full">
451
+ <thead>
452
+ <tr class="border-b border-border">
453
+ <th class="text-left py-3 px-4 text-sm font-semibold text-foreground">Dimension</th>
454
+ <th class="text-center py-3 px-4 text-sm font-semibold text-foreground">Critical</th>
455
+ <th class="text-center py-3 px-4 text-sm font-semibold text-foreground">High</th>
456
+ <th class="text-center py-3 px-4 text-sm font-semibold text-foreground">Medium</th>
457
+ <th class="text-center py-3 px-4 text-sm font-semibold text-foreground">Low</th>
458
+ <th class="text-center py-3 px-4 text-sm font-semibold text-foreground">Total</th>
459
+ <th class="text-center py-3 px-4 text-sm font-semibold text-foreground">Status</th>
460
+ </tr>
461
+ </thead>
462
+ <tbody id="dimensionSummaryBody">
463
+ <!-- Populated by JavaScript -->
464
+ </tbody>
465
+ </table>
466
+ </div>
467
+ </div>
468
+
469
+ <!-- Dimension Tabs -->
470
+ <div class="flex gap-2 mb-5 overflow-x-auto pb-2">
471
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border bg-primary text-primary-foreground" data-dimension="all" onclick="filterByDimension('all')">All Findings</button>
472
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border hover:bg-hover" data-dimension="security" onclick="filterByDimension('security')">Security</button>
473
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border hover:bg-hover" data-dimension="architecture" onclick="filterByDimension('architecture')">Architecture</button>
474
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border hover:bg-hover" data-dimension="quality" onclick="filterByDimension('quality')">Quality</button>
475
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border hover:bg-hover" data-dimension="action-items" onclick="filterByDimension('action-items')">Action Items</button>
476
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border hover:bg-hover" data-dimension="performance" onclick="filterByDimension('performance')">Performance</button>
477
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border hover:bg-hover" data-dimension="maintainability" onclick="filterByDimension('maintainability')">Maintainability</button>
478
+ <button class="px-4 py-2 rounded-lg font-medium text-sm whitespace-nowrap transition-all border border-border hover:bg-hover" data-dimension="best-practices" onclick="filterByDimension('best-practices')">Best Practices</button>
479
+ </div>
480
+
481
+ <!-- Advanced Filters -->
482
+ <div class="bg-card rounded-lg shadow p-5 mb-5">
483
+ <div class="flex justify-between items-center mb-4">
484
+ <div class="text-lg font-semibold text-foreground">đŸŽ¯ Advanced Filters & Sort</div>
485
+ <button class="px-4 py-2 border border-border rounded-lg text-sm font-medium hover:bg-hover transition-all" onclick="resetFilters()">Reset All Filters</button>
486
+ </div>
487
+
488
+ <div class="space-y-4">
489
+ <!-- Severity Filter -->
490
+ <div class="flex gap-2.5 flex-wrap items-center">
491
+ <span class="text-sm font-medium text-muted-foreground min-w-[80px]">Severity:</span>
492
+ <div class="flex gap-2.5 flex-wrap">
493
+ <label class="flex items-center gap-1.5 px-3 py-2 rounded-lg bg-muted cursor-pointer transition-all hover:bg-primary hover:text-white border-2 border-transparent has-[:checked]:bg-primary has-[:checked]:text-white" id="filter-critical">
494
+ <input type="checkbox" value="critical" onchange="toggleSeverityFilter('critical')" class="cursor-pointer">
495
+ <span>🔴 Critical</span>
496
+ </label>
497
+ <label class="flex items-center gap-1.5 px-3 py-2 rounded-lg bg-muted cursor-pointer transition-all hover:bg-primary hover:text-white border-2 border-transparent has-[:checked]:bg-primary has-[:checked]:text-white" id="filter-high">
498
+ <input type="checkbox" value="high" onchange="toggleSeverityFilter('high')" class="cursor-pointer">
499
+ <span>🟠 High</span>
500
+ </label>
501
+ <label class="flex items-center gap-1.5 px-3 py-2 rounded-lg bg-muted cursor-pointer transition-all hover:bg-primary hover:text-white border-2 border-transparent has-[:checked]:bg-primary has-[:checked]:text-white" id="filter-medium">
502
+ <input type="checkbox" value="medium" onchange="toggleSeverityFilter('medium')" class="cursor-pointer">
503
+ <span>🟡 Medium</span>
504
+ </label>
505
+ <label class="flex items-center gap-1.5 px-3 py-2 rounded-lg bg-muted cursor-pointer transition-all hover:bg-primary hover:text-white border-2 border-transparent has-[:checked]:bg-primary has-[:checked]:text-white" id="filter-low">
506
+ <input type="checkbox" value="low" onchange="toggleSeverityFilter('low')" class="cursor-pointer">
507
+ <span>đŸŸĸ Low</span>
508
+ </label>
509
+ </div>
510
+ </div>
511
+
512
+ <!-- Sort Controls -->
513
+ <div class="flex gap-2.5 flex-wrap items-center">
514
+ <span class="text-sm font-medium text-muted-foreground min-w-[80px]">Sort:</span>
515
+ <select id="sortSelect" class="px-4 py-2 border border-border rounded-lg text-sm bg-card hover:bg-hover transition-all cursor-pointer" onchange="sortFindings()">
516
+ <option value="severity">By Severity</option>
517
+ <option value="dimension">By Dimension</option>
518
+ <option value="file">By File</option>
519
+ <option value="title">By Title</option>
520
+ </select>
521
+ <button class="flex items-center gap-2 px-4 py-2 border border-border rounded-lg text-sm hover:bg-hover transition-all min-w-[140px] justify-center" id="sortOrderBtn" onclick="toggleSortOrder()">
522
+ <span class="text-lg" id="sortOrderIcon">↓</span>
523
+ <span id="sortOrderText">Descending</span>
524
+ </button>
525
+ </div>
526
+
527
+ <!-- Selection Actions -->
528
+ <div class="flex gap-2.5 flex-wrap items-center">
529
+ <span class="text-sm font-medium text-muted-foreground min-w-[80px]">Select:</span>
530
+ <button class="px-3 py-2 border border-border rounded-lg text-sm hover:bg-hover transition-all" onclick="selectAllVisible()">Select Visible</button>
531
+ <button class="px-3 py-2 border border-border rounded-lg text-sm hover:bg-hover transition-all" onclick="selectBySeverity('critical')">Critical Only</button>
532
+ <button class="px-3 py-2 border border-border rounded-lg text-sm hover:bg-hover transition-all" onclick="deselectAll()">Clear</button>
533
+ </div>
534
+ </div>
535
+ </div>
536
+
537
+ <!-- Findings Container -->
538
+ <div class="bg-card rounded-lg shadow p-5">
539
+ <div class="flex items-center justify-between mb-4">
540
+ <h3 class="text-lg font-semibold text-foreground">Findings <span id="findingsCount">(0)</span></h3>
541
+ </div>
542
+ <div id="findingsList" class="space-y-3">
543
+ <div class="text-center py-12">
544
+ <div class="text-6xl mb-4">âŗ</div>
545
+ <p class="text-lg text-muted-foreground">Loading findings...</p>
546
+ </div>
547
+ </div>
548
+ </div>
549
+ </div>
550
+
551
+ <!-- Detail Drawer -->
552
+ <div class="fixed inset-0 bg-black/50 z-40 hidden" id="drawerOverlay" onclick="closeDrawer()"></div>
553
+ <div class="drawer fixed top-0 right-0 w-[600px] max-w-full h-screen bg-card shadow-lg z-50 flex flex-col" id="findingDrawer">
554
+ <div class="flex items-center justify-between px-5 py-4 border-b border-border">
555
+ <h3 class="text-lg font-semibold text-foreground" id="drawerTitle">Finding Details</h3>
556
+ <button class="w-8 h-8 flex items-center justify-center text-xl text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors" onclick="closeDrawer()">&times;</button>
557
+ </div>
558
+ <div class="flex-1 overflow-y-auto p-5" id="drawerContent">
559
+ <!-- Content populated by JavaScript -->
560
+ </div>
561
+ </div>
562
+
563
+ <!-- History Timeline Drawer -->
564
+ <div class="fixed inset-0 bg-black/50 z-40 hidden" id="historyDrawerOverlay" onclick="closeHistoryDrawer()"></div>
565
+ <div class="history-drawer fixed top-0 right-0 w-[600px] max-w-full h-screen bg-card shadow-lg z-50 overflow-y-auto" id="historyDrawer">
566
+ <div class="sticky top-0 bg-card border-b border-border p-5 flex justify-between items-center z-10">
567
+ <h3 class="text-xl font-semibold text-foreground">📜 Fix History</h3>
568
+ <button class="w-8 h-8 flex items-center justify-center text-xl text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors" onclick="closeHistoryDrawer()">&times;</button>
569
+ </div>
570
+ <div class="p-5" id="historyTimeline">
571
+ <!-- History items populated by JavaScript -->
572
+ </div>
573
+ </div>
574
+
575
+ <script>
576
+
577
+ // State
578
+ let allFindings = [];
579
+ let filteredFindings = [];
580
+ let currentFilters = {
581
+ dimension: 'all',
582
+ severities: new Set(), // ✨ NEW: Multiple severity selection
583
+ search: ''
584
+ };
585
+ let sortConfig = {
586
+ field: 'severity',
587
+ order: 'desc' // ✨ NEW: 'asc' or 'desc'
588
+ };
589
+ let pollingInterval = null;
590
+ let reviewState = null;
591
+
592
+ // Fix-related state
593
+ let selectedFindings = new Set();
594
+ let fixSession = null;
595
+ let fixProgressInterval = null;
596
+ let fixProgressCollapsed = false;
597
+
598
+ // Selection management
599
+ function toggleFindingSelection(findingId, event) {
600
+ event.stopPropagation(); // Prevent triggering showFindingDetail
601
+
602
+ if (selectedFindings.has(findingId)) {
603
+ selectedFindings.delete(findingId);
604
+ } else {
605
+ selectedFindings.add(findingId);
606
+ }
607
+
608
+ updateSelectionUI();
609
+ }
610
+
611
+ function selectAll() {
612
+ allFindings.forEach(finding => {
613
+ selectedFindings.add(finding.id);
614
+ });
615
+ updateSelectionUI();
616
+ }
617
+
618
+ // ✨ NEW: Select only currently visible findings
619
+ function selectAllVisible() {
620
+ filteredFindings.forEach(finding => {
621
+ selectedFindings.add(finding.id);
622
+ });
623
+ updateSelectionUI();
624
+ }
625
+
626
+ // ✨ NEW: Select findings by severity
627
+ function selectBySeverity(severity) {
628
+ allFindings.forEach(finding => {
629
+ if (finding.severity.toLowerCase() === severity) {
630
+ selectedFindings.add(finding.id);
631
+ }
632
+ });
633
+ updateSelectionUI();
634
+ }
635
+
636
+ function deselectAll() {
637
+ selectedFindings.clear();
638
+ updateSelectionUI();
639
+ }
640
+
641
+ // ✨ NEW: Toggle severity filter
642
+ function toggleSeverityFilter(severity) {
643
+ if (currentFilters.severities.has(severity)) {
644
+ currentFilters.severities.delete(severity);
645
+ document.getElementById(`filter-${severity}`).classList.remove('active');
646
+ } else {
647
+ currentFilters.severities.add(severity);
648
+ document.getElementById(`filter-${severity}`).classList.add('active');
649
+ }
650
+ applyFilters();
651
+ }
652
+
653
+ // ✨ NEW: Toggle sort order
654
+ function toggleSortOrder() {
655
+ sortConfig.order = sortConfig.order === 'asc' ? 'desc' : 'asc';
656
+
657
+ // Update UI
658
+ const icon = document.getElementById('sortOrderIcon');
659
+ const text = document.getElementById('sortOrderText');
660
+
661
+ if (sortConfig.order === 'asc') {
662
+ icon.textContent = '↑';
663
+ text.textContent = 'Ascending';
664
+ } else {
665
+ icon.textContent = '↓';
666
+ text.textContent = 'Descending';
667
+ }
668
+
669
+ sortFindings();
670
+ }
671
+
672
+ // ✨ NEW: Reset all filters
673
+ function resetFilters() {
674
+ // Reset severity filters
675
+ currentFilters.severities.clear();
676
+ document.querySelectorAll('.filter-checkbox-item').forEach(item => {
677
+ item.classList.remove('active');
678
+ const checkbox = item.querySelector('input[type="checkbox"]');
679
+ if (checkbox) checkbox.checked = false;
680
+ });
681
+
682
+ // Reset dimension filter
683
+ currentFilters.dimension = 'all';
684
+ document.querySelectorAll('.tab').forEach(tab => {
685
+ tab.classList.toggle('active', tab.dataset.dimension === 'all');
686
+ });
687
+
688
+ // Reset search
689
+ currentFilters.search = '';
690
+ document.getElementById('searchInput').value = '';
691
+
692
+ // Reset sort
693
+ sortConfig.field = 'severity';
694
+ sortConfig.order = 'desc';
695
+ document.getElementById('sortSelect').value = 'severity';
696
+ document.getElementById('sortOrderIcon').textContent = '↓';
697
+ document.getElementById('sortOrderText').textContent = 'Descending';
698
+
699
+ applyFilters();
700
+ }
701
+
702
+ function updateSelectionUI() {
703
+ // Update counter
704
+ const counter = document.getElementById('selectionCounter');
705
+ counter.textContent = `${selectedFindings.size} finding${selectedFindings.size !== 1 ? 's' : ''} selected`;
706
+
707
+ // Update export button state
708
+ const exportBtn = document.getElementById('exportFixBtn');
709
+ exportBtn.disabled = selectedFindings.size === 0;
710
+
711
+ // Update checkbox states
712
+ document.querySelectorAll('.finding-checkbox').forEach(checkbox => {
713
+ checkbox.checked = selectedFindings.has(checkbox.dataset.findingId);
714
+ });
715
+ }
716
+
717
+ // Export selected findings for fixing
718
+ async function exportSelectedFindings() {
719
+ if (selectedFindings.size === 0) {
720
+ alert('Please select at least one finding to export');
721
+ return;
722
+ }
723
+
724
+ // Gather selected findings
725
+ const selectedFindingsData = allFindings.filter(f => selectedFindings.has(f.id));
726
+
727
+ // Create export data structure
728
+ const exportData = {
729
+ export_id: `${Date.now()}`,
730
+ export_timestamp: new Date().toISOString(),
731
+ review_id: reviewState?.review_id || 'unknown',
732
+ session_id: reviewState?.session_id || 'unknown',
733
+ findings_count: selectedFindingsData.length,
734
+ findings: selectedFindingsData.map(f => ({
735
+ id: f.id,
736
+ title: f.title,
737
+ description: f.description,
738
+ severity: f.severity,
739
+ dimension: f.dimension,
740
+ category: f.category || 'uncategorized',
741
+ file: f.file,
742
+ line: f.line,
743
+ code_context: f.code_context || null,
744
+ recommendations: f.recommendations || [],
745
+ root_cause: f.root_cause || null
746
+ }))
747
+ };
748
+
749
+ // Convert to JSON and download
750
+ const jsonStr = JSON.stringify(exportData, null, 2);
751
+ const blob = new Blob([jsonStr], { type: 'application/json' });
752
+ const url = URL.createObjectURL(blob);
753
+ const a = document.createElement('a');
754
+ const filename = `fix-export-${exportData.export_id}.json`;
755
+ a.href = url;
756
+ a.download = filename;
757
+ document.body.appendChild(a);
758
+ a.click();
759
+ document.body.removeChild(a);
760
+ URL.revokeObjectURL(url);
761
+
762
+ // ✨ Show export path and usage instructions with session directory recommendation
763
+ const reviewDir = window.location.pathname.replace('/dashboard.html', '').replace('/.review/dashboard.html', '/.review');
764
+ // Extract absolute path from file:// URL
765
+ const absolutePath = decodeURIComponent(window.location.pathname).replace(/^\/([A-Z]:)/, '$1');
766
+ const sessionDir = absolutePath.replace('/.review/dashboard.html', '');
767
+ const reviewSessionDir = `${sessionDir}/.review`;
768
+
769
+ const notification = `
770
+ ✅ Exported ${selectedFindingsData.length} finding${selectedFindingsData.length !== 1 ? 's' : ''} for automated fixing!
771
+
772
+ 📁 File: ${filename}
773
+ 📂 Browser download: Your Downloads folder
774
+
775
+ 📋 Recommended Location:
776
+ ${reviewSessionDir}/
777
+
778
+ 🔄 Move to session directory (recommended):
779
+ # On Windows:
780
+ move "%USERPROFILE%\\Downloads\\${filename}" "${reviewSessionDir.replace(/\//g, '\\')}\\${filename}"
781
+
782
+ # On Mac/Linux:
783
+ mv ~/Downloads/${filename} ${reviewSessionDir}/${filename}
784
+
785
+ 🔧 Usage (after moving file):
786
+ /workflow:review-fix ${reviewSessionDir}/${filename}
787
+
788
+ Or directly from Downloads:
789
+ /workflow:review-fix ~/Downloads/${filename}
790
+
791
+ 📋 Review Session: ${exportData.session_id}
792
+ 📊 Findings by Severity:
793
+ â€ĸ Critical: ${selectedFindingsData.filter(f => f.severity === 'critical').length}
794
+ â€ĸ High: ${selectedFindingsData.filter(f => f.severity === 'high').length}
795
+ â€ĸ Medium: ${selectedFindingsData.filter(f => f.severity === 'medium').length}
796
+ â€ĸ Low: ${selectedFindingsData.filter(f => f.severity === 'low').length}
797
+
798
+ 💡 The automated fix workflow will:
799
+ 1. Group findings by file and relationship
800
+ 2. Execute fixes in parallel where safe
801
+ 3. Run tests after each fix
802
+ 4. Track progress in this dashboard
803
+ `.trim();
804
+
805
+ alert(notification);
806
+ }
807
+
808
+ // Fix progress tracking
809
+ function detectFixSession() {
810
+ // Check if there's an active fix session in the review directory
811
+ fetch('./fixes/active-fix-session.json')
812
+ .then(response => {
813
+ if (response.ok) {
814
+ return response.json();
815
+ }
816
+ throw new Error('No active fix session');
817
+ })
818
+ .then(data => {
819
+ fixSession = data;
820
+ startFixProgressPolling(data.fix_session_id);
821
+ })
822
+ .catch(() => {
823
+ // No active fix session, hide progress section
824
+ document.getElementById('fixProgressSection').classList.remove('active');
825
+ });
826
+ }
827
+
828
+ function startFixProgressPolling(fixSessionId) {
829
+ // Show progress section
830
+ document.getElementById('fixProgressSection').classList.add('active');
831
+
832
+ // Initial load
833
+ loadFixProgress(fixSessionId);
834
+
835
+ // Start polling every 3 seconds
836
+ if (fixProgressInterval) {
837
+ clearInterval(fixProgressInterval);
838
+ }
839
+ fixProgressInterval = setInterval(() => {
840
+ loadFixProgress(fixSessionId);
841
+ }, 3000);
842
+ }
843
+
844
+ async function loadFixProgress(fixSessionId) {
845
+ try {
846
+ // Step 1: Load fix plan to get progress file list
847
+ const planResponse = await fetch(`./fixes/${fixSessionId}/fix-plan.json`);
848
+ if (!planResponse.ok) throw new Error('Fix plan not found');
849
+ const fixPlan = await planResponse.json();
850
+
851
+ // Step 2: Load all progress files in parallel
852
+ const progressFiles = fixPlan.groups.map(g => g.progress_file);
853
+ const progressPromises = progressFiles.map(file =>
854
+ fetch(`./fixes/${fixSessionId}/${file}`)
855
+ .then(r => r.ok ? r.json() : null)
856
+ .catch(() => null)
857
+ );
858
+ const progressDataArray = await Promise.all(progressPromises);
859
+
860
+ // Step 3: Aggregate data from all progress files
861
+ const progressData = aggregateProgressData(fixPlan, progressDataArray.filter(d => d !== null));
862
+
863
+ updateFixStatus(progressData);
864
+
865
+ // If complete, stop polling and update history
866
+ if (progressData.status === 'completed' || progressData.status === 'failed') {
867
+ clearInterval(fixProgressInterval);
868
+ fixProgressInterval = null;
869
+
870
+ // Reload fix history
871
+ await loadFixHistory();
872
+
873
+ // Mark findings as fixed
874
+ if (progressData.status === 'completed') {
875
+ progressData.fixes.forEach(fix => {
876
+ if (fix.status === 'fixed') {
877
+ markFindingAsFixed(fix.finding_id);
878
+ }
879
+ });
880
+ }
881
+ }
882
+ } catch (error) {
883
+ console.error('Error loading fix progress:', error);
884
+ }
885
+ }
886
+
887
+ function aggregateProgressData(fixPlan, progressDataArray) {
888
+ // Aggregate all findings from progress files
889
+ const allFindings = [];
890
+ const activeAgents = [];
891
+ let hasAnyInProgress = false;
892
+ let hasAnyFailed = false;
893
+ let allCompleted = true;
894
+
895
+ progressDataArray.forEach(progressFile => {
896
+ // Collect all findings with group_id
897
+ if (progressFile.findings) {
898
+ progressFile.findings.forEach(finding => {
899
+ allFindings.push({
900
+ finding_id: finding.finding_id,
901
+ finding_title: finding.finding_title,
902
+ status: finding.status,
903
+ group_id: progressFile.group_id,
904
+ completion_time: finding.completion_time
905
+ });
906
+ });
907
+ }
908
+
909
+ // Collect active agents
910
+ if (progressFile.assigned_agent && progressFile.status === 'in-progress') {
911
+ const currentFinding = progressFile.current_finding;
912
+ activeAgents.push({
913
+ agent_id: progressFile.assigned_agent,
914
+ group_id: progressFile.group_id,
915
+ current_task: currentFinding ? currentFinding.finding_title : 'Working...',
916
+ finding_id: currentFinding ? currentFinding.finding_id : null,
917
+ finding_title: currentFinding ? currentFinding.finding_title : null,
918
+ file: currentFinding ? currentFinding.file : null,
919
+ status: progressFile.phase || 'analyzing',
920
+ started_at: progressFile.started_at
921
+ });
922
+ }
923
+
924
+ // Track statuses
925
+ if (progressFile.status === 'in-progress') hasAnyInProgress = true;
926
+ if (progressFile.status === 'failed') hasAnyFailed = true;
927
+ if (progressFile.status !== 'completed' && progressFile.status !== 'failed') {
928
+ allCompleted = false;
929
+ }
930
+ });
931
+
932
+ // Calculate completion metrics
933
+ const totalFindings = allFindings.length;
934
+ const completedCount = allFindings.filter(f => f.status === 'fixed' || f.status === 'failed').length;
935
+ const percentComplete = totalFindings > 0 ? (completedCount / totalFindings) * 100 : 0;
936
+
937
+ // Determine overall status
938
+ let overallStatus = 'pending';
939
+ if (allCompleted) {
940
+ overallStatus = hasAnyFailed ? 'failed' : 'completed';
941
+ } else if (hasAnyInProgress) {
942
+ overallStatus = 'in_progress';
943
+ }
944
+
945
+ // Determine phase
946
+ let phase = 'planning';
947
+ if (hasAnyInProgress || allCompleted) {
948
+ phase = allCompleted ? 'completion' : 'execution';
949
+ }
950
+
951
+ // Build stages from fix plan and update with current progress
952
+ const stages = fixPlan.timeline.stages.map(stage => {
953
+ // Check if all groups in this stage are completed
954
+ const groupStatuses = stage.groups.map(groupId => {
955
+ const progressFile = progressDataArray.find(p => p.group_id === groupId);
956
+ return progressFile ? progressFile.status : 'pending';
957
+ });
958
+
959
+ let stageStatus = 'pending';
960
+ if (groupStatuses.every(s => s === 'completed' || s === 'failed')) {
961
+ stageStatus = 'completed';
962
+ } else if (groupStatuses.some(s => s === 'in-progress')) {
963
+ stageStatus = 'in-progress';
964
+ }
965
+
966
+ return {
967
+ stage: stage.stage,
968
+ status: stageStatus,
969
+ groups: stage.groups,
970
+ execution_mode: stage.execution_mode
971
+ };
972
+ });
973
+
974
+ // Get earliest start time
975
+ const startTimes = progressDataArray
976
+ .map(p => p.started_at)
977
+ .filter(t => t)
978
+ .map(t => new Date(t).getTime());
979
+ const startTime = startTimes.length > 0 ? new Date(Math.min(...startTimes)).toISOString() : null;
980
+
981
+ // Find current stage
982
+ const currentStageObj = stages.find(s => s.status === 'in-progress') || stages.find(s => s.status === 'pending');
983
+ const currentStage = currentStageObj ? currentStageObj.stage : stages.length;
984
+
985
+ return {
986
+ fix_session_id: fixPlan.fix_session_id,
987
+ review_id: fixPlan.review_id,
988
+ status: overallStatus,
989
+ phase: phase,
990
+ start_time: startTime,
991
+ total_findings: totalFindings,
992
+ current_stage: currentStage,
993
+ total_stages: fixPlan.timeline.stages.length,
994
+ percent_complete: percentComplete,
995
+ fixes: allFindings,
996
+ active_agents: activeAgents,
997
+ stages: stages
998
+ };
999
+ }
1000
+
1001
+ function updateFixStatus(progressData) {
1002
+ const fixPhaseBadge = document.getElementById('fixPhaseBadge');
1003
+ const planningPhase = document.getElementById('planningPhase');
1004
+ const executionPhase = document.getElementById('executionPhase');
1005
+ const stageTimeline = document.getElementById('stageTimeline');
1006
+
1007
+ // Update phase badge
1008
+ const phase = progressData.phase || 'planning';
1009
+ fixPhaseBadge.textContent = phase.toUpperCase();
1010
+ fixPhaseBadge.className = `phase-badge phase-${phase}`;
1011
+
1012
+ // Update stage timeline (show if stages exist, regardless of phase)
1013
+ updateStageTimeline(progressData);
1014
+
1015
+ // Show appropriate phase UI
1016
+ if (phase === 'planning') {
1017
+ planningPhase.style.display = 'block';
1018
+ executionPhase.style.display = 'none';
1019
+ } else if (phase === 'execution' || phase === 'completion') {
1020
+ planningPhase.style.display = 'none';
1021
+ executionPhase.style.display = 'block';
1022
+
1023
+ // Update progress bar
1024
+ const progressFill = document.getElementById('fixProgressFill');
1025
+ const progressText = document.getElementById('fixProgressText');
1026
+ const percentComplete = progressData.percent_complete || 0;
1027
+ progressFill.style.width = `${percentComplete}%`;
1028
+
1029
+ const completedCount = progressData.fixes?.filter(f => f.status === 'fixed' || f.status === 'failed').length || 0;
1030
+ const totalCount = progressData.total_findings || 0;
1031
+ const currentStage = progressData.current_stage || 1;
1032
+ const totalStages = progressData.total_stages || 1;
1033
+
1034
+ // Format start time
1035
+ let startTimeText = '';
1036
+ if (progressData.start_time) {
1037
+ const startTime = new Date(progressData.start_time);
1038
+ const elapsed = Math.floor((Date.now() - startTime.getTime()) / 1000 / 60); // minutes
1039
+ startTimeText = ` â€ĸ Started ${startTime.toLocaleTimeString()} (${elapsed}m ago)`;
1040
+ }
1041
+
1042
+ progressText.textContent = `Stage ${currentStage}/${totalStages}: ${completedCount}/${totalCount} findings completed (${percentComplete.toFixed(1)}%)${startTimeText}`;
1043
+
1044
+ // Update active groups
1045
+ updateActiveGroups(progressData);
1046
+
1047
+ // Update active agents
1048
+ updateActiveAgents(progressData);
1049
+ }
1050
+ }
1051
+
1052
+ function updateStageTimeline(progressData) {
1053
+ const stageTimeline = document.getElementById('stageTimeline');
1054
+ const stages = progressData.stages || [];
1055
+
1056
+ if (stages.length === 0) {
1057
+ stageTimeline.style.display = 'none';
1058
+ stageTimeline.innerHTML = '';
1059
+ return;
1060
+ }
1061
+
1062
+ // Show timeline when stages are available
1063
+ stageTimeline.style.display = 'flex';
1064
+ stageTimeline.innerHTML = stages.map(stage => `
1065
+ <div class="stage-item ${stage.status}">
1066
+ <div class="stage-number">Stage ${stage.stage}</div>
1067
+ <div class="stage-mode">${stage.execution_mode === 'parallel' ? '⚡ Parallel' : 'âžĄī¸ Serial'}</div>
1068
+ <div class="stage-groups">${stage.groups.length} group${stage.groups.length !== 1 ? 's' : ''}</div>
1069
+ </div>
1070
+ `).join('');
1071
+ }
1072
+
1073
+ function updateActiveGroups(progressData) {
1074
+ const activeGroupsList = document.getElementById('activeGroupsList');
1075
+ const stages = progressData.stages || [];
1076
+ const activeStage = stages.find(s => s.status === 'in-progress');
1077
+
1078
+ if (!activeStage) {
1079
+ activeGroupsList.innerHTML = '';
1080
+ return;
1081
+ }
1082
+
1083
+ // Get fixes for groups in active stage
1084
+ const groupFixes = {};
1085
+ progressData.fixes?.forEach(fix => {
1086
+ if (fix.group_id && activeStage.groups.includes(fix.group_id)) {
1087
+ if (!groupFixes[fix.group_id]) {
1088
+ groupFixes[fix.group_id] = [];
1089
+ }
1090
+ groupFixes[fix.group_id].push(fix);
1091
+ }
1092
+ });
1093
+
1094
+ const groupCards = activeStage.groups.map(groupId => {
1095
+ const fixes = groupFixes[groupId] || [];
1096
+ const inProgressCount = fixes.filter(f => f.status === 'in-progress').length;
1097
+ const completedCount = fixes.filter(f => f.status === 'fixed' || f.status === 'failed').length;
1098
+
1099
+ // Get in-progress finding titles
1100
+ const inProgressFindings = fixes
1101
+ .filter(f => f.status === 'in-progress')
1102
+ .map(f => f.finding_title)
1103
+ .filter(title => title);
1104
+
1105
+ const inProgressText = inProgressFindings.length > 0
1106
+ ? `<div class="group-active-items">🔧 ${inProgressFindings.join(', ')}</div>`
1107
+ : '';
1108
+
1109
+ return `
1110
+ <div class="active-group-card">
1111
+ <div class="group-header">
1112
+ <div class="group-id">${groupId}</div>
1113
+ <div class="group-status">${inProgressCount > 0 ? 'In Progress' : 'Pending'}</div>
1114
+ </div>
1115
+ <div class="group-findings">${completedCount}/${fixes.length} findings completed</div>
1116
+ ${inProgressText}
1117
+ </div>
1118
+ `;
1119
+ }).join('');
1120
+
1121
+ activeGroupsList.innerHTML = groupCards || '';
1122
+ }
1123
+
1124
+ function getAgentStatusIcon(status) {
1125
+ const icons = {
1126
+ 'analyzing': '🔍',
1127
+ 'fixing': '🔧',
1128
+ 'testing': 'đŸ§Ē',
1129
+ 'committing': '💾'
1130
+ };
1131
+ return icons[status] || '⚡';
1132
+ }
1133
+
1134
+ function updateActiveAgents(progressData) {
1135
+ const activeAgentsList = document.getElementById('activeAgentsList');
1136
+
1137
+ if (!progressData.active_agents || progressData.active_agents.length === 0) {
1138
+ activeAgentsList.innerHTML = '';
1139
+ return;
1140
+ }
1141
+
1142
+ activeAgentsList.innerHTML = '<h4 style="margin-bottom: 10px;">Active Agents:</h4>' +
1143
+ progressData.active_agents.map(agent => {
1144
+ const statusIcon = getAgentStatusIcon(agent.status);
1145
+ const statusText = agent.status ? agent.status.charAt(0).toUpperCase() + agent.status.slice(1) : '';
1146
+ const findingTitle = agent.finding_title || agent.finding_id || '';
1147
+
1148
+ // Render flow control steps if available
1149
+ const flowControlHtml = agent.flow_control && agent.flow_control.steps && agent.flow_control.steps.length > 0
1150
+ ? `<div class="agent-flow-control">${renderFlowControlSteps(agent.flow_control)}</div>`
1151
+ : '';
1152
+
1153
+ return `
1154
+ <div class="active-agent-item">
1155
+ <div class="agent-status">
1156
+ ${statusIcon} ${agent.agent_id} (${agent.group_id || 'unknown'})
1157
+ ${statusText ? `<span class="agent-status-badge">${statusText}</span>` : ''}
1158
+ </div>
1159
+ <div class="agent-task">${agent.current_task || findingTitle || 'Initializing...'}</div>
1160
+ ${agent.file ? `<div class="agent-file">📄 ${agent.file}</div>` : ''}
1161
+ ${flowControlHtml}
1162
+ </div>
1163
+ `;
1164
+ }).join('');
1165
+ }
1166
+
1167
+ function renderFlowControlSteps(flowControl) {
1168
+ if (!flowControl || !flowControl.implementation_approach || flowControl.implementation_approach.length === 0) {
1169
+ return '';
1170
+ }
1171
+
1172
+ const stepsHtml = flowControl.implementation_approach.map(step => {
1173
+ let stepIcon = '';
1174
+ let stepClass = '';
1175
+
1176
+ if (step.status === 'completed') {
1177
+ stepIcon = '✅';
1178
+ stepClass = 'flow-step-completed';
1179
+ } else if (step.status === 'in-progress') {
1180
+ stepIcon = 'âŗ';
1181
+ stepClass = 'flow-step-in-progress';
1182
+ } else if (step.status === 'failed') {
1183
+ stepIcon = '❌';
1184
+ stepClass = 'flow-step-failed';
1185
+ } else {
1186
+ stepIcon = '⏸';
1187
+ stepClass = 'flow-step-pending';
1188
+ }
1189
+
1190
+ // Format step name: "analyze_context" -> "Analyze Context"
1191
+ const stepName = step.action || step.step.split('_').map(word =>
1192
+ word.charAt(0).toUpperCase() + word.slice(1)
1193
+ ).join(' ');
1194
+
1195
+ return `
1196
+ <div class="flow-step ${stepClass}">
1197
+ <span class="flow-step-icon">${stepIcon}</span>
1198
+ <span class="flow-step-name">${stepName}</span>
1199
+ </div>
1200
+ `;
1201
+ }).join('');
1202
+
1203
+ return `
1204
+ <div class="flow-control-container">
1205
+ <div class="flow-control-header">Progress Steps:</div>
1206
+ <div class="flow-steps">${stepsHtml}</div>
1207
+ </div>
1208
+ `;
1209
+ }
1210
+
1211
+ function markFindingAsFixed(findingId) {
1212
+ const finding = allFindings.find(f => f.id === findingId);
1213
+ if (finding) {
1214
+ finding.fix_status = 'fixed';
1215
+ renderFindings(); // Re-render to show fix badge
1216
+ }
1217
+ }
1218
+
1219
+ function toggleFixProgress() {
1220
+ fixProgressCollapsed = !fixProgressCollapsed;
1221
+ const section = document.getElementById('fixProgressSection');
1222
+ section.classList.toggle('collapsed', fixProgressCollapsed);
1223
+ }
1224
+
1225
+ // History drawer functions
1226
+ function openHistoryDrawer() {
1227
+ document.getElementById('historyDrawer').classList.add('active');
1228
+ document.getElementById('historyDrawerOverlay').classList.add('active');
1229
+ loadFixHistory();
1230
+ }
1231
+
1232
+ function closeHistoryDrawer() {
1233
+ document.getElementById('historyDrawer').classList.remove('active');
1234
+ document.getElementById('historyDrawerOverlay').classList.remove('active');
1235
+ }
1236
+
1237
+ async function loadFixHistory() {
1238
+ try {
1239
+ const response = await fetch('./fixes/fix-history.json');
1240
+ if (!response.ok) throw new Error('Fix history not found');
1241
+
1242
+ const historyData = await response.json();
1243
+ renderFixHistory(historyData);
1244
+ } catch (error) {
1245
+ console.error('Error loading fix history:', error);
1246
+ document.getElementById('historyTimeline').innerHTML = `
1247
+ <div class="empty-state">
1248
+ <div class="empty-state-icon">📜</div>
1249
+ <p>No fix history available</p>
1250
+ </div>
1251
+ `;
1252
+ }
1253
+ }
1254
+
1255
+ function renderFixHistory(historyData) {
1256
+ const timeline = document.getElementById('historyTimeline');
1257
+
1258
+ if (!historyData.sessions || historyData.sessions.length === 0) {
1259
+ timeline.innerHTML = `
1260
+ <div class="empty-state">
1261
+ <div class="empty-state-icon">📜</div>
1262
+ <p>No fix sessions yet</p>
1263
+ </div>
1264
+ `;
1265
+ return;
1266
+ }
1267
+
1268
+ timeline.innerHTML = historyData.sessions.map(session => {
1269
+ const timestamp = new Date(session.timestamp).toLocaleString();
1270
+ const statusEmoji = session.status === 'completed' ? '✅' :
1271
+ session.status === 'failed' ? '❌' : 'âŗ';
1272
+
1273
+ return `
1274
+ <div class="history-item">
1275
+ <div class="history-header">
1276
+ <span class="history-status">${statusEmoji} ${session.status}</span>
1277
+ <span class="history-time">${timestamp}</span>
1278
+ </div>
1279
+ <div class="history-details">
1280
+ <div><strong>Session:</strong> ${session.fix_session_id}</div>
1281
+ <div><strong>Findings:</strong> ${session.findings_count} issues</div>
1282
+ <div><strong>Fixed:</strong> ${session.fixed_count || 0} issues</div>
1283
+ <div><strong>Failed:</strong> ${session.failed_count || 0} issues</div>
1284
+ </div>
1285
+ </div>
1286
+ `;
1287
+ }).join('');
1288
+ }
1289
+
1290
+ // Theme management
1291
+ function initTheme() {
1292
+ const savedTheme = localStorage.getItem('theme') || 'light';
1293
+ document.documentElement.setAttribute('data-theme', savedTheme);
1294
+ updateThemeIcon(savedTheme);
1295
+ }
1296
+
1297
+ function toggleTheme() {
1298
+ const currentTheme = document.documentElement.getAttribute('data-theme');
1299
+ const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
1300
+ document.documentElement.setAttribute('data-theme', newTheme);
1301
+ localStorage.setItem('theme', newTheme);
1302
+ updateThemeIcon(newTheme);
1303
+ }
1304
+
1305
+ function updateThemeIcon(theme) {
1306
+ document.getElementById('themeToggle').textContent = theme === 'dark' ? 'â˜€ī¸' : '🌙';
1307
+ }
1308
+
1309
+ // Polling mechanism
1310
+ function startPolling() {
1311
+ loadProgress();
1312
+ pollingInterval = setInterval(() => {
1313
+ loadProgress();
1314
+ }, 5000); // Poll every 5 seconds
1315
+ }
1316
+
1317
+ function stopPolling() {
1318
+ if (pollingInterval) {
1319
+ clearInterval(pollingInterval);
1320
+ pollingInterval = null;
1321
+ }
1322
+ }
1323
+
1324
+ // Load progress from review-progress.json
1325
+ async function loadProgress() {
1326
+ try {
1327
+ const response = await fetch('./review-progress.json');
1328
+ if (!response.ok) throw new Error('Progress file not found');
1329
+
1330
+ const progress = await response.json();
1331
+
1332
+ // ✨ NEW: Load available dimensions incrementally and get actual count
1333
+ const loadedCount = await loadAvailableDimensions();
1334
+
1335
+ // ✨ NEW: Update progress UI with actual file count
1336
+ updateProgressUI(progress, loadedCount);
1337
+
1338
+ // If complete, stop polling
1339
+ if (progress.phase === 'complete') {
1340
+ stopPolling();
1341
+ }
1342
+ } catch (error) {
1343
+ console.error('Error loading progress:', error);
1344
+ }
1345
+ }
1346
+
1347
+ // ✨ NEW: Load all available dimension files (even if review not complete)
1348
+ async function loadAvailableDimensions() {
1349
+ try {
1350
+ // Load review state to get expected dimensions
1351
+ const stateResponse = await fetch('./review-state.json');
1352
+ if (!stateResponse.ok) return;
1353
+
1354
+ reviewState = await stateResponse.json();
1355
+ document.getElementById('sessionId').textContent = reviewState.session_id;
1356
+
1357
+ // Try to load all expected dimensions
1358
+ const allDimensions = reviewState.metadata?.dimensions ||
1359
+ Object.keys(dimensionConfig);
1360
+
1361
+ const dimensionPromises = allDimensions.map(dim =>
1362
+ fetch(`./dimensions/${dim}.json`)
1363
+ .then(r => {
1364
+ if (r.ok) return r.json();
1365
+ return null; // Dimension not ready yet
1366
+ })
1367
+ .catch(err => {
1368
+ // Silently skip dimensions that don't exist yet
1369
+ return null;
1370
+ })
1371
+ );
1372
+
1373
+ const dimensions = await Promise.all(dimensionPromises);
1374
+
1375
+ // Aggregate findings from completed dimensions
1376
+ allFindings = [];
1377
+ const loadedDimensions = [];
1378
+ const severityCounts = { critical: 0, high: 0, medium: 0, low: 0 };
1379
+
1380
+ dimensions.forEach(dim => {
1381
+ if (dim) {
1382
+ // Handle both array and object formats
1383
+ const dimData = Array.isArray(dim) ? dim[0] : dim;
1384
+
1385
+ if (dimData && dimData.findings) {
1386
+ loadedDimensions.push(dimData.dimension);
1387
+
1388
+ // Aggregate findings
1389
+ allFindings.push(...dimData.findings.map(f => ({
1390
+ ...f,
1391
+ dimension: dimData.dimension
1392
+ })));
1393
+
1394
+ // Aggregate severity counts
1395
+ if (dimData.summary) {
1396
+ severityCounts.critical += dimData.summary.critical || 0;
1397
+ severityCounts.high += dimData.summary.high || 0;
1398
+ severityCounts.medium += dimData.summary.medium || 0;
1399
+ severityCounts.low += dimData.summary.low || 0;
1400
+ }
1401
+ }
1402
+ }
1403
+ });
1404
+
1405
+ // Update severity counts with real data
1406
+ if (loadedDimensions.length > 0) {
1407
+ updateSeverityCounts(severityCounts);
1408
+ updateDimensionSummary();
1409
+ renderFindings();
1410
+ }
1411
+
1412
+ // ✨ NEW: Return loaded count for progress calculation
1413
+ return {
1414
+ loaded: loadedDimensions.length,
1415
+ total: allDimensions.length,
1416
+ findings: allFindings.length
1417
+ };
1418
+ } catch (error) {
1419
+ console.error('Error loading available dimensions:', error);
1420
+ return { loaded: 0, total: 7, findings: 0 };
1421
+ }
1422
+ }
1423
+
1424
+ // Update progress UI
1425
+ function updateProgressUI(progress, loadedCount) {
1426
+ document.getElementById('reviewId').textContent = progress.review_id || 'N/A';
1427
+ document.getElementById('lastUpdate').textContent = new Date(progress.last_update).toLocaleString();
1428
+
1429
+ const phaseBadge = document.getElementById('phaseBadge');
1430
+ phaseBadge.textContent = progress.phase.toUpperCase();
1431
+ phaseBadge.className = `phase-badge phase-${progress.phase}`;
1432
+
1433
+ let percentComplete = 0;
1434
+ let progressText = '';
1435
+
1436
+ // ✨ NEW: Calculate progress based on actual loaded dimension files
1437
+ if (loadedCount && loadedCount.total > 0) {
1438
+ percentComplete = Math.round((loadedCount.loaded / loadedCount.total) * 100);
1439
+
1440
+ if (progress.phase === 'parallel' || progress.phase === 'aggregate') {
1441
+ progressText = `Parallel Review: ${loadedCount.loaded}/${loadedCount.total} dimensions completed`;
1442
+ if (loadedCount.findings > 0) {
1443
+ progressText += ` â€ĸ ${loadedCount.findings} finding${loadedCount.findings !== 1 ? 's' : ''} discovered`;
1444
+ }
1445
+ } else if (progress.phase === 'iterate' && progress.progress.deep_dive) {
1446
+ percentComplete = progress.progress.deep_dive.percent_complete;
1447
+ progressText = `Deep-Dive: ${progress.progress.deep_dive.analyzed}/${progress.progress.deep_dive.total_findings} findings analyzed`;
1448
+ } else if (progress.phase === 'complete') {
1449
+ percentComplete = 100;
1450
+ progressText = `Review Complete â€ĸ ${loadedCount.findings} total finding${loadedCount.findings !== 1 ? 's' : ''}`;
1451
+ }
1452
+ } else {
1453
+ // Fallback to original logic if loadedCount not available
1454
+ if (progress.progress.parallel_review) {
1455
+ percentComplete = progress.progress.parallel_review.percent_complete;
1456
+ progressText = `Parallel Review: ${progress.progress.parallel_review.completed}/${progress.progress.parallel_review.total_dimensions} dimensions`;
1457
+ }
1458
+
1459
+ if (progress.progress.deep_dive) {
1460
+ percentComplete = progress.progress.deep_dive.percent_complete;
1461
+ progressText = `Deep-Dive: ${progress.progress.deep_dive.analyzed}/${progress.progress.deep_dive.total_findings} findings`;
1462
+ }
1463
+
1464
+ if (progress.phase === 'complete') {
1465
+ percentComplete = 100;
1466
+ progressText = 'Review Complete';
1467
+ }
1468
+ }
1469
+
1470
+ document.getElementById('progressFill').style.width = `${percentComplete}%`;
1471
+ document.getElementById('progressText').textContent = progressText;
1472
+ }
1473
+
1474
+ // Load final results (now delegates to loadAvailableDimensions)
1475
+ async function loadFinalResults() {
1476
+ // ✨ NEW: This function now just ensures one final load
1477
+ // since loadAvailableDimensions() handles all the heavy lifting
1478
+ await loadAvailableDimensions();
1479
+ }
1480
+
1481
+ // Update severity counts
1482
+ function updateSeverityCounts(distribution) {
1483
+ document.getElementById('criticalCount').textContent = distribution.critical || 0;
1484
+ document.getElementById('highCount').textContent = distribution.high || 0;
1485
+ document.getElementById('mediumCount').textContent = distribution.medium || 0;
1486
+ document.getElementById('lowCount').textContent = distribution.low || 0;
1487
+ }
1488
+
1489
+ // Dimension summary table configuration
1490
+ const dimensionConfig = {
1491
+ 'security': { icon: '🔒', label: 'Security' },
1492
+ 'architecture': { icon: '🏛', label: 'Architecture' },
1493
+ 'quality': { icon: '✅', label: 'Quality' },
1494
+ 'action-items': { icon: '📋', label: 'Action-Items' },
1495
+ 'performance': { icon: '⚡', label: 'Performance' },
1496
+ 'maintainability': { icon: '🔧', label: 'Maintainability' },
1497
+ 'best-practices': { icon: '📚', label: 'Best-Practices' }
1498
+ };
1499
+
1500
+ // Update dimension summary table
1501
+ function updateDimensionSummary() {
1502
+ const tbody = document.getElementById('dimensionSummaryBody');
1503
+ if (!tbody) return;
1504
+
1505
+ // Get all dimension names from config
1506
+ const dimensions = Object.keys(dimensionConfig);
1507
+
1508
+ // Calculate counts per dimension
1509
+ const dimensionStats = {};
1510
+ dimensions.forEach(dim => {
1511
+ dimensionStats[dim] = { critical: 0, high: 0, medium: 0, low: 0, total: 0, reviewed: false };
1512
+ });
1513
+
1514
+ // Aggregate findings by dimension
1515
+ allFindings.forEach(finding => {
1516
+ const dim = finding.dimension;
1517
+ if (dimensionStats[dim]) {
1518
+ const severity = finding.severity.toLowerCase();
1519
+ if (dimensionStats[dim][severity] !== undefined) {
1520
+ dimensionStats[dim][severity]++;
1521
+ }
1522
+ dimensionStats[dim].total++;
1523
+ // ✨ NEW: Mark as reviewed if we have findings from this dimension
1524
+ dimensionStats[dim].reviewed = true;
1525
+ }
1526
+ });
1527
+
1528
+ // Also check reviewed status from reviewState (backward compatibility)
1529
+ if (reviewState && reviewState.dimensions_reviewed) {
1530
+ reviewState.dimensions_reviewed.forEach(dim => {
1531
+ if (dimensionStats[dim]) {
1532
+ dimensionStats[dim].reviewed = true;
1533
+ }
1534
+ });
1535
+ }
1536
+
1537
+ // Generate table rows
1538
+ const rows = dimensions.map(dim => {
1539
+ const config = dimensionConfig[dim];
1540
+ const stats = dimensionStats[dim];
1541
+ const hasFindings = stats.total > 0;
1542
+
1543
+ // Create count badge with appropriate styling
1544
+ const createCountBadge = (count, severity) => {
1545
+ const zeroClass = count === 0 ? ' zero' : '';
1546
+ return `<span class="count-badge ${severity}${zeroClass}">${count}</span>`;
1547
+ };
1548
+
1549
+ // ✨ NEW: Enhanced status indicator with 3 states
1550
+ let statusClass, statusIcon, statusTooltip;
1551
+ if (stats.reviewed && hasFindings) {
1552
+ statusClass = 'reviewed';
1553
+ statusIcon = '✓';
1554
+ statusTooltip = 'Completed';
1555
+ } else if (stats.reviewed && !hasFindings) {
1556
+ statusClass = 'reviewed';
1557
+ statusIcon = '✓';
1558
+ statusTooltip = 'Completed (no findings)';
1559
+ } else {
1560
+ statusClass = 'pending';
1561
+ statusIcon = 'âŗ';
1562
+ statusTooltip = 'Processing...';
1563
+ }
1564
+
1565
+ return `
1566
+ <tr onclick="filterByDimension('${dim}')" style="cursor: pointer;">
1567
+ <td>
1568
+ <div class="dimension-name">
1569
+ <div class="dimension-icon ${dim}">${config.icon}</div>
1570
+ <span>${config.label}</span>
1571
+ </div>
1572
+ </td>
1573
+ <td>${createCountBadge(stats.critical, 'critical')}</td>
1574
+ <td>${createCountBadge(stats.high, 'high')}</td>
1575
+ <td>${createCountBadge(stats.medium, 'medium')}</td>
1576
+ <td>${createCountBadge(stats.low, 'low')}</td>
1577
+ <td><span class="count-badge total">${stats.total}</span></td>
1578
+ <td><span class="status-indicator ${statusClass}" title="${statusTooltip}">${statusIcon}</span></td>
1579
+ </tr>
1580
+ `;
1581
+ }).join('');
1582
+
1583
+ tbody.innerHTML = rows;
1584
+ }
1585
+
1586
+ // Filter functions
1587
+ function filterByDimension(dimension) {
1588
+ currentFilters.dimension = dimension;
1589
+
1590
+ // Update tab UI
1591
+ document.querySelectorAll('.tab').forEach(tab => {
1592
+ tab.classList.toggle('active', tab.dataset.dimension === dimension);
1593
+ });
1594
+
1595
+ applyFilters();
1596
+ }
1597
+
1598
+ function setupSearch() {
1599
+ const searchInput = document.getElementById('searchInput');
1600
+ searchInput.addEventListener('input', (e) => {
1601
+ currentFilters.search = e.target.value.toLowerCase();
1602
+ applyFilters();
1603
+ });
1604
+ }
1605
+
1606
+ function applyFilters() {
1607
+ filteredFindings = allFindings.filter(finding => {
1608
+ // Dimension filter
1609
+ if (currentFilters.dimension !== 'all' && finding.dimension !== currentFilters.dimension) {
1610
+ return false;
1611
+ }
1612
+
1613
+ // ✨ NEW: Multi-select severity filter
1614
+ if (currentFilters.severities.size > 0) {
1615
+ if (!currentFilters.severities.has(finding.severity.toLowerCase())) {
1616
+ return false;
1617
+ }
1618
+ }
1619
+
1620
+ // Search filter
1621
+ if (currentFilters.search) {
1622
+ const searchText = `${finding.title} ${finding.description} ${finding.file} ${finding.category || ''}`.toLowerCase();
1623
+ if (!searchText.includes(currentFilters.search)) {
1624
+ return false;
1625
+ }
1626
+ }
1627
+
1628
+ return true;
1629
+ });
1630
+
1631
+ // Auto-sort after filtering
1632
+ sortFindings();
1633
+ }
1634
+
1635
+ // ✨ UPDATED: Sort findings with order support
1636
+ function sortFindings() {
1637
+ const sortBy = document.getElementById('sortSelect').value;
1638
+ sortConfig.field = sortBy;
1639
+
1640
+ const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
1641
+
1642
+ filteredFindings.sort((a, b) => {
1643
+ let comparison = 0;
1644
+
1645
+ if (sortBy === 'severity') {
1646
+ comparison = severityOrder[a.severity.toLowerCase()] - severityOrder[b.severity.toLowerCase()];
1647
+ } else if (sortBy === 'dimension') {
1648
+ comparison = a.dimension.localeCompare(b.dimension);
1649
+ } else if (sortBy === 'file') {
1650
+ comparison = a.file.localeCompare(b.file);
1651
+ } else if (sortBy === 'title') {
1652
+ comparison = a.title.localeCompare(b.title);
1653
+ }
1654
+
1655
+ // ✨ NEW: Apply sort order (asc/desc)
1656
+ return sortConfig.order === 'asc' ? comparison : -comparison;
1657
+ });
1658
+
1659
+ renderFindings();
1660
+ }
1661
+
1662
+ // Render findings list
1663
+ function renderFindings() {
1664
+ const container = document.getElementById('findingsList');
1665
+ document.getElementById('findingsCount').textContent = `(${filteredFindings.length})`;
1666
+
1667
+ if (filteredFindings.length === 0) {
1668
+ container.innerHTML = `
1669
+ <div class="empty-state">
1670
+ <div class="empty-state-icon">✨</div>
1671
+ <p>No findings match your filters</p>
1672
+ </div>
1673
+ `;
1674
+ return;
1675
+ }
1676
+
1677
+ container.innerHTML = filteredFindings.map(finding => {
1678
+ // Determine fix status badge
1679
+ const fixStatusBadge = finding.fix_status ?
1680
+ `<span class="fix-status-badge status-${finding.fix_status}">
1681
+ ${finding.fix_status === 'pending' ? 'âŗ Pending' :
1682
+ finding.fix_status === 'in-progress' ? '⚡ In Progress' :
1683
+ finding.fix_status === 'fixed' ? '✅ Fixed' :
1684
+ finding.fix_status === 'failed' ? '❌ Failed' : ''}
1685
+ </span>` : '';
1686
+
1687
+ return `
1688
+ <div class="finding-item ${finding.severity}" onclick='showFindingDetail(${JSON.stringify(finding).replace(/'/g, "\\'")})' style="display: flex; gap: 12px;">
1689
+ <input type="checkbox"
1690
+ class="finding-checkbox"
1691
+ data-finding-id="${finding.id}"
1692
+ onclick='toggleFindingSelection("${finding.id}", event)'
1693
+ ${selectedFindings.has(finding.id) ? 'checked' : ''}>
1694
+ <div style="flex: 1;">
1695
+ <div class="finding-header">
1696
+ <div class="finding-title">${finding.title}</div>
1697
+ <div class="finding-badges">
1698
+ <span class="severity-badge ${finding.severity}">${finding.severity}</span>
1699
+ <span class="dimension-badge">${finding.dimension}</span>
1700
+ </div>
1701
+ </div>
1702
+ <div class="finding-file">📄 ${finding.file}:${finding.line}</div>
1703
+ <div class="finding-description">${finding.description.substring(0, 200)}${finding.description.length > 200 ? '...' : ''}</div>
1704
+ ${fixStatusBadge}
1705
+ </div>
1706
+ </div>
1707
+ `;
1708
+ }).join('');
1709
+ }
1710
+
1711
+ // Show finding detail in drawer
1712
+ function showFindingDetail(finding) {
1713
+ const drawer = document.getElementById('findingDrawer');
1714
+ const overlay = document.getElementById('drawerOverlay');
1715
+ const content = document.getElementById('drawerContent');
1716
+
1717
+ document.getElementById('drawerTitle').textContent = finding.title;
1718
+
1719
+ content.innerHTML = `
1720
+ <div class="drawer-section">
1721
+ <div style="display: flex; gap: 10px; margin-bottom: 15px;">
1722
+ <span class="severity-badge ${finding.severity}">${finding.severity}</span>
1723
+ <span class="dimension-badge">${finding.dimension}</span>
1724
+ </div>
1725
+ </div>
1726
+
1727
+ <div class="drawer-section">
1728
+ <div class="drawer-section-title">📄 Location</div>
1729
+ <div class="metadata-grid">
1730
+ <div class="metadata-item">
1731
+ <div class="metadata-label">File</div>
1732
+ <div class="metadata-value" style="font-family: monospace; font-size: 0.85rem;">${finding.file}</div>
1733
+ </div>
1734
+ <div class="metadata-item">
1735
+ <div class="metadata-label">Line</div>
1736
+ <div class="metadata-value">${finding.line}</div>
1737
+ </div>
1738
+ ${finding.category ? `
1739
+ <div class="metadata-item">
1740
+ <div class="metadata-label">Category</div>
1741
+ <div class="metadata-value">${finding.category}</div>
1742
+ </div>
1743
+ ` : ''}
1744
+ </div>
1745
+ </div>
1746
+
1747
+ <div class="drawer-section">
1748
+ <div class="drawer-section-title">📝 Description</div>
1749
+ <p style="line-height: 1.8;">${finding.description}</p>
1750
+ </div>
1751
+
1752
+ ${finding.snippet ? `
1753
+ <div class="drawer-section">
1754
+ <div class="drawer-section-title">đŸ’ģ Code Snippet</div>
1755
+ <div class="code-snippet">${escapeHtml(finding.snippet)}</div>
1756
+ </div>
1757
+ ` : ''}
1758
+
1759
+ <div class="drawer-section">
1760
+ <div class="drawer-section-title">✅ Recommendation</div>
1761
+ <div class="recommendation-box">
1762
+ ${finding.recommendation}
1763
+ </div>
1764
+ </div>
1765
+
1766
+ ${finding.impact ? `
1767
+ <div class="drawer-section">
1768
+ <div class="drawer-section-title">âš ī¸ Impact</div>
1769
+ <p style="line-height: 1.8;">${finding.impact}</p>
1770
+ </div>
1771
+ ` : ''}
1772
+
1773
+ ${finding.references && finding.references.length > 0 ? `
1774
+ <div class="drawer-section">
1775
+ <div class="drawer-section-title">🔗 References</div>
1776
+ <ul class="reference-list">
1777
+ ${finding.references.map(ref => {
1778
+ const isUrl = ref.startsWith('http');
1779
+ return `<li>${isUrl ? `<a href="${ref}" target="_blank">${ref}</a>` : ref}</li>`;
1780
+ }).join('')}
1781
+ </ul>
1782
+ </div>
1783
+ ` : ''}
1784
+
1785
+ ${finding.metadata ? `
1786
+ <div class="drawer-section">
1787
+ <div class="drawer-section-title">â„šī¸ Metadata</div>
1788
+ <div class="metadata-grid">
1789
+ ${finding.metadata.cwe_id ? `
1790
+ <div class="metadata-item">
1791
+ <div class="metadata-label">CWE ID</div>
1792
+ <div class="metadata-value">${finding.metadata.cwe_id}</div>
1793
+ </div>
1794
+ ` : ''}
1795
+ ${finding.metadata.owasp_category ? `
1796
+ <div class="metadata-item">
1797
+ <div class="metadata-label">OWASP Category</div>
1798
+ <div class="metadata-value">${finding.metadata.owasp_category}</div>
1799
+ </div>
1800
+ ` : ''}
1801
+ ${finding.metadata.pattern_type ? `
1802
+ <div class="metadata-item">
1803
+ <div class="metadata-label">Pattern Type</div>
1804
+ <div class="metadata-value">${finding.metadata.pattern_type}</div>
1805
+ </div>
1806
+ ` : ''}
1807
+ ${finding.metadata.complexity_score ? `
1808
+ <div class="metadata-item">
1809
+ <div class="metadata-label">Complexity Score</div>
1810
+ <div class="metadata-value">${finding.metadata.complexity_score}</div>
1811
+ </div>
1812
+ ` : ''}
1813
+ </div>
1814
+ </div>
1815
+ ` : ''}
1816
+ `;
1817
+
1818
+ drawer.classList.add('open');
1819
+ overlay.classList.add('show');
1820
+ }
1821
+
1822
+ function closeDrawer() {
1823
+ document.getElementById('findingDrawer').classList.remove('open');
1824
+ document.getElementById('drawerOverlay').classList.remove('show');
1825
+ }
1826
+
1827
+ function escapeHtml(text) {
1828
+ const map = {
1829
+ '&': '&amp;',
1830
+ '<': '&lt;',
1831
+ '>': '&gt;',
1832
+ '"': '&quot;',
1833
+ "'": '&#039;'
1834
+ };
1835
+ return text.replace(/[&<>"']/g, m => map[m]);
1836
+ }
1837
+
1838
+ // Export to Markdown
1839
+ function exportToMarkdown() {
1840
+ if (!reviewState) {
1841
+ alert('Review data not yet loaded. Please wait.');
1842
+ return;
1843
+ }
1844
+
1845
+ let markdown = `# Code Review Report\n\n`;
1846
+ markdown += `**Session**: ${reviewState.session_id}\n`;
1847
+ markdown += `**Review ID**: ${reviewState.review_id}\n`;
1848
+ markdown += `**Date**: ${new Date().toLocaleDateString()}\n`;
1849
+ markdown += `**Dimensions**: ${reviewState.dimensions_reviewed.join(', ')}\n\n`;
1850
+
1851
+ markdown += `## Summary\n\n`;
1852
+ markdown += `- **Total Findings**: ${allFindings.length}\n`;
1853
+ markdown += `- **Critical**: ${reviewState.severity_distribution.critical}\n`;
1854
+ markdown += `- **High**: ${reviewState.severity_distribution.high}\n`;
1855
+ markdown += `- **Medium**: ${reviewState.severity_distribution.medium}\n`;
1856
+ markdown += `- **Low**: ${reviewState.severity_distribution.low}\n\n`;
1857
+
1858
+ // Group by dimension
1859
+ reviewState.dimensions_reviewed.forEach(dim => {
1860
+ const dimFindings = allFindings.filter(f => f.dimension === dim);
1861
+ if (dimFindings.length === 0) return;
1862
+
1863
+ markdown += `## ${dim.charAt(0).toUpperCase() + dim.slice(1)} (${dimFindings.length} findings)\n\n`;
1864
+
1865
+ dimFindings.forEach(finding => {
1866
+ markdown += `### ${finding.title}\n\n`;
1867
+ markdown += `**Severity**: ${finding.severity} \n`;
1868
+ markdown += `**File**: \`${finding.file}:${finding.line}\` \n`;
1869
+ markdown += `**Category**: ${finding.category || 'N/A'} \n\n`;
1870
+ markdown += `${finding.description}\n\n`;
1871
+ markdown += `**Recommendation**: ${finding.recommendation}\n\n`;
1872
+ if (finding.impact) {
1873
+ markdown += `**Impact**: ${finding.impact}\n\n`;
1874
+ }
1875
+ markdown += `---\n\n`;
1876
+ });
1877
+ });
1878
+
1879
+ // Download
1880
+ const blob = new Blob([markdown], { type: 'text/markdown' });
1881
+ const url = URL.createObjectURL(blob);
1882
+ const a = document.createElement('a');
1883
+ const filename = `review-report-${reviewState.review_id}.md`;
1884
+ a.download = filename;
1885
+ a.click();
1886
+ URL.revokeObjectURL(url);
1887
+
1888
+ // ✨ Show export path notification with session directory recommendation
1889
+ const reviewDir = window.location.pathname.replace('/dashboard.html', '').replace('/.review/dashboard.html', '/.review');
1890
+ // Extract absolute path from file:// URL
1891
+ const absolutePath = decodeURIComponent(window.location.pathname).replace(/^\/([A-Z]:)/, '$1');
1892
+ const sessionDir = absolutePath.replace('/.review/dashboard.html', '');
1893
+ const reportsDir = `${sessionDir}/.review/reports`;
1894
+
1895
+ const notification = `
1896
+ ✅ Report exported successfully!
1897
+
1898
+ 📁 File: ${filename}
1899
+ 📂 Browser download: Your Downloads folder
1900
+
1901
+ 📋 Recommended Location:
1902
+ ${reportsDir}/
1903
+
1904
+ 🔄 Move to session directory:
1905
+ # On Windows:
1906
+ move "%USERPROFILE%\\Downloads\\${filename}" "${reportsDir.replace(/\//g, '\\')}\\${filename}"
1907
+
1908
+ # On Mac/Linux:
1909
+ mv ~/Downloads/${filename} ${reportsDir}/${filename}
1910
+
1911
+ 💡 All review files in:
1912
+ ${reportsDir}/
1913
+ `.trim();
1914
+
1915
+ alert(notification);
1916
+ }
1917
+
1918
+ // Initialize
1919
+ document.addEventListener('DOMContentLoaded', () => {
1920
+ initTheme();
1921
+ setupSearch();
1922
+ startPolling();
1923
+ detectFixSession(); // Check for active fix sessions
1924
+
1925
+ document.getElementById('themeToggle').addEventListener('click', toggleTheme);
1926
+ });
1927
+
1928
+ </script>
1929
+ </body>
1930
+ </html>