@ngockhoale/ukit 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/LICENSE +21 -0
  3. package/README.md +189 -0
  4. package/bin/ukit +30 -0
  5. package/manifests/platform.full.yaml +1194 -0
  6. package/package.json +71 -0
  7. package/scripts/bug/triage.mjs +37 -0
  8. package/scripts/index/build-index.mjs +35 -0
  9. package/scripts/index/query-index.mjs +92 -0
  10. package/scripts/index/refresh-index.mjs +85 -0
  11. package/scripts/release/verify-release.mjs +56 -0
  12. package/src/bug/triageBug.js +123 -0
  13. package/src/cli/adapters.js +148 -0
  14. package/src/cli/commands/diff.js +51 -0
  15. package/src/cli/commands/doctor.js +125 -0
  16. package/src/cli/commands/indexArgs.js +73 -0
  17. package/src/cli/commands/indexTools.js +509 -0
  18. package/src/cli/commands/install.js +293 -0
  19. package/src/cli/commands/memory.js +126 -0
  20. package/src/cli/commands/status.js +8 -0
  21. package/src/cli/commands/uninstall.js +51 -0
  22. package/src/cli/index.js +109 -0
  23. package/src/context/detectProjectContext.js +49 -0
  24. package/src/context/detectProviders.js +12 -0
  25. package/src/core/applyPlan.js +89 -0
  26. package/src/core/buildPlan.js +228 -0
  27. package/src/core/compact/index.js +294 -0
  28. package/src/core/compact/threshold.js +936 -0
  29. package/src/core/diffPlan.js +73 -0
  30. package/src/core/ensureGitignore.js +117 -0
  31. package/src/core/fileOps.js +188 -0
  32. package/src/core/memory/hygiene.js +160 -0
  33. package/src/core/memory/index.js +2 -0
  34. package/src/core/memory/retrieval.js +476 -0
  35. package/src/core/memory/store.js +202 -0
  36. package/src/core/metadata.js +132 -0
  37. package/src/core/migrateLegacy.js +139 -0
  38. package/src/core/output/index.js +1309 -0
  39. package/src/core/paths.js +13 -0
  40. package/src/core/report.js +17 -0
  41. package/src/core/router/advisor.js +42 -0
  42. package/src/core/router/index.js +2 -0
  43. package/src/core/router/router.js +164 -0
  44. package/src/core/runInstallPipeline.js +365 -0
  45. package/src/core/runtimeConfig.js +190 -0
  46. package/src/core/runtimePaths.js +24 -0
  47. package/src/core/status.js +186 -0
  48. package/src/core/token/index.js +328 -0
  49. package/src/core/uninstall.js +246 -0
  50. package/src/core/validation/confidence.js +89 -0
  51. package/src/core/validation/index.js +2 -0
  52. package/src/core/validation/validator.js +165 -0
  53. package/src/index/buildIndex.js +1392 -0
  54. package/src/index/gitHooks.js +109 -0
  55. package/src/index/importResolution.js +377 -0
  56. package/src/index/languageTools.js +127 -0
  57. package/src/index/paths.js +27 -0
  58. package/src/index/queryIndex.js +637 -0
  59. package/src/index/relatedTests.js +237 -0
  60. package/src/index/resolveContext.js +345 -0
  61. package/src/index/routeCatalog.js +258 -0
  62. package/src/index/taskRouting.js +677 -0
  63. package/src/index/verificationPlan.js +437 -0
  64. package/src/manifest/loadManifest.js +22 -0
  65. package/src/manifest/selectItems.js +78 -0
  66. package/src/manifest/validateManifest.js +115 -0
  67. package/src/render/buildVariables.js +39 -0
  68. package/src/render/renderTemplate.js +44 -0
  69. package/src/stack/detectStack.js +213 -0
  70. package/templates/.claude/agents/bug-debugger.md +57 -0
  71. package/templates/.claude/agents/feature-implementer.md +55 -0
  72. package/templates/.claude/config/providers.md +25 -0
  73. package/templates/.claude/hooks/auto-allow-bash.sh +155 -0
  74. package/templates/.claude/hooks/auto-prune-bash.sh +75 -0
  75. package/templates/.claude/hooks/block-dangerous.sh +54 -0
  76. package/templates/.claude/hooks/compress-output.sh +17 -0
  77. package/templates/.claude/hooks/protect-files.sh +37 -0
  78. package/templates/.claude/hooks/reinject-context.sh +28 -0
  79. package/templates/.claude/hooks/session-start.md +13 -0
  80. package/templates/.claude/hooks/skill-router.sh +1681 -0
  81. package/templates/.claude/hooks/verification-guard.sh +271 -0
  82. package/templates/.claude/settings.json +144 -0
  83. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  84. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  85. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  86. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  87. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  88. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  89. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  90. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  91. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  92. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  93. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  94. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  95. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  96. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  97. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  98. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  99. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  100. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  101. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  102. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  103. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  104. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  105. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  106. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  107. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  108. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  109. package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  110. package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  111. package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  112. package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  113. package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  114. package/templates/.claude/skills/_shared/ooxml/schemas/mce/mc.xsd +75 -0
  115. package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  116. package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  117. package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  118. package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  119. package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  120. package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  121. package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  122. package/templates/.claude/skills/_shared/ooxml/scripts/pack.py +159 -0
  123. package/templates/.claude/skills/_shared/ooxml/scripts/unpack.py +29 -0
  124. package/templates/.claude/skills/_shared/ooxml/scripts/validate.py +69 -0
  125. package/templates/.claude/skills/_shared/ooxml/scripts/validation/__init__.py +15 -0
  126. package/templates/.claude/skills/_shared/ooxml/scripts/validation/base.py +951 -0
  127. package/templates/.claude/skills/_shared/ooxml/scripts/validation/docx.py +274 -0
  128. package/templates/.claude/skills/_shared/ooxml/scripts/validation/pptx.py +315 -0
  129. package/templates/.claude/skills/_shared/ooxml/scripts/validation/redlining.py +279 -0
  130. package/templates/.claude/skills/backend-api/SKILL.md +26 -0
  131. package/templates/.claude/skills/canvas-design/LICENSE.txt +202 -0
  132. package/templates/.claude/skills/canvas-design/SKILL.md +130 -0
  133. package/templates/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  134. package/templates/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  135. package/templates/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  136. package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  137. package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  138. package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  139. package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  140. package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  141. package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  142. package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  143. package/templates/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  144. package/templates/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  145. package/templates/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  146. package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
  147. package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  148. package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
  149. package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  150. package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
  151. package/templates/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  152. package/templates/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  153. package/templates/.claude/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
  154. package/templates/.claude/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  155. package/templates/.claude/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
  156. package/templates/.claude/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
  157. package/templates/.claude/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  158. package/templates/.claude/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
  159. package/templates/.claude/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  160. package/templates/.claude/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  161. package/templates/.claude/skills/code-review/SKILL.md +97 -0
  162. package/templates/.claude/skills/debugging-toolkit/SKILL.md +156 -0
  163. package/templates/.claude/skills/delivery/SKILL.md +92 -0
  164. package/templates/.claude/skills/discover-security/SKILL.md +86 -0
  165. package/templates/.claude/skills/docker-packaging/SKILL.md +60 -0
  166. package/templates/.claude/skills/docs-manager/SKILL.md +465 -0
  167. package/templates/.claude/skills/docs-manager/init-project-docs.sh +70 -0
  168. package/templates/.claude/skills/docs-manager/templates/README.md.template +50 -0
  169. package/templates/.claude/skills/docs-manager/templates/agent-roles.md.template +24 -0
  170. package/templates/.claude/skills/docs-manager/templates/coding-conventions.md.template +28 -0
  171. package/templates/.claude/skills/docs-manager/templates/memory.md.template +30 -0
  172. package/templates/.claude/skills/docs-manager/templates/onboarding.md.template +20 -0
  173. package/templates/.claude/skills/docs-manager/templates/project.md.template +26 -0
  174. package/templates/.claude/skills/docs-quality/SKILL.md +148 -0
  175. package/templates/.claude/skills/docx/LICENSE.txt +30 -0
  176. package/templates/.claude/skills/docx/SKILL.md +197 -0
  177. package/templates/.claude/skills/docx/docx-js.md +350 -0
  178. package/templates/.claude/skills/docx/ooxml.md +610 -0
  179. package/templates/.claude/skills/docx/scripts/__init__.py +1 -0
  180. package/templates/.claude/skills/docx/scripts/document.py +1276 -0
  181. package/templates/.claude/skills/docx/scripts/templates/comments.xml +3 -0
  182. package/templates/.claude/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  183. package/templates/.claude/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  184. package/templates/.claude/skills/docx/scripts/templates/commentsIds.xml +3 -0
  185. package/templates/.claude/skills/docx/scripts/templates/people.xml +3 -0
  186. package/templates/.claude/skills/docx/scripts/utilities.py +374 -0
  187. package/templates/.claude/skills/duraone/SKILL.md +204 -0
  188. package/templates/.claude/skills/duraone/references/backend.md +636 -0
  189. package/templates/.claude/skills/duraone/references/frontend.md +1506 -0
  190. package/templates/.claude/skills/duraone/references/sql.md +631 -0
  191. package/templates/.claude/skills/duraone/references/workflow.md +520 -0
  192. package/templates/.claude/skills/executing-plans/SKILL.md +76 -0
  193. package/templates/.claude/skills/file-organizer/SKILL.md +433 -0
  194. package/templates/.claude/skills/frontend/SKILL.md +26 -0
  195. package/templates/.claude/skills/frontend-design/LICENSE.txt +177 -0
  196. package/templates/.claude/skills/frontend-design/SKILL.md +42 -0
  197. package/templates/.claude/skills/frontend-vue/SKILL.md +127 -0
  198. package/templates/.claude/skills/frontend-vue/components/Control/Box.vue +137 -0
  199. package/templates/.claude/skills/frontend-vue/components/Control/Button.vue +93 -0
  200. package/templates/.claude/skills/frontend-vue/components/Control/ButtonBar.vue +29 -0
  201. package/templates/.claude/skills/frontend-vue/components/Control/ButtonFloat.vue +62 -0
  202. package/templates/.claude/skills/frontend-vue/components/Control/CheckButton.vue +75 -0
  203. package/templates/.claude/skills/frontend-vue/components/Control/Checkbox.vue +58 -0
  204. package/templates/.claude/skills/frontend-vue/components/Control/Datetime.vue +148 -0
  205. package/templates/.claude/skills/frontend-vue/components/Control/Dropdownlist.vue +156 -0
  206. package/templates/.claude/skills/frontend-vue/components/Control/Input.vue +106 -0
  207. package/templates/.claude/skills/frontend-vue/components/Control/Label.vue +38 -0
  208. package/templates/.claude/skills/frontend-vue/components/Control/Master/BoxColumn.vue +24 -0
  209. package/templates/.claude/skills/frontend-vue/components/Control/Popup/Confirm.vue +33 -0
  210. package/templates/.claude/skills/frontend-vue/components/Control/Popup/Info.vue +32 -0
  211. package/templates/.claude/skills/frontend-vue/components/Control/Popup/ModalInfo.vue +39 -0
  212. package/templates/.claude/skills/frontend-vue/components/Control/Popup/Reject.vue +64 -0
  213. package/templates/.claude/skills/frontend-vue/components/Control/Tag.vue +82 -0
  214. package/templates/.claude/skills/frontend-vue/components/Control/Upload.vue +61 -0
  215. package/templates/.claude/skills/frontend-vue/components/ControlMobile/Dropdownlist.vue +103 -0
  216. package/templates/.claude/skills/frontend-vue/components/ControlMobile/PagingBar.vue +108 -0
  217. package/templates/.claude/skills/frontend-vue/components/ControlMobile/UploadImage.vue +137 -0
  218. package/templates/.claude/skills/frontend-vue/components/Grid/AG.vue +806 -0
  219. package/templates/.claude/skills/frontend-vue/components/Grid/AntTable.vue +253 -0
  220. package/templates/.claude/skills/frontend-vue/components/Grid/CustomDropdownEditor.vue +43 -0
  221. package/templates/.claude/skills/frontend-vue/components/Grid/CustomDropdownEditorEnable.vue +55 -0
  222. package/templates/.claude/skills/frontend-vue/components/Grid/HtmlTable.vue +40 -0
  223. package/templates/.claude/skills/frontend-vue/components/PDFViewer.vue +25 -0
  224. package/templates/.claude/skills/frontend-vue/components/Panel/FormView.vue +309 -0
  225. package/templates/.claude/skills/frontend-vue/components/Partial/Footer.vue +23 -0
  226. package/templates/.claude/skills/frontend-vue/components/Partial/Header.vue +265 -0
  227. package/templates/.claude/skills/frontend-vue/components/Partial/Sidebar.vue +122 -0
  228. package/templates/.claude/skills/frontend-vue/components/Template.vue +16 -0
  229. package/templates/.claude/skills/frontend-vue/components/View/Form.vue +89 -0
  230. package/templates/.claude/skills/frontend-vue/composables/indexDBStore.js +140 -0
  231. package/templates/.claude/skills/frontend-vue/composables/masterApi.js +362 -0
  232. package/templates/.claude/skills/frontend-vue/composables/state.js +578 -0
  233. package/templates/.claude/skills/frontend-vue/composables/useRequest.js +221 -0
  234. package/templates/.claude/skills/frontend-vue/composables/useSession.js +179 -0
  235. package/templates/.claude/skills/frontend-vue/composables/useTranslation.js +54 -0
  236. package/templates/.claude/skills/frontend-vue/composables/useWebSocket.js +257 -0
  237. package/templates/.claude/skills/frontend-vue/composables/userObj.js +111 -0
  238. package/templates/.claude/skills/frontend-vue/composables/utils.js +322 -0
  239. package/templates/.claude/skills/frontend-vue/reference/composables-example.vue +320 -0
  240. package/templates/.claude/skills/frontend-vue/reference/form-example.vue +183 -0
  241. package/templates/.claude/skills/frontend-vue/reference/grid-example.vue +147 -0
  242. package/templates/.claude/skills/frontend-vue/reference/masterdata-example/[id].vue +106 -0
  243. package/templates/.claude/skills/frontend-vue/reference/masterdata-example/index.vue +58 -0
  244. package/templates/.claude/skills/frontend-vue/reference/popup-example.vue +159 -0
  245. package/templates/.claude/skills/pdf/LICENSE.txt +30 -0
  246. package/templates/.claude/skills/pdf/SKILL.md +294 -0
  247. package/templates/.claude/skills/pdf/forms.md +205 -0
  248. package/templates/.claude/skills/pdf/reference.md +612 -0
  249. package/templates/.claude/skills/pdf/scripts/check_bounding_boxes.py +70 -0
  250. package/templates/.claude/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
  251. package/templates/.claude/skills/pdf/scripts/check_fillable_fields.py +12 -0
  252. package/templates/.claude/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
  253. package/templates/.claude/skills/pdf/scripts/create_validation_image.py +41 -0
  254. package/templates/.claude/skills/pdf/scripts/extract_form_field_info.py +152 -0
  255. package/templates/.claude/skills/pdf/scripts/fill_fillable_fields.py +114 -0
  256. package/templates/.claude/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
  257. package/templates/.claude/skills/pdf-processing/SKILL.md +107 -0
  258. package/templates/.claude/skills/pdf-processing-pro/FORMS.md +610 -0
  259. package/templates/.claude/skills/pdf-processing-pro/OCR.md +137 -0
  260. package/templates/.claude/skills/pdf-processing-pro/SKILL.md +296 -0
  261. package/templates/.claude/skills/pdf-processing-pro/TABLES.md +626 -0
  262. package/templates/.claude/skills/pdf-processing-pro/scripts/analyze_form.py +307 -0
  263. package/templates/.claude/skills/postgres/SKILL.md +69 -0
  264. package/templates/.claude/skills/postgres/reference/fn_get_examples.sql +208 -0
  265. package/templates/.claude/skills/postgres/reference/fn_rpt_examples.sql +239 -0
  266. package/templates/.claude/skills/postgres/reference/utility_functions.sql +94 -0
  267. package/templates/.claude/skills/pptx/LICENSE.txt +30 -0
  268. package/templates/.claude/skills/pptx/SKILL.md +484 -0
  269. package/templates/.claude/skills/pptx/html2pptx.md +625 -0
  270. package/templates/.claude/skills/pptx/ooxml.md +427 -0
  271. package/templates/.claude/skills/pptx/scripts/html2pptx.js +979 -0
  272. package/templates/.claude/skills/pptx/scripts/inventory.py +1020 -0
  273. package/templates/.claude/skills/pptx/scripts/rearrange.py +231 -0
  274. package/templates/.claude/skills/pptx/scripts/replace.py +385 -0
  275. package/templates/.claude/skills/pptx/scripts/thumbnail.py +450 -0
  276. package/templates/.claude/skills/repo-maintenance/SKILL.md +97 -0
  277. package/templates/.claude/skills/research/EXAMPLES.md +434 -0
  278. package/templates/.claude/skills/research/REFERENCE.md +399 -0
  279. package/templates/.claude/skills/research/SKILL.md +136 -0
  280. package/templates/.claude/skills/root-cause-tracing/SKILL.md +174 -0
  281. package/templates/.claude/skills/root-cause-tracing/find-polluter.sh +63 -0
  282. package/templates/.claude/skills/sharing-skills/SKILL.md +194 -0
  283. package/templates/.claude/skills/sql-optimization-patterns/SKILL.md +493 -0
  284. package/templates/.claude/skills/subagent-driven-development/SKILL.md +189 -0
  285. package/templates/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
  286. package/templates/.claude/skills/systematic-debugging/SKILL.md +295 -0
  287. package/templates/.claude/skills/systematic-debugging/test-academic.md +14 -0
  288. package/templates/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
  289. package/templates/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
  290. package/templates/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
  291. package/templates/.claude/skills/test-driven-development/SKILL.md +364 -0
  292. package/templates/.claude/skills/testing-anti-patterns/SKILL.md +302 -0
  293. package/templates/.claude/skills/testing-quality/SKILL.md +97 -0
  294. package/templates/.claude/skills/verification-before-completion/SKILL.md +139 -0
  295. package/templates/.claude/skills/webapp-testing/LICENSE.txt +202 -0
  296. package/templates/.claude/skills/webapp-testing/SKILL.md +96 -0
  297. package/templates/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
  298. package/templates/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
  299. package/templates/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
  300. package/templates/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
  301. package/templates/.claude/ukit/index/build-index.mjs +28 -0
  302. package/templates/.claude/ukit/index/cache-utils.mjs +140 -0
  303. package/templates/.claude/ukit/index/lib/index-core.mjs +2800 -0
  304. package/templates/.claude/ukit/index/query-index.mjs +150 -0
  305. package/templates/.claude/ukit/index/refresh-index.mjs +57 -0
  306. package/templates/.claude/ukit/index/reset-auto-permissions.mjs +76 -0
  307. package/templates/.claude/ukit/index/resolve-context.mjs +279 -0
  308. package/templates/.claude/ukit/index/route-catalog.mjs +258 -0
  309. package/templates/.claude/ukit/index/route-task.mjs +1994 -0
  310. package/templates/.claude/ukit/index/triage.mjs +133 -0
  311. package/templates/.claude/ukit/index/verify-context.mjs +689 -0
  312. package/templates/.claude/ukit/runtime/compact-threshold.mjs +1013 -0
  313. package/templates/.claude/ukit/runtime/output-compression.mjs +1340 -0
  314. package/templates/.claude/ukit/runtime/reinject-context.mjs +874 -0
  315. package/templates/.claude/ukit/runtime/token-utils.mjs +500 -0
  316. package/templates/.codex/README.md +83 -0
  317. package/templates/.codex/settings.json +187 -0
  318. package/templates/.gitignore +75 -0
  319. package/templates/AGENTS.md +116 -0
  320. package/templates/CLAUDE.md +93 -0
  321. package/templates/adapter-presets/antigravity/README.md +22 -0
  322. package/templates/adapter-presets/antigravity/rules.md +49 -0
  323. package/templates/adapter-presets/claude/settings.local.json +42 -0
  324. package/templates/adapter-presets/codex/settings.local.json +6 -0
  325. package/templates/adapter-presets/opencode/opencode.template.json +1 -0
  326. package/templates/docs/BUGFIX.md +20 -0
  327. package/templates/docs/BUG_INDEX.md +12 -0
  328. package/templates/docs/BUG_METRICS.md +7 -0
  329. package/templates/docs/BUG_TEMPLATE.md +13 -0
  330. package/templates/docs/CODE_MAP.md +35 -0
  331. package/templates/docs/INSTALL.md +113 -0
  332. package/templates/docs/MEMORY.md +49 -0
  333. package/templates/docs/PROJECT.md +50 -0
  334. package/templates/docs/UKIT_USAGE_GUIDE.md +147 -0
  335. package/templates/docs/WORKLOG.md +10 -0
  336. package/templates/ukit/README.md +14 -0
  337. package/templates/ukit/storage/cache/compact-history.json +3 -0
  338. package/templates/ukit/storage/cache/compact-pressure.json +1 -0
  339. package/templates/ukit/storage/cache/output-history.json +3 -0
  340. package/templates/ukit/storage/cache/prompt-cache.json +3 -0
  341. package/templates/ukit/storage/config.json +37 -0
  342. package/templates/ukit/storage/memory/projects/.gitkeep +2 -0
  343. package/templates/ukit/storage/memory/sessions/.gitkeep +0 -0
  344. package/templates/ukit/storage/memory/user.json +5 -0
