16
const SKILL_NAME = 'composio-cli';
17
const SKILL_ASSET_NAME = 'composio-skill.zip';
18
export type SkillReleaseChannel = CliReleaseChannel;
19
+export type SkillInstallTarget = 'claude' | 'codex' | 'openclaw';
20
+
21
+const SKILL_NAME_PATTERN = /^[A-Za-z0-9._-]+$/;
22
+
23
+const SKILL_TARGET_LABELS: Record<SkillInstallTarget, string> = {
24
+ claude: 'Claude Code',
25
+ codex: 'Codex',
26
+ openclaw: 'OpenClaw',
27
+};
28
29
type GitHubConfig = GitHubRepoConfig & {
30
TAG: Option.Option<string>;
34
const hasSkillAsset = (release: GitHubRelease) =>
35
release.assets.some(asset => asset.name === SKILL_ASSET_NAME);
36
37
+export const resolveInstalledSkillName = (skillName?: string): string => {
38
+ const normalized = skillName?.trim();
39
+ if (!normalized) {
40
+ return SKILL_NAME;
41
+ }
42
+ if (
43
+ normalized === '.' ||
44
+ normalized === '..' ||
45
+ !SKILL_NAME_PATTERN.test(normalized)
46
+ ) {
47
+ throw new Error(
48
+ 'Invalid skill name. Use letters, numbers, dots, underscores, or hyphens only.'
49
+ );
50
+ }
51
+ return normalized;
52
+};
53
+
54
+export const resolveTargetSkillPath = ({
55
+ home,
56
+ skillName,
57
+ target,
58
+}: {
59
+ home: string;
60
+ skillName: string;
61
+ target: SkillInstallTarget;
62
+}): string => {
63
+ switch (target) {
64
+ case 'claude':
65
+ return path.join(home, '.claude', 'skills', skillName);
66
+ case 'codex':
67
+ return path.join(home, '.codex', 'skills', skillName);
68
+ case 'openclaw':
69
+ return path.join(home, '.openclaw', 'skills', skillName);
70
+ }
71
+};
72
+
73
+const resolveTargetLabel = (target: SkillInstallTarget): string => SKILL_TARGET_LABELS[target];
74
+
75
export const inferSkillReleaseChannel = (tagOrVersion: string): SkillReleaseChannel =>
76
tagOrVersion.includes('-beta.') ? 'beta' : 'stable';
77
115
* Install the composio-cli skill into the user's global agent skills directory.
116
*
117
* - Downloads composio-skill.zip from the matching CLI GitHub release
71
- * - Extracts to ~/.agents/skills/composio-cli/
72
- * - Creates a symlink at ~/.claude/skills/composio-cli → ../../.agents/skills/composio-cli
118
+ * - Extracts to ~/.agents/skills/<skill-name>/
119
+ * - Creates a symlink in the selected agent's skills directory
120
*
121
* Non-fatal: wrapped version catches all errors.
122
*/
123
export const installSkill = (options?: {
124
readonly releaseTag?: string;
125
readonly channel?: SkillReleaseChannel;
126
+ readonly target?: SkillInstallTarget;
127
+ readonly skillName?: string;
128
}) =>
129
Effect.gen(function* () {
130
const os = yield* NodeOs;
132
const httpClient = yield* HttpClient.HttpClient;
133
const githubConfig = yield* Config.all(GITHUB_CONFIG);
134
const home = os.homedir;
135
+ const target = options?.target ?? 'claude';
136
+ const skillName = resolveInstalledSkillName(options?.skillName);
137
87
- const agentSkillDir = path.join(home, '.agents', 'skills', SKILL_NAME);
88
- const claudeSkillLink = path.join(home, '.claude', 'skills', SKILL_NAME);
138
+ const agentSkillDir = path.join(home, '.agents', 'skills', skillName);
139
+ const targetSkillPath = resolveTargetSkillPath({ home, skillName, target });
140
141
const tag = yield* resolveSkillReleaseTag({
142
channel: options?.channel,
212
fs.rmSync(tmpDir, { recursive: true, force: true });
213
}
214
164
- // Create symlink for Claude Code — always replace any existing entry
165
- fs.mkdirSync(path.join(home, '.claude', 'skills'), { recursive: true });
215
+ // Create agent-specific symlink — always replace any existing entry.
216
+ fs.mkdirSync(path.dirname(targetSkillPath), { recursive: true });
217
try {
167
- const stat = fs.lstatSync(claudeSkillLink);
218
+ const stat = fs.lstatSync(targetSkillPath);
219
// Entry exists (symlink, broken symlink, or directory) — remove it
220
if (stat.isSymbolicLink()) {
170
- fs.unlinkSync(claudeSkillLink);
221
+ fs.unlinkSync(targetSkillPath);
222
} else if (stat.isDirectory()) {
172
- fs.rmSync(claudeSkillLink, { recursive: true, force: true });
223
+ fs.rmSync(targetSkillPath, { recursive: true, force: true });
224
} else {
174
- fs.unlinkSync(claudeSkillLink);
225
+ fs.unlinkSync(targetSkillPath);
226
}
227
} catch {
228
// lstatSync throws if nothing exists at the path — that's fine
229
}
179
- const relativeTarget = path.relative(path.dirname(claudeSkillLink), agentSkillDir);
180
- fs.symlinkSync(relativeTarget, claudeSkillLink);
230
+ const relativeTarget = path.relative(path.dirname(targetSkillPath), agentSkillDir);
231
+ fs.symlinkSync(relativeTarget, targetSkillPath);
232
182
- yield* ui.log.success('Installed composio-cli skill for Claude Code');
233
+ yield* ui.log.success(`Installed ${skillName} skill for ${resolveTargetLabel(target)}`);
234
});
235
236
/**
239
export const installSkillSafe = (options?: {
240
readonly releaseTag?: string;
241
readonly channel?: SkillReleaseChannel;
242
+ readonly target?: SkillInstallTarget;
243
+ readonly skillName?: string;
244
}) =>
245
installSkill(options).pipe(
246
Effect.sandbox,
248
Effect.gen(function* () {
249
const ui = yield* TerminalUI;
250
yield* Effect.logDebug('Skill install failed:', cause);
198
- yield* ui.log.warn('Could not install Claude Code skill (non-fatal)');
251
+ const targetLabel = resolveTargetLabel(options?.target ?? 'claude');
252
+ yield* ui.log.warn(`Could not install ${targetLabel} skill (non-fatal)`);
253
})
254
)
255
);