@chakresh/kresh 0.1.0 → 0.1.2
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
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chakresh/kresh",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"bin": {
|
|
5
5
|
"kresh": "./src/index.js"
|
|
6
6
|
},
|
|
7
7
|
"type": "module",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"
|
|
9
|
+
"@chakresh/kresh": "^0.1.1",
|
|
10
10
|
"axios": "^1.6.8",
|
|
11
11
|
"chalk": "^5.3.0",
|
|
12
|
-
"
|
|
13
|
-
"inquirer": "^9.2.16"
|
|
12
|
+
"commander": "^11.1.0",
|
|
13
|
+
"inquirer": "^9.2.16",
|
|
14
|
+
"ora": "^8.0.1"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
14
18
|
}
|
|
15
19
|
}
|
package/src/commands/publish.js
CHANGED
|
@@ -6,7 +6,8 @@ import { logger } from '../utils/logger.js';
|
|
|
6
6
|
export async function publishSkill() {
|
|
7
7
|
logger.info("To publish an intelligence skill, please follow these steps:");
|
|
8
8
|
console.log(" 1. Create a markdown file named SKILL.md specifying agent instructions.");
|
|
9
|
-
|
|
9
|
+
const webUrl = process.env.KRESH_API_URL || 'https://kresh.vercel.app';
|
|
10
|
+
console.log(` 2. Open the publisher page: ${webUrl}/dashboard/publish`);
|
|
10
11
|
console.log(" 3. Enter the name, category, version, and upload or paste your SKILL.md content.");
|
|
11
12
|
console.log();
|
|
12
13
|
logger.success("Once published, anyone can install it with `kresh install <slug>`.");
|
package/src/commands/search.js
CHANGED
package/src/services/api.js
CHANGED
|
@@ -39,6 +39,20 @@ export async function removeLocalSkill(slug) {
|
|
|
39
39
|
try {
|
|
40
40
|
const targetDir = path.join(process.cwd(), 'skills', slug);
|
|
41
41
|
await fs.rm(targetDir, { recursive: true, force: true });
|
|
42
|
+
|
|
43
|
+
// Clean up empty parent directory (e.g. @username) if it becomes empty
|
|
44
|
+
if (slug.includes('/')) {
|
|
45
|
+
const parts = slug.split('/');
|
|
46
|
+
const parentDir = path.join(process.cwd(), 'skills', parts[0]);
|
|
47
|
+
try {
|
|
48
|
+
const files = await fs.readdir(parentDir);
|
|
49
|
+
if (files.length === 0) {
|
|
50
|
+
await fs.rmdir(parentDir);
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
// Ignore errors if directory is not empty or doesn't exist
|
|
54
|
+
}
|
|
55
|
+
}
|
|
42
56
|
return true;
|
|
43
57
|
} catch (error) {
|
|
44
58
|
console.error('Failed to remove skill files from the skills directory:', error);
|
|
@@ -63,15 +77,43 @@ export async function listLocalSkills() {
|
|
|
63
77
|
const skills = [];
|
|
64
78
|
for (const entry of entries) {
|
|
65
79
|
if (entry.isDirectory()) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
80
|
+
if (entry.name.startsWith('@')) {
|
|
81
|
+
// It's a user scope directory, scan subdirectories inside it
|
|
82
|
+
const scopeDir = path.join(skillsDir, entry.name);
|
|
83
|
+
let subEntries = [];
|
|
84
|
+
try {
|
|
85
|
+
subEntries = await fs.readdir(scopeDir, { withFileTypes: true });
|
|
86
|
+
} catch (e) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
for (const subEntry of subEntries) {
|
|
91
|
+
if (subEntry.isDirectory()) {
|
|
92
|
+
const scopedSlug = `${entry.name}/${subEntry.name}`;
|
|
93
|
+
const metadata = await readLocalSkillMetadata(scopedSlug);
|
|
94
|
+
if (metadata) {
|
|
95
|
+
skills.push({
|
|
96
|
+
slug: metadata.slug || scopedSlug,
|
|
97
|
+
installed: true,
|
|
98
|
+
version: metadata.version || metadata.currentVersion || 'unknown',
|
|
99
|
+
name: metadata.name || 'unknown',
|
|
100
|
+
description: metadata.description || ''
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
// Standard/global skill directory
|
|
107
|
+
const metadata = await readLocalSkillMetadata(entry.name);
|
|
108
|
+
if (metadata) {
|
|
109
|
+
skills.push({
|
|
110
|
+
slug: metadata.slug || entry.name,
|
|
111
|
+
installed: true,
|
|
112
|
+
version: metadata.version || metadata.currentVersion || 'unknown',
|
|
113
|
+
name: metadata.name || 'unknown',
|
|
114
|
+
description: metadata.description || ''
|
|
115
|
+
});
|
|
116
|
+
}
|
|
75
117
|
}
|
|
76
118
|
}
|
|
77
119
|
}
|