reskill 1.1.1 → 1.3.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/README.md +30 -1
- package/README.zh-CN.md +35 -6
- package/dist/cli/commands/__integration__/helpers.d.ts +2 -1
- package/dist/cli/commands/__integration__/helpers.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/index.d.ts +4 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +10 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/logout.d.ts +9 -0
- package/dist/cli/commands/logout.d.ts.map +1 -0
- package/dist/cli/commands/publish.d.ts +32 -0
- package/dist/cli/commands/publish.d.ts.map +1 -0
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/whoami.d.ts +9 -0
- package/dist/cli/commands/whoami.d.ts.map +1 -0
- package/dist/cli/index.js +3352 -123
- package/dist/core/auth-manager.d.ts +71 -0
- package/dist/core/auth-manager.d.ts.map +1 -0
- package/dist/core/cache-manager.d.ts +16 -1
- package/dist/core/cache-manager.d.ts.map +1 -1
- package/dist/core/config-loader.d.ts +64 -1
- package/dist/core/config-loader.d.ts.map +1 -1
- package/dist/core/extractor.d.ts +62 -0
- package/dist/core/extractor.d.ts.map +1 -0
- package/dist/core/git-resolver.d.ts +28 -1
- package/dist/core/git-resolver.d.ts.map +1 -1
- package/dist/core/http-resolver.d.ts +108 -0
- package/dist/core/http-resolver.d.ts.map +1 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/install-directory.d.ts +81 -0
- package/dist/core/install-directory.d.ts.map +1 -0
- package/dist/core/installer.d.ts +4 -0
- package/dist/core/installer.d.ts.map +1 -1
- package/dist/core/publisher.d.ts +85 -0
- package/dist/core/publisher.d.ts.map +1 -0
- package/dist/core/registry-client.d.ts +141 -0
- package/dist/core/registry-client.d.ts.map +1 -0
- package/dist/core/registry-resolver.d.ts +62 -0
- package/dist/core/registry-resolver.d.ts.map +1 -0
- package/dist/core/skill-manager.d.ts +51 -1
- package/dist/core/skill-manager.d.ts.map +1 -1
- package/dist/core/skill-parser.d.ts +5 -1
- package/dist/core/skill-parser.d.ts.map +1 -1
- package/dist/core/skill-validator.d.ts +110 -0
- package/dist/core/skill-validator.d.ts.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1769 -55
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/git.d.ts +4 -3
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/http.d.ts +51 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/registry-scope.d.ts +150 -0
- package/dist/utils/registry-scope.d.ts.map +1 -0
- package/dist/utils/registry.d.ts +22 -0
- package/dist/utils/registry.d.ts.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publisher - Handle Git information and publish payload building
|
|
3
|
+
*
|
|
4
|
+
* Extracts Git metadata and builds the payload for publishing to registry.
|
|
5
|
+
*/
|
|
6
|
+
import type { SkillJson } from '../types/index.js';
|
|
7
|
+
import type { ParsedSkill } from './skill-parser.js';
|
|
8
|
+
export interface GitInfo {
|
|
9
|
+
isRepo: boolean;
|
|
10
|
+
remoteUrl: string | null;
|
|
11
|
+
currentBranch: string | null;
|
|
12
|
+
currentCommit: string | null;
|
|
13
|
+
commitDate: string | null;
|
|
14
|
+
tag: string | null;
|
|
15
|
+
tagCommit: string | null;
|
|
16
|
+
isDirty: boolean;
|
|
17
|
+
sourceRef: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface LoadedSkillForPublish {
|
|
20
|
+
path: string;
|
|
21
|
+
skillJson: SkillJson;
|
|
22
|
+
skillMd: ParsedSkill | null;
|
|
23
|
+
readme: string | null;
|
|
24
|
+
files: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface PublishPayload {
|
|
27
|
+
version: string;
|
|
28
|
+
description: string;
|
|
29
|
+
gitRef: string;
|
|
30
|
+
gitCommit: string;
|
|
31
|
+
gitCommitDate?: string;
|
|
32
|
+
repositoryUrl: string;
|
|
33
|
+
sourceRef: string;
|
|
34
|
+
skillJson: SkillJson;
|
|
35
|
+
skillMd?: {
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
license?: string;
|
|
39
|
+
compatibility?: string;
|
|
40
|
+
allowedTools?: string[];
|
|
41
|
+
};
|
|
42
|
+
readmePreview?: string;
|
|
43
|
+
files: string[];
|
|
44
|
+
entry: string;
|
|
45
|
+
keywords?: string[];
|
|
46
|
+
compatibility?: Record<string, string>;
|
|
47
|
+
integrity: string;
|
|
48
|
+
}
|
|
49
|
+
export declare class PublishError extends Error {
|
|
50
|
+
constructor(message: string);
|
|
51
|
+
}
|
|
52
|
+
export declare class Publisher {
|
|
53
|
+
/**
|
|
54
|
+
* Get Git information from a skill directory
|
|
55
|
+
*/
|
|
56
|
+
getGitInfo(skillPath: string, specifiedTag?: string): Promise<GitInfo>;
|
|
57
|
+
/**
|
|
58
|
+
* Parse remote URL to sourceRef format (e.g., github:user/repo)
|
|
59
|
+
*/
|
|
60
|
+
parseRemoteToSourceRef(remoteUrl: string): string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Normalize host to registry name
|
|
63
|
+
*/
|
|
64
|
+
private normalizeHost;
|
|
65
|
+
/**
|
|
66
|
+
* Build publish payload
|
|
67
|
+
*/
|
|
68
|
+
buildPayload(skill: {
|
|
69
|
+
path: string;
|
|
70
|
+
skillJson: SkillJson;
|
|
71
|
+
skillMd: ParsedSkill | null;
|
|
72
|
+
readme: string | null;
|
|
73
|
+
files: string[];
|
|
74
|
+
}, gitInfo: GitInfo, integrity: string): PublishPayload;
|
|
75
|
+
/**
|
|
76
|
+
* Format bytes for display
|
|
77
|
+
*/
|
|
78
|
+
formatBytes(bytes: number): string;
|
|
79
|
+
/**
|
|
80
|
+
* Calculate total size of files
|
|
81
|
+
*/
|
|
82
|
+
calculateTotalSize(skillPath: string, files: string[]): number;
|
|
83
|
+
}
|
|
84
|
+
export default Publisher;
|
|
85
|
+
//# sourceMappingURL=publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../../src/core/publisher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAA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;;OAEG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;CAW/D;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RegistryClient - Interact with reskill registry API
|
|
3
|
+
*
|
|
4
|
+
* Handles authentication, publishing, and downloading skills from the registry.
|
|
5
|
+
*/
|
|
6
|
+
import type { SkillInfo } from '../types/index.js';
|
|
7
|
+
import type { PublishPayload } from './publisher.js';
|
|
8
|
+
export interface RegistryConfig {
|
|
9
|
+
registry: string;
|
|
10
|
+
token?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PublishRequest {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
description: string;
|
|
16
|
+
license?: string;
|
|
17
|
+
compatibility?: string;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
allowed_tools?: string;
|
|
20
|
+
tag?: string;
|
|
21
|
+
tarball: Buffer;
|
|
22
|
+
}
|
|
23
|
+
export interface PublishResponse {
|
|
24
|
+
success: boolean;
|
|
25
|
+
ok?: boolean;
|
|
26
|
+
error?: string;
|
|
27
|
+
data?: {
|
|
28
|
+
name: string;
|
|
29
|
+
version: string;
|
|
30
|
+
integrity: string;
|
|
31
|
+
tag: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface WhoamiResponse {
|
|
35
|
+
success: boolean;
|
|
36
|
+
error?: string;
|
|
37
|
+
user?: {
|
|
38
|
+
id: string;
|
|
39
|
+
handle: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface SkillMetadataResponse {
|
|
43
|
+
name: string;
|
|
44
|
+
'dist-tags': Record<string, string>;
|
|
45
|
+
versions?: Record<string, unknown>;
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DownloadResult {
|
|
49
|
+
tarball: Buffer;
|
|
50
|
+
integrity: string;
|
|
51
|
+
}
|
|
52
|
+
export declare class RegistryError extends Error {
|
|
53
|
+
readonly statusCode?: number;
|
|
54
|
+
readonly response?: unknown;
|
|
55
|
+
constructor(message: string, statusCode?: number, response?: unknown);
|
|
56
|
+
}
|
|
57
|
+
export declare class RegistryClient {
|
|
58
|
+
private config;
|
|
59
|
+
constructor(config: RegistryConfig);
|
|
60
|
+
/**
|
|
61
|
+
* Get authorization headers
|
|
62
|
+
*/
|
|
63
|
+
private getAuthHeaders;
|
|
64
|
+
/**
|
|
65
|
+
* Get current user info (whoami)
|
|
66
|
+
*/
|
|
67
|
+
whoami(): Promise<WhoamiResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Create tarball from skill files
|
|
70
|
+
*
|
|
71
|
+
* @param skillPath - Path to the skill directory
|
|
72
|
+
* @param files - List of relative file paths to include
|
|
73
|
+
* @param shortName - Optional: if provided, use as top-level directory in tarball
|
|
74
|
+
* (e.g., 'my-skill' -> 'my-skill/SKILL.md')
|
|
75
|
+
*/
|
|
76
|
+
createTarball(skillPath: string, files: string[], shortName?: string): Promise<Buffer>;
|
|
77
|
+
/**
|
|
78
|
+
* 获取 skill 基本信息(包含 source_type)
|
|
79
|
+
* 用于 install 命令判断安装逻辑分支
|
|
80
|
+
*
|
|
81
|
+
* @param skillName - 完整名称,如 @kanyun/my-skill
|
|
82
|
+
* @returns Skill 基本信息
|
|
83
|
+
* @throws RegistryError 如果 skill 不存在或请求失败
|
|
84
|
+
*/
|
|
85
|
+
getSkillInfo(skillName: string): Promise<SkillInfo>;
|
|
86
|
+
/**
|
|
87
|
+
* Resolve a tag (like "latest" or "beta") to an actual version number
|
|
88
|
+
*
|
|
89
|
+
* @param skillName - Full skill name (e.g., "@kanyun/test-skill" or "public-skill")
|
|
90
|
+
* @param tagOrVersion - Tag name or semver version (defaults to "latest")
|
|
91
|
+
* @returns Resolved version number
|
|
92
|
+
* @throws RegistryError if skill or tag not found
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* await client.resolveVersion('@kanyun/test-skill', 'latest') // '2.4.5'
|
|
96
|
+
* await client.resolveVersion('@kanyun/test-skill', '2.4.5') // '2.4.5' (直接返回)
|
|
97
|
+
*/
|
|
98
|
+
resolveVersion(skillName: string, tagOrVersion?: string): Promise<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Download a skill tarball from the registry
|
|
101
|
+
*
|
|
102
|
+
* @param skillName - Full skill name (e.g., "@kanyun/test-skill" or "public-skill")
|
|
103
|
+
* @param version - Version number to download
|
|
104
|
+
* @returns Downloaded tarball and its integrity hash
|
|
105
|
+
* @throws RegistryError if skill or version not found
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* const { tarball, integrity } = await client.downloadSkill('@kanyun/test-skill', '1.0.0');
|
|
109
|
+
*/
|
|
110
|
+
downloadSkill(skillName: string, version: string): Promise<DownloadResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Calculate SHA256 integrity hash for content
|
|
113
|
+
*
|
|
114
|
+
* @param content - Content buffer to hash
|
|
115
|
+
* @returns Integrity string in format "sha256-{base64hash}"
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* RegistryClient.calculateIntegrity(buffer) // 'sha256-abc123...'
|
|
119
|
+
*/
|
|
120
|
+
static calculateIntegrity(content: Buffer): string;
|
|
121
|
+
/**
|
|
122
|
+
* Verify content matches expected integrity hash
|
|
123
|
+
*
|
|
124
|
+
* @param content - Content buffer to verify
|
|
125
|
+
* @param expectedIntegrity - Expected integrity string (e.g., "sha256-{hash}")
|
|
126
|
+
* @returns true if integrity matches, false otherwise
|
|
127
|
+
* @throws Error if integrity format is invalid or algorithm is unsupported
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* RegistryClient.verifyIntegrity(buffer, 'sha256-abc123...') // true or false
|
|
131
|
+
*/
|
|
132
|
+
static verifyIntegrity(content: Buffer, expectedIntegrity: string): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Publish a skill to the registry
|
|
135
|
+
*/
|
|
136
|
+
publish(skillName: string, payload: PublishPayload, skillPath: string, options?: {
|
|
137
|
+
tag?: string;
|
|
138
|
+
}): Promise<PublishResponse>;
|
|
139
|
+
}
|
|
140
|
+
export default RegistryClient;
|
|
141
|
+
//# sourceMappingURL=registry-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-client.d.ts","sourceRoot":"","sources":["../../src/core/registry-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMrD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAA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AM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BhF;;;;;;;;OAQG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAKlD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO;IAsB3E;;OAEG;IACG,OAAO,CACX,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7B,OAAO,CAAC,eAAe,CAAC;CAiE5B;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry Resolver (Step 5.1)
|
|
3
|
+
*
|
|
4
|
+
* Resolves skill references from npm-style registries:
|
|
5
|
+
* - Private registry: @scope/name[@version] (e.g., @kanyun/planning-with-files@2.4.5)
|
|
6
|
+
* - Public registry: name[@version] (e.g., my-skill@1.0.0)
|
|
7
|
+
*
|
|
8
|
+
* Uses RegistryClient to download and verify skills.
|
|
9
|
+
*/
|
|
10
|
+
import { type ParsedSkillIdentifier } from '../utils/registry-scope.js';
|
|
11
|
+
export interface RegistryResolveResult {
|
|
12
|
+
/** Parsed skill identifier */
|
|
13
|
+
parsed: ParsedSkillIdentifier;
|
|
14
|
+
/** Short skill name (without scope) */
|
|
15
|
+
shortName: string;
|
|
16
|
+
/** Resolved version */
|
|
17
|
+
version: string;
|
|
18
|
+
/** Registry URL */
|
|
19
|
+
registryUrl: string;
|
|
20
|
+
/** Downloaded tarball buffer */
|
|
21
|
+
tarball: Buffer;
|
|
22
|
+
/** Integrity hash from server */
|
|
23
|
+
integrity: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class RegistryResolver {
|
|
26
|
+
/**
|
|
27
|
+
* Check if a reference is a registry source (not Git or HTTP)
|
|
28
|
+
*
|
|
29
|
+
* Registry formats:
|
|
30
|
+
* - @scope/name[@version] - private registry
|
|
31
|
+
* - name[@version] - public registry (if not matching other formats)
|
|
32
|
+
*
|
|
33
|
+
* Explicitly excluded:
|
|
34
|
+
* - Git SSH: git@github.com:user/repo.git
|
|
35
|
+
* - Git HTTPS: https://github.com/user/repo.git
|
|
36
|
+
* - GitHub web: https://github.com/user/repo/tree/...
|
|
37
|
+
* - HTTP/OSS: https://example.com/skill.tar.gz
|
|
38
|
+
* - Registry shorthand: github:user/repo, gitlab:org/repo
|
|
39
|
+
*/
|
|
40
|
+
static isRegistryRef(ref: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve a registry skill reference
|
|
43
|
+
*
|
|
44
|
+
* @param ref - Skill reference (e.g., "@kanyun/planning-with-files@2.4.5" or "my-skill@latest")
|
|
45
|
+
* @returns Resolved skill information including downloaded tarball
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const result = await resolver.resolve('@kanyun/planning-with-files@2.4.5');
|
|
49
|
+
* console.log(result.shortName); // 'planning-with-files'
|
|
50
|
+
* console.log(result.version); // '2.4.5'
|
|
51
|
+
*/
|
|
52
|
+
resolve(ref: string): Promise<RegistryResolveResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Extract tarball to a target directory
|
|
55
|
+
*
|
|
56
|
+
* @param tarball - Tarball buffer
|
|
57
|
+
* @param destDir - Destination directory
|
|
58
|
+
* @returns Path to the extracted skill directory
|
|
59
|
+
*/
|
|
60
|
+
extract(tarball: Buffer, destDir: string): Promise<string>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=registry-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-resolver.d.ts","sourceRoot":"","sources":["../../src/core/registry-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC;AAMpC,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAoC1C;;;;;;;;;;OAUG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA+B1D;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAWjE"}
|
|
@@ -22,6 +22,8 @@ export interface SkillManagerOptions {
|
|
|
22
22
|
export declare class SkillManager {
|
|
23
23
|
private projectRoot;
|
|
24
24
|
private resolver;
|
|
25
|
+
private httpResolver;
|
|
26
|
+
private registryResolver;
|
|
25
27
|
private cache;
|
|
26
28
|
private config;
|
|
27
29
|
private lockManager;
|
|
@@ -56,10 +58,26 @@ export declare class SkillManager {
|
|
|
56
58
|
* Checks canonical location first, then falls back to configured installDir.
|
|
57
59
|
*/
|
|
58
60
|
getSkillPath(name: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Detect if a reference is an HTTP/OSS URL
|
|
63
|
+
*/
|
|
64
|
+
private isHttpSource;
|
|
65
|
+
/**
|
|
66
|
+
* Detect if a reference is a registry source (@scope/name or name@version)
|
|
67
|
+
*/
|
|
68
|
+
private isRegistrySource;
|
|
59
69
|
/**
|
|
60
70
|
* Install skill
|
|
61
71
|
*/
|
|
62
72
|
install(ref: string, options?: InstallOptions): Promise<InstalledSkill>;
|
|
73
|
+
/**
|
|
74
|
+
* Install skill from Git repository
|
|
75
|
+
*/
|
|
76
|
+
private installFromGit;
|
|
77
|
+
/**
|
|
78
|
+
* Install skill from HTTP/OSS URL
|
|
79
|
+
*/
|
|
80
|
+
private installFromHttp;
|
|
63
81
|
/**
|
|
64
82
|
* Install all skills from skills.json
|
|
65
83
|
*/
|
|
@@ -116,7 +134,7 @@ export declare class SkillManager {
|
|
|
116
134
|
/**
|
|
117
135
|
* Install skill to multiple agents
|
|
118
136
|
*
|
|
119
|
-
* @param ref - Skill reference (e.g., github:user/repo@v1.0.0)
|
|
137
|
+
* @param ref - Skill reference (e.g., github:user/repo@v1.0.0 or HTTP URL)
|
|
120
138
|
* @param targetAgents - Target agents list
|
|
121
139
|
* @param options - Installation options
|
|
122
140
|
*/
|
|
@@ -124,6 +142,38 @@ export declare class SkillManager {
|
|
|
124
142
|
skill: InstalledSkill;
|
|
125
143
|
results: Map<AgentType, InstallResult>;
|
|
126
144
|
}>;
|
|
145
|
+
/**
|
|
146
|
+
* Install skill from Git to multiple agents
|
|
147
|
+
*/
|
|
148
|
+
private installToAgentsFromGit;
|
|
149
|
+
/**
|
|
150
|
+
* Install skill from HTTP/OSS to multiple agents
|
|
151
|
+
*/
|
|
152
|
+
private installToAgentsFromHttp;
|
|
153
|
+
/**
|
|
154
|
+
* Install skill from npm-style Registry to multiple agents
|
|
155
|
+
*
|
|
156
|
+
* Supports:
|
|
157
|
+
* - Private registry: @scope/name[@version] (e.g., @kanyun/planning-with-files@2.4.5)
|
|
158
|
+
* - Public registry: name[@version] (e.g., my-skill@1.0.0)
|
|
159
|
+
* - Web-published skills (github/gitlab/oss_url/custom_url/local)
|
|
160
|
+
*/
|
|
161
|
+
private installToAgentsFromRegistry;
|
|
162
|
+
/**
|
|
163
|
+
* 安装页面发布的 skill
|
|
164
|
+
*
|
|
165
|
+
* 页面发布的 skill 不支持版本管理,根据 source_type 分支到不同的安装逻辑:
|
|
166
|
+
* - github/gitlab: 复用 installToAgentsFromGit
|
|
167
|
+
* - oss_url/custom_url: 复用 installToAgentsFromHttp
|
|
168
|
+
* - local: 通过 Registry API 下载 tarball
|
|
169
|
+
*/
|
|
170
|
+
private installFromWebPublished;
|
|
171
|
+
/**
|
|
172
|
+
* 安装 Local Folder 模式发布的 skill
|
|
173
|
+
*
|
|
174
|
+
* 通过 Registry 的 /api/skills/:name/download API 下载 tarball
|
|
175
|
+
*/
|
|
176
|
+
private installFromRegistryLocal;
|
|
127
177
|
/**
|
|
128
178
|
* Get default target agents
|
|
129
179
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-manager.d.ts","sourceRoot":"","sources":["../../src/core/skill-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"skill-manager.d.ts","sourceRoot":"","sources":["../../src/core/skill-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAwB,MAAM,mBAAmB,CAAC;AAc9F,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,QAA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AS,CAAC;KAC5B;IAQD;;OAEG;IACG,aAAa,IAAI,OAAO,CAC5B,KAAK,CAAC;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC,CACH;IAmED;;;;;;OAMG;IACG,eAAe,CACnB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,SAAS,EAAE,EACzB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC;QACT,KAAK,EAAE,cAAc,CAAC;QACtB,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;KACxC,CAAC;IAYF;;OAEG;YACW,sBAAsB;IAqGpC;;OAEG;YACW,uBAAuB;IAsGrC;;;;;;;OAOG;YACW,2BAA2B;IA0JzC;;;;;;;OAOG;YACW,uBAAuB;IA+CrC;;;;OAIG;YACW,wBAAwB;IAsBtC;;;;;;;OAOG;IACG,sBAAsB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAWpD;;OAEG;IACH,qBAAqB,IAAI,WAAW;IAQpC;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG;QAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;IAenF;;OAEG;IACH,gBAAgB,IAAI,SAAS,EAAE;IAI/B;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC;CAyBtF;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -17,6 +17,8 @@ export interface SkillMdFrontmatter {
|
|
|
17
17
|
name: string;
|
|
18
18
|
/** Skill description (required) */
|
|
19
19
|
description: string;
|
|
20
|
+
/** Version (optional, semver format) */
|
|
21
|
+
version?: string;
|
|
20
22
|
/** License */
|
|
21
23
|
license?: string;
|
|
22
24
|
/** Compatibility requirements */
|
|
@@ -34,6 +36,8 @@ export interface ParsedSkill {
|
|
|
34
36
|
name: string;
|
|
35
37
|
/** Skill description */
|
|
36
38
|
description: string;
|
|
39
|
+
/** Version (optional, semver format) */
|
|
40
|
+
version?: string;
|
|
37
41
|
/** License */
|
|
38
42
|
license?: string;
|
|
39
43
|
/** Compatibility requirements */
|
|
@@ -69,7 +73,7 @@ export declare function validateSkillName(name: string): void;
|
|
|
69
73
|
*
|
|
70
74
|
* Specification requirements:
|
|
71
75
|
* - Max 1024 characters
|
|
72
|
-
* -
|
|
76
|
+
* - Angle brackets are allowed per agentskills.io spec
|
|
73
77
|
*/
|
|
74
78
|
export declare function validateSkillDescription(description: string): void;
|
|
75
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-parser.d.ts","sourceRoot":"","sources":["../../src/core/skill-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0BAA0B;IAC1B,QAAQ,CAAC,EAA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io specification: https://agentskills.io/specification
|
|
5
|
+
*
|
|
6
|
+
* Key points:
|
|
7
|
+
* - SKILL.md is REQUIRED (with name and description in frontmatter)
|
|
8
|
+
* - skill.json is OPTIONAL (for additional metadata like version, keywords)
|
|
9
|
+
* - Version can come from skill.json, SKILL.md metadata.version, or default to "0.0.0"
|
|
10
|
+
*/
|
|
11
|
+
import type { SkillJson } from '../types/index.js';
|
|
12
|
+
import { type ParsedSkill } from './skill-parser.js';
|
|
13
|
+
export interface ValidationError {
|
|
14
|
+
field: string;
|
|
15
|
+
message: string;
|
|
16
|
+
suggestion?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ValidationWarning {
|
|
19
|
+
field: string;
|
|
20
|
+
message: string;
|
|
21
|
+
suggestion?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ValidationResult {
|
|
24
|
+
valid: boolean;
|
|
25
|
+
errors: ValidationError[];
|
|
26
|
+
warnings: ValidationWarning[];
|
|
27
|
+
}
|
|
28
|
+
export interface LoadedSkill {
|
|
29
|
+
path: string;
|
|
30
|
+
/** skill.json content (may be synthesized from SKILL.md if skill.json doesn't exist) */
|
|
31
|
+
skillJson: SkillJson | null;
|
|
32
|
+
/** SKILL.md parsed content */
|
|
33
|
+
skillMd: ParsedSkill | null;
|
|
34
|
+
readme: string | null;
|
|
35
|
+
files: string[];
|
|
36
|
+
/** Whether skillJson was synthesized from SKILL.md (no actual skill.json file) */
|
|
37
|
+
synthesized?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare class SkillValidator {
|
|
40
|
+
/**
|
|
41
|
+
* Validate skill name format
|
|
42
|
+
*
|
|
43
|
+
* Requirements:
|
|
44
|
+
* - Lowercase letters, numbers, and hyphens only
|
|
45
|
+
* - 1-64 characters
|
|
46
|
+
* - Cannot start or end with hyphen
|
|
47
|
+
* - Cannot have consecutive hyphens
|
|
48
|
+
*/
|
|
49
|
+
validateName(name: string): ValidationResult;
|
|
50
|
+
/**
|
|
51
|
+
* Validate version format (semver)
|
|
52
|
+
*/
|
|
53
|
+
validateVersion(version: string): ValidationResult;
|
|
54
|
+
/**
|
|
55
|
+
* Validate description
|
|
56
|
+
*
|
|
57
|
+
* Following agentskills.io specification:
|
|
58
|
+
* - Max 1024 characters
|
|
59
|
+
* - Non-empty
|
|
60
|
+
*/
|
|
61
|
+
validateDescription(description: string): ValidationResult;
|
|
62
|
+
/**
|
|
63
|
+
* Load skill information from directory
|
|
64
|
+
*
|
|
65
|
+
* Following agentskills.io specification:
|
|
66
|
+
* - SKILL.md is the primary source of metadata
|
|
67
|
+
* - skill.json is optional and provides additional metadata
|
|
68
|
+
* - If skill.json doesn't exist, synthesize it from SKILL.md
|
|
69
|
+
*/
|
|
70
|
+
loadSkill(skillPath: string): LoadedSkill;
|
|
71
|
+
/**
|
|
72
|
+
* Synthesize a SkillJson object from SKILL.md frontmatter
|
|
73
|
+
*
|
|
74
|
+
* This allows publishing skills that only have SKILL.md (per agentskills.io spec)
|
|
75
|
+
*/
|
|
76
|
+
private synthesizeSkillJson;
|
|
77
|
+
/**
|
|
78
|
+
* Scan files to include in publish
|
|
79
|
+
*
|
|
80
|
+
* If includePatterns is specified, only include those files/directories.
|
|
81
|
+
* Otherwise, scan all files in the directory (excluding ignored patterns).
|
|
82
|
+
*/
|
|
83
|
+
private scanFiles;
|
|
84
|
+
/**
|
|
85
|
+
* Patterns to ignore when scanning directories
|
|
86
|
+
*/
|
|
87
|
+
private static readonly IGNORE_PATTERNS;
|
|
88
|
+
/**
|
|
89
|
+
* Check if a file/directory should be ignored
|
|
90
|
+
*/
|
|
91
|
+
private shouldIgnore;
|
|
92
|
+
/**
|
|
93
|
+
* Recursively add files from directory
|
|
94
|
+
*/
|
|
95
|
+
private addFilesFromDir;
|
|
96
|
+
/**
|
|
97
|
+
* Validate a skill directory for publishing
|
|
98
|
+
*
|
|
99
|
+
* Following agentskills.io specification:
|
|
100
|
+
* - SKILL.md is REQUIRED with name and description in frontmatter
|
|
101
|
+
* - skill.json is OPTIONAL (for version, keywords, etc.)
|
|
102
|
+
*/
|
|
103
|
+
validate(skillPath: string): ValidationResult;
|
|
104
|
+
/**
|
|
105
|
+
* Generate integrity hash for files
|
|
106
|
+
*/
|
|
107
|
+
generateIntegrity(skillPath: string, files: string[]): string;
|
|
108
|
+
}
|
|
109
|
+
export default SkillValidator;
|
|
110
|
+
//# sourceMappingURL=skill-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-validator.d.ts","sourceRoot":"","sources":["../../src/core/skill-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMvE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,8BAA8B;IAC9B,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAmBD,qBAAa,cAAc;IACzB;;;;;;;;OAQG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAwE5C;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAiClD;;;;;;OAMG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB;IAwB1D;;;;;;;OAOG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW;IAiDzC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAsCjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAarC;IAEF;;OAEG;IACH,OAAO,CAAC,YAAY;IAepB;;OAEG;IACH,OAAO,CAAC,eAAe;IAoBvB;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAqI7C;;OAEG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;CAiB9D;AAED,eAAe,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Git-based skills management for AI agents
|
|
5
5
|
* Supports 17+ coding agents: Cursor, Claude Code, GitHub Copilot, etc.
|
|
6
6
|
*/
|
|
7
|
-
export { agents, CacheManager, ConfigLoader, DEFAULT_REGISTRIES, detectInstalledAgents,
|
|
8
|
-
export type { AgentConfig, AgentType, InstalledSkill, InstallMode, InstallOptions, InstallResult, ListOptions, LockedSkill, ParsedSkill, ParsedSkillRef, ParsedVersion, SkillJson, SkillMdFrontmatter, SkillsJson, SkillsLock, UpdateOptions, VersionType
|
|
9
|
-
export { getCanonicalSkillPath, getCanonicalSkillsDir, isPathSafe, sanitizeName, shortenPath
|
|
7
|
+
export { agents, CacheManager, ConfigLoader, DEFAULT_REGISTRIES, detectInstalledAgents, generateSkillMd, getAgentConfig, getAgentSkillsDir, getAllAgentTypes, GitResolver, hasValidSkillMd, HttpResolver, Installer, isValidAgentType, LockManager, parseSkillFromDir, parseSkillMd, parseSkillMdFile, SkillManager, SkillValidationError, validateSkillDescription, validateSkillName } from './core/index.js';
|
|
8
|
+
export type { AgentConfig, AgentType, InstalledSkill, InstallMode, InstallOptions, InstallResult, ListOptions, LockedSkill, ParsedSkill, ParsedSkillRef, ParsedVersion, SkillJson, SkillMdFrontmatter, SkillsJson, SkillsLock, UpdateOptions, VersionType } from './types/index.js';
|
|
9
|
+
export { getCanonicalSkillPath, getCanonicalSkillsDir, isPathSafe, sanitizeName, shortenPath } from './utils/fs.js';
|
|
10
10
|
export { logger } from './utils/index.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAEL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAEL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EAAE,eAAe,EACtC,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAE9C,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,WAAW,EAEX,SAAS,EACT,cAAc,EACd,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|