iskills 0.2.41 → 0.2.46

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 (179) hide show
  1. package/README.md +124 -26
  2. package/README.zh-CN.md +146 -0
  3. package/bin/iskills.js +85 -3
  4. package/bin/opentui-register.mjs +10 -0
  5. package/bin/opentui-resolve-hook.mjs +12 -0
  6. package/bin/patch-react-reconciler.mjs +71 -0
  7. package/dist/src/cli.js +22 -9
  8. package/dist/src/cli.js.map +1 -1
  9. package/dist/src/commands/browser-actions.js +76 -65
  10. package/dist/src/commands/browser-actions.js.map +1 -1
  11. package/dist/src/commands/config.d.ts +5 -0
  12. package/dist/src/commands/config.js +22 -0
  13. package/dist/src/commands/config.js.map +1 -0
  14. package/dist/src/commands/create.d.ts +1 -0
  15. package/dist/src/commands/create.js +37 -0
  16. package/dist/src/commands/create.js.map +1 -0
  17. package/dist/src/commands/index.d.ts +2 -0
  18. package/dist/src/commands/index.js +30 -70
  19. package/dist/src/commands/index.js.map +1 -1
  20. package/dist/src/commands/library.js +59 -67
  21. package/dist/src/commands/library.js.map +1 -1
  22. package/dist/src/commands/search.js +15 -10
  23. package/dist/src/commands/search.js.map +1 -1
  24. package/dist/src/domain/collection-write.d.ts +2 -0
  25. package/dist/src/domain/collection-write.js +83 -33
  26. package/dist/src/domain/collection-write.js.map +1 -1
  27. package/dist/src/domain/core.d.ts +29 -1
  28. package/dist/src/domain/core.js +134 -12
  29. package/dist/src/domain/core.js.map +1 -1
  30. package/dist/src/domain/git.js +15 -14
  31. package/dist/src/domain/git.js.map +1 -1
  32. package/dist/src/domain/types.d.ts +2 -0
  33. package/dist/src/domain/user-config.d.ts +12 -0
  34. package/dist/src/domain/user-config.js +55 -0
  35. package/dist/src/domain/user-config.js.map +1 -0
  36. package/dist/src/i18n/en.d.ts +5 -0
  37. package/dist/src/i18n/en.js +419 -0
  38. package/dist/src/i18n/en.js.map +1 -0
  39. package/dist/src/i18n/index.d.ts +47 -0
  40. package/dist/src/i18n/index.js +129 -0
  41. package/dist/src/i18n/index.js.map +1 -0
  42. package/dist/src/i18n/zh.d.ts +404 -0
  43. package/dist/src/i18n/zh.js +419 -0
  44. package/dist/src/i18n/zh.js.map +1 -0
  45. package/dist/src/ui/browser/browser.d.ts +2 -1
  46. package/dist/src/ui/browser/browser.js +295 -77
  47. package/dist/src/ui/browser/browser.js.map +1 -1
  48. package/dist/src/ui/browser/detail.d.ts +1 -1
  49. package/dist/src/ui/browser/detail.js +4 -3
  50. package/dist/src/ui/browser/detail.js.map +1 -1
  51. package/dist/src/ui/browser/footer.js +20 -3
  52. package/dist/src/ui/browser/footer.js.map +1 -1
  53. package/dist/src/ui/browser/format.d.ts +21 -9
  54. package/dist/src/ui/browser/format.js +99 -73
  55. package/dist/src/ui/browser/format.js.map +1 -1
  56. package/dist/src/ui/browser/index.js +11 -10
  57. package/dist/src/ui/browser/index.js.map +1 -1
  58. package/dist/src/ui/browser/layout.d.ts +1 -1
  59. package/dist/src/ui/browser/layout.js +1 -1
  60. package/dist/src/ui/browser/shortcut-help.d.ts +2 -0
  61. package/dist/src/ui/browser/shortcut-help.js +34 -13
  62. package/dist/src/ui/browser/shortcut-help.js.map +1 -1
  63. package/dist/src/ui/browser/types.d.ts +14 -5
  64. package/dist/src/ui/collection-match.d.ts +1 -1
  65. package/dist/src/ui/collection-match.js +9 -6
  66. package/dist/src/ui/collection-match.js.map +1 -1
  67. package/dist/src/ui/components/colors.d.ts +55 -5
  68. package/dist/src/ui/components/colors.js +58 -6
  69. package/dist/src/ui/components/colors.js.map +1 -1
  70. package/dist/src/ui/components/confirm.js +2 -2
  71. package/dist/src/ui/components/confirm.js.map +1 -1
  72. package/dist/src/ui/components/framed-panel.d.ts +3 -3
  73. package/dist/src/ui/components/framed-panel.js +30 -11
  74. package/dist/src/ui/components/framed-panel.js.map +1 -1
  75. package/dist/src/ui/components/link.js +13 -8
  76. package/dist/src/ui/components/link.js.map +1 -1
  77. package/dist/src/ui/components/modal-panel.d.ts +12 -0
  78. package/dist/src/ui/components/modal-panel.js +14 -0
  79. package/dist/src/ui/components/modal-panel.js.map +1 -0
  80. package/dist/src/ui/components/modal.js +3 -3
  81. package/dist/src/ui/components/modal.js.map +1 -1
  82. package/dist/src/ui/components/mouse/bounds.d.ts +1 -6
  83. package/dist/src/ui/components/mouse/bounds.js +1 -22
  84. package/dist/src/ui/components/mouse/bounds.js.map +1 -1
  85. package/dist/src/ui/components/mouse/clickable.d.ts +6 -4
  86. package/dist/src/ui/components/mouse/clickable.js +26 -10
  87. package/dist/src/ui/components/mouse/clickable.js.map +1 -1
  88. package/dist/src/ui/components/mouse/index.d.ts +2 -2
  89. package/dist/src/ui/components/mouse/index.js +2 -2
  90. package/dist/src/ui/components/mouse/index.js.map +1 -1
  91. package/dist/src/ui/components/mouse/parse.d.ts +1 -1
  92. package/dist/src/ui/components/mouse/parse.js +3 -3
  93. package/dist/src/ui/components/mouse/parse.js.map +1 -1
  94. package/dist/src/ui/components/mouse/provider.d.ts +17 -15
  95. package/dist/src/ui/components/mouse/provider.js +29 -85
  96. package/dist/src/ui/components/mouse/provider.js.map +1 -1
  97. package/dist/src/ui/components/multi-select.js +24 -7
  98. package/dist/src/ui/components/multi-select.js.map +1 -1
  99. package/dist/src/ui/components/options.d.ts +2 -1
  100. package/dist/src/ui/components/options.js +2 -1
  101. package/dist/src/ui/components/options.js.map +1 -1
  102. package/dist/src/ui/components/select.d.ts +4 -0
  103. package/dist/src/ui/components/select.js +32 -34
  104. package/dist/src/ui/components/select.js.map +1 -1
  105. package/dist/src/ui/components/spinner.d.ts +16 -0
  106. package/dist/src/ui/components/spinner.js +45 -0
  107. package/dist/src/ui/components/spinner.js.map +1 -0
  108. package/dist/src/ui/components/tabs.js +10 -6
  109. package/dist/src/ui/components/tabs.js.map +1 -1
  110. package/dist/src/ui/components/tag-editor.d.ts +1 -2
  111. package/dist/src/ui/components/tag-editor.js +12 -7
  112. package/dist/src/ui/components/tag-editor.js.map +1 -1
  113. package/dist/src/ui/components/termcn.d.ts +3 -1
  114. package/dist/src/ui/components/termcn.js +5 -3
  115. package/dist/src/ui/components/termcn.js.map +1 -1
  116. package/dist/src/ui/components/text-input.d.ts +4 -0
  117. package/dist/src/ui/components/text-input.js +29 -69
  118. package/dist/src/ui/components/text-input.js.map +1 -1
  119. package/dist/src/ui/components/use-input.d.ts +21 -7
  120. package/dist/src/ui/components/use-input.js +61 -9
  121. package/dist/src/ui/components/use-input.js.map +1 -1
  122. package/dist/src/ui/config/index.d.ts +11 -0
  123. package/dist/src/ui/config/index.js +22 -0
  124. package/dist/src/ui/config/index.js.map +1 -0
  125. package/dist/src/ui/config/settings.d.ts +17 -0
  126. package/dist/src/ui/config/settings.js +126 -0
  127. package/dist/src/ui/config/settings.js.map +1 -0
  128. package/dist/src/ui/footer/resolve-footer.js +48 -35
  129. package/dist/src/ui/footer/resolve-footer.js.map +1 -1
  130. package/dist/src/ui/footer/types.d.ts +6 -2
  131. package/dist/src/ui/import/review.js +16 -9
  132. package/dist/src/ui/import/review.js.map +1 -1
  133. package/dist/src/ui/import/skill-select.js +48 -16
  134. package/dist/src/ui/import/skill-select.js.map +1 -1
  135. package/dist/src/ui/import/types.d.ts +1 -1
  136. package/dist/src/ui/install/review.js +22 -16
  137. package/dist/src/ui/install/review.js.map +1 -1
  138. package/dist/src/ui/install/types.d.ts +4 -6
  139. package/dist/src/ui/install/types.js +1 -1
  140. package/dist/src/ui/overlay/bridge.js +4 -0
  141. package/dist/src/ui/overlay/bridge.js.map +1 -1
  142. package/dist/src/ui/overlay/dialogs.js +1 -1
  143. package/dist/src/ui/overlay/host.js +4 -4
  144. package/dist/src/ui/overlay/host.js.map +1 -1
  145. package/dist/src/ui/prompts/present.d.ts +5 -3
  146. package/dist/src/ui/prompts/present.js +10 -7
  147. package/dist/src/ui/prompts/present.js.map +1 -1
  148. package/dist/src/ui/search/index.js +11 -9
  149. package/dist/src/ui/search/index.js.map +1 -1
  150. package/dist/src/ui/shell/app-shell.d.ts +1 -1
  151. package/dist/src/ui/shell/app-shell.js +4 -6
  152. package/dist/src/ui/shell/app-shell.js.map +1 -1
  153. package/dist/src/ui/shell/footer.js +5 -8
  154. package/dist/src/ui/shell/footer.js.map +1 -1
  155. package/dist/src/ui/shell/lifecycle.d.ts +12 -0
  156. package/dist/src/ui/shell/lifecycle.js +30 -0
  157. package/dist/src/ui/shell/lifecycle.js.map +1 -0
  158. package/dist/src/ui/shell/run.d.ts +35 -10
  159. package/dist/src/ui/shell/run.js +175 -88
  160. package/dist/src/ui/shell/run.js.map +1 -1
  161. package/dist/src/ui/shell/terminal.d.ts +0 -1
  162. package/dist/src/ui/shell/terminal.js +3 -2
  163. package/dist/src/ui/shell/terminal.js.map +1 -1
  164. package/dist/src/ui/skill-labels.d.ts +9 -9
  165. package/dist/src/ui/skill-labels.js +13 -10
  166. package/dist/src/ui/skill-labels.js.map +1 -1
  167. package/dist/src/ui/tui/hooks.d.ts +45 -0
  168. package/dist/src/ui/tui/hooks.js +79 -0
  169. package/dist/src/ui/tui/hooks.js.map +1 -0
  170. package/dist/src/ui/tui/index.d.ts +2 -0
  171. package/dist/src/ui/tui/index.js +3 -0
  172. package/dist/src/ui/tui/index.js.map +1 -0
  173. package/dist/src/ui/tui/primitives.d.ts +12 -0
  174. package/dist/src/ui/tui/primitives.js +56 -0
  175. package/dist/src/ui/tui/primitives.js.map +1 -0
  176. package/dist/src/util/open-path.d.ts +2 -0
  177. package/dist/src/util/open-path.js +27 -0
  178. package/dist/src/util/open-path.js.map +1 -0
  179. package/package.json +11 -7
