Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ _프롬프트 문맥에 맞는 Skill을 자동 로드하는 모습입니다._
| Copilot | `copilot` | `.github/instructions/*.instructions.md` |
| Codex | `codex` | `.agents/skills/*/SKILL.md` |
| Antigravity | `antigravity` | `.agent/skills/*/SKILL.md` |
| OpenClaw | `openclaw` | `~/.openclaw/skills/*/SKILL.md` |

## How to Use

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ _This shows Skills being automatically loaded based on prompt context._
| Copilot | `copilot` | `.github/instructions/*.instructions.md` |
| Codex | `codex` | `.agents/skills/*/SKILL.md` |
| Antigravity | `antigravity` | `.agent/skills/*/SKILL.md` |
| OpenClaw | `openclaw` | `~/.openclaw/skills/*/SKILL.md` |

## How to Use

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"claude-code",
"copilot",
"codex",
"antigravity"
"antigravity",
"openclaw"
],
"homepage": "https://github.com/MosslandOpenDevs/heymark#readme",
"bugs": {
Expand Down
10 changes: 9 additions & 1 deletion src/tools/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@ const CURSOR = {
OUTPUT_PATTERN: ".cursor/rules/*.mdc",
};

module.exports = { ANTIGRAVITY, CLAUDE_CODE, CODEX, COPILOT, CURSOR };
const OPENCLAW = {
KEY: "openclaw",
NAME: "OpenClaw",
SKILLS_DIR: path.join(".openclaw", "skills"),
SKILL_FILE_NAME: "SKILL.md",
OUTPUT_PATTERN: "~/.openclaw/skills/*/SKILL.md",
};

module.exports = { ANTIGRAVITY, CLAUDE_CODE, CODEX, COPILOT, CURSOR, OPENCLAW };
72 changes: 72 additions & 0 deletions src/tools/openclaw/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const fs = require("fs");
const path = require("path");
const os = require("os");
const { OPENCLAW } = require("@/tools/constants");

function createContent(skill) {
const frontmatterLines = [
"---",
`name: ${skill.name}`,
`description: "${skill.description}"`,
"---",
];

return `${frontmatterLines.join("\n")}\n\n${skill.body}\n`;
}

function getSkillsDir() {
return path.join(os.homedir(), OPENCLAW.SKILLS_DIR);
}

function generate(skills) {
const skillsDir = getSkillsDir();

for (const skill of skills) {
try {
const skillDir = path.join(skillsDir, skill.name);
fs.mkdirSync(skillDir, { recursive: true });
fs.writeFileSync(path.join(skillDir, OPENCLAW.SKILL_FILE_NAME), createContent(skill), "utf8");
} catch (err) {
const skillDir = path.join(skillsDir, skill.name);
throw new Error(`OpenClaw: failed to generate skill "${skill.name}" at ${skillDir}: ${err.message}`);
}
}

return skills.length;
}

function clean(skillNames) {
const skillsDir = getSkillsDir();
if (!fs.existsSync(skillsDir)) {
return [];
}

const cleanedPaths = [];
for (const skillName of skillNames) {
const skillDir = path.join(skillsDir, skillName);
if (!fs.existsSync(skillDir)) continue;

try {
fs.rmSync(skillDir, { recursive: true, force: true });
cleanedPaths.push(path.join(skillsDir, skillName));
} catch (err) {
throw new Error(`OpenClaw: failed to clean skill "${skillName}" at ${skillDir}: ${err.message}`);
}
}

return cleanedPaths;
}

module.exports = {
key: OPENCLAW.KEY,
name: OPENCLAW.NAME,
output: OPENCLAW.OUTPUT_PATTERN,

generate(skills) {
return generate(skills);
},

clean(skillNames) {
return clean(skillNames);
},
};