theus-cli-linux-x64 0.2.84

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 (742) hide show
  1. package/LICENSE +42 -0
  2. package/README.md +295 -0
  3. package/RELEASE.json +18 -0
  4. package/assets/brand-official/v1.0/logo/theus-lockup-negative-official.png +0 -0
  5. package/assets/brand-official/v1.0/logo/theus-lockup-primary-dark-official.png +0 -0
  6. package/assets/fonts/satoshi/satoshi-300.woff2 +0 -0
  7. package/assets/fonts/satoshi/satoshi-400.woff2 +0 -0
  8. package/assets/fonts/satoshi/satoshi-500.woff2 +0 -0
  9. package/assets/fonts/satoshi/satoshi-700.woff2 +0 -0
  10. package/assets/fonts/satoshi/satoshi-900.woff2 +0 -0
  11. package/assets/windows-store/Square150x150Logo.png +0 -0
  12. package/assets/windows-store/Square44x44Logo.png +0 -0
  13. package/assets/windows-store/StoreLogo.png +0 -0
  14. package/assets/windows-store/theus-store-icon-master.png +0 -0
  15. package/bin/theus +0 -0
  16. package/package.json +18 -0
  17. package/vendor/theus-arsenal/.arsenal-nombres-ola2.json +6 -0
  18. package/vendor/theus-arsenal/.arsenal-nombres-ola3.json +72 -0
  19. package/vendor/theus-arsenal/.mailmap +2 -0
  20. package/vendor/theus-arsenal/.theus-plugin/marketplace.json +25 -0
  21. package/vendor/theus-arsenal/.theus-plugin/plugin.json +20 -0
  22. package/vendor/theus-arsenal/AUTHORS.md +8 -0
  23. package/vendor/theus-arsenal/CLEANROOM_REPLACEMENT_PLAN.md +11 -0
  24. package/vendor/theus-arsenal/LICENSE +26 -0
  25. package/vendor/theus-arsenal/PROVENANCE.md +9 -0
  26. package/vendor/theus-arsenal/README.md +41 -0
  27. package/vendor/theus-arsenal/THIRD_PARTY.md +80 -0
  28. package/vendor/theus-arsenal/agents/actualizador-docs.md +123 -0
  29. package/vendor/theus-arsenal/agents/analista-comentarios.md +53 -0
  30. package/vendor/theus-arsenal/agents/analista-conversaciones.md +60 -0
  31. package/vendor/theus-arsenal/agents/analista-tests-pr.md +53 -0
  32. package/vendor/theus-arsenal/agents/analista-tipos.md +49 -0
  33. package/vendor/theus-arsenal/agents/arquitecto-accesibilidad.md +148 -0
  34. package/vendor/theus-arsenal/agents/arquitecto-codigo.md +79 -0
  35. package/vendor/theus-arsenal/agents/arquitecto-homelab.md +90 -0
  36. package/vendor/theus-arsenal/agents/arquitecto-redes.md +116 -0
  37. package/vendor/theus-arsenal/agents/arquitecto-sistemas.md +219 -0
  38. package/vendor/theus-arsenal/agents/bifurcador-opensource.md +206 -0
  39. package/vendor/theus-arsenal/agents/cazador-fallos-silenciosos.md +58 -0
  40. package/vendor/theus-arsenal/agents/consultor-documentacion.md +76 -0
  41. package/vendor/theus-arsenal/agents/diagnosticador-redes.md +135 -0
  42. package/vendor/theus-arsenal/agents/ejecutor-e2e.md +96 -0
  43. package/vendor/theus-arsenal/agents/empaquetador-opensource.md +257 -0
  44. package/vendor/theus-arsenal/agents/escaner-secretos.md +196 -0
  45. package/vendor/theus-arsenal/agents/especialista-seo.md +70 -0
  46. package/vendor/theus-arsenal/agents/estratega-marketing.md +158 -0
  47. package/vendor/theus-arsenal/agents/evaluador-agentes.md +214 -0
  48. package/vendor/theus-arsenal/agents/evaluador-harness.md +217 -0
  49. package/vendor/theus-arsenal/agents/explorador-codigo.md +79 -0
  50. package/vendor/theus-arsenal/agents/extractor-specs.md +214 -0
  51. package/vendor/theus-arsenal/agents/generador-harness.md +139 -0
  52. package/vendor/theus-arsenal/agents/guia-tdd.md +99 -0
  53. package/vendor/theus-arsenal/agents/jefe-de-gabinete.md +162 -0
  54. package/vendor/theus-arsenal/agents/limpiador-refactors.md +93 -0
  55. package/vendor/theus-arsenal/agents/optimizador-rendimiento.md +454 -0
  56. package/vendor/theus-arsenal/agents/planificador-harness.md +107 -0
  57. package/vendor/theus-arsenal/agents/planificador.md +221 -0
  58. package/vendor/theus-arsenal/agents/resolutor-apps-harmonyos.md +181 -0
  59. package/vendor/theus-arsenal/agents/resolutor-builds-cpp.md +98 -0
  60. package/vendor/theus-arsenal/agents/resolutor-builds-dart.md +209 -0
  61. package/vendor/theus-arsenal/agents/resolutor-builds-django.md +253 -0
  62. package/vendor/theus-arsenal/agents/resolutor-builds-go.md +102 -0
  63. package/vendor/theus-arsenal/agents/resolutor-builds-java.md +274 -0
  64. package/vendor/theus-arsenal/agents/resolutor-builds-kotlin.md +128 -0
  65. package/vendor/theus-arsenal/agents/resolutor-builds-pytorch.md +128 -0
  66. package/vendor/theus-arsenal/agents/resolutor-builds-react.md +214 -0
  67. package/vendor/theus-arsenal/agents/resolutor-builds-rust.md +156 -0
  68. package/vendor/theus-arsenal/agents/resolutor-builds-swift.md +169 -0
  69. package/vendor/theus-arsenal/agents/resolutor-builds.md +122 -0
  70. package/vendor/theus-arsenal/agents/revisor-bd.md +97 -0
  71. package/vendor/theus-arsenal/agents/revisor-codigo.md +291 -0
  72. package/vendor/theus-arsenal/agents/revisor-config-red.md +116 -0
  73. package/vendor/theus-arsenal/agents/revisor-cpp.md +80 -0
  74. package/vendor/theus-arsenal/agents/revisor-csharp.md +109 -0
  75. package/vendor/theus-arsenal/agents/revisor-django.md +168 -0
  76. package/vendor/theus-arsenal/agents/revisor-fastapi.md +82 -0
  77. package/vendor/theus-arsenal/agents/revisor-flutter.md +251 -0
  78. package/vendor/theus-arsenal/agents/revisor-go.md +84 -0
  79. package/vendor/theus-arsenal/agents/revisor-java.md +192 -0
  80. package/vendor/theus-arsenal/agents/revisor-kotlin.md +171 -0
  81. package/vendor/theus-arsenal/agents/revisor-ml.md +159 -0
  82. package/vendor/theus-arsenal/agents/revisor-php.md +108 -0
  83. package/vendor/theus-arsenal/agents/revisor-python.md +106 -0
  84. package/vendor/theus-arsenal/agents/revisor-react.md +166 -0
  85. package/vendor/theus-arsenal/agents/revisor-rust.md +102 -0
  86. package/vendor/theus-arsenal/agents/revisor-seguridad.md +116 -0
  87. package/vendor/theus-arsenal/agents/revisor-software-clinico.md +95 -0
  88. package/vendor/theus-arsenal/agents/revisor-swift.md +115 -0
  89. package/vendor/theus-arsenal/agents/revisor-typescript.md +123 -0
  90. package/vendor/theus-arsenal/agents/revisor-vue.md +205 -0
  91. package/vendor/theus-arsenal/agents/simplificador-codigo.md +55 -0
  92. package/vendor/theus-arsenal/commands/actualizar-docs.md +88 -0
  93. package/vendor/theus-arsenal/commands/actualizar-mapas-codigo.md +78 -0
  94. package/vendor/theus-arsenal/commands/aprender-evaluar.md +109 -0
  95. package/vendor/theus-arsenal/commands/aprender.md +74 -0
  96. package/vendor/theus-arsenal/commands/arreglar-build.md +66 -0
  97. package/vendor/theus-arsenal/commands/bucle-multiperspectiva.md +153 -0
  98. package/vendor/theus-arsenal/commands/build-cpp.md +173 -0
  99. package/vendor/theus-arsenal/commands/build-flutter.md +164 -0
  100. package/vendor/theus-arsenal/commands/build-go.md +183 -0
  101. package/vendor/theus-arsenal/commands/build-gradle.md +75 -0
  102. package/vendor/theus-arsenal/commands/build-kotlin.md +176 -0
  103. package/vendor/theus-arsenal/commands/build-react.md +187 -0
  104. package/vendor/theus-arsenal/commands/build-rust.md +187 -0
  105. package/vendor/theus-arsenal/commands/campana-marketing.md +125 -0
  106. package/vendor/theus-arsenal/commands/checkpoint.md +78 -0
  107. package/vendor/theus-arsenal/commands/cobertura-tests.md +73 -0
  108. package/vendor/theus-arsenal/commands/configurar-gestor-paquetes.md +86 -0
  109. package/vendor/theus-arsenal/commands/consulta.md +164 -0
  110. package/vendor/theus-arsenal/commands/control-calidad.md +50 -0
  111. package/vendor/theus-arsenal/commands/crear-skill.md +77 -0
  112. package/vendor/theus-arsenal/commands/enrutar-modelo.md +30 -0
  113. package/vendor/theus-arsenal/commands/epica-desbloquear.md +17 -0
  114. package/vendor/theus-arsenal/commands/epica-descomponer.md +22 -0
  115. package/vendor/theus-arsenal/commands/epica-publicar.md +21 -0
  116. package/vendor/theus-arsenal/commands/epica-reclamar.md +25 -0
  117. package/vendor/theus-arsenal/commands/epica-revisar.md +22 -0
  118. package/vendor/theus-arsenal/commands/epica-sincronizar.md +21 -0
  119. package/vendor/theus-arsenal/commands/epica-validar.md +21 -0
  120. package/vendor/theus-arsenal/commands/evolucionar.md +176 -0
  121. package/vendor/theus-arsenal/commands/funcionalidad.md +49 -0
  122. package/vendor/theus-arsenal/commands/guardar-sesion.md +278 -0
  123. package/vendor/theus-arsenal/commands/harness-build.md +111 -0
  124. package/vendor/theus-arsenal/commands/harness-diseno.md +46 -0
  125. package/vendor/theus-arsenal/commands/informe-costos.md +90 -0
  126. package/vendor/theus-arsenal/commands/iniciar-bucle.md +36 -0
  127. package/vendor/theus-arsenal/commands/instintos-estado.md +53 -0
  128. package/vendor/theus-arsenal/commands/instintos-exportar.md +69 -0
  129. package/vendor/theus-arsenal/commands/instintos-importar.md +120 -0
  130. package/vendor/theus-arsenal/commands/lienzo-planes.md +48 -0
  131. package/vendor/theus-arsenal/commands/limpiar-refactor.md +84 -0
  132. package/vendor/theus-arsenal/commands/modo-seguro.md +96 -0
  133. package/vendor/theus-arsenal/commands/orq-agregar-funcionalidad.md +36 -0
  134. package/vendor/theus-arsenal/commands/orq-cambiar-funcionalidad.md +38 -0
  135. package/vendor/theus-arsenal/commands/orq-construir-mvp.md +36 -0
  136. package/vendor/theus-arsenal/commands/orq-corregir-defecto.md +40 -0
  137. package/vendor/theus-arsenal/commands/orq-refinar-codigo.md +44 -0
  138. package/vendor/theus-arsenal/commands/orq-revisar.md +135 -0
  139. package/vendor/theus-arsenal/commands/plan-prd.md +160 -0
  140. package/vendor/theus-arsenal/commands/plan.md +198 -0
  141. package/vendor/theus-arsenal/commands/podar.md +31 -0
  142. package/vendor/theus-arsenal/commands/pr.md +181 -0
  143. package/vendor/theus-arsenal/commands/promover.md +41 -0
  144. package/vendor/theus-arsenal/commands/proyectos.md +33 -0
  145. package/vendor/theus-arsenal/commands/prp-commit.md +112 -0
  146. package/vendor/theus-arsenal/commands/prp-implementar.md +385 -0
  147. package/vendor/theus-arsenal/commands/prp-planificar.md +501 -0
  148. package/vendor/theus-arsenal/commands/reanudar-sesion.md +160 -0
  149. package/vendor/theus-arsenal/commands/revisar-codigo.md +289 -0
  150. package/vendor/theus-arsenal/commands/revisar-cpp.md +132 -0
  151. package/vendor/theus-arsenal/commands/revisar-fastapi.md +39 -0
  152. package/vendor/theus-arsenal/commands/revisar-flutter.md +115 -0
  153. package/vendor/theus-arsenal/commands/revisar-go.md +148 -0
  154. package/vendor/theus-arsenal/commands/revisar-kotlin.md +140 -0
  155. package/vendor/theus-arsenal/commands/revisar-pr.md +37 -0
  156. package/vendor/theus-arsenal/commands/revisar-python.md +297 -0
  157. package/vendor/theus-arsenal/commands/revisar-react.md +170 -0
  158. package/vendor/theus-arsenal/commands/revisar-rust.md +142 -0
  159. package/vendor/theus-arsenal/commands/revisar-vue.md +174 -0
  160. package/vendor/theus-arsenal/commands/salud-skills.md +52 -0
  161. package/vendor/theus-arsenal/commands/sesiones.md +345 -0
  162. package/vendor/theus-arsenal/commands/test-cpp.md +252 -0
  163. package/vendor/theus-arsenal/commands/test-flutter.md +143 -0
  164. package/vendor/theus-arsenal/commands/test-go.md +268 -0
  165. package/vendor/theus-arsenal/commands/test-kotlin.md +312 -0
  166. package/vendor/theus-arsenal/commands/test-react.md +265 -0
  167. package/vendor/theus-arsenal/commands/test-rust.md +309 -0
  168. package/vendor/theus-arsenal/commands/vigilancia-canary.md +43 -0
  169. package/vendor/theus-arsenal/hooks/hooks.json +274 -0
  170. package/vendor/theus-arsenal/package.json +6 -0
  171. package/vendor/theus-arsenal/rules/angular/coding-style.md +182 -0
  172. package/vendor/theus-arsenal/rules/angular/hooks.md +25 -0
  173. package/vendor/theus-arsenal/rules/angular/patterns.md +249 -0
  174. package/vendor/theus-arsenal/rules/angular/security.md +87 -0
  175. package/vendor/theus-arsenal/rules/angular/testing.md +164 -0
  176. package/vendor/theus-arsenal/rules/arkts/coding-style.md +153 -0
  177. package/vendor/theus-arsenal/rules/arkts/hooks.md +80 -0
  178. package/vendor/theus-arsenal/rules/arkts/patterns.md +236 -0
  179. package/vendor/theus-arsenal/rules/arkts/security.md +141 -0
  180. package/vendor/theus-arsenal/rules/arkts/testing.md +126 -0
  181. package/vendor/theus-arsenal/rules/common/agents.md +49 -0
  182. package/vendor/theus-arsenal/rules/common/code-review.md +123 -0
  183. package/vendor/theus-arsenal/rules/common/coding-style.md +90 -0
  184. package/vendor/theus-arsenal/rules/common/development-workflow.md +44 -0
  185. package/vendor/theus-arsenal/rules/common/git-workflow.md +24 -0
  186. package/vendor/theus-arsenal/rules/common/hooks.md +32 -0
  187. package/vendor/theus-arsenal/rules/common/patterns.md +31 -0
  188. package/vendor/theus-arsenal/rules/common/performance.md +53 -0
  189. package/vendor/theus-arsenal/rules/common/security.md +29 -0
  190. package/vendor/theus-arsenal/rules/common/testing.md +57 -0
  191. package/vendor/theus-arsenal/rules/cpp/coding-style.md +44 -0
  192. package/vendor/theus-arsenal/rules/cpp/hooks.md +39 -0
  193. package/vendor/theus-arsenal/rules/cpp/patterns.md +51 -0
  194. package/vendor/theus-arsenal/rules/cpp/security.md +51 -0
  195. package/vendor/theus-arsenal/rules/cpp/testing.md +44 -0
  196. package/vendor/theus-arsenal/rules/csharp/coding-style.md +72 -0
  197. package/vendor/theus-arsenal/rules/csharp/hooks.md +25 -0
  198. package/vendor/theus-arsenal/rules/csharp/patterns.md +50 -0
  199. package/vendor/theus-arsenal/rules/csharp/security.md +58 -0
  200. package/vendor/theus-arsenal/rules/csharp/testing.md +50 -0
  201. package/vendor/theus-arsenal/rules/dart/coding-style.md +159 -0
  202. package/vendor/theus-arsenal/rules/dart/hooks.md +68 -0
  203. package/vendor/theus-arsenal/rules/dart/patterns.md +261 -0
  204. package/vendor/theus-arsenal/rules/dart/security.md +135 -0
  205. package/vendor/theus-arsenal/rules/dart/testing.md +215 -0
  206. package/vendor/theus-arsenal/rules/fsharp/coding-style.md +112 -0
  207. package/vendor/theus-arsenal/rules/fsharp/hooks.md +26 -0
  208. package/vendor/theus-arsenal/rules/fsharp/patterns.md +111 -0
  209. package/vendor/theus-arsenal/rules/fsharp/security.md +76 -0
  210. package/vendor/theus-arsenal/rules/fsharp/testing.md +62 -0
  211. package/vendor/theus-arsenal/rules/golang/coding-style.md +32 -0
  212. package/vendor/theus-arsenal/rules/golang/hooks.md +17 -0
  213. package/vendor/theus-arsenal/rules/golang/patterns.md +45 -0
  214. package/vendor/theus-arsenal/rules/golang/security.md +34 -0
  215. package/vendor/theus-arsenal/rules/golang/testing.md +31 -0
  216. package/vendor/theus-arsenal/rules/java/coding-style.md +114 -0
  217. package/vendor/theus-arsenal/rules/java/hooks.md +18 -0
  218. package/vendor/theus-arsenal/rules/java/patterns.md +147 -0
  219. package/vendor/theus-arsenal/rules/java/security.md +101 -0
  220. package/vendor/theus-arsenal/rules/java/testing.md +133 -0
  221. package/vendor/theus-arsenal/rules/kotlin/coding-style.md +86 -0
  222. package/vendor/theus-arsenal/rules/kotlin/hooks.md +17 -0
  223. package/vendor/theus-arsenal/rules/kotlin/patterns.md +146 -0
  224. package/vendor/theus-arsenal/rules/kotlin/security.md +82 -0
  225. package/vendor/theus-arsenal/rules/kotlin/testing.md +128 -0
  226. package/vendor/theus-arsenal/rules/nuxt/coding-style.md +47 -0
  227. package/vendor/theus-arsenal/rules/nuxt/hooks.md +39 -0
  228. package/vendor/theus-arsenal/rules/nuxt/patterns.md +54 -0
  229. package/vendor/theus-arsenal/rules/nuxt/security.md +48 -0
  230. package/vendor/theus-arsenal/rules/nuxt/testing.md +49 -0
  231. package/vendor/theus-arsenal/rules/php/coding-style.md +40 -0
  232. package/vendor/theus-arsenal/rules/php/hooks.md +24 -0
  233. package/vendor/theus-arsenal/rules/php/patterns.md +33 -0
  234. package/vendor/theus-arsenal/rules/php/security.md +37 -0
  235. package/vendor/theus-arsenal/rules/php/testing.md +38 -0
  236. package/vendor/theus-arsenal/rules/python/coding-style.md +42 -0
  237. package/vendor/theus-arsenal/rules/python/fastapi.md +58 -0
  238. package/vendor/theus-arsenal/rules/python/hooks.md +19 -0
  239. package/vendor/theus-arsenal/rules/python/patterns.md +39 -0
  240. package/vendor/theus-arsenal/rules/python/security.md +30 -0
  241. package/vendor/theus-arsenal/rules/python/testing.md +38 -0
  242. package/vendor/theus-arsenal/rules/react/coding-style.md +109 -0
  243. package/vendor/theus-arsenal/rules/react/hooks.md +187 -0
  244. package/vendor/theus-arsenal/rules/react/patterns.md +194 -0
  245. package/vendor/theus-arsenal/rules/react/security.md +180 -0
  246. package/vendor/theus-arsenal/rules/react/testing.md +208 -0
  247. package/vendor/theus-arsenal/rules/react-native/accessibility.md +55 -0
  248. package/vendor/theus-arsenal/rules/react-native/coding-style.md +71 -0
  249. package/vendor/theus-arsenal/rules/react-native/hooks.md +28 -0
  250. package/vendor/theus-arsenal/rules/react-native/patterns.md +88 -0
  251. package/vendor/theus-arsenal/rules/react-native/performance.md +45 -0
  252. package/vendor/theus-arsenal/rules/react-native/production-readiness.md +51 -0
  253. package/vendor/theus-arsenal/rules/react-native/security.md +43 -0
  254. package/vendor/theus-arsenal/rules/react-native/testing.md +52 -0
  255. package/vendor/theus-arsenal/rules/ruby/coding-style.md +46 -0
  256. package/vendor/theus-arsenal/rules/ruby/hooks.md +37 -0
  257. package/vendor/theus-arsenal/rules/ruby/patterns.md +44 -0
  258. package/vendor/theus-arsenal/rules/ruby/security.md +51 -0
  259. package/vendor/theus-arsenal/rules/ruby/testing.md +51 -0
  260. package/vendor/theus-arsenal/rules/rust/coding-style.md +151 -0
  261. package/vendor/theus-arsenal/rules/rust/hooks.md +16 -0
  262. package/vendor/theus-arsenal/rules/rust/patterns.md +168 -0
  263. package/vendor/theus-arsenal/rules/rust/security.md +141 -0
  264. package/vendor/theus-arsenal/rules/rust/testing.md +154 -0
  265. package/vendor/theus-arsenal/rules/swift/coding-style.md +47 -0
  266. package/vendor/theus-arsenal/rules/swift/hooks.md +20 -0
  267. package/vendor/theus-arsenal/rules/swift/patterns.md +66 -0
  268. package/vendor/theus-arsenal/rules/swift/security.md +33 -0
  269. package/vendor/theus-arsenal/rules/swift/testing.md +45 -0
  270. package/vendor/theus-arsenal/rules/typescript/coding-style.md +199 -0
  271. package/vendor/theus-arsenal/rules/typescript/hooks.md +22 -0
  272. package/vendor/theus-arsenal/rules/typescript/patterns.md +52 -0
  273. package/vendor/theus-arsenal/rules/typescript/security.md +28 -0
  274. package/vendor/theus-arsenal/rules/typescript/testing.md +18 -0
  275. package/vendor/theus-arsenal/rules/vue/coding-style.md +54 -0
  276. package/vendor/theus-arsenal/rules/vue/hooks.md +45 -0
  277. package/vendor/theus-arsenal/rules/vue/patterns.md +56 -0
  278. package/vendor/theus-arsenal/rules/vue/security.md +46 -0
  279. package/vendor/theus-arsenal/rules/vue/testing.md +53 -0
  280. package/vendor/theus-arsenal/rules/web/coding-style.md +108 -0
  281. package/vendor/theus-arsenal/rules/web/design-quality.md +75 -0
  282. package/vendor/theus-arsenal/rules/web/hooks.md +141 -0
  283. package/vendor/theus-arsenal/rules/web/patterns.md +91 -0
  284. package/vendor/theus-arsenal/rules/web/performance.md +76 -0
  285. package/vendor/theus-arsenal/rules/web/security.md +69 -0
  286. package/vendor/theus-arsenal/rules/web/testing.md +67 -0
  287. package/vendor/theus-arsenal/scripts/hooks/bash-hook-dispatcher.js +192 -0
  288. package/vendor/theus-arsenal/scripts/hooks/block-no-verify.js +556 -0
  289. package/vendor/theus-arsenal/scripts/hooks/check-console-log.js +92 -0
  290. package/vendor/theus-arsenal/scripts/hooks/check-hook-enabled.js +16 -0
  291. package/vendor/theus-arsenal/scripts/hooks/config-protection.js +171 -0
  292. package/vendor/theus-arsenal/scripts/hooks/design-quality-check.js +132 -0
  293. package/vendor/theus-arsenal/scripts/hooks/doc-file-warning.js +110 -0
  294. package/vendor/theus-arsenal/scripts/hooks/modo-seguro.js +158 -0
  295. package/vendor/theus-arsenal/scripts/hooks/notificacion-escritorio.js +208 -0
  296. package/vendor/theus-arsenal/scripts/hooks/plugin-hook-bootstrap.js +280 -0
  297. package/vendor/theus-arsenal/scripts/hooks/post-bash-command-log.js +87 -0
  298. package/vendor/theus-arsenal/scripts/hooks/post-bash-dispatcher.js +24 -0
  299. package/vendor/theus-arsenal/scripts/hooks/post-bash-pr-created.js +60 -0
  300. package/vendor/theus-arsenal/scripts/hooks/post-edit-accumulator.js +94 -0
  301. package/vendor/theus-arsenal/scripts/hooks/post-edit-console-warn.js +54 -0
  302. package/vendor/theus-arsenal/scripts/hooks/post-edit-format.js +110 -0
  303. package/vendor/theus-arsenal/scripts/hooks/post-edit-typecheck.js +98 -0
  304. package/vendor/theus-arsenal/scripts/hooks/pre-bash-commit-quality.js +447 -0
  305. package/vendor/theus-arsenal/scripts/hooks/pre-bash-dev-server-block.js +232 -0
  306. package/vendor/theus-arsenal/scripts/hooks/pre-bash-dispatcher.js +27 -0
  307. package/vendor/theus-arsenal/scripts/hooks/pre-compact.js +101 -0
  308. package/vendor/theus-arsenal/scripts/hooks/pretooluse-visible-output.js +49 -0
  309. package/vendor/theus-arsenal/scripts/hooks/quality-gate.js +168 -0
  310. package/vendor/theus-arsenal/scripts/hooks/run-with-flags.js +271 -0
  311. package/vendor/theus-arsenal/scripts/hooks/salud-mcp.js +749 -0
  312. package/vendor/theus-arsenal/scripts/hooks/seguimiento-costos.js +161 -0
  313. package/vendor/theus-arsenal/scripts/hooks/session-end.js +340 -0
  314. package/vendor/theus-arsenal/scripts/hooks/session-start.js +906 -0
  315. package/vendor/theus-arsenal/scripts/hooks/stop-format-typecheck.js +263 -0
  316. package/vendor/theus-arsenal/scripts/hooks/suggest-compact.js +286 -0
  317. package/vendor/theus-arsenal/scripts/hooks/theus-context-monitor.js +289 -0
  318. package/vendor/theus-arsenal/scripts/hooks/verificacion-factual.js +1278 -0
  319. package/vendor/theus-arsenal/scripts/lib/agent-data-home.js +96 -0
  320. package/vendor/theus-arsenal/scripts/lib/cost-estimate.js +66 -0
  321. package/vendor/theus-arsenal/scripts/lib/hook-flags.js +79 -0
  322. package/vendor/theus-arsenal/scripts/lib/llm-summary.js +185 -0
  323. package/vendor/theus-arsenal/scripts/lib/loopback-guard.js +54 -0
  324. package/vendor/theus-arsenal/scripts/lib/observer-sessions.js +237 -0
  325. package/vendor/theus-arsenal/scripts/lib/package-manager.d.ts +120 -0
  326. package/vendor/theus-arsenal/scripts/lib/package-manager.js +434 -0
  327. package/vendor/theus-arsenal/scripts/lib/path-safety.js +86 -0
  328. package/vendor/theus-arsenal/scripts/lib/plan-canvas/markdown.js +285 -0
  329. package/vendor/theus-arsenal/scripts/lib/plan-canvas/sdk.js +238 -0
  330. package/vendor/theus-arsenal/scripts/lib/plan-canvas/server.js +534 -0
  331. package/vendor/theus-arsenal/scripts/lib/plan-canvas/sessions.js +274 -0
  332. package/vendor/theus-arsenal/scripts/lib/plan-canvas/ui.js +546 -0
  333. package/vendor/theus-arsenal/scripts/lib/project-detect.js +451 -0
  334. package/vendor/theus-arsenal/scripts/lib/resolve-formatter.js +193 -0
  335. package/vendor/theus-arsenal/scripts/lib/resolve-theus-root.js +101 -0
  336. package/vendor/theus-arsenal/scripts/lib/session-aliases.d.ts +138 -0
  337. package/vendor/theus-arsenal/scripts/lib/session-aliases.js +483 -0
  338. package/vendor/theus-arsenal/scripts/lib/session-bridge.js +155 -0
  339. package/vendor/theus-arsenal/scripts/lib/session-manager.d.ts +137 -0
  340. package/vendor/theus-arsenal/scripts/lib/session-manager.js +555 -0
  341. package/vendor/theus-arsenal/scripts/lib/shell-split.js +86 -0
  342. package/vendor/theus-arsenal/scripts/lib/shell-substitution.js +501 -0
  343. package/vendor/theus-arsenal/scripts/lib/skill-evolution/dashboard.js +414 -0
  344. package/vendor/theus-arsenal/scripts/lib/skill-evolution/health.js +285 -0
  345. package/vendor/theus-arsenal/scripts/lib/skill-evolution/index.js +22 -0
  346. package/vendor/theus-arsenal/scripts/lib/skill-evolution/provenance.js +200 -0
  347. package/vendor/theus-arsenal/scripts/lib/skill-evolution/tracker.js +157 -0
  348. package/vendor/theus-arsenal/scripts/lib/skill-evolution/versioning.js +246 -0
  349. package/vendor/theus-arsenal/scripts/lib/transcript-context.js +232 -0
  350. package/vendor/theus-arsenal/scripts/lib/utils.d.ts +205 -0
  351. package/vendor/theus-arsenal/scripts/lib/utils.js +658 -0
  352. package/vendor/theus-arsenal/scripts/plan-canvas.js +341 -0
  353. package/vendor/theus-arsenal/scripts/setup-package-manager.js +46 -0
  354. package/vendor/theus-arsenal/scripts/skills-health.js +143 -0
  355. package/vendor/theus-arsenal/skills/a11y-frontend/SKILL.md +444 -0
  356. package/vendor/theus-arsenal/skills/accesibilidad/SKILL.md +144 -0
  357. package/vendor/theus-arsenal/skills/acelerador-throughput-datos/SKILL.md +72 -0
  358. package/vendor/theus-arsenal/skills/agente-scraper-datos/SKILL.md +771 -0
  359. package/vendor/theus-arsenal/skills/analisis-plataformas-competencia/SKILL.md +137 -0
  360. package/vendor/theus-arsenal/skills/api-x/SKILL.md +233 -0
  361. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/SKILL.md +335 -0
  362. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/observer-loop.sh +374 -0
  363. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/observer.md +188 -0
  364. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/session-guardian.sh +153 -0
  365. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/agents/start-observer.sh +253 -0
  366. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/config.json +8 -0
  367. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/hooks/observe.sh +594 -0
  368. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/detect-project.sh +325 -0
  369. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/instinct-cli.py +1918 -0
  370. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/lib/arsenal-dir.sh +23 -0
  371. package/vendor/theus-arsenal/skills/aprendizaje-continuo-v2/scripts/test_parse_instinct.py +1420 -0
  372. package/vendor/theus-arsenal/skills/arquitectura-hexagonal/SKILL.md +275 -0
  373. package/vendor/theus-arsenal/skills/arquitectura-limpia-android/SKILL.md +340 -0
  374. package/vendor/theus-arsenal/skills/arquitectura-pipelines-recomendacion/SKILL.md +112 -0
  375. package/vendor/theus-arsenal/skills/atlas-datos-prediccion/SKILL.md +53 -0
  376. package/vendor/theus-arsenal/skills/auditoria-arquitectura-agentes/SKILL.md +257 -0
  377. package/vendor/theus-arsenal/skills/auditoria-produccion/SKILL.md +180 -0
  378. package/vendor/theus-arsenal/skills/auditoria-rutas-clic/SKILL.md +243 -0
  379. package/vendor/theus-arsenal/skills/autoevaluacion-agente/SKILL.md +180 -0
  380. package/vendor/theus-arsenal/skills/autoevaluacion-agente/examples/high-score-example.md +89 -0
  381. package/vendor/theus-arsenal/skills/autoevaluacion-agente/examples/low-score-example.md +87 -0
  382. package/vendor/theus-arsenal/skills/autoevaluacion-agente/references/evaluation-criteria.md +71 -0
  383. package/vendor/theus-arsenal/skills/autoevaluacion-agente/references/hook-integration.md +90 -0
  384. package/vendor/theus-arsenal/skills/autoevaluacion-agente/scripts/evaluate.py +409 -0
  385. package/vendor/theus-arsenal/skills/autoevaluacion-agente/templates/evaluation-report.md +86 -0
  386. package/vendor/theus-arsenal/skills/automatizacion-ssh-netmiko/SKILL.md +176 -0
  387. package/vendor/theus-arsenal/skills/base-datos-pubmed/SKILL.md +174 -0
  388. package/vendor/theus-arsenal/skills/base-datos-uspto/SKILL.md +173 -0
  389. package/vendor/theus-arsenal/skills/benchmark/SKILL.md +92 -0
  390. package/vendor/theus-arsenal/skills/bitacora-crecimiento/SKILL.md +120 -0
  391. package/vendor/theus-arsenal/skills/bucle-verificacion/SKILL.md +125 -0
  392. package/vendor/theus-arsenal/skills/buscar-primero/SKILL.md +184 -0
  393. package/vendor/theus-arsenal/skills/busqueda-exa/SKILL.md +111 -0
  394. package/vendor/theus-arsenal/skills/cache-por-hash/SKILL.md +160 -0
  395. package/vendor/theus-arsenal/skills/campana-marketing/SKILL.md +118 -0
  396. package/vendor/theus-arsenal/skills/capacidad-producto/SKILL.md +138 -0
  397. package/vendor/theus-arsenal/skills/cazador-vulnerabilidades/SKILL.md +104 -0
  398. package/vendor/theus-arsenal/skills/compactacion-estrategica/SKILL.md +115 -0
  399. package/vendor/theus-arsenal/skills/comparador-baskets-prediccion/SKILL.md +69 -0
  400. package/vendor/theus-arsenal/skills/compras-energia/SKILL.md +206 -0
  401. package/vendor/theus-arsenal/skills/concurrencia-swift-6-2/SKILL.md +224 -0
  402. package/vendor/theus-arsenal/skills/consejo/SKILL.md +201 -0
  403. package/vendor/theus-arsenal/skills/construccion-harness-agentes/SKILL.md +78 -0
  404. package/vendor/theus-arsenal/skills/constructor-conectores/SKILL.md +119 -0
  405. package/vendor/theus-arsenal/skills/constructor-equipos/SKILL.md +169 -0
  406. package/vendor/theus-arsenal/skills/consulta-documentacion/SKILL.md +92 -0
  407. package/vendor/theus-arsenal/skills/consultas-genomicas-gget/SKILL.md +170 -0
  408. package/vendor/theus-arsenal/skills/contacto-inversores/SKILL.md +95 -0
  409. package/vendor/theus-arsenal/skills/corrutinas-flows-kotlin/SKILL.md +284 -0
  410. package/vendor/theus-arsenal/skills/creacion-video-remotion/SKILL.md +46 -0
  411. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/3d.md +86 -0
  412. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/animations.md +29 -0
  413. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/charts-bar-chart.tsx +173 -0
  414. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/text-animations-typewriter.tsx +100 -0
  415. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets/text-animations-word-highlight.tsx +108 -0
  416. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/assets.md +78 -0
  417. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/audio.md +172 -0
  418. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/calculate-metadata.md +104 -0
  419. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/can-decode.md +75 -0
  420. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/charts.md +58 -0
  421. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/compositions.md +146 -0
  422. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/display-captions.md +126 -0
  423. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/extract-frames.md +229 -0
  424. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/fonts.md +152 -0
  425. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-audio-duration.md +58 -0
  426. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-video-dimensions.md +68 -0
  427. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/get-video-duration.md +58 -0
  428. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/gifs.md +138 -0
  429. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/images.md +130 -0
  430. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/import-srt-captions.md +67 -0
  431. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/lottie.md +67 -0
  432. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/measuring-dom-nodes.md +34 -0
  433. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/measuring-text.md +143 -0
  434. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/sequencing.md +106 -0
  435. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/tailwind.md +11 -0
  436. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/text-animations.md +20 -0
  437. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/timing.md +179 -0
  438. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/transcribe-captions.md +19 -0
  439. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/transitions.md +122 -0
  440. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/trimming.md +52 -0
  441. package/vendor/theus-arsenal/skills/creacion-video-remotion/rules/videos.md +171 -0
  442. package/vendor/theus-arsenal/skills/cumplimiento-aduanero/SKILL.md +270 -0
  443. package/vendor/theus-arsenal/skills/cumplimiento-hipaa/SKILL.md +78 -0
  444. package/vendor/theus-arsenal/skills/datos-sensibles-salud/SKILL.md +149 -0
  445. package/vendor/theus-arsenal/skills/decimales-tokens-evm/SKILL.md +128 -0
  446. package/vendor/theus-arsenal/skills/decisiones-arquitectura/SKILL.md +206 -0
  447. package/vendor/theus-arsenal/skills/demos-ui/SKILL.md +469 -0
  448. package/vendor/theus-arsenal/skills/desarrollo-por-intencion/SKILL.md +369 -0
  449. package/vendor/theus-arsenal/skills/descubrimiento-marca/SKILL.md +149 -0
  450. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/10_proposito-porque.md +42 -0
  451. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/20_posicionamiento.md +47 -0
  452. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/30_audiencia-nicho.md +53 -0
  453. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/40_personalidad-arquetipo.md +61 -0
  454. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/50_voz-tono.md +62 -0
  455. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/60_narrativa-historia.md +54 -0
  456. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/70_tension-fundador.md +50 -0
  457. package/vendor/theus-arsenal/skills/descubrimiento-marca/references/90_SINTESIS.md +133 -0
  458. package/vendor/theus-arsenal/skills/descubrimiento-plugins-laravel/SKILL.md +230 -0
  459. package/vendor/theus-arsenal/skills/destilado-reglas/SKILL.md +263 -0
  460. package/vendor/theus-arsenal/skills/destilado-reglas/scripts/scan-rules.sh +58 -0
  461. package/vendor/theus-arsenal/skills/destilado-reglas/scripts/scan-skills.sh +129 -0
  462. package/vendor/theus-arsenal/skills/diagnostico-bgp/SKILL.md +170 -0
  463. package/vendor/theus-arsenal/skills/direccion-estetica/SKILL.md +220 -0
  464. package/vendor/theus-arsenal/skills/direccion-estetica/references/taxonomia-generos.md +89 -0
  465. package/vendor/theus-arsenal/skills/diseno-api/SKILL.md +522 -0
  466. package/vendor/theus-arsenal/skills/diseno-liquid-glass/SKILL.md +282 -0
  467. package/vendor/theus-arsenal/skills/e2e-escritorio-windows/SKILL.md +879 -0
  468. package/vendor/theus-arsenal/skills/edicion-video/SKILL.md +289 -0
  469. package/vendor/theus-arsenal/skills/enfoque-producto/SKILL.md +91 -0
  470. package/vendor/theus-arsenal/skills/entornos-flox/SKILL.md +493 -0
  471. package/vendor/theus-arsenal/skills/estandares-codigo/SKILL.md +548 -0
  472. package/vendor/theus-arsenal/skills/estandares-cpp/SKILL.md +727 -0
  473. package/vendor/theus-arsenal/skills/estandares-java/SKILL.md +389 -0
  474. package/vendor/theus-arsenal/skills/estilo-legado/SKILL.md +149 -0
  475. package/vendor/theus-arsenal/skills/estructura-informes-competencia/SKILL.md +95 -0
  476. package/vendor/theus-arsenal/skills/evaluacion-academica/SKILL.md +165 -0
  477. package/vendor/theus-arsenal/skills/explorador-skills/SKILL.md +129 -0
  478. package/vendor/theus-arsenal/skills/flujo-git/SKILL.md +714 -0
  479. package/vendor/theus-arsenal/skills/flujo-ingenieria-ml/SKILL.md +343 -0
  480. package/vendor/theus-arsenal/skills/flujo-tdd/SKILL.md +584 -0
  481. package/vendor/theus-arsenal/skills/forja-personas/SKILL.md +298 -0
  482. package/vendor/theus-arsenal/skills/forja-personas/gacha.py +224 -0
  483. package/vendor/theus-arsenal/skills/forja-personas/gacha.sh +5 -0
  484. package/vendor/theus-arsenal/skills/forja-personas/references/avatar-style.md +123 -0
  485. package/vendor/theus-arsenal/skills/forja-personas/references/boundary-rules.md +53 -0
  486. package/vendor/theus-arsenal/skills/forja-personas/references/error-handling.md +53 -0
  487. package/vendor/theus-arsenal/skills/forja-personas/references/identity-tension.md +48 -0
  488. package/vendor/theus-arsenal/skills/forja-personas/references/naming-system.md +39 -0
  489. package/vendor/theus-arsenal/skills/forja-personas/references/output-template.md +166 -0
  490. package/vendor/theus-arsenal/skills/fundamentos-animacion/SKILL.md +296 -0
  491. package/vendor/theus-arsenal/skills/generacion-iconos-ios/SKILL.md +156 -0
  492. package/vendor/theus-arsenal/skills/generacion-iconos-ios/scripts/generate_icons.swift +258 -0
  493. package/vendor/theus-arsenal/skills/generacion-iconos-ios/scripts/iconify_gen.sh +235 -0
  494. package/vendor/theus-arsenal/skills/gestion-excepciones-logisticas/SKILL.md +208 -0
  495. package/vendor/theus-arsenal/skills/gestion-transportistas/SKILL.md +204 -0
  496. package/vendor/theus-arsenal/skills/guia-adopcion-ml/SKILL.md +64 -0
  497. package/vendor/theus-arsenal/skills/harness-agente-autonomo/SKILL.md +252 -0
  498. package/vendor/theus-arsenal/skills/harness-eval-clinico/SKILL.md +212 -0
  499. package/vendor/theus-arsenal/skills/harness-evaluacion/SKILL.md +296 -0
  500. package/vendor/theus-arsenal/skills/harness-generador-evaluador/SKILL.md +254 -0
  501. package/vendor/theus-arsenal/skills/homelab-diseno-red/SKILL.md +120 -0
  502. package/vendor/theus-arsenal/skills/homelab-dns-pihole/SKILL.md +264 -0
  503. package/vendor/theus-arsenal/skills/homelab-preparacion-red/SKILL.md +144 -0
  504. package/vendor/theus-arsenal/skills/homelab-segmentacion-vlan/SKILL.md +307 -0
  505. package/vendor/theus-arsenal/skills/homelab-vpn-wireguard/SKILL.md +299 -0
  506. package/vendor/theus-arsenal/skills/ingenieria-agentica/SKILL.md +96 -0
  507. package/vendor/theus-arsenal/skills/inspeccion-animaciones-blender/SKILL.md +164 -0
  508. package/vendor/theus-arsenal/skills/instaladores-python/SKILL.md +820 -0
  509. package/vendor/theus-arsenal/skills/integracion-jira/SKILL.md +307 -0
  510. package/vendor/theus-arsenal/skills/inteligencia-leads/SKILL.md +312 -0
  511. package/vendor/theus-arsenal/skills/inteligencia-leads/agents/agente-enriquecimiento.md +87 -0
  512. package/vendor/theus-arsenal/skills/inteligencia-leads/agents/mapeador-mutuos.md +76 -0
  513. package/vendor/theus-arsenal/skills/inteligencia-leads/agents/puntuador-senales.md +60 -0
  514. package/vendor/theus-arsenal/skills/inteligencia-leads/agents/redactor-outreach.md +102 -0
  515. package/vendor/theus-arsenal/skills/inteligencia-mercados-prediccion/SKILL.md +53 -0
  516. package/vendor/theus-arsenal/skills/introspeccion-agente/SKILL.md +150 -0
  517. package/vendor/theus-arsenal/skills/inventario-skills/SKILL.md +194 -0
  518. package/vendor/theus-arsenal/skills/inventario-skills/scripts/quick-diff.sh +87 -0
  519. package/vendor/theus-arsenal/skills/inventario-skills/scripts/save-results.sh +57 -0
  520. package/vendor/theus-arsenal/skills/inventario-skills/scripts/scan.sh +170 -0
  521. package/vendor/theus-arsenal/skills/investigacion-mercado/SKILL.md +87 -0
  522. package/vendor/theus-arsenal/skills/investigacion-oraculos-prediccion/SKILL.md +59 -0
  523. package/vendor/theus-arsenal/skills/investigacion-profunda/SKILL.md +161 -0
  524. package/vendor/theus-arsenal/skills/keccak256-nodejs/SKILL.md +100 -0
  525. package/vendor/theus-arsenal/skills/libro-decisiones-recursivo/SKILL.md +82 -0
  526. package/vendor/theus-arsenal/skills/lienzo-planes/SKILL.md +111 -0
  527. package/vendor/theus-arsenal/skills/limpieza-configuracion/SKILL.md +116 -0
  528. package/vendor/theus-arsenal/skills/logistica-inversa-devoluciones/SKILL.md +241 -0
  529. package/vendor/theus-arsenal/skills/manejo-errores/SKILL.md +375 -0
  530. package/vendor/theus-arsenal/skills/materiales-inversores/SKILL.md +101 -0
  531. package/vendor/theus-arsenal/skills/memoria-por-proyecto/SKILL.md +170 -0
  532. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/forget.mjs +44 -0
  533. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/info.mjs +24 -0
  534. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/init.mjs +152 -0
  535. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/list.mjs +40 -0
  536. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/migrate.mjs +214 -0
  537. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/resume.mjs +36 -0
  538. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/save.mjs +210 -0
  539. package/vendor/theus-arsenal/skills/memoria-por-proyecto/commands/shared.mjs +402 -0
  540. package/vendor/theus-arsenal/skills/memoria-por-proyecto/hooks/session-start.mjs +238 -0
  541. package/vendor/theus-arsenal/skills/metodologia-benchmarks/SKILL.md +131 -0
  542. package/vendor/theus-arsenal/skills/migraciones-bd/SKILL.md +430 -0
  543. package/vendor/theus-arsenal/skills/modelos-fundacionales-en-dispositivo/SKILL.md +244 -0
  544. package/vendor/theus-arsenal/skills/modo-seguro/SKILL.md +86 -0
  545. package/vendor/theus-arsenal/skills/motion-avanzado/SKILL.md +592 -0
  546. package/vendor/theus-arsenal/skills/motor-de-contenido/SKILL.md +136 -0
  547. package/vendor/theus-arsenal/skills/no-conformidades-calidad/SKILL.md +249 -0
  548. package/vendor/theus-arsenal/skills/onboarding-codigo/SKILL.md +244 -0
  549. package/vendor/theus-arsenal/skills/operaciones-agentes-empresariales/SKILL.md +51 -0
  550. package/vendor/theus-arsenal/skills/operaciones-conocimiento/SKILL.md +159 -0
  551. package/vendor/theus-arsenal/skills/operaciones-correo/SKILL.md +123 -0
  552. package/vendor/theus-arsenal/skills/operaciones-facturacion/SKILL.md +142 -0
  553. package/vendor/theus-arsenal/skills/operaciones-flujo-proyectos/SKILL.md +110 -0
  554. package/vendor/theus-arsenal/skills/operaciones-github/SKILL.md +143 -0
  555. package/vendor/theus-arsenal/skills/operaciones-google-workspace/SKILL.md +100 -0
  556. package/vendor/theus-arsenal/skills/operaciones-investigacion/SKILL.md +124 -0
  557. package/vendor/theus-arsenal/skills/operaciones-mensajes/SKILL.md +103 -0
  558. package/vendor/theus-arsenal/skills/operaciones-terminal/SKILL.md +110 -0
  559. package/vendor/theus-arsenal/skills/optimizacion-benchmark/SKILL.md +70 -0
  560. package/vendor/theus-arsenal/skills/optimizacion-costos-llm/SKILL.md +182 -0
  561. package/vendor/theus-arsenal/skills/optimizador-conexiones/SKILL.md +191 -0
  562. package/vendor/theus-arsenal/skills/optimizador-paralelismo/SKILL.md +75 -0
  563. package/vendor/theus-arsenal/skills/optimizador-prompts/SKILL.md +374 -0
  564. package/vendor/theus-arsenal/skills/orq-agregar-funcionalidad/SKILL.md +37 -0
  565. package/vendor/theus-arsenal/skills/orq-cambiar-funcionalidad/SKILL.md +36 -0
  566. package/vendor/theus-arsenal/skills/orq-construir-mvp/SKILL.md +38 -0
  567. package/vendor/theus-arsenal/skills/orq-corregir-defecto/SKILL.md +36 -0
  568. package/vendor/theus-arsenal/skills/orq-pipeline/SKILL.md +134 -0
  569. package/vendor/theus-arsenal/skills/orq-refinar-codigo/SKILL.md +49 -0
  570. package/vendor/theus-arsenal/skills/orquestacion-equipos-agentes/SKILL.md +117 -0
  571. package/vendor/theus-arsenal/skills/pagos-agentes-x402/SKILL.md +237 -0
  572. package/vendor/theus-arsenal/skills/patrones-angular/SKILL.md +153 -0
  573. package/vendor/theus-arsenal/skills/patrones-angular/references/angular-animations.md +160 -0
  574. package/vendor/theus-arsenal/skills/patrones-angular/references/angular-aria.md +410 -0
  575. package/vendor/theus-arsenal/skills/patrones-angular/references/cli.md +86 -0
  576. package/vendor/theus-arsenal/skills/patrones-angular/references/component-harnesses.md +59 -0
  577. package/vendor/theus-arsenal/skills/patrones-angular/references/component-styling.md +91 -0
  578. package/vendor/theus-arsenal/skills/patrones-angular/references/components.md +117 -0
  579. package/vendor/theus-arsenal/skills/patrones-angular/references/creating-services.md +97 -0
  580. package/vendor/theus-arsenal/skills/patrones-angular/references/data-resolvers.md +69 -0
  581. package/vendor/theus-arsenal/skills/patrones-angular/references/define-routes.md +67 -0
  582. package/vendor/theus-arsenal/skills/patrones-angular/references/defining-providers.md +72 -0
  583. package/vendor/theus-arsenal/skills/patrones-angular/references/di-fundamentals.md +120 -0
  584. package/vendor/theus-arsenal/skills/patrones-angular/references/e2e-testing.md +56 -0
  585. package/vendor/theus-arsenal/skills/patrones-angular/references/effects.md +83 -0
  586. package/vendor/theus-arsenal/skills/patrones-angular/references/hierarchical-injectors.md +43 -0
  587. package/vendor/theus-arsenal/skills/patrones-angular/references/host-elements.md +80 -0
  588. package/vendor/theus-arsenal/skills/patrones-angular/references/injection-context.md +63 -0
  589. package/vendor/theus-arsenal/skills/patrones-angular/references/inputs.md +101 -0
  590. package/vendor/theus-arsenal/skills/patrones-angular/references/linked-signal.md +59 -0
  591. package/vendor/theus-arsenal/skills/patrones-angular/references/loading-strategies.md +61 -0
  592. package/vendor/theus-arsenal/skills/patrones-angular/references/mcp.md +67 -0
  593. package/vendor/theus-arsenal/skills/patrones-angular/references/navigate-to-routes.md +69 -0
  594. package/vendor/theus-arsenal/skills/patrones-angular/references/outputs.md +86 -0
  595. package/vendor/theus-arsenal/skills/patrones-angular/references/reactive-forms.md +122 -0
  596. package/vendor/theus-arsenal/skills/patrones-angular/references/rendering-strategies.md +44 -0
  597. package/vendor/theus-arsenal/skills/patrones-angular/references/resource.md +77 -0
  598. package/vendor/theus-arsenal/skills/patrones-angular/references/route-animations.md +56 -0
  599. package/vendor/theus-arsenal/skills/patrones-angular/references/route-guards.md +52 -0
  600. package/vendor/theus-arsenal/skills/patrones-angular/references/router-lifecycle.md +45 -0
  601. package/vendor/theus-arsenal/skills/patrones-angular/references/router-testing.md +87 -0
  602. package/vendor/theus-arsenal/skills/patrones-angular/references/show-routes-with-outlets.md +68 -0
  603. package/vendor/theus-arsenal/skills/patrones-angular/references/signal-forms.md +795 -0
  604. package/vendor/theus-arsenal/skills/patrones-angular/references/signals-overview.md +94 -0
  605. package/vendor/theus-arsenal/skills/patrones-angular/references/tailwind-css.md +69 -0
  606. package/vendor/theus-arsenal/skills/patrones-angular/references/template-driven-forms.md +114 -0
  607. package/vendor/theus-arsenal/skills/patrones-angular/references/testing-fundamentals.md +65 -0
  608. package/vendor/theus-arsenal/skills/patrones-animacion/SKILL.md +432 -0
  609. package/vendor/theus-arsenal/skills/patrones-backend/SKILL.md +560 -0
  610. package/vendor/theus-arsenal/skills/patrones-cdss-clinico/SKILL.md +249 -0
  611. package/vendor/theus-arsenal/skills/patrones-cisco-ios/SKILL.md +148 -0
  612. package/vendor/theus-arsenal/skills/patrones-clickhouse/SKILL.md +443 -0
  613. package/vendor/theus-arsenal/skills/patrones-compose-multiplatform/SKILL.md +298 -0
  614. package/vendor/theus-arsenal/skills/patrones-dart-flutter/SKILL.md +566 -0
  615. package/vendor/theus-arsenal/skills/patrones-despliegue/SKILL.md +426 -0
  616. package/vendor/theus-arsenal/skills/patrones-django/SKILL.md +739 -0
  617. package/vendor/theus-arsenal/skills/patrones-django-celery/SKILL.md +456 -0
  618. package/vendor/theus-arsenal/skills/patrones-docker/SKILL.md +363 -0
  619. package/vendor/theus-arsenal/skills/patrones-dotnet/SKILL.md +321 -0
  620. package/vendor/theus-arsenal/skills/patrones-emr-clinico/SKILL.md +168 -0
  621. package/vendor/theus-arsenal/skills/patrones-fastapi/SKILL.md +513 -0
  622. package/vendor/theus-arsenal/skills/patrones-frontend/SKILL.md +655 -0
  623. package/vendor/theus-arsenal/skills/patrones-go/SKILL.md +674 -0
  624. package/vendor/theus-arsenal/skills/patrones-jpa/SKILL.md +156 -0
  625. package/vendor/theus-arsenal/skills/patrones-kotlin/SKILL.md +717 -0
  626. package/vendor/theus-arsenal/skills/patrones-kotlin-exposed/SKILL.md +724 -0
  627. package/vendor/theus-arsenal/skills/patrones-kotlin-ktor/SKILL.md +694 -0
  628. package/vendor/theus-arsenal/skills/patrones-kubernetes/SKILL.md +754 -0
  629. package/vendor/theus-arsenal/skills/patrones-laravel/SKILL.md +414 -0
  630. package/vendor/theus-arsenal/skills/patrones-mcp/SKILL.md +66 -0
  631. package/vendor/theus-arsenal/skills/patrones-mysql/SKILL.md +420 -0
  632. package/vendor/theus-arsenal/skills/patrones-nestjs/SKILL.md +229 -0
  633. package/vendor/theus-arsenal/skills/patrones-nextjs/SKILL.md +56 -0
  634. package/vendor/theus-arsenal/skills/patrones-nuxt4/SKILL.md +99 -0
  635. package/vendor/theus-arsenal/skills/patrones-perl/SKILL.md +508 -0
  636. package/vendor/theus-arsenal/skills/patrones-postgres/SKILL.md +141 -0
  637. package/vendor/theus-arsenal/skills/patrones-prisma/SKILL.md +399 -0
  638. package/vendor/theus-arsenal/skills/patrones-python/SKILL.md +750 -0
  639. package/vendor/theus-arsenal/skills/patrones-pytorch/SKILL.md +400 -0
  640. package/vendor/theus-arsenal/skills/patrones-quarkus/SKILL.md +729 -0
  641. package/vendor/theus-arsenal/skills/patrones-react/SKILL.md +339 -0
  642. package/vendor/theus-arsenal/skills/patrones-react-native/SKILL.md +325 -0
  643. package/vendor/theus-arsenal/skills/patrones-redis/SKILL.md +401 -0
  644. package/vendor/theus-arsenal/skills/patrones-rust/SKILL.md +504 -0
  645. package/vendor/theus-arsenal/skills/patrones-springboot/SKILL.md +314 -0
  646. package/vendor/theus-arsenal/skills/patrones-swiftui/SKILL.md +261 -0
  647. package/vendor/theus-arsenal/skills/patrones-tinystruct/SKILL.md +281 -0
  648. package/vendor/theus-arsenal/skills/patrones-tinystruct/references/architecture.md +90 -0
  649. package/vendor/theus-arsenal/skills/patrones-tinystruct/references/data-handling.md +60 -0
  650. package/vendor/theus-arsenal/skills/patrones-tinystruct/references/database.md +99 -0
  651. package/vendor/theus-arsenal/skills/patrones-tinystruct/references/routing.md +64 -0
  652. package/vendor/theus-arsenal/skills/patrones-tinystruct/references/system-usage.md +97 -0
  653. package/vendor/theus-arsenal/skills/patrones-tinystruct/references/testing.md +72 -0
  654. package/vendor/theus-arsenal/skills/patrones-vite/SKILL.md +449 -0
  655. package/vendor/theus-arsenal/skills/patrones-vue/SKILL.md +469 -0
  656. package/vendor/theus-arsenal/skills/persistencia-actores-swift/SKILL.md +148 -0
  657. package/vendor/theus-arsenal/skills/pipeline-opensource/SKILL.md +254 -0
  658. package/vendor/theus-arsenal/skills/planificacion-demanda-inventario/SKILL.md +236 -0
  659. package/vendor/theus-arsenal/skills/planificador-trades-prediccion/SKILL.md +60 -0
  660. package/vendor/theus-arsenal/skills/plano-tecnico/SKILL.md +102 -0
  661. package/vendor/theus-arsenal/skills/presentaciones-html/SKILL.md +189 -0
  662. package/vendor/theus-arsenal/skills/presentaciones-html/STYLE_PRESETS.md +330 -0
  663. package/vendor/theus-arsenal/skills/presentaciones-html/animation-patterns.md +122 -0
  664. package/vendor/theus-arsenal/skills/presentaciones-html/html-template.md +419 -0
  665. package/vendor/theus-arsenal/skills/presentaciones-html/scripts/export-pdf.sh +418 -0
  666. package/vendor/theus-arsenal/skills/presentaciones-html/scripts/extract-pptx.py +96 -0
  667. package/vendor/theus-arsenal/skills/presentaciones-html/viewport-base.css +153 -0
  668. package/vendor/theus-arsenal/skills/presupuesto-contexto/SKILL.md +263 -0
  669. package/vendor/theus-arsenal/skills/procesamiento-documentos-nutrient/SKILL.md +168 -0
  670. package/vendor/theus-arsenal/skills/programacion-produccion/SKILL.md +220 -0
  671. package/vendor/theus-arsenal/skills/publicacion-cruzada/SKILL.md +117 -0
  672. package/vendor/theus-arsenal/skills/publicador-social/SKILL.md +121 -0
  673. package/vendor/theus-arsenal/skills/puerta-de-entrega/SKILL.md +164 -0
  674. package/vendor/theus-arsenal/skills/puerta-de-entrega/hooks/puerta-entrega.py +242 -0
  675. package/vendor/theus-arsenal/skills/pulir-interfaces/SKILL.md +126 -0
  676. package/vendor/theus-arsenal/skills/qa-navegador/SKILL.md +103 -0
  677. package/vendor/theus-arsenal/skills/ranking-grafo-social/SKILL.md +153 -0
  678. package/vendor/theus-arsenal/skills/recuperacion-iterativa/SKILL.md +236 -0
  679. package/vendor/theus-arsenal/skills/redaccion-articulos/SKILL.md +81 -0
  680. package/vendor/theus-arsenal/skills/regex-vs-llm/SKILL.md +221 -0
  681. package/vendor/theus-arsenal/skills/regresion-codigo-ia/SKILL.md +388 -0
  682. package/vendor/theus-arsenal/skills/rendimiento-react/SKILL.md +567 -0
  683. package/vendor/theus-arsenal/skills/revision-codigo-flutter-dart/SKILL.md +442 -0
  684. package/vendor/theus-arsenal/skills/revision-literatura-cientifica/SKILL.md +191 -0
  685. package/vendor/theus-arsenal/skills/revision-multiperspectiva/SKILL.md +302 -0
  686. package/vendor/theus-arsenal/skills/revision-riesgo-prediccion/SKILL.md +56 -0
  687. package/vendor/theus-arsenal/skills/revision-seguridad/SKILL.md +505 -0
  688. package/vendor/theus-arsenal/skills/revision-seguridad/cloud-infrastructure-security.md +361 -0
  689. package/vendor/theus-arsenal/skills/runtime-bun/SKILL.md +83 -0
  690. package/vendor/theus-arsenal/skills/salud-codigo-codescene/SKILL.md +163 -0
  691. package/vendor/theus-arsenal/skills/salud-interfaces-red/SKILL.md +143 -0
  692. package/vendor/theus-arsenal/skills/seguimiento-costos/SKILL.md +122 -0
  693. package/vendor/theus-arsenal/skills/seguridad-agentes-trading/SKILL.md +145 -0
  694. package/vendor/theus-arsenal/skills/seguridad-amm-defi/SKILL.md +166 -0
  695. package/vendor/theus-arsenal/skills/seguridad-django/SKILL.md +648 -0
  696. package/vendor/theus-arsenal/skills/seguridad-laravel/SKILL.md +945 -0
  697. package/vendor/theus-arsenal/skills/seguridad-perl/SKILL.md +507 -0
  698. package/vendor/theus-arsenal/skills/seguridad-quarkus/SKILL.md +474 -0
  699. package/vendor/theus-arsenal/skills/seguridad-springboot/SKILL.md +279 -0
  700. package/vendor/theus-arsenal/skills/seo/SKILL.md +166 -0
  701. package/vendor/theus-arsenal/skills/sistema-diseno/SKILL.md +81 -0
  702. package/vendor/theus-arsenal/skills/sistema-operativo-agentico/SKILL.md +375 -0
  703. package/vendor/theus-arsenal/skills/sistemas-latencia-critica/SKILL.md +65 -0
  704. package/vendor/theus-arsenal/skills/tdd-django/SKILL.md +735 -0
  705. package/vendor/theus-arsenal/skills/tdd-laravel/SKILL.md +673 -0
  706. package/vendor/theus-arsenal/skills/tdd-quarkus/SKILL.md +817 -0
  707. package/vendor/theus-arsenal/skills/tdd-springboot/SKILL.md +165 -0
  708. package/vendor/theus-arsenal/skills/testing-cpp/SKILL.md +328 -0
  709. package/vendor/theus-arsenal/skills/testing-csharp/SKILL.md +321 -0
  710. package/vendor/theus-arsenal/skills/testing-e2e/SKILL.md +325 -0
  711. package/vendor/theus-arsenal/skills/testing-go/SKILL.md +719 -0
  712. package/vendor/theus-arsenal/skills/testing-kotlin/SKILL.md +829 -0
  713. package/vendor/theus-arsenal/skills/testing-perl/SKILL.md +479 -0
  714. package/vendor/theus-arsenal/skills/testing-protocolos-di-swift/SKILL.md +196 -0
  715. package/vendor/theus-arsenal/skills/testing-python/SKILL.md +815 -0
  716. package/vendor/theus-arsenal/skills/testing-react/SKILL.md +421 -0
  717. package/vendor/theus-arsenal/skills/testing-rust/SKILL.md +506 -0
  718. package/vendor/theus-arsenal/skills/tours-de-codigo/SKILL.md +252 -0
  719. package/vendor/theus-arsenal/skills/traduccion-documentos-visado/SKILL.md +121 -0
  720. package/vendor/theus-arsenal/skills/ui-a-vue/SKILL.md +141 -0
  721. package/vendor/theus-arsenal/skills/validacion-config-red/SKILL.md +211 -0
  722. package/vendor/theus-arsenal/skills/verificacion-django/SKILL.md +470 -0
  723. package/vendor/theus-arsenal/skills/verificacion-factual/SKILL.md +142 -0
  724. package/vendor/theus-arsenal/skills/verificacion-laravel/SKILL.md +184 -0
  725. package/vendor/theus-arsenal/skills/verificacion-quarkus/SKILL.md +485 -0
  726. package/vendor/theus-arsenal/skills/verificacion-springboot/SKILL.md +237 -0
  727. package/vendor/theus-arsenal/skills/videodb/SKILL.md +374 -0
  728. package/vendor/theus-arsenal/skills/videodb/reference/api-reference.md +550 -0
  729. package/vendor/theus-arsenal/skills/videodb/reference/capture-reference.md +407 -0
  730. package/vendor/theus-arsenal/skills/videodb/reference/capture.md +101 -0
  731. package/vendor/theus-arsenal/skills/videodb/reference/editor.md +443 -0
  732. package/vendor/theus-arsenal/skills/videodb/reference/generative.md +331 -0
  733. package/vendor/theus-arsenal/skills/videodb/reference/rtstream-reference.md +564 -0
  734. package/vendor/theus-arsenal/skills/videodb/reference/rtstream.md +65 -0
  735. package/vendor/theus-arsenal/skills/videodb/reference/search.md +230 -0
  736. package/vendor/theus-arsenal/skills/videodb/reference/streaming.md +406 -0
  737. package/vendor/theus-arsenal/skills/videodb/reference/use-cases.md +118 -0
  738. package/vendor/theus-arsenal/skills/videodb/scripts/ws_listener.py +279 -0
  739. package/vendor/theus-arsenal/skills/videos-manim/SKILL.md +91 -0
  740. package/vendor/theus-arsenal/skills/videos-manim/assets/network_graph_scene.py +52 -0
  741. package/vendor/theus-arsenal/skills/vigilancia-canary/SKILL.md +108 -0
  742. package/vendor/theus-arsenal/skills/voz-de-marca/SKILL.md +106 -0
