killer-skills 1.6.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/CHANGELOG.md +156 -0
- package/LICENSE +21 -0
- package/README.md +360 -0
- package/dist/commands/completion.d.ts +8 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +242 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config.d.ts +24 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +132 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +361 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/deps.d.ts +8 -0
- package/dist/commands/deps.d.ts.map +1 -0
- package/dist/commands/deps.js +144 -0
- package/dist/commands/deps.js.map +1 -0
- package/dist/commands/do.d.ts +13 -0
- package/dist/commands/do.d.ts.map +1 -0
- package/dist/commands/do.js +223 -0
- package/dist/commands/do.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +191 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +13 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +234 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/list.d.ts +9 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +103 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/manage.d.ts +9 -0
- package/dist/commands/manage.d.ts.map +1 -0
- package/dist/commands/manage.js +132 -0
- package/dist/commands/manage.js.map +1 -0
- package/dist/commands/outdated.d.ts +9 -0
- package/dist/commands/outdated.d.ts.map +1 -0
- package/dist/commands/outdated.js +168 -0
- package/dist/commands/outdated.js.map +1 -0
- package/dist/commands/plugin.d.ts +8 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +98 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/publish.d.ts +8 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +199 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/read.d.ts +9 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +69 -0
- package/dist/commands/read.js.map +1 -0
- package/dist/commands/search.d.ts +8 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +105 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/stats.d.ts +16 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +137 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/submit.d.ts +9 -0
- package/dist/commands/submit.d.ts.map +1 -0
- package/dist/commands/submit.js +245 -0
- package/dist/commands/submit.js.map +1 -0
- package/dist/commands/sync.d.ts +11 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +134 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/update.d.ts +9 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +175 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config/claude.d.ts +2 -0
- package/dist/config/claude.d.ts.map +1 -0
- package/dist/config/claude.js +19 -0
- package/dist/config/claude.js.map +1 -0
- package/dist/config/cursor.d.ts +2 -0
- package/dist/config/cursor.d.ts.map +1 -0
- package/dist/config/cursor.js +18 -0
- package/dist/config/cursor.js.map +1 -0
- package/dist/config/ides.d.ts +19 -0
- package/dist/config/ides.d.ts.map +1 -0
- package/dist/config/ides.js +221 -0
- package/dist/config/ides.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +11 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +264 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/registry.d.ts +8 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +34 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/agents-md.d.ts +33 -0
- package/dist/utils/agents-md.d.ts.map +1 -0
- package/dist/utils/agents-md.js +137 -0
- package/dist/utils/agents-md.js.map +1 -0
- package/dist/utils/dependencies.d.ts +49 -0
- package/dist/utils/dependencies.d.ts.map +1 -0
- package/dist/utils/dependencies.js +141 -0
- package/dist/utils/dependencies.js.map +1 -0
- package/dist/utils/github.d.ts +58 -0
- package/dist/utils/github.d.ts.map +1 -0
- package/dist/utils/github.js +198 -0
- package/dist/utils/github.js.map +1 -0
- package/dist/utils/platform.d.ts +54 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +154 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/plugins.d.ts +50 -0
- package/dist/utils/plugins.d.ts.map +1 -0
- package/dist/utils/plugins.js +115 -0
- package/dist/utils/plugins.js.map +1 -0
- package/dist/utils/prompt-templates.d.ts +47 -0
- package/dist/utils/prompt-templates.d.ts.map +1 -0
- package/dist/utils/prompt-templates.js +160 -0
- package/dist/utils/prompt-templates.js.map +1 -0
- package/dist/utils/skill-metadata.d.ts +55 -0
- package/dist/utils/skill-metadata.d.ts.map +1 -0
- package/dist/utils/skill-metadata.js +82 -0
- package/dist/utils/skill-metadata.js.map +1 -0
- package/dist/utils/skills.d.ts +27 -0
- package/dist/utils/skills.d.ts.map +1 -0
- package/dist/utils/skills.js +163 -0
- package/dist/utils/skills.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates standardized XML prompt for AI agents to understand and use installed skills.
|
|
5
|
+
* Compatible with OpenSkills format for cross-tool interoperability.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, writeFileSync, mkdirSync } from 'fs';
|
|
8
|
+
import { dirname, basename } from 'path';
|
|
9
|
+
/**
|
|
10
|
+
* Generate skills XML section in OpenSkills-compatible format
|
|
11
|
+
*/
|
|
12
|
+
export function generateSkillsXml(skills) {
|
|
13
|
+
if (skills.length === 0) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
const skillTags = skills
|
|
17
|
+
.map(s => `<skill>
|
|
18
|
+
<name>${escapeXml(s.name)}</name>
|
|
19
|
+
<description>${escapeXml(s.description)}</description>
|
|
20
|
+
<location>${s.location}</location>
|
|
21
|
+
</skill>`)
|
|
22
|
+
.join('\n\n');
|
|
23
|
+
return `<skills_system priority="1">
|
|
24
|
+
|
|
25
|
+
## Available Skills
|
|
26
|
+
|
|
27
|
+
<!-- SKILLS_TABLE_START -->
|
|
28
|
+
<usage>
|
|
29
|
+
When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
|
30
|
+
|
|
31
|
+
How to use skills:
|
|
32
|
+
- Invoke: \`killer read <skill-name>\` (run in your shell)
|
|
33
|
+
- For multiple: \`killer read skill-one,skill-two\`
|
|
34
|
+
- The skill content will load with detailed instructions on how to complete the task
|
|
35
|
+
- Base directory provided in output for resolving bundled resources (references/, scripts/, assets/)
|
|
36
|
+
|
|
37
|
+
Usage notes:
|
|
38
|
+
- Only use skills listed in <available_skills> below
|
|
39
|
+
- Do not invoke a skill that is already loaded in your context
|
|
40
|
+
- Each skill invocation is stateless
|
|
41
|
+
</usage>
|
|
42
|
+
|
|
43
|
+
<available_skills>
|
|
44
|
+
|
|
45
|
+
${skillTags}
|
|
46
|
+
|
|
47
|
+
</available_skills>
|
|
48
|
+
<!-- SKILLS_TABLE_END -->
|
|
49
|
+
|
|
50
|
+
</skills_system>`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse skill names currently in an AGENTS.md file
|
|
54
|
+
*/
|
|
55
|
+
export function parseCurrentSkills(content) {
|
|
56
|
+
const skillNames = [];
|
|
57
|
+
// Match <skill><name>skill-name</name>...</skill>
|
|
58
|
+
const skillRegex = /<skill>[\s\S]*?<name>([^<]+)<\/name>[\s\S]*?<\/skill>/g;
|
|
59
|
+
let match;
|
|
60
|
+
while ((match = skillRegex.exec(content)) !== null) {
|
|
61
|
+
skillNames.push(match[1].trim());
|
|
62
|
+
}
|
|
63
|
+
return skillNames;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Replace or add skills section in a markdown file
|
|
67
|
+
*/
|
|
68
|
+
export function replaceSkillsSection(content, newSection) {
|
|
69
|
+
const startMarker = '<skills_system';
|
|
70
|
+
const endMarker = '</skills_system>';
|
|
71
|
+
// Check for XML markers
|
|
72
|
+
if (content.includes(startMarker)) {
|
|
73
|
+
const regex = /<skills_system[^>]*>[\s\S]*?<\/skills_system>/;
|
|
74
|
+
return content.replace(regex, newSection);
|
|
75
|
+
}
|
|
76
|
+
// Fallback to HTML comments
|
|
77
|
+
const htmlStartMarker = '<!-- SKILLS_TABLE_START -->';
|
|
78
|
+
const htmlEndMarker = '<!-- SKILLS_TABLE_END -->';
|
|
79
|
+
if (content.includes(htmlStartMarker)) {
|
|
80
|
+
// Extract just the inner content without outer XML wrapper
|
|
81
|
+
const innerMatch = newSection.match(/<!-- SKILLS_TABLE_START -->[\s\S]*<!-- SKILLS_TABLE_END -->/);
|
|
82
|
+
if (innerMatch) {
|
|
83
|
+
const regex = new RegExp(`${escapeRegex(htmlStartMarker)}[\\s\\S]*?${escapeRegex(htmlEndMarker)}`, 'g');
|
|
84
|
+
return content.replace(regex, innerMatch[0]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// No markers found - append to end of file
|
|
88
|
+
return content.trimEnd() + '\n\n' + newSection + '\n';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Remove skills section from a markdown file
|
|
92
|
+
*/
|
|
93
|
+
export function removeSkillsSection(content) {
|
|
94
|
+
const startMarker = '<skills_system';
|
|
95
|
+
if (content.includes(startMarker)) {
|
|
96
|
+
const regex = /<skills_system[^>]*>[\s\S]*?<\/skills_system>/;
|
|
97
|
+
return content.replace(regex, '<!-- Skills section removed -->');
|
|
98
|
+
}
|
|
99
|
+
const htmlStartMarker = '<!-- SKILLS_TABLE_START -->';
|
|
100
|
+
const htmlEndMarker = '<!-- SKILLS_TABLE_END -->';
|
|
101
|
+
if (content.includes(htmlStartMarker)) {
|
|
102
|
+
const regex = new RegExp(`${escapeRegex(htmlStartMarker)}[\\s\\S]*?${escapeRegex(htmlEndMarker)}`, 'g');
|
|
103
|
+
return content.replace(regex, `${htmlStartMarker}\n<!-- Skills section removed -->\n${htmlEndMarker}`);
|
|
104
|
+
}
|
|
105
|
+
return content;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Ensure a markdown file exists, creating it if necessary
|
|
109
|
+
*/
|
|
110
|
+
export function ensureMarkdownFile(filePath, defaultTitle) {
|
|
111
|
+
if (!existsSync(filePath)) {
|
|
112
|
+
const dir = dirname(filePath);
|
|
113
|
+
if (dir && dir !== '.' && !existsSync(dir)) {
|
|
114
|
+
mkdirSync(dir, { recursive: true });
|
|
115
|
+
}
|
|
116
|
+
const title = defaultTitle || basename(filePath).replace('.md', '');
|
|
117
|
+
writeFileSync(filePath, `# ${title}\n\n`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Escape special XML characters
|
|
122
|
+
*/
|
|
123
|
+
function escapeXml(str) {
|
|
124
|
+
return str
|
|
125
|
+
.replace(/&/g, '&')
|
|
126
|
+
.replace(/</g, '<')
|
|
127
|
+
.replace(/>/g, '>')
|
|
128
|
+
.replace(/"/g, '"')
|
|
129
|
+
.replace(/'/g, ''');
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Escape special regex characters
|
|
133
|
+
*/
|
|
134
|
+
function escapeRegex(str) {
|
|
135
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=agents-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../../src/utils/agents-md.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAgB,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AASzC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAmB;IACjD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,SAAS,GAAG,MAAM;SACnB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACV,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;eACV,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;YAC3B,CAAC,CAAC,QAAQ;SACb,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;IAElB,OAAO;;;;;;;;;;;;;;;;;;;;;;EAsBT,SAAS;;;;;iBAKM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAC9C,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,kDAAkD;IAClD,MAAM,UAAU,GAAG,wDAAwD,CAAC;IAE5E,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACjD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UA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C,GAAW;IAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Dependencies Utilities
|
|
3
|
+
*
|
|
4
|
+
* Manage skill dependencies - skills that depend on other skills.
|
|
5
|
+
*/
|
|
6
|
+
export interface SkillDependency {
|
|
7
|
+
name: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
optional?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SkillDependencies {
|
|
12
|
+
requires: SkillDependency[];
|
|
13
|
+
optional: SkillDependency[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse dependencies from SKILL.md frontmatter
|
|
17
|
+
*
|
|
18
|
+
* Example SKILL.md:
|
|
19
|
+
* ---
|
|
20
|
+
* name: my-skill
|
|
21
|
+
* requires:
|
|
22
|
+
* - pdf
|
|
23
|
+
* - docx
|
|
24
|
+
* optional:
|
|
25
|
+
* - xlsx
|
|
26
|
+
* ---
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseDependencies(skillMdContent: string): SkillDependencies;
|
|
29
|
+
/**
|
|
30
|
+
* Check if all required dependencies are installed
|
|
31
|
+
*/
|
|
32
|
+
export declare function checkDependencies(skillPath: string, installedSkills: string[]): Promise<{
|
|
33
|
+
satisfied: boolean;
|
|
34
|
+
missing: SkillDependency[];
|
|
35
|
+
optional: SkillDependency[];
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Display dependency check results
|
|
39
|
+
*/
|
|
40
|
+
export declare function displayDependencyStatus(skillName: string, result: {
|
|
41
|
+
satisfied: boolean;
|
|
42
|
+
missing: SkillDependency[];
|
|
43
|
+
optional: SkillDependency[];
|
|
44
|
+
}): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get all dependencies for a skill recursively
|
|
47
|
+
*/
|
|
48
|
+
export declare function getAllDependencies(skillPath: string, getSkillPath: (name: string) => string | null, visited?: Set<string>): Promise<SkillDependency[]>;
|
|
49
|
+
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/utils/dependencies.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,iBAAiB,CAyC3E;AAeD;;GAEG;AACH,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC,CAoB1F;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,GACxF,IAAI,CAqBN;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACpC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,EAC7C,OAAO,cAAoB,GAC5B,OAAO,CAAC,eAAe,EAAE,CAAC,CA4B5B"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Dependencies Utilities
|
|
3
|
+
*
|
|
4
|
+
* Manage skill dependencies - skills that depend on other skills.
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'fs-extra';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
/**
|
|
10
|
+
* Parse dependencies from SKILL.md frontmatter
|
|
11
|
+
*
|
|
12
|
+
* Example SKILL.md:
|
|
13
|
+
* ---
|
|
14
|
+
* name: my-skill
|
|
15
|
+
* requires:
|
|
16
|
+
* - pdf
|
|
17
|
+
* - docx
|
|
18
|
+
* optional:
|
|
19
|
+
* - xlsx
|
|
20
|
+
* ---
|
|
21
|
+
*/
|
|
22
|
+
export function parseDependencies(skillMdContent) {
|
|
23
|
+
const result = {
|
|
24
|
+
requires: [],
|
|
25
|
+
optional: []
|
|
26
|
+
};
|
|
27
|
+
const frontmatterMatch = skillMdContent.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
28
|
+
if (!frontmatterMatch)
|
|
29
|
+
return result;
|
|
30
|
+
const frontmatter = frontmatterMatch[1];
|
|
31
|
+
// Parse requires
|
|
32
|
+
const requiresMatch = frontmatter.match(/^requires:\s*\n((?:\s*-\s*.+\n?)*)/m);
|
|
33
|
+
if (requiresMatch) {
|
|
34
|
+
const lines = requiresMatch[1].split('\n');
|
|
35
|
+
for (const line of lines) {
|
|
36
|
+
const match = line.match(/^\s*-\s*(.+)\s*$/);
|
|
37
|
+
if (match) {
|
|
38
|
+
const dep = parseDependencyString(match[1].trim());
|
|
39
|
+
if (dep)
|
|
40
|
+
result.requires.push(dep);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Parse optional
|
|
45
|
+
const optionalMatch = frontmatter.match(/^optional:\s*\n((?:\s*-\s*.+\n?)*)/m);
|
|
46
|
+
if (optionalMatch) {
|
|
47
|
+
const lines = optionalMatch[1].split('\n');
|
|
48
|
+
for (const line of lines) {
|
|
49
|
+
const match = line.match(/^\s*-\s*(.+)\s*$/);
|
|
50
|
+
if (match) {
|
|
51
|
+
const dep = parseDependencyString(match[1].trim());
|
|
52
|
+
if (dep) {
|
|
53
|
+
dep.optional = true;
|
|
54
|
+
result.optional.push(dep);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse a dependency string like "pdf" or "pdf@1.0.0"
|
|
63
|
+
*/
|
|
64
|
+
function parseDependencyString(str) {
|
|
65
|
+
if (!str)
|
|
66
|
+
return null;
|
|
67
|
+
const parts = str.split('@');
|
|
68
|
+
return {
|
|
69
|
+
name: parts[0].trim(),
|
|
70
|
+
version: parts[1]?.trim()
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Check if all required dependencies are installed
|
|
75
|
+
*/
|
|
76
|
+
export async function checkDependencies(skillPath, installedSkills) {
|
|
77
|
+
const skillMdPath = path.join(skillPath, 'SKILL.md');
|
|
78
|
+
if (!await fs.pathExists(skillMdPath)) {
|
|
79
|
+
return { satisfied: true, missing: [], optional: [] };
|
|
80
|
+
}
|
|
81
|
+
const content = await fs.readFile(skillMdPath, 'utf-8');
|
|
82
|
+
const deps = parseDependencies(content);
|
|
83
|
+
const installedSet = new Set(installedSkills.map(s => s.toLowerCase()));
|
|
84
|
+
const missing = deps.requires.filter(d => !installedSet.has(d.name.toLowerCase()));
|
|
85
|
+
const optionalMissing = deps.optional.filter(d => !installedSet.has(d.name.toLowerCase()));
|
|
86
|
+
return {
|
|
87
|
+
satisfied: missing.length === 0,
|
|
88
|
+
missing,
|
|
89
|
+
optional: optionalMissing
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Display dependency check results
|
|
94
|
+
*/
|
|
95
|
+
export function displayDependencyStatus(skillName, result) {
|
|
96
|
+
if (result.satisfied && result.optional.length === 0) {
|
|
97
|
+
console.log(chalk.green(` ✓ All dependencies satisfied for ${skillName}`));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!result.satisfied) {
|
|
101
|
+
console.log(chalk.red(`\n⚠️ Missing dependencies for ${skillName}:`));
|
|
102
|
+
for (const dep of result.missing) {
|
|
103
|
+
console.log(chalk.red(` • ${dep.name}${dep.version ? `@${dep.version}` : ''}`));
|
|
104
|
+
}
|
|
105
|
+
console.log(chalk.dim('\nInstall missing dependencies:'));
|
|
106
|
+
console.log(chalk.cyan(` killer install ${result.missing.map(d => d.name).join(' ')}`));
|
|
107
|
+
}
|
|
108
|
+
if (result.optional.length > 0) {
|
|
109
|
+
console.log(chalk.yellow(`\n💡 Optional dependencies for ${skillName}:`));
|
|
110
|
+
for (const dep of result.optional) {
|
|
111
|
+
console.log(chalk.yellow(` • ${dep.name}${dep.version ? `@${dep.version}` : ''} (optional)`));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get all dependencies for a skill recursively
|
|
117
|
+
*/
|
|
118
|
+
export async function getAllDependencies(skillPath, getSkillPath, visited = new Set()) {
|
|
119
|
+
const skillMdPath = path.join(skillPath, 'SKILL.md');
|
|
120
|
+
if (!await fs.pathExists(skillMdPath)) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
const skillName = path.basename(skillPath);
|
|
124
|
+
if (visited.has(skillName)) {
|
|
125
|
+
return []; // Avoid circular dependencies
|
|
126
|
+
}
|
|
127
|
+
visited.add(skillName);
|
|
128
|
+
const content = await fs.readFile(skillMdPath, 'utf-8');
|
|
129
|
+
const deps = parseDependencies(content);
|
|
130
|
+
const allDeps = [...deps.requires, ...deps.optional];
|
|
131
|
+
// Recursively get dependencies of dependencies
|
|
132
|
+
for (const dep of deps.requires) {
|
|
133
|
+
const depPath = getSkillPath(dep.name);
|
|
134
|
+
if (depPath) {
|
|
135
|
+
const subDeps = await getAllDependencies(depPath, getSkillPath, visited);
|
|
136
|
+
allDeps.push(...subDeps);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return allDeps;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/utils/dependencies.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,cAAsB;IACpD,MAAM,MAAM,GAAsB;QAC9B,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,EAAE;KACf,CAAC;IAEF,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC1E,IAAI,CAAC,gBAAgB;QAAE,OAAO,MAAM,CAAC;IAErC,MAAM,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAExC,iBAAiB;IACjB,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC/E,IAAI,aAAa,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YAC7C,IAAI,KAAK,EAAE,CAAC;gBACR,MAAM,GAAG,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBACnD,IAAI,GAAG;oBAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACvC,CAAC;QACL,CAAC;IACL,CAAC;IAED,i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C,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC,CAAC,8BAA8B;IAC7C,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEvB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,OAAO,GAAsB,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAExE,+CAA+C;IAC/C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;YACzE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QAC7B,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub API Utilities
|
|
3
|
+
*
|
|
4
|
+
* Functions for fetching skills from GitHub repositories.
|
|
5
|
+
* Converted from github.js to TypeScript.
|
|
6
|
+
*/
|
|
7
|
+
export interface RepoInfo {
|
|
8
|
+
owner: string;
|
|
9
|
+
repo: string;
|
|
10
|
+
skillPath: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface SkillFile {
|
|
13
|
+
path: string;
|
|
14
|
+
content: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse repo string (owner/repo) into components
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseRepoString(repoString: string): RepoInfo;
|
|
20
|
+
/**
|
|
21
|
+
* Check if string looks like a GitHub repo reference
|
|
22
|
+
*/
|
|
23
|
+
export declare function isGitHubRepo(source: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Normalize GitHub URL to owner/repo format
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeGitHubUrl(source: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Fetch JSON from GitHub API
|
|
30
|
+
*/
|
|
31
|
+
export declare function fetchGitHubAPI<T>(endpoint: string): Promise<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch raw file content from GitHub
|
|
34
|
+
*/
|
|
35
|
+
export declare function fetchRawFile(owner: string, repo: string, filePath: string, branch?: string): Promise<string>;
|
|
36
|
+
interface TreeItem {
|
|
37
|
+
path: string;
|
|
38
|
+
type: 'blob' | 'tree';
|
|
39
|
+
sha: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get repository tree to find all files
|
|
43
|
+
*/
|
|
44
|
+
export declare function getRepoTree(owner: string, repo: string, branch?: string): Promise<TreeItem[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Find SKILL.md file in repository
|
|
47
|
+
*/
|
|
48
|
+
export declare function findSkillFile(owner: string, repo: string): Promise<TreeItem>;
|
|
49
|
+
/**
|
|
50
|
+
* Download all files for a skill
|
|
51
|
+
*/
|
|
52
|
+
export declare function downloadSkillFiles(owner: string, repo: string, skillBasePath?: string): Promise<SkillFile[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Search for skills on GitHub
|
|
55
|
+
*/
|
|
56
|
+
export declare function searchSkillsOnGitHub(query: string, limit?: number): Promise<unknown[]>;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|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AK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,SAAK,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAmC9G;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAexF"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub API Utilities
|
|
3
|
+
*
|
|
4
|
+
* Functions for fetching skills from GitHub repositories.
|
|
5
|
+
* Converted from github.js to TypeScript.
|
|
6
|
+
*/
|
|
7
|
+
import https from 'https';
|
|
8
|
+
const GITHUB_API_BASE = 'https://api.github.com';
|
|
9
|
+
/**
|
|
10
|
+
* Parse repo string (owner/repo) into components
|
|
11
|
+
*/
|
|
12
|
+
export function parseRepoString(repoString) {
|
|
13
|
+
const parts = repoString.split('/');
|
|
14
|
+
if (parts.length < 2) {
|
|
15
|
+
throw new Error(`Invalid repo format: ${repoString}. Expected: owner/repo`);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
owner: parts[0],
|
|
19
|
+
repo: parts[1],
|
|
20
|
+
skillPath: parts.length > 2 ? parts.slice(2).join('/') : null
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if string looks like a GitHub repo reference
|
|
25
|
+
*/
|
|
26
|
+
export function isGitHubRepo(source) {
|
|
27
|
+
// Matches: owner/repo, owner/repo/path, github.com/owner/repo
|
|
28
|
+
if (source.includes('github.com'))
|
|
29
|
+
return true;
|
|
30
|
+
if (source.startsWith('git@') || source.startsWith('https://'))
|
|
31
|
+
return true;
|
|
32
|
+
// Check for owner/repo pattern (must have exactly one slash at start)
|
|
33
|
+
const parts = source.split('/');
|
|
34
|
+
if (parts.length >= 2 && !source.startsWith('/') && !source.startsWith('.')) {
|
|
35
|
+
// Check if first part looks like a username (not a path)
|
|
36
|
+
return /^[a-zA-Z0-9_-]+$/.test(parts[0]) && /^[a-zA-Z0-9_.-]+$/.test(parts[1]);
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Normalize GitHub URL to owner/repo format
|
|
42
|
+
*/
|
|
43
|
+
export function normalizeGitHubUrl(source) {
|
|
44
|
+
// Handle github.com URLs
|
|
45
|
+
const urlMatch = source.match(/github\.com[\/:]([^\/]+)\/([^\/\s]+)/);
|
|
46
|
+
if (urlMatch) {
|
|
47
|
+
return `${urlMatch[1]}/${urlMatch[2].replace('.git', '')}`;
|
|
48
|
+
}
|
|
49
|
+
return source;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Fetch JSON from GitHub API
|
|
53
|
+
*/
|
|
54
|
+
export async function fetchGitHubAPI(endpoint) {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const url = `${GITHUB_API_BASE}${endpoint}`;
|
|
57
|
+
const options = {
|
|
58
|
+
headers: {
|
|
59
|
+
'User-Agent': 'killer-skills-cli',
|
|
60
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
61
|
+
...(process.env.GITHUB_TOKEN && {
|
|
62
|
+
'Authorization': `token ${process.env.GITHUB_TOKEN}`
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
https.get(url, options, (res) => {
|
|
67
|
+
let data = '';
|
|
68
|
+
res.on('data', chunk => data += chunk);
|
|
69
|
+
res.on('end', () => {
|
|
70
|
+
if (res.statusCode !== 200) {
|
|
71
|
+
reject(new Error(`GitHub API error: ${res.statusCode} - ${data}`));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
resolve(JSON.parse(data));
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
reject(new Error(`Failed to parse GitHub response: ${e.message}`));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}).on('error', reject);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Fetch raw file content from GitHub
|
|
86
|
+
*/
|
|
87
|
+
export async function fetchRawFile(owner, repo, filePath, branch = 'main') {
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${filePath}`;
|
|
90
|
+
https.get(url, (res) => {
|
|
91
|
+
// Handle redirect
|
|
92
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
93
|
+
const location = res.headers.location;
|
|
94
|
+
if (location) {
|
|
95
|
+
https.get(location, (redirectRes) => {
|
|
96
|
+
let data = '';
|
|
97
|
+
redirectRes.on('data', chunk => data += chunk);
|
|
98
|
+
redirectRes.on('end', () => resolve(data));
|
|
99
|
+
}).on('error', reject);
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (res.statusCode !== 200) {
|
|
104
|
+
// Try 'master' branch if 'main' fails
|
|
105
|
+
if (branch === 'main') {
|
|
106
|
+
fetchRawFile(owner, repo, filePath, 'master')
|
|
107
|
+
.then(resolve)
|
|
108
|
+
.catch(reject);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
reject(new Error(`Failed to fetch ${filePath}: ${res.statusCode}`));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
let data = '';
|
|
115
|
+
res.on('data', chunk => data += chunk);
|
|
116
|
+
res.on('end', () => resolve(data));
|
|
117
|
+
}).on('error', reject);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get repository tree to find all files
|
|
122
|
+
*/
|
|
123
|
+
export async function getRepoTree(owner, repo, branch = 'main') {
|
|
124
|
+
try {
|
|
125
|
+
const data = await fetchGitHubAPI(`/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`);
|
|
126
|
+
return data.tree || [];
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
// Try master branch
|
|
130
|
+
if (branch === 'main') {
|
|
131
|
+
return getRepoTree(owner, repo, 'master');
|
|
132
|
+
}
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Find SKILL.md file in repository
|
|
138
|
+
*/
|
|
139
|
+
export async function findSkillFile(owner, repo) {
|
|
140
|
+
const tree = await getRepoTree(owner, repo);
|
|
141
|
+
// Look for SKILL.md - prefer root level
|
|
142
|
+
const skillFiles = tree.filter(item => item.type === 'blob' && item.path.endsWith('SKILL.md'));
|
|
143
|
+
if (skillFiles.length === 0) {
|
|
144
|
+
throw new Error(`No SKILL.md found in ${owner}/${repo}`);
|
|
145
|
+
}
|
|
146
|
+
// Prefer root level SKILL.md
|
|
147
|
+
const rootSkill = skillFiles.find(f => f.path === 'SKILL.md');
|
|
148
|
+
return rootSkill || skillFiles[0];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Download all files for a skill
|
|
152
|
+
*/
|
|
153
|
+
export async function downloadSkillFiles(owner, repo, skillBasePath = '') {
|
|
154
|
+
const tree = await getRepoTree(owner, repo);
|
|
155
|
+
// Find all files related to the skill
|
|
156
|
+
const prefix = skillBasePath ? `${skillBasePath}/` : '';
|
|
157
|
+
const skillFiles = tree.filter(item => item.type === 'blob' &&
|
|
158
|
+
(item.path.startsWith(prefix) || !skillBasePath));
|
|
159
|
+
const files = [];
|
|
160
|
+
for (const file of skillFiles) {
|
|
161
|
+
// Skip files that are definitely not part of a skill
|
|
162
|
+
if (file.path.includes('node_modules/') ||
|
|
163
|
+
file.path.includes('.git/') ||
|
|
164
|
+
file.path.startsWith('.')) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const content = await fetchRawFile(owner, repo, file.path);
|
|
169
|
+
const relativePath = skillBasePath
|
|
170
|
+
? file.path.replace(`${skillBasePath}/`, '')
|
|
171
|
+
: file.path;
|
|
172
|
+
files.push({
|
|
173
|
+
path: relativePath,
|
|
174
|
+
content
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
console.warn(`Warning: Could not download ${file.path}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return files;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Search for skills on GitHub
|
|
185
|
+
*/
|
|
186
|
+
export async function searchSkillsOnGitHub(query, limit = 10) {
|
|
187
|
+
const searchQuery = encodeURIComponent(`${query} filename:SKILL.md`);
|
|
188
|
+
const endpoint = `/search/code?q=${searchQuery}&per_page=${limit}`;
|
|
189
|
+
try {
|
|
190
|
+
const data = await fetchGitHubAPI(endpoint);
|
|
191
|
+
return data.items || [];
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
console.error('Search failed:', e.message);
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,eAAe,GAAG,wBAAwB,CAAC;AAajD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAC9C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,wBAAwB,UAAU,wBAAwB,CAAC,CAAC;IAChF,CAAC;IAED,OAAO;QACH,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACf,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAA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