@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.
Files changed (98) hide show
  1. package/dist/cli/index.d.ts +0 -11
  2. package/dist/cli/index.js +1059 -21
  3. package/dist/index.d.ts +0 -18
  4. package/dist/index.js +3205 -247
  5. package/dist/tools/catalog/anthropicToolCatalog.json +1306 -0
  6. package/dist/tools/catalog/toolCatalog.json +4078 -382
  7. package/package.json +10 -3
  8. package/skills/self-improvement.md +388 -222
  9. package/templates/self-improvement-full.md +91 -0
  10. package/templates/{self-improvement.md → self-improvement-lite.md} +13 -9
  11. package/dist/api/client.d.ts +0 -14
  12. package/dist/api/client.js +0 -67
  13. package/dist/cli/commands/setup-self-improvement-gh.d.ts +0 -7
  14. package/dist/cli/commands/setup-self-improvement-gh.js +0 -310
  15. package/dist/cli/commands/setup.d.ts +0 -7
  16. package/dist/cli/commands/setup.js +0 -173
  17. package/dist/cli/commands/skill.d.ts +0 -24
  18. package/dist/cli/commands/skill.js +0 -264
  19. package/dist/cli/utils/ide-config.d.ts +0 -31
  20. package/dist/cli/utils/ide-config.js +0 -294
  21. package/dist/cli/utils/prompts.d.ts +0 -22
  22. package/dist/cli/utils/prompts.js +0 -71
  23. package/dist/tools/analyzeFlow.d.ts +0 -7
  24. package/dist/tools/analyzeFlow.js +0 -68
  25. package/dist/tools/analyzeFunnel.d.ts +0 -7
  26. package/dist/tools/analyzeFunnel.js +0 -63
  27. package/dist/tools/catalog/callTool.d.ts +0 -22
  28. package/dist/tools/catalog/callTool.js +0 -92
  29. package/dist/tools/catalog/index.d.ts +0 -11
  30. package/dist/tools/catalog/index.js +0 -11
  31. package/dist/tools/catalog/searchTools.d.ts +0 -22
  32. package/dist/tools/catalog/searchTools.js +0 -194
  33. package/dist/tools/compareCohorts.d.ts +0 -6
  34. package/dist/tools/compareCohorts.js +0 -84
  35. package/dist/tools/comparePeriods.d.ts +0 -6
  36. package/dist/tools/comparePeriods.js +0 -54
  37. package/dist/tools/detectDrift.d.ts +0 -6
  38. package/dist/tools/detectDrift.js +0 -55
  39. package/dist/tools/detectRegressions.d.ts +0 -6
  40. package/dist/tools/detectRegressions.js +0 -63
  41. package/dist/tools/diagnostic.d.ts +0 -6
  42. package/dist/tools/diagnostic.js +0 -109
  43. package/dist/tools/discoverPersonas.d.ts +0 -6
  44. package/dist/tools/discoverPersonas.js +0 -50
  45. package/dist/tools/getActionableIssues.d.ts +0 -7
  46. package/dist/tools/getActionableIssues.js +0 -55
  47. package/dist/tools/getAnomalies.d.ts +0 -6
  48. package/dist/tools/getAnomalies.js +0 -53
  49. package/dist/tools/getConsoleErrors.d.ts +0 -6
  50. package/dist/tools/getConsoleErrors.js +0 -61
  51. package/dist/tools/getDeadClicks.d.ts +0 -6
  52. package/dist/tools/getDeadClicks.js +0 -42
  53. package/dist/tools/getDomains.d.ts +0 -6
  54. package/dist/tools/getDomains.js +0 -34
  55. package/dist/tools/getElementFriction.d.ts +0 -6
  56. package/dist/tools/getElementFriction.js +0 -45
  57. package/dist/tools/getFlowFriction.d.ts +0 -7
  58. package/dist/tools/getFlowFriction.js +0 -57
  59. package/dist/tools/getFormFriction.d.ts +0 -6
  60. package/dist/tools/getFormFriction.js +0 -42
  61. package/dist/tools/getIssues.d.ts +0 -6
  62. package/dist/tools/getIssues.js +0 -82
  63. package/dist/tools/getJourneyPatterns.d.ts +0 -7
  64. package/dist/tools/getJourneyPatterns.js +0 -50
  65. package/dist/tools/getPageMetrics.d.ts +0 -6
  66. package/dist/tools/getPageMetrics.js +0 -47
  67. package/dist/tools/getPageTrends.d.ts +0 -6
  68. package/dist/tools/getPageTrends.js +0 -46
  69. package/dist/tools/getSessionDetails.d.ts +0 -6
  70. package/dist/tools/getSessionDetails.js +0 -70
  71. package/dist/tools/getSessionPages.d.ts +0 -7
  72. package/dist/tools/getSessionPages.js +0 -74
  73. package/dist/tools/getUxHealthReport.d.ts +0 -7
  74. package/dist/tools/getUxHealthReport.js +0 -50
  75. package/dist/tools/improvementRun.d.ts +0 -6
  76. package/dist/tools/improvementRun.js +0 -315
  77. package/dist/tools/knowledge.d.ts +0 -6
  78. package/dist/tools/knowledge.js +0 -186
  79. package/dist/tools/listPages.d.ts +0 -6
  80. package/dist/tools/listPages.js +0 -50
  81. package/dist/tools/listSessions.d.ts +0 -7
  82. package/dist/tools/listSessions.js +0 -67
  83. package/dist/tools/memory.d.ts +0 -7
  84. package/dist/tools/memory.js +0 -119
  85. package/dist/tools/predictOutcomes.d.ts +0 -6
  86. package/dist/tools/predictOutcomes.js +0 -66
  87. package/dist/tools/remediation.d.ts +0 -6
  88. package/dist/tools/remediation.js +0 -223
  89. package/dist/tools/scanSite.d.ts +0 -6
  90. package/dist/tools/scanSite.js +0 -51
  91. package/dist/tools/searchSessions.d.ts +0 -6
  92. package/dist/tools/searchSessions.js +0 -51
  93. package/dist/tools/triage.d.ts +0 -6
  94. package/dist/tools/triage.js +0 -114
  95. package/dist/tools/triageSessions.d.ts +0 -8
  96. package/dist/tools/triageSessions.js +0 -197
  97. package/dist/tools/upgradeOptions.d.ts +0 -7
  98. package/dist/tools/upgradeOptions.js +0 -67