@@ -1,28 +1,30 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text, useStdout } from 'ink';
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ import { Text, useStdout } from '../tui/index.js';
3
3
  import { useInput } from '../components/use-input.js';
4
4
  import { useAtom, useAtomValue, useStore } from 'jotai';
5
- import { useEffect, useMemo, useRef, useState } from 'react';
5
+ import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
6
6
  import { browserFilterAtom, browserGroupJumpAtom, browserNavigationAtom, browserSelectionAtom, browserUpdateCheckAtom, } from './store.js';
7
7
  import { browserFrameDimensions, masterDetailLayout, masterDetailSeparator, masterDetailViewportHeight, masterDetailWidths, } from './layout.js';
8
- import { TAG_FILTER_ALL, browseDetailRows, collectionCategoryLines, collectionListColumnLines, DETAIL_LABEL_WIDTH, flatRows, focusAfterDownFromAgents, focusAfterDownFromTabs, focusAfterUpFromList, focusAfterUpFromTags, groupedRows, listSkillSummary, moreActionModalContent, nextAgent, nextMainTab, selectableSkills, skillsForTagFilter, tagFilterOptions, visibleAgentGroups, } from './format.js';
8
+ import { TAG_FILTER_ALL, browseDetailRows, collectionCategoryLines, collectionListColumnLines, detailEditableFields, detailLabelWidth, flatRows, focusAfterDownFromAgents, focusAfterDownFromTabs, focusAfterUpFromList, focusAfterUpFromTags, groupedRows, listSkillSummary, moreActionModalContent, nextAgent, nextMainTab, selectableSkills, skillsForTagFilter, tagFilterOptions, visibleAgentGroups, } from './format.js';
9
+ import { t } from '../../i18n/index.js';
9
10
  import { useModal, useOverlayBusy } from '../overlay/host.js';
10
11
  import { FramedPanel } from '../components/framed-panel.js';
