@proflandrigan/shards 1.1.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 (397) hide show
  1. package/README.md +475 -0
  2. package/package.json +37 -0
  3. package/src/agents/academic.md +276 -0
  4. package/src/agents/ai-engineer.md +377 -0
  5. package/src/agents/analytics-engineer.md +364 -0
  6. package/src/agents/applied-ml-scientist.md +410 -0
  7. package/src/agents/backend-engineer.md +255 -0
  8. package/src/agents/bi-engineer.md +333 -0
  9. package/src/agents/data-analyst.md +343 -0
  10. package/src/agents/data-engineer.md +260 -0
  11. package/src/agents/data-modeller.md +386 -0
  12. package/src/agents/data-scientist.md +366 -0
  13. package/src/agents/deep-learning-engineer.md +389 -0
  14. package/src/agents/ml-engineer.md +424 -0
  15. package/src/agents/mlops-engineer.md +339 -0
  16. package/src/agents/researcher.md +187 -0
  17. package/src/agents/specific_instructions/academic/critical_review.md +263 -0
  18. package/src/agents/specific_instructions/academic/report.md +113 -0
  19. package/src/agents/specific_instructions/ai_engineer/advise.md +162 -0
  20. package/src/agents/specific_instructions/ai_engineer/bi_engineer_handoff.md +86 -0
  21. package/src/agents/specific_instructions/ai_engineer/experiment.md +471 -0
  22. package/src/agents/specific_instructions/ai_engineer/experiment_ui_mode.md +44 -0
  23. package/src/agents/specific_instructions/ai_engineer/phases/index.md +45 -0
  24. package/src/agents/specific_instructions/ai_engineer/phases/phase-1.md +55 -0
  25. package/src/agents/specific_instructions/ai_engineer/phases/phase-2.md +86 -0
  26. package/src/agents/specific_instructions/ai_engineer/phases/phase-3.md +96 -0
  27. package/src/agents/specific_instructions/ai_engineer/phases/phase-4.md +138 -0
  28. package/src/agents/specific_instructions/ai_engineer/phases/phase-5.md +157 -0
  29. package/src/agents/specific_instructions/ai_engineer/phases/phase-6.md +196 -0
  30. package/src/agents/specific_instructions/ai_engineer/phases/phase-7.md +313 -0
  31. package/src/agents/specific_instructions/ai_engineer/phases.md +1011 -0
  32. package/src/agents/specific_instructions/ai_engineer/prompt_lab.md +161 -0
  33. package/src/agents/specific_instructions/ai_engineer/prompt_lab_ui_mode.md +28 -0
  34. package/src/agents/specific_instructions/ai_engineer/research.md +393 -0
  35. package/src/agents/specific_instructions/ai_engineer/research_ui_mode.md +66 -0
  36. package/src/agents/specific_instructions/ai_engineer/review.md +159 -0
  37. package/src/agents/specific_instructions/ai_engineer/validation_checklist.md +182 -0
  38. package/src/agents/specific_instructions/analytics_engineer/advise.md +155 -0
  39. package/src/agents/specific_instructions/analytics_engineer/bi_engineer_handoff.md +91 -0
  40. package/src/agents/specific_instructions/analytics_engineer/data_analyst_handoff.md +84 -0
  41. package/src/agents/specific_instructions/analytics_engineer/deep_phases.md +818 -0
  42. package/src/agents/specific_instructions/analytics_engineer/phases_deep/index.md +24 -0
  43. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-1.md +77 -0
  44. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-2.md +106 -0
  45. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-3.md +93 -0
  46. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-4.md +79 -0
  47. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-5.md +61 -0
  48. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-6.md +45 -0
  49. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-7.md +235 -0
  50. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-8.md +221 -0
  51. package/src/agents/specific_instructions/analytics_engineer/phases_quick/index.md +19 -0
  52. package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-1.md +47 -0
  53. package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-2.md +78 -0
  54. package/src/agents/specific_instructions/analytics_engineer/quick_phases.md +112 -0
  55. package/src/agents/specific_instructions/analytics_engineer/review.md +167 -0
  56. package/src/agents/specific_instructions/analytics_engineer/service_mode.md +369 -0
  57. package/src/agents/specific_instructions/analytics_engineer/ui_mode.md +45 -0
  58. package/src/agents/specific_instructions/analytics_engineer/update.md +162 -0
  59. package/src/agents/specific_instructions/analytics_engineer/validation_checklist.md +121 -0
  60. package/src/agents/specific_instructions/applied_ml_scientist/advise.md +143 -0
  61. package/src/agents/specific_instructions/applied_ml_scientist/phases/index.md +21 -0
  62. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-1.md +51 -0
  63. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-2.md +66 -0
  64. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-3.md +113 -0
  65. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-4.md +104 -0
  66. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-5.md +156 -0
  67. package/src/agents/specific_instructions/applied_ml_scientist/phases.md +428 -0
  68. package/src/agents/specific_instructions/applied_ml_scientist/research.md +379 -0
  69. package/src/agents/specific_instructions/applied_ml_scientist/review.md +142 -0
  70. package/src/agents/specific_instructions/applied_ml_scientist/validation_checklist.md +136 -0
  71. package/src/agents/specific_instructions/backend_engineer/clean.md +149 -0
  72. package/src/agents/specific_instructions/backend_engineer/review.md +91 -0
  73. package/src/agents/specific_instructions/backend_engineer/review_checklist.md +54 -0
  74. package/src/agents/specific_instructions/backend_engineer/service_mode.md +67 -0
  75. package/src/agents/specific_instructions/bi_engineer/advise.md +137 -0
  76. package/src/agents/specific_instructions/bi_engineer/data_analyst_handoff.md +77 -0
  77. package/src/agents/specific_instructions/bi_engineer/incoming_handoff.md +45 -0
  78. package/src/agents/specific_instructions/bi_engineer/phases/index.md +20 -0
  79. package/src/agents/specific_instructions/bi_engineer/phases/phase-1.md +164 -0
  80. package/src/agents/specific_instructions/bi_engineer/phases/phase-2.md +92 -0
  81. package/src/agents/specific_instructions/bi_engineer/phases/phase-3.md +121 -0
  82. package/src/agents/specific_instructions/bi_engineer/phases/phase-4.md +106 -0
  83. package/src/agents/specific_instructions/bi_engineer/phases.md +451 -0
  84. package/src/agents/specific_instructions/bi_engineer/review.md +166 -0
  85. package/src/agents/specific_instructions/bi_engineer/update.md +147 -0
  86. package/src/agents/specific_instructions/bi_engineer/validation_checklist.md +124 -0
  87. package/src/agents/specific_instructions/data_analyst/advise.md +138 -0
  88. package/src/agents/specific_instructions/data_analyst/explain.md +221 -0
  89. package/src/agents/specific_instructions/data_analyst/incoming_handoff.md +40 -0
  90. package/src/agents/specific_instructions/data_analyst/phases/index.md +20 -0
  91. package/src/agents/specific_instructions/data_analyst/phases/phase-1.md +159 -0
  92. package/src/agents/specific_instructions/data_analyst/phases/phase-2.md +112 -0
  93. package/src/agents/specific_instructions/data_analyst/phases/phase-3.md +265 -0
  94. package/src/agents/specific_instructions/data_analyst/phases/phase-4.md +100 -0
  95. package/src/agents/specific_instructions/data_analyst/phases.md +501 -0
  96. package/src/agents/specific_instructions/data_analyst/review.md +138 -0
  97. package/src/agents/specific_instructions/data_analyst/ui_mode.md +26 -0
  98. package/src/agents/specific_instructions/data_analyst/update.md +144 -0
  99. package/src/agents/specific_instructions/data_analyst/validation_checklist.md +95 -0
  100. package/src/agents/specific_instructions/data_engineer/advise.md +137 -0
  101. package/src/agents/specific_instructions/data_engineer/phases.md +466 -0
  102. package/src/agents/specific_instructions/data_engineer/phases_deep/index.md +23 -0
  103. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-1.md +49 -0
  104. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-2.md +93 -0
  105. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-3.md +55 -0
  106. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-4.md +48 -0
  107. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-5.md +40 -0
  108. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-6.md +102 -0
  109. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-7.md +87 -0
  110. package/src/agents/specific_instructions/data_engineer/phases_quick/index.md +19 -0
  111. package/src/agents/specific_instructions/data_engineer/phases_quick/phase-1.md +45 -0
  112. package/src/agents/specific_instructions/data_engineer/phases_quick/phase-2.md +54 -0
  113. package/src/agents/specific_instructions/data_engineer/review.md +135 -0
  114. package/src/agents/specific_instructions/data_engineer/validation_checklist.md +136 -0
  115. package/src/agents/specific_instructions/data_modeller/advise.md +137 -0
  116. package/src/agents/specific_instructions/data_modeller/phases.md +581 -0
  117. package/src/agents/specific_instructions/data_modeller/phases_deep/index.md +23 -0
  118. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-1.md +52 -0
  119. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-2.md +113 -0
  120. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-3.md +47 -0
  121. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-4.md +51 -0
  122. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-5.md +45 -0
  123. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-6.md +105 -0
  124. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-7.md +136 -0
  125. package/src/agents/specific_instructions/data_modeller/phases_quick/index.md +19 -0
  126. package/src/agents/specific_instructions/data_modeller/phases_quick/phase-1.md +47 -0
  127. package/src/agents/specific_instructions/data_modeller/phases_quick/phase-2.md +65 -0
  128. package/src/agents/specific_instructions/data_modeller/review.md +141 -0
  129. package/src/agents/specific_instructions/data_modeller/service_mode.md +218 -0
  130. package/src/agents/specific_instructions/data_modeller/validation_checklist.md +125 -0
  131. package/src/agents/specific_instructions/data_scientist/advise.md +158 -0
  132. package/src/agents/specific_instructions/data_scientist/bi_engineer_handoff.md +63 -0
  133. package/src/agents/specific_instructions/data_scientist/experiment.md +482 -0
  134. package/src/agents/specific_instructions/data_scientist/experiment_ui_mode.md +44 -0
  135. package/src/agents/specific_instructions/data_scientist/explain.md +247 -0
  136. package/src/agents/specific_instructions/data_scientist/greenfield_data.md +35 -0
  137. package/src/agents/specific_instructions/data_scientist/ml_engineer_handoff.md +52 -0
  138. package/src/agents/specific_instructions/data_scientist/notebook_walkthrough.md +76 -0
  139. package/src/agents/specific_instructions/data_scientist/phases/index.md +24 -0
  140. package/src/agents/specific_instructions/data_scientist/phases/phase-1.md +45 -0
  141. package/src/agents/specific_instructions/data_scientist/phases/phase-2.md +67 -0
  142. package/src/agents/specific_instructions/data_scientist/phases/phase-3.md +89 -0
  143. package/src/agents/specific_instructions/data_scientist/phases/phase-4.md +143 -0
  144. package/src/agents/specific_instructions/data_scientist/phases/phase-5.md +71 -0
  145. package/src/agents/specific_instructions/data_scientist/phases/phase-6.md +239 -0
  146. package/src/agents/specific_instructions/data_scientist/phases/phase-7.md +207 -0
  147. package/src/agents/specific_instructions/data_scientist/phases.md +651 -0
  148. package/src/agents/specific_instructions/data_scientist/research.md +345 -0
  149. package/src/agents/specific_instructions/data_scientist/research_ui_mode.md +52 -0
  150. package/src/agents/specific_instructions/data_scientist/review.md +136 -0
  151. package/src/agents/specific_instructions/data_scientist/service_mode.md +247 -0
  152. package/src/agents/specific_instructions/data_scientist/validation_checklist.md +183 -0
  153. package/src/agents/specific_instructions/deep_learning_engineer/advise.md +145 -0
  154. package/src/agents/specific_instructions/deep_learning_engineer/phases/index.md +21 -0
  155. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-1.md +74 -0
  156. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-2.md +98 -0
  157. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-3.md +76 -0
  158. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-4.md +128 -0
  159. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-5.md +292 -0
  160. package/src/agents/specific_instructions/deep_learning_engineer/phases.md +567 -0
  161. package/src/agents/specific_instructions/deep_learning_engineer/research.md +389 -0
  162. package/src/agents/specific_instructions/deep_learning_engineer/review.md +155 -0
  163. package/src/agents/specific_instructions/deep_learning_engineer/validation_checklist.md +147 -0
  164. package/src/agents/specific_instructions/ml_engineer/advise.md +174 -0
  165. package/src/agents/specific_instructions/ml_engineer/bi_engineer_handoff.md +71 -0
  166. package/src/agents/specific_instructions/ml_engineer/experiment.md +474 -0
  167. package/src/agents/specific_instructions/ml_engineer/experiment_ui_mode.md +44 -0
  168. package/src/agents/specific_instructions/ml_engineer/notebook_walkthrough.md +75 -0
  169. package/src/agents/specific_instructions/ml_engineer/phases/index.md +25 -0
  170. package/src/agents/specific_instructions/ml_engineer/phases/phase-1.md +49 -0
  171. package/src/agents/specific_instructions/ml_engineer/phases/phase-2.md +75 -0
  172. package/src/agents/specific_instructions/ml_engineer/phases/phase-3.md +124 -0
  173. package/src/agents/specific_instructions/ml_engineer/phases/phase-4.md +279 -0
  174. package/src/agents/specific_instructions/ml_engineer/phases/phase-5.md +160 -0
  175. package/src/agents/specific_instructions/ml_engineer/phases/phase-6-5.md +170 -0
  176. package/src/agents/specific_instructions/ml_engineer/phases/phase-6.md +295 -0
  177. package/src/agents/specific_instructions/ml_engineer/phases/phase-7.md +337 -0
  178. package/src/agents/specific_instructions/ml_engineer/phases.md +1068 -0
  179. package/src/agents/specific_instructions/ml_engineer/research.md +437 -0
  180. package/src/agents/specific_instructions/ml_engineer/research_ui_mode.md +71 -0
  181. package/src/agents/specific_instructions/ml_engineer/review.md +187 -0
  182. package/src/agents/specific_instructions/ml_engineer/service_mode.md +273 -0
  183. package/src/agents/specific_instructions/ml_engineer/validation_checklist.md +185 -0
  184. package/src/agents/specific_instructions/mlops_engineer/advise.md +139 -0
  185. package/src/agents/specific_instructions/mlops_engineer/phases/index.md +23 -0
  186. package/src/agents/specific_instructions/mlops_engineer/phases/phase-1.md +52 -0
  187. package/src/agents/specific_instructions/mlops_engineer/phases/phase-2.md +86 -0
  188. package/src/agents/specific_instructions/mlops_engineer/phases/phase-3.md +105 -0
  189. package/src/agents/specific_instructions/mlops_engineer/phases/phase-4.md +128 -0
  190. package/src/agents/specific_instructions/mlops_engineer/phases/phase-5.md +106 -0
  191. package/src/agents/specific_instructions/mlops_engineer/phases/phase-6.md +128 -0
  192. package/src/agents/specific_instructions/mlops_engineer/phases/phase-7.md +144 -0
  193. package/src/agents/specific_instructions/mlops_engineer/phases.md +671 -0
  194. package/src/agents/specific_instructions/mlops_engineer/review.md +164 -0
  195. package/src/agents/specific_instructions/mlops_engineer/service_mode.md +81 -0
  196. package/src/agents/specific_instructions/mlops_engineer/validation_checklist.md +151 -0
  197. package/src/agents/specific_instructions/researcher/critical_review.md +292 -0
  198. package/src/agents/specific_instructions/researcher/review_checklist.md +67 -0
  199. package/src/agents/specific_instructions/researcher/service_mode.md +224 -0
  200. package/src/agents/specific_instructions/shared/auto_verify_mode.md +141 -0
  201. package/src/agents/specific_instructions/shared/autonomous_research.md +1289 -0
  202. package/src/agents/specific_instructions/shared/behavioral_rules.md +36 -0
  203. package/src/agents/specific_instructions/shared/diverge_protocol.md +387 -0
  204. package/src/agents/specific_instructions/shared/engineering_guidelines.md +136 -0
  205. package/src/agents/specific_instructions/shared/experiment_versioning.md +184 -0
  206. package/src/agents/specific_instructions/shared/goal_mode.md +187 -0
  207. package/src/agents/specific_instructions/shared/incremental_testing.md +139 -0
  208. package/src/agents/specific_instructions/shared/intent_discovery.md +223 -0
  209. package/src/agents/specific_instructions/shared/join_path_protocol.md +168 -0
  210. package/src/agents/specific_instructions/shared/knowledge_checkpoint.md +83 -0
  211. package/src/agents/specific_instructions/shared/knowledge_harvest.md +220 -0
  212. package/src/agents/specific_instructions/shared/knowledge_retrieval.md +100 -0
  213. package/src/agents/specific_instructions/shared/notebook_walkthrough_protocol.md +367 -0
  214. package/src/agents/specific_instructions/shared/reviewer_verdict_protocol.md +74 -0
  215. package/src/agents/specific_instructions/shared/swarm_protocol.md +97 -0
  216. package/src/agents/specific_instructions/shared/validation_protocol.md +139 -0
  217. package/src/agents/specific_instructions/syn/arbiter.md +140 -0
  218. package/src/agents/specific_instructions/syn/brainstorm.md +550 -0
  219. package/src/agents/specific_instructions/syn/code_review.md +232 -0
  220. package/src/agents/specific_instructions/syn/diff.md +239 -0
  221. package/src/agents/specific_instructions/syn/final_review.md +65 -0
  222. package/src/agents/specific_instructions/syn/fixer.md +240 -0
  223. package/src/agents/specific_instructions/syn/free_form.md +130 -0
  224. package/src/agents/specific_instructions/syn/knowledge.md +468 -0
  225. package/src/agents/specific_instructions/syn/notebook_walkthrough.md +78 -0
  226. package/src/agents/specific_instructions/syn/panel_review.md +634 -0
  227. package/src/agents/specific_instructions/syn/pm.md +453 -0
  228. package/src/agents/specific_instructions/syn/pr_review.md +255 -0
  229. package/src/agents/specific_instructions/syn/slides.md +417 -0
  230. package/src/agents/syn.md +729 -0
  231. package/src/commands/academic.md +41 -0
  232. package/src/commands/ai-engineer.md +45 -0
  233. package/src/commands/analytics-engineer.md +48 -0
  234. package/src/commands/applied-ml-scientist.md +45 -0
  235. package/src/commands/backend-engineer.md +35 -0
  236. package/src/commands/bi-engineer.md +40 -0
  237. package/src/commands/brainstorm.md +24 -0
  238. package/src/commands/data-analyst.md +38 -0
  239. package/src/commands/data-engineer.md +37 -0
  240. package/src/commands/data-modeller.md +38 -0
  241. package/src/commands/data-scientist.md +38 -0
  242. package/src/commands/deep-learning-engineer.md +47 -0
  243. package/src/commands/end.md +49 -0
  244. package/src/commands/knowledge.md +24 -0
  245. package/src/commands/ml-engineer.md +42 -0
  246. package/src/commands/mlops-engineer.md +47 -0
  247. package/src/commands/notebook-walkthrough.md +58 -0
  248. package/src/commands/researcher.md +40 -0
  249. package/src/commands/resume.md +57 -0
  250. package/src/commands/review-pr.md +26 -0
  251. package/src/commands/shards-guide.md +41 -0
  252. package/src/commands/shards-ui.md +32 -0
  253. package/src/commands/shards.md +41 -0
  254. package/src/docs/01-getting-started/concepts.md +109 -0
  255. package/src/docs/01-getting-started/first-session.md +79 -0
  256. package/src/docs/01-getting-started/install.md +61 -0
  257. package/src/docs/02-agents/academic.md +71 -0
  258. package/src/docs/02-agents/ai-engineer.md +78 -0
  259. package/src/docs/02-agents/analytics-engineer.md +58 -0
  260. package/src/docs/02-agents/applied-ml-scientist.md +59 -0
  261. package/src/docs/02-agents/backend-engineer.md +58 -0
  262. package/src/docs/02-agents/bi-engineer.md +65 -0
  263. package/src/docs/02-agents/data-analyst.md +67 -0
  264. package/src/docs/02-agents/data-engineer.md +57 -0
  265. package/src/docs/02-agents/data-modeller.md +51 -0
  266. package/src/docs/02-agents/data-scientist.md +78 -0
  267. package/src/docs/02-agents/deep-learning-engineer.md +64 -0
  268. package/src/docs/02-agents/ml-engineer.md +80 -0
  269. package/src/docs/02-agents/mlops-engineer.md +59 -0
  270. package/src/docs/02-agents/overview.md +62 -0
  271. package/src/docs/02-agents/researcher.md +73 -0
  272. package/src/docs/02-agents/syn.md +88 -0
  273. package/src/docs/03-protocols/auto-verify.md +82 -0
  274. package/src/docs/03-protocols/autonomous-research.md +59 -0
  275. package/src/docs/03-protocols/behavioral-rules.md +35 -0
  276. package/src/docs/03-protocols/diverge.md +50 -0
  277. package/src/docs/03-protocols/engineering-guidelines.md +56 -0
  278. package/src/docs/03-protocols/experiment-versioning.md +38 -0
  279. package/src/docs/03-protocols/gate-pattern.md +65 -0
  280. package/src/docs/03-protocols/incremental-testing.md +68 -0
  281. package/src/docs/03-protocols/join-path.md +46 -0
  282. package/src/docs/03-protocols/knowledge-ledger.md +70 -0
  283. package/src/docs/03-protocols/reviewer-verdicts.md +39 -0
  284. package/src/docs/03-protocols/swarm.md +40 -0
  285. package/src/docs/03-protocols/validation.md +174 -0
  286. package/src/docs/04-ui/activity-bar.md +70 -0
  287. package/src/docs/04-ui/chat-pane.md +80 -0
  288. package/src/docs/04-ui/code-intel.md +62 -0
  289. package/src/docs/04-ui/file-editing.md +61 -0
  290. package/src/docs/04-ui/git.md +54 -0
  291. package/src/docs/04-ui/keybindings.md +79 -0
  292. package/src/docs/04-ui/knowledge-map.md +76 -0
  293. package/src/docs/04-ui/overview.md +93 -0
  294. package/src/docs/04-ui/panels.md +49 -0
  295. package/src/docs/04-ui/pinboard-selection.md +66 -0
  296. package/src/docs/04-ui/quick-open-palette.md +56 -0
  297. package/src/docs/04-ui/sessions.md +81 -0
  298. package/src/docs/04-ui/settings-permissions.md +56 -0
  299. package/src/docs/05-commands/reference.md +59 -0
  300. package/src/docs/06-outputs/directory-map.md +116 -0
  301. package/src/docs/07-workflows/ai-eval-first.md +57 -0
  302. package/src/docs/07-workflows/deep-study-to-production.md +76 -0
  303. package/src/docs/07-workflows/diverge-exploration.md +77 -0
  304. package/src/docs/07-workflows/quick-analysis.md +45 -0
  305. package/src/docs/08-integrations/claude-code-auto-mode.md +191 -0
  306. package/src/docs/08-integrations/google-slides.md +175 -0
  307. package/src/docs/README.md +30 -0
  308. package/src/docs/manifest.json +108 -0
  309. package/src/templates/analysis-template.md +20 -0
  310. package/src/templates/branch-report.md +46 -0
  311. package/src/templates/diff-report.md +88 -0
  312. package/src/templates/knowledge-index.md +7 -0
  313. package/src/templates/model-card-schema.json +186 -0
  314. package/src/templates/model-card-schema.md +88 -0
  315. package/src/templates/model-card.md +124 -0
  316. package/src/templates/project-plan.md +47 -0
  317. package/src/templates/project-specs.md +81 -0
  318. package/src/templates/report-template.md +43 -0
  319. package/src/templates/study-template.md +25 -0
  320. package/src/ui/cc-readonly.js +181 -0
  321. package/src/ui/chat-session.js +466 -0
  322. package/src/ui/css/base.css +136 -0
  323. package/src/ui/css/brainstorm.css +525 -0
  324. package/src/ui/css/chat.css +1405 -0
  325. package/src/ui/css/editor.css +546 -0
  326. package/src/ui/css/eval-dashboard.css +157 -0
  327. package/src/ui/css/experiment.css +237 -0
  328. package/src/ui/css/guide.css +186 -0
  329. package/src/ui/css/knowledge-map.css +383 -0
  330. package/src/ui/css/layout.css +431 -0
  331. package/src/ui/css/model-card.css +161 -0
  332. package/src/ui/css/notebook-walkthrough.css +271 -0
  333. package/src/ui/css/pr-review.css +403 -0
  334. package/src/ui/css/prompt-lab.css +325 -0
  335. package/src/ui/css/sessions.css +258 -0
  336. package/src/ui/css/sidebar.css +661 -0
  337. package/src/ui/css/terminal.css +113 -0
  338. package/src/ui/css/theme-light.css +542 -0
  339. package/src/ui/index.html +389 -0
  340. package/src/ui/js/agents.js +32 -0
  341. package/src/ui/js/bookmarks.js +230 -0
  342. package/src/ui/js/chat.js +1776 -0
  343. package/src/ui/js/code-intel.js +328 -0
  344. package/src/ui/js/command-palette.js +142 -0
  345. package/src/ui/js/events.js +591 -0
  346. package/src/ui/js/explorer.js +317 -0
  347. package/src/ui/js/file-view.js +477 -0
  348. package/src/ui/js/git.js +536 -0
  349. package/src/ui/js/guide.js +198 -0
  350. package/src/ui/js/hud.js +75 -0
  351. package/src/ui/js/init.js +351 -0
  352. package/src/ui/js/knowledge-map.js +906 -0
  353. package/src/ui/js/markdown.js +114 -0
  354. package/src/ui/js/monaco.js +164 -0
  355. package/src/ui/js/notebook-walkthrough.js +272 -0
  356. package/src/ui/js/notebook.js +448 -0
  357. package/src/ui/js/panels.js +2681 -0
  358. package/src/ui/js/pinboard.js +186 -0
  359. package/src/ui/js/quick-open.js +164 -0
  360. package/src/ui/js/selection-context.js +131 -0
  361. package/src/ui/js/sessions.js +256 -0
  362. package/src/ui/js/settings.js +476 -0
  363. package/src/ui/js/split-view.js +82 -0
  364. package/src/ui/js/state.js +343 -0
  365. package/src/ui/js/table.js +161 -0
  366. package/src/ui/js/tabs.js +284 -0
  367. package/src/ui/js/tabular.js +125 -0
  368. package/src/ui/js/terminal.js +354 -0
  369. package/src/ui/js/timeline.js +137 -0
  370. package/src/ui/js/utils.js +293 -0
  371. package/src/ui/notebook-kernel.py +790 -0
  372. package/src/ui/open-browser.js +55 -0
  373. package/src/ui/permission-pattern.js +42 -0
  374. package/src/ui/relay.js +513 -0
  375. package/src/ui/server.js +3072 -0
  376. package/src/ui/session-index.js +225 -0
  377. package/src/ui/shards_icon.png +0 -0
  378. package/src/ui/spawn-server.js +41 -0
  379. package/src/ui/symbol-index.js +813 -0
  380. package/src/ui/ui-push.js +177 -0
  381. package/tools/gate-hook/VALIDATION_SPEC.md +273 -0
  382. package/tools/gate-hook/__tests__/auto-verify.test.js +343 -0
  383. package/tools/gate-hook/auto-allowlist.js +179 -0
  384. package/tools/gate-hook/auto-state.js +68 -0
  385. package/tools/gate-hook/classify.js +21 -0
  386. package/tools/gate-hook/log.js +57 -0
  387. package/tools/gate-hook/parser.js +205 -0
  388. package/tools/gate-hook/sql-guard.js +230 -0
  389. package/tools/gate-hook/state.js +170 -0
  390. package/tools/gate-hook/sweep.js +139 -0
  391. package/tools/gate-hook/transcript.js +45 -0
  392. package/tools/gate-hook/validation.js +321 -0
  393. package/tools/gate-hook.js +475 -0
  394. package/tools/install.js +914 -0
  395. package/tools/shards-gates.js +311 -0
  396. package/tools/shards-sessions.js +261 -0
  397. package/tools/shards-ui.js +377 -0
