heymark 1.2.0 → 2.0.1

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.
@@ -0,0 +1,58 @@
1
+ const path = require("path");
2
+ const { writeConfig } = require("@/skill-repo/config-file");
3
+ const { SKILL_REPO_DEFAULT_BRANCH } = require("@/skill-repo/constants");
4
+ const branch = require("@/commands/link/flags/branch");
5
+ const folder = require("@/commands/link/flags/folder");
6
+
7
+ function parseFlags(flags, handlers) {
8
+ const result = {};
9
+ for (let i = 0; i < flags.length; i++) {
10
+ const flag = flags[i];
11
+ const handler = handlers.find((h) => h.is(flag));
12
+ if (handler) {
13
+ const parsed = handler.parse(flags, i);
14
+ result[handler.key] = parsed.value;
15
+ i += parsed.advance;
16
+ continue;
17
+ }
18
+ console.error(`[Error] Unknown flag: ${flag}`);
19
+ process.exit(1);
20
+ }
21
+ return result;
22
+ }
23
+
24
+ function parseConfig(flags) {
25
+ const repoUrl = flags[0];
26
+ if (!repoUrl || repoUrl.startsWith("--")) {
27
+ console.error(
28
+ "[Error] Provide a repo URL. Example: heymark link https://github.com/org/repo.git"
29
+ );
30
+ process.exit(1);
31
+ }
32
+
33
+ const parsed = parseFlags(flags.slice(1), [branch, folder]);
34
+
35
+ return {
36
+ repoUrl: repoUrl.trim(),
37
+ branch: parsed.branch || SKILL_REPO_DEFAULT_BRANCH,
38
+ folder: parsed.folder || "",
39
+ };
40
+ }
41
+
42
+ function runLink(flags, context) {
43
+ const config = parseConfig(flags);
44
+ const configPath = writeConfig(context.cwd, config);
45
+
46
+ console.log(`[Link] Saved to ${path.relative(context.cwd, configPath) || configPath}`);
47
+ console.log(` repo: ${config.repoUrl}`);
48
+ if (config.branch !== SKILL_REPO_DEFAULT_BRANCH) {
49
+ console.log(` branch: ${config.branch}`);
50
+ }
51
+ if (config.folder) {
52
+ console.log(` folder: ${config.folder}`);
53
+ }
54
+ }
55
+
56
+ module.exports = {
57
+ runLink,
58
+ };
@@ -0,0 +1,35 @@
1
+ const ALL_TOOLS_TOKEN = ".";
2
+
3
+ function selectTools(flags, availableTools) {
4
+ const availableToolKeys = Object.keys(availableTools);
5
+ if (flags.length === 0) {
6
+ return availableToolKeys;
7
+ }
8
+
9
+ if (flags.some((tool) => tool.includes(","))) {
10
+ console.error("[Error] Use spaces between tools, not commas.");
11
+ process.exit(1);
12
+ }
13
+
14
+ if (flags.includes(ALL_TOOLS_TOKEN)) {
15
+ if (flags.length > 1) {
16
+ console.error("[Error] Use '.' alone for all tools.");
17
+ process.exit(1);
18
+ }
19
+ return availableToolKeys;
20
+ }
21
+
22
+ const invalid = flags.filter((tool) => !availableTools[tool]);
23
+ if (invalid.length > 0) {
24
+ console.error(
25
+ `[Error] Unknown: ${invalid.join(", ")}. Available: ${availableToolKeys.join(", ")}`
26
+ );
27
+ process.exit(1);
28
+ }
29
+
30
+ return Array.from(new Set(flags));
31
+ }
32
+
33
+ module.exports = {
34
+ selectTools,
35
+ };
@@ -0,0 +1,35 @@
1
+ const { cleaner } = require("@/commands/cleaner");
2
+ const { selectTools } = require("@/commands/select-tools");
3
+ const { readCache } = require("@/skill-repo/cache-folder");
4
+ const { readConfig } = require("@/skill-repo/config-file");
5
+ const { SKILL_REPO_DEFAULT_BRANCH } = require("@/skill-repo/constants");
6
+
7
+ function runSync(flags, context) {
8
+ const selectedTools = selectTools(flags, context.tools);
9
+ const { skills } = readCache(context.cwd);
10
+ const config = readConfig(context.cwd);
11
+
12
+ console.log("[Sync]");
13
+ if (config) {
14
+ console.log(` repo: ${config.repoUrl}`);
15
+ if (config.folder) console.log(` folder: ${config.folder}`);
16
+ if (config.branch !== SKILL_REPO_DEFAULT_BRANCH) console.log(` branch: ${config.branch}`);
17
+ }
18
+ console.log("");
19
+
20
+ const skillNames = skills.map((s) => s.name);
21
+ cleaner(context.tools, selectedTools, skillNames, context.cwd);
22
+
23
+ for (const toolKey of selectedTools) {
24
+ const tool = context.tools[toolKey];
25
+ const count = tool.generate(skills, context.cwd);
26
+ console.log(` ${tool.name.padEnd(16)} -> ${tool.output} (${count} skills)`);
27
+ }
28
+
29
+ console.log("");
30
+ console.log(`[Done] ${selectedTools.length} tools synced.`);
31
+ }
32
+
33
+ module.exports = {
34
+ runSync,
35
+ };
package/src/index.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ require("./alias.js");
4
+
5
+ const { COMMAND_LINK, COMMAND_SYNC, COMMAND_CLEAN, COMMAND_HELP } = require("@/commands/constants");
6
+ const { runLink } = require("@/commands/link");
7
+ const { runSync } = require("@/commands/sync");
8
+ const { runClean } = require("@/commands/clean");
9
+ const { runHelp } = require("@/commands/help");
10
+ const { loadTools } = require("@/tools/loader");
11
+
12
+ function main() {
13
+ const context = {
14
+ cwd: process.cwd(),
15
+ tools: loadTools(),
16
+ };
17
+
18
+ const args = process.argv.slice(2);
19
+
20
+ if (args.length === 0) {
21
+ runHelp([], context);
22
+ return;
23
+ }
24
+
25
+ const command = args[0];
26
+ const flags = args.slice(1);
27
+
28
+ if (command === COMMAND_LINK) {
29
+ runLink(flags, context);
30
+ return;
31
+ }
32
+
33
+ if (command === COMMAND_SYNC) {
34
+ runSync(flags, context);
35
+ return;
36
+ }
37
+
38
+ if (command === COMMAND_CLEAN) {
39
+ runClean(flags, context);
40
+ return;
41
+ }
42
+
43
+ if (command === COMMAND_HELP) {
44
+ runHelp(flags, context);
45
+ return;
46
+ }
47
+
48
+ console.error(`[Error] Unknown command: ${command}. Run: heymark help`);
49
+ process.exit(1);
50
+ }
51
+
52
+ main();
@@ -0,0 +1,77 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { execSync } = require("child_process");
4
+ const { HEYMARK, SKILL_REPO_DEFAULT_BRANCH } = require("@/skill-repo/constants");
5
+ const { readConfig } = require("@/skill-repo/config-file");
6
+ const { readSkillFiles } = require("@/skill-repo/skill-file-parser");
7
+
8
+ function getCloneFolderPath(cwd, repoUrl) {
9
+ const name = repoUrl.trim().split("/").pop() || "repo";
10
+ const dirName = name.endsWith(".git") ? name.slice(0, -4) : name;
11
+ return path.join(cwd, HEYMARK.DIR, HEYMARK.CACHE_DIR, dirName);
12
+ }
13
+
14
+ function gitClone(cwd, dir, branch, repoUrl) {
15
+ execSync(`git clone --depth 1 --branch "${branch}" "${repoUrl}" "${dir}"`, {
16
+ stdio: "inherit",
17
+ cwd,
18
+ });
19
+ }
20
+
21
+ function gitPull(dir, branch) {
22
+ execSync(`git fetch origin && git checkout --quiet . && git pull --quiet origin "${branch}"`, {
23
+ stdio: "pipe",
24
+ cwd: dir,
25
+ });
26
+ }
27
+
28
+ function writeCache(cwd) {
29
+ const config = readConfig(cwd);
30
+ if (!config) {
31
+ console.error(
32
+ `[Error] Not linked. Run: heymark link <repo-url> (config: ${HEYMARK.DIR}/${HEYMARK.CONFIG_FILE})`
33
+ );
34
+ process.exit(1);
35
+ }
36
+
37
+ const branch = config.branch || SKILL_REPO_DEFAULT_BRANCH;
38
+ const cacheBase = path.join(cwd, HEYMARK.DIR, HEYMARK.CACHE_DIR);
39
+ const cloneFolderPath = getCloneFolderPath(cwd, config.repoUrl);
40
+
41
+ if (!fs.existsSync(cloneFolderPath)) {
42
+ fs.mkdirSync(cacheBase, { recursive: true });
43
+ try {
44
+ gitClone(cwd, cloneFolderPath, branch, config.repoUrl);
45
+ } catch {
46
+ console.error("[Error] Clone failed. Check repo access (SSH or token).");
47
+ process.exit(1);
48
+ }
49
+ } else {
50
+ try {
51
+ gitPull(cloneFolderPath, branch);
52
+ } catch {
53
+ // Continue with cached clone when fetch/pull fails.
54
+ }
55
+ }
56
+
57
+ return { config, cloneFolderPath };
58
+ }
59
+
60
+ function readCache(cwd) {
61
+ const { config, cloneFolderPath } = writeCache(cwd);
62
+
63
+ const folder = config.folder || "";
64
+ const skillsFolderPath = folder ? path.join(cloneFolderPath, folder) : cloneFolderPath;
65
+ if (!fs.existsSync(skillsFolderPath) || !fs.statSync(skillsFolderPath).isDirectory()) {
66
+ console.error(`[Error] Folder not found in repo: ${folder || "(root)"}`);
67
+ process.exit(1);
68
+ }
69
+
70
+ const skills = readSkillFiles(skillsFolderPath);
71
+
72
+ return { config, skillsFolderPath, skills };
73
+ }
74
+
75
+ module.exports = {
76
+ readCache,
77
+ };
@@ -0,0 +1,87 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { HEYMARK, SKILL_REPO_DEFAULT_BRANCH } = require("@/skill-repo/constants");
4
+
5
+ function getConfigFilePath(cwd) {
6
+ return path.join(cwd, HEYMARK.DIR, HEYMARK.CONFIG_FILE);
7
+ }
8
+
9
+ function parseRawConfig(rawConfig) {
10
+ if (!rawConfig || typeof rawConfig !== "object") {
11
+ return null;
12
+ }
13
+
14
+ const raw = rawConfig;
15
+
16
+ const repoUrl =
17
+ typeof raw.repoUrl === "string" && raw.repoUrl.trim()
18
+ ? raw.repoUrl.trim()
19
+ : typeof raw.skillSource === "string" && raw.skillSource.trim()
20
+ ? raw.skillSource.trim()
21
+ : typeof raw.rulesSource === "string" && raw.rulesSource.trim()
22
+ ? raw.rulesSource.trim()
23
+ : "";
24
+
25
+ if (!repoUrl) {
26
+ return null;
27
+ }
28
+
29
+ const branch =
30
+ typeof raw.branch === "string" && raw.branch.trim()
31
+ ? raw.branch.trim()
32
+ : SKILL_REPO_DEFAULT_BRANCH;
33
+
34
+ const folder =
35
+ typeof raw.folder === "string"
36
+ ? raw.folder.trim()
37
+ : typeof raw.skillSourceDir === "string"
38
+ ? raw.skillSourceDir.trim()
39
+ : typeof raw.rulesSourceDir === "string"
40
+ ? raw.rulesSourceDir.trim()
41
+ : "";
42
+
43
+ return { repoUrl, branch, folder };
44
+ }
45
+
46
+ function writeConfig(cwd, config) {
47
+ const dir = path.join(cwd, HEYMARK.DIR);
48
+ if (!fs.existsSync(dir)) {
49
+ fs.mkdirSync(dir, { recursive: true });
50
+ }
51
+
52
+ const data = parseRawConfig(config);
53
+ if (!data) {
54
+ throw new Error("Invalid config");
55
+ }
56
+
57
+ const filePath = getConfigFilePath(cwd);
58
+ const payload = {
59
+ repoUrl: data.repoUrl,
60
+ branch: data.branch || SKILL_REPO_DEFAULT_BRANCH,
61
+ };
62
+ if (data.folder) {
63
+ payload.folder = data.folder;
64
+ }
65
+
66
+ fs.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
67
+ return filePath;
68
+ }
69
+
70
+ function readConfig(cwd) {
71
+ const filePath = getConfigFilePath(cwd);
72
+ if (!fs.existsSync(filePath)) {
73
+ return null;
74
+ }
75
+
76
+ try {
77
+ const raw = fs.readFileSync(filePath, "utf8");
78
+ return parseRawConfig(JSON.parse(raw));
79
+ } catch {
80
+ return null;
81
+ }
82
+ }
83
+
84
+ module.exports = {
85
+ writeConfig,
86
+ readConfig,
87
+ };
@@ -0,0 +1,14 @@
1
+ const HEYMARK = {
2
+ DIR: ".heymark",
3
+ CONFIG_FILE: "config.json",
4
+ CACHE_DIR: "cache",
5
+ };
6
+
7
+ const SKILL_FILE_EXTENSION = ".md";
8
+ const SKILL_REPO_DEFAULT_BRANCH = "main";
9
+
10
+ module.exports = {
11
+ HEYMARK,
12
+ SKILL_FILE_EXTENSION,
13
+ SKILL_REPO_DEFAULT_BRANCH,
14
+ };
@@ -0,0 +1,79 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { SKILL_FILE_EXTENSION } = require("@/skill-repo/constants");
4
+
5
+ const FRONTMATTER_REGEX = /^---\r?\n([\s\S]+?)\r?\n---\r?\n?([\s\S]*)$/;
6
+
7
+ function parseFrontmatter(content) {
8
+ const match = content.match(FRONTMATTER_REGEX);
9
+ if (!match) {
10
+ return { metadata: {}, body: content.trim() };
11
+ }
12
+
13
+ const [, metadataBlock, body] = match;
14
+
15
+ const metadata = {};
16
+ metadataBlock.split(/\r?\n/).forEach((line) => {
17
+ const separatorIndex = line.indexOf(":");
18
+ if (separatorIndex === -1) return;
19
+
20
+ const key = line.slice(0, separatorIndex).trim();
21
+ let value = line.slice(separatorIndex + 1).trim();
22
+
23
+ if (
24
+ (value.startsWith('"') && value.endsWith('"')) ||
25
+ (value.startsWith("'") && value.endsWith("'"))
26
+ ) {
27
+ value = value.slice(1, -1);
28
+ }
29
+
30
+ if (value === "true") metadata[key] = true;
31
+ else if (value === "false") metadata[key] = false;
32
+ else metadata[key] = value;
33
+ });
34
+
35
+ return { metadata, body: body.trim() };
36
+ }
37
+
38
+ function readSkillFile(skillsDir, fileName) {
39
+ const filePath = path.join(skillsDir, fileName);
40
+ const raw = fs.readFileSync(filePath, "utf8");
41
+ const { metadata, body } = parseFrontmatter(raw);
42
+ const baseName = path.basename(fileName, SKILL_FILE_EXTENSION);
43
+
44
+ return {
45
+ fileName,
46
+ name: typeof metadata.name === "string" && metadata.name ? metadata.name : baseName,
47
+ description:
48
+ typeof metadata.description === "string" && metadata.description
49
+ ? metadata.description
50
+ : baseName,
51
+ globs: typeof metadata.globs === "string" ? metadata.globs : "",
52
+ alwaysApply: metadata.alwaysApply === true,
53
+ metadata,
54
+ body,
55
+ };
56
+ }
57
+
58
+ function readSkillFiles(skillsDir) {
59
+ if (!fs.existsSync(skillsDir)) {
60
+ console.error(`[Error] Skills folder not found: ${skillsDir}`);
61
+ process.exit(1);
62
+ }
63
+
64
+ const files = fs
65
+ .readdirSync(skillsDir)
66
+ .filter((fileName) => fileName.endsWith(SKILL_FILE_EXTENSION))
67
+ .sort();
68
+
69
+ if (files.length === 0) {
70
+ console.error(`[Error] No .md files in: ${skillsDir}`);
71
+ process.exit(1);
72
+ }
73
+
74
+ return files.map((fileName) => readSkillFile(skillsDir, fileName));
75
+ }
76
+
77
+ module.exports = {
78
+ readSkillFiles,
79
+ };
@@ -0,0 +1,33 @@
1
+ const { ANTIGRAVITY } = require("@/tools/constants");
2
+ const { generate, clean } = require("@/tools/skill-per-folder");
3
+
4
+ function createContent(skill) {
5
+ const frontmatterLines = [
6
+ "---",
7
+ `name: ${skill.name}`,
8
+ `description: "${skill.description}"`,
9
+ "---",
10
+ ];
11
+
12
+ return `${frontmatterLines.join("\n")}\n\n${skill.body}\n`;
13
+ }
14
+
15
+ module.exports = {
16
+ key: ANTIGRAVITY.KEY,
17
+ name: ANTIGRAVITY.NAME,
18
+ output: ANTIGRAVITY.OUTPUT_PATTERN,
19
+
20
+ generate(skills, cwd) {
21
+ return generate({
22
+ cwd,
23
+ dir: ANTIGRAVITY.SKILLS_DIR,
24
+ fileName: ANTIGRAVITY.SKILL_FILE_NAME,
25
+ skills,
26
+ createContent,
27
+ });
28
+ },
29
+
30
+ clean(skillNames, cwd) {
31
+ return clean(cwd, ANTIGRAVITY.SKILLS_DIR);
32
+ },
33
+ };
@@ -0,0 +1,33 @@
1
+ const { CLAUDE_CODE } = require("@/tools/constants");
2
+ const { generate, clean } = require("@/tools/skill-per-folder");
3
+
4
+ function createContent(skill) {
5
+ const frontmatterLines = [
6
+ "---",
7
+ `name: ${skill.name}`,
8
+ `description: "${skill.description}"`,
9
+ "---",
10
+ ];
11
+
12
+ return `${frontmatterLines.join("\n")}\n\n${skill.body}\n`;
13
+ }
14
+
15
+ module.exports = {
16
+ key: CLAUDE_CODE.KEY,
17
+ name: CLAUDE_CODE.NAME,
18
+ output: CLAUDE_CODE.OUTPUT_PATTERN,
19
+
20
+ generate(skills, cwd) {
21
+ return generate({
22
+ cwd,
23
+ dir: CLAUDE_CODE.SKILLS_DIR,
24
+ fileName: CLAUDE_CODE.SKILL_FILE_NAME,
25
+ skills,
26
+ createContent,
27
+ });
28
+ },
29
+
30
+ clean(skillNames, cwd) {
31
+ return clean(cwd, CLAUDE_CODE.SKILLS_DIR);
32
+ },
33
+ };
@@ -0,0 +1,33 @@
1
+ const { CODEX } = require("@/tools/constants");
2
+ const { generate, clean } = require("@/tools/skill-per-folder");
3
+
4
+ function createContent(skill) {
5
+ const frontmatterLines = [
6
+ "---",
7
+ `name: ${skill.name}`,
8
+ `description: "${skill.description}"`,
9
+ "---",
10
+ ];
11
+
12
+ return `${frontmatterLines.join("\n")}\n\n${skill.body}\n`;
13
+ }
14
+
15
+ module.exports = {
16
+ key: CODEX.KEY,
17
+ name: CODEX.NAME,
18
+ output: CODEX.OUTPUT_PATTERN,
19
+
20
+ generate(skills, cwd) {
21
+ return generate({
22
+ cwd,
23
+ dir: CODEX.SKILLS_DIR,
24
+ fileName: CODEX.SKILL_FILE_NAME,
25
+ skills,
26
+ createContent,
27
+ });
28
+ },
29
+
30
+ clean(skillNames, cwd) {
31
+ return clean(cwd, CODEX.SKILLS_DIR);
32
+ },
33
+ };
@@ -0,0 +1,44 @@
1
+ const path = require("path");
2
+
3
+ const ANTIGRAVITY = {
4
+ KEY: "antigravity",
5
+ NAME: "Antigravity",
6
+ SKILLS_DIR: path.join(".agent", "skills"),
7
+ SKILL_FILE_NAME: "SKILL.md",
8
+ OUTPUT_PATTERN: ".agent/skills/*/SKILL.md",
9
+ };
10
+
11
+ const CLAUDE_CODE = {
12
+ KEY: "claude-code",
13
+ NAME: "Claude Code",
14
+ SKILLS_DIR: path.join(".claude", "skills"),
15
+ SKILL_FILE_NAME: "SKILL.md",
16
+ OUTPUT_PATTERN: ".claude/skills/*/SKILL.md",
17
+ };
18
+
19
+ const CODEX = {
20
+ KEY: "codex",
21
+ NAME: "Codex",
22
+ SKILLS_DIR: path.join(".agents", "skills"),
23
+ SKILL_FILE_NAME: "SKILL.md",
24
+ OUTPUT_PATTERN: ".agents/skills/*/SKILL.md",
25
+ };
26
+
27
+ const COPILOT = {
28
+ KEY: "copilot",
29
+ NAME: "Copilot",
30
+ INSTRUCTIONS_DIR: path.join(".github", "instructions"),
31
+ FILE_SUFFIX: ".instructions.md",
32
+ DEFAULT_GLOB: "**",
33
+ OUTPUT_PATTERN: ".github/instructions/*.instructions.md",
34
+ };
35
+
36
+ const CURSOR = {
37
+ KEY: "cursor",
38
+ NAME: "Cursor",
39
+ SKILLS_DIR: path.join(".cursor", "rules"),
40
+ FILE_SUFFIX: ".mdc",
41
+ OUTPUT_PATTERN: ".cursor/rules/*.mdc",
42
+ };
43
+
44
+ module.exports = { ANTIGRAVITY, CLAUDE_CODE, CODEX, COPILOT, CURSOR };
@@ -0,0 +1,40 @@
1
+ const { COPILOT } = require("@/tools/constants");
2
+ const { generate, clean } = require("@/tools/skill-per-file");
3
+
4
+ function getFileName(skill) {
5
+ return `${skill.name}${COPILOT.FILE_SUFFIX}`;
6
+ }
7
+
8
+ function createContent(skill) {
9
+ const globs = skill.globs
10
+ ? skill.globs
11
+ .split(",")
12
+ .map((g) => g.trim())
13
+ .filter(Boolean)
14
+ : [];
15
+ const applyToLines = (globs.length > 0 ? globs : [COPILOT.DEFAULT_GLOB])
16
+ .map((glob) => ` - "${glob}"`)
17
+ .join("\n");
18
+ const header = `applyTo:\n${applyToLines}\n---`;
19
+ return `${header}\n\n${skill.body}\n`;
20
+ }
21
+
22
+ module.exports = {
23
+ key: COPILOT.KEY,
24
+ name: COPILOT.NAME,
25
+ output: COPILOT.OUTPUT_PATTERN,
26
+
27
+ generate(skills, cwd) {
28
+ return generate({
29
+ cwd,
30
+ dir: COPILOT.INSTRUCTIONS_DIR,
31
+ skills,
32
+ getFileName,
33
+ createContent,
34
+ });
35
+ },
36
+
37
+ clean(skillNames, cwd) {
38
+ return clean(cwd, COPILOT.INSTRUCTIONS_DIR);
39
+ },
40
+ };
@@ -0,0 +1,39 @@
1
+ const { CURSOR } = require("@/tools/constants");
2
+ const { generate, clean } = require("@/tools/skill-per-file");
3
+
4
+ function getFileName(skill) {
5
+ return `${skill.name}${CURSOR.FILE_SUFFIX}`;
6
+ }
7
+
8
+ function createContent(skill) {
9
+ const frontmatterLines = ["---", `description: "${skill.description}"`];
10
+
11
+ if (skill.globs) {
12
+ frontmatterLines.push(`globs: "${skill.globs}"`);
13
+ }
14
+
15
+ frontmatterLines.push(`alwaysApply: ${skill.alwaysApply}`);
16
+ frontmatterLines.push("---");
17
+
18
+ return `${frontmatterLines.join("\n")}\n\n${skill.body}\n`;
19
+ }
20
+
21
+ module.exports = {
22
+ key: CURSOR.KEY,
23
+ name: CURSOR.NAME,
24
+ output: CURSOR.OUTPUT_PATTERN,
25
+
26
+ generate(skills, cwd) {
27
+ return generate({
28
+ cwd,
29
+ dir: CURSOR.SKILLS_DIR,
30
+ skills,
31
+ getFileName,
32
+ createContent,
33
+ });
34
+ },
35
+
36
+ clean(skillNames, cwd) {
37
+ return clean(cwd, CURSOR.SKILLS_DIR);
38
+ },
39
+ };
@@ -0,0 +1,17 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const TOOLS_DIR = path.join(__dirname);
5
+
6
+ function loadTools() {
7
+ const tools = fs
8
+ .readdirSync(TOOLS_DIR)
9
+ .filter((name) => fs.statSync(path.join(TOOLS_DIR, name)).isDirectory())
10
+ .map((name) => require(path.join(TOOLS_DIR, name)));
11
+
12
+ return Object.fromEntries(tools.map((tool) => [tool.key, tool]));
13
+ }
14
+
15
+ module.exports = {
16
+ loadTools,
17
+ };