iskills 0.2.45 → 0.2.47

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 (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -7
  3. package/README.zh-CN.md +8 -6
  4. package/bin/iskills.js +10 -2
  5. package/dist/src/cli.js +22 -7
  6. package/dist/src/cli.js.map +1 -1
  7. package/dist/src/commands/browser-actions.d.ts +2 -0
  8. package/dist/src/commands/browser-actions.js +154 -49
  9. package/dist/src/commands/browser-actions.js.map +1 -1
  10. package/dist/src/commands/config.d.ts +5 -0
  11. package/dist/src/commands/config.js +23 -0
  12. package/dist/src/commands/config.js.map +1 -0
  13. package/dist/src/commands/create.js +12 -8
  14. package/dist/src/commands/create.js.map +1 -1
  15. package/dist/src/commands/index.d.ts +1 -0
  16. package/dist/src/commands/index.js +19 -77
  17. package/dist/src/commands/index.js.map +1 -1
  18. package/dist/src/commands/library.d.ts +46 -12
  19. package/dist/src/commands/library.js +384 -230
  20. package/dist/src/commands/library.js.map +1 -1
  21. package/dist/src/commands/search.js +17 -39
  22. package/dist/src/commands/search.js.map +1 -1
  23. package/dist/src/domain/collection-write.d.ts +53 -2
  24. package/dist/src/domain/collection-write.js +293 -61
  25. package/dist/src/domain/collection-write.js.map +1 -1
  26. package/dist/src/domain/core.d.ts +46 -5
  27. package/dist/src/domain/core.js +164 -58
  28. package/dist/src/domain/core.js.map +1 -1
  29. package/dist/src/domain/cross-agent-install.d.ts +32 -0
  30. package/dist/src/domain/cross-agent-install.js +147 -0
  31. package/dist/src/domain/cross-agent-install.js.map +1 -0
  32. package/dist/src/domain/errors.d.ts +20 -0
  33. package/dist/src/domain/errors.js +31 -0
  34. package/dist/src/domain/errors.js.map +1 -0
  35. package/dist/src/domain/git.js +15 -14
  36. package/dist/src/domain/git.js.map +1 -1
  37. package/dist/src/domain/user-config.d.ts +12 -0
  38. package/dist/src/domain/user-config.js +55 -0
  39. package/dist/src/domain/user-config.js.map +1 -0
  40. package/dist/src/i18n/en.d.ts +5 -0
  41. package/dist/src/i18n/en.js +423 -0
  42. package/dist/src/i18n/en.js.map +1 -0
  43. package/dist/src/i18n/index.d.ts +54 -0
  44. package/dist/src/i18n/index.js +164 -0
  45. package/dist/src/i18n/index.js.map +1 -0
  46. package/dist/src/i18n/zh.d.ts +409 -0
  47. package/dist/src/i18n/zh.js +423 -0
  48. package/dist/src/i18n/zh.js.map +1 -0
  49. package/dist/src/ui/browser/browse-capabilities.d.ts +26 -0
  50. package/dist/src/ui/browser/browse-capabilities.js +130 -0
  51. package/dist/src/ui/browser/browse-capabilities.js.map +1 -0
  52. package/dist/src/ui/browser/browser.js +205 -62
  53. package/dist/src/ui/browser/browser.js.map +1 -1
  54. package/dist/src/ui/browser/detail.js +1 -1
  55. package/dist/src/ui/browser/detail.js.map +1 -1
  56. package/dist/src/ui/browser/footer.js +26 -88
  57. package/dist/src/ui/browser/footer.js.map +1 -1
  58. package/dist/src/ui/browser/format.d.ts +13 -20
  59. package/dist/src/ui/browser/format.js +81 -144
  60. package/dist/src/ui/browser/format.js.map +1 -1
  61. package/dist/src/ui/browser/index.js +35 -3
  62. package/dist/src/ui/browser/index.js.map +1 -1
  63. package/dist/src/ui/browser/shortcut-help.js +3 -4
  64. package/dist/src/ui/browser/shortcut-help.js.map +1 -1
  65. package/dist/src/ui/browser/store.d.ts +4 -0
  66. package/dist/src/ui/browser/store.js +2 -0
  67. package/dist/src/ui/browser/store.js.map +1 -1
  68. package/dist/src/ui/browser/types.d.ts +19 -4
  69. package/dist/src/ui/collection-match.d.ts +1 -1
  70. package/dist/src/ui/collection-match.js +8 -5
  71. package/dist/src/ui/collection-match.js.map +1 -1
  72. package/dist/src/ui/components/framed-panel.d.ts +6 -1
  73. package/dist/src/ui/components/framed-panel.js +7 -4
  74. package/dist/src/ui/components/framed-panel.js.map +1 -1
  75. package/dist/src/ui/components/modal-panel.d.ts +4 -1
  76. package/dist/src/ui/components/modal-panel.js +8 -2
  77. package/dist/src/ui/components/modal-panel.js.map +1 -1
  78. package/dist/src/ui/components/mouse/index.d.ts +1 -1
  79. package/dist/src/ui/components/mouse/index.js +1 -1
  80. package/dist/src/ui/components/mouse/index.js.map +1 -1
  81. package/dist/src/ui/components/mouse/parse.d.ts +0 -7
  82. package/dist/src/ui/components/mouse/parse.js +0 -41
  83. package/dist/src/ui/components/mouse/parse.js.map +1 -1
  84. package/dist/src/ui/components/multi-select.js +3 -10
  85. package/dist/src/ui/components/multi-select.js.map +1 -1
  86. package/dist/src/ui/components/options.d.ts +2 -0
  87. package/dist/src/ui/components/options.js +9 -0
  88. package/dist/src/ui/components/options.js.map +1 -1
  89. package/dist/src/ui/components/select.js +1 -1
  90. package/dist/src/ui/components/select.js.map +1 -1
  91. package/dist/src/ui/components/tag-editor.d.ts +1 -2
  92. package/dist/src/ui/components/tag-editor.js +6 -4
  93. package/dist/src/ui/components/tag-editor.js.map +1 -1
  94. package/dist/src/ui/components/termcn.d.ts +1 -5
  95. package/dist/src/ui/components/termcn.js +1 -4
  96. package/dist/src/ui/components/termcn.js.map +1 -1
  97. package/dist/src/ui/config/index.d.ts +11 -0
  98. package/dist/src/ui/config/index.js +22 -0
  99. package/dist/src/ui/config/index.js.map +1 -0
  100. package/dist/src/ui/config/settings.d.ts +17 -0
  101. package/dist/src/ui/config/settings.js +126 -0
  102. package/dist/src/ui/config/settings.js.map +1 -0
  103. package/dist/src/ui/footer/resolve-footer.js +54 -36
  104. package/dist/src/ui/footer/resolve-footer.js.map +1 -1
  105. package/dist/src/ui/footer/types.d.ts +12 -2
  106. package/dist/src/ui/import/review.js +5 -8
  107. package/dist/src/ui/import/review.js.map +1 -1
  108. package/dist/src/ui/import/skill-select.js +15 -33
  109. package/dist/src/ui/import/skill-select.js.map +1 -1
  110. package/dist/src/ui/install/review.js +18 -19
  111. package/dist/src/ui/install/review.js.map +1 -1
  112. package/dist/src/ui/overlay/bridge.d.ts +1 -1
  113. package/dist/src/ui/prompts/present.d.ts +4 -2
  114. package/dist/src/ui/prompts/present.js +70 -5
  115. package/dist/src/ui/prompts/present.js.map +1 -1
  116. package/dist/src/ui/search/index.js +9 -7
  117. package/dist/src/ui/search/index.js.map +1 -1
  118. package/dist/src/ui/shell/app-shell.d.ts +1 -1
  119. package/dist/src/ui/shell/app-shell.js +1 -1
  120. package/dist/src/ui/shell/run.d.ts +0 -11
  121. package/dist/src/ui/shell/run.js +0 -43
  122. package/dist/src/ui/shell/run.js.map +1 -1
  123. package/dist/src/ui/shell/terminal.d.ts +0 -1
  124. package/dist/src/ui/shell/terminal.js +2 -1
  125. package/dist/src/ui/shell/terminal.js.map +1 -1
  126. package/dist/src/ui/skill-labels.d.ts +10 -9
  127. package/dist/src/ui/skill-labels.js +14 -10
  128. package/dist/src/ui/skill-labels.js.map +1 -1
  129. package/dist/src/ui/tui/hooks.d.ts +1 -13
  130. package/dist/src/ui/tui/hooks.js +1 -11
  131. package/dist/src/ui/tui/hooks.js.map +1 -1
  132. package/dist/src/ui/tui/index.d.ts +1 -1
  133. package/dist/src/ui/tui/index.js +1 -1
  134. package/dist/src/ui/tui/index.js.map +1 -1
  135. package/package.json +10 -11
  136. package/bin/patch-react-reconciler.mjs +0 -71
  137. package/dist/src/ui/components/confirm.d.ts +0 -6
  138. package/dist/src/ui/components/confirm.js +0 -22
  139. package/dist/src/ui/components/confirm.js.map +0 -1
  140. package/dist/src/ui/components/link.d.ts +0 -7
  141. package/dist/src/ui/components/link.js +0 -17
  142. package/dist/src/ui/components/link.js.map +0 -1
  143. package/dist/src/ui/components/modal.d.ts +0 -16
  144. package/dist/src/ui/components/modal.js +0 -58
  145. package/dist/src/ui/components/modal.js.map +0 -1
@@ -3,20 +3,42 @@ 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
5
  import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
6
- import { browserFilterAtom, browserGroupJumpAtom, browserNavigationAtom, browserSelectionAtom, browserUpdateCheckAtom, } from './store.js';
6
+ import { browserFilterAtom, browserGroupJumpAtom, browserNavigationAtom, browserSelectionAtom, browserTagFilterAtom, 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 { isCrossAgentInstallable } from '../../domain/cross-agent-install.js';
9
+ import { browseSelectionSets, projectActionSkills, } from './browse-capabilities.js';
10
+ import { TAG_FILTER_ALL, browseDetailRows, collectionCategoryLines, collectionListColumnLines, detailEditableFields, detailLabelWidth, flatRows, focusAfterDownFromAgents, focusAfterDownFromTabs, focusAfterUpFromList, focusAfterUpFromTags, groupedRows, listSkillSummary, nextAgent, nextMainTab, selectableSkills, skillsForTagFilter, tagFilterOptions, visibleAgentGroups, } from './format.js';
11
+ import { t } from '../../i18n/index.js';
9
12
  import { useModal, useOverlayBusy } from '../overlay/host.js';
10
13
  import { FramedPanel } from '../components/framed-panel.js';
11
14
  import { Select, Tabs, termcnColors, WorkingSpinner, useSpinnerFrame, } from '../components/termcn.js';
12
15
  import { Clickable } from '../components/mouse/clickable.js';
13
16
  import { padColumns, sliceColumns } from '../components/terminal-layout.js';
14
17
  import { ShortcutHelpPanel } from './shortcut-help.js';
15
- /** Framed more-actions panel for absolute modal overlay (list shows through). */
16
- function MoreActionsPanel({ scope, onConfirm, onCancel, }) {
17
- return (_jsx(FramedPanel, { title: " \u66F4\u591A\u64CD\u4F5C ", content: [...moreActionModalContent(scope), 'Enter 执行 · Esc 返回'], width: 64, muteLastContent: true, onEscape: onCancel, onKey: (input, key) => {
18
- if (key.return || input.includes('\r') || input.includes('\n'))
19
- onConfirm();
18
+ /** Framed more-actions picker when multiple m-actions are available. */
19
+ function MoreActionsPanel({ scope, items, onSelect, onCancel, }) {
20
+ const [cursor, setCursor] = useState(0);
21
+ const clamped = Math.max(0, Math.min(cursor, items.length - 1));
22
+ const lines = [
23
+ scope,
24
+ '',
25
+ ...items.map((item, index) => index === clamped ? `› ${item.label}` : ` ${item.label}`),
26
+ t('browser.moreActionsFooter'),
27
+ ];
28
+ return (_jsx(FramedPanel, { title: t('browser.moreActionsTitle'), content: lines, width: 64, muteLastContent: true, scrollWithArrows: false, onEscape: onCancel, onKey: (input, key) => {
29
+ if (key.upArrow) {
30
+ setCursor((current) => Math.max(0, current - 1));
31
+ return;
32
+ }
33
+ if (key.downArrow) {
34
+ setCursor((current) => Math.min(items.length - 1, current + 1));
35
+ return;
36
+ }
37
+ if (key.return || input.includes('\r') || input.includes('\n')) {
38
+ const item = items[clamped];
39
+ if (item)
40
+ onSelect(item.id);
41
+ }
20
42
  } }));
21
43
  }
22
44
  function masterDetailBlankRow(tagWidth, listWidth, peekWidth) {
@@ -61,7 +83,7 @@ function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false
61
83
  : listSkillSummary(skill, preferNote, summaryWidth);
62
84
  const inlineSummary = summary;
63
85
  const selectionMarker = selected.has(skill.path) ? '●' : '○';
64
- 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(WorkingSpinner, {})) : updates.has(skill.name) ? (_jsx(Text, { color: termcnColors.primary, children: " \u2191" })) : null, inlineSummary && (_jsxs(Text, { color: termcnColors.muted, children: [" \u2014 ", inlineSummary] }))] }));
86
+ 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] }))] }));
65
87
  const body = (_jsx(Text, { wrap: "truncate-end", ...(current
66
88
  ? {
67
89
  color: termcnColors.selectionFg,
@@ -74,7 +96,7 @@ function SkillPane({ rows, cursor, isActive, preferNote = false, compact = false
74
96
  }
75
97
  return (_jsx(Clickable, { onClick: () => onRowClick(index), children: body }, `${row.group}:${skill.path}:${index}`));
76
98
  };
77
- 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: "\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] }))] }));
99
+ 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] }))] }));
78
100
  }