@@ -0,0 +1,399 @@
1
+ # Research Tools Reference
2
+
3
+ Detailed documentation for all research tools.
4
+
5
+ ---
6
+
7
+ ## searchGitHub
8
+
9
+ Search GitHub repositories for actual code patterns.
10
+
11
+ ### Basic Usage
12
+
13
+ **CRITICAL**: Search for **literal code**, not keywords.
14
+
15
+ ✅ **Good queries**:
16
+ ```javascript
17
+ // Finding React useState patterns
18
+ query: "useState("
19
+ language: ["TypeScript", "TSX"]
20
+
21
+ // Finding error handling in async functions
22
+ query: "(?s)try {.*await"
23
+ useRegexp: true
24
+ language: ["TypeScript"]
25
+
26
+ // Finding specific API usage
27
+ query: "betterAuth({"
28
+ language: ["TypeScript"]
29
+ ```
30
+
31
+ ❌ **Bad queries**:
32
+ ```javascript
33
+ // These are KEYWORDS, not code patterns
34
+ query: "react hooks tutorial" // Won't find code!
35
+ query: "best practices" // Won't find code!
36
+ query: "how to use useState" // Won't find code!
37
+ ```
38
+
39
+ ### Advanced Usage
40
+
41
+ #### 1. Regex for flexible patterns
42
+ ```javascript
43
+ {
44
+ query: "(?s)useState\\(.*loading", // useState with loading variable
45
+ useRegexp: true,
46
+ language: ["TSX"]
47
+ }
48
+ ```
49
+
50
+ **Note**: Prefix with `(?s)` to match across multiple lines.
51
+
52
+ #### 2. Filter by repository
53
+ ```javascript
54
+ {
55
+ query: "getServerSession",
56
+ repo: "vercel/", // All Vercel repos
57
+ language: ["TypeScript"]
58
+ }
59
+ ```
60
+
61
+ #### 3. Filter by file path
62
+ ```javascript
63
+ {
64
+ query: "export default {",
65
+ path: "next.config.js", // Only in Next.js config files
66
+ }
67
+ ```
68
+
69
+ #### 4. Case sensitivity
70
+ ```javascript
71
+ {
72
+ query: "CORS(",
73
+ matchCase: true, // Exact case match
74
+ language: ["Python"]
75
+ }
76
+ ```
77
+
78
+ ### Hidden Tricks
79
+
80
+ **Trick 1: Find specific library usage in popular projects**
81
+ ```javascript
82
+ {
83
+ query: "figma: {",
84
+ repo: "better-auth/",
85
+ language: ["TypeScript"]
86
+ }
87
+ ```
88
+
89
+ **Trick 2: Search for error handling patterns**
90
+ ```javascript
91
+ {
92
+ query: "(?s)try {.*catch.*error",
93
+ useRegexp: true,
94
+ language: ["TypeScript"]
95
+ }
96
+ ```
97
+
98
+ **Trick 3: Find configuration patterns**
99
+ ```javascript
100
+ {
101
+ query: "export default {",
102
+ path: "*.config.ts",
103
+ }
104
+ ```
105
+
106
+ **Trick 4: Find how others handle edge cases**
107
+ ```javascript
108
+ {
109
+ query: "if (!data)",
110
+ language: ["TypeScript"],
111
+ repo: "vercel/" // Learn from production code
112
+ }
113
+ ```
114
+
115
+ ### Watch Out For
116
+
117
+ ⚠️ **Pitfall 1: Using keywords instead of code**
118
+ - Don't search for "react hooks best practices"
119
+ - Search for `"useState("` instead
120
+
121
+ ⚠️ **Pitfall 2: Forgetting regex anchors**
122
+ - Use `(?s)` for multiline matching
123
+ - Escape special chars: `\\{` not `{`
124
+
125
+ ⚠️ **Pitfall 3: Too broad search**
126
+ - `"export"` will return millions of results
127
+ - Be specific: `"export const auth ="`
128
+
129
+ ⚠️ **Pitfall 4: Ignoring language filter**
130
+ - Always specify language to reduce noise
131
+ - Use `["TypeScript", "TSX"]` for React projects
132
+
133
+ ---
134
+
135
+ ## get_code_context_exa
136
+
137
+ Get official documentation and high-quality examples for libraries/APIs.
138
+
139
+ ### Basic Usage
140
+
141
+ ✅ **Good queries**:
142
+ ```javascript
143
+ {
144
+ query: "Next.js 15 server actions best practices",
145
+ tokensNum: 5000
146
+ }
147
+
148
+ {
149
+ query: "Better Auth Figma OAuth integration guide",
150
+ tokensNum: 3000
151
+ }
152
+
153
+ {
154
+ query: "Drizzle ORM PostgreSQL schema migration",
155
+ tokensNum: 8000
156
+ }
157
+ ```
158
+
159
+ ### Advanced Usage
160
+
161
+ #### 1. Adjust token count based on depth
162
+ ```javascript
163
+ // Quick reference - 1000-3000 tokens
164
+ { query: "React useEffect cleanup", tokensNum: 2000 }
165
+
166
+ // Comprehensive guide - 5000-10000 tokens
167
+ { query: "Next.js 15 full authentication flow", tokensNum: 8000 }
168
+
169
+ // Deep dive - 15000-50000 tokens
170
+ { query: "Stripe webhook handling complete guide", tokensNum: 20000 }
171
+ ```
172
+
173
+ #### 2. Include version/year for latest docs
174
+ ```javascript
175
+ {
176
+ query: "Next.js 15 2025 app router", // Specify year!
177
+ tokensNum: 5000
178
+ }
179
+ ```
180
+
181
+ #### 3. Focus on specific aspects
182
+ ```javascript
183
+ // Not: "React hooks"
184
+ // Better: "React hooks performance optimization patterns"
185
+
186
+ {
187
+ query: "React hooks performance optimization patterns",
188
+ tokensNum: 5000
189
+ }
190
+ ```
191
+
192
+ ### Hidden Tricks
193
+
194
+ **Trick 1: Compare official docs across versions**
195
+ ```javascript
196
+ // Search 1
197
+ { query: "Next.js 14 server components", tokensNum: 3000 }
198
+ // Search 2
199
+ { query: "Next.js 15 server components", tokensNum: 3000 }
200
+ // Compare the differences
201
+ ```
202
+
203
+ **Trick 2: Get migration guides**
204
+ ```javascript
205
+ {
206
+ query: "migrate from Next.js 14 to 15 breaking changes",
207
+ tokensNum: 8000
208
+ }
209
+ ```
210
+
211
+ **Trick 3: Find official examples**
212
+ ```javascript
213
+ {
214
+ query: "Vercel Next.js 15 official examples repository",
215
+ tokensNum: 5000
216
+ }
217
+ ```
218
+
219
+ ### Watch Out For
220
+
221
+ ⚠️ **Pitfall 1: Too generic queries**
222
+ - "React" → Too broad
223
+ - "React Server Components rendering patterns 2025" → Specific
224
+
225
+ ⚠️ **Pitfall 2: Wrong token count**
226
+ - Too low (< 2000): May miss critical details
227
+ - Too high (> 20000): Wastes time and tokens
228
+ - Default 5000 is usually good
229
+
230
+ ⚠️ **Pitfall 3: Outdated docs**
231
+ - ALWAYS include year: "2025" or "latest"
232
+ - Check account for "Today's date" in context
233
+
234
+ ---
235
+
236
+ ## web_search_exa
237
+
238
+ Real-time web search for articles, blog posts, discussions.
239
+
240
+ ### Basic Usage
241
+
242
+ ✅ **Good use cases**:
243
+ ```javascript
244
+ // Find recent articles
245
+ {
246
+ query: "Next.js 15 performance improvements 2025",
247
+ numResults: 8
248
+ }
249
+
250
+ // Find comparisons
251
+ {
252
+ query: "Drizzle vs Prisma 2025 comparison",
253
+ numResults: 5
254
+ }
255
+
256
+ // Find official announcements
257
+ {
258
+ query: "Better Auth 2.0 release notes",
259
+ numResults: 3
260
+ }
261
+ ```
262
+
263
+ ### Advanced Usage
264
+
265
+ #### 1. Adjust result count
266
+ ```javascript
267
+ // Quick scan - 3-5 results
268
+ { query: "React 19 new features", numResults: 3 }
269
+
270
+ // Comprehensive - 8-10 results
271
+ { query: "Next.js deployment best practices", numResults: 10 }
272
+ ```
273
+
274
+ #### 2. Search type
275
+ ```javascript
276
+ // Quick search
277
+ { query: "...", type: "fast" }
278
+
279
+ // Deep research
280
+ { query: "...", type: "deep" }
281
+
282
+ // Balanced (default)
283
+ { query: "...", type: "auto" }
284
+ ```
285
+
286
+ #### 3. Livecrawl for latest content
287
+ ```javascript
288
+ {
289
+ query: "Next.js 15 RC release notes",
290
+ livecrawl: "preferred", // Get latest content
291
+ numResults: 3
292
+ }
293
+ ```
294
+
295
+ ### Hidden Tricks
296
+
297
+ **Trick 1: Find GitHub discussions**
298
+ ```javascript
299
+ {
300
+ query: "site:github.com better-auth figma OAuth issue",
301
+ numResults: 5
302
+ }
303
+ ```
304
+
305
+ **Trick 2: Official docs only**
306
+ ```javascript
307
+ {
308
+ query: "site:nextjs.org server actions",
309
+ numResults: 3
310
+ }
311
+ ```
312
+
313
+ **Trick 3: Find real-world war stories**
314
+ ```javascript
315
+ {
316
+ query: "debugging Next.js server actions production",
317
+ type: "deep",
318
+ numResults: 8
319
+ }
320
+ ```
321
+
322
+ ### Watch Out For
323
+
324
+ ⚠️ **Pitfall 1: Generic queries**
325
+ - "Next.js tutorial" → Low quality
326
+ - "Next.js 15 server actions error handling patterns" → High quality
327
+
328
+ ⚠️ **Pitfall 2: Too many results**
329
+ - > 10 results is usually noise
330
+ - 3-5 results is often enough
331
+
332
+ ⚠️ **Pitfall 3: Not using site: filter**
333
+ - Use `site:` to focus on authoritative sources
334
+
335
+ ---
336
+
337
+ ## Token/Result Guidelines
338
+
339
+ ### searchGitHub
340
+ - No limit on results, but first 10-20 are usually enough
341
+ - Use specific queries to reduce noise
342
+
343
+ ### get_code_context_exa
344
+ | Use Case | Tokens |
345
+ |----------|--------|
346
+ | Quick API reference | 1000-3000 |
347
+ | Comprehensive guide | 5000-10000 |
348
+ | Deep documentation | 15000-30000 |
349
+ | Exhaustive research | 30000-50000 |
350
+
351
+ ### web_search_exa
352
+ | Use Case | Results |
353
+ |----------|---------|
354
+ | Quick fact check | 1-3 |
355
+ | Standard research | 5-8 |
356
+ | Comprehensive | 8-10 |
357
+ | Avoid > 10 | Too noisy |
358
+
359
+ ---
360
+
361
+ ## Common Patterns
362
+
363
+ ### Pattern 1: "How do I use X?"
364
+ 1. `get_code_context_exa`: Get official docs (5000 tokens)
365
+ 2. `searchGitHub`: Find real usage (3-5 examples)
366
+ 3. `web_search_exa`: Find best practices (5 results)
367
+
368
+ ### Pattern 2: "Why is X not working?"
369
+ 1. `web_search_exa`: Search exact error (deep, 5 results)
370
+ 2. `searchGitHub`: Find how others fixed it (regex search)
371
+ 3. `get_code_context_exa`: Check official troubleshooting (3000 tokens)
372
+
373
+ ### Pattern 3: "X vs Y?"
374
+ 1. `web_search_exa`: Find comparisons (8 results)
375
+ 2. `searchGitHub`: Check real adoption (compare result counts)
376
+ 3. `get_code_context_exa`: Read both official docs (5000 tokens each)
377
+
378
+ ### Pattern 4: "Latest version of X?"
379
+ 1. `get_code_context_exa`: "X 2025 latest docs" (5000 tokens)
380
+ 2. `web_search_exa`: "X release notes" (livecrawl: preferred, 3 results)
381
+ 3. `searchGitHub`: Find recent usage patterns
382
+
383
+ ---
384
+
385
+ ## Quick Troubleshooting
386
+
387
+ **No results from searchGitHub?**
388
+ - Check: Are you using code, not keywords?
389
+ - Try: Simplify your query
390
+ - Example: `"useState("` not `"react useState hook"`
391
+
392
+ **Outdated docs from get_code_context_exa?**
393
+ - Check: Did you include year in query?
394
+ - Try: Add "2025" or "latest" to query
395
+
396
+ **Too many irrelevant results from web_search_exa?**
397
+ - Check: Is query too generic?
398
+ - Try: Use `site:` filter for authoritative sources
399
+ - Reduce: numResults to 3-5
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: research
3
+ description: Research libraries, APIs, and patterns using searchGitHub and Exa tools. Finds real-world implementations and saves structured reports to docs/research/. Use when investigating technologies, debugging issues, or comparing options.
4
+ allowed-tools: [mcp__mcp-router__searchGitHub, mcp__mcp-router__web_search_exa, mcp__mcp-router__get_code_context_exa, Write, Bash, Read, Glob]
5
+ ---
6
+
7
+ # Technical Research Skill
8
+
9
+ You are Linus Torvalds conducting technical research. Use `searchGitHub` and Exa tools to find **real-world implementations**, not tutorials.
10
+
11
+ ---
12
+
13
+ ## Available Tools
14
+
15
+ ### 1. `searchGitHub` - Find Real Code
16
+ Search GitHub repositories for actual usage patterns.
17
+
18
+ **CRITICAL**: This is **literal code search** (like grep), NOT keyword search.
19
+
20
+ ✅ Good: `"useState("`, `"betterAuth({"`, `"(?s)try {.*await"`
21
+ ❌ Bad: `"react tutorial"`, `"best practices"`, `"how to use"`
22
+
23
+ See [REFERENCE.md](./REFERENCE.md#searchgithub) for detailed usage.
24
+
25
+ ### 2. `web_search_exa` - Web Search
26
+ Real-time web search with content scraping.
27
+
28
+ See [REFERENCE.md](./REFERENCE.md#web_search_exa) for detailed usage.
29
+
30
+ ### 3. `get_code_context_exa` - Code Context
31
+ Get high-quality library/SDK/API documentation and examples.
32
+
33
+ See [REFERENCE.md](./REFERENCE.md#get_code_context_exa) for detailed usage.
34
+
35
+ ---
36
+
37
+ ## Research Workflow
38
+
39
+ When user asks to research a technology/library/pattern:
40
+
41
+ ### Step 1: Understand the question
42
+
43
+ Identify what user needs:
44
+ - **How-to**: "How do I implement X?"
45
+ - **Best practices**: "What's the right way to do X?"
46
+ - **Comparison**: "Should I use X or Y?"
47
+ - **Debugging**: "Why is X not working?"
48
+
49
+ ### Step 2: Choose the right tool combination
50
+
51
+ | User Need | Tool Strategy |
52
+ |-----------|---------------|
53
+ | "How to use library X?" | `get_code_context_exa` first, then `searchGitHub` for real usage |
54
+ | "Real-world examples of X" | `searchGitHub` for actual code |
55
+ | "Best practices for X" | `web_search_exa` for recent articles + `searchGitHub` for code |
56
+ | "X vs Y comparison" | `web_search_exa` for analysis + `searchGitHub` to verify claims |
57
+ | "Latest docs for X" | `get_code_context_exa` with specific version/year |
58
+
59
+ See [EXAMPLES.md](./EXAMPLES.md) for detailed strategies.
60
+
61
+ ### Step 3: Execute search strategy
62
+
63
+ Use the tools in combination. Always:
64
+ - **Start specific**: Use precise queries
65
+ - **Verify with code**: Don't trust opinions without evidence
66
+ - **Check dates**: Prefer 2025 content over old posts
67
+ - **Cross-reference**: Multiple sources confirm truth
68
+
69
+ ### Step 4: Synthesize findings
70
+
71
+ Output format:
72
+ ```
73
+ ## 【Research Results】
74
+
75
+ ### Core Finding
76
+ <One-sentence answer to the user's question>
77
+
78
+ ### Evidence from Real Code
79
+ <2-3 examples from GitHub showing actual usage>
80
+
81
+ ### Official Context
82
+ <Key points from Exa code context / web search>
83
+
84
+ ### Recommended Approach
85
+ <Specific actionable recommendation based on evidence>
86
+
87
+ ### Watch Out For
88
+ <Pitfalls found in research, anti-patterns to avoid>
89
+ ```
90
+
91
+ ### Step 5: Save research document
92
+
93
+ **ALWAYS save research to `docs/research/`** using this format:
94
+
95
+ **Filename**: `docs/research/<YYYY-MM-DD>_<topic-slug>.md`
96
+
97
+ **Template**: See full template in [EXAMPLES.md](./EXAMPLES.md#output-template)
98
+
99
+ **Process**:
100
+ 1. Check if `docs/research/` exists, create if needed
101
+ 2. Generate filename from topic (lowercase, hyphenated)
102
+ 3. Use Write tool to save the document
103
+ 4. Confirm to user: "Research saved to docs/research/[filename]"
104
+
105
+ ---
106
+
107
+ ## Linus's Research Philosophy
108
+
109
+ > "Talk is cheap. Show me the code."
110
+
111
+ **Priorities**:
112
+ 1. **Real code** > Blog posts
113
+ 2. **Production usage** > Tutorials
114
+ 3. **Official docs** > Medium articles
115
+ 4. **Recent content (2025)** > Old posts
116
+ 5. **Specific examples** > Generic advice
117
+
118
+ **Anti-patterns**:
119
+ - ❌ Relying on tutorials without checking real code
120
+ - ❌ Using outdated documentation
121
+ - ❌ Trusting opinions without evidence
122
+ - ❌ Searching for keywords instead of code patterns
123
+
124
+ **Good researcher**:
125
+ - ✅ Checks multiple sources
126
+ - ✅ Verifies with real code
127
+ - ✅ Tests small examples
128
+ - ✅ Questions everything
129
+
130
+ ---
131
+
132
+ ## Quick Reference
133
+
134
+ - **Detailed tool documentation**: [REFERENCE.md](./REFERENCE.md)
135
+ - **Research strategy examples**: [EXAMPLES.md](./EXAMPLES.md)
136
+ - **Tool selection guide**: Step 2 above
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: root-cause-tracing
3
+ description: Use when errors occur deep in execution and you need to trace back to find the original trigger - systematically traces bugs backward through call stack, adding instrumentation when needed, to identify source of invalid data or incorrect behavior
4
+ ---
5
+
6
+ # Root Cause Tracing
7
+
8
+ ## Overview
9
+
10
+ Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
11
+
12
+ **Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
13
+
14
+ ## When to Use
15
+
16
+ ```dot
17
+ digraph when_to_use {
18
+ "Bug appears deep in stack?" [shape=diamond];
19
+ "Can trace backwards?" [shape=diamond];
20
+ "Fix at symptom point" [shape=box];
21
+ "Trace to original trigger" [shape=box];
22
+ "BETTER: Also add defense-in-depth" [shape=box];
23
+
24
+ "Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
25
+ "Can trace backwards?" -> "Trace to original trigger" [label="yes"];
26
+ "Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
27
+ "Trace to original trigger" -> "BETTER: Also add defense-in-depth";
28
+ }
29
+ ```
30
+
31
+ **Use when:**
32
+ - Error happens deep in execution (not at entry point)
33
+ - Stack trace shows long call chain
34
+ - Unclear where invalid data originated
35
+ - Need to find which test/code triggers the problem
36
+
37
+ ## The Tracing Process
38
+
39
+ ### 1. Observe the Symptom
40
+ ```
41
+ Error: git init failed in /Users/jesse/project/packages/core
42
+ ```
43
+
44
+ ### 2. Find Immediate Cause
45
+ **What code directly causes this?**
46
+ ```typescript
47
+ await execFileAsync('git', ['init'], { cwd: projectDir });
48
+ ```
49
+
50
+ ### 3. Ask: What Called This?
51
+ ```typescript
52
+ WorktreeManager.createSessionWorktree(projectDir, sessionId)
53
+ → called by Session.initializeWorkspace()
54
+ → called by Session.create()
55
+ → called by test at Project.create()
56
+ ```
57
+
58
+ ### 4. Keep Tracing Up
59
+ **What value was passed?**
60
+ - `projectDir = ''` (empty string!)
61
+ - Empty string as `cwd` resolves to `process.cwd()`
62
+ - That's the source code directory!
63
+
64
+ ### 5. Find Original Trigger
65
+ **Where did empty string come from?**
66
+ ```typescript
67
+ const context = setupCoreTest(); // Returns { tempDir: '' }
68
+ Project.create('name', context.tempDir); // Accessed before beforeEach!
69
+ ```
70
+
71
+ ## Adding Stack Traces
72
+
73
+ When you can't trace manually, add instrumentation:
74
+
75
+ ```typescript
76
+ // Before the problematic operation
77
+ async function gitInit(directory: string) {
78
+ const stack = new Error().stack;
79
+ console.error('DEBUG git init:', {
80
+ directory,
81
+ cwd: process.cwd(),
82
+ nodeEnv: process.env.NODE_ENV,
83
+ stack,
84
+ });
85
+
86
+ await execFileAsync('git', ['init'], { cwd: directory });
87
+ }
88
+ ```
89
+
90
+ **Critical:** Use `console.error()` in tests (not logger - may not show)
91
+
92
+ **Run and capture:**
93
+ ```bash
94
+ npm test 2>&1 | grep 'DEBUG git init'
95
+ ```
96
+
97
+ **Analyze stack traces:**
98
+ - Look for test file names
99
+ - Find the line number triggering the call
100
+ - Identify the pattern (same test? same parameter?)
101
+
102
+ ## Finding Which Test Causes Pollution
103
+
104
+ If something appears during tests but you don't know which test:
105
+
106
+ Use the bisection script: @find-polluter.sh
107
+
108
+ ```bash
109
+ ./find-polluter.sh '.git' 'src/**/*.test.ts'
110
+ ```
111
+
112
+ Runs tests one-by-one, stops at first polluter. See script for usage.
113
+
114
+ ## Real Example: Empty projectDir
115
+
116
+ **Symptom:** `.git` created in `packages/core/` (source code)
117
+
118
+ **Trace chain:**
119
+ 1. `git init` runs in `process.cwd()` ← empty cwd parameter
120
+ 2. WorktreeManager called with empty projectDir
121
+ 3. Session.create() passed empty string
122
+ 4. Test accessed `context.tempDir` before beforeEach
123
+ 5. setupCoreTest() returns `{ tempDir: '' }` initially
124
+
125
+ **Root cause:** Top-level variable initialization accessing empty value
126
+
127
+ **Fix:** Made tempDir a getter that throws if accessed before beforeEach
128
+
129
+ **Also added defense-in-depth:**
130
+ - Layer 1: Project.create() validates directory
131
+ - Layer 2: WorkspaceManager validates not empty
132
+ - Layer 3: NODE_ENV guard refuses git init outside tmpdir
133
+ - Layer 4: Stack trace logging before git init
134
+
135
+ ## Key Principle
136
+
137
+ ```dot
138
+ digraph principle {
139
+ "Found immediate cause" [shape=ellipse];
140
+ "Can trace one level up?" [shape=diamond];
141
+ "Trace backwards" [shape=box];
142
+ "Is this the source?" [shape=diamond];
143
+ "Fix at source" [shape=box];
144
+ "Add validation at each layer" [shape=box];
145
+ "Bug impossible" [shape=doublecircle];
146
+ "NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
147
+
148
+ "Found immediate cause" -> "Can trace one level up?";
149
+ "Can trace one level up?" -> "Trace backwards" [label="yes"];
150
+ "Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
151
+ "Trace backwards" -> "Is this the source?";
152
+ "Is this the source?" -> "Trace backwards" [label="no - keeps going"];
153
+ "Is this the source?" -> "Fix at source" [label="yes"];
154
+ "Fix at source" -> "Add validation at each layer";
155
+ "Add validation at each layer" -> "Bug impossible";
156
+ }
157
+ ```
158
+
159
+ **NEVER fix just where the error appears.** Trace back to find the original trigger.
160
+
161
+ ## Stack Trace Tips
162
+
163
+ **In tests:** Use `console.error()` not logger - logger may be suppressed
164
+ **Before operation:** Log before the dangerous operation, not after it fails
165
+ **Include context:** Directory, cwd, environment variables, timestamps
166
+ **Capture stack:** `new Error().stack` shows complete call chain
167
+
168
+ ## Real-World Impact
169
+
170
+ From debugging session (2025-10-03):
171
+ - Found root cause through 5-level trace
172
+ - Fixed at source (getter validation)
173
+ - Added 4 layers of defense
174
+ - 1847 tests passed, zero pollution