@agents-inc/cli 0.32.1 → 0.34.1

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 (212) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +7 -7
  3. package/config/skills-matrix.yaml +1 -1
  4. package/config/stacks.yaml +1 -1
  5. package/dist/{chunk-OMV7TLWD.js → chunk-2LUXM5FB.js} +26 -89
  6. package/dist/chunk-2LUXM5FB.js.map +1 -0
  7. package/dist/{chunk-Z4TWOP3H.js → chunk-5YNZJ5TP.js} +2 -2
  8. package/dist/{chunk-UX2H2K2G.js → chunk-A5CYQQVG.js} +2 -2
  9. package/dist/chunk-ALS7SH7X.js +120 -0
  10. package/dist/chunk-ALS7SH7X.js.map +1 -0
  11. package/dist/{chunk-BZQBJP34.js → chunk-ANGAZ444.js} +2 -2
  12. package/dist/{chunk-IZZ4IIEG.js → chunk-B47QYIUL.js} +4 -4
  13. package/dist/{chunk-5PIKNCZX.js → chunk-CB7GYRUP.js} +5 -5
  14. package/dist/{chunk-4RAY5AOI.js → chunk-CEWNZQMH.js} +3 -3
  15. package/dist/{chunk-R74PZWQS.js → chunk-GGHH3KR2.js} +5 -5
  16. package/dist/chunk-GGHH3KR2.js.map +1 -0
  17. package/dist/{chunk-UICL22RT.js → chunk-GIFEDW27.js} +4 -4
  18. package/dist/{chunk-ODUOU55D.js → chunk-GVMA2EKC.js} +2 -2
  19. package/dist/chunk-HTTPKSL6.js +31 -0
  20. package/dist/chunk-HTTPKSL6.js.map +1 -0
  21. package/dist/{chunk-FJQRVFMB.js → chunk-JXMRTHDT.js} +2 -2
  22. package/dist/{chunk-PBEHPQLK.js → chunk-JZOLJVWA.js} +55 -20
  23. package/dist/chunk-JZOLJVWA.js.map +1 -0
  24. package/dist/{chunk-YND42IXK.js → chunk-KENWMEKN.js} +11 -9
  25. package/dist/chunk-KENWMEKN.js.map +1 -0
  26. package/dist/{chunk-IYG2LAIM.js → chunk-LFHZBF6N.js} +5 -17
  27. package/dist/chunk-LFHZBF6N.js.map +1 -0
  28. package/dist/{chunk-SO22IQPY.js → chunk-MZB3GGOH.js} +2 -2
  29. package/dist/chunk-MZB3GGOH.js.map +1 -0
  30. package/dist/{chunk-BZN2Z5P7.js → chunk-NLR6Z37M.js} +1 -1
  31. package/dist/chunk-NLR6Z37M.js.map +1 -0
  32. package/dist/{chunk-OGJIZ6QH.js → chunk-OKILA27U.js} +122 -232
  33. package/dist/chunk-OKILA27U.js.map +1 -0
  34. package/dist/{chunk-A27LOC4Z.js → chunk-QC37C32G.js} +2 -2
  35. package/dist/{chunk-3ZOIOVKT.js → chunk-R3AD6XBJ.js} +4 -4
  36. package/dist/chunk-R3AD6XBJ.js.map +1 -0
  37. package/dist/{chunk-LGUI3PMO.js → chunk-TKB4O2RY.js} +9 -9
  38. package/dist/chunk-TKB4O2RY.js.map +1 -0
  39. package/dist/{chunk-MM7NK5N2.js → chunk-TM4I4EHK.js} +5 -13
  40. package/dist/chunk-TM4I4EHK.js.map +1 -0
  41. package/dist/{chunk-R3XFQKPG.js → chunk-VEZ2GZEK.js} +2 -2
  42. package/dist/{chunk-WEUVWHMA.js → chunk-X7SPCWY6.js} +8 -8
  43. package/dist/{chunk-EMJ2ZKS7.js → chunk-XYCN2GCV.js} +3 -3
  44. package/dist/{chunk-LAPCUV4D.js → chunk-YCS7GF6Y.js} +2 -4
  45. package/dist/chunk-YCS7GF6Y.js.map +1 -0
  46. package/dist/{chunk-QPTOIZAT.js → chunk-YPJKOM42.js} +2 -2
  47. package/dist/{chunk-FZGYSLJL.js → chunk-ZE355C6C.js} +2 -2
  48. package/dist/{chunk-B2UBHA66.js → chunk-ZI5EBHCC.js} +26 -35
  49. package/dist/chunk-ZI5EBHCC.js.map +1 -0
  50. package/dist/{chunk-W2ZSCZ2U.js → chunk-ZP4BI6J2.js} +4 -4
  51. package/dist/commands/build/marketplace.js +3 -3
  52. package/dist/commands/build/plugins.js +5 -5
  53. package/dist/commands/build/stack.js +5 -5
  54. package/dist/commands/compile.js +7 -7
  55. package/dist/commands/compile.js.map +1 -1
  56. package/dist/commands/config/get.js +4 -4
  57. package/dist/commands/config/index.js +5 -5
  58. package/dist/commands/config/path.js +4 -4
  59. package/dist/commands/config/set-project.js +4 -4
  60. package/dist/commands/config/show.js +5 -5
  61. package/dist/commands/config/unset-project.js +4 -4
  62. package/dist/commands/diff.js +5 -5
  63. package/dist/commands/diff.js.map +1 -1
  64. package/dist/commands/doctor.js +7 -7
  65. package/dist/commands/doctor.js.map +1 -1
  66. package/dist/commands/edit.js +28 -31
  67. package/dist/commands/edit.js.map +1 -1
  68. package/dist/commands/eject.js +5 -5
  69. package/dist/commands/eject.js.map +1 -1
  70. package/dist/commands/import/skill.js +5 -5
  71. package/dist/commands/info.js +6 -6
  72. package/dist/commands/info.js.map +1 -1
  73. package/dist/commands/init.js +35 -41
  74. package/dist/commands/init.js.map +1 -1
  75. package/dist/commands/list.js +5 -5
  76. package/dist/commands/list.js.map +1 -1
  77. package/dist/commands/new/agent.js +5 -5
  78. package/dist/commands/new/skill.js +5 -5
  79. package/dist/commands/new/skill.js.map +1 -1
  80. package/dist/commands/outdated.js +5 -5
  81. package/dist/commands/outdated.js.map +1 -1
  82. package/dist/commands/search.js +7 -7
  83. package/dist/commands/uninstall.js +6 -6
  84. package/dist/commands/update.js +7 -7
  85. package/dist/commands/update.js.map +1 -1
  86. package/dist/commands/validate.js +5 -5
  87. package/dist/commands/version/bump.js +4 -4
  88. package/dist/commands/version/index.js +4 -4
  89. package/dist/commands/version/set.js +4 -4
  90. package/dist/commands/version/show.js +4 -4
  91. package/dist/components/skill-search/skill-search.js +3 -3
  92. package/dist/components/wizard/category-grid.js +2 -2
  93. package/dist/components/wizard/category-grid.test.js +34 -66
  94. package/dist/components/wizard/category-grid.test.js.map +1 -1
  95. package/dist/components/wizard/domain-selection.js +5 -5
  96. package/dist/components/wizard/help-modal.js +2 -2
  97. package/dist/components/wizard/menu-item.js +2 -2
  98. package/dist/components/wizard/search-modal.js +2 -2
  99. package/dist/components/wizard/search-modal.test.js +2 -2
  100. package/dist/components/wizard/section-progress.js +2 -2
  101. package/dist/components/wizard/section-progress.test.js +2 -2
  102. package/dist/components/wizard/source-grid.js +4 -4
  103. package/dist/components/wizard/source-grid.test.js +4 -4
  104. package/dist/components/wizard/stack-selection.js +8 -8
  105. package/dist/components/wizard/step-build.js +7 -7
  106. package/dist/components/wizard/step-build.test.js +17 -17
  107. package/dist/components/wizard/step-build.test.js.map +1 -1
  108. package/dist/components/wizard/step-confirm.js +3 -3
  109. package/dist/components/wizard/step-confirm.test.js +6 -6
  110. package/dist/components/wizard/step-refine.js +2 -2
  111. package/dist/components/wizard/step-refine.test.js +2 -2
  112. package/dist/components/wizard/step-settings.js +5 -5
  113. package/dist/components/wizard/step-settings.test.js +12 -12
  114. package/dist/components/wizard/step-settings.test.js.map +1 -1
  115. package/dist/components/wizard/step-sources.js +9 -9
  116. package/dist/components/wizard/step-sources.test.js +10 -10
  117. package/dist/components/wizard/step-stack.js +10 -10
  118. package/dist/components/wizard/step-stack.test.js +19 -23
  119. package/dist/components/wizard/step-stack.test.js.map +1 -1
  120. package/dist/components/wizard/view-title.js +2 -2
  121. package/dist/components/wizard/wizard-layout.js +7 -7
  122. package/dist/components/wizard/wizard-tabs.js +2 -2
  123. package/dist/components/wizard/wizard-tabs.test.js +7 -8
  124. package/dist/components/wizard/wizard-tabs.test.js.map +1 -1
  125. package/dist/components/wizard/wizard.js +23 -23
  126. package/dist/config/skills-matrix.yaml +1 -1
  127. package/dist/config/stacks.yaml +1 -1
  128. package/dist/hooks/init.js +3 -3
  129. package/dist/{source-manager-SBPPLOQQ.js → source-manager-WJYANKDI.js} +4 -4
  130. package/dist/src/agents/developer/api-developer/agent.yaml +1 -1
  131. package/dist/src/agents/developer/cli-developer/agent.yaml +1 -1
  132. package/dist/src/agents/developer/web-architecture/agent.yaml +1 -1
  133. package/dist/src/agents/developer/web-developer/agent.yaml +1 -1
  134. package/dist/src/agents/meta/agent-summoner/agent.yaml +1 -1
  135. package/dist/src/agents/meta/agent-summoner/critical-reminders.md +1 -1
  136. package/dist/src/agents/meta/agent-summoner/critical-requirements.md +1 -1
  137. package/dist/src/agents/meta/agent-summoner/examples.md +2 -2
  138. package/dist/src/agents/meta/agent-summoner/workflow.md +3 -3
  139. package/dist/src/agents/meta/documentor/agent.yaml +1 -1
  140. package/dist/src/agents/meta/skill-summoner/agent.yaml +1 -1
  141. package/dist/src/agents/meta/skill-summoner/output-format.md +1 -1
  142. package/dist/src/agents/migration/cli-migrator/agent.yaml +1 -1
  143. package/dist/src/agents/pattern/pattern-scout/agent.yaml +1 -1
  144. package/dist/src/agents/pattern/web-pattern-critique/agent.yaml +1 -1
  145. package/dist/src/agents/planning/web-pm/agent.yaml +1 -1
  146. package/dist/src/agents/researcher/api-researcher/agent.yaml +1 -1
  147. package/dist/src/agents/researcher/web-researcher/agent.yaml +1 -1
  148. package/dist/src/agents/reviewer/api-reviewer/agent.yaml +1 -1
  149. package/dist/src/agents/reviewer/cli-reviewer/agent.yaml +1 -1
  150. package/dist/src/agents/reviewer/web-reviewer/agent.yaml +1 -1
  151. package/dist/src/agents/tester/cli-tester/agent.yaml +1 -1
  152. package/dist/src/agents/tester/web-tester/agent.yaml +1 -1
  153. package/dist/stores/wizard-store.js +4 -4
  154. package/dist/stores/wizard-store.test.js +5 -5
  155. package/package.json +8 -8
  156. package/src/agents/developer/api-developer/agent.yaml +1 -1
  157. package/src/agents/developer/cli-developer/agent.yaml +1 -1
  158. package/src/agents/developer/web-architecture/agent.yaml +1 -1
  159. package/src/agents/developer/web-developer/agent.yaml +1 -1
  160. package/src/agents/meta/agent-summoner/agent.yaml +1 -1
  161. package/src/agents/meta/agent-summoner/critical-reminders.md +1 -1
  162. package/src/agents/meta/agent-summoner/critical-requirements.md +1 -1
  163. package/src/agents/meta/agent-summoner/examples.md +2 -2
  164. package/src/agents/meta/agent-summoner/workflow.md +3 -3
  165. package/src/agents/meta/documentor/agent.yaml +1 -1
  166. package/src/agents/meta/skill-summoner/agent.yaml +1 -1
  167. package/src/agents/meta/skill-summoner/output-format.md +1 -1
  168. package/src/agents/migration/cli-migrator/agent.yaml +1 -1
  169. package/src/agents/pattern/pattern-scout/agent.yaml +1 -1
  170. package/src/agents/pattern/web-pattern-critique/agent.yaml +1 -1
  171. package/src/agents/planning/web-pm/agent.yaml +1 -1
  172. package/src/agents/researcher/api-researcher/agent.yaml +1 -1
  173. package/src/agents/researcher/web-researcher/agent.yaml +1 -1
  174. package/src/agents/reviewer/api-reviewer/agent.yaml +1 -1
  175. package/src/agents/reviewer/cli-reviewer/agent.yaml +1 -1
  176. package/src/agents/reviewer/web-reviewer/agent.yaml +1 -1
  177. package/src/agents/tester/cli-tester/agent.yaml +1 -1
  178. package/src/agents/tester/web-tester/agent.yaml +1 -1
  179. package/dist/chunk-3ZOIOVKT.js.map +0 -1
  180. package/dist/chunk-B2UBHA66.js.map +0 -1
  181. package/dist/chunk-BZN2Z5P7.js.map +0 -1
  182. package/dist/chunk-H566H3MQ.js +0 -87
  183. package/dist/chunk-H566H3MQ.js.map +0 -1
  184. package/dist/chunk-IYG2LAIM.js.map +0 -1
  185. package/dist/chunk-LAPCUV4D.js.map +0 -1
  186. package/dist/chunk-LGUI3PMO.js.map +0 -1
  187. package/dist/chunk-MM7NK5N2.js.map +0 -1
  188. package/dist/chunk-O4D67NN7.js +0 -24
  189. package/dist/chunk-O4D67NN7.js.map +0 -1
  190. package/dist/chunk-OGJIZ6QH.js.map +0 -1
  191. package/dist/chunk-OMV7TLWD.js.map +0 -1
  192. package/dist/chunk-PBEHPQLK.js.map +0 -1
  193. package/dist/chunk-R74PZWQS.js.map +0 -1
  194. package/dist/chunk-SO22IQPY.js.map +0 -1
  195. package/dist/chunk-YND42IXK.js.map +0 -1
  196. /package/dist/{chunk-Z4TWOP3H.js.map → chunk-5YNZJ5TP.js.map} +0 -0
  197. /package/dist/{chunk-UX2H2K2G.js.map → chunk-A5CYQQVG.js.map} +0 -0
  198. /package/dist/{chunk-BZQBJP34.js.map → chunk-ANGAZ444.js.map} +0 -0
  199. /package/dist/{chunk-IZZ4IIEG.js.map → chunk-B47QYIUL.js.map} +0 -0
  200. /package/dist/{chunk-5PIKNCZX.js.map → chunk-CB7GYRUP.js.map} +0 -0
  201. /package/dist/{chunk-4RAY5AOI.js.map → chunk-CEWNZQMH.js.map} +0 -0
  202. /package/dist/{chunk-UICL22RT.js.map → chunk-GIFEDW27.js.map} +0 -0
  203. /package/dist/{chunk-ODUOU55D.js.map → chunk-GVMA2EKC.js.map} +0 -0
  204. /package/dist/{chunk-FJQRVFMB.js.map → chunk-JXMRTHDT.js.map} +0 -0
  205. /package/dist/{chunk-A27LOC4Z.js.map → chunk-QC37C32G.js.map} +0 -0
  206. /package/dist/{chunk-R3XFQKPG.js.map → chunk-VEZ2GZEK.js.map} +0 -0
  207. /package/dist/{chunk-WEUVWHMA.js.map → chunk-X7SPCWY6.js.map} +0 -0
  208. /package/dist/{chunk-EMJ2ZKS7.js.map → chunk-XYCN2GCV.js.map} +0 -0
  209. /package/dist/{chunk-QPTOIZAT.js.map → chunk-YPJKOM42.js.map} +0 -0
  210. /package/dist/{chunk-FZGYSLJL.js.map → chunk-ZE355C6C.js.map} +0 -0
  211. /package/dist/{chunk-W2ZSCZ2U.js.map → chunk-ZP4BI6J2.js.map} +0 -0
  212. /package/dist/{source-manager-SBPPLOQQ.js.map → source-manager-WJYANKDI.js.map} +0 -0
@@ -4,94 +4,16 @@ import {
4
4
  } from "./chunk-DC5AK3LW.js";
5
5
  import {
6
6
  CLI_COLORS,
7
- SCROLL_VIEWPORT,
8
- UI_SYMBOLS
9
- } from "./chunk-LAPCUV4D.js";
7
+ SCROLL_VIEWPORT
8
+ } from "./chunk-YCS7GF6Y.js";
10
9
  import {
11
10
  init_esm_shims
12
11
  } from "./chunk-DHET7RCE.js";
13
12
 
14
13
  // src/cli/components/wizard/category-grid.tsx
15
14
  init_esm_shims();
16
- import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
17
- import { Box, Text } from "ink";
18
- import { sortBy } from "remeda";
19
-
20
- // src/cli/components/hooks/use-virtual-scroll.ts
21
- init_esm_shims();
22
- import { useMemo } from "react";
23
- function computeVirtualScroll({
24
- items,
25
- availableHeight,
26
- focusedIndex,
27
- estimateItemHeight,
28
- terminalWidth
29
- }) {
30
- const totalItems = items.length;
31
- if (totalItems === 0) {
32
- return {
33
- visibleItems: [],
34
- startIndex: 0,
35
- endIndex: 0,
36
- hiddenAbove: 0,
37
- hiddenBelow: 0,
38
- isScrollable: false
39
- };
40
- }
41
- const heights = items.map((item) => estimateItemHeight(item, terminalWidth));
42
- const totalHeight = heights.reduce((sum, h) => sum + h, 0);
43
- if (totalHeight <= availableHeight) {
44
- return {
45
- visibleItems: items,
46
- startIndex: 0,
47
- endIndex: totalItems,
48
- hiddenAbove: 0,
49
- hiddenBelow: 0,
50
- isScrollable: false
51
- };
52
- }
53
- const viewportHeight = Math.max(
54
- SCROLL_VIEWPORT.MIN_VIEWPORT_ROWS,
55
- availableHeight - SCROLL_VIEWPORT.SCROLL_INDICATOR_HEIGHT * 2
56
- );
57
- const safeFocused = Math.max(0, Math.min(focusedIndex, totalItems - 1));
58
- let startIndex = safeFocused;
59
- let endIndex = safeFocused + 1;
60
- let usedHeight = heights[safeFocused] ?? 0;
61
- while (endIndex < totalItems) {
62
- const nextHeight = heights[endIndex] ?? 0;
63
- if (usedHeight + nextHeight > viewportHeight) break;
64
- usedHeight += nextHeight;
65
- endIndex++;
66
- }
67
- while (startIndex > 0) {
68
- const prevHeight = heights[startIndex - 1] ?? 0;
69
- if (usedHeight + prevHeight > viewportHeight) break;
70
- usedHeight += prevHeight;
71
- startIndex--;
72
- }
73
- while (endIndex < totalItems) {
74
- const nextHeight = heights[endIndex] ?? 0;
75
- if (usedHeight + nextHeight > viewportHeight) break;
76
- usedHeight += nextHeight;
77
- endIndex++;
78
- }
79
- return {
80
- visibleItems: items.slice(startIndex, endIndex),
81
- startIndex,
82
- endIndex,
83
- hiddenAbove: startIndex,
84
- hiddenBelow: totalItems - endIndex,
85
- isScrollable: true
86
- };
87
- }
88
- function useVirtualScroll(options) {
89
- const { items, availableHeight, focusedIndex, estimateItemHeight, terminalWidth } = options;
90
- return useMemo(
91
- () => computeVirtualScroll(options),
92
- [items, availableHeight, focusedIndex, estimateItemHeight, terminalWidth]
93
- );
94
- }
15
+ import { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef, useState } from "react";
16
+ import { Box, Text, measureElement } from "ink";
95
17
 
96
18
  // src/cli/components/hooks/use-category-grid-input.ts
97
19
  init_esm_shims();
@@ -106,12 +28,7 @@ var isSectionLocked = (categoryId, categories) => {
106
28
  if (!frameworkCategory) return false;
107
29
  return !frameworkCategory.options.some((opt) => opt.selected);
108
30
  };