79
101
  function AgentTabs({ groups, agent, focused, onSelect, }) {
80
102
  return (_jsx("box", { flexDirection: "row", paddingLeft: 1, gap: 2, children: groups.map((group) => {
@@ -106,14 +128,19 @@ function masterDetailColumnText(line, width, options = {}) {
106
128
  : {}), ...(options.bold ? { bold: true } : {}), children: padded }));
107
129
  }
108
130
  /** Right-pane detail row: muted labels, normal/muted values, optional bold title. */
109
- function DetailColumnRow({ row, width, }) {
131
+ function DetailColumnRow({ row, width, selected = false, }) {
132
+ if (selected) {
133
+ return (_jsx(Text, { wrap: "truncate-end", color: termcnColors.selectionFg, backgroundColor: termcnColors.selectionBg, bold: true, children: padColumns(sliceColumns(row.label !== undefined
134
+ ? `${padColumns(row.label, detailLabelWidth())}${row.text}`
135
+ : row.text, 0, width), width) }));
136
+ }
110
137
  if (row.label !== undefined) {
111
- const valueWidth = Math.max(1, width - DETAIL_LABEL_WIDTH);
112
- 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) })] }));
138
+ const valueWidth = Math.max(1, width - detailLabelWidth());
139
+ 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) })] }));
113
140
  }
114
141
  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) }));
115
142
  }
116
- function MasterDetailBody({ tagLines, listLines, peekLines, tagWidth, listWidth, peekWidth, tagActive, listActive, collectionHome = false, listActiveLineIndexes, listSelectedLineIndexes, detailRows, onTagLineClick, onListLineClick, onListScroll, }) {
143
+ function MasterDetailBody({ tagLines, listLines, peekLines, tagWidth, listWidth, peekWidth, tagActive, listActive, detailActive = false, detailActiveField, collectionHome = false, listActiveLineIndexes, listSelectedLineIndexes, detailRows, onTagLineClick, onListLineClick, onDetailLineClick, onListScroll, }) {
117
144
  const rows = Math.max(tagLines.length, listLines.length, peekLines.length, detailRows?.length ?? 0);
118
145
  const divided = collectionHome;
119
146
  const divider = divided ? '│' : '';
@@ -158,7 +185,14 @@ function MasterDetailBody({ tagLines, listLines, peekLines, tagWidth, listWidth,
158
185
  });
159
186
  const tagInteractive = onTagLineClick && (tagLines[index] ?? '').trim().length > 0;
160
187
  const listInteractive = onListLineClick && (listLines[index] ?? '').trim().length > 0;
161
- 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] ? (_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}`));
188
+ 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] ? ((() => {
189
+ const detailRow = detailRows[index];
190
+ const fieldSelected = detailActive &&
191
+ detailRow.field !== undefined &&
192
+ detailRow.field === detailActiveField;
193
+ const cell = (_jsx(DetailColumnRow, { row: detailRow, width: peekWidth, selected: fieldSelected }));
194
+ return onDetailLineClick && detailRow.field ? (_jsx(Clickable, { onClick: () => onDetailLineClick(index), children: cell })) : (cell);
195
+ })()) : (_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}`));
162
196
  }) }));
