skillpkg-core 0.1.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/adapters/base.d.ts +48 -0
- package/dist/adapters/base.d.ts.map +1 -0
- package/dist/adapters/base.js +54 -0
- package/dist/adapters/base.js.map +1 -0
- package/dist/adapters/claude-code.d.ts +39 -0
- package/dist/adapters/claude-code.d.ts.map +1 -0
- package/dist/adapters/claude-code.js +172 -0
- package/dist/adapters/claude-code.js.map +1 -0
- package/dist/adapters/cline.d.ts +43 -0
- package/dist/adapters/cline.d.ts.map +1 -0
- package/dist/adapters/cline.js +157 -0
- package/dist/adapters/cline.js.map +1 -0
- package/dist/adapters/codex.d.ts +31 -0
- package/dist/adapters/codex.d.ts.map +1 -0
- package/dist/adapters/codex.js +117 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/copilot.d.ts +44 -0
- package/dist/adapters/copilot.d.ts.map +1 -0
- package/dist/adapters/copilot.js +183 -0
- package/dist/adapters/copilot.js.map +1 -0
- package/dist/adapters/index.d.ts +11 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +13 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/manager.d.ts +51 -0
- package/dist/adapters/manager.d.ts.map +1 -0
- package/dist/adapters/manager.js +147 -0
- package/dist/adapters/manager.js.map +1 -0
- package/dist/adapters/types.d.ts +93 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +2 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/exporter/exporter.d.ts +54 -0
- package/dist/exporter/exporter.d.ts.map +1 -0
- package/dist/exporter/exporter.js +303 -0
- package/dist/exporter/exporter.js.map +1 -0
- package/dist/exporter/index.d.ts +6 -0
- package/dist/exporter/index.d.ts.map +1 -0
- package/dist/exporter/index.js +6 -0
- package/dist/exporter/index.js.map +1 -0
- package/dist/exporter/types.d.ts +38 -0
- package/dist/exporter/types.d.ts.map +1 -0
- package/dist/exporter/types.js +5 -0
- package/dist/exporter/types.js.map +1 -0
- package/dist/importer/importer.d.ts +37 -0
- package/dist/importer/importer.d.ts.map +1 -0
- package/dist/importer/importer.js +204 -0
- package/dist/importer/importer.js.map +1 -0
- package/dist/importer/index.d.ts +6 -0
- package/dist/importer/index.d.ts.map +1 -0
- package/dist/importer/index.js +6 -0
- package/dist/importer/index.js.map +1 -0
- package/dist/importer/types.d.ts +43 -0
- package/dist/importer/types.d.ts.map +1 -0
- package/dist/importer/types.js +2 -0
- package/dist/importer/types.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/index.d.ts +23 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +24 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/parser.d.ts +64 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +121 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/schema.d.ts +155 -0
- package/dist/parser/schema.d.ts.map +1 -0
- package/dist/parser/schema.js +147 -0
- package/dist/parser/schema.js.map +1 -0
- package/dist/parser/validator.d.ts +38 -0
- package/dist/parser/validator.d.ts.map +1 -0
- package/dist/parser/validator.js +125 -0
- package/dist/parser/validator.js.map +1 -0
- package/dist/registry/auth.d.ts +38 -0
- package/dist/registry/auth.d.ts.map +1 -0
- package/dist/registry/auth.js +142 -0
- package/dist/registry/auth.js.map +1 -0
- package/dist/registry/client.d.ts +80 -0
- package/dist/registry/client.d.ts.map +1 -0
- package/dist/registry/client.js +238 -0
- package/dist/registry/client.js.map +1 -0
- package/dist/registry/index.d.ts +10 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +9 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/types.d.ts +94 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +18 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/store/config.d.ts +30 -0
- package/dist/store/config.d.ts.map +1 -0
- package/dist/store/config.js +112 -0
- package/dist/store/config.js.map +1 -0
- package/dist/store/index.d.ts +21 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +24 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/manager.d.ts +113 -0
- package/dist/store/manager.d.ts.map +1 -0
- package/dist/store/manager.js +250 -0
- package/dist/store/manager.js.map +1 -0
- package/dist/store/paths.d.ts +37 -0
- package/dist/store/paths.d.ts.map +1 -0
- package/dist/store/paths.js +60 -0
- package/dist/store/paths.js.map +1 -0
- package/dist/store/registry.d.ts +34 -0
- package/dist/store/registry.d.ts.map +1 -0
- package/dist/store/registry.js +105 -0
- package/dist/store/registry.js.map +1 -0
- package/dist/types.d.ts +130 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Skill } from '../types.js';
|
|
2
|
+
import type { PlatformAdapter } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for platform adapters
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseAdapter implements PlatformAdapter {
|
|
7
|
+
abstract name: string;
|
|
8
|
+
abstract displayName: string;
|
|
9
|
+
/**
|
|
10
|
+
* Detect if this platform is present in the project
|
|
11
|
+
* Default implementation checks for platform-specific directory
|
|
12
|
+
*/
|
|
13
|
+
abstract detect(projectPath: string): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the output path for a skill
|
|
16
|
+
*/
|
|
17
|
+
abstract getOutputPath(skillName: string, projectPath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a path can be imported from this platform
|
|
20
|
+
*/
|
|
21
|
+
abstract canImport(path: string): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Import a skill from this platform format
|
|
24
|
+
*/
|
|
25
|
+
abstract import(path: string): Promise<Skill>;
|
|
26
|
+
/**
|
|
27
|
+
* Format skill content for this platform
|
|
28
|
+
* Override in subclasses for platform-specific formatting
|
|
29
|
+
*/
|
|
30
|
+
protected abstract formatSkillContent(skill: Skill): string;
|
|
31
|
+
/**
|
|
32
|
+
* Sync a skill to this platform
|
|
33
|
+
*/
|
|
34
|
+
sync(skill: Skill, projectPath: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Remove a skill from this platform
|
|
37
|
+
*/
|
|
38
|
+
remove(skillName: string, projectPath: string): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Helper: Read file content safely
|
|
41
|
+
*/
|
|
42
|
+
protected readFileSafe(path: string): Promise<string | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Helper: Check if directory exists
|
|
45
|
+
*/
|
|
46
|
+
protected dirExists(path: string): boolean;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/adapters/base.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,8BAAsB,WAAY,YAAW,eAAe;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAEtD;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAEtE;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAElD;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAE7C;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAE3D;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5D;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnE;;OAEG;cACa,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IASlE;;OAEG;IACH,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base adapter abstract class
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import { mkdir, writeFile, unlink, readFile } from 'fs/promises';
|
|
6
|
+
import { dirname } from 'path';
|
|
7
|
+
/**
|
|
8
|
+
* Abstract base class for platform adapters
|
|
9
|
+
*/
|
|
10
|
+
export class BaseAdapter {
|
|
11
|
+
/**
|
|
12
|
+
* Sync a skill to this platform
|
|
13
|
+
*/
|
|
14
|
+
async sync(skill, projectPath) {
|
|
15
|
+
const outputPath = this.getOutputPath(skill.name, projectPath);
|
|
16
|
+
const content = this.formatSkillContent(skill);
|
|
17
|
+
// Ensure directory exists
|
|
18
|
+
const dir = dirname(outputPath);
|
|
19
|
+
if (!existsSync(dir)) {
|
|
20
|
+
await mkdir(dir, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
// Write file
|
|
23
|
+
await writeFile(outputPath, content, 'utf-8');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Remove a skill from this platform
|
|
27
|
+
*/
|
|
28
|
+
async remove(skillName, projectPath) {
|
|
29
|
+
const outputPath = this.getOutputPath(skillName, projectPath);
|
|
30
|
+
if (existsSync(outputPath)) {
|
|
31
|
+
await unlink(outputPath);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Helper: Read file content safely
|
|
36
|
+
*/
|
|
37
|
+
async readFileSafe(path) {
|
|
38
|
+
try {
|
|
39
|
+
if (!existsSync(path))
|
|
40
|
+
return null;
|
|
41
|
+
return await readFile(path, 'utf-8');
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Helper: Check if directory exists
|
|
49
|
+
*/
|
|
50
|
+
dirExists(path) {
|
|
51
|
+
return existsSync(path);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/adapters/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAI/B;;GAEG;AACH,MAAM,OAAgB,WAAW;IA+B/B;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,KAAY,EAAE,WAAmB;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAE/C,0BAA0B;QAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;QAED,aAAa;QACb,MAAM,SAAS,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,WAAmB;QACjD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC9D,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,YAAY,CAAC,IAAY;QACvC,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YACnC,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACO,SAAS,CAAC,IAAY;QAC9B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Skill } from '../types.js';
|
|
2
|
+
import { BaseAdapter } from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Claude Code platform adapter
|
|
5
|
+
*/
|
|
6
|
+
export declare class ClaudeCodeAdapter extends BaseAdapter {
|
|
7
|
+
name: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
/**
|
|
10
|
+
* Detect if Claude Code is present (.claude/ directory exists)
|
|
11
|
+
*/
|
|
12
|
+
detect(projectPath: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the output path for a skill
|
|
15
|
+
* Format: .claude/skills/{skill-name}/SKILL.md
|
|
16
|
+
*/
|
|
17
|
+
getOutputPath(skillName: string, projectPath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format skill content as SKILL.md with YAML frontmatter
|
|
20
|
+
*/
|
|
21
|
+
protected formatSkillContent(skill: Skill): string;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a path can be imported from Claude Code format
|
|
24
|
+
*/
|
|
25
|
+
canImport(path: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Import a skill from Claude Code SKILL.md format
|
|
28
|
+
*/
|
|
29
|
+
import(path: string): Promise<Skill>;
|
|
30
|
+
/**
|
|
31
|
+
* List all skills in .claude/skills/
|
|
32
|
+
*/
|
|
33
|
+
listSkills(projectPath: string): Promise<string[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Simple YAML parser for frontmatter
|
|
36
|
+
*/
|
|
37
|
+
private parseSimpleYaml;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAYxC;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,IAAI,SAAiB;IACrB,WAAW,SAAiB;IAE5B;;OAEG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD;;;OAGG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAI7D;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAiClD;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe/C;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAsC1C;;OAEG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBxD;;OAEG;IACH,OAAO,CAAC,eAAe;CA+CxB"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code adapter
|
|
3
|
+
*
|
|
4
|
+
* Syncs skills to .claude/skills/{skill-name}/SKILL.md format
|
|
5
|
+
*/
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { readdir } from 'fs/promises';
|
|
8
|
+
import { BaseAdapter } from './base.js';
|
|
9
|
+
/**
|
|
10
|
+
* Claude Code platform adapter
|
|
11
|
+
*/
|
|
12
|
+
export class ClaudeCodeAdapter extends BaseAdapter {
|
|
13
|
+
name = 'claude-code';
|
|
14
|
+
displayName = 'Claude Code';
|
|
15
|
+
/**
|
|
16
|
+
* Detect if Claude Code is present (.claude/ directory exists)
|
|
17
|
+
*/
|
|
18
|
+
async detect(projectPath) {
|
|
19
|
+
return this.dirExists(join(projectPath, '.claude'));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the output path for a skill
|
|
23
|
+
* Format: .claude/skills/{skill-name}/SKILL.md
|
|
24
|
+
*/
|
|
25
|
+
getOutputPath(skillName, projectPath) {
|
|
26
|
+
return join(projectPath, '.claude', 'skills', skillName, 'SKILL.md');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Format skill content as SKILL.md with YAML frontmatter
|
|
30
|
+
*/
|
|
31
|
+
formatSkillContent(skill) {
|
|
32
|
+
const frontmatter = {
|
|
33
|
+
name: skill.name,
|
|
34
|
+
description: skill.description,
|
|
35
|
+
version: skill.version,
|
|
36
|
+
};
|
|
37
|
+
// Add allowed-tools if specified in platform config
|
|
38
|
+
const claudeConfig = skill.platforms?.['claude-code'];
|
|
39
|
+
if (claudeConfig?.['allowed-tools']) {
|
|
40
|
+
frontmatter['allowed-tools'] = claudeConfig['allowed-tools'];
|
|
41
|
+
}
|
|
42
|
+
// Build YAML frontmatter
|
|
43
|
+
const yamlLines = ['---'];
|
|
44
|
+
yamlLines.push(`name: ${frontmatter.name}`);
|
|
45
|
+
yamlLines.push(`description: ${JSON.stringify(frontmatter.description)}`);
|
|
46
|
+
yamlLines.push(`version: ${frontmatter.version}`);
|
|
47
|
+
if (frontmatter['allowed-tools']?.length) {
|
|
48
|
+
yamlLines.push('allowed-tools:');
|
|
49
|
+
for (const tool of frontmatter['allowed-tools']) {
|
|
50
|
+
yamlLines.push(` - ${tool}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
yamlLines.push('---');
|
|
54
|
+
yamlLines.push('');
|
|
55
|
+
// Add skill instructions
|
|
56
|
+
yamlLines.push(skill.instructions);
|
|
57
|
+
return yamlLines.join('\n');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if a path can be imported from Claude Code format
|
|
61
|
+
*/
|
|
62
|
+
async canImport(path) {
|
|
63
|
+
// Check if it's a SKILL.md file or .claude/skills directory
|
|
64
|
+
if (path.endsWith('SKILL.md')) {
|
|
65
|
+
const content = await this.readFileSafe(path);
|
|
66
|
+
return content !== null && content.startsWith('---');
|
|
67
|
+
}
|
|
68
|
+
// Check if it's a .claude/skills directory
|
|
69
|
+
if (path.endsWith('.claude/skills') || path.includes('.claude/skills/')) {
|
|
70
|
+
return this.dirExists(path);
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Import a skill from Claude Code SKILL.md format
|
|
76
|
+
*/
|
|
77
|
+
async import(path) {
|
|
78
|
+
const content = await this.readFileSafe(path);
|
|
79
|
+
if (!content) {
|
|
80
|
+
throw new Error(`Cannot read file: ${path}`);
|
|
81
|
+
}
|
|
82
|
+
// Parse YAML frontmatter
|
|
83
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
84
|
+
if (!frontmatterMatch) {
|
|
85
|
+
throw new Error(`Invalid SKILL.md format: missing frontmatter`);
|
|
86
|
+
}
|
|
87
|
+
const [, frontmatterYaml, instructions] = frontmatterMatch;
|
|
88
|
+
// Simple YAML parsing for frontmatter
|
|
89
|
+
const frontmatter = this.parseSimpleYaml(frontmatterYaml);
|
|
90
|
+
// Build skill object
|
|
91
|
+
const skill = {
|
|
92
|
+
schema: '1.0',
|
|
93
|
+
name: frontmatter.name || 'imported-skill',
|
|
94
|
+
version: frontmatter.version || '1.0.0',
|
|
95
|
+
description: frontmatter.description || '',
|
|
96
|
+
instructions: instructions.trim(),
|
|
97
|
+
};
|
|
98
|
+
// Add allowed-tools if present
|
|
99
|
+
if (frontmatter['allowed-tools']) {
|
|
100
|
+
skill.platforms = {
|
|
101
|
+
'claude-code': {
|
|
102
|
+
'allowed-tools': frontmatter['allowed-tools'],
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return skill;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* List all skills in .claude/skills/
|
|
110
|
+
*/
|
|
111
|
+
async listSkills(projectPath) {
|
|
112
|
+
const skillsDir = join(projectPath, '.claude', 'skills');
|
|
113
|
+
if (!this.dirExists(skillsDir)) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
const entries = await readdir(skillsDir, { withFileTypes: true });
|
|
118
|
+
return entries
|
|
119
|
+
.filter((entry) => entry.isDirectory())
|
|
120
|
+
.map((entry) => entry.name);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Simple YAML parser for frontmatter
|
|
128
|
+
*/
|
|
129
|
+
parseSimpleYaml(yaml) {
|
|
130
|
+
const result = {};
|
|
131
|
+
const lines = yaml.split('\n');
|
|
132
|
+
let currentKey = '';
|
|
133
|
+
let currentArray = [];
|
|
134
|
+
for (const line of lines) {
|
|
135
|
+
// Skip empty lines
|
|
136
|
+
if (!line.trim())
|
|
137
|
+
continue;
|
|
138
|
+
// Check for array item
|
|
139
|
+
if (line.startsWith(' - ')) {
|
|
140
|
+
currentArray.push(line.slice(4).trim());
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
// Save previous array if exists
|
|
144
|
+
if (currentKey && currentArray.length > 0) {
|
|
145
|
+
result[currentKey] = currentArray;
|
|
146
|
+
currentArray = [];
|
|
147
|
+
}
|
|
148
|
+
// Parse key-value
|
|
149
|
+
const match = line.match(/^(\S+):\s*(.*)$/);
|
|
150
|
+
if (match) {
|
|
151
|
+
const [, key, value] = match;
|
|
152
|
+
currentKey = key;
|
|
153
|
+
if (value) {
|
|
154
|
+
// Handle quoted strings
|
|
155
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
156
|
+
result[key] = value.slice(1, -1);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
result[key] = value;
|
|
160
|
+
}
|
|
161
|
+
currentKey = '';
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Save final array if exists
|
|
166
|
+
if (currentKey && currentArray.length > 0) {
|
|
167
|
+
result[currentKey] = currentArray;
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAYxC;;GAEG;AACH,MAAM,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CAAC;oBACnC,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;oBACtB,CAAC;oBACD,UAAU,GAAG,EAAE,CAAC;gBAClB,CAAC;YACH,CAAC;QACH,CAAC;QAED,6BAA6B;QAC7B,IAAI,UAAU,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;QACpC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Skill } from '../types.js';
|
|
2
|
+
import { BaseAdapter } from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Cline platform adapter
|
|
5
|
+
*/
|
|
6
|
+
export declare class ClineAdapter extends BaseAdapter {
|
|
7
|
+
name: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
/**
|
|
10
|
+
* Detect if Cline is present (.cline/ directory exists)
|
|
11
|
+
*/
|
|
12
|
+
detect(projectPath: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the output path for a skill
|
|
15
|
+
* Format: .cline/rules/{skill-name}.md
|
|
16
|
+
*/
|
|
17
|
+
getOutputPath(skillName: string, projectPath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format skill content for Cline format
|
|
20
|
+
*/
|
|
21
|
+
protected formatSkillContent(skill: Skill): string;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a path can be imported from Cline format
|
|
24
|
+
*/
|
|
25
|
+
canImport(path: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Import a skill from Cline format
|
|
28
|
+
*/
|
|
29
|
+
import(path: string): Promise<Skill>;
|
|
30
|
+
/**
|
|
31
|
+
* List all skills in .cline/rules/
|
|
32
|
+
*/
|
|
33
|
+
listSkills(projectPath: string): Promise<string[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Extract skill name from file path
|
|
36
|
+
*/
|
|
37
|
+
private extractNameFromPath;
|
|
38
|
+
/**
|
|
39
|
+
* Extract instructions when no "## Instructions" section found
|
|
40
|
+
*/
|
|
41
|
+
private extractInstructions;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=cline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline.d.ts","sourceRoot":"","sources":["../../src/adapters/cline.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,IAAI,SAAW;IACf,WAAW,SAAmB;IAE9B;;OAEG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD;;;OAGG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAI7D;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAuClD;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe/C;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IA2C1C;;OAEG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBxD;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAU5B"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VS Code Cline adapter
|
|
3
|
+
*
|
|
4
|
+
* Syncs skills to .cline/rules/{skill-name}.md format
|
|
5
|
+
*/
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { readdir } from 'fs/promises';
|
|
8
|
+
import { BaseAdapter } from './base.js';
|
|
9
|
+
/**
|
|
10
|
+
* Cline platform adapter
|
|
11
|
+
*/
|
|
12
|
+
export class ClineAdapter extends BaseAdapter {
|
|
13
|
+
name = 'cline';
|
|
14
|
+
displayName = 'VS Code Cline';
|
|
15
|
+
/**
|
|
16
|
+
* Detect if Cline is present (.cline/ directory exists)
|
|
17
|
+
*/
|
|
18
|
+
async detect(projectPath) {
|
|
19
|
+
return this.dirExists(join(projectPath, '.cline'));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the output path for a skill
|
|
23
|
+
* Format: .cline/rules/{skill-name}.md
|
|
24
|
+
*/
|
|
25
|
+
getOutputPath(skillName, projectPath) {
|
|
26
|
+
return join(projectPath, '.cline', 'rules', `${skillName}.md`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Format skill content for Cline format
|
|
30
|
+
*/
|
|
31
|
+
formatSkillContent(skill) {
|
|
32
|
+
const lines = [];
|
|
33
|
+
// Cline uses simple markdown format
|
|
34
|
+
lines.push(`# ${skill.name}`);
|
|
35
|
+
lines.push('');
|
|
36
|
+
lines.push(`> ${skill.description}`);
|
|
37
|
+
lines.push('');
|
|
38
|
+
lines.push(`**Version:** ${skill.version}`);
|
|
39
|
+
lines.push('');
|
|
40
|
+
// Triggers as "When to use"
|
|
41
|
+
if (skill.triggers?.length) {
|
|
42
|
+
lines.push('## When to use');
|
|
43
|
+
lines.push('');
|
|
44
|
+
for (const trigger of skill.triggers) {
|
|
45
|
+
lines.push(`- ${trigger}`);
|
|
46
|
+
}
|
|
47
|
+
lines.push('');
|
|
48
|
+
}
|
|
49
|
+
// Capabilities as "Required capabilities"
|
|
50
|
+
if (skill.capabilities?.length) {
|
|
51
|
+
lines.push('## Required capabilities');
|
|
52
|
+
lines.push('');
|
|
53
|
+
for (const cap of skill.capabilities) {
|
|
54
|
+
lines.push(`- \`${cap}\``);
|
|
55
|
+
}
|
|
56
|
+
lines.push('');
|
|
57
|
+
}
|
|
58
|
+
// Instructions
|
|
59
|
+
lines.push('## Instructions');
|
|
60
|
+
lines.push('');
|
|
61
|
+
lines.push(skill.instructions);
|
|
62
|
+
return lines.join('\n');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check if a path can be imported from Cline format
|
|
66
|
+
*/
|
|
67
|
+
async canImport(path) {
|
|
68
|
+
// Check for .cline/rules/*.md files
|
|
69
|
+
if (path.includes('.cline/rules/') && path.endsWith('.md')) {
|
|
70
|
+
const content = await this.readFileSafe(path);
|
|
71
|
+
return content !== null && content.startsWith('# ');
|
|
72
|
+
}
|
|
73
|
+
// Check for .cline/rules directory
|
|
74
|
+
if (path.endsWith('.cline/rules')) {
|
|
75
|
+
return this.dirExists(path);
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Import a skill from Cline format
|
|
81
|
+
*/
|
|
82
|
+
async import(path) {
|
|
83
|
+
const content = await this.readFileSafe(path);
|
|
84
|
+
if (!content) {
|
|
85
|
+
throw new Error(`Cannot read file: ${path}`);
|
|
86
|
+
}
|
|
87
|
+
// Parse markdown format
|
|
88
|
+
const nameMatch = content.match(/^# (.+)$/m);
|
|
89
|
+
const descMatch = content.match(/^> (.+)$/m);
|
|
90
|
+
const versionMatch = content.match(/\*\*Version:\*\*\s*(.+)$/m);
|
|
91
|
+
// Extract instructions (everything after "## Instructions")
|
|
92
|
+
const instructionsMatch = content.match(/## Instructions\n\n([\s\S]*?)(?=\n## |$)/);
|
|
93
|
+
const skill = {
|
|
94
|
+
schema: '1.0',
|
|
95
|
+
name: nameMatch?.[1] || this.extractNameFromPath(path),
|
|
96
|
+
version: versionMatch?.[1] || '1.0.0',
|
|
97
|
+
description: descMatch?.[1] || '',
|
|
98
|
+
instructions: instructionsMatch?.[1]?.trim() || this.extractInstructions(content),
|
|
99
|
+
};
|
|
100
|
+
// Extract triggers
|
|
101
|
+
const triggersSection = content.match(/## When to use\n\n([\s\S]*?)(?=\n## |$)/);
|
|
102
|
+
if (triggersSection) {
|
|
103
|
+
const triggers = triggersSection[1].match(/^- (.+)$/gm);
|
|
104
|
+
if (triggers) {
|
|
105
|
+
skill.triggers = triggers.map((t) => t.slice(2));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Extract capabilities
|
|
109
|
+
const capsSection = content.match(/## Required capabilities\n\n([\s\S]*?)(?=\n## |$)/);
|
|
110
|
+
if (capsSection) {
|
|
111
|
+
const caps = capsSection[1].match(/`(.+?)`/g);
|
|
112
|
+
if (caps) {
|
|
113
|
+
skill.capabilities = caps.map((c) => c.slice(1, -1));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return skill;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* List all skills in .cline/rules/
|
|
120
|
+
*/
|
|
121
|
+
async listSkills(projectPath) {
|
|
122
|
+
const rulesDir = join(projectPath, '.cline', 'rules');
|
|
123
|
+
if (!this.dirExists(rulesDir)) {
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
const entries = await readdir(rulesDir);
|
|
128
|
+
return entries
|
|
129
|
+
.filter((entry) => entry.endsWith('.md'))
|
|
130
|
+
.map((entry) => entry.replace('.md', ''));
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Extract skill name from file path
|
|
138
|
+
*/
|
|
139
|
+
extractNameFromPath(path) {
|
|
140
|
+
const match = path.match(/([^/\\]+)\.md$/);
|
|
141
|
+
return match?.[1] || 'imported-skill';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Extract instructions when no "## Instructions" section found
|
|
145
|
+
*/
|
|
146
|
+
extractInstructions(content) {
|
|
147
|
+
// Remove header and metadata, keep the rest as instructions
|
|
148
|
+
return content
|
|
149
|
+
.replace(/^# .+$/m, '')
|
|
150
|
+
.replace(/^> .+$/m, '')
|
|
151
|
+
.replace(/\*\*Version:\*\*.+$/m, '')
|
|
152
|
+
.replace(/## When to use[\s\S]*?(?=\n## |$)/, '')
|
|
153
|
+
.replace(/## Required capabilities[\s\S]*?(?=\n## |$)/, '')
|
|
154
|
+
.trim();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=cline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline.js","sourceRoot":"","sources":["../../src/adapters/cline.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,IAAI,GAAG,OAAO,CAAC;IACf,WAAW,GAAG,eAAe,CAAC;IAE9B;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,SAAiB,EAAE,WAAmB;QAClD,OAAO,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,SAAS,KAAK,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACO,kBAAkB,CAAC,KAAY;QACvC,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,oCAAoC;QACpC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QACrC,KAAK,CAAC,IAAI,CA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AAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;iBACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,IAAY;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC3C,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC;IACxC,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,OAAe;QACzC,4DAA4D;QAC5D,OAAO,OAAO;aACX,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;aACtB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;aACtB,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;aACnC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC;aAChD,OAAO,CAAC,6CAA6C,EAAE,EAAE,CAAC;aAC1D,IAAI,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Skill } from '../types.js';
|
|
2
|
+
import { BaseAdapter } from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Codex platform adapter
|
|
5
|
+
*/
|
|
6
|
+
export declare class CodexAdapter extends BaseAdapter {
|
|
7
|
+
name: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
/**
|
|
10
|
+
* Detect if Codex is present (AGENTS.md or .codex/ exists)
|
|
11
|
+
*/
|
|
12
|
+
detect(projectPath: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the output path for a skill
|
|
15
|
+
* Format: .codex/agents/{skill-name}.md
|
|
16
|
+
*/
|
|
17
|
+
getOutputPath(skillName: string, projectPath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format skill content for Codex format
|
|
20
|
+
*/
|
|
21
|
+
protected formatSkillContent(skill: Skill): string;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a path can be imported from Codex format
|
|
24
|
+
*/
|
|
25
|
+
canImport(path: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Import a skill from Codex format
|
|
28
|
+
*/
|
|
29
|
+
import(path: string): Promise<Skill>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,IAAI,SAAW;IACf,WAAW,SAAkB;IAE7B;;OAEG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOnD;;;OAGG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAI7D;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAsClD;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAc/C;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CA2C3C"}
|