11
- import { Select, Tabs, termcnColors, } from '../components/termcn.js';
12
+ import { Select, Tabs, termcnColors, WorkingSpinner, useSpinnerFrame, } from '../components/termcn.js';
13
+ import { Clickable } from '../components/mouse/clickable.js';
12
14
  import { padColumns, sliceColumns } from '../components/terminal-layout.js';
13
15
  import { ShortcutHelpPanel } from './shortcut-help.js';
14
16
  /** Framed more-actions panel for absolute modal overlay (list shows through). */
15
17
  function MoreActionsPanel({ scope, onConfirm, onCancel, }) {
16
- return (_jsx(FramedPanel, { title: " \u66F4\u591A\u64CD\u4F5C ", content: [...moreActionModalContent(scope), 'Enter 执行 · Esc 返回'], width: 64, muteLastContent: true, onEscape: onCancel, onKey: (input, key) => {
18
+ return (_jsx(FramedPanel, { title: t('browser.moreActionsTitle'), content: [...moreActionModalContent(scope), t('browser.moreActionsFooter')], width: 64, muteLastContent: true, onEscape: onCancel, onKey: (input, key) => {
17
19
  if (key.return || input.includes('\r') || input.includes('\n'))
18
20
  onConfirm();
19
21
  } }));
20
22
  }
21
23
  function masterDetailBlankRow(tagWidth, listWidth, peekWidth) {
22
24
  const divider = '│';
23
- return (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Box, { width: tagWidth + 1, flexDirection: "row", children: [_jsx(Text, { wrap: "truncate-end", children: padColumns('', tagWidth) }), _jsx(Text, { color: termcnColors.border, children: divider })] }), _jsxs(Box, { width: listWidth + 1, flexDirection: "row", children: [_jsx(Text, { wrap: "truncate-end", children: padColumns('', listWidth) }), _jsx(Text, { color: termcnColors.border, children: divider })] }), _jsx(Box, { width: peekWidth, children: _jsx(Text, { wrap: "truncate-end", children: padColumns('', peekWidth) }) })] }));
25
+ return (_jsxs("box", { flexDirection: "row", children: [_jsxs("box", { width: tagWidth + 1, flexDirection: "row", children: [_jsx(Text, { wrap: "truncate-end", children: padColumns('', tagWidth) }), _jsx(Text, { color: termcnColors.border, children: divider })] }), _jsxs("box", { width: listWidth + 1, flexDirection: "row", children: [_jsx(Text, { wrap: "truncate-end", children: padColumns('', listWidth) }), _jsx(Text, { color: termcnColors.border, children: divider })] }), _jsx("box", { flexDirection: "row", width: peekWidth, children: _jsx(Text, { wrap: "truncate-end", children: padColumns('', peekWidth) }) })] }));
24
26
  }
25
- function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false, layout = 'default', columnWidth, showPagination = true, showSource = false, showReferences = false, showGroup = false, updates = new Set(), updatingSkillName, viewportHeight, }) {
27
+ function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false, layout = 'default', columnWidth, showPagination = true, showSource = false, showReferences = false, showGroup = false, updates = new Set(), updatingSkillName, viewportHeight, onRowClick, onCursorDelta, }) {
26
28
  const { stdout } = useStdout();
27
29
  const selected = useAtomValue(browserSelectionAtom);
28
30
  const paneHeight = viewportHeight ?? Math.max(3, (stdout.rows ?? 24) - 8);
@@ -32,12 +34,26 @@ function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false
32
34
  const visible = rows.slice(offset, offset + height);
33
35
  const paneWidth = columnWidth ?? Math.max(20, (stdout.columns ?? 80) - 4);
34
36
  const summaryWidth = Math.max(8, paneWidth - 4);
37
+ const onMouseScroll = useCallback((event) => {
38
+ const info = event.scroll;
39
+ if (!info || !onCursorDelta)
40
+ return;
41
+ const steps = Math.max(1, Math.abs(info.delta) || 1);
42
+ if (info.direction === 'up')
43
+ onCursorDelta(-steps);
44
+ else if (info.direction === 'down')
45
+ onCursorDelta(steps);
46
+ event.stopPropagation();
47
+ }, [onCursorDelta]);
35
48
  const renderRow = (row, index) => {
36
49
  if (row.type === 'group') {
37
50
  const groupSkills = row.skills;
38
51
  const count = groupSkills.filter((skill) => selected.has(skill.path)).length;
39
52
  const marker = count === 0 ? '○' : count === groupSkills.length && groupSkills.length ? '●' : '◐';
40
- return (_jsx(Text, { bold: true, ...(isActive && index === active ? { color: termcnColors.primary } : {}), children: `${isActive && index === active ? '›' : ' '} ${marker} ${row.name} (${row.skills.length})` }, `group:${row.name}:${index}`));
53
+ const body = (_jsx(Text, { bold: true, ...(isActive && index === active ? { color: termcnColors.primary } : {}), children: `${isActive && index === active ? '›' : ' '} ${marker} ${row.name} (${row.skills.length})` }));
54
+ if (!onRowClick)
55
+ return _jsx("box", { flexDirection: "row", children: body }, `group:${row.name}:${index}`);
56
+ return (_jsx(Clickable, { onClick: () => onRowClick(index), children: body }, `group:${row.name}:${index}`));
41
57
  }
42
58
  const skill = row.skill;
43
59
  const current = isActive && index === active;
@@ -46,56 +62,117 @@ function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false
46
62
  : listSkillSummary(skill, preferNote, summaryWidth);
47
63
  const inlineSummary = summary;
48
64
  const selectionMarker = selected.has(skill.path) ? '●' : '○';
49
- const nameLine = (_jsxs(_Fragment, { children: [` ${current ? '›' : ' '} ${selectionMarker} `, showGroup && row.group && (_jsxs(Text, { color: termcnColors.muted, children: [row.group, " / "] })), showReferences && skill.isReference ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: termcnColors.muted, children: "\u5F15\u7528 \u00B7 " }), _jsx(Text, { bold: current, children: skill.name })] })) : showSource && !skill.fromCollection ? (`本地 · ${skill.name}`) : (_jsx(Text, { bold: current, children: skill.name })), updatingSkillName === skill.name ? (_jsx(Text, { color: termcnColors.primary, children: " \u66F4\u65B0\u4E2D" })) : updates.has(skill.name) ? (_jsx(Text, { color: termcnColors.primary, children: " \u2191" })) : null, inlineSummary && (_jsxs(Text, { color: termcnColors.muted, children: [" \u2014 ", inlineSummary] }))] }));
50
- return (_jsx(Text, { wrap: "truncate-end", ...(current ? { color: termcnColors.primary } : {}), children: nameLine }, `${row.group}:${skill.path}:${index}`));
65
+ const nameLine = (_jsxs(_Fragment, { children: [` ${current ? '›' : ' '} ${selectionMarker} `, showGroup && row.group && (_jsxs(Text, { color: termcnColors.muted, children: [row.group, " / "] })), showReferences && skill.isReference ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: termcnColors.muted, children: t('browser.referencePrefix') }), _jsx(Text, { bold: current, children: skill.name })] })) : showSource && !skill.fromCollection ? (t('browser.localSkill', { name: skill.name })) : (_jsx(Text, { bold: current, children: skill.name })), updatingSkillName === skill.name ? (_jsx(WorkingSpinner, {})) : updates.has(skill.name) ? (_jsx(Text, { color: termcnColors.primary, children: " \u2191" })) : null, inlineSummary && (_jsxs(Text, { color: termcnColors.muted, children: [" \u2014 ", inlineSummary] }))] }));
66
+ const body = (_jsx(Text, { wrap: "truncate-end", ...(current
67
+ ? {
68
+ color: termcnColors.selectionFg,
69
+ backgroundColor: termcnColors.selectionBg,
70
+ bold: true,
71
+ }
72
+ : {}), children: nameLine }));
73
+ if (!onRowClick) {
74
+ return (_jsx("box", { flexDirection: "row", children: body }, `${row.group}:${skill.path}:${index}`));
75
+ }
76
+ return (_jsx(Clickable, { onClick: () => onRowClick(index), children: body }, `${row.group}:${skill.path}:${index}`));
51
77
  };
