@jahia/agentic 0.3.0 → 0.4.1

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 (398) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/claude/.claude/rules/jahia.md +13 -40
  3. package/dist/claude/.claude/skills/jahia-cnd-author/SKILL.md +94 -0
  4. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-area-types.md +55 -0
  5. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-authoring-experience.md +92 -0
  6. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-child-nodes.md +74 -0
  7. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-jahia-mixins.md +510 -0
  8. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-modeling-decisions.md +87 -0
  9. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-numbers-dates.md +92 -0
  10. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-string-selectors.md +133 -0
  11. package/dist/claude/.claude/skills/jahia-cnd-author/references/cnd-syntax.md +119 -0
  12. package/dist/claude/.claude/skills/jahia-cnd-author/references/types-ts-mapping.md +73 -0
  13. package/dist/claude/.claude/skills/jahia-dev-accessibility/SKILL.md +5 -265
  14. package/dist/claude/.claude/skills/jahia-dev-build-component/SKILL.md +15 -7
  15. package/dist/claude/.claude/skills/jahia-dev-create-page-template/SKILL.md +59 -21
  16. package/dist/claude/.claude/skills/jahia-dev-create-template-set/SKILL.md +20 -47
  17. package/dist/claude/.claude/skills/jahia-dev-create-view/SKILL.md +3 -3
  18. package/dist/claude/.claude/skills/jahia-dev-review-cnd/SKILL.md +79 -0
  19. package/dist/claude/.claude/skills/jahia-dev-review-cnd/scripts/check-cnd.d.mts +13 -0
  20. package/dist/claude/.claude/skills/jahia-dev-review-cnd/scripts/check-cnd.mjs +198 -0
  21. package/dist/claude/.claude/skills/jahia-dev-site-review/SKILL.md +70 -0
  22. package/dist/claude/.claude/skills/jahia-dev-site-review/scripts/review-pages.mjs +85 -0
  23. package/dist/claude/.claude/skills/jahia-dev-start-local/SKILL.md +18 -26
  24. package/dist/claude/CLAUDE.md +14 -41
  25. package/dist/codex/.agents/skills/jahia-cnd-author/SKILL.md +94 -0
  26. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-area-types.md +55 -0
  27. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-authoring-experience.md +92 -0
  28. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-child-nodes.md +74 -0
  29. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-jahia-mixins.md +510 -0
  30. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-modeling-decisions.md +87 -0
  31. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-numbers-dates.md +92 -0
  32. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-string-selectors.md +133 -0
  33. package/dist/codex/.agents/skills/jahia-cnd-author/references/cnd-syntax.md +119 -0
  34. package/dist/codex/.agents/skills/jahia-cnd-author/references/types-ts-mapping.md +73 -0
  35. package/dist/codex/.agents/skills/jahia-dev-accessibility/SKILL.md +5 -265
  36. package/dist/codex/.agents/skills/jahia-dev-build-component/SKILL.md +15 -7
  37. package/dist/codex/.agents/skills/jahia-dev-create-page-template/SKILL.md +59 -21
  38. package/dist/codex/.agents/skills/jahia-dev-create-template-set/SKILL.md +20 -47
  39. package/dist/codex/.agents/skills/jahia-dev-create-view/SKILL.md +3 -3
  40. package/dist/codex/.agents/skills/jahia-dev-review-cnd/SKILL.md +79 -0
  41. package/dist/codex/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.d.mts +13 -0
  42. package/dist/codex/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.mjs +198 -0
  43. package/dist/codex/.agents/skills/jahia-dev-site-review/SKILL.md +70 -0
  44. package/dist/codex/.agents/skills/jahia-dev-site-review/scripts/review-pages.mjs +85 -0
  45. package/dist/codex/.agents/skills/jahia-dev-start-local/SKILL.md +18 -26
  46. package/dist/codex/AGENTS.md +15 -42
  47. package/dist/copilot/.agents/skills/jahia-cnd-author/SKILL.md +94 -0
  48. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-area-types.md +55 -0
  49. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-authoring-experience.md +92 -0
  50. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-child-nodes.md +74 -0
  51. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-jahia-mixins.md +510 -0
  52. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-modeling-decisions.md +87 -0
  53. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-numbers-dates.md +92 -0
  54. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-string-selectors.md +133 -0
  55. package/dist/copilot/.agents/skills/jahia-cnd-author/references/cnd-syntax.md +119 -0
  56. package/dist/copilot/.agents/skills/jahia-cnd-author/references/types-ts-mapping.md +73 -0
  57. package/dist/copilot/.agents/skills/jahia-dev-accessibility/SKILL.md +5 -265
  58. package/dist/copilot/.agents/skills/jahia-dev-build-component/SKILL.md +15 -7
  59. package/dist/copilot/.agents/skills/jahia-dev-create-page-template/SKILL.md +59 -21
  60. package/dist/copilot/.agents/skills/jahia-dev-create-template-set/SKILL.md +20 -47
  61. package/dist/copilot/.agents/skills/jahia-dev-create-view/SKILL.md +3 -3
  62. package/dist/copilot/.agents/skills/jahia-dev-review-cnd/SKILL.md +79 -0
  63. package/dist/copilot/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.d.mts +13 -0
  64. package/dist/copilot/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.mjs +198 -0
  65. package/dist/copilot/.agents/skills/jahia-dev-site-review/SKILL.md +70 -0
  66. package/dist/copilot/.agents/skills/jahia-dev-site-review/scripts/review-pages.mjs +85 -0
  67. package/dist/copilot/.agents/skills/jahia-dev-start-local/SKILL.md +18 -26
  68. package/dist/copilot/AGENTS.md +15 -42
  69. package/dist/cursor/.agents/skills/jahia-cnd-author/SKILL.md +94 -0
  70. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-area-types.md +55 -0
  71. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-authoring-experience.md +92 -0
  72. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-child-nodes.md +74 -0
  73. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-jahia-mixins.md +510 -0
  74. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-modeling-decisions.md +87 -0
  75. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-numbers-dates.md +92 -0
  76. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-string-selectors.md +133 -0
  77. package/dist/cursor/.agents/skills/jahia-cnd-author/references/cnd-syntax.md +119 -0
  78. package/dist/cursor/.agents/skills/jahia-cnd-author/references/types-ts-mapping.md +73 -0
  79. package/dist/cursor/.agents/skills/jahia-dev-accessibility/SKILL.md +5 -265
  80. package/dist/cursor/.agents/skills/jahia-dev-build-component/SKILL.md +15 -7
  81. package/dist/cursor/.agents/skills/jahia-dev-create-page-template/SKILL.md +59 -21
  82. package/dist/cursor/.agents/skills/jahia-dev-create-template-set/SKILL.md +20 -47
  83. package/dist/cursor/.agents/skills/jahia-dev-create-view/SKILL.md +3 -3
  84. package/dist/cursor/.agents/skills/jahia-dev-review-cnd/SKILL.md +79 -0
  85. package/dist/cursor/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.d.mts +13 -0
  86. package/dist/cursor/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.mjs +198 -0
  87. package/dist/cursor/.agents/skills/jahia-dev-site-review/SKILL.md +70 -0
  88. package/dist/cursor/.agents/skills/jahia-dev-site-review/scripts/review-pages.mjs +85 -0
  89. package/dist/cursor/.agents/skills/jahia-dev-start-local/SKILL.md +18 -26
  90. package/dist/cursor/.cursor/rules/jahia.mdc +13 -40
  91. package/dist/gemini/.agents/skills/jahia-cnd-author/SKILL.md +94 -0
  92. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-area-types.md +55 -0
  93. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-authoring-experience.md +92 -0
  94. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-child-nodes.md +74 -0
  95. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-jahia-mixins.md +510 -0
  96. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-modeling-decisions.md +87 -0
  97. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-numbers-dates.md +92 -0
  98. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-string-selectors.md +133 -0
  99. package/dist/gemini/.agents/skills/jahia-cnd-author/references/cnd-syntax.md +119 -0
  100. package/dist/gemini/.agents/skills/jahia-cnd-author/references/types-ts-mapping.md +73 -0
  101. package/dist/gemini/.agents/skills/jahia-dev-accessibility/SKILL.md +5 -265
  102. package/dist/gemini/.agents/skills/jahia-dev-build-component/SKILL.md +15 -7
  103. package/dist/gemini/.agents/skills/jahia-dev-create-page-template/SKILL.md +59 -21
  104. package/dist/gemini/.agents/skills/jahia-dev-create-template-set/SKILL.md +20 -47
  105. package/dist/gemini/.agents/skills/jahia-dev-create-view/SKILL.md +3 -3
  106. package/dist/gemini/.agents/skills/jahia-dev-review-cnd/SKILL.md +79 -0
  107. package/dist/gemini/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.d.mts +13 -0
  108. package/dist/gemini/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.mjs +198 -0
  109. package/dist/gemini/.agents/skills/jahia-dev-site-review/SKILL.md +70 -0
  110. package/dist/gemini/.agents/skills/jahia-dev-site-review/scripts/review-pages.mjs +85 -0
  111. package/dist/gemini/.agents/skills/jahia-dev-start-local/SKILL.md +18 -26
  112. package/dist/gemini/AGENTS.md +15 -42
  113. package/dist/gemini/GEMINI.md +2 -2
  114. package/dist/index.js +13 -0
  115. package/dist/opencode/.agents/skills/jahia-cnd-author/SKILL.md +94 -0
  116. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-area-types.md +55 -0
  117. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-authoring-experience.md +92 -0
  118. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-child-nodes.md +74 -0
  119. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-jahia-mixins.md +510 -0
  120. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-modeling-decisions.md +87 -0
  121. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-numbers-dates.md +92 -0
  122. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-string-selectors.md +133 -0
  123. package/dist/opencode/.agents/skills/jahia-cnd-author/references/cnd-syntax.md +119 -0
  124. package/dist/opencode/.agents/skills/jahia-cnd-author/references/types-ts-mapping.md +73 -0
  125. package/dist/opencode/.agents/skills/jahia-dev-accessibility/SKILL.md +5 -265
  126. package/dist/opencode/.agents/skills/jahia-dev-build-component/SKILL.md +15 -7
  127. package/dist/opencode/.agents/skills/jahia-dev-create-page-template/SKILL.md +59 -21
  128. package/dist/opencode/.agents/skills/jahia-dev-create-template-set/SKILL.md +20 -47
  129. package/dist/opencode/.agents/skills/jahia-dev-create-view/SKILL.md +3 -3
  130. package/dist/opencode/.agents/skills/jahia-dev-review-cnd/SKILL.md +79 -0
  131. package/dist/opencode/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.d.mts +13 -0
  132. package/dist/opencode/.agents/skills/jahia-dev-review-cnd/scripts/check-cnd.mjs +198 -0
  133. package/dist/opencode/.agents/skills/jahia-dev-site-review/SKILL.md +70 -0
  134. package/dist/opencode/.agents/skills/jahia-dev-site-review/scripts/review-pages.mjs +85 -0
  135. package/dist/opencode/.agents/skills/jahia-dev-start-local/SKILL.md +18 -26
  136. package/dist/opencode/AGENTS.md +15 -42
  137. package/dist/windsurf/.windsurf/rules/jahia.md +13 -40
  138. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/SKILL.md +94 -0
  139. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-area-types.md +55 -0
  140. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-authoring-experience.md +92 -0
  141. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-child-nodes.md +74 -0
  142. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-jahia-mixins.md +510 -0
  143. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-modeling-decisions.md +87 -0
  144. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-numbers-dates.md +92 -0
  145. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-string-selectors.md +133 -0
  146. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/cnd-syntax.md +119 -0
  147. package/dist/windsurf/.windsurf/skills/jahia-cnd-author/references/types-ts-mapping.md +73 -0
  148. package/dist/windsurf/.windsurf/skills/jahia-dev-accessibility/SKILL.md +5 -265
  149. package/dist/windsurf/.windsurf/skills/jahia-dev-build-component/SKILL.md +15 -7
  150. package/dist/windsurf/.windsurf/skills/jahia-dev-create-page-template/SKILL.md +59 -21
  151. package/dist/windsurf/.windsurf/skills/jahia-dev-create-template-set/SKILL.md +20 -47
  152. package/dist/windsurf/.windsurf/skills/jahia-dev-create-view/SKILL.md +3 -3
  153. package/dist/windsurf/.windsurf/skills/jahia-dev-review-cnd/SKILL.md +79 -0
  154. package/dist/windsurf/.windsurf/skills/jahia-dev-review-cnd/scripts/check-cnd.d.mts +13 -0
  155. package/dist/windsurf/.windsurf/skills/jahia-dev-review-cnd/scripts/check-cnd.mjs +198 -0
  156. package/dist/windsurf/.windsurf/skills/jahia-dev-site-review/SKILL.md +70 -0
  157. package/dist/windsurf/.windsurf/skills/jahia-dev-site-review/scripts/review-pages.mjs +85 -0
  158. package/dist/windsurf/.windsurf/skills/jahia-dev-start-local/SKILL.md +18 -26
  159. package/dist/windsurf/AGENTS.md +15 -42
  160. package/package.json +1 -1
  161. package/dist/claude/.claude/skills/jahia/SKILL.md +0 -144
  162. package/dist/claude/.claude/skills/jahia-content/SKILL.md +0 -157
  163. package/dist/claude/.claude/skills/jahia-content-create-content/SKILL.md +0 -359
  164. package/dist/claude/.claude/skills/jahia-content-explore-structure/SKILL.md +0 -255
  165. package/dist/claude/.claude/skills/jahia-content-media-upload/SKILL.md +0 -197
  166. package/dist/claude/.claude/skills/jahia-content-move-content/SKILL.md +0 -231
  167. package/dist/claude/.claude/skills/jahia-content-organize/SKILL.md +0 -209
  168. package/dist/claude/.claude/skills/jahia-content-publish/SKILL.md +0 -181
  169. package/dist/claude/.claude/skills/jahia-content-query-content/SKILL.md +0 -174
  170. package/dist/claude/.claude/skills/jahia-content-translate-content/SKILL.md +0 -226
  171. package/dist/claude/.claude/skills/jahia-dev/SKILL.md +0 -124
  172. package/dist/claude/.claude/skills/jahia-dev-apis/SKILL.md +0 -52
  173. package/dist/claude/.claude/skills/jahia-dev-apis/references/authentication.md +0 -484
  174. package/dist/claude/.claude/skills/jahia-dev-apis/references/graphql.md +0 -657
  175. package/dist/claude/.claude/skills/jahia-dev-apis/references/jcr-api.md +0 -465
  176. package/dist/claude/.claude/skills/jahia-dev-apis/references/security.md +0 -541
  177. package/dist/claude/.claude/skills/jahia-dev-cypress/SKILL.md +0 -265
  178. package/dist/claude/.claude/skills/jahia-dev-define-content-type/SKILL.md +0 -536
  179. package/dist/claude/.claude/skills/jahia-dev-java/SKILL.md +0 -110
  180. package/dist/claude/.claude/skills/jahia-dev-java/references/backend.md +0 -331
  181. package/dist/claude/.claude/skills/jahia-dev-java/references/content-types.md +0 -273
  182. package/dist/claude/.claude/skills/jahia-dev-java/references/modules.md +0 -218
  183. package/dist/claude/.claude/skills/jahia-dev-java/references/osgi.md +0 -208
  184. package/dist/claude/.claude/skills/jahia-dev-java/references/rendering.md +0 -191
  185. package/dist/claude/.claude/skills/jahia-dev-java/references/ui-extensions.md +0 -344
  186. package/dist/claude/.claude/skills/jahia-dev-osgi-module/SKILL.md +0 -297
  187. package/dist/claude/.claude/skills/jahia-dev-ui-extension/SKILL.md +0 -559
  188. package/dist/claude/.claude/skills/jahia-java-concurrency/SKILL.md +0 -308
  189. package/dist/claude/.claude/skills/jahia-java-jcr/SKILL.md +0 -153
  190. package/dist/claude/.claude/skills/jahia-java-osgi/SKILL.md +0 -134
  191. package/dist/claude/.claude/skills/jahia-java-persistence/SKILL.md +0 -177
  192. package/dist/claude/.claude/skills/jahia-java-security/SKILL.md +0 -84
  193. package/dist/claude/.claude/skills/jahia-review-java/SKILL.md +0 -131
  194. package/dist/claude/.claude/skills/jahia-review-java/references/code-review-output.md +0 -121
  195. package/dist/codex/.agents/skills/jahia/SKILL.md +0 -144
  196. package/dist/codex/.agents/skills/jahia-content/SKILL.md +0 -157
  197. package/dist/codex/.agents/skills/jahia-content-create-content/SKILL.md +0 -359
  198. package/dist/codex/.agents/skills/jahia-content-explore-structure/SKILL.md +0 -255
  199. package/dist/codex/.agents/skills/jahia-content-media-upload/SKILL.md +0 -197
  200. package/dist/codex/.agents/skills/jahia-content-move-content/SKILL.md +0 -231
  201. package/dist/codex/.agents/skills/jahia-content-organize/SKILL.md +0 -209
  202. package/dist/codex/.agents/skills/jahia-content-publish/SKILL.md +0 -181
  203. package/dist/codex/.agents/skills/jahia-content-query-content/SKILL.md +0 -174
  204. package/dist/codex/.agents/skills/jahia-content-translate-content/SKILL.md +0 -226
  205. package/dist/codex/.agents/skills/jahia-dev/SKILL.md +0 -124
  206. package/dist/codex/.agents/skills/jahia-dev-apis/SKILL.md +0 -52
  207. package/dist/codex/.agents/skills/jahia-dev-apis/references/authentication.md +0 -484
  208. package/dist/codex/.agents/skills/jahia-dev-apis/references/graphql.md +0 -657
  209. package/dist/codex/.agents/skills/jahia-dev-apis/references/jcr-api.md +0 -465
  210. package/dist/codex/.agents/skills/jahia-dev-apis/references/security.md +0 -541
  211. package/dist/codex/.agents/skills/jahia-dev-cypress/SKILL.md +0 -265
  212. package/dist/codex/.agents/skills/jahia-dev-define-content-type/SKILL.md +0 -536
  213. package/dist/codex/.agents/skills/jahia-dev-java/SKILL.md +0 -110
  214. package/dist/codex/.agents/skills/jahia-dev-java/references/backend.md +0 -331
  215. package/dist/codex/.agents/skills/jahia-dev-java/references/content-types.md +0 -273
  216. package/dist/codex/.agents/skills/jahia-dev-java/references/modules.md +0 -218
  217. package/dist/codex/.agents/skills/jahia-dev-java/references/osgi.md +0 -208
  218. package/dist/codex/.agents/skills/jahia-dev-java/references/rendering.md +0 -191
  219. package/dist/codex/.agents/skills/jahia-dev-java/references/ui-extensions.md +0 -344
  220. package/dist/codex/.agents/skills/jahia-dev-osgi-module/SKILL.md +0 -297
  221. package/dist/codex/.agents/skills/jahia-dev-ui-extension/SKILL.md +0 -559
  222. package/dist/codex/.agents/skills/jahia-java-concurrency/SKILL.md +0 -308
  223. package/dist/codex/.agents/skills/jahia-java-jcr/SKILL.md +0 -153
  224. package/dist/codex/.agents/skills/jahia-java-osgi/SKILL.md +0 -134
  225. package/dist/codex/.agents/skills/jahia-java-persistence/SKILL.md +0 -177
  226. package/dist/codex/.agents/skills/jahia-java-security/SKILL.md +0 -84
  227. package/dist/codex/.agents/skills/jahia-review-java/SKILL.md +0 -131
  228. package/dist/codex/.agents/skills/jahia-review-java/references/code-review-output.md +0 -121
  229. package/dist/copilot/.agents/skills/jahia/SKILL.md +0 -144
  230. package/dist/copilot/.agents/skills/jahia-content/SKILL.md +0 -157
  231. package/dist/copilot/.agents/skills/jahia-content-create-content/SKILL.md +0 -359
  232. package/dist/copilot/.agents/skills/jahia-content-explore-structure/SKILL.md +0 -255
  233. package/dist/copilot/.agents/skills/jahia-content-media-upload/SKILL.md +0 -197
  234. package/dist/copilot/.agents/skills/jahia-content-move-content/SKILL.md +0 -231
  235. package/dist/copilot/.agents/skills/jahia-content-organize/SKILL.md +0 -209
  236. package/dist/copilot/.agents/skills/jahia-content-publish/SKILL.md +0 -181
  237. package/dist/copilot/.agents/skills/jahia-content-query-content/SKILL.md +0 -174
  238. package/dist/copilot/.agents/skills/jahia-content-translate-content/SKILL.md +0 -226
  239. package/dist/copilot/.agents/skills/jahia-dev/SKILL.md +0 -124
  240. package/dist/copilot/.agents/skills/jahia-dev-apis/SKILL.md +0 -52
  241. package/dist/copilot/.agents/skills/jahia-dev-apis/references/authentication.md +0 -484
  242. package/dist/copilot/.agents/skills/jahia-dev-apis/references/graphql.md +0 -657
  243. package/dist/copilot/.agents/skills/jahia-dev-apis/references/jcr-api.md +0 -465
  244. package/dist/copilot/.agents/skills/jahia-dev-apis/references/security.md +0 -541
  245. package/dist/copilot/.agents/skills/jahia-dev-cypress/SKILL.md +0 -265
  246. package/dist/copilot/.agents/skills/jahia-dev-define-content-type/SKILL.md +0 -536
  247. package/dist/copilot/.agents/skills/jahia-dev-java/SKILL.md +0 -110
  248. package/dist/copilot/.agents/skills/jahia-dev-java/references/backend.md +0 -331
  249. package/dist/copilot/.agents/skills/jahia-dev-java/references/content-types.md +0 -273
  250. package/dist/copilot/.agents/skills/jahia-dev-java/references/modules.md +0 -218
  251. package/dist/copilot/.agents/skills/jahia-dev-java/references/osgi.md +0 -208
  252. package/dist/copilot/.agents/skills/jahia-dev-java/references/rendering.md +0 -191
  253. package/dist/copilot/.agents/skills/jahia-dev-java/references/ui-extensions.md +0 -344
  254. package/dist/copilot/.agents/skills/jahia-dev-osgi-module/SKILL.md +0 -297
  255. package/dist/copilot/.agents/skills/jahia-dev-ui-extension/SKILL.md +0 -559
  256. package/dist/copilot/.agents/skills/jahia-java-concurrency/SKILL.md +0 -308
  257. package/dist/copilot/.agents/skills/jahia-java-jcr/SKILL.md +0 -153
  258. package/dist/copilot/.agents/skills/jahia-java-osgi/SKILL.md +0 -134
  259. package/dist/copilot/.agents/skills/jahia-java-persistence/SKILL.md +0 -177
  260. package/dist/copilot/.agents/skills/jahia-java-security/SKILL.md +0 -84
  261. package/dist/copilot/.agents/skills/jahia-review-java/SKILL.md +0 -131
  262. package/dist/copilot/.agents/skills/jahia-review-java/references/code-review-output.md +0 -121
  263. package/dist/cursor/.agents/skills/jahia/SKILL.md +0 -144
  264. package/dist/cursor/.agents/skills/jahia-content/SKILL.md +0 -157
  265. package/dist/cursor/.agents/skills/jahia-content-create-content/SKILL.md +0 -359
  266. package/dist/cursor/.agents/skills/jahia-content-explore-structure/SKILL.md +0 -255
  267. package/dist/cursor/.agents/skills/jahia-content-media-upload/SKILL.md +0 -197
  268. package/dist/cursor/.agents/skills/jahia-content-move-content/SKILL.md +0 -231
  269. package/dist/cursor/.agents/skills/jahia-content-organize/SKILL.md +0 -209
  270. package/dist/cursor/.agents/skills/jahia-content-publish/SKILL.md +0 -181
  271. package/dist/cursor/.agents/skills/jahia-content-query-content/SKILL.md +0 -174
  272. package/dist/cursor/.agents/skills/jahia-content-translate-content/SKILL.md +0 -226
  273. package/dist/cursor/.agents/skills/jahia-dev/SKILL.md +0 -124
  274. package/dist/cursor/.agents/skills/jahia-dev-apis/SKILL.md +0 -52
  275. package/dist/cursor/.agents/skills/jahia-dev-apis/references/authentication.md +0 -484
  276. package/dist/cursor/.agents/skills/jahia-dev-apis/references/graphql.md +0 -657
  277. package/dist/cursor/.agents/skills/jahia-dev-apis/references/jcr-api.md +0 -465
  278. package/dist/cursor/.agents/skills/jahia-dev-apis/references/security.md +0 -541
  279. package/dist/cursor/.agents/skills/jahia-dev-cypress/SKILL.md +0 -265
  280. package/dist/cursor/.agents/skills/jahia-dev-define-content-type/SKILL.md +0 -536
  281. package/dist/cursor/.agents/skills/jahia-dev-java/SKILL.md +0 -110
  282. package/dist/cursor/.agents/skills/jahia-dev-java/references/backend.md +0 -331
  283. package/dist/cursor/.agents/skills/jahia-dev-java/references/content-types.md +0 -273
  284. package/dist/cursor/.agents/skills/jahia-dev-java/references/modules.md +0 -218
  285. package/dist/cursor/.agents/skills/jahia-dev-java/references/osgi.md +0 -208
  286. package/dist/cursor/.agents/skills/jahia-dev-java/references/rendering.md +0 -191
  287. package/dist/cursor/.agents/skills/jahia-dev-java/references/ui-extensions.md +0 -344
  288. package/dist/cursor/.agents/skills/jahia-dev-osgi-module/SKILL.md +0 -297
  289. package/dist/cursor/.agents/skills/jahia-dev-ui-extension/SKILL.md +0 -559
  290. package/dist/cursor/.agents/skills/jahia-java-concurrency/SKILL.md +0 -308
  291. package/dist/cursor/.agents/skills/jahia-java-jcr/SKILL.md +0 -153
  292. package/dist/cursor/.agents/skills/jahia-java-osgi/SKILL.md +0 -134
  293. package/dist/cursor/.agents/skills/jahia-java-persistence/SKILL.md +0 -177
  294. package/dist/cursor/.agents/skills/jahia-java-security/SKILL.md +0 -84
  295. package/dist/cursor/.agents/skills/jahia-review-java/SKILL.md +0 -131
  296. package/dist/cursor/.agents/skills/jahia-review-java/references/code-review-output.md +0 -121
  297. package/dist/gemini/.agents/skills/jahia/SKILL.md +0 -144
  298. package/dist/gemini/.agents/skills/jahia-content/SKILL.md +0 -157
  299. package/dist/gemini/.agents/skills/jahia-content-create-content/SKILL.md +0 -359
  300. package/dist/gemini/.agents/skills/jahia-content-explore-structure/SKILL.md +0 -255
  301. package/dist/gemini/.agents/skills/jahia-content-media-upload/SKILL.md +0 -197
  302. package/dist/gemini/.agents/skills/jahia-content-move-content/SKILL.md +0 -231
  303. package/dist/gemini/.agents/skills/jahia-content-organize/SKILL.md +0 -209
  304. package/dist/gemini/.agents/skills/jahia-content-publish/SKILL.md +0 -181
  305. package/dist/gemini/.agents/skills/jahia-content-query-content/SKILL.md +0 -174
  306. package/dist/gemini/.agents/skills/jahia-content-translate-content/SKILL.md +0 -226
  307. package/dist/gemini/.agents/skills/jahia-dev/SKILL.md +0 -124
  308. package/dist/gemini/.agents/skills/jahia-dev-apis/SKILL.md +0 -52
  309. package/dist/gemini/.agents/skills/jahia-dev-apis/references/authentication.md +0 -484
  310. package/dist/gemini/.agents/skills/jahia-dev-apis/references/graphql.md +0 -657
  311. package/dist/gemini/.agents/skills/jahia-dev-apis/references/jcr-api.md +0 -465
  312. package/dist/gemini/.agents/skills/jahia-dev-apis/references/security.md +0 -541
  313. package/dist/gemini/.agents/skills/jahia-dev-cypress/SKILL.md +0 -265
  314. package/dist/gemini/.agents/skills/jahia-dev-define-content-type/SKILL.md +0 -536
  315. package/dist/gemini/.agents/skills/jahia-dev-java/SKILL.md +0 -110
  316. package/dist/gemini/.agents/skills/jahia-dev-java/references/backend.md +0 -331
  317. package/dist/gemini/.agents/skills/jahia-dev-java/references/content-types.md +0 -273
  318. package/dist/gemini/.agents/skills/jahia-dev-java/references/modules.md +0 -218
  319. package/dist/gemini/.agents/skills/jahia-dev-java/references/osgi.md +0 -208
  320. package/dist/gemini/.agents/skills/jahia-dev-java/references/rendering.md +0 -191
  321. package/dist/gemini/.agents/skills/jahia-dev-java/references/ui-extensions.md +0 -344
  322. package/dist/gemini/.agents/skills/jahia-dev-osgi-module/SKILL.md +0 -297
  323. package/dist/gemini/.agents/skills/jahia-dev-ui-extension/SKILL.md +0 -559
  324. package/dist/gemini/.agents/skills/jahia-java-concurrency/SKILL.md +0 -308
  325. package/dist/gemini/.agents/skills/jahia-java-jcr/SKILL.md +0 -153
  326. package/dist/gemini/.agents/skills/jahia-java-osgi/SKILL.md +0 -134
  327. package/dist/gemini/.agents/skills/jahia-java-persistence/SKILL.md +0 -177
  328. package/dist/gemini/.agents/skills/jahia-java-security/SKILL.md +0 -84
  329. package/dist/gemini/.agents/skills/jahia-review-java/SKILL.md +0 -131
  330. package/dist/gemini/.agents/skills/jahia-review-java/references/code-review-output.md +0 -121
  331. package/dist/opencode/.agents/skills/jahia/SKILL.md +0 -144
  332. package/dist/opencode/.agents/skills/jahia-content/SKILL.md +0 -157
  333. package/dist/opencode/.agents/skills/jahia-content-create-content/SKILL.md +0 -359
  334. package/dist/opencode/.agents/skills/jahia-content-explore-structure/SKILL.md +0 -255
  335. package/dist/opencode/.agents/skills/jahia-content-media-upload/SKILL.md +0 -197
  336. package/dist/opencode/.agents/skills/jahia-content-move-content/SKILL.md +0 -231
  337. package/dist/opencode/.agents/skills/jahia-content-organize/SKILL.md +0 -209
  338. package/dist/opencode/.agents/skills/jahia-content-publish/SKILL.md +0 -181
  339. package/dist/opencode/.agents/skills/jahia-content-query-content/SKILL.md +0 -174
  340. package/dist/opencode/.agents/skills/jahia-content-translate-content/SKILL.md +0 -226
  341. package/dist/opencode/.agents/skills/jahia-dev/SKILL.md +0 -124
  342. package/dist/opencode/.agents/skills/jahia-dev-apis/SKILL.md +0 -52
  343. package/dist/opencode/.agents/skills/jahia-dev-apis/references/authentication.md +0 -484
  344. package/dist/opencode/.agents/skills/jahia-dev-apis/references/graphql.md +0 -657
  345. package/dist/opencode/.agents/skills/jahia-dev-apis/references/jcr-api.md +0 -465
  346. package/dist/opencode/.agents/skills/jahia-dev-apis/references/security.md +0 -541
  347. package/dist/opencode/.agents/skills/jahia-dev-cypress/SKILL.md +0 -265
  348. package/dist/opencode/.agents/skills/jahia-dev-define-content-type/SKILL.md +0 -536
  349. package/dist/opencode/.agents/skills/jahia-dev-java/SKILL.md +0 -110
  350. package/dist/opencode/.agents/skills/jahia-dev-java/references/backend.md +0 -331
  351. package/dist/opencode/.agents/skills/jahia-dev-java/references/content-types.md +0 -273
  352. package/dist/opencode/.agents/skills/jahia-dev-java/references/modules.md +0 -218
  353. package/dist/opencode/.agents/skills/jahia-dev-java/references/osgi.md +0 -208
  354. package/dist/opencode/.agents/skills/jahia-dev-java/references/rendering.md +0 -191
  355. package/dist/opencode/.agents/skills/jahia-dev-java/references/ui-extensions.md +0 -344
  356. package/dist/opencode/.agents/skills/jahia-dev-osgi-module/SKILL.md +0 -297
  357. package/dist/opencode/.agents/skills/jahia-dev-ui-extension/SKILL.md +0 -559
  358. package/dist/opencode/.agents/skills/jahia-java-concurrency/SKILL.md +0 -308
  359. package/dist/opencode/.agents/skills/jahia-java-jcr/SKILL.md +0 -153
  360. package/dist/opencode/.agents/skills/jahia-java-osgi/SKILL.md +0 -134
  361. package/dist/opencode/.agents/skills/jahia-java-persistence/SKILL.md +0 -177
  362. package/dist/opencode/.agents/skills/jahia-java-security/SKILL.md +0 -84
  363. package/dist/opencode/.agents/skills/jahia-review-java/SKILL.md +0 -131
  364. package/dist/opencode/.agents/skills/jahia-review-java/references/code-review-output.md +0 -121
  365. package/dist/windsurf/.windsurf/skills/jahia/SKILL.md +0 -144
  366. package/dist/windsurf/.windsurf/skills/jahia-content/SKILL.md +0 -157
  367. package/dist/windsurf/.windsurf/skills/jahia-content-create-content/SKILL.md +0 -359
  368. package/dist/windsurf/.windsurf/skills/jahia-content-explore-structure/SKILL.md +0 -255
  369. package/dist/windsurf/.windsurf/skills/jahia-content-media-upload/SKILL.md +0 -197
  370. package/dist/windsurf/.windsurf/skills/jahia-content-move-content/SKILL.md +0 -231
  371. package/dist/windsurf/.windsurf/skills/jahia-content-organize/SKILL.md +0 -209
  372. package/dist/windsurf/.windsurf/skills/jahia-content-publish/SKILL.md +0 -181
  373. package/dist/windsurf/.windsurf/skills/jahia-content-query-content/SKILL.md +0 -174
  374. package/dist/windsurf/.windsurf/skills/jahia-content-translate-content/SKILL.md +0 -226
  375. package/dist/windsurf/.windsurf/skills/jahia-dev/SKILL.md +0 -124
  376. package/dist/windsurf/.windsurf/skills/jahia-dev-apis/SKILL.md +0 -52
  377. package/dist/windsurf/.windsurf/skills/jahia-dev-apis/references/authentication.md +0 -484
  378. package/dist/windsurf/.windsurf/skills/jahia-dev-apis/references/graphql.md +0 -657
  379. package/dist/windsurf/.windsurf/skills/jahia-dev-apis/references/jcr-api.md +0 -465
  380. package/dist/windsurf/.windsurf/skills/jahia-dev-apis/references/security.md +0 -541
  381. package/dist/windsurf/.windsurf/skills/jahia-dev-cypress/SKILL.md +0 -265
  382. package/dist/windsurf/.windsurf/skills/jahia-dev-define-content-type/SKILL.md +0 -536
  383. package/dist/windsurf/.windsurf/skills/jahia-dev-java/SKILL.md +0 -110
  384. package/dist/windsurf/.windsurf/skills/jahia-dev-java/references/backend.md +0 -331
  385. package/dist/windsurf/.windsurf/skills/jahia-dev-java/references/content-types.md +0 -273
  386. package/dist/windsurf/.windsurf/skills/jahia-dev-java/references/modules.md +0 -218
  387. package/dist/windsurf/.windsurf/skills/jahia-dev-java/references/osgi.md +0 -208
  388. package/dist/windsurf/.windsurf/skills/jahia-dev-java/references/rendering.md +0 -191
  389. package/dist/windsurf/.windsurf/skills/jahia-dev-java/references/ui-extensions.md +0 -344
  390. package/dist/windsurf/.windsurf/skills/jahia-dev-osgi-module/SKILL.md +0 -297
  391. package/dist/windsurf/.windsurf/skills/jahia-dev-ui-extension/SKILL.md +0 -559
  392. package/dist/windsurf/.windsurf/skills/jahia-java-concurrency/SKILL.md +0 -308
  393. package/dist/windsurf/.windsurf/skills/jahia-java-jcr/SKILL.md +0 -153
  394. package/dist/windsurf/.windsurf/skills/jahia-java-osgi/SKILL.md +0 -134
  395. package/dist/windsurf/.windsurf/skills/jahia-java-persistence/SKILL.md +0 -177
  396. package/dist/windsurf/.windsurf/skills/jahia-java-security/SKILL.md +0 -84
  397. package/dist/windsurf/.windsurf/skills/jahia-review-java/SKILL.md +0 -131
  398. package/dist/windsurf/.windsurf/skills/jahia-review-java/references/code-review-output.md +0 -121
