@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,500 @@
1
+ #!/usr/bin/env node
2
+ import crypto from 'node:crypto';
3
+ import fs from 'node:fs/promises';
4
+ import path from 'node:path';
5
+
6
+ export const DEFAULT_PROMPT_CACHE_MAX_ENTRIES = 20;
7
+ export const DEFAULT_COMPACT_HISTORY_MAX_ENTRIES = 50;
8
+ const DEFAULT_MAX_COMPACT_ANCHORS = 3;
9
+
10
+ const HEADER_RE = /^\s*(?:#{1,6}\s|={3,}|-{3,})/;
11
+ const CODE_FENCE_RE = /^\s*```/;
12
+ const BULLET_RE = /^(\s*[-*]\s+)(.*)$/;
13
+ const COMMAND_RE = /^\s*(?:[$>#]\s*)?(?:node|npm|pnpm|yarn|bun|python(?:3)?|pip|git|docker|kubectl|make|cargo|go|java|pytest|vitest|npx)\b/i;
14
+ const STRUCTURED_LINE_RE = /https?:\/\/|(?:^|[\s(])(?:src|tests?|docs|ukit|\.claude|\.codex|app|lib|packages|scripts)\//i;
15
+ const VERBOSE_REPLACEMENTS = [
16
+ [/\bplease\b/gi, ''],
17
+ [/\bremember to\b/gi, ''],
18
+ [/\bmake sure to\b/gi, 'ensure '],
19
+ [/\bin order to\b/gi, 'to'],
20
+ [/\bfor the current task\b/gi, 'for this task'],
21
+ [/\bcurrent task\b/gi, 'task'],
22
+ [/\bprevious context block\b/gi, 'context block'],
23
+ [/\bshould still\b/gi, 'still'],
24
+ ];
25
+
26
+ export function buildRuntimePaths(projectRoot) {
27
+ const runtimeRoot = path.join(projectRoot, '.ukit');
28
+ const storageRoot = path.join(runtimeRoot, 'storage');
29
+ const cacheRoot = path.join(storageRoot, 'cache');
30
+ const memoryRoot = path.join(storageRoot, 'memory');
31
+
32
+ return {
33
+ runtimeRoot,
34
+ storageRoot,
35
+ cacheRoot,
36
+ memoryRoot,
37
+ teeCacheDir: path.join(cacheRoot, 'tee'),
38
+ configPath: path.join(storageRoot, 'config.json'),
39
+ promptCachePath: path.join(cacheRoot, 'prompt-cache.json'),
40
+ compactHistoryPath: path.join(cacheRoot, 'compact-history.json'),
41
+ compactPressurePath: path.join(cacheRoot, 'compact-pressure.json'),
42
+ outputHistoryPath: path.join(cacheRoot, 'output-history.json'),
43
+ userMemoryPath: path.join(memoryRoot, 'user.json'),
44
+ projectsDir: path.join(memoryRoot, 'projects'),
45
+ sessionsDir: path.join(memoryRoot, 'sessions'),
46
+ };
47
+ }
48
+
49
+ export async function readJson(filePath, fallback = null) {
50
+ try {
51
+ return JSON.parse(await fs.readFile(filePath, 'utf8'));
52
+ } catch {
53
+ return fallback;
54
+ }
55
+ }
56
+
57
+ async function writeJson(filePath, value) {
58
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
59
+ await fs.writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, 'utf8');
60
+ }
61
+
62
+ export function buildCompactMachineKey(prefix, payload = {}) {
63
+ return `${prefix}:${crypto.createHash('sha256').update(JSON.stringify(payload)).digest('base64url')}`;
64
+ }
65
+
66
+ export function estimateTokenCount(value) {
67
+ const text = String(value ?? '').trim();
68
+ if (!text) {
69
+ return 0;
70
+ }
71
+
72
+ return Math.max(1, Math.ceil(text.length / 4));
73
+ }
74
+
75
+ function isStructuredLine(line) {
76
+ return (
77
+ CODE_FENCE_RE.test(line)
78
+ || HEADER_RE.test(line)
79
+ || COMMAND_RE.test(line)
80
+ || STRUCTURED_LINE_RE.test(line)
81
+ || line.includes('`')
82
+ );
83
+ }
84
+
85
+ function normalizeWhitespace(value) {
86
+ return value
87
+ .replace(/\s+\|\s+/g, ' | ')
88
+ .replace(/\s*[:;]\s*/g, ': ')
89
+ .replace(/\s*,\s*/g, ', ')
90
+ .replace(/\s+/g, ' ')
91
+ .trim();
92
+ }
93
+
94
+ export function compressLine(line) {
95
+ const raw = String(line ?? '');
96
+ if (!raw.trim()) {
97
+ return '';
98
+ }
99
+
100
+ const trimmed = raw.trim();
101
+ if (isStructuredLine(trimmed)) {
102
+ return trimmed;
103
+ }
104
+
105
+ const bulletMatch = raw.match(BULLET_RE);
106
+ const prefix = bulletMatch ? '- ' : '';
107
+ let next = bulletMatch ? bulletMatch[2].trim() : trimmed;
108
+
109
+ for (const [pattern, replacement] of VERBOSE_REPLACEMENTS) {
110
+ next = next.replace(pattern, replacement);
111
+ }
112
+
113
+ next = normalizeWhitespace(next);
114
+ return prefix ? `${prefix}${next}` : next;
115
+ }
116
+
117
+ export function compressMarkdownLines(lines, { maxTokens = 320, maxLines = 12, preserveFirstLine = true } = {}) {
118
+ const sourceLines = Array.isArray(lines) ? lines : [];
119
+ const selected = [];
120
+ const seen = new Set();
121
+ let usedTokens = 0;
122
+ let nonEmptyCount = 0;
123
+ let pendingBlankLine = false;
124
+
125
+ for (const [index, line] of sourceLines.entries()) {
126
+ const compressed = compressLine(line);
127
+ if (!compressed) {
128
+ pendingBlankLine = selected.length > 0 && selected[selected.length - 1] !== '';
129
+ continue;
130
+ }
131
+
132
+ const dedupeKey = compressed.toLowerCase();
133
+ if (seen.has(dedupeKey)) {
134
+ continue;
135
+ }
136
+
137
+ const tokens = estimateTokenCount(compressed);
138
+ const wouldOverflow = selected.length > 0 && (usedTokens + tokens) > maxTokens;
139
+ const wouldExceedLines = index > 0 && nonEmptyCount >= maxLines;
140
+ if (wouldOverflow || wouldExceedLines) {
141
+ break;
142
+ }
143
+
144
+ if (pendingBlankLine && selected.length > 0) {
145
+ selected.push('');
146
+ pendingBlankLine = false;
147
+ }
148
+
149
+ selected.push(compressed);
150
+ seen.add(dedupeKey);
151
+ usedTokens += tokens;
152
+ nonEmptyCount += 1;
153
+ }
154
+
155
+ if (preserveFirstLine && selected.length === 0 && sourceLines.length > 0) {
156
+ const fallback = compressLine(sourceLines[0]);
157
+ if (fallback) {
158
+ return [fallback];
159
+ }
160
+ }
161
+
162
+ return selected;
163
+ }
164
+
165
+ export function compactContextBlock(
166
+ lines,
167
+ {
168
+ header = null,
169
+ maxTokens = 320,
170
+ maxLines = 12,
171
+ anchorLines = [],
172
+ anchorPatterns = [],
173
+ maxAnchors = DEFAULT_MAX_COMPACT_ANCHORS,
174
+ } = {},
175
+ ) {
176
+ const contentLines = Array.isArray(lines) ? lines.filter((line) => typeof line === 'string') : [];
177
+ const rawLines = header ? [header, ...contentLines] : [...contentLines];
178
+ const beforeText = rawLines.join('\n');
179
+ const normalizedMaxLines = header ? maxLines + 1 : maxLines;
180
+ const normalizedAnchorLines = resolveAnchorLines(rawLines, {
181
+ header,
182
+ anchorLines,
183
+ anchorPatterns,
184
+ maxAnchors,
185
+ });
186
+ const compactedLines = buildCompactedContextLines(rawLines, {
187
+ maxTokens,
188
+ maxLines: normalizedMaxLines,
189
+ preserveFirstLine: Boolean(header),
190
+ forceFirstCount: header ? 1 : 0,
191
+ });
192
+ let text = compactedLines.join('\n').trim();
193
+ let validationMode = 'default';
194
+
195
+ if (normalizedAnchorLines.length > 0 && findMissingAnchors(text, normalizedAnchorLines).length > 0) {
196
+ const anchorFirstLines = buildCompactedContextLines(
197
+ header
198
+ ? [header, ...normalizedAnchorLines, ...contentLines]
199
+ : [...normalizedAnchorLines, ...contentLines],
200
+ {
201
+ maxTokens,
202
+ maxLines: normalizedMaxLines,
203
+ preserveFirstLine: Boolean(header),
204
+ forceFirstCount: (header ? 1 : 0) + normalizedAnchorLines.length,
205
+ },
206
+ );
207
+ const anchorFirstText = anchorFirstLines.join('\n').trim();
208
+
209
+ if (findMissingAnchors(anchorFirstText, normalizedAnchorLines).length === 0) {
210
+ text = anchorFirstText;
211
+ validationMode = 'anchor-first';
212
+ } else {
213
+ text = buildCompactedContextLines(
214
+ header
215
+ ? [header, ...normalizedAnchorLines]
216
+ : [...normalizedAnchorLines],
217
+ {
218
+ maxTokens,
219
+ maxLines: normalizedMaxLines,
220
+ preserveFirstLine: Boolean(header),
221
+ forceFirstCount: (header ? 1 : 0) + normalizedAnchorLines.length,
222
+ },
223
+ ).join('\n').trim();
224
+ validationMode = 'forced-anchors';
225
+ }
226
+ }
227
+
228
+ return {
229
+ text,
230
+ tokensBefore: estimateTokenCount(beforeText),
231
+ tokensAfter: estimateTokenCount(text),
232
+ savedTokens: Math.max(0, estimateTokenCount(beforeText) - estimateTokenCount(text)),
233
+ validationMode,
234
+ anchorCount: normalizedAnchorLines.length,
235
+ };
236
+ }
237
+
238
+ function normalizeAnchorPattern(pattern) {
239
+ if (pattern instanceof RegExp) {
240
+ return (line) => pattern.test(line);
241
+ }
242
+ if (typeof pattern === 'string' && pattern.trim()) {
243
+ const prefix = pattern.trim();
244
+ return (line) => line.startsWith(prefix);
245
+ }
246
+ if (typeof pattern === 'function') {
247
+ return pattern;
248
+ }
249
+ return null;
250
+ }
251
+
252
+ function normalizeLineForDedupe(line) {
253
+ return String(line ?? '').trim().replace(/\s+/g, ' ').toLowerCase();
254
+ }
255
+
256
+ function uniqueLines(lines) {
257
+ const seen = new Set();
258
+ const unique = [];
259
+
260
+ for (const line of lines) {
261
+ const trimmed = String(line ?? '').trim();
262
+ const normalized = normalizeLineForDedupe(trimmed);
263
+ if (!normalized || seen.has(normalized)) {
264
+ continue;
265
+ }
266
+ seen.add(normalized);
267
+ unique.push(trimmed);
268
+ }
269
+
270
+ return unique;
271
+ }
272
+
273
+ function resolveAnchorLines(rawLines, { header = null, anchorLines = [], anchorPatterns = [], maxAnchors = DEFAULT_MAX_COMPACT_ANCHORS } = {}) {
274
+ const predicates = anchorPatterns
275
+ .map((pattern) => normalizeAnchorPattern(pattern))
276
+ .filter(Boolean);
277
+ const explicitAnchorLines = Array.isArray(anchorLines) ? anchorLines : [];
278
+ const matchedPatternLines = predicates.length > 0
279
+ ? rawLines.filter((line) => {
280
+ const trimmed = String(line ?? '').trim();
281
+ return trimmed && predicates.some((predicate) => predicate(trimmed));
282
+ })
283
+ : [];
284
+
285
+ return uniqueLines([
286
+ ...explicitAnchorLines,
287
+ ...matchedPatternLines,
288
+ ])
289
+ .filter((line) => !header || normalizeLineForDedupe(line) !== normalizeLineForDedupe(header))
290
+ .slice(0, Math.max(0, maxAnchors));
291
+ }
292
+
293
+ function buildCompactedContextLines(
294
+ lines,
295
+ {
296
+ maxTokens = 320,
297
+ maxLines = 12,
298
+ preserveFirstLine = true,
299
+ forceFirstCount = 0,
300
+ } = {},
301
+ ) {
302
+ const sourceLines = Array.isArray(lines) ? lines : [];
303
+ const selected = [];
304
+ const seen = new Set();
305
+ let usedTokens = 0;
306
+ let nonEmptyCount = 0;
307
+
308
+ for (const line of sourceLines) {
309
+ const compressed = compressLine(line);
310
+ if (!compressed) {
311
+ continue;
312
+ }
313
+
314
+ const dedupeKey = compressed.toLowerCase();
315
+ if (seen.has(dedupeKey)) {
316
+ continue;
317
+ }
318
+
319
+ const tokens = estimateTokenCount(compressed);
320
+ const forceLine = nonEmptyCount < forceFirstCount;
321
+ const wouldOverflow = selected.length > 0 && (usedTokens + tokens) > maxTokens;
322
+ const wouldExceedLines = nonEmptyCount >= maxLines;
323
+
324
+ if (!forceLine && (wouldOverflow || wouldExceedLines)) {
325
+ break;
326
+ }
327
+ if (forceLine && wouldExceedLines) {
328
+ break;
329
+ }
330
+
331
+ selected.push(compressed);
332
+ seen.add(dedupeKey);
333
+ usedTokens += tokens;
334
+ nonEmptyCount += 1;
335
+ }
336
+
337
+ if (selected.length === 0) {
338
+ return compressMarkdownLines(sourceLines, { maxTokens, maxLines, preserveFirstLine });
339
+ }
340
+
341
+ return selected;
342
+ }
343
+
344
+ function findMissingAnchors(text, anchorLines) {
345
+ const normalizedText = String(text ?? '').toLowerCase();
346
+ return anchorLines.filter((line) => {
347
+ const compressed = compressLine(line).toLowerCase();
348
+ return compressed && !normalizedText.includes(compressed);
349
+ });
350
+ }
351
+
352
+ function normalizePromptCacheEntry(entry) {
353
+ if (!entry || typeof entry !== 'object') {
354
+ return null;
355
+ }
356
+
357
+ const requestKey = typeof entry.requestKey === 'string' ? entry.requestKey.trim() : '';
358
+ if (!requestKey) {
359
+ return null;
360
+ }
361
+
362
+ const updatedAt = Number(entry.updatedAt);
363
+ const hitCount = Number(entry.hitCount);
364
+ const lastHitAt = Number(entry.lastHitAt);
365
+
366
+ return {
367
+ ...entry,
368
+ requestKey,
369
+ updatedAt: Number.isFinite(updatedAt) ? updatedAt : Date.now(),
370
+ hitCount: Number.isFinite(hitCount) && hitCount >= 0 ? hitCount : 0,
371
+ lastHitAt: Number.isFinite(lastHitAt) ? lastHitAt : null,
372
+ };
373
+ }
374
+
375
+ function normalizePromptCacheDocument(raw, { maxEntries = DEFAULT_PROMPT_CACHE_MAX_ENTRIES } = {}) {
376
+ const candidates = [];
377
+ if (Array.isArray(raw?.entries)) {
378
+ candidates.push(...raw.entries);
379
+ }
380
+ if (
381
+ !Array.isArray(raw?.entries)
382
+ && raw
383
+ && typeof raw === 'object'
384
+ && typeof raw.requestKey === 'string'
385
+ && raw.requestKey.trim()
386
+ ) {
387
+ candidates.push(raw);
388
+ }
389
+
390
+ return {
391
+ entries: candidates
392
+ .map((entry) => normalizePromptCacheEntry(entry))
393
+ .filter(Boolean)
394
+ .sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))
395
+ .filter((entry, index, list) => list.findIndex((candidate) => candidate.requestKey === entry.requestKey) === index)
396
+ .slice(0, maxEntries),
397
+ };
398
+ }
399
+
400
+ export async function readPromptCacheEntry(projectRoot, requestKey, { maxEntries = DEFAULT_PROMPT_CACHE_MAX_ENTRIES, touch = false } = {}) {
401
+ if (typeof requestKey !== 'string' || !requestKey.trim()) {
402
+ return null;
403
+ }
404
+
405
+ const runtimePaths = buildRuntimePaths(projectRoot);
406
+ const cache = normalizePromptCacheDocument(await readJson(runtimePaths.promptCachePath, null), { maxEntries });
407
+ const entryIndex = cache.entries.findIndex((entry) => entry.requestKey === requestKey);
408
+ if (entryIndex < 0) {
409
+ return null;
410
+ }
411
+
412
+ const entry = cache.entries[entryIndex];
413
+ if (!touch) {
414
+ return entry;
415
+ }
416
+
417
+ const touchedEntry = {
418
+ ...entry,
419
+ updatedAt: Date.now(),
420
+ lastHitAt: Date.now(),
421
+ hitCount: (entry.hitCount ?? 0) + 1,
422
+ };
423
+ const nextDocument = normalizePromptCacheDocument({
424
+ entries: [
425
+ touchedEntry,
426
+ ...cache.entries.slice(0, entryIndex),
427
+ ...cache.entries.slice(entryIndex + 1),
428
+ ],
429
+ }, { maxEntries });
430
+ await writeJson(runtimePaths.promptCachePath, nextDocument);
431
+ return nextDocument.entries[0] ?? touchedEntry;
432
+ }
433
+
434
+ export async function writePromptCacheEntry(projectRoot, entry, { maxEntries = DEFAULT_PROMPT_CACHE_MAX_ENTRIES } = {}) {
435
+ const normalizedEntry = normalizePromptCacheEntry(entry);
436
+ if (!normalizedEntry) {
437
+ return null;
438
+ }
439
+
440
+ const runtimePaths = buildRuntimePaths(projectRoot);
441
+ const cache = normalizePromptCacheDocument(await readJson(runtimePaths.promptCachePath, null), { maxEntries });
442
+ const nextDocument = normalizePromptCacheDocument({
443
+ entries: [
444
+ normalizedEntry,
445
+ ...cache.entries.filter((existingEntry) => existingEntry.requestKey !== normalizedEntry.requestKey),
446
+ ],
447
+ }, { maxEntries });
448
+ await writeJson(runtimePaths.promptCachePath, nextDocument);
449
+ return nextDocument;
450
+ }
451
+
452
+ function normalizeCompactHistoryEntry(entry) {
453
+ if (!entry || typeof entry !== 'object') {
454
+ return null;
455
+ }
456
+
457
+ const timestamp = Number(entry.timestamp);
458
+ const tokensBefore = Number(entry.tokensBefore);
459
+ const tokensAfter = Number(entry.tokensAfter);
460
+ const savedTokens = Number(entry.savedTokens);
461
+
462
+ return {
463
+ ...entry,
464
+ timestamp: Number.isFinite(timestamp) ? timestamp : Date.now(),
465
+ tokensBefore: Number.isFinite(tokensBefore) ? tokensBefore : 0,
466
+ tokensAfter: Number.isFinite(tokensAfter) ? tokensAfter : 0,
467
+ savedTokens: Number.isFinite(savedTokens) ? savedTokens : 0,
468
+ };
469
+ }
470
+
471
+ function normalizeCompactHistoryDocument(raw, { maxEntries = DEFAULT_COMPACT_HISTORY_MAX_ENTRIES } = {}) {
472
+ const candidates = Array.isArray(raw?.entries)
473
+ ? raw.entries
474
+ : Array.isArray(raw)
475
+ ? raw
476
+ : [];
477
+
478
+ return {
479
+ entries: candidates
480
+ .map((entry) => normalizeCompactHistoryEntry(entry))
481
+ .filter(Boolean)
482
+ .sort((left, right) => (right.timestamp ?? 0) - (left.timestamp ?? 0))
483
+ .slice(0, maxEntries),
484
+ };
485
+ }
486
+
487
+ export async function recordCompaction(projectRoot, entry, { maxEntries = DEFAULT_COMPACT_HISTORY_MAX_ENTRIES } = {}) {
488
+ const normalizedEntry = normalizeCompactHistoryEntry(entry);
489
+ if (!normalizedEntry || (normalizedEntry.savedTokens ?? 0) <= 0) {
490
+ return null;
491
+ }
492
+
493
+ const runtimePaths = buildRuntimePaths(projectRoot);
494
+ const history = normalizeCompactHistoryDocument(await readJson(runtimePaths.compactHistoryPath, null), { maxEntries });
495
+ const nextDocument = normalizeCompactHistoryDocument({
496
+ entries: [normalizedEntry, ...history.entries],
497
+ }, { maxEntries });
498
+ await writeJson(runtimePaths.compactHistoryPath, nextDocument);
499
+ return normalizedEntry;
500
+ }
@@ -0,0 +1,83 @@
1
+ # {{project.name}}
2
+
3
+ Auto-generated by UKit for OpenAI Codex.
4
+
5
+ - Packs: {{project.stack}}
6
+ - Package manager: {{runtime.packageManager}}
7
+
8
+ ## Team Workflow (Highest Priority)
9
+
10
+ - Teammates should only need to remember **`ukit install`**.
11
+ - After `ukit install`, open Claude/Codex and ask naturally.
12
+ - Do not make end users memorize skill names, helper scripts, or routing internals unless they are debugging UKit itself.
13
+ - **Treat helper commands as internal orchestration. Do not ask end users to run them.**
14
+
15
+ ## UKit v1.1.6 Shared Runtime
16
+
17
+ - Shared runtime state lives in `.ukit/storage/`.
18
+ - Treat `.ukit/storage/config.json` as the source of compact, token-pipeline, router, memory, and validation toggles.
19
+ - Reuse `.ukit/storage/memory/` before asking users to restate prior decisions.
20
+ - For non-trivial work, prefer `ukit memory recall "<current task>"` before widening docs.
21
+ - Reusable cache state lives in `.ukit/storage/cache/prompt-cache.json`, `.ukit/storage/cache/compact-history.json`, `.ukit/storage/cache/compact-pressure.json`, `.ukit/storage/cache/output-history.json`, and preserved raw tool outputs under `.ukit/storage/cache/tee/`.
22
+ - If an older repo still has a visible `ukit/` runtime root, rerun `ukit install`; UKit should migrate the shared runtime into hidden `.ukit/` when safe.
23
+ - Maintainers can inspect runtime state with `ukit status` and `ukit memory export`.
24
+ - Reuse compact `previous-context` / `recent-output` route snapshots before replaying raw history.
25
+ - Threshold-based compact pressure is internal orchestration; Codex users should not need to manage it manually.
26
+
27
+ ## Speed / Reading Contract
28
+
29
+ - **Trivial**: no docs.
30
+ - **Simple**: `docs/MEMORY.md` only.
31
+ - **Non-trivial**: `docs/MEMORY.md` + `docs/PROJECT.md` + `docs/CODE_MAP.md`.
32
+ - Read `docs/WORKLOG.md` only when recent continuation/debug context matters.
33
+ - Source is truth; if docs are stale, update docs and continue.
34
+
35
+ ## Index-First Loop (for Codex)
36
+
37
+ 1. Refresh/build the index only when needed:
38
+ - `node .codex/ukit/index/refresh-index.mjs`
39
+ - fallback: `node .codex/ukit/index/build-index.mjs`
40
+ 2. Query likely files:
41
+ - `node .codex/ukit/index/query-index.mjs "<error|symbol|path>"`
42
+ 3. For bug signatures:
43
+ - `node .codex/ukit/index/triage.mjs "<error signature>"`
44
+ 4. Open only the top 1-3 suspect files first, then widen if needed.
45
+
46
+ For clearly non-code specialist lanes, avoid dragging the source-code index into the route unless the target is actually code.
47
+
48
+ ## Automatic Skill Activation
49
+
50
+ - End users should not need to know skill names.
51
+ - For every non-trivial task — and again after the first meaningful tool calls — inspect installed project-local skills and **auto-activate the matching skill immediately**.
52
+ - Match from prompt wording plus tool/file evidence.
53
+ - Use the smallest useful set, usually 1-2 skills.
54
+ - If docs work is detected, prefer `.codex/skills/docs-quality/SKILL.md`.
55
+ - If routing is complex or ambiguous, prefer `node .codex/ukit/index/route-task.mjs "<prompt>" [--tool-command <cmd>] [--target <file>]`.
56
+ - That helper should keep shared route memory in `.claude/ukit/skill-router-state.json` so Claude and Codex continue from the same compact route state.
57
+ - When route memory already includes `previous-context` or `recent-output`, reuse it before widening reads or logs.
58
+ - After routing, prefer `node .codex/ukit/index/resolve-context.mjs ...` for context and `node .codex/ukit/index/verify-context.mjs ...` for verification.
59
+ - Follow routed verification policy: targeted first, widen only when scope/risk justifies it, ask before blanket broad runs.
60
+
61
+ ## Selective Subagent Usage (internal only)
62
+
63
+ - Stay direct for trivial/simple work or tightly coupled code already localized by the index.
64
+ - Delegate only when it reduces context bloat or unlocks meaningful parallel/background progress.
65
+ - Good triggers: noisy side lanes, 3+ independent investigations, long-running background work, or explicit plan/batch execution.
66
+ - End users still only need `ukit install`; subagent choice is internal orchestration.
67
+
68
+ ## Docs Discipline
69
+
70
+ After significant work, update only what changed:
71
+ - `docs/WORKLOG.md`
72
+ - `docs/MEMORY.md`
73
+ - `docs/CODE_MAP.md`
74
+ - `docs/PROJECT.md`
75
+
76
+ ## Skills
77
+
78
+ Skills are shared from `.claude/skills/` via symlink at `.codex/skills/`.
79
+
80
+ ## Codex Rulebase
81
+
82
+ - `.codex/settings.json` — project-shared Codex safe-auto baseline
83
+ - `.codex/settings.local.json` — machine-local overrides (kept on reinstall)