52
- return (_jsxs(Box, { flexDirection: "column", minHeight: 3, children: [rows.length ? (visible.map((row, visibleIndex) => renderRow(row, offset + visibleIndex))) : (_jsx(Text, { color: termcnColors.muted, children: "\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD" })), showPagination && rows.length > height && (_jsxs(Text, { color: termcnColors.muted, children: [offset + 1, "\u2013", Math.min(offset + height, rows.length), " / ", rows.length] }))] }));
78
+ return (_jsxs("box", { flexDirection: "column", minHeight: 3, onMouseScroll: onMouseScroll, children: [rows.length ? (visible.map((row, visibleIndex) => renderRow(row, offset + visibleIndex))) : (_jsx(Text, { color: termcnColors.muted, children: t('browser.noMatchingSkills') })), showPagination && rows.length > height && (_jsxs(Text, { color: termcnColors.muted, children: [offset + 1, "\u2013", Math.min(offset + height, rows.length), " / ", rows.length] }))] }));
53
79
  }
54
- function AgentTabs({ groups, agent, focused, }) {
55
- return (_jsx(Box, { paddingLeft: 1, gap: 2, children: groups.map((group) => {
80
+ function AgentTabs({ groups, agent, focused, onSelect, }) {
81
+ return (_jsx("box", { flexDirection: "row", paddingLeft: 1, gap: 2, children: groups.map((group) => {
56
82
  const active = group.agent === agent;
57
- // Keyboard focus only: never use foreground/white for "current agent".
58
- // Unfocused row stays fully muted so switching main tabs does not look
59
- // like the agent row is already selected.
60
- const highlighted = focused && active;
61
- return (_jsx(Text, { color: highlighted ? termcnColors.primary : termcnColors.muted, underline: highlighted, children: `${group.agent} ${group.skills.length}` }, group.agent));
83
+ // Current agent always uses primary (visible after mouse click without
84
+ // forcing keyboard focus onto the agents row). Keyboard-on-agents adds
85
+ // selection chrome so the focus ladder is still obvious.
86
+ const keyboardHere = focused && active;
87
+ return (_jsx(Clickable, { onClick: () => onSelect(group.agent), children: _jsx(Text, { color: keyboardHere
88
+ ? termcnColors.selectionFg
89
+ : active
90
+ ? termcnColors.primary
91
+ : termcnColors.muted, ...(keyboardHere
92
+ ? { backgroundColor: termcnColors.selectionBg, bold: true }
93
+ : active
94
+ ? { bold: true, underline: true }
95
+ : {}), children: `${group.agent} ${group.skills.length}` }) }, group.agent));
62
96
  }) }));
63
97
  }
64
98
  function masterDetailColumnText(line, width, options = {}) {
65
99
  const padded = padColumns(sliceColumns(line, 0, width), width);
66
- return (_jsx(Text, { wrap: "truncate-end", ...(options.color ? { color: options.color } : {}), ...(options.bold ? { bold: true } : {}), ...(options.inverse ? { inverse: true } : {}), ...(options.muted ? { color: termcnColors.muted } : {}), children: padded }));
100
+ if (options.selected) {
101
+ return (_jsx(Text, { wrap: "truncate-end", color: termcnColors.selectionFg, backgroundColor: termcnColors.selectionBg, bold: true, children: padded }));
102
+ }
103
+ return (_jsx(Text, { wrap: "truncate-end", ...(options.muted
104
+ ? { color: termcnColors.muted }
105
+ : options.color
106
+ ? { color: options.color }
107
+ : {}), ...(options.bold ? { bold: true } : {}), children: padded }));
67
108
  }
68
109
  /** Right-pane detail row: muted labels, normal/muted values, optional bold title. */
69
- function DetailColumnRow({ row, width, }) {
110
+ function DetailColumnRow({ row, width, selected = false, }) {
111
+ if (selected) {
112
+ return (_jsx(Text, { wrap: "truncate-end", color: termcnColors.selectionFg, backgroundColor: termcnColors.selectionBg, bold: true, children: padColumns(sliceColumns(row.label !== undefined
113
+ ? `${padColumns(row.label, detailLabelWidth())}${row.text}`
114
+ : row.text, 0, width), width) }));
115
+ }
70
116
  if (row.label !== undefined) {
71
- const valueWidth = Math.max(1, width - DETAIL_LABEL_WIDTH);
72
- return (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: termcnColors.muted, children: padColumns(row.label, DETAIL_LABEL_WIDTH) }), _jsx(Text, { ...(row.muted ? { color: termcnColors.muted } : {}), ...(row.bold ? { bold: true } : {}), ...(row.primary ? { color: termcnColors.primary } : {}), children: padColumns(sliceColumns(row.text, 0, valueWidth), valueWidth) })] }));
117
+ const valueWidth = Math.max(1, width - detailLabelWidth());
118
+ return (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: termcnColors.muted, children: padColumns(row.label, detailLabelWidth()) }), _jsx(Text, { ...(row.muted ? { color: termcnColors.muted } : {}), ...(row.bold ? { bold: true } : {}), ...(row.primary ? { color: termcnColors.primary } : {}), children: padColumns(sliceColumns(row.text, 0, valueWidth), valueWidth) })] }));
73
119
  }
74
120
  return (_jsx(Text, { wrap: "truncate-end", ...(row.primary ? { color: termcnColors.primary } : {}), ...(row.muted ? { color: termcnColors.muted } : {}), ...(row.bold ? { bold: true } : {}), children: padColumns(sliceColumns(row.text, 0, width), width) }));
75
121
  }
