xtrm-tools 0.7.2 → 0.7.4

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