163
197
  }
164
198
  /**
@@ -236,12 +270,8 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
236
270
  const [choosingGroup, setChoosingGroup] = useAtom(browserGroupJumpAtom);
237
271
  const [updateCheck, setUpdateCheck] = useAtom(browserUpdateCheckAtom);
238
272
  const searching = filter.open;
239
- const selectedCollection = collection.filter((skill) => selected.has(skill.path));
273
+ const { selectedCollection, selectedProject, selectedGlobal, selectedProjectLocal, selectedGlobalLocal, } = browseSelectionSets(selected, { collection, projectGroups, globalGroups });
240
274
  const selectedUpdates = selectedCollection.filter((skill) => updateCheck.updates.has(skill.name));
241
- const selectedProject = project.filter((skill) => selected.has(skill.path));
242
- const selectedGlobal = globalGroups.flatMap((group) => group.skills.filter((skill) => selected.has(skill.path)));
243
- const selectedProjectLocal = project.filter((skill) => selected.has(skill.path) && !skill.fromCollection);
244
- const selectedGlobalLocal = globalGroups.flatMap((group) => group.skills.filter((skill) => selected.has(skill.path) && !skill.fromCollection));
245
275
  const { stdout } = useStdout();
246
276
  // Wide terminals keep the 3-column master-detail chrome even while filtering;
247
277
  // list rows still apply `query` inside the skill column.
@@ -259,25 +289,30 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
259
289
  const groupRows = useMemo(() => groupedRows(tabSkills, ''), [tabSkills]);
260
290
  const groups = groupRows.filter((row) => row.type === 'group');
261
291
  const tagOptions = useMemo(() => tagFilterOptions(tabSkills, groups), [groups, tabSkills]);
262
- const [tagFilter, setTagFilter] = useState(TAG_FILTER_ALL);
292
+ const [tagFilter, setTagFilter] = useAtom(browserTagFilterAtom);
263
293
  const [tagCursor, setTagCursor] = useState(0);
264
294
  const tagCursorRef = useRef(tagCursor);
265
295
  tagCursorRef.current = tagCursor;
296
+ /** Index into detailEditableFields(collection) while focus === 'detail'. */
297
+ const [detailFieldIndex, setDetailFieldIndex] = useState(0);
298
+ const detailFieldIndexRef = useRef(detailFieldIndex);
299
+ detailFieldIndexRef.current = detailFieldIndex;
266
300
  const masterDetailSkills = useMemo(() => skillsForTagFilter(tabSkills, tagFilter), [tabSkills, tagFilter]);