@@ -0,0 +1,906 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Hook de SessionStart - Cargar el contexto previo al iniciar una sesión
4
+ *
5
+ * Multiplataforma (Windows, macOS, Linux)
6
+ *
7
+ * Se ejecuta cuando arranca una nueva sesión de Theus. Carga el resumen de la
8
+ * sesión más reciente en el contexto vía stdout, reporta las sesiones y skills
9
+ * aprendidas disponibles, y carga las reglas y contextos del plugin desde
10
+ * ${THEUS_PLUGIN_ROOT}/rules y ${THEUS_PLUGIN_ROOT}/contexts si existen.
11
+ */
12
+
13
+ const {
14
+ getSessionsDir,
15
+ getSessionSearchDirs,
16
+ getLearnedSkillsDir,
17
+ getProjectName,
18
+ findFiles,
19
+ ensureDir,
20
+ readFile,
21
+ stripAnsi,
22
+ log
23
+ } = require('../lib/utils');
24
+ const { resolveProjectContext, writeSessionLease, resolveSessionId, getObserverDataDir } = require('../lib/observer-sessions');
25
+ const { getPackageManager, getSelectionPrompt } = require('../lib/package-manager');
26
+ const { listAliases } = require('../lib/session-aliases');
27
+ const { detectProjectType } = require('../lib/project-detect');
28
+ const path = require('path');
29
+ const fs = require('fs');
30
+
31
+ const DEFAULT_INSTINCT_CONFIDENCE_THRESHOLD = 0.7;
32
+ const DEFAULT_MAX_INJECTED_INSTINCTS = 6;
33
+ const MAX_INJECTED_LEARNED_SKILLS = 6;
34
+ const MAX_LEARNED_SKILL_SUMMARY_CHARS = 220;
35
+ const DEFAULT_SESSION_START_CONTEXT_MAX_CHARS = 8000;
36
+ const DEFAULT_SESSION_RETENTION_DAYS = 30;
37
+ const MAX_PLUGIN_RESOURCE_CHARS = 4000;
38
+ const SESSION_START_MODE_INVALID = 'invalid';
39
+ const SESSION_START_MODE_SKIP = 'skip';
40
+
41
+ /**
42
+ * Resuelve una ruta del sistema de archivos a su forma canónica (real).
43
+ *
44
+ * Maneja symlinks y, en sistemas de archivos que no distinguen mayúsculas
45
+ * (macOS, Windows), normaliza el uso de mayúsculas para que las comparaciones
46
+ * de rutas sean confiables. Recurre a la ruta original si la resolución falla
47
+ * (p. ej., la ruta ya no existe).
48
+ *
49
+ * @param {string} p - La ruta a normalizar.
50
+ * @returns {string} La ruta canónica, o la original si la resolución falla.
51
+ */
52
+ function normalizePath(p) {
53
+ try {
54
+ return fs.realpathSync(p);
55
+ } catch {
56
+ return p;
57
+ }
58
+ }
59
+
60
+ function dedupeRecentSessions(searchDirs) {
61
+ const recentSessionsByName = new Map();
62
+
63
+ for (const [dirIndex, dir] of searchDirs.entries()) {
64
+ const matches = findFiles(dir, '*-session.tmp', { maxAge: 7 });
65
+
66
+ for (const match of matches) {
67
+ const basename = path.basename(match.path);
68
+ const current = {
69
+ ...match,
70
+ basename,
71
+ dirIndex,
72
+ };
73
+ const existing = recentSessionsByName.get(basename);
74
+
75
+ if (
76
+ !existing
77
+ || current.mtime > existing.mtime
78
+ || (current.mtime === existing.mtime && current.dirIndex < existing.dirIndex)
79
+ ) {
80
+ recentSessionsByName.set(basename, current);
81
+ }
82
+ }
83
+ }
84
+
85
+ return Array.from(recentSessionsByName.values())
86
+ .sort((left, right) => right.mtime - left.mtime || left.dirIndex - right.dirIndex);
87
+ }
88
+
89
+ /**
90
+ * Resuelve los días de retención de sesiones desde la variable de entorno
91
+ * THEUS_SESSION_RETENTION_DAYS.
92
+ *
93
+ * @returns {number|null} La ventana de retención en días, o `null` cuando el
94
+ * usuario optó explícitamente por no purgar. Valores vacíos o basura caen
95
+ * al valor por defecto {@link DEFAULT_SESSION_RETENTION_DAYS}.
96
+ */
97
+ function getSessionRetentionDays() {
98
+ const raw = process.env.THEUS_SESSION_RETENTION_DAYS;
99
+ if (!raw) return DEFAULT_SESSION_RETENTION_DAYS;
100
+
101
+ const normalized = String(raw).trim().toLowerCase();
102
+ if (['0', 'off', 'false', 'disabled', 'never', 'none'].includes(normalized)) {
103
+ return null;
104
+ }
105
+
106
+ const parsed = Number.parseInt(raw, 10);
107
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULT_SESSION_RETENTION_DAYS;
108
+ }
109
+
110
+ function isSessionStartContextDisabled() {
111
+ const raw = String(process.env.THEUS_SESSION_START_CONTEXT || '').trim().toLowerCase();
112
+ return ['0', 'false', 'off', 'none', 'disabled'].includes(raw);
113
+ }
114
+
115
+ function getSessionStartMaxContextChars() {
116
+ const raw = process.env.THEUS_SESSION_START_MAX_CHARS;
117
+ if (!raw) return DEFAULT_SESSION_START_CONTEXT_MAX_CHARS;
118
+
119
+ const parsed = Number.parseInt(raw, 10);
120
+ return Number.isInteger(parsed) && parsed >= 0 ? parsed : DEFAULT_SESSION_START_CONTEXT_MAX_CHARS;
121
+ }
122
+
123
+ /**
124
+ * Resuelve la confianza mínima que necesita un instinto para inyectarse en
125
+ * SessionStart. Sobrescribible vía `THEUS_INSTINCT_CONFIDENCE_THRESHOLD`
126
+ * (un número en [0, 1]); valores vacíos o fuera de rango caen al valor por
127
+ * defecto {@link DEFAULT_INSTINCT_CONFIDENCE_THRESHOLD}.
128
+ *
129
+ * @returns {number} El piso de confianza para instintos inyectados.
130
+ */
131
+ function getInstinctConfidenceThreshold() {
132
+ const raw = process.env.THEUS_INSTINCT_CONFIDENCE_THRESHOLD;
133
+ if (!raw) return DEFAULT_INSTINCT_CONFIDENCE_THRESHOLD;
134
+
135
+ // Exigir un decimal plano (p. ej. "0.7", "1", "0.95") para que la basura al
136
+ // final ("0.7x") y la sintaxis numérica no decimal como "0x1" (hexadecimal)
137
+ // o "1e2" (exponente) se rechacen por completo en lugar de que Number() las
138
+ // acepte en silencio.
139
+ const normalized = raw.trim();
140
+ if (!/^\d+(\.\d+)?$/.test(normalized)) return DEFAULT_INSTINCT_CONFIDENCE_THRESHOLD;
141
+
142
+ const parsed = Number(normalized);
143
+ return Number.isFinite(parsed) && parsed >= 0 && parsed <= 1
144
+ ? parsed
145
+ : DEFAULT_INSTINCT_CONFIDENCE_THRESHOLD;
146
+ }
147
+
148
+ /**
149
+ * Resuelve la cantidad máxima de instintos inyectados en SessionStart.
150
+ * Sobrescribible vía `THEUS_MAX_INJECTED_INSTINCTS` (un entero positivo);
151
+ * valores vacíos o inválidos caen al valor por defecto
152
+ * {@link DEFAULT_MAX_INJECTED_INSTINCTS}.
153
+ *
154
+ * @returns {number} El tope de instintos inyectados.
155
+ */
156
+ function getMaxInjectedInstincts() {
157
+ const raw = process.env.THEUS_MAX_INJECTED_INSTINCTS;
158
+ if (!raw) return DEFAULT_MAX_INJECTED_INSTINCTS;
159
+
160
+ // Exigir un entero no negativo plano para que "3.9", "6abc", "0x1"
161
+ // (hexadecimal) y "1e2" (exponente) se rechacen por completo y caigan al
162
+ // valor por defecto, en lugar de que parseInt trunque o Number() acepte
163
+ // sintaxis alternativa.
164
+ const normalized = raw.trim();
165
+ if (!/^\d+$/.test(normalized)) return DEFAULT_MAX_INJECTED_INSTINCTS;
166
+
167
+ const parsed = Number(normalized);
168
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULT_MAX_INJECTED_INSTINCTS;
169
+ }
170
+
171
+ function parseSessionStartPayload(rawInput) {
172
+ const input = String(rawInput || '');
173
+ if (!input.trim()) return { mode: null, sessionId: null };
174
+
175
+ let payload;
176
+ try {
177
+ payload = JSON.parse(input);
178
+ } catch {
179
+ log(`[SessionStart] Payload de stdin inválido; se omite la inyección del resumen de la sesión previa. Longitud: ${input.length}`);
180
+ return { mode: SESSION_START_MODE_INVALID, sessionId: null };
181
+ }
182
+
183
+ const sessionId = payload && typeof payload.session_id === 'string' && payload.session_id.trim()
184
+ ? payload.session_id.trim()
185
+ : null;
186
+
187
+ const supportedModes = new Set(['startup', 'resume', 'clear', 'compact']);
188
+
189
+ if (payload.hook_event_name === 'SessionStart') {
190
+ const mode = typeof payload.source === 'string' ? payload.source.trim().toLowerCase() : '';
191
+ return { mode: supportedModes.has(mode) ? mode : SESSION_START_MODE_SKIP, sessionId };
192
+ }
193
+
194
+ return { mode: SESSION_START_MODE_SKIP, sessionId };
195
+ }
196
+
197
+ function limitSessionStartContext(additionalContext, maxChars = getSessionStartMaxContextChars()) {
198
+ const context = String(additionalContext || '');
199
+
200
+ if (context.length <= maxChars) {
201
+ return context;
202
+ }
203
+
204
+ const marker = '\n\n[SessionStart truncó el contexto. Define THEUS_SESSION_START_MAX_CHARS para subir el tope o THEUS_SESSION_START_CONTEXT=off para desactivar el contexto inyectado.]';
205
+ const prefixLength = Math.max(0, maxChars - marker.length);
206
+ log(`[SessionStart] Contexto adicional truncado de ${context.length} a ${maxChars} caracteres`);
207
+
208
+ return `${context.slice(0, prefixLength).trimEnd()}${marker}`.slice(0, maxChars);
209
+ }
210
+
211
+ function pruneExpiredSessions(searchDirs, retentionDays) {
212
+ const uniqueDirs = Array.from(new Set(searchDirs.filter(dir => typeof dir === 'string' && dir.length > 0)));
213
+ let removed = 0;
214
+
215
+ for (const dir of uniqueDirs) {
216
+ if (!fs.existsSync(dir)) continue;
217
+
218
+ let entries;
219
+ try {
220
+ entries = fs.readdirSync(dir, { withFileTypes: true });
221
+ } catch {
222
+ continue;
223
+ }
224
+
225
+ for (const entry of entries) {
226
+ if (!entry.isFile() || !entry.name.endsWith('-session.tmp')) continue;
227
+
228
+ const fullPath = path.join(dir, entry.name);
229
+ let stats;
230
+ try {
231
+ stats = fs.statSync(fullPath);
232
+ } catch {
233
+ continue;
234
+ }
235
+
236
+ const ageInDays = (Date.now() - stats.mtimeMs) / (1000 * 60 * 60 * 24);
237
+ if (ageInDays <= retentionDays) continue;
238
+
239
+ try {
240
+ fs.rmSync(fullPath, { force: true });
241
+ removed += 1;
242
+ } catch (error) {
243
+ log(`[SessionStart] Advertencia: no se pudo purgar la sesión expirada ${fullPath}: ${error.message}`);
244
+ }
245
+ }
246
+ }
247
+
248
+ return removed;
249
+ }
250
+
251
+ /**
252
+ * Carga los archivos Markdown de un directorio de recursos del plugin
253
+ * (${THEUS_PLUGIN_ROOT}/rules o ${THEUS_PLUGIN_ROOT}/contexts) si existen.
254
+ *
255
+ * @param {string} dirName - Nombre del subdirectorio dentro de la raíz del plugin.
256
+ * @param {string} label - Etiqueta visible del bloque inyectado.
257
+ * @returns {string} El bloque de contexto, o cadena vacía si no hay nada que cargar.
258
+ */
259
+ /**
260
+ * Construye un índice compacto de las reglas del plugin
261
+ * (${THEUS_PLUGIN_ROOT}/rules/<grupo>/*.md) para inyectarlo como contexto.
262
+ *
263
+ * Las reglas están organizadas en subdirectorios por lenguaje/tema y suman
264
+ * decenas de archivos: inyectarlas completas reventaría el presupuesto de
265
+ * contexto de la sesión. En su lugar se inyecta el mapa de grupos y archivos
266
+ * con la instrucción de leer el archivo pertinente al trabajar en cada área.
267
+ *
268
+ * @returns {string} El bloque de índice, o cadena vacía si no hay reglas.
269
+ */
270
+ function loadPluginRulesIndex() {
271
+ const pluginRoot = String(process.env.THEUS_PLUGIN_ROOT || '').trim();
272
+ if (!pluginRoot) return '';
273
+
274
+ const rulesDir = path.join(pluginRoot, 'rules');
275
+ if (!fs.existsSync(rulesDir)) return '';
276
+
277
+ let groups;
278
+ try {
279
+ groups = fs.readdirSync(rulesDir, { withFileTypes: true })
280
+ .filter(entry => entry.isDirectory())
281
+ .map(entry => entry.name)
282
+ .sort((a, b) => (a === 'common' ? -1 : b === 'common' ? 1 : a.localeCompare(b)));
283
+ } catch (error) {
284
+ log(`[SessionStart] Advertencia: no se pudo leer ${rulesDir}: ${error.message}`);
285
+ return '';
286
+ }
287
+
288
+ const lines = [];
289
+ for (const group of groups) {
290
+ let files;
291
+ try {
292
+ files = fs.readdirSync(path.join(rulesDir, group))
293
+ .filter(name => /\.md$/i.test(name))
294
+ .map(name => name.replace(/\.md$/i, ''))
295
+ .sort();
296
+ } catch {
297
+ continue;
298
+ }
299
+ if (files.length === 0) continue;
300
+ const nota = group === 'common' ? ' (aplican a todo el código, en cualquier lenguaje)' : '';
301
+ lines.push(`- ${group}${nota}: ${files.join(', ')}`);
302
+ }
303
+
304
+ if (lines.length === 0) return '';
305
+
306
+ log(`[SessionStart] Inyectando índice de reglas del plugin (${lines.length} grupos)`);
307
+ return [
308
+ 'Reglas de calidad del arsenal:',
309
+ '',
310
+ `El plugin incluye reglas de estilo, patrones, seguridad y testing en \`${rulesDir}/<grupo>/<archivo>.md\`.`,
311
+ 'Antes de escribir o revisar código de una de estas áreas, lee con la tool Read el archivo pertinente (como mínimo security y patterns del grupo, más los de common):',
312
+ ...lines,
313
+ ].join('\n');
314
+ }
315
+
316
+ function loadPluginResources(dirName, label) {
317
+ const pluginRoot = String(process.env.THEUS_PLUGIN_ROOT || '').trim();
318
+ if (!pluginRoot) return '';
319
+
320
+ const dir = path.join(pluginRoot, dirName);
321
+ if (!fs.existsSync(dir)) return '';
322
+
323
+ let entries;
324
+ try {
325
+ entries = fs.readdirSync(dir, { withFileTypes: true })
326
+ .filter(entry => entry.isFile() && /\.md$/i.test(entry.name))
327
+ .sort((left, right) => left.name.localeCompare(right.name));
328
+ } catch (error) {
329
+ log(`[SessionStart] Advertencia: no se pudo leer ${dir}: ${error.message}`);
330
+ return '';
331
+ }
332
+
333
+ if (entries.length === 0) return '';
334
+
335
+ const parts = [];
336
+ let used = 0;
337
+ for (const entry of entries) {
338
+ const filePath = path.join(dir, entry.name);
339
+ const content = readFile(filePath);
340
+ if (!content) continue;
341
+
342
+ const trimmed = content.trim();
343
+ const remaining = MAX_PLUGIN_RESOURCE_CHARS - used;
344
+ if (remaining <= 0) {
345
+ parts.push(`- ${entry.name}: omitido por límite de tamaño`);
346
+ continue;
347
+ }
348
+
349
+ const slice = trimmed.length > remaining ? `${trimmed.slice(0, remaining).trimEnd()}\n[...truncado]` : trimmed;
350
+ used += slice.length;
351
+ parts.push(`### ${entry.name}\n${slice}`);
352
+ }
353
+
354
+ if (parts.length === 0) return '';
355
+
356
+ log(`[SessionStart] Cargando ${parts.length} archivo(s) de ${dirName}/ del plugin`);
357
+ return `${label}:\n\n${parts.join('\n\n')}`;
358
+ }
359
+
360
+ /**
361
+ * Selecciona la sesión que mejor coincide con el directorio de trabajo actual.
362
+ *
363
+ * Los archivos de sesión escritos por session-end.js contienen campos de
364
+ * encabezado como:
365
+ * **Proyecto:** mi-proyecto
366
+ * **Worktree:** /ruta/al/proyecto
367
+ *
368
+ * Esta función lee cada archivo de sesión una sola vez, cacheando su
369
+ * contenido, y devuelve tanto el objeto de sesión seleccionado como su
370
+ * contenido ya leído para evitar E/S duplicada en el llamador.
371
+ *
372
+ * Prioridad (de mayor a menor):
373
+ * 1. Coincidencia exacta de worktree (cwd) — la más reciente
374
+ * 2. Coincidencia por nombre de proyecto para sesiones legacy sin metadatos de Worktree
375
+ * 3. Sin inyección cuando las sesiones pertenecen a otro worktree/proyecto
376
+ *
377
+ * Las sesiones ya vienen ordenadas de más reciente a más antigua, así que la
378
+ * primera coincidencia de cada categoría gana.
379
+ *
380
+ * @param {Array<Object>} sessions - Lista de sesiones deduplicada, más recientes primero.
381
+ * @param {string} cwd - Directorio de trabajo actual (process.cwd()).
382
+ * @param {string} currentProject - Nombre del proyecto actual según getProjectName().
383
+ * @returns {{ session: Object, content: string, matchReason: string } | null}
384
+ * La sesión que mejor coincide con su contenido cacheado y el motivo de la
385
+ * coincidencia, o null si la lista está vacía o ningún archivo es legible.
386
+ */
387
+ function selectMatchingSession(sessions, cwd, currentProject) {
388
+ if (sessions.length === 0) return null;
389
+
390
+ // Normalizar cwd una vez fuera del bucle para evitar syscalls repetidas
391
+ const normalizedCwd = normalizePath(cwd);
392
+
393
+ let projectMatch = null;
394
+ let projectMatchContent = null;
395
+ let readableSessions = 0;
396
+
397
+ for (const session of sessions) {
398
+ const content = readFile(session.path);
399
+ if (!content) continue;
400
+ readableSessions++;
401
+
402
+ // Extraer el campo **Worktree:**
403
+ const worktreeMatch = content.match(/\*\*Worktree:\*\*\s*(.+)$/m);
404
+ const sessionWorktree = worktreeMatch ? worktreeMatch[1].trim() : '';
405
+
406
+ // Coincidencia exacta de worktree — la mejor posible, retornar de inmediato.
407
+ // Normalizar ambas rutas para manejar symlinks y sistemas de archivos que
408
+ // no distinguen mayúsculas
409
+ if (sessionWorktree && normalizePath(sessionWorktree) === normalizedCwd) {
410
+ return { session, content, matchReason: 'worktree' };
411
+ }
412
+
413
+ // La coincidencia por nombre de proyecto solo es segura para archivos de
414
+ // sesión legacy escritos antes de que existieran los metadatos de
415
+ // Worktree. Un Worktree explícito distinto no es una coincidencia.
416
+ if (!projectMatch && currentProject && !sessionWorktree) {
417
+ const projectFieldMatch = content.match(/\*\*Proyecto:\*\*\s*(.+)$/m);
418
+ const sessionProject = projectFieldMatch ? projectFieldMatch[1].trim() : '';
419
+ if (sessionProject && sessionProject === currentProject) {
420
+ projectMatch = session;
421
+ projectMatchContent = content;
422
+ }
423
+ }
424
+ }
425
+
426
+ if (projectMatch) {
427
+ return { session: projectMatch, content: projectMatchContent, matchReason: 'project' };
428
+ }
429
+
430
+ log(readableSessions > 0
431
+ ? '[SessionStart] No se encontró una sesión que coincida por worktree/proyecto'
432
+ : '[SessionStart] Ningún archivo de sesión fue legible');
433
+ return null;
434
+ }
435
+
436
+ function parseInstinctFile(content) {
437
+ const instincts = [];
438
+ let current = null;
439
+ let inFrontmatter = false;
440
+ let contentLines = [];
441
+
442
+ for (const line of String(content).split('\n')) {
443
+ if (line.trim() === '---') {
444
+ if (inFrontmatter) {
445
+ inFrontmatter = false;
446
+ } else {
447
+ if (current && current.id) {
448
+ current.content = contentLines.join('\n').trim();
449
+ instincts.push(current);
450
+ }
451
+ current = {};
452
+ contentLines = [];
453
+ inFrontmatter = true;
454
+ }
455
+ continue;
456
+ }
457
+
458
+ if (inFrontmatter) {
459
+ const separatorIndex = line.indexOf(':');
460
+ if (separatorIndex === -1) continue;
461
+ const key = line.slice(0, separatorIndex).trim();
462
+ let value = line.slice(separatorIndex + 1).trim();
463
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
464
+ value = value.slice(1, -1);
465
+ }
466
+ if (key === 'confidence') {
467
+ const parsed = Number.parseFloat(value);
468
+ current[key] = Number.isFinite(parsed) ? parsed : 0.5;
469
+ } else {
470
+ current[key] = value;
471
+ }
472
+ } else if (current) {
473
+ contentLines.push(line);
474
+ }
475
+ }
476
+
477
+ if (current && current.id) {
478
+ current.content = contentLines.join('\n').trim();
479
+ instincts.push(current);
480
+ }
481
+
482
+ return instincts;
483
+ }
484
+
485
+ function readInstinctsFromDir(directory, scope) {
486
+ if (!directory || !fs.existsSync(directory)) return [];
487
+
488
+ const entries = fs.readdirSync(directory, { withFileTypes: true })
489
+ .filter(entry => entry.isFile() && /\.(ya?ml|md)$/i.test(entry.name))
490
+ .sort((left, right) => left.name.localeCompare(right.name));
491
+
492
+ const instincts = [];
493
+ for (const entry of entries) {
494
+ const filePath = path.join(directory, entry.name);
495
+ try {
496
+ const parsed = parseInstinctFile(fs.readFileSync(filePath, 'utf8'));
497
+ for (const instinct of parsed) {
498
+ instincts.push({
499
+ ...instinct,
500
+ _scopeLabel: scope,
501
+ _sourceFile: filePath,
502
+ });
503
+ }
504
+ } catch (error) {
505
+ log(`[SessionStart] Advertencia: no se pudo parsear el archivo de instintos ${filePath}: ${error.message}`);
506
+ }
507
+ }
508
+
509
+ return instincts;
510
+ }
511
+
512
+ function extractInstinctAction(content) {
513
+ const actionMatch = String(content || '').match(/## (?:Action|Acción)\s*\n+([\s\S]+?)(?:\n## |\n---|$)/);
514
+ const actionBlock = (actionMatch ? actionMatch[1] : String(content || '')).trim();
515
+ const firstLine = actionBlock
516
+ .split('\n')
517
+ .map(line => line.trim())
518
+ .find(Boolean);
519
+
520
+ return firstLine || '';
521
+ }
522
+
523
+ function summarizeActiveInstincts(observerContext) {
524
+ const observerDataDir = getObserverDataDir();
525
+ const globalDirs = [
526
+ { dir: path.join(observerDataDir, 'instincts', 'personal'), scope: 'global' },
527
+ { dir: path.join(observerDataDir, 'instincts', 'inherited'), scope: 'global' },
528
+ ];
529
+ const projectDirs = observerContext.isGlobal ? [] : [
530
+ { dir: path.join(observerContext.projectDir, 'instincts', 'personal'), scope: 'project' },
531
+ { dir: path.join(observerContext.projectDir, 'instincts', 'inherited'), scope: 'project' },
532
+ ];
533
+
534
+ const scopedInstincts = [
535
+ ...projectDirs.flatMap(({ dir, scope }) => readInstinctsFromDir(dir, scope)),
536
+ ...globalDirs.flatMap(({ dir, scope }) => readInstinctsFromDir(dir, scope)),
537
+ ];
538
+
539
+ const confidenceThreshold = getInstinctConfidenceThreshold();
540
+ const maxInjected = getMaxInjectedInstincts();
541
+
542
+ const deduped = new Map();
543
+ for (const instinct of scopedInstincts) {
544
+ if (!instinct.id || instinct.confidence < confidenceThreshold) continue;
545
+ const existing = deduped.get(instinct.id);
546
+ if (!existing || (existing._scopeLabel !== 'project' && instinct._scopeLabel === 'project')) {
547
+ deduped.set(instinct.id, instinct);
548
+ }
549
+ }
550
+
551
+ const ranked = Array.from(deduped.values())
552
+ .map(instinct => ({
553
+ ...instinct,
554
+ action: extractInstinctAction(instinct.content),
555
+ }))
556
+ .filter(instinct => instinct.action)
557
+ .sort((left, right) => {
558
+ if (right.confidence !== left.confidence) return right.confidence - left.confidence;
559
+ if (left._scopeLabel !== right._scopeLabel) return left._scopeLabel === 'project' ? -1 : 1;
560
+ return String(left.id).localeCompare(String(right.id));
561
+ })
562
+ .slice(0, maxInjected);
563
+
564
+ if (ranked.length === 0) {
565
+ return '';
566
+ }
567
+
568
+ log(`[SessionStart] Inyectando ${ranked.length} instinto(s) en el contexto de la sesión`);
569
+
570
+ const lines = ranked.map(instinct => {
571
+ const scope = instinct._scopeLabel === 'project' ? 'proyecto' : 'global';
572
+ const confidence = `${Math.round(instinct.confidence * 100)}%`;
573
+ return `- [${scope} ${confidence}] ${instinct.action}`;
574
+ });
575
+
576
+ return `Instintos activos:\n${lines.join('\n')}`;
577
+ }
578
+
579
+ function stripMarkdownInline(value) {
580
+ return String(value || '')
581
+ .replace(/`([^`]+)`/g, '$1')
582
+ .replace(/\*\*([^*]+)\*\*/g, '$1')
583
+ .replace(/\*([^*]+)\*/g, '$1')
584
+ .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1')
585
+ .trim();
586
+ }
587
+
588
+ function collapseWhitespace(value) {
589
+ return String(value || '').replace(/\s+/g, ' ').trim();
590
+ }
591
+
592
+ function truncateSummary(value, maxLength = MAX_LEARNED_SKILL_SUMMARY_CHARS) {
593
+ const normalized = collapseWhitespace(stripMarkdownInline(value));
594
+ if (normalized.length <= maxLength) {
595
+ return normalized;
596
+ }
597
+ return `${normalized.slice(0, Math.max(0, maxLength - 3)).trimEnd()}...`;
598
+ }
599
+
600
+ function extractMarkdownHeading(content) {
601
+ const match = String(content || '').match(/^#\s+(.+)$/m);
602
+ return match ? stripMarkdownInline(match[1]) : '';
603
+ }
604
+
605
+ function extractSection(content, headingPattern) {
606
+ const source = String(content || '');
607
+ const match = source.match(new RegExp(`^##\\s+${headingPattern}\\s*\\n+([\\s\\S]+?)(?:\\n##\\s+|$)`, 'im'));
608
+ return match ? match[1].trim() : '';
609
+ }
610
+
611
+ function extractFirstParagraph(content) {
612
+ const withoutHeading = String(content || '').replace(/^#\s+.+$/m, '').trim();
613
+ return withoutHeading
614
+ .split(/\n\s*\n/)
615
+ .map(paragraph => paragraph.trim())
616
+ .find(Boolean) || '';
617
+ }
618
+
619
+ function summarizeLearnedSkillFile(filePath, learnedRoot) {
620
+ const content = readFile(filePath);
621
+ if (!content) return null;
622
+
623
+ const isDirectorySkill = path.basename(filePath).toLowerCase() === 'skill.md';
624
+ const slug = isDirectorySkill
625
+ ? path.basename(path.dirname(filePath))
626
+ : path.basename(filePath, path.extname(filePath));
627
+ const title = extractMarkdownHeading(content) || slug;
628
+ const summary = truncateSummary(
629
+ extractSection(content, '(?:When to Use|Cuándo usar)')
630
+ || extractSection(content, '(?:Trigger|Disparador)')
631
+ || extractSection(content, '(?:Problem|Problema)')
632
+ || extractFirstParagraph(content)
633
+ || title
634
+ );
635
+
636
+ if (!summary) return null;
637
+
638
+ let mtime = 0;
639
+ try {
640
+ mtime = fs.statSync(filePath).mtimeMs;
641
+ } catch {
642
+ // Mantener los archivos ilegibles/eliminados fuera de la prioridad por
643
+ // recencia sin hacer fallar el hook.
644
+ }
645
+
646
+ const relativePath = path.relative(learnedRoot, filePath);
647
+ return {
648
+ slug,
649
+ title: truncateSummary(title, 80),
650
+ summary,
651
+ relativePath,
652
+ mtime,
653
+ };
654
+ }
655
+
656
+ function collectLearnedSkillFiles(learnedDir) {
657
+ const flatMarkdownFiles = findFiles(learnedDir, '*.md');
658
+ const directorySkillFiles = findFiles(learnedDir, 'SKILL.md', { recursive: true });
659
+ const byPath = new Map();
660
+
661
+ for (const match of [...flatMarkdownFiles, ...directorySkillFiles]) {
662
+ byPath.set(match.path, match);
663
+ }
664
+
665
+ return Array.from(byPath.values())
666
+ .sort((left, right) => right.mtime - left.mtime || left.path.localeCompare(right.path));
667
+ }
668
+
669
+ function summarizeLearnedSkills(learnedDir, learnedSkillFiles = collectLearnedSkillFiles(learnedDir)) {
670
+ const summaries = learnedSkillFiles
671
+ .map(match => summarizeLearnedSkillFile(match.path, learnedDir))
672
+ .filter(Boolean)
673
+ .slice(0, MAX_INJECTED_LEARNED_SKILLS);
674
+
675
+ if (summaries.length === 0) {
676
+ return '';
677
+ }
678
+
679
+ log(`[SessionStart] Inyectando ${summaries.length} skill(s) aprendida(s) en el contexto de la sesión`);
680
+
681
+ const lines = summaries.map(skill => {
682
+ const titleSuffix = skill.title && skill.title !== skill.slug ? ` (${skill.title})` : '';
683
+ return `- ${skill.slug}${titleSuffix}: ${skill.summary}`;
684
+ });
685
+
686
+ return [
687
+ 'Skills aprendidas disponibles:',
688
+ 'Solo como referencia; aplica una skill aprendida únicamente cuando sea relevante para la solicitud actual del usuario.',
689
+ ...lines,
690
+ ].join('\n');
691
+ }
692
+
693
+ async function main() {
694
+ const sessionsDir = getSessionsDir();
695
+ const sessionSearchDirs = getSessionSearchDirs();
696
+ const learnedDir = getLearnedSkillsDir();
697
+ const additionalContextParts = [];
698
+ const observerContext = resolveProjectContext();
699
+ const maxContextChars = getSessionStartMaxContextChars();
700
+ const explicitContextDisabled = isSessionStartContextDisabled();
701
+ const shouldInjectContext = !explicitContextDisabled && maxContextChars !== 0;
702
+ const { mode: sessionStartMode, sessionId: stdinSessionId } = parseSessionStartPayload(fs.readFileSync(0, 'utf8'));
703
+
704
+ // Asegurar que los directorios existan
705
+ ensureDir(sessionsDir);
706
+ ensureDir(learnedDir);
707
+
708
+ const retentionDays = getSessionRetentionDays();
709
+ if (retentionDays === null) {
710
+ log('[SessionStart] Purga desactivada vía THEUS_SESSION_RETENTION_DAYS');
711
+ } else {
712
+ const prunedSessions = pruneExpiredSessions(sessionSearchDirs, retentionDays);
713
+ if (prunedSessions > 0) {
714
+ log(`[SessionStart] Se purgaron ${prunedSessions} sesión(es) expiradas con más de ${retentionDays} día(s)`);
715
+ }
716
+ }
717
+
718
+ // El session_id llega por stdin en el payload JSON del evento SessionStart.
719
+ const observerSessionId = resolveSessionId(stdinSessionId);
720
+ if (observerSessionId) {
721
+ writeSessionLease(observerContext, observerSessionId, {
722
+ hook: 'SessionStart',
723
+ projectRoot: observerContext.projectRoot
724
+ });
725
+ log(`[SessionStart] Lease de observador registrado para ${observerSessionId}`);
726
+ } else {
727
+ log('[SessionStart] No hay session_id disponible en stdin; se omite el registro del lease de observador');
728
+ }
729
+
730
+ if (explicitContextDisabled) {
731
+ log('[SessionStart] Inyección de contexto adicional desactivada por THEUS_SESSION_START_CONTEXT');
732
+ } else if (maxContextChars === 0) {
733
+ log('[SessionStart] Inyección de contexto adicional desactivada por THEUS_SESSION_START_MAX_CHARS=0');
734
+ }
735
+
736
+ if (shouldInjectContext) {
737
+ // Cargar reglas y contextos del plugin (${THEUS_PLUGIN_ROOT}/rules y
738
+ // ${THEUS_PLUGIN_ROOT}/contexts) si existen. Las reglas viven en
739
+ // subdirectorios por lenguaje, así que se inyecta un índice compacto en
740
+ // vez del contenido completo (45+ archivos no caben en el contexto).
741
+ const pluginRules = loadPluginRulesIndex();
742
+ if (pluginRules) {
743
+ additionalContextParts.push(pluginRules);
744
+ }
745
+ const pluginContexts = loadPluginResources('contexts', 'Contextos del plugin');
746
+ if (pluginContexts) {
747
+ additionalContextParts.push(pluginContexts);
748
+ }
749
+
750
+ const instinctSummary = summarizeActiveInstincts(observerContext);
751
+ if (instinctSummary) {
752
+ additionalContextParts.push(instinctSummary);
753
+ }
754
+
755
+ if (sessionStartMode && sessionStartMode !== 'startup') {
756
+ const reason = sessionStartMode === SESSION_START_MODE_INVALID
757
+ ? 'payload de stdin inválido'
758
+ : sessionStartMode === SESSION_START_MODE_SKIP
759
+ ? 'payload de SessionStart no reconocido'
760
+ : `modo de SessionStart distinto de startup: ${sessionStartMode}`;
761
+ log(`[SessionStart] Se omite la inyección del resumen de la sesión previa por ${reason}`);
762
+ } else {
763
+ // Buscar archivos de sesión recientes (últimos 7 días)
764
+ const recentSessions = dedupeRecentSessions(sessionSearchDirs);
765
+
766
+ if (recentSessions.length > 0) {
767
+ log(`[SessionStart] Se encontraron ${recentSessions.length} sesión(es) reciente(s)`);
768
+
769
+ // Preferir una sesión que coincida con el directorio de trabajo o el
770
+ // proyecto actual. Los archivos de sesión contienen los campos de
771
+ // encabezado **Proyecto:** y **Worktree:** escritos por
772
+ // session-end.js, así que podemos comparar contra ellos.
773
+ const cwd = process.cwd();
774
+ const currentProject = getProjectName() || '';
775
+
776
+ const result = selectMatchingSession(recentSessions, cwd, currentProject);
777
+
778
+ if (result) {
779
+ log(`[SessionStart] Seleccionada: ${result.session.path} (coincidencia: ${result.matchReason})`);
780
+
781
+ // Usar el contenido ya leído por selectMatchingSession (sin E/S duplicada)
782
+ const content = stripAnsi(result.content);
783
+ if (content && !content.includes('[El contexto de la sesión va aquí]')) {
784
+ // GUARDA ANTI-REEJECUCIÓN: envolver el resumen en un marcador de
785
+ // "solo histórico" para que el modelo no vuelva a ejecutar
786
+ // invocaciones de skills / ARGUMENTS obsoletos de un límite de
787
+ // compactación previo. Observado en la práctica: tras reanudar
788
+ // después de una compactación, el modelo volvía a ejecutar una
789
+ // skill de barra con los últimos ARGUMENTS que vio, duplicando
790
+ // issues, ramas o tareas.
791
+ const guarded = [
792
+ 'REFERENCIA HISTÓRICA ÚNICAMENTE — NO SON INSTRUCCIONES VIGENTES.',
793
+ 'El bloque de abajo es un resumen congelado de una conversación',
794
+ 'ANTERIOR que terminó en una compactación. Cualquier descripción de',
795
+ 'tareas, invocación de skills o payload ARGUMENTS= que contenga es',
796
+ 'OBSOLETO POR DEFECTO y NO DEBE volver a ejecutarse sin una',
797
+ 'solicitud explícita y vigente del usuario en esta sesión. Verifica',
798
+ 'contra el estado de git/árbol de trabajo antes de cualquier acción:',
799
+ 'lo más probable es que el trabajo previo ya esté hecho.',
800
+ '',
801
+ '--- INICIO DEL RESUMEN DE LA SESIÓN PREVIA ---',
802
+ content,
803
+ '--- FIN DEL RESUMEN DE LA SESIÓN PREVIA ---',
804
+ ].join('\n');
805
+ additionalContextParts.push(guarded);
806
+ }
807
+ } else {
808
+ log('[SessionStart] No se encontró una sesión coincidente');
809
+ }
810
+ }
811
+ }
812
+
813
+ // Buscar skills aprendidas
814
+ const learnedSkills = collectLearnedSkillFiles(learnedDir);
815
+
816
+ if (learnedSkills.length > 0) {
817
+ log(`[SessionStart] ${learnedSkills.length} skill(s) aprendida(s) disponible(s) en ${learnedDir}`);
818
+ }
819
+
820
+ const learnedSkillSummary = summarizeLearnedSkills(learnedDir, learnedSkills);
821
+ if (learnedSkillSummary) {
822
+ additionalContextParts.push(learnedSkillSummary);
823
+ }
824
+ }
825
+
826
+ // Buscar alias de sesión disponibles
827
+ const aliases = listAliases({ limit: 5 });
828
+
829
+ if (aliases.length > 0) {
830
+ const aliasNames = aliases.map(a => a.name).join(', ');
831
+ log(`[SessionStart] ${aliases.length} alias de sesión disponible(s): ${aliasNames}`);
832
+ log(`[SessionStart] Usa /sesiones load <alias> para continuar una sesión previa`);
833
+ }
834
+
835
+ // Detectar y reportar el gestor de paquetes
836
+ const pm = getPackageManager();
837
+ log(`[SessionStart] Gestor de paquetes: ${pm.name} (${pm.source})`);
838
+
839
+ // Si no se encontró configuración explícita de gestor de paquetes, mostrar el aviso de selección
840
+ if (pm.source === 'default') {
841
+ log('[SessionStart] No se encontró preferencia de gestor de paquetes.');
842
+ log(getSelectionPrompt());
843
+ }
844
+
845
+ // Detectar el tipo de proyecto y los frameworks
846
+ const projectInfo = detectProjectType();
847
+ if (projectInfo.languages.length > 0 || projectInfo.frameworks.length > 0) {
848
+ const parts = [];
849
+ if (projectInfo.languages.length > 0) {
850
+ parts.push(`lenguajes: ${projectInfo.languages.join(', ')}`);
851
+ }
852
+ if (projectInfo.frameworks.length > 0) {
853
+ parts.push(`frameworks: ${projectInfo.frameworks.join(', ')}`);
854
+ }
855
+ log(`[SessionStart] Proyecto detectado — ${parts.join('; ')}`);
856
+ if (shouldInjectContext) {
857
+ additionalContextParts.push(`Tipo de proyecto: ${JSON.stringify(projectInfo)}`);
858
+ }
859
+ } else {
860
+ log('[SessionStart] No se detectó un tipo de proyecto específico');
861
+ }
862
+
863
+ const additionalContext = shouldInjectContext
864
+ ? limitSessionStartContext(additionalContextParts.join('\n\n'), maxContextChars)
865
+ : '';
866
+ await writeSessionStartPayload(additionalContext);
867
+ }
868
+
869
+ function writeSessionStartPayload(additionalContext) {
870
+ return new Promise((resolve, reject) => {
871
+ let settled = false;
872
+ const payload = JSON.stringify({
873
+ hookSpecificOutput: {
874
+ hookEventName: 'SessionStart',
875
+ additionalContext
876
+ }
877
+ });
878
+
879
+ const handleError = (err) => {
880
+ if (settled) return;
881
+ settled = true;
882
+ if (err) {
883
+ log(`[SessionStart] Error al escribir en stdout: ${err.message}`);
884
+ }
885
+ reject(err || new Error('error del stream de stdout'));
886
+ };
887
+
888
+ process.stdout.once('error', handleError);
889
+ process.stdout.write(payload, (err) => {
890
+ process.stdout.removeListener('error', handleError);
891
+ if (settled) return;
892
+ settled = true;
893
+ if (err) {
894
+ log(`[SessionStart] Error al escribir en stdout: ${err.message}`);
895
+ reject(err);
896
+ return;
897
+ }
898
+ resolve();
899
+ });
900
+ });
901
+ }
902
+
903
+ main().catch(err => {
904
+ console.error('[SessionStart] Error:', err.message);
905
+ process.exitCode = 0; // No bloquear ante errores
906
+ });