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,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex (OpenAI) adapter
|
|
3
|
+
*
|
|
4
|
+
* Syncs skills to AGENTS.md or .codex/ format
|
|
5
|
+
*/
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { BaseAdapter } from './base.js';
|
|
8
|
+
/**
|
|
9
|
+
* Codex platform adapter
|
|
10
|
+
*/
|
|
11
|
+
export class CodexAdapter extends BaseAdapter {
|
|
12
|
+
name = 'codex';
|
|
13
|
+
displayName = 'OpenAI Codex';
|
|
14
|
+
/**
|
|
15
|
+
* Detect if Codex is present (AGENTS.md or .codex/ exists)
|
|
16
|
+
*/
|
|
17
|
+
async detect(projectPath) {
|
|
18
|
+
return (this.dirExists(join(projectPath, '.codex')) ||
|
|
19
|
+
this.dirExists(join(projectPath, 'AGENTS.md')));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the output path for a skill
|
|
23
|
+
* Format: .codex/agents/{skill-name}.md
|
|
24
|
+
*/
|
|
25
|
+
getOutputPath(skillName, projectPath) {
|
|
26
|
+
return join(projectPath, '.codex', 'agents', `${skillName}.md`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Format skill content for Codex format
|
|
30
|
+
*/
|
|
31
|
+
formatSkillContent(skill) {
|
|
32
|
+
const lines = [];
|
|
33
|
+
// Header
|
|
34
|
+
lines.push(`# ${skill.name}`);
|
|
35
|
+
lines.push('');
|
|
36
|
+
lines.push(`> ${skill.description}`);
|
|
37
|
+
lines.push('');
|
|
38
|
+
// Version info
|
|
39
|
+
lines.push(`**Version:** ${skill.version}`);
|
|
40
|
+
lines.push('');
|
|
41
|
+
// Sandbox config if specified
|
|
42
|
+
const codexConfig = skill.platforms?.codex;
|
|
43
|
+
if (codexConfig?.sandbox !== undefined) {
|
|
44
|
+
lines.push(`**Sandbox:** ${codexConfig.sandbox ? 'enabled' : 'disabled'}`);
|
|
45
|
+
lines.push('');
|
|
46
|
+
}
|
|
47
|
+
// Triggers
|
|
48
|
+
if (skill.triggers?.length) {
|
|
49
|
+
lines.push('## Triggers');
|
|
50
|
+
lines.push('');
|
|
51
|
+
for (const trigger of skill.triggers) {
|
|
52
|
+
lines.push(`- \`${trigger}\``);
|
|
53
|
+
}
|
|
54
|
+
lines.push('');
|
|
55
|
+
}
|
|
56
|
+
// Instructions
|
|
57
|
+
lines.push('## Instructions');
|
|
58
|
+
lines.push('');
|
|
59
|
+
lines.push(skill.instructions);
|
|
60
|
+
return lines.join('\n');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if a path can be imported from Codex format
|
|
64
|
+
*/
|
|
65
|
+
async canImport(path) {
|
|
66
|
+
// Check for AGENTS.md or .codex/ directory
|
|
67
|
+
if (path.endsWith('AGENTS.md')) {
|
|
68
|
+
const content = await this.readFileSafe(path);
|
|
69
|
+
return content !== null && content.includes('# ');
|
|
70
|
+
}
|
|
71
|
+
if (path.includes('.codex/agents/') && path.endsWith('.md')) {
|
|
72
|
+
return this.dirExists(path);
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Import a skill from Codex format
|
|
78
|
+
*/
|
|
79
|
+
async import(path) {
|
|
80
|
+
const content = await this.readFileSafe(path);
|
|
81
|
+
if (!content) {
|
|
82
|
+
throw new Error(`Cannot read file: ${path}`);
|
|
83
|
+
}
|
|
84
|
+
// Parse markdown format
|
|
85
|
+
const nameMatch = content.match(/^# (.+)$/m);
|
|
86
|
+
const descMatch = content.match(/^> (.+)$/m);
|
|
87
|
+
const versionMatch = content.match(/\*\*Version:\*\*\s*(.+)$/m);
|
|
88
|
+
const sandboxMatch = content.match(/\*\*Sandbox:\*\*\s*(enabled|disabled)/m);
|
|
89
|
+
// Extract instructions (everything after "## Instructions")
|
|
90
|
+
const instructionsMatch = content.match(/## Instructions\n\n([\s\S]*?)(?=\n## |$)/);
|
|
91
|
+
const skill = {
|
|
92
|
+
schema: '1.0',
|
|
93
|
+
name: nameMatch?.[1] || 'imported-skill',
|
|
94
|
+
version: versionMatch?.[1] || '1.0.0',
|
|
95
|
+
description: descMatch?.[1] || '',
|
|
96
|
+
instructions: instructionsMatch?.[1]?.trim() || content,
|
|
97
|
+
};
|
|
98
|
+
// Add sandbox config if present
|
|
99
|
+
if (sandboxMatch) {
|
|
100
|
+
skill.platforms = {
|
|
101
|
+
codex: {
|
|
102
|
+
sandbox: sandboxMatch[1] === 'enabled',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// Extract triggers if present
|
|
107
|
+
const triggersSection = content.match(/## Triggers\n\n([\s\S]*?)(?=\n## |$)/);
|
|
108
|
+
if (triggersSection) {
|
|
109
|
+
const triggers = triggersSection[1].match(/- `(.+)`/g);
|
|
110
|
+
if (triggers) {
|
|
111
|
+
skill.triggers = triggers.map((t) => t.match(/`(.+)`/)[1]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return skill;
|
|
115
|
+
}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AK,SAAS;iBACvC;aACF,CAAC;QACJ,CAAC;QAED,8BAA8B;QAC9B,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC9E,IAAI,eAAe,EAAE,CAAC;YACpB,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACvD,IAAI,QAAQ,EAAE,CAAC;gBACb,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Skill } from '../types.js';
|
|
2
|
+
import { BaseAdapter } from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* GitHub Copilot platform adapter
|
|
5
|
+
*/
|
|
6
|
+
export declare class CopilotAdapter extends BaseAdapter {
|
|
7
|
+
name: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
/**
|
|
10
|
+
* Detect if GitHub Copilot is present (.github/ directory exists)
|
|
11
|
+
*/
|
|
12
|
+
detect(projectPath: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the output path for a skill
|
|
15
|
+
* Note: All skills go into the same file
|
|
16
|
+
*/
|
|
17
|
+
getOutputPath(_skillName: string, projectPath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format skill content as a marked section
|
|
20
|
+
*/
|
|
21
|
+
protected formatSkillContent(skill: Skill): string;
|
|
22
|
+
/**
|
|
23
|
+
* Sync a skill to copilot-instructions.md (append/replace mode)
|
|
24
|
+
*/
|
|
25
|
+
sync(skill: Skill, projectPath: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Remove a skill from copilot-instructions.md
|
|
28
|
+
*/
|
|
29
|
+
remove(skillName: string, projectPath: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if a path can be imported from Copilot format
|
|
32
|
+
*/
|
|
33
|
+
canImport(path: string): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Import skills from copilot-instructions.md
|
|
36
|
+
* Note: Returns the first skill found (multi-skill import not supported here)
|
|
37
|
+
*/
|
|
38
|
+
import(path: string): Promise<Skill>;
|
|
39
|
+
/**
|
|
40
|
+
* Parse a marked section into a skill
|
|
41
|
+
*/
|
|
42
|
+
private parseSection;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=copilot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../src/adapters/copilot.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQxC;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,IAAI,SAAa;IACjB,WAAW,SAAoB;IAE/B;;OAEG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD;;;OAGG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAI9D;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAwBlD;;OAEG;IACG,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC5D;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BnE;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO/C;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAsC1C;;OAEG;IACH,OAAO,CAAC,YAAY;CA6BrB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot adapter
|
|
3
|
+
*
|
|
4
|
+
* Syncs skills to .github/copilot-instructions.md (append mode)
|
|
5
|
+
*/
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
8
|
+
import { existsSync } from 'fs';
|
|
9
|
+
import { BaseAdapter } from './base.js';
|
|
10
|
+
/**
|
|
11
|
+
* Marker for skillpkg-managed sections
|
|
12
|
+
*/
|
|
13
|
+
const SKILL_START_MARKER = '<!-- skillpkg:';
|
|
14
|
+
const SKILL_END_MARKER = '<!-- /skillpkg:';
|
|
15
|
+
/**
|
|
16
|
+
* GitHub Copilot platform adapter
|
|
17
|
+
*/
|
|
18
|
+
export class CopilotAdapter extends BaseAdapter {
|
|
19
|
+
name = 'copilot';
|
|
20
|
+
displayName = 'GitHub Copilot';
|
|
21
|
+
/**
|
|
22
|
+
* Detect if GitHub Copilot is present (.github/ directory exists)
|
|
23
|
+
*/
|
|
24
|
+
async detect(projectPath) {
|
|
25
|
+
return this.dirExists(join(projectPath, '.github'));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the output path for a skill
|
|
29
|
+
* Note: All skills go into the same file
|
|
30
|
+
*/
|
|
31
|
+
getOutputPath(_skillName, projectPath) {
|
|
32
|
+
return join(projectPath, '.github', 'copilot-instructions.md');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Format skill content as a marked section
|
|
36
|
+
*/
|
|
37
|
+
formatSkillContent(skill) {
|
|
38
|
+
const lines = [];
|
|
39
|
+
lines.push(`${SKILL_START_MARKER}${skill.name} -->`);
|
|
40
|
+
lines.push('');
|
|
41
|
+
lines.push(`## ${skill.name}`);
|
|
42
|
+
lines.push('');
|
|
43
|
+
lines.push(`> ${skill.description}`);
|
|
44
|
+
lines.push('');
|
|
45
|
+
// Mode config if specified
|
|
46
|
+
const copilotConfig = skill.platforms?.copilot;
|
|
47
|
+
if (copilotConfig?.mode) {
|
|
48
|
+
lines.push(`_Mode: ${copilotConfig.mode}_`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
}
|
|
51
|
+
lines.push(skill.instructions);
|
|
52
|
+
lines.push('');
|
|
53
|
+
lines.push(`${SKILL_END_MARKER}${skill.name} -->`);
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Sync a skill to copilot-instructions.md (append/replace mode)
|
|
58
|
+
*/
|
|
59
|
+
async sync(skill, projectPath) {
|
|
60
|
+
const outputPath = this.getOutputPath(skill.name, projectPath);
|
|
61
|
+
const skillContent = this.formatSkillContent(skill);
|
|
62
|
+
// Read existing content
|
|
63
|
+
let existingContent = '';
|
|
64
|
+
if (existsSync(outputPath)) {
|
|
65
|
+
existingContent = await readFile(outputPath, 'utf-8');
|
|
66
|
+
}
|
|
67
|
+
// Check if skill already exists in file
|
|
68
|
+
const startMarker = `${SKILL_START_MARKER}${skill.name} -->`;
|
|
69
|
+
const endMarker = `${SKILL_END_MARKER}${skill.name} -->`;
|
|
70
|
+
const startIndex = existingContent.indexOf(startMarker);
|
|
71
|
+
const endIndex = existingContent.indexOf(endMarker);
|
|
72
|
+
let newContent;
|
|
73
|
+
if (startIndex !== -1 && endIndex !== -1) {
|
|
74
|
+
// Replace existing section
|
|
75
|
+
newContent =
|
|
76
|
+
existingContent.slice(0, startIndex) +
|
|
77
|
+
skillContent +
|
|
78
|
+
existingContent.slice(endIndex + endMarker.length);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Append new section
|
|
82
|
+
newContent = existingContent.trim()
|
|
83
|
+
? `${existingContent.trim()}\n\n${skillContent}`
|
|
84
|
+
: skillContent;
|
|
85
|
+
}
|
|
86
|
+
// Write file
|
|
87
|
+
await writeFile(outputPath, newContent, 'utf-8');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Remove a skill from copilot-instructions.md
|
|
91
|
+
*/
|
|
92
|
+
async remove(skillName, projectPath) {
|
|
93
|
+
const outputPath = this.getOutputPath(skillName, projectPath);
|
|
94
|
+
if (!existsSync(outputPath))
|
|
95
|
+
return;
|
|
96
|
+
const content = await readFile(outputPath, 'utf-8');
|
|
97
|
+
const startMarker = `${SKILL_START_MARKER}${skillName} -->`;
|
|
98
|
+
const endMarker = `${SKILL_END_MARKER}${skillName} -->`;
|
|
99
|
+
const startIndex = content.indexOf(startMarker);
|
|
100
|
+
const endIndex = content.indexOf(endMarker);
|
|
101
|
+
if (startIndex === -1 || endIndex === -1)
|
|
102
|
+
return;
|
|
103
|
+
// Remove section (including surrounding whitespace)
|
|
104
|
+
let newContent = content.slice(0, startIndex).trimEnd() +
|
|
105
|
+
'\n\n' +
|
|
106
|
+
content.slice(endIndex + endMarker.length).trimStart();
|
|
107
|
+
// Clean up extra newlines
|
|
108
|
+
newContent = newContent.replace(/\n{3,}/g, '\n\n').trim();
|
|
109
|
+
await writeFile(outputPath, newContent || '', 'utf-8');
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check if a path can be imported from Copilot format
|
|
113
|
+
*/
|
|
114
|
+
async canImport(path) {
|
|
115
|
+
if (!path.endsWith('copilot-instructions.md')) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return existsSync(path);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Import skills from copilot-instructions.md
|
|
122
|
+
* Note: Returns the first skill found (multi-skill import not supported here)
|
|
123
|
+
*/
|
|
124
|
+
async import(path) {
|
|
125
|
+
const content = await this.readFileSafe(path);
|
|
126
|
+
if (!content) {
|
|
127
|
+
throw new Error(`Cannot read file: ${path}`);
|
|
128
|
+
}
|
|
129
|
+
// Check for skillpkg markers
|
|
130
|
+
const markerMatch = content.match(new RegExp(`${SKILL_START_MARKER.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(\\S+) -->`));
|
|
131
|
+
if (markerMatch) {
|
|
132
|
+
// Parse marked section
|
|
133
|
+
const skillName = markerMatch[1];
|
|
134
|
+
const startMarker = `${SKILL_START_MARKER}${skillName} -->`;
|
|
135
|
+
const endMarker = `${SKILL_END_MARKER}${skillName} -->`;
|
|
136
|
+
const startIndex = content.indexOf(startMarker);
|
|
137
|
+
const endIndex = content.indexOf(endMarker);
|
|
138
|
+
if (startIndex !== -1 && endIndex !== -1) {
|
|
139
|
+
const section = content.slice(startIndex + startMarker.length, endIndex).trim();
|
|
140
|
+
return this.parseSection(skillName, section);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// No markers - treat entire file as single skill
|
|
144
|
+
const nameMatch = content.match(/^## (.+)$/m);
|
|
145
|
+
const descMatch = content.match(/^> (.+)$/m);
|
|
146
|
+
return {
|
|
147
|
+
schema: '1.0',
|
|
148
|
+
name: nameMatch?.[1] || 'imported-skill',
|
|
149
|
+
version: '1.0.0',
|
|
150
|
+
description: descMatch?.[1] || '',
|
|
151
|
+
instructions: content,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Parse a marked section into a skill
|
|
156
|
+
*/
|
|
157
|
+
parseSection(skillName, section) {
|
|
158
|
+
const descMatch = section.match(/^> (.+)$/m);
|
|
159
|
+
const modeMatch = section.match(/_Mode: (edit|chat)_/);
|
|
160
|
+
// Remove header and description to get instructions
|
|
161
|
+
let instructions = section
|
|
162
|
+
.replace(/^## .+$/m, '')
|
|
163
|
+
.replace(/^> .+$/m, '')
|
|
164
|
+
.replace(/_Mode: .+_/, '')
|
|
165
|
+
.trim();
|
|
166
|
+
const skill = {
|
|
167
|
+
schema: '1.0',
|
|
168
|
+
name: skillName,
|
|
169
|
+
version: '1.0.0',
|
|
170
|
+
description: descMatch?.[1] || '',
|
|
171
|
+
instructions,
|
|
172
|
+
};
|
|
173
|
+
if (modeMatch) {
|
|
174
|
+
skill.platforms = {
|
|
175
|
+
copilot: {
|
|
176
|
+
mode: modeMatch[1],
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
return skill;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=copilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../src/adapters/copilot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;GAEG;AACH,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C,IAAI,GAAG,SAAS,CAAC;IACjB,WAAW,GAAG,gBAAgB,CAAC;IAE/B;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,UAAkB,EAAE,WAAmB;QACnD,OAAO,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACO,kBAAkB,CAAC,KAAY;QACvC,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,KAAK,CAAC,IAAI,CAAC,GAAG,kBAAkB,GAAG,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC;QACrD,KAAK,CAAC,IAAI,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AC,UAAU,EAAE,EAAE,CAAC;aACvB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;aACtB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;aACzB,IAAI,EAAE,CAAC;QAEV,MAAM,KAAK,GAAU;YACnB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;YACjC,YAAY;SACb,CAAC;QAEF,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,CAAC,SAAS,GAAG;gBAChB,OAAO,EAAE;oBACP,IAAI,EAAE,SAAS,CAAC,CAAC,CAAoB;iBACtC;aACF,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters module - Platform synchronization
|
|
3
|
+
*/
|
|
4
|
+
export type { PlatformAdapter, DetectedPlatform, SyncOptions, SyncResult, SyncedItem, SkippedItem, SyncError, } from './types.js';
|
|
5
|
+
export { BaseAdapter } from './base.js';
|
|
6
|
+
export { ClaudeCodeAdapter } from './claude-code.js';
|
|
7
|
+
export { CodexAdapter } from './codex.js';
|
|
8
|
+
export { CopilotAdapter } from './copilot.js';
|
|
9
|
+
export { ClineAdapter } from './cline.js';
|
|
10
|
+
export { AdapterManager, createAdapterManager } from './manager.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters module - Platform synchronization
|
|
3
|
+
*/
|
|
4
|
+
// Base class
|
|
5
|
+
export { BaseAdapter } from './base.js';
|
|
6
|
+
// Platform adapters
|
|
7
|
+
export { ClaudeCodeAdapter } from './claude-code.js';
|
|
8
|
+
export { CodexAdapter } from './codex.js';
|
|
9
|
+
export { CopilotAdapter } from './copilot.js';
|
|
10
|
+
export { ClineAdapter } from './cline.js';
|
|
11
|
+
// Manager
|
|
12
|
+
export { AdapterManager, createAdapterManager } from './manager.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,aAAa;AACb,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,oBAAoB;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages platform adapters and sync operations
|
|
5
|
+
*/
|
|
6
|
+
import type { Skill } from '../types.js';
|
|
7
|
+
import type { PlatformAdapter, DetectedPlatform, SyncOptions, SyncResult } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Adapter Manager class
|
|
10
|
+
*/
|
|
11
|
+
export declare class AdapterManager {
|
|
12
|
+
private adapters;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Register a platform adapter
|
|
16
|
+
*/
|
|
17
|
+
registerAdapter(adapter: PlatformAdapter): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get an adapter by name
|
|
20
|
+
*/
|
|
21
|
+
getAdapter(name: string): PlatformAdapter | null;
|
|
22
|
+
/**
|
|
23
|
+
* List all registered adapters
|
|
24
|
+
*/
|
|
25
|
+
listAdapters(): PlatformAdapter[];
|
|
26
|
+
/**
|
|
27
|
+
* Detect which platforms are present in a project
|
|
28
|
+
*/
|
|
29
|
+
detectPlatforms(projectPath: string): Promise<DetectedPlatform[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Sync skills to all or specified platforms
|
|
32
|
+
*/
|
|
33
|
+
sync(skills: Skill[], options?: SyncOptions): Promise<SyncResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Sync skills to a specific platform
|
|
36
|
+
*/
|
|
37
|
+
syncToPlatform(platform: string, skills: Skill[], projectPath?: string): Promise<SyncResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Remove a skill from all platforms
|
|
40
|
+
*/
|
|
41
|
+
removeFromAllPlatforms(skillName: string, projectPath?: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Remove a skill from a specific platform
|
|
44
|
+
*/
|
|
45
|
+
removeFromPlatform(skillName: string, platform: string, projectPath?: string): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a new AdapterManager instance
|
|
49
|
+
*/
|
|
50
|
+
export declare function createAdapterManager(): AdapterManager;
|
|
51
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/adapters/manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACX,MAAM,YAAY,CAAC;AAMpB;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAA2C;;IAU3D;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAI/C;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAIhD;;OAEG;IACH,YAAY,IAAI,eAAe,EAAE;IAIjC;;OAEG;IACG,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAgBvE;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAkE3E;;OAEG;IACG,cAAc,CAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,KAAK,EAAE,EACf,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,UAAU,CAAC;IAItB;;OAEG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,IAAI,CAAC;IAUhB;;OAEG;IACG,kBAAkB,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,IAAI,CAAC;CAMjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAErD"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ClaudeCodeAdapter } from './claude-code.js';
|
|
2
|
+
import { CodexAdapter } from './codex.js';
|
|
3
|
+
import { CopilotAdapter } from './copilot.js';
|
|
4
|
+
import { ClineAdapter } from './cline.js';
|
|
5
|
+
/**
|
|
6
|
+
* Adapter Manager class
|
|
7
|
+
*/
|
|
8
|
+
export class AdapterManager {
|
|
9
|
+
adapters = new Map();
|
|
10
|
+
constructor() {
|
|
11
|
+
// Register built-in adapters
|
|
12
|
+
this.registerAdapter(new ClaudeCodeAdapter());
|
|
13
|
+
this.registerAdapter(new CodexAdapter());
|
|
14
|
+
this.registerAdapter(new CopilotAdapter());
|
|
15
|
+
this.registerAdapter(new ClineAdapter());
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Register a platform adapter
|
|
19
|
+
*/
|
|
20
|
+
registerAdapter(adapter) {
|
|
21
|
+
this.adapters.set(adapter.name, adapter);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get an adapter by name
|
|
25
|
+
*/
|
|
26
|
+
getAdapter(name) {
|
|
27
|
+
return this.adapters.get(name) || null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* List all registered adapters
|
|
31
|
+
*/
|
|
32
|
+
listAdapters() {
|
|
33
|
+
return Array.from(this.adapters.values());
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Detect which platforms are present in a project
|
|
37
|
+
*/
|
|
38
|
+
async detectPlatforms(projectPath) {
|
|
39
|
+
const results = [];
|
|
40
|
+
for (const adapter of this.adapters.values()) {
|
|
41
|
+
const detected = await adapter.detect(projectPath);
|
|
42
|
+
results.push({
|
|
43
|
+
name: adapter.name,
|
|
44
|
+
displayName: adapter.displayName,
|
|
45
|
+
detected,
|
|
46
|
+
path: detected ? adapter.getOutputPath('', projectPath) : '',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return results;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sync skills to all or specified platforms
|
|
53
|
+
*/
|
|
54
|
+
async sync(skills, options = {}) {
|
|
55
|
+
const projectPath = options.projectPath || process.cwd();
|
|
56
|
+
const targetPlatforms = options.platforms;
|
|
57
|
+
const dryRun = options.dryRun || false;
|
|
58
|
+
const result = {
|
|
59
|
+
success: true,
|
|
60
|
+
synced: [],
|
|
61
|
+
skipped: [],
|
|
62
|
+
errors: [],
|
|
63
|
+
};
|
|
64
|
+
// Get adapters to sync to
|
|
65
|
+
let adaptersToUse;
|
|
66
|
+
if (targetPlatforms?.length) {
|
|
67
|
+
adaptersToUse = targetPlatforms
|
|
68
|
+
.map((name) => this.adapters.get(name))
|
|
69
|
+
.filter((a) => a !== undefined);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
adaptersToUse = this.listAdapters();
|
|
73
|
+
}
|
|
74
|
+
// Detect which platforms are present
|
|
75
|
+
const detectedPlatforms = await this.detectPlatforms(projectPath);
|
|
76
|
+
const presentPlatforms = new Set(detectedPlatforms.filter((p) => p.detected).map((p) => p.name));
|
|
77
|
+
// Sync each skill to each platform
|
|
78
|
+
for (const skill of skills) {
|
|
79
|
+
for (const adapter of adaptersToUse) {
|
|
80
|
+
// Check if platform is present
|
|
81
|
+
if (!presentPlatforms.has(adapter.name)) {
|
|
82
|
+
result.skipped.push({
|
|
83
|
+
skill: skill.name,
|
|
84
|
+
platform: adapter.name,
|
|
85
|
+
reason: 'Platform not detected',
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
// Sync
|
|
90
|
+
try {
|
|
91
|
+
if (!dryRun) {
|
|
92
|
+
await adapter.sync(skill, projectPath);
|
|
93
|
+
}
|
|
94
|
+
result.synced.push({
|
|
95
|
+
skill: skill.name,
|
|
96
|
+
platform: adapter.name,
|
|
97
|
+
path: adapter.getOutputPath(skill.name, projectPath),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
result.success = false;
|
|
102
|
+
result.errors.push({
|
|
103
|
+
skill: skill.name,
|
|
104
|
+
platform: adapter.name,
|
|
105
|
+
error: error instanceof Error ? error.message : String(error),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sync skills to a specific platform
|
|
114
|
+
*/
|
|
115
|
+
async syncToPlatform(platform, skills, projectPath = process.cwd()) {
|
|
116
|
+
return this.sync(skills, { projectPath, platforms: [platform] });
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Remove a skill from all platforms
|
|
120
|
+
*/
|
|
121
|
+
async removeFromAllPlatforms(skillName, projectPath = process.cwd()) {
|
|
122
|
+
for (const adapter of this.adapters.values()) {
|
|
123
|
+
try {
|
|
124
|
+
await adapter.remove(skillName, projectPath);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Ignore errors during removal
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Remove a skill from a specific platform
|
|
133
|
+
*/
|
|
134
|
+
async removeFromPlatform(skillName, platform, projectPath = process.cwd()) {
|
|
135
|
+
const adapter = this.adapters.get(platform);
|
|
136
|
+
if (adapter) {
|
|
137
|
+
await adapter.remove(skillName, projectPath);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Create a new AdapterManager instance
|
|
143
|
+
*/
|
|
144
|
+
export function createAdapterManager() {
|
|
145
|
+
return new AdapterManager();
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/adapters/manager.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,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