@fbincon/claude-code-statusline 3.7.0 → 3.9.0

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 (247) hide show
  1. package/README.md +81 -79
  2. package/candidate.json +434 -289
  3. package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js +18 -4
  4. package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js.map +1 -1
  5. package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js +26 -1
  6. package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js.map +1 -1
  7. package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +7 -2
  8. package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -1
  9. package/node_modules/@fbincon/statusline-cli/dist/src/config/selective-import.d.ts +3 -0
  10. package/node_modules/@fbincon/statusline-cli/dist/src/config/selective-import.js +40 -0
  11. package/node_modules/@fbincon/statusline-cli/dist/src/config/selective-import.js.map +1 -0
  12. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js +5 -1
  13. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js.map +1 -1
  14. package/node_modules/@fbincon/statusline-cli/dist/src/help.js +9 -0
  15. package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
  16. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +1 -1
  17. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
  18. package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js +20 -0
  19. package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js.map +1 -1
  20. package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.d.ts +4 -3
  21. package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js +14 -13
  22. package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js.map +1 -1
  23. package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.d.ts +5 -2
  24. package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js +8 -6
  25. package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js.map +1 -1
  26. package/node_modules/@fbincon/statusline-cli/dist/src/main.js +14 -2
  27. package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
  28. package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.d.ts +17 -0
  29. package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.js +56 -0
  30. package/node_modules/@fbincon/statusline-cli/dist/src/management/arguments.js.map +1 -0
  31. package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.d.ts +7 -0
  32. package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.js +69 -0
  33. package/node_modules/@fbincon/statusline-cli/dist/src/management/bootstrap.js.map +1 -0
  34. package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.d.ts +10 -0
  35. package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.js +123 -0
  36. package/node_modules/@fbincon/statusline-cli/dist/src/management/configuration.js.map +1 -0
  37. package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.d.ts +20 -0
  38. package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.js +170 -0
  39. package/node_modules/@fbincon/statusline-cli/dist/src/management/first-entry.js.map +1 -0
  40. package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.d.ts +1 -0
  41. package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.js +51 -0
  42. package/node_modules/@fbincon/statusline-cli/dist/src/management/integration-runner.js.map +1 -0
  43. package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.d.ts +3 -0
  44. package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.js +34 -0
  45. package/node_modules/@fbincon/statusline-cli/dist/src/management/integration.js.map +1 -0
  46. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition-runner.d.ts +1 -0
  47. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition-runner.js +16 -0
  48. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition-runner.js.map +1 -0
  49. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.d.ts +3 -0
  50. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js +96 -0
  51. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js.map +1 -0
  52. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +3 -0
  53. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +62 -0
  54. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -0
  55. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +18 -0
  56. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +319 -0
  57. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -0
  58. package/node_modules/@fbincon/statusline-cli/dist/src/management/store.d.ts +53 -0
  59. package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js +117 -0
  60. package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js.map +1 -0
  61. package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.d.ts +1 -0
  62. package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.js +13 -0
  63. package/node_modules/@fbincon/statusline-cli/dist/src/management/worker-entry.js.map +1 -0
  64. package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js +9 -10
  65. package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js.map +1 -1
  66. package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage-index.js +2 -2
  67. package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage-index.js.map +1 -1
  68. package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js +4 -2
  69. package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js.map +1 -1
  70. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js +6 -2
  71. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js.map +1 -1
  72. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +1 -1
  73. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +22 -6
  74. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
  75. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
  76. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +1 -1
  77. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +7 -4
  78. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +9 -6
  79. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +5 -1
  80. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/alignment-manager.ts +59 -0
  81. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/alignments.ts +77 -0
  82. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/appearance.ts +3 -2
  83. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +17 -4
  84. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts +18 -4
  85. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/gradients.ts +29 -0
  86. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/group-manager.ts +5 -3
  87. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/groups.ts +2 -0
  88. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-differences.ts +72 -0
  89. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-review.ts +49 -2
  90. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-selection.ts +38 -0
  91. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/profile-manager.ts +14 -5
  92. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +9 -3
  93. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +552 -6
  94. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +2 -0
  95. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +3 -1
  96. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +26 -21
  97. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +6 -2
  98. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +1 -1
  99. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
  100. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +3 -3
  101. package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +1 -1
  102. package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +1 -1
  103. package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +13 -4
  104. package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -1
  105. package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js +1 -1
  106. package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js.map +1 -1
  107. package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js +11 -4
  108. package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js.map +1 -1
  109. package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.d.ts +2 -4
  110. package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js +2 -83
  111. package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js.map +1 -1
  112. package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js +12 -3
  113. package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js.map +1 -1
  114. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +15 -3
  115. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +2 -2
  116. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
  117. package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.d.ts +18 -0
  118. package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.js +112 -0
  119. package/node_modules/@fbincon/statusline-core/dist/src/editor/alignment-manager.js.map +1 -0
  120. package/node_modules/@fbincon/statusline-core/dist/src/editor/alignments.d.ts +21 -0
  121. package/node_modules/@fbincon/statusline-core/dist/src/editor/alignments.js +117 -0
  122. package/node_modules/@fbincon/statusline-core/dist/src/editor/alignments.js.map +1 -0
  123. package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js +3 -2
  124. package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js.map +1 -1
  125. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +8 -4
  126. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
  127. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +4 -0
  128. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +16 -3
  129. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
  130. package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js +24 -4
  131. package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -1
  132. package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.d.ts +16 -0
  133. package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js +31 -0
  134. package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js.map +1 -0
  135. package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.d.ts +2 -1
  136. package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js +5 -3
  137. package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js.map +1 -1
  138. package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js +3 -0
  139. package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js.map +1 -1
  140. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-differences.d.ts +4 -0
  141. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-differences.js +86 -0
  142. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-differences.js.map +1 -0
  143. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.d.ts +8 -2
  144. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js +67 -1
  145. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js.map +1 -1
  146. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-selection.d.ts +7 -0
  147. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-selection.js +42 -0
  148. package/node_modules/@fbincon/statusline-core/dist/src/editor/import-selection.js.map +1 -0
  149. package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.d.ts +4 -1
  150. package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js +16 -4
  151. package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js.map +1 -1
  152. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +546 -0
  153. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +552 -6
  154. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
  155. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.d.ts +27 -0
  156. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js +78 -0
  157. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -0
  158. package/node_modules/@fbincon/statusline-core/dist/src/management/package.d.ts +41 -0
  159. package/node_modules/@fbincon/statusline-core/dist/src/management/package.js +15 -0
  160. package/node_modules/@fbincon/statusline-core/dist/src/management/package.js.map +1 -0
  161. package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
  162. package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
  163. package/node_modules/@fbincon/statusline-core/dist/src/rendering/alignment.d.ts +3 -0
  164. package/node_modules/@fbincon/statusline-core/dist/src/rendering/alignment.js +97 -0
  165. package/node_modules/@fbincon/statusline-core/dist/src/rendering/alignment.js.map +1 -0
  166. package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.d.ts +1 -0
  167. package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js.map +1 -1
  168. package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +2 -3
  169. package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js.map +1 -1
  170. package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +2 -0
  171. package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -1
  172. package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.d.ts +13 -0
  173. package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js +68 -0
  174. package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js.map +1 -0
  175. package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js +5 -4
  176. package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js.map +1 -1
  177. package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.d.ts +4 -1
  178. package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +41 -15
  179. package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -1
  180. package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.d.ts +1 -0
  181. package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js +9 -3
  182. package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js.map +1 -1
  183. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +4 -0
  184. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +15 -1
  185. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
  186. package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +7 -5
  187. package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -1
  188. package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.d.ts +3 -0
  189. package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js +3 -0
  190. package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js.map +1 -1
  191. package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.d.ts +1 -1
  192. package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.js +1 -1
  193. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +92 -1
  194. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +92 -1
  195. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +92 -1
  196. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +92 -1
  197. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +92 -1
  198. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +92 -1
  199. package/node_modules/@fbincon/statusline-platform/dist/src/command.d.ts +1 -0
  200. package/node_modules/@fbincon/statusline-platform/dist/src/command.js +1 -1
  201. package/node_modules/@fbincon/statusline-platform/dist/src/command.js.map +1 -1
  202. package/node_modules/@fbincon/statusline-platform/dist/src/files.d.ts +1 -1
  203. package/node_modules/@fbincon/statusline-platform/dist/src/files.js +5 -5
  204. package/node_modules/@fbincon/statusline-platform/dist/src/files.js.map +1 -1
  205. package/node_modules/@fbincon/statusline-platform/dist/src/git.d.ts +31 -0
  206. package/node_modules/@fbincon/statusline-platform/dist/src/git.js +180 -0
  207. package/node_modules/@fbincon/statusline-platform/dist/src/git.js.map +1 -0
  208. package/node_modules/@fbincon/statusline-platform/dist/src/npm.d.ts +44 -0
  209. package/node_modules/@fbincon/statusline-platform/dist/src/npm.js +229 -0
  210. package/node_modules/@fbincon/statusline-platform/dist/src/npm.js.map +1 -0
  211. package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.d.ts +4 -0
  212. package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.js +49 -0
  213. package/node_modules/@fbincon/statusline-platform/dist/src/package-copy.js.map +1 -0
  214. package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.d.ts +2 -0
  215. package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.js +51 -0
  216. package/node_modules/@fbincon/statusline-platform/dist/src/remove-tree.js.map +1 -0
  217. package/node_modules/@fbincon/statusline-platform/dist/src/source-process.d.ts +4 -0
  218. package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js +24 -2
  219. package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js.map +1 -1
  220. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.d.ts +12 -0
  221. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.js +20 -0
  222. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/capabilities.js.map +1 -0
  223. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.d.ts +3 -0
  224. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js +5 -2
  225. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js.map +1 -1
  226. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.d.ts +3 -1
  227. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js +20 -3
  228. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js.map +1 -1
  229. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.d.ts +3 -0
  230. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js +5 -0
  231. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js.map +1 -1
  232. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +5 -0
  233. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
  234. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js +5 -0
  235. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js.map +1 -1
  236. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +2 -2
  237. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
  238. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +1 -1
  239. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
  240. package/node_modules/@fbincon/statusline-tui/dist/src/session.js +7 -8
  241. package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
  242. package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +1 -1
  243. package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +6 -4
  244. package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -1
  245. package/node_modules/@fbincon/statusline-tui/dist/src/state.js +12 -5
  246. package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
  247. package/package.json +47 -1