76
- function MasterDetailBody({ tagLines, listLines, peekLines, tagWidth, listWidth, peekWidth, tagActive, listActive, collectionHome = false, listActiveLineIndexes, listSelectedLineIndexes, detailRows, }) {
122
+ function MasterDetailBody({ tagLines, listLines, peekLines, tagWidth, listWidth, peekWidth, tagActive, listActive, detailActive = false, detailActiveField, collectionHome = false, listActiveLineIndexes, listSelectedLineIndexes, detailRows, onTagLineClick, onListLineClick, onDetailLineClick, onListScroll, }) {
77
123
  const rows = Math.max(tagLines.length, listLines.length, peekLines.length, detailRows?.length ?? 0);
78
124
  const divided = collectionHome;
79
125
  const divider = divided ? '│' : '';
80
126
  const tagColumnWidth = tagWidth + (divider ? 1 : 0);
81
127
  const listColumnWidth = listWidth + (divider ? 1 : 0);
82
- return (_jsx(_Fragment, { children: Array.from({ length: rows }, (_, index) => (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Box, { width: tagColumnWidth, flexDirection: "row", children: [masterDetailColumnText(tagLines[index] ?? '', tagWidth, {
83
- ...(tagActive && tagLines[index]?.startsWith('›')
84
- ? collectionHome
85
- ? { inverse: true }
86
- : { color: termcnColors.primary }
128
+ // Only the skill column (2nd) owns list wheel scrolling. Detail (3rd) must not
129
+ // move the list when the pointer is over it — attach scroll handler only there.
130
+ const onListColumnScroll = useCallback((event) => {
131
+ const info = event.scroll;
132
+ if (!info || !onListScroll)
133
+ return;
134
+ const steps = Math.max(1, Math.abs(info.delta) || 1);
135
+ if (info.direction === 'up')
136
+ onListScroll(-steps);
137
+ else if (info.direction === 'down')
138
+ onListScroll(steps);
139
+ event.stopPropagation();
140
+ }, [onListScroll]);
141
+ const swallowScroll = useCallback((event) => {
142
+ // Keep wheel over detail/tag from bubbling to a parent list scroller.
143
+ if (event.scroll)
144
+ event.stopPropagation();
145
+ }, []);
146
+ return (_jsx("box", { flexDirection: "column", children: Array.from({ length: rows }, (_, index) => {
147
+ const tagCell = masterDetailColumnText(tagLines[index] ?? '', tagWidth, {
148
+ ...(tagActive && tagLines[index]?.startsWith('›')
149
+ ? collectionHome
150
+ ? { selected: true }
151
+ : { color: termcnColors.primary, bold: true }
152
+ : {}),
153
+ });
154
+ const listCell = masterDetailColumnText(listLines[index] ?? '', listWidth, {
155
+ ...(listActiveLineIndexes?.has(index)
156
+ ? { selected: true }
157
+ : listSelectedLineIndexes?.has(index)
158
+ ? { color: termcnColors.primary, bold: true }
159
+ : listActive && listLines[index]?.startsWith('›')
160
+ ? { color: termcnColors.primary, bold: true }
161
+ : index % 2 === 1 && listLines[index]?.trim()
162
+ ? { muted: true }
87
163
  : {}),
88
- }), divider ? _jsx(Text, { color: termcnColors.border, children: divider }) : null] }), _jsxs(Box, { width: listColumnWidth, flexDirection: "row", children: [masterDetailColumnText(listLines[index] ?? '', listWidth, {
89
- ...(listActiveLineIndexes?.has(index)
90
- ? { inverse: true }
91
- : listSelectedLineIndexes?.has(index)
92
- ? { color: termcnColors.primary, bold: true }
93
- : listActive && listLines[index]?.startsWith('›')
94
- ? { color: termcnColors.primary, bold: true }
95
- : index % 2 === 1 && listLines[index]?.trim()
96
- ? { muted: true }
97
- : {}),
98
- }), divider ? _jsx(Text, { color: termcnColors.border, children: divider }) : null] }), _jsx(Box, { width: peekWidth, children: detailRows?.[index] ? (_jsx(DetailColumnRow, { row: detailRows[index], width: peekWidth })) : (_jsx(Text, { wrap: "truncate-end", color: index === 0 && peekLines[index] !== '选择技能查看' ? termcnColors.primary : termcnColors.muted, bold: index === 0 && peekLines[index] !== '选择技能查看', children: padColumns(sliceColumns(peekLines[index] ?? '', 0, peekWidth), peekWidth) })) })] }, `master-detail-row:${index}`))) }));
164
+ });
165
+ const tagInteractive = onTagLineClick && (tagLines[index] ?? '').trim().length > 0;
166
+ const listInteractive = onListLineClick && (listLines[index] ?? '').trim().length > 0;
167
+ return (_jsxs("box", { flexDirection: "row", children: [_jsxs("box", { width: tagColumnWidth, flexDirection: "row", onMouseScroll: swallowScroll, children: [tagInteractive ? (_jsx(Clickable, { onClick: () => onTagLineClick(index), children: tagCell })) : (tagCell), divider ? _jsx(Text, { color: termcnColors.border, children: divider }) : null] }), _jsxs("box", { width: listColumnWidth, flexDirection: "row", onMouseScroll: onListColumnScroll, children: [listInteractive ? (_jsx(Clickable, { onClick: () => onListLineClick(index), children: listCell })) : (listCell), divider ? _jsx(Text, { color: termcnColors.border, children: divider }) : null] }), _jsx("box", { flexDirection: "row", width: peekWidth, onMouseScroll: swallowScroll, children: detailRows?.[index] ? ((() => {
168
+ const detailRow = detailRows[index];
169
+ const fieldSelected = detailActive &&
170
+ detailRow.field !== undefined &&
171
+ detailRow.field === detailActiveField;
172
+ const cell = (_jsx(DetailColumnRow, { row: detailRow, width: peekWidth, selected: fieldSelected }));
173
+ return onDetailLineClick && detailRow.field ? (_jsx(Clickable, { onClick: () => onDetailLineClick(index), children: cell })) : (cell);
174
+ })()) : (_jsx(Text, { wrap: "truncate-end", color: index === 0 && peekLines[index] !== t('browser.selectSkillToView') ? termcnColors.primary : termcnColors.muted, bold: index === 0 && peekLines[index] !== t('browser.selectSkillToView'), children: padColumns(sliceColumns(peekLines[index] ?? '', 0, peekWidth), peekWidth) })) })] }, `master-detail-row:${index}`));
175
+ }) }));
99
176
  }
