xtrm-tools 0.7.3 → 0.7.7

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 (533) hide show
  1. package/.xtrm/config/hooks.json +3 -0
  2. package/.xtrm/config/pi/extensions/xtrm-ui/format.ts +189 -0
  3. package/.xtrm/config/pi/extensions/xtrm-ui/index.ts +76 -17
  4. package/.xtrm/config/pi/extensions/xtrm-ui/package.json +16 -5
  5. package/.xtrm/ext-src/custom-footer/.pi/structured-returns/83051fe4-97da-4e2c-bdaa-343b32f4e714.combined.log +7 -0
  6. package/.xtrm/ext-src/custom-footer/.pi/structured-returns/83051fe4-97da-4e2c-bdaa-343b32f4e714.stderr.log +0 -0
  7. package/.xtrm/ext-src/custom-footer/.pi/structured-returns/83051fe4-97da-4e2c-bdaa-343b32f4e714.stdout.log +7 -0
  8. package/.xtrm/ext-src/xtrm-ui/format.ts +282 -0
  9. package/.xtrm/{extensions → ext-src}/xtrm-ui/index.ts +76 -17
  10. package/.xtrm/ext-src/xtrm-ui/package.json +21 -0
  11. package/.xtrm/hooks/specialists/specialists-complete.mjs +70 -0
  12. package/.xtrm/hooks/specialists/specialists-session-start.mjs +105 -0
  13. package/.xtrm/registry.json +397 -409
  14. package/.xtrm/skills/default/README.txt +31 -0
  15. package/.xtrm/skills/default/clean-code/SKILL.md +201 -0
  16. package/.xtrm/skills/default/creating-service-skills/SKILL.md +433 -0
  17. package/.xtrm/skills/default/creating-service-skills/references/script_quality_standards.md +425 -0
  18. package/.xtrm/skills/default/creating-service-skills/references/service_skill_system_guide.md +278 -0
  19. package/.xtrm/skills/default/creating-service-skills/scripts/bootstrap.py +326 -0
  20. package/.xtrm/skills/default/creating-service-skills/scripts/deep_dive.py +304 -0
  21. package/.xtrm/skills/default/creating-service-skills/scripts/scaffolder.py +482 -0
  22. package/.xtrm/skills/default/deepwiki/SKILL.md +50 -0
  23. package/.xtrm/skills/default/delegating/SKILL.md +196 -0
  24. package/.xtrm/skills/default/delegating/config.yaml +210 -0
  25. package/.xtrm/skills/default/delegating/references/orchestration-protocols.md +41 -0
  26. package/.xtrm/skills/default/documenting/CHANGELOG.md +23 -0
  27. package/.xtrm/skills/default/documenting/README.md +148 -0
  28. package/.xtrm/skills/default/documenting/SKILL.md +113 -0
  29. package/.xtrm/skills/default/documenting/examples/example_pattern.md +70 -0
  30. package/.xtrm/skills/default/documenting/examples/example_reference.md +70 -0
  31. package/.xtrm/skills/default/documenting/examples/example_ssot_analytics.md +64 -0
  32. package/.xtrm/skills/default/documenting/examples/example_workflow.md +141 -0
  33. package/.xtrm/skills/default/documenting/references/changelog-format.md +97 -0
  34. package/.xtrm/skills/default/documenting/references/metadata-schema.md +136 -0
  35. package/.xtrm/skills/default/documenting/references/taxonomy.md +81 -0
  36. package/.xtrm/skills/default/documenting/references/versioning-rules.md +78 -0
  37. package/.xtrm/skills/default/documenting/scripts/bump_version.sh +60 -0
  38. package/.xtrm/skills/default/documenting/scripts/changelog/__init__.py +0 -0
  39. package/.xtrm/skills/default/documenting/scripts/changelog/add_entry.py +216 -0
  40. package/.xtrm/skills/default/documenting/scripts/changelog/bump_release.py +117 -0
  41. package/.xtrm/skills/default/documenting/scripts/changelog/init_changelog.py +54 -0
  42. package/.xtrm/skills/default/documenting/scripts/changelog/validate_changelog.py +128 -0
  43. package/.xtrm/skills/default/documenting/scripts/drift_detector.py +266 -0
  44. package/.xtrm/skills/default/documenting/scripts/generate_template.py +311 -0
  45. package/.xtrm/skills/default/documenting/scripts/list_by_category.sh +84 -0
  46. package/.xtrm/skills/default/documenting/scripts/orchestrator.py +255 -0
  47. package/.xtrm/skills/default/documenting/scripts/validate_metadata.py +242 -0
  48. package/.xtrm/skills/default/documenting/templates/CHANGELOG.md.template +13 -0
  49. package/.xtrm/skills/default/find-docs/SKILL.md +175 -0
  50. package/.xtrm/skills/default/find-skills/SKILL.md +133 -0
  51. package/.xtrm/skills/default/github-search/SKILL.md +49 -0
  52. package/.xtrm/skills/default/gitnexus-debugging/SKILL.md +89 -0
  53. package/.xtrm/skills/default/gitnexus-impact-analysis/SKILL.md +97 -0
  54. package/.xtrm/skills/default/gitnexus-pr-review/SKILL.md +163 -0
  55. package/.xtrm/skills/default/gitnexus-refactoring/SKILL.md +121 -0
  56. package/.xtrm/skills/default/hook-development/SKILL.md +797 -0
  57. package/.xtrm/skills/default/hook-development/examples/load-context.sh +55 -0
  58. package/.xtrm/skills/default/hook-development/examples/quality-check.js +1168 -0
  59. package/.xtrm/skills/default/hook-development/examples/validate-bash.sh +43 -0
  60. package/.xtrm/skills/default/hook-development/examples/validate-write.sh +38 -0
  61. package/.xtrm/skills/default/hook-development/references/advanced.md +527 -0
  62. package/.xtrm/skills/default/hook-development/references/migration.md +369 -0
  63. package/.xtrm/skills/default/hook-development/references/patterns.md +412 -0
  64. package/.xtrm/skills/default/hook-development/scripts/README.md +164 -0
  65. package/.xtrm/skills/default/hook-development/scripts/hook-linter.sh +153 -0
  66. package/.xtrm/skills/default/hook-development/scripts/test-hook.sh +252 -0
  67. package/.xtrm/skills/default/hook-development/scripts/validate-hook-schema.sh +159 -0
  68. package/.xtrm/skills/default/init-session/SKILL.md +69 -0
  69. package/.xtrm/skills/default/last30days/SKILL.md +881 -0
  70. package/.xtrm/skills/default/last30days/scripts/briefing.py +260 -0
  71. package/.xtrm/skills/default/last30days/scripts/evaluate-synthesis.py +120 -0
  72. package/.xtrm/skills/default/last30days/scripts/evaluate_search_quality.py +641 -0
  73. package/.xtrm/skills/default/last30days/scripts/generate-synthesis-inputs.py +53 -0
  74. package/.xtrm/skills/default/last30days/scripts/last30days.py +2137 -0
  75. package/.xtrm/skills/default/last30days/scripts/lib/__init__.py +1 -0
  76. package/.xtrm/skills/default/last30days/scripts/lib/bird_x.py +458 -0
  77. package/.xtrm/skills/default/last30days/scripts/lib/bluesky.py +225 -0
  78. package/.xtrm/skills/default/last30days/scripts/lib/brave_search.py +329 -0
  79. package/.xtrm/skills/default/last30days/scripts/lib/cache.py +165 -0
  80. package/.xtrm/skills/default/last30days/scripts/lib/chrome_cookies.py +265 -0
  81. package/.xtrm/skills/default/last30days/scripts/lib/cookie_extract.py +295 -0
  82. package/.xtrm/skills/default/last30days/scripts/lib/dates.py +124 -0
  83. package/.xtrm/skills/default/last30days/scripts/lib/dedupe.py +290 -0
  84. package/.xtrm/skills/default/last30days/scripts/lib/entity_extract.py +127 -0
  85. package/.xtrm/skills/default/last30days/scripts/lib/env.py +807 -0
  86. package/.xtrm/skills/default/last30days/scripts/lib/exa_search.py +176 -0
  87. package/.xtrm/skills/default/last30days/scripts/lib/hackernews.py +266 -0
  88. package/.xtrm/skills/default/last30days/scripts/lib/http.py +174 -0
  89. package/.xtrm/skills/default/last30days/scripts/lib/instagram.py +365 -0
  90. package/.xtrm/skills/default/last30days/scripts/lib/models.py +221 -0
  91. package/.xtrm/skills/default/last30days/scripts/lib/normalize.py +489 -0
  92. package/.xtrm/skills/default/last30days/scripts/lib/openai_reddit.py +631 -0
  93. package/.xtrm/skills/default/last30days/scripts/lib/openrouter_search.py +216 -0
  94. package/.xtrm/skills/default/last30days/scripts/lib/parallel_search.py +139 -0
  95. package/.xtrm/skills/default/last30days/scripts/lib/polymarket.py +580 -0
  96. package/.xtrm/skills/default/last30days/scripts/lib/quality_nudge.py +201 -0
  97. package/.xtrm/skills/default/last30days/scripts/lib/query.py +117 -0
  98. package/.xtrm/skills/default/last30days/scripts/lib/query_type.py +111 -0
  99. package/.xtrm/skills/default/last30days/scripts/lib/reddit.py +617 -0
  100. package/.xtrm/skills/default/last30days/scripts/lib/reddit_enrich.py +325 -0
  101. package/.xtrm/skills/default/last30days/scripts/lib/reddit_public.py +259 -0
  102. package/.xtrm/skills/default/last30days/scripts/lib/relevance.py +148 -0
  103. package/.xtrm/skills/default/last30days/scripts/lib/render.py +1018 -0
  104. package/.xtrm/skills/default/last30days/scripts/lib/safari_cookies.py +182 -0
  105. package/.xtrm/skills/default/last30days/scripts/lib/schema.py +843 -0
  106. package/.xtrm/skills/default/last30days/scripts/lib/score.py +775 -0
  107. package/.xtrm/skills/default/last30days/scripts/lib/scrapecreators_x.py +182 -0
  108. package/.xtrm/skills/default/last30days/scripts/lib/setup_wizard.py +186 -0
  109. package/.xtrm/skills/default/last30days/scripts/lib/tiktok.py +349 -0
  110. package/.xtrm/skills/default/last30days/scripts/lib/truthsocial.py +183 -0
  111. package/.xtrm/skills/default/last30days/scripts/lib/ui.py +620 -0
  112. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/LICENSE +21 -0
  113. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/bird-search.mjs +134 -0
  114. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/cookies.js +191 -0
  115. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/features.json +17 -0
  116. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/paginate-cursor.js +37 -0
  117. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/query-ids.json +20 -0
  118. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/runtime-features.js +151 -0
  119. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/runtime-query-ids.js +264 -0
  120. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-base.js +129 -0
  121. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-constants.js +50 -0
  122. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-features.js +347 -0
  123. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-search.js +157 -0
  124. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-types.js +2 -0
  125. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/lib/twitter-client-utils.js +511 -0
  126. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/LICENSE +22 -0
  127. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/README.md +29 -0
  128. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.d.ts +3 -0
  129. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.d.ts.map +1 -0
  130. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.js +2 -0
  131. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.js.map +1 -0
  132. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.d.ts +8 -0
  133. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.d.ts.map +1 -0
  134. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.js +27 -0
  135. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.js.map +1 -0
  136. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.d.ts +11 -0
  137. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.d.ts.map +1 -0
  138. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.js +100 -0
  139. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.js.map +1 -0
  140. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.d.ts +25 -0
  141. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.d.ts.map +1 -0
  142. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.js +104 -0
  143. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.js.map +1 -0
  144. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.d.ts +10 -0
  145. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.d.ts.map +1 -0
  146. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.js +293 -0
  147. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.js.map +1 -0
  148. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.d.ts +10 -0
  149. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.d.ts.map +1 -0
  150. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.js +26 -0
  151. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.js.map +1 -0
  152. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.d.ts +7 -0
  153. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.d.ts.map +1 -0
  154. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.js +51 -0
  155. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.js.map +1 -0
  156. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.d.ts +7 -0
  157. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.d.ts.map +1 -0
  158. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.js +60 -0
  159. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.js.map +1 -0
  160. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.d.ts +7 -0
  161. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.d.ts.map +1 -0
  162. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.js +38 -0
  163. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.js.map +1 -0
  164. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.d.ts +5 -0
  165. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.d.ts.map +1 -0
  166. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.js +33 -0
  167. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.js.map +1 -0
  168. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.d.ts +24 -0
  169. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.d.ts.map +1 -0
  170. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.js +30 -0
  171. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.js.map +1 -0
  172. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.d.ts +11 -0
  173. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.d.ts.map +1 -0
  174. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.js +43 -0
  175. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.js.map +1 -0
  176. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.d.ts +8 -0
  177. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.d.ts.map +1 -0
  178. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.js +41 -0
  179. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.js.map +1 -0
  180. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.d.ts +8 -0
  181. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.d.ts.map +1 -0
  182. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.js +53 -0
  183. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.js.map +1 -0
  184. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.d.ts +8 -0
  185. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.d.ts.map +1 -0
  186. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.js +27 -0
  187. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.js.map +1 -0
  188. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.d.ts +7 -0
  189. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.d.ts.map +1 -0
  190. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.js +53 -0
  191. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.js.map +1 -0
  192. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.d.ts +8 -0
  193. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.d.ts.map +1 -0
  194. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.js +60 -0
  195. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.js.map +1 -0
  196. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.d.ts +7 -0
  197. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.d.ts.map +1 -0
  198. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.js +38 -0
  199. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.js.map +1 -0
  200. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.d.ts +6 -0
  201. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.d.ts.map +1 -0
  202. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.js +257 -0
  203. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.js.map +1 -0
  204. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.d.ts +8 -0
  205. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.d.ts.map +1 -0
  206. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.js +71 -0
  207. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.js.map +1 -0
  208. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.d.ts +6 -0
  209. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.d.ts.map +1 -0
  210. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.js +173 -0
  211. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.js.map +1 -0
  212. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.d.ts +26 -0
  213. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.d.ts.map +1 -0
  214. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.js +195 -0
  215. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.js.map +1 -0
  216. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.d.ts +121 -0
  217. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.d.ts.map +1 -0
  218. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.js +2 -0
  219. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.js.map +1 -0
  220. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.d.ts +2 -0
  221. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.d.ts.map +1 -0
  222. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.js +18 -0
  223. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.js.map +1 -0
  224. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.d.ts +8 -0
  225. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.d.ts.map +1 -0
  226. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.js +110 -0
  227. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.js.map +1 -0
  228. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.d.ts +2 -0
  229. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.d.ts.map +1 -0
  230. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.js +32 -0
  231. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.js.map +1 -0
  232. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.d.ts +2 -0
  233. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.d.ts.map +1 -0
  234. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.js +13 -0
  235. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.js.map +1 -0
  236. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.d.ts +2 -0
  237. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.d.ts.map +1 -0
  238. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.js +7 -0
  239. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.js.map +1 -0
  240. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.d.ts +5 -0
  241. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.d.ts.map +1 -0
  242. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.js +58 -0
  243. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.js.map +1 -0
  244. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.d.ts +2 -0
  245. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.d.ts.map +1 -0
  246. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.js +27 -0
  247. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.js.map +1 -0
  248. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.d.ts +2 -0
  249. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.d.ts.map +1 -0
  250. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.js +8 -0
  251. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.js.map +1 -0
  252. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/package.json +40 -0
  253. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/package.json +13 -0
  254. package/.xtrm/skills/default/last30days/scripts/lib/websearch.py +401 -0
  255. package/.xtrm/skills/default/last30days/scripts/lib/xai_x.py +217 -0
  256. package/.xtrm/skills/default/last30days/scripts/lib/xiaohongshu_api.py +162 -0
  257. package/.xtrm/skills/default/last30days/scripts/lib/youtube_yt.py +538 -0
  258. package/.xtrm/skills/default/last30days/scripts/store.py +654 -0
  259. package/.xtrm/skills/default/last30days/scripts/sync.sh +50 -0
  260. package/.xtrm/skills/default/last30days/scripts/test-v1-vs-v2.sh +219 -0
  261. package/.xtrm/skills/default/last30days/scripts/watchlist.py +329 -0
  262. package/.xtrm/skills/default/planning/SKILL.md +405 -0
  263. package/.xtrm/skills/default/planning/evals/evals.json +19 -0
  264. package/.xtrm/skills/default/prompt-improving/README.md +162 -0
  265. package/.xtrm/skills/default/prompt-improving/SKILL.md +74 -0
  266. package/.xtrm/skills/default/prompt-improving/references/analysis_commands.md +24 -0
  267. package/.xtrm/skills/default/prompt-improving/references/chain_of_thought.md +24 -0
  268. package/.xtrm/skills/default/prompt-improving/references/mcp_definitions.md +20 -0
  269. package/.xtrm/skills/default/prompt-improving/references/multishot.md +23 -0
  270. package/.xtrm/skills/default/prompt-improving/references/xml_core.md +60 -0
  271. package/.xtrm/skills/default/quality-gates/.claude/hooks/hook-config.json +66 -0
  272. package/.xtrm/skills/default/quality-gates/.claude/hooks/quality-check.cjs +1286 -0
  273. package/.xtrm/skills/default/quality-gates/.claude/hooks/quality-check.py +334 -0
  274. package/.xtrm/skills/default/quality-gates/.claude/settings.json +3 -0
  275. package/.xtrm/skills/default/quality-gates/.claude/skills/using-quality-gates/SKILL.md +254 -0
  276. package/.xtrm/skills/default/quality-gates/README.md +109 -0
  277. package/.xtrm/skills/default/quality-gates/evals/evals.json +181 -0
  278. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/FINAL-EVAL-SUMMARY.md +75 -0
  279. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/edge-case-auto-fix-verification/with_skill/outputs/response.md +59 -0
  280. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/edge-case-mixed-language-project/with_skill/outputs/response.md +60 -0
  281. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/eval-summary.md +105 -0
  282. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/partial-install-python-only/with_skill/outputs/response.md +93 -0
  283. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/python-refactor-request/with_skill/outputs/response.md +104 -0
  284. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/quality-gate-error-fix/with_skill/outputs/response.md +74 -0
  285. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-general-chat/with_skill/outputs/response.md +18 -0
  286. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-math-question/with_skill/outputs/response.md +18 -0
  287. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-unrelated-coding/with_skill/outputs/response.md +56 -0
  288. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/tdd-guard-blocking-confusion/with_skill/outputs/response.md +67 -0
  289. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/typescript-feature-with-tests/with_skill/outputs/response.md +97 -0
  290. package/.xtrm/skills/default/scoping-service-skills/SKILL.md +231 -0
  291. package/.xtrm/skills/default/scoping-service-skills/scripts/scope.py +74 -0
  292. package/.xtrm/skills/default/service-skills-set/README.md +93 -0
  293. package/.xtrm/skills/default/service-skills-set/git-hooks/doc_reminder.py +67 -0
  294. package/.xtrm/skills/default/service-skills-set/git-hooks/skill_staleness.py +194 -0
  295. package/.xtrm/skills/default/service-skills-set/install-service-skills.py +193 -0
  296. package/.xtrm/skills/default/service-skills-set/service-registry.json +4 -0
  297. package/.xtrm/skills/default/service-skills-set/service-skills-readme.md +236 -0
  298. package/.xtrm/skills/default/service-skills-set/settings.json +37 -0
  299. package/.xtrm/skills/default/session-close-report/SKILL.md +131 -0
  300. package/.xtrm/skills/default/skill-creator/LICENSE.txt +202 -0
  301. package/.xtrm/skills/default/skill-creator/SKILL.md +479 -0
  302. package/.xtrm/skills/default/skill-creator/agents/analyzer.md +274 -0
  303. package/.xtrm/skills/default/skill-creator/agents/comparator.md +202 -0
  304. package/.xtrm/skills/default/skill-creator/agents/grader.md +223 -0
  305. package/.xtrm/skills/default/skill-creator/assets/eval_review.html +146 -0
  306. package/.xtrm/skills/default/skill-creator/eval-viewer/generate_review.py +471 -0
  307. package/.xtrm/skills/default/skill-creator/eval-viewer/viewer.html +1325 -0
  308. package/.xtrm/skills/default/skill-creator/references/schemas.md +430 -0
  309. package/.xtrm/skills/default/skill-creator/scripts/__init__.py +0 -0
  310. package/.xtrm/skills/default/skill-creator/scripts/aggregate_benchmark.py +401 -0
  311. package/.xtrm/skills/default/skill-creator/scripts/generate_report.py +326 -0
  312. package/.xtrm/skills/default/skill-creator/scripts/improve_description.py +248 -0
  313. package/.xtrm/skills/default/skill-creator/scripts/package_skill.py +136 -0
  314. package/.xtrm/skills/default/skill-creator/scripts/quick_validate.py +103 -0
  315. package/.xtrm/skills/default/skill-creator/scripts/run_eval.py +310 -0
  316. package/.xtrm/skills/default/skill-creator/scripts/run_loop.py +332 -0
  317. package/.xtrm/skills/default/skill-creator/scripts/utils.py +47 -0
  318. package/.xtrm/skills/default/specialists-creator/SKILL.md +705 -0
  319. package/.xtrm/skills/default/specialists-creator/scripts/validate-specialist.ts +41 -0
  320. package/.xtrm/skills/default/sync-docs/SKILL.md +262 -0
  321. package/.xtrm/skills/default/sync-docs/evals/evals.json +89 -0
  322. package/.xtrm/skills/default/sync-docs/references/doc-structure.md +99 -0
  323. package/.xtrm/skills/default/sync-docs/references/schema.md +103 -0
  324. package/.xtrm/skills/default/sync-docs/scripts/changelog/add_entry.py +216 -0
  325. package/.xtrm/skills/default/sync-docs/scripts/context_gatherer.py +405 -0
  326. package/.xtrm/skills/default/sync-docs/scripts/doc_structure_analyzer.py +495 -0
  327. package/.xtrm/skills/default/sync-docs/scripts/drift_detector.py +563 -0
  328. package/.xtrm/skills/default/sync-docs/scripts/validate_doc.py +365 -0
  329. package/.xtrm/skills/default/sync-docs/scripts/validate_metadata.py +185 -0
  330. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/benchmark.json +293 -0
  331. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/benchmark.md +13 -0
  332. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/eval_metadata.json +27 -0
  333. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/outputs/result.md +210 -0
  334. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/grading.json +28 -0
  335. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/timing.json +1 -0
  336. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/outputs/result.md +101 -0
  337. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/grading.json +28 -0
  338. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/timing.json +5 -0
  339. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/timing.json +5 -0
  340. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/eval_metadata.json +27 -0
  341. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/outputs/result.md +198 -0
  342. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/grading.json +28 -0
  343. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/timing.json +1 -0
  344. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/outputs/result.md +94 -0
  345. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/grading.json +28 -0
  346. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/timing.json +1 -0
  347. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/eval_metadata.json +27 -0
  348. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/outputs/result.md +237 -0
  349. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/grading.json +28 -0
  350. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/timing.json +1 -0
  351. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/outputs/result.md +134 -0
  352. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/grading.json +28 -0
  353. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/timing.json +1 -0
  354. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/benchmark.json +297 -0
  355. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/benchmark.md +13 -0
  356. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/eval_metadata.json +27 -0
  357. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/outputs/result.md +137 -0
  358. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/grading.json +92 -0
  359. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/timing.json +1 -0
  360. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/outputs/result.md +134 -0
  361. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/grading.json +86 -0
  362. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/timing.json +1 -0
  363. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/eval_metadata.json +27 -0
  364. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/outputs/result.md +193 -0
  365. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/grading.json +72 -0
  366. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/timing.json +1 -0
  367. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/outputs/result.md +211 -0
  368. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/grading.json +91 -0
  369. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/timing.json +5 -0
  370. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/eval_metadata.json +27 -0
  371. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/outputs/result.md +182 -0
  372. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/grading.json +95 -0
  373. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/timing.json +1 -0
  374. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/outputs/result.md +222 -0
  375. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/grading.json +88 -0
  376. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/timing.json +5 -0
  377. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/benchmark.json +298 -0
  378. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/benchmark.md +13 -0
  379. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/eval_metadata.json +27 -0
  380. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/outputs/result.md +125 -0
  381. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/grading.json +97 -0
  382. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/timing.json +5 -0
  383. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/outputs/result.md +144 -0
  384. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/grading.json +78 -0
  385. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/timing.json +5 -0
  386. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/eval_metadata.json +27 -0
  387. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/outputs/result.md +104 -0
  388. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/grading.json +91 -0
  389. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/timing.json +5 -0
  390. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/outputs/result.md +79 -0
  391. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/grading.json +82 -0
  392. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/timing.json +5 -0
  393. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/eval_metadata.json +27 -0
  394. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase1_context.json +302 -0
  395. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase2_drift.txt +33 -0
  396. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase3_analysis.json +114 -0
  397. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase4_fix.txt +118 -0
  398. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase5_validate.txt +38 -0
  399. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/result.md +158 -0
  400. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/grading.json +95 -0
  401. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/timing.json +5 -0
  402. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/outputs/result.md +71 -0
  403. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/grading.json +90 -0
  404. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/timing.json +5 -0
  405. package/.xtrm/skills/default/test-planning/SKILL.md +465 -0
  406. package/.xtrm/skills/default/test-planning/evals/evals.json +23 -0
  407. package/.xtrm/skills/default/updating-service-skills/SKILL.md +136 -0
  408. package/.xtrm/skills/default/updating-service-skills/scripts/drift_detector.py +222 -0
  409. package/.xtrm/skills/default/using-nodes/SKILL.md +333 -0
  410. package/.xtrm/skills/default/using-quality-gates/SKILL.md +254 -0
  411. package/.xtrm/skills/default/using-service-skills/SKILL.md +108 -0
  412. package/.xtrm/skills/default/using-service-skills/scripts/cataloger.py +74 -0
  413. package/.xtrm/skills/default/using-service-skills/scripts/skill_activator.py +152 -0
  414. package/.xtrm/skills/default/using-specialists/SKILL.md +848 -0
  415. package/.xtrm/skills/default/using-specialists/evals/evals.json +68 -0
  416. package/.xtrm/skills/default/using-tdd/SKILL.md +410 -0
  417. package/.xtrm/skills/default/using-xtrm/SKILL.md +127 -0
  418. package/.xtrm/skills/default/xt-debugging/SKILL.md +149 -0
  419. package/.xtrm/skills/default/xt-end/SKILL.md +297 -0
  420. package/.xtrm/skills/default/xt-merge/SKILL.md +326 -0
  421. package/.xtrm/skills/optional/README.txt +2 -0
  422. package/.xtrm/skills/optional/architecture-design/PACK.json +11 -0
  423. package/.xtrm/skills/optional/architecture-design/architecture-patterns/SKILL.md +494 -0
  424. package/.xtrm/skills/optional/architecture-design/architecture-patterns/references/advanced-patterns.md +391 -0
  425. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/SKILL.md +473 -0
  426. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
  427. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/assets/prompt-template-library.md +264 -0
  428. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/chain-of-thought.md +412 -0
  429. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/few-shot-learning.md +386 -0
  430. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/prompt-optimization.md +428 -0
  431. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/prompt-templates.md +484 -0
  432. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/references/system-prompts.md +195 -0
  433. package/.xtrm/skills/optional/architecture-design/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
  434. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/SKILL.md +277 -0
  435. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  436. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/implementer-prompt.md +113 -0
  437. package/.xtrm/skills/optional/architecture-design/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  438. package/.xtrm/skills/optional/code-quality/PACK.json +12 -0
  439. package/.xtrm/skills/optional/code-quality/code-review-excellence/SKILL.md +529 -0
  440. package/.xtrm/skills/optional/code-quality/multi-reviewer-patterns/SKILL.md +127 -0
  441. package/.xtrm/skills/optional/code-quality/systematic-debugging/SKILL.md +296 -0
  442. package/.xtrm/skills/optional/code-quality/verification-before-completion/SKILL.md +139 -0
  443. package/.xtrm/skills/optional/data-engineering/PACK.json +9 -0
  444. package/.xtrm/skills/optional/data-engineering/data-analyst/SKILL.md +57 -0
  445. package/.xtrm/skills/optional/research-methods/PACK.json +12 -0
  446. package/.xtrm/skills/optional/research-methods/academic-researcher/SKILL.md +269 -0
  447. package/.xtrm/skills/optional/research-methods/brainstorming/SKILL.md +164 -0
  448. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/frame-template.html +214 -0
  449. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/helper.js +88 -0
  450. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/server.cjs +354 -0
  451. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/start-server.sh +148 -0
  452. package/.xtrm/skills/optional/research-methods/brainstorming/scripts/stop-server.sh +56 -0
  453. package/.xtrm/skills/optional/research-methods/brainstorming/spec-document-reviewer-prompt.md +49 -0
  454. package/.xtrm/skills/optional/research-methods/brainstorming/visual-companion.md +287 -0
  455. package/.xtrm/skills/optional/research-methods/deep-research/SKILL.md +192 -0
  456. package/.xtrm/skills/optional/research-methods/fact-checker/SKILL.md +182 -0
  457. package/.xtrm/skills/optional/security-ops/PACK.json +9 -0
  458. package/.xtrm/skills/optional/security-ops/security-auditor/SKILL.md +165 -0
  459. package/.xtrm/skills/optional/xt-optional/PACK.json +16 -0
  460. package/.xtrm/skills/optional/xt-optional/docker-expert/SKILL.md +409 -0
  461. package/.xtrm/skills/optional/xt-optional/obsidian-cli/SKILL.md +106 -0
  462. package/.xtrm/skills/optional/xt-optional/python-testing/SKILL.md +815 -0
  463. package/.xtrm/skills/optional/xt-optional/senior-backend/SKILL.md +209 -0
  464. package/.xtrm/skills/optional/xt-optional/senior-backend/references/api_design_patterns.md +103 -0
  465. package/.xtrm/skills/optional/xt-optional/senior-backend/references/backend_security_practices.md +103 -0
  466. package/.xtrm/skills/optional/xt-optional/senior-backend/references/database_optimization_guide.md +103 -0
  467. package/.xtrm/skills/optional/xt-optional/senior-backend/scripts/api_load_tester.py +114 -0
  468. package/.xtrm/skills/optional/xt-optional/senior-backend/scripts/api_scaffolder.py +114 -0
  469. package/.xtrm/skills/optional/xt-optional/senior-backend/scripts/database_migration_tool.py +114 -0
  470. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/SKILL.md +226 -0
  471. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/references/experiment_design_frameworks.md +80 -0
  472. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/references/feature_engineering_patterns.md +80 -0
  473. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/references/statistical_methods_advanced.md +80 -0
  474. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/scripts/experiment_designer.py +100 -0
  475. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/scripts/feature_engineering_pipeline.py +100 -0
  476. package/.xtrm/skills/optional/xt-optional/senior-data-scientist/scripts/model_evaluation_suite.py +100 -0
  477. package/.xtrm/skills/optional/xt-optional/senior-devops/SKILL.md +209 -0
  478. package/.xtrm/skills/optional/xt-optional/senior-devops/references/cicd_pipeline_guide.md +103 -0
  479. package/.xtrm/skills/optional/xt-optional/senior-devops/references/deployment_strategies.md +103 -0
  480. package/.xtrm/skills/optional/xt-optional/senior-devops/references/infrastructure_as_code.md +103 -0
  481. package/.xtrm/skills/optional/xt-optional/senior-devops/scripts/deployment_manager.py +114 -0
  482. package/.xtrm/skills/optional/xt-optional/senior-devops/scripts/pipeline_generator.py +114 -0
  483. package/.xtrm/skills/optional/xt-optional/senior-devops/scripts/terraform_scaffolder.py +114 -0
  484. package/.xtrm/skills/optional/xt-optional/senior-security/SKILL.md +209 -0
  485. package/.xtrm/skills/optional/xt-optional/senior-security/references/cryptography_implementation.md +103 -0
  486. package/.xtrm/skills/optional/xt-optional/senior-security/references/penetration_testing_guide.md +103 -0
  487. package/.xtrm/skills/optional/xt-optional/senior-security/references/security_architecture_patterns.md +103 -0
  488. package/.xtrm/skills/optional/xt-optional/senior-security/scripts/pentest_automator.py +114 -0
  489. package/.xtrm/skills/optional/xt-optional/senior-security/scripts/security_auditor.py +114 -0
  490. package/.xtrm/skills/optional/xt-optional/senior-security/scripts/threat_modeler.py +114 -0
  491. package/CHANGELOG.md +16 -0
  492. package/README.md +5 -0
  493. package/cli/dist/index.cjs +862 -614
  494. package/cli/dist/index.cjs.map +1 -1
  495. package/cli/package.json +1 -1
  496. package/package.json +4 -1
  497. package/.xtrm/extensions/xtrm-ui/format.ts +0 -93
  498. package/.xtrm/extensions/xtrm-ui/package.json +0 -10
  499. /package/.xtrm/{extensions → ext-src}/auto-session-name/index.ts +0 -0
  500. /package/.xtrm/{extensions → ext-src}/auto-session-name/package.json +0 -0
  501. /package/.xtrm/{extensions → ext-src}/auto-update/index.ts +0 -0
  502. /package/.xtrm/{extensions → ext-src}/auto-update/package.json +0 -0
  503. /package/.xtrm/{extensions → ext-src}/beads/index.ts +0 -0
  504. /package/.xtrm/{extensions → ext-src}/beads/package.json +0 -0
  505. /package/.xtrm/{extensions → ext-src}/compact-header/index.ts +0 -0
  506. /package/.xtrm/{extensions → ext-src}/compact-header/package.json +0 -0
  507. /package/.xtrm/{extensions → ext-src}/core/adapter.ts +0 -0
  508. /package/.xtrm/{extensions → ext-src}/core/guard-rules.ts +0 -0
  509. /package/.xtrm/{extensions → ext-src}/core/lib.ts +0 -0
  510. /package/.xtrm/{extensions → ext-src}/core/logger.ts +0 -0
  511. /package/.xtrm/{extensions → ext-src}/core/package.json +0 -0
  512. /package/.xtrm/{extensions → ext-src}/core/runner.ts +0 -0
  513. /package/.xtrm/{extensions → ext-src}/core/session-state.ts +0 -0
  514. /package/.xtrm/{extensions → ext-src}/custom-footer/index.ts +0 -0
  515. /package/.xtrm/{extensions → ext-src}/custom-footer/package.json +0 -0
  516. /package/.xtrm/{extensions → ext-src}/custom-provider-qwen-cli/index.ts +0 -0
  517. /package/.xtrm/{extensions → ext-src}/custom-provider-qwen-cli/package.json +0 -0
  518. /package/.xtrm/{extensions → ext-src}/git-checkpoint/index.ts +0 -0
  519. /package/.xtrm/{extensions → ext-src}/git-checkpoint/package.json +0 -0
  520. /package/.xtrm/{extensions → ext-src}/lsp-bootstrap/index.ts +0 -0
  521. /package/.xtrm/{extensions → ext-src}/lsp-bootstrap/package.json +0 -0
  522. /package/.xtrm/{extensions → ext-src}/pi-serena-compact/index.ts +0 -0
  523. /package/.xtrm/{extensions → ext-src}/pi-serena-compact/package.json +0 -0
  524. /package/.xtrm/{extensions → ext-src}/quality-gates/index.ts +0 -0
  525. /package/.xtrm/{extensions → ext-src}/quality-gates/package.json +0 -0
  526. /package/.xtrm/{extensions → ext-src}/service-skills/index.ts +0 -0
  527. /package/.xtrm/{extensions → ext-src}/service-skills/package.json +0 -0
  528. /package/.xtrm/{extensions → ext-src}/session-flow/index.ts +0 -0
  529. /package/.xtrm/{extensions → ext-src}/session-flow/package.json +0 -0
  530. /package/.xtrm/{extensions → ext-src}/xtrm-loader/index.ts +0 -0
  531. /package/.xtrm/{extensions → ext-src}/xtrm-loader/package.json +0 -0
  532. /package/.xtrm/{extensions → ext-src}/xtrm-ui/themes/pidex-dark.json +0 -0
  533. /package/.xtrm/{extensions → ext-src}/xtrm-ui/themes/pidex-light.json +0 -0