@@ -0,0 +1,91 @@
1
+ ---
2
+ on:
3
+ schedule: daily
4
+ workflow_dispatch:
5
+ inputs:
6
+ branch:
7
+ description: "Branch to analyze"
8
+ default: "main"
9
+ max_fixes:
10
+ description: "Maximum issues to fix"
11
+ default: "5"
12
+
13
+ engine: { { ENGINE } }
14
+
15
+ permissions:
16
+ contents: read
17
+ issues: read
18
+ pull-requests: read
19
+ actions: read
20
+
21
+ mcp-servers:
22
+ recapt:
23
+ command: npx
24
+ args: ["@recapt/mcp@latest"]
25
+ env:
26
+ RECAPT_SECRET_KEY: "${{ secrets.RECAPT_SECRET_KEY }}"
27
+ allowed: ["*"]
28
+
29
+ safe-outputs:
30
+ dispatch-workflow:
31
+ workflows:
32
+ - evaluate-worker
33
+ - fix-worker
34
+ max: 10
35
+ ---
36
+
37
+ ## Self-Improvement Orchestrator (Full)
38
+
39
+ You are the orchestrator for the self-improvement workflow with parallel workers. Your job is to:
40
+
41
+ 1. Check and update PR statuses for pending fixes
42
+ 2. Dispatch evaluate-workers for deployed fixes ready for evaluation
43
+ 3. Run diagnostics to find new issues
44
+ 4. Triage and select issues to fix
45
+ 5. Dispatch fix-workers for each selected issue
46
+ 6. Wait for all workers to complete
47
+ 7. Generate a summary and complete the improvement run
48
+
49
+ ### Important: Autonomous Mode
50
+
51
+ You are running in a GitHub Actions sandbox with NO human interaction possible. You must:
52
+
53
+ - **Never wait for user input** - Make all decisions autonomously
54
+ - **Never ask questions** - Proceed with reasonable defaults
55
+ - **Complete all work in one run** - There is no "check back later"
56
+ - **Dispatch workers for parallel execution** - Don't fix issues yourself
57
+
58
+ {{DOMAIN_CONFIG}}
59
+
60
+ ### Context
61
+
62
+ Get recent changes to understand what might have introduced issues:
63
+
64
+ ```bash
65
+ git log --since="24 hours ago" --oneline
66
+ ```
67
+
68
+ ### Workflow
69
+
70
+ Follow the self-improvement orchestrator workflow. The recapt MCP server is connected and provides all necessary tools.
71
+
72
+ The workflow covers:
73
+
74
+ 1. Starting an improvement run to track progress
75
+ 2. Checking PR statuses for waiting fixes
76
+ 3. Dispatching evaluate-workers for deployed fixes
77
+ 4. Running diagnostics to find current UX issues
78
+ 5. Triaging and selecting high-priority issues
79
+ 6. Dispatching fix-workers (one per issue, parallel execution)
80
+ 7. Waiting for all workers to complete
81
+ 8. Generating summary and completing the run
82
+
83
+ ### Output
84
+
85
+ Summarize the run:
86
+
87
+ 1. **PR Status Updates**: How many PRs were checked, merged, dismissed
88
+ 2. **Evaluations**: How many fixes were evaluated, results
89
+ 3. **Diagnostics**: Site health score, key findings
90
+ 4. **Fixes Dispatched**: Which issues are being fixed by workers
91
+ 5. **Deferred/Dismissed**: Which issues were skipped and why
@@ -6,6 +6,9 @@ on:
6
6
  branch:
7
7
  description: "Branch to analyze"
8
8
  default: "main"
9
+ max_fixes:
10
+ description: "Maximum issues to fix"
11
+ default: "3"
9
12
 
10
13
  engine: { { ENGINE } }
11
14
 
@@ -28,11 +31,12 @@ safe-outputs:
28
31
  labels: [automated, ux-fix]
29
32
  base-branch: main
30
33
  draft: true
34
+ max: 1
31
35
  ---
32
36
 
33
- ## Self-Improvement UX Fixes
37
+ ## Self-Improvement (Lite)
34
38
 
35
- You are a UX engineer using recapt behavioral intelligence to automatically detect and fix user friction points.
39
+ You are a UX engineer using recapt behavioral intelligence to automatically detect and fix user friction points. This is the **lite** variant - you fix issues directly (no worker dispatch) and create a single PR with all changes.
36
40
 
37
41
  ### Important: Autonomous Mode
38
42
 
@@ -41,9 +45,8 @@ You are running in a GitHub Actions sandbox with NO human interaction possible.
41
45
  - **Never wait for user input** - Make all decisions autonomously
42
46
  - **Never ask questions** - Proceed with reasonable defaults
43
47
  - **Complete all work in one run** - There is no "check back later"
44
- - **Always track fixes** - Call `confirm_deployment` for every fix without asking
45
- - **Triage autonomously** - Fix high-confidence issues, skip ambiguous ones (document skipped issues in the PR)
46
- - **If data is insufficient** - Note it in the PR and proceed with available information
48
+ - **Fix issues directly** - Do NOT dispatch workers, implement fixes yourself
49
+ - **Create one PR** - All fixes go into a single pull request
47
50
 
48
51
  {{DOMAIN_CONFIG}}
49
52
 
@@ -57,19 +60,20 @@ git log --since="24 hours ago" --oneline
57
60
 
58
61
  ### Workflow
59
62
 
60
- Follow the self-improvement workflow defined in `.agents/recapt/self-improvement.md`. The recapt MCP server is connected and provides all necessary tools.
63
+ Follow the self-improvement workflow. The recapt MCP server is connected and provides all necessary tools.
61
64
 
62
65
  The workflow covers:
63
66
 
64
67
  1. Checking and evaluating any pending fixes from previous runs
65
68
  2. Running diagnostics to find current UX issues
66
69
  3. Investigating and triaging high-priority issues
67
- 4. Implementing code fixes for actionable issues
68
- 5. Tracking fixes for future evaluation
70
+ 4. Implementing code fixes for actionable issues (sequentially)
71
+ 5. Creating a single PR with all fixes
72
+ 6. Tracking fixes for future evaluation
69
73
 
70
74
  ### Output
71
75
 
72
- Create a pull request containing:
76
+ Create a single pull request containing:
73
77
 
74
78
  - Evaluation results for any previously deployed fixes (improved/regressed/no change)
75
79
  - New issues discovered and fixes implemented
@@ -1,14 +0,0 @@
1
- /**
2
- * HTTP client for calling external-api query endpoints.
3
- */
4
- export declare function isApiConfigured(): boolean;
5
- export declare function getApiUrl(): string;
6
- interface ApiResponse<T> {
7
- data?: T;
8
- error?: string;
9
- }
10
- export declare function apiGet<T>(path: string, params?: Record<string, string | number | undefined>): Promise<ApiResponse<T>>;
11
- export declare function apiPost<T>(path: string, body?: Record<string, unknown>): Promise<ApiResponse<T>>;
12
- export declare function apiPatch<T>(path: string, body?: Record<string, unknown>): Promise<ApiResponse<T>>;
13
- export declare function apiDelete<T>(path: string): Promise<ApiResponse<T>>;
14
- export {};
@@ -1,67 +0,0 @@
1
- /**
2
- * HTTP client for calling external-api query endpoints.
3
- */
4
- const API_URL = process.env.RECAPT_API_URL ||
5
- process.env.EXTERNAL_API_URL ||
6
- "https://api.recapt.app";
7
- const SECRET_KEY = process.env.RECAPT_SECRET_KEY;
8
- const REQUEST_TIMEOUT_MS = 120_000;
9
- export function isApiConfigured() {
10
- return !!SECRET_KEY;
11
- }
12
- export function getApiUrl() {
13
- return API_URL;
14
- }
15
- async function request(options) {
16
- const { method, path, params, body } = options;
17
- if (!SECRET_KEY) {
18
- return { error: "RECAPT_SECRET_KEY not configured" };
19
- }
20
- const url = new URL(`${API_URL}/v1beta/query${path}`);
21
- if (params) {
22
- for (const [key, value] of Object.entries(params)) {
23
- if (value !== undefined) {
24
- url.searchParams.set(key, String(value));
25
- }
26
- }
27
- }
28
- const controller = new AbortController();
29
- const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
30
- try {
31
- const res = await fetch(url.toString(), {
32
- method,
33
- headers: {
34
- "x-private-key": SECRET_KEY,
35
- "Content-Type": "application/json",
36
- },
37
- body: body ? JSON.stringify(body) : undefined,
38
- signal: controller.signal,
39
- });
40
- clearTimeout(timeout);
41
- if (!res.ok) {
42
- const errorBody = (await res.json().catch(() => ({})));
43
- return { error: errorBody.error || `HTTP ${res.status}` };
44
- }
45
- const data = (await res.json());
46
- return { data };
47
- }
48
- catch (err) {
49
- clearTimeout(timeout);
50
- if (err instanceof Error && err.name === "AbortError") {
51
- return { error: `Request timed out after ${REQUEST_TIMEOUT_MS / 1000}s` };
52
- }
53
- return { error: err instanceof Error ? err.message : String(err) };
54
- }
55
- }
56
- export function apiGet(path, params) {
57
- return request({ method: "GET", path, params });
58
- }
59
- export function apiPost(path, body = {}) {
60
- return request({ method: "POST", path, body });
61
- }
62
- export function apiPatch(path, body = {}) {
63
- return request({ method: "PATCH", path, body });
64
- }
65
- export function apiDelete(path) {
66
- return request({ method: "DELETE", path });
67
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Setup Self-Improvement GitHub Command
3
- *
4
- * Interactive wizard to set up the self-improvement agentic workflow for GitHub.
5
- */
6
- import { Command } from "commander";
7
- export declare const setupSelfImprovementGhCommand: Command;
@@ -1,310 +0,0 @@
1
- /**
2
- * Setup Self-Improvement GitHub Command
3
- *
4
- * Interactive wizard to set up the self-improvement agentic workflow for GitHub.
5
- */
6
- import { Command } from "commander";
7
- import { exec, execSync } from "child_process";
8
- import fs from "fs";
9
- import path from "path";
10
- import { fileURLToPath } from "url";
11
- import { installSkill } from "./skill.js";
12
- import { confirm, select, multiSelect, input, header, print, success, error, info, warn, newline, } from "../utils/prompts.js";
13
- const __filename = fileURLToPath(import.meta.url);
14
- const __dirname = path.dirname(__filename);
15
- const TEMPLATES_DIR = path.resolve(__dirname, "../../../templates");
16
- const WORKFLOW_TEMPLATE = "self-improvement.md";
17
- const WORKFLOW_DEST = ".github/workflows/self-improvement.md";
18
- const ENGINES = [
19
- { id: "claude", name: "Claude (Anthropic)", secretName: "ANTHROPIC_API_KEY" },
20
- { id: "copilot", name: "GitHub Copilot", secretName: "COPILOT_GITHUB_TOKEN" },
21
- { id: "codex", name: "Codex (OpenAI)", secretName: "OPENAI_API_KEY" },
22
- ];
23
- const API_URL = process.env.RECAPT_API_URL ||
24
- process.env.EXTERNAL_API_URL ||
25
- "https://api.recapt.app";
26
- async function fetchDomains(secretKey) {
27
- try {
28
- const res = await fetch(`${API_URL}/v1beta/query/domains`, {
29
- headers: {
30
- "x-private-key": secretKey,
31
- "Content-Type": "application/json",
32
- },
33
- });
34
- if (!res.ok) {
35
- return null;
36
- }
37
- const data = (await res.json());
38
- return data;
39
- }
40
- catch {
41
- return null;
42
- }
43
- }
44
- function commandExists(cmd) {
45
- try {
46
- execSync(`which ${cmd}`, { stdio: "ignore" });
47
- return true;
48
- }
49
- catch {
50
- return false;
51
- }
52
- }
53
- function ghExtensionInstalled(extension) {
54
- try {
55
- const output = execSync("gh extension list", { encoding: "utf-8" });
56
- return output.includes(extension);
57
- }
58
- catch {
59
- return false;
60
- }
61
- }
62
- function isGitRepo() {
63
- try {
64
- execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
65
- return true;
66
- }
67
- catch {
68
- return false;
69
- }
70
- }
71
- function getRepoUrl() {
72
- try {
73
- const url = execSync("gh repo view --json url -q .url", {
74
- encoding: "utf-8",
75
- }).trim();
76
- return url || null;
77
- }
78
- catch {
79
- return null;
80
- }
81
- }
82
- function openBrowser(url) {
83
- const platform = process.platform;
84
- let command;
85
- switch (platform) {
86
- case "darwin":
87
- command = `open "${url}"`;
88
- break;
89
- case "win32":
90
- command = `start "" "${url}"`;
91
- break;
92
- default:
93
- command = `xdg-open "${url}"`;
94
- }
95
- exec(command, (err) => {
96
- if (err) {
97
- info(`Could not open browser automatically. Please visit: ${url}`);
98
- }
99
- });
100
- }
101
- async function runSetupSelfImprovementGh() {
102
- header("Recapt Self-Improvement GitHub Setup");
103
- const cwd = process.cwd();
104
- print("Checking prerequisites...");
105
- newline();
106
- const hasGh = commandExists("gh");
107
- print(` ${hasGh ? "[x]" : "[ ]"} gh CLI installed`);
108
- if (!hasGh) {
109
- newline();
110
- error("GitHub CLI (gh) is required but not installed.");
111
- info("Install it from: https://cli.github.com/");
112
- process.exit(1);
113
- }
114
- const hasGhAw = ghExtensionInstalled("github/gh-aw");
115
- print(` ${hasGhAw ? "[x]" : "[ ]"} gh-aw extension installed`);
116
- if (!hasGhAw) {
117
- newline();
118
- const shouldInstall = await confirm("gh-aw extension is required. Install it now?", true);
119
- if (shouldInstall) {
120
- print("Installing gh-aw extension...");
121
- try {
122
- execSync("gh extension install github/gh-aw", { stdio: "inherit" });
123
- success("gh-aw extension installed");
124
- }
125
- catch {
126
- error("Failed to install gh-aw extension");
127
- info("Try manually: gh extension install github/gh-aw");
128
- process.exit(1);
129
- }
130
- }
131
- else {
132
- error("gh-aw extension is required to continue.");
133
- process.exit(1);
134
- }
135
- }
136
- const inGitRepo = isGitRepo();
137
- print(` ${inGitRepo ? "[x]" : "[ ]"} Git repository detected`);
138
- if (!inGitRepo) {
139
- newline();
140
- error("This command must be run from within a git repository.");
141
- process.exit(1);
142
- }
143
- newline();
144
- const engineOptions = ENGINES.map((engine) => ({
145
- label: `${engine.name} (requires ${engine.secretName} secret)`,
146
- value: engine,
147
- }));
148
- const selectedEngine = await select("Which AI engine do you want to use?", engineOptions);
149
- if (!selectedEngine) {
150
- error("No engine selected.");
151
- process.exit(1);
152
- }
153
- newline();
154
- // Domain selection
155
- print("Configuring domain filter...");
156
- info("You can optionally limit the workflow to specific domains.");
157
- newline();
158
- let selectedDomains = [];
159
- const recaptKey = await input("Enter your RECAPT_SECRET_KEY to fetch domains (or press Enter to skip)");
160
- if (recaptKey) {
161
- const domains = await fetchDomains(recaptKey);
162
- if (domains && domains.length > 0) {
163
- const domainOptions = [
164
- { label: "All domains", value: "__all__", selected: true },
165
- ...domains.map((d) => ({
166
- label: d.domainName,
167
- value: d.domainName,
168
- selected: false,
169
- })),
170
- ];
171
- const selected = await multiSelect("Which domains should this workflow analyze?", domainOptions);
172
- if (!selected.includes("__all__") && selected.length > 0) {
173
- selectedDomains = selected;
174
- success(`Selected domains: ${selectedDomains.join(", ")}`);
175
- }
176
- else {
177
- info("Will analyze all domains");
178
- }
179
- }
180
- else {
181
- warn("Could not fetch domains. Will analyze all domains.");
182
- }
183
- }
184
- else {
185
- const manualDomain = await input("Enter a specific domain to filter (or press Enter for all domains)");
186
- if (manualDomain) {
187
- selectedDomains = [manualDomain];
188
- success(`Selected domain: ${manualDomain}`);
189
- }
190
- else {
191
- info("Will analyze all domains");
192
- }
193
- }
194
- newline();
195
- print("Installing self-improvement skill...");
196
- const skillInstalled = installSkill(cwd, "self-improvement", true);
197
- if (!skillInstalled) {
198
- error("Failed to install self-improvement skill");
199
- process.exit(1);
200
- }
201
- newline();
202
- print("Creating workflow...");
203
- const templatePath = path.join(TEMPLATES_DIR, WORKFLOW_TEMPLATE);
204
- const destPath = path.join(cwd, WORKFLOW_DEST);
205
- const destDir = path.dirname(destPath);
206
- if (!fs.existsSync(templatePath)) {
207
- error(`Workflow template not found: ${templatePath}`);
208
- process.exit(1);
209
- }
210
- if (!fs.existsSync(destDir)) {
211
- fs.mkdirSync(destDir, { recursive: true });
212
- }
213
- const templateContent = fs.readFileSync(templatePath, "utf-8");
214
- // Build domain config section
215
- let domainConfig = "";
216
- if (selectedDomains.length > 0) {
217
- const domainList = selectedDomains.join(", ");
218
- domainConfig = `### Domain Restriction
219
-
220
- **Target domains:** ${domainList}
221
-
222
- Before doing any work:
223
- 1. Call \`get_domains\` to verify the target domain(s) exist
224
- 2. If any target domain is NOT in the list, stop immediately and report: "Domain not found: [domain]. Available domains: [list]"
225
- 3. If domains are valid, pass the \`domain\` parameter to all tools that support filtering (e.g., \`run_full_diagnostic\`, \`get_page_metrics\`, etc.)
226
-
227
- Do NOT analyze or fix issues for domains not in the target list.
228
-
229
- `;
230
- }
231
- else {
232
- domainConfig = `### Domain Scope
233
-
234
- **Target:** All domains
235
-
236
- Analyze and fix issues across all domains configured in recapt. Call \`get_domains\` first to see available domains.
237
-
238
- `;
239
- }
240
- // Replace placeholders (support both {{VAR}} and { { VAR } } formats)
241
- const workflowContent = templateContent
242
- .replace(/\{\s*\{\s*ENGINE\s*\}\s*\}/g, selectedEngine.id)
243
- .replace(/\{\s*\{\s*DOMAIN_CONFIG\s*\}\s*\}/g, domainConfig);
244
- if (fs.existsSync(destPath)) {
245
- const overwrite = await confirm("Workflow file already exists. Overwrite?", false);
246
- if (!overwrite) {
247
- info("Skipping workflow creation");
248
- }
249
- else {
250
- fs.writeFileSync(destPath, workflowContent);
251
- success(`Created: ${WORKFLOW_DEST}`);
252
- }
253
- }
254
- else {
255
- fs.writeFileSync(destPath, workflowContent);
256
- success(`Created: ${WORKFLOW_DEST}`);
257
- }
258
- newline();
259
- print("Compiling workflow...");
260
- try {
261
- execSync("gh aw compile", { cwd, stdio: "inherit" });
262
- success("Created: .github/workflows/self-improvement.lock.yml");
263
- }
264
- catch {
265
- warn("Failed to compile workflow. You can run 'gh aw compile' manually.");
266
- }
267
- newline();
268
- print("GitHub Secrets Required:");
269
- info(`1. ${selectedEngine.secretName} - For ${selectedEngine.name} to run the agent`);
270
- info("2. RECAPT_SECRET_KEY - For recapt behavioral intelligence");
271
- newline();
272
- const repoUrl = getRepoUrl();
273
- if (repoUrl) {
274
- const secretsUrl = `${repoUrl}/settings/secrets/actions`;
275
- const openSecrets = await confirm("Open GitHub secrets page?", true);
276
- if (openSecrets) {
277
- openBrowser(secretsUrl);
278
- await new Promise((resolve) => setTimeout(resolve, 1000));
279
- }
280
- }
281
- else {
282
- info("Go to your repository Settings → Secrets and variables → Actions");
283
- info(`Add ${selectedEngine.secretName} and RECAPT_SECRET_KEY as secrets.`);
284
- }
285
- newline();
286
- success("Setup complete!");
287
- newline();
288
- print("Next steps:");
289
- print(' 1. git add . && git commit -m "Add recapt self-improvement workflow"');
290
- print(" 2. git push");
291
- print(" 3. Run manually: gh aw run self-improvement");
292
- newline();
293
- warn("Important: Enable PR creation permissions");
294
- info("The workflow needs permission to create pull requests.");
295
- info("Go to Settings → Actions → General → Workflow permissions");
296
- info('Enable "Allow GitHub Actions to create and approve pull requests"');
297
- info("(This may need to be set at the organization level)");
298
- newline();
299
- }
300
- export const setupSelfImprovementGhCommand = new Command("setup-self-improvement-gh")
301
- .description("Set up automated self-improvement workflow for GitHub Actions")
302
- .action(async () => {
303
- try {
304
- await runSetupSelfImprovementGh();
305
- }
306
- catch (err) {
307
- error(`Setup failed: ${err}`);
308
- process.exit(1);
309
- }
310
- });
@@ -1,7 +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
- export declare const setupCommand: Command;