100
177
  /**
101
178
  * Browser list view. Navigation/selection live in the parent Jotai Provider
@@ -106,6 +183,8 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
106
183
  const modal = useModal();
107
184
  const shellBusy = useOverlayBusy();
108
185
  const store = useStore();
186
+ // Local braille spinner only while a skill is updating (not a global busy overlay).
187
+ const updatingFrame = useSpinnerFrame(Boolean(updatingSkillName));
109
188
  const [navigation, setNavigationState] = useAtom(browserNavigationAtom);
110
189
  const [selected, setSelected] = useAtom(browserSelectionAtom);
111
190
  const navigationRef = useRef(navigation);
@@ -197,6 +276,10 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
197
276
  const [tagCursor, setTagCursor] = useState(0);
198
277
  const tagCursorRef = useRef(tagCursor);
199
278
  tagCursorRef.current = tagCursor;
279
+ /** Index into detailEditableFields(collection) while focus === 'detail'. */
280
+ const [detailFieldIndex, setDetailFieldIndex] = useState(0);
281
+ const detailFieldIndexRef = useRef(detailFieldIndex);
282
+ detailFieldIndexRef.current = detailFieldIndex;
200
283
  const masterDetailSkills = useMemo(() => skillsForTagFilter(tabSkills, tagFilter), [tabSkills, tagFilter]);
201
284
  const masterDetailRows = useMemo(() => flatRows(masterDetailSkills, query), [masterDetailSkills, query]);
202
285
  const listRows = useMasterDetail ? masterDetailRows : rows;
@@ -299,11 +382,26 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
299
382
  const masterListOffset = useMasterDetail
300
383
  ? Math.max(0, Math.min(cursor - Math.floor(masterListVisibleHeight / 2), Math.max(0, listRows.length - masterListVisibleHeight)))
301
384
  : 0;
302
- const peekSkill = focus === 'list' && currentRow?.type === 'skill' ? currentRow.skill : undefined;
385
+ const peekSkill = (focus === 'list' || focus === 'detail') && currentRow?.type === 'skill'
386
+ ? currentRow.skill
387
+ : undefined;
388
+ const detailFields = detailEditableFields(tab === 'collection');
389
+ const activeDetailField = focus === 'detail' && detailFields.length
390
+ ? detailFields[Math.max(0, Math.min(detailFieldIndex, detailFields.length - 1))]
391
+ : undefined;
303
392
  useEffect(() => {
304
- if (focus === 'tags' && !useMasterDetail)
393
+ if ((focus === 'detail' || focus === 'tags') && !useMasterDetail)
305
394
  setFocus('list');
306
395
  }, [focus, useMasterDetail, setFocus]);