@@ -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
@@ -29623,11 +29623,15 @@ async function runClaudeRuntimeSyncPhase(opts) {
29623
29623
  const hooksConfig = await import_fs_extra2.default.readJson(hooksConfigPath);
29624
29624
  const projectHooksDir = import_path2.default.join(repoRoot, ".xtrm", "hooks");
29625
29625
  const generatedHooks = resolveHooksForProjectRuntime(hooksConfig.hooks ?? {}, projectHooksDir);
29626
+ const generatedStatusLine = resolveStatusLineForProjectRuntime(hooksConfig.statusLine, projectHooksDir);
29626
29627
  const settingsPath = isGlobal ? import_path2.default.join(import_os.default.homedir(), ".claude", "settings.json") : import_path2.default.join(repoRoot, ".claude", "settings.json");
29627
29628
  const hasExistingSettings = await import_fs_extra2.default.pathExists(settingsPath);
29628
29629
  const baseSettings = await readBaseSettings(settingsTemplatePath);
29629
29630
  const existingSettings = hasExistingSettings ? await readSettings(settingsPath) : {};
29630
29631
  const mergedSettings = hasExistingSettings ? { ...existingSettings, hooks: generatedHooks } : { ...baseSettings, hooks: generatedHooks };
29632
+ if (generatedStatusLine) {
29633
+ mergedSettings.statusLine = generatedStatusLine;
29634
+ }
29631
29635
  if (prune) {
29632
29636
  delete mergedSettings.enabledPlugins;
29633
29637
  delete mergedSettings.extraKnownMarketplaces;
@@ -29671,6 +29675,7 @@ async function runClaudeRuntimeSyncPhase(opts) {
29671
29675
  console.log(t.success(" \u2713 Removed plugin-era settings keys (enabledPlugins, extraKnownMarketplaces)"));
29672
29676
  }
29673
29677
  console.log(t.success(" \u2713 Claude settings hooks synced\n"));
29678
+ await ensureGlobalStatusLine();
29674
29679
  return {
29675
29680
  settingsPath,
29676
29681
  hooksEventsWritten,
@@ -29678,6 +29683,24 @@ async function runClaudeRuntimeSyncPhase(opts) {
29678
29683
  wroteSettings: true
29679
29684
  };
29680
29685
  }
29686
+ async function ensureGlobalStatusLine() {
29687
+ const homeDir = import_os.default.homedir();
29688
+ const statuslineHookPath = import_path2.default.join(homeDir, ".xtrm", "hooks", "statusline.mjs");
29689
+ const globalSettingsPath = import_path2.default.join(homeDir, ".claude", "settings.json");
29690
+ if (!await import_fs_extra2.default.pathExists(statuslineHookPath)) {
29691
+ return;
29692
+ }
29693
+ const expectedCommand = `node "${statuslineHookPath}"`;
29694
+ const settings = await readSettings(globalSettingsPath);
29695
+ const currentCommand = settings.statusLine?.command;
29696
+ if (currentCommand === expectedCommand) {
29697
+ return;
29698
+ }
29699
+ settings.statusLine = { type: "command", command: expectedCommand };
29700
+ await import_fs_extra2.default.ensureDir(import_path2.default.dirname(globalSettingsPath));
29701
+ await import_fs_extra2.default.writeJson(globalSettingsPath, settings, { spaces: 2 });
29702
+ console.log(t.success(` \u2713 Wired statusline \u2192 ~/.xtrm/hooks/statusline.mjs`));
29703
+ }
29681
29704
  function resolveHooksForProjectRuntime(hooks, projectHooksDir) {
29682
29705
  const normalizedHooksDir = normalizeHookCommandPath(projectHooksDir);
29683
29706
  const rewrittenHooks = {};
@@ -29697,6 +29720,36 @@ function resolveHooksForProjectRuntime(hooks, projectHooksDir) {
29697
29720
  }
29698
29721
  return rewrittenHooks;
29699
29722
  }
29723
+ function resolveStatusLineForProjectRuntime(statusLineConfig, projectHooksDir) {
29724
+ if (!statusLineConfig?.script) {
29725
+ return void 0;
29726
+ }
29727
+ const normalizedHooksDir = normalizeHookCommandPath(projectHooksDir);
29728
+ const resolvedScriptPath = resolveStatusLineScriptPath(statusLineConfig.script, normalizedHooksDir);
29729
+ return {
29730
+ type: "command",
29731
+ command: buildScriptCommand(statusLineConfig.script, resolvedScriptPath)
29732
+ };
29733
+ }
29734
+ function resolveStatusLineScriptPath(script, normalizedHooksDir) {
29735
+ const pluginRootPattern = /^(?:\$\{CLAUDE_PLUGIN_ROOT\}|\$CLAUDE_PLUGIN_ROOT)\/hooks\/(.+)$/;
29736
+ const pluginRootMatch = script.match(pluginRootPattern);
29737
+ if (pluginRootMatch?.[1]) {
29738
+ return normalizeHookCommandPath(import_path2.default.join(normalizedHooksDir, pluginRootMatch[1]));
29739
+ }
29740
+ return normalizeHookCommandPath(import_path2.default.join(normalizedHooksDir, script));
29741
+ }
29742
+ function buildScriptCommand(scriptName, resolvedPath) {
29743
+ const ext = import_path2.default.extname(scriptName).toLowerCase();
29744
+ if (ext === ".js" || ext === ".cjs" || ext === ".mjs") {
29745
+ return `node "${resolvedPath}"`;
29746
+ }
29747
+ if (ext === ".sh") {
29748
+ return `bash "${resolvedPath}"`;
29749
+ }
29750
+ const pythonBin = process.platform === "win32" ? "python" : "python3";
29751
+ return `${pythonBin} "${resolvedPath}"`;
29752
+ }
29700
29753
  function rewritePluginRootCommandToProjectHookPath(command, normalizedHooksDir) {
29701
29754
  const pluginRootPatterns = [
29702
29755
  /\$\{CLAUDE_PLUGIN_ROOT\}\/hooks\/([^\s"']+)/g,
@@ -29784,11 +29837,14 @@ var import_node_path5 = __toESM(require("path"), 1);
29784
29837
  var import_node_child_process = require("child_process");
29785
29838
  var import_node_fs = require("fs");
29786
29839
 
29787
- // src/core/pi-runtime.ts
29788
- var import_child_process2 = require("child_process");
29789
- var import_fs_extra7 = __toESM(require_lib(), 1);
29840
+ // src/core/skills-scaffold.ts
29790
29841
  var import_path3 = __toESM(require("path"), 1);
29791
- var import_node_os = require("os");
29842
+ var import_fs_extra7 = __toESM(require_lib(), 1);
29843
+
29844
+ // src/core/skills-materializer.ts
29845
+ var import_node_crypto = require("crypto");
29846
+ var import_node_path4 = __toESM(require("path"), 1);
29847
+ var import_fs_extra6 = __toESM(require_lib(), 1);
29792
29848
 
29793
29849
  // src/core/skills-layout.ts
29794
29850
  var import_node_path = __toESM(require("path"), 1);
@@ -43760,11 +43816,6 @@ async function validateSkillsInvariants(skillsRoot) {
43760
43816
  return violations;
43761
43817
  }
43762
43818
 
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
43819
  // src/core/skills-state.ts
43769
43820
  var import_fs_extra5 = __toESM(require_lib(), 1);
43770
43821
  var runtimeEnabledPacksSchema = external_exports.strictObject({
@@ -43965,562 +44016,33 @@ async function rebuildAllRuntimeActiveViews(skillsRoot) {
43965
44016
  return results;
43966
44017
  }
43967
44018
 
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
44019
  // src/core/skills-scaffold.ts
44496
- var import_path4 = __toESM(require("path"), 1);
44497
- var import_fs_extra8 = __toESM(require_lib(), 1);
44498
44020
  async function ensureSkillsSymlink(linkPath, symlinkTarget, label) {
44499
- const existing = await import_fs_extra8.default.lstat(linkPath).catch(() => null);
44021
+ const existing = await import_fs_extra7.default.lstat(linkPath).catch(() => null);
44500
44022
  if (existing) {
44501
44023
  if (existing.isSymbolicLink()) {
44502
- const current = await import_fs_extra8.default.readlink(linkPath);
44024
+ const current = await import_fs_extra7.default.readlink(linkPath);
44503
44025
  if (current === symlinkTarget) {
44504
44026
  console.log(kleur_default.dim(` \u2713 ${label} symlink already in place`));
44505
44027
  return;
44506
44028
  }
44507
- await import_fs_extra8.default.remove(linkPath);
44029
+ await import_fs_extra7.default.remove(linkPath);
44508
44030
  } else {
44509
44031
  if (label === ".claude/skills") {
44510
44032
  console.log(kleur_default.yellow(" \u26A0 .claude/skills is a runtime-managed read-only view; direct writes are unsupported."));
44511
44033
  console.log(kleur_default.yellow(" Move custom skills to .xtrm/skills/default or .xtrm/skills/{optional,user}/packs/* and rebuild."));
44512
44034
  }
44513
- await import_fs_extra8.default.remove(linkPath);
44035
+ await import_fs_extra7.default.remove(linkPath);
44514
44036
  console.log(kleur_default.yellow(` \u26A0 ${label} was a real path \u2014 replaced with managed symlink`));
44515
44037
  }
44516
44038
  }
44517
- await import_fs_extra8.default.mkdirp(import_path4.default.dirname(linkPath));
44518
- await import_fs_extra8.default.symlink(symlinkTarget, linkPath);
44039
+ await import_fs_extra7.default.mkdirp(import_path3.default.dirname(linkPath));
44040
+ await import_fs_extra7.default.symlink(symlinkTarget, linkPath);
44519
44041
  console.log(`${kleur_default.green(" \u2713")} ${label} \u2192 ${symlinkTarget}`);
44520
44042
  }
44521
44043
  async function ensureAgentsSkillsSymlink(projectRoot) {
44522
44044
  const skillsRoot = resolveSkillsRoot(projectRoot);
44523
- if (!await import_fs_extra8.default.pathExists(import_path4.default.join(skillsRoot, "default"))) {
44045
+ if (!await import_fs_extra7.default.pathExists(import_path3.default.join(skillsRoot, "default"))) {
44524
44046
  return {
44525
44047
  activatedClaudeSkills: 0,
44526
44048
  activatedPiSkills: 0
@@ -44535,12 +44057,12 @@ async function ensureAgentsSkillsSymlink(projectRoot) {
44535
44057
  const activatedClaudeSkills = materializedViews.find((view) => view.runtime === "claude")?.discoveredSkillCount ?? 0;
44536
44058
  const activatedPiSkills = materializedViews.find((view) => view.runtime === "pi")?.discoveredSkillCount ?? 0;
44537
44059
  await ensureSkillsSymlink(
44538
- import_path4.default.join(projectRoot, ".claude", "skills"),
44539
- import_path4.default.join("..", ".xtrm", "skills", "active", "claude"),
44060
+ import_path3.default.join(projectRoot, ".claude", "skills"),
44061
+ import_path3.default.join("..", ".xtrm", "skills", "active", "claude"),
44540
44062
  ".claude/skills"
44541
44063
  );
44542
- const agentsSkillsPath = import_path4.default.join(projectRoot, ".agents", "skills");
44543
- if (await import_fs_extra8.default.pathExists(agentsSkillsPath)) {
44064
+ const agentsSkillsPath = import_path3.default.join(projectRoot, ".agents", "skills");
44065
+ if (await import_fs_extra7.default.pathExists(agentsSkillsPath)) {
44544
44066
  console.log(kleur_default.dim(" \u25CB .agents/skills is deprecated; runtime skills are generated under .xtrm/skills/active/*"));
44545
44067
  }
44546
44068
  return {
@@ -44663,30 +44185,6 @@ async function launchWorktreeSession(opts) {
44663
44185
  console.log(kleur_default.green(`
44664
44186
  \u2713 Worktree ready \u2014 launching ${runtime}...
44665
44187
  `));
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
44188
  if (runtime === "claude") {
44691
44189
  const claudeDir = import_node_path5.default.join(worktreePath, ".claude");
44692
44190
  try {
@@ -44764,7 +44262,7 @@ async function confirmDestructiveAction(opts) {
44764
44262
  }
44765
44263
 
44766
44264
  // src/core/machine-bootstrap.ts
44767
- var import_child_process3 = require("child_process");
44265
+ var import_child_process2 = require("child_process");
44768
44266
  var OFFICIAL_CLAUDE_PLUGINS = ["serena", "context7"];
44769
44267
  var OFFICIAL_MARKETPLACE = "claude-plugins-official";
44770
44268
  var MANAGED_DEPS = [
@@ -44870,7 +44368,7 @@ var MANAGED_DEPS = [
44870
44368
  }
44871
44369
  ];
44872
44370
  function checkDep(dep) {
44873
- const result = (0, import_child_process3.spawnSync)(dep.cli, [dep.versionFlag], {
44371
+ const result = (0, import_child_process2.spawnSync)(dep.cli, [dep.versionFlag], {
44874
44372
  encoding: "utf8",
44875
44373
  stdio: "pipe",
44876
44374
  timeout: 5e3
@@ -44957,7 +44455,7 @@ function executeBootstrap(plan, opts = {}) {
44957
44455
  for (const step of steps) {
44958
44456
  const cmd = step.sudo && process.platform !== "darwin" ? "sudo" : step.cmd;
44959
44457
  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" });
44458
+ const r = (0, import_child_process2.spawnSync)(cmd, args, { stdio: "inherit" });
44961
44459
  if (r.status !== 0) {
44962
44460
  ok = false;
44963
44461
  break;
@@ -45008,7 +44506,7 @@ function normalizePluginName(name) {
45008
44506
  return atIndex === -1 ? trimmed : trimmed.slice(0, atIndex);
45009
44507
  }
45010
44508
  function readInstalledOfficialPlugins() {
45011
- const listResult = (0, import_child_process3.spawnSync)("claude", ["plugin", "list", "--json"], {
44509
+ const listResult = (0, import_child_process2.spawnSync)("claude", ["plugin", "list", "--json"], {
45012
44510
  encoding: "utf8",
45013
44511
  stdio: "pipe",
45014
44512
  timeout: 1e4
@@ -45036,14 +44534,14 @@ function readInstalledOfficialPlugins() {
45036
44534
  return installedNames;
45037
44535
  }
45038
44536
  function ensureOfficialMarketplace() {
45039
- const listResult = (0, import_child_process3.spawnSync)("claude", ["plugin", "marketplace", "list"], {
44537
+ const listResult = (0, import_child_process2.spawnSync)("claude", ["plugin", "marketplace", "list"], {
45040
44538
  encoding: "utf8",
45041
44539
  stdio: "pipe",
45042
44540
  timeout: 1e4
45043
44541
  });
45044
44542
  const output = listResult.stdout ?? "";
45045
44543
  if (output.includes(OFFICIAL_MARKETPLACE)) return;
45046
- (0, import_child_process3.spawnSync)("claude", [
44544
+ (0, import_child_process2.spawnSync)("claude", [
45047
44545
  "plugin",
45048
44546
  "marketplace",
45049
44547
  "add",
@@ -45051,12 +44549,12 @@ function ensureOfficialMarketplace() {
45051
44549
  ], { stdio: "inherit", timeout: 12e4 });
45052
44550
  }
45053
44551
  function tryInstallOfficialPlugin(pluginName) {
45054
- const directInstall = (0, import_child_process3.spawnSync)("claude", ["plugin", "install", pluginName, "--scope", "user"], { stdio: "inherit" });
44552
+ const directInstall = (0, import_child_process2.spawnSync)("claude", ["plugin", "install", pluginName, "--scope", "user"], { stdio: "inherit" });
45055
44553
  if (directInstall.status === 0) {
45056
44554
  return true;
45057
44555
  }
45058
44556
  const marketplaceQualified = `${pluginName}@${OFFICIAL_MARKETPLACE}`;
45059
- const marketplaceInstall = (0, import_child_process3.spawnSync)("claude", ["plugin", "install", marketplaceQualified, "--scope", "user"], { stdio: "inherit" });
44557
+ const marketplaceInstall = (0, import_child_process2.spawnSync)("claude", ["plugin", "install", marketplaceQualified, "--scope", "user"], { stdio: "inherit" });
45060
44558
  return marketplaceInstall.status === 0;
45061
44559
  }
45062
44560
  function ensureOfficialPlugins(dryRun) {
@@ -45115,9 +44613,9 @@ function getProjectSettingsPath(repoRoot) {
45115
44613
  return import_node_path6.default.join(repoRoot, ".claude", "settings.json");
45116
44614
  }
45117
44615
  function hasXtrmHookWiring(settingsPath) {
45118
- if (!import_fs_extra9.default.existsSync(settingsPath)) return false;
44616
+ if (!import_fs_extra8.default.existsSync(settingsPath)) return false;
45119
44617
  try {
45120
- const data = import_fs_extra9.default.readJsonSync(settingsPath);
44618
+ const data = import_fs_extra8.default.readJsonSync(settingsPath);
45121
44619
  const groups = Object.values(data.hooks ?? {});
45122
44620
  for (const wrappers of groups) {
45123
44621
  for (const wrapper of wrappers) {
@@ -45231,6 +44729,682 @@ var import_fs_extra11 = __toESM(require_lib(), 1);
45231
44729
  var import_path5 = __toESM(require("path"), 1);
45232
44730
  var import_node_child_process3 = require("child_process");
45233
44731
  var import_node_os2 = require("os");
44732
+
44733
+ // src/core/pi-runtime.ts
44734
+ var import_child_process3 = require("child_process");
44735
+ var import_fs_extra9 = __toESM(require_lib(), 1);
44736
+ var import_path4 = __toESM(require("path"), 1);
44737
+ var import_node_os = require("os");
44738
+ function resolvePkgRoot() {
44739
+ const candidates = [
44740
+ import_path4.default.resolve(__dirname, "../.."),
44741
+ import_path4.default.resolve(__dirname, "../../..")
44742
+ ];
44743
+ for (const c of candidates) {
44744
+ if (import_fs_extra9.default.existsSync(import_path4.default.join(c, ".xtrm", "extensions"))) return c;
44745
+ }
44746
+ return candidates[0];
44747
+ }
44748
+ var PI_AGENT_DIR = process.env.PI_AGENT_DIR || import_path4.default.join((0, import_node_os.homedir)(), ".pi", "agent");
44749
+ var PI_MCP_ADAPTER_OVERRIDE_DIR = import_path4.default.join(PI_AGENT_DIR, "extensions", "pi-mcp-adapter");
44750
+ var PI_MCP_ADAPTER_REQUIRED_ENTRY = "commands.js";
44751
+ var PROJECT_EXTENSIONS_ENTRY = "../.xtrm/extensions";
44752
+ var PROJECT_SKILLS_ENTRY = "../.xtrm/skills/active/pi";
44753
+ var MANAGED_EXTENSIONS = [
44754
+ { id: "core", displayName: "@xtrm/pi-core", isLibrary: true, required: true },
44755
+ { id: "auto-session-name", displayName: "auto-session-name", required: false },
44756
+ { id: "auto-update", displayName: "auto-update", required: false },
44757
+ { id: "beads", displayName: "beads", required: true },
44758
+ { id: "compact-header", displayName: "compact-header", required: false },
44759
+ { id: "custom-footer", displayName: "custom-footer", required: true },
44760
+ { id: "custom-provider-qwen-cli", displayName: "custom-provider-qwen-cli", required: false },
44761
+ { id: "git-checkpoint", displayName: "git-checkpoint", required: false },
44762
+ { id: "lsp-bootstrap", displayName: "lsp-bootstrap", required: false },
44763
+ { id: "pi-serena-compact", displayName: "pi-serena-compact", required: false },
44764
+ { id: "quality-gates", displayName: "quality-gates", required: true },
44765
+ { id: "service-skills", displayName: "service-skills", required: false },
44766
+ { id: "session-flow", displayName: "session-flow", required: true },
44767
+ { id: "xtrm-loader", displayName: "xtrm-loader", required: true },
44768
+ { id: "xtrm-ui", displayName: "xtrm-ui", required: true }
44769
+ ];
44770
+ var MANAGED_PACKAGES = [
44771
+ { id: "npm:pi-gitnexus", displayName: "pi-gitnexus", required: true },
44772
+ { id: "npm:pi-serena-tools", displayName: "pi-serena-tools", required: true },
44773
+ { id: "npm:@zenobius/pi-worktrees", displayName: "pi-worktrees", required: true },
44774
+ { id: "npm:@robhowley/pi-structured-return", displayName: "pi-structured-return", required: true },
44775
+ { id: "npm:@aliou/pi-guardrails", displayName: "pi-guardrails", required: false },
44776
+ { id: "npm:@aliou/pi-processes", displayName: "pi-processes", required: true }
44777
+ ];
44778
+ var ALWAYS_GLOBAL_INSTALL_PACKAGE_IDS = /* @__PURE__ */ new Set([
44779
+ "npm:pi-gitnexus",
44780
+ "npm:pi-serena-tools"
44781
+ ]);
44782
+ function getInstalledPiPackages() {
44783
+ const result = (0, import_child_process3.spawnSync)("pi", ["list"], { encoding: "utf8", stdio: "pipe" });
44784
+ if (result.status !== 0) return [];
44785
+ const output = result.stdout;
44786
+ const packages = [];
44787
+ for (const line of output.split("\n")) {
44788
+ const match = line.match(/^\s+(npm:[\w\-/@]+)/);
44789
+ if (match) packages.push(match[1]);
44790
+ }
44791
+ return packages.sort();
44792
+ }
44793
+ async function listInstalledExtensions(targetDir) {
44794
+ if (!await import_fs_extra9.default.pathExists(targetDir)) return [];
44795
+ const entries = await import_fs_extra9.default.readdir(targetDir, { withFileTypes: true });
44796
+ return entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name).sort();
44797
+ }
44798
+ async function inventoryPiRuntime(sourceDir, targetDir) {
44799
+ const installedExtNames = await listInstalledExtensions(targetDir);
44800
+ const extensionStatuses = [];
44801
+ const missingExtensions = [];
44802
+ const staleExtensions = [];
44803
+ const orphanedExtensions = [];
44804
+ for (const ext of MANAGED_EXTENSIONS) {
44805
+ const srcPath = import_path4.default.join(sourceDir, ext.id);
44806
+ const dstPath = import_path4.default.join(targetDir, ext.id);
44807
+ const srcExists = await import_fs_extra9.default.pathExists(srcPath);
44808
+ const dstExists = await import_fs_extra9.default.pathExists(dstPath);
44809
+ if (!srcExists) {
44810
+ continue;
44811
+ }
44812
+ if (!dstExists) {
44813
+ const status2 = { ext, installed: false };
44814
+ extensionStatuses.push(status2);
44815
+ missingExtensions.push(status2);
44816
+ continue;
44817
+ }
44818
+ let isStale = false;
44819
+ if (srcPath !== dstPath) {
44820
+ const dstStat = await import_fs_extra9.default.lstat(dstPath);
44821
+ if (dstStat.isSymbolicLink()) {
44822
+ const linkTarget = await import_fs_extra9.default.readlink(dstPath);
44823
+ const resolvedTarget = import_path4.default.resolve(import_path4.default.dirname(dstPath), linkTarget);
44824
+ isStale = resolvedTarget !== import_path4.default.resolve(srcPath);
44825
+ } else {
44826
+ isStale = true;
44827
+ }
44828
+ }
44829
+ const status = {
44830
+ ext,
44831
+ installed: true,
44832
+ stale: isStale
44833
+ };
44834
+ extensionStatuses.push(status);
44835
+ if (isStale) {
44836
+ staleExtensions.push(status);
44837
+ }
44838
+ }
44839
+ const managedIds = new Set(MANAGED_EXTENSIONS.map((e) => e.id));
44840
+ for (const name of installedExtNames) {
44841
+ if (!managedIds.has(name)) {
44842
+ orphanedExtensions.push(name);
44843
+ }
44844
+ }
44845
+ const installedPkgIds = getInstalledPiPackages();
44846
+ const packageStatuses = [];
44847
+ const missingPackages = [];
44848
+ for (const pkg of MANAGED_PACKAGES) {
44849
+ const isInstalled = installedPkgIds.includes(pkg.id);
44850
+ const status = { pkg, installed: isInstalled };
44851
+ packageStatuses.push(status);
44852
+ if (!isInstalled) {
44853
+ missingPackages.push(status);
44854
+ }
44855
+ }
44856
+ const allRequiredPresent = missingExtensions.every((s) => !s.ext.required) && staleExtensions.every((s) => !s.ext.required) && missingPackages.every((s) => !s.pkg.required);
44857
+ const allPresent = missingExtensions.length === 0 && staleExtensions.length === 0 && orphanedExtensions.length === 0 && missingPackages.length === 0;
44858
+ return {
44859
+ extensions: extensionStatuses,
44860
+ packages: packageStatuses,
44861
+ missingExtensions,
44862
+ staleExtensions,
44863
+ orphanedExtensions,
44864
+ missingPackages,
44865
+ allRequiredPresent,
44866
+ allPresent
44867
+ };
44868
+ }
44869
+ function renderPiRuntimePlan(plan) {
44870
+ console.log(kleur_default.bold("\n Pi Runtime"));
44871
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
44872
+ const extTotal = plan.extensions.length;
44873
+ const extOk = plan.extensions.filter((s) => s.installed && !s.stale).length;
44874
+ console.log(kleur_default.dim(` Extensions: ${extOk}/${extTotal} up-to-date`));
44875
+ if (plan.missingExtensions.length > 0) {
44876
+ const names = plan.missingExtensions.map((s) => s.ext.displayName).join(", ");
44877
+ console.log(kleur_default.yellow(` Missing: ${names}`));
44878
+ }
44879
+ if (plan.staleExtensions.length > 0) {
44880
+ const names = plan.staleExtensions.map((s) => s.ext.displayName).join(", ");
44881
+ console.log(kleur_default.yellow(` Stale: ${names}`));
44882
+ }
44883
+ if (plan.orphanedExtensions.length > 0) {
44884
+ const names = plan.orphanedExtensions.join(", ");
44885
+ console.log(kleur_default.red(` Orphaned: ${names} (will remove)`));
44886
+ }
44887
+ const pkgTotal = plan.packages.length;
44888
+ const pkgOk = plan.packages.filter((s) => s.installed).length;
44889
+ console.log(kleur_default.dim(` Packages: ${pkgOk}/${pkgTotal} installed`));
44890
+ if (plan.missingPackages.length > 0) {
44891
+ const names = plan.missingPackages.map((s) => s.pkg.displayName).join(", ");
44892
+ console.log(kleur_default.yellow(` Missing: ${names}`));
44893
+ }
44894
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
44895
+ if (plan.allPresent) {
44896
+ console.log(t.success(" \u2713 All extensions and packages present.\n"));
44897
+ } else if (plan.allRequiredPresent) {
44898
+ console.log(t.success(" \u2713 All required items present."));
44899
+ const optionalMissing = [
44900
+ ...plan.missingExtensions.filter((s) => !s.ext.required),
44901
+ ...plan.missingPackages.filter((s) => !s.pkg.required)
44902
+ ];
44903
+ if (optionalMissing.length > 0) {
44904
+ const names = optionalMissing.map(
44905
+ (s) => "ext" in s ? s.ext.displayName : s.pkg.displayName
44906
+ ).join(", ");
44907
+ console.log(kleur_default.dim(` \u25CB Optional not installed: ${names}
44908
+ `));
44909
+ } else {
44910
+ console.log("");
44911
+ }
44912
+ } else {
44913
+ console.log(kleur_default.yellow(" \u26A0 Missing required items.\n"));
44914
+ }
44915
+ }
44916
+ function mergePiSyncResults(base, incoming) {
44917
+ return {
44918
+ extensionsAdded: [...base.extensionsAdded, ...incoming.extensionsAdded],
44919
+ extensionsUpdated: [...base.extensionsUpdated, ...incoming.extensionsUpdated],
44920
+ extensionsRemoved: [...base.extensionsRemoved, ...incoming.extensionsRemoved],
44921
+ packagesInstalled: [...base.packagesInstalled, ...incoming.packagesInstalled],
44922
+ failed: [...base.failed, ...incoming.failed]
44923
+ };
44924
+ }
44925
+ function parseNpmPackageName(piPackageId) {
44926
+ if (!piPackageId.startsWith("npm:")) return null;
44927
+ const npmPackageName = piPackageId.slice(4).trim();
44928
+ return npmPackageName.length > 0 ? npmPackageName : null;
44929
+ }
44930
+ async function isPackagePresentInPiAgent(agentDir, piPackageId) {
44931
+ const npmPackageName = parseNpmPackageName(piPackageId);
44932
+ if (!npmPackageName) return false;
44933
+ const packageDir = import_path4.default.join(agentDir, "npm", "node_modules", npmPackageName);
44934
+ return import_fs_extra9.default.pathExists(packageDir);
44935
+ }
44936
+ async function ensureAlwaysGlobalPiPackages(dryRun, log, agentDir = PI_AGENT_DIR, installRunner = (piPackageId) => {
44937
+ const installResult = (0, import_child_process3.spawnSync)("pi", ["install", piPackageId], { stdio: "pipe", encoding: "utf8" });
44938
+ return installResult.status;
44939
+ }) {
44940
+ const installed = [];
44941
+ const failed = [];
44942
+ const packagesToEnsure = MANAGED_PACKAGES.filter((pkg) => ALWAYS_GLOBAL_INSTALL_PACKAGE_IDS.has(pkg.id));
44943
+ for (const pkg of packagesToEnsure) {
44944
+ if (await isPackagePresentInPiAgent(agentDir, pkg.id)) {
44945
+ continue;
44946
+ }
44947
+ if (dryRun) {
44948
+ log?.(`[DRY RUN] pi install ${pkg.id}`);
44949
+ continue;
44950
+ }
44951
+ const installStatus = installRunner(pkg.id);
44952
+ if (installStatus === 0) {
44953
+ installed.push(pkg.id);
44954
+ log?.(`${sym.ok} ${pkg.displayName} (global)`);
44955
+ continue;
44956
+ }
44957
+ failed.push(pkg.id);
44958
+ log?.(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 global install failed`));
44959
+ }
44960
+ return { installed, failed };
44961
+ }
44962
+ async function ensureCorePackageSymlink(coreSrcDir, projectRoot, dryRun, log) {
44963
+ if (!await import_fs_extra9.default.pathExists(coreSrcDir)) return "missing-source";
44964
+ const extensionsDir = import_path4.default.join(projectRoot, ".xtrm", "extensions");
44965
+ const nodeModulesDir = import_path4.default.join(extensionsDir, "node_modules", "@xtrm");
44966
+ const symlinkPath = import_path4.default.join(nodeModulesDir, "pi-core");
44967
+ const expectedTarget = import_path4.default.resolve(coreSrcDir);
44968
+ const existing = await import_fs_extra9.default.lstat(symlinkPath).catch(() => null);
44969
+ if (existing) {
44970
+ if (existing.isSymbolicLink()) {
44971
+ const currentLinkTarget = await import_fs_extra9.default.readlink(symlinkPath);
44972
+ const resolvedTarget = import_path4.default.resolve(import_path4.default.dirname(symlinkPath), currentLinkTarget);
44973
+ if (resolvedTarget === expectedTarget) {
44974
+ return "ok";
44975
+ }
44976
+ }
44977
+ if (dryRun) {
44978
+ log?.(kleur_default.dim("[DRY RUN] would repair @xtrm/pi-core symlink target"));
44979
+ return "would-repair";
44980
+ }
44981
+ await import_fs_extra9.default.remove(symlinkPath);
44982
+ await import_fs_extra9.default.ensureDir(nodeModulesDir);
44983
+ const relTarget2 = import_path4.default.relative(nodeModulesDir, coreSrcDir);
44984
+ await import_fs_extra9.default.symlink(relTarget2, symlinkPath);
44985
+ log?.(kleur_default.dim("Repaired @xtrm/pi-core symlink \u2192 .xtrm/extensions/node_modules/@xtrm/pi-core"));
44986
+ return "repaired";
44987
+ }
44988
+ if (dryRun) {
44989
+ log?.(kleur_default.dim("[DRY RUN] would create @xtrm/pi-core symlink"));
44990
+ return "would-create";
44991
+ }
44992
+ await import_fs_extra9.default.ensureDir(nodeModulesDir);
44993
+ const relTarget = import_path4.default.relative(nodeModulesDir, coreSrcDir);
44994
+ await import_fs_extra9.default.symlink(relTarget, symlinkPath);
44995
+ log?.(kleur_default.dim("Created @xtrm/pi-core symlink \u2192 .xtrm/extensions/node_modules/@xtrm/pi-core"));
44996
+ return "created";
44997
+ }
44998
+ async function remediateStalePiMcpAdapterOverride(dryRun, log) {
44999
+ const stat = await import_fs_extra9.default.lstat(PI_MCP_ADAPTER_OVERRIDE_DIR).catch(() => null);
45000
+ if (!stat) {
45001
+ return {
45002
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
45003
+ found: false,
45004
+ stale: false,
45005
+ remediated: false
45006
+ };
45007
+ }
45008
+ if (stat.isSymbolicLink()) {
45009
+ return {
45010
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
45011
+ found: true,
45012
+ stale: false,
45013
+ remediated: false
45014
+ };
45015
+ }
45016
+ const hasRequiredEntry = await import_fs_extra9.default.pathExists(import_path4.default.join(PI_MCP_ADAPTER_OVERRIDE_DIR, PI_MCP_ADAPTER_REQUIRED_ENTRY));
45017
+ if (stat.isDirectory() && hasRequiredEntry) {
45018
+ return {
45019
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
45020
+ found: true,
45021
+ stale: false,
45022
+ remediated: false
45023
+ };
45024
+ }
45025
+ const reason = stat.isDirectory() ? `missing ${PI_MCP_ADAPTER_REQUIRED_ENTRY}` : "not a directory/symlink";
45026
+ if (dryRun) {
45027
+ log?.(kleur_default.dim(`[DRY RUN] would remove stale pi-mcp-adapter override (${reason})`));
45028
+ return {
45029
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
45030
+ found: true,
45031
+ stale: true,
45032
+ remediated: false,
45033
+ reason
45034
+ };
45035
+ }
45036
+ await import_fs_extra9.default.remove(PI_MCP_ADAPTER_OVERRIDE_DIR);
45037
+ log?.(kleur_default.dim(`Removed stale pi-mcp-adapter override (${reason})`));
45038
+ return {
45039
+ path: PI_MCP_ADAPTER_OVERRIDE_DIR,
45040
+ found: true,
45041
+ stale: true,
45042
+ remediated: true,
45043
+ reason
45044
+ };
45045
+ }
45046
+ async function runPiLaunchPreflight(projectRoot, dryRun, log) {
45047
+ const staleOverride = await remediateStalePiMcpAdapterOverride(dryRun, log);
45048
+ const coreSymlinkStatus = await ensureCorePackageSymlink(
45049
+ import_path4.default.join(projectRoot, ".xtrm", "extensions", "core"),
45050
+ projectRoot,
45051
+ dryRun,
45052
+ log
45053
+ );
45054
+ return {
45055
+ coreSymlinkStatus,
45056
+ staleOverride
45057
+ };
45058
+ }
45059
+ function isXtrmExtensionsSetting(entry) {
45060
+ const normalizedEntry = entry.replaceAll("\\", "/").replace(/\/$/, "");
45061
+ return normalizedEntry === PROJECT_EXTENSIONS_ENTRY || normalizedEntry === ".xtrm/extensions";
45062
+ }
45063
+ async function cleanupLegacyProjectExtensionCopies(projectRoot, dryRun, log) {
45064
+ const piSettingsPath = import_path4.default.join(projectRoot, ".pi", "settings.json");
45065
+ let existingSettings = {};
45066
+ try {
45067
+ existingSettings = await import_fs_extra9.default.readJson(piSettingsPath);
45068
+ } catch {
45069
+ return { removed: [], failed: [] };
45070
+ }
45071
+ const pointsToXtrmExtensions = (existingSettings.extensions ?? []).some(isXtrmExtensionsSetting);
45072
+ if (!pointsToXtrmExtensions) return { removed: [], failed: [] };
45073
+ const legacyExtensionsDir = import_path4.default.join(projectRoot, ".pi", "extensions");
45074
+ if (!await import_fs_extra9.default.pathExists(legacyExtensionsDir)) return { removed: [], failed: [] };
45075
+ const removed = [];
45076
+ const failed = [];
45077
+ for (const ext of MANAGED_EXTENSIONS) {
45078
+ const legacyExtPath = import_path4.default.join(legacyExtensionsDir, ext.id);
45079
+ const legacyStat = await import_fs_extra9.default.lstat(legacyExtPath).catch(() => null);
45080
+ if (!legacyStat || legacyStat.isSymbolicLink() || !legacyStat.isDirectory()) {
45081
+ continue;
45082
+ }
45083
+ if (dryRun) {
45084
+ log?.(kleur_default.dim(`[DRY RUN] - .pi/extensions/${ext.id} (legacy copy)`));
45085
+ continue;
45086
+ }
45087
+ try {
45088
+ await import_fs_extra9.default.remove(legacyExtPath);
45089
+ removed.push(ext.id);
45090
+ log?.(kleur_default.dim(`Removed legacy .pi/extensions/${ext.id}`));
45091
+ } catch (err) {
45092
+ failed.push(ext.id);
45093
+ log?.(kleur_default.red(`\u2717 Failed to remove legacy .pi/extensions/${ext.id}: ${err}`));
45094
+ }
45095
+ }
45096
+ return { removed, failed };
45097
+ }
45098
+ async function updatePiSettings(projectRoot, dryRun, log) {
45099
+ const piSettingsPath = import_path4.default.join(projectRoot, ".pi", "settings.json");
45100
+ if (dryRun) {
45101
+ log?.(kleur_default.dim(`[DRY RUN] would update .pi/settings.json`));
45102
+ return;
45103
+ }
45104
+ let existingSettings = {};
45105
+ try {
45106
+ existingSettings = await import_fs_extra9.default.readJson(piSettingsPath);
45107
+ } catch {
45108
+ }
45109
+ const existingPackages = (existingSettings.packages ?? []).filter(
45110
+ (p) => !p.startsWith("./extensions/")
45111
+ );
45112
+ await import_fs_extra9.default.ensureDir(import_path4.default.join(projectRoot, ".pi"));
45113
+ await import_fs_extra9.default.writeJson(piSettingsPath, {
45114
+ ...existingSettings,
45115
+ extensions: [],
45116
+ // Empty = Pi uses global ~/.pi/agent/extensions/
45117
+ skills: [PROJECT_SKILLS_ENTRY],
45118
+ packages: []
45119
+ // Empty = packages installed globally at ~/.pi/agent/settings.json
45120
+ }, { spaces: 2 });
45121
+ log?.(kleur_default.dim(`Updated .pi/settings.json \u2192 global extensions + packages + .xtrm/skills/active/pi`));
45122
+ }
45123
+ async function executePiSync(plan, sourceDir, targetDir, opts = {}) {
45124
+ const {
45125
+ dryRun = false,
45126
+ isGlobal = false,
45127
+ projectRoot,
45128
+ removeOrphaned = true,
45129
+ log = (msg) => console.log(kleur_default.dim(` ${msg}`))
45130
+ } = opts;
45131
+ const result = {
45132
+ extensionsAdded: [],
45133
+ extensionsUpdated: [],
45134
+ extensionsRemoved: [],
45135
+ packagesInstalled: [],
45136
+ failed: []
45137
+ };
45138
+ if (!dryRun) {
45139
+ await import_fs_extra9.default.ensureDir(targetDir);
45140
+ }
45141
+ const toSync = [...plan.missingExtensions, ...plan.staleExtensions];
45142
+ for (const status of toSync) {
45143
+ const { ext } = status;
45144
+ const srcPath = import_path4.default.join(sourceDir, ext.id);
45145
+ const dstPath = import_path4.default.join(targetDir, ext.id);
45146
+ if (dryRun) {
45147
+ log(`[DRY RUN] ${status.installed ? "\u21BB" : "+"} ${ext.displayName}`);
45148
+ continue;
45149
+ }
45150
+ try {
45151
+ await import_fs_extra9.default.remove(dstPath);
45152
+ const relTarget = import_path4.default.relative(targetDir, srcPath);
45153
+ await import_fs_extra9.default.symlink(relTarget, dstPath);
45154
+ if (status.installed) {
45155
+ result.extensionsUpdated.push(ext.id);
45156
+ log(`\u21BB ${ext.displayName} (symlinked)`);
45157
+ } else {
45158
+ result.extensionsAdded.push(ext.id);
45159
+ log(`+ ${ext.displayName} (symlinked)`);
45160
+ }
45161
+ } catch (err) {
45162
+ result.failed.push(ext.id);
45163
+ log(kleur_default.red(`\u2717 ${ext.displayName}: ${err}`));
45164
+ }
45165
+ }
45166
+ if (removeOrphaned && plan.orphanedExtensions.length > 0) {
45167
+ for (const orphanId of plan.orphanedExtensions) {
45168
+ const orphanPath = import_path4.default.join(targetDir, orphanId);
45169
+ if (dryRun) {
45170
+ log(kleur_default.red(`[DRY RUN] - ${orphanId} (orphaned)`));
45171
+ continue;
45172
+ }
45173
+ try {
45174
+ await import_fs_extra9.default.remove(orphanPath);
45175
+ result.extensionsRemoved.push(orphanId);
45176
+ log(kleur_default.red(`- ${orphanId} (orphaned)`));
45177
+ } catch (err) {
45178
+ result.failed.push(orphanId);
45179
+ log(kleur_default.red(`\u2717 ${orphanId}: ${err}`));
45180
+ }
45181
+ }
45182
+ }
45183
+ for (const status of plan.missingPackages) {
45184
+ const { pkg } = status;
45185
+ const installArgs = ["install", pkg.id];
45186
+ if (dryRun) {
45187
+ log(`[DRY RUN] pi ${installArgs.join(" ")}`);
45188
+ continue;
45189
+ }
45190
+ try {
45191
+ const r = (0, import_child_process3.spawnSync)("pi", installArgs, { stdio: "pipe", encoding: "utf8" });
45192
+ if (r.status === 0) {
45193
+ result.packagesInstalled.push(pkg.id);
45194
+ log(`${sym.ok} ${pkg.displayName}`);
45195
+ } else {
45196
+ result.failed.push(pkg.id);
45197
+ log(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 install failed`));
45198
+ }
45199
+ } catch (err) {
45200
+ result.failed.push(pkg.id);
45201
+ log(kleur_default.red(`\u2717 ${pkg.displayName}: ${err}`));
45202
+ }
45203
+ }
45204
+ return result;
45205
+ }
45206
+ var EXTENSION_SOURCE_DIR = "ext-src";
45207
+ async function linkExtensionsToGlobal(repoRoot, dryRun = false, log = (msg) => console.log(kleur_default.dim(` ${msg}`))) {
45208
+ const globalExtDir = import_path4.default.join(PI_AGENT_DIR, "extensions");
45209
+ const repoExtDir = import_path4.default.join(repoRoot, ".xtrm", EXTENSION_SOURCE_DIR);
45210
+ const linked = [];
45211
+ const failed = [];
45212
+ if (!await import_fs_extra9.default.pathExists(repoExtDir)) {
45213
+ log("No .xtrm/ext-src/ found \u2014 skipping global link");
45214
+ return { linked, failed };
45215
+ }
45216
+ if (dryRun) {
45217
+ log("[DRY RUN] would create extension symlinks in ~/.pi/agent/extensions/");
45218
+ return { linked, failed };
45219
+ }
45220
+ await import_fs_extra9.default.ensureDir(globalExtDir);
45221
+ const coreNodeModulesDir = import_path4.default.join(globalExtDir, "node_modules", "@xtrm");
45222
+ const coreSymlinkPath = import_path4.default.join(coreNodeModulesDir, "pi-core");
45223
+ const coreRelativeTarget = import_path4.default.join("..", "..", "core");
45224
+ try {
45225
+ await import_fs_extra9.default.ensureDir(coreNodeModulesDir);
45226
+ const existing = await import_fs_extra9.default.lstat(coreSymlinkPath).catch(() => null);
45227
+ if (existing) await import_fs_extra9.default.remove(coreSymlinkPath);
45228
+ await import_fs_extra9.default.symlink(coreRelativeTarget, coreSymlinkPath);
45229
+ log("\u2713 @xtrm/pi-core \u2192 global node_modules");
45230
+ } catch (err) {
45231
+ log(kleur_default.yellow(`\u26A0 @xtrm/pi-core symlink: ${err}`));
45232
+ }
45233
+ const entries = await import_fs_extra9.default.readdir(repoExtDir, { withFileTypes: true });
45234
+ for (const entry of entries) {
45235
+ if (!entry.isDirectory()) continue;
45236
+ if (entry.name === "node_modules") continue;
45237
+ const extPath = import_path4.default.join(repoExtDir, entry.name);
45238
+ const globalLink = import_path4.default.join(globalExtDir, entry.name);
45239
+ try {
45240
+ const existing = await import_fs_extra9.default.lstat(globalLink).catch(() => null);
45241
+ if (existing) {
45242
+ if (existing.isSymbolicLink()) {
45243
+ const currentTarget = await import_fs_extra9.default.readlink(globalLink);
45244
+ const resolvedTarget = import_path4.default.resolve(import_path4.default.dirname(globalLink), currentTarget);
45245
+ if (resolvedTarget === import_path4.default.resolve(extPath)) {
45246
+ continue;
45247
+ }
45248
+ }
45249
+ await import_fs_extra9.default.remove(globalLink);
45250
+ }
45251
+ await import_fs_extra9.default.symlink(extPath, globalLink);
45252
+ linked.push(entry.name);
45253
+ log(`\u2713 ${entry.name} \u2192 .xtrm/${EXTENSION_SOURCE_DIR}/${entry.name}`);
45254
+ } catch (err) {
45255
+ failed.push(entry.name);
45256
+ log(kleur_default.red(`\u2717 ${entry.name}: ${err}`));
45257
+ }
45258
+ }
45259
+ return { linked, failed };
45260
+ }
45261
+ async function ensureNpmPackageExtensionSymlinks(log) {
45262
+ const os9 = require("os");
45263
+ const homeDir = os9.homedir();
45264
+ const extensionsDir = import_path4.default.join(homeDir, ".pi", "agent", "extensions");
45265
+ await import_fs_extra9.default.ensureDir(extensionsDir);
45266
+ const npmPrefix = (0, import_child_process3.spawnSync)("npm", ["prefix", "-g"], { encoding: "utf8" }).stdout.trim();
45267
+ const globalNodeModules = import_path4.default.join(npmPrefix, "lib", "node_modules");
45268
+ const npmPackages = [
45269
+ { packageName: "pi-gitnexus", symlinkName: "gitnexus" },
45270
+ { packageName: "pi-serena-tools", symlinkName: "serena" }
45271
+ ];
45272
+ for (const { packageName, symlinkName } of npmPackages) {
45273
+ const packagePath = import_path4.default.join(globalNodeModules, packageName);
45274
+ const symlinkPath = import_path4.default.join(extensionsDir, symlinkName);
45275
+ const packageExists = await import_fs_extra9.default.pathExists(packagePath);
45276
+ if (!packageExists) {
45277
+ log?.(kleur_default.yellow(` \u26A0 ${packageName} not found in ${globalNodeModules}, skipping symlink`));
45278
+ continue;
45279
+ }
45280
+ const symlinkExists = await import_fs_extra9.default.lstat(symlinkPath).catch(() => null);
45281
+ if (symlinkExists?.isSymbolicLink()) {
45282
+ const currentTarget = await import_fs_extra9.default.readlink(symlinkPath);
45283
+ const resolvedTarget = import_path4.default.resolve(extensionsDir, currentTarget);
45284
+ if (resolvedTarget === packagePath) {
45285
+ log?.(kleur_default.dim(` \u2713 ${symlinkName} symlink already correct`));
45286
+ continue;
45287
+ }
45288
+ log?.(kleur_default.dim(` Removing stale ${symlinkName} symlink`));
45289
+ await import_fs_extra9.default.remove(symlinkPath);
45290
+ } else if (symlinkExists) {
45291
+ log?.(kleur_default.dim(` Removing stale ${symlinkName} (not a symlink)`));
45292
+ await import_fs_extra9.default.remove(symlinkPath);
45293
+ }
45294
+ const relativeTarget = import_path4.default.relative(extensionsDir, packagePath);
45295
+ await import_fs_extra9.default.symlink(relativeTarget, symlinkPath);
45296
+ log?.(kleur_default.dim(` Created ${symlinkName} symlink \u2192 ${relativeTarget}`));
45297
+ }
45298
+ }
45299
+ async function runPiRuntimeSync(opts = {}) {
45300
+ const { dryRun = false, isGlobal = false, projectRoot } = opts;
45301
+ const pkgRoot = resolvePkgRoot();
45302
+ const sourceDir = import_path4.default.join(pkgRoot, ".xtrm", "extensions");
45303
+ const resolvedProjectRoot = projectRoot || process.cwd();
45304
+ const log = (msg) => console.log(kleur_default.dim(` ${msg}`));
45305
+ const emptyResult = {
45306
+ extensionsAdded: [],
45307
+ extensionsUpdated: [],
45308
+ extensionsRemoved: [],
45309
+ packagesInstalled: [],
45310
+ failed: []
45311
+ };
45312
+ const result = { ...emptyResult };
45313
+ if (!await import_fs_extra9.default.pathExists(sourceDir)) {
45314
+ console.log(kleur_default.dim("\n Managed extensions: skipped (not bundled in npm package)\n"));
45315
+ return result;
45316
+ }
45317
+ const preflight = await runPiLaunchPreflight(resolvedProjectRoot, dryRun, log);
45318
+ if (preflight.staleOverride.remediated) {
45319
+ result.extensionsRemoved.push("pi-mcp-adapter");
45320
+ }
45321
+ if (isGlobal) {
45322
+ const targetDir = import_path4.default.join(PI_AGENT_DIR, "extensions");
45323
+ const plan = await inventoryPiRuntime(sourceDir, targetDir);
45324
+ renderPiRuntimePlan(plan);
45325
+ if (plan.allPresent) return result;
45326
+ const synced = await executePiSync(plan, sourceDir, targetDir, {
45327
+ dryRun,
45328
+ isGlobal: true,
45329
+ removeOrphaned: true
45330
+ });
45331
+ return mergePiSyncResults(result, synced);
45332
+ }
45333
+ const linkResult = await linkExtensionsToGlobal(resolvedProjectRoot, dryRun, log);
45334
+ result.extensionsAdded.push(...linkResult.linked);
45335
+ result.failed.push(...linkResult.failed);
45336
+ await ensureNpmPackageExtensionSymlinks(log);
45337
+ const installedPkgIds = getInstalledPiPackages();
45338
+ const packageStatuses = [];
45339
+ const missingPackages = [];
45340
+ for (const pkg of MANAGED_PACKAGES) {
45341
+ const isInstalled = installedPkgIds.includes(pkg.id);
45342
+ const status = { pkg, installed: isInstalled };
45343
+ packageStatuses.push(status);
45344
+ if (!isInstalled) missingPackages.push(status);
45345
+ }
45346
+ console.log(kleur_default.bold("\n Pi Runtime"));
45347
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
45348
+ console.log(kleur_default.dim(` Extensions: ~/.pi/agent/extensions/ \u2192 .xtrm/${EXTENSION_SOURCE_DIR}/`));
45349
+ const pkgOk = packageStatuses.filter((s) => s.installed).length;
45350
+ console.log(kleur_default.dim(` Packages: ${pkgOk}/${packageStatuses.length} installed`));
45351
+ if (missingPackages.length > 0) {
45352
+ const names = missingPackages.map((s) => s.pkg.displayName).join(", ");
45353
+ console.log(kleur_default.yellow(` Missing: ${names}`));
45354
+ }
45355
+ console.log(kleur_default.dim(" " + "-".repeat(50)));
45356
+ const legacyCleanup = await cleanupLegacyProjectExtensionCopies(resolvedProjectRoot, dryRun, log);
45357
+ result.extensionsRemoved.push(...legacyCleanup.removed);
45358
+ result.failed.push(...legacyCleanup.failed);
45359
+ for (const status of missingPackages) {
45360
+ const { pkg } = status;
45361
+ if (dryRun) {
45362
+ log(`[DRY RUN] pi install ${pkg.id}`);
45363
+ continue;
45364
+ }
45365
+ try {
45366
+ const r = (0, import_child_process3.spawnSync)("pi", ["install", pkg.id], { stdio: "pipe", encoding: "utf8" });
45367
+ if (r.status === 0) {
45368
+ result.packagesInstalled.push(pkg.id);
45369
+ log(`${sym.ok} ${pkg.displayName}`);
45370
+ } else {
45371
+ result.failed.push(pkg.id);
45372
+ log(kleur_default.yellow(`\u26A0 ${pkg.displayName} \u2014 install failed`));
45373
+ }
45374
+ } catch (err) {
45375
+ result.failed.push(pkg.id);
45376
+ log(kleur_default.red(`\u2717 ${pkg.displayName}: ${err}`));
45377
+ }
45378
+ }
45379
+ const alwaysGlobalInstallResult = await ensureAlwaysGlobalPiPackages(dryRun, log);
45380
+ result.packagesInstalled.push(...alwaysGlobalInstallResult.installed);
45381
+ result.failed.push(...alwaysGlobalInstallResult.failed);
45382
+ const skillsRoot = resolveSkillsRoot(resolvedProjectRoot);
45383
+ if (await import_fs_extra9.default.pathExists(import_path4.default.join(skillsRoot, "default"))) {
45384
+ const invariantViolations = await validateSkillsInvariants(skillsRoot);
45385
+ if (invariantViolations.length > 0) {
45386
+ const summary = invariantViolations.map((violation) => `${violation.code}: ${violation.message}`).join("; ");
45387
+ throw new Error(`Skills invariants failed. ${summary}`);
45388
+ }
45389
+ if (!dryRun) {
45390
+ await rebuildRuntimeActiveView("pi", skillsRoot);
45391
+ }
45392
+ }
45393
+ await updatePiSettings(resolvedProjectRoot, dryRun, log);
45394
+ const requiredFailed = missingPackages.filter(
45395
+ (s) => s.pkg.required && result.failed.includes(s.pkg.id)
45396
+ );
45397
+ if (missingPackages.length === 0 || result.failed.length === 0) {
45398
+ console.log(t.success(" \u2713 All required items present.\n"));
45399
+ } else if (requiredFailed.length === 0) {
45400
+ console.log(t.success(" \u2713 All required items present.\n"));
45401
+ } else {
45402
+ console.log(kleur_default.yellow(" \u26A0 Missing required items.\n"));
45403
+ }
45404
+ return result;
45405
+ }
45406
+
45407
+ // src/commands/pi-install.ts
45234
45408
  var PI_AGENT_DIR2 = process.env.PI_AGENT_DIR || import_path5.default.join((0, import_node_os2.homedir)(), ".pi", "agent");
45235
45409
  function ensurePnpm(dryRun) {
45236
45410
  if (isPnpmInstalled()) {
@@ -45653,6 +45827,7 @@ function createPiCommand() {
45653
45827
  // src/commands/init.ts
45654
45828
  var import_path15 = __toESM(require("path"), 1);
45655
45829
  var import_fs_extra21 = __toESM(require_lib(), 1);
45830
+ var import_prompts3 = __toESM(require_prompts3(), 1);
45656
45831
  var import_child_process5 = require("child_process");
45657
45832
 
45658
45833
  // src/core/registry-scaffold.ts
@@ -45745,20 +45920,24 @@ async function scaffoldSkillsDefaultFromPackage(params) {
45745
45920
  const { packageRoot, userXtrmDir, dryRun } = params;
45746
45921
  const sourceDir = import_path8.default.join(packageRoot, ".xtrm", "skills", "default");
45747
45922
  const targetDir = import_path8.default.join(userXtrmDir, "skills", "default");
45748
- if (await import_fs_extra13.default.pathExists(targetDir)) {
45749
- return "noop";
45923
+ const stat = await import_fs_extra13.default.lstat(targetDir).catch(() => null);
45924
+ if (stat) {
45925
+ if (stat.isSymbolicLink()) {
45926
+ const isValid = await import_fs_extra13.default.pathExists(targetDir);
45927
+ if (isValid) {
45928
+ return "noop";
45929
+ }
45930
+ await import_fs_extra13.default.remove(targetDir);
45931
+ } else {
45932
+ return "noop";
45933
+ }
45750
45934
  }
45751
45935
  if (dryRun) {
45752
45936
  return "noop";
45753
45937
  }
45754
45938
  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
- }
45939
+ await import_fs_extra13.default.copy(sourceDir, targetDir);
45940
+ return "copy";
45762
45941
  }
45763
45942
  function buildExpectedHashes(registry2) {
45764
45943
  const expected = /* @__PURE__ */ new Map();
@@ -48334,19 +48513,88 @@ async function runProjectBootstrap(projectRoot, isGitRepo) {
48334
48513
  }
48335
48514
  await installServiceSkillHooks(projectRoot);
48336
48515
  }
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;
48516
+ function hasInteractiveTTY2() {
48517
+ return Boolean(process.stdout.isTTY && process.stdin.isTTY);
48518
+ }
48519
+ async function resolveInitProjectRoot(yes) {
48520
+ const cwd = import_path15.default.resolve(process.cwd());
48521
+ let gitRoot;
48342
48522
  try {
48343
- projectRoot = getProjectRoot();
48523
+ gitRoot = getProjectRoot();
48344
48524
  } catch {
48345
- projectRoot = process.cwd();
48346
- isGitRepo = false;
48347
48525
  console.log(kleur_default.yellow("\n \u26A0 Not a git repository \u2014 git-dependent phases (beads, gitnexus) will be skipped"));
48348
48526
  console.log(kleur_default.dim(" Run git init first, then: gitnexus analyze\n"));
48527
+ return { projectRoot: cwd, isGitRepo: false, aborted: false };
48528
+ }
48529
+ const resolvedGitRoot = import_path15.default.resolve(gitRoot);
48530
+ if (resolvedGitRoot === cwd) {
48531
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: false };
48532
+ }
48533
+ console.log(kleur_default.yellow("\n \u26A0 CWD is not the git root."));
48534
+ console.log(kleur_default.dim(` CWD: ${cwd}`));
48535
+ console.log(kleur_default.dim(` Git root: ${resolvedGitRoot}`));
48536
+ if (yes) {
48537
+ console.log(kleur_default.dim(" --yes supplied; proceeding with the git root.\n"));
48538
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: false };
48539
+ }
48540
+ if (!hasInteractiveTTY2()) {
48541
+ console.log(kleur_default.red(" Non-interactive session cannot choose automatically."));
48542
+ console.log(kleur_default.dim(" Re-run with --yes to proceed with the git root, or run from the git root directory.\n"));
48543
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: true };
48544
+ }
48545
+ const { action } = await (0, import_prompts3.default)({
48546
+ type: "select",
48547
+ name: "action",
48548
+ message: "CWD is not the git root. Run git init here first, or continue targeting the git root?",
48549
+ choices: [
48550
+ { title: "Abort and show instructions", value: "abort" },
48551
+ { title: "Run git init in CWD and use this directory", value: "git-init" },
48552
+ { title: "Proceed anyway and target the git root", value: "proceed" }
48553
+ ],
48554
+ initial: 0
48555
+ });
48556
+ if (action === "git-init") {
48557
+ const initResult = (0, import_child_process5.spawnSync)("git", ["init"], {
48558
+ cwd,
48559
+ encoding: "utf8",
48560
+ timeout: 1e4
48561
+ });
48562
+ if (initResult.status !== 0) {
48563
+ if (initResult.stdout) process.stdout.write(initResult.stdout);
48564
+ if (initResult.stderr) process.stderr.write(initResult.stderr);
48565
+ console.log(kleur_default.red("\n \u2717 Failed to initialize git repository in CWD."));
48566
+ console.log(kleur_default.dim(" Fix git init errors and re-run xtrm init.\n"));
48567
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: true };
48568
+ }
48569
+ try {
48570
+ const refreshedGitRoot = getProjectRoot();
48571
+ console.log(kleur_default.green(` \u2713 Initialized git repo in CWD: ${refreshedGitRoot}`));
48572
+ return { projectRoot: import_path15.default.resolve(refreshedGitRoot), isGitRepo: true, aborted: false };
48573
+ } catch {
48574
+ console.log(kleur_default.red("\n \u2717 git init succeeded, but git root could not be resolved."));
48575
+ console.log(kleur_default.dim(" Re-run xtrm init from this directory.\n"));
48576
+ return { projectRoot: cwd, isGitRepo: true, aborted: true };
48577
+ }
48578
+ }
48579
+ if (action === "proceed") {
48580
+ console.log(kleur_default.dim(" Proceeding with the existing git root.\n"));
48581
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: false };
48349
48582
  }
48583
+ console.log(kleur_default.dim("\n Init cancelled."));
48584
+ console.log(kleur_default.dim(` To initialize this directory as its own repo: cd ${cwd} && git init`));
48585
+ console.log(kleur_default.dim(` To target the existing repo root: cd ${resolvedGitRoot} && xtrm init
48586
+ `));
48587
+ return { projectRoot: resolvedGitRoot, isGitRepo: true, aborted: true };
48588
+ }
48589
+ async function runProjectInit(opts = {}) {
48590
+ const { dryRun = false, yes = false } = opts;
48591
+ const effectiveYes = yes || process.argv.includes("--yes") || process.argv.includes("-y");
48592
+ const rootResolution = await resolveInitProjectRoot(effectiveYes);
48593
+ if (rootResolution.aborted) {
48594
+ return;
48595
+ }
48596
+ const projectRoot = rootResolution.projectRoot;
48597
+ const isGitRepo = rootResolution.isGitRepo;
48350
48598
  const inventory = await runPreflight(projectRoot, opts);
48351
48599
  renderInitPlan(inventory);
48352
48600
  if (dryRun) {
@@ -48519,7 +48767,7 @@ function getProjectRoot() {
48519
48767
  }
48520
48768
 
48521
48769
  // src/commands/status.ts
48522
- var import_prompts3 = __toESM(require_prompts3(), 1);
48770
+ var import_prompts4 = __toESM(require_prompts3(), 1);
48523
48771
 
48524
48772
  // src/core/sync-executor.ts
48525
48773
  var import_path18 = __toESM(require("path"), 1);
@@ -49390,7 +49638,7 @@ function createStatusCommand() {
49390
49638
  console.log(kleur_default.yellow(`
49391
49639
  \u26A0 ${totalPending} pending change${totalPending !== 1 ? "s" : ""} across ${pending.length} environment${pending.length !== 1 ? "s" : ""}
49392
49640
  `));
49393
- const { selected } = await (0, import_prompts3.default)({
49641
+ const { selected } = await (0, import_prompts4.default)({
49394
49642
  type: "multiselect",
49395
49643
  name: "selected",
49396
49644
  message: "Select environments to sync:",
@@ -50620,7 +50868,7 @@ function clearStatuslineClaim2(repoRoot) {
50620
50868
  }
50621
50869
 
50622
50870
  // src/commands/attach.ts
50623
- var import_prompts4 = __toESM(require_prompts3(), 1);
50871
+ var import_prompts5 = __toESM(require_prompts3(), 1);
50624
50872
  var import_node_child_process8 = require("child_process");
50625
50873
  function createAttachCommand() {
50626
50874
  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 +50904,7 @@ function createAttachCommand() {
50656
50904
  value: slug
50657
50905
  };
50658
50906
  });
50659
- const { picked } = await (0, import_prompts4.default)({
50907
+ const { picked } = await (0, import_prompts5.default)({
50660
50908
  type: "select",
50661
50909
  name: "picked",
50662
50910
  message: "Select worktree to attach",
@@ -50692,7 +50940,7 @@ function createAttachCommand() {
50692
50940
  });
50693
50941
  }
50694
50942
  async function pickRuntime() {
50695
- const { runtime } = await (0, import_prompts4.default)({
50943
+ const { runtime } = await (0, import_prompts5.default)({
50696
50944
  type: "select",
50697
50945
  name: "runtime",
50698
50946
  message: "No session metadata found \u2014 which runtime?",