bfi-cli 0.1.46 → 0.1.55

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.
@@ -85,7 +85,15 @@ async function resolveAgents(api) {
85
85
  if (cache) remoteAgents = cache.agents.map(mapToAgentConfig);
86
86
  }
87
87
  if (shouldSaveCache && remoteAgents) saveCache(remoteAgents, newMaxUpdatedAt);
88
- if (remoteAgents) for (const agent of remoteAgents) merged.set(agent.name, agent);
88
+ if (remoteAgents) for (const agent of remoteAgents) {
89
+ const existing = merged.get(agent.name);
90
+ if (existing) merged.set(agent.name, {
91
+ ...agent,
92
+ showInUniversalList: existing.showInUniversalList,
93
+ showInUniversalPrompt: existing.showInUniversalPrompt
94
+ });
95
+ else merged.set(agent.name, agent);
96
+ }
89
97
  }
90
98
  const config = loadGlobalConfig();
91
99
  if (config?.customAgents) for (const [name, entry] of Object.entries(config.customAgents)) merged.set(name, mapCustomEntry(name, entry));
package/dist/cli.mjs CHANGED
@@ -352,11 +352,15 @@ async function searchMultiselect(options) {
352
352
  lines.push(`${icon} ${import_picocolors.default.bold(message)}`);
353
353
  if (state === "active") {
354
354
  if (lockedSection && lockedSection.items.length > 0) {
355
+ const maxVisible = lockedSection.maxVisibleItems;
356
+ const visibleLocked = maxVisible && maxVisible < lockedSection.items.length ? lockedSection.items.slice(0, maxVisible) : lockedSection.items;
357
+ const lockedRemaining = lockedSection.items.length - visibleLocked.length;
355
358
  lines.push(`${S_BAR}`);
356
359
  const lockedTitle = `${import_picocolors.default.bold(lockedSection.title)} ${import_picocolors.default.dim("── always included")}`;
357
360
  lines.push(`${S_BAR} ${S_BAR_H}${S_BAR_H} ${lockedTitle} ${S_BAR_H.repeat(12)}`);
358
- for (const item of lockedSection.items) lines.push(`${S_BAR} ${S_BULLET} ${import_picocolors.default.bold(item.label)}`);
359
- if (lockedSection.hiddenCount && lockedSection.hiddenCount > 0) lines.push(`${S_BAR} ${import_picocolors.default.dim(`...and ${lockedSection.hiddenCount} more`)}`);
361
+ for (const item of visibleLocked) lines.push(`${S_BAR} ${S_BULLET} ${import_picocolors.default.bold(item.label)}`);
362
+ if (lockedRemaining > 0) lines.push(`${S_BAR} ${import_picocolors.default.dim(`...and ${lockedRemaining} more`)}`);
363
+ else if (lockedSection.hiddenCount && lockedSection.hiddenCount > 0) lines.push(`${S_BAR} ${import_picocolors.default.dim(`...and ${lockedSection.hiddenCount} more`)}`);
360
364
  lines.push(`${S_BAR}`);
361
365
  lines.push(`${S_BAR} ${S_BAR_H}${S_BAR_H} ${import_picocolors.default.bold("Additional agents")} ${S_BAR_H.repeat(29)}`);
362
366
  }
@@ -2997,7 +3001,6 @@ async function selectAgentsInteractive(options) {
2997
3001
  try {
2998
3002
  installedAgents = await detectInstalledAgents();
2999
3003
  } catch {}
3000
- const hasDetected = installedAgents.length > 0;
3001
3004
  const installedSet = new Set(installedAgents);
3002
3005
  const universalAgents = getUniversalAgents().filter(supportsGlobalFilter);
3003
3006
  const visibleUniversalAgents = getVisibleUniversalAgents().filter(supportsGlobalFilter);
@@ -3011,54 +3014,33 @@ async function selectAgentsInteractive(options) {
3011
3014
  universalAgents.sort(sortByPriority);
3012
3015
  visibleUniversalAgents.sort(sortByPriority);
3013
3016
  otherAgents.sort(sortByPriority);
3014
- const showAll = hasDetected ? false : true;
3015
- const filteredUniversal = showAll ? visibleUniversalAgents : visibleUniversalAgents.filter((a) => installedSet.has(a));
3016
3017
  const universalSection = {
3017
- title: `共享目录 (.agents/skills) — ${showAll ? "全部" : `已检测到 ${filteredUniversal.length} 个`}`,
3018
- items: filteredUniversal.map((a) => ({
3018
+ title: `共享目录 (.agents/skills)${installedAgents.length > 0 ? ` — 已检测到 ${visibleUniversalAgents.filter((a) => installedSet.has(a)).length} 个` : ""}`,
3019
+ items: visibleUniversalAgents.map((a) => ({
3019
3020
  value: a,
3020
3021
  label: agents[a].displayName
3021
3022
  })),
3022
- hiddenCount: showAll ? universalAgents.length - visibleUniversalAgents.length : 0
3023
+ hiddenCount: universalAgents.length - visibleUniversalAgents.length,
3024
+ maxVisibleItems: 5
3023
3025
  };
3024
- const filteredOther = showAll ? otherAgents : otherAgents.filter((a) => installedSet.has(a));
3025
- const otherChoices = filteredOther.map((a) => ({
3026
+ const otherChoices = otherAgents.map((a) => ({
3026
3027
  value: a,
3027
3028
  label: agents[a].displayName,
3028
3029
  hint: options.global ? agents[a].globalSkillsDir : agents[a].skillsDir
3029
3030
  }));
3030
- if (!showAll && otherAgents.length > filteredOther.length) otherChoices.push({
3031
- value: "__show_all__",
3032
- label: `显示全部 ${otherAgents.length + universalAgents.length} 个 Agent...`,
3033
- hint: "包括未检测到的"
3034
- });
3035
- let lastSelected;
3031
+ let lastSelected = [];
3036
3032
  try {
3037
- lastSelected = await getLastSelectedAgents();
3033
+ lastSelected = await getLastSelectedAgents() || [];
3038
3034
  } catch {}
3039
3035
  const selected = await searchMultiselect({
3040
3036
  message: "请选择要安装到的 Agent:",
3041
3037
  items: otherChoices,
3042
- initialSelected: lastSelected ? lastSelected.filter((a) => otherAgents.includes(a) && !universalAgents.includes(a)) : [],
3038
+ initialSelected: [.../* @__PURE__ */ new Set([...installedAgents, ...lastSelected])].filter((a) => otherAgents.includes(a) && !universalAgents.includes(a)),
3043
3039
  lockedSection: universalSection
3044
3040
  });
3045
- if (!isCancelled(selected)) {
3046
- const selection = selected;
3047
- if (selection.includes("__show_all__")) {
3048
- const allSelected = [
3049
- ...selection.filter((s) => s !== "__show_all__"),
3050
- ...otherAgents.filter((a) => !installedSet.has(a)),
3051
- ...universalAgents.filter((a) => !installedSet.has(a))
3052
- ];
3053
- try {
3054
- await saveSelectedAgents(allSelected);
3055
- } catch {}
3056
- return [...new Set(allSelected)];
3057
- }
3058
- try {
3059
- await saveSelectedAgents(selection);
3060
- } catch {}
3061
- }
3041
+ if (!isCancelled(selected)) try {
3042
+ await saveSelectedAgents(selected);
3043
+ } catch {}
3062
3044
  return selected;
3063
3045
  }
3064
3046
  async function handleWellKnownSkills(source, url, options, spinner) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.46",
3
+ "version": "0.1.55",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {