natureco-cli 1.0.5 → 1.0.7
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/package.json +1 -1
- package/src/commands/ask.js +10 -1
- package/src/commands/skills.js +47 -18
- package/src/utils/skills.js +2 -1
package/package.json
CHANGED
package/src/commands/ask.js
CHANGED
|
@@ -2,6 +2,8 @@ const chalk = require('chalk');
|
|
|
2
2
|
const { getApiKey, getConfig } = require('../utils/config');
|
|
3
3
|
const { getBots, sendMessage } = require('../utils/api');
|
|
4
4
|
const { getSkillPrompts } = require('../utils/skills');
|
|
5
|
+
const { getMemoryPrompt } = require('../utils/memory');
|
|
6
|
+
const { getAgentsPrompt } = require('../utils/agents');
|
|
5
7
|
|
|
6
8
|
async function ask(question) {
|
|
7
9
|
const apiKey = getApiKey();
|
|
@@ -21,6 +23,13 @@ async function ask(question) {
|
|
|
21
23
|
|
|
22
24
|
// Skill prompts'ları yükle
|
|
23
25
|
const skillPrompts = getSkillPrompts();
|
|
26
|
+
const memoryPrompt = getMemoryPrompt(defaultBotId);
|
|
27
|
+
const agentsPrompt = getAgentsPrompt();
|
|
28
|
+
|
|
29
|
+
let systemPrompt = '';
|
|
30
|
+
if (skillPrompts) systemPrompt += skillPrompts;
|
|
31
|
+
if (agentsPrompt) systemPrompt += '\n\n' + agentsPrompt;
|
|
32
|
+
if (memoryPrompt) systemPrompt += '\n\n' + memoryPrompt;
|
|
24
33
|
|
|
25
34
|
// Loading animasyonu
|
|
26
35
|
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
@@ -32,7 +41,7 @@ async function ask(question) {
|
|
|
32
41
|
}, 80);
|
|
33
42
|
|
|
34
43
|
try {
|
|
35
|
-
const response = await sendMessage(apiKey, defaultBotId, question, null,
|
|
44
|
+
const response = await sendMessage(apiKey, defaultBotId, question, null, systemPrompt);
|
|
36
45
|
|
|
37
46
|
clearInterval(loadingInterval);
|
|
38
47
|
process.stdout.write('\r');
|
package/src/commands/skills.js
CHANGED
|
@@ -170,9 +170,8 @@ async function createSkillCommand(name) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
async function searchSkillsCommand(query) {
|
|
173
|
-
const popularSkills = getPopularSkills();
|
|
174
|
-
|
|
175
173
|
if (!query || query.trim().length === 0) {
|
|
174
|
+
const popularSkills = getPopularSkills();
|
|
176
175
|
console.log(chalk.yellow('\nPopüler Skill\'ler:\n'));
|
|
177
176
|
popularSkills.forEach(skill => {
|
|
178
177
|
console.log(chalk.cyan(` ${skill.name.padEnd(15)}`), chalk.gray(skill.description));
|
|
@@ -185,24 +184,54 @@ async function searchSkillsCommand(query) {
|
|
|
185
184
|
return;
|
|
186
185
|
}
|
|
187
186
|
|
|
188
|
-
|
|
189
|
-
const results = popularSkills.filter(skill =>
|
|
190
|
-
skill.name.toLowerCase().includes(query.toLowerCase()) ||
|
|
191
|
-
skill.description.toLowerCase().includes(query.toLowerCase()) ||
|
|
192
|
-
skill.slug.toLowerCase().includes(query.toLowerCase())
|
|
193
|
-
);
|
|
187
|
+
console.log(chalk.yellow(`\n⏳ "${query}" aranıyor...\n`));
|
|
194
188
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
189
|
+
try {
|
|
190
|
+
// ClawHub search API
|
|
191
|
+
const searchUrl = `https://clawhub.ai/api/skills?q=${encodeURIComponent(query)}&limit=10`;
|
|
192
|
+
const response = await fetch(searchUrl);
|
|
193
|
+
|
|
194
|
+
if (!response.ok) {
|
|
195
|
+
throw new Error('ClawHub API\'ye erişilemedi');
|
|
196
|
+
}
|
|
199
197
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
const data = await response.json();
|
|
199
|
+
const results = data.skills || [];
|
|
200
|
+
|
|
201
|
+
if (results.length === 0) {
|
|
202
|
+
console.log(chalk.yellow(`"${query}" için sonuç bulunamadı.\n`));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
console.log(chalk.yellow(`"${query}" için ${results.length} sonuç:\n`));
|
|
207
|
+
results.forEach(skill => {
|
|
208
|
+
console.log(chalk.cyan(` ${skill.name.padEnd(15)}`), chalk.gray(skill.description || 'Açıklama yok'));
|
|
209
|
+
console.log(chalk.gray(` Kurmak için: natureco skills install clawhub:${skill.slug}`));
|
|
210
|
+
});
|
|
211
|
+
console.log('');
|
|
212
|
+
} catch (err) {
|
|
213
|
+
// Fallback to local popular skills search
|
|
214
|
+
console.log(chalk.gray('ClawHub\'a bağlanılamadı, yerel aramada...\n'));
|
|
215
|
+
|
|
216
|
+
const popularSkills = getPopularSkills();
|
|
217
|
+
const results = popularSkills.filter(skill =>
|
|
218
|
+
skill.name.toLowerCase().includes(query.toLowerCase()) ||
|
|
219
|
+
skill.description.toLowerCase().includes(query.toLowerCase()) ||
|
|
220
|
+
skill.slug.toLowerCase().includes(query.toLowerCase())
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
if (results.length === 0) {
|
|
224
|
+
console.log(chalk.yellow(`"${query}" için sonuç bulunamadı.\n`));
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
console.log(chalk.yellow(`"${query}" için ${results.length} sonuç:\n`));
|
|
229
|
+
results.forEach(skill => {
|
|
230
|
+
console.log(chalk.cyan(` ${skill.name.padEnd(15)}`), chalk.gray(skill.description));
|
|
231
|
+
console.log(chalk.gray(` Kurmak için: natureco skills install ${skill.slug}`));
|
|
232
|
+
});
|
|
233
|
+
console.log('');
|
|
234
|
+
}
|
|
206
235
|
}
|
|
207
236
|
|
|
208
237
|
async function browseSkillsCommand() {
|
package/src/utils/skills.js
CHANGED
|
@@ -152,7 +152,7 @@ async function installSkill(slug) {
|
|
|
152
152
|
// ClawHub format: clawhub:github
|
|
153
153
|
if (slug.startsWith('clawhub:')) {
|
|
154
154
|
actualSlug = slug.replace('clawhub:', '');
|
|
155
|
-
url = `https://clawhub.ai/skills/${actualSlug}/SKILL.md`;
|
|
155
|
+
url = `https://clawhub.ai/api/v1/skills/${actualSlug}/file?path=SKILL.md`;
|
|
156
156
|
}
|
|
157
157
|
// Direct URL
|
|
158
158
|
else if (slug.startsWith('http://') || slug.startsWith('https://')) {
|
|
@@ -168,6 +168,7 @@ async function installSkill(slug) {
|
|
|
168
168
|
|
|
169
169
|
try {
|
|
170
170
|
const response = await fetch(url);
|
|
171
|
+
|
|
171
172
|
if (!response.ok) {
|
|
172
173
|
throw new Error(`Skill bulunamadı: ${actualSlug}`);
|
|
173
174
|
}
|