xtrm-tools 0.7.3 → 0.7.4

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 (527) hide show
  1. package/.xtrm/config/pi/extensions/xtrm-ui/format.ts +189 -0
  2. package/.xtrm/config/pi/extensions/xtrm-ui/index.ts +76 -17
  3. package/.xtrm/config/pi/extensions/xtrm-ui/package.json +16 -5
  4. package/.xtrm/hooks/specialists/specialists-complete.mjs +70 -0
  5. package/.xtrm/hooks/specialists/specialists-session-start.mjs +105 -0
  6. package/.xtrm/registry.json +397 -409
  7. package/.xtrm/skills/default/README.txt +31 -0
  8. package/.xtrm/skills/default/clean-code/SKILL.md +201 -0
  9. package/.xtrm/skills/default/creating-service-skills/SKILL.md +433 -0
  10. package/.xtrm/skills/default/creating-service-skills/references/script_quality_standards.md +425 -0
  11. package/.xtrm/skills/default/creating-service-skills/references/service_skill_system_guide.md +278 -0
  12. package/.xtrm/skills/default/creating-service-skills/scripts/bootstrap.py +326 -0
  13. package/.xtrm/skills/default/creating-service-skills/scripts/deep_dive.py +304 -0
  14. package/.xtrm/skills/default/creating-service-skills/scripts/scaffolder.py +482 -0
  15. package/.xtrm/skills/default/deepwiki/SKILL.md +50 -0
  16. package/.xtrm/skills/default/delegating/SKILL.md +196 -0
  17. package/.xtrm/skills/default/delegating/config.yaml +210 -0
  18. package/.xtrm/skills/default/delegating/references/orchestration-protocols.md +41 -0
  19. package/.xtrm/skills/default/documenting/CHANGELOG.md +23 -0
  20. package/.xtrm/skills/default/documenting/README.md +148 -0
  21. package/.xtrm/skills/default/documenting/SKILL.md +113 -0
  22. package/.xtrm/skills/default/documenting/examples/example_pattern.md +70 -0
  23. package/.xtrm/skills/default/documenting/examples/example_reference.md +70 -0
  24. package/.xtrm/skills/default/documenting/examples/example_ssot_analytics.md +64 -0
  25. package/.xtrm/skills/default/documenting/examples/example_workflow.md +141 -0
  26. package/.xtrm/skills/default/documenting/references/changelog-format.md +97 -0
  27. package/.xtrm/skills/default/documenting/references/metadata-schema.md +136 -0
  28. package/.xtrm/skills/default/documenting/references/taxonomy.md +81 -0
  29. package/.xtrm/skills/default/documenting/references/versioning-rules.md +78 -0
  30. package/.xtrm/skills/default/documenting/scripts/bump_version.sh +60 -0
  31. package/.xtrm/skills/default/documenting/scripts/changelog/__init__.py +0 -0
  32. package/.xtrm/skills/default/documenting/scripts/changelog/add_entry.py +216 -0
  33. package/.xtrm/skills/default/documenting/scripts/changelog/bump_release.py +117 -0
  34. package/.xtrm/skills/default/documenting/scripts/changelog/init_changelog.py +54 -0
  35. package/.xtrm/skills/default/documenting/scripts/changelog/validate_changelog.py +128 -0
  36. package/.xtrm/skills/default/documenting/scripts/drift_detector.py +266 -0
  37. package/.xtrm/skills/default/documenting/scripts/generate_template.py +311 -0
  38. package/.xtrm/skills/default/documenting/scripts/list_by_category.sh +84 -0
  39. package/.xtrm/skills/default/documenting/scripts/orchestrator.py +255 -0
  40. package/.xtrm/skills/default/documenting/scripts/validate_metadata.py +242 -0
  41. package/.xtrm/skills/default/documenting/templates/CHANGELOG.md.template +13 -0
  42. package/.xtrm/skills/default/find-docs/SKILL.md +175 -0
  43. package/.xtrm/skills/default/find-skills/SKILL.md +133 -0
  44. package/.xtrm/skills/default/github-search/SKILL.md +49 -0
  45. package/.xtrm/skills/default/gitnexus-debugging/SKILL.md +89 -0
  46. package/.xtrm/skills/default/gitnexus-impact-analysis/SKILL.md +97 -0
  47. package/.xtrm/skills/default/gitnexus-pr-review/SKILL.md +163 -0
  48. package/.xtrm/skills/default/gitnexus-refactoring/SKILL.md +121 -0
  49. package/.xtrm/skills/default/hook-development/SKILL.md +797 -0
  50. package/.xtrm/skills/default/hook-development/examples/load-context.sh +55 -0
  51. package/.xtrm/skills/default/hook-development/examples/quality-check.js +1168 -0
  52. package/.xtrm/skills/default/hook-development/examples/validate-bash.sh +43 -0
  53. package/.xtrm/skills/default/hook-development/examples/validate-write.sh +38 -0
  54. package/.xtrm/skills/default/hook-development/references/advanced.md +527 -0
  55. package/.xtrm/skills/default/hook-development/references/migration.md +369 -0
  56. package/.xtrm/skills/default/hook-development/references/patterns.md +412 -0
  57. package/.xtrm/skills/default/hook-development/scripts/README.md +164 -0
  58. package/.xtrm/skills/default/hook-development/scripts/hook-linter.sh +153 -0
  59. package/.xtrm/skills/default/hook-development/scripts/test-hook.sh +252 -0
  60. package/.xtrm/skills/default/hook-development/scripts/validate-hook-schema.sh +159 -0
  61. package/.xtrm/skills/default/init-session/SKILL.md +69 -0
  62. package/.xtrm/skills/default/last30days/SKILL.md +881 -0
  63. package/.xtrm/skills/default/last30days/scripts/briefing.py +260 -0
  64. package/.xtrm/skills/default/last30days/scripts/evaluate-synthesis.py +120 -0
  65. package/.xtrm/skills/default/last30days/scripts/evaluate_search_quality.py +641 -0
  66. package/.xtrm/skills/default/last30days/scripts/generate-synthesis-inputs.py +53 -0
  67. package/.xtrm/skills/default/last30days/scripts/last30days.py +2137 -0
  68. package/.xtrm/skills/default/last30days/scripts/lib/__init__.py +1 -0
  69. package/.xtrm/skills/default/last30days/scripts/lib/bird_x.py +458 -0
  70. package/.xtrm/skills/default/last30days/scripts/lib/bluesky.py +225 -0
  71. package/.xtrm/skills/default/last30days/scripts/lib/brave_search.py +329 -0
  72. package/.xtrm/skills/default/last30days/scripts/lib/cache.py +165 -0
  73. package/.xtrm/skills/default/last30days/scripts/lib/chrome_cookies.py +265 -0
  74. package/.xtrm/skills/default/last30days/scripts/lib/cookie_extract.py +295 -0
  75. package/.xtrm/skills/default/last30days/scripts/lib/dates.py +124 -0
  76. package/.xtrm/skills/default/last30days/scripts/lib/dedupe.py +290 -0
  77. package/.xtrm/skills/default/last30days/scripts/lib/entity_extract.py +127 -0
  78. package/.xtrm/skills/default/last30days/scripts/lib/env.py +807 -0
  79. package/.xtrm/skills/default/last30days/scripts/lib/exa_search.py +176 -0
  80. package/.xtrm/skills/default/last30days/scripts/lib/hackernews.py +266 -0
  81. package/.xtrm/skills/default/last30days/scripts/lib/http.py +174 -0
  82. package/.xtrm/skills/default/last30days/scripts/lib/instagram.py +365 -0
  83. package/.xtrm/skills/default/last30days/scripts/lib/models.py +221 -0
  84. package/.xtrm/skills/default/last30days/scripts/lib/normalize.py +489 -0
  85. package/.xtrm/skills/default/last30days/scripts/lib/openai_reddit.py +631 -0
  86. package/.xtrm/skills/default/last30days/scripts/lib/openrouter_search.py +216 -0
  87. package/.xtrm/skills/default/last30days/scripts/lib/parallel_search.py +139 -0
  88. package/.xtrm/skills/default/last30days/scripts/lib/polymarket.py +580 -0
  89. package/.xtrm/skills/default/last30days/scripts/lib/quality_nudge.py +201 -0
  90. package/.xtrm/skills/default/last30days/scripts/lib/query.py +117 -0
  91. package/.xtrm/skills/default/last30days/scripts/lib/query_type.py +111 -0
  92. package/.xtrm/skills/default/last30days/scripts/lib/reddit.py +617 -0
  93. package/.xtrm/skills/default/last30days/scripts/lib/reddit_enrich.py +325 -0
  94. package/.xtrm/skills/default/last30days/scripts/lib/reddit_public.py +259 -0
  95. package/.xtrm/skills/default/last30days/scripts/lib/relevance.py +148 -0
  96. package/.xtrm/skills/default/last30days/scripts/lib/render.py +1018 -0
  97. package/.xtrm/skills/default/last30days/scripts/lib/safari_cookies.py +182 -0
  98. package/.xtrm/skills/default/last30days/scripts/lib/schema.py +843 -0
  99. package/.xtrm/skills/default/last30days/scripts/lib/score.py +775 -0
  100. package/.xtrm/skills/default/last30days/scripts/lib/scrapecreators_x.py +182 -0
  101. package/.xtrm/skills/default/last30days/scripts/lib/setup_wizard.py +186 -0
  102. package/.xtrm/skills/default/last30days/scripts/lib/tiktok.py +349 -0
  103. package/.xtrm/skills/default/last30days/scripts/lib/truthsocial.py +183 -0
  104. package/.xtrm/skills/default/last30days/scripts/lib/ui.py +620 -0
  105. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/LICENSE +21 -0
  106. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/bird-search.mjs +134 -0
  107. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/cookies.js +191 -0
  108. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/features.json +17 -0
  109. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/paginate-cursor.js +37 -0
  110. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/query-ids.json +20 -0
  111. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/runtime-features.js +151 -0
  112. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/runtime-query-ids.js +264 -0
  113. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-base.js +129 -0
  114. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-constants.js +50 -0
  115. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-features.js +347 -0
  116. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-search.js +157 -0
  117. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-types.js +2 -0
  118. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-utils.js +511 -0
  119. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/LICENSE +22 -0
  120. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/README.md +29 -0
  121. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.d.ts +3 -0
  122. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.d.ts.map +1 -0
  123. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.js +2 -0
  124. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.js.map +1 -0
  125. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.d.ts +8 -0
  126. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.d.ts.map +1 -0
  127. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.js +27 -0
  128. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.js.map +1 -0
  129. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.d.ts +11 -0
  130. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.d.ts.map +1 -0
  131. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.js +100 -0
  132. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.js.map +1 -0
  133. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.d.ts +25 -0
  134. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.d.ts.map +1 -0
  135. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.js +104 -0
  136. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.js.map +1 -0
  137. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.d.ts +10 -0
  138. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.d.ts.map +1 -0
  139. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.js +293 -0
  140. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.js.map +1 -0
  141. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.d.ts +10 -0
  142. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.d.ts.map +1 -0
  143. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.js +26 -0
  144. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.js.map +1 -0
  145. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.d.ts +7 -0
  146. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.d.ts.map +1 -0
  147. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.js +51 -0
  148. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.js.map +1 -0
  149. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.d.ts +7 -0
  150. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.d.ts.map +1 -0
  151. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.js +60 -0
  152. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.js.map +1 -0
  153. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.d.ts +7 -0
  154. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.d.ts.map +1 -0
  155. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.js +38 -0
  156. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.js.map +1 -0
  157. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.d.ts +5 -0
  158. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.d.ts.map +1 -0
  159. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.js +33 -0
  160. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.js.map +1 -0
  161. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.d.ts +24 -0
  162. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.d.ts.map +1 -0
  163. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.js +30 -0
  164. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.js.map +1 -0
  165. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.d.ts +11 -0
  166. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.d.ts.map +1 -0
  167. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.js +43 -0
  168. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.js.map +1 -0
  169. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.d.ts +8 -0
  170. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.d.ts.map +1 -0
  171. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.js +41 -0
  172. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.js.map +1 -0
  173. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.d.ts +8 -0
  174. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.d.ts.map +1 -0
  175. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.js +53 -0
  176. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.js.map +1 -0
  177. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.d.ts +8 -0
  178. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.d.ts.map +1 -0
  179. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.js +27 -0
  180. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.js.map +1 -0
  181. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.d.ts +7 -0
  182. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.d.ts.map +1 -0
  183. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.js +53 -0
  184. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.js.map +1 -0
  185. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.d.ts +8 -0
  186. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.d.ts.map +1 -0
  187. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.js +60 -0
  188. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.js.map +1 -0
  189. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.d.ts +7 -0
  190. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.d.ts.map +1 -0
  191. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.js +38 -0
  192. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.js.map +1 -0
  193. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.d.ts +6 -0
  194. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.d.ts.map +1 -0
  195. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.js +257 -0
  196. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.js.map +1 -0
  197. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.d.ts +8 -0
  198. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.d.ts.map +1 -0
  199. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.js +71 -0
  200. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.js.map +1 -0
  201. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.d.ts +6 -0
  202. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.d.ts.map +1 -0
  203. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.js +173 -0
  204. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.js.map +1 -0
  205. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.d.ts +26 -0
  206. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.d.ts.map +1 -0
  207. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.js +195 -0
  208. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.js.map +1 -0
  209. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.d.ts +121 -0
  210. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.d.ts.map +1 -0
  211. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.js +2 -0
  212. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.js.map +1 -0
  213. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.d.ts +2 -0
  214. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.d.ts.map +1 -0
  215. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.js +18 -0
  216. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.js.map +1 -0
  217. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.d.ts +8 -0
  218. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.d.ts.map +1 -0
  219. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.js +110 -0
  220. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.js.map +1 -0
  221. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.d.ts +2 -0
  222. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.d.ts.map +1 -0
  223. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.js +32 -0
  224. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.js.map +1 -0
  225. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.d.ts +2 -0
  226. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.d.ts.map +1 -0
  227. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.js +13 -0
  228. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.js.map +1 -0
  229. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.d.ts +2 -0
  230. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.d.ts.map +1 -0
  231. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.js +7 -0
  232. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.js.map +1 -0
  233. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.d.ts +5 -0
  234. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.d.ts.map +1 -0
  235. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.js +58 -0
  236. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.js.map +1 -0
  237. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.d.ts +2 -0
  238. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.d.ts.map +1 -0
  239. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.js +27 -0
  240. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.js.map +1 -0
  241. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.d.ts +2 -0
  242. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.d.ts.map +1 -0
  243. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.js +8 -0
  244. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.js.map +1 -0
  245. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/package.json +40 -0
  246. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/package.json +13 -0
  247. package/.xtrm/skills/default/last30days/scripts/lib/websearch.py +401 -0
  248. package/.xtrm/skills/default/last30days/scripts/lib/xai_x.py +217 -0
  249. package/.xtrm/skills/default/last30days/scripts/lib/xiaohongshu_api.py +162 -0
  250. package/.xtrm/skills/default/last30days/scripts/lib/youtube_yt.py +538 -0
  251. package/.xtrm/skills/default/last30days/scripts/store.py +654 -0
  252. package/.xtrm/skills/default/last30days/scripts/sync.sh +50 -0
  253. package/.xtrm/skills/default/last30days/scripts/test-v1-vs-v2.sh +219 -0
  254. package/.xtrm/skills/default/last30days/scripts/watchlist.py +329 -0
  255. package/.xtrm/skills/default/planning/SKILL.md +405 -0
  256. package/.xtrm/skills/default/planning/evals/evals.json +19 -0
  257. package/.xtrm/skills/default/prompt-improving/README.md +162 -0
  258. package/.xtrm/skills/default/prompt-improving/SKILL.md +74 -0
  259. package/.xtrm/skills/default/prompt-improving/references/analysis_commands.md +24 -0
  260. package/.xtrm/skills/default/prompt-improving/references/chain_of_thought.md +24 -0
  261. package/.xtrm/skills/default/prompt-improving/references/mcp_definitions.md +20 -0
  262. package/.xtrm/skills/default/prompt-improving/references/multishot.md +23 -0
  263. package/.xtrm/skills/default/prompt-improving/references/xml_core.md +60 -0
  264. package/.xtrm/skills/default/quality-gates/.claude/hooks/hook-config.json +66 -0
  265. package/.xtrm/skills/default/quality-gates/.claude/hooks/quality-check.cjs +1286 -0
  266. package/.xtrm/skills/default/quality-gates/.claude/hooks/quality-check.py +334 -0
  267. package/.xtrm/skills/default/quality-gates/.claude/settings.json +3 -0
  268. package/.xtrm/skills/default/quality-gates/.claude/skills/using-quality-gates/SKILL.md +254 -0
  269. package/.xtrm/skills/default/quality-gates/README.md +109 -0
  270. package/.xtrm/skills/default/quality-gates/evals/evals.json +181 -0
  271. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/FINAL-EVAL-SUMMARY.md +75 -0
  272. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/edge-case-auto-fix-verification/with_skill/outputs/response.md +59 -0
  273. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/edge-case-mixed-language-project/with_skill/outputs/response.md +60 -0
  274. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/eval-summary.md +105 -0
  275. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/partial-install-python-only/with_skill/outputs/response.md +93 -0
  276. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/python-refactor-request/with_skill/outputs/response.md +104 -0
  277. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/quality-gate-error-fix/with_skill/outputs/response.md +74 -0
  278. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-general-chat/with_skill/outputs/response.md +18 -0
  279. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-math-question/with_skill/outputs/response.md +18 -0
  280. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-unrelated-coding/with_skill/outputs/response.md +56 -0
  281. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/tdd-guard-blocking-confusion/with_skill/outputs/response.md +67 -0
  282. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/typescript-feature-with-tests/with_skill/outputs/response.md +97 -0
  283. package/.xtrm/skills/default/scoping-service-skills/SKILL.md +231 -0
  284. package/.xtrm/skills/default/scoping-service-skills/scripts/scope.py +74 -0
  285. package/.xtrm/skills/default/service-skills-set/README.md +93 -0
  286. package/.xtrm/skills/default/service-skills-set/git-hooks/doc_reminder.py +67 -0
  287. package/.xtrm/skills/default/service-skills-set/git-hooks/skill_staleness.py +194 -0
  288. package/.xtrm/skills/default/service-skills-set/install-service-skills.py +193 -0
  289. package/.xtrm/skills/default/service-skills-set/service-registry.json +4 -0
  290. package/.xtrm/skills/default/service-skills-set/service-skills-readme.md +236 -0
  291. package/.xtrm/skills/default/service-skills-set/settings.json +37 -0
  292. package/.xtrm/skills/default/session-close-report/SKILL.md +131 -0
  293. package/.xtrm/skills/default/skill-creator/LICENSE.txt +202 -0
  294. package/.xtrm/skills/default/skill-creator/SKILL.md +479 -0
  295. package/.xtrm/skills/default/skill-creator/agents/analyzer.md +274 -0
  296. package/.xtrm/skills/default/skill-creator/agents/comparator.md +202 -0
  297. package/.xtrm/skills/default/skill-creator/agents/grader.md +223 -0
  298. package/.xtrm/skills/default/skill-creator/assets/eval_review.html +146 -0
  299. package/.xtrm/skills/default/skill-creator/eval-viewer/generate_review.py +471 -0
  300. package/.xtrm/skills/default/skill-creator/eval-viewer/viewer.html +1325 -0
  301. package/.xtrm/skills/default/skill-creator/references/schemas.md +430 -0
  302. package/.xtrm/skills/default/skill-creator/scripts/__init__.py +0 -0
  303. package/.xtrm/skills/default/skill-creator/scripts/aggregate_benchmark.py +401 -0
  304. package/.xtrm/skills/default/skill-creator/scripts/generate_report.py +326 -0
  305. package/.xtrm/skills/default/skill-creator/scripts/improve_description.py +248 -0
  306. package/.xtrm/skills/default/skill-creator/scripts/package_skill.py +136 -0
  307. package/.xtrm/skills/default/skill-creator/scripts/quick_validate.py +103 -0
  308. package/.xtrm/skills/default/skill-creator/scripts/run_eval.py +310 -0
  309. package/.xtrm/skills/default/skill-creator/scripts/run_loop.py +332 -0
  310. package/.xtrm/skills/default/skill-creator/scripts/utils.py +47 -0
  311. package/.xtrm/skills/default/specialists-creator/SKILL.md +705 -0
  312. package/.xtrm/skills/default/specialists-creator/scripts/validate-specialist.ts +41 -0
  313. package/.xtrm/skills/default/sync-docs/SKILL.md +262 -0
  314. package/.xtrm/skills/default/sync-docs/evals/evals.json +89 -0
  315. package/.xtrm/skills/default/sync-docs/references/doc-structure.md +99 -0
  316. package/.xtrm/skills/default/sync-docs/references/schema.md +103 -0
  317. package/.xtrm/skills/default/sync-docs/scripts/changelog/add_entry.py +216 -0
  318. package/.xtrm/skills/default/sync-docs/scripts/context_gatherer.py +405 -0
  319. package/.xtrm/skills/default/sync-docs/scripts/doc_structure_analyzer.py +495 -0
  320. package/.xtrm/skills/default/sync-docs/scripts/drift_detector.py +563 -0
  321. package/.xtrm/skills/default/sync-docs/scripts/validate_doc.py +365 -0
  322. package/.xtrm/skills/default/sync-docs/scripts/validate_metadata.py +185 -0
  323. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/benchmark.json +293 -0
  324. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/benchmark.md +13 -0
  325. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/eval_metadata.json +27 -0
  326. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/outputs/result.md +210 -0
  327. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/grading.json +28 -0
  328. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/timing.json +1 -0
  329. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/outputs/result.md +101 -0
  330. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/grading.json +28 -0
  331. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/timing.json +5 -0
  332. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/timing.json +5 -0
  333. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/eval_metadata.json +27 -0
  334. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/outputs/result.md +198 -0
  335. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/grading.json +28 -0
  336. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/timing.json +1 -0
  337. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/outputs/result.md +94 -0
  338. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/grading.json +28 -0
  339. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/timing.json +1 -0
  340. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/eval_metadata.json +27 -0
  341. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/outputs/result.md +237 -0
  342. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/grading.json +28 -0
  343. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/timing.json +1 -0
  344. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/outputs/result.md +134 -0
  345. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/grading.json +28 -0
  346. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/timing.json +1 -0
  347. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/benchmark.json +297 -0
  348. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/benchmark.md +13 -0
  349. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/eval_metadata.json +27 -0
  350. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/outputs/result.md +137 -0
  351. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/grading.json +92 -0
  352. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/timing.json +1 -0
  353. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/outputs/result.md +134 -0
  354. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/grading.json +86 -0
  355. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/timing.json +1 -0
  356. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/eval_metadata.json +27 -0
  357. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/outputs/result.md +193 -0
  358. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/grading.json +72 -0
  359. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/timing.json +1 -0
  360. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/outputs/result.md +211 -0
  361. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/grading.json +91 -0
  362. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/timing.json +5 -0
  363. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/eval_metadata.json +27 -0
  364. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/outputs/result.md +182 -0
  365. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/grading.json +95 -0
  366. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/timing.json +1 -0
  367. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/outputs/result.md +222 -0
  368. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/grading.json +88 -0
  369. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/timing.json +5 -0
  370. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/benchmark.json +298 -0
  371. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/benchmark.md +13 -0
  372. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/eval_metadata.json +27 -0
  373. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/outputs/result.md +125 -0
  374. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/grading.json +97 -0
  375. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/timing.json +5 -0
  376. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/outputs/result.md +144 -0
  377. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/grading.json +78 -0
  378. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/timing.json +5 -0
  379. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/eval_metadata.json +27 -0
  380. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/outputs/result.md +104 -0
  381. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/grading.json +91 -0
  382. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/timing.json +5 -0
  383. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/outputs/result.md +79 -0
  384. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/grading.json +82 -0
  385. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/timing.json +5 -0
  386. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/eval_metadata.json +27 -0
  387. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase1_context.json +302 -0
  388. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase2_drift.txt +33 -0
  389. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase3_analysis.json +114 -0
  390. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase4_fix.txt +118 -0
  391. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase5_validate.txt +38 -0
  392. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/result.md +158 -0
  393. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/grading.json +95 -0
  394. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/timing.json +5 -0
  395. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/outputs/result.md +71 -0
  396. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/grading.json +90 -0
  397. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/timing.json +5 -0
  398. package/.xtrm/skills/default/test-planning/SKILL.md +465 -0
  399. package/.xtrm/skills/default/test-planning/evals/evals.json +23 -0
  400. package/.xtrm/skills/default/updating-service-skills/SKILL.md +136 -0
  401. package/.xtrm/skills/default/updating-service-skills/scripts/drift_detector.py +222 -0
  402. package/.xtrm/skills/default/using-nodes/SKILL.md +333 -0
  403. package/.xtrm/skills/default/using-quality-gates/SKILL.md +254 -0
  404. package/.xtrm/skills/default/using-service-skills/SKILL.md +108 -0
  405. package/.xtrm/skills/default/using-service-skills/scripts/cataloger.py +74 -0
  406. package/.xtrm/skills/default/using-service-skills/scripts/skill_activator.py +152 -0
  407. package/.xtrm/skills/default/using-specialists/SKILL.md +848 -0
  408. package/.xtrm/skills/default/using-specialists/evals/evals.json +68 -0
  409. package/.xtrm/skills/default/using-tdd/SKILL.md +410 -0
  410. package/.xtrm/skills/default/using-xtrm/SKILL.md +127 -0
  411. package/.xtrm/skills/default/xt-debugging/SKILL.md +149 -0
  412. package/.xtrm/skills/default/xt-end/SKILL.md +297 -0
  413. package/.xtrm/skills/default/xt-merge/SKILL.md +326 -0
  414. package/.xtrm/skills/optional/README.txt +2 -0
  415. package/.xtrm/skills/optional/architecture-design/PACK.json +11 -0
  416. package/.xtrm/skills/optional/architecture-design/architecture-patterns/SKILL.md +494 -0
  417. package/.xtrm/skills/optional/architecture-design/architecture-patterns/references/advanced-patterns.md +391 -0
  418. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/SKILL.md +473 -0
  419. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
  420. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/assets/prompt-template-library.md +264 -0
  421. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/chain-of-thought.md +412 -0
  422. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/few-shot-learning.md +386 -0
  423. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/prompt-optimization.md +428 -0
  424. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/prompt-templates.md +484 -0
  425. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/system-prompts.md +195 -0
  426. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
  427. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/SKILL.md +277 -0
  428. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  429. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/implementer-prompt.md +113 -0
  430. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  431. package/.xtrm/skills/optional/code-quality/PACK.json +12 -0
  432. package/.xtrm/skills/optional/code-quality/code-review-excellence/SKILL.md +529 -0
  433. package/.xtrm/skills/optional/code-quality/multi-reviewer-patterns/SKILL.md +127 -0
  434. package/.xtrm/skills/optional/code-quality/systematic-debugging/SKILL.md +296 -0
  435. package/.xtrm/skills/optional/code-quality/verification-before-completion/SKILL.md +139 -0
  436. package/.xtrm/skills/optional/data-engineering/PACK.json +9 -0
  437. package/.xtrm/skills/optional/data-engineering/data-analyst/SKILL.md +57 -0
  438. package/.xtrm/skills/optional/research-methods/PACK.json +12 -0
  439. package/.xtrm/skills/optional/research-methods/academic-researcher/SKILL.md +269 -0
  440. package/.xtrm/skills/optional/research-methods/brainstorming/SKILL.md +164 -0
  441. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/frame-template.html +214 -0
  442. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/helper.js +88 -0
  443. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/server.cjs +354 -0
  444. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/start-server.sh +148 -0
  445. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/stop-server.sh +56 -0
  446. package/.xtrm/skills/optional/research-methods/brainstorming/spec-document-reviewer-prompt.md +49 -0
  447. package/.xtrm/skills/optional/research-methods/brainstorming/visual-companion.md +287 -0
  448. package/.xtrm/skills/optional/research-methods/deep-research/SKILL.md +192 -0
  449. package/.xtrm/skills/optional/research-methods/fact-checker/SKILL.md +182 -0
  450. package/.xtrm/skills/optional/security-ops/PACK.json +9 -0
  451. package/.xtrm/skills/optional/security-ops/security-auditor/SKILL.md +165 -0
  452. package/.xtrm/skills/optional/xt-optional/PACK.json +16 -0
  453. package/.xtrm/skills/optional/xt-optional/docker-expert/SKILL.md +409 -0
  454. package/.xtrm/skills/optional/xt-optional/obsidian-cli/SKILL.md +106 -0
  455. package/.xtrm/skills/optional/xt-optional/python-testing/SKILL.md +815 -0
  456. package/.xtrm/skills/optional/xt-optional/senior-backend/SKILL.md +209 -0
  457. package/.xtrm/skills/optional/xt-optional/senior-backend/references/api_design_patterns.md +103 -0
  458. package/.xtrm/skills/optional/xt-optional/senior-backend/references/backend_security_practices.md +103 -0
  459. package/.xtrm/skills/optional/xt-optional/senior-backend/references/database_optimization_guide.md +103 -0
  460. package/.xtrm/skills/optional/xt-optional/senior-backend/scripts/api_load_tester.py +114 -0
  461. package/.xtrm/skills/optional/xt-optional/senior-backend/scripts/api_scaffolder.py +114 -0
  462. package/.xtrm/skills/optional/xt-optional/senior-backend/scripts/database_migration_tool.py +114 -0
  463. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/SKILL.md +226 -0
  464. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/references/experiment_design_frameworks.md +80 -0
  465. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/references/feature_engineering_patterns.md +80 -0
  466. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/references/statistical_methods_advanced.md +80 -0
  467. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/scripts/experiment_designer.py +100 -0
  468. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/scripts/feature_engineering_pipeline.py +100 -0
  469. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/scripts/model_evaluation_suite.py +100 -0
  470. package/.xtrm/skills/optional/xt-optional/senior-devops/SKILL.md +209 -0
  471. package/.xtrm/skills/optional/xt-optional/senior-devops/references/cicd_pipeline_guide.md +103 -0
  472. package/.xtrm/skills/optional/xt-optional/senior-devops/references/deployment_strategies.md +103 -0
  473. package/.xtrm/skills/optional/xt-optional/senior-devops/references/infrastructure_as_code.md +103 -0
  474. package/.xtrm/skills/optional/xt-optional/senior-devops/scripts/deployment_manager.py +114 -0
  475. package/.xtrm/skills/optional/xt-optional/senior-devops/scripts/pipeline_generator.py +114 -0
  476. package/.xtrm/skills/optional/xt-optional/senior-devops/scripts/terraform_scaffolder.py +114 -0
  477. package/.xtrm/skills/optional/xt-optional/senior-security/SKILL.md +209 -0
  478. package/.xtrm/skills/optional/xt-optional/senior-security/references/cryptography_implementation.md +103 -0
  479. package/.xtrm/skills/optional/xt-optional/senior-security/references/penetration_testing_guide.md +103 -0
  480. package/.xtrm/skills/optional/xt-optional/senior-security/references/security_architecture_patterns.md +103 -0
  481. package/.xtrm/skills/optional/xt-optional/senior-security/scripts/pentest_automator.py +114 -0
  482. package/.xtrm/skills/optional/xt-optional/senior-security/scripts/security_auditor.py +114 -0
  483. package/.xtrm/skills/optional/xt-optional/senior-security/scripts/threat_modeler.py +114 -0
  484. package/CHANGELOG.md +16 -0
  485. package/README.md +5 -0
  486. package/cli/dist/index.cjs +798 -612
  487. package/cli/dist/index.cjs.map +1 -1
  488. package/cli/package.json +1 -1
  489. package/package.json +3 -1
  490. package/.xtrm/extensions/auto-session-name/index.ts +0 -29
  491. package/.xtrm/extensions/auto-session-name/package.json +0 -16
  492. package/.xtrm/extensions/auto-update/index.ts +0 -71
  493. package/.xtrm/extensions/auto-update/package.json +0 -16
  494. package/.xtrm/extensions/beads/index.ts +0 -232
  495. package/.xtrm/extensions/beads/package.json +0 -19
  496. package/.xtrm/extensions/compact-header/index.ts +0 -69
  497. package/.xtrm/extensions/compact-header/package.json +0 -16
  498. package/.xtrm/extensions/core/adapter.ts +0 -52
  499. package/.xtrm/extensions/core/guard-rules.ts +0 -100
  500. package/.xtrm/extensions/core/lib.ts +0 -3
  501. package/.xtrm/extensions/core/logger.ts +0 -45
  502. package/.xtrm/extensions/core/package.json +0 -18
  503. package/.xtrm/extensions/core/runner.ts +0 -71
  504. package/.xtrm/extensions/core/session-state.ts +0 -59
  505. package/.xtrm/extensions/custom-footer/index.ts +0 -398
  506. package/.xtrm/extensions/custom-footer/package.json +0 -19
  507. package/.xtrm/extensions/custom-provider-qwen-cli/index.ts +0 -363
  508. package/.xtrm/extensions/custom-provider-qwen-cli/package.json +0 -1
  509. package/.xtrm/extensions/git-checkpoint/index.ts +0 -53
  510. package/.xtrm/extensions/git-checkpoint/package.json +0 -16
  511. package/.xtrm/extensions/lsp-bootstrap/index.ts +0 -134
  512. package/.xtrm/extensions/lsp-bootstrap/package.json +0 -17
  513. package/.xtrm/extensions/pi-serena-compact/index.ts +0 -121
  514. package/.xtrm/extensions/pi-serena-compact/package.json +0 -16
  515. package/.xtrm/extensions/quality-gates/index.ts +0 -66
  516. package/.xtrm/extensions/quality-gates/package.json +0 -19
  517. package/.xtrm/extensions/service-skills/index.ts +0 -108
  518. package/.xtrm/extensions/service-skills/package.json +0 -19
  519. package/.xtrm/extensions/session-flow/index.ts +0 -96
  520. package/.xtrm/extensions/session-flow/package.json +0 -19
  521. package/.xtrm/extensions/xtrm-loader/index.ts +0 -152
  522. package/.xtrm/extensions/xtrm-loader/package.json +0 -19
  523. package/.xtrm/extensions/xtrm-ui/format.ts +0 -93
  524. package/.xtrm/extensions/xtrm-ui/index.ts +0 -1053
  525. package/.xtrm/extensions/xtrm-ui/package.json +0 -10
  526. package/.xtrm/extensions/xtrm-ui/themes/pidex-dark.json +0 -85
  527. package/.xtrm/extensions/xtrm-ui/themes/pidex-light.json +0 -85
