openskills-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/bin/cli.d.ts +10 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +133 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/src/modes/install.d.ts +32 -0
- package/dist/src/modes/install.d.ts.map +1 -0
- package/dist/src/modes/install.js +215 -0
- package/dist/src/modes/install.js.map +1 -0
- package/dist/src/modes/mcp-proxy.d.ts +16 -0
- package/dist/src/modes/mcp-proxy.d.ts.map +1 -0
- package/dist/src/modes/mcp-proxy.js +117 -0
- package/dist/src/modes/mcp-proxy.js.map +1 -0
- package/dist/src/services/downloader.d.ts +32 -0
- package/dist/src/services/downloader.d.ts.map +1 -0
- package/dist/src/services/downloader.js +125 -0
- package/dist/src/services/downloader.js.map +1 -0
- package/dist/src/services/extractor.d.ts +38 -0
- package/dist/src/services/extractor.d.ts.map +1 -0
- package/dist/src/services/extractor.js +82 -0
- package/dist/src/services/extractor.js.map +1 -0
- package/dist/src/services/symlink.d.ts +64 -0
- package/dist/src/services/symlink.d.ts.map +1 -0
- package/dist/src/services/symlink.js +153 -0
- package/dist/src/services/symlink.js.map +1 -0
- package/dist/src/types/index.d.ts +75 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +5 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/agent-dirs.d.ts +49 -0
- package/dist/src/utils/agent-dirs.d.ts.map +1 -0
- package/dist/src/utils/agent-dirs.js +116 -0
- package/dist/src/utils/agent-dirs.js.map +1 -0
- package/dist/src/utils/constants.d.ts +16 -0
- package/dist/src/utils/constants.d.ts.map +1 -0
- package/dist/src/utils/constants.js +21 -0
- package/dist/src/utils/constants.js.map +1 -0
- package/dist/src/utils/errors.d.ts +72 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +108 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/logger.d.ts +41 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +85 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/mode-detector.d.ts +74 -0
- package/dist/src/utils/mode-detector.d.ts.map +1 -0
- package/dist/src/utils/mode-detector.js +156 -0
- package/dist/src/utils/mode-detector.js.map +1 -0
- package/dist/src/utils/prompts.d.ts +22 -0
- package/dist/src/utils/prompts.d.ts.map +1 -0
- package/dist/src/utils/prompts.js +69 -0
- package/dist/src/utils/prompts.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent directory mappings for skill installation.
|
|
3
|
+
*
|
|
4
|
+
* Maps agent names to their directory structures for both project-level
|
|
5
|
+
* and global installations. Supports 39+ coding agents.
|
|
6
|
+
*/
|
|
7
|
+
import { AgentMapping } from '../types/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Agent directory mappings (39+ agents).
|
|
10
|
+
*
|
|
11
|
+
* Note: Project and global paths are often different for the same agent.
|
|
12
|
+
*/
|
|
13
|
+
export declare const AGENT_MAPPINGS: AgentMapping[];
|
|
14
|
+
/**
|
|
15
|
+
* Get the correct directory path for an agent.
|
|
16
|
+
*
|
|
17
|
+
* @param agent - Agent name (e.g., 'claude-code', 'cursor', 'openclaw')
|
|
18
|
+
* @param isGlobal - Whether to return global or project path
|
|
19
|
+
* @returns Directory path (relative for project, with ~ prefix for global)
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* getAgentDir('claude-code', false) // '.claude/skills'
|
|
24
|
+
* getAgentDir('claude-code', true) // '.claude/skills'
|
|
25
|
+
* getAgentDir('openclaw', false) // 'skills'
|
|
26
|
+
* getAgentDir('openclaw', true) // '.moltbot/skills'
|
|
27
|
+
* getAgentDir('unknown-agent', false) // '.unknown-agent/skills' (fallback)
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function getAgentDir(agent: string, isGlobal: boolean): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get full installation path for a skill.
|
|
33
|
+
*
|
|
34
|
+
* @param agent - Agent name
|
|
35
|
+
* @param skill - Skill name
|
|
36
|
+
* @param isGlobal - Whether global or project installation
|
|
37
|
+
* @returns Full path to skill directory
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* getInstallPath('claude-code', 'pdf-processing', false)
|
|
42
|
+
* // '.claude/skills/pdf-processing'
|
|
43
|
+
*
|
|
44
|
+
* getInstallPath('cursor', 'web-scraper', true)
|
|
45
|
+
* // '/home/user/.cursor/skills/web-scraper' (resolved at runtime)
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function getInstallPath(agent: string, skill: string, isGlobal: boolean): string;
|
|
49
|
+
//# sourceMappingURL=agent-dirs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-dirs.d.ts","sourceRoot":"","sources":["../../../src/utils/agent-dirs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,YAAY,EA2DxC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAYpE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAGtF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent directory mappings for skill installation.
|
|
3
|
+
*
|
|
4
|
+
* Maps agent names to their directory structures for both project-level
|
|
5
|
+
* and global installations. Supports 39+ coding agents.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Agent directory mappings (39+ agents).
|
|
9
|
+
*
|
|
10
|
+
* Note: Project and global paths are often different for the same agent.
|
|
11
|
+
*/
|
|
12
|
+
export const AGENT_MAPPINGS = [
|
|
13
|
+
// Anthropic
|
|
14
|
+
{ agent_name: 'claude-code', project_dir: '.claude/skills', global_dir: '.claude/skills' },
|
|
15
|
+
{ agent_name: 'claude', project_dir: '.claude/skills', global_dir: '.claude/skills' },
|
|
16
|
+
// OpenClaw ecosystem
|
|
17
|
+
{ agent_name: 'openclaw', project_dir: 'skills', global_dir: '.moltbot/skills' },
|
|
18
|
+
{ agent_name: 'clawdbot', project_dir: 'skills', global_dir: '.moltbot/skills' },
|
|
19
|
+
// Agents using .agents/skills/ for project
|
|
20
|
+
{ agent_name: 'amp', project_dir: '.agents/skills', global_dir: '.config/agents/skills' },
|
|
21
|
+
{ agent_name: 'codex', project_dir: '.agents/skills', global_dir: '.codex/skills' },
|
|
22
|
+
{ agent_name: 'gemini-cli', project_dir: '.agents/skills', global_dir: '.gemini/skills' },
|
|
23
|
+
{ agent_name: 'github-copilot', project_dir: '.agents/skills', global_dir: '.copilot/skills' },
|
|
24
|
+
{ agent_name: 'kimi', project_dir: '.agents/skills', global_dir: '.config/agents/skills' },
|
|
25
|
+
{ agent_name: 'kimi-cli', project_dir: '.agents/skills', global_dir: '.config/agents/skills' },
|
|
26
|
+
{ agent_name: 'opencode', project_dir: '.agents/skills', global_dir: '.config/opencode/skills' },
|
|
27
|
+
{ agent_name: 'replit', project_dir: '.agents/skills', global_dir: '.config/agents/skills' },
|
|
28
|
+
// Agents with unique paths
|
|
29
|
+
{ agent_name: 'adal', project_dir: '.adal/skills', global_dir: '.adal/skills' },
|
|
30
|
+
{ agent_name: 'antigravity', project_dir: '.agent/skills', global_dir: '.gemini/antigravity/skills' },
|
|
31
|
+
{ agent_name: 'augment', project_dir: '.augment/skills', global_dir: '.augment/skills' },
|
|
32
|
+
{ agent_name: 'cline', project_dir: '.cline/skills', global_dir: '.cline/skills' },
|
|
33
|
+
{ agent_name: 'codebuddy', project_dir: '.codebuddy/skills', global_dir: '.codebuddy/skills' },
|
|
34
|
+
{ agent_name: 'command-code', project_dir: '.commandcode/skills', global_dir: '.commandcode/skills' },
|
|
35
|
+
{ agent_name: 'commandcode', project_dir: '.commandcode/skills', global_dir: '.commandcode/skills' },
|
|
36
|
+
{ agent_name: 'continue', project_dir: '.continue/skills', global_dir: '.continue/skills' },
|
|
37
|
+
{ agent_name: 'crush', project_dir: '.crush/skills', global_dir: '.config/crush/skills' },
|
|
38
|
+
{ agent_name: 'cursor', project_dir: '.cursor/skills', global_dir: '.cursor/skills' },
|
|
39
|
+
{ agent_name: 'droid', project_dir: '.factory/skills', global_dir: '.factory/skills' },
|
|
40
|
+
{ agent_name: 'factory', project_dir: '.factory/skills', global_dir: '.factory/skills' },
|
|
41
|
+
{ agent_name: 'goose', project_dir: '.goose/skills', global_dir: '.config/goose/skills' },
|
|
42
|
+
{ agent_name: 'iflow', project_dir: '.iflow/skills', global_dir: '.iflow/skills' },
|
|
43
|
+
{ agent_name: 'iflow-cli', project_dir: '.iflow/skills', global_dir: '.iflow/skills' },
|
|
44
|
+
{ agent_name: 'junie', project_dir: '.junie/skills', global_dir: '.junie/skills' },
|
|
45
|
+
{ agent_name: 'kilo', project_dir: '.kilocode/skills', global_dir: '.kilocode/skills' },
|
|
46
|
+
{ agent_name: 'kilocode', project_dir: '.kilocode/skills', global_dir: '.kilocode/skills' },
|
|
47
|
+
{ agent_name: 'kilo-code', project_dir: '.kilocode/skills', global_dir: '.kilocode/skills' },
|
|
48
|
+
{ agent_name: 'kiro', project_dir: '.kiro/skills', global_dir: '.kiro/skills' },
|
|
49
|
+
{ agent_name: 'kiro-cli', project_dir: '.kiro/skills', global_dir: '.kiro/skills' },
|
|
50
|
+
{ agent_name: 'kode', project_dir: '.kode/skills', global_dir: '.kode/skills' },
|
|
51
|
+
{ agent_name: 'mcpjam', project_dir: '.mcpjam/skills', global_dir: '.mcpjam/skills' },
|
|
52
|
+
{ agent_name: 'mistral-vibe', project_dir: '.vibe/skills', global_dir: '.vibe/skills' },
|
|
53
|
+
{ agent_name: 'vibe', project_dir: '.vibe/skills', global_dir: '.vibe/skills' },
|
|
54
|
+
{ agent_name: 'mux', project_dir: '.mux/skills', global_dir: '.mux/skills' },
|
|
55
|
+
{ agent_name: 'neovate', project_dir: '.neovate/skills', global_dir: '.neovate/skills' },
|
|
56
|
+
{ agent_name: 'openhands', project_dir: '.openhands/skills', global_dir: '.openhands/skills' },
|
|
57
|
+
{ agent_name: 'pi', project_dir: '.pi/skills', global_dir: '.pi/agent/skills' },
|
|
58
|
+
{ agent_name: 'pochi', project_dir: '.pochi/skills', global_dir: '.pochi/skills' },
|
|
59
|
+
{ agent_name: 'qoder', project_dir: '.qoder/skills', global_dir: '.qoder/skills' },
|
|
60
|
+
{ agent_name: 'qwen', project_dir: '.qwen/skills', global_dir: '.qwen/skills' },
|
|
61
|
+
{ agent_name: 'qwen-code', project_dir: '.qwen/skills', global_dir: '.qwen/skills' },
|
|
62
|
+
{ agent_name: 'roo', project_dir: '.roo/skills', global_dir: '.roo/skills' },
|
|
63
|
+
{ agent_name: 'roo-code', project_dir: '.roo/skills', global_dir: '.roo/skills' },
|
|
64
|
+
{ agent_name: 'trae', project_dir: '.trae/skills', global_dir: '.trae/skills' },
|
|
65
|
+
{ agent_name: 'trae-cn', project_dir: '.trae/skills', global_dir: '.trae-cn/skills' },
|
|
66
|
+
{ agent_name: 'windsurf', project_dir: '.windsurf/skills', global_dir: '.codeium/windsurf/skills' },
|
|
67
|
+
{ agent_name: 'zencoder', project_dir: '.zencoder/skills', global_dir: '.zencoder/skills' },
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Get the correct directory path for an agent.
|
|
71
|
+
*
|
|
72
|
+
* @param agent - Agent name (e.g., 'claude-code', 'cursor', 'openclaw')
|
|
73
|
+
* @param isGlobal - Whether to return global or project path
|
|
74
|
+
* @returns Directory path (relative for project, with ~ prefix for global)
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* getAgentDir('claude-code', false) // '.claude/skills'
|
|
79
|
+
* getAgentDir('claude-code', true) // '.claude/skills'
|
|
80
|
+
* getAgentDir('openclaw', false) // 'skills'
|
|
81
|
+
* getAgentDir('openclaw', true) // '.moltbot/skills'
|
|
82
|
+
* getAgentDir('unknown-agent', false) // '.unknown-agent/skills' (fallback)
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export function getAgentDir(agent, isGlobal) {
|
|
86
|
+
const agentLower = agent.toLowerCase();
|
|
87
|
+
// Find matching agent mapping
|
|
88
|
+
const mapping = AGENT_MAPPINGS.find(m => m.agent_name === agentLower);
|
|
89
|
+
if (mapping) {
|
|
90
|
+
return isGlobal ? mapping.global_dir : mapping.project_dir;
|
|
91
|
+
}
|
|
92
|
+
// Fallback pattern for unknown agents
|
|
93
|
+
return `.${agent}/skills`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get full installation path for a skill.
|
|
97
|
+
*
|
|
98
|
+
* @param agent - Agent name
|
|
99
|
+
* @param skill - Skill name
|
|
100
|
+
* @param isGlobal - Whether global or project installation
|
|
101
|
+
* @returns Full path to skill directory
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* getInstallPath('claude-code', 'pdf-processing', false)
|
|
106
|
+
* // '.claude/skills/pdf-processing'
|
|
107
|
+
*
|
|
108
|
+
* getInstallPath('cursor', 'web-scraper', true)
|
|
109
|
+
* // '/home/user/.cursor/skills/web-scraper' (resolved at runtime)
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export function getInstallPath(agent, skill, isGlobal) {
|
|
113
|
+
const agentDir = getAgentDir(agent, isGlobal);
|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,CAAC;IAEvC,8BAA8B;IAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;IAEtE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC7D,CAAC;IAED,sCAAsC;IACtC,OAAO,IAAI,KAAK,SAAS,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,KAAa,EAAE,QAAiB;IAC5E,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9C,OAAO,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI constants and configuration.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Default agents for multi-agent installation (-y flag).
|
|
6
|
+
* These agents will have symlinks created when using -y without specifying an agent.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_AGENTS: readonly ["claude-code", "codex", "cursor", "gemini-cli", "qwen-code"];
|
|
9
|
+
/**
|
|
10
|
+
* All supported agents for interactive selection.
|
|
11
|
+
* Dynamically extracted from AGENT_MAPPINGS to stay in sync.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SUPPORTED_AGENTS: string[];
|
|
14
|
+
export type SupportedAgent = typeof SUPPORTED_AGENTS[number];
|
|
15
|
+
export type DefaultAgent = typeof DEFAULT_AGENTS[number];
|
|
16
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;GAGG;AACH,eAAO,MAAM,cAAc,wEAMjB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAwC,CAAC;AAEtE,MAAM,MAAM,cAAc,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI constants and configuration.
|
|
3
|
+
*/
|
|
4
|
+
import { AGENT_MAPPINGS } from './agent-dirs.js';
|
|
5
|
+
/**
|
|
6
|
+
* Default agents for multi-agent installation (-y flag).
|
|
7
|
+
* These agents will have symlinks created when using -y without specifying an agent.
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_AGENTS = [
|
|
10
|
+
'claude-code',
|
|
11
|
+
'codex',
|
|
12
|
+
'cursor',
|
|
13
|
+
'gemini-cli',
|
|
14
|
+
'qwen-code',
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* All supported agents for interactive selection.
|
|
18
|
+
* Dynamically extracted from AGENT_MAPPINGS to stay in sync.
|
|
19
|
+
*/
|
|
20
|
+
export const SUPPORTED_AGENTS = AGENT_MAPPINGS.map(m => m.agent_name);
|
|
21
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa;IACb,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,WAAW;CACH,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error formatter utility for user-friendly error messages.
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent error formatting with appropriate exit codes.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Exit codes for different error types.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ExitCode: {
|
|
10
|
+
readonly SUCCESS: 0;
|
|
11
|
+
readonly USER_ERROR: 1;
|
|
12
|
+
readonly NETWORK_ERROR: 2;
|
|
13
|
+
readonly SYSTEM_ERROR: 3;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Format and display error message, then exit.
|
|
17
|
+
*
|
|
18
|
+
* @param message - Error message
|
|
19
|
+
* @param exitCode - Exit code (default: 1)
|
|
20
|
+
* @param suggestions - Optional suggestions for the user
|
|
21
|
+
*/
|
|
22
|
+
export declare function exitWithError(message: string, exitCode?: number, suggestions?: string[]): never;
|
|
23
|
+
/**
|
|
24
|
+
* Format user error (invalid arguments, missing flags).
|
|
25
|
+
*/
|
|
26
|
+
export declare function userError(message: string, suggestions?: string[]): never;
|
|
27
|
+
/**
|
|
28
|
+
* Format network error (download failed, backend unreachable).
|
|
29
|
+
*/
|
|
30
|
+
export declare function networkError(message: string): never;
|
|
31
|
+
/**
|
|
32
|
+
* Format system error (disk full, permission denied).
|
|
33
|
+
*/
|
|
34
|
+
export declare function systemError(message: string): never;
|
|
35
|
+
/**
|
|
36
|
+
* Validate skill slug format.
|
|
37
|
+
*
|
|
38
|
+
* Valid format: lowercase letters, numbers, hyphens, underscores
|
|
39
|
+
*
|
|
40
|
+
* @param slug - Skill slug to validate
|
|
41
|
+
* @throws Error if invalid format
|
|
42
|
+
*/
|
|
43
|
+
export declare function validateSkillSlug(slug: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Validate agent name format.
|
|
46
|
+
*
|
|
47
|
+
* Valid format: lowercase letters, numbers, hyphens
|
|
48
|
+
*
|
|
49
|
+
* @param agent - Agent name to validate
|
|
50
|
+
* @returns Normalized agent name (lowercase)
|
|
51
|
+
*/
|
|
52
|
+
export declare function validateAgentName(agent: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Format success message with timing.
|
|
55
|
+
*
|
|
56
|
+
* @param message - Success message
|
|
57
|
+
* @param durationMs - Duration in milliseconds
|
|
58
|
+
*/
|
|
59
|
+
export declare function success(message: string, durationMs?: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Format info message.
|
|
62
|
+
*
|
|
63
|
+
* @param message - Info message
|
|
64
|
+
*/
|
|
65
|
+
export declare function info(message: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Format step message (for multi-step operations).
|
|
68
|
+
*
|
|
69
|
+
* @param message - Step message
|
|
70
|
+
*/
|
|
71
|
+
export declare function step(message: string): void;
|
|
72
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAA4B,EACtC,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,KAAK,CAQP;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAExE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEnD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAElD;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CASpD;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAOlE;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error formatter utility for user-friendly error messages.
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent error formatting with appropriate exit codes.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Exit codes for different error types.
|
|
8
|
+
*/
|
|
9
|
+
export const ExitCode = {
|
|
10
|
+
SUCCESS: 0,
|
|
11
|
+
USER_ERROR: 1, // Invalid arguments, missing flags, etc.
|
|
12
|
+
NETWORK_ERROR: 2, // Download failed, backend unreachable, etc.
|
|
13
|
+
SYSTEM_ERROR: 3, // Disk full, permission denied, symlink failed, etc.
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Format and display error message, then exit.
|
|
17
|
+
*
|
|
18
|
+
* @param message - Error message
|
|
19
|
+
* @param exitCode - Exit code (default: 1)
|
|
20
|
+
* @param suggestions - Optional suggestions for the user
|
|
21
|
+
*/
|
|
22
|
+
export function exitWithError(message, exitCode = ExitCode.USER_ERROR, suggestions) {
|
|
23
|
+
console.error(`✗ Error: ${message}`);
|
|
24
|
+
if (suggestions && suggestions.length > 0) {
|
|
25
|
+
console.error(` Did you mean: ${suggestions.join(', ')}?`);
|
|
26
|
+
}
|
|
27
|
+
process.exit(exitCode);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Format user error (invalid arguments, missing flags).
|
|
31
|
+
*/
|
|
32
|
+
export function userError(message, suggestions) {
|
|
33
|
+
exitWithError(message, ExitCode.USER_ERROR, suggestions);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Format network error (download failed, backend unreachable).
|
|
37
|
+
*/
|
|
38
|
+
export function networkError(message) {
|
|
39
|
+
exitWithError(message, ExitCode.NETWORK_ERROR);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Format system error (disk full, permission denied).
|
|
43
|
+
*/
|
|
44
|
+
export function systemError(message) {
|
|
45
|
+
exitWithError(message, ExitCode.SYSTEM_ERROR);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Validate skill slug format.
|
|
49
|
+
*
|
|
50
|
+
* Valid format: lowercase letters, numbers, hyphens, underscores
|
|
51
|
+
*
|
|
52
|
+
* @param slug - Skill slug to validate
|
|
53
|
+
* @throws Error if invalid format
|
|
54
|
+
*/
|
|
55
|
+
export function validateSkillSlug(slug) {
|
|
56
|
+
const validPattern = /^[a-z0-9-_]+$/;
|
|
57
|
+
if (!validPattern.test(slug)) {
|
|
58
|
+
userError('Invalid skill slug format (use lowercase, hyphens, underscores only)', ['Example: pdf-processing']);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validate agent name format.
|
|
63
|
+
*
|
|
64
|
+
* Valid format: lowercase letters, numbers, hyphens
|
|
65
|
+
*
|
|
66
|
+
* @param agent - Agent name to validate
|
|
67
|
+
* @returns Normalized agent name (lowercase)
|
|
68
|
+
*/
|
|
69
|
+
export function validateAgentName(agent) {
|
|
70
|
+
const normalized = agent.toLowerCase();
|
|
71
|
+
const validPattern = /^[a-z0-9-]+$/;
|
|
72
|
+
if (!validPattern.test(normalized)) {
|
|
73
|
+
userError('Invalid agent name format (use lowercase, hyphens only)', ['Example: claude-code, cursor, openclaw']);
|
|
74
|
+
}
|
|
75
|
+
return normalized;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Format success message with timing.
|
|
79
|
+
*
|
|
80
|
+
* @param message - Success message
|
|
81
|
+
* @param durationMs - Duration in milliseconds
|
|
82
|
+
*/
|
|
83
|
+
export function success(message, durationMs) {
|
|
84
|
+
if (durationMs !== undefined) {
|
|
85
|
+
const seconds = (durationMs / 1000).toFixed(1);
|
|
86
|
+
console.log(`✓ ${message} (${seconds}s)`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
console.log(`✓ ${message}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Format info message.
|
|
94
|
+
*
|
|
95
|
+
* @param message - Info message
|
|
96
|
+
*/
|
|
97
|
+
export function info(message) {
|
|
98
|
+
console.log(` ${message}`);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Format step message (for multi-step operations).
|
|
102
|
+
*
|
|
103
|
+
* @param message - Step message
|
|
104
|
+
*/
|
|
105
|
+
export function step(message) {
|
|
106
|
+
console.log(`→ ${message}`);
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC,EAAO,yCAAyC;IAC7D,aAAa,EAAE,CAAC,EAAI,6CAA6C;IACjE,YAAY,EAAE,CAAC,EAAK,qDAAqD;CACjE,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAe,EACf,WAAmB,QAAQ,CAAC,UAAU,EACtC,WAAsB;IAEtB,OAAO,CAAC,KAAK,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;IAErC,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,CAAC,KAAK,CAAC,mBAAmB,WAAW,CAA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IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger utility for installation events.
|
|
3
|
+
*
|
|
4
|
+
* Logs installation events to ~/.openskills/install.log in JSON Lines format.
|
|
5
|
+
*/
|
|
6
|
+
import { InstallLogEntry } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Log installation event to JSON Lines file.
|
|
9
|
+
*
|
|
10
|
+
* @param entry - Log entry to write
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* logInstallEvent({
|
|
15
|
+
* timestamp: new Date().toISOString(),
|
|
16
|
+
* event: 'start',
|
|
17
|
+
* skill_slug: 'pdf-processing',
|
|
18
|
+
* agent_name: 'claude-code',
|
|
19
|
+
* installation_scope: 'project'
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function logInstallEvent(entry: InstallLogEntry): void;
|
|
24
|
+
/**
|
|
25
|
+
* Create a log entry helper for a specific installation.
|
|
26
|
+
*
|
|
27
|
+
* @param skillSlug - Skill identifier
|
|
28
|
+
* @param agentName - Agent name
|
|
29
|
+
* @param installationScope - Installation scope
|
|
30
|
+
* @returns Function to log events for this installation
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const log = createInstallLogger('pdf-processing', 'claude-code', 'project');
|
|
35
|
+
* log('start');
|
|
36
|
+
* log('download_complete', { duration_ms: 1234 });
|
|
37
|
+
* log('complete', { duration_ms: 5678 });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function createInstallLogger(skillSlug: string, agentName: string, installationScope: 'project' | 'global'): (event: InstallLogEntry["event"], extra?: Partial<InstallLogEntry>) => void;
|
|
41
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAcpD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAgB5D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,SAAS,GAAG,QAAQ,IAKrC,OAAO,eAAe,CAAC,OAAO,CAAC,EAC/B,QAAQ,OAAO,CAAC,eAAe,CAAC,KAC/B,IAAI,CAiBR"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger utility for installation events.
|
|
3
|
+
*
|
|
4
|
+
* Logs installation events to ~/.openskills/install.log in JSON Lines format.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import * as os from 'os';
|
|
9
|
+
const LOG_DIR = path.join(os.homedir(), '.openskills');
|
|
10
|
+
const LOG_FILE = path.join(LOG_DIR, 'install.log');
|
|
11
|
+
/**
|
|
12
|
+
* Ensure log directory exists.
|
|
13
|
+
*/
|
|
14
|
+
function ensureLogDir() {
|
|
15
|
+
if (!fs.existsSync(LOG_DIR)) {
|
|
16
|
+
fs.mkdirSync(LOG_DIR, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Log installation event to JSON Lines file.
|
|
21
|
+
*
|
|
22
|
+
* @param entry - Log entry to write
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* logInstallEvent({
|
|
27
|
+
* timestamp: new Date().toISOString(),
|
|
28
|
+
* event: 'start',
|
|
29
|
+
* skill_slug: 'pdf-processing',
|
|
30
|
+
* agent_name: 'claude-code',
|
|
31
|
+
* installation_scope: 'project'
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function logInstallEvent(entry) {
|
|
36
|
+
try {
|
|
37
|
+
ensureLogDir();
|
|
38
|
+
// Add timestamp if not present
|
|
39
|
+
if (!entry.timestamp) {
|
|
40
|
+
entry.timestamp = new Date().toISOString();
|
|
41
|
+
}
|
|
42
|
+
// Append to log file (JSON Lines format)
|
|
43
|
+
const line = JSON.stringify(entry) + '\n';
|
|
44
|
+
fs.appendFileSync(LOG_FILE, line, 'utf-8');
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
// Don't fail installation if logging fails
|
|
48
|
+
console.error(`Warning: Failed to write to install log: ${error.message}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a log entry helper for a specific installation.
|
|
53
|
+
*
|
|
54
|
+
* @param skillSlug - Skill identifier
|
|
55
|
+
* @param agentName - Agent name
|
|
56
|
+
* @param installationScope - Installation scope
|
|
57
|
+
* @returns Function to log events for this installation
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const log = createInstallLogger('pdf-processing', 'claude-code', 'project');
|
|
62
|
+
* log('start');
|
|
63
|
+
* log('download_complete', { duration_ms: 1234 });
|
|
64
|
+
* log('complete', { duration_ms: 5678 });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export function createInstallLogger(skillSlug, agentName, installationScope) {
|
|
68
|
+
const startTime = Date.now();
|
|
69
|
+
return (event, extra) => {
|
|
70
|
+
const entry = {
|
|
71
|
+
timestamp: new Date().toISOString(),
|
|
72
|
+
event,
|
|
73
|
+
skill_slug: skillSlug,
|
|
74
|
+
agent_name: agentName,
|
|
75
|
+
installation_scope: installationScope,
|
|
76
|
+
...extra,
|
|
77
|
+
};
|
|
78
|
+
// Add duration for completion events
|
|
79
|
+
if (event === 'complete' || event === 'error') {
|
|
80
|
+
entry.duration_ms = Date.now() - startTime;
|
|
81
|
+
}
|
|
82
|
+
logInstallEvent(entry);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;AACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAEnD;;GAEG;AACH,SAAS,YAAY;IACnB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU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
|
|
3
|
+
*
|
|
4
|
+
* Determines which mode the CLI should operate in based on command-line arguments.
|
|
5
|
+
*/
|
|
6
|
+
import { CliMode } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Detect CLI mode from command-line arguments.
|
|
9
|
+
*
|
|
10
|
+
* Mode priority:
|
|
11
|
+
* 1. Help (-h, --help)
|
|
12
|
+
* 2. Version (-v, --version)
|
|
13
|
+
* 3. MCP proxy (--api-key)
|
|
14
|
+
* 4. Installation (positional skill name or -s/--skill flag)
|
|
15
|
+
* 5. Help (default if no valid flags)
|
|
16
|
+
*
|
|
17
|
+
* @param args - Command-line arguments (process.argv.slice(2))
|
|
18
|
+
* @returns Detected CLI mode
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* detectMode(['pdf-processing', '-a', 'claude-code']) // 'install'
|
|
23
|
+
* detectMode(['-s', 'pdf', '-a', 'claude-code']) // 'install'
|
|
24
|
+
* detectMode(['--api-key', 'osk_abc123']) // 'mcp'
|
|
25
|
+
* detectMode(['-h']) // 'help'
|
|
26
|
+
* detectMode(['-v']) // 'version'
|
|
27
|
+
* detectMode([]) // 'help'
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function detectMode(args: string[]): CliMode;
|
|
31
|
+
/**
|
|
32
|
+
* Parse installation options from command-line arguments.
|
|
33
|
+
*
|
|
34
|
+
* Supports both positional and flag-based skill names:
|
|
35
|
+
* - Positional: npx openskills pdf-processing -a claude-code
|
|
36
|
+
* - Flag-based: npx openskills -s pdf-processing -a claude-code
|
|
37
|
+
*
|
|
38
|
+
* @param args - Command-line arguments
|
|
39
|
+
* @returns Parsed installation options or partial options for interactive mode
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* parseInstallOptions(['pdf-processing', '-a', 'claude-code'])
|
|
44
|
+
* // { skill: 'pdf-processing', agent: 'claude-code', global: false, force: false, multiAgent: false }
|
|
45
|
+
*
|
|
46
|
+
* parseInstallOptions(['pdf-processing', '-y'])
|
|
47
|
+
* // { skill: 'pdf-processing', agent: null, global: true, force: false, multiAgent: true }
|
|
48
|
+
*
|
|
49
|
+
* parseInstallOptions(['pdf-processing'])
|
|
50
|
+
* // { skill: 'pdf-processing', agent: null, global: false, force: false, multiAgent: false }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseInstallOptions(args: string[]): {
|
|
54
|
+
skill: string | null;
|
|
55
|
+
agent: string | null;
|
|
56
|
+
global: boolean;
|
|
57
|
+
force: boolean;
|
|
58
|
+
multiAgent: boolean;
|
|
59
|
+
scopeExplicit: boolean;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Parse API key from command-line arguments.
|
|
63
|
+
*
|
|
64
|
+
* @param args - Command-line arguments
|
|
65
|
+
* @returns API key or null if not found
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* parseApiKey(['--api-key', 'osk_abc123']) // 'osk_abc123'
|
|
70
|
+
* parseApiKey(['-s', 'pdf']) // null
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseApiKey(args: string[]): string | null;
|
|
74
|
+
//# sourceMappingURL=mode-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-detector.d.ts","sourceRoot":"","sources":["../../../src/utils/mode-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAuBlD;AAgCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IACnD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;CACxB,CAmDA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAGzD"}
|