@recapt/mcp 0.0.18-beta → 0.0.20-beta
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/dist/cli/index.d.ts +0 -11
- package/dist/cli/index.js +1059 -21
- package/dist/index.d.ts +0 -18
- package/dist/index.js +3205 -247
- package/dist/tools/catalog/anthropicToolCatalog.json +1306 -0
- package/dist/tools/catalog/toolCatalog.json +4078 -382
- package/package.json +10 -3
- package/skills/self-improvement.md +388 -222
- package/templates/self-improvement-full.md +91 -0
- package/templates/{self-improvement.md → self-improvement-lite.md} +13 -9
- package/dist/api/client.d.ts +0 -14
- package/dist/api/client.js +0 -67
- package/dist/cli/commands/setup-self-improvement-gh.d.ts +0 -7
- package/dist/cli/commands/setup-self-improvement-gh.js +0 -310
- package/dist/cli/commands/setup.d.ts +0 -7
- package/dist/cli/commands/setup.js +0 -173
- package/dist/cli/commands/skill.d.ts +0 -24
- package/dist/cli/commands/skill.js +0 -264
- package/dist/cli/utils/ide-config.d.ts +0 -31
- package/dist/cli/utils/ide-config.js +0 -294
- package/dist/cli/utils/prompts.d.ts +0 -22
- package/dist/cli/utils/prompts.js +0 -71
- package/dist/tools/analyzeFlow.d.ts +0 -7
- package/dist/tools/analyzeFlow.js +0 -68
- package/dist/tools/analyzeFunnel.d.ts +0 -7
- package/dist/tools/analyzeFunnel.js +0 -63
- package/dist/tools/catalog/callTool.d.ts +0 -22
- package/dist/tools/catalog/callTool.js +0 -92
- package/dist/tools/catalog/index.d.ts +0 -11
- package/dist/tools/catalog/index.js +0 -11
- package/dist/tools/catalog/searchTools.d.ts +0 -22
- package/dist/tools/catalog/searchTools.js +0 -194
- package/dist/tools/compareCohorts.d.ts +0 -6
- package/dist/tools/compareCohorts.js +0 -84
- package/dist/tools/comparePeriods.d.ts +0 -6
- package/dist/tools/comparePeriods.js +0 -54
- package/dist/tools/detectDrift.d.ts +0 -6
- package/dist/tools/detectDrift.js +0 -55
- package/dist/tools/detectRegressions.d.ts +0 -6
- package/dist/tools/detectRegressions.js +0 -63
- package/dist/tools/diagnostic.d.ts +0 -6
- package/dist/tools/diagnostic.js +0 -109
- package/dist/tools/discoverPersonas.d.ts +0 -6
- package/dist/tools/discoverPersonas.js +0 -50
- package/dist/tools/getActionableIssues.d.ts +0 -7
- package/dist/tools/getActionableIssues.js +0 -55
- package/dist/tools/getAnomalies.d.ts +0 -6
- package/dist/tools/getAnomalies.js +0 -53
- package/dist/tools/getConsoleErrors.d.ts +0 -6
- package/dist/tools/getConsoleErrors.js +0 -61
- package/dist/tools/getDeadClicks.d.ts +0 -6
- package/dist/tools/getDeadClicks.js +0 -42
- package/dist/tools/getDomains.d.ts +0 -6
- package/dist/tools/getDomains.js +0 -34
- package/dist/tools/getElementFriction.d.ts +0 -6
- package/dist/tools/getElementFriction.js +0 -45
- package/dist/tools/getFlowFriction.d.ts +0 -7
- package/dist/tools/getFlowFriction.js +0 -57
- package/dist/tools/getFormFriction.d.ts +0 -6
- package/dist/tools/getFormFriction.js +0 -42
- package/dist/tools/getIssues.d.ts +0 -6
- package/dist/tools/getIssues.js +0 -82
- package/dist/tools/getJourneyPatterns.d.ts +0 -7
- package/dist/tools/getJourneyPatterns.js +0 -50
- package/dist/tools/getPageMetrics.d.ts +0 -6
- package/dist/tools/getPageMetrics.js +0 -47
- package/dist/tools/getPageTrends.d.ts +0 -6
- package/dist/tools/getPageTrends.js +0 -46
- package/dist/tools/getSessionDetails.d.ts +0 -6
- package/dist/tools/getSessionDetails.js +0 -70
- package/dist/tools/getSessionPages.d.ts +0 -7
- package/dist/tools/getSessionPages.js +0 -74
- package/dist/tools/getUxHealthReport.d.ts +0 -7
- package/dist/tools/getUxHealthReport.js +0 -50
- package/dist/tools/improvementRun.d.ts +0 -6
- package/dist/tools/improvementRun.js +0 -315
- package/dist/tools/knowledge.d.ts +0 -6
- package/dist/tools/knowledge.js +0 -186
- package/dist/tools/listPages.d.ts +0 -6
- package/dist/tools/listPages.js +0 -50
- package/dist/tools/listSessions.d.ts +0 -7
- package/dist/tools/listSessions.js +0 -67
- package/dist/tools/memory.d.ts +0 -7
- package/dist/tools/memory.js +0 -119
- package/dist/tools/predictOutcomes.d.ts +0 -6
- package/dist/tools/predictOutcomes.js +0 -66
- package/dist/tools/remediation.d.ts +0 -6
- package/dist/tools/remediation.js +0 -223
- package/dist/tools/scanSite.d.ts +0 -6
- package/dist/tools/scanSite.js +0 -51
- package/dist/tools/searchSessions.d.ts +0 -6
- package/dist/tools/searchSessions.js +0 -51
- package/dist/tools/triage.d.ts +0 -6
- package/dist/tools/triage.js +0 -114
- package/dist/tools/triageSessions.d.ts +0 -8
- package/dist/tools/triageSessions.js +0 -197
- package/dist/tools/upgradeOptions.d.ts +0 -7
- package/dist/tools/upgradeOptions.js +0 -67
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Setup Command
|
|
3
|
-
*
|
|
4
|
-
* Interactive wizard to configure recapt MCP server across AI IDEs.
|
|
5
|
-
*/
|
|
6
|
-
import { Command } from "commander";
|
|
7
|
-
import { exec } from "child_process";
|
|
8
|
-
import { detectInstalledIdes, addRecaptToIdeConfig, } from "../utils/ide-config.js";
|
|
9
|
-
import { confirm, secret, multiSelect, header, print, success, error, info, warn, newline, } from "../utils/prompts.js";
|
|
10
|
-
import { installAllSkills, installSelectedSkills, getAvailableSkills, } from "./skill.js";
|
|
11
|
-
const SETTINGS_URL = "https://dash.recapt.app/settings";
|
|
12
|
-
function openBrowser(url) {
|
|
13
|
-
const platform = process.platform;
|
|
14
|
-
let command;
|
|
15
|
-
switch (platform) {
|
|
16
|
-
case "darwin":
|
|
17
|
-
command = `open "${url}"`;
|
|
18
|
-
break;
|
|
19
|
-
case "win32":
|
|
20
|
-
command = `start "" "${url}"`;
|
|
21
|
-
break;
|
|
22
|
-
default:
|
|
23
|
-
command = `xdg-open "${url}"`;
|
|
24
|
-
}
|
|
25
|
-
exec(command, (err) => {
|
|
26
|
-
if (err) {
|
|
27
|
-
info(`Could not open browser automatically. Please visit: ${url}`);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
async function promptForKey() {
|
|
32
|
-
const hasKey = await confirm("Do you have a Recapt MCP key?", false);
|
|
33
|
-
if (!hasKey) {
|
|
34
|
-
newline();
|
|
35
|
-
info(`Opening ${SETTINGS_URL} (MCP Keys tab)...`);
|
|
36
|
-
info("Create a new MCP key and copy it.");
|
|
37
|
-
newline();
|
|
38
|
-
openBrowser(SETTINGS_URL);
|
|
39
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
40
|
-
}
|
|
41
|
-
const rawKey = await secret("Paste your MCP key");
|
|
42
|
-
const key = rawKey?.trim();
|
|
43
|
-
if (!key) {
|
|
44
|
-
error("No key provided.");
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
return key;
|
|
48
|
-
}
|
|
49
|
-
async function runSetup() {
|
|
50
|
-
header("Recapt MCP Setup");
|
|
51
|
-
const detectedIdes = detectInstalledIdes();
|
|
52
|
-
const installedIdes = detectedIdes.filter((ide) => ide.detected);
|
|
53
|
-
print("Detected AI IDEs:");
|
|
54
|
-
newline();
|
|
55
|
-
for (const ide of detectedIdes) {
|
|
56
|
-
const marker = ide.detected ? "[x]" : "[ ]";
|
|
57
|
-
const status = ide.detected ? `(${ide.globalPathResolved})` : "(not found)";
|
|
58
|
-
print(` ${marker} ${ide.config.name} ${status}`);
|
|
59
|
-
}
|
|
60
|
-
newline();
|
|
61
|
-
if (installedIdes.length === 0) {
|
|
62
|
-
error("No supported AI IDEs detected.");
|
|
63
|
-
info("Supported IDEs: Cursor, Claude Code, Windsurf, VS Code");
|
|
64
|
-
info("Make sure at least one is installed before running setup.");
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
const options = installedIdes.map((ide) => ({
|
|
68
|
-
label: ide.config.name,
|
|
69
|
-
value: ide.config,
|
|
70
|
-
selected: true,
|
|
71
|
-
}));
|
|
72
|
-
const selectedIdes = await multiSelect("Which IDE(s) do you want to configure?", options);
|
|
73
|
-
if (selectedIdes.length === 0) {
|
|
74
|
-
info("No IDEs selected. Exiting.");
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
newline();
|
|
78
|
-
// Small delay to prevent stdin buffering issues from IDE selection
|
|
79
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
80
|
-
const mcpKey = await promptForKey();
|
|
81
|
-
if (!mcpKey) {
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
newline();
|
|
85
|
-
print("Writing configuration...");
|
|
86
|
-
newline();
|
|
87
|
-
const configuredPaths = [];
|
|
88
|
-
for (const ide of selectedIdes) {
|
|
89
|
-
try {
|
|
90
|
-
const configPath = addRecaptToIdeConfig(ide, mcpKey, true);
|
|
91
|
-
success(`${ide.name}: ${configPath}`);
|
|
92
|
-
configuredPaths.push(configPath);
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
error(`${ide.name}: Failed to write config - ${err}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (configuredPaths.length === 0) {
|
|
99
|
-
error("Failed to configure any IDEs.");
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
newline();
|
|
103
|
-
const shouldInstallSkills = await confirm("Install recapt skills?", true);
|
|
104
|
-
if (shouldInstallSkills) {
|
|
105
|
-
newline();
|
|
106
|
-
let availableSkills;
|
|
107
|
-
try {
|
|
108
|
-
availableSkills = getAvailableSkills();
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
error(`Failed to load skills: ${err instanceof Error ? err.message : err}`);
|
|
112
|
-
availableSkills = [];
|
|
113
|
-
}
|
|
114
|
-
if (availableSkills.length > 0) {
|
|
115
|
-
const skillOptions = [
|
|
116
|
-
{ label: "Install all skills", value: "__all__", selected: true },
|
|
117
|
-
...availableSkills.map((skill) => ({
|
|
118
|
-
label: `${skill.name} - ${skill.description}`,
|
|
119
|
-
value: skill.name,
|
|
120
|
-
selected: false,
|
|
121
|
-
})),
|
|
122
|
-
];
|
|
123
|
-
const selectedSkills = await multiSelect("Which skills do you want to install?", skillOptions);
|
|
124
|
-
if (selectedSkills.length > 0) {
|
|
125
|
-
newline();
|
|
126
|
-
print("Installing skills...");
|
|
127
|
-
newline();
|
|
128
|
-
const cwd = process.cwd();
|
|
129
|
-
let result;
|
|
130
|
-
if (selectedSkills.includes("__all__")) {
|
|
131
|
-
result = installAllSkills(cwd);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
result = installSelectedSkills(cwd, selectedSkills);
|
|
135
|
-
}
|
|
136
|
-
if (result.error) {
|
|
137
|
-
error(`Failed to load skills: ${result.error}`);
|
|
138
|
-
}
|
|
139
|
-
else if (result.installed.length > 0) {
|
|
140
|
-
success(`Installed ${result.installed.length} skill(s): ${result.installed.join(", ")}`);
|
|
141
|
-
if (result.failed.length > 0) {
|
|
142
|
-
warn(`Failed to install: ${result.failed.join(", ")}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else if (result.failed.length > 0) {
|
|
146
|
-
error(`Failed to install skills: ${result.failed.join(", ")}`);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
info("No skills were installed.");
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
info("No skills selected.");
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
newline();
|
|
158
|
-
success("Setup complete!");
|
|
159
|
-
newline();
|
|
160
|
-
info("Restart your IDE(s) to activate the MCP server.");
|
|
161
|
-
newline();
|
|
162
|
-
}
|
|
163
|
-
export const setupCommand = new Command("setup")
|
|
164
|
-
.description("Configure recapt MCP server for your AI IDE(s)")
|
|
165
|
-
.action(async () => {
|
|
166
|
-
try {
|
|
167
|
-
await runSetup();
|
|
168
|
-
}
|
|
169
|
-
catch (err) {
|
|
170
|
-
error(`Setup failed: ${err}`);
|
|
171
|
-
process.exit(1);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill Command
|
|
3
|
-
*
|
|
4
|
-
* Manages recapt workflow skills installation to .agents/recapt/.
|
|
5
|
-
* Works across all AI IDEs that support the AGENTS.md standard.
|
|
6
|
-
*/
|
|
7
|
-
import { Command } from "commander";
|
|
8
|
-
interface SkillInfo {
|
|
9
|
-
name: string;
|
|
10
|
-
file: string;
|
|
11
|
-
description: string;
|
|
12
|
-
}
|
|
13
|
-
export type { SkillInfo };
|
|
14
|
-
export declare function getAvailableSkills(): SkillInfo[];
|
|
15
|
-
export declare function installSkill(cwd: string, skillName: string, force?: boolean): boolean;
|
|
16
|
-
export interface InstallResult {
|
|
17
|
-
success: boolean;
|
|
18
|
-
installed: string[];
|
|
19
|
-
failed: string[];
|
|
20
|
-
error?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function installAllSkills(cwd: string, force?: boolean): InstallResult;
|
|
23
|
-
export declare function installSelectedSkills(cwd: string, skillNames: string[], force?: boolean): InstallResult;
|
|
24
|
-
export declare const skillCommand: Command;
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill Command
|
|
3
|
-
*
|
|
4
|
-
* Manages recapt workflow skills installation to .agents/recapt/.
|
|
5
|
-
* Works across all AI IDEs that support the AGENTS.md standard.
|
|
6
|
-
*/
|
|
7
|
-
import { Command } from "commander";
|
|
8
|
-
import fs from "fs";
|
|
9
|
-
import path from "path";
|
|
10
|
-
import { fileURLToPath } from "url";
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = path.dirname(__filename);
|
|
13
|
-
const SKILLS_DIR = path.resolve(__dirname, "../../../skills");
|
|
14
|
-
const AGENTS_DIR = ".agents/recapt";
|
|
15
|
-
const AGENTS_MD = "AGENTS.md";
|
|
16
|
-
const MARKER_START = "<!-- recapt:skills -->";
|
|
17
|
-
const MARKER_END = "<!-- /recapt:skills -->";
|
|
18
|
-
export function getAvailableSkills() {
|
|
19
|
-
if (!fs.existsSync(SKILLS_DIR)) {
|
|
20
|
-
throw new Error(`Skills directory not found: ${SKILLS_DIR}`);
|
|
21
|
-
}
|
|
22
|
-
const files = fs.readdirSync(SKILLS_DIR).filter((f) => f.endsWith(".md"));
|
|
23
|
-
if (files.length === 0) {
|
|
24
|
-
throw new Error(`No skill files found in: ${SKILLS_DIR}`);
|
|
25
|
-
}
|
|
26
|
-
return files.map((file) => {
|
|
27
|
-
const content = fs.readFileSync(path.join(SKILLS_DIR, file), "utf-8");
|
|
28
|
-
const firstLine = content.split("\n")[0];
|
|
29
|
-
const description = firstLine.startsWith("# ")
|
|
30
|
-
? firstLine.slice(2).trim()
|
|
31
|
-
: file.replace(".md", "");
|
|
32
|
-
return {
|
|
33
|
-
name: file.replace(".md", ""),
|
|
34
|
-
file,
|
|
35
|
-
description,
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function getInstalledSkills(cwd) {
|
|
40
|
-
const agentsDir = path.join(cwd, AGENTS_DIR);
|
|
41
|
-
if (!fs.existsSync(agentsDir)) {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
return fs
|
|
45
|
-
.readdirSync(agentsDir)
|
|
46
|
-
.filter((f) => f.endsWith(".md"))
|
|
47
|
-
.map((f) => f.replace(".md", ""));
|
|
48
|
-
}
|
|
49
|
-
function ensureAgentsDir(cwd) {
|
|
50
|
-
const agentsDir = path.join(cwd, AGENTS_DIR);
|
|
51
|
-
if (!fs.existsSync(agentsDir)) {
|
|
52
|
-
fs.mkdirSync(agentsDir, { recursive: true });
|
|
53
|
-
console.log(`Created ${AGENTS_DIR}/`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function readAgentsMd(cwd) {
|
|
57
|
-
const agentsMdPath = path.join(cwd, AGENTS_MD);
|
|
58
|
-
if (!fs.existsSync(agentsMdPath)) {
|
|
59
|
-
return "";
|
|
60
|
-
}
|
|
61
|
-
return fs.readFileSync(agentsMdPath, "utf-8");
|
|
62
|
-
}
|
|
63
|
-
function writeAgentsMd(cwd, content) {
|
|
64
|
-
const agentsMdPath = path.join(cwd, AGENTS_MD);
|
|
65
|
-
fs.writeFileSync(agentsMdPath, content);
|
|
66
|
-
}
|
|
67
|
-
function getSkillDisplayName(skillName) {
|
|
68
|
-
try {
|
|
69
|
-
const skills = getAvailableSkills();
|
|
70
|
-
const skill = skills.find((s) => s.name === skillName);
|
|
71
|
-
return skill?.description ?? skillName;
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return skillName;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function updateAgentsMdReferences(cwd) {
|
|
78
|
-
const installed = getInstalledSkills(cwd);
|
|
79
|
-
let content = readAgentsMd(cwd);
|
|
80
|
-
if (installed.length === 0) {
|
|
81
|
-
if (content.includes(MARKER_START)) {
|
|
82
|
-
const regex = new RegExp(`\\n?${MARKER_START}[\\s\\S]*?${MARKER_END}\\n?`, "g");
|
|
83
|
-
content = content.replace(regex, "").trim();
|
|
84
|
-
if (content) {
|
|
85
|
-
writeAgentsMd(cwd, content + "\n");
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
const agentsMdPath = path.join(cwd, AGENTS_MD);
|
|
89
|
-
if (fs.existsSync(agentsMdPath)) {
|
|
90
|
-
fs.unlinkSync(agentsMdPath);
|
|
91
|
-
console.log(`Removed empty ${AGENTS_MD}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const skillLinks = installed
|
|
98
|
-
.map((name) => `- [${getSkillDisplayName(name)}](${AGENTS_DIR}/${name}.md)`)
|
|
99
|
-
.join("\n");
|
|
100
|
-
const newBlock = `${MARKER_START}
|
|
101
|
-
For recapt behavioral intelligence workflows, see:
|
|
102
|
-
${skillLinks}
|
|
103
|
-
${MARKER_END}`;
|
|
104
|
-
if (content.includes(MARKER_START)) {
|
|
105
|
-
const regex = new RegExp(`${MARKER_START}[\\s\\S]*?${MARKER_END}`, "g");
|
|
106
|
-
content = content.replace(regex, newBlock);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
if (content.trim()) {
|
|
110
|
-
content = content.trim() + "\n\n" + newBlock;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
content = `# Project Agent Instructions\n\n${newBlock}`;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
writeAgentsMd(cwd, content + "\n");
|
|
117
|
-
}
|
|
118
|
-
export function installSkill(cwd, skillName, force = false) {
|
|
119
|
-
let skills;
|
|
120
|
-
try {
|
|
121
|
-
skills = getAvailableSkills();
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
console.error(`Failed to load skills: ${err instanceof Error ? err.message : err}`);
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
const skill = skills.find((s) => s.name === skillName);
|
|
128
|
-
if (!skill) {
|
|
129
|
-
console.error(`Unknown skill: ${skillName}`);
|
|
130
|
-
console.error(`Available skills: ${skills.map((s) => s.name).join(", ")}`);
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
ensureAgentsDir(cwd);
|
|
134
|
-
const sourcePath = path.join(SKILLS_DIR, skill.file);
|
|
135
|
-
const destPath = path.join(cwd, AGENTS_DIR, skill.file);
|
|
136
|
-
if (fs.existsSync(destPath)) {
|
|
137
|
-
const sourceContent = fs.readFileSync(sourcePath, "utf-8");
|
|
138
|
-
const destContent = fs.readFileSync(destPath, "utf-8");
|
|
139
|
-
if (sourceContent === destContent) {
|
|
140
|
-
console.log(`Skill already up to date: ${skillName}`);
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
if (!force) {
|
|
144
|
-
console.log(`Skill outdated: ${skillName} (use --force to update)`);
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
148
|
-
console.log(`Updated: ${skillName} → ${AGENTS_DIR}/${skill.file}`);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
152
|
-
console.log(`Installed: ${skillName} → ${AGENTS_DIR}/${skill.file}`);
|
|
153
|
-
}
|
|
154
|
-
updateAgentsMdReferences(cwd);
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
function uninstallSkill(cwd, skillName) {
|
|
158
|
-
const skillPath = path.join(cwd, AGENTS_DIR, `${skillName}.md`);
|
|
159
|
-
if (!fs.existsSync(skillPath)) {
|
|
160
|
-
console.error(`Skill not installed: ${skillName}`);
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
fs.unlinkSync(skillPath);
|
|
164
|
-
console.log(`Uninstalled: ${skillName}`);
|
|
165
|
-
updateAgentsMdReferences(cwd);
|
|
166
|
-
const agentsDir = path.join(cwd, AGENTS_DIR);
|
|
167
|
-
const remaining = fs.readdirSync(agentsDir);
|
|
168
|
-
if (remaining.length === 0) {
|
|
169
|
-
fs.rmdirSync(agentsDir);
|
|
170
|
-
const parentDir = path.dirname(agentsDir);
|
|
171
|
-
if (fs.existsSync(parentDir) && fs.readdirSync(parentDir).length === 0) {
|
|
172
|
-
fs.rmdirSync(parentDir);
|
|
173
|
-
}
|
|
174
|
-
console.log(`Removed empty ${AGENTS_DIR}/`);
|
|
175
|
-
}
|
|
176
|
-
return true;
|
|
177
|
-
}
|
|
178
|
-
function listSkills(cwd) {
|
|
179
|
-
let available;
|
|
180
|
-
try {
|
|
181
|
-
available = getAvailableSkills();
|
|
182
|
-
}
|
|
183
|
-
catch (err) {
|
|
184
|
-
console.error(`Failed to load skills: ${err instanceof Error ? err.message : err}`);
|
|
185
|
-
process.exit(1);
|
|
186
|
-
}
|
|
187
|
-
const installed = new Set(getInstalledSkills(cwd));
|
|
188
|
-
console.log("\nAvailable recapt skills:\n");
|
|
189
|
-
for (const skill of available) {
|
|
190
|
-
const status = installed.has(skill.name) ? "[installed]" : "";
|
|
191
|
-
console.log(` ${skill.name.padEnd(20)} ${skill.description} ${status}`);
|
|
192
|
-
}
|
|
193
|
-
console.log();
|
|
194
|
-
}
|
|
195
|
-
export function installAllSkills(cwd, force = false) {
|
|
196
|
-
let skills;
|
|
197
|
-
try {
|
|
198
|
-
skills = getAvailableSkills();
|
|
199
|
-
}
|
|
200
|
-
catch (err) {
|
|
201
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
202
|
-
console.error(`Failed to load skills: ${message}`);
|
|
203
|
-
return { success: false, installed: [], failed: [], error: message };
|
|
204
|
-
}
|
|
205
|
-
return installSelectedSkills(cwd, skills.map((s) => s.name), force);
|
|
206
|
-
}
|
|
207
|
-
export function installSelectedSkills(cwd, skillNames, force = false) {
|
|
208
|
-
const installed = [];
|
|
209
|
-
const failed = [];
|
|
210
|
-
for (const skillName of skillNames) {
|
|
211
|
-
try {
|
|
212
|
-
if (installSkill(cwd, skillName, force)) {
|
|
213
|
-
installed.push(skillName);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
failed.push(skillName);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
catch (err) {
|
|
220
|
-
console.error(`Failed to install ${skillName}: ${err}`);
|
|
221
|
-
failed.push(skillName);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
const success = failed.length === 0 && installed.length > 0;
|
|
225
|
-
if (success && installed.length > 1) {
|
|
226
|
-
console.log(`\nAll skills installed. See ${AGENTS_MD} for references.`);
|
|
227
|
-
}
|
|
228
|
-
return { success, installed, failed };
|
|
229
|
-
}
|
|
230
|
-
const listCommand = new Command("list")
|
|
231
|
-
.description("Show available skills")
|
|
232
|
-
.action(() => {
|
|
233
|
-
listSkills(process.cwd());
|
|
234
|
-
});
|
|
235
|
-
const installCommand = new Command("install")
|
|
236
|
-
.description("Install a skill")
|
|
237
|
-
.argument("[name]", "Skill name to install")
|
|
238
|
-
.option("-a, --all", "Install all skills")
|
|
239
|
-
.option("-f, --force", "Force update if skill already exists")
|
|
240
|
-
.action((name, options) => {
|
|
241
|
-
const cwd = process.cwd();
|
|
242
|
-
if (options.all) {
|
|
243
|
-
installAllSkills(cwd, options.force);
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (!name) {
|
|
247
|
-
console.error("Usage: recapt skill install <name> or recapt skill install --all");
|
|
248
|
-
process.exit(1);
|
|
249
|
-
}
|
|
250
|
-
if (installSkill(cwd, name, options.force)) {
|
|
251
|
-
console.log(`\nSkill reference added to ${AGENTS_MD}`);
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
const uninstallCommand = new Command("uninstall")
|
|
255
|
-
.description("Remove a skill")
|
|
256
|
-
.argument("<name>", "Skill name to uninstall")
|
|
257
|
-
.action((name) => {
|
|
258
|
-
uninstallSkill(process.cwd(), name);
|
|
259
|
-
});
|
|
260
|
-
export const skillCommand = new Command("skill")
|
|
261
|
-
.description("Manage recapt workflow skills")
|
|
262
|
-
.addCommand(listCommand)
|
|
263
|
-
.addCommand(installCommand)
|
|
264
|
-
.addCommand(uninstallCommand);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IDE Configuration Utilities
|
|
3
|
-
*
|
|
4
|
-
* Handles detection and configuration of MCP servers across different AI IDEs.
|
|
5
|
-
*/
|
|
6
|
-
export type ConfigFormat = "json" | "toml";
|
|
7
|
-
export interface IdeConfig {
|
|
8
|
-
name: string;
|
|
9
|
-
globalPath: string | null;
|
|
10
|
-
projectPath: string;
|
|
11
|
-
rootKey: string;
|
|
12
|
-
format: ConfigFormat;
|
|
13
|
-
}
|
|
14
|
-
export declare const IDE_CONFIGS: IdeConfig[];
|
|
15
|
-
export interface DetectedIde {
|
|
16
|
-
config: IdeConfig;
|
|
17
|
-
detected: boolean;
|
|
18
|
-
globalPathResolved: string | null;
|
|
19
|
-
}
|
|
20
|
-
export declare function detectInstalledIdes(): DetectedIde[];
|
|
21
|
-
export interface McpServerConfig {
|
|
22
|
-
type?: string;
|
|
23
|
-
command: string;
|
|
24
|
-
args: string[];
|
|
25
|
-
env: Record<string, string>;
|
|
26
|
-
}
|
|
27
|
-
export declare function readIdeConfig(configPath: string, format?: ConfigFormat): Record<string, unknown>;
|
|
28
|
-
export declare function writeIdeConfig(configPath: string, config: Record<string, unknown>, format?: ConfigFormat): void;
|
|
29
|
-
export declare function addRecaptToIdeConfig(ide: IdeConfig, secretKey: string, useGlobal?: boolean): string;
|
|
30
|
-
export declare function removeRecaptFromIdeConfig(ide: IdeConfig, useGlobal?: boolean): boolean;
|
|
31
|
-
export declare function isRecaptConfigured(ide: IdeConfig): boolean;
|