ali-skills 0.0.32 → 0.0.33
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.
|
@@ -448,7 +448,7 @@ function getBucUser() {
|
|
|
448
448
|
if (!auth.account) return null;
|
|
449
449
|
return {
|
|
450
450
|
username: auth.name || auth.account,
|
|
451
|
-
email: `${auth.account}@alibaba-inc.com`
|
|
451
|
+
email: auth.email || `${auth.account}@alibaba-inc.com`
|
|
452
452
|
};
|
|
453
453
|
} catch {
|
|
454
454
|
return null;
|
|
@@ -1902,6 +1902,14 @@ async function fetchAuditData(source, skillSlugs, sourceType, timeoutMs = 3e3) {
|
|
|
1902
1902
|
return null;
|
|
1903
1903
|
}
|
|
1904
1904
|
}
|
|
1905
|
+
let cachedUserParam;
|
|
1906
|
+
function getUserParam() {
|
|
1907
|
+
if (cachedUserParam === void 0) {
|
|
1908
|
+
const user = getCurrentUser();
|
|
1909
|
+
cachedUserParam = user ? JSON.stringify(user) : null;
|
|
1910
|
+
}
|
|
1911
|
+
return cachedUserParam;
|
|
1912
|
+
}
|
|
1905
1913
|
function track(data) {
|
|
1906
1914
|
if (!isEnabled()) return;
|
|
1907
1915
|
try {
|
|
@@ -1909,6 +1917,8 @@ function track(data) {
|
|
|
1909
1917
|
pendingCount++;
|
|
1910
1918
|
if (cliVersion) params.set("v", cliVersion);
|
|
1911
1919
|
if (isCI()) params.set("ci", "1");
|
|
1920
|
+
const userParam = getUserParam();
|
|
1921
|
+
if (userParam) params.set("user", userParam);
|
|
1912
1922
|
for (const [key, value] of Object.entries(data)) if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
1913
1923
|
const requestUrl = `${TELEMETRY_URL}?${params.toString()}`;
|
|
1914
1924
|
if (process.env.DEBUG) console.log("[Telemetry] request:", requestUrl);
|
|
@@ -2354,7 +2364,7 @@ function logSkillParseFailures(failures) {
|
|
|
2354
2364
|
if (f.hint) M.message(import_picocolors.default.yellow(` 提示: ${f.hint}`));
|
|
2355
2365
|
}
|
|
2356
2366
|
}
|
|
2357
|
-
var version$1 = "2.0.
|
|
2367
|
+
var version$1 = "2.0.34";
|
|
2358
2368
|
const isCancelled$1 = (value) => typeof value === "symbol";
|
|
2359
2369
|
function redactSensitiveText(text) {
|
|
2360
2370
|
return text.replace(/(https?:\/\/)([^/\s:@]+)(?::([^@/\s]*))?@/gi, "$1").replace(/([?&](?:private_token|access_token|token|api_key|access_key|secret|password)=)[^&\s]+/gi, "$1***");
|
|
@@ -2755,20 +2765,16 @@ async function handleWellKnownSkills(source, url, options, spinner) {
|
|
|
2755
2765
|
skillFiles[skill.installName] = skill.sourceUrl;
|
|
2756
2766
|
if (skill.description) skillDescriptions[skill.installName] = skill.description;
|
|
2757
2767
|
}
|
|
2758
|
-
if (await isSourcePrivate(sourceIdentifier) !== true) {
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
descriptions: JSON.stringify(skillDescriptions),
|
|
2769
|
-
...currentUser && { user: JSON.stringify(currentUser) }
|
|
2770
|
-
});
|
|
2771
|
-
}
|
|
2768
|
+
if (await isSourcePrivate(sourceIdentifier) !== true) track({
|
|
2769
|
+
event: "install",
|
|
2770
|
+
source: sourceIdentifier,
|
|
2771
|
+
skills: selectedSkills.map((s) => s.installName).join(","),
|
|
2772
|
+
agents: targetAgents.join(","),
|
|
2773
|
+
...installGlobally && { global: "1" },
|
|
2774
|
+
skillFiles: JSON.stringify(skillFiles),
|
|
2775
|
+
sourceType: "well-known",
|
|
2776
|
+
descriptions: JSON.stringify(skillDescriptions)
|
|
2777
|
+
});
|
|
2772
2778
|
if (successful.length > 0 && installGlobally) {
|
|
2773
2779
|
const successfulSkillNames = new Set(successful.map((r) => r.skill));
|
|
2774
2780
|
for (const skill of selectedSkills) if (successfulSkillNames.has(skill.installName)) try {
|
|
@@ -3329,25 +3335,7 @@ async function runAdd(args, options = {}) {
|
|
|
3329
3335
|
if (normalizedSource && trackableSkillNames.length > 0) {
|
|
3330
3336
|
const ownerRepo = parseOwnerRepo(normalizedSource);
|
|
3331
3337
|
if (ownerRepo) {
|
|
3332
|
-
if (await isRepoPrivate(ownerRepo.owner, ownerRepo.repo) === false) {
|
|
3333
|
-
const currentUser = getCurrentUser();
|
|
3334
|
-
track({
|
|
3335
|
-
event: "install",
|
|
3336
|
-
source: normalizedSource,
|
|
3337
|
-
skills: trackableSkillNames.join(","),
|
|
3338
|
-
agents: targetAgents.join(","),
|
|
3339
|
-
...installGlobally && { global: "1" },
|
|
3340
|
-
skillFiles: JSON.stringify(skillFiles),
|
|
3341
|
-
sourceType: effectiveSourceType,
|
|
3342
|
-
skillMdLastCommitAuthors: JSON.stringify(skillMdLastCommitAuthors),
|
|
3343
|
-
skillMdConfigAuthors: JSON.stringify(skillMdAuthors),
|
|
3344
|
-
descriptions: JSON.stringify(skillDescriptions),
|
|
3345
|
-
...currentUser && { user: JSON.stringify(currentUser) }
|
|
3346
|
-
});
|
|
3347
|
-
}
|
|
3348
|
-
} else {
|
|
3349
|
-
const currentUser = getCurrentUser();
|
|
3350
|
-
track({
|
|
3338
|
+
if (await isRepoPrivate(ownerRepo.owner, ownerRepo.repo) === false) track({
|
|
3351
3339
|
event: "install",
|
|
3352
3340
|
source: normalizedSource,
|
|
3353
3341
|
skills: trackableSkillNames.join(","),
|
|
@@ -3357,10 +3345,20 @@ async function runAdd(args, options = {}) {
|
|
|
3357
3345
|
sourceType: effectiveSourceType,
|
|
3358
3346
|
skillMdLastCommitAuthors: JSON.stringify(skillMdLastCommitAuthors),
|
|
3359
3347
|
skillMdConfigAuthors: JSON.stringify(skillMdAuthors),
|
|
3360
|
-
descriptions: JSON.stringify(skillDescriptions)
|
|
3361
|
-
...currentUser && { user: JSON.stringify(currentUser) }
|
|
3348
|
+
descriptions: JSON.stringify(skillDescriptions)
|
|
3362
3349
|
});
|
|
3363
|
-
}
|
|
3350
|
+
} else track({
|
|
3351
|
+
event: "install",
|
|
3352
|
+
source: normalizedSource,
|
|
3353
|
+
skills: trackableSkillNames.join(","),
|
|
3354
|
+
agents: targetAgents.join(","),
|
|
3355
|
+
...installGlobally && { global: "1" },
|
|
3356
|
+
skillFiles: JSON.stringify(skillFiles),
|
|
3357
|
+
sourceType: effectiveSourceType,
|
|
3358
|
+
skillMdLastCommitAuthors: JSON.stringify(skillMdLastCommitAuthors),
|
|
3359
|
+
skillMdConfigAuthors: JSON.stringify(skillMdAuthors),
|
|
3360
|
+
descriptions: JSON.stringify(skillDescriptions)
|
|
3361
|
+
});
|
|
3364
3362
|
}
|
|
3365
3363
|
if (successful.length > 0 && installGlobally && normalizedSource) {
|
|
3366
3364
|
const successfulSkillNames = new Set(successful.map((r) => r.skill));
|
|
@@ -5007,6 +5005,7 @@ function startLocalServer() {
|
|
|
5007
5005
|
const empId = url.searchParams.get("emp_id") || "";
|
|
5008
5006
|
const account = url.searchParams.get("account") || "";
|
|
5009
5007
|
const name = url.searchParams.get("name") || "";
|
|
5008
|
+
const email = url.searchParams.get("email") || "";
|
|
5010
5009
|
const privateToken = url.searchParams.get("private_token") || "";
|
|
5011
5010
|
const ssoRefreshToken = url.searchParams.get("sso_refresh_token") || "";
|
|
5012
5011
|
const expiresAt = url.searchParams.get("expires_at") || "0";
|
|
@@ -5163,6 +5162,7 @@ function startLocalServer() {
|
|
|
5163
5162
|
empId,
|
|
5164
5163
|
account,
|
|
5165
5164
|
name,
|
|
5165
|
+
email,
|
|
5166
5166
|
privateToken,
|
|
5167
5167
|
ssoRefreshToken,
|
|
5168
5168
|
expiresAt: parseInt(expiresAt, 10)
|
|
@@ -5231,11 +5231,12 @@ async function login(options) {
|
|
|
5231
5231
|
openBrowser$2(loginUrl);
|
|
5232
5232
|
console.log(`${TEXT$3}等待授权完成...${RESET$4}`);
|
|
5233
5233
|
try {
|
|
5234
|
-
const { empId, account, name, privateToken, ssoRefreshToken, expiresAt } = await waitForCallback();
|
|
5234
|
+
const { empId, account, name, email, privateToken, ssoRefreshToken, expiresAt } = await waitForCallback();
|
|
5235
5235
|
saveAuth({
|
|
5236
5236
|
empId,
|
|
5237
5237
|
account,
|
|
5238
5238
|
name,
|
|
5239
|
+
email,
|
|
5239
5240
|
gatewayUrl,
|
|
5240
5241
|
privateToken,
|
|
5241
5242
|
ssoRefreshToken,
|
|
@@ -5727,13 +5728,22 @@ const SUPPORTED_FLAGS = [
|
|
|
5727
5728
|
];
|
|
5728
5729
|
function showStaffHelp() {
|
|
5729
5730
|
console.log(`
|
|
5730
|
-
${BOLD$1}Usage:${RESET$3} ali-skills staff <workNo|nickName>
|
|
5731
|
+
${BOLD$1}Usage:${RESET$3} ali-skills staff <workNo|nickName> [options]
|
|
5732
|
+
|
|
5733
|
+
${BOLD$1}Options:${RESET$3}
|
|
5734
|
+
--workNo=<工号> 按工号查询
|
|
5735
|
+
--nickName=<花名> 按花名查询
|
|
5736
|
+
--name=<姓名> 按姓名查询
|
|
5737
|
+
--licenseNo=<证件号> 按证件号查询
|
|
5738
|
+
--workNoList=<工号1,工号2> 批量工号查询
|
|
5739
|
+
--format=<md|json> 输出格式(默认 md)
|
|
5731
5740
|
|
|
5732
5741
|
${BOLD$1}Examples:${RESET$3}
|
|
5733
5742
|
${DIM$3}$${RESET$3} ali-skills staff 000001
|
|
5734
5743
|
${DIM$3}$${RESET$3} ali-skills staff 花名
|
|
5735
5744
|
${DIM$3}$${RESET$3} ali-skills staff --name=姓名
|
|
5736
5745
|
${DIM$3}$${RESET$3} ali-skills staff --workNoList=000001,000002
|
|
5746
|
+
${DIM$3}$${RESET$3} ali-skills staff 000001 --format=json
|
|
5737
5747
|
`);
|
|
5738
5748
|
}
|
|
5739
5749
|
function parseStaffArgs(args) {
|
|
@@ -5842,6 +5852,10 @@ async function runStaff(args) {
|
|
|
5842
5852
|
console.error(`${RED$3}Error:${RESET$3} 登录态已过期,请执行: npx ali-skills login --reauth`);
|
|
5843
5853
|
process.exit(1);
|
|
5844
5854
|
}
|
|
5855
|
+
if (!(res.headers.get("content-type") ?? "").includes("application/json")) {
|
|
5856
|
+
console.error(`${RED$3}Error:${RESET$3} 服务端返回非 JSON 响应 (HTTP ${res.status}),可能是查询结果过多导致超时,请尝试更精确的查询条件`);
|
|
5857
|
+
process.exit(1);
|
|
5858
|
+
}
|
|
5845
5859
|
const json = await res.json();
|
|
5846
5860
|
if (!res.ok || !json.success) {
|
|
5847
5861
|
console.error(`${RED$3}Error:${RESET$3} ${json.error || `Request failed (${res.status})`}`);
|
|
@@ -5850,7 +5864,7 @@ async function runStaff(args) {
|
|
|
5850
5864
|
const records = json.data?.records ?? [];
|
|
5851
5865
|
track({
|
|
5852
5866
|
event: "staff",
|
|
5853
|
-
|
|
5867
|
+
query: parsed.param
|
|
5854
5868
|
});
|
|
5855
5869
|
if (records.length === 0) {
|
|
5856
5870
|
console.log(`${DIM$3}No results found.${RESET$3}`);
|
|
@@ -7079,7 +7093,7 @@ function showBanner() {
|
|
|
7079
7093
|
console.log(` ${DIM}$${RESET} ${TEXT}npx ali-skills check${RESET} ${DIM}Check for updates${RESET}`);
|
|
7080
7094
|
console.log(` ${DIM}$${RESET} ${TEXT}npx ali-skills update${RESET} ${DIM}Update all skills${RESET}`);
|
|
7081
7095
|
console.log();
|
|
7082
|
-
console.log(` ${DIM}$${RESET} ${TEXT}npx ali-skills staff ${DIM}<
|
|
7096
|
+
console.log(` ${DIM}$${RESET} ${TEXT}npx ali-skills staff ${DIM}<query>${RESET} ${DIM}Query staff info${RESET}`);
|
|
7083
7097
|
console.log();
|
|
7084
7098
|
console.log(` ${DIM}$${RESET} ${TEXT}npx ali-skills experimental_install${RESET} ${DIM}Restore from skills-lock.json${RESET}`);
|
|
7085
7099
|
console.log(` ${DIM}$${RESET} ${TEXT}npx ali-skills init ${DIM}[name]${RESET} ${DIM}Create a new skill${RESET}`);
|
|
@@ -7117,10 +7131,11 @@ ${BOLD}Project:${RESET}
|
|
|
7117
7131
|
init [name] Initialize a skill (creates <name>/SKILL.md or ./SKILL.md)
|
|
7118
7132
|
|
|
7119
7133
|
${BOLD}Staff:${RESET}
|
|
7120
|
-
staff <
|
|
7134
|
+
staff <query> Query employee info (auto-detect workNo or nickName)
|
|
7121
7135
|
staff --nickName=X Query by nick name
|
|
7122
7136
|
staff --name=X Query by real name
|
|
7123
7137
|
staff --workNoList=X Query by comma-separated work numbers
|
|
7138
|
+
staff --format=json Output as JSON (default: md)
|
|
7124
7139
|
|
|
7125
7140
|
${BOLD}Gateway:${RESET}
|
|
7126
7141
|
gateway 鉴权请求能力入口(login/logout/status/req)
|
|
@@ -7174,6 +7189,8 @@ ${BOLD}Examples:${RESET}
|
|
|
7174
7189
|
${DIM}$${RESET} ali-skills ls --json ${DIM}# JSON output${RESET}
|
|
7175
7190
|
${DIM}$${RESET} ali-skills find ${DIM}# interactive search${RESET}
|
|
7176
7191
|
${DIM}$${RESET} ali-skills find typescript ${DIM}# search by keyword${RESET}
|
|
7192
|
+
${DIM}$${RESET} ali-skills staff 工号 ${DIM}# query by workNo${RESET}
|
|
7193
|
+
${DIM}$${RESET} ali-skills staff 花名 ${DIM}# query by nickName${RESET}
|
|
7177
7194
|
${DIM}$${RESET} ali-skills check
|
|
7178
7195
|
${DIM}$${RESET} ali-skills check web-design react-best-practices
|
|
7179
7196
|
${DIM}$${RESET} ali-skills update
|
|
@@ -8329,6 +8346,7 @@ async function main() {
|
|
|
8329
8346
|
}
|
|
8330
8347
|
}
|
|
8331
8348
|
main().then(async () => {
|
|
8349
|
+
await flushTelemetry();
|
|
8332
8350
|
if (getPendingTelemetryCount() > 0) {
|
|
8333
8351
|
const syncStartAt = Date.now();
|
|
8334
8352
|
const longSyncThresholdMs = 800;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ali-skills",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"description": "The open agent skills ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"author": "",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ali/cli-skills": "^2.0.
|
|
34
|
+
"@ali/cli-skills": "^2.0.34"
|
|
35
35
|
},
|
|
36
36
|
"bundleDependencies": [
|
|
37
37
|
"@ali/cli-skills"
|