109
- var findValidStartColumn = (options) => {
110
- for (let i = 0; i < options.length; i++) {
111
- if (options[i] && options[i].state !== "disabled") {
112
- return i;
113
- }
114
- }
31
+ var findValidStartColumn = (_options) => {
115
32
  return 0;
116
33
  };
117
34
  var findNextUnlockedIndex = (processed, currentIndex, allCategories) => {
@@ -149,11 +66,6 @@ function useCategoryGridInput({
149
66
  if (focusedCol > maxCol) {
150
67
  const newCol = Math.max(0, maxCol);
151
68
  setFocused(focusedRow, newCol);
152
- } else if (currentOptions[focusedCol]?.state === "disabled") {
153
- const validCol = findValidStartColumn(currentOptions);
154
- if (validCol !== focusedCol) {
155
- setFocused(focusedRow, validCol);
156
- }
157
69
  }
158
70
  }, [focusedRow, currentOptions, focusedCol, setFocused, currentRow]);
159
71
  useEffect(() => {
@@ -230,38 +142,30 @@ function useCategoryGridInput({
230
142
  // src/cli/components/wizard/category-grid.tsx
231
143
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
232
144
  var SYMBOL_REQUIRED = "*";
233
- var sortOptions = (options, expertMode) => {
234
- if (expertMode) {
235
- return options;
236
- }
237
- const stateOrder = {
238
- recommended: 0,
239
- normal: 1,
240
- discouraged: 2,
241
- disabled: 3
242
- };
243
- return sortBy([...options], (o) => stateOrder[o.state]);
145
+ var STATE_PRIORITY = {
146
+ recommended: 0,
147
+ normal: 1,
148
+ discouraged: 2,
149
+ disabled: 3
150
+ };
151
+ var stableSortByState = (options) => {
152
+ return [...options].sort((a, b) => {
153
+ if (a.selected !== b.selected) return a.selected ? -1 : 1;
154
+ return STATE_PRIORITY[a.state] - STATE_PRIORITY[b.state];
155
+ });
244
156
  };
245
157
  var findNextValidOption = (options, currentIndex, direction, wrap = true) => {
246
158
  const length = options.length;
247
159
  if (length === 0) return currentIndex;
248
- let index = currentIndex;
249
- let attempts = 0;
250
- while (attempts < length) {
251
- index += direction;
252
- if (wrap) {
253
- if (index < 0) index = length - 1;
254
- if (index >= length) index = 0;
255
- } else {
256
- if (index < 0) index = 0;
257
- if (index >= length) index = length - 1;
258
- }
259
- if (options[index] && options[index].state !== "disabled") {
260
- return index;
261
- }
262
- attempts++;
160
+ let index = currentIndex + direction;
161
+ if (wrap) {
162
+ if (index < 0) index = length - 1;
163
+ if (index >= length) index = 0;
164
+ } else {
165
+ if (index < 0) index = 0;
166
+ if (index >= length) index = length - 1;
263
167
  }
264
- return currentIndex;
168
+ return index;
265
169
  };
266
170
  var getStateSuffix = (state, isLocked) => {
267
171
  if (isLocked || state === "disabled") return "(disabled)";
@@ -269,71 +173,37 @@ var getStateSuffix = (state, isLocked) => {
269
173
  if (state === "discouraged") return "(discouraged)";
270
174
  return null;
271
175
  };
272
- var getStateSymbol = (option, isLocked) => {
273
- if (isLocked || option.state === "disabled") return UI_SYMBOLS.DISABLED;
274
- if (option.selected) return UI_SYMBOLS.SELECTED;
275
- if (option.state === "discouraged") return UI_SYMBOLS.DISCOURAGED;
276
- return UI_SYMBOLS.UNSELECTED;
277
- };
278
176
  var SkillTag = ({ option, isFocused, isLocked }) => {
279
- const getColor = () => {
280
- if (isLocked || option.state === "disabled") {
281
- return {
282
- text: CLI_COLORS.NEUTRAL,
283
- border: CLI_COLORS.NEUTRAL
284
- };
285
- }
286
- if (option.selected) {
287
- return {
288
- text: CLI_COLORS.PRIMARY,
289
- border: CLI_COLORS.PRIMARY
290
- };
291
- }
292
- if (option.state === "recommended") {
293
- return {
294
- text: CLI_COLORS.UNFOCUSED,
295
- border: CLI_COLORS.NEUTRAL
296
- };
297
- }
298
- if (option.state === "discouraged") {
299
- return {
300
- text: CLI_COLORS.WARNING,
301
- border: CLI_COLORS.WARNING
302
- };
303
- }
304
- return {
305
- text: CLI_COLORS.NEUTRAL,
306
- border: CLI_COLORS.NEUTRAL
307
- };
177
+ const getTextColor = () => {
178
+ if (isLocked || option.state === "disabled") return CLI_COLORS.NEUTRAL;
179
+ if (option.selected) return CLI_COLORS.PRIMARY;
180
+ if (option.state === "recommended") return CLI_COLORS.UNFOCUSED;
181
+ if (option.state === "discouraged") return CLI_COLORS.WARNING;
182
+ return CLI_COLORS.NEUTRAL;
183
+ };
184
+ const getStateBorderColor = () => {
185
+ if (isLocked || option.state === "disabled") return CLI_COLORS.NEUTRAL;
186
+ if (option.selected) return CLI_COLORS.PRIMARY;
187
+ if (option.state === "recommended") return CLI_COLORS.UNFOCUSED;
188
+ if (option.state === "discouraged") return CLI_COLORS.WARNING;
189
+ return CLI_COLORS.UNFOCUSED;
308
190
  };
309
191
  const isBold = isFocused || option.selected;
310
- const isDimmed = isLocked || option.state === "disabled";
311
- const isBorderDimmed = isDimmed || !option.selected && !isFocused;
312
- const focusBorderColor = option.selected ? CLI_COLORS.PRIMARY : CLI_COLORS.UNFOCUSED;
313
- const colors = getColor();
192
+ const textColor = getTextColor();
314
193
  const stateSuffix = getStateSuffix(option.state, isLocked);
315
- const stateSymbol = getStateSymbol(option, isLocked);
316
194
  return /* @__PURE__ */ jsx(
317
195
  Box,
318
196
  {
319
197
  marginRight: 1,
320
- borderColor: isFocused ? focusBorderColor : colors.border,
198
+ borderColor: isFocused ? getStateBorderColor() : CLI_COLORS.NEUTRAL,
321
199
  borderStyle: "single",
322
- borderDimColor: isBorderDimmed,
323
- children: /* @__PURE__ */ jsxs(Text, { color: colors.text, bold: isBold, dimColor: false, children: [
200
+ borderDimColor: !isFocused,
201
+ children: /* @__PURE__ */ jsxs(Text, { color: textColor, bold: isBold, dimColor: false, children: [
324
202
  " ",
325
203
  option.local && /* @__PURE__ */ jsxs(Fragment, { children: [
326
204
  /* @__PURE__ */ jsx(Text, { backgroundColor: CLI_COLORS.NEUTRAL, children: " L " }),
327
205
  " "
328
206
  ] }),
329
- option.installed && /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
330
- UI_SYMBOLS.SELECTED,
331
- " "
332
- ] }),
333
- !option.installed && /* @__PURE__ */ jsxs(Text, { dimColor: isDimmed, children: [
334
- stateSymbol,
335
- " "
336
- ] }),
337
207
  option.label,
338
208
  stateSuffix && /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
339
209
  " ",
@@ -373,38 +243,38 @@ var CategorySection = ({
373
243
  ] }, option.id)) })
374
244
  ] });
375
245
  };
376
- var estimateCategoryHeight = (category, terminalWidth) => {
377
- const { CATEGORY_NAME_LINES, AVG_TAG_WIDTH, CATEGORY_MARGIN_LINES } = SCROLL_VIEWPORT;
378
- const optionCount = category.sortedOptions.length;
379
- const tagsPerRow = Math.max(1, Math.floor(terminalWidth / AVG_TAG_WIDTH));
380
- const tagRows = Math.ceil(optionCount / tagsPerRow);
381
- return CATEGORY_NAME_LINES + tagRows + CATEGORY_MARGIN_LINES;
382
- };
383
- var ScrollIndicator = ({ count, direction }) => {
384
- if (count === 0) return null;
385
- const arrow = direction === "above" ? UI_SYMBOLS.SCROLL_UP : UI_SYMBOLS.SCROLL_DOWN;
386
- const label = `${arrow} ${count} more ${count === 1 ? "category" : "categories"} ${direction}`;
387
- return /* @__PURE__ */ jsx(Box, { paddingLeft: 1, marginTop: direction === "below" ? 1 : 0, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: label }) });
388
- };
389
- var DEFAULT_TERMINAL_WIDTH = 80;
390
246
  var CategoryGrid = ({
391
247
  categories,
248
+ availableHeight = 0,
392
249
  showDescriptions,
393
250
  expertMode,
394
251
  onToggle,
395
252
  onToggleDescriptions,
396
253
  defaultFocusedRow = 0,
397
254
  defaultFocusedCol = 0,
398
- onFocusChange,
399
- availableHeight,
400
- terminalWidth
255
+ onFocusChange
401
256
  }) => {
402
- const processedCategories = useMemo2(
403
- () => categories.map((category) => ({
404
- ...category,
405
- sortedOptions: sortOptions(category.options, expertMode)
406
- })),
407
- [categories, expertMode]
257
+ const initialOrderRef = useRef(/* @__PURE__ */ new Map());
258
+ const processedCategories = useMemo(
259
+ () => categories.map((category) => {
260
+ const cached = initialOrderRef.current.get(category.id);
261
+ if (cached) {
262
+ const orderMap = new Map(cached.map((id, idx) => [id, idx]));
263
+ const sorted2 = [...category.options].sort((a, b) => {
264
+ const aIdx = orderMap.get(a.id) ?? Infinity;
265
+ const bIdx = orderMap.get(b.id) ?? Infinity;
266
+ return aIdx - bIdx;
267
+ });
268
+ return { ...category, sortedOptions: sorted2 };
269
+ }
270
+ const sorted = stableSortByState(category.options);
271
+ initialOrderRef.current.set(
272
+ category.id,
273
+ sorted.map((o) => o.id)
274
+ );
275
+ return { ...category, sortedOptions: sorted };
276
+ }),
277
+ [categories]
408
278
  );
409
279
  const getColCount = useCallback2(
410
280
  (row) => processedCategories[row]?.sortedOptions.length ?? 0,
@@ -426,16 +296,6 @@ var CategoryGrid = ({
426
296
  },
427
297
  [processedCategories, categories]
428
298
  );
429
- const adjustCol = useCallback2(
430
- (row, clampedCol) => {
431
- const options = processedCategories[row]?.sortedOptions || [];
432
- if (options[clampedCol]?.state === "disabled") {
433
- return findValidStartColumn(options);
434
- }
435
- return clampedCol;
436
- },
437
- [processedCategories]
438
- );
439
299
  const { focusedRow, focusedCol, setFocused, moveFocus } = useFocusedListItem(
440
300
  processedCategories.length,
441
301
  getColCount,
@@ -443,7 +303,6 @@ var CategoryGrid = ({
443
303
  wrap: true,
444
304
  isRowLocked,
445
305
  findValidCol,
446
- adjustCol,
447
306
  onChange: onFocusChange,
448
307
  initialRow: defaultFocusedRow,
449
308
  initialCol: defaultFocusedCol
@@ -459,39 +318,70 @@ var CategoryGrid = ({
459
318
  onToggle,
460
319
  onToggleDescriptions
461
320
  });
462
- const { visibleItems, startIndex, hiddenAbove, hiddenBelow, isScrollable } = useVirtualScroll({
463
- items: processedCategories,
464
- availableHeight: availableHeight ?? Infinity,
465
- focusedIndex: focusedRow,
466
- estimateItemHeight: estimateCategoryHeight,
467
- terminalWidth: terminalWidth ?? DEFAULT_TERMINAL_WIDTH
321
+ const sectionRefs = useRef([]);
322
+ const [sectionHeights, setSectionHeights] = useState([]);
323
+ const [scrollTopPx, setScrollTopPx] = useState(0);
324
+ const setSectionRef = useCallback2((index, el) => {
325
+ sectionRefs.current[index] = el;
326
+ }, []);
327
+ useEffect2(() => {
328
+ const heights = sectionRefs.current.map((el) => {
329
+ if (el) {
330
+ const { height } = measureElement(el);
331
+ return height;
332
+ }
333
+ return 0;
334
+ });
335
+ setSectionHeights((prev) => {
336
+ if (prev.length === heights.length && prev.every((h, i) => h === heights[i])) {
337
+ return prev;
338
+ }
339
+ return heights;
340
+ });
468
341
  });
342
+ const scrollEnabled = availableHeight > 0 && availableHeight >= SCROLL_VIEWPORT.MIN_VIEWPORT_ROWS;
343
+ useEffect2(() => {
344
+ if (!scrollEnabled || sectionHeights.length === 0) return;
345
+ let topOfFocused = 0;
346
+ for (let i = 0; i < focusedRow; i++) {
347
+ topOfFocused += sectionHeights[i] ?? 0;
348
+ }
349
+ const focusedHeight = sectionHeights[focusedRow] ?? 0;
350
+ const bottomOfFocused = topOfFocused + focusedHeight;
351
+ setScrollTopPx((prev) => {
352
+ if (topOfFocused < prev) {
353
+ return topOfFocused;
354
+ }
355
+ if (bottomOfFocused > prev + availableHeight) {
356
+ return bottomOfFocused - availableHeight;
357
+ }
358
+ return prev;
359
+ });
360
+ }, [focusedRow, sectionHeights, scrollEnabled, availableHeight]);
469
361
  if (categories.length === 0) {
470
362
  return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "No categories to display." }) });
471
363
  }
472
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
473
- isScrollable && /* @__PURE__ */ jsx(ScrollIndicator, { count: hiddenAbove, direction: "above" }),
474
- visibleItems.map((category, visibleIndex) => {
475
- const originalIndex = startIndex + visibleIndex;
476
- const isLocked = isSectionLocked(category.id, categories);
477
- return /* @__PURE__ */ jsx(
478
- CategorySection,
479
- {
480
- category,
481
- options: category.sortedOptions,
482
- isLocked,
483
- isFocused: originalIndex === focusedRow,
484
- focusedOptionIndex: focusedCol,
485
- showDescriptions
486
- },
487
- category.id
488
- );
489
- }),
490
- isScrollable && /* @__PURE__ */ jsx(ScrollIndicator, { count: hiddenBelow, direction: "below" })
491
- ] });
364
+ const sectionElements = processedCategories.map((category, index) => {
365
+ const isLocked = isSectionLocked(category.id, categories);
366
+ return /* @__PURE__ */ jsx(Box, { ref: (el) => setSectionRef(index, el), flexShrink: 0, children: /* @__PURE__ */ jsx(
367
+ CategorySection,
368
+ {
369
+ category,
370
+ options: category.sortedOptions,
371
+ isLocked,
372
+ isFocused: index === focusedRow,
373
+ focusedOptionIndex: focusedCol,
374
+ showDescriptions
375
+ }
376
+ ) }, category.id);
377
+ });
378
+ if (!scrollEnabled) {
379
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", flexGrow: 1, overflow: "hidden", children: sectionElements });
380
+ }
381
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", height: availableHeight, overflow: "hidden", children: /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginTop: scrollTopPx > 0 ? -scrollTopPx : 0, flexShrink: 0, children: sectionElements }) });
492
382
  };
493
383
 
494
384
  export {
495
385
  CategoryGrid
496
386
  };
497
- //# sourceMappingURL=chunk-OGJIZ6QH.js.map
387
+ //# sourceMappingURL=chunk-OKILA27U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/components/wizard/category-grid.tsx","../src/cli/components/hooks/use-category-grid-input.ts"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { Box, type DOMElement, Text, measureElement } from \"ink\";\n\nimport type { SkillId, Subcategory } from \"../../types/index.js\";\nimport { CLI_COLORS, SCROLL_VIEWPORT } from \"../../consts.js\";\nimport {\n findValidStartColumn,\n isSectionLocked,\n useCategoryGridInput,\n} from \"../hooks/use-category-grid-input.js\";\nimport { useFocusedListItem } from \"../hooks/use-focused-list-item.js\";\n\nexport type OptionState = \"normal\" | \"recommended\" | \"discouraged\" | \"disabled\";\n\nexport type CategoryOption = {\n id: SkillId;\n label: string;\n state: OptionState;\n stateReason?: string;\n selected: boolean;\n local?: boolean;\n installed?: boolean;\n};\n\nexport type CategoryRow = {\n id: Subcategory;\n displayName: string;\n required: boolean;\n exclusive: boolean;\n options: CategoryOption[];\n};\n\nexport type CategoryGridProps = {\n categories: CategoryRow[];\n /** Available height in terminal lines for the scrollable viewport. 0 = no constraint. */\n availableHeight?: number;\n showDescriptions: boolean;\n expertMode: boolean;\n onToggle: (categoryId: Subcategory, technologyId: SkillId) => void;\n onToggleDescriptions: () => void;\n /** Optional initial focus row (default: 0). Use with React `key` to reset. */\n defaultFocusedRow?: number;\n /** Optional initial focus col (default: 0). Use with React `key` to reset. */\n defaultFocusedCol?: number;\n /** Optional callback fired whenever the focused position changes */\n onFocusChange?: (row: number, col: number) => void;\n};\n\nconst SYMBOL_REQUIRED = \"*\";\n\n/**\n * Priority order for skill states in the initial sort.\n * Lower numbers appear first. Selected skills are sorted above all states.\n */\nconst STATE_PRIORITY: Record<OptionState, number> = {\n recommended: 0,\n normal: 1,\n discouraged: 2,\n disabled: 3,\n};\n\n/**\n * Sort options by: selected first, then by state priority.\n * Within each group, original matrix order is preserved (stable sort).\n */\nconst stableSortByState = (options: CategoryOption[]): CategoryOption[] => {\n return [...options].sort((a, b) => {\n // Selected skills first\n if (a.selected !== b.selected) return a.selected ? -1 : 1;\n // Then by state priority\n return STATE_PRIORITY[a.state] - STATE_PRIORITY[b.state];\n });\n};\n\nconst findNextValidOption = (\n options: CategoryOption[],\n currentIndex: number,\n direction: 1 | -1,\n wrap = true,\n): number => {\n const length = options.length;\n if (length === 0) return currentIndex;\n\n let index = currentIndex + direction;\n\n if (wrap) {\n if (index < 0) index = length - 1;\n if (index >= length) index = 0;\n } else {\n if (index < 0) index = 0;\n if (index >= length) index = length - 1;\n }\n\n return index;\n};\n\ntype SkillTagProps = {\n option: CategoryOption;\n isFocused: boolean;\n isLocked: boolean;\n};\n\nconst getStateSuffix = (state: OptionState, isLocked: boolean): string | null => {\n if (isLocked || state === \"disabled\") return \"(disabled)\";\n if (state === \"recommended\") return \"(recommended)\";\n if (state === \"discouraged\") return \"(discouraged)\";\n return null;\n};\n\nconst SkillTag: React.FC<SkillTagProps> = ({ option, isFocused, isLocked }) => {\n const getTextColor = (): string => {\n if (isLocked || option.state === \"disabled\") return CLI_COLORS.NEUTRAL;\n if (option.selected) return CLI_COLORS.PRIMARY;\n if (option.state === \"recommended\") return CLI_COLORS.UNFOCUSED;\n if (option.state === \"discouraged\") return CLI_COLORS.WARNING;\n // Normal unselected: muted color to clearly contrast with selected (cyan) skills\n return CLI_COLORS.NEUTRAL;\n };\n\n const getStateBorderColor = (): string => {\n if (isLocked || option.state === \"disabled\") return CLI_COLORS.NEUTRAL;\n if (option.selected) return CLI_COLORS.PRIMARY;\n if (option.state === \"recommended\") return CLI_COLORS.UNFOCUSED;\n if (option.state === \"discouraged\") return CLI_COLORS.WARNING;\n return CLI_COLORS.UNFOCUSED;\n };\n\n const isBold = isFocused || option.selected;\n const textColor = getTextColor();\n const stateSuffix = getStateSuffix(option.state, isLocked);\n\n return (\n <Box\n marginRight={1}\n borderColor={isFocused ? getStateBorderColor() : CLI_COLORS.NEUTRAL}\n borderStyle=\"single\"\n borderDimColor={!isFocused}\n >\n <Text color={textColor} bold={isBold} dimColor={false}>\n {\" \"}\n {option.local && (\n <>\n <Text backgroundColor={CLI_COLORS.NEUTRAL}> L </Text>{\" \"}\n </>\n )}\n {option.label}\n {stateSuffix && <Text dimColor> {stateSuffix}</Text>}{\" \"}\n </Text>\n </Box>\n );\n};\n\ntype CategorySectionProps = {\n category: CategoryRow;\n options: CategoryOption[];\n isLocked: boolean;\n isFocused: boolean;\n focusedOptionIndex: number;\n showDescriptions: boolean;\n};\n\nconst CategorySection: React.FC<CategorySectionProps> = ({\n category,\n options,\n isLocked,\n isFocused,\n focusedOptionIndex,\n showDescriptions,\n}) => {\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Box flexDirection=\"row\">\n <Text dimColor={isLocked}>{category.displayName}</Text>\n {category.required && (\n <Text color={isLocked ? CLI_COLORS.NEUTRAL : CLI_COLORS.ERROR} dimColor={isLocked}>\n {\" \"}\n {SYMBOL_REQUIRED}\n </Text>\n )}\n </Box>\n\n <Box flexDirection=\"row\" flexWrap=\"wrap\" marginTop={0}>\n {options.map((option, index) => (\n <Box key={option.id} flexDirection=\"column\">\n <SkillTag\n option={option}\n isFocused={isFocused && index === focusedOptionIndex && !isLocked}\n isLocked={isLocked}\n />\n {showDescriptions && option.stateReason && !isLocked && (\n <Box marginLeft={1} marginBottom={0}>\n <Text dimColor wrap=\"truncate-end\">\n {option.stateReason}\n </Text>\n </Box>\n )}\n </Box>\n ))}\n </Box>\n </Box>\n );\n};\n\ntype ProcessedCategory = CategoryRow & { sortedOptions: CategoryOption[] };\n\nexport const CategoryGrid: React.FC<CategoryGridProps> = ({\n categories,\n availableHeight = 0,\n showDescriptions,\n expertMode,\n onToggle,\n onToggleDescriptions,\n defaultFocusedRow = 0,\n defaultFocusedCol = 0,\n onFocusChange,\n}) => {\n // Cache the initial sort order per category so toggling selections does not reorder skills.\n // The ref resets when the component remounts (e.g., domain change via key={activeDomain}).\n const initialOrderRef = useRef<Map<string, SkillId[]>>(new Map());\n\n const processedCategories = useMemo(\n () =>\n categories.map((category) => {\n const cached = initialOrderRef.current.get(category.id);\n if (cached) {\n // Re-order options to match the cached initial sort\n const orderMap = new Map(cached.map((id, idx) => [id, idx]));\n const sorted = [...category.options].sort((a, b) => {\n const aIdx = orderMap.get(a.id) ?? Infinity;\n const bIdx = orderMap.get(b.id) ?? Infinity;\n return aIdx - bIdx;\n });\n return { ...category, sortedOptions: sorted };\n }\n // First time seeing this category — sort by state priority\n const sorted = stableSortByState(category.options);\n initialOrderRef.current.set(\n category.id,\n sorted.map((o) => o.id),\n );\n return { ...category, sortedOptions: sorted };\n }),\n [categories],\n );\n\n const getColCount = useCallback(\n (row: number): number => processedCategories[row]?.sortedOptions.length ?? 0,\n [processedCategories],\n );\n\n const isRowLocked = useCallback(\n (row: number): boolean => {\n const cat = processedCategories[row];\n return cat ? isSectionLocked(cat.id, categories) : false;\n },\n [processedCategories, categories],\n );\n\n const findValidCol = useCallback(\n (row: number, currentCol: number, direction: 1 | -1): number => {\n const options = processedCategories[row]?.sortedOptions || [];\n const catId = processedCategories[row]?.id;\n if (catId && isSectionLocked(catId, categories)) return currentCol;\n return findNextValidOption(options, currentCol, direction, true);\n },\n [processedCategories, categories],\n );\n\n const { focusedRow, focusedCol, setFocused, moveFocus } = useFocusedListItem(\n processedCategories.length,\n getColCount,\n {\n wrap: true,\n isRowLocked,\n findValidCol,\n onChange: onFocusChange,\n initialRow: defaultFocusedRow,\n initialCol: defaultFocusedCol,\n },\n );\n\n useCategoryGridInput({\n processedCategories,\n categories,\n focusedRow,\n focusedCol,\n setFocused,\n moveFocus,\n onToggle,\n onToggleDescriptions,\n });\n\n // --- Pixel-accurate scroll tracking ---\n const sectionRefs = useRef<(DOMElement | null)[]>([]);\n const [sectionHeights, setSectionHeights] = useState<number[]>([]);\n const [scrollTopPx, setScrollTopPx] = useState(0);\n\n const setSectionRef = useCallback((index: number, el: DOMElement | null) => {\n sectionRefs.current[index] = el;\n }, []);\n\n // Measure all section heights after each render\n useEffect(() => {\n const heights = sectionRefs.current.map((el) => {\n if (el) {\n const { height } = measureElement(el);\n return height;\n }\n return 0;\n });\n setSectionHeights((prev) => {\n // Only update if heights actually changed (avoid infinite re-render)\n if (prev.length === heights.length && prev.every((h, i) => h === heights[i])) {\n return prev;\n }\n return heights;\n });\n });\n\n const scrollEnabled = availableHeight > 0 && availableHeight >= SCROLL_VIEWPORT.MIN_VIEWPORT_ROWS;\n\n // Scroll focused row into view\n useEffect(() => {\n if (!scrollEnabled || sectionHeights.length === 0) return;\n\n let topOfFocused = 0;\n for (let i = 0; i < focusedRow; i++) {\n topOfFocused += sectionHeights[i] ?? 0;\n }\n const focusedHeight = sectionHeights[focusedRow] ?? 0;\n const bottomOfFocused = topOfFocused + focusedHeight;\n\n setScrollTopPx((prev) => {\n if (topOfFocused < prev) {\n return topOfFocused;\n }\n if (bottomOfFocused > prev + availableHeight) {\n return bottomOfFocused - availableHeight;\n }\n return prev;\n });\n }, [focusedRow, sectionHeights, scrollEnabled, availableHeight]);\n\n if (categories.length === 0) {\n return (\n <Box flexDirection=\"column\">\n <Text dimColor>No categories to display.</Text>\n </Box>\n );\n }\n\n const sectionElements = processedCategories.map((category, index) => {\n const isLocked = isSectionLocked(category.id, categories);\n\n return (\n <Box key={category.id} ref={(el) => setSectionRef(index, el)} flexShrink={0}>\n <CategorySection\n category={category}\n options={category.sortedOptions}\n isLocked={isLocked}\n isFocused={index === focusedRow}\n focusedOptionIndex={focusedCol}\n showDescriptions={showDescriptions}\n />\n </Box>\n );\n });\n\n // When no height constraint, render flat (tests, or before first measurement)\n if (!scrollEnabled) {\n return (\n <Box flexDirection=\"column\" flexGrow={1} overflow=\"hidden\">\n {sectionElements}\n </Box>\n );\n }\n\n return (\n <Box flexDirection=\"column\" height={availableHeight} overflow=\"hidden\">\n <Box flexDirection=\"column\" marginTop={scrollTopPx > 0 ? -scrollTopPx : 0} flexShrink={0}>\n {sectionElements}\n </Box>\n </Box>\n );\n};\n","import { useCallback, useEffect } from \"react\";\nimport { useInput } from \"ink\";\n\nimport type { Subcategory, SkillId } from \"../../types/index.js\";\nimport type { CategoryOption, CategoryRow } from \"../wizard/category-grid.js\";\n\nconst FRAMEWORK_CATEGORY_ID = \"framework\";\n\n// Locked = non-framework section when no framework is selected\nexport const isSectionLocked = (categoryId: Subcategory, categories: CategoryRow[]): boolean => {\n if (categoryId === FRAMEWORK_CATEGORY_ID) {\n return false;\n }\n\n const frameworkCategory = categories.find((cat) => cat.id === FRAMEWORK_CATEGORY_ID);\n if (!frameworkCategory) return false;\n\n return !frameworkCategory.options.some((opt) => opt.selected);\n};\n\nexport const findValidStartColumn = (_options: CategoryOption[]): number => {\n return 0;\n};\n\n/** Find next unlocked section index (wrapping, direction: forward) */\nexport const findNextUnlockedIndex = (\n processed: { id: Subcategory; sortedOptions: CategoryOption[] }[],\n currentIndex: number,\n allCategories: CategoryRow[],\n): number => {\n const length = processed.length;\n if (length === 0) return currentIndex;\n\n let index = currentIndex;\n let attempts = 0;\n\n while (attempts < length) {\n index += 1;\n if (index >= length) index = 0;\n\n const category = processed[index];\n if (category && !isSectionLocked(category.id, allCategories)) {\n return index;\n }\n\n attempts++;\n }\n\n return currentIndex;\n};\n\ntype ProcessedCategory = CategoryRow & { sortedOptions: CategoryOption[] };\n\ntype UseCategoryGridInputOptions = {\n processedCategories: ProcessedCategory[];\n categories: CategoryRow[];\n focusedRow: number;\n focusedCol: number;\n setFocused: (row: number, col: number) => void;\n moveFocus: (direction: \"up\" | \"down\" | \"left\" | \"right\") => void;\n onToggle: (categoryId: Subcategory, technologyId: SkillId) => void;\n onToggleDescriptions: () => void;\n};\n\nexport function useCategoryGridInput({\n processedCategories,\n categories,\n focusedRow,\n focusedCol,\n setFocused,\n moveFocus,\n onToggle,\n onToggleDescriptions,\n}: UseCategoryGridInputOptions): void {\n const currentRow = processedCategories[focusedRow];\n const currentOptions = currentRow?.sortedOptions || [];\n const currentLocked = currentRow ? isSectionLocked(currentRow.id, categories) : false;\n\n // Adjust column when current row's options change externally (e.g. option becomes disabled)\n useEffect(() => {\n if (!currentRow) return;\n\n const maxCol = currentOptions.length - 1;\n if (focusedCol > maxCol) {\n const newCol = Math.max(0, maxCol);\n setFocused(focusedRow, newCol);\n }\n }, [focusedRow, currentOptions, focusedCol, setFocused, currentRow]);\n\n // Bounce off locked sections when a section becomes locked (e.g. framework deselected)\n useEffect(() => {\n if (currentRow && currentLocked) {\n const nextUnlocked = findNextUnlockedIndex(processedCategories, focusedRow, categories);\n if (nextUnlocked !== focusedRow) {\n const newRowOptions = processedCategories[nextUnlocked]?.sortedOptions || [];\n const newCol = findValidStartColumn(newRowOptions);\n setFocused(nextUnlocked, newCol);\n }\n }\n }, [currentRow, currentLocked, focusedRow, processedCategories, categories, setFocused]);\n\n useInput(\n useCallback(\n (\n input: string,\n key: {\n leftArrow: boolean;\n rightArrow: boolean;\n upArrow: boolean;\n downArrow: boolean;\n tab: boolean;\n shift: boolean;\n },\n ) => {\n if (key.tab && key.shift) {\n onToggleDescriptions();\n return;\n }\n\n if (key.tab && !key.shift) {\n const nextSection = findNextUnlockedIndex(processedCategories, focusedRow, categories);\n if (nextSection !== focusedRow) {\n const newRowOptions = processedCategories[nextSection]?.sortedOptions || [];\n const newCol = findValidStartColumn(newRowOptions);\n setFocused(nextSection, newCol);\n }\n return;\n }\n\n if (input === \"d\" || input === \"D\") {\n onToggleDescriptions();\n return;\n }\n\n if (input === \" \") {\n if (currentLocked) return;\n const currentOption = currentOptions[focusedCol];\n if (currentOption && currentOption.state !== \"disabled\") {\n onToggle(currentRow.id, currentOption.id);\n }\n return;\n }\n\n const isLeft = key.leftArrow || input === \"h\";\n const isRight = key.rightArrow || input === \"l\";\n const isUp = key.upArrow || input === \"k\";\n const isDown = key.downArrow || input === \"j\";\n\n if (isLeft) {\n if (currentLocked) return;\n moveFocus(\"left\");\n } else if (isRight) {\n if (currentLocked) return;\n moveFocus(\"right\");\n } else if (isUp) {\n moveFocus(\"up\");\n } else if (isDown) {\n moveFocus(\"down\");\n }\n },\n [\n focusedRow,\n focusedCol,\n currentOptions,\n currentRow,\n currentLocked,\n processedCategories,\n categories,\n onToggle,\n onToggleDescriptions,\n setFocused,\n moveFocus,\n ],\n ),\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA,SAAgB,eAAAA,cAAa,aAAAC,YAAW,SAAS,QAAQ,gBAAgB;AAEzE,SAAS,KAAsB,MAAM,sBAAsB;;;ACF3D;AAAA,SAAS,aAAa,iBAAiB;AACvC,SAAS,gBAAgB;AAKzB,IAAM,wBAAwB;AAGvB,IAAM,kBAAkB,CAAC,YAAyB,eAAuC;AAC9F,MAAI,eAAe,uBAAuB;AACxC,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,WAAW,KAAK,CAAC,QAAQ,IAAI,OAAO,qBAAqB;AACnF,MAAI,CAAC,kBAAmB,QAAO;AAE/B,SAAO,CAAC,kBAAkB,QAAQ,KAAK,CAAC,QAAQ,IAAI,QAAQ;AAC9D;AAEO,IAAM,uBAAuB,CAAC,aAAuC;AAC1E,SAAO;AACT;AAGO,IAAM,wBAAwB,CACnC,WACA,cACA,kBACW;AACX,QAAM,SAAS,UAAU;AACzB,MAAI,WAAW,EAAG,QAAO;AAEzB,MAAI,QAAQ;AACZ,MAAI,WAAW;AAEf,SAAO,WAAW,QAAQ;AACxB,aAAS;AACT,QAAI,SAAS,OAAQ,SAAQ;AAE7B,UAAM,WAAW,UAAU,KAAK;AAChC,QAAI,YAAY,CAAC,gBAAgB,SAAS,IAAI,aAAa,GAAG;AAC5D,aAAO;AAAA,IACT;AAEA;AAAA,EACF;AAEA,SAAO;AACT;AAeO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsC;AACpC,QAAM,aAAa,oBAAoB,UAAU;AACjD,QAAM,iBAAiB,YAAY,iBAAiB,CAAC;AACrD,QAAM,gBAAgB,aAAa,gBAAgB,WAAW,IAAI,UAAU,IAAI;AAG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AAC,YAAY,gBAAgB,eAAe,eAAe,CAAC;AAE/D,MAAI,WAAW,WAAW,GAAG;AAC3B,WACE,oBAAC,OAAI,eAAc,UACjB,8BAAC,QAAK,UAAQ,MAAC,uCAAyB,GAC1C;AAAA,EAEJ;AAEA,QAAM,kBAAkB,oBAAoB,IAAI,CAAC,UAAU,UAAU;AACnE,UAAM,WAAW,gBAAgB,SAAS,IAAI,UAAU;AAExD,WACE,oBAAC,OAAsB,KAAK,CAAC,OAAO,cAAc,OAAO,EAAE,GAAG,YAAY,GACxE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS,SAAS;AAAA,QAClB;AAAA,QACA,WAAW,UAAU;AAAA,QACrB,oBAAoB;AAAA,QACpB;AAAA;AAAA,IACF,KARQ,SAAS,EASnB;AAAA,EAEJ,CAAC;AAGD,MAAI,CAAC,eAAe;AAClB,WACE,oBAAC,OAAI,eAAc,UAAS,UAAU,GAAG,UAAS,UAC/C,2BACH;AAAA,EAEJ;AAEA,SACE,oBAAC,OAAI,eAAc,UAAS,QAAQ,iBAAiB,UAAS,UAC5D,8BAAC,OAAI,eAAc,UAAS,WAAW,cAAc,IAAI,CAAC,cAAc,GAAG,YAAY,GACpF,2BACH,GACF;AAEJ;","names":["useCallback","useEffect","sorted","useCallback","useEffect"]}
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-JMVWYAHT.js";
5
5
  import {
6
6
  CLI_COLORS
7
- } from "./chunk-LAPCUV4D.js";
7
+ } from "./chunk-YCS7GF6Y.js";
8
8
  import {
9
9
  init_esm_shims
10
10
  } from "./chunk-DHET7RCE.js";
@@ -92,4 +92,4 @@ var SearchModal = ({ results, alias, onBind, onClose }) => {
92
92
  export {
93
93
  SearchModal
94
94
  };
95
- //# sourceMappingURL=chunk-A27LOC4Z.js.map
95
+ //# sourceMappingURL=chunk-QC37C32G.js.map
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolveAlias
4
- } from "./chunk-MM7NK5N2.js";
4
+ } from "./chunk-TM4I4EHK.js";
5
5
  import {
6
6
  typedEntries,
7
7
  typedKeys
8
8
  } from "./chunk-T4EXUIBY.js";
9
9
  import {
10
10
  warn
11
- } from "./chunk-BZN2Z5P7.js";
11
+ } from "./chunk-NLR6Z37M.js";
12
12
  import {
13
13
  DEFAULT_PRESELECTED_SKILLS
14
- } from "./chunk-LAPCUV4D.js";
14
+ } from "./chunk-YCS7GF6Y.js";
15
15
  import {
16
16
  init_esm_shims
17
17
  } from "./chunk-DHET7RCE.js";
@@ -362,4 +362,4 @@ var useWizardStore = create((set, get) => ({
362
362
  export {
363
363
  useWizardStore
364
364
  };
365
- //# sourceMappingURL=chunk-3ZOIOVKT.js.map
365
+ //# sourceMappingURL=chunk-R3AD6XBJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/stores/wizard-store.ts"],"sourcesContent":["import { create } from \"zustand\";\nimport { DEFAULT_PRESELECTED_SKILLS } from \"../consts.js\";\nimport { resolveAlias } from \"../lib/matrix/index.js\";\nimport type {\n BoundSkill,\n Domain,\n DomainSelections,\n MergedSkillsMatrix,\n SkillAlias,\n SkillAssignment,\n SkillId,\n Subcategory,\n SubcategorySelections,\n} from \"../types/index.js\";\nimport { warn } from \"../utils/logger.js\";\nimport { typedEntries, typedKeys } from \"../utils/typed-object.js\";\n\nconst ALL_DOMAINS: Domain[] = [\"web\", \"web-extras\", \"api\", \"cli\", \"mobile\", \"shared\"];\n\nconst DEFAULT_SOURCE_ID = \"public\";\nconst DEFAULT_SOURCE_LABEL = \"Public\";\n\n/** Sort priority: local first, then public, then private/other */\nconst SOURCE_SORT_ORDER: Record<string, number> = {\n local: 0,\n public: 1,\n private: 2,\n};\n\nconst SOURCE_DISPLAY_NAMES: Record<string, string> = {\n public: \"Public\",\n local: \"Local\",\n};\n\nconst DEFAULT_SORT_PRIORITY = 3;\n\nfunction formatSourceLabel(source: {\n name: string;\n version?: string;\n installed?: boolean;\n}): string {\n const displayName = SOURCE_DISPLAY_NAMES[source.name] ?? source.name;\n const prefix = source.installed ? \"\\u2713 \" : \"\";\n const versionSuffix = source.version ? ` \\u00B7 v${source.version}` : \"\";\n return `${prefix}${displayName}${versionSuffix}`;\n}\n\ntype SkillLookupEntry = { category: string; displayName?: string };\n\nfunction resolveSkillForPopulation(\n skillId: SkillId,\n skills: Partial<Record<SkillId, SkillLookupEntry>>,\n categories: Partial<Record<Subcategory, { domain?: Domain }>>,\n): { domain: Domain; subcat: Subcategory; techId: SkillId } | null {\n const skill = skills[skillId];\n if (!skill?.category || !skill.displayName) {\n warn(\n `Installed skill '${skillId}' is missing from the marketplace — it may have been removed or renamed`,\n );\n return null;\n }\n\n // Boundary cast: category is a Subcategory at the data boundary\n const subcat = skill.category as Subcategory;\n const domain = categories[subcat]?.domain;\n if (!domain) {\n warn(`Installed skill '${skillId}' has unknown category '${skill.category}' — skipping`);\n return null;\n }\n\n // Boundary cast: display name resolved to SkillId downstream by resolveAlias\n return { domain, subcat, techId: skill.displayName as SkillId };\n}\n\nfunction buildBoundSkillOptions(\n boundSkills: BoundSkill[],\n alias: SkillAlias,\n selectedSource: string,\n): { id: string; label: string; selected: boolean; installed: boolean }[] {\n return boundSkills\n .filter((b) => b.boundTo === alias)\n .map((bound) => ({\n id: bound.sourceName,\n label: formatSourceLabel({\n name: bound.sourceName,\n installed: false,\n }),\n selected: selectedSource === bound.sourceName,\n installed: false,\n }));\n}\n\n/** Extract the alias from a skill ID or use displayName from the matrix */\nfunction getSkillAlias(skillId: SkillId, matrix: MergedSkillsMatrix): SkillAlias {\n const displayName = matrix.displayNames?.[skillId];\n if (displayName) return displayName;\n // Fallback: use the last segment of the skill ID (e.g., \"web-framework-react\" -> \"react\")\n const segments = skillId.split(\"-\");\n const fallback = segments[segments.length - 1] || skillId;\n warn(`No display name found for skill '${skillId}', using fallback alias '${fallback}'`);\n return fallback;\n}\n\n/**\n * Wizard step identifiers for the multi-step init/edit flow.\n *\n * Progression: stack -> build -> sources -> confirm\n * The \"stack\" step shows all stacks + \"Start from scratch\" in a unified list.\n * Navigation is tracked via the `history` stack for goBack() support.\n */\nexport type WizardStep =\n | \"stack\" // Unified first step: select stack or \"Start from scratch\", then domain selection\n | \"build\" // CategoryGrid for technology selection\n | \"sources\" // Choose skill sources (recommended vs custom)\n | \"confirm\"; // Final confirmation\n\n/**\n * Wizard store state and actions.\n *\n * The store uses a composition pattern: small, focused actions that each mutate\n * one or two state fields. Wizard step components compose these actions to build\n * up the full selection state incrementally (domains -> subcategories -> skills -> sources).\n *\n * State flow: unified stack/scratch selection -> domain selection -> per-domain skill\n * selection (build step) -> source customization -> confirmation.\n */\nexport type WizardState = {\n step: WizardStep;\n\n approach: \"stack\" | \"scratch\" | null;\n selectedStackId: string | null;\n stackAction: \"defaults\" | \"customize\" | null;\n\n selectedDomains: Domain[];\n\n currentDomainIndex: number;\n domainSelections: DomainSelections;\n\n showDescriptions: boolean;\n expertMode: boolean;\n\n installMode: \"plugin\" | \"local\";\n\n sourceSelections: Partial<Record<SkillId, string>>;\n customizeSources: boolean;\n\n showSettings: boolean;\n showHelp: boolean;\n enabledSources: Record<string, boolean>;\n\n boundSkills: BoundSkill[];\n\n history: WizardStep[];\n\n /**\n * Navigate to a wizard step, pushing the current step onto history.\n * @param step - Target step to navigate to\n *\n * Side effects: sets `step`, appends previous step to `history`\n */\n setStep: (step: WizardStep) => void;\n /**\n * Set the wizard approach (stack-based or build-from-scratch).\n * @param approach - \"stack\" to use a pre-built template, \"scratch\" to select skills manually, null to reset\n *\n * Side effects: sets `approach`\n */\n setApproach: (approach: \"stack\" | \"scratch\" | null) => void;\n /**\n * Select a stack by ID, or null to deselect.\n * @param stackId - Stack identifier from suggestedStacks, or null to clear\n *\n * Side effects: sets `selectedStackId`\n */\n selectStack: (stackId: string | null) => void;\n /**\n * Set how to apply the selected stack.\n * @param action - \"defaults\" to use stack as-is, \"customize\" to enter the build step\n *\n * Side effects: sets `stackAction`\n */\n setStackAction: (action: \"defaults\" | \"customize\") => void;\n /**\n * Pre-populate domainSelections from a stack's agent-to-skill mappings.\n *\n * Iterates all agents in the stack, resolving each subcategory's skill assignments\n * to the appropriate domain. Enables all domains and deduplicates skill IDs.\n *\n * @param stack - Stack definition with agent-level skill assignments\n * @param stack.agents - Record of agent name to `{ subcategory: SkillAssignment[] }` mappings\n * @param categories - Category definitions used to resolve subcategory -> domain mapping\n *\n * Side effects: sets `domainSelections`, sets `selectedDomains` to ALL_DOMAINS\n */\n populateFromStack: (\n stack: { agents: Record<string, Partial<Record<Subcategory, SkillAssignment[]>>> },\n categories: Partial<Record<Subcategory, { domain?: Domain }>>,\n ) => void;\n /**\n * Pre-populate domainSelections from a flat list of installed skill IDs.\n *\n * Used by `agentsinc edit` to restore wizard state from existing project config.\n * Looks up each skill's category and domain, warns for unresolvable skills.\n *\n * @param skillIds - Flat array of currently installed skill IDs\n * @param skills - Skill lookup providing category and displayName per skill ID\n * @param categories - Category definitions used to resolve subcategory -> domain mapping\n *\n * Side effects: sets `domainSelections`, sets `selectedDomains` to ALL_DOMAINS\n */\n populateFromSkillIds: (\n skillIds: SkillId[],\n skills: Partial<Record<SkillId, { category: string; displayName?: string }>>,\n categories: Partial<Record<Subcategory, { domain?: Domain }>>,\n ) => void;\n /**\n * Toggle a domain on or off in the selectedDomains list.\n * @param domain - Domain to toggle\n *\n * Side effects: adds or removes from `selectedDomains`\n */\n toggleDomain: (domain: Domain) => void;\n /**\n * Toggle a skill selection within a domain's subcategory.\n *\n * When exclusive is true (radio behavior), selecting a new skill replaces any\n * existing selection in that subcategory. When false (checkbox behavior),\n * the skill is added to or removed from the selection array.\n *\n * @param domain - Domain containing the subcategory\n * @param subcategory - Subcategory within the domain\n * @param technology - Skill ID to toggle\n * @param exclusive - If true, only one skill can be selected per subcategory (radio)\n *\n * Side effects: updates `domainSelections[domain][subcategory]`\n */\n toggleTechnology: (\n domain: Domain,\n subcategory: Subcategory,\n technology: SkillId,\n exclusive: boolean,\n ) => void;\n /**\n * Advance to the next domain in the build step.\n * @returns true if advanced, false if already at the last domain\n *\n * Side effects: increments `currentDomainIndex`\n */\n nextDomain: () => boolean;\n /**\n * Go back to the previous domain in the build step.\n * @returns true if moved back, false if already at the first domain\n *\n * Side effects: decrements `currentDomainIndex`\n */\n prevDomain: () => boolean;\n /** Toggle skill description visibility in the build step grid. */\n toggleShowDescriptions: () => void;\n /** Toggle expert mode (shows advanced/niche skills in the build step). */\n toggleExpertMode: () => void;\n /** Toggle between \"plugin\" and \"local\" install modes. */\n toggleInstallMode: () => void;\n /**\n * Set which source provides a specific skill.\n * @param skillId - Skill to configure the source for\n * @param sourceId - Source identifier (e.g., \"public\", \"local\", marketplace name)\n *\n * Side effects: updates `sourceSelections[skillId]`. No-op with warning if either param is empty.\n */\n setSourceSelection: (skillId: SkillId, sourceId: string) => void;\n /**\n * Enable or disable source customization on the sources step.\n * @param customize - true to show per-skill source pickers\n *\n * Side effects: sets `customizeSources`\n */\n setCustomizeSources: (customize: boolean) => void;\n /** Toggle the settings overlay (source management). */\n toggleSettings: () => void;\n /** Toggle the help overlay (hotkey reference). */\n toggleHelp: () => void;\n /**\n * Replace the full set of enabled/disabled sources.\n * @param sources - Record of source name to enabled boolean. Empty-string keys are filtered out.\n *\n * Side effects: sets `enabledSources`\n */\n setEnabledSources: (sources: Record<string, boolean>) => void;\n /**\n * Add a bound skill from search to the wizard's bound skills list.\n * Duplicates (same id + sourceUrl) are silently skipped with a warning.\n *\n * @param skill - Bound skill to add (foreign skill tied to a subcategory alias)\n *\n * Side effects: appends to `boundSkills`\n */\n bindSkill: (skill: BoundSkill) => void;\n /**\n * Navigate to the previous wizard step using the history stack.\n * Falls back to \"stack\" if history is empty.\n *\n * Side effects: pops from `history`, sets `step` to the popped value\n */\n goBack: () => void;\n /** Reset all wizard state to initial values. */\n reset: () => void;\n\n /**\n * Collect all selected skill IDs across all domains and subcategories.\n * @returns Flat array of every selected SkillId (may contain duplicates if shared across domains)\n */\n getAllSelectedTechnologies: () => SkillId[];\n /**\n * Group selected skill IDs by domain.\n * @returns Partial record mapping each domain with selections to its skill ID array\n */\n getSelectedTechnologiesPerDomain: () => Partial<Record<Domain, SkillId[]>>;\n /**\n * Get the domain currently visible in the build step.\n * @returns The domain at currentDomainIndex, or null if no domains are selected\n */\n getCurrentDomain: () => Domain | null;\n /** Returns the foundational methodology skills that are always preselected (DEFAULT_PRESELECTED_SKILLS). */\n getDefaultMethodologySkills: () => SkillId[];\n /**\n * Count total selected technologies across all domains.\n * @returns Number of selected skill IDs\n */\n getTechnologyCount: () => number;\n /**\n * Compute which wizard steps are completed and which are skipped.\n * Used by WizardTabs to render step progress indicators.\n * @returns Object with completedSteps and skippedSteps string arrays\n */\n getStepProgress: () => { completedSteps: WizardStep[]; skippedSteps: WizardStep[] };\n /** @returns true if there is a next domain after the current one */\n canGoToNextDomain: () => boolean;\n /** @returns true if there is a previous domain before the current one */\n canGoToPreviousDomain: () => boolean;\n /**\n * Find the parent domain for a sub-domain (e.g., web-extras -> web).\n * @param domain - Domain to look up\n * @param matrix - Merged skills matrix containing category definitions with parent_domain\n * @returns The parent domain, or undefined if the domain has no parent\n */\n getParentDomain: (domain: Domain, matrix: MergedSkillsMatrix) => Domain | undefined;\n /**\n * Get the current selections of a domain's parent domain.\n * Used for framework-first filtering: web-extras inherits web's framework selections.\n *\n * @param domain - Sub-domain to find parent selections for\n * @param matrix - Merged skills matrix containing category definitions\n * @returns The parent domain's SubcategorySelections, or undefined if no parent\n */\n getParentDomainSelections: (\n domain: Domain,\n matrix: MergedSkillsMatrix,\n ) => SubcategorySelections | undefined;\n /**\n * Build the source selection rows for the sources step UI.\n *\n * For each selected technology, resolves the canonical skill ID, looks up available\n * sources from the matrix, merges in any bound skills from search, and determines\n * which source is currently selected. Sources are sorted: local first, then public,\n * then private/other.\n *\n * @param matrix - Merged skills matrix with resolved skills and their available sources\n * @returns Array of row objects, one per selected technology, each containing:\n * - `skillId` - Canonical resolved skill ID\n * - `displayName` - Human-readable skill alias\n * - `alias` - Same as displayName (for backward compatibility)\n * - `options` - Available sources with selection state and install status\n */\n buildSourceRows: (matrix: MergedSkillsMatrix) => {\n skillId: SkillId;\n displayName: SkillAlias;\n alias: SkillAlias;\n options: { id: string; label: string; selected: boolean; installed: boolean }[];\n }[];\n};\n\nconst createInitialState = () => ({\n step: \"stack\" as WizardStep,\n approach: null as \"stack\" | \"scratch\" | null,\n selectedStackId: null as string | null,\n stackAction: null as \"defaults\" | \"customize\" | null,\n selectedDomains: [] as Domain[],\n currentDomainIndex: 0,\n domainSelections: {} as DomainSelections,\n showDescriptions: false,\n expertMode: false,\n installMode: \"local\" as \"plugin\" | \"local\",\n sourceSelections: {} as Partial<Record<SkillId, string>>,\n customizeSources: false,\n showSettings: false,\n showHelp: false,\n enabledSources: {} as Record<string, boolean>,\n boundSkills: [] as BoundSkill[],\n history: [] as WizardStep[],\n});\n\nexport const useWizardStore = create<WizardState>((set, get) => ({\n ...createInitialState(),\n\n setStep: (step) =>\n set((state) => ({\n step,\n history: [...state.history, state.step],\n })),\n\n setApproach: (approach) => set({ approach }),\n\n selectStack: (stackId) => set({ selectedStackId: stackId }),\n\n setStackAction: (action) => set({ stackAction: action }),\n\n populateFromStack: (stack, categories) =>\n set(() => {\n const domainSelections: DomainSelections = {};\n const domains = new Set<Domain>();\n\n for (const agentConfig of Object.values(stack.agents)) {\n for (const [subcat, assignments] of typedEntries<Subcategory, SkillAssignment[]>(\n agentConfig,\n )) {\n const category = categories[subcat];\n const domain = category?.domain;\n\n if (!domain || !assignments) {\n continue;\n }\n\n domains.add(domain);\n\n if (!domainSelections[domain]) {\n domainSelections[domain] = {};\n }\n\n if (!domainSelections[domain][subcat]) {\n domainSelections[domain][subcat] = [];\n }\n\n for (const assignment of assignments) {\n if (!domainSelections[domain][subcat].includes(assignment.id)) {\n domainSelections[domain][subcat].push(assignment.id);\n }\n }\n }\n }\n\n return {\n domainSelections,\n selectedDomains: ALL_DOMAINS,\n };\n }),\n\n populateFromSkillIds: (skillIds, skills, categories) =>\n set(() => {\n const domainSelections: DomainSelections = {};\n let skippedCount = 0;\n\n for (const skillId of skillIds) {\n const resolved = resolveSkillForPopulation(skillId, skills, categories);\n if (!resolved) {\n skippedCount++;\n continue;\n }\n\n const { domain, subcat, techId } = resolved;\n if (!domainSelections[domain]) domainSelections[domain] = {};\n if (!domainSelections[domain][subcat]) domainSelections[domain][subcat] = [];\n\n if (!domainSelections[domain][subcat].includes(techId)) {\n domainSelections[domain][subcat].push(techId);\n }\n }\n\n if (skippedCount > 0) {\n warn(`${skippedCount} installed skill(s) could not be resolved and were skipped`);\n }\n\n return { domainSelections, selectedDomains: ALL_DOMAINS };\n }),\n\n toggleDomain: (domain) =>\n set((state) => {\n const isSelected = state.selectedDomains.includes(domain);\n return {\n selectedDomains: isSelected\n ? state.selectedDomains.filter((d) => d !== domain)\n : [...state.selectedDomains, domain],\n };\n }),\n\n toggleTechnology: (domain, subcategory, technology, exclusive) =>\n set((state) => {\n const currentSelections = state.domainSelections[domain]?.[subcategory] || [];\n const isSelected = currentSelections.includes(technology);\n\n let newSelections: SkillId[];\n if (exclusive) {\n newSelections = isSelected ? [] : [technology];\n } else {\n newSelections = isSelected\n ? currentSelections.filter((t) => t !== technology)\n : [...currentSelections, technology];\n }\n\n return {\n domainSelections: {\n ...state.domainSelections,\n [domain]: {\n ...state.domainSelections[domain],\n [subcategory]: newSelections,\n },\n },\n };\n }),\n\n nextDomain: () => {\n const state = get();\n if (state.currentDomainIndex < state.selectedDomains.length - 1) {\n set({\n currentDomainIndex: state.currentDomainIndex + 1,\n });\n return true;\n }\n return false;\n },\n\n prevDomain: () => {\n const state = get();\n if (state.currentDomainIndex > 0) {\n set({\n currentDomainIndex: state.currentDomainIndex - 1,\n });\n return true;\n }\n return false;\n },\n\n toggleShowDescriptions: () => set((state) => ({ showDescriptions: !state.showDescriptions })),\n\n toggleExpertMode: () => set((state) => ({ expertMode: !state.expertMode })),\n\n toggleInstallMode: () =>\n set((state) => ({\n installMode: state.installMode === \"plugin\" ? \"local\" : \"plugin\",\n })),\n\n setSourceSelection: (skillId, sourceId) =>\n set((state) => {\n if (!skillId) {\n warn(\"Ignoring setSourceSelection call with empty skillId\");\n return state;\n }\n if (!sourceId) {\n warn(`Ignoring setSourceSelection call with empty sourceId for skill '${skillId}'`);\n return state;\n }\n return {\n sourceSelections: { ...state.sourceSelections, [skillId]: sourceId },\n };\n }),\n\n setCustomizeSources: (customize) => set({ customizeSources: customize }),\n\n toggleSettings: () => set((state) => ({ showSettings: !state.showSettings })),\n\n toggleHelp: () => set((state) => ({ showHelp: !state.showHelp })),\n\n setEnabledSources: (sources) => {\n const invalidKeys = Object.keys(sources).filter((key) => !key.trim());\n if (invalidKeys.length > 0) {\n warn(\"Ignoring setEnabledSources call with empty source name(s)\");\n }\n const validSources = Object.fromEntries(Object.entries(sources).filter(([key]) => key.trim()));\n return set({ enabledSources: validSources });\n },\n\n bindSkill: (skill) =>\n set((state) => {\n const exists = state.boundSkills.some(\n (b) => b.id === skill.id && b.sourceUrl === skill.sourceUrl,\n );\n if (exists) {\n warn(`Skill '${skill.id}' from '${skill.sourceUrl}' is already bound — skipping duplicate`);\n return state;\n }\n return { boundSkills: [...state.boundSkills, skill] };\n }),\n\n goBack: () =>\n set((state) => {\n const history = [...state.history];\n const previousStep = history.pop();\n return {\n step: previousStep || \"stack\",\n history,\n };\n }),\n\n reset: () => set(createInitialState()),\n\n getAllSelectedTechnologies: () => {\n const state = get();\n const technologies: SkillId[] = [];\n for (const domain of typedKeys<Domain>(state.domainSelections)) {\n const domainSel = state.domainSelections[domain];\n if (!domainSel) continue;\n for (const subcategory of typedKeys<Subcategory>(domainSel)) {\n const techs = domainSel[subcategory];\n if (techs) technologies.push(...techs);\n }\n }\n return technologies;\n },\n\n getSelectedTechnologiesPerDomain: () => {\n const state = get();\n const result: Partial<Record<Domain, SkillId[]>> = {};\n for (const domain of typedKeys<Domain>(state.domainSelections)) {\n const domainSel = state.domainSelections[domain];\n if (!domainSel) continue;\n const techs: SkillId[] = [];\n for (const subcategory of typedKeys<Subcategory>(domainSel)) {\n const subTechs = domainSel[subcategory];\n if (subTechs) techs.push(...subTechs);\n }\n if (techs.length > 0) {\n result[domain] = techs;\n }\n }\n return result;\n },\n\n getCurrentDomain: () => {\n const state = get();\n return state.selectedDomains[state.currentDomainIndex] || null;\n },\n\n getDefaultMethodologySkills: () => {\n return [...DEFAULT_PRESELECTED_SKILLS];\n },\n\n getTechnologyCount: () => {\n return get().getAllSelectedTechnologies().length;\n },\n\n getStepProgress: () => {\n const state = get();\n const completed: WizardStep[] = [];\n const skipped: WizardStep[] = [];\n\n if (state.step !== \"stack\") {\n completed.push(\"stack\");\n }\n\n if (state.approach === \"stack\" && state.selectedStackId && state.stackAction === \"defaults\") {\n skipped.push(\"build\");\n skipped.push(\"sources\");\n } else if (state.step === \"confirm\") {\n completed.push(\"build\");\n completed.push(\"sources\");\n } else if (state.step === \"sources\") {\n completed.push(\"build\");\n }\n\n return { completedSteps: completed, skippedSteps: skipped };\n },\n\n canGoToNextDomain: () => {\n const state = get();\n return state.currentDomainIndex < state.selectedDomains.length - 1;\n },\n\n canGoToPreviousDomain: () => {\n const state = get();\n return state.currentDomainIndex > 0;\n },\n\n getParentDomain: (domain, matrix) => {\n const cat = Object.values(matrix.categories).find(\n (c) => c.domain === domain && c.parent_domain,\n );\n return cat?.parent_domain;\n },\n\n getParentDomainSelections: (domain, matrix) => {\n const state = get();\n const parentDomain = state.getParentDomain(domain, matrix);\n if (!parentDomain) return undefined;\n return state.domainSelections[parentDomain];\n },\n\n buildSourceRows: (matrix) => {\n const state = get();\n const selectedTechnologies = get().getAllSelectedTechnologies();\n const { sourceSelections, boundSkills } = state;\n\n return selectedTechnologies.map((tech) => {\n const skillId = resolveAlias(tech, matrix);\n const skill = matrix.skills[skillId];\n const selectedSource =\n sourceSelections[skillId] || skill?.activeSource?.name || DEFAULT_SOURCE_ID;\n const alias = getSkillAlias(skillId, matrix);\n\n const sortedSources = [...(skill?.availableSources || [])].sort(\n (a, b) =>\n (SOURCE_SORT_ORDER[a.type] ?? DEFAULT_SORT_PRIORITY) -\n (SOURCE_SORT_ORDER[b.type] ?? DEFAULT_SORT_PRIORITY),\n );\n\n const options =\n sortedSources.length > 0\n ? sortedSources.map((source) => ({\n id: source.name,\n label: formatSourceLabel({\n name: source.name,\n version: source.version,\n installed: source.installed,\n }),\n selected: selectedSource === source.name,\n installed: source.installed,\n }))\n : [\n {\n id: DEFAULT_SOURCE_ID,\n label: DEFAULT_SOURCE_LABEL,\n selected: selectedSource === DEFAULT_SOURCE_ID,\n installed: false,\n },\n ];\n\n options.push(...buildBoundSkillOptions(boundSkills, alias, selectedSource));\n\n return { skillId, displayName: alias, alias, options };\n });\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,cAAc;AAiBvB,IAAM,cAAwB,CAAC,OAAO,cAAc,OAAO,OAAO,UAAU,QAAQ;AAEpF,IAAM,oBAAoB;AAC1B,IAAM,uBAAuB;AAG7B,IAAM,oBAA4C;AAAA,EAChD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AACX;AAEA,IAAM,uBAA+C;AAAA,EACnD,QAAQ;AAAA,EACR,OAAO;AACT;AAEA,IAAM,wBAAwB;AAE9B,SAAS,kBAAkB,QAIhB;AACT,QAAM,cAAc,qBAAqB,OAAO,IAAI,KAAK,OAAO;AAChE,QAAM,SAAS,OAAO,YAAY,YAAY;AAC9C,QAAM,gBAAgB,OAAO,UAAU,UAAY,OAAO,OAAO,KAAK;AACtE,SAAO,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa;AAChD;AAIA,SAAS,0BACP,SACA,QACA,YACiE;AACjE,QAAM,QAAQ,OAAO,OAAO;AAC5B,MAAI,CAAC,OAAO,YAAY,CAAC,MAAM,aAAa;AAC1C;AAAA,MACE,oBAAoB,OAAO;AAAA,IAC7B;AACA,WAAO;AAAA,EACT;AAGA,QAAM,SAAS,MAAM;AACrB,QA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