267
301
  const masterDetailRows = useMemo(() => flatRows(masterDetailSkills, query), [masterDetailSkills, query]);
268
302
  const listRows = useMasterDetail ? masterDetailRows : rows;
269
303
  const currentRow = listRows[cursor];
270
- const actionSkills = tab === 'project'
271
- ? selectedProject.length
272
- ? selectedProject
273
- : currentRow?.type === 'skill'
274
- ? [currentRow.skill]
275
- : []
276
- : [];
277
- const canOpenActions = !updatingSkillName &&
304
+ const actionSkills = projectActionSkills(tab, tab === 'global' ? selectedGlobal : selectedProject, currentRow?.type === 'skill' ? currentRow.skill : undefined);
305
+ const canMaterialize = !updatingSkillName &&
278
306
  focus === 'list' &&
307
+ tab === 'project' &&
279
308
  actionSkills.length > 0 &&
280
309
  actionSkills.every((skill) => skill.isReference);
310
+ const canInstallToAgents = !updatingSkillName &&
311
+ focus === 'list' &&
312
+ (tab === 'project' || tab === 'global') &&
313
+ actionSkills.length > 0 &&
314
+ actionSkills.every((skill) => isCrossAgentInstallable(skill));
315
+ const canOpenActions = canMaterialize || canInstallToAgents;
281
316
  const previousTab = useRef(tab);
282
317
  useEffect(() => {
283
318
  if (previousTab.current !== tab) {
@@ -365,11 +400,31 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
365
400
  const masterListOffset = useMasterDetail
366
401
  ? Math.max(0, Math.min(cursor - Math.floor(masterListVisibleHeight / 2), Math.max(0, listRows.length - masterListVisibleHeight)))
367
402
  : 0;
368
- const peekSkill = focus === 'list' && currentRow?.type === 'skill' ? currentRow.skill : undefined;
403
+ const peekSkill = (focus === 'list' || focus === 'detail') && currentRow?.type === 'skill'
404
+ ? currentRow.skill
405
+ : undefined;
406
+ const detailFields = detailEditableFields(tab === 'collection');
407
+ const activeDetailField = focus === 'detail' && detailFields.length
408
+ ? detailFields[Math.max(0, Math.min(detailFieldIndex, detailFields.length - 1))]
409
+ : undefined;
369
410
  useEffect(() => {
370
- if (focus === 'tags' && !useMasterDetail)
411
+ if ((focus === 'detail' || focus === 'tags') && !useMasterDetail)
371
412
  setFocus('list');
372
413
  }, [focus, useMasterDetail, setFocus]);
414
+ useEffect(() => {
415
+ if (focus === 'detail' && currentRow?.type !== 'skill')
416
+ setFocus('list');
417
+ }, [focus, currentRow, setFocus]);
418
+ // Project / global never own detail-column focus (preview only).
419
+ useEffect(() => {
420
+ if (focus === 'detail' && tab !== 'collection')
421
+ setFocus('list');
422
+ }, [focus, tab, setFocus]);
423
+ useEffect(() => {
424
+ if (detailFieldIndex >= detailFields.length && detailFields.length > 0) {
425
+ setDetailFieldIndex(detailFields.length - 1);
426
+ }
427
+ }, [detailFieldIndex, detailFields.length]);
373
428
  useInput((input, key) => {
374
429
  const live = navigationRef.current;
375
430
  const liveFocus = live?.focus ?? 'tabs';
@@ -377,9 +432,9 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
377
432
  if (input === '?') {
378
433
  void modal.open({
379
434
  footerItems: [
380
- { key: '↑↓', label: '移动' },
381
- { key: 'e', label: '展开' },
382
- { key: 'Esc', label: '关闭' },
435
+ { key: '↑↓', label: t('common.move') },
436
+ { key: 'e', label: t('common.expand') },
437
+ { key: 'Esc', label: t('common.close') },
383
438
  ],
384
439
  content: (close) => (_jsx(ShortcutHelpPanel, { onClose: () => close(undefined), maxBodyRows: 14 })),
385
440
  });
@@ -509,25 +564,86 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
509
564
  }
510
565
  return;
511
566
  }
567
+ // Right column: move among editable fields (标签 / 备注); Enter opens editor.
568
+ if (liveFocus === 'detail' || focus === 'detail') {
569
+ const detailRow = listRows[cursorRef.current];
570
+ const skill = detailRow?.type === 'skill' ? detailRow.skill : undefined;
571
+ const fields = detailEditableFields(tab === 'collection');
572
+ if (key.leftArrow)
573
+ return setFocus('list');
574
+ if (key.upArrow) {
575
+ if (!fields.length)
576
+ return;
577
+ setDetailFieldIndex((index) => Math.max(0, index - 1));
578
+ return;
579
+ }
580
+ if (key.downArrow) {
581
+ if (!fields.length)
582
+ return;
583
+ setDetailFieldIndex((index) => Math.min(fields.length - 1, index + 1));
584
+ return;
585
+ }
586
+ if (key.rightArrow)
587
+ return;
588
+ const field = fields[detailFieldIndexRef.current] ?? fields[0];
589
+ if (skill && field && (key.return || input.includes('\r') || input.includes('\n'))) {
590
+ if (field === 'tags')
591
+ return finish({ type: 'editTags', skill });
592
+ if (field === 'note')
593
+ return finish({ type: 'editNote', skill });
594
+ }
595
+ if (skill && tab === 'collection') {
596
+ if (input === 't')
597
+ return finish({ type: 'editTags', skill });
598
+ if (input === 'n')
599
+ return finish({ type: 'editNote', skill });
600
+ }
601
+ return;
602
+ }
512
603
  if ((navigationRef.current?.focus ?? focus) !== 'list')
513
604
  return;
514
605
  const row = listRows[cursorRef.current];
515
606
  if (input === 'm' && canOpenActions) {
516
607
  const skills = actionSkills;
517
- const scope = selectedProject.length
518
- ? `已选择 ${skills.length} 个技能`
519
- : `技能:${skills[0]?.name ?? ''}`;
608
+ const moreItems = [];
609
+ if (canMaterialize) {
610
+ moreItems.push({ id: 'materialize', label: t('browser.materializeAction') });
611
+ }
612
+ if (canInstallToAgents) {
613
+ moreItems.push({
614
+ id: 'installToAgents',
615
+ label: t('browser.installToAgentsAction'),
616
+ });
617
+ }
618
+ const runMore = (id) => {
619
+ if (id === 'materialize')
620
+ finish({ type: 'materialize', skills });
621
+ else if (tab === 'project' || tab === 'global') {
622
+ finish({ type: 'installToAgents', skills, scope: tab });
623
+ }
624
+ };
625
+ // Single available action: enter its flow directly (no intermediate menu).
626
+ if (moreItems.length === 1) {
627
+ const only = moreItems[0];
628
+ if (only)
629
+ runMore(only.id);
630
+ return;
631
+ }
632
+ const selectedAtTab = tab === 'global' ? selectedGlobal.length : selectedProject.length;
633
+ const scope = selectedAtTab
634
+ ? t('browser.selectedSkills', { count: skills.length })
635
+ : t('browser.skillLine', { names: skills[0]?.name ?? '' });
520
636
  void modal
521
637
  .open({
522
638
  footerItems: [
523
- { key: 'Enter', label: '确认' },
524
- { key: 'Esc', label: '取消' },
639
+ { key: 'Enter', label: t('common.confirm') },
640
+ { key: 'Esc', label: t('common.cancel') },
525
641
  ],
526
- content: (close) => (_jsx(MoreActionsPanel, { scope: scope, onConfirm: () => close(true), onCancel: () => close(false) })),
642
+ content: (close) => (_jsx(MoreActionsPanel, { scope: scope, items: moreItems, onSelect: (id) => close(id), onCancel: () => close(null) })),
527
643
  })
528
- .then((confirmed) => {
529
- if (confirmed)
530
- finish({ type: 'materialize', skills });
644
+ .then((id) => {
645
+ if (id)
646
+ runMore(id);
531
647
  });
532
648
  return;
533
649
  }
@@ -568,12 +684,12 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
568
684
  const skills = removableCollection;
569
685
  void modal
570
686
  .confirm({
571
- title: '删除收藏',
687
+ title: t('browser.removeCollectionTitle'),
572
688
  message: skills.length === 1
573
- ? `从收藏夹移除 ${skills[0]?.name ?? ''} 吗?`
574
- : `从收藏夹移除 ${skills.length} 个技能吗?`,
689
+ ? t('browser.removeCollectionOne', { name: skills[0]?.name ?? '' })
690
+ : t('browser.removeCollectionMany', { count: skills.length }),
575
691
  ...(skills.length > 1
576
- ? { details: [`技能:${skills.map((skill) => skill.name).join(', ')}`] }
692
+ ? { details: [t('browser.skillLine', { names: skills.map((skill) => skill.name).join(', ') })] }
577
693
  : {}),
578
694
  })
579
695
  .then((ok) => {
@@ -586,12 +702,12 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
586
702
  const skills = removableLocations;
587
703
  void modal
588
704
  .confirm({
589
- title: '删除技能',
705
+ title: t('browser.removeLocationsTitle'),
590
706
  message: skills.length === 1
591
- ? `删除 ${skills[0]?.name ?? ''} 的当前位置吗?`
592
- : `删除所选 ${skills.length} 个技能位置吗?`,
707
+ ? t('browser.removeLocationOne', { name: skills[0]?.name ?? '' })
708
+ : t('browser.removeLocationsMany', { count: skills.length }),
593
709
  details: [
594
- '将永久删除以下位置;收藏夹内容(如有)保留。',
710
+ t('browser.removeLocationsHint'),
595
711
  ...skills.map((skill) => skill.path),
596
712
  ],
597
713
  })
@@ -603,7 +719,22 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
603
719
  }
604
720
  const selectedLocal = tab === 'project' ? selectedProjectLocal : selectedGlobalLocal;
605
721
  if (input === 'i' && tab !== 'collection' && selectedLocal.length) {
606
- return finish({ type: 'import', skills: selectedLocal });
722
+ const skills = selectedLocal;
723
+ void modal
724
+ .confirm({
725
+ title: t('browser.importCollectionTitle'),
726
+ message: skills.length === 1
727
+ ? t('browser.importCollectionOne', { name: skills[0]?.name ?? '' })
728
+ : t('browser.importCollectionMany', { count: skills.length }),
729
+ ...(skills.length > 1
730
+ ? { details: [t('browser.skillLine', { names: skills.map((skill) => skill.name).join(', ') })] }
731
+ : {}),
732
+ })
733
+ .then((ok) => {
734
+ if (ok)
735
+ finish({ type: 'import', skills });
736
+ });
737
+ return;
607
738
  }
608
739
  if (key.leftArrow && useMasterDetail)
609
740
  return setFocus('tags');
@@ -628,13 +759,16 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
628
759
  return next;
629
760
  });
630
761
  }
631
- // 3-column layout peeks detail in the right pane — neither → nor Enter
632
- // open fullscreen there (narrow list keeps → / Enter as before).
633
- if (key.rightArrow && row?.type === 'skill' && !useBrowseHome) {
634
- if (tab === 'collection')
635
- return openDetail(row.skill, true);
636
- if (row.skill.fromCollection)
762
+ // Collection only: wide → focuses detail column; narrow → opens fullscreen detail.
763
+ // Project / global: right pane is preview only — no → focus/open detail.
764
+ if (key.rightArrow && row?.type === 'skill' && tab === 'collection') {
765
+ if (useMasterDetail) {
766
+ setDetailFieldIndex(0);
767
+ return setFocus('detail');
768
+ }
769
+ if (!useBrowseHome) {
637
770
  return openDetail(row.skill, true);
771
+ }
638
772
  }
639
773
  if (key.return || input.includes('\r') || input.includes('\n')) {
640
774
  if (tab === 'collection' && selectedCollection.length) {
@@ -686,7 +820,7 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
686
820
  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);
687
821
  const detailRows = browseDetailRows(peekSkill, peekWidth, viewportHeight, options.collection ?? false, options.updates ?? new Set(), options.updatingSkillName, updatingFrame);
688
822
  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) }) })] }));