@@ -1,308 +0,0 @@
1
- ---
2
- name: jahia-java-concurrency
3
- description: Thread safety patterns for Jahia Java backend development in a multi-threaded web application. Covers volatile, locking, atomic variables, thread-safe collections, immutability, and common pitfalls that cause data races, stale reads, and silent corruption. Load when implementing or reviewing any class that holds mutable state accessible from multiple threads — OSGi services, caches, static fields, background workers, event listeners.
4
- allowed-tools: Read
5
- ---
6
-
7
- # Concurrency and Thread Safety for Jahia Java Backend
8
-
9
- In a Jahia webapp, every OSGi service is a singleton — its instance fields are shared across every concurrent request, publication job, event listener, and background thread. A field that looks fine in a single-threaded test can silently corrupt data or read stale values under real load.
10
-
11
- This skill covers the correct patterns and the pitfalls. Both developers and reviewers use it.
12
-
13
- > OSGi-specific concurrency (`@Modified` config reload, `@Reference` dynamic rebinding) is covered in `/jahia-java-osgi`. This skill covers the general Java concurrency model applicable to all backend code.
14
-
15
- ---
16
-
17
- ## The three questions to ask about any mutable field
18
-
19
- Before writing or reviewing any instance or static field in a service:
20
-
21
- 1. **Can it be written by more than one thread?** If yes → needs synchronization or an atomic type.
22
- 2. **Can it be read while another thread is writing it?** If yes → at minimum needs `volatile`.
23
- 3. **Are read + write part of a compound action** (check-then-act, read-modify-write)? If yes → `volatile` alone is not enough, needs a lock or an atomic with CAS.
24
-
25
- ---
26
-
27
- ## Immutability — the first line of defence
28
-
29
- ### Correct approach
30
-
31
- Prefer immutable objects. An immutable object needs no synchronization — it is inherently thread-safe.
32
-
33
- - Make fields `final` wherever possible.
34
- - Use `record` types for config/value objects (all fields are final by definition).
35
- - Use `List.of()`, `Map.of()`, `Set.of()` for collections that do not change after construction.
36
- - Return copies or unmodifiable views of mutable internal collections rather than the live reference.
37
-
38
- ### Pitfall
39
-
40
- ```java
41
- // dangerous — caller can mutate the internal list
42
- public List<String> getAllowedRoles() {
43
- return allowedRoles; // returns live mutable reference
44
- }
45
- ```
46
-
47
- Return `Collections.unmodifiableList(allowedRoles)` or `List.copyOf(allowedRoles)` instead.
48
-
49
- ---
50
-
51
- ## `volatile` — correct use and limits
52
-
53
- ### Correct use
54
-
55
- `volatile` guarantees **visibility**: a write to a `volatile` field is immediately visible to all subsequent reads in other threads. Use it when:
56
-
57
- - One thread writes, many threads read (no compound action needed).
58
- - The written value is a single reference or primitive (not two fields that must be updated atomically together).
59
-
60
- ```java
61
- // correct — single writer (SCR @Modified), many readers
62
- private volatile Config config;
63
-
64
- @Activate @Modified
65
- void activate(Cfg cfg) {
66
- this.config = new Config(cfg); // atomic reference swap
67
- }
68
- ```
69
-
70
- ### Limits — volatile is NOT enough for compound actions
71
-
72
- ```java
73
- // WRONG — read-modify-write is not atomic even with volatile
74
- private volatile int counter = 0;
75
- public void increment() {
76
- counter++; // read, increment, write — three steps, not one
77
- }
78
- ```
79
-
80
- Two threads can both read `counter = 5`, both compute `6`, and both write `6` — losing one increment. Use `AtomicInteger.incrementAndGet()` instead.
81
-
82
- Similarly, volatile does not protect **two fields that must be consistent with each other**:
83
-
84
- ```java
85
- // WRONG — reader can see updated 'host' with old 'port'
86
- private volatile String host;
87
- private volatile int port;
88
- ```
89
-
90
- Bundle related fields into a single immutable record and swap the reference atomically (as shown in `/jahia-java-osgi`).
91
-
92
- ---
93
-
94
- ## Atomic variables
95
-
96
- Use `java.util.concurrent.atomic` for lock-free, thread-safe single-value updates:
97
-
98
- | Need | Type |
99
- |---|---|
100
- | Thread-safe counter | `AtomicInteger` / `AtomicLong` |
101
- | Thread-safe reference swap | `AtomicReference<T>` |
102
- | Conditional update (compare-and-swap) | `AtomicReference.compareAndSet()` |
103
- | Accumulator under high contention | `LongAdder` (more scalable than `AtomicLong` for pure counting) |
104
-
105
- ### Check-then-act with `compareAndSet`
106
-
107
- ```java
108
- // correct — atomic conditional update
109
- AtomicReference<State> stateRef = new AtomicReference<>(State.IDLE);
110
-
111
- public boolean tryStart() {
112
- return stateRef.compareAndSet(State.IDLE, State.RUNNING);
113
- }
114
- ```
115
-
116
- Two threads calling `tryStart()` concurrently: only one gets `true`. No lock needed.
117
-
118
- ---
119
-
120
- ## Synchronized blocks and `ReentrantLock`
121
-
122
- ### When to use
123
-
124
- Use explicit locking when:
125
- - The critical section spans multiple statements that must execute atomically.
126
- - You need read/write distinction (`ReadWriteLock`).
127
- - You need a timed or interruptible lock attempt (`ReentrantLock.tryLock(timeout)`).
128
-
129
- ### Correct approach
130
-
131
- ```java
132
- // small, focused critical section
133
- private final Object lock = new Object();
134
- private List<String> items = new ArrayList<>();
135
-
136
- public void addItem(String item) {
137
- synchronized (lock) {
138
- items.add(item);
139
- }
140
- }
141
-
142
- public List<String> snapshot() {
143
- synchronized (lock) {
144
- return List.copyOf(items); // return a copy, not the live list
145
- }
146
- }
147
- ```
148
-
149
- ### Pitfalls
150
-
151
- - **Locking on `this`.** Callers can also `synchronized(service)` from outside, causing unexpected contention or deadlock. Prefer a private `final Object lock`.
152
- - **Holding a lock during I/O or JCR calls.** A lock held while doing a JCR query or an HTTP call blocks all other threads waiting for it. Move I/O outside the critical section; only protect the state mutation.
153
- - **Inconsistent lock object.** Two methods protecting the same state must use the same lock.
154
- - **Deadlock.** Two threads each holding lock A and waiting for lock B. Always acquire multiple locks in the same fixed order. Prefer `tryLock(timeout)` and fail gracefully rather than block indefinitely.
155
-
156
- ### `ReadWriteLock` for read-heavy state
157
-
158
- ```java
159
- private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
160
- private Map<String, String> cache = new HashMap<>();
161
-
162
- public String get(String key) {
163
- rwLock.readLock().lock();
164
- try { return cache.get(key); }
165
- finally { rwLock.readLock().unlock(); }
166
- }
167
-
168
- public void put(String key, String value) {
169
- rwLock.writeLock().lock();
170
- try { cache.put(key, value); }
171
- finally { rwLock.writeLock().unlock(); }
172
- }
173
- ```
174
-
175
- Multiple readers proceed concurrently; a writer gets exclusive access. Worth the complexity only when reads heavily outnumber writes.
176
-
177
- ---
178
-
179
- ## Thread-safe collections
180
-
181
- | Use case | Correct type | What NOT to use |
182
- |---|---|---|
183
- | Concurrent map (read-heavy or write-heavy) | `ConcurrentHashMap` | `HashMap` (not thread-safe), `Collections.synchronizedMap` (full lock on every op) |
184
- | Concurrent list, infrequent writes | `CopyOnWriteArrayList` | `ArrayList`, `Collections.synchronizedList` |
185
- | Concurrent queue / work queue | `LinkedBlockingQueue`, `ArrayBlockingQueue` | `LinkedList` |
186
- | Set | `ConcurrentHashMap.newKeySet()` | `HashSet` |
187
- | Cache with eviction | `Caffeine` or `Guava Cache` | `HashMap` with manual cleanup |
188
-
189
- ### Pitfall — compound actions on `ConcurrentHashMap`
190
-
191
- ```java
192
- // WRONG — check-then-put is not atomic
193
- if (!map.containsKey(key)) {
194
- map.put(key, value);
195
- }
196
- // CORRECT
197
- map.putIfAbsent(key, value);
198
- // or for a more complex compute:
199
- map.computeIfAbsent(key, k -> expensiveCreate(k));
200
- ```
201
-
202
- Even `ConcurrentHashMap` does not make compound actions atomic unless you use the atomic methods (`putIfAbsent`, `computeIfAbsent`, `merge`, `compute`).
203
-
204
- ---
205
-
206
- ## Static fields
207
-
208
- ### Pitfall
209
-
210
- Static fields are shared across all class loader instances — effectively global state in a webapp. A static mutable field is the most dangerous form of shared state: it is not scoped to a component lifecycle, so it outlives bundle reactivations and can carry stale state.
211
-
212
- ```java
213
- // dangerous — static mutable state in a webapp
214
- private static Map<String, Object> cache = new HashMap<>();
215
- ```
216
-
217
- **Rule:** static fields in a Jahia module must be either:
218
- - `final` and truly immutable (constants, loggers), or
219
- - `volatile` / concurrent-typed with documented thread-safety, or
220
- - `ThreadLocal` (thread-scoped, not shared).
221
-
222
- If you need a cache or shared service state, use an OSGi `@Component` instance field — the OSGi lifecycle manages it correctly.
223
-
224
- ---
225
-
226
- ## `ThreadLocal`
227
-
228
- `ThreadLocal` gives each thread its own isolated copy of a variable. Correct for per-request state (locale, user context, transaction context).
229
-
230
- ### Pitfall — thread pool reuse
231
-
232
- Jahia uses thread pools. A `ThreadLocal` set during request A and not cleared will be visible during a later request B handled by the same thread:
233
-
234
- ```java
235
- // always clean up in a finally block
236
- threadLocal.set(value);
237
- try {
238
- doWork();
239
- } finally {
240
- threadLocal.remove(); // mandatory
241
- }
242
- ```
243
-
244
- Failing to call `remove()` is a P1 finding — stale user context or locale leaked to subsequent requests.
245
-
246
- ---
247
-
248
- ## JCR sessions are NOT thread-safe
249
-
250
- A `JCRSessionWrapper` must never be shared across threads. Do not store a session as an instance field of an OSGi service and reuse it across requests.
251
-
252
- ```java
253
- // WRONG — shared session across threads
254
- @Component
255
- public class MyService {
256
- private JCRSessionWrapper session; // one session, all threads — crash under concurrency
257
- }
258
- ```
259
-
260
- Always obtain a fresh session per-thread (and per-locale where i18n matters) and close it in a `finally` block or via `JCRTemplate`.
261
-
262
- ---
263
-
264
- ## Lazy initialization
265
-
266
- ### Correct approach — `volatile` + double-checked locking
267
-
268
- ```java
269
- private volatile ExpensiveObject instance;
270
-
271
- public ExpensiveObject get() {
272
- if (instance == null) { // first check (no lock)
273
- synchronized (this) {
274
- if (instance == null) { // second check (with lock)
275
- instance = new ExpensiveObject();
276
- }
277
- }
278
- }
279
- return instance;
280
- }
281
- ```
282
-
283
- Without `volatile`, the JVM may publish a partially-constructed object due to instruction reordering. **`volatile` on the field is mandatory for double-checked locking to be correct.**
284
-
285
- ### Simpler alternative — holder idiom
286
-
287
- ```java
288
- // no synchronization needed — class loading is inherently thread-safe
289
- private static class Holder {
290
- static final ExpensiveObject INSTANCE = new ExpensiveObject();
291
- }
292
- public static ExpensiveObject get() { return Holder.INSTANCE; }
293
- ```
294
-
295
- ---
296
-
297
- ## Review checklist
298
-
299
- When reviewing any class in a Jahia module, check:
300
-
301
- 1. **Instance fields of `@Component` services** — are mutable ones `volatile`, atomic, or synchronized?
302
- 2. **Static mutable fields** — flag immediately; require justification and correct synchronization.
303
- 3. **Compound actions** — every check-then-act or read-modify-write on a shared field needs a lock or atomic CAS.
304
- 4. **Collections returned from getters** — are they copies or unmodifiable views?
305
- 5. **JCR sessions** — never stored as instance fields; always obtained and closed per-thread.
306
- 6. **`ThreadLocal`** — always cleaned up in a `finally` block.
307
- 7. **Locks** — held for the minimum possible time; no I/O inside a critical section.
308
- 8. **Undocumented thread-safety contract** — if the class is not internally thread-safe, its Javadoc must say so and name the required external synchronization.
@@ -1,153 +0,0 @@
1
- ---
2
- name: jahia-java-jcr
3
- description: JCR patterns for Jahia Java development — correct usage of sessions, workspaces, node operations, mixins, locks, and versioning. Covers both the right approach and the pitfalls that cause data loss, security gaps, or concurrency bugs. Load when implementing or reviewing any class that reads or writes the JCR.
4
- allowed-tools: Read
5
- ---
6
-
7
- # JCR Patterns for Jahia Java
8
-
9
- This skill covers how to use the JCR correctly in a Jahia Java module. Each section states the correct approach first, then the pitfall to avoid. Both developers and reviewers use this skill: developers to implement correctly from the start, reviewers to identify violations.
10
-
11
- ---
12
-
13
- ## Session lifecycle and workspace
14
-
15
- ### Correct approach
16
-
17
- - **User session** (`JCRSessionWrapper` obtained from `JCRSessionFactory.getCurrentUserSession(workspace, locale)`) enforces ACLs. Use this for any operation that should respect the user's permissions.
18
- - **System session** (`JCRTemplate.doExecuteWithSystemSession` or `JCRSessionFactory.getCurrentSystemSession`) bypasses ACLs. Use only when a permission check was performed earlier in the call chain and documented explicitly.
19
- - **Workspace boundary.** `default` (edit workspace, where authors work) vs `live` (published, visitor-facing). Public-facing reads must use `live`. Admin UIs use `default`. Writes that must appear publicly go through `PublicationService` — never write to `live` directly unless you have a specific operational reason.
20
- - **Locale.** `getCurrentUserSession(workspace, locale)` resolves i18n properties. Omitting the locale falls back to default — correct only if the caller truly does not need a specific locale.
21
-
22
- ### Pitfalls
23
-
24
- - **System session without prior permission check.** When a system session performs an operation, trace back to where the target node ID came from. If it came from a user-session lookup with no further authorization check, the user-session lookup is the entire security boundary. Document this explicitly. If it is absent, it is a security finding.
25
- - **Workspace mismatch.** Reading from `default` when rendering public pages, or writing to `live` when the intended target is `default`. Both produce silent wrong behavior.
26
- - **Locale omission.** Calling without locale and reading `jcr:title` or any i18n property — the result is locale-nondeterministic.
27
-
28
- ---
29
-
30
- ## Node names — JSR-283 conformance
31
-
32
- ### Correct approach
33
-
34
- Forbidden characters in a local name: `/ : [ ] | *`, plus whitespace-only names. Use `JCRContentUtils.escapeLocalNodeName` to sanitize any externally-supplied string before using it as a node name.
35
-
36
- ### Pitfall
37
-
38
- Hand-rolled filename sanitization (regex replacements, `String.replace`) is almost always incomplete. The JSR-283 character set is non-obvious. Use the platform helper.
39
-
40
- ---
41
-
42
- ## Same-name siblings (SNS)
43
-
44
- ### Correct approach
45
-
46
- Two children with the same name under the same parent are indexed `node[1]`, `node[2]`. If you need to find-or-create by name under concurrent load, either:
47
- - Lock the parent node before the check-then-create sequence.
48
- - Use a unique-by-construction name (UUID, slug+timestamp) and store the display name as a property.
49
-
50
- ### Pitfall
51
-
52
- Unguarded find-or-create patterns under any concurrent caller (publication pipeline, event listener, HTTP endpoint) hit `ItemExistsException` or silently create a duplicate SNS node. Under guest endpoints this is a P1 finding.
53
-
54
- ---
55
-
56
- ## Mixin handling
57
-
58
- ### Correct approach
59
-
60
- - Before setting properties specific to a mixin, call `node.addMixin("ns:myMixin")` if the node does not already have it.
61
- - Use `node.isNodeType("ns:myMixin")` to classify behavior rather than switching on concrete node type strings from another module. This keeps the engine decoupled from specific UI modules.
62
- - **Definition-level vs instance-level mixins.** Mixins applied in the CND definition are always present on every node of that type. Mixins added at runtime via `addMixin()` are instance-level — they must be captured and restored explicitly in any serialization/versioning path.
63
-
64
- ### Pitfalls
65
-
66
- - Assuming a mixin is present because the content type "should" have it — this breaks when the content was created before the mixin was added to the definition.
67
- - Hardcoded concrete node-type strings from another module (`fmdb:inputText`, `fmdb:textarea`). The correct pattern is classifying mixins in the engine's own CND.
68
- - Serialization paths (export, versioning, diff) that capture `properties` but ignore `mixinNodeTypesNames` — instance-level mixin changes are silently lost on restore.
69
-
70
- ---
71
-
72
- ## Versioning and checkout
73
-
74
- ### Correct approach
75
-
76
- Writing to a `mix:versionable` node requires a `checkout()` call first. After saving, call `checkin()` if the workflow requires it. Jahia's publication service handles this for standard publication flows — only write direct checkout/checkin in custom write paths.
77
-
78
- ### Pitfall
79
-
80
- Writing to a versioned node without `checkout()` throws `VersionException`. Code that assumes the node is always in a checked-out state breaks whenever the publication service last left it checked in.
81
-
82
- ---
83
-
84
- ## Locking
85
-
86
- ### Correct approach
87
-
88
- Respect existing locks before performing write operations. Before clearing a lock:
89
- 1. Check whether the lock is owned by the current operation or by an external caller (another user, a publication job, a workflow).
90
- 2. If the lock is external, **fail the operation** with a clear error — do not clear it silently and continue.
91
- 3. Document the thread-safety contract of any write path that involves locking.
92
-
93
- ### Pitfall
94
-
95
- ```java
96
- // dangerous — clears locks unconditionally, continues even if clearing fails
97
- JCRContentUtils.clearAllLocks(node);
98
- restoreContent(node, version);
99
- ```
100
-
101
- A node locked by an active publication job, a concurrent editor, or a workflow step is locked for a reason. Clearing it unconditionally can corrupt in-progress work. This is a P0 finding if the code ships to production; P1 if guarded by a feature flag that is off by default.
102
-
103
- ---
104
-
105
- ## JCR event listeners
106
-
107
- ### Correct approach
108
-
109
- Register listeners in `@Activate` and unregister in `@Deactivate`. Use `JCRObservationManager` or Jahia's `DefaultEventListener` base class. Keep listeners short — heavy work should be dispatched to a separate thread or scheduled task.
110
-
111
- Event listener disabling via `JCRObservationManager.setAllEventListenersDisabled(true)` is **thread-local** in Jahia, not global. It is safe to use inside a request thread or a background thread without affecting other concurrent threads.
112
-
113
- ### Pitfalls
114
-
115
- - Listeners registered but never unregistered — accumulate across reactivations, causing duplicate event processing.
116
- - Blocking I/O or JCR writes inside a synchronous event listener — holds the observation thread and causes lag across the entire event queue.
117
-
118
- ---
119
-
120
- ## `RepositoryException` handling
121
-
122
- ### Correct approach
123
-
124
- - On a **security gate** (checking node type, checking permission): if the check throws, fail closed. Do not let the operation continue.
125
- - On a **data read**: if partial results would be misleading downstream, fail or return an empty result with a logged warning.
126
-
127
- ### Pitfall
128
-
129
- ```java
130
- try {
131
- requiresAuth = node.isNodeType("...");
132
- } catch (RepositoryException e) {
133
- log.warn(...);
134
- return; // operation continues — fails open
135
- }
136
- ```
137
-
138
- Fail-open on a security gate is a P0 finding. Fail-open on a data read producing misleading partial state is P0 or P1 depending on downstream impact.
139
-
140
- ---
141
-
142
- ## JCR SQL2 queries
143
-
144
- ### Correct approach
145
-
146
- - Scope queries with `ISDESCENDANTNODE(alias, '/sites/...')` — never query the entire repository.
147
- - Use specific node types, not `nt:base`. Use `jmix:searchable` for broad content queries.
148
- - Parameterize with bind variables, not string concatenation.
149
- - Set a `LIMIT` on unbounded queries.
150
-
151
- ### Pitfall
152
-
153
- `SELECT * FROM [nt:base]` against the full repository is a full-scan and blocks the query index. String-concatenated queries are a JCR injection vector (less critical than SQL injection but still wrong).
@@ -1,134 +0,0 @@
1
- ---
2
- name: jahia-java-osgi
3
- description: OSGi component patterns for Jahia Java development — correct usage of @Component lifecycle, @Reference, Export-Package, whiteboard services, and thread safety. Covers both the right approach and the pitfalls that cause NPEs, stale state, or leaked internals. Load when implementing or reviewing any class annotated with @Component, @Reference, or @Activate.
4
- allowed-tools: Read
5
- ---
6
-
7
- # OSGi Component Patterns for Jahia Java
8
-
9
- This skill covers how to write OSGi components correctly in a Jahia Java module. Each section states the correct approach first, then the pitfall to avoid. Both developers and reviewers use this skill.
10
-
11
- For broader Java concurrency patterns (atomic variables, locking, thread-safe collections, `ThreadLocal`, JCR session threading) that apply beyond OSGi components, load `/jahia-java-concurrency`.
12
-
13
- For a comprehensive OSGi reference (bundle lifecycle, Blueprint XML, Karaf tooling, service registry), load the `jahia-dev-java` skill and read `references/osgi.md`.
14
-
15
- ---
16
-
17
- ## Component state and configuration reload
18
-
19
- ### Correct approach
20
-
21
- `@Component` services are singletons. Configuration is delivered via `@Activate` (on first start) and `@Modified` (on config change). `@Modified` runs on a different thread than service consumers.
22
-
23
- The safe pattern for config reload:
24
-
25
- ```java
26
- private volatile Config config;
27
-
28
- record Config(String host, int port) {}
29
-
30
- @Activate @Modified
31
- public void activate(MyOsgiConfig cfg) {
32
- this.config = new Config(cfg.host(), cfg.port());
33
- }
34
-
35
- public void doWork() {
36
- var c = this.config; // snapshot once — atomic read
37
- // use c.host(), c.port() ...
38
- }
39
- ```
40
-
41
- A single `volatile` write (the reference swap) is atomically visible to all readers. Readers snapshot the reference once at method entry and work with the snapshot — they never see a half-updated config.
42
-
43
- ### Pitfalls
44
-
45
- - **Mutable fields updated in `@Activate`/`@Modified` without `volatile` or synchronization.** A consumer thread can read a field while `@Modified` is updating it — data race. P1 finding.
46
- - **Multiple fields updated individually without synchronization.** Even with `volatile`, two separate field reads can see values from different config snapshots. Use a single `volatile Config` record, not individual `volatile String host; volatile int port`.
47
-
48
- ---
49
-
50
- ## Service references
51
-
52
- ### Correct approach
53
-
54
- - `@Reference` fields are set by SCR before `@Activate`. Treat them as effectively final inside the component's methods.
55
- - For **mandatory** references (`cardinality = MANDATORY`), the component will not activate if the service is absent — null checks are not needed.
56
- - For **optional** references (`cardinality = OPTIONAL`), the field can be `null` — always guard.
57
- - For **dynamic** references (`policy = ReferencePolicy.DYNAMIC`), the field can be replaced at runtime. Snapshot it at method entry: `var svc = this.myService;` then use `svc`. Reading the field twice risks NPE if the service is unregistered between reads.
58
-
59
- ### Pitfalls
60
-
61
- - **Non-mandatory `@Reference` accessed without null guard.** P1 — NPE in production when the referenced bundle is not deployed.
62
- - **Dynamic reference read twice without snapshot.** Between two reads the SCR may set the field to `null`. P1.
63
- - **`policyOption = GREEDY`.** SCR rebinds to a higher-ranked service when one appears. Code holding a reference to the old service instance keeps using a deactivated service. Document this if intentional.
64
-
65
- ---
66
-
67
- ## Lifecycle side effects
68
-
69
- ### Correct approach
70
-
71
- Every side effect created in `@Activate` must be undone in `@Deactivate`. Components can be deactivated and re-activated on config changes (depending on `@Modified` policy). Failing to undo side effects causes them to accumulate across activations.
72
-
73
- Checklist:
74
- - Thread started in `@Activate` → stopped in `@Deactivate` (interrupt + join).
75
- - JCR event listener registered → unregistered.
76
- - Scheduled task registered → cancelled.
77
- - External connection opened → closed.
78
- - Cache populated → cleared or reseeded.
79
-
80
- ### Pitfall
81
-
82
- A listener registered in `@Activate` but never unregistered in `@Deactivate` survives deactivation, fires events for a component that is no longer active, and duplicates on next activation. P1.
83
-
84
- ---
85
-
86
- ## Export-Package hygiene
87
-
88
- ### Correct approach
89
-
90
- `Export-Package` in `pom.xml` defines what other bundles can import. It is the module's public API contract.
91
-
92
- - Export only interfaces and types in a dedicated `api` or `spi` sub-package.
93
- - Never export `*.impl`, `*.internal`, `*.actions` — the name signals private scope.
94
- - Never re-export third-party packages.
95
- - If the module advertises an SPI for external consumers, the SPI should live in a **separate Maven module** (`{name}-api`). Changing the runtime JAR then does not force a version bump on the API.
96
-
97
- ### Pitfall
98
-
99
- Exporting implementation packages means any other bundle can import your internal classes. A refactor that renames or removes an internal class becomes a breaking change for dependent bundles. P1.
100
-
101
- ---
102
-
103
- ## Whiteboard pattern services
104
-
105
- Services registered as `@Component` — `Servlet`, `Filter`, `EventHandler`, GraphQL provider — are activated the moment the bundle starts. If the service is reachable over HTTP, it is as exposed as a `web.xml` servlet, with no extra protection by default. Apply the security mapping from `jahia-java-security` for every HTTP-reachable whiteboard service.
106
-
107
- ---
108
-
109
- ## Service locator anti-pattern
110
-
111
- ### Correct approach
112
-
113
- Declare all dependencies as `@Reference` fields. SCR injects them before `@Activate`. The component's constructor or `@Activate` method has all dependencies available without any lookup.
114
-
115
- ### Pitfall
116
-
117
- ```java
118
- // anti-pattern — service locator inside a method
119
- MyService svc = (MyService) SpringContextSingleton.getBean("myService");
120
- ```
121
-
122
- Service locator calls inside methods: hide the component's real dependencies, make the code impossible to unit-test, bypass SCR lifecycle guarantees, and can return stale or wrong beans after a context refresh. P2 in general code; P1 in a hot path or security-relevant method.
123
-
124
- ---
125
-
126
- ## Thread safety summary for reviewers
127
-
128
- When reviewing an `@Component` service, ask:
129
-
130
- 1. Are there mutable instance fields? If yes — are they `volatile` or synchronized?
131
- 2. Does the component react to `@Modified`? If yes — do consumers snapshot config at method entry?
132
- 3. Are there `DYNAMIC` references? If yes — do callers snapshot the reference?
133
- 4. Does the component start threads, register listeners, or open connections? If yes — does `@Deactivate` undo all of them?
134
- 5. Does the component's Javadoc state its thread-safety contract? If the service is not internally safe, the caller must be told what external serialization is required.