396
+ useEffect(() => {
397
+ if (focus === 'detail' && currentRow?.type !== 'skill')
398
+ setFocus('list');
399
+ }, [focus, currentRow, setFocus]);
400
+ useEffect(() => {
401
+ if (detailFieldIndex >= detailFields.length && detailFields.length > 0) {
402
+ setDetailFieldIndex(detailFields.length - 1);
403
+ }
404
+ }, [detailFieldIndex, detailFields.length]);
307
405
  useInput((input, key) => {
308
406
  const live = navigationRef.current;
309
407
  const liveFocus = live?.focus ?? 'tabs';
@@ -311,9 +409,9 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
311
409
  if (input === '?') {
312
410
  void modal.open({
313
411
  footerItems: [
314
- { key: '↑↓', label: '移动' },
315
- { key: 'e', label: '展开' },
316
- { key: 'Esc', label: '关闭' },
412
+ { key: '↑↓', label: t('common.move') },
413
+ { key: 'e', label: t('common.expand') },
414
+ { key: 'Esc', label: t('common.close') },
317
415
  ],
318
416
  content: (close) => (_jsx(ShortcutHelpPanel, { onClose: () => close(undefined), maxBodyRows: 14 })),
319
417
  });
@@ -443,19 +541,55 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
443
541
  }
444
542
  return;
445
543
  }
544
+ // Right column: move among editable fields (标签 / 备注); Enter opens editor.
545
+ if (liveFocus === 'detail' || focus === 'detail') {
546
+ const detailRow = listRows[cursorRef.current];
547
+ const skill = detailRow?.type === 'skill' ? detailRow.skill : undefined;
548
+ const fields = detailEditableFields(tab === 'collection');
549
+ if (key.leftArrow)
550
+ return setFocus('list');
551
+ if (key.upArrow) {
552
+ if (!fields.length)
553
+ return;
554
+ setDetailFieldIndex((index) => Math.max(0, index - 1));
555
+ return;
556
+ }
557
+ if (key.downArrow) {
558
+ if (!fields.length)
559
+ return;
560
+ setDetailFieldIndex((index) => Math.min(fields.length - 1, index + 1));
561
+ return;
562
+ }
563
+ if (key.rightArrow)
564
+ return;
565
+ const field = fields[detailFieldIndexRef.current] ?? fields[0];
566
+ if (skill && field && (key.return || input.includes('\r') || input.includes('\n'))) {
567
+ if (field === 'tags')
568
+ return finish({ type: 'editTags', skill });
569
+ if (field === 'note')
570
+ return finish({ type: 'editNote', skill });
571
+ }
572
+ if (skill && tab === 'collection') {
573
+ if (input === 't')
574
+ return finish({ type: 'editTags', skill });
575
+ if (input === 'n')
576
+ return finish({ type: 'editNote', skill });
577
+ }
578
+ return;
579
+ }
446
580
  if ((navigationRef.current?.focus ?? focus) !== 'list')
447
581
  return;
448
582
  const row = listRows[cursorRef.current];
449
583
  if (input === 'm' && canOpenActions) {
450
584
  const skills = actionSkills;
451
585
  const scope = selectedProject.length
452
- ? `已选择 ${skills.length} 个技能`
453
- : `技能:${skills[0]?.name ?? ''}`;
586
+ ? t('browser.selectedSkills', { count: skills.length })
587
+ : t('browser.skillLine', { names: skills[0]?.name ?? '' });
454
588
  void modal
455
589
  .open({
456
590
  footerItems: [
457
- { key: 'Enter', label: '确认' },
458
- { key: 'Esc', label: '取消' },
591
+ { key: 'Enter', label: t('common.confirm') },
592
+ { key: 'Esc', label: t('common.cancel') },
459
593
  ],
460
594
  content: (close) => (_jsx(MoreActionsPanel, { scope: scope, onConfirm: () => close(true), onCancel: () => close(false) })),
461
595
  })
@@ -502,12 +636,12 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
502
636
  const skills = removableCollection;
503
637
  void modal
504
638
  .confirm({
505
- title: '删除收藏',
639
+ title: t('browser.removeCollectionTitle'),
506
640
  message: skills.length === 1
507
- ? `从收藏夹移除 ${skills[0]?.name ?? ''} 吗?`
508
- : `从收藏夹移除 ${skills.length} 个技能吗?`,
641
+ ? t('browser.removeCollectionOne', { name: skills[0]?.name ?? '' })
642
+ : t('browser.removeCollectionMany', { count: skills.length }),
509
643
  ...(skills.length > 1
510
- ? { details: [`技能:${skills.map((skill) => skill.name).join(', ')}`] }
644
+ ? { details: [t('browser.skillLine', { names: skills.map((skill) => skill.name).join(', ') })] }
511
645
  : {}),
512
646
  })
513
647
  .then((ok) => {
@@ -520,12 +654,12 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
520
654
  const skills = removableLocations;
521
655
  void modal
522
656
  .confirm({
523
- title: '删除技能',
657
+ title: t('browser.removeLocationsTitle'),
524
658
  message: skills.length === 1
525
- ? `删除 ${skills[0]?.name ?? ''} 的当前位置吗?`
526
- : `删除所选 ${skills.length} 个技能位置吗?`,
659
+ ? t('browser.removeLocationOne', { name: skills[0]?.name ?? '' })
660
+ : t('browser.removeLocationsMany', { count: skills.length }),
527
661
  details: [
528
- '将永久删除以下位置;收藏夹内容(如有)保留。',
662
+ t('browser.removeLocationsHint'),
529
663
  ...skills.map((skill) => skill.path),
530
664
  ],
531
665
  })
@@ -562,13 +696,19 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
562
696
  return next;
563
697
  });
564
698
  }
565
- // 3-column layout peeks detail in the right pane — neither → nor Enter
566
- // open fullscreen there (narrow list keeps → / Enter as before).
567
- if (key.rightArrow && row?.type === 'skill' && !useBrowseHome) {
568
- if (tab === 'collection')
569
- return openDetail(row.skill, true);
570
- if (row.skill.fromCollection)
571
- return openDetail(row.skill, true);
699
+ // Wide 3-column: → moves focus into the right detail column (editable fields).
700
+ // Narrow layout keeps → as fullscreen detail for collection / collected skills.
701
+ if (key.rightArrow && row?.type === 'skill') {
702
+ if (useMasterDetail) {
703
+ setDetailFieldIndex(0);
704
+ return setFocus('detail');
705
+ }
706
+ if (!useBrowseHome) {
707
+ if (tab === 'collection')
708
+ return openDetail(row.skill, true);
709
+ if (row.skill.fromCollection)
710
+ return openDetail(row.skill, true);
711
+ }
572
712
  }
573
713
  if (key.return || input.includes('\r') || input.includes('\n')) {
574
714
  if (tab === 'collection' && selectedCollection.length) {
@@ -614,19 +754,94 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
614
754
  if (useBrowseHome) {
615
755
  const { tagWidth, listWidth, peekWidth } = masterDetailColumns;
616
756
  const selectedPaths = selected;
757
+ const tagActiveIndex = Math.max(0, Math.min(tagCursor, tagOptions.length - 1));
758
+ const tagOffset = Math.max(0, Math.min(tagActiveIndex - Math.floor(viewportHeight / 2), Math.max(0, tagOptions.length - viewportHeight)));
617
759
  const tagLines = collectionCategoryLines(tagOptions, tagCursor, focus === 'tags', tagWidth, viewportHeight);
618
- const { lines: listLines, activeLineIndexes: listActiveLineIndexes, selectedLineIndexes: listSelectedLineIndexes, } = collectionListColumnLines(paneRows, cursor, focus === 'list', options.preferNote ?? false, listWidth, viewportHeight, selectedPaths, options.updates ?? new Set(), options.updatingSkillName);
619
- const detailRows = browseDetailRows(peekSkill, peekWidth, viewportHeight, options.collection ?? false, options.updates ?? new Set(), options.updatingSkillName);
620
- const headerLine = (left, middle, right) => (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Box, { width: tagWidth + 1, flexDirection: "row", children: [_jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(left, tagWidth) }), _jsx(Text, { color: termcnColors.border, children: "\u2502" })] }), _jsxs(Box, { width: listWidth + 1, flexDirection: "row", children: [_jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(middle, listWidth) }), _jsx(Text, { color: termcnColors.border, children: "\u2502" })] }), _jsx(Box, { width: peekWidth, children: _jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(right, peekWidth) }) })] }));
621
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: termcnColors.border, wrap: "truncate-end", children: masterDetailSeparator(tagWidth, listWidth, peekWidth, 'top', true) }), headerLine('标签', '技能', '详情'), masterDetailBlankRow(tagWidth, listWidth, peekWidth), _jsx(MasterDetailBody, { tagLines: tagLines, listLines: listLines, peekLines: [], tagWidth: tagWidth, listWidth: listWidth, peekWidth: peekWidth, tagActive: focus === 'tags', listActive: focus === 'list', collectionHome: true, ...(listActiveLineIndexes ? { listActiveLineIndexes } : {}), ...(listSelectedLineIndexes ? { listSelectedLineIndexes } : {}), detailRows: detailRows }), _jsx(Text, { color: termcnColors.border, wrap: "truncate-end", children: masterDetailSeparator(tagWidth, listWidth, peekWidth, 'bottom', true) })] }));
760
+ const { lines: listLines, skillOffset, activeLineIndexes: listActiveLineIndexes, selectedLineIndexes: listSelectedLineIndexes, } = collectionListColumnLines(paneRows, cursor, focus === 'list', options.preferNote ?? false, listWidth, viewportHeight, selectedPaths, options.updates ?? new Set(), options.updatingSkillName, updatingFrame);
761
+ const detailRows = browseDetailRows(peekSkill, peekWidth, viewportHeight, options.collection ?? false, options.updates ?? new Set(), options.updatingSkillName, updatingFrame);
762
+ const headerLine = (left, middle, right) => (_jsxs("box", { flexDirection: "row", children: [_jsxs("box", { width: tagWidth + 1, flexDirection: "row", children: [_jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(left, tagWidth) }), _jsx(Text, { color: termcnColors.border, children: "\u2502" })] }), _jsxs("box", { width: listWidth + 1, flexDirection: "row", children: [_jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(middle, listWidth) }), _jsx(Text, { color: termcnColors.border, children: "\u2502" })] }), _jsx("box", { flexDirection: "row", width: peekWidth, children: _jsx(Text, { bold: true, color: termcnColors.muted, wrap: "truncate-end", children: padColumns(right, peekWidth) }) })] }));
763
+ return (_jsxs("box", { flexDirection: "column", children: [_jsx(Text, { color: termcnColors.border, wrap: "truncate-end", children: masterDetailSeparator(tagWidth, listWidth, peekWidth, 'top', true) }), headerLine(t('common.tags'), t('common.skill'), t('common.detail')), masterDetailBlankRow(tagWidth, listWidth, peekWidth), _jsx(MasterDetailBody, { tagLines: tagLines, listLines: listLines, peekLines: [], tagWidth: tagWidth, listWidth: listWidth, peekWidth: peekWidth, tagActive: focus === 'tags', listActive: focus === 'list', detailActive: focus === 'detail', ...(activeDetailField ? { detailActiveField: activeDetailField } : {}), collectionHome: true, ...(listActiveLineIndexes ? { listActiveLineIndexes } : {}), ...(listSelectedLineIndexes ? { listSelectedLineIndexes } : {}), detailRows: detailRows, onTagLineClick: (visibleIndex) => {
764
+ const absolute = tagOffset + visibleIndex;
765
+ if (absolute < 0 || absolute >= tagOptions.length)
766
+ return;
767
+ const option = tagOptions[absolute];
768
+ if (!option)
769
+ return;
770
+ setTagFilter(option.key);
771
+ setTagCursor(absolute);
772
+ setCursor(0);
773
+ setFocus('tags');
774
+ }, onListLineClick: (visibleIndex) => {
775
+ // Paired name/summary lines → skill index.
776
+ const skillIndex = skillOffset + Math.floor(visibleIndex / 2);
777
+ if (skillIndex < 0 || skillIndex >= paneRows.length)
778
+ return;
779
+ setCursor(skillIndex);
780
+ setFocus('list');
781
+ const row = paneRows[skillIndex];
782
+ if (!row)
783
+ return;
784
+ const paths = selectableSkills(row).map((skill) => skill.path);
785
+ if (!paths.length)
786
+ return;
787
+ setSelected((previous) => {
788
+ const next = new Set(previous);
789
+ const allSelected = paths.every((path) => previous.has(path));
790
+ for (const path of paths) {
791
+ if (allSelected)
792
+ next.delete(path);
793
+ else
794
+ next.add(path);
795
+ }
796
+ return next;
797
+ });
798
+ }, onDetailLineClick: (visibleIndex) => {
799
+ const row = detailRows[visibleIndex];
800
+ if (!row?.field)
801
+ return;
802
+ const index = detailFields.indexOf(row.field);
803
+ if (index < 0)
804
+ return;
805
+ setDetailFieldIndex(index);
806
+ setFocus('detail');
807
+ }, onListScroll: (delta) => {
808
+ setFocus('list');
809
+ setCursor((index) => Math.max(0, Math.min(Math.max(0, paneRows.length - 1), index + delta)));
810
+ } }), _jsx(Text, { color: termcnColors.border, wrap: "truncate-end", children: masterDetailSeparator(tagWidth, listWidth, peekWidth, 'bottom', true) })] }));
622
811
  }
623
- return (_jsx(SkillPane, { rows: paneRows, cursor: cursor, isActive: focus === 'list', viewportHeight: viewportHeight, ...options }));
812
+ return (_jsx(SkillPane, { rows: paneRows, cursor: cursor, isActive: focus === 'list', viewportHeight: viewportHeight, onRowClick: (index) => {
813
+ setCursor(index);
814
+ setFocus('list');
815
+ const row = paneRows[index];
816
+ if (!row)
817
+ return;
818
+ const paths = selectableSkills(row).map((skill) => skill.path);
819
+ if (!paths.length)
820
+ return;
821
+ setSelected((previous) => {
822
+ const next = new Set(previous);
823
+ const allSelected = paths.every((path) => previous.has(path));
824
+ for (const path of paths) {
825
+ if (allSelected)
826
+ next.delete(path);
827
+ else
828
+ next.add(path);
829
+ }
830
+ return next;
831
+ });
832
+ }, onCursorDelta: (delta) => {
833
+ setFocus('list');
834
+ setCursor((index) => Math.max(0, Math.min(Math.max(0, paneRows.length - 1), index + delta)));
835
+ }, ...options }));
624
836
  };
625
837
  const tabs = [
626
838
  {
627
839
  key: 'project',
628
- label: `当前项目 ${project.length}`,
629
- content: (_jsxs(Box, { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleProjectGroups, agent: activeProjectAgent, focused: !shellBusy && !searching && focus === 'agents' }), renderBrowsePane(listRows, browseViewportHeight(true), {
840
+ label: t('browser.tabProject', { count: project.length }),
841
+ content: (_jsxs("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleProjectGroups, agent: activeProjectAgent, focused: !shellBusy && !searching && focus === 'agents', onSelect: (name) => {
842
+ setAgent(name);
843
+ setCursor(0);
844
+ } }), renderBrowsePane(listRows, browseViewportHeight(true), {
630
845
  showSource: true,
631
846
  showReferences: true,
632
847
  showGroup: Boolean(query.trim()),
@@ -634,16 +849,19 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
634
849
  },
635
850
  {
636
851
  key: 'global',
637
- label: `全局 ${globalGroups.reduce((count, group) => count + group.skills.length, 0)}`,
638
- content: (_jsxs(Box, { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleGlobalGroups, agent: activeGlobalAgent, focused: !shellBusy && !searching && focus === 'agents' }), renderBrowsePane(listRows, browseViewportHeight(true), {
852
+ label: t('browser.tabGlobal', { count: globalGroups.reduce((count, group) => count + group.skills.length, 0) }),
853
+ content: (_jsxs("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleGlobalGroups, agent: activeGlobalAgent, focused: !shellBusy && !searching && focus === 'agents', onSelect: (name) => {
854
+ setAgent(name);
855
+ setCursor(0);
856
+ } }), renderBrowsePane(listRows, browseViewportHeight(true), {
639
857
  showSource: true,
640
858
  showGroup: Boolean(query.trim()),
641
859
  })] })),
642
860
  },
643
861
  {
644
862
  key: 'collection',
645
- label: `收藏夹 ${collection.length}`,
646
- content: (_jsx(Box, { flexDirection: "column", minHeight: frame.frameHeight - 1, children: renderBrowsePane(listRows, browseViewportHeight(false), {
863
+ label: t('browser.tabCollection', { count: collection.length }),
864
+ content: (_jsx("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: renderBrowsePane(listRows, browseViewportHeight(false), {
647
865
  preferNote: true,
648
866
  collection: true,
649
867
  showGroup: Boolean(query.trim()),
@@ -653,7 +871,7 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
653
871
  },
654
872
  ];
655
873
  if (choosingGroup) {
656
- return (_jsx(Select, { label: "\u8DF3\u8F6C\u5230\u5206\u7EC4\uFF1A", numbered: true, options: groups.map((group) => ({
874
+ return (_jsx(Select, { label: t('browser.jumpToGroup'), numbered: true, options: groups.map((group) => ({
657
875
  label: `${group.name} (${group.skills.length})`,
658
876
  value: group.name,
659
877
  })), onSubmit: (name) => {
@@ -672,6 +890,6 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
672
890
  setChoosingGroup(false);
673
891
  } }));
674
892
  }
675
- return (_jsx(Box, { flexDirection: "column", children: _jsx(Tabs, { tabs: tabs, activeTab: tab, onTabChange: (key) => setTab(key), isActive: !shellBusy && !searching && focus === 'tabs', enableArrowNav: false, focused: !shellBusy && !searching && focus === 'tabs', width: frame.frameWidth, bordered: false, chip: useBrowseHome }) }));
893
+ return (_jsx("box", { flexDirection: "column", children: _jsx(Tabs, { tabs: tabs, activeTab: tab, onTabChange: (key) => setTab(key), isActive: !shellBusy && !searching && focus === 'tabs', enableArrowNav: false, focused: !shellBusy && !searching && focus === 'tabs', width: frame.frameWidth, bordered: false, chip: useBrowseHome }) }));
676
894
  }
677
895
  //# sourceMappingURL=browser.js.map