@@ -0,0 +1,536 @@
1
+ // ═══════════════════════════════════════════════════════════════
2
+ // Git status & diff integration
3
+ // ═══════════════════════════════════════════════════════════════
4
+
5
+ var gitCurrentBranch = null;
6
+ var gitChanges = []; // [{ path, status, staged }]
7
+ var gitChangesMap = {}; // path -> { status, staged }
8
+ var gitDiffInstance = null; // Monaco diff editor instance
9
+ var gitRefreshTimer = null;
10
+ var activeGitRepo = null; // null = PROJECT_DIR root; string = subrepo relPath (e.g. "repo-a")
11
+ var discoveredRepos = []; // [{ name, relPath, branch }]
12
+
13
+ // Append ?repo=<activeGitRepo> to a URL (or &repo= if query string already present)
14
+ function gitUrl(base) {
15
+ if (!activeGitRepo || activeGitRepo === '.') return base;
16
+ var sep = base.indexOf('?') === -1 ? '?' : '&';
17
+ return base + sep + 'repo=' + encodeURIComponent(activeGitRepo);
18
+ }
19
+
20
+ async function fetchGitStatus() {
21
+ try {
22
+ var res = await authFetch(gitUrl('/git/status'));
23
+ var data = await res.json();
24
+ if (data.error && !data.branch) {
25
+ gitCurrentBranch = null;
26
+ gitChanges = [];
27
+ gitChangesMap = {};
28
+ } else {
29
+ var prevBranch = gitCurrentBranch;
30
+ gitCurrentBranch = data.branch;
31
+ gitChanges = data.changes || [];
32
+ gitChangesMap = {};
33
+ // If branch changed, re-detect PR
34
+ if (prevBranch !== gitCurrentBranch && typeof fetchPRInfo === 'function') {
35
+ gitPRInfo = null;
36
+ gitPRCommentCount = 0;
37
+ if (gitPRCountInterval) { clearInterval(gitPRCountInterval); gitPRCountInterval = null; }
38
+ fetchPRInfo();
39
+ }
40
+ for (var i = 0; i < gitChanges.length; i++) {
41
+ gitChangesMap[gitChanges[i].path] = gitChanges[i];
42
+ }
43
+ }
44
+ renderGitChanges();
45
+ if (typeof renderHud === 'function') renderHud();
46
+ // Invalidate diff cache for files no longer changed
47
+ for (var p in openFiles) {
48
+ if (openFiles[p].cachedDiffData && !gitChangesMap[p]) {
49
+ openFiles[p].cachedDiffData = false;
50
+ if (openFiles[p].diffMode) {
51
+ openFiles[p].diffMode = false;
52
+ }
53
+ }
54
+ }
55
+ // Update diff button for current file
56
+ var curKey = typeof getCurrentFileKey === 'function' ? getCurrentFileKey() : null;
57
+ if (curKey && typeof updateDiffButtonState === 'function') updateDiffButtonState(curKey);
58
+ // Refresh tab badges
59
+ if (typeof renderWsTabs === 'function') renderWsTabs();
60
+ } catch (e) {
61
+ // Git not available or network error
62
+ }
63
+ }
64
+
65
+ function renderGitChanges() {
66
+ var list = document.getElementById('git-changes-list');
67
+ var branchLabel = document.getElementById('git-branch-label');
68
+ var emptyState = document.getElementById('git-view-empty');
69
+ var badge = document.getElementById('activity-git-badge');
70
+ if (!list) return;
71
+
72
+ // Update branch label in git view header
73
+ if (branchLabel) {
74
+ branchLabel.textContent = gitCurrentBranch || '';
75
+ branchLabel.title = gitCurrentBranch || '';
76
+ }
77
+
78
+ var count = gitChanges ? gitChanges.length : 0;
79
+
80
+ // Update activity bar badge
81
+ if (badge) {
82
+ if (count > 0) {
83
+ badge.textContent = count > 99 ? '99+' : String(count);
84
+ badge.style.display = '';
85
+ } else {
86
+ badge.style.display = 'none';
87
+ }
88
+ }
89
+
90
+ // Toggle empty state
91
+ if (emptyState) emptyState.style.display = count === 0 ? '' : 'none';
92
+
93
+ list.innerHTML = '';
94
+ if (count === 0) return;
95
+
96
+ for (var i = 0; i < gitChanges.length; i++) {
97
+ var change = gitChanges[i];
98
+ var entry = document.createElement('div');
99
+ entry.className = 'git-change-entry';
100
+ entry.title = change.path + ' (' + change.status + (change.staged ? ', staged' : '') + ')';
101
+
102
+ var badgeLetter = change.status === 'modified' ? 'M' :
103
+ change.status === 'added' ? 'A' :
104
+ change.status === 'deleted' ? 'D' :
105
+ change.status === 'untracked' ? 'U' :
106
+ change.status === 'renamed' ? 'R' : '?';
107
+
108
+ var parts = change.path.split('/');
109
+ var name = parts.pop();
110
+ var dir = parts.length > 0 ? parts.join('/') : '';
111
+
112
+ entry.innerHTML =
113
+ '<span class="git-status-badge ' + change.status + '">' + badgeLetter + '</span>' +
114
+ '<span class="dir-name">' + esc(name) + '</span>' +
115
+ (dir ? '<span class="git-dir">' + esc(dir) + '</span>' : '');
116
+
117
+ entry.addEventListener('click', (function(fp, st) {
118
+ return function() { openGitDiff(fp, st); };
119
+ })(change.path, change.status));
120
+ if (typeof makeExplorerEntryDraggable === 'function') makeExplorerEntryDraggable(entry, change.path);
121
+
122
+ list.appendChild(entry);
123
+ }
124
+ }
125
+
126
+ async function openGitDiff(filePath, status) {
127
+ try {
128
+ var res = await authFetch(gitUrl('/git/diff?path=' + encodeURIComponent(filePath)));
129
+ var data = await res.json();
130
+ if (data.error) return;
131
+
132
+ // Open as a special diff tab
133
+ var tabId = 'diff:' + filePath;
134
+ openFiles[tabId] = {
135
+ content: data.modified || '',
136
+ absPath: filePath,
137
+ originalContent: data.original || '',
138
+ modified: false,
139
+ editMode: false,
140
+ tabularData: null,
141
+ tabulatorInstance: null,
142
+ media: false,
143
+ gitDiff: true,
144
+ gitOriginal: data.original || '',
145
+ gitModified: data.modified || '',
146
+ gitStatus: status,
147
+ gitPath: filePath,
148
+ };
149
+
150
+ if (fileTabOrder.indexOf(tabId) === -1) {
151
+ fileTabOrder.push(tabId);
152
+ }
153
+
154
+ if (splitMode) {
155
+ renderWsTabs();
156
+ showFileInPane(tabId);
157
+ } else {
158
+ activeTabId = tabId;
159
+ renderWsTabs();
160
+ showActiveContent();
161
+ }
162
+ } catch (e) {}
163
+ }
164
+
165
+ function renderGitDiffPane(tabId) {
166
+ var f = openFiles[tabId];
167
+ if (!f || !f.gitDiff) return;
168
+
169
+ var pathDisplay = document.getElementById('file-path-display');
170
+ pathDisplay.textContent = f.gitPath + ' (diff)';
171
+ document.getElementById('copy-path-btn').style.display = '';
172
+ document.getElementById('edit-btn').style.display = 'none';
173
+ document.getElementById('save-btn').style.display = 'none';
174
+
175
+ // Hide other views
176
+ document.getElementById('file-rendered-view').classList.remove('visible');
177
+ document.getElementById('file-rendered-view').innerHTML = '';
178
+ document.getElementById('file-editor').style.display = 'none';
179
+ document.getElementById('table-view').classList.remove('visible');
180
+ if (typeof destroyTabulator === 'function') destroyTabulator();
181
+ disposeMonacoInstance();
182
+ var monacoFileContainer = document.getElementById('monaco-file-container');
183
+ monacoFileContainer.style.display = 'none';
184
+ monacoFileContainer.innerHTML = '';
185
+
186
+ // Show diff container
187
+ var diffContainer = document.getElementById('git-diff-container');
188
+ diffContainer.classList.add('visible');
189
+ diffContainer.innerHTML = '';
190
+
191
+ // Dispose previous diff editor
192
+ disposeGitDiffEditor();
193
+
194
+ loadMonaco().then(function() {
195
+ var originalModel = monaco.editor.createModel(f.gitOriginal, getMonacoLang(f.gitPath));
196
+ var modifiedModel = monaco.editor.createModel(f.gitModified, getMonacoLang(f.gitPath));
197
+
198
+ gitDiffInstance = monaco.editor.createDiffEditor(diffContainer, {
199
+ theme: currentMonacoTheme(),
200
+ automaticLayout: true,
201
+ readOnly: true,
202
+ renderSideBySide: true,
203
+ minimap: { enabled: false },
204
+ scrollBeyondLastLine: false,
205
+ fontSize: 13,
206
+ fontFamily: "'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace",
207
+ lineHeight: 20,
208
+ scrollbar: { verticalScrollbarSize: 5, horizontalScrollbarSize: 5 },
209
+ overviewRulerLanes: 0,
210
+ padding: { top: 8, bottom: 8 },
211
+ });
212
+
213
+ gitDiffInstance.setModel({
214
+ original: originalModel,
215
+ modified: modifiedModel,
216
+ });
217
+ }).catch(function() {
218
+ // Fallback: show unified diff as plain text
219
+ diffContainer.innerHTML = '<pre style="padding:12px;color:#b0b0c4;font-size:12px;white-space:pre-wrap;overflow:auto;height:100%">' +
220
+ esc(f.content || 'No diff available') + '</pre>';
221
+ });
222
+ }
223
+
224
+ function disposeGitDiffEditor() {
225
+ if (gitDiffInstance) {
226
+ gitDiffInstance.dispose();
227
+ gitDiffInstance = null;
228
+ }
229
+ }
230
+
231
+ function hideGitDiffContainer() {
232
+ var diffContainer = document.getElementById('git-diff-container');
233
+ if (diffContainer) {
234
+ diffContainer.classList.remove('visible');
235
+ diffContainer.innerHTML = '';
236
+ }
237
+ disposeGitDiffEditor();
238
+ }
239
+
240
+ function getGitStatusForFile(relPath) {
241
+ return gitChangesMap[relPath] || null;
242
+ }
243
+
244
+ // ═══════════════════════════════════════════════════════════════
245
+ // Inline diff toggle (in-place diff for normal file tabs)
246
+ // ═══════════════════════════════════════════════════════════════
247
+
248
+ async function toggleDiffMode() {
249
+ var key = typeof getCurrentFileKey === 'function' ? getCurrentFileKey() : null;
250
+ if (!key || !openFiles[key]) return;
251
+ var f = openFiles[key];
252
+
253
+ if (f.diffMode) {
254
+ // Toggle OFF — return to normal file view
255
+ f.diffMode = false;
256
+ hideGitDiffContainer();
257
+ renderFilePane(key);
258
+ return;
259
+ }
260
+
261
+ // Toggle ON
262
+ f.diffMode = true;
263
+ updateDiffButtonState(key);
264
+
265
+ // Use cached diff data if available
266
+ if (f.cachedDiffData) {
267
+ renderInlineDiff(key);
268
+ return;
269
+ }
270
+
271
+ // Fetch diff data from server
272
+ try {
273
+ var res = await authFetch(gitUrl('/git/diff?path=' + encodeURIComponent(key)));
274
+ var data = await res.json();
275
+ if (data.error) { f.diffMode = false; updateDiffButtonState(key); return; }
276
+
277
+ // Cache on the file object
278
+ f.gitOriginal = data.original || '';
279
+ f.gitModified = data.modified || '';
280
+ f.cachedDiffData = true;
281
+
282
+ // Guard against rapid toggle — user may have toggled off during fetch
283
+ if (f.diffMode) {
284
+ renderInlineDiff(key);
285
+ }
286
+ } catch (e) {
287
+ f.diffMode = false;
288
+ updateDiffButtonState(key);
289
+ }
290
+ }
291
+
292
+ function renderInlineDiff(relPath) {
293
+ var f = openFiles[relPath];
294
+ if (!f || !f.diffMode) return;
295
+
296
+ // Update toolbar
297
+ document.getElementById('file-path-display').textContent = relPath + ' (diff)';
298
+ document.getElementById('edit-btn').style.display = 'none';
299
+ document.getElementById('save-btn').style.display = 'none';
300
+
301
+ // Hide normal file views
302
+ document.getElementById('file-rendered-view').classList.remove('visible');
303
+ document.getElementById('file-rendered-view').innerHTML = '';
304
+ document.getElementById('file-editor').style.display = 'none';
305
+ document.getElementById('table-view').classList.remove('visible');
306
+ if (typeof destroyTabulator === 'function') destroyTabulator();
307
+ disposeMonacoInstance();
308
+ var monacoFileContainer = document.getElementById('monaco-file-container');
309
+ monacoFileContainer.style.display = 'none';
310
+ monacoFileContainer.innerHTML = '';
311
+
312
+ // Show diff container
313
+ var diffContainer = document.getElementById('git-diff-container');
314
+ diffContainer.classList.add('visible');
315
+ diffContainer.innerHTML = '';
316
+ disposeGitDiffEditor();
317
+
318
+ loadMonaco().then(function() {
319
+ var originalModel = monaco.editor.createModel(f.gitOriginal, getMonacoLang(relPath));
320
+ var modifiedModel = monaco.editor.createModel(f.gitModified, getMonacoLang(relPath));
321
+
322
+ gitDiffInstance = monaco.editor.createDiffEditor(diffContainer, {
323
+ theme: currentMonacoTheme(),
324
+ automaticLayout: true,
325
+ readOnly: true,
326
+ renderSideBySide: true,
327
+ minimap: { enabled: false },
328
+ scrollBeyondLastLine: false,
329
+ fontSize: 13,
330
+ fontFamily: "'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace",
331
+ lineHeight: 20,
332
+ scrollbar: { verticalScrollbarSize: 5, horizontalScrollbarSize: 5 },
333
+ overviewRulerLanes: 0,
334
+ padding: { top: 8, bottom: 8 },
335
+ });
336
+
337
+ gitDiffInstance.setModel({ original: originalModel, modified: modifiedModel });
338
+ }).catch(function() {
339
+ diffContainer.innerHTML = '<pre style="padding:12px;color:#b0b0c4;font-size:12px;white-space:pre-wrap;overflow:auto;height:100%">' +
340
+ esc('Diff view unavailable') + '</pre>';
341
+ });
342
+
343
+ updateDiffButtonState(relPath);
344
+ }
345
+
346
+ function updateDiffButtonState(relPath) {
347
+ var diffBtn = document.getElementById('diff-btn');
348
+ if (!diffBtn) return;
349
+
350
+ var f = openFiles[relPath];
351
+ if (!f) { diffBtn.style.display = 'none'; return; }
352
+
353
+ // Determine if file is diffable
354
+ var ext = relPath.split('.').pop().toLowerCase();
355
+ var isMedia = f.media || isImageFile(relPath) || isPdfFile(relPath);
356
+ var isNotebook = ext === 'ipynb';
357
+ var isDiffTab = f.gitDiff;
358
+ var hasGitChanges = !!gitChangesMap[relPath];
359
+
360
+ // Hide for: edit mode, media, notebooks, diff: tabs, no git changes
361
+ if (f.editMode || isMedia || isNotebook || isDiffTab || !hasGitChanges) {
362
+ diffBtn.style.display = 'none';
363
+ return;
364
+ }
365
+
366
+ diffBtn.style.display = '';
367
+ diffBtn.className = f.diffMode ? 'toolbar-btn active' : 'toolbar-btn';
368
+ }
369
+
370
+ function scheduleGitRefresh() {
371
+ if (gitRefreshTimer) clearTimeout(gitRefreshTimer);
372
+ gitRefreshTimer = setTimeout(fetchGitStatus, 2000);
373
+ }
374
+
375
+ // Auto-refresh git status periodically (every 15s)
376
+ setInterval(fetchGitStatus, 15000);
377
+
378
+ // ═══════════════════════════════════════════════════════════════
379
+ // GitHub PR integration
380
+ // ═══════════════════════════════════════════════════════════════
381
+
382
+ var gitPRInfo = null; // { number, title, state, url, branch, base, author, reviewDecision }
383
+ var gitPRCommentCount = 0;
384
+ var gitPRCountInterval = null;
385
+ var gitPRLastBranch = null;
386
+
387
+ async function fetchPRInfo() {
388
+ try {
389
+ var res = await authFetch(gitUrl('/git/pr-info'));
390
+ var data = await res.json();
391
+ gitPRInfo = (data && data.pr) ? data.pr : null;
392
+ updatePRHud();
393
+ if (gitPRInfo) {
394
+ // Start polling comment count if not already running
395
+ if (!gitPRCountInterval) {
396
+ fetchPRCommentCount();
397
+ gitPRCountInterval = setInterval(fetchPRCommentCount, 60000);
398
+ }
399
+ } else {
400
+ // No PR — stop polling, clear HUD
401
+ if (gitPRCountInterval) { clearInterval(gitPRCountInterval); gitPRCountInterval = null; }
402
+ gitPRCommentCount = 0;
403
+ updatePRHud();
404
+ }
405
+ } catch (e) {
406
+ // gh not available or network error — silent fail
407
+ }
408
+ }
409
+
410
+ async function fetchPRCommentCount() {
411
+ if (!gitPRInfo) return;
412
+ try {
413
+ var res = await authFetch(gitUrl('/git/pr-comments?pr=' + gitPRInfo.number));
414
+ var data = await res.json();
415
+ if (data && data.threads) {
416
+ gitPRCommentCount = data.threads.length;
417
+ updatePRHud();
418
+ }
419
+ } catch (e) {}
420
+ }
421
+
422
+ async function fetchPRComments(prNumber) {
423
+ var res = await authFetch(gitUrl('/git/pr-comments?pr=' + prNumber));
424
+ return await res.json();
425
+ }
426
+
427
+ async function openPRReviewPanel() {
428
+ // Ensure we have PR info
429
+ if (!gitPRInfo) {
430
+ await fetchPRInfo();
431
+ }
432
+ if (!gitPRInfo) {
433
+ // Show a brief message in the chat or as a status bar tooltip
434
+ var hudPR = document.getElementById('hud-pr-text');
435
+ if (hudPR) { hudPR.textContent = 'No open PR for this branch'; setTimeout(updatePRHud, 3000); }
436
+ return;
437
+ }
438
+ var panelId = 'pr-review-' + gitPRInfo.number;
439
+ // If already open, just switch to it
440
+ if (typeof openPanels !== 'undefined' && openPanels[panelId]) {
441
+ if (typeof switchTab === 'function') switchTab(panelId);
442
+ return;
443
+ }
444
+ // Open panel with placeholder while loading
445
+ if (typeof openPanelTab === 'function') {
446
+ openPanelTab(panelId, { panel: 'pr-review', title: 'PR #' + gitPRInfo.number, data: null });
447
+ // Store PR info on the panel for the renderer
448
+ if (typeof openPanels !== 'undefined' && openPanels[panelId]) {
449
+ openPanels[panelId]._prInfo = gitPRInfo;
450
+ }
451
+ }
452
+ // Fetch comments and update panel
453
+ try {
454
+ var data = await fetchPRComments(gitPRInfo.number);
455
+ if (typeof openPanels !== 'undefined' && openPanels[panelId]) {
456
+ openPanels[panelId].rawData = data;
457
+ openPanels[panelId]._prInfo = gitPRInfo;
458
+ if (typeof updatePanelData === 'function') updatePanelData(panelId, data);
459
+ }
460
+ } catch (e) {}
461
+ }
462
+
463
+ // ═══════════════════════════════════════════════════════════════
464
+ // Multi-repo discovery & picker
465
+ // ═══════════════════════════════════════════════════════════════
466
+
467
+ async function fetchGitRepos() {
468
+ try {
469
+ var res = await authFetch('/git/repos');
470
+ var data = await res.json();
471
+ discoveredRepos = data.repos || [];
472
+ renderRepoPicker();
473
+ } catch (e) {
474
+ // silent fail
475
+ }
476
+ }
477
+
478
+ function renderRepoPicker() {
479
+ var picker = document.getElementById('git-repo-picker');
480
+ var select = document.getElementById('git-repo-select');
481
+ if (!picker || !select) return;
482
+
483
+ // Hide when there's only one repo (or none)
484
+ if (discoveredRepos.length <= 1) {
485
+ picker.style.display = 'none';
486
+ return;
487
+ }
488
+
489
+ picker.style.display = '';
490
+ select.innerHTML = '';
491
+
492
+ for (var i = 0; i < discoveredRepos.length; i++) {
493
+ var r = discoveredRepos[i];
494
+ var opt = document.createElement('option');
495
+ opt.value = r.relPath;
496
+ opt.textContent = r.name + ' (' + r.branch + ')';
497
+ if ((activeGitRepo === r.relPath) || (!activeGitRepo && r.relPath === '.')) {
498
+ opt.selected = true;
499
+ }
500
+ select.appendChild(opt);
501
+ }
502
+ }
503
+
504
+ function setActiveGitRepo(relPath) {
505
+ activeGitRepo = (relPath === '.' || relPath === '') ? null : relPath;
506
+ // Reset PR state for the new repo
507
+ gitPRInfo = null;
508
+ gitPRCommentCount = 0;
509
+ if (gitPRCountInterval) { clearInterval(gitPRCountInterval); gitPRCountInterval = null; }
510
+ // Refresh git status and PR info for the newly selected repo
511
+ fetchGitStatus();
512
+ fetchPRInfo();
513
+ }
514
+
515
+ function updatePRHud() {
516
+ var item = document.getElementById('hud-pr-item');
517
+ var sep = document.getElementById('hud-pr-sep');
518
+ var text = document.getElementById('hud-pr-text');
519
+ if (!item) return;
520
+ if (gitPRInfo && gitPRCommentCount > 0) {
521
+ item.style.display = '';
522
+ if (sep) sep.style.display = '';
523
+ if (text) text.textContent = gitPRCommentCount + ' PR comment' + (gitPRCommentCount !== 1 ? 's' : '');
524
+ item.title = 'PR #' + gitPRInfo.number + ': ' + gitPRCommentCount + ' review comment' + (gitPRCommentCount !== 1 ? 's' : '') + ' — click to open';
525
+ } else if (gitPRInfo) {
526
+ // PR exists but no comments — show subtler indicator
527
+ item.style.display = '';
528
+ if (sep) sep.style.display = '';
529
+ if (text) text.textContent = 'PR #' + gitPRInfo.number;
530
+ item.title = 'PR #' + gitPRInfo.number + ': ' + (gitPRInfo.title || '') + ' — click to open';
531
+ } else {
532
+ item.style.display = 'none';
533
+ if (sep) sep.style.display = 'none';
534
+ }
535
+ if (typeof renderHud === 'function') renderHud();
536
+ }