@@ -8212,7 +8212,7 @@ var require_dist = __commonJS({
8212
8212
  });
8213
8213
  };
8214
8214
  }
8215
- var prompts5 = require_prompts();
8215
+ var prompts6 = require_prompts();
8216
8216
  var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
8217
8217
  var noop = () => {
8218
8218
  };
@@ -8263,7 +8263,7 @@ var require_dist = __commonJS({
8263
8263
  var _question2 = question;
8264
8264
  name = _question2.name;
8265
8265
  type = _question2.type;
8266
- if (prompts5[type] === void 0) {
8266
+ if (prompts6[type] === void 0) {
8267
8267
  throw new Error(`prompt type (${type}) is not defined`);
8268
8268
  }
8269
8269
  if (override2[question.name] !== void 0) {
@@ -8274,7 +8274,7 @@ var require_dist = __commonJS({
8274
8274
  }
8275
8275
  }
8276
8276
  try {
8277
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts5[type](question);
8277
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts6[type](question);
8278
8278
  answers[name] = answer = yield getFormattedAnswer(question, answer, true);
8279
8279
  quit = yield onSubmit(question, answer, answers);
8280
8280
  } catch (err) {
@@ -8306,7 +8306,7 @@ var require_dist = __commonJS({
8306
8306
  }
8307
8307
  module2.exports = Object.assign(prompt, {
8308
8308
  prompt,
8309
- prompts: prompts5,
8309
+ prompts: prompts6,
8310
8310
  inject,
8311
8311
  override
8312
8312
  });
@@ -10393,7 +10393,7 @@ var require_prompts2 = __commonJS({
10393
10393
  var require_lib2 = __commonJS({
10394
10394
  "../node_modules/prompts/lib/index.js"(exports2, module2) {
10395
10395
  "use strict";
10396
- var prompts5 = require_prompts2();
10396
+ var prompts6 = require_prompts2();
10397
10397
  var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
10398
10398
  var noop = () => {
10399
10399
  };
@@ -10425,7 +10425,7 @@ var require_lib2 = __commonJS({
10425
10425
  throw new Error("prompt message is required");
10426
10426
  }
10427
10427
  ({ name, type } = question);
10428
- if (prompts5[type] === void 0) {
10428
+ if (prompts6[type] === void 0) {
10429
10429
  throw new Error(`prompt type (${type}) is not defined`);
10430
10430
  }
10431
10431
  if (override2[question.name] !== void 0) {
@@ -10436,7 +10436,7 @@ var require_lib2 = __commonJS({
10436
10436
  }
10437
10437
  }
10438
10438
  try {
10439
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts5[type](question);
10439
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts6[type](question);
10440
10440
  answers[name] = answer = await getFormattedAnswer(question, answer, true);
10441
10441
  quit = await onSubmit(question, answer, answers);
10442
10442
  } catch (err) {
@@ -10459,7 +10459,7 @@ var require_lib2 = __commonJS({
10459
10459
  function override(answers) {
10460
10460
  prompt._override = Object.assign({}, answers);
10461
10461
  }
10462
- module2.exports = Object.assign(prompt, { prompt, prompts: prompts5, inject, override });
10462
+ module2.exports = Object.assign(prompt, { prompt, prompts: prompts6, inject, override });
10463
10463
  }
10464
10464
  });
10465
10465
 
@@ -29517,7 +29517,7 @@ var kleur_default = $;
29517
29517
 
29518
29518
  // src/commands/claude.ts
29519
29519
  var import_node_child_process2 = require("child_process");
29520
- var import_fs_extra9 = __toESM(require_lib(), 1);
29520
+ var import_fs_extra8 = __toESM(require_lib(), 1);
29521
29521
  var import_node_path6 = __toESM(require("path"), 1);
29522
29522
 
29523
29523
  // src/utils/repo-root.ts
@@ -29784,11 +29784,14 @@ var import_node_path5 = __toESM(require("path"), 1);
29784
29784
  var import_node_child_process = require("child_process");
29785
29785
  var import_node_fs = require("fs");
29786
29786
 
29787
- // src/core/pi-runtime.ts
29788
- var import_child_process2 = require("child_process");
29789
- var import_fs_extra7 = __toESM(require_lib(), 1);
29787
+ // src/core/skills-scaffold.ts
29790
29788
  var import_path3 = __toESM(require("path"), 1);
29791
- var import_node_os = require("os");
29789
+ var import_fs_extra7 = __toESM(require_lib(), 1);
29790
+
29791
+ // src/core/skills-materializer.ts
29792
+ var import_node_crypto = require("crypto");
29793
+ var import_node_path4 = __toESM(require("path"), 1);
29794
+ var import_fs_extra6 = __toESM(require_lib(), 1);
29792
29795
 
29793
29796
  // src/core/skills-layout.ts
29794
29797
  var import_node_path = __toESM(require("path"), 1);
@@ -43760,11 +43763,6 @@ async function validateSkillsInvariants(skillsRoot) {
43760
43763
  return violations;
43761
43764
  }
43762
43765
 
43763
- // src/core/skills-materializer.ts
43764
- var import_node_crypto = require("crypto");
43765
- var import_node_path4 = __toESM(require("path"), 1);
43766
- var import_fs_extra6 = __toESM(require_lib(), 1);
43767
-
43768
43766
  // src/core/skills-state.ts
43769
43767
  var import_fs_extra5 = __toESM(require_lib(), 1);
43770
43768
  var runtimeEnabledPacksSchema = external_exports.strictObject({
@@ -43965,562 +43963,33 @@ async function rebuildAllRuntimeActiveViews(skillsRoot) {
43965
43963
  return results;
43966
43964
  }
43967
43965
 
43968
- // src/core/pi-runtime.ts
43969
- function resolvePkgRoot() {
43970
- const candidates = [
43971
- import_path3.default.resolve(__dirname, "../.."),
43972
- import_path3.default.resolve(__dirname, "../../..")
43973
- ];
43974
- for (const c of candidates) {
43975
- if (import_fs_extra7.default.existsSync(import_path3.default.join(c, ".xtrm", "extensions"))) return c;
43976
- }
43977
- return candidates[0];
43978
- }
43979
- var PI_AGENT_DIR = process.env.PI_AGENT_DIR || import_path3.default.join((0, import_node_os.homedir)(), ".pi", "agent");
43980
- var PI_MCP_ADAPTER_OVERRIDE_DIR = import_path3.default.join(PI_AGENT_DIR, "extensions", "pi-mcp-adapter");
43981
- var PI_MCP_ADAPTER_REQUIRED_ENTRY = "commands.js";
43982
- var PROJECT_EXTENSIONS_ENTRY = "../.xtrm/extensions";
43983
- var PROJECT_SKILLS_ENTRY = "../.xtrm/skills/active/pi";
43984
- var MANAGED_EXTENSIONS = [
43985
- { id: "core", displayName: "@xtrm/pi-core", isLibrary: true, required: true },
43986
- { id: "auto-session-name", displayName: "auto-session-name", required: false },
43987
- { id: "auto-update", displayName: "auto-update", required: false },
43988
- { id: "beads", displayName: "beads", required: true },
43989
- { id: "compact-header", displayName: "compact-header", required: false },
43990
- { id: "custom-footer", displayName: "custom-footer", required: true },
43991
- { id: "custom-provider-qwen-cli", displayName: "custom-provider-qwen-cli", required: false },
43992
- { id: "git-checkpoint", displayName: "git-checkpoint", required: false },
43993
- { id: "lsp-bootstrap", displayName: "lsp-bootstrap", required: false },
43994
- { id: "pi-serena-compact", displayName: "pi-serena-compact", required: false },
43995
- { id: "quality-gates", displayName: "quality-gates", required: true },
43996
- { id: "service-skills", displayName: "service-skills", required: false },
43997
- { id: "session-flow", displayName: "session-flow", required: true },
43998
- { id: "xtrm-loader", displayName: "xtrm-loader", required: true },
43999
- { id: "xtrm-ui", displayName: "xtrm-ui", required: true }
44000
- ];
44001
- var MANAGED_PACKAGES = [
44002
- { id: "npm:pi-gitnexus", displayName: "pi-gitnexus", required: true },
44003
- { id: "npm:pi-serena-tools", displayName: "pi-serena-tools", required: true },
44004
- { id: "npm:@zenobius/pi-worktrees", displayName: "pi-worktrees", required: true },
44005
- { id: "npm:@robhowley/pi-structured-return", displayName: "pi-structured-return", required: true },
44006
- { id: "npm:@aliou/pi-guardrails", displayName: "pi-guardrails", required: false },
44007
- { id: "npm:@aliou/pi-processes", displayName: "pi-processes", required: true }
44008
- ];
44009
- function getInstalledPiPackages() {
44010
- const result = (0, import_child_process2.spawnSync)("pi", ["list"], { encoding: "utf8", stdio: "pipe" });
44011
- if (result.status !== 0) return [];
44012
- const output = result.stdout;
44013
- const packages = [];
44014
- for (const line of output.split("\n")) {
44015
- const match = line.match(/^\s+(npm:[\w\-/@]+)/);
44016
- if (match) packages.push(match[1]);
44017
- }
44018
- return packages.sort();
44019
- }
44020
- async function listInstalledExtensions(targetDir) {
44021
- if (!await import_fs_extra7.default.pathExists(targetDir)) return [];
44022
- const entries = await import_fs_extra7.default.readdir(targetDir, { withFileTypes: true });
44023
- return entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name).sort();
44024
- }
44025
- async function inventoryPiRuntime(sourceDir, targetDir) {
44026
- const installedExtNames = await listInstalledExtensions(targetDir);
44027
- const extensionStatuses = [];
44028
- const missingExtensions = [];
44029
- const staleExtensions = [];
44030
- const orphanedExtensions = [];
44031
- for (const ext of MANAGED_EXTENSIONS) {
44032
- const srcPath = import_path3.default.join(sourceDir, ext.id);
44033
- const dstPath = import_path3.default.join(targetDir, ext.id);
44034
- const srcExists = await import_fs_extra7.default.pathExists(srcPath);
44035
- const dstExists = await import_fs_extra7.default.pathExists(dstPath);
44036
- if (!srcExists) {
44037
- continue;
44038
- }
44039
- if (!dstExists) {
44040
- const status2 = { ext, installed: false };
44041
- extensionStatuses.push(status2);
44042
- missingExtensions.push(status2);
44043
- continue;
44044
- }
44045
- let isStale = false;
44046
- if (srcPath !== dstPath) {
44047
- const dstStat = await import_fs_extra7.default.lstat(dstPath);
44048
- if (dstStat.isSymbolicLink()) {
44049
- const linkTarget = await import_fs_extra7.default.readlink(dstPath);
44050
- const resolvedTarget = import_path3.default.resolve(import_path3.default.dirname(dstPath), linkTarget);
44051
- isStale = resolvedTarget !== import_path3.default.resolve(srcPath);
44052
- } else {
44053
- isStale = true;
44054
- }
44055
- }
44056
- const status = {
44057
- ext,
44058
- installed: true,
44059
- stale: isStale
44060
- };
44061
- extensionStatuses.push(status);
44062
- if (isStale) {
44063
- staleExtensions.push(status);
44064
- }
44065
- }
44066
- const managedIds = new Set(MANAGED_EXTENSIONS.map((e) => e.id));
44067
- for (const name of installedExtNames) {
44068
- if (!managedIds.has(name)) {
44069
- orphanedExtensions.push(name);
44070
- }
44071
- }
44072
- const installedPkgIds = getInstalledPiPackages();
44073
- const packageStatuses = [];
44074
- const missingPackages = [];
44075
- for (const pkg of MANAGED_PACKAGES) {
44076
- const isInstalled = installedPkgIds.includes(pkg.id);
44077
- const status = { pkg, installed: isInstalled };
44078
- packageStatuses.push(status);
44079
- if (!isInstalled) {
44080
- missingPackages.push(status);
44081
- }
44082
- }
44083
- const allRequiredPresent = missingExtensions.every((s) => !s.ext.required) && staleExtensions.every((s) => !s.ext.required) && missingPackages.every((s) => !s.pkg.required);
44084
- const allPresent = missingExtensions.length === 0 && staleExtensions.length === 0 && orphanedExtensions.length === 0 && missingPackages.length === 0;
44085
- return {
44086
- extensions: extensionStatuses,
44087
- packages: packageStatuses,
44088
- missingExtensions,
44089
- staleExtensions,
44090
- orphanedExtensions,
44091
- missingPackages,
44092
- allRequiredPresent,
44093
- allPresent
44094
- };
44095
- }
44096
- function renderPiRuntimePlan(plan) {
44097
- console.log(kleur_default.bold("\n Pi Runtime"));
44098
- console.log(kleur_default.dim(" " + "-".repeat(50)));
44099
- const extTotal = plan.extensions.length;
44100
- const extOk = plan.extensions.filter((s) => s.installed && !s.stale).length;
44101
- console.log(kleur_default.dim(` Extensions: ${extOk}/${extTotal} up-to-date`));
44102
- if (plan.missingExtensions.length > 0) {
44103
- const names = plan.missingExtensions.map((s) => s.ext.displayName).join(", ");
44104
- console.log(kleur_default.yellow(` Missing: ${names}`));
44105
- }
44106
- if (plan.staleExtensions.length > 0) {
44107
- const names = plan.staleExtensions.map((s) => s.ext.displayName).join(", ");
44108
- console.log(kleur_default.yellow(` Stale: ${names}`));
44109
- }
44110
- if (plan.orphanedExtensions.length > 0) {
44111
- const names = plan.orphanedExtensions.join(", ");
44112
- console.log(kleur_default.red(` Orphaned: ${names} (will remove)`));
44113
- }
44114
- const pkgTotal = plan.packages.length;
44115
- const pkgOk = plan.packages.filter((s) => s.installed).length;
44116
- console.log(kleur_default.dim(` Packages: ${pkgOk}/${pkgTotal} installed`));
44117
- if (plan.missingPackages.length > 0) {
44118
- const names = plan.missingPackages.map((s) => s.pkg.displayName).join(", ");
44119
- console.log(kleur_default.yellow(` Missing: ${names}`));
44120
- }
44121
- console.log(kleur_default.dim(" " + "-".repeat(50)));
44122
- if (plan.allPresent) {
44123
- console.log(t.success(" \u2713 All extensions and packages present.\n"));
44124
- } else if (plan.allRequiredPresent) {
44125
- console.log(t.success(" \u2713 All required items present."));
44126
- const optionalMissing = [
44127
- ...plan.missingExtensions.filter((s) => !s.ext.required),
44128
- ...plan.missingPackages.filter((s) => !s.pkg.required)
44129
- ];
44130
- if (optionalMissing.length > 0) {
44131
- const names = optionalMissing.map(
44132
- (s) => "ext" in s ? s.ext.displayName : s.pkg.displayName
44133
- ).join(", ");
44134
- console.log(kleur_default.dim(` \u25CB Optional not installed: ${names}
44135
- `));
44136
- } else {
44137
- console.log("");
44138
- }
44139
- } else {
44140
- console.log(kleur_default.yellow(" \u26A0 Missing required items.\n"));
44141
- }
44142
- }
44143
- function mergePiSyncResults(base, incoming) {
44144
- return {
44145
- extensionsAdded: [...base.extensionsAdded, ...incoming.extensionsAdded],
44146
- extensionsUpdated: [...base.extensionsUpdated, ...incoming.extensionsUpdated],
44147
- extensionsRemoved: [...base.extensionsRemoved, ...incoming.extensionsRemoved],
44148
- packagesInstalled: [...base.packagesInstalled, ...incoming.packagesInstalled],
44149
- failed: [...base.failed, ...incoming.failed]
44150
- };
44151
- }
44152
- async function ensureCorePackageSymlink(coreSrcDir, projectRoot, dryRun, log) {
44153
- if (!await import_fs_extra7.default.pathExists(coreSrcDir)) return "missing-source";
44154
- const extensionsDir = import_path3.default.join(projectRoot, ".xtrm", "extensions");
44155
- const nodeModulesDir = import_path3.default.join(extensionsDir, "node_modules", "@xtrm");
44156
- const symlinkPath = import_path3.default.join(nodeModulesDir, "pi-core");
44157
- const expectedTarget = import_path3.default.resolve(coreSrcDir);
44158
- const existing = await import_fs_extra7.default.lstat(symlinkPath).catch(() => null);
44159
- if (existing) {
44160
- if (existing.isSymbolicLink()) {
44161
- const currentLinkTarget = await import_fs_extra7.default.readlink(symlinkPath);
44162
- const resolvedTarget = import_path3.default.resolve(import_path3.default.dirname(symlinkPath), currentLinkTarget);
44163
- if (resolvedTarget === expectedTarget) {
44164
- return "ok";
44165
- }
44166
- }
44167
- if (dryRun) {
44168
- log?.(kleur_default.dim("[DRY RUN] would repair @xtrm/pi-core symlink target"));
44169
- return "would-repair";
44170
- }
44171
- await import_fs_extra7.default.remove(symlinkPath);
44172
- await import_fs_extra7.default.ensureDir(nodeModulesDir);
44173
- const relTarget2 = import_path3.default.relative(nodeModulesDir, coreSrcDir);
44174
- await import_fs_extra7.default.symlink(relTarget2, symlinkPath);
44175
- log?.(kleur_default.dim("Repaired @xtrm/pi-core symlink \u2192 .xtrm/extensions/node_modules/@xtrm/pi-core"));
44176
- return "repaired";
44177
- }
44178
- if (dryRun) {
44179
- log?.(kleur_default.dim("[DRY RUN] would create @xtrm/pi-core symlink"));
44180
- return "would-create";
44181
- }
44182
- await import_fs_extra7.default.ensureDir(nodeModulesDir);
44183
- const relTarget = import_path3.default.relative(nodeModulesDir, coreSrcDir);
44184
- await import_fs_extra7.default.symlink(relTarget, symlinkPath);
44185
- log?.(kleur_default.dim("Created @xtrm/pi-core symlink \u2192 .xtrm/extensions/node_modules/@xtrm/pi-core"));
44186
- return "created";
44187
- }
44188
- async function remediateStalePiMcpAdapterOverride(dryRun, log) {
44189
- const stat = await import_fs_extra7.default.lstat(PI_MCP_ADAPTER_OVERRIDE_DIR).catch(() => null);
44190
- if (!stat) {
44191
- return {
44192
- path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44193
- found: false,
44194
- stale: false,
44195
- remediated: false
44196
- };
44197
- }
44198
- if (stat.isSymbolicLink()) {
44199
- return {
44200
- path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44201
- found: true,
44202
- stale: false,
44203
- remediated: false
44204
- };
44205
- }
44206
- const hasRequiredEntry = await import_fs_extra7.default.pathExists(import_path3.default.join(PI_MCP_ADAPTER_OVERRIDE_DIR, PI_MCP_ADAPTER_REQUIRED_ENTRY));
44207
- if (stat.isDirectory() && hasRequiredEntry) {
44208
- return {
44209
- path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44210
- found: true,
44211
- stale: false,
44212
- remediated: false
44213
- };
44214
- }
44215
- const reason = stat.isDirectory() ? `missing ${PI_MCP_ADAPTER_REQUIRED_ENTRY}` : "not a directory/symlink";
44216
- if (dryRun) {
44217
- log?.(kleur_default.dim(`[DRY RUN] would remove stale pi-mcp-adapter override (${reason})`));
44218
- return {
44219
- path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44220
- found: true,
44221
- stale: true,
44222
- remediated: false,
44223
- reason
44224
- };
44225
- }
44226
- await import_fs_extra7.default.remove(PI_MCP_ADAPTER_OVERRIDE_DIR);
44227
- log?.(kleur_default.dim(`Removed stale pi-mcp-adapter override (${reason})`));
44228
- return {
44229
- path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44230
- found: true,
44231
- stale: true,
44232
- remediated: true,
44233
- reason
44234
- };
44235
- }
44236
- async function runPiLaunchPreflight(projectRoot, dryRun, log) {
44237
- const staleOverride = await remediateStalePiMcpAdapterOverride(dryRun, log);
44238
- const coreSymlinkStatus = await ensureCorePackageSymlink(
44239
- import_path3.default.join(projectRoot, ".xtrm", "extensions", "core"),
44240
- projectRoot,
44241
- dryRun,
44242
- log
44243
- );
44244
- return {
44245
- coreSymlinkStatus,
44246
- staleOverride
44247
- };
44248
- }
44249
- function isXtrmExtensionsSetting(entry) {
44250
- const normalizedEntry = entry.replaceAll("\\", "/").replace(/\/$/, "");
44251
- return normalizedEntry === PROJECT_EXTENSIONS_ENTRY || normalizedEntry === ".xtrm/extensions";
44252
- }
44253
- async function cleanupLegacyProjectExtensionCopies(projectRoot, dryRun, log) {
44254
- const piSettingsPath = import_path3.default.join(projectRoot, ".pi", "settings.json");
44255
- let existingSettings = {};
44256
- try {
44257
- existingSettings = await import_fs_extra7.default.readJson(piSettingsPath);
44258
- } catch {
44259
- return { removed: [], failed: [] };
44260
- }
44261
- const pointsToXtrmExtensions = (existingSettings.extensions ?? []).some(isXtrmExtensionsSetting);
44262
- if (!pointsToXtrmExtensions) return { removed: [], failed: [] };
44263
- const legacyExtensionsDir = import_path3.default.join(projectRoot, ".pi", "extensions");
44264
- if (!await import_fs_extra7.default.pathExists(legacyExtensionsDir)) return { removed: [], failed: [] };
44265
- const removed = [];
44266
- const failed = [];
44267
- for (const ext of MANAGED_EXTENSIONS) {
44268
- const legacyExtPath = import_path3.default.join(legacyExtensionsDir, ext.id);
44269
- const legacyStat = await import_fs_extra7.default.lstat(legacyExtPath).catch(() => null);
44270
- if (!legacyStat || legacyStat.isSymbolicLink() || !legacyStat.isDirectory()) {
44271
- continue;
44272
- }
44273
- if (dryRun) {
44274
- log?.(kleur_default.dim(`[DRY RUN] - .pi/extensions/${ext.id} (legacy copy)`));
44275
- continue;
44276
- }
44277
- try {
44278
- await import_fs_extra7.default.remove(legacyExtPath);
44279
- removed.push(ext.id);
44280
- log?.(kleur_default.dim(`Removed legacy .pi/extensions/${ext.id}`));
44281
- } catch (err) {
44282
- failed.push(ext.id);
44283
- log?.(kleur_default.red(`\u2717 Failed to remove legacy .pi/extensions/${ext.id}: ${err}`));
44284
- }
44285
- }
44286
- return { removed, failed };
44287
- }
44288
- async function updatePiSettings(projectRoot, dryRun, log) {
44289
- const piSettingsPath = import_path3.default.join(projectRoot, ".pi", "settings.json");
44290
- if (dryRun) {
44291
- log?.(kleur_default.dim(`[DRY RUN] would update .pi/settings.json`));
44292
- return;
44293
- }
44294
- let existingSettings = {};
44295
- try {
44296
- existingSettings = await import_fs_extra7.default.readJson(piSettingsPath);
44297
- } catch {
44298
- }
44299
- const existingPackages = (existingSettings.packages ?? []).filter(
44300
- (p) => !p.startsWith("./extensions/")
44301
- );
44302
- await import_fs_extra7.default.ensureDir(import_path3.default.join(projectRoot, ".pi"));
44303
- await import_fs_extra7.default.writeJson(piSettingsPath, {
44304
- ...existingSettings,
44305
- extensions: [PROJECT_EXTENSIONS_ENTRY],
44306
- skills: [PROJECT_SKILLS_ENTRY],
44307
- packages: existingPackages
44308
- }, { spaces: 2 });
44309
- log?.(kleur_default.dim(`Updated .pi/settings.json \u2192 .xtrm/extensions + .xtrm/skills/active/pi`));
44310
- }
44311
- async function executePiSync(plan, sourceDir, targetDir, opts = {}) {
44312
- const {
44313
- dryRun = false,
44314
- isGlobal = false,
44315
- projectRoot,
44316
- removeOrphaned = true,
44317
- log = (msg) => console.log(kleur_default.dim(` ${msg}`))
44318
- } = opts;
44319
- const result = {
44320
- extensionsAdded: [],
44321
- extensionsUpdated: [],
44322
- extensionsRemoved: [],
44323
- packagesInstalled: [],
44324
- failed: []
44325
- };
44326
- if (!dryRun) {
44327
- await import_fs_extra7.default.ensureDir(targetDir);
44328
- }
44329
- const toSync = [...plan.missingExtensions, ...plan.staleExtensions];
44330
- for (const status of toSync) {
44331
- const { ext } = status;
44332
- const srcPath = import_path3.default.join(sourceDir, ext.id);
44333
- const dstPath = import_path3.default.join(targetDir, ext.id);
44334
- if (dryRun) {
44335
- log(`[DRY RUN] ${status.installed ? "\u21BB" : "+"} ${ext.displayName}`);
44336
- continue;
44337
- }
44338
- try {
44339
- await import_fs_extra7.default.remove(dstPath);
44340
- const relTarget = import_path3.default.relative(targetDir, srcPath);
44341
- await import_fs_extra7.default.symlink(relTarget, dstPath);
44342
- if (status.installed) {
44343
- result.extensionsUpdated.push(ext.id);
44344
- log(`\u21BB ${ext.displayName} (symlinked)`);
44345
- } else {
44346
- result.extensionsAdded.push(ext.id);
44347
- log(`+ ${ext.displayName} (symlinked)`);
44348
- }
44349
- } catch (err) {
44350
- result.failed.push(ext.id);
44351
- log(kleur_default.red(`\u2717 ${ext.displayName}: ${err}`));
44352
- }
44353
- }
44354
- if (removeOrphaned && plan.orphanedExtensions.length > 0) {
44355
- for (const orphanId of plan.orphanedExtensions) {
44356
- const orphanPath = import_path3.default.join(targetDir, orphanId);
44357
- if (dryRun) {
44358
- log(kleur_default.red(`[DRY RUN] - ${orphanId} (orphaned)`));
44359
- continue;
44360
- }
44361
- try {
44362
- await import_fs_extra7.default.remove(orphanPath);
44363
- result.extensionsRemoved.push(orphanId);
44364
- log(kleur_default.red(`- ${orphanId} (orphaned)`));
44365
- } catch (err) {
44366
- result.failed.push(orphanId);
44367
- log(kleur_default.red(`\u2717 ${orphanId}: ${err}`));
44368
- }
44369
- }
44370
- }
44371
- for (const status of plan.missingPackages) {
44372
- const { pkg } = status;
44373
- const installArgs = isGlobal ? ["install", pkg.id] : ["install", pkg.id, "-l"];
44374
- if (dryRun) {
44375
- log(`[DRY RUN] pi ${installArgs.join(" ")}`);
44376
- continue;
44377
- }
44378
- try {
44379
- const r = (0, import_child_process2.spawnSync)("pi", installArgs, { stdio: "pipe", encoding: "utf8" });
44380
- if (r.status === 0) {
44381
- result.packagesInstalled.push(pkg.id);
44382
- log(`${sym.ok} ${pkg.displayName}`);
44383
- } else {
44384
- result.failed.push(pkg.id);
44385
- log(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 install failed`));
44386
- }
44387
- } catch (err) {
44388
- result.failed.push(pkg.id);
44389
- log(kleur_default.red(`\u2717 ${pkg.displayName}: ${err}`));
44390
- }
44391
- }
44392
- return result;
44393
- }
44394
- async function runPiRuntimeSync(opts = {}) {
44395
- const { dryRun = false, isGlobal = false, projectRoot } = opts;
44396
- const pkgRoot = resolvePkgRoot();
44397
- const sourceDir = import_path3.default.join(pkgRoot, ".xtrm", "extensions");
44398
- const resolvedProjectRoot = projectRoot || process.cwd();
44399
- const log = (msg) => console.log(kleur_default.dim(` ${msg}`));
44400
- const emptyResult = {
44401
- extensionsAdded: [],
44402
- extensionsUpdated: [],
44403
- extensionsRemoved: [],
44404
- packagesInstalled: [],
44405
- failed: []
44406
- };
44407
- const result = { ...emptyResult };
44408
- if (!await import_fs_extra7.default.pathExists(sourceDir)) {
44409
- console.log(kleur_default.dim("\n Managed extensions: skipped (not bundled in npm package)\n"));
44410
- return result;
44411
- }
44412
- const preflight = await runPiLaunchPreflight(resolvedProjectRoot, dryRun, log);
44413
- if (preflight.staleOverride.remediated) {
44414
- result.extensionsRemoved.push("pi-mcp-adapter");
44415
- }
44416
- if (isGlobal) {
44417
- const targetDir = import_path3.default.join(PI_AGENT_DIR, "extensions");
44418
- const plan = await inventoryPiRuntime(sourceDir, targetDir);
44419
- renderPiRuntimePlan(plan);
44420
- if (plan.allPresent) return result;
44421
- const synced = await executePiSync(plan, sourceDir, targetDir, {
44422
- dryRun,
44423
- isGlobal: true,
44424
- removeOrphaned: true
44425
- });
44426
- return mergePiSyncResults(result, synced);
44427
- }
44428
- const installedPkgIds = getInstalledPiPackages();
44429
- const packageStatuses = [];
44430
- const missingPackages = [];
44431
- for (const pkg of MANAGED_PACKAGES) {
44432
- const isInstalled = installedPkgIds.includes(pkg.id);
44433
- const status = { pkg, installed: isInstalled };
44434
- packageStatuses.push(status);
44435
- if (!isInstalled) missingPackages.push(status);
44436
- }
44437
- console.log(kleur_default.bold("\n Pi Runtime"));
44438
- console.log(kleur_default.dim(" " + "-".repeat(50)));
44439
- console.log(kleur_default.dim(` Extensions: via .xtrm/extensions (settings.json)`));
44440
- const pkgOk = packageStatuses.filter((s) => s.installed).length;
44441
- console.log(kleur_default.dim(` Packages: ${pkgOk}/${packageStatuses.length} installed`));
44442
- if (missingPackages.length > 0) {
44443
- const names = missingPackages.map((s) => s.pkg.displayName).join(", ");
44444
- console.log(kleur_default.yellow(` Missing: ${names}`));
44445
- }
44446
- console.log(kleur_default.dim(" " + "-".repeat(50)));
44447
- const legacyCleanup = await cleanupLegacyProjectExtensionCopies(resolvedProjectRoot, dryRun, log);
44448
- result.extensionsRemoved.push(...legacyCleanup.removed);
44449
- result.failed.push(...legacyCleanup.failed);
44450
- for (const status of missingPackages) {
44451
- const { pkg } = status;
44452
- if (dryRun) {
44453
- log(`[DRY RUN] pi install ${pkg.id} -l`);
44454
- continue;
44455
- }
44456
- try {
44457
- const r = (0, import_child_process2.spawnSync)("pi", ["install", pkg.id, "-l"], { stdio: "pipe", encoding: "utf8" });
44458
- if (r.status === 0) {
44459
- result.packagesInstalled.push(pkg.id);
44460
- log(`${sym.ok} ${pkg.displayName}`);
44461
- } else {
44462
- result.failed.push(pkg.id);
44463
- log(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 install failed`));
44464
- }
44465
- } catch (err) {
44466
- result.failed.push(pkg.id);
44467
- log(kleur_default.red(`\u2717 ${pkg.displayName}: ${err}`));
44468
- }
44469
- }
44470
- const skillsRoot = resolveSkillsRoot(resolvedProjectRoot);
44471
- if (await import_fs_extra7.default.pathExists(import_path3.default.join(skillsRoot, "default"))) {
44472
- const invariantViolations = await validateSkillsInvariants(skillsRoot);
44473
- if (invariantViolations.length > 0) {
44474
- const summary = invariantViolations.map((violation) => `${violation.code}: ${violation.message}`).join("; ");
44475
- throw new Error(`Skills invariants failed. ${summary}`);
44476
- }
44477
- if (!dryRun) {
44478
- await rebuildRuntimeActiveView("pi", skillsRoot);
44479
- }
44480
- }
44481
- await updatePiSettings(resolvedProjectRoot, dryRun, log);
44482
- const requiredFailed = missingPackages.filter(
44483
- (s) => s.pkg.required && result.failed.includes(s.pkg.id)
44484
- );
44485
- if (missingPackages.length === 0 || result.failed.length === 0) {
44486
- console.log(t.success(" \u2713 All required items present.\n"));
44487
- } else if (requiredFailed.length === 0) {
44488
- console.log(t.success(" \u2713 All required items present.\n"));
44489
- } else {
44490
- console.log(kleur_default.yellow(" \u26A0 Missing required items.\n"));
44491
- }
44492
- return result;
44493
- }
44494
-
44495
43966
  // src/core/skills-scaffold.ts
44496
- var import_path4 = __toESM(require("path"), 1);
44497
- var import_fs_extra8 = __toESM(require_lib(), 1);
44498
43967
  async function ensureSkillsSymlink(linkPath, symlinkTarget, label) {
44499
- const existing = await import_fs_extra8.default.lstat(linkPath).catch(() => null);
43968
+ const existing = await import_fs_extra7.default.lstat(linkPath).catch(() => null);
44500
43969
  if (existing) {
44501
43970
  if (existing.isSymbolicLink()) {
44502
- const current = await import_fs_extra8.default.readlink(linkPath);
43971
+ const current = await import_fs_extra7.default.readlink(linkPath);
44503
43972
  if (current === symlinkTarget) {
44504
43973
  console.log(kleur_default.dim(` \u2713 ${label} symlink already in place`));
44505
43974
  return;
44506
43975
  }
44507
- await import_fs_extra8.default.remove(linkPath);
43976
+ await import_fs_extra7.default.remove(linkPath);
44508
43977
  } else {
44509
43978
  if (label === ".claude/skills") {
44510
43979
  console.log(kleur_default.yellow(" \u26A0 .claude/skills is a runtime-managed read-only view; direct writes are unsupported."));
44511
43980
  console.log(kleur_default.yellow(" Move custom skills to .xtrm/skills/default or .xtrm/skills/{optional,user}/packs/* and rebuild."));
44512
43981
  }
44513
- await import_fs_extra8.default.remove(linkPath);
43982
+ await import_fs_extra7.default.remove(linkPath);
44514
43983
  console.log(kleur_default.yellow(` \u26A0 ${label} was a real path \u2014 replaced with managed symlink`));
44515
43984
  }
44516
43985
  }
44517
- await import_fs_extra8.default.mkdirp(import_path4.default.dirname(linkPath));
44518
- await import_fs_extra8.default.symlink(symlinkTarget, linkPath);
43986
+ await import_fs_extra7.default.mkdirp(import_path3.default.dirname(linkPath));
43987
+ await import_fs_extra7.default.symlink(symlinkTarget, linkPath);
44519
43988
  console.log(`${kleur_default.green(" \u2713")} ${label} \u2192 ${symlinkTarget}`);
44520
43989
  }
44521
43990
  async function ensureAgentsSkillsSymlink(projectRoot) {
44522
43991
  const skillsRoot = resolveSkillsRoot(projectRoot);
44523
- if (!await import_fs_extra8.default.pathExists(import_path4.default.join(skillsRoot, "default"))) {
43992
+ if (!await import_fs_extra7.default.pathExists(import_path3.default.join(skillsRoot, "default"))) {
44524
43993
  return {
44525
43994
  activatedClaudeSkills: 0,
44526
43995
  activatedPiSkills: 0
@@ -44535,12 +44004,12 @@ async function ensureAgentsSkillsSymlink(projectRoot) {
44535
44004
  const activatedClaudeSkills = materializedViews.find((view) => view.runtime === "claude")?.discoveredSkillCount ?? 0;
44536
44005
  const activatedPiSkills = materializedViews.find((view) => view.runtime === "pi")?.discoveredSkillCount ?? 0;
44537
44006
  await ensureSkillsSymlink(
44538
- import_path4.default.join(projectRoot, ".claude", "skills"),
44539
- import_path4.default.join("..", ".xtrm", "skills", "active", "claude"),
44007
+ import_path3.default.join(projectRoot, ".claude", "skills"),
44008
+ import_path3.default.join("..", ".xtrm", "skills", "active", "claude"),
44540
44009
  ".claude/skills"
44541
44010
  );
44542
- const agentsSkillsPath = import_path4.default.join(projectRoot, ".agents", "skills");
44543
- if (await import_fs_extra8.default.pathExists(agentsSkillsPath)) {
44011
+ const agentsSkillsPath = import_path3.default.join(projectRoot, ".agents", "skills");
44012
+ if (await import_fs_extra7.default.pathExists(agentsSkillsPath)) {
44544
44013
  console.log(kleur_default.dim(" \u25CB .agents/skills is deprecated; runtime skills are generated under .xtrm/skills/active/*"));
44545
44014
  }
44546
44015
  return {
@@ -44663,30 +44132,6 @@ async function launchWorktreeSession(opts) {
44663
44132
  console.log(kleur_default.green(`
44664
44133
  \u2713 Worktree ready \u2014 launching ${runtime}...
44665
44134
  `));
44666
- if (runtime === "pi") {
44667
- const projectPiDir = import_node_path5.default.join(mainRepoRoot, ".pi");
44668
- const worktreePiDir = import_node_path5.default.join(worktreePath, ".pi");
44669
- if ((0, import_node_fs.existsSync)(projectPiDir) && !(0, import_node_fs.existsSync)(worktreePiDir)) {
44670
- try {
44671
- (0, import_node_fs.symlinkSync)(projectPiDir, worktreePiDir);
44672
- } catch {
44673
- }
44674
- }
44675
- const projectPiNpmDir = import_node_path5.default.join(projectPiDir, "npm");
44676
- const worktreePiNpmDir = import_node_path5.default.join(worktreePiDir, "npm");
44677
- if ((0, import_node_fs.existsSync)(projectPiNpmDir) && !(0, import_node_fs.existsSync)(worktreePiNpmDir)) {
44678
- try {
44679
- (0, import_node_fs.symlinkSync)(projectPiNpmDir, worktreePiNpmDir);
44680
- } catch {
44681
- }
44682
- }
44683
- try {
44684
- await runPiLaunchPreflight(worktreePath, false);
44685
- } catch (error48) {
44686
- const message = error48 instanceof Error ? error48.message : String(error48);
44687
- console.log(kleur_default.dim(` warning: pi launch preflight failed (${message})`));
44688
- }
44689
- }
44690
44135
  if (runtime === "claude") {
44691
44136
  const claudeDir = import_node_path5.default.join(worktreePath, ".claude");
44692
44137
  try {
@@ -44764,7 +44209,7 @@ async function confirmDestructiveAction(opts) {
44764
44209
  }
44765
44210
 
44766
44211
  // src/core/machine-bootstrap.ts
44767
- var import_child_process3 = require("child_process");
44212
+ var import_child_process2 = require("child_process");
44768
44213
  var OFFICIAL_CLAUDE_PLUGINS = ["serena", "context7"];
44769
44214
  var OFFICIAL_MARKETPLACE = "claude-plugins-official";
44770
44215
  var MANAGED_DEPS = [
@@ -44870,7 +44315,7 @@ var MANAGED_DEPS = [
44870
44315
  }
44871
44316
  ];
44872
44317
  function checkDep(dep) {
44873
- const result = (0, import_child_process3.spawnSync)(dep.cli, [dep.versionFlag], {
44318
+ const result = (0, import_child_process2.spawnSync)(dep.cli, [dep.versionFlag], {
44874
44319
  encoding: "utf8",
44875
44320
  stdio: "pipe",
44876
44321
  timeout: 5e3
@@ -44957,7 +44402,7 @@ function executeBootstrap(plan, opts = {}) {
44957
44402
  for (const step of steps) {
44958
44403
  const cmd = step.sudo && process.platform !== "darwin" ? "sudo" : step.cmd;
44959
44404
  const args = step.sudo && process.platform !== "darwin" ? [step.cmd, ...step.args] : step.args;
44960
- const r = (0, import_child_process3.spawnSync)(cmd, args, { stdio: "inherit" });
44405
+ const r = (0, import_child_process2.spawnSync)(cmd, args, { stdio: "inherit" });
44961
44406
  if (r.status !== 0) {
44962
44407
  ok = false;
44963
44408
  break;
@@ -45008,7 +44453,7 @@ function normalizePluginName(name) {
45008
44453
  return atIndex === -1 ? trimmed : trimmed.slice(0, atIndex);
45009
44454
  }
45010
44455
  function readInstalledOfficialPlugins() {
45011
- const listResult = (0, import_child_process3.spawnSync)("claude", ["plugin", "list", "--json"], {
44456
+ const listResult = (0, import_child_process2.spawnSync)("claude", ["plugin", "list", "--json"], {
45012
44457
  encoding: "utf8",
45013
44458
  stdio: "pipe",
45014
44459
  timeout: 1e4
@@ -45036,14 +44481,14 @@ function readInstalledOfficialPlugins() {
45036
44481
  return installedNames;
45037
44482
  }
45038
44483
  function ensureOfficialMarketplace() {
45039
- const listResult = (0, import_child_process3.spawnSync)("claude", ["plugin", "marketplace", "list"], {
44484
+ const listResult = (0, import_child_process2.spawnSync)("claude", ["plugin", "marketplace", "list"], {
45040
44485
  encoding: "utf8",
45041
44486
  stdio: "pipe",
45042
44487
  timeout: 1e4
45043
44488
  });
45044
44489
  const output = listResult.stdout ?? "";
45045
44490
  if (output.includes(OFFICIAL_MARKETPLACE)) return;
45046
- (0, import_child_process3.spawnSync)("claude", [
44491
+ (0, import_child_process2.spawnSync)("claude", [
45047
44492
  "plugin",
45048
44493
  "marketplace",
45049
44494
  "add",
@@ -45051,12 +44496,12 @@ function ensureOfficialMarketplace() {
45051
44496
  ], { stdio: "inherit", timeout: 12e4 });
45052
44497
  }
45053
44498
  function tryInstallOfficialPlugin(pluginName) {
45054
- const directInstall = (0, import_child_process3.spawnSync)("claude", ["plugin", "install", pluginName, "--scope", "user"], { stdio: "inherit" });
44499
+ const directInstall = (0, import_child_process2.spawnSync)("claude", ["plugin", "install", pluginName, "--scope", "user"], { stdio: "inherit" });
45055
44500
  if (directInstall.status === 0) {
45056
44501
  return true;
45057
44502
  }
45058
44503
  const marketplaceQualified = `${pluginName}@${OFFICIAL_MARKETPLACE}`;
45059
- const marketplaceInstall = (0, import_child_process3.spawnSync)("claude", ["plugin", "install", marketplaceQualified, "--scope", "user"], { stdio: "inherit" });
44504
+ const marketplaceInstall = (0, import_child_process2.spawnSync)("claude", ["plugin", "install", marketplaceQualified, "--scope", "user"], { stdio: "inherit" });
45060
44505
  return marketplaceInstall.status === 0;
45061
44506
  }
45062
44507
  function ensureOfficialPlugins(dryRun) {
@@ -45115,9 +44560,9 @@ function getProjectSettingsPath(repoRoot) {
45115
44560
  return import_node_path6.default.join(repoRoot, ".claude", "settings.json");
45116
44561
  }
45117
44562
  function hasXtrmHookWiring(settingsPath) {
45118
- if (!import_fs_extra9.default.existsSync(settingsPath)) return false;
44563
+ if (!import_fs_extra8.default.existsSync(settingsPath)) return false;
45119
44564
  try {
45120
- const data = import_fs_extra9.default.readJsonSync(settingsPath);
44565
+ const data = import_fs_extra8.default.readJsonSync(settingsPath);
45121
44566
  const groups = Object.values(data.hooks ?? {});
45122
44567
  for (const wrappers of groups) {
45123
44568
  for (const wrapper of wrappers) {
@@ -45231,6 +44676,682 @@ var import_fs_extra11 = __toESM(require_lib(), 1);
45231
44676
  var import_path5 = __toESM(require("path"), 1);
45232
44677
  var import_node_child_process3 = require("child_process");
45233
44678
  var import_node_os2 = require("os");
44679
+
44680
+ // src/core/pi-runtime.ts
44681
+ var import_child_process3 = require("child_process");
44682
+ var import_fs_extra9 = __toESM(require_lib(), 1);
44683
+ var import_path4 = __toESM(require("path"), 1);
44684
+ var import_node_os = require("os");
44685
+ function resolvePkgRoot() {
44686
+ const candidates = [
44687
+ import_path4.default.resolve(__dirname, "../.."),
44688
+ import_path4.default.resolve(__dirname, "../../..")
44689
+ ];
44690
+ for (const c of candidates) {
44691
+ if (import_fs_extra9.default.existsSync(import_path4.default.join(c, ".xtrm", "extensions"))) return c;
44692
+ }
44693
+ return candidates[0];
44694
+ }
44695
+ var PI_AGENT_DIR = process.env.PI_AGENT_DIR || import_path4.default.join((0, import_node_os.homedir)(), ".pi", "agent");
44696
+ var PI_MCP_ADAPTER_OVERRIDE_DIR = import_path4.default.join(PI_AGENT_DIR, "extensions", "pi-mcp-adapter");
44697
+ var PI_MCP_ADAPTER_REQUIRED_ENTRY = "commands.js";
44698
+ var PROJECT_EXTENSIONS_ENTRY = "../.xtrm/extensions";
44699
+ var PROJECT_SKILLS_ENTRY = "../.xtrm/skills/active/pi";
44700
+ var MANAGED_EXTENSIONS = [
44701
+ { id: "core", displayName: "@xtrm/pi-core", isLibrary: true, required: true },
44702
+ { id: "auto-session-name", displayName: "auto-session-name", required: false },
44703
+ { id: "auto-update", displayName: "auto-update", required: false },
44704
+ { id: "beads", displayName: "beads", required: true },
44705
+ { id: "compact-header", displayName: "compact-header", required: false },
44706
+ { id: "custom-footer", displayName: "custom-footer", required: true },
44707
+ { id: "custom-provider-qwen-cli", displayName: "custom-provider-qwen-cli", required: false },
44708
+ { id: "git-checkpoint", displayName: "git-checkpoint", required: false },
44709
+ { id: "lsp-bootstrap", displayName: "lsp-bootstrap", required: false },
44710
+ { id: "pi-serena-compact", displayName: "pi-serena-compact", required: false },
44711
+ { id: "quality-gates", displayName: "quality-gates", required: true },
44712
+ { id: "service-skills", displayName: "service-skills", required: false },
44713
+ { id: "session-flow", displayName: "session-flow", required: true },
44714
+ { id: "xtrm-loader", displayName: "xtrm-loader", required: true },
44715
+ { id: "xtrm-ui", displayName: "xtrm-ui", required: true }
44716
+ ];
44717
+ var MANAGED_PACKAGES = [
44718
+ { id: "npm:pi-gitnexus", displayName: "pi-gitnexus", required: true },
44719
+ { id: "npm:pi-serena-tools", displayName: "pi-serena-tools", required: true },
44720
+ { id: "npm:@zenobius/pi-worktrees", displayName: "pi-worktrees", required: true },
44721
+ { id: "npm:@robhowley/pi-structured-return", displayName: "pi-structured-return", required: true },
44722
+ { id: "npm:@aliou/pi-guardrails", displayName: "pi-guardrails", required: false },
44723
+ { id: "npm:@aliou/pi-processes", displayName: "pi-processes", required: true }
44724
+ ];
44725
+ var ALWAYS_GLOBAL_INSTALL_PACKAGE_IDS = /* @__PURE__ */ new Set([
44726
+ "npm:pi-gitnexus",
44727
+ "npm:pi-serena-tools"
44728
+ ]);
44729
+ function getInstalledPiPackages() {
44730
+ const result = (0, import_child_process3.spawnSync)("pi", ["list"], { encoding: "utf8", stdio: "pipe" });
44731
+ if (result.status !== 0) return [];
44732
+ const output = result.stdout;
44733
+ const packages = [];
44734
+ for (const line of output.split("\n")) {
44735
+ const match = line.match(/^\s+(npm:[\w\-/@]+)/);
44736
+ if (match) packages.push(match[1]);
44737
+ }
44738
+ return packages.sort();
44739
+ }
44740
+ async function listInstalledExtensions(targetDir) {
44741
+ if (!await import_fs_extra9.default.pathExists(targetDir)) return [];
44742
+ const entries = await import_fs_extra9.default.readdir(targetDir, { withFileTypes: true });
44743
+ return entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name).sort();
44744
+ }
44745
+ async function inventoryPiRuntime(sourceDir, targetDir) {
44746
+ const installedExtNames = await listInstalledExtensions(targetDir);
44747
+ const extensionStatuses = [];
44748
+ const missingExtensions = [];
44749
+ const staleExtensions = [];
44750
+ const orphanedExtensions = [];
44751
+ for (const ext of MANAGED_EXTENSIONS) {
44752
+ const srcPath = import_path4.default.join(sourceDir, ext.id);
44753
+ const dstPath = import_path4.default.join(targetDir, ext.id);
44754
+ const srcExists = await import_fs_extra9.default.pathExists(srcPath);
44755
+ const dstExists = await import_fs_extra9.default.pathExists(dstPath);
44756
+ if (!srcExists) {
44757
+ continue;
44758
+ }
44759
+ if (!dstExists) {
44760
+ const status2 = { ext, installed: false };
44761
+ extensionStatuses.push(status2);
44762
+ missingExtensions.push(status2);
44763
+ continue;
44764
+ }
44765
+ let isStale = false;
44766
+ if (srcPath !== dstPath) {
44767
+ const dstStat = await import_fs_extra9.default.lstat(dstPath);
44768
+ if (dstStat.isSymbolicLink()) {
44769
+ const linkTarget = await import_fs_extra9.default.readlink(dstPath);
44770
+ const resolvedTarget = import_path4.default.resolve(import_path4.default.dirname(dstPath), linkTarget);
44771
+ isStale = resolvedTarget !== import_path4.default.resolve(srcPath);
44772
+ } else {
44773
+ isStale = true;
44774
+ }
44775
+ }
44776
+ const status = {
44777
+ ext,
44778
+ installed: true,
44779
+ stale: isStale
44780
+ };
44781
+ extensionStatuses.push(status);
44782
+ if (isStale) {
44783
+ staleExtensions.push(status);
44784
+ }
44785
+ }
44786
+ const managedIds = new Set(MANAGED_EXTENSIONS.map((e) => e.id));
44787
+ for (const name of installedExtNames) {
44788
+ if (!managedIds.has(name)) {
44789
+ orphanedExtensions.push(name);
44790
+ }
44791
+ }
44792
+ const installedPkgIds = getInstalledPiPackages();
44793
+ const packageStatuses = [];
44794
+ const missingPackages = [];
44795
+ for (const pkg of MANAGED_PACKAGES) {
44796
+ const isInstalled = installedPkgIds.includes(pkg.id);
44797
+ const status = { pkg, installed: isInstalled };
44798
+ packageStatuses.push(status);
44799
+ if (!isInstalled) {
44800
+ missingPackages.push(status);
44801
+ }
44802
+ }
44803
+ const allRequiredPresent = missingExtensions.every((s) => !s.ext.required) && staleExtensions.every((s) => !s.ext.required) && missingPackages.every((s) => !s.pkg.required);
44804
+ const allPresent = missingExtensions.length === 0 && staleExtensions.length === 0 && orphanedExtensions.length === 0 && missingPackages.length === 0;
44805
+ return {
44806
+ extensions: extensionStatuses,
44807
+ packages: packageStatuses,
44808
+ missingExtensions,
44809
+ staleExtensions,
44810
+ orphanedExtensions,
44811
+ missingPackages,
44812
+ allRequiredPresent,
44813
+ allPresent
44814
+ };
44815
+ }
44816
+ function renderPiRuntimePlan(plan) {
44817
+ console.log(kleur_default.bold("\n Pi Runtime"));
44818
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
44819
+ const extTotal = plan.extensions.length;
44820
+ const extOk = plan.extensions.filter((s) => s.installed && !s.stale).length;
44821
+ console.log(kleur_default.dim(` Extensions: ${extOk}/${extTotal} up-to-date`));
44822
+ if (plan.missingExtensions.length > 0) {
44823
+ const names = plan.missingExtensions.map((s) => s.ext.displayName).join(", ");
44824
+ console.log(kleur_default.yellow(` Missing: ${names}`));
44825
+ }
44826
+ if (plan.staleExtensions.length > 0) {
44827
+ const names = plan.staleExtensions.map((s) => s.ext.displayName).join(", ");
44828
+ console.log(kleur_default.yellow(` Stale: ${names}`));
44829
+ }
44830
+ if (plan.orphanedExtensions.length > 0) {
44831
+ const names = plan.orphanedExtensions.join(", ");
44832
+ console.log(kleur_default.red(` Orphaned: ${names} (will remove)`));
44833
+ }
44834
+ const pkgTotal = plan.packages.length;
44835
+ const pkgOk = plan.packages.filter((s) => s.installed).length;
44836
+ console.log(kleur_default.dim(` Packages: ${pkgOk}/${pkgTotal} installed`));
44837
+ if (plan.missingPackages.length > 0) {
44838
+ const names = plan.missingPackages.map((s) => s.pkg.displayName).join(", ");
44839
+ console.log(kleur_default.yellow(` Missing: ${names}`));
44840
+ }
44841
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
44842
+ if (plan.allPresent) {
44843
+ console.log(t.success(" \u2713 All extensions and packages present.\n"));
44844
+ } else if (plan.allRequiredPresent) {
44845
+ console.log(t.success(" \u2713 All required items present."));
44846
+ const optionalMissing = [
44847
+ ...plan.missingExtensions.filter((s) => !s.ext.required),
44848
+ ...plan.missingPackages.filter((s) => !s.pkg.required)
44849
+ ];
44850
+ if (optionalMissing.length > 0) {
44851
+ const names = optionalMissing.map(
44852
+ (s) => "ext" in s ? s.ext.displayName : s.pkg.displayName
44853
+ ).join(", ");
44854
+ console.log(kleur_default.dim(` \u25CB Optional not installed: ${names}
44855
+ `));
44856
+ } else {
44857
+ console.log("");
44858
+ }
44859
+ } else {
44860
+ console.log(kleur_default.yellow(" \u26A0 Missing required items.\n"));
44861
+ }
44862
+ }
44863
+ function mergePiSyncResults(base, incoming) {
44864
+ return {
44865
+ extensionsAdded: [...base.extensionsAdded, ...incoming.extensionsAdded],
44866
+ extensionsUpdated: [...base.extensionsUpdated, ...incoming.extensionsUpdated],
44867
+ extensionsRemoved: [...base.extensionsRemoved, ...incoming.extensionsRemoved],
44868
+ packagesInstalled: [...base.packagesInstalled, ...incoming.packagesInstalled],
44869
+ failed: [...base.failed, ...incoming.failed]
44870
+ };
44871
+ }
44872
+ function parseNpmPackageName(piPackageId) {
44873
+ if (!piPackageId.startsWith("npm:")) return null;
44874
+ const npmPackageName = piPackageId.slice(4).trim();
44875
+ return npmPackageName.length > 0 ? npmPackageName : null;
44876
+ }
44877
+ async function isPackagePresentInPiAgent(agentDir, piPackageId) {
44878
+ const npmPackageName = parseNpmPackageName(piPackageId);
44879
+ if (!npmPackageName) return false;
44880
+ const packageDir = import_path4.default.join(agentDir, "npm", "node_modules", npmPackageName);
44881
+ return import_fs_extra9.default.pathExists(packageDir);
44882
+ }
44883
+ async function ensureAlwaysGlobalPiPackages(dryRun, log, agentDir = PI_AGENT_DIR, installRunner = (piPackageId) => {
44884
+ const installResult = (0, import_child_process3.spawnSync)("pi", ["install", piPackageId], { stdio: "pipe", encoding: "utf8" });
44885
+ return installResult.status;
44886
+ }) {
44887
+ const installed = [];
44888
+ const failed = [];
44889
+ const packagesToEnsure = MANAGED_PACKAGES.filter((pkg) => ALWAYS_GLOBAL_INSTALL_PACKAGE_IDS.has(pkg.id));
44890
+ for (const pkg of packagesToEnsure) {
44891
+ if (await isPackagePresentInPiAgent(agentDir, pkg.id)) {
44892
+ continue;
44893
+ }
44894
+ if (dryRun) {
44895
+ log?.(`[DRY RUN] pi install ${pkg.id}`);
44896
+ continue;
44897
+ }
44898
+ const installStatus = installRunner(pkg.id);
44899
+ if (installStatus === 0) {
44900
+ installed.push(pkg.id);
44901
+ log?.(`${sym.ok} ${pkg.displayName} (global)`);
44902
+ continue;
44903
+ }
44904
+ failed.push(pkg.id);
44905
+ log?.(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 global install failed`));
44906
+ }
44907
+ return { installed, failed };
44908
+ }
44909
+ async function ensureCorePackageSymlink(coreSrcDir, projectRoot, dryRun, log) {
44910
+ if (!await import_fs_extra9.default.pathExists(coreSrcDir)) return "missing-source";
44911
+ const extensionsDir = import_path4.default.join(projectRoot, ".xtrm", "extensions");
44912
+ const nodeModulesDir = import_path4.default.join(extensionsDir, "node_modules", "@xtrm");
44913
+ const symlinkPath = import_path4.default.join(nodeModulesDir, "pi-core");
44914
+ const expectedTarget = import_path4.default.resolve(coreSrcDir);
44915
+ const existing = await import_fs_extra9.default.lstat(symlinkPath).catch(() => null);
44916
+ if (existing) {
44917
+ if (existing.isSymbolicLink()) {
44918
+ const currentLinkTarget = await import_fs_extra9.default.readlink(symlinkPath);
44919
+ const resolvedTarget = import_path4.default.resolve(import_path4.default.dirname(symlinkPath), currentLinkTarget);
44920
+ if (resolvedTarget === expectedTarget) {
44921
+ return "ok";
44922
+ }
44923
+ }
44924
+ if (dryRun) {
44925
+ log?.(kleur_default.dim("[DRY RUN] would repair @xtrm/pi-core symlink target"));
44926
+ return "would-repair";
44927
+ }
44928
+ await import_fs_extra9.default.remove(symlinkPath);
44929
+ await import_fs_extra9.default.ensureDir(nodeModulesDir);
44930
+ const relTarget2 = import_path4.default.relative(nodeModulesDir, coreSrcDir);
44931
+ await import_fs_extra9.default.symlink(relTarget2, symlinkPath);
44932
+ log?.(kleur_default.dim("Repaired @xtrm/pi-core symlink \u2192 .xtrm/extensions/node_modules/@xtrm/pi-core"));
44933
+ return "repaired";
44934
+ }
44935
+ if (dryRun) {
44936
+ log?.(kleur_default.dim("[DRY RUN] would create @xtrm/pi-core symlink"));
44937
+ return "would-create";
44938
+ }
44939
+ await import_fs_extra9.default.ensureDir(nodeModulesDir);
44940
+ const relTarget = import_path4.default.relative(nodeModulesDir, coreSrcDir);
44941
+ await import_fs_extra9.default.symlink(relTarget, symlinkPath);
44942
+ log?.(kleur_default.dim("Created @xtrm/pi-core symlink \u2192 .xtrm/extensions/node_modules/@xtrm/pi-core"));
44943
+ return "created";
44944
+ }
44945
+ async function remediateStalePiMcpAdapterOverride(dryRun, log) {
44946
+ const stat = await import_fs_extra9.default.lstat(PI_MCP_ADAPTER_OVERRIDE_DIR).catch(() => null);
44947
+ if (!stat) {
44948
+ return {
44949
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44950
+ found: false,
44951
+ stale: false,
44952
+ remediated: false
44953
+ };
44954
+ }
44955
+ if (stat.isSymbolicLink()) {
44956
+ return {
44957
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44958
+ found: true,
44959
+ stale: false,
44960
+ remediated: false
44961
+ };
44962
+ }
44963
+ const hasRequiredEntry = await import_fs_extra9.default.pathExists(import_path4.default.join(PI_MCP_ADAPTER_OVERRIDE_DIR, PI_MCP_ADAPTER_REQUIRED_ENTRY));
44964
+ if (stat.isDirectory() && hasRequiredEntry) {
44965
+ return {
44966
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44967
+ found: true,
44968
+ stale: false,
44969
+ remediated: false
44970
+ };
44971
+ }
44972
+ const reason = stat.isDirectory() ? `missing ${PI_MCP_ADAPTER_REQUIRED_ENTRY}` : "not a directory/symlink";
44973
+ if (dryRun) {
44974
+ log?.(kleur_default.dim(`[DRY RUN] would remove stale pi-mcp-adapter override (${reason})`));
44975
+ return {
44976
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44977
+ found: true,
44978
+ stale: true,
44979
+ remediated: false,
44980
+ reason
44981
+ };
44982
+ }
44983
+ await import_fs_extra9.default.remove(PI_MCP_ADAPTER_OVERRIDE_DIR);
44984
+ log?.(kleur_default.dim(`Removed stale pi-mcp-adapter override (${reason})`));
44985
+ return {
44986
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
44987
+ found: true,
44988
+ stale: true,
44989
+ remediated: true,
44990
+ reason
44991
+ };
44992
+ }
44993
+ async function runPiLaunchPreflight(projectRoot, dryRun, log) {
44994
+ const staleOverride = await remediateStalePiMcpAdapterOverride(dryRun, log);
44995
+ const coreSymlinkStatus = await ensureCorePackageSymlink(
44996
+ import_path4.default.join(projectRoot, ".xtrm", "extensions", "core"),
44997
+ projectRoot,
44998
+ dryRun,
44999
+ log
45000
+ );
45001
+ return {
45002
+ coreSymlinkStatus,
45003
+ staleOverride
45004
+ };
45005
+ }
45006
+ function isXtrmExtensionsSetting(entry) {
45007
+ const normalizedEntry = entry.replaceAll("\\", "/").replace(/\/$/, "");
45008
+ return normalizedEntry === PROJECT_EXTENSIONS_ENTRY || normalizedEntry === ".xtrm/extensions";
45009
+ }
45010
+ async function cleanupLegacyProjectExtensionCopies(projectRoot, dryRun, log) {
45011
+ const piSettingsPath = import_path4.default.join(projectRoot, ".pi", "settings.json");
45012
+ let existingSettings = {};
45013
+ try {
45014
+ existingSettings = await import_fs_extra9.default.readJson(piSettingsPath);
45015
+ } catch {
45016
+ return { removed: [], failed: [] };
45017
+ }
45018
+ const pointsToXtrmExtensions = (existingSettings.extensions ?? []).some(isXtrmExtensionsSetting);
45019
+ if (!pointsToXtrmExtensions) return { removed: [], failed: [] };
45020
+ const legacyExtensionsDir = import_path4.default.join(projectRoot, ".pi", "extensions");
45021
+ if (!await import_fs_extra9.default.pathExists(legacyExtensionsDir)) return { removed: [], failed: [] };
45022
+ const removed = [];
45023
+ const failed = [];
45024
+ for (const ext of MANAGED_EXTENSIONS) {
45025
+ const legacyExtPath = import_path4.default.join(legacyExtensionsDir, ext.id);
45026
+ const legacyStat = await import_fs_extra9.default.lstat(legacyExtPath).catch(() => null);
45027
+ if (!legacyStat || legacyStat.isSymbolicLink() || !legacyStat.isDirectory()) {
45028
+ continue;
45029
+ }
45030
+ if (dryRun) {
45031
+ log?.(kleur_default.dim(`[DRY RUN] - .pi/extensions/${ext.id} (legacy copy)`));
45032
+ continue;
45033
+ }
45034
+ try {
45035
+ await import_fs_extra9.default.remove(legacyExtPath);
45036
+ removed.push(ext.id);
45037
+ log?.(kleur_default.dim(`Removed legacy .pi/extensions/${ext.id}`));
45038
+ } catch (err) {
45039
+ failed.push(ext.id);
45040
+ log?.(kleur_default.red(`\u2717 Failed to remove legacy .pi/extensions/${ext.id}: ${err}`));
45041
+ }
45042
+ }
45043
+ return { removed, failed };
45044
+ }
45045
+ async function updatePiSettings(projectRoot, dryRun, log) {
45046
+ const piSettingsPath = import_path4.default.join(projectRoot, ".pi", "settings.json");
45047
+ if (dryRun) {
45048
+ log?.(kleur_default.dim(`[DRY RUN] would update .pi/settings.json`));
45049
+ return;
45050
+ }
45051
+ let existingSettings = {};
45052
+ try {
45053
+ existingSettings = await import_fs_extra9.default.readJson(piSettingsPath);
45054
+ } catch {
45055
+ }
45056
+ const existingPackages = (existingSettings.packages ?? []).filter(
45057
+ (p) => !p.startsWith("./extensions/")
45058
+ );
45059
+ await import_fs_extra9.default.ensureDir(import_path4.default.join(projectRoot, ".pi"));
45060
+ await import_fs_extra9.default.writeJson(piSettingsPath, {
45061
+ ...existingSettings,
45062
+ extensions: [],
45063
+ // Empty = Pi uses global ~/.pi/agent/extensions/
45064
+ skills: [PROJECT_SKILLS_ENTRY],
45065
+ packages: []
45066
+ // Empty = packages installed globally at ~/.pi/agent/settings.json
45067
+ }, { spaces: 2 });
45068
+ log?.(kleur_default.dim(`Updated .pi/settings.json \u2192 global extensions + packages + .xtrm/skills/active/pi`));
45069
+ }
45070
+ async function executePiSync(plan, sourceDir, targetDir, opts = {}) {
45071
+ const {
45072
+ dryRun = false,
45073
+ isGlobal = false,
45074
+ projectRoot,
45075
+ removeOrphaned = true,
45076
+ log = (msg) => console.log(kleur_default.dim(` ${msg}`))
45077
+ } = opts;
45078
+ const result = {
45079
+ extensionsAdded: [],
45080
+ extensionsUpdated: [],
45081
+ extensionsRemoved: [],
45082
+ packagesInstalled: [],
45083
+ failed: []
45084
+ };
45085
+ if (!dryRun) {
45086
+ await import_fs_extra9.default.ensureDir(targetDir);
45087
+ }
45088
+ const toSync = [...plan.missingExtensions, ...plan.staleExtensions];
45089
+ for (const status of toSync) {
45090
+ const { ext } = status;
45091
+ const srcPath = import_path4.default.join(sourceDir, ext.id);
45092
+ const dstPath = import_path4.default.join(targetDir, ext.id);
45093
+ if (dryRun) {
45094
+ log(`[DRY RUN] ${status.installed ? "\u21BB" : "+"} ${ext.displayName}`);
45095
+ continue;
45096
+ }
45097
+ try {
45098
+ await import_fs_extra9.default.remove(dstPath);
45099
+ const relTarget = import_path4.default.relative(targetDir, srcPath);
45100
+ await import_fs_extra9.default.symlink(relTarget, dstPath);
45101
+ if (status.installed) {
45102
+ result.extensionsUpdated.push(ext.id);
45103
+ log(`\u21BB ${ext.displayName} (symlinked)`);
45104
+ } else {
45105
+ result.extensionsAdded.push(ext.id);
45106
+ log(`+ ${ext.displayName} (symlinked)`);
45107
+ }
45108
+ } catch (err) {
45109
+ result.failed.push(ext.id);
45110
+ log(kleur_default.red(`\u2717 ${ext.displayName}: ${err}`));
45111
+ }
45112
+ }
45113
+ if (removeOrphaned && plan.orphanedExtensions.length > 0) {
45114
+ for (const orphanId of plan.orphanedExtensions) {
45115
+ const orphanPath = import_path4.default.join(targetDir, orphanId);
45116
+ if (dryRun) {
45117
+ log(kleur_default.red(`[DRY RUN] - ${orphanId} (orphaned)`));
45118
+ continue;
45119
+ }
45120
+ try {
45121
+ await import_fs_extra9.default.remove(orphanPath);
45122
+ result.extensionsRemoved.push(orphanId);
45123
+ log(kleur_default.red(`- ${orphanId} (orphaned)`));
45124
+ } catch (err) {
45125
+ result.failed.push(orphanId);
45126
+ log(kleur_default.red(`\u2717 ${orphanId}: ${err}`));
45127
+ }
45128
+ }
45129
+ }
45130
+ for (const status of plan.missingPackages) {
45131
+ const { pkg } = status;
45132
+ const installArgs = ["install", pkg.id];
45133
+ if (dryRun) {
45134
+ log(`[DRY RUN] pi ${installArgs.join(" ")}`);
45135
+ continue;
45136
+ }
45137
+ try {
45138
+ const r = (0, import_child_process3.spawnSync)("pi", installArgs, { stdio: "pipe", encoding: "utf8" });
45139
+ if (r.status === 0) {
45140
+ result.packagesInstalled.push(pkg.id);
45141
+ log(`${sym.ok} ${pkg.displayName}`);
45142
+ } else {
45143
+ result.failed.push(pkg.id);
45144
+ log(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 install failed`));
45145
+ }
45146
+ } catch (err) {
45147
+ result.failed.push(pkg.id);
45148
+ log(kleur_default.red(`\u2717 ${pkg.displayName}: ${err}`));
45149
+ }
45150
+ }
45151
+ return result;
45152
+ }
45153
+ var EXTENSION_SOURCE_DIR = "ext-src";
45154
+ async function linkExtensionsToGlobal(repoRoot, dryRun = false, log = (msg) => console.log(kleur_default.dim(` ${msg}`))) {
45155
+ const globalExtDir = import_path4.default.join(PI_AGENT_DIR, "extensions");
45156
+ const repoExtDir = import_path4.default.join(repoRoot, ".xtrm", EXTENSION_SOURCE_DIR);
45157
+ const linked = [];
45158
+ const failed = [];
45159
+ if (!await import_fs_extra9.default.pathExists(repoExtDir)) {
45160
+ log("No .xtrm/ext-src/ found \u2014 skipping global link");
45161
+ return { linked, failed };
45162
+ }
45163
+ if (dryRun) {
45164
+ log("[DRY RUN] would create extension symlinks in ~/.pi/agent/extensions/");
45165
+ return { linked, failed };
45166
+ }
45167
+ await import_fs_extra9.default.ensureDir(globalExtDir);
45168
+ const coreNodeModulesDir = import_path4.default.join(globalExtDir, "node_modules", "@xtrm");
45169
+ const coreSymlinkPath = import_path4.default.join(coreNodeModulesDir, "pi-core");
45170
+ const coreRelativeTarget = import_path4.default.join("..", "..", "core");
45171
+ try {
45172
+ await import_fs_extra9.default.ensureDir(coreNodeModulesDir);
45173
+ const existing = await import_fs_extra9.default.lstat(coreSymlinkPath).catch(() => null);
45174
+ if (existing) await import_fs_extra9.default.remove(coreSymlinkPath);
45175
+ await import_fs_extra9.default.symlink(coreRelativeTarget, coreSymlinkPath);
45176
+ log("\u2713 @xtrm/pi-core \u2192 global node_modules");
45177
+ } catch (err) {
45178
+ log(kleur_default.yellow(`\u26A0 @xtrm/pi-core symlink: ${err}`));
45179
+ }
45180
+ const entries = await import_fs_extra9.default.readdir(repoExtDir, { withFileTypes: true });
45181
+ for (const entry of entries) {
45182
+ if (!entry.isDirectory()) continue;
45183
+ if (entry.name === "node_modules") continue;
45184
+ const extPath = import_path4.default.join(repoExtDir, entry.name);
45185
+ const globalLink = import_path4.default.join(globalExtDir, entry.name);
45186
+ try {
45187
+ const existing = await import_fs_extra9.default.lstat(globalLink).catch(() => null);
45188
+ if (existing) {
45189
+ if (existing.isSymbolicLink()) {
45190
+ const currentTarget = await import_fs_extra9.default.readlink(globalLink);
45191
+ const resolvedTarget = import_path4.default.resolve(import_path4.default.dirname(globalLink), currentTarget);
45192
+ if (resolvedTarget === import_path4.default.resolve(extPath)) {
45193
+ continue;
45194
+ }
45195
+ }
45196
+ await import_fs_extra9.default.remove(globalLink);
45197
+ }
45198
+ await import_fs_extra9.default.symlink(extPath, globalLink);
45199
+ linked.push(entry.name);
45200
+ log(`\u2713 ${entry.name} \u2192 .xtrm/${EXTENSION_SOURCE_DIR}/${entry.name}`);
45201
+ } catch (err) {
45202
+ failed.push(entry.name);
45203
+ log(kleur_default.red(`\u2717 ${entry.name}: ${err}`));
45204
+ }
45205
+ }
45206
+ return { linked, failed };
45207
+ }
45208
+ async function ensureNpmPackageExtensionSymlinks(log) {
45209
+ const os9 = require("os");
45210
+ const homeDir = os9.homedir();
45211
+ const extensionsDir = import_path4.default.join(homeDir, ".pi", "agent", "extensions");
45212
+ await import_fs_extra9.default.ensureDir(extensionsDir);
45213
+ const npmPrefix = (0, import_child_process3.spawnSync)("npm", ["prefix", "-g"], { encoding: "utf8" }).stdout.trim();
45214
+ const globalNodeModules = import_path4.default.join(npmPrefix, "lib", "node_modules");
45215
+ const npmPackages = [
45216
+ { packageName: "pi-gitnexus", symlinkName: "gitnexus" },
45217
+ { packageName: "pi-serena-tools", symlinkName: "serena" }
45218
+ ];
45219
+ for (const { packageName, symlinkName } of npmPackages) {
45220
+ const packagePath = import_path4.default.join(globalNodeModules, packageName);
45221
+ const symlinkPath = import_path4.default.join(extensionsDir, symlinkName);
45222
+ const packageExists = await import_fs_extra9.default.pathExists(packagePath);
45223
+ if (!packageExists) {
45224
+ log?.(kleur_default.yellow(` \u26A0 ${packageName} not found in ${globalNodeModules}, skipping symlink`));
45225
+ continue;
45226
+ }
45227
+ const symlinkExists = await import_fs_extra9.default.lstat(symlinkPath).catch(() => null);
45228
+ if (symlinkExists?.isSymbolicLink()) {
45229
+ const currentTarget = await import_fs_extra9.default.readlink(symlinkPath);
45230
+ const resolvedTarget = import_path4.default.resolve(extensionsDir, currentTarget);
45231
+ if (resolvedTarget === packagePath) {
45232
+ log?.(kleur_default.dim(` \u2713 ${symlinkName} symlink already correct`));
45233
+ continue;
45234
+ }
45235
+ log?.(kleur_default.dim(` Removing stale ${symlinkName} symlink`));
45236
+ await import_fs_extra9.default.remove(symlinkPath);
45237
+ } else if (symlinkExists) {
45238
+ log?.(kleur_default.dim(` Removing stale ${symlinkName} (not a symlink)`));
45239
+ await import_fs_extra9.default.remove(symlinkPath);
45240
+ }
45241
+ const relativeTarget = import_path4.default.relative(extensionsDir, packagePath);
45242
+ await import_fs_extra9.default.symlink(relativeTarget, symlinkPath);
45243
+ log?.(kleur_default.dim(` Created ${symlinkName} symlink \u2192 ${relativeTarget}`));
45244
+ }
45245
+ }
45246
+ async function runPiRuntimeSync(opts = {}) {
45247
+ const { dryRun = false, isGlobal = false, projectRoot } = opts;
45248
+ const pkgRoot = resolvePkgRoot();
45249
+ const sourceDir = import_path4.default.join(pkgRoot, ".xtrm", "extensions");
45250
+ const resolvedProjectRoot = projectRoot || process.cwd();
45251
+ const log = (msg) => console.log(kleur_default.dim(` ${msg}`));
45252
+ const emptyResult = {
45253
+ extensionsAdded: [],
45254
+ extensionsUpdated: [],
45255
+ extensionsRemoved: [],
45256
+ packagesInstalled: [],
45257
+ failed: []
45258
+ };
45259
+ const result = { ...emptyResult };
45260
+ if (!await import_fs_extra9.default.pathExists(sourceDir)) {
45261
+ console.log(kleur_default.dim("\n Managed extensions: skipped (not bundled in npm package)\n"));
45262
+ return result;
45263
+ }
45264
+ const preflight = await runPiLaunchPreflight(resolvedProjectRoot, dryRun, log);
45265
+ if (preflight.staleOverride.remediated) {
45266
+ result.extensionsRemoved.push("pi-mcp-adapter");
45267
+ }
45268
+ if (isGlobal) {
45269
+ const targetDir = import_path4.default.join(PI_AGENT_DIR, "extensions");
45270
+ const plan = await inventoryPiRuntime(sourceDir, targetDir);
45271
+ renderPiRuntimePlan(plan);
45272
+ if (plan.allPresent) return result;
45273
+ const synced = await executePiSync(plan, sourceDir, targetDir, {
45274
+ dryRun,
45275
+ isGlobal: true,
45276
+ removeOrphaned: true
45277
+ });
45278
+ return mergePiSyncResults(result, synced);
45279
+ }
45280
+ const linkResult = await linkExtensionsToGlobal(resolvedProjectRoot, dryRun, log);
45281
+ result.extensionsAdded.push(...linkResult.linked);
45282
+ result.failed.push(...linkResult.failed);
45283
+ await ensureNpmPackageExtensionSymlinks(log);
45284
+ const installedPkgIds = getInstalledPiPackages();
45285
+ const packageStatuses = [];
45286
+ const missingPackages = [];
45287
+ for (const pkg of MANAGED_PACKAGES) {
45288
+ const isInstalled = installedPkgIds.includes(pkg.id);
45289
+ const status = { pkg, installed: isInstalled };
45290
+ packageStatuses.push(status);
45291
+ if (!isInstalled) missingPackages.push(status);
45292
+ }
45293
+ console.log(kleur_default.bold("\n Pi Runtime"));
45294
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
45295
+ console.log(kleur_default.dim(` Extensions: ~/.pi/agent/extensions/ \u2192 .xtrm/${EXTENSION_SOURCE_DIR}/`));
45296
+ const pkgOk = packageStatuses.filter((s) => s.installed).length;
45297
+ console.log(kleur_default.dim(` Packages: ${pkgOk}/${packageStatuses.length} installed`));
45298
+ if (missingPackages.length > 0) {
45299
+ const names = missingPackages.map((s) => s.pkg.displayName).join(", ");
45300
+ console.log(kleur_default.yellow(` Missing: ${names}`));
45301
+ }
45302
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
45303
+ const legacyCleanup = await cleanupLegacyProjectExtensionCopies(resolvedProjectRoot, dryRun, log);
45304
+ result.extensionsRemoved.push(...legacyCleanup.removed);
45305
+ result.failed.push(...legacyCleanup.failed);
45306
+ for (const status of missingPackages) {
45307
+ const { pkg } = status;
45308
+ if (dryRun) {
45309
+ log(`[DRY RUN] pi install ${pkg.id}`);
45310
+ continue;
45311
+ }
45312
+ try {
45313
+ const r = (0, import_child_process3.spawnSync)("pi", ["install", pkg.id], { stdio: "pipe", encoding: "utf8" });
45314
+ if (r.status === 0) {
45315
+ result.packagesInstalled.push(pkg.id);
45316
+ log(`${sym.ok} ${pkg.displayName}`);
45317
+ } else {
45318
+ result.failed.push(pkg.id);
45319
+ log(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 install failed`));
45320
+ }
45321
+ } catch (err) {
45322
+ result.failed.push(pkg.id);
45323
+ log(kleur_default.red(`\u2717 ${pkg.displayName}: ${err}`));
45324
+ }
45325
+ }
45326
+ const alwaysGlobalInstallResult = await ensureAlwaysGlobalPiPackages(dryRun, log);
45327
+ result.packagesInstalled.push(...alwaysGlobalInstallResult.installed);
45328
+ result.failed.push(...alwaysGlobalInstallResult.failed);
45329
+ const skillsRoot = resolveSkillsRoot(resolvedProjectRoot);
45330
+ if (await import_fs_extra9.default.pathExists(import_path4.default.join(skillsRoot, "default"))) {
45331
+ const invariantViolations = await validateSkillsInvariants(skillsRoot);
45332
+ if (invariantViolations.length > 0) {
45333
+ const summary = invariantViolations.map((violation) => `${violation.code}: ${violation.message}`).join("; ");
45334
+ throw new Error(`Skills invariants failed. ${summary}`);
45335
+ }
45336
+ if (!dryRun) {
45337
+ await rebuildRuntimeActiveView("pi", skillsRoot);
45338
+ }
45339
+ }
45340
+ await updatePiSettings(resolvedProjectRoot, dryRun, log);
45341
+ const requiredFailed = missingPackages.filter(
45342
+ (s) => s.pkg.required && result.failed.includes(s.pkg.id)
45343
+ );
45344
+ if (missingPackages.length === 0 || result.failed.length === 0) {
45345
+ console.log(t.success(" \u2713 All required items present.\n"));
45346
+ } else if (requiredFailed.length === 0) {
45347
+ console.log(t.success(" \u2713 All required items present.\n"));
45348
+ } else {
45349
+ console.log(kleur_default.yellow(" \u26A0 Missing required items.\n"));
45350
+ }
45351
+ return result;
45352
+ }
45353
+
45354
+ // src/commands/pi-install.ts
45234
45355
  var PI_AGENT_DIR2 = process.env.PI_AGENT_DIR || import_path5.default.join((0, import_node_os2.homedir)(), ".pi", "agent");
45235
45356
  function ensurePnpm(dryRun) {
45236
45357
  if (isPnpmInstalled()) {
@@ -45653,6 +45774,7 @@ function createPiCommand() {
45653
45774
  // src/commands/init.ts
45654
45775
  var import_path15 = __toESM(require("path"), 1);
45655
45776
  var import_fs_extra21 = __toESM(require_lib(), 1);
45777
+ var import_prompts3 = __toESM(require_prompts3(), 1);
45656
45778
  var import_child_process5 = require("child_process");
45657
45779
 
45658
45780
  // src/core/registry-scaffold.ts
@@ -45752,13 +45874,8 @@ async function scaffoldSkillsDefaultFromPackage(params) {
45752
45874
  return "noop";
45753
45875
  }
45754
45876
  await import_fs_extra13.default.ensureDir(import_path8.default.dirname(targetDir));
45755
- try {
45756
- await import_fs_extra13.default.ensureSymlink(sourceDir, targetDir);
45757
- return "symlink";
45758
- } catch {
45759
- await import_fs_extra13.default.copy(sourceDir, targetDir);
45760
- return "copy";
45761
- }
45877
+ await import_fs_extra13.default.copy(sourceDir, targetDir);
45878
+ return "copy";
45762
45879
  }
45763
45880
  function buildExpectedHashes(registry2) {
45764
45881
  const expected = /* @__PURE__ */ new Map();
@@ -48334,19 +48451,88 @@ async function runProjectBootstrap(projectRoot, isGitRepo) {
48334
48451
  }
48335
48452
  await installServiceSkillHooks(projectRoot);
48336
48453
  }
48337
- async function runProjectInit(opts = {}) {
48338
- const { dryRun = false, yes = false } = opts;
48339
- const effectiveYes = yes || process.argv.includes("--yes") || process.argv.includes("-y");
48340
- let projectRoot;
48341
- let isGitRepo = true;
48454
+ function hasInteractiveTTY2() {
48455
+ return Boolean(process.stdout.isTTY && process.stdin.isTTY);
48456
+ }
48457
+ async function resolveInitProjectRoot(yes) {
48458
+ const cwd = import_path15.default.resolve(process.cwd());
48459
+ let gitRoot;
48342
48460
  try {
48343
- projectRoot = getProjectRoot();
48461
+ gitRoot = getProjectRoot();
48344
48462
  } catch {
48345
- projectRoot = process.cwd();
48346
- isGitRepo = false;
48347
48463
  console.log(kleur_default.yellow("\n \u26A0 Not a git repository \u2014 git-dependent phases (beads, gitnexus) will be skipped"));
48348
48464
  console.log(kleur_default.dim(" Run git init first, then: gitnexus analyze\n"));
48465
+ return { projectRoot: cwd, isGitRepo: false, aborted: false };
48466
+ }
48467
+ const resolvedGitRoot = import_path15.default.resolve(gitRoot);
48468
+ if (resolvedGitRoot === cwd) {
48469
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: false };
48470
+ }
48471
+ console.log(kleur_default.yellow("\n \u26A0 CWD is not the git root."));
48472
+ console.log(kleur_default.dim(` CWD: ${cwd}`));
48473
+ console.log(kleur_default.dim(` Git root: ${resolvedGitRoot}`));
48474
+ if (yes) {
48475
+ console.log(kleur_default.dim(" --yes supplied; proceeding with the git root.\n"));
48476
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: false };
48477
+ }
48478
+ if (!hasInteractiveTTY2()) {
48479
+ console.log(kleur_default.red(" Non-interactive session cannot choose automatically."));
48480
+ console.log(kleur_default.dim(" Re-run with --yes to proceed with the git root, or run from the git root directory.\n"));
48481
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: true };
48482
+ }
48483
+ const { action } = await (0, import_prompts3.default)({
48484
+ type: "select",
48485
+ name: "action",
48486
+ message: "CWD is not the git root. Run git init here first, or continue targeting the git root?",
48487
+ choices: [
48488
+ { title: "Abort and show instructions", value: "abort" },
48489
+ { title: "Run git init in CWD and use this directory", value: "git-init" },
48490
+ { title: "Proceed anyway and target the git root", value: "proceed" }
48491
+ ],
48492
+ initial: 0
48493
+ });
48494
+ if (action === "git-init") {
48495
+ const initResult = (0, import_child_process5.spawnSync)("git", ["init"], {
48496
+ cwd,
48497
+ encoding: "utf8",
48498
+ timeout: 1e4
48499
+ });
48500
+ if (initResult.status !== 0) {
48501
+ if (initResult.stdout) process.stdout.write(initResult.stdout);
48502
+ if (initResult.stderr) process.stderr.write(initResult.stderr);
48503
+ console.log(kleur_default.red("\n \u2717 Failed to initialize git repository in CWD."));
48504
+ console.log(kleur_default.dim(" Fix git init errors and re-run xtrm init.\n"));
48505
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: true };
48506
+ }
48507
+ try {
48508
+ const refreshedGitRoot = getProjectRoot();
48509
+ console.log(kleur_default.green(` \u2713 Initialized git repo in CWD: ${refreshedGitRoot}`));
48510
+ return { projectRoot: import_path15.default.resolve(refreshedGitRoot), isGitRepo: true, aborted: false };
48511
+ } catch {
48512
+ console.log(kleur_default.red("\n \u2717 git init succeeded, but git root could not be resolved."));
48513
+ console.log(kleur_default.dim(" Re-run xtrm init from this directory.\n"));
48514
+ return { projectRoot: cwd, isGitRepo: true, aborted: true };
48515
+ }
48516
+ }
48517
+ if (action === "proceed") {
48518
+ console.log(kleur_default.dim(" Proceeding with the existing git root.\n"));
48519
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: false };
48349
48520
  }
48521
+ console.log(kleur_default.dim("\n Init cancelled."));
48522
+ console.log(kleur_default.dim(` To initialize this directory as its own repo: cd ${cwd} && git init`));
48523
+ console.log(kleur_default.dim(` To target the existing repo root: cd ${resolvedGitRoot} && xtrm init
48524
+ `));
48525
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: true };
48526
+ }
48527
+ async function runProjectInit(opts = {}) {
48528
+ const { dryRun = false, yes = false } = opts;
48529
+ const effectiveYes = yes || process.argv.includes("--yes") || process.argv.includes("-y");
48530
+ const rootResolution = await resolveInitProjectRoot(effectiveYes);
48531
+ if (rootResolution.aborted) {
48532
+ return;
48533
+ }
48534
+ const projectRoot = rootResolution.projectRoot;
48535
+ const isGitRepo = rootResolution.isGitRepo;
48350
48536
  const inventory = await runPreflight(projectRoot, opts);
48351
48537
  renderInitPlan(inventory);
48352
48538
  if (dryRun) {
@@ -48519,7 +48705,7 @@ function getProjectRoot() {
48519
48705
  }
48520
48706
 
48521
48707
  // src/commands/status.ts
48522
- var import_prompts3 = __toESM(require_prompts3(), 1);
48708
+ var import_prompts4 = __toESM(require_prompts3(), 1);
48523
48709
 
48524
48710
  // src/core/sync-executor.ts
48525
48711
  var import_path18 = __toESM(require("path"), 1);
@@ -49390,7 +49576,7 @@ function createStatusCommand() {
49390
49576
  console.log(kleur_default.yellow(`
49391
49577
  \u26A0 ${totalPending} pending change${totalPending !== 1 ? "s" : ""} across ${pending.length} environment${pending.length !== 1 ? "s" : ""}
49392
49578
  `));
49393
- const { selected } = await (0, import_prompts3.default)({
49579
+ const { selected } = await (0, import_prompts4.default)({
49394
49580
  type: "multiselect",
49395
49581
  name: "selected",
49396
49582
  message: "Select environments to sync:",
@@ -50620,7 +50806,7 @@ function clearStatuslineClaim2(repoRoot) {
50620
50806
  }
50621
50807
 
50622
50808
  // src/commands/attach.ts
50623
- var import_prompts4 = __toESM(require_prompts3(), 1);
50809
+ var import_prompts5 = __toESM(require_prompts3(), 1);
50624
50810
  var import_node_child_process8 = require("child_process");
50625
50811
  function createAttachCommand() {
50626
50812
  return new Command("attach").description("Re-attach to an existing xt worktree and resume the Claude or Pi session").argument("[name]", 'Worktree slug or branch name to attach to (e.g. "abc1" or "xt/abc1")').action(async (name) => {
@@ -50656,7 +50842,7 @@ function createAttachCommand() {
50656
50842
  value: slug
50657
50843
  };
50658
50844
  });
50659
- const { picked } = await (0, import_prompts4.default)({
50845
+ const { picked } = await (0, import_prompts5.default)({
50660
50846
  type: "select",
50661
50847
  name: "picked",
50662
50848
  message: "Select worktree to attach",
@@ -50692,7 +50878,7 @@ function createAttachCommand() {
50692
50878
  });
50693
50879
  }
50694
50880
  async function pickRuntime() {
50695
- const { runtime } = await (0, import_prompts4.default)({
50881
+ const { runtime } = await (0, import_prompts5.default)({
50696
50882
  type: "select",
50697
50883
  name: "runtime",
50698
50884
  message: "No session metadata found \u2014 which runtime?",