@mockingbird_konwlage_cli/cli 1.0.1 → 1.1.0
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.
- package/index.js +16 -68
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -22,77 +22,25 @@ program
|
|
|
22
22
|
|
|
23
23
|
console.log(chalk.blue(`[Mockingbird] Installing skill '${slug}' for agent '${agent}'...`));
|
|
24
24
|
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// First, try to see if it matches our known internal mapping
|
|
29
|
-
const repoMap = {
|
|
30
|
-
"anthropic-skills": "anthropics/skills/main/skills",
|
|
31
|
-
"anthropics": "anthropics/skills/main/skills",
|
|
32
|
-
"awesome-copilot": "github/awesome-copilot/main/skills",
|
|
33
|
-
"github": "github/awesome-copilot/main/skills",
|
|
34
|
-
"google-gemini": "google-gemini/gemini-cli/main/.gemini/skills",
|
|
35
|
-
"gemini-cli": "google-gemini/gemini-cli/main/.gemini/skills",
|
|
36
|
-
"openai-skills": "openai/skills/main/skills",
|
|
37
|
-
"openai": "openai/skills/main/skills",
|
|
38
|
-
"playwright-skills": "microsoft/playwright/main/packages/playwright/src/skill",
|
|
39
|
-
"microsoft": "microsoft/playwright/main/packages/playwright/src/skill",
|
|
40
|
-
"pytorch-skills": "pytorch/pytorch/main/.claude/skills",
|
|
41
|
-
"pytorch": "pytorch/pytorch/main/.claude/skills",
|
|
42
|
-
"antfu-skills": "antfu/skills/main/skills",
|
|
43
|
-
"antfu": "antfu/skills/main/skills",
|
|
44
|
-
"dimillian-skills": "Dimillian/Skills/main",
|
|
45
|
-
"dimillian": "Dimillian/Skills/main",
|
|
46
|
-
"prompts-chat-skills": "f/prompts.chat/main/.windsurf/skills",
|
|
47
|
-
"f": "f/prompts.chat/main/.windsurf/skills",
|
|
48
|
-
"huggingface-skills": "huggingface/skills/main/skills",
|
|
49
|
-
"huggingface": "huggingface/skills/main/skills"
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
let urlsToTry = [];
|
|
53
|
-
|
|
54
|
-
if (slug.includes('/')) {
|
|
55
|
-
const parts = slug.split('/');
|
|
56
|
-
const prefix = parts[0];
|
|
57
|
-
const skillName = parts[1];
|
|
58
|
-
|
|
59
|
-
if (repoMap[prefix]) {
|
|
60
|
-
urlsToTry.push(`https://raw.githubusercontent.com/${repoMap[prefix]}/${skillName}/SKILL.md`);
|
|
61
|
-
// Also try master just in case the mapping branch is old
|
|
62
|
-
urlsToTry.push(`https://raw.githubusercontent.com/${repoMap[prefix].replace('/main/', '/master/')}/${skillName}/SKILL.md`);
|
|
63
|
-
} else {
|
|
64
|
-
// Generic fallback for org/repo/skillname
|
|
65
|
-
let filePath = parts.slice(2).join('/') || 'SKILL.md';
|
|
66
|
-
if (!filePath.endsWith('.md')) {
|
|
67
|
-
filePath += filePath ? '/SKILL.md' : 'SKILL.md';
|
|
68
|
-
}
|
|
69
|
-
urlsToTry.push(`https://raw.githubusercontent.com/${parts[0]}/${parts[1]}/main/${filePath}`);
|
|
70
|
-
urlsToTry.push(`https://raw.githubusercontent.com/${parts[0]}/${parts[1]}/master/${filePath}`);
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
urlsToTry.push(`https://raw.githubusercontent.com/mockingbird-ai/skills/main/${slug}/SKILL.md`);
|
|
74
|
-
urlsToTry.push(`https://raw.githubusercontent.com/mockingbird-ai/skills/master/${slug}/SKILL.md`);
|
|
75
|
-
}
|
|
25
|
+
// The Mockingbird Knowledge API URL
|
|
26
|
+
const API_BASE_URL = process.env.MOCKINGBIRD_API_URL || 'https://mockingbird.youmind.com';
|
|
27
|
+
const apiUrl = `${API_BASE_URL}/api/public/skills/raw/${slug}`;
|
|
76
28
|
|
|
77
29
|
let skillContent = null;
|
|
78
|
-
let successfulUrl = '';
|
|
79
|
-
|
|
80
|
-
for (const url of urlsToTry) {
|
|
81
|
-
try {
|
|
82
|
-
process.stdout.write(chalk.gray(`Probing: ${url} ... `));
|
|
83
|
-
const response = await axios.get(url, { timeout: 5000 });
|
|
84
|
-
skillContent = response.data;
|
|
85
|
-
successfulUrl = url;
|
|
86
|
-
console.log(chalk.green('OK'));
|
|
87
|
-
break;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.log(chalk.red('NOT FOUND'));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
30
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
31
|
+
try {
|
|
32
|
+
process.stdout.write(chalk.gray(`Fetching from Mockingbird API: ${apiUrl} ... `));
|
|
33
|
+
const response = await axios.get(apiUrl, { timeout: 10000 });
|
|
34
|
+
skillContent = response.data;
|
|
35
|
+
console.log(chalk.green('OK'));
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.log(chalk.red('NOT FOUND'));
|
|
38
|
+
console.error(chalk.red(`\n✖ Error: Failed to find SKILL.md for '${slug}' from Mockingbird Knowledge Base.`));
|
|
39
|
+
if (error.response && error.response.status === 404) {
|
|
40
|
+
console.error(chalk.gray(`The skill might not be registered or supported yet.`));
|
|
41
|
+
} else {
|
|
42
|
+
console.error(chalk.gray(`Details: ${error.message}`));
|
|
43
|
+
}
|
|
96
44
|
process.exit(1);
|
|
97
45
|
}
|
|
98
46
|
|