689
- 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, onTagLineClick: (visibleIndex) => {
823
+ 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) => {
690
824
  const absolute = tagOffset + visibleIndex;
691
825
  if (absolute < 0 || absolute >= tagOptions.length)
692
826
  return;
@@ -721,6 +855,15 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
721
855
  }
722
856
  return next;
723
857
  });
858
+ }, onDetailLineClick: (visibleIndex) => {
859
+ const row = detailRows[visibleIndex];
860
+ if (!row?.field)
861
+ return;
862
+ const index = detailFields.indexOf(row.field);
863
+ if (index < 0)
864
+ return;
865
+ setDetailFieldIndex(index);
866
+ setFocus('detail');
724
867
  }, onListScroll: (delta) => {
725
868
  setFocus('list');
726
869
  setCursor((index) => Math.max(0, Math.min(Math.max(0, paneRows.length - 1), index + delta)));
@@ -754,7 +897,7 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
754
897
  const tabs = [
755
898
  {
756
899
  key: 'project',
757
- label: `当前项目 ${project.length}`,
900
+ label: t('browser.tabProject', { count: project.length }),
758
901
  content: (_jsxs("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleProjectGroups, agent: activeProjectAgent, focused: !shellBusy && !searching && focus === 'agents', onSelect: (name) => {
759
902
  setAgent(name);
760
903
  setCursor(0);
@@ -766,7 +909,7 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
766
909
  },
767
910
  {
768
911
  key: 'global',
769
- label: `全局 ${globalGroups.reduce((count, group) => count + group.skills.length, 0)}`,
912
+ label: t('browser.tabGlobal', { count: globalGroups.reduce((count, group) => count + group.skills.length, 0) }),
770
913
  content: (_jsxs("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: [_jsx(AgentTabs, { groups: visibleGlobalGroups, agent: activeGlobalAgent, focused: !shellBusy && !searching && focus === 'agents', onSelect: (name) => {
771
914
  setAgent(name);
772
915
  setCursor(0);
@@ -777,7 +920,7 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
777
920
  },
778
921
  {
779
922
  key: 'collection',
780
- label: `收藏夹 ${collection.length}`,
923
+ label: t('browser.tabCollection', { count: collection.length }),
781
924
  content: (_jsx("box", { flexDirection: "column", minHeight: frame.frameHeight - 1, children: renderBrowsePane(listRows, browseViewportHeight(false), {
782
925
  preferNote: true,
783
926
  collection: true,
@@ -788,7 +931,7 @@ export function Browser({ projectGroups, collection, globalGroups, canSync, chec
788
931
  },
789
932
  ];
790
933
  if (choosingGroup) {
791
- return (_jsx(Select, { label: "\u8DF3\u8F6C\u5230\u5206\u7EC4\uFF1A", numbered: true, options: groups.map((group) => ({
934
+ return (_jsx(Select, { label: t('browser.jumpToGroup'), numbered: true, options: groups.map((group) => ({
792
935
  label: `${group.name} (${group.skills.length})`,
793
936
  value: group.name,
794
937
  })), onSubmit: (name) => {