ali-skills 0.1.2 → 0.1.3
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.
|
@@ -6,10 +6,17 @@ import { dirname, isAbsolute, join, normalize, resolve, sep } from "path";
|
|
|
6
6
|
import { homedir, tmpdir } from "os";
|
|
7
7
|
import { createHash } from "crypto";
|
|
8
8
|
import { mkdir, mkdtemp, readFile, rm, writeFile } from "fs/promises";
|
|
9
|
+
function stripGitSuffix(value) {
|
|
10
|
+
return value.replace(/\.git$/i, "");
|
|
11
|
+
}
|
|
9
12
|
function resolveSourceInput(source, options = {}) {
|
|
10
13
|
let resolved = source.replace(/\bgitlab\.alibaba-inc\.com\b/g, "code.alibaba-inc.com");
|
|
11
14
|
if (!options.github) {
|
|
12
|
-
|
|
15
|
+
const shorthandMatch = resolved.match(/^([^/]+)\/([^/]+)$/);
|
|
16
|
+
if (shorthandMatch && !resolved.includes(":") && !resolved.startsWith(".") && !resolved.startsWith("/")) {
|
|
17
|
+
const [, owner, repo] = shorthandMatch;
|
|
18
|
+
resolved = `https://${GITLAB_ACCOUNT.user}:${GITLAB_ACCOUNT.token}@code.alibaba-inc.com/${owner}/${stripGitSuffix(repo)}.git`;
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
if (/^https?:\/\/code\.alibaba-inc\.com\//.test(resolved) && !resolved.includes("@")) resolved = resolved.replace(/^(https?):\/\/code\.alibaba-inc\.com\//, `$1://${GITLAB_ACCOUNT.user}:${GITLAB_ACCOUNT.token}@code.alibaba-inc.com/`);
|
|
15
22
|
return resolved;
|
|
@@ -36,14 +43,14 @@ function getOwnerRepo(parsed) {
|
|
|
36
43
|
const sshMatch = parsed.url.match(/^git@[^:]+:(.+)$/);
|
|
37
44
|
if (sshMatch) {
|
|
38
45
|
let path = sshMatch[1];
|
|
39
|
-
path = path
|
|
46
|
+
path = stripGitSuffix(path);
|
|
40
47
|
if (path.includes("/")) return path;
|
|
41
48
|
return null;
|
|
42
49
|
}
|
|
43
50
|
if (!parsed.url.startsWith("http://") && !parsed.url.startsWith("https://")) return null;
|
|
44
51
|
try {
|
|
45
52
|
let path = new URL(parsed.url).pathname.slice(1);
|
|
46
|
-
path = path
|
|
53
|
+
path = stripGitSuffix(path);
|
|
47
54
|
if (path.includes("/")) return path;
|
|
48
55
|
} catch {}
|
|
49
56
|
return null;
|
|
@@ -165,7 +172,7 @@ function parseSource(input) {
|
|
|
165
172
|
const [, owner, repo, skillFilter] = atSkillMatch;
|
|
166
173
|
return {
|
|
167
174
|
type: "github",
|
|
168
|
-
url: `https://github.com/${owner}/${repo}.git`,
|
|
175
|
+
url: `https://github.com/${owner}/${stripGitSuffix(repo)}.git`,
|
|
169
176
|
skillFilter
|
|
170
177
|
};
|
|
171
178
|
}
|
|
@@ -174,7 +181,7 @@ function parseSource(input) {
|
|
|
174
181
|
const [, owner, repo, subpath] = shorthandMatch;
|
|
175
182
|
return {
|
|
176
183
|
type: "github",
|
|
177
|
-
url: `https://github.com/${owner}/${repo}.git`,
|
|
184
|
+
url: `https://github.com/${owner}/${stripGitSuffix(repo)}.git`,
|
|
178
185
|
subpath: subpath ? sanitizeSubpath(subpath) : subpath
|
|
179
186
|
};
|
|
180
187
|
}
|
|
@@ -1394,7 +1394,7 @@ var WellKnownProvider = class {
|
|
|
1394
1394
|
}
|
|
1395
1395
|
};
|
|
1396
1396
|
const wellKnownProvider = new WellKnownProvider();
|
|
1397
|
-
var version$1 = "2.1.
|
|
1397
|
+
var version$1 = "2.1.3";
|
|
1398
1398
|
const isCancelled$1 = (value) => typeof value === "symbol";
|
|
1399
1399
|
async function isSourcePrivate(source) {
|
|
1400
1400
|
const ownerRepo = parseOwnerRepo(source);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ali-skills",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "The open agent skills ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"author": "",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ali/cli-skills": "^2.1.
|
|
35
|
+
"@ali/cli-skills": "^2.1.3"
|
|
36
36
|
},
|
|
37
37
|
"bundleDependencies": [
|
|
38
38
|
"@ali/cli-skills"
|