@katlux/toolkit 0.1.1-alpha.145 → 0.1.1-alpha.147

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 (298) hide show
  1. package/README.md +32 -22
  2. package/bin/ai-init.mjs +575 -0
  3. package/bin/ai-tokens/adapters/antigravityAdapter.mjs +22 -0
  4. package/bin/ai-tokens/adapters/claudeCodeAdapter.mjs +192 -0
  5. package/bin/ai-tokens/adapters/codexAdapter.mjs +176 -0
  6. package/bin/ai-tokens/adapters/cursorAdapter.mjs +202 -0
  7. package/bin/ai-tokens/adapters/index.mjs +30 -0
  8. package/bin/ai-tokens/cliViews.mjs +301 -0
  9. package/bin/ai-tokens/formatAndDates.mjs +89 -0
  10. package/bin/ai-tokens/reportGenerator.mjs +232 -0
  11. package/bin/ai-tokens/transcriptParser.mjs +299 -0
  12. package/bin/ai-tokens.mjs +38 -872
  13. package/bin/cli.mjs +81 -48
  14. package/bin/create-preset.mjs +1 -0
  15. package/bin/preset-contracts.json +2997 -0
  16. package/dist/compiled/composables/locales/asianAndPacific.mjs +296 -0
  17. package/dist/compiled/composables/locales/northernAndEasternEuropean.mjs +342 -0
  18. package/dist/compiled/composables/locales/westernEuropean.mjs +268 -0
  19. package/dist/compiled/composables/locales.mjs +32 -720
  20. package/dist/compiled/composables/useDataProvider.mjs +39 -26
  21. package/dist/compiled/composables/useFilterLogic.mjs +10 -2
  22. package/dist/compiled/composables/useKatluxForm.mjs +13 -11
  23. package/dist/compiled/composables/usePresetComponent.mjs +2 -0
  24. package/dist/compiled/composables/useRequestQueue.mjs +3 -1
  25. package/dist/compiled/composables/useVirtualDataset.mjs +657 -0
  26. package/dist/compiled/composables/useVirtualScroll.mjs +93 -66
  27. package/dist/compiled/composables/virtualDataset/cacheStateHelpers.mjs +76 -0
  28. package/dist/compiled/composables/virtualDataset/keyboardNavHelpers.mjs +60 -0
  29. package/dist/compiled/composables/virtualDataset/treeSelectionHelpers.mjs +103 -0
  30. package/dist/compiled/composables/virtualDataset/types.mjs +0 -0
  31. package/dist/compiled/utils/deprecation.mjs +44 -0
  32. package/dist/compiled/utils/dom.mjs +124 -0
  33. package/dist/module.cjs +58 -77
  34. package/dist/module.d.cts +5 -0
  35. package/dist/module.d.mts +4 -1
  36. package/dist/module.json +1 -1
  37. package/dist/module.mjs +54 -77
  38. package/dist/runtime/app.config.d.ts +3 -0
  39. package/dist/runtime/components/KAccordion/KAccordion.global.d.vue.ts +1 -1
  40. package/dist/runtime/components/KAccordion/KAccordion.global.vue.d.ts +1 -1
  41. package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +7 -3
  42. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +4 -1
  43. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +7 -3
  44. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +12 -2
  45. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +40 -41
  46. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
  47. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
  48. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  49. package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +19 -10
  50. package/dist/runtime/components/KCalendar/KCalendar.global.vue +7 -2
  51. package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +19 -10
  52. package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +14 -201
  53. package/dist/runtime/components/KCalendar/KCalendar.logic.js +67 -14
  54. package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +25 -5
  55. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +15 -1
  56. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +25 -5
  57. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +21 -3
  58. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +136 -7
  59. package/dist/runtime/components/KCalendar/recurringUtils.js +6 -5
  60. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
  61. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
  62. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +18 -3
  63. package/dist/runtime/components/KCombobox/KCombobox.global.vue +9 -4
  64. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +18 -3
  65. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +16 -2
  66. package/dist/runtime/components/KCombobox/KCombobox.logic.js +32 -13
  67. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +8 -8
  68. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +8 -8
  69. package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
  70. package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +3 -3
  71. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue +4 -1
  72. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +3 -3
  73. package/dist/runtime/components/KContextMenu/KContextMenu.logic.d.ts +24 -4
  74. package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +43 -22
  75. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +38 -11
  76. package/dist/runtime/components/KDatatable/KDataIterator.global.vue +39 -20
  77. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +38 -11
  78. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +31 -8
  79. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +69 -24
  80. package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +10 -14
  81. package/dist/runtime/components/KDatatable/KDatatable.global.vue +6 -5
  82. package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +10 -14
  83. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -6
  84. package/dist/runtime/components/KDatatable/KDatatable.logic.js +32 -24
  85. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +33 -15
  86. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +60 -16
  87. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +33 -15
  88. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +30 -6
  89. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +249 -59
  90. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
  91. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
  92. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +2 -0
  93. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +4 -4
  94. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +4 -4
  95. package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +3 -2
  96. package/dist/runtime/components/KDropdown/KDropdown.logic.js +14 -13
  97. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +55 -4
  98. package/dist/runtime/components/KGantt/KGantt.global.vue +18 -3
  99. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +55 -4
  100. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +33 -5
  101. package/dist/runtime/components/KGantt/KGantt.logic.js +39 -6
  102. package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
  103. package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
  104. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +2 -2
  105. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
  106. package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
  107. package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
  108. package/dist/runtime/components/KLayout/KLayout.global.d.vue.ts +4 -1
  109. package/dist/runtime/components/KLayout/KLayout.global.vue +4 -1
  110. package/dist/runtime/components/KLayout/KLayout.global.vue.d.ts +4 -1
  111. package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +9 -0
  112. package/dist/runtime/components/KLoader/KLoader.global.vue +3 -0
  113. package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +9 -0
  114. package/dist/runtime/components/KLoader/KLoader.logic.d.ts +5 -0
  115. package/dist/runtime/components/KLoader/KLoader.logic.js +4 -0
  116. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +2 -2
  117. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +2 -2
  118. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +30 -7
  119. package/dist/runtime/components/KMultiTabs/KMultiTabs.logic.d.ts +1 -0
  120. package/dist/runtime/components/KMultiTabs/MultiTabs.global.d.vue.ts +23 -0
  121. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +24 -0
  122. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue.d.ts +23 -0
  123. package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +3 -1
  124. package/dist/runtime/components/KPagination/KPagination.global.vue +2 -1
  125. package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +3 -1
  126. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
  127. package/dist/runtime/components/KPagination/KPagination.logic.js +74 -14
  128. package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
  129. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
  130. package/dist/runtime/components/KTabs/KTabs.logic.js +33 -11
  131. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
  132. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
  133. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +15 -4
  134. package/dist/runtime/components/KTextbox/KTextbox.global.vue +8 -2
  135. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +15 -4
  136. package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +5 -0
  137. package/dist/runtime/components/KTextbox/KTextbox.logic.js +4 -0
  138. package/dist/runtime/components/KTooltip/KTooltip.logic.d.ts +11 -2
  139. package/dist/runtime/components/KTooltip/KTooltip.logic.js +7 -5
  140. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +4 -4
  141. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +4 -4
  142. package/dist/runtime/components/KTree/KTree.logic.d.ts +2 -2
  143. package/dist/runtime/components/KTree/KTree.logic.js +37 -13
  144. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +7 -5
  145. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +4 -6
  146. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +7 -5
  147. package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +3 -2
  148. package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +10 -1
  149. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +40 -6
  150. package/dist/runtime/components/KTreeView/KTreeView.global.vue +19 -1
  151. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +40 -6
  152. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +24 -4
  153. package/dist/runtime/components/KTreeView/KTreeView.logic.js +105 -11
  154. package/dist/runtime/composables/locales/asianAndPacific.d.ts +11 -0
  155. package/dist/runtime/composables/locales/asianAndPacific.js +296 -0
  156. package/dist/runtime/composables/locales/northernAndEasternEuropean.d.ts +12 -0
  157. package/dist/runtime/composables/locales/northernAndEasternEuropean.js +342 -0
  158. package/dist/runtime/composables/locales/westernEuropean.d.ts +10 -0
  159. package/dist/runtime/composables/locales/westernEuropean.js +268 -0
  160. package/dist/runtime/composables/locales.d.ts +4 -24
  161. package/dist/runtime/composables/locales.js +32 -720
  162. package/dist/runtime/composables/useDataProvider.d.ts +5 -3
  163. package/dist/runtime/composables/useDataProvider.js +39 -26
  164. package/dist/runtime/composables/useFilterLogic.d.ts +16 -4
  165. package/dist/runtime/composables/useFilterLogic.js +10 -2
  166. package/dist/runtime/composables/useKatluxForm.d.ts +4 -4
  167. package/dist/runtime/composables/useKatluxForm.js +13 -11
  168. package/dist/runtime/composables/usePresetComponent.js +2 -0
  169. package/dist/runtime/composables/useRequestQueue.d.ts +2 -0
  170. package/dist/runtime/composables/useRequestQueue.js +3 -1
  171. package/dist/runtime/composables/useSortLogic.d.ts +1 -1
  172. package/dist/runtime/composables/useVirtualDataset.d.ts +9 -0
  173. package/dist/runtime/composables/useVirtualDataset.js +657 -0
  174. package/dist/runtime/composables/useVirtualScroll.d.ts +14 -10
  175. package/dist/runtime/composables/useVirtualScroll.js +93 -66
  176. package/dist/runtime/composables/virtualDataset/cacheStateHelpers.d.ts +49 -0
  177. package/dist/runtime/composables/virtualDataset/cacheStateHelpers.js +76 -0
  178. package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.d.ts +26 -0
  179. package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.js +60 -0
  180. package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.d.ts +24 -0
  181. package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.js +103 -0
  182. package/dist/runtime/composables/virtualDataset/types.d.ts +113 -0
  183. package/dist/runtime/composables/virtualDataset/types.js +0 -0
  184. package/dist/runtime/directives/clickOutside.d.ts +1 -1
  185. package/dist/runtime/directives/clickOutside.js +41 -13
  186. package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -1
  187. package/dist/runtime/plugins/nuxtCompatPlugin.js +16 -1
  188. package/dist/runtime/plugins/toastPlugin.client.js +2 -2
  189. package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
  190. package/dist/runtime/presets/default/assets/scss/css-variables.scss +6 -1
  191. package/dist/runtime/presets/default/assets/scss/index.css +3 -0
  192. package/dist/runtime/presets/default/assets/svg/katlux-logo.svg +7 -0
  193. package/dist/runtime/presets/default/assets/svg/katlux.svg +6 -0
  194. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +3 -2
  195. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +31 -3
  196. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +3 -2
  197. package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
  198. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +6 -0
  199. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
  200. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +7 -0
  201. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +57 -2
  202. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +7 -0
  203. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +6 -5
  204. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
  205. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +27 -17
  206. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
  207. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -1
  208. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +10 -10
  209. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -1
  210. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.d.vue.ts +2 -0
  211. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +67 -22
  212. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue.d.ts +2 -0
  213. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +41 -8
  214. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +184 -174
  215. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +41 -8
  216. package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +17 -10
  217. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +113 -394
  218. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +17 -10
  219. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +6 -0
  220. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +71 -4
  221. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +6 -0
  222. package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +5 -2
  223. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +15 -12
  224. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +5 -2
  225. package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +11 -2
  226. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +46 -29
  227. package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -2
  228. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.d.vue.ts +6 -2
  229. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +23 -8
  230. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue.d.ts +6 -2
  231. package/dist/runtime/presets/default/components/KLayout/KLayout.vue +2 -2
  232. package/dist/runtime/presets/default/components/KLoader/KLoader.d.vue.ts +1 -0
  233. package/dist/runtime/presets/default/components/KLoader/KLoader.vue +13 -2
  234. package/dist/runtime/presets/default/components/KLoader/KLoader.vue.d.ts +1 -0
  235. package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -94
  236. package/dist/runtime/presets/default/components/KMultiTabs/KMultiTabs.vue +69 -4
  237. package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +18 -46
  238. package/dist/runtime/presets/default/components/KSlider/KSlider.vue +11 -23
  239. package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +4 -1
  240. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +24 -8
  241. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +4 -1
  242. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +3 -3
  243. package/dist/runtime/presets/default/components/KTree/KTree.vue +61 -56
  244. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
  245. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.d.vue.ts +1 -0
  246. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue +12 -2
  247. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue.d.ts +1 -0
  248. package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +11 -2
  249. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +14 -2
  250. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +11 -2
  251. package/dist/runtime/server/middleware/session.js +7 -0
  252. package/dist/runtime/utils/deprecation.d.ts +14 -0
  253. package/dist/runtime/utils/deprecation.js +44 -0
  254. package/dist/runtime/utils/dom.d.ts +31 -0
  255. package/dist/runtime/utils/dom.js +124 -0
  256. package/dist/skills/KATLUX_INDEX.md +18 -19
  257. package/dist/skills/katlux-components/SKILL.md +2 -0
  258. package/dist/skills/katlux-components/components/KBulkActions.md +26 -2
  259. package/dist/skills/katlux-components/components/KCombobox.md +2 -2
  260. package/dist/skills/katlux-components/components/KDataIterator.md +17 -4
  261. package/dist/skills/katlux-components/components/KDatatable.md +38 -0
  262. package/dist/skills/katlux-components/components/KDatePicker.md +3 -1
  263. package/dist/skills/katlux-components/components/KGantt.md +9 -0
  264. package/dist/skills/katlux-components/components/KIcon.md +1 -1
  265. package/dist/skills/katlux-components/components/KLayout.md +4 -0
  266. package/dist/skills/katlux-components/components/KLineChart.md +3 -0
  267. package/dist/skills/katlux-components/components/KLoader.md +3 -0
  268. package/dist/skills/katlux-components/components/KProductList.md +0 -1
  269. package/dist/skills/katlux-components/components/KScatterChart.md +3 -0
  270. package/dist/skills/katlux-components/components/KTextbox.md +1 -0
  271. package/dist/skills/katlux-components/components/KTreePicker.md +2 -1
  272. package/dist/skills/katlux-components/components/KTreeView.md +12 -0
  273. package/dist/skills/katlux-config/SKILL.md +27 -8
  274. package/dist/skills/katlux-presets/SKILL.md +163 -3
  275. package/dist/skills/katlux-presets/creating-a-preset.md +67 -0
  276. package/dist/skills/katlux-providers/SKILL.md +19 -5
  277. package/dist/skills/katlux-providers/providers/ADataProvider.md +17 -9
  278. package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +27 -3
  279. package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +11 -1
  280. package/dist/skills/katlux-providers/providers/CAPITreeServerDataProvider.md +13 -0
  281. package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +19 -4
  282. package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +4 -2
  283. package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +2 -2
  284. package/dist/skills/katlux-providers/providers/RequestProvider.md +10 -0
  285. package/dist/skills/katlux-providers/providers/encryption-field-level.md +67 -20
  286. package/dist/skills/katlux-providers/providers/encryption-key-management.md +23 -2
  287. package/dist/skills/katlux-providers/providers/encryption-key-pinning.md +25 -11
  288. package/dist/skills/katlux-providers/providers/encryption-searchable.md +341 -0
  289. package/dist/skills/katlux-providers/providers/encryption-symmetric.md +29 -2
  290. package/dist/skills/katlux-providers/providers/encryption-threat-model.md +70 -1
  291. package/dist/skills/katlux-providers/providers/encryption.md +26 -1
  292. package/dist/skills/katlux-providers/providers/types.md +3 -1
  293. package/dist/skills/katlux-providers/providers/useDataProvider.md +2 -1
  294. package/dist/skills/katlux-providers/providers/useVirtualDataset.md +154 -0
  295. package/dist/skills/katlux-tokens/SKILL.md +2 -1
  296. package/dist/types.d.mts +1 -1
  297. package/package.json +7 -3
  298. package/bin/add-ai-reference.mjs +0 -259
package/README.md CHANGED
@@ -1,50 +1,60 @@
1
1
  # @katlux/toolkit
2
2
 
3
- Core UI toolkit and components for the Katlux framework.
3
+ [![npm version](https://img.shields.io/badge/version-0.1.1--alpha.146-orange.svg)](https://www.npmjs.com/package/@katlux/toolkit)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](./LICENSE)
4
5
 
5
- ## Setup
6
+ Core UI toolkit, WAI-ARIA accessible components, preset system, and Nuxt 3 module for the Katlux framework.
6
7
 
7
- Katlux is built to be a zero-configuration UI toolkit for Nuxt 3. You only need to install a Katlux preset, and the core toolkit will be automatically installed and configured for you!
8
+ ## Installation
8
9
 
9
- ### Option 1: Automatic Installation (Recommended)
10
- Use the Nuxt CLI to automatically install the preset and add it to your `nuxt.config.ts` in one atomic step:
10
+ ### Option 1: Nuxt CLI (Recommended)
11
+ Use the Nuxt CLI to install `@katlux/toolkit` (or a preset such as `@katlux/preset-modern`) and register it in `nuxt.config.ts`:
11
12
  ```bash
12
- npx nuxi module add @katlux/preset-modern@alpha
13
+ npx nuxi module add @katlux/toolkit@alpha
13
14
  ```
14
15
 
15
16
  ### Option 2: Manual Installation
16
- 1. Install the preset package via your favorite package manager:
17
17
  ```bash
18
- npm install @katlux/preset-modern@alpha
18
+ npm install @katlux/toolkit@alpha
19
19
  ```
20
- *(This automatically installs `@katlux/toolkit@alpha` and data providers under the hood)*
21
20
 
22
- 2. Add the module to your `nuxt.config.ts`:
21
+ Add the module to your `nuxt.config.ts`:
23
22
  ```ts
24
23
  export default defineNuxtConfig({
25
24
  modules: [
26
- '@katlux/preset-modern'
25
+ '@katlux/toolkit'
27
26
  ]
28
27
  })
29
28
  ```
30
29
 
31
- That's it! Katlux will now automatically:
32
- - Globally register all component auto-imports (e.g. `<KButton>`)
33
- - Inject necessary SCSS variables
34
- - Configure TypeScript properly so your IDE understands the components
30
+ Katlux automatically:
31
+ - Globally auto-imports all `K*` UI components, `C*` data providers, and `E*` enums.
32
+ - Installs `@nuxtjs/i18n` with default English fallbacks if you haven't already configured `@nuxtjs/i18n`.
33
+ - Registers Nitro SSR session isolation middleware and CSS design token variables.
34
+ - Keeps `katluxToolkit.autoAiReference` disabled (`false`) by default for zero unexpected file writes during `nuxt dev`.
35
35
 
36
- ## Developer Guide
36
+ ## CLI Utilities
37
37
 
38
- For full documentation and repository access:
39
- - **Developer Guide & Repository**: [https://github.com/katlux-ui/KatluxShowcase](https://github.com/katlux-ui/KatluxShowcase) *(We will open source it soon)*
38
+ ```bash
39
+ # Install AI skill references (.agents/skills/) into your project
40
+ npx @katlux/toolkit katlux-ai-init --all
41
+
42
+ # Scaffold a custom visual preset
43
+ npx @katlux/toolkit create-preset my-preset
44
+ ```
45
+
46
+ ## Documentation & Changelog
47
+
48
+ - **Monorepo Repository**: [https://github.com/katlux-ui/KatluxShowcase](https://github.com/katlux-ui/KatluxShowcase)
49
+ - **Changelog & Migration Guide**: [CHANGELOG.md](https://github.com/katlux-ui/KatluxShowcase/blob/dev/CHANGELOG.md)
40
50
 
41
51
  ## Attributions
42
52
 
43
- This project includes SVG icons from [Lucide](https://lucide.dev/), which are licensed under the ISC License. See the `NOTICE` file for more details.
53
+ This project includes SVG icons from [Lucide](https://lucide.dev/), licensed under the ISC License.
44
54
 
45
55
  ## License & Trademark Policy
46
56
 
47
- The code in this repository is completely free and open-source under the Apache 2.0 License.
48
- However, **Katlux™** and the Katlux logo are unregistered trademarks of the Katlux project.
57
+ The code in this repository is completely free and open-source under the **Apache 2.0 License** (see [LICENSE](./LICENSE)).
58
+ However, **Katlux™** and the Katlux logo are unregistered trademarks of the Katlux project.
49
59
 
50
- To protect our users from fraud, you may not use the "Katlux" name or logo to brand your own modified forks, derivative works, or malicious distributions without explicit permission. You are, however, completely free to state "Built with Katlux" in your projects!
60
+ To protect our users from fraud, you may not use the "Katlux" name or logo to brand your own modified forks, derivative works, or malicious distributions without explicit permission. You are, however, completely free to state "Built with Katlux" in your projects!
@@ -0,0 +1,575 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @katlux/toolkit katlux-ai-init
4
+ *
5
+ * Configures Katlux AI assistant skills, agent rules, and Model Context Protocol (MCP)
6
+ * servers for your development workspace.
7
+ *
8
+ * What it does:
9
+ * 1. Installs/updates Katlux AI skills in .agents/skills/katlux-* with content-hash protection
10
+ * 2. Scaffolds AGENTS.md and .agents/rules/rules.md (if missing)
11
+ * 3. Configures Katlux MCP server in .agents/mcp_config.json (always)
12
+ * 4. Optionally configures Cursor (.cursor/mcp.json) with --cursor or --all
13
+ * 5. Optionally configures VS Code (.vscode/mcp.json) with --vscode or --all
14
+ * 6. Optionally adds "ai:check" script to package.json with --scripts
15
+ *
16
+ * Usage:
17
+ * npx @katlux/toolkit katlux-ai-init [options]
18
+ *
19
+ * Options:
20
+ * --cursor Configure Cursor MCP (.cursor/mcp.json)
21
+ * --vscode Configure VS Code Copilot MCP (.vscode/mcp.json)
22
+ * --all Configure all IDEs (.agents, .cursor, .vscode)
23
+ * --scripts Add token-efficient "ai:check" typechecker script to package.json
24
+ * --dry-run Display changes without modifying any files
25
+ * --force Overwrite local files even if locally modified
26
+ * --help, -h Show this help message
27
+ */
28
+
29
+ import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync } from 'node:fs'
30
+ import { resolve, join, dirname } from 'node:path'
31
+ import { createHash } from 'node:crypto'
32
+ import { fileURLToPath } from 'node:url'
33
+
34
+ const __dirname = dirname(fileURLToPath(import.meta.url))
35
+
36
+ const RESET = '\x1b[0m'
37
+ const GREEN = '\x1b[32m'
38
+ const CYAN = '\x1b[36m'
39
+ const YELLOW = '\x1b[33m'
40
+ const RED = '\x1b[31m'
41
+ const BOLD = '\x1b[1m'
42
+ const DIM = '\x1b[2m'
43
+
44
+ export function log(color, prefix, message) {
45
+ console.log(`${color}${BOLD}${prefix}${RESET} ${message}`)
46
+ }
47
+
48
+ export function hashContent(content) {
49
+ return createHash('sha256').update(content, 'utf-8').digest('hex')
50
+ }
51
+
52
+ /**
53
+ * Strips single-line and multi-line comments from JSON string while preserving string literals.
54
+ * Also removes trailing commas before closing braces/brackets.
55
+ */
56
+ export function stripJsonComments(jsonString) {
57
+ if (typeof jsonString !== 'string') return ''
58
+ return jsonString
59
+ .replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (match, group) => group ? '' : match)
60
+ .replace(/,(\s*[}\]])/g, '$1')
61
+ }
62
+
63
+ /**
64
+ * Determines current Katlux package version and compatible MCP version.
65
+ */
66
+ export function resolvePackageVersions(projectRoot) {
67
+ let toolkitVersion = '0.1.1-alpha.146'
68
+ let mcpVersion = '0.1.0-alpha.25'
69
+
70
+ try {
71
+ const pkgPath = resolve(__dirname, '../package.json')
72
+ if (existsSync(pkgPath)) {
73
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
74
+ if (pkg.version) toolkitVersion = pkg.version
75
+ if (pkg.katlux?.mcpVersion) mcpVersion = pkg.katlux.mcpVersion
76
+ }
77
+ } catch {}
78
+
79
+ try {
80
+ const mcpPkgPath = resolve(__dirname, '../../katlux-mcp-core/package.json')
81
+ if (existsSync(mcpPkgPath)) {
82
+ const mcpPkg = JSON.parse(readFileSync(mcpPkgPath, 'utf-8'))
83
+ if (mcpPkg.version) mcpVersion = mcpPkg.version
84
+ }
85
+ } catch {}
86
+
87
+ if (projectRoot) {
88
+ try {
89
+ const consumerMcpPkg = resolve(projectRoot, 'node_modules/@katlux/mcp-core/package.json')
90
+ if (existsSync(consumerMcpPkg)) {
91
+ const mcpPkg = JSON.parse(readFileSync(consumerMcpPkg, 'utf-8'))
92
+ if (mcpPkg.version) mcpVersion = mcpPkg.version
93
+ }
94
+ } catch {}
95
+ }
96
+
97
+ return { toolkitVersion, mcpVersion }
98
+ }
99
+
100
+ /**
101
+ * Updates an MCP configuration file non-destructively, supporting JSONC (comments) and
102
+ * formatting correctly based on target type ('vscode' vs 'cursor' / 'agents').
103
+ */
104
+ export function updateMcpConfig({
105
+ filePath,
106
+ targetType,
107
+ mcpVersion,
108
+ isMonorepo = false,
109
+ dryRun = false
110
+ }) {
111
+ const dir = dirname(filePath)
112
+ let rawContent = ''
113
+ let config = {}
114
+
115
+ if (existsSync(filePath)) {
116
+ try {
117
+ rawContent = readFileSync(filePath, 'utf-8')
118
+ const cleanJson = stripJsonComments(rawContent)
119
+ config = JSON.parse(cleanJson)
120
+ } catch (err) {
121
+ return {
122
+ status: 'parse_error',
123
+ error: err.message,
124
+ filePath
125
+ }
126
+ }
127
+ }
128
+
129
+ if (typeof config !== 'object' || config === null || Array.isArray(config)) {
130
+ config = {}
131
+ }
132
+
133
+ if (targetType === 'vscode') {
134
+ // VS Code native format uses root "servers" and requires "type": "stdio"
135
+ if (!config.servers || typeof config.servers !== 'object' || Array.isArray(config.servers)) {
136
+ config.servers = {}
137
+ }
138
+ config.servers.katlux = {
139
+ type: 'stdio',
140
+ command: isMonorepo ? 'node' : 'npx',
141
+ args: isMonorepo
142
+ ? ['packages/katlux-mcp-core/bin/katlux-mcp-core.mjs']
143
+ : ['-y', `@katlux/mcp-core@${mcpVersion}`]
144
+ }
145
+ } else {
146
+ // Cursor & Antigravity/Agents format uses root "mcpServers"
147
+ if (!config.mcpServers || typeof config.mcpServers !== 'object' || Array.isArray(config.mcpServers)) {
148
+ config.mcpServers = {}
149
+ }
150
+ config.mcpServers.katlux = {
151
+ command: isMonorepo ? 'node' : 'npx',
152
+ args: isMonorepo
153
+ ? ['packages/katlux-mcp-core/bin/katlux-mcp-core.mjs']
154
+ : ['-y', `@katlux/mcp-core@${mcpVersion}`]
155
+ }
156
+ }
157
+
158
+ if (!dryRun) {
159
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
160
+ writeFileSync(filePath, JSON.stringify(config, null, 2) + '\n', 'utf-8')
161
+ }
162
+
163
+ return {
164
+ status: 'success',
165
+ filePath,
166
+ config
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Updates VS Code workspace settings (.vscode/settings.json) non-destructively
172
+ * to enable MCP server autostart and discovery.
173
+ */
174
+ export function updateVsCodeSettings({ filePath, dryRun = false }) {
175
+ const dir = dirname(filePath)
176
+ let rawContent = ''
177
+ let config = {}
178
+
179
+ if (existsSync(filePath)) {
180
+ try {
181
+ rawContent = readFileSync(filePath, 'utf-8')
182
+ const cleanJson = stripJsonComments(rawContent)
183
+ config = JSON.parse(cleanJson)
184
+ } catch (err) {
185
+ return {
186
+ status: 'parse_error',
187
+ error: err.message,
188
+ filePath
189
+ }
190
+ }
191
+ }
192
+
193
+ if (typeof config !== 'object' || config === null || Array.isArray(config)) {
194
+ config = {}
195
+ }
196
+
197
+ config['chat.mcp.autostart'] = 'newAndOutdated'
198
+ config['chat.mcp.discovery.enabled'] = true
199
+
200
+ if (!dryRun) {
201
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
202
+ writeFileSync(filePath, JSON.stringify(config, null, 2) + '\n', 'utf-8')
203
+ }
204
+
205
+ return {
206
+ status: 'success',
207
+ filePath,
208
+ config
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Scaffolds AGENTS.md and .agents/rules/rules.md only if missing.
214
+ */
215
+ export function scaffoldAgentFiles({ projectRoot, dryRun = false }) {
216
+ const created = []
217
+ const skipped = []
218
+
219
+ const agentsMdPath = resolve(projectRoot, 'AGENTS.md')
220
+ if (!existsSync(agentsMdPath)) {
221
+ if (!dryRun) {
222
+ writeFileSync(agentsMdPath, `# Agent Context and Guidelines
223
+
224
+ This file serves as the main entry point for AI agents to understand the workspace structure and guidelines.
225
+
226
+ - [Project Rules](.agents/rules/rules.md)
227
+ - [Katlux Skills Index](.agents/skills/KATLUX_INDEX.md)
228
+ `, 'utf-8')
229
+ }
230
+ created.push('AGENTS.md')
231
+ } else {
232
+ skipped.push('AGENTS.md')
233
+ }
234
+
235
+ const rulesDir = resolve(projectRoot, '.agents/rules')
236
+ const rulesMdPath = resolve(rulesDir, 'rules.md')
237
+ if (!existsSync(rulesMdPath)) {
238
+ if (!dryRun) {
239
+ if (!existsSync(rulesDir)) mkdirSync(rulesDir, { recursive: true })
240
+ writeFileSync(rulesMdPath, `# Agent Rules
241
+
242
+ ## Project-Specific Rules
243
+
244
+ <!-- Add your own project rules here. -->
245
+ <!-- Example: always use the "users" Pinia store for auth state. -->
246
+
247
+ ## Katlux Code Standards
248
+
249
+ 1. **Zero-Import Standard**: All \`K*\` components (\`KDatatable\`, \`KModal\`, etc.), \`C*\` provider classes (\`CAPIFlatServerDataProvider\`, \`CFlatClientDataProvider\`, etc.), and \`E*\` enums (\`ECacheStrategy\`, \`EDataFilterOperator\`) are globally auto-imported by the Nuxt module. **DO NOT generate top-level import statements for Katlux components, providers, or enums in Vue SFC files.**
250
+ 2. **Template**: Always use **Pug** (\`lang="pug"\`). Use **Tabs** for indentation.
251
+ 3. **Styling**: Use CSS variables (e.g. \`var(--primary-500)\`, \`var(--border-radius-md)\`). Never hardcode colors or sizes.
252
+ 4. **Preset Selectors**: Scope CSS rules under \`[data-preset~="preset-name"]\`. Avoid \`!important\`.
253
+ 5. **Imports**: Use workspace aliases (e.g. \`#toolkit/composables/...\`). Avoid deep relative imports.
254
+ 6. **i18n**: Use \`t('...')\` for all user-facing strings and ARIA labels.
255
+
256
+ ## Katlux AI Pairing & Token Efficiency Standards
257
+
258
+ 1. **MCP Tools First**: Always call Katlux MCP tools (\`katlux_inspect_project\`, \`katlux_query\`, \`katlux_scaffold\`, \`katlux_validate_code\`) for exact component APIs, slots, props, and provider options (~200 tokens) instead of searching or reading deep package source files.
259
+ 2. **Surgical File Reads**: When inspecting code, use targeted line ranges (30–50 lines maximum). Pinpoint lines with symbol searches or grep before reading.
260
+ 3. **Compact Test Execution**: When running tests during AI pairing, use compact flags (e.g. \`--changed\`, \`--reporter=summary\`, or \`--reporter=agent\`) to prevent verbose logs from consuming context tokens.
261
+ 4. **Focused Sessions**: Complete one feature or bug per conversation session. Start a fresh session when moving to an unrelated task to keep the AI context lean and token-efficient.
262
+ `, 'utf-8')
263
+ }
264
+ created.push('.agents/rules/rules.md')
265
+ } else {
266
+ skipped.push('.agents/rules/rules.md')
267
+ }
268
+
269
+ return { created, skipped }
270
+ }
271
+
272
+ /**
273
+ * Injects token-efficient typechecker into package.json preserving formatting.
274
+ */
275
+ export function injectPackageScript({ projectRoot, dryRun = false }) {
276
+ const pkgPath = resolve(projectRoot, 'package.json')
277
+ if (!existsSync(pkgPath)) return { status: 'no_package_json' }
278
+
279
+ try {
280
+ const raw = readFileSync(pkgPath, 'utf-8')
281
+ const indent = raw.includes('\t') ? '\t' : (raw.match(/^[ ]+/m)?.[0]?.length || 2)
282
+ const pkg = JSON.parse(raw)
283
+
284
+ if (!pkg.scripts) pkg.scripts = {}
285
+ if (pkg.scripts['ai:check']) {
286
+ return { status: 'already_exists', script: pkg.scripts['ai:check'] }
287
+ }
288
+
289
+ // Cross-platform command avoiding grep/head pipelines
290
+ pkg.scripts['ai:check'] = 'vue-tsc --noEmit --pretty false'
291
+
292
+ if (!dryRun) {
293
+ writeFileSync(pkgPath, JSON.stringify(pkg, null, indent) + '\n', 'utf-8')
294
+ }
295
+ return { status: 'injected', script: pkg.scripts['ai:check'] }
296
+ } catch (err) {
297
+ return { status: 'error', error: err.message }
298
+ }
299
+ }
300
+
301
+ /**
302
+ * Syncs Katlux skill files with hash-based modification protection.
303
+ */
304
+ export async function syncSkills({
305
+ projectRoot,
306
+ skillsDir,
307
+ packagedSkillsDir,
308
+ force = false,
309
+ dryRun = false
310
+ }) {
311
+ const manifestFile = resolve(skillsDir, '.katlux-manifest.json')
312
+ const versionFile = resolve(skillsDir, '.katlux-version')
313
+
314
+ let manifest = {}
315
+ if (existsSync(manifestFile)) {
316
+ try {
317
+ manifest = JSON.parse(readFileSync(manifestFile, 'utf-8'))
318
+ } catch {}
319
+ }
320
+ if (!manifest.hashes) manifest.hashes = {}
321
+
322
+ let copied = 0
323
+ let skippedUserModified = 0
324
+ let preservedFiles = []
325
+
326
+ const hasPackaged = packagedSkillsDir && existsSync(join(packagedSkillsDir, 'KATLUX_INDEX.md'))
327
+ if (!hasPackaged) {
328
+ return {
329
+ status: 'no_packaged_skills',
330
+ error: `Packaged skills not found in ${packagedSkillsDir || 'default location'}`,
331
+ copied: 0,
332
+ skippedUserModified: 0,
333
+ preservedFiles: []
334
+ }
335
+ }
336
+
337
+ // Helper to copy directory files
338
+ function copyFilesRecursive(src, dest, relBase = '') {
339
+ if (!dryRun && !existsSync(dest)) mkdirSync(dest, { recursive: true })
340
+ const entries = readdirSync(src, { withFileTypes: true })
341
+ for (const entry of entries) {
342
+ const relPath = relBase ? `${relBase}/${entry.name}` : entry.name
343
+ if (!relBase && entry.name !== 'KATLUX_INDEX.md' && !entry.name.startsWith('katlux-')) {
344
+ continue
345
+ }
346
+
347
+ const srcPath = join(src, entry.name)
348
+ const destPath = join(dest, entry.name)
349
+
350
+ if (entry.isDirectory()) {
351
+ copyFilesRecursive(srcPath, destPath, relPath)
352
+ } else if (entry.name.endsWith('.md')) {
353
+ const srcContent = readFileSync(srcPath, 'utf-8')
354
+ const newHash = hashContent(srcContent)
355
+
356
+ if (existsSync(destPath) && !force) {
357
+ const diskContent = readFileSync(destPath, 'utf-8')
358
+ const diskHash = hashContent(diskContent)
359
+ const prevHash = manifest.hashes?.[relPath]
360
+
361
+ if (prevHash && diskHash !== prevHash && diskHash !== newHash) {
362
+ skippedUserModified++
363
+ preservedFiles.push(relPath)
364
+ continue
365
+ }
366
+ }
367
+
368
+ if (!dryRun) {
369
+ const targetDir = dirname(destPath)
370
+ if (!existsSync(targetDir)) mkdirSync(targetDir, { recursive: true })
371
+ writeFileSync(destPath, srcContent, 'utf-8')
372
+ manifest.hashes[relPath] = newHash
373
+ }
374
+ copied++
375
+ }
376
+ }
377
+ }
378
+
379
+ copyFilesRecursive(packagedSkillsDir, skillsDir)
380
+
381
+ if (!dryRun) {
382
+ const { toolkitVersion } = resolvePackageVersions(projectRoot)
383
+ manifest.version = toolkitVersion
384
+ if (!existsSync(skillsDir)) mkdirSync(skillsDir, { recursive: true })
385
+ writeFileSync(manifestFile, JSON.stringify(manifest, null, 2), 'utf-8')
386
+ writeFileSync(versionFile, toolkitVersion, 'utf-8')
387
+ }
388
+
389
+ return {
390
+ status: 'success',
391
+ copied,
392
+ skippedUserModified,
393
+ preservedFiles
394
+ }
395
+ }
396
+
397
+ /**
398
+ * Main dispatcher for katlux-ai-init CLI
399
+ */
400
+ export async function runAiInit(options = {}) {
401
+ const projectRoot = options.projectRoot || process.cwd()
402
+ const args = options.args || process.argv.slice(2)
403
+
404
+ const isHelp = args.includes('--help') || args.includes('-h')
405
+ if (isHelp) {
406
+ console.log(`
407
+ ${BOLD}Katlux AI Assistant & MCP Initializer${RESET}
408
+
409
+ ${BOLD}Usage:${RESET}
410
+ npx @katlux/toolkit katlux-ai-init [options]
411
+
412
+ ${BOLD}Options:${RESET}
413
+ ${CYAN}--cursor${RESET} Configure Cursor MCP (.cursor/mcp.json)
414
+ ${CYAN}--vscode${RESET} Configure VS Code Copilot MCP (.vscode/mcp.json)
415
+ ${CYAN}--all${RESET} Configure all IDEs (.agents, .cursor, .vscode)
416
+ ${CYAN}--scripts${RESET} Inject token-efficient "ai:check" script into package.json
417
+ ${CYAN}--dry-run${RESET} Preview all changes without writing to disk
418
+ ${CYAN}--force${RESET} Overwrite skill files even if locally modified
419
+ ${CYAN}--help, -h${RESET} Show this help screen
420
+ `)
421
+ return 0
422
+ }
423
+
424
+ const dryRun = args.includes('--dry-run') || options.dryRun || false
425
+ const force = args.includes('--force') || options.force || false
426
+ const withCursor = args.includes('--cursor') || args.includes('--all') || options.cursor || false
427
+ const withVsCode = args.includes('--vscode') || args.includes('--all') || options.vscode || false
428
+ const withScripts = args.includes('--scripts') || options.scripts || false
429
+
430
+ const localMcpPath = resolve(projectRoot, 'packages/katlux-mcp-core/bin/katlux-mcp-core.mjs')
431
+ const isMonorepo = existsSync(localMcpPath)
432
+
433
+ const { toolkitVersion, mcpVersion } = resolvePackageVersions(projectRoot)
434
+
435
+ console.log()
436
+ log(CYAN, '[katlux-ai-init]', `Initializing Katlux AI assistant context & tools...${dryRun ? ` ${YELLOW}(dry-run)${RESET}` : ''}`)
437
+ console.log()
438
+
439
+ const skillsDir = resolve(projectRoot, '.agents/skills')
440
+ const packagedSkillsDir = resolve(__dirname, '../dist/skills')
441
+
442
+ // 1. Sync skills
443
+ process.stdout.write(` ${DIM}Syncing Katlux AI skill files to .agents/skills/...${RESET}`)
444
+ const skillResult = await syncSkills({
445
+ projectRoot,
446
+ skillsDir,
447
+ packagedSkillsDir,
448
+ force,
449
+ dryRun
450
+ })
451
+ if (skillResult.status === 'no_packaged_skills') {
452
+ process.stdout.write(` ${YELLOW}⚠ (${skillResult.error})${RESET}\n`)
453
+ } else {
454
+ process.stdout.write(` ${GREEN}✔ (${skillResult.copied} files synced)${RESET}\n`)
455
+ }
456
+ if (skillResult.skippedUserModified > 0) {
457
+ log(YELLOW, ' preserved', `${skillResult.skippedUserModified} locally modified skill files were kept intact (use --force to overwrite)`)
458
+ }
459
+
460
+ // 2. Scaffold agent files
461
+ const agentScaffold = scaffoldAgentFiles({ projectRoot, dryRun })
462
+ if (agentScaffold.created.includes('AGENTS.md')) {
463
+ log(GREEN, ' created', `AGENTS.md ${DIM}(primary entry point for AI context)${RESET}`)
464
+ } else {
465
+ log(DIM, ' skipped', `AGENTS.md (already exists)`)
466
+ }
467
+
468
+ if (agentScaffold.created.includes('.agents/rules/rules.md')) {
469
+ log(GREEN, ' created', `.agents/rules/rules.md ${DIM}(project-specific agent rules)${RESET}`)
470
+ } else {
471
+ log(DIM, ' skipped', `.agents/rules/rules.md (already exists)`)
472
+ }
473
+
474
+ // 3. Configure .agents/mcp_config.json (standard)
475
+ const agentsMcpPath = resolve(projectRoot, '.agents/mcp_config.json')
476
+ const agentsMcp = updateMcpConfig({
477
+ filePath: agentsMcpPath,
478
+ targetType: 'agents',
479
+ mcpVersion,
480
+ isMonorepo,
481
+ dryRun
482
+ })
483
+ if (agentsMcp.status === 'success') {
484
+ log(GREEN, ' configured', `.agents/mcp_config.json ${DIM}(@katlux/mcp-core@${mcpVersion})${RESET}`)
485
+ } else {
486
+ log(YELLOW, ' warning', `Failed to parse .agents/mcp_config.json: ${agentsMcp.error}. File was left untouched.`)
487
+ }
488
+
489
+ // 4. Configure Cursor if requested
490
+ if (withCursor) {
491
+ const cursorMcpPath = resolve(projectRoot, '.cursor/mcp.json')
492
+ const cursorMcp = updateMcpConfig({
493
+ filePath: cursorMcpPath,
494
+ targetType: 'cursor',
495
+ mcpVersion,
496
+ isMonorepo,
497
+ dryRun
498
+ })
499
+ if (cursorMcp.status === 'success') {
500
+ log(GREEN, ' configured', `.cursor/mcp.json ${DIM}(Cursor MCP server enabled)${RESET}`)
501
+ } else {
502
+ log(YELLOW, ' warning', `Failed to parse .cursor/mcp.json: ${cursorMcp.error}. File was left untouched.`)
503
+ }
504
+ } else {
505
+ log(DIM, ' info', `Run with --cursor to configure Cursor (.cursor/mcp.json)`)
506
+ }
507
+
508
+ // 5. Configure VS Code if requested
509
+ if (withVsCode) {
510
+ const vscodeMcpPath = resolve(projectRoot, '.vscode/mcp.json')
511
+ const vscodeMcp = updateMcpConfig({
512
+ filePath: vscodeMcpPath,
513
+ targetType: 'vscode',
514
+ mcpVersion,
515
+ isMonorepo,
516
+ dryRun
517
+ })
518
+ if (vscodeMcp.status === 'success') {
519
+ log(GREEN, ' configured', `.vscode/mcp.json ${DIM}(VS Code Copilot "servers" with type: stdio)${RESET}`)
520
+ } else {
521
+ log(YELLOW, ' warning', `Failed to parse .vscode/mcp.json: ${vscodeMcp.error}. File was left untouched.`)
522
+ }
523
+
524
+ const vscodeSettingsPath = resolve(projectRoot, '.vscode/settings.json')
525
+ const vscodeSettings = updateVsCodeSettings({
526
+ filePath: vscodeSettingsPath,
527
+ dryRun
528
+ })
529
+ if (vscodeSettings.status === 'success') {
530
+ log(GREEN, ' configured', `.vscode/settings.json ${DIM}(chat.mcp.autostart & discovery enabled)${RESET}`)
531
+ } else {
532
+ log(YELLOW, ' warning', `Failed to parse .vscode/settings.json: ${vscodeSettings.error}. File was left untouched.`)
533
+ }
534
+ } else {
535
+ log(DIM, ' info', `Run with --vscode to configure VS Code (.vscode/mcp.json & .vscode/settings.json)`)
536
+ }
537
+
538
+ // 6. Scripts injection if requested
539
+ if (withScripts) {
540
+ const scriptResult = injectPackageScript({ projectRoot, dryRun })
541
+ if (scriptResult.status === 'injected') {
542
+ log(GREEN, ' injected', `package.json "ai:check" script: ${scriptResult.script}`)
543
+ } else if (scriptResult.status === 'already_exists') {
544
+ log(DIM, ' skipped', `package.json "ai:check" already exists`)
545
+ }
546
+ }
547
+
548
+ console.log()
549
+ log(GREEN, '[katlux-ai-init] ✔', `Katlux AI assistant integration successfully initialized!`)
550
+ console.log()
551
+ console.log(` ${CYAN}Skills:${RESET} .agents/skills/katlux-*/SKILL.md`)
552
+ console.log(` ${CYAN}Index:${RESET} .agents/skills/KATLUX_INDEX.md`)
553
+ console.log(` ${CYAN}Context:${RESET} AGENTS.md`)
554
+ console.log(` ${CYAN}Rules:${RESET} .agents/rules/rules.md`)
555
+ console.log(` ${CYAN}MCP Server:${RESET} @katlux/mcp-core@${mcpVersion}`)
556
+ if (withVsCode) {
557
+ console.log()
558
+ console.log(` ${DIM}💡 VS Code Notice:${RESET} Ensure ${CYAN}Workspace Trust${RESET} is granted and Copilot is in ${CYAN}Agent Mode${RESET}.`)
559
+ console.log(` MCP tools connect on the first prompt or via ${CYAN}MCP: List Servers${RESET}.`)
560
+ }
561
+ console.log()
562
+ return 0
563
+ }
564
+
565
+ // Execute directly if run as CLI script
566
+ const isMain = process.argv[1] && (
567
+ process.argv[1].endsWith('ai-init.mjs') ||
568
+ process.argv[1].endsWith('katlux-ai-init')
569
+ )
570
+ if (isMain) {
571
+ runAiInit().catch(err => {
572
+ console.error(`${RED}[katlux-ai-init] ✖${RESET} ${err.message}`)
573
+ process.exit(1)
574
+ })
575
+ }
@@ -0,0 +1,22 @@
1
+ import { BRAIN_DIR } from '../formatAndDates.mjs'
2
+ import {
3
+ analyzeSession,
4
+ getConversationPreviewFast,
5
+ getConversations,
6
+ parseTranscript
7
+ } from '../transcriptParser.mjs'
8
+
9
+ /**
10
+ * Antigravity IDE transcript adapter.
11
+ * Wraps the default transcriptParser functions for backward compatibility.
12
+ */
13
+ export const antigravityAdapter = {
14
+ name: 'antigravity',
15
+ displayName: 'Antigravity',
16
+ emptyMessage: `No conversations found in ${BRAIN_DIR}`,
17
+ getConversations,
18
+ getConversationPreviewFast,
19
+ parseTranscript,
20
+ analyzeSession
21
+ }
22
+