bfi-cli 0.1.24 → 0.1.26

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 (2) hide show
  1. package/dist/cli.mjs +25 -2
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -136,7 +136,30 @@ function parseSource(input) {
136
136
  const alias = SOURCE_ALIASES[input];
137
137
  if (alias) input = alias;
138
138
  const githubPrefixMatch = input.match(/^github:(.+)$/);
139
- if (githubPrefixMatch) return parseSource(appendFragmentRef(githubPrefixMatch[1], fragmentRef, fragmentSkillFilter));
139
+ if (githubPrefixMatch) {
140
+ const rest = githubPrefixMatch[1];
141
+ const atSkill = rest.match(/^([^/]+)\/([^/@]+)@(.+)$/);
142
+ if (atSkill && !rest.includes(":")) {
143
+ const [, owner, repo, skillFilter] = atSkill;
144
+ return {
145
+ type: "github",
146
+ url: `https://github.com/${owner}/${repo}.git`,
147
+ ...fragmentRef ? { ref: fragmentRef } : {},
148
+ skillFilter: fragmentSkillFilter || skillFilter
149
+ };
150
+ }
151
+ const shorthand = rest.match(/^([^/]+)\/([^/]+)(?:\/(.+?))?\/?$/);
152
+ if (shorthand && !rest.includes(":") && !rest.startsWith(".")) {
153
+ const [, owner, repo, subpath] = shorthand;
154
+ return {
155
+ type: "github",
156
+ url: `https://github.com/${owner}/${repo}.git`,
157
+ ...fragmentRef ? { ref: fragmentRef } : {},
158
+ subpath: subpath ? sanitizeSubpath(subpath) : subpath,
159
+ ...fragmentSkillFilter ? { skillFilter: fragmentSkillFilter } : {}
160
+ };
161
+ }
162
+ }
140
163
  const gitlabPrefixMatch = input.match(/^gitlab:(.+)$/);
141
164
  if (gitlabPrefixMatch) return parseSource(appendFragmentRef(`https://gitlab.com/${gitlabPrefixMatch[1]}`, fragmentRef, fragmentSkillFilter));
142
165
  const githubTreeWithPathMatch = input.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);
@@ -6970,7 +6993,7 @@ async function searchMarketplace(query) {
6970
6993
  if (skill.source) console.log(` ${DIM$8}来源:${skill.source}${RESET$8}`);
6971
6994
  if (installs) console.log(` ${CYAN}${installs}${RESET$8}`);
6972
6995
  console.log(` ${TEXT$7}https://skills.sh/${skill.id}${RESET$8}`);
6973
- if (skill.source) console.log(` ${DIM$8}安装:${TEXT$7}BFI_GIT_HOST=github.com bfi skills add ${skill.source}${RESET$8}`);
6996
+ if (skill.source) console.log(` ${DIM$8}安装:${TEXT$7}bfi skills add github:${skill.source}${RESET$8}`);
6974
6997
  console.log();
6975
6998
  }
6976
6999
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {