agent-skills-cli 1.0.9 → 1.1.1
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/README.md +110 -14
- package/dist/__tests__/git-auth.test.d.ts +11 -0
- package/dist/__tests__/git-auth.test.d.ts.map +1 -0
- package/dist/__tests__/git-auth.test.js +160 -0
- package/dist/__tests__/git-auth.test.js.map +1 -0
- package/dist/__tests__/skill-lock.test.d.ts +8 -0
- package/dist/__tests__/skill-lock.test.d.ts.map +1 -0
- package/dist/__tests__/skill-lock.test.js +104 -0
- package/dist/__tests__/skill-lock.test.js.map +1 -0
- package/dist/__tests__/skillsrc.test.d.ts +11 -0
- package/dist/__tests__/skillsrc.test.d.ts.map +1 -0
- package/dist/__tests__/skillsrc.test.js +185 -0
- package/dist/__tests__/skillsrc.test.js.map +1 -0
- package/dist/__tests__/source-parser.test.d.ts +16 -0
- package/dist/__tests__/source-parser.test.d.ts.map +1 -0
- package/dist/__tests__/source-parser.test.js +231 -0
- package/dist/__tests__/source-parser.test.js.map +1 -0
- package/dist/adapters/adapter.d.ts +51 -0
- package/dist/adapters/adapter.d.ts.map +1 -0
- package/dist/adapters/adapter.js +51 -0
- package/dist/adapters/adapter.js.map +1 -0
- package/dist/adapters/claude.d.ts +16 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +30 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/copilot.d.ts +16 -0
- package/dist/adapters/copilot.d.ts.map +1 -0
- package/dist/adapters/copilot.js +32 -0
- package/dist/adapters/copilot.js.map +1 -0
- package/dist/adapters/cursor.d.ts +17 -0
- package/dist/adapters/cursor.d.ts.map +1 -0
- package/dist/adapters/cursor.js +34 -0
- package/dist/adapters/cursor.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 +10 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/universal.d.ts +12 -0
- package/dist/adapters/universal.d.ts.map +1 -0
- package/dist/adapters/universal.js +16 -0
- package/dist/adapters/universal.js.map +1 -0
- package/dist/cli/agents.d.ts +11 -0
- package/dist/cli/agents.d.ts.map +1 -1
- package/dist/cli/agents.js +47 -0
- package/dist/cli/agents.js.map +1 -1
- package/dist/cli/commands/convert.d.ts.map +1 -1
- package/dist/cli/commands/convert.js +16 -65
- package/dist/cli/commands/convert.js.map +1 -1
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +15 -7
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/install.d.ts +8 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +203 -90
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/score.d.ts +10 -0
- package/dist/cli/commands/score.d.ts.map +1 -0
- package/dist/cli/commands/score.js +91 -0
- package/dist/cli/commands/score.js.map +1 -0
- package/dist/cli/commands/show.d.ts.map +1 -1
- package/dist/cli/commands/show.js +8 -0
- package/dist/cli/commands/show.js.map +1 -1
- package/dist/cli/commands/submit-repo.d.ts +11 -0
- package/dist/cli/commands/submit-repo.d.ts.map +1 -0
- package/dist/cli/commands/submit-repo.js +133 -0
- package/dist/cli/commands/submit-repo.js.map +1 -0
- package/dist/cli/commands/submit.d.ts.map +1 -1
- package/dist/cli/commands/submit.js +10 -0
- package/dist/cli/commands/submit.js.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/git-auth.d.ts +74 -0
- package/dist/core/git-auth.d.ts.map +1 -0
- package/dist/core/git-auth.js +299 -0
- package/dist/core/git-auth.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +7 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/quality.d.ts +48 -0
- package/dist/core/quality.d.ts.map +1 -0
- package/dist/core/quality.js +241 -0
- package/dist/core/quality.js.map +1 -0
- package/dist/core/skill-lock.d.ts +1 -1
- package/dist/core/skill-lock.d.ts.map +1 -1
- package/dist/core/skillsrc.d.ts +65 -0
- package/dist/core/skillsrc.d.ts.map +1 -0
- package/dist/core/skillsrc.js +161 -0
- package/dist/core/skillsrc.js.map +1 -0
- package/dist/core/source-parser.d.ts +9 -1
- package/dist/core/source-parser.d.ts.map +1 -1
- package/dist/core/source-parser.js +85 -6
- package/dist/core/source-parser.js.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for skillsrc.ts
|
|
3
|
+
*
|
|
4
|
+
* Validates:
|
|
5
|
+
* - JSON config parsing
|
|
6
|
+
* - Source filtering by type
|
|
7
|
+
* - Registry lookup by scope
|
|
8
|
+
* - Auth env var resolution
|
|
9
|
+
*/
|
|
10
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
11
|
+
import { writeFile, mkdir, rm } from 'fs/promises';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
import { tmpdir } from 'os';
|
|
14
|
+
import { loadSkillsRC, getSourcesByType, getRegistryForScope, getAuthEnvVar, } from '../core/skillsrc.js';
|
|
15
|
+
// ─── Test Helpers ────────────────────────────────────────────────────
|
|
16
|
+
let testDir;
|
|
17
|
+
beforeEach(async () => {
|
|
18
|
+
testDir = join(tmpdir(), `skillsrc-test-${Date.now()}`);
|
|
19
|
+
await mkdir(testDir, { recursive: true });
|
|
20
|
+
});
|
|
21
|
+
afterEach(async () => {
|
|
22
|
+
await rm(testDir, { recursive: true, force: true }).catch(() => { });
|
|
23
|
+
});
|
|
24
|
+
// ─── JSON Config Loading ─────────────────────────────────────────────
|
|
25
|
+
describe('loadSkillsRC - JSON', () => {
|
|
26
|
+
it('should load .skillsrc.json file', async () => {
|
|
27
|
+
const config = {
|
|
28
|
+
sources: [
|
|
29
|
+
{ type: 'git', url: 'https://git.company.com/team/skills', auth: 'env', envVar: 'COMPANY_TOKEN' },
|
|
30
|
+
{ type: 'npm', registry: 'https://npm.company.com', scope: '@company' },
|
|
31
|
+
],
|
|
32
|
+
defaults: {
|
|
33
|
+
agents: ['cursor', 'claude'],
|
|
34
|
+
global: false,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
await writeFile(join(testDir, '.skillsrc.json'), JSON.stringify(config, null, 2));
|
|
38
|
+
const result = await loadSkillsRC(testDir);
|
|
39
|
+
expect(result).not.toBeNull();
|
|
40
|
+
expect(result.sources).toHaveLength(2);
|
|
41
|
+
expect(result.sources[0].type).toBe('git');
|
|
42
|
+
expect(result.sources[1].type).toBe('npm');
|
|
43
|
+
expect(result.defaults.agents).toEqual(['cursor', 'claude']);
|
|
44
|
+
});
|
|
45
|
+
it('should load .skillsrc file with JSON content', async () => {
|
|
46
|
+
const config = {
|
|
47
|
+
sources: [
|
|
48
|
+
{ type: 'git', url: 'https://gitlab.com/private/repo' },
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
await writeFile(join(testDir, '.skillsrc'), JSON.stringify(config));
|
|
52
|
+
const result = await loadSkillsRC(testDir);
|
|
53
|
+
expect(result).not.toBeNull();
|
|
54
|
+
expect(result.sources).toHaveLength(1);
|
|
55
|
+
});
|
|
56
|
+
it('should return null when no config exists', async () => {
|
|
57
|
+
const emptyDir = join(tmpdir(), `empty-${Date.now()}`);
|
|
58
|
+
await mkdir(emptyDir, { recursive: true });
|
|
59
|
+
// Pass emptyDir as cwd, and override homedir by providing the path
|
|
60
|
+
const result = await loadSkillsRC(emptyDir);
|
|
61
|
+
// May or may not find a config depending on user's homedir
|
|
62
|
+
// Just verify it doesn't throw
|
|
63
|
+
expect(result === null || typeof result === 'object').toBe(true);
|
|
64
|
+
await rm(emptyDir, { recursive: true, force: true }).catch(() => { });
|
|
65
|
+
});
|
|
66
|
+
it('should handle empty JSON object', async () => {
|
|
67
|
+
await writeFile(join(testDir, '.skillsrc.json'), '{}');
|
|
68
|
+
const result = await loadSkillsRC(testDir);
|
|
69
|
+
// Empty object is valid but has no sources
|
|
70
|
+
expect(result).not.toBeNull();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
// ─── Source Filtering ────────────────────────────────────────────────
|
|
74
|
+
describe('getSourcesByType', () => {
|
|
75
|
+
const config = {
|
|
76
|
+
sources: [
|
|
77
|
+
{ type: 'git', url: 'https://git.company.com/team/skills' },
|
|
78
|
+
{ type: 'npm', registry: 'https://npm.company.com', scope: '@company' },
|
|
79
|
+
{ type: 'git', url: 'https://gitlab.com/other/repo' },
|
|
80
|
+
{ type: 'npm', scope: '@internal' },
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
it('should filter git sources', () => {
|
|
84
|
+
const gitSources = getSourcesByType(config, 'git');
|
|
85
|
+
expect(gitSources).toHaveLength(2);
|
|
86
|
+
expect(gitSources.every(s => s.type === 'git')).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
it('should filter npm sources', () => {
|
|
89
|
+
const npmSources = getSourcesByType(config, 'npm');
|
|
90
|
+
expect(npmSources).toHaveLength(2);
|
|
91
|
+
expect(npmSources.every(s => s.type === 'npm')).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
it('should return empty array for no matches', () => {
|
|
94
|
+
const result = getSourcesByType({ sources: [] }, 'git');
|
|
95
|
+
expect(result).toHaveLength(0);
|
|
96
|
+
});
|
|
97
|
+
it('should handle config without sources', () => {
|
|
98
|
+
const result = getSourcesByType({}, 'git');
|
|
99
|
+
expect(result).toHaveLength(0);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
// ─── Registry Lookup ─────────────────────────────────────────────────
|
|
103
|
+
describe('getRegistryForScope', () => {
|
|
104
|
+
const config = {
|
|
105
|
+
sources: [
|
|
106
|
+
{ type: 'npm', registry: 'https://npm.company.com', scope: '@company' },
|
|
107
|
+
{ type: 'npm', registry: 'https://npm.internal.io', scope: '@internal' },
|
|
108
|
+
{ type: 'npm', scope: '@public' }, // no registry
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
it('should find registry for matching scope', () => {
|
|
112
|
+
expect(getRegistryForScope(config, '@company')).toBe('https://npm.company.com');
|
|
113
|
+
expect(getRegistryForScope(config, '@internal')).toBe('https://npm.internal.io');
|
|
114
|
+
});
|
|
115
|
+
it('should return undefined for scope without registry', () => {
|
|
116
|
+
expect(getRegistryForScope(config, '@public')).toBeUndefined();
|
|
117
|
+
});
|
|
118
|
+
it('should return undefined for unknown scope', () => {
|
|
119
|
+
expect(getRegistryForScope(config, '@unknown')).toBeUndefined();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
// ─── Auth Env Var Lookup ─────────────────────────────────────────────
|
|
123
|
+
describe('getAuthEnvVar', () => {
|
|
124
|
+
const config = {
|
|
125
|
+
sources: [
|
|
126
|
+
{ type: 'git', url: 'git.company.com', envVar: 'COMPANY_GIT_TOKEN' },
|
|
127
|
+
{ type: 'git', url: 'gitlab.internal.io', envVar: 'INTERNAL_TOKEN' },
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
it('should find env var for matching URL', () => {
|
|
131
|
+
expect(getAuthEnvVar(config, 'https://git.company.com/team/repo')).toBe('COMPANY_GIT_TOKEN');
|
|
132
|
+
});
|
|
133
|
+
it('should find env var with partial URL match', () => {
|
|
134
|
+
expect(getAuthEnvVar(config, 'https://gitlab.internal.io/project')).toBe('INTERNAL_TOKEN');
|
|
135
|
+
});
|
|
136
|
+
it('should return undefined for non-matching URL', () => {
|
|
137
|
+
expect(getAuthEnvVar(config, 'https://github.com/owner/repo')).toBeUndefined();
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
// ─── Complex Config ──────────────────────────────────────────────────
|
|
141
|
+
describe('loadSkillsRC - Complex Scenarios', () => {
|
|
142
|
+
it('should handle config with all fields populated', async () => {
|
|
143
|
+
const config = {
|
|
144
|
+
sources: [
|
|
145
|
+
{
|
|
146
|
+
type: 'git',
|
|
147
|
+
url: 'https://git.company.com/team/skills',
|
|
148
|
+
auth: 'env',
|
|
149
|
+
envVar: 'COMPANY_TOKEN',
|
|
150
|
+
name: 'Company Skills',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'npm',
|
|
154
|
+
registry: 'https://npm.company.com',
|
|
155
|
+
scope: '@company',
|
|
156
|
+
auth: 'token',
|
|
157
|
+
name: 'Company npm',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
defaults: {
|
|
161
|
+
agents: ['cursor', 'claude', 'copilot'],
|
|
162
|
+
global: true,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
await writeFile(join(testDir, '.skillsrc.json'), JSON.stringify(config, null, 2));
|
|
166
|
+
const result = await loadSkillsRC(testDir);
|
|
167
|
+
expect(result).not.toBeNull();
|
|
168
|
+
expect(result.sources).toHaveLength(2);
|
|
169
|
+
expect(result.sources[0].name).toBe('Company Skills');
|
|
170
|
+
expect(result.sources[1].registry).toBe('https://npm.company.com');
|
|
171
|
+
expect(result.defaults.global).toBe(true);
|
|
172
|
+
expect(result.defaults.agents).toHaveLength(3);
|
|
173
|
+
});
|
|
174
|
+
it('should prioritize project config over home config', async () => {
|
|
175
|
+
// Create project-level config
|
|
176
|
+
const projectConfig = {
|
|
177
|
+
sources: [{ type: 'git', url: 'project-source' }],
|
|
178
|
+
};
|
|
179
|
+
await writeFile(join(testDir, '.skillsrc.json'), JSON.stringify(projectConfig));
|
|
180
|
+
const result = await loadSkillsRC(testDir);
|
|
181
|
+
expect(result).not.toBeNull();
|
|
182
|
+
expect(result.sources[0].url).toBe('project-source');
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
//# sourceMappingURL=skillsrc.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillsrc.test.js","sourceRoot":"","sources":["../../src/__tests__/skillsrc.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU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AC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for source-parser.ts
|
|
3
|
+
*
|
|
4
|
+
* Validates parsing of all supported source formats:
|
|
5
|
+
* - Local paths
|
|
6
|
+
* - GitHub URLs (with/without branches, subpaths, shorthand)
|
|
7
|
+
* - GitLab URLs
|
|
8
|
+
* - Bitbucket URLs
|
|
9
|
+
* - SSH URLs (git@host:path)
|
|
10
|
+
* - npm packages (npm:@scope/pkg)
|
|
11
|
+
* - Private/self-hosted Git URLs
|
|
12
|
+
* - Direct SKILL.md URLs
|
|
13
|
+
* - Well-known URLs
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=source-parser.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-parser.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/source-parser.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for source-parser.ts
|
|
3
|
+
*
|
|
4
|
+
* Validates parsing of all supported source formats:
|
|
5
|
+
* - Local paths
|
|
6
|
+
* - GitHub URLs (with/without branches, subpaths, shorthand)
|
|
7
|
+
* - GitLab URLs
|
|
8
|
+
* - Bitbucket URLs
|
|
9
|
+
* - SSH URLs (git@host:path)
|
|
10
|
+
* - npm packages (npm:@scope/pkg)
|
|
11
|
+
* - Private/self-hosted Git URLs
|
|
12
|
+
* - Direct SKILL.md URLs
|
|
13
|
+
* - Well-known URLs
|
|
14
|
+
*/
|
|
15
|
+
import { describe, it, expect } from 'vitest';
|
|
16
|
+
import { parseSource, getOwnerRepo, getSourceTypeDisplay } from '../core/source-parser.js';
|
|
17
|
+
// ─── Local Paths ─────────────────────────────────────────────────────
|
|
18
|
+
describe('parseSource - Local Paths', () => {
|
|
19
|
+
it('should parse current directory', () => {
|
|
20
|
+
const result = parseSource('.');
|
|
21
|
+
expect(result.type).toBe('local');
|
|
22
|
+
expect(result.localPath).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
it('should parse relative path', () => {
|
|
25
|
+
const result = parseSource('./my-skill');
|
|
26
|
+
expect(result.type).toBe('local');
|
|
27
|
+
expect(result.localPath).toContain('my-skill');
|
|
28
|
+
});
|
|
29
|
+
it('should parse parent relative path', () => {
|
|
30
|
+
const result = parseSource('../other-skill');
|
|
31
|
+
expect(result.type).toBe('local');
|
|
32
|
+
expect(result.localPath).toContain('other-skill');
|
|
33
|
+
});
|
|
34
|
+
it('should parse absolute path', () => {
|
|
35
|
+
const result = parseSource('/home/user/skills/my-skill');
|
|
36
|
+
expect(result.type).toBe('local');
|
|
37
|
+
expect(result.localPath).toBe('/home/user/skills/my-skill');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
// ─── GitHub URLs ─────────────────────────────────────────────────────
|
|
41
|
+
describe('parseSource - GitHub URLs', () => {
|
|
42
|
+
it('should parse basic GitHub URL', () => {
|
|
43
|
+
const result = parseSource('https://github.com/owner/repo');
|
|
44
|
+
expect(result.type).toBe('github');
|
|
45
|
+
expect(result.url).toBe('https://github.com/owner/repo.git');
|
|
46
|
+
});
|
|
47
|
+
it('should parse GitHub URL with .git suffix', () => {
|
|
48
|
+
const result = parseSource('https://github.com/owner/repo.git');
|
|
49
|
+
expect(result.type).toBe('github');
|
|
50
|
+
expect(result.url).toBe('https://github.com/owner/repo.git');
|
|
51
|
+
});
|
|
52
|
+
it('should parse GitHub URL with branch', () => {
|
|
53
|
+
const result = parseSource('https://github.com/owner/repo/tree/develop');
|
|
54
|
+
expect(result.type).toBe('github');
|
|
55
|
+
expect(result.ref).toBe('develop');
|
|
56
|
+
});
|
|
57
|
+
it('should parse GitHub URL with branch and subpath', () => {
|
|
58
|
+
const result = parseSource('https://github.com/owner/repo/tree/main/skills/my-skill');
|
|
59
|
+
expect(result.type).toBe('github');
|
|
60
|
+
expect(result.ref).toBe('main');
|
|
61
|
+
expect(result.subpath).toBe('skills/my-skill');
|
|
62
|
+
});
|
|
63
|
+
it('should parse GitHub shorthand owner/repo', () => {
|
|
64
|
+
const result = parseSource('anthropics/skills');
|
|
65
|
+
expect(result.type).toBe('github');
|
|
66
|
+
expect(result.url).toBe('https://github.com/anthropics/skills.git');
|
|
67
|
+
});
|
|
68
|
+
it('should parse GitHub shorthand with subpath', () => {
|
|
69
|
+
const result = parseSource('owner/repo/skills/my-skill');
|
|
70
|
+
expect(result.type).toBe('github');
|
|
71
|
+
expect(result.subpath).toBe('skills/my-skill');
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
// ─── GitLab URLs ─────────────────────────────────────────────────────
|
|
75
|
+
describe('parseSource - GitLab URLs', () => {
|
|
76
|
+
it('should parse basic GitLab URL', () => {
|
|
77
|
+
const result = parseSource('https://gitlab.com/owner/repo');
|
|
78
|
+
expect(result.type).toBe('gitlab');
|
|
79
|
+
expect(result.url).toBe('https://gitlab.com/owner/repo.git');
|
|
80
|
+
});
|
|
81
|
+
it('should parse GitLab URL with branch', () => {
|
|
82
|
+
const result = parseSource('https://gitlab.com/owner/repo/-/tree/main');
|
|
83
|
+
expect(result.type).toBe('gitlab');
|
|
84
|
+
expect(result.ref).toBe('main');
|
|
85
|
+
});
|
|
86
|
+
it('should parse GitLab URL with branch and subpath', () => {
|
|
87
|
+
const result = parseSource('https://gitlab.com/owner/repo/-/tree/develop/path/to/skill');
|
|
88
|
+
expect(result.type).toBe('gitlab');
|
|
89
|
+
expect(result.ref).toBe('develop');
|
|
90
|
+
expect(result.subpath).toBe('path/to/skill');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
// ─── Bitbucket URLs ──────────────────────────────────────────────────
|
|
94
|
+
describe('parseSource - Bitbucket URLs', () => {
|
|
95
|
+
it('should parse basic Bitbucket URL', () => {
|
|
96
|
+
const result = parseSource('https://bitbucket.org/team/repo');
|
|
97
|
+
expect(result.type).toBe('bitbucket');
|
|
98
|
+
expect(result.url).toBe('https://bitbucket.org/team/repo.git');
|
|
99
|
+
});
|
|
100
|
+
it('should parse Bitbucket URL with .git suffix', () => {
|
|
101
|
+
const result = parseSource('https://bitbucket.org/team/repo.git');
|
|
102
|
+
expect(result.type).toBe('bitbucket');
|
|
103
|
+
expect(result.url).toBe('https://bitbucket.org/team/repo.git');
|
|
104
|
+
});
|
|
105
|
+
it('should parse Bitbucket URL with branch', () => {
|
|
106
|
+
const result = parseSource('https://bitbucket.org/team/repo/src/main');
|
|
107
|
+
expect(result.type).toBe('bitbucket');
|
|
108
|
+
expect(result.ref).toBe('main');
|
|
109
|
+
});
|
|
110
|
+
it('should parse Bitbucket URL with branch and subpath', () => {
|
|
111
|
+
const result = parseSource('https://bitbucket.org/team/repo/src/develop/skills/my-skill');
|
|
112
|
+
expect(result.type).toBe('bitbucket');
|
|
113
|
+
expect(result.ref).toBe('develop');
|
|
114
|
+
expect(result.subpath).toBe('skills/my-skill');
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
// ─── SSH URLs ────────────────────────────────────────────────────────
|
|
118
|
+
describe('parseSource - SSH URLs', () => {
|
|
119
|
+
it('should parse SSH GitHub URL', () => {
|
|
120
|
+
const result = parseSource('git@github.com:owner/repo.git');
|
|
121
|
+
expect(result.type).toBe('private-git');
|
|
122
|
+
expect(result.url).toBe('git@github.com:owner/repo.git');
|
|
123
|
+
expect(result.sshHost).toBe('github.com');
|
|
124
|
+
});
|
|
125
|
+
it('should parse SSH GitLab URL', () => {
|
|
126
|
+
const result = parseSource('git@gitlab.com:team/project.git');
|
|
127
|
+
expect(result.type).toBe('private-git');
|
|
128
|
+
expect(result.sshHost).toBe('gitlab.com');
|
|
129
|
+
});
|
|
130
|
+
it('should parse SSH custom host URL', () => {
|
|
131
|
+
const result = parseSource('git@git.company.com:team/skills.git');
|
|
132
|
+
expect(result.type).toBe('private-git');
|
|
133
|
+
expect(result.sshHost).toBe('git.company.com');
|
|
134
|
+
});
|
|
135
|
+
it('should parse SSH URL without .git suffix', () => {
|
|
136
|
+
const result = parseSource('git@github.com:owner/repo');
|
|
137
|
+
expect(result.type).toBe('private-git');
|
|
138
|
+
expect(result.url).toBe('git@github.com:owner/repo');
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
// ─── npm Packages ────────────────────────────────────────────────────
|
|
142
|
+
describe('parseSource - npm Packages', () => {
|
|
143
|
+
it('should parse scoped npm package', () => {
|
|
144
|
+
const result = parseSource('npm:@company/skills');
|
|
145
|
+
expect(result.type).toBe('npm');
|
|
146
|
+
expect(result.url).toBe('@company/skills');
|
|
147
|
+
});
|
|
148
|
+
it('should parse unscoped npm package', () => {
|
|
149
|
+
const result = parseSource('npm:my-skills-package');
|
|
150
|
+
expect(result.type).toBe('npm');
|
|
151
|
+
expect(result.url).toBe('my-skills-package');
|
|
152
|
+
});
|
|
153
|
+
it('should parse npm package with version', () => {
|
|
154
|
+
const result = parseSource('npm:@company/skills@1.2.3');
|
|
155
|
+
expect(result.type).toBe('npm');
|
|
156
|
+
expect(result.url).toBe('@company/skills@1.2.3');
|
|
157
|
+
});
|
|
158
|
+
it('should parse npm package with tag', () => {
|
|
159
|
+
const result = parseSource('npm:@company/skills@latest');
|
|
160
|
+
expect(result.type).toBe('npm');
|
|
161
|
+
expect(result.url).toBe('@company/skills@latest');
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
// ─── Private/Self-hosted Git ─────────────────────────────────────────
|
|
165
|
+
describe('parseSource - Private/Self-hosted Git', () => {
|
|
166
|
+
it('should parse self-hosted GitLab URL', () => {
|
|
167
|
+
const result = parseSource('https://git.company.com/team/skills');
|
|
168
|
+
expect(result.type).toBe('private-git');
|
|
169
|
+
expect(result.url).toBe('https://git.company.com/team/skills');
|
|
170
|
+
});
|
|
171
|
+
it('should parse self-hosted Git with port', () => {
|
|
172
|
+
const result = parseSource('https://git.internal.io:8443/team/repo');
|
|
173
|
+
expect(result.type).toBe('private-git');
|
|
174
|
+
});
|
|
175
|
+
it('should parse self-hosted Git .git URL', () => {
|
|
176
|
+
const result = parseSource('https://git.company.com/team/skills.git');
|
|
177
|
+
expect(result.type).toBe('private-git');
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
// ─── Direct SKILL.md URLs ────────────────────────────────────────────
|
|
181
|
+
describe('parseSource - Direct SKILL.md URLs', () => {
|
|
182
|
+
it('should parse raw GitHub URL to SKILL.md', () => {
|
|
183
|
+
const result = parseSource('https://raw.githubusercontent.com/owner/repo/main/skill/SKILL.md');
|
|
184
|
+
expect(result.type).toBe('direct-url');
|
|
185
|
+
});
|
|
186
|
+
it('should parse GitHub blob URL to SKILL.md', () => {
|
|
187
|
+
const result = parseSource('https://github.com/owner/repo/blob/main/skill/SKILL.md');
|
|
188
|
+
expect(result.type).toBe('direct-url');
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
// ─── getOwnerRepo ────────────────────────────────────────────────────
|
|
192
|
+
describe('getOwnerRepo', () => {
|
|
193
|
+
it('should extract owner/repo from GitHub URL', () => {
|
|
194
|
+
const parsed = parseSource('https://github.com/anthropics/skills');
|
|
195
|
+
expect(getOwnerRepo(parsed)).toBe('anthropics/skills');
|
|
196
|
+
});
|
|
197
|
+
it('should extract owner/repo from GitLab URL', () => {
|
|
198
|
+
const parsed = parseSource('https://gitlab.com/team/project');
|
|
199
|
+
expect(getOwnerRepo(parsed)).toBe('team/project');
|
|
200
|
+
});
|
|
201
|
+
it('should extract owner/repo from Bitbucket URL', () => {
|
|
202
|
+
const parsed = parseSource('https://bitbucket.org/team/repo');
|
|
203
|
+
expect(getOwnerRepo(parsed)).toBe('team/repo');
|
|
204
|
+
});
|
|
205
|
+
it('should extract owner/repo from SSH URL', () => {
|
|
206
|
+
const parsed = parseSource('git@github.com:owner/repo.git');
|
|
207
|
+
expect(getOwnerRepo(parsed)).toBe('owner/repo');
|
|
208
|
+
});
|
|
209
|
+
it('should return null for local paths', () => {
|
|
210
|
+
const parsed = parseSource('.');
|
|
211
|
+
expect(getOwnerRepo(parsed)).toBeNull();
|
|
212
|
+
});
|
|
213
|
+
it('should return null for npm packages', () => {
|
|
214
|
+
const parsed = parseSource('npm:@company/skills');
|
|
215
|
+
expect(getOwnerRepo(parsed)).toBeNull();
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
// ─── getSourceTypeDisplay ────────────────────────────────────────────
|
|
219
|
+
describe('getSourceTypeDisplay', () => {
|
|
220
|
+
it('should display correct names for all types', () => {
|
|
221
|
+
expect(getSourceTypeDisplay('local')).toBe('Local');
|
|
222
|
+
expect(getSourceTypeDisplay('github')).toBe('GitHub');
|
|
223
|
+
expect(getSourceTypeDisplay('gitlab')).toBe('GitLab');
|
|
224
|
+
expect(getSourceTypeDisplay('bitbucket')).toBe('Bitbucket');
|
|
225
|
+
expect(getSourceTypeDisplay('npm')).toBe('npm');
|
|
226
|
+
expect(getSourceTypeDisplay('private-git')).toBe('Private Git');
|
|
227
|
+
expect(getSourceTypeDisplay('direct-url')).toBe('Direct URL');
|
|
228
|
+
expect(getSourceTypeDisplay('well-known')).toBe('Well-Known');
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
//# sourceMappingURL=source-parser.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-parser.test.js","sourceRoot":"","sources":["../../src/__tests__/source-parser.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAE3F,wEAAwE;AAExE,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,gCAAgC,EAAE,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CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9D,MAAM,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Adapter — Base Interface & Abstract Class
|
|
3
|
+
*
|
|
4
|
+
* Provides a formal adapter pattern for all 42 supported AI agents.
|
|
5
|
+
* Each agent can override config path generation, format rendering,
|
|
6
|
+
* and feature detection.
|
|
7
|
+
*/
|
|
8
|
+
export interface AgentAdapter {
|
|
9
|
+
/** Internal key, e.g. "cursor" */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
/** Human-readable name, e.g. "Cursor" */
|
|
12
|
+
readonly displayName: string;
|
|
13
|
+
/** Relative project-level skill directory */
|
|
14
|
+
getProjectDir(): string;
|
|
15
|
+
/** Absolute global skill directory */
|
|
16
|
+
getGlobalDir(): string;
|
|
17
|
+
/** Full path for a given skill, e.g. `.cursor/skills/my-skill/SKILL.md` */
|
|
18
|
+
getConfigPath(skillName: string, global: boolean): string;
|
|
19
|
+
/** Generate agent-specific config content from parsed skill */
|
|
20
|
+
generateConfig(parsed: ParsedSkillInput): string;
|
|
21
|
+
/** Does this adapter support a particular format? */
|
|
22
|
+
supportsFormat(format: string): boolean;
|
|
23
|
+
/** Get the filename the agent expects (usually SKILL.md) */
|
|
24
|
+
getSkillFilename(): string;
|
|
25
|
+
}
|
|
26
|
+
/** Minimal skill input for config generation */
|
|
27
|
+
export interface ParsedSkillInput {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
rawContent: string;
|
|
31
|
+
sections?: {
|
|
32
|
+
heading: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}[];
|
|
35
|
+
frontmatter?: Record<string, any>;
|
|
36
|
+
}
|
|
37
|
+
export declare abstract class BaseAdapter implements AgentAdapter {
|
|
38
|
+
abstract readonly name: string;
|
|
39
|
+
abstract readonly displayName: string;
|
|
40
|
+
protected readonly projectDir: string;
|
|
41
|
+
protected readonly globalDir: string;
|
|
42
|
+
constructor(projectDir: string, globalDir: string);
|
|
43
|
+
getProjectDir(): string;
|
|
44
|
+
getGlobalDir(): string;
|
|
45
|
+
getConfigPath(skillName: string, global: boolean): string;
|
|
46
|
+
generateConfig(parsed: ParsedSkillInput): string;
|
|
47
|
+
supportsFormat(format: string): boolean;
|
|
48
|
+
getSkillFilename(): string;
|
|
49
|
+
}
|
|
50
|
+
export declare const HOME: string;
|
|
51
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,WAAW,YAAY;IACzB,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,6CAA6C;IAC7C,aAAa,IAAI,MAAM,CAAC;IACxB,sCAAsC;IACtC,YAAY,IAAI,MAAM,CAAC;IACvB,2EAA2E;IAC3E,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1D,+DAA+D;IAC/D,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACjD,qDAAqD;IACrD,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,4DAA4D;IAC5D,gBAAgB,IAAI,MAAM,CAAC;CAC9B;AAED,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC;AAID,8BAAsB,WAAY,YAAW,YAAY;IACrD,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAEtC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEzB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,aAAa,IAAI,MAAM;IAIvB,YAAY,IAAI,MAAM;IAItB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM;IAKzD,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;IAiBhD,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIvC,gBAAgB,IAAI,MAAM;CAG7B;AAID,eAAO,MAAM,IAAI,QAAY,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Adapter — Base Interface & Abstract Class
|
|
3
|
+
*
|
|
4
|
+
* Provides a formal adapter pattern for all 42 supported AI agents.
|
|
5
|
+
* Each agent can override config path generation, format rendering,
|
|
6
|
+
* and feature detection.
|
|
7
|
+
*/
|
|
8
|
+
import { homedir } from 'os';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
// ── Base Adapter ─────────────────────────────────────────────────────────
|
|
11
|
+
export class BaseAdapter {
|
|
12
|
+
projectDir;
|
|
13
|
+
globalDir;
|
|
14
|
+
constructor(projectDir, globalDir) {
|
|
15
|
+
this.projectDir = projectDir;
|
|
16
|
+
this.globalDir = globalDir;
|
|
17
|
+
}
|
|
18
|
+
getProjectDir() {
|
|
19
|
+
return this.projectDir;
|
|
20
|
+
}
|
|
21
|
+
getGlobalDir() {
|
|
22
|
+
return this.globalDir;
|
|
23
|
+
}
|
|
24
|
+
getConfigPath(skillName, global) {
|
|
25
|
+
const base = global ? this.getGlobalDir() : this.getProjectDir();
|
|
26
|
+
return join(base, skillName, this.getSkillFilename());
|
|
27
|
+
}
|
|
28
|
+
generateConfig(parsed) {
|
|
29
|
+
// Default: output as standard SKILL.md format
|
|
30
|
+
const lines = [];
|
|
31
|
+
if (parsed.frontmatter && Object.keys(parsed.frontmatter).length > 0) {
|
|
32
|
+
lines.push('---');
|
|
33
|
+
for (const [key, value] of Object.entries(parsed.frontmatter)) {
|
|
34
|
+
lines.push(`${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
35
|
+
}
|
|
36
|
+
lines.push('---');
|
|
37
|
+
lines.push('');
|
|
38
|
+
}
|
|
39
|
+
lines.push(parsed.rawContent);
|
|
40
|
+
return lines.join('\n');
|
|
41
|
+
}
|
|
42
|
+
supportsFormat(format) {
|
|
43
|
+
return format === 'skill.md' || format === 'markdown';
|
|
44
|
+
}
|
|
45
|
+
getSkillFilename() {
|
|
46
|
+
return 'SKILL.md';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// ── Home directory constant ──────────────────────────────────────────────
|
|
50
|
+
export const HOME = homedir();
|
|
51
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapters/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiC5B,4EAA4E;AAE5E,MAAM,OAAgB,WAAW;IAIV,UAAU,CAAS;IACnB,SAAS,CAAS;IAErC,YAAY,UAAkB,EAAE,SAAiB;QAC7C,IAAI,CAAC,UAAU,GAA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Ac,CAAC,MAAc;QACzB,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,UAAU,CAAC;IAC1D,CAAC;IAED,gBAAgB;QACZ,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAED,4EAA4E;AAE5E,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Adapter
|
|
3
|
+
* Handles Claude Code-specific skill format (CLAUDE.md awareness)
|
|
4
|
+
*/
|
|
5
|
+
import { BaseAdapter, type ParsedSkillInput } from './adapter.js';
|
|
6
|
+
export declare class ClaudeAdapter extends BaseAdapter {
|
|
7
|
+
readonly name = "claude";
|
|
8
|
+
readonly displayName = "Claude Code";
|
|
9
|
+
constructor();
|
|
10
|
+
supportsFormat(format: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Generate CLAUDE.md format (Claude Code's native config)
|
|
13
|
+
*/
|
|
14
|
+
toClaudeMd(parsed: ParsedSkillInput): string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAQ,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExE,qBAAa,aAAc,SAAQ,WAAW;IAC1C,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,WAAW,iBAAiB;;IAMrC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIvC;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;CAW/C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Adapter
|
|
3
|
+
* Handles Claude Code-specific skill format (CLAUDE.md awareness)
|
|
4
|
+
*/
|
|
5
|
+
import { BaseAdapter, HOME } from './adapter.js';
|
|
6
|
+
export class ClaudeAdapter extends BaseAdapter {
|
|
7
|
+
name = 'claude';
|
|
8
|
+
displayName = 'Claude Code';
|
|
9
|
+
constructor() {
|
|
10
|
+
super('.claude/skills', `${HOME}/.claude/skills`);
|
|
11
|
+
}
|
|
12
|
+
supportsFormat(format) {
|
|
13
|
+
return format === 'skill.md' || format === 'claudemd';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generate CLAUDE.md format (Claude Code's native config)
|
|
17
|
+
*/
|
|
18
|
+
toClaudeMd(parsed) {
|
|
19
|
+
const lines = [];
|
|
20
|
+
lines.push(`# ${parsed.name}`);
|
|
21
|
+
lines.push('');
|
|
22
|
+
if (parsed.description) {
|
|
23
|
+
lines.push(`> ${parsed.description}`);
|
|
24
|
+
lines.push('');
|
|
25
|
+
}
|
|
26
|
+
lines.push(parsed.rawContent);
|
|
27
|
+
return lines.join('\n');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,IAAI,EAAyB,MAAM,cAAc,CAAC;AAExE,MAAM,OAAO,aAAc,SAAQ,WAAW;IACjC,IAAI,GAAG,QAAQ,CAAC;IAChB,WAAW,GAAG,aAAa,CAAC;IAErC;QACI,KAAK,CAAC,gBAAgB,EAAE,GAAG,IAAI,iBAAiB,CAAC,CAAC;IACtD,CAAC;IAED,cAAc,CAAC,MAAc;QACzB,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,UAAU,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,MAAwB;QAC/B,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACJ"}
|