-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathindex.js
More file actions
77 lines (69 loc) · 2.12 KB
/
index.js
File metadata and controls
77 lines (69 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import { readFileSync, readdirSync, existsSync } from "fs";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/**
* Get the path to the skills directory
*/
export function getSkillsPath() {
return join(__dirname, "skills");
}
/**
* Get the path to the templates directory
*/
export function getTemplatesPath() {
return join(__dirname, "templates");
}
/**
* List all available skills
*/
export function listSkills() {
const skillsPath = getSkillsPath();
const skills = readdirSync(skillsPath, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
return skills;
}
/**
* Get a skill's content by name
*/
export function getSkill(skillName) {
const skillPath = join(getSkillsPath(), skillName, "SKILL.md");
if (!existsSync(skillPath)) {
throw new Error(`Skill not found: ${skillName}`);
}
return readFileSync(skillPath, "utf-8");
}
/**
* Get the path to a specific skill
*/
export function getSkillPath(skillName) {
return join(getSkillsPath(), skillName, "SKILL.md");
}
/**
* Available skills with descriptions
*/
export const SKILLS = {
"convex-best-practices":
"Guidelines for building production-ready Convex apps",
"convex-functions": "Writing queries, mutations, actions, and HTTP actions",
"convex-realtime": "Patterns for building reactive applications",
"convex-schema-validator": "Database schema definition and validation",
"convex-file-storage": "File upload, storage, and serving",
"convex-agents": "Building AI agents with Convex",
"convex-cron-jobs": "Scheduled functions and background tasks",
"convex-http-actions": "HTTP endpoints and webhook handling",
"convex-migrations": "Schema evolution and data migrations",
"convex-security-check": "Quick security audit checklist",
"convex-security-audit": "Deep security review patterns",
"convex-component-authoring": "Creating reusable Convex components",
};
export default {
getSkillsPath,
getTemplatesPath,
listSkills,
getSkill,
getSkillPath,
SKILLS,
};