@@ -0,0 +1,96 @@
1
+ /** Refresh owned Mod bytes with the newer ownership reader before an older installer runs. */
2
+ import { join } from 'node:path';
3
+ import { readFileSync } from 'node:fs';
4
+ import { compatibility, compareVersions } from '@fbincon/statusline-core/management/compatibility';
5
+ import { PACKAGE_NAME, VERSION } from '@fbincon/statusline-core/release';
6
+ import { PROTOCOL_VERSION } from '@fbincon/statusline-core/contracts/ui';
7
+ import { equalSettings } from '@fbincon/statusline-core/json-equality';
8
+ import { PackageError } from '@fbincon/statusline-core/management/package';
9
+ import { decodeUtf8 } from '@fbincon/statusline-platform/utf8';
10
+ import { readJson } from '@fbincon/statusline-core/json-read';
11
+ import { NATIVE, RUNTIME } from '../integration/model.js';
12
+ import { owner } from '../integration/mod-ownership.js';
13
+ import { bundledFiles } from '../integration/resources.js';
14
+ import { integrate } from '../integration/mods.js';
15
+ import { BINDING_FILE } from '../integration/ownership.js';
16
+ import { administration } from '../recovery/service.js';
17
+ import { refreshIntents } from '../recovery/journal.js';
18
+ import { loadNative, loadRuntime } from '../config/backend-preferences.js';
19
+ import { readSettings } from '../config/storage.js';
20
+ import { automaticRequested } from '../sources/automatic-state.js';
21
+ import { atLeast } from '../config/service.js';
22
+ import { assertConfiguration, configurationBytes, configurationHashes } from './configuration.js';
23
+ export function prepareModDowngrade(context, root, version, expected, dryRun) {
24
+ assertConfiguration(context.configDir, expected);
25
+ const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
26
+ if (manifest.version !== version || manifest.name !== PACKAGE_NAME)
27
+ throw new PackageError('identity');
28
+ const target = compatibility(manifest.statuslineCompatibility, version);
29
+ const modes = loadRuntime(context.configDir, context.io);
30
+ const restricted = readSettings(context.configDir, context.io)[0].disableAllHooks === true;
31
+ const intents = refreshIntents(context.configDir);
32
+ const transitions = [NATIVE, RUNTIME].flatMap(original => {
33
+ const protocol = original.name === NATIVE.name ? target.editor_protocol : target.runtime_protocol;
34
+ const marker = owner(context.configDir, original, context.io, true);
35
+ if (!marker || marker.protocol_version <= protocol && compareVersions(marker.mod_version, version) <= 0 &&
36
+ target.editor_protocol >= PROTOCOL_VERSION && compareVersions(VERSION, version) <= 0)
37
+ return [];
38
+ const spec = { ...original, protocol };
39
+ const bundle = bundledFiles(spec, { root: join(root, 'node_modules/@fbincon/statusline-cli/resources', spec.name), version });
40
+ const requested = original.name === NATIVE.name ? loadNative(context.configDir, undefined, version, context.io)
41
+ : modes.native_timing || modes.live_metrics || automaticRequested(context.configDir);
42
+ return [{ spec, bundle, requested, disabled: !requested || restricted || intents.includes(spec.name) || !atLeast(context.version, spec.minimum) }];
43
+ });
44
+ if (dryRun || !transitions.length)
45
+ return expected;
46
+ const before = configurationBytes(context.configDir);
47
+ administration(context, false, tracked => {
48
+ assertConfiguration(context.configDir, expected);
49
+ for (const { spec, requested, bundle } of transitions) {
50
+ const result = integrate(tracked, spec, requested, !requested, bundle);
51
+ if (!['installed', 'plugin-disabled', 'disabled', 'suspended'].includes(result.state))
52
+ throw new PackageError('integration_failed');
53
+ }
54
+ });
55
+ const after = configurationBytes(context.configDir);
56
+ for (const name of Object.keys(before)) {
57
+ const a = before[name], b = after[name];
58
+ if (a === null ? b === null : b !== null && a.equals(b))
59
+ continue;
60
+ // Official refresh may rewrite formatting and the owned backend version.
61
+ // All other configuration values must still match the reviewed snapshot.
62
+ if (!['settings.json', BINDING_FILE].includes(name) || a === null || b === null)
63
+ throw new PackageError('conflict');
64
+ const left = readJson(decodeUtf8(a)), right = readJson(decodeUtf8(b));
65
+ if (name === 'settings.json') {
66
+ for (const { spec, requested } of transitions)
67
+ if (requested) {
68
+ const a = left.pluginConfigs?.[spec.plugin]?.options, b = right.pluginConfigs?.[spec.plugin]?.options;
69
+ if (a && b && b.backendVersion === version)
70
+ a.backendVersion = version;
71
+ }
72
+ for (const { spec, disabled } of transitions)
73
+ if (disabled) {
74
+ if (right.enabledPlugins?.[spec.plugin] === true)
75
+ throw new PackageError('conflict');
76
+ if (left.enabledPlugins)
77
+ delete left.enabledPlugins[spec.plugin];
78
+ if (right.enabledPlugins)
79
+ delete right.enabledPlugins[spec.plugin];
80
+ }
81
+ for (const value of [left, right])
82
+ if (value.enabledPlugins && !Object.keys(value.enabledPlugins).length)
83
+ delete value.enabledPlugins;
84
+ }
85
+ if (name === BINDING_FILE)
86
+ for (const value of [left, right]) {
87
+ value.refresh_disabled = value.refresh_disabled?.filter((name) => !transitions.some(t => t.spec.name === name && intents.includes(name)));
88
+ if (!value.refresh_disabled?.length)
89
+ delete value.refresh_disabled;
90
+ }
91
+ if (!equalSettings(left, right))
92
+ throw new PackageError('conflict');
93
+ }
94
+ return configurationHashes(after);
95
+ }
96
+ //# sourceMappingURL=mod-transition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod-transition.js","sourceRoot":"","sources":["../../../src/management/mod-transition.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;A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K,CAAC;YAAE,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Language } from '@fbincon/statusline-core/i18n/messages';
2
+ import type { ManagementOptions } from './arguments.js';
3
+ export declare function restoreConfiguration(flags: ManagementOptions, configDir: string, prefix: string, language: Language, stdout: (value: string) => void, confirm?: () => Promise<boolean>, signal?: AbortSignal): Promise<number>;
@@ -0,0 +1,62 @@
1
+ import { join, dirname } from 'node:path';
2
+ import { PackageError } from '@fbincon/statusline-core/management/package';
3
+ import { compatibility } from '@fbincon/statusline-core/management/compatibility';
4
+ import { readOperation, operationPath } from './store.js';
5
+ import { configurationBytes, configurationHashes, assertConfiguration, configurationCompatibility, readSnapshot } from './configuration.js';
6
+ import { assertClear } from '../recovery/journal.js';
7
+ import { commit } from '../recovery/files.js';
8
+ import { createStorage, artifact, jsonBytes, readSettings } from '../config/storage.js';
9
+ import { validateDisplay, defaultDisplay } from '@fbincon/statusline-core/config/display';
10
+ import { validateProfiles, emptyProfiles } from '@fbincon/statusline-core/config/profiles';
11
+ import { readJson } from '@fbincon/statusline-core/json-read';
12
+ import { decodeUtf8 } from '@fbincon/statusline-platform/utf8';
13
+ import { ConfigurationService } from '../config/service.js';
14
+ import { profileRowsSettings } from '../config/profiles.js';
15
+ import { previousBinding } from '../integration/ownership.js';
16
+ import { detectClaudeVersion } from '@fbincon/statusline-platform/commands';
17
+ import { t } from '@fbincon/statusline-core/i18n/messages';
18
+ import { confirmPackage } from './first-entry.js';
19
+ import { equalSettings } from '@fbincon/statusline-core/json-equality';
20
+ export async function restoreConfiguration(flags, configDir, prefix, language, stdout, confirm, signal) {
21
+ const operation = readOperation(configDir, prefix, flags.restoreConfig), current = configurationBytes(configDir), hashes = configurationHashes(current);
22
+ if (!operation.snapshot || !operation.before)
23
+ throw new PackageError('backup');
24
+ const backup = readSnapshot(configDir, dirname(operationPath(operation)), operation.snapshot);
25
+ const declared = compatibility(operation.beforeCompatibility, operation.before.version);
26
+ if (configurationCompatibility(backup, declared).length)
27
+ throw new PackageError('backup');
28
+ const names = ['claude-statusline.json', 'claude-statusline-profiles.json'];
29
+ const proposed = { ...current, ...Object.fromEntries(names.map(name => [name, backup[name] ?? null])) };
30
+ // Product preferences and execution grants always remain current. The target
31
+ // rollback will recheck all of them before replacing the package.
32
+ const display = backup[names[0]] ? validateDisplay(readJson(decodeUtf8(backup[names[0]]))) : defaultDisplay();
33
+ const profiles = backup[names[1]] ? validateProfiles(readJson(decodeUtf8(backup[names[1]]))) : emptyProfiles();
34
+ const io = createStorage(), binding = previousBinding(configDir, io);
35
+ const changes = names.filter(name => current[name] === null ? proposed[name] !== null : proposed[name] === null || !current[name].equals(proposed[name])).map(name => ({ ...artifact(join(configDir, name), current[name] ?? null), desired: proposed[name] ?? null }));
36
+ if (binding) {
37
+ const service = new ConfigurationService({ configDir, launch: binding, hostVersion: detectClaudeVersion }, io), [settings, raw] = readSettings(configDir, io);
38
+ const updated = profileRowsSettings(service, settings, display, profiles);
39
+ if (!equalSettings(settings, updated))
40
+ changes.push({ ...artifact(join(configDir, 'settings.json'), raw), desired: jsonBytes(updated) });
41
+ }
42
+ const review = { schema_version: 1, action: 'restore-config', backup_id: operation.id, source_version: operation.before.version, prefix, files: changes.map(change => ({ path: change.path, current: hashes[change.name] ?? null, backup: operation.snapshot[change.name] ?? null })), preserved: ['source_authorization', 'runtime_preferences', 'editor_preferences', 'unrelated_claude_settings'] };
43
+ if (!flags.json)
44
+ stdout(t('management.restore_review', language) + '\n');
45
+ stdout(JSON.stringify(review, null, 2) + '\n');
46
+ if (flags.dryRun)
47
+ return 0;
48
+ if (!flags.yes && !await (confirm?.() ?? confirmPackage(language, stdout, signal)))
49
+ return 0;
50
+ if (signal?.aborted)
51
+ throw new PackageError('interrupted');
52
+ const backupDir = io.lock(configDir, () => {
53
+ assertClear(configDir);
54
+ assertConfiguration(configDir, hashes);
55
+ // Verify the immutable source once more while holding the revision lock.
56
+ readSnapshot(configDir, dirname(operationPath(operation)), operation.snapshot);
57
+ return commit(configDir, 'package-config-restore', changes, io);
58
+ });
59
+ stdout(t('management.restored', language, { backup: backupDir ?? '-' }) + '\n');
60
+ return 0;
61
+ }
62
+ //# sourceMappingURL=restore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restore.js","sourceRoot":"","sources":["../../../src/management/restore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5I,OAAO,EAAe,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,O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AC,CAAC;IAC/C,IAAI,KAAK,CAAC,MAAM;QACZ,OAAO,CAAC,CAAC;IACb,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9E,OAAO,CAAC,CAAC;IACb,IAAI,MAAM,EAAE,OAAO;QACf,MAAM,IAAI,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;QACtC,WAAW,CAAC,SAAS,CAAC,CAAC;QACvB,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACvC,yEAAyE;QACzE,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,QAAS,CAAC,CAAC;QAChF,OAAO,MAAM,CAAC,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,CAAC,CAAC,qBAAqB,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,SAAS,IAAI,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IAChF,OAAO,CAAC,CAAC;AACb,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Npm } from '@fbincon/statusline-platform/npm';
2
+ import { type ManagementOptions } from './arguments.js';
3
+ import { type PackageOperation } from './store.js';
4
+ import { refreshIntegration } from './integration.js';
5
+ export interface ManagementEnvironment {
6
+ origin: string;
7
+ stdout: (text: string) => void;
8
+ stderr: (text: string) => void;
9
+ environment?: NodeJS.ProcessEnv;
10
+ tty?: boolean;
11
+ npm?: Npm;
12
+ confirm?: () => Promise<boolean>;
13
+ host?: () => readonly number[] | null;
14
+ integrate?: typeof refreshIntegration;
15
+ checkpoint?: (stage: string, operation: PackageOperation) => void;
16
+ }
17
+ export declare function mutationAuthorized(flags: ManagementOptions, tty: boolean): void;
18
+ export declare function manage(argv: readonly string[], options: ManagementEnvironment): Promise<number>;
@@ -0,0 +1,319 @@
1
+ import * as fs from 'node:fs';
2
+ import { join, dirname } from 'node:path';
3
+ import { tmpdir } from 'node:os';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { PackageError } from '@fbincon/statusline-core/management/package';
6
+ import { compatibility, compareVersions, runtimeCompatibility } from '@fbincon/statusline-core/management/compatibility';
7
+ import { t } from '@fbincon/statusline-core/i18n/messages';
8
+ import { Npm, productIdentity, productRoot, writablePrefix, within, verifyArchive, globalPackageRoot } from '@fbincon/statusline-platform/npm';
9
+ import { lock, atomicWrite } from '@fbincon/statusline-platform/files';
10
+ import { copyPackage } from '@fbincon/statusline-platform/package-copy';
11
+ import { removeTree } from '@fbincon/statusline-platform/remove-tree';
12
+ import { detectClaudeVersion, resolvedPath, which, sameLaunchEntry } from '@fbincon/statusline-platform/commands';
13
+ import { readPreferences } from '../config/preferences.js';
14
+ import { createStorage } from '../config/storage.js';
15
+ import { previousBinding } from '../integration/ownership.js';
16
+ import { assertClear } from '../recovery/journal.js';
17
+ import { safeTarget } from '../integration/paths.js';
18
+ import { managementOptions } from './arguments.js';
19
+ import { confirmPackage } from './first-entry.js';
20
+ import { pendingPath, startOperation, saveOperation, recordInstallation, finishOperation, operationPath, readInstallation, readOperation, observeOperation } from './store.js';
21
+ import { configurationBytes, configurationHashes, configurationCompatibility, assertConfiguration, saveSnapshot } from './configuration.js';
22
+ import { refreshIntegration } from './integration.js';
23
+ import { restoreConfiguration } from './restore.js';
24
+ import { ArgumentError } from '../config/arguments.js';
25
+ import { processMatches } from '@fbincon/statusline-platform/processes';
26
+ export function mutationAuthorized(flags, tty) {
27
+ if (flags.check || flags.dryRun)
28
+ return;
29
+ if (!tty && (!flags.yes || !flags.prefix || !flags.restoreConfig && !flags.version))
30
+ throw new PackageError('noninteractive');
31
+ }
32
+ function currentPackage(layout) {
33
+ const current = productIdentity(layout.root, layout.prefix);
34
+ if (!current)
35
+ throw new PackageError('not_installed');
36
+ return current;
37
+ }
38
+ function sameIdentity(current, before) {
39
+ return current.version === before.version && current.root === before.root && current.entry === before.entry && current.prefix === before.prefix && current.inventory_sha256 === before.inventory_sha256;
40
+ }
41
+ function selection(flags, before, history) {
42
+ if (flags.version)
43
+ return { selector: flags.version, channel: flags.command === 'rollback' ? history?.previousChannel ?? (flags.version.includes('-') ? null : 'latest') : history?.channel ?? (flags.version.includes('-') ? null : 'latest') };
44
+ if (flags.command === 'rollback') {
45
+ if (!history?.previous || history.current.version !== before.version)
46
+ throw new PackageError('no_previous');
47
+ return { selector: history.previous.version, channel: history.previousChannel ?? (history.previous.version.includes('-') ? null : 'latest') };
48
+ }
49
+ const channel = flags.channel ?? history?.channel ?? (before.version.includes('-') ? null : 'latest');
50
+ if (!channel)
51
+ throw new PackageError('channel');
52
+ return { selector: channel, channel };
53
+ }
54
+ function installedCompatibility(current) {
55
+ const manifest = JSON.parse(fs.readFileSync(join(current.root, 'package.json'), 'utf8'));
56
+ return compatibility(manifest.statuslineCompatibility, current.version);
57
+ }
58
+ function observedPackage(layout, operation) {
59
+ if (operation.executors?.some(p => processMatches(p.pid, p.token)))
60
+ throw new PackageError('busy');
61
+ try {
62
+ const identity = productIdentity(layout.root, layout.prefix);
63
+ if (identity && ![operation.before?.version, operation.version].includes(identity.version))
64
+ throw new PackageError('conflict');
65
+ return { identity, state: identity?.version ?? 'absent' };
66
+ }
67
+ catch (error) {
68
+ if (error instanceof PackageError && error.code === 'conflict')
69
+ throw error;
70
+ const manifest = join(layout.root, 'package.json');
71
+ if (fs.existsSync(manifest)) {
72
+ const value = JSON.parse(fs.readFileSync(manifest, 'utf8'));
73
+ if (value.name !== '@fbincon/claude-code-statusline' || ![operation.version, operation.before?.version].includes(value.version))
74
+ throw new PackageError('identity');
75
+ }
76
+ return { identity: null, state: 'incomplete' };
77
+ }
78
+ }
79
+ function targetIntegration(configDir, before, flags, origin, layout, env) {
80
+ const binding = previousBinding(configDir, createStorage()), launch = { executable: process.execPath, args: [before.entry] };
81
+ if (binding && (binding.args.length !== 1 || resolvedPath(binding.args[0]) !== resolvedPath(before.entry)))
82
+ throw new PackageError('prefix_ambiguous');
83
+ if (!flags.prefix) {
84
+ const active = which('claude-statusline', env);
85
+ if (active && !sameLaunchEntry(active, launch))
86
+ throw new PackageError('prefix_ambiguous');
87
+ if (!within(origin, layout.cache)) {
88
+ const originIdentity = productIdentity(origin);
89
+ if (originIdentity && origin !== before.root && origin.includes(process.platform === 'win32' ? 'node_modules' : 'lib/node_modules'))
90
+ throw new PackageError('prefix_ambiguous');
91
+ }
92
+ }
93
+ return binding !== null;
94
+ }
95
+ export async function manage(argv, options) {
96
+ const { stdout, stderr } = options, environment = options.environment ?? process.env;
97
+ let flags, language = 'en', temporary, release, operation;
98
+ const controller = new AbortController(), cancel = () => controller.abort();
99
+ process.on('SIGINT', cancel);
100
+ process.on('SIGTERM', cancel);
101
+ try {
102
+ flags = managementOptions(argv);
103
+ const requestedDirectory = flags.configDir ?? environment.CLAUDE_CONFIG_DIR;
104
+ const configDir = resolvedPath(requestedDirectory?.trim() ? requestedDirectory : '~/.claude');
105
+ language = flags.language ?? readPreferences(configDir, createStorage()).ui_language;
106
+ mutationAuthorized(flags, options.tty ?? !!(process.stdin.isTTY && process.stdout.isTTY));
107
+ if (flags.restoreConfig && flags.prefix) {
108
+ const prefix = resolvedPath(flags.prefix);
109
+ if (within(configDir, globalPackageRoot(prefix)))
110
+ throw new PackageError('prefix');
111
+ return await restoreConfiguration(flags, configDir, prefix, language, stdout, options.confirm, controller.signal);
112
+ }
113
+ const npm = options.npm ?? new Npm(environment, undefined, undefined, controller.signal), layout = await npm.layout(flags.prefix);
114
+ if (within(configDir, layout.root))
115
+ throw new PackageError('prefix');
116
+ if (flags.restoreConfig)
117
+ return await restoreConfiguration(flags, configDir, layout.prefix, language, stdout, options.confirm, controller.signal);
118
+ let before = null;
119
+ if (!flags.package)
120
+ before = currentPackage(layout);
121
+ const recordedHistory = readInstallation(configDir, layout.prefix);
122
+ const history = flags.package || before && recordedHistory && sameIdentity(before, recordedHistory.current) ? recordedHistory : null;
123
+ if (before && history)
124
+ before = { ...before, integrity: history.current.integrity, registry: history.current.registry };
125
+ let target, channel, integrated, host, hashes, observed = null;
126
+ if (flags.package) {
127
+ operation = readOperation(configDir, layout.prefix);
128
+ if (flags.version && flags.version !== operation.version)
129
+ throw new PackageError('version');
130
+ observed = observedPackage(layout, operation).state;
131
+ before = operation.before;
132
+ target = operation.target ?? await npm.metadata(operation.version, { ...layout, registry: operation.registry });
133
+ channel = operation.channel ?? null;
134
+ integrated = operation.integrated ?? false;
135
+ }
136
+ else {
137
+ if (fs.existsSync(pendingPath(layout.prefix)))
138
+ throw new PackageError('pending');
139
+ await npm.verify(before, layout.bin);
140
+ installedCompatibility(before);
141
+ integrated = targetIntegration(configDir, before, flags, options.origin, layout, environment);
142
+ const selected = selection(flags, before, history);
143
+ channel = selected.channel;
144
+ target = await npm.metadata(selected.selector, layout);
145
+ if (flags.command === 'rollback' && !flags.version && history?.previous?.integrity && target.integrity !== history.previous.integrity)
146
+ throw new PackageError('integrity');
147
+ const direction = compareVersions(target.version, before.version);
148
+ if (flags.command === 'update' && direction < 0)
149
+ throw new PackageError('use_rollback');
150
+ if (flags.command === 'rollback' && direction >= 0)
151
+ throw new PackageError('rollback_direction');
152
+ }
153
+ host = integrated ? (options.host ?? detectClaudeVersion)() : null;
154
+ const bytes = configurationBytes(configDir);
155
+ hashes = configurationHashes(bytes);
156
+ const configReasons = configurationCompatibility(bytes, target.compatibility);
157
+ const reasons = runtimeCompatibility(target.compatibility, process.versions.node, process.platform + '-' + process.arch, host?.join('.') ?? null, integrated);
158
+ if (!await npm.nodeCompatible(target.nodeEngine) && !reasons.includes('runtime'))
159
+ reasons.push('runtime');
160
+ if (configReasons.length)
161
+ reasons.push('configuration');
162
+ const review = { schema_version: 1, action: flags.package ? 'recover-package' : flags.command, current: before?.version ?? null, observed_package: observed ?? before?.version ?? null, target: target.version, registry: target.registry, prefix: layout.prefix, entry: join(layout.root, 'node_modules/@fbincon/statusline-cli/dist/src/entry.js'), node: process.execPath, npm_entry: npm.entry, config_dir: configDir, node_version: process.versions.node, node_engine: target.nodeEngine, host: host?.join('.') ?? null, channel, integrated, compatibility: target.compatibility, integrity: target.integrity, compatible: !reasons.length, reasons, configuration_conflicts: configReasons, backup_id: operation?.id ?? history?.transaction ?? null, artifact_verified: false };
163
+ if (flags.check) {
164
+ stdout(JSON.stringify(review, null, 2) + '\n');
165
+ return reasons.length ? 2 : 0;
166
+ }
167
+ if (reasons.length) {
168
+ stdout(JSON.stringify(review, null, 2) + '\n');
169
+ if (!flags.json)
170
+ stderr(t('package.reason_' + reasons[0], language) + '\n');
171
+ return 2;
172
+ }
173
+ if (!flags.package && target.version === before.version) {
174
+ stdout(flags.json ? JSON.stringify({ ...review, unchanged: true }) + '\n' : t('management.current', language, { version: target.version }) + '\n');
175
+ return 0;
176
+ }
177
+ assertClear(configDir, true);
178
+ temporary = fs.realpathSync.native(fs.mkdtempSync(join(tmpdir(), 'claude-statusline-operation-')));
179
+ fs.chmodSync(temporary, 0o700);
180
+ let archive;
181
+ if (operation?.archive) {
182
+ archive = join(dirname(operationPath(operation)), operation.archive);
183
+ safeTarget(configDir, archive);
184
+ verifyArchive(archive, target);
185
+ }
186
+ else
187
+ archive = await npm.download(target, join(temporary, 'download'));
188
+ const staging = join(temporary, 'staging');
189
+ await npm.installArchive(archive, staging);
190
+ const staged = await npm.validateStaged(staging, target);
191
+ if (flags.command === 'rollback' && !flags.version && history?.previous?.inventory_sha256 && staged.inventory_sha256 !== history.previous.inventory_sha256)
192
+ throw new PackageError('integrity');
193
+ const expected = { ...staged, prefix: layout.prefix, root: layout.root, entry: review.entry };
194
+ if (integrated)
195
+ await (options.integrate ?? refreshIntegration)(staged.root, expected, configDir, host, hashes, temporary, true, environment, controller.signal);
196
+ review.artifact_verified = true;
197
+ if (!flags.json)
198
+ stdout(t('management.review', language) + '\n');
199
+ stdout(JSON.stringify(review, null, 2) + '\n');
200
+ if (flags.dryRun)
201
+ return 0;
202
+ writablePrefix(layout.prefix);
203
+ if (!flags.yes && !await (options.confirm?.() ?? confirmPackage(language, stdout, controller.signal))) {
204
+ stdout(t('package.cancelled', language) + '\n');
205
+ return 0;
206
+ }
207
+ if (controller.signal.aborted)
208
+ throw new PackageError('interrupted');
209
+ release = lock(join(layout.prefix, '.claude-statusline-install.lock'), true);
210
+ assertConfiguration(configDir, hashes);
211
+ assertClear(configDir, true);
212
+ const actual = flags.package ? observedPackage(layout, operation) : { identity: productIdentity(layout.root, layout.prefix), state: null };
213
+ const installed = actual.identity;
214
+ if (flags.package) {
215
+ const recorded = readOperation(configDir, layout.prefix);
216
+ if (recorded.id !== operation.id || actual.state !== observed)
217
+ throw new PackageError('conflict');
218
+ operation = recorded;
219
+ }
220
+ else {
221
+ if (!installed || !sameIdentity(installed, before) || fs.existsSync(pendingPath(layout.prefix)))
222
+ throw new PackageError('conflict');
223
+ operation = startOperation(configDir, layout.prefix, target.version, target.registry, before, flags.command);
224
+ operation.snapshot = createStorage().lock(configDir, () => { assertConfiguration(configDir, hashes); return saveSnapshot(configDir, dirname(operationPath(operation)), bytes); });
225
+ operation.beforeCompatibility = installedCompatibility(before);
226
+ operation.previousChannel = history?.channel ?? null;
227
+ }
228
+ if (operation.before && !operation.snapshot) {
229
+ if (!installed || installed.version !== operation.before.version)
230
+ throw new PackageError('backup');
231
+ operation.snapshot = createStorage().lock(configDir, () => { assertConfiguration(configDir, hashes); return saveSnapshot(configDir, dirname(operationPath(operation)), bytes); });
232
+ operation.beforeCompatibility = installedCompatibility(installed);
233
+ }
234
+ const runnerRoot = productRoot(fileURLToPath(import.meta.url)), recoveryRunner = join(dirname(operationPath(operation)), 'recovery-runner');
235
+ if (runnerRoot && !fs.existsSync(recoveryRunner)) {
236
+ safeTarget(configDir, recoveryRunner);
237
+ const staging = fs.mkdtempSync(join(dirname(recoveryRunner), '.runner-'));
238
+ try {
239
+ const copied = join(staging, 'package');
240
+ copyPackage(runnerRoot, copied);
241
+ if (!productIdentity(copied))
242
+ throw new PackageError('identity');
243
+ fs.renameSync(copied, recoveryRunner);
244
+ }
245
+ finally {
246
+ removeTree(staging);
247
+ }
248
+ }
249
+ operation.target = target;
250
+ operation.channel = channel;
251
+ operation.integrated = integrated;
252
+ const savedArchive = join(dirname(operationPath(operation)), 'target.tgz');
253
+ safeTarget(configDir, savedArchive);
254
+ if (archive !== savedArchive)
255
+ atomicWrite(savedArchive, fs.readFileSync(archive));
256
+ operation.archive = 'target.tgz';
257
+ operation.results = { package: false, integration: false };
258
+ saveOperation(operation);
259
+ const observeProcess = observeOperation(operation);
260
+ npm.onProcess = observeProcess;
261
+ options.checkpoint?.('reviewed', operation);
262
+ verifyArchive(savedArchive, target);
263
+ if (installed?.version !== target.version) {
264
+ operation.stage = 'installing';
265
+ saveOperation(operation);
266
+ options.checkpoint?.('installing', operation);
267
+ await npm.installArchive(savedArchive, layout.prefix);
268
+ }
269
+ operation.after = await npm.validateStaged(layout.prefix, target);
270
+ operation.stage = 'package_verified';
271
+ operation.results.package = true;
272
+ saveOperation(operation);
273
+ options.checkpoint?.('package_verified', operation);
274
+ assertConfiguration(configDir, hashes);
275
+ if (integrated) {
276
+ operation.stage = 'integrating';
277
+ saveOperation(operation);
278
+ options.checkpoint?.('integrating', operation);
279
+ await (options.integrate ?? refreshIntegration)(layout.root, operation.after, configDir, host, hashes, temporary, false, environment, controller.signal, observeProcess);
280
+ }
281
+ operation.after = await npm.validateStaged(layout.prefix, target);
282
+ operation.results.integration = true;
283
+ saveOperation(operation);
284
+ recordInstallation(operation);
285
+ finishOperation(operation);
286
+ stdout(t('management.complete', language, { version: target.version, prefix: layout.prefix, backup: operation.snapshot ? operation.id : '—' }) + '\n');
287
+ if (runnerRoot)
288
+ stdout(t('management.runner', language, { entry: join(recoveryRunner, 'bin/claude-statusline.js') }) + '\n');
289
+ return 0;
290
+ }
291
+ catch (error) {
292
+ const reason = error instanceof PackageError ? error.code : error instanceof ArgumentError ? 'arguments' : 'io_error';
293
+ if (operation && operation.stage !== 'complete' && release) {
294
+ operation.stage = 'uncertain';
295
+ if (operation.results)
296
+ operation.results.error = reason;
297
+ try {
298
+ saveOperation(operation);
299
+ }
300
+ catch { /* Preserve the last durable phase if the journal volume is unavailable. */ }
301
+ }
302
+ const message = t('package.reason_' + reason, language);
303
+ if (flags?.json)
304
+ stdout(JSON.stringify({ schema_version: 1, error: { code: reason, message } }) + '\n');
305
+ else
306
+ stderr(t('package.failure', language, { reason: message }) + '\n');
307
+ if (operation && release)
308
+ stderr(t('management.partial', language, { id: operation.id, version: operation.version, prefix: operation.prefix, config: operation.configDir, stage: operation.stage }) + '\n');
309
+ return reason === 'interrupted' ? 130 : 2;
310
+ }
311
+ finally {
312
+ release?.();
313
+ process.off('SIGINT', cancel);
314
+ process.off('SIGTERM', cancel);
315
+ if (temporary)
316
+ removeTree(temporary);
317
+ }
318
+ }
319
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/management/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAA4C,MAAM,6CAA6C,CAAC;AACrH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzH,OAAO,EAAE,CAAC,EAAiB,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,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C,GAAG,IAAI,CAAC,CAAC;QACtL,OAAO,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;YACO,CAAC;QACL,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC/B,IAAI,SAAS;YACT,UAAU,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;AACL,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { type PackageIdentity } from '@fbincon/statusline-core/management/package';
2
+ import type { PackageCompatibility } from '@fbincon/statusline-core/management/compatibility';
3
+ import type { RegistryPackage } from '@fbincon/statusline-platform/npm';
4
+ import type { ConfigHashes } from './configuration.js';
5
+ export declare const MANAGEMENT_ROOT = "statusline_runtime/package-management";
6
+ export interface PackageOperation {
7
+ schema_version: 1;
8
+ id: string;
9
+ configDir: string;
10
+ prefix: string;
11
+ action: 'install' | 'update' | 'rollback';
12
+ version: string;
13
+ registry: string;
14
+ before: PackageIdentity | null;
15
+ after: PackageIdentity | null;
16
+ stage: 'reviewed' | 'installing' | 'package_verified' | 'integrating' | 'complete' | 'uncertain';
17
+ created: string;
18
+ target?: RegistryPackage;
19
+ archive?: string;
20
+ snapshot?: ConfigHashes;
21
+ beforeCompatibility?: PackageCompatibility;
22
+ integrated?: boolean;
23
+ channel?: 'latest' | 'beta' | null;
24
+ previousChannel?: 'latest' | 'beta' | null;
25
+ results?: {
26
+ package: boolean;
27
+ integration: boolean;
28
+ error?: string;
29
+ };
30
+ executors?: {
31
+ pid: number;
32
+ token: string;
33
+ }[];
34
+ }
35
+ export declare const prefixKey: (prefix: string) => string;
36
+ export declare const pendingPath: (prefix: string) => string;
37
+ export declare function operationPath(operation: PackageOperation): string;
38
+ export declare function saveOperation(operation: PackageOperation): void;
39
+ export declare function startOperation(configDir: string, prefix: string, version: string, registry: string, before: PackageIdentity | null, action?: PackageOperation['action']): PackageOperation;
40
+ export declare function recordInstallation(operation: PackageOperation): void;
41
+ export declare function finishOperation(operation: PackageOperation): void;
42
+ export declare function observeOperation(operation: PackageOperation): (pid: number | null) => void;
43
+ export declare function createPrefix(prefix: string): void;
44
+ export interface InstallationRecord {
45
+ schema_version: 1;
46
+ current: PackageIdentity;
47
+ previous: PackageIdentity | null;
48
+ transaction: string;
49
+ channel: 'latest' | 'beta' | null;
50
+ previousChannel?: 'latest' | 'beta' | null;
51
+ }
52
+ export declare function readInstallation(configDir: string, prefix: string): InstallationRecord | null;
53
+ export declare function readOperation(configDir: string, prefix: string, id?: string): PackageOperation;