bfi-cli 0.1.44 → 0.1.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.
@@ -4,6 +4,13 @@ import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import os from "node:os";
6
6
  const CACHE_FILE = path.join(os.homedir(), ".bfi", "agents-cache.json");
7
+ function makeDetectInstalled(globalSkillsDir) {
8
+ return async () => {
9
+ if (!globalSkillsDir) return false;
10
+ const resolved = globalSkillsDir.startsWith("~/") ? path.join(os.homedir(), globalSkillsDir.slice(2)) : globalSkillsDir;
11
+ return fs.existsSync(resolved);
12
+ };
13
+ }
7
14
  function loadCache() {
8
15
  try {
9
16
  if (fs.existsSync(CACHE_FILE)) {
@@ -27,21 +34,25 @@ function saveCache(agents, maxUpdatedAt) {
27
34
  } catch {}
28
35
  }
29
36
  function mapToAgentConfig(a) {
37
+ const gsd = a.globalSkillsDir || void 0;
30
38
  return {
31
39
  name: a.name,
32
40
  displayName: a.displayName || a.name,
33
41
  skillsDir: a.skillsDir,
34
- globalSkillsDir: a.globalSkillsDir || void 0,
35
- detectInstalled: async () => false
42
+ globalSkillsDir: gsd,
43
+ sortOrder: typeof a.sortOrder === "number" ? a.sortOrder : 0,
44
+ detectInstalled: makeDetectInstalled(gsd)
36
45
  };
37
46
  }
38
47
  function mapCustomEntry(name, entry) {
48
+ const gsd = entry.globalSkillsDir || void 0;
39
49
  return {
40
50
  name,
41
51
  displayName: entry.displayName || name,
42
52
  skillsDir: entry.skillsDir,
43
- globalSkillsDir: entry.globalSkillsDir,
44
- detectInstalled: async () => false
53
+ globalSkillsDir: gsd,
54
+ sortOrder: 0,
55
+ detectInstalled: makeDetectInstalled(gsd)
45
56
  };
46
57
  }
47
58
  function parseLastModifiedHeader(headers) {
package/dist/cli.mjs CHANGED
@@ -3002,6 +3002,15 @@ async function selectAgentsInteractive(options) {
3002
3002
  const universalAgents = getUniversalAgents().filter(supportsGlobalFilter);
3003
3003
  const visibleUniversalAgents = getVisibleUniversalAgents().filter(supportsGlobalFilter);
3004
3004
  const otherAgents = getNonUniversalAgents().filter((agent) => agent !== "eve" && supportsGlobalFilter(agent));
3005
+ const sortByPriority = (a, b) => {
3006
+ const orderA = agents[a]?.sortOrder ?? 0;
3007
+ const orderB = agents[b]?.sortOrder ?? 0;
3008
+ if (orderA !== orderB) return orderA - orderB;
3009
+ return (agents[a]?.displayName || a).localeCompare(agents[b]?.displayName || b);
3010
+ };
3011
+ universalAgents.sort(sortByPriority);
3012
+ visibleUniversalAgents.sort(sortByPriority);
3013
+ otherAgents.sort(sortByPriority);
3005
3014
  const showAll = hasDetected ? false : true;
3006
3015
  const filteredUniversal = showAll ? visibleUniversalAgents : visibleUniversalAgents.filter((a) => installedSet.has(a));
3007
3016
  const universalSection = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {