@unityclaw/skills 1.0.0

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/dist/index.cjs ADDED
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ executeSkill: () => executeSkill,
34
+ getClaudeSkillsDir: () => getClaudeSkillsDir,
35
+ getOpenClawSkillsDir: () => getOpenClawSkillsDir,
36
+ getSkillsDir: () => getSkillsDir,
37
+ installSkills: () => installSkills,
38
+ listSkills: () => listSkills,
39
+ parseSkill: () => parseSkill
40
+ });
41
+ module.exports = __toCommonJS(index_exports);
42
+ var import_child_process = require("child_process");
43
+ var import_promises = require("fs/promises");
44
+ var import_fs = require("fs");
45
+ var import_path = __toESM(require("path"), 1);
46
+ var import_meta = {};
47
+ function getSkillsDir() {
48
+ let currentDir;
49
+ try {
50
+ if (typeof import_meta !== "undefined" && import_meta.url) {
51
+ const { fileURLToPath } = require("url");
52
+ currentDir = import_path.default.dirname(fileURLToPath(import_meta.url));
53
+ } else if (typeof __dirname !== "undefined") {
54
+ currentDir = __dirname;
55
+ } else {
56
+ currentDir = process.cwd();
57
+ }
58
+ } catch {
59
+ currentDir = process.cwd();
60
+ }
61
+ let searchDir = currentDir;
62
+ const root = import_path.default.parse(searchDir).root;
63
+ while (searchDir !== root) {
64
+ try {
65
+ const entries = (0, import_fs.readdirSync)(searchDir);
66
+ const hasSkills = entries.some((e) => /^unityclaw-/.test(e) || /^unityclaw-/.test(e));
67
+ if (hasSkills) {
68
+ return searchDir;
69
+ }
70
+ } catch {
71
+ }
72
+ searchDir = import_path.default.dirname(searchDir);
73
+ }
74
+ return import_path.default.dirname(currentDir);
75
+ }
76
+ async function parseSkill(skillPath) {
77
+ try {
78
+ const content = await (0, import_promises.readFile)(skillPath, "utf-8");
79
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
80
+ if (!frontmatterMatch) return null;
81
+ const frontmatter = frontmatterMatch[1];
82
+ const meta = {};
83
+ for (const line of frontmatter.split("\n")) {
84
+ const match = line.match(/^(\w+(?:\.\w+)*):\s*(.+)$/);
85
+ if (match) {
86
+ const [, key, value] = match;
87
+ if (key.includes(".")) {
88
+ const parts = key.split(".");
89
+ let current = meta;
90
+ for (let i = 0; i < parts.length - 1; i++) {
91
+ if (!current[parts[i]]) current[parts[i]] = {};
92
+ current = current[parts[i]];
93
+ }
94
+ current[parts[parts.length - 1]] = value.replace(/^["']|["']$/g, "");
95
+ } else {
96
+ meta[key] = value.replace(/^["']|["']$/g, "");
97
+ }
98
+ }
99
+ }
100
+ return meta;
101
+ } catch {
102
+ return null;
103
+ }
104
+ }
105
+ async function listSkills() {
106
+ const skillsDir = getSkillsDir();
107
+ const skills = [];
108
+ try {
109
+ const entries = await (0, import_promises.readdir)(skillsDir, { withFileTypes: true });
110
+ for (const entry of entries) {
111
+ if (!entry.isDirectory()) continue;
112
+ if (!entry.name.startsWith("unityclaw-") && !entry.name.startsWith("unityclaw-")) continue;
113
+ if (entry.name === "src" || entry.name === "dist" || entry.name === "node_modules") continue;
114
+ const skillFile = import_path.default.join(skillsDir, entry.name, "SKILL.md");
115
+ if ((0, import_fs.existsSync)(skillFile)) {
116
+ const meta = await parseSkill(skillFile);
117
+ skills.push({
118
+ name: entry.name,
119
+ path: skillFile,
120
+ meta
121
+ });
122
+ }
123
+ }
124
+ } catch (error) {
125
+ console.error("Error listing skills:", error);
126
+ }
127
+ return skills;
128
+ }
129
+ function getClaudeSkillsDir() {
130
+ const homeDir = process.env.HOME || process.env.USERPROFILE || "";
131
+ return import_path.default.join(homeDir, ".claude", "skills");
132
+ }
133
+ function getOpenClawSkillsDir() {
134
+ const homeDir = process.env.HOME || process.env.USERPROFILE || "";
135
+ return process.env.OPENCLAW_SKILLS_DIR || import_path.default.join(homeDir, ".openclaw", "skills");
136
+ }
137
+ async function installSkills(target, skills) {
138
+ const targetDir = target === "claude" ? getClaudeSkillsDir() : getOpenClawSkillsDir();
139
+ const skillsDir = getSkillsDir();
140
+ console.log(`Installing skills to ${target}...`);
141
+ console.log(`Target directory: ${targetDir}`);
142
+ if (!(0, import_fs.existsSync)(targetDir)) {
143
+ await (0, import_promises.mkdir)(targetDir, { recursive: true });
144
+ }
145
+ const availableSkills = await listSkills();
146
+ const skillsToInstall = skills && skills.length > 0 ? availableSkills.filter((s) => skills.includes(s.name)) : availableSkills;
147
+ if (skillsToInstall.length === 0) {
148
+ console.log("No skills to install.");
149
+ return;
150
+ }
151
+ console.log(`
152
+ Installing ${skillsToInstall.length} skill(s):
153
+ `);
154
+ for (const skill of skillsToInstall) {
155
+ const srcDir = import_path.default.join(skillsDir, skill.name);
156
+ const destDir = import_path.default.join(targetDir, skill.name);
157
+ try {
158
+ await (0, import_promises.cp)(srcDir, destDir, { recursive: true });
159
+ console.log(` \u2705 ${skill.name}${skill.meta ? ` - ${skill.meta.description}` : ""}`);
160
+ } catch (error) {
161
+ console.log(` \u274C ${skill.name} - Error: ${error}`);
162
+ }
163
+ }
164
+ console.log(`
165
+ \u2728 Done! Skills installed to: ${targetDir}`);
166
+ }
167
+ async function executeSkill(skillCommand) {
168
+ const fullCommand = `claude "${skillCommand}"`;
169
+ console.log(`Executing: ${fullCommand}
170
+ `);
171
+ return new Promise((resolve, reject) => {
172
+ const child = (0, import_child_process.spawn)("claude", [skillCommand], {
173
+ stdio: "inherit",
174
+ shell: true
175
+ });
176
+ child.on("close", (code) => {
177
+ if (code === 0) {
178
+ resolve();
179
+ } else {
180
+ reject(new Error(`Command failed with code ${code}`));
181
+ }
182
+ });
183
+ child.on("error", (error) => {
184
+ reject(error);
185
+ });
186
+ });
187
+ }
188
+ // Annotate the CommonJS export names for ESM import in node:
189
+ 0 && (module.exports = {
190
+ executeSkill,
191
+ getClaudeSkillsDir,
192
+ getOpenClawSkillsDir,
193
+ getSkillsDir,
194
+ installSkills,
195
+ listSkills,
196
+ parseSkill
197
+ });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @unityclaw/skills
3
+ * UnityClaw Skills - Install and execute skills for Claude Code and OpenClaw
4
+ */
5
+ /** Skill metadata */
6
+ interface SkillMeta {
7
+ name: string;
8
+ description: string;
9
+ version: string;
10
+ metadata?: {
11
+ openclaw?: {
12
+ emoji?: string;
13
+ homepage?: string;
14
+ };
15
+ };
16
+ }
17
+ /** Get the skills directory */
18
+ declare function getSkillsDir(): string;
19
+ /** Parse skill markdown file and extract metadata */
20
+ declare function parseSkill(skillPath: string): Promise<SkillMeta | null>;
21
+ /** List all available skills */
22
+ declare function listSkills(): Promise<Array<{
23
+ name: string;
24
+ path: string;
25
+ meta: SkillMeta | null;
26
+ }>>;
27
+ /** Get Claude Code skills directory */
28
+ declare function getClaudeSkillsDir(): string;
29
+ /** Get OpenClaw skills directory */
30
+ declare function getOpenClawSkillsDir(): string;
31
+ /** Install skills to target directory */
32
+ declare function installSkills(target: 'claude' | 'openclaw', skills?: string[]): Promise<void>;
33
+ /** Execute a skill via Claude Code CLI */
34
+ declare function executeSkill(skillCommand: string): Promise<void>;
35
+
36
+ export { type SkillMeta, executeSkill, getClaudeSkillsDir, getOpenClawSkillsDir, getSkillsDir, installSkills, listSkills, parseSkill };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @unityclaw/skills
3
+ * UnityClaw Skills - Install and execute skills for Claude Code and OpenClaw
4
+ */
5
+ /** Skill metadata */
6
+ interface SkillMeta {
7
+ name: string;
8
+ description: string;
9
+ version: string;
10
+ metadata?: {
11
+ openclaw?: {
12
+ emoji?: string;
13
+ homepage?: string;
14
+ };
15
+ };
16
+ }
17
+ /** Get the skills directory */
18
+ declare function getSkillsDir(): string;
19
+ /** Parse skill markdown file and extract metadata */
20
+ declare function parseSkill(skillPath: string): Promise<SkillMeta | null>;
21
+ /** List all available skills */
22
+ declare function listSkills(): Promise<Array<{
23
+ name: string;
24
+ path: string;
25
+ meta: SkillMeta | null;
26
+ }>>;
27
+ /** Get Claude Code skills directory */
28
+ declare function getClaudeSkillsDir(): string;
29
+ /** Get OpenClaw skills directory */
30
+ declare function getOpenClawSkillsDir(): string;
31
+ /** Install skills to target directory */
32
+ declare function installSkills(target: 'claude' | 'openclaw', skills?: string[]): Promise<void>;
33
+ /** Execute a skill via Claude Code CLI */
34
+ declare function executeSkill(skillCommand: string): Promise<void>;
35
+
36
+ export { type SkillMeta, executeSkill, getClaudeSkillsDir, getOpenClawSkillsDir, getSkillsDir, installSkills, listSkills, parseSkill };
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import {
2
+ executeSkill,
3
+ getClaudeSkillsDir,
4
+ getOpenClawSkillsDir,
5
+ getSkillsDir,
6
+ installSkills,
7
+ listSkills,
8
+ parseSkill
9
+ } from "./chunk-KHQZYC3Y.js";
10
+ export {
11
+ executeSkill,
12
+ getClaudeSkillsDir,
13
+ getOpenClawSkillsDir,
14
+ getSkillsDir,
15
+ installSkills,
16
+ listSkills,
17
+ parseSkill
18
+ };
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@unityclaw/skills",
3
+ "version": "1.0.0",
4
+ "description": "UnityClaw Skills - Claude Code and OpenClaw skill definitions for AI-powered image/video generation, media analysis, and more",
5
+ "type": "module",
6
+ "bin": {
7
+ "unityclaw-skills": "./dist/cli.js"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "unityclaw-*/SKILL.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean",
23
+ "dev": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch",
24
+ "typecheck": "tsc --noEmit",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "keywords": [
28
+ "unityclaw",
29
+ "claude-code",
30
+ "openclaw",
31
+ "skills",
32
+ "ai",
33
+ "image-generation",
34
+ "video-generation",
35
+ "media-analysis"
36
+ ],
37
+ "author": "UnityClaw",
38
+ "license": "MIT",
39
+ "dependencies": {
40
+ "commander": "^12.0.0",
41
+ "fs-extra": "^11.2.0",
42
+ "chalk": "^5.3.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/fs-extra": "^11.0.4",
46
+ "@types/node": "^20.10.0",
47
+ "tsup": "^8.0.1",
48
+ "typescript": "^5.3.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=18.0.0"
52
+ },
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "https://github.com/unityclaw/sdk.git",
56
+ "directory": "packages/skills"
57
+ },
58
+ "homepage": "https://unityclaw.com"
59
+ }