myskill 1.2.2 → 1.2.3
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 +1 -1
- package/src/commands/convert.js +6 -0
- package/src/commands/create.js +3 -1
- package/src/commands/list.js +5 -1
- package/src/platforms/baseSchema.js +17 -0
- package/src/platforms/claude.js +2 -36
- package/src/platforms/copilot.js +24 -0
- package/src/platforms/index.js +4 -2
- package/src/utils/skills.js +15 -2
package/package.json
CHANGED
package/src/commands/convert.js
CHANGED
|
@@ -65,6 +65,12 @@ export async function convert(sourcePath, options = {}) {
|
|
|
65
65
|
} else if (targetPlatform.id === "claude") {
|
|
66
66
|
if (sourceFm["allowed-tools"])
|
|
67
67
|
newFm["allowed-tools"] = sourceFm["allowed-tools"];
|
|
68
|
+
} else if (targetPlatform.id === "copilot") {
|
|
69
|
+
if (sourceFm.license) newFm.license = sourceFm.license;
|
|
70
|
+
if (sourceFm.compatibility) newFm.compatibility = sourceFm.compatibility;
|
|
71
|
+
if (sourceFm.metadata) newFm.metadata = sourceFm.metadata;
|
|
72
|
+
if (sourceFm["allowed-tools"])
|
|
73
|
+
newFm["allowed-tools"] = sourceFm["allowed-tools"];
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
const newContent = generateSkill(newFm, markdownBody);
|
package/src/commands/create.js
CHANGED
|
@@ -168,7 +168,9 @@ export async function create(options = {}) {
|
|
|
168
168
|
const localBase =
|
|
169
169
|
answers.platform === "opencode"
|
|
170
170
|
? ".opencode/skill"
|
|
171
|
-
:
|
|
171
|
+
: answers.platform === "copilot"
|
|
172
|
+
? ".github/skills"
|
|
173
|
+
: `.${answers.platform}/skills`;
|
|
172
174
|
targetDir = path.join(process.cwd(), localBase, answers.name);
|
|
173
175
|
}
|
|
174
176
|
|
package/src/commands/list.js
CHANGED
|
@@ -25,7 +25,11 @@ export async function list(options = {}) {
|
|
|
25
25
|
const locations = [{ name: "Global", path: globalPath }];
|
|
26
26
|
|
|
27
27
|
const localBase =
|
|
28
|
-
platform.id === "opencode"
|
|
28
|
+
platform.id === "opencode"
|
|
29
|
+
? ".opencode/skill"
|
|
30
|
+
: platform.id === "copilot"
|
|
31
|
+
? ".github/skills"
|
|
32
|
+
: `.${platform.id}/skills`;
|
|
29
33
|
locations.push({
|
|
30
34
|
name: "Project",
|
|
31
35
|
path: path.join(process.cwd(), localBase),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const agentSkillsBaseSchema = z.object({
|
|
4
|
+
name: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.max(64)
|
|
8
|
+
.regex(
|
|
9
|
+
/^[a-z0-9]+(-[a-z0-9]+)*$/,
|
|
10
|
+
"Name must be lowercase alphanumeric with single hyphens, no start/end hyphen",
|
|
11
|
+
),
|
|
12
|
+
description: z.string().min(1).max(1024),
|
|
13
|
+
license: z.string().optional(),
|
|
14
|
+
compatibility: z.string().max(500).optional(),
|
|
15
|
+
metadata: z.record(z.string()).optional(),
|
|
16
|
+
"allowed-tools": z.union([z.string(), z.array(z.string())]).optional(),
|
|
17
|
+
});
|
package/src/platforms/claude.js
CHANGED
|
@@ -1,48 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
// We need to make this async or a function to read config
|
|
7
|
-
// But index.js exports static objects.
|
|
8
|
-
// Let's change the platforms to be functions or getters?
|
|
9
|
-
// This is a breaking change for internal architecture.
|
|
10
|
-
// Or we can load config synchronously? No, fs-extra is async.
|
|
11
|
-
// Best approach: Keep the export structure but make defaultPath a getter or load it once at startup.
|
|
12
|
-
// Since `bin/myskill.js` is async, we can initialize platforms there?
|
|
13
|
-
// Or just reading config synchronously if we must?
|
|
14
|
-
// Node.js supports top-level await in modules.
|
|
15
|
-
|
|
16
|
-
// Let's try top-level await for config loading since we are in ESM.
|
|
17
|
-
let config = {};
|
|
18
|
-
try {
|
|
19
|
-
// We can't easily do top level await here without fs/promises and maybe it slows down startup.
|
|
20
|
-
// Instead, let's make `defaultPath` a property we resolve when needed, or check config inside commands.
|
|
21
|
-
// BUT the prompt definitions and validation logic depend on platform definition.
|
|
22
|
-
// The path is mostly used in commands (create, list, etc).
|
|
23
|
-
// So let's change `defaultPath` to a function `getDefaultPath()`.
|
|
24
|
-
} catch (e) {}
|
|
25
|
-
|
|
26
|
-
// For now, I will modify the definitions to export functions or include a resolution helper.
|
|
27
|
-
// Actually, simplest is to just expose the hardcoded default as fallback,
|
|
28
|
-
// and utility function `getPlatformPath(platformId)` in `utils/config.js` or `platforms/index.js`.
|
|
4
|
+
import { agentSkillsBaseSchema } from "./baseSchema.js";
|
|
29
5
|
|
|
30
6
|
export const claude = {
|
|
31
7
|
id: "claude",
|
|
32
8
|
name: "Claude Code",
|
|
33
9
|
docsUrl: "https://code.claude.com/docs/en/skills",
|
|
34
10
|
defaultPath: path.join(os.homedir(), ".claude", "skills"),
|
|
35
|
-
schema:
|
|
36
|
-
name: z
|
|
37
|
-
.string()
|
|
38
|
-
.min(1)
|
|
39
|
-
.max(64)
|
|
40
|
-
.regex(
|
|
41
|
-
/^[a-z0-9-]+$/,
|
|
42
|
-
"Name must be lowercase alphanumeric with hyphens",
|
|
43
|
-
),
|
|
44
|
-
description: z.string().min(1).max(1024),
|
|
45
|
-
"allowed-tools": z.union([z.string(), z.array(z.string())]).optional(),
|
|
11
|
+
schema: agentSkillsBaseSchema.extend({
|
|
46
12
|
model: z.string().optional(),
|
|
47
13
|
context: z.enum(["fork"]).optional(),
|
|
48
14
|
agent: z.string().optional(),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import os from "os";
|
|
4
|
+
import { agentSkillsBaseSchema } from "./baseSchema.js";
|
|
5
|
+
|
|
6
|
+
export const copilot = {
|
|
7
|
+
id: "copilot",
|
|
8
|
+
name: "GitHub Copilot CLI",
|
|
9
|
+
docsUrl: "https://docs.github.com/copilot/concepts/agents/about-agent-skills",
|
|
10
|
+
defaultPath: path.join(os.homedir(), ".copilot", "skills"),
|
|
11
|
+
schema: agentSkillsBaseSchema,
|
|
12
|
+
prompts: [
|
|
13
|
+
{
|
|
14
|
+
type: "input",
|
|
15
|
+
name: "license",
|
|
16
|
+
message: "License (e.g., MIT):",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: "input",
|
|
20
|
+
name: "compatibility",
|
|
21
|
+
message: "Compatibility (e.g., github-copilot):",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
package/src/platforms/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { claude } from "./claude.js";
|
|
2
|
-
import {
|
|
2
|
+
import { copilot } from "./copilot.js";
|
|
3
3
|
import { codex } from "./codex.js";
|
|
4
4
|
import { gemini } from "./gemini.js";
|
|
5
|
+
import { opencode } from "./opencode.js";
|
|
5
6
|
import { getConfig } from "../utils/config.js";
|
|
6
7
|
|
|
7
8
|
export const platforms = {
|
|
8
9
|
claude,
|
|
9
|
-
|
|
10
|
+
copilot,
|
|
10
11
|
codex,
|
|
11
12
|
gemini,
|
|
13
|
+
opencode,
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
export function getPlatform(id) {
|
package/src/utils/skills.js
CHANGED
|
@@ -5,7 +5,6 @@ import { platforms, getPlatformPath } from "../platforms/index.js";
|
|
|
5
5
|
|
|
6
6
|
export function detectPlatform(frontmatter) {
|
|
7
7
|
if (
|
|
8
|
-
frontmatter["allowed-tools"] ||
|
|
9
8
|
frontmatter.context ||
|
|
10
9
|
frontmatter.hooks ||
|
|
11
10
|
frontmatter.agent ||
|
|
@@ -14,6 +13,16 @@ export function detectPlatform(frontmatter) {
|
|
|
14
13
|
return platforms.claude;
|
|
15
14
|
}
|
|
16
15
|
|
|
16
|
+
if (
|
|
17
|
+
frontmatter["allowed-tools"] &&
|
|
18
|
+
!frontmatter.context &&
|
|
19
|
+
!frontmatter.hooks &&
|
|
20
|
+
!frontmatter.agent &&
|
|
21
|
+
!frontmatter["user-invocable"]
|
|
22
|
+
) {
|
|
23
|
+
return platforms.copilot;
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
if (frontmatter.license || frontmatter.compatibility) {
|
|
18
27
|
return platforms.opencode;
|
|
19
28
|
}
|
|
@@ -78,7 +87,11 @@ export async function getAllInstalledSkills() {
|
|
|
78
87
|
for (const platform of Object.values(platforms)) {
|
|
79
88
|
const globalPath = await getPlatformPath(platform.id);
|
|
80
89
|
const localBase =
|
|
81
|
-
platform.id === "opencode"
|
|
90
|
+
platform.id === "opencode"
|
|
91
|
+
? ".opencode/skill"
|
|
92
|
+
: platform.id === "copilot"
|
|
93
|
+
? ".github/skills"
|
|
94
|
+
: `.${platform.id}/skills`;
|
|
82
95
|
const locations = [
|
|
83
96
|
{ name: "Global", path: globalPath },
|
|
84
97
|
{ name: "Project", path: path.join(process.cwd(), localBase) },
|