@fbincon/claude-code-statusline 3.4.0 → 3.6.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 (228) hide show
  1. package/README.md +78 -75
  2. package/candidate.json +392 -297
  3. package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js +5 -0
  4. package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js.map +1 -1
  5. package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js +2 -1
  6. package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js.map +1 -1
  7. package/node_modules/@fbincon/statusline-cli/dist/src/config/service.d.ts +2 -0
  8. package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js +14 -0
  9. package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js.map +1 -1
  10. package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js +5 -3
  11. package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js.map +1 -1
  12. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js +24 -0
  13. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js.map +1 -1
  14. package/node_modules/@fbincon/statusline-cli/dist/src/help.js +8 -2
  15. package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
  16. package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js +1 -1
  17. package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js.map +1 -1
  18. package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js +2 -0
  19. package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js.map +1 -1
  20. package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.d.ts +2 -0
  21. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup-service.d.ts +23 -0
  22. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup-service.js +168 -0
  23. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup-service.js.map +1 -0
  24. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.d.ts +3 -0
  25. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js +64 -0
  26. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js.map +1 -0
  27. package/node_modules/@fbincon/statusline-cli/dist/src/main.js +24 -4
  28. package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
  29. package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js +1 -1
  30. package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js.map +1 -1
  31. package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.js +46 -1
  32. package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.js.map +1 -1
  33. package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.d.ts +3 -0
  34. package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js +117 -0
  35. package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js.map +1 -0
  36. package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.d.ts +4 -0
  37. package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js +35 -0
  38. package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js.map +1 -0
  39. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.d.ts +8 -0
  40. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js +118 -0
  41. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js.map +1 -0
  42. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.d.ts +35 -0
  43. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js +359 -0
  44. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js.map +1 -0
  45. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +2 -2
  46. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +31 -1
  47. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
  48. package/node_modules/@fbincon/statusline-cli/resources/statusline-config/SKILL.md +5 -0
  49. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
  50. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +15 -5
  51. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +14 -7
  52. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +6 -2
  53. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +1 -0
  54. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/appearance.ts +24 -6
  55. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +2 -0
  56. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts +1 -1
  57. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/profile-manager.ts +21 -2
  58. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/quick-setup.ts +14 -11
  59. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts +60 -0
  60. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-manager.ts +301 -0
  61. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-validation.ts +45 -0
  62. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +577 -10
  63. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +1164 -6
  64. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +2 -1
  65. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +21 -18
  66. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +6 -2
  67. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +1 -0
  68. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
  69. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +3 -3
  70. package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.d.ts +91 -0
  71. package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js +250 -0
  72. package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js.map +1 -1
  73. package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.d.ts +1 -0
  74. package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +5 -2
  75. package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js.map +1 -1
  76. package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +1 -1
  77. package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +21 -12
  78. package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -1
  79. package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js +7 -10
  80. package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js.map +1 -1
  81. package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.d.ts +3 -0
  82. package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js +15 -1
  83. package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js.map +1 -1
  84. package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js +4 -2
  85. package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js.map +1 -1
  86. package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js +7 -2
  87. package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js.map +1 -1
  88. package/node_modules/@fbincon/statusline-core/dist/src/config/presets.d.ts +4 -0
  89. package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js +37 -3
  90. package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js.map +1 -1
  91. package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js +2 -1
  92. package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js.map +1 -1
  93. package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js +5 -3
  94. package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js.map +1 -1
  95. package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.d.ts +26 -2
  96. package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js +3 -3
  97. package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js.map +1 -1
  98. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +263 -6
  99. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +486 -3
  100. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
  101. package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.d.ts +4 -2
  102. package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js +29 -6
  103. package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js.map +1 -1
  104. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +16 -7
  105. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
  106. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +2 -0
  107. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +1 -0
  108. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
  109. package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js +1 -1
  110. package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -1
  111. package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.d.ts +3 -0
  112. package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js +26 -1
  113. package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js.map +1 -1
  114. package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.d.ts +4 -4
  115. package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.js +16 -9
  116. package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.js.map +1 -1
  117. package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.d.ts +30 -0
  118. package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js +96 -0
  119. package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js.map +1 -0
  120. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.d.ts +39 -0
  121. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js +270 -0
  122. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js.map +1 -0
  123. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.d.ts +2 -0
  124. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js +45 -0
  125. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js.map +1 -0
  126. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.d.ts +27 -0
  127. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js +222 -0
  128. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js.map +1 -0
  129. package/node_modules/@fbincon/statusline-core/dist/src/extensions/portable.d.ts +3 -0
  130. package/node_modules/@fbincon/statusline-core/dist/src/extensions/portable.js +6 -0
  131. package/node_modules/@fbincon/statusline-core/dist/src/extensions/portable.js.map +1 -0
  132. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +1158 -0
  133. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +1164 -6
  134. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
  135. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.d.ts +26 -0
  136. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js +27 -1
  137. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js.map +1 -1
  138. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.d.ts +26 -0
  139. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js +27 -1
  140. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js.map +1 -1
  141. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.d.ts +26 -0
  142. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js +27 -1
  143. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js.map +1 -1
  144. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.d.ts +26 -0
  145. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js +27 -1
  146. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js.map +1 -1
  147. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.d.ts +26 -0
  148. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.js +27 -1
  149. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.js.map +1 -1
  150. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.d.ts +26 -0
  151. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.js +27 -1
  152. package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.js.map +1 -1
  153. package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
  154. package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
  155. package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.d.ts +3 -1
  156. package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js +25 -3
  157. package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js.map +1 -1
  158. package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.d.ts +3 -1
  159. package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js +18 -5
  160. package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js.map +1 -1
  161. package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.d.ts +3 -0
  162. package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +1 -1
  163. package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js.map +1 -1
  164. package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +2 -0
  165. package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -1
  166. package/node_modules/@fbincon/statusline-core/dist/src/rendering/extensions.d.ts +7 -0
  167. package/node_modules/@fbincon/statusline-core/dist/src/rendering/extensions.js +35 -0
  168. package/node_modules/@fbincon/statusline-core/dist/src/rendering/extensions.js.map +1 -0
  169. package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +12 -6
  170. package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -1
  171. package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.d.ts +3 -0
  172. package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js +30 -9
  173. package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js.map +1 -1
  174. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +15 -5
  175. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +78 -48
  176. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
  177. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js +6 -0
  178. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js.map +1 -1
  179. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +3 -1
  180. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -1
  181. package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.d.ts +1 -0
  182. package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js +2 -2
  183. package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js.map +1 -1
  184. package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +15 -4
  185. package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -1
  186. package/node_modules/@fbincon/statusline-core/dist/src/terminal/links.d.ts +6 -0
  187. package/node_modules/@fbincon/statusline-core/dist/src/terminal/links.js +37 -0
  188. package/node_modules/@fbincon/statusline-core/dist/src/terminal/links.js.map +1 -0
  189. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +194 -1
  190. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +194 -1
  191. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +194 -1
  192. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +194 -1
  193. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +194 -1
  194. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +194 -1
  195. package/node_modules/@fbincon/statusline-platform/dist/src/posix-source-exec.d.ts +1 -0
  196. package/node_modules/@fbincon/statusline-platform/dist/src/posix-source-exec.js +26 -0
  197. package/node_modules/@fbincon/statusline-platform/dist/src/posix-source-exec.js.map +1 -0
  198. package/node_modules/@fbincon/statusline-platform/dist/src/source-files.d.ts +2 -0
  199. package/node_modules/@fbincon/statusline-platform/dist/src/source-files.js +37 -0
  200. package/node_modules/@fbincon/statusline-platform/dist/src/source-files.js.map +1 -0
  201. package/node_modules/@fbincon/statusline-platform/dist/src/source-process.d.ts +19 -0
  202. package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js +122 -0
  203. package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js.map +1 -0
  204. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.d.ts +4 -0
  205. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js +61 -0
  206. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js.map +1 -0
  207. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-job.d.ts +3 -0
  208. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-job.js +61 -0
  209. package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-job.js.map +1 -0
  210. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/canvas.js +3 -2
  211. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/canvas.js.map +1 -1
  212. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +6 -1
  213. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
  214. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js +2 -0
  215. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js.map +1 -1
  216. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +2 -0
  217. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
  218. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +1 -1
  219. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
  220. package/node_modules/@fbincon/statusline-tui/dist/src/session.js +6 -0
  221. package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
  222. package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +12 -0
  223. package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +75 -0
  224. package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -0
  225. package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +1 -1
  226. package/node_modules/@fbincon/statusline-tui/dist/src/state.js +12 -1
  227. package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
  228. package/package.json +1 -1
@@ -12,7 +12,7 @@ import {
12
12
  SCOPELABELS_VALUES,
13
13
  STATUSLINELANGUAGE_VALUES,
14
14
  UNAVAILABLEREASON_VALUES,
15
- FORMAT_CHOICES, PRESETS, EDITOR_FIELDS, GUIDANCE_KEYS, ITEM_DEFAULTS,
15
+ FORMAT_CHOICES, PRESETS, EDITOR_FIELDS, POWERLINE_FIELDS, GUIDANCE_KEYS, ITEM_DEFAULTS,
16
16
  } from './generated-contracts.ts';
17
17
  import type {
18
18
  Capabilities,
@@ -24,6 +24,7 @@ import type {
24
24
  Span,
25
25
  } from './generated-contracts.ts';
26
26
  import { validColor, visibilityChoices } from './editor/appearance.ts';
27
+ import { isSourceResult } from './editor/source-validation.ts';
27
28
  import { isLocalizedText } from './i18n/index.ts';
28
29
  import type { LocalizedText } from './i18n/index.ts';
29
30
 
@@ -104,7 +105,7 @@ function formatOverrides(value: unknown): boolean {
104
105
  function itemOptions(value: unknown, ids: readonly string[], scope: "main" | "subagent"): boolean {
105
106
  if (!object(value)) return false;
106
107
  return Object.entries(value).every(([id, option]) => ids.includes(id) && object(option) &&
107
- exact(option, ['label', 'icon', 'priority', 'max_width', 'formatting', 'foreground', 'background', 'visibility', 'visibility_threshold']) &&
108
+ exact(option, ['label', 'icon', 'priority', 'max_width', 'formatting', 'foreground', 'background', 'visibility', 'visibility_threshold', ...(option.link !== undefined ? ['link'] : [])]) && (option.link === undefined || ['off','auto','on'].includes(String(option.link))) &&
108
109
  (option.label === null || (text(option.label) && [...option.label].length <= 256)) &&
109
110
  (option.icon === null || (text(option.icon) && [...option.icon].length <= 256)) &&
110
111
  range(option.priority, 0, 100) && range(option.max_width, 2, 10000, true) &&
@@ -126,7 +127,7 @@ function instanceList(value: unknown, ids: readonly string[], scope: "main" | "s
126
127
  if (!Array.isArray(value)) return false;
127
128
  const seen = new Set<string>();
128
129
  return value.every(node => {
129
- if (!object(node) || !exact(node,['id','type_id','enabled','options','text']) ||
130
+ if (!object(node) || !exact(node,['id','type_id','enabled','options','text', ...(node.source !== undefined ? ['source'] : [])]) || node.source !== undefined && (!object(node.source) || !exact(node.source,['binding','hint']) || !(node.source.binding === null || text(node.source.binding)) || !text(node.source.hint)) ||
130
131
  typeof node.id !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/.test(node.id) || seen.has(node.id) ||
131
132
  typeof node.type_id !== 'string' || !ids.includes(node.type_id) || typeof node.enabled !== 'boolean' ||
132
133
  !itemOptions({[node.type_id]: node.options},ids,scope)) return false;
@@ -158,7 +159,7 @@ export function isDraft(value: unknown): value is Draft {
158
159
  'statusline_language',
159
160
  'instances',
160
161
  'use_colors',
161
- 'palette', 'theme', 'powerline_glyph',
162
+ 'palette', 'theme', 'powerline_glyph', 'powerline',
162
163
  'directory_style',
163
164
  'separator_style',
164
165
  'scope_labels',
@@ -169,7 +170,10 @@ export function isDraft(value: unknown): value is Draft {
169
170
  )
170
171
  return false;
171
172
  if (
172
- d.schema_version !== 8 ||
173
+ d.schema_version !== 10 ||
174
+ !object(d.powerline) || !exact(d.powerline, POWERLINE_FIELDS.map(f => f.key.slice(10))) ||
175
+ !POWERLINE_FIELDS.every(f => f.kind === 'boolean' ? typeof (d.powerline as Record<string, unknown>)[f.key.slice(10)] === 'boolean' :
176
+ (f.choices as readonly unknown[]).includes((d.powerline as Record<string, unknown>)[f.key.slice(10)])) ||
173
177
  !THEME_VALUES.some(x => x === d.theme) || !POWERLINEGLYPH_VALUES.some(x => x === d.powerline_glyph) ||
174
178
  !STATUSLINELANGUAGE_VALUES.some((x) => x === d.statusline_language) ||
175
179
  !object(d.metrics) || !exact(d.metrics, ['branch_diff_base_ref']) ||
@@ -332,6 +336,7 @@ function isOptions(value: unknown): value is ConfigurationOptions {
332
336
  palette: PALETTE_VALUES,
333
337
  theme: THEME_VALUES,
334
338
  "powerline-glyph": POWERLINEGLYPH_VALUES,
339
+ ...Object.fromEntries(POWERLINE_FIELDS.map(f => [f.key.replaceAll('.', '-').replaceAll('_', '-'), f.kind === 'boolean' ? [true, false] : f.choices])),
335
340
  'directory-style': DIRECTORYSTYLE_VALUES,
336
341
  'separator-style': SEPARATORSTYLE_VALUES,
337
342
  'scope-labels': SCOPELABELS_VALUES,
@@ -465,6 +470,8 @@ export function parseResponse<O extends Operation>(
465
470
  if (!exact(result, ['draft','changes']) || !isDraft(result.draft) || !Array.isArray(result.changes) || !result.changes.every(isImportChange)) fail();
466
471
  } else if (operation === 'import' || operation === 'preset') {
467
472
  if (!isDraft(result.draft)) fail();
473
+ } else if (operation.startsWith('source')) {
474
+ if (!isSourceResult(operation,result)) fail();
468
475
  } else if (operation === 'profiles_read' || operation === 'profiles_apply') {
469
476
  if (!isProfiles(result) || operation === 'profiles_apply' && (typeof result.changed !== 'boolean' || !(result.backup_dir === null || text(result.backup_dir)))) fail();
470
477
  } else if (operation === 'profile_import') {
@@ -504,8 +511,8 @@ export function parseResponse<O extends Operation>(
504
511
  !result.backend_version ||
505
512
  !isOptions(result.options) ||
506
513
  !isCapabilities(result.capabilities) ||
507
- !selection(result.operations, ['describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose', 'profiles_read', 'profiles_apply', 'profile_import', 'profile_export', 'task_details']) ||
508
- result.operations.length !== 17 ||
514
+ !selection(result.operations, ['sources_read','sources_apply','source_review','source_context','source_refresh','source_status','source_cancel','source_diagnose','describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose', 'profiles_read', 'profiles_apply', 'profile_import', 'profile_export', 'task_details']) ||
515
+ result.operations.length !== 25 ||
509
516
  JSON.stringify(result.editor_fields) !== JSON.stringify(EDITOR_FIELDS) ||
510
517
  JSON.stringify(result.presets) !== JSON.stringify(PRESETS) ||
511
518
  !object(result.formatting_options) ||
@@ -1,3 +1,4 @@
1
+ import { openSources, sourcesKey } from '../editor/source-manager.ts';
1
2
  import { openExplanation, explanationKey } from '../editor/explanation.ts';
2
3
  import { openQuick, controlQuick } from '../editor/quick-setup.ts';
3
4
  import { openProfiles, profilesKey } from '../editor/profile-manager.ts';
@@ -14,7 +15,7 @@ import { formSelection, pageSelection } from '../editor/navigation.ts';
14
15
  import { guidanceLines } from '../editor/guidance.ts';
15
16
  import { navigateReview } from '../editor/import-review.ts';
16
17
 
17
- export type Effect = 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | 'explain' | 'profiles' | null;
18
+ export type Effect = 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | 'explain' | 'profiles' | 'sources' | null;
18
19
 
19
20
  export function cancelInput(view: View): void {
20
21
  const input = view.input, e = view.editor;
@@ -35,6 +36,8 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
35
36
  const shortcut = /^[A-Z]$/.test(key) ? key.toLowerCase() : key;
36
37
  if (!e || view.busy) return null;
37
38
  if (event.overflow) { setMessage(view, 'message', localizedText('input.overflow')); return null; }
39
+ if (e.sources) return sourcesKey(e,event);
40
+ if (event.ctrl && key.toLowerCase()==='y' && !view.input && !e.review && !e.quick && !e.explanation) {openSources(e);return 'sources';}
38
41
  if (e.profiles) return profilesKey(e, { ...event, key: key === 'return' ? 'enter' : key });
39
42
  if (event.ctrl && key.toLowerCase() === 'o' && !view.input && !e.detail && !e.adding && !e.review && !e.quick && !e.explanation && !view.uncertain) {
40
43
  if (e.acceptNumeric()) { openProfiles(e); return 'profiles'; }
@@ -143,7 +146,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
143
146
  return null;
144
147
  }
145
148
  if(e.adding&&!event.ctrl&&!event.meta&&shortcut==='q'){e.closePicker(scope);return null;}
146
- if(e.adding&&event.ctrl&&key.toLowerCase()==='e'){e.detail={scope,id:e.selected[scope]};e.guidanceScroll=0;return null;}
149
+ if(e.adding&&event.ctrl&&key.toLowerCase()==='y'){e.detail={scope,id:e.selected[scope]};e.guidanceScroll=0;return null;}
147
150
  if(e.adding&&['tab','1','2','3','4'].includes(key))return null;
148
151
  }
149
152
  if (event.ctrl && key.toLowerCase() === 'e' && (e.page === 'main' || e.page === 'subagents')) {
@@ -197,6 +200,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
197
200
  return isSettings && e.setting === 'preview-background' ? 'previewBackground' : isSettings && e.setting === 'ui-language' ? 'uiLanguage' : null;
198
201
  } else if (key === 'return' || key === ' ' || key === 'space') {
199
202
  if (!isSettings) { if(!e.toggle(scope, selected))setMessage(view,"message",localizedText("composition.invalid")); }
203
+ else if (e.setting === 'sources') {openSources(e);return 'sources';}
200
204
  else if (e.setting === 'profiles') { if (e.acceptNumeric()) { openProfiles(e); return 'profiles'; } }
201
205
  else if (e.setting === 'quick-setup') { if (e.acceptNumeric()) e.quick=openQuick(e.draft); }
202
206
  else if(e.setting==='item-explain' && e.detail) { e.explanation=openExplanation(e.detail.scope,e.detail.id); return 'explain'; }
@@ -97,6 +97,7 @@ export function settingRows(view: View): SettingRow[] {
97
97
  rows.push(...fields.filter(row => row.group !== 'Appearance'));
98
98
  rows.push(
99
99
  { key: 'ui-language', label: 'Interface language (saved immediately)', group: 'Interface', value: LANGUAGE_NAMES[view.language ?? 'en'], editable: true },
100
+ { key: 'sources', label: 'Data sources', group: 'Presets / portable files', value: 'Enter', editable: true },
100
101
  { key: 'profiles', label: 'Display schemes and projects', group: 'Presets / portable files', value: 'Enter', editable: true },
101
102
  { key: 'quick-setup', label: 'Quick setup', group: 'Presets / portable files', value: 'Enter', editable: true },
102
103
  { key: 'preset-select', label: 'Preset', group: 'Presets / portable files', value: e.preset, editable: true },
@@ -1,21 +1,39 @@
1
1
  // Generated by tools/generation/resources.ts; do not edit.
2
2
  /** Pure controls/validation from Python's scoped visibility capabilities. */
3
- import { VISIBILITY_ITEMS } from '../generated-contracts.ts';
4
- import type { Scope, EditorField } from '../generated-contracts.ts';
3
+ import { VISIBILITY_ITEMS, FORMAT_CHOICES } from '../generated-contracts.ts';
4
+ import type { Scope, EditorField, ItemCapability } from '../generated-contracts.ts';
5
5
 
6
6
  export function visibilityChoices(scope: Scope, id: string): string[] {
7
7
  const rule = (VISIBILITY_ITEMS[scope] as Record<string, string>)[id];
8
8
  return rule ? ['always', rule] : ['always'];
9
9
  }
10
10
 
11
- export function itemFields(fields: EditorField[], scope: Scope, id: string): EditorField[] {
11
+ /** Existing rendering rules remain compatible; editors expose only effective overrides. */
12
+ export function supportedFormats(scope: Scope, id: string, capability?: ItemCapability): string[] {
13
+ if (capability) return capability.formats;
14
+ if (id === 'text' || id === 'spacer') return [];
15
+ const fields = ['labels', 'icons'];
16
+ if (['model', 'model-with-effort'].includes(id)) fields.push('model_name');
17
+ const numbers = scope === 'main'
18
+ ? ['context-window-size', 'context-tokens', 'tokens', 'input-tokens', 'output-tokens', 'cost', 'prompt-cache', 'session-cost', 'lines-changed', 'cache-misses', 'api-requests', 'spend-amount', 'active-agents', 'prompt-input-tokens', 'prompt-output-tokens', 'prompt-cost']
19
+ : ['context-window-size', 'context-tokens', 'tokens'];
20
+ if (numbers.includes(id)) fields.push('number_format');
21
+ if (scope === 'main' && ['five-hour-limit', 'weekly-limit', 'spend-limit'].includes(id)) fields.push('allowance');
22
+ if (scope === 'main' && ['five-hour-reset', 'weekly-reset'].includes(id)) fields.push('reset_format', 'reset_timezone');
23
+ return fields;
24
+ }
25
+
26
+ export function itemFields(fields: EditorField[], scope: Scope, id: string, capability?: ItemCapability): EditorField[] {
12
27
  if(id==='spacer')return [];
13
28
  if(id==='text')return [{key:'text',label:'Literal text',group:'Item format',kind:'text',choices:[],minimum:0,maximum:256,nullable:false},
14
29
  ...fields.filter(f=>['label','icon','foreground','background','priority','max_width'].includes(f.key))];
15
- const choices = visibilityChoices(scope, id);
16
- return fields.filter(spec => (spec.key !== 'visibility' || choices.length > 1) &&
30
+ const choices = capability?.visibility ?? visibilityChoices(scope, id);
31
+ const links: EditorField[] = capability?.link ? [{key:'link',label:'Links',group:'Item format',kind:'choice',choices:['off','auto','on'],minimum:0,maximum:0,nullable:false}] : [];
32
+ const formats = supportedFormats(scope, id, capability);
33
+ fields = fields.filter(field => !Object.hasOwn(FORMAT_CHOICES,field.key) || formats.includes(field.key));
34
+ return [...links, ...fields.filter(spec => (spec.key !== 'visibility' || choices.length > 1) &&
17
35
  (spec.key !== 'visibility_threshold' || choices.includes('used-at-least')))
18
- .map(spec => spec.key === 'visibility' ? {...spec, choices} : spec);
36
+ .map(spec => spec.key === 'visibility' ? {...spec, choices} : spec)];
19
37
  }
20
38
 
21
39
  export function validColor(value: unknown): boolean {
@@ -1,5 +1,6 @@
1
1
  // Generated by tools/generation/resources.ts; do not edit.
2
2
  import type { ExplanationView } from './explanation.ts';
3
+ import type { SourceManager } from './source-manager.ts';
3
4
  import type { ProfileManager } from './profile-manager.ts';
4
5
  import type { QuickSetup } from './quick-setup.ts';
5
6
  import { t, type Language } from '../i18n/index.ts';
@@ -45,6 +46,7 @@ export class Editor {
45
46
  quick: QuickSetup | null = null;
46
47
  explanation: ExplanationView | null = null;
47
48
  profiles: ProfileManager | null = null;
49
+ sources: SourceManager | null = null;
48
50
  preset = 'minimal';
49
51
  path = 'statusline.json';
50
52
  pendingTransfer: 'import' | 'export' | 'preset' | null = null;
@@ -63,7 +63,7 @@ export function formRows(view: FormView): FormRow[] {
63
63
  if (e.detail) {
64
64
  const node = e.instance(e.detail.scope, e.detail.id)!;
65
65
  const options = node.options;
66
- return itemFields(e.description.editor_fields.item!, e.detail.scope, node.type_id).map((spec) => row(spec, 'item:' + spec.key, spec.key === 'text' ? node.text : spec.key in e.description.formatting_options ? options.formatting[spec.key] ?? 'inherit' :
66
+ return itemFields(e.description.editor_fields.item!, e.detail.scope, node.type_id, e.definition(e.detail.scope,node.id)?.capabilities).map((spec) => row(spec, 'item:' + spec.key, spec.key === 'text' ? node.text : spec.key === 'link' ? options.link ?? 'off' : spec.key in e.description.formatting_options ? options.formatting[spec.key] ?? 'inherit' :
67
67
  options[spec.key as keyof typeof options] ?? ITEM_DEFAULTS[spec.key as keyof typeof ITEM_DEFAULTS]))
68
68
  .sort((a, b) => ['Item format', 'Conditional visibility', 'Item colors', 'Item fitting'].indexOf(a.group) - ['Item format', 'Conditional visibility', 'Item colors', 'Item fitting'].indexOf(b.group));
69
69
  }
@@ -17,6 +17,7 @@ export interface ProfileManager {
17
17
  selected: string | null;
18
18
  projectRoot: string | null;
19
19
  cursor: number;
20
+ detailScroll: number;
20
21
  action: Action | null;
21
22
  fields: { key: 'name' | 'path'; input: TextInput }[];
22
23
  field: number;
@@ -29,9 +30,15 @@ export interface ProfileManager {
29
30
  }
30
31
  export interface ProfileBackend { request<O extends Operation>(operation: O, payload?: unknown): ResultFor<O> | Promise<ResultFor<O>> }
31
32
  export function openProfiles(editor: Editor): void {
32
- editor.profiles = { library: null, page: 'list', selected: null, projectRoot: null, cursor: 0, action: null, fields: [], field: 0, candidate: null,
33
+ editor.profiles = { library: null, page: 'list', selected: null, projectRoot: null, cursor: 0, detailScroll: 0, action: null, fields: [], field: 0, candidate: null,
33
34
  confirmation: null, next: null, effect: { kind: 'load' }, message: null, uncertain: false };
34
35
  }
36
+ /** Open Save as without replacing the caller's unsaved draft. */
37
+ export function saveProfileCopy(editor: Editor, display: DisplayDraft): void {
38
+ openProfiles(editor);
39
+ editor.profiles!.candidate = JSON.parse(JSON.stringify(display)) as DisplayDraft;
40
+ editor.profiles!.action = 'save';
41
+ }
35
42
  export function targetLabel(editor: Editor, language: Language): string {
36
43
  const c = editor.baseline.configuration;
37
44
  if (!c) return t('profiles.user', language);
@@ -71,7 +78,7 @@ function submitForm(e: Editor): void {
71
78
  if (m.action === 'unbind') payload.path = values.path;
72
79
  m.confirmation = { kind: 'mutation', payload };
73
80
  }
74
- m.page = 'confirm'; m.cursor = 0;
81
+ m.page = 'confirm'; m.cursor = 0; m.detailScroll = 0;
75
82
  }
76
83
  /** One reducer supplies both editors; text never dispatches shortcuts. */
77
84
  export function profilesKey(e: Editor, event: TextKey): 'profiles' | null {
@@ -112,6 +119,7 @@ export function profilesKey(e: Editor, event: TextKey): 'profiles' | null {
112
119
  return m.effect ? 'profiles' : null;
113
120
  }
114
121
  if (m.page === 'confirm') {
122
+ if (key === 'pageup' || key === 'pagedown') { m.detailScroll = Math.max(0, m.detailScroll + (key === 'pageup' ? -1 : 1)); return null; }
115
123
  if (key === 'up' || key === 'down') m.cursor = 1 - m.cursor;
116
124
  if (key === 'enter') {
117
125
  if (m.cursor === 1) { m.page = 'list'; m.cursor = 0; m.confirmation = null; }
@@ -154,7 +162,9 @@ export async function performProfileAction(e: Editor, backend: ProfileBackend):
154
162
  let writing = false;
155
163
  try {
156
164
  if (effect.kind === 'load') {
165
+ const copy = m.action === 'save' && m.candidate !== null;
157
166
  m.library = await backend.request('profiles_read'); m.page = 'list'; m.cursor = 0;
167
+ if (copy) startForm(e, 'save');
158
168
  m.message = m.uncertain ? text('profiles.review_saved') : null; m.uncertain = false; return;
159
169
  }
160
170
  if (effect.kind === 'switch') {
@@ -227,6 +237,15 @@ export function profilesView(e: Editor, language: Language, width: number, heigh
227
237
  add(tr('profiles.action.' + (m.action ?? 'export')));
228
238
  if (value?.kind === 'mutation') add(String(value.payload.name ?? value.payload.path ?? m.library.profiles.find(p=>p.id===value.payload.id)?.name ?? ''));
229
239
  if (value?.kind === 'export') add(value.path);
240
+ if (value?.kind === 'mutation' && value.payload.action === 'save' && typeof value.payload.name === 'string') {
241
+ const profile = m.library.profiles.find(profile => profile.name === (value.payload.name as string).trim().normalize('NFC'));
242
+ const roots = m.library.bindings.filter(binding => binding.profile_id === profile?.id).map(binding => binding.root);
243
+ if (roots.length) for (const line of wrapText([t('profiles.shared', language, { count: roots.length }), ...roots], width)) add(line);
244
+ }
245
+ // Keep both confirmation actions reachable even with many bound projects.
246
+ const capacity = Math.max(0, height - 3), start = Math.min(m.detailScroll, Math.max(0, lines.length - capacity));
247
+ return [...lines.slice(start, start + capacity), ...rows.map((row, index) => ({ text: tr(row.label), selected: index === m.cursor })),
248
+ { text: tr('profiles.navigation'), selected: false }].slice(0, height);
230
249
  }
231
250
  if (m.page === 'actions') {
232
251
  add(m.library.profiles.find(p => p.id === m.selected)?.name ?? '');
@@ -5,6 +5,7 @@ import { THEME_VALUES, PALETTE_VALUES, SEPARATORSTYLE_VALUES, PRESETS } from '..
5
5
  import { copyDraft } from './draft.ts';
6
6
  import { t, type Language } from '../i18n/index.ts';
7
7
  import { wrapText } from '../../ui/text.ts';
8
+ import { saveProfileCopy } from './profile-manager.ts';
8
9
 
9
10
  export interface QuickSetup {
10
11
  base: Draft;
@@ -15,18 +16,18 @@ export interface QuickSetup {
15
16
  previewScope: Scope;
16
17
  detailScroll: number;
17
18
  }
18
- export function openQuick(draft: Draft): QuickSetup {
19
- return {base:copyDraft(draft),candidate:copyDraft(draft),step:'scenario',selected:0,preset:'developer',previewScope:'main',detailScroll:0};
19
+ export function openQuick(draft: Draft, preset = 'developer'): QuickSetup {
20
+ return {base:copyDraft(draft),candidate:copyDraft(draft),step:'scenario',selected:Math.max(0, PRESETS.findIndex(p=>p.id===preset)),preset,previewScope:'main',detailScroll:0};
20
21
  }
21
22
  export function receivePreset(quick: QuickSetup, draft: Draft): void {
22
23
  quick.candidate = copyDraft(draft); quick.step = 'appearance'; quick.selected = 0; quick.detailScroll = 0;
23
24
  }
24
- export function quickKey(quick: QuickSetup, key: string): 'preset' | 'accept' | 'save' | 'cancel' | null {
25
- const count = quick.step === 'scenario' ? PRESETS.length : quick.step === 'appearance' ? 5 : 3;
25
+ export function quickKey(quick: QuickSetup, key: string): 'preset' | 'accept' | 'save' | 'copy' | 'cancel' | null {
26
+ const count = quick.step === 'scenario' ? PRESETS.length : quick.step === 'appearance' ? 5 : 4;
26
27
  if (key === 'escape' || key === 'cancel') return 'cancel';
27
28
  if (key === 'pageup' || key === 'pagedown') { quick.detailScroll = Math.max(0, quick.detailScroll + (key === 'pageup' ? -1 : 1)); return null; }
28
29
  if (key === 'tab') { quick.previewScope = quick.previewScope === 'main' ? 'subagent' : 'main'; return null; }
29
- if (key === 'backspace' || quick.step === 'review' && quick.selected === 2 && key === 'return') {
30
+ if (key === 'backspace' || quick.step === 'review' && quick.selected === 3 && key === 'return') {
30
31
  if (quick.step === 'scenario') return 'cancel';
31
32
  quick.step = quick.step === 'review' ? 'appearance' : 'scenario';
32
33
  quick.selected = quick.step === 'scenario' ? Math.max(0, PRESETS.findIndex(p => p.id === quick.preset)) : 0;
@@ -37,7 +38,7 @@ export function quickKey(quick: QuickSetup, key: string): 'preset' | 'accept' |
37
38
  quick.detailScroll = 0; return null;
38
39
  }
39
40
  if (quick.step === 'scenario' && key === 'return') { quick.preset = PRESETS[quick.selected]!.id; return 'preset'; }
40
- if (quick.step === 'review' && key === 'return') return quick.selected === 0 ? 'accept' : 'save';
41
+ if (quick.step === 'review' && key === 'return') return quick.selected === 0 ? 'accept' : quick.selected === 1 ? 'save' : 'copy';
41
42
  if (quick.step !== 'appearance' || !['left','right','return'].includes(key)) return null;
42
43
  const d = quick.candidate.display, delta = key === 'left' ? -1 : 1;
43
44
  const cycle = <T>(values: readonly T[], value: T): T => values[(values.indexOf(value)+delta+values.length)%values.length]!;
@@ -49,7 +50,7 @@ export function quickKey(quick: QuickSetup, key: string): 'preset' | 'accept' |
49
50
  return null;
50
51
  }
51
52
  /** Both adapters use the same menu, selection window and scrollable requirement text. */
52
- export function quickView(quick: QuickSetup, language: Language, width: number, height: number): {text:string;selected:boolean}[] {
53
+ export function quickView(quick: QuickSetup, language: Language, width: number, height: number, sharedProjects: readonly string[] = []): {text:string;selected:boolean}[] {
53
54
  const tr = (key:string,params:Record<string,unknown>={}) => t(key,language,params);
54
55
  const preset = PRESETS.find(p=>p.id === (quick.step === 'scenario' ? PRESETS[quick.selected]!.id : quick.preset))!;
55
56
  const d=quick.candidate.display;
@@ -59,9 +60,10 @@ export function quickView(quick: QuickSetup, language: Language, width: number,
59
60
  tr('settings.colors')+': '+tr('values.'+(d.use_colors?'on':'off')),
60
61
  tr('settings.palette')+': '+d.palette,
61
62
  tr('settings.separator-style')+': '+tr('values.'+d.separator_style), tr('quick.next'),
62
- ] : [tr('quick.fine_tune'),tr('quick.save'),tr('quick.back')];
63
- const paragraphs=[tr(preset.requirements_key),tr('quick.sample'),
64
- ...(!d.subagents.enabled && preset.id==='multi-agent' ? [tr('quick.subagents_off')] : []),
63
+ ] : [tr('quick.fine_tune'),tr('quick.save'),tr('quick.copy'),tr('quick.back')];
64
+ const paragraphs=[...(quick.step === 'review' && quick.selected === 1 && sharedProjects.length ? [tr('profiles.shared',{count:sharedProjects.length}), ...sharedProjects] : []),
65
+ tr(preset.requirements_key),tr('quick.sample'),
66
+ ...(!d.subagents.enabled && ['multi-agent','agent-focus'].includes(preset.id) ? [tr('quick.subagents_off')] : []),
65
67
  ...(quick.step==='review' ? [tr('quick.replace')] : [])];
66
68
  const detail=wrapText(paragraphs,width), menuHeight=Math.max(1, Math.min(rows.length,Math.floor(height/2)));
67
69
  const start=Math.max(0, Math.min(quick.selected,rows.length-menuHeight,quick.selected-menuHeight+1));
@@ -71,12 +73,13 @@ export function quickView(quick: QuickSetup, language: Language, width: number,
71
73
  return result;
72
74
  }
73
75
 
74
- export function controlQuick(editor: Editor, key: string): 'transfer' | 'save' | null {
76
+ export function controlQuick(editor: Editor, key: string): 'transfer' | 'save' | 'profiles' | null {
75
77
  const quick = editor.quick;
76
78
  if (!quick) return null;
77
79
  const effect = quickKey(quick,key);
78
80
  if (effect === 'cancel') editor.quick = null;
79
81
  if (effect === 'preset') { editor.preset=quick.preset; editor.pendingTransfer='preset'; return 'transfer'; }
82
+ if (effect === 'copy') { saveProfileCopy(editor, quick.candidate.display); editor.quick=null; return 'profiles'; }
80
83
  if (effect === 'accept' || effect === 'save') { editor.replaceDraft(quick.candidate); editor.quick=null; return effect === 'save' ? 'save' : null; }
81
84
  return null;
82
85
  }
@@ -0,0 +1,60 @@
1
+ // Generated by tools/generation/resources.ts; do not edit.
2
+ import type { Draft } from '../generated-contracts.ts';
3
+ import { LANGUAGES, type Language, type LocalizedText } from '../i18n/index.ts';
4
+ import { copyDraft } from './draft.ts';
5
+ import { openQuick, quickKey, receivePreset, type QuickSetup } from './quick-setup.ts';
6
+
7
+ export interface SetupFacts {
8
+ checks: { level: 'OK' | 'WARN' | 'ERROR'; message: string | LocalizedText }[];
9
+ resources: string[];
10
+ notes: LocalizedText[];
11
+ draft: Draft | null;
12
+ hasDisplay: boolean;
13
+ canSave: boolean;
14
+ canIntegrate: boolean;
15
+ }
16
+ export type SetupEffect = 'cancel' | 'interrupt' | 'preset' | 'language' | 'save' | 'integrate' | null;
17
+ /** The wizard holds only drafts; effects are executed by its CLI/TUI adapters. */
18
+ export class SetupState {
19
+ phase: 'checks' | 'choice' | 'quick' | 'review' = 'checks';
20
+ selected = 0;
21
+ scroll = 0;
22
+ quick: QuickSetup | null = null;
23
+ candidate: Draft | null;
24
+ message: LocalizedText | null = null;
25
+ constructor(readonly facts: SetupFacts, public language: Language) { this.candidate = facts.draft ? copyDraft(facts.draft) : null; }
26
+ receive(draft: Draft): void { receivePreset(this.quick!, draft); }
27
+ key(key: string): SetupEffect {
28
+ if (key === 'interrupt') return 'interrupt';
29
+ if (key === 'escape' || key === 'cancel') return 'cancel';
30
+ if (key === 'l') { this.language = LANGUAGES[(LANGUAGES.indexOf(this.language) + 1) % LANGUAGES.length]!; return 'language'; }
31
+ if (this.phase === 'quick') {
32
+ if (key === 'backspace' && this.quick!.step === 'scenario') { this.phase = 'choice'; this.selected = 1; return null; }
33
+ const result = quickKey(this.quick!, key);
34
+ if (result === 'preset') return 'preset';
35
+ if (this.quick!.step === 'review') { this.candidate = copyDraft(this.quick!.candidate); this.phase = 'review'; this.selected = 0; this.scroll = 0; }
36
+ return null;
37
+ }
38
+ if (key === 'pageup' || key === 'pagedown') { this.scroll = Math.max(0, this.scroll + (key === 'pageup' ? -1 : 1)); return null; }
39
+ if (key === 'backspace' && this.phase !== 'checks') {
40
+ this.phase = this.phase === 'review' && this.quick ? 'quick' : 'checks';
41
+ if (this.phase === 'quick') { this.quick!.step = 'appearance'; this.quick!.selected = 4; }
42
+ this.scroll = 0; this.selected = 0; return null;
43
+ }
44
+ const count = this.phase === 'checks' ? 1 : this.phase === 'choice' ? 2 : 3;
45
+ if (['up','down','home','end'].includes(key)) {
46
+ this.selected = key === 'home' ? 0 : key === 'end' ? count - 1 : Math.max(0, Math.min(count - 1, this.selected + (key === 'up' ? -1 : 1)));
47
+ return null;
48
+ }
49
+ if (key !== 'return') return null;
50
+ if (this.phase === 'checks') { if (this.facts.canSave) { this.phase = 'choice'; this.selected = this.facts.hasDisplay ? 0 : 1; this.scroll = 0; } }
51
+ else if (this.phase === 'choice') {
52
+ this.scroll = 0;
53
+ if (this.selected === 0) { this.candidate = copyDraft(this.facts.draft!); this.quick = null; this.phase = 'review'; this.selected = 0; }
54
+ else { this.quick = openQuick(this.facts.draft!, 'daily-development'); this.phase = 'quick'; }
55
+ } else if (this.selected === 2) return 'cancel';
56
+ else if (this.selected === 1 && this.facts.canSave) return 'save';
57
+ else if (this.selected === 0 && this.facts.canIntegrate) return 'integrate';
58
+ return null;
59
+ }
60
+ }