@react-grab/cli 0.1.12 → 0.1.14
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.cjs +188 -96
- package/dist/cli.js +188 -96
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -65,10 +65,19 @@ var onCancel = () => {
|
|
|
65
65
|
var prompts = (questions) => {
|
|
66
66
|
return basePrompts__default.default(questions, { onCancel });
|
|
67
67
|
};
|
|
68
|
+
var VALID_PACKAGE_MANAGERS = /* @__PURE__ */ new Set([
|
|
69
|
+
"npm",
|
|
70
|
+
"yarn",
|
|
71
|
+
"pnpm",
|
|
72
|
+
"bun"
|
|
73
|
+
]);
|
|
68
74
|
var detectPackageManager = async (projectRoot) => {
|
|
69
75
|
const detected = await ni.detect({ cwd: projectRoot });
|
|
70
|
-
if (detected
|
|
71
|
-
|
|
76
|
+
if (detected) {
|
|
77
|
+
const managerName = detected.split("@")[0];
|
|
78
|
+
if (VALID_PACKAGE_MANAGERS.has(managerName)) {
|
|
79
|
+
return managerName;
|
|
80
|
+
}
|
|
72
81
|
}
|
|
73
82
|
return "npm";
|
|
74
83
|
};
|
|
@@ -308,7 +317,8 @@ var AGENT_PACKAGES = [
|
|
|
308
317
|
"@react-grab/codex",
|
|
309
318
|
"@react-grab/gemini",
|
|
310
319
|
"@react-grab/amp",
|
|
311
|
-
"@react-grab/ami"
|
|
320
|
+
"@react-grab/ami",
|
|
321
|
+
"@react-grab/mcp"
|
|
312
322
|
];
|
|
313
323
|
var detectUnsupportedFramework = (projectRoot) => {
|
|
314
324
|
const packageJsonPath = path.join(projectRoot, "package.json");
|
|
@@ -855,6 +865,13 @@ var AGENT_NAMES = {
|
|
|
855
865
|
ami: "Ami",
|
|
856
866
|
droid: "Droid"
|
|
857
867
|
};
|
|
868
|
+
var getAgentDisplayName = (agent) => {
|
|
869
|
+
if (agent === "mcp") return "MCP";
|
|
870
|
+
if (agent in AGENT_NAMES) {
|
|
871
|
+
return AGENT_NAMES[agent];
|
|
872
|
+
}
|
|
873
|
+
return agent;
|
|
874
|
+
};
|
|
858
875
|
var NEXT_APP_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
|
|
859
876
|
<Script
|
|
860
877
|
src="//unpkg.com/react-grab/dist/index.global.js"
|
|
@@ -1608,6 +1625,14 @@ var previewPackageJsonTransform = (projectRoot, agent, installedAgents, packageM
|
|
|
1608
1625
|
noChanges: true
|
|
1609
1626
|
};
|
|
1610
1627
|
}
|
|
1628
|
+
if (agent === "mcp") {
|
|
1629
|
+
return {
|
|
1630
|
+
success: true,
|
|
1631
|
+
filePath: "",
|
|
1632
|
+
message: "MCP does not use package.json dev script",
|
|
1633
|
+
noChanges: true
|
|
1634
|
+
};
|
|
1635
|
+
}
|
|
1611
1636
|
const packageJsonPath = path.join(projectRoot, "package.json");
|
|
1612
1637
|
if (!fs.existsSync(packageJsonPath)) {
|
|
1613
1638
|
return {
|
|
@@ -2169,9 +2194,9 @@ var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDoma
|
|
|
2169
2194
|
};
|
|
2170
2195
|
|
|
2171
2196
|
// src/commands/add.ts
|
|
2172
|
-
var VERSION = "0.1.
|
|
2197
|
+
var VERSION = "0.1.14";
|
|
2173
2198
|
var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
|
|
2174
|
-
var add = new commander.Command().name("add").alias("install").description("
|
|
2199
|
+
var add = new commander.Command().name("add").alias("install").description("connect React Grab to your agent").argument("[agent]", `agent to connect (${AGENTS.join(", ")}, mcp)`).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
2175
2200
|
"-c, --cwd <cwd>",
|
|
2176
2201
|
"working directory (defaults to current directory)",
|
|
2177
2202
|
process.cwd()
|
|
@@ -2198,9 +2223,10 @@ var add = new commander.Command().name("add").alias("install").description("add
|
|
|
2198
2223
|
const availableAgents = AGENTS.filter(
|
|
2199
2224
|
(agent) => !projectInfo.installedAgents.includes(agent)
|
|
2200
2225
|
);
|
|
2201
|
-
if (availableAgents.length === 0) {
|
|
2226
|
+
if (availableAgents.length === 0 && isNonInteractive && !agentArg) {
|
|
2202
2227
|
logger.break();
|
|
2203
|
-
logger.success("All
|
|
2228
|
+
logger.success("All legacy agents are already installed.");
|
|
2229
|
+
logger.log("Run without -y to add MCP.");
|
|
2204
2230
|
logger.break();
|
|
2205
2231
|
process.exit(0);
|
|
2206
2232
|
}
|
|
@@ -2234,11 +2260,11 @@ var add = new commander.Command().name("add").alias("install").description("add
|
|
|
2234
2260
|
message: "How would you like to proceed?",
|
|
2235
2261
|
choices: [
|
|
2236
2262
|
{
|
|
2237
|
-
title: `Replace with ${
|
|
2263
|
+
title: `Replace with ${getAgentDisplayName(agentIntegration)}`,
|
|
2238
2264
|
value: "replace"
|
|
2239
2265
|
},
|
|
2240
2266
|
{
|
|
2241
|
-
title: `Add ${
|
|
2267
|
+
title: `Add ${getAgentDisplayName(agentIntegration)} alongside existing`,
|
|
2242
2268
|
value: "add"
|
|
2243
2269
|
},
|
|
2244
2270
|
{ title: "Cancel", value: "cancel" }
|
|
@@ -2279,55 +2305,60 @@ var add = new commander.Command().name("add").alias("install").description("add
|
|
|
2279
2305
|
);
|
|
2280
2306
|
logger.log("Restart your agents to activate.");
|
|
2281
2307
|
logger.break();
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
name: "agent",
|
|
2287
|
-
message: `Which ${highlighter.info("agent integration")} would you like to add?`,
|
|
2288
|
-
choices: availableAgents.map((availableAgent) => ({
|
|
2289
|
-
title: AGENT_NAMES[availableAgent],
|
|
2290
|
-
value: availableAgent
|
|
2291
|
-
}))
|
|
2292
|
-
});
|
|
2293
|
-
if (!agent) {
|
|
2294
|
-
logger.break();
|
|
2295
|
-
process.exit(1);
|
|
2296
|
-
}
|
|
2297
|
-
agentIntegration = agent;
|
|
2298
|
-
if (projectInfo.installedAgents.length > 0) {
|
|
2299
|
-
const installedNames = formatInstalledAgentNames(
|
|
2300
|
-
projectInfo.installedAgents
|
|
2301
|
-
);
|
|
2302
|
-
const { action } = await prompts({
|
|
2308
|
+
agentIntegration = "mcp";
|
|
2309
|
+
projectInfo.installedAgents = [...projectInfo.installedAgents, "mcp"];
|
|
2310
|
+
} else {
|
|
2311
|
+
const { agent } = await prompts({
|
|
2303
2312
|
type: "select",
|
|
2304
|
-
name: "
|
|
2305
|
-
message: "
|
|
2313
|
+
name: "agent",
|
|
2314
|
+
message: `Which ${highlighter.info("agent")} would you like to connect?`,
|
|
2306
2315
|
choices: [
|
|
2307
|
-
{
|
|
2308
|
-
title:
|
|
2309
|
-
value:
|
|
2310
|
-
},
|
|
2311
|
-
{
|
|
2312
|
-
title: `Add ${AGENT_NAMES[agentIntegration]} alongside existing`,
|
|
2313
|
-
value: "add"
|
|
2314
|
-
},
|
|
2315
|
-
{ title: "Cancel", value: "cancel" }
|
|
2316
|
+
...availableAgents.map((availableAgent) => ({
|
|
2317
|
+
title: AGENT_NAMES[availableAgent],
|
|
2318
|
+
value: availableAgent
|
|
2319
|
+
})),
|
|
2320
|
+
{ title: "Skip", value: "skip" }
|
|
2316
2321
|
]
|
|
2317
2322
|
});
|
|
2318
|
-
if (!
|
|
2319
|
-
logger.break();
|
|
2320
|
-
logger.log("Changes cancelled.");
|
|
2323
|
+
if (!agent || agent === "skip") {
|
|
2321
2324
|
logger.break();
|
|
2322
2325
|
process.exit(0);
|
|
2323
2326
|
}
|
|
2324
|
-
|
|
2325
|
-
|
|
2327
|
+
agentIntegration = agent;
|
|
2328
|
+
if (projectInfo.installedAgents.length > 0) {
|
|
2329
|
+
const installedNames = formatInstalledAgentNames(
|
|
2330
|
+
projectInfo.installedAgents
|
|
2331
|
+
);
|
|
2332
|
+
const { action } = await prompts({
|
|
2333
|
+
type: "select",
|
|
2334
|
+
name: "action",
|
|
2335
|
+
message: "How would you like to proceed?",
|
|
2336
|
+
choices: [
|
|
2337
|
+
{
|
|
2338
|
+
title: `Replace ${installedNames} with ${getAgentDisplayName(agentIntegration)}`,
|
|
2339
|
+
value: "replace"
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
title: `Add ${getAgentDisplayName(agentIntegration)} alongside existing`,
|
|
2343
|
+
value: "add"
|
|
2344
|
+
},
|
|
2345
|
+
{ title: "Cancel", value: "cancel" }
|
|
2346
|
+
]
|
|
2347
|
+
});
|
|
2348
|
+
if (!action || action === "cancel") {
|
|
2349
|
+
logger.break();
|
|
2350
|
+
logger.log("Changes cancelled.");
|
|
2351
|
+
logger.break();
|
|
2352
|
+
process.exit(0);
|
|
2353
|
+
}
|
|
2354
|
+
if (action === "replace") {
|
|
2355
|
+
agentsToRemove = [...projectInfo.installedAgents];
|
|
2356
|
+
}
|
|
2326
2357
|
}
|
|
2327
2358
|
}
|
|
2328
2359
|
} else {
|
|
2329
2360
|
logger.break();
|
|
2330
|
-
logger.error("Please specify an agent to
|
|
2361
|
+
logger.error("Please specify an agent to connect.");
|
|
2331
2362
|
logger.error("Available agents: " + availableAgents.join(", "));
|
|
2332
2363
|
logger.break();
|
|
2333
2364
|
process.exit(1);
|
|
@@ -2399,7 +2430,7 @@ var add = new commander.Command().name("add").alias("install").description("add
|
|
|
2399
2430
|
);
|
|
2400
2431
|
}
|
|
2401
2432
|
const addingSpinner = spinner(
|
|
2402
|
-
`Adding ${
|
|
2433
|
+
`Adding ${getAgentDisplayName(agentIntegration)}.`
|
|
2403
2434
|
).start();
|
|
2404
2435
|
addingSpinner.succeed();
|
|
2405
2436
|
const result = previewTransform(
|
|
@@ -2505,7 +2536,7 @@ var add = new commander.Command().name("add").alias("install").description("add
|
|
|
2505
2536
|
}
|
|
2506
2537
|
logger.break();
|
|
2507
2538
|
logger.log(
|
|
2508
|
-
`${highlighter.success("Success!")} ${
|
|
2539
|
+
`${highlighter.success("Success!")} ${getAgentDisplayName(agentIntegration)} has been added.`
|
|
2509
2540
|
);
|
|
2510
2541
|
if (packageJsonResult.warning) {
|
|
2511
2542
|
logger.warn(packageJsonResult.warning);
|
|
@@ -2524,7 +2555,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
|
|
|
2524
2555
|
var MAX_CONTEXT_LINES = 50;
|
|
2525
2556
|
|
|
2526
2557
|
// src/commands/configure.ts
|
|
2527
|
-
var VERSION2 = "0.1.
|
|
2558
|
+
var VERSION2 = "0.1.14";
|
|
2528
2559
|
var isMac = process.platform === "darwin";
|
|
2529
2560
|
var META_LABEL = isMac ? "Cmd" : "Win";
|
|
2530
2561
|
var ALT_LABEL = isMac ? "Option" : "Alt";
|
|
@@ -3027,7 +3058,7 @@ var configure = new commander.Command().name("configure").alias("config").descri
|
|
|
3027
3058
|
});
|
|
3028
3059
|
|
|
3029
3060
|
// src/utils/cli-helpers.ts
|
|
3030
|
-
var formatInstalledAgentNames2 = (agents) => agents.map(
|
|
3061
|
+
var formatInstalledAgentNames2 = (agents) => agents.map(getAgentDisplayName).join(", ");
|
|
3031
3062
|
var applyTransformWithFeedback = (result, message) => {
|
|
3032
3063
|
const writeSpinner = spinner(
|
|
3033
3064
|
message ?? `Applying changes to ${result.filePath}.`
|
|
@@ -3080,7 +3111,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
|
|
|
3080
3111
|
};
|
|
3081
3112
|
|
|
3082
3113
|
// src/commands/init.ts
|
|
3083
|
-
var VERSION3 = "0.1.
|
|
3114
|
+
var VERSION3 = "0.1.14";
|
|
3084
3115
|
var REPORT_URL = "https://react-grab.com/api/report-cli";
|
|
3085
3116
|
var DOCS_URL = "https://github.com/aidenybai/react-grab";
|
|
3086
3117
|
var reportToCli = (type, config, error) => {
|
|
@@ -3116,12 +3147,7 @@ var UNSUPPORTED_FRAMEWORK_NAMES = {
|
|
|
3116
3147
|
sveltekit: "SvelteKit",
|
|
3117
3148
|
gatsby: "Gatsby"
|
|
3118
3149
|
};
|
|
3119
|
-
var getAgentName =
|
|
3120
|
-
if (agent in AGENT_NAMES) {
|
|
3121
|
-
return AGENT_NAMES[agent];
|
|
3122
|
-
}
|
|
3123
|
-
return agent;
|
|
3124
|
-
};
|
|
3150
|
+
var getAgentName = getAgentDisplayName;
|
|
3125
3151
|
var formatActivationKeyDisplay2 = (activationKey) => {
|
|
3126
3152
|
if (!activationKey) return "Default (Option/Alt)";
|
|
3127
3153
|
return activationKey.split("+").map((part) => {
|
|
@@ -3136,7 +3162,7 @@ var formatActivationKeyDisplay2 = (activationKey) => {
|
|
|
3136
3162
|
};
|
|
3137
3163
|
var init = new commander.Command().name("init").description("initialize React Grab in your project").option("-y, --yes", "skip confirmation prompts", false).option("-f, --force", "force overwrite existing config", false).option(
|
|
3138
3164
|
"-a, --agent <agent>",
|
|
3139
|
-
|
|
3165
|
+
`connect to your agent (${AGENTS.join(", ")}, mcp)`
|
|
3140
3166
|
).option(
|
|
3141
3167
|
"-k, --key <key>",
|
|
3142
3168
|
"activation key (e.g., Meta+K, Ctrl+Shift+G, Space)"
|
|
@@ -3355,40 +3381,108 @@ var init = new commander.Command().name("init").description("initialize React Gr
|
|
|
3355
3381
|
const availableAgents = AGENTS.filter(
|
|
3356
3382
|
(agent) => !projectInfo.installedAgents.includes(agent)
|
|
3357
3383
|
);
|
|
3358
|
-
|
|
3384
|
+
logger.break();
|
|
3385
|
+
const { wantAddAgent } = await prompts({
|
|
3386
|
+
type: "confirm",
|
|
3387
|
+
name: "wantAddAgent",
|
|
3388
|
+
message: `Would you like to ${highlighter.info("connect it to your agent")}?`,
|
|
3389
|
+
initial: false
|
|
3390
|
+
});
|
|
3391
|
+
if (wantAddAgent === void 0) {
|
|
3359
3392
|
logger.break();
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
});
|
|
3366
|
-
if (wantAddAgent === void 0) {
|
|
3393
|
+
process.exit(1);
|
|
3394
|
+
}
|
|
3395
|
+
if (wantAddAgent) {
|
|
3396
|
+
const connectionMode = await promptConnectionMode();
|
|
3397
|
+
if (connectionMode === void 0) {
|
|
3367
3398
|
logger.break();
|
|
3368
3399
|
process.exit(1);
|
|
3369
3400
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3401
|
+
let agentIntegration2;
|
|
3402
|
+
if (connectionMode === "mcp") {
|
|
3403
|
+
const didInstall = await promptMcpInstall();
|
|
3404
|
+
if (!didInstall) {
|
|
3405
|
+
logger.break();
|
|
3406
|
+
process.exit(0);
|
|
3407
|
+
}
|
|
3408
|
+
logger.break();
|
|
3409
|
+
logger.success("MCP server has been configured.");
|
|
3410
|
+
logger.log("Restart your agents to activate.");
|
|
3411
|
+
agentIntegration2 = "mcp";
|
|
3412
|
+
projectInfo.installedAgents = ["mcp"];
|
|
3413
|
+
const result2 = previewTransform(
|
|
3414
|
+
projectInfo.projectRoot,
|
|
3415
|
+
projectInfo.framework,
|
|
3416
|
+
projectInfo.nextRouterType,
|
|
3417
|
+
agentIntegration2,
|
|
3418
|
+
true
|
|
3419
|
+
);
|
|
3420
|
+
const packageJsonResult2 = previewPackageJsonTransform(
|
|
3421
|
+
projectInfo.projectRoot,
|
|
3422
|
+
agentIntegration2,
|
|
3423
|
+
projectInfo.installedAgents,
|
|
3424
|
+
projectInfo.packageManager
|
|
3425
|
+
);
|
|
3426
|
+
if (!result2.success) {
|
|
3427
|
+
logger.break();
|
|
3428
|
+
logger.error(result2.message);
|
|
3373
3429
|
logger.break();
|
|
3374
3430
|
process.exit(1);
|
|
3375
3431
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
logger.break();
|
|
3380
|
-
process.exit(0);
|
|
3381
|
-
}
|
|
3432
|
+
const hasLayoutChanges2 = !result2.noChanges && result2.originalContent && result2.newContent;
|
|
3433
|
+
const hasPackageJsonChanges2 = packageJsonResult2.success && !packageJsonResult2.noChanges && packageJsonResult2.originalContent && packageJsonResult2.newContent;
|
|
3434
|
+
if (hasLayoutChanges2 || hasPackageJsonChanges2) {
|
|
3382
3435
|
logger.break();
|
|
3383
|
-
|
|
3384
|
-
|
|
3436
|
+
if (hasLayoutChanges2) {
|
|
3437
|
+
printDiff(
|
|
3438
|
+
result2.filePath,
|
|
3439
|
+
result2.originalContent,
|
|
3440
|
+
result2.newContent
|
|
3441
|
+
);
|
|
3442
|
+
}
|
|
3443
|
+
if (hasPackageJsonChanges2) {
|
|
3444
|
+
if (hasLayoutChanges2) {
|
|
3445
|
+
logger.break();
|
|
3446
|
+
}
|
|
3447
|
+
printDiff(
|
|
3448
|
+
packageJsonResult2.filePath,
|
|
3449
|
+
packageJsonResult2.originalContent,
|
|
3450
|
+
packageJsonResult2.newContent
|
|
3451
|
+
);
|
|
3452
|
+
}
|
|
3385
3453
|
logger.break();
|
|
3386
|
-
|
|
3454
|
+
const { proceed } = await prompts({
|
|
3455
|
+
type: "confirm",
|
|
3456
|
+
name: "proceed",
|
|
3457
|
+
message: "Apply these changes?",
|
|
3458
|
+
initial: true
|
|
3459
|
+
});
|
|
3460
|
+
if (!proceed) {
|
|
3461
|
+
logger.break();
|
|
3462
|
+
logger.log("Agent addition cancelled.");
|
|
3463
|
+
} else {
|
|
3464
|
+
installPackagesWithFeedback(
|
|
3465
|
+
getPackagesToInstall(agentIntegration2, false),
|
|
3466
|
+
projectInfo.packageManager,
|
|
3467
|
+
projectInfo.projectRoot
|
|
3468
|
+
);
|
|
3469
|
+
if (hasLayoutChanges2) {
|
|
3470
|
+
applyTransformWithFeedback(result2);
|
|
3471
|
+
}
|
|
3472
|
+
if (hasPackageJsonChanges2) {
|
|
3473
|
+
applyPackageJsonWithFeedback(packageJsonResult2);
|
|
3474
|
+
}
|
|
3475
|
+
logger.break();
|
|
3476
|
+
logger.success(
|
|
3477
|
+
`${getAgentName(agentIntegration2)} has been added.`
|
|
3478
|
+
);
|
|
3479
|
+
}
|
|
3387
3480
|
}
|
|
3481
|
+
} else {
|
|
3388
3482
|
const { agent } = await prompts({
|
|
3389
3483
|
type: "select",
|
|
3390
3484
|
name: "agent",
|
|
3391
|
-
message: `Which ${highlighter.info("agent
|
|
3485
|
+
message: `Which ${highlighter.info("agent")} would you like to connect?`,
|
|
3392
3486
|
choices: [
|
|
3393
3487
|
...availableAgents.map((innerAgent) => ({
|
|
3394
3488
|
title: getAgentName(innerAgent),
|
|
@@ -3401,7 +3495,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
|
|
|
3401
3495
|
logger.break();
|
|
3402
3496
|
process.exit(0);
|
|
3403
3497
|
}
|
|
3404
|
-
|
|
3498
|
+
agentIntegration2 = agent;
|
|
3405
3499
|
let agentsToRemove2 = [];
|
|
3406
3500
|
if (projectInfo.installedAgents.length > 0) {
|
|
3407
3501
|
const installedNames = formatInstalledAgentNames2(
|
|
@@ -3699,7 +3793,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
|
|
|
3699
3793
|
const { wantAddAgent } = await prompts({
|
|
3700
3794
|
type: "confirm",
|
|
3701
3795
|
name: "wantAddAgent",
|
|
3702
|
-
message: `Would you like to
|
|
3796
|
+
message: `Would you like to ${highlighter.info("connect it to your agent")}?`,
|
|
3703
3797
|
initial: false
|
|
3704
3798
|
});
|
|
3705
3799
|
if (wantAddAgent === void 0) {
|
|
@@ -3722,11 +3816,12 @@ var init = new commander.Command().name("init").description("initialize React Gr
|
|
|
3722
3816
|
logger.success("MCP server has been configured.");
|
|
3723
3817
|
logger.log("Continuing with React Grab installation...");
|
|
3724
3818
|
logger.break();
|
|
3819
|
+
agentIntegration = "mcp";
|
|
3725
3820
|
} else {
|
|
3726
3821
|
const { agent } = await prompts({
|
|
3727
3822
|
type: "select",
|
|
3728
3823
|
name: "agent",
|
|
3729
|
-
message: `Which ${highlighter.info("agent
|
|
3824
|
+
message: `Which ${highlighter.info("agent")} would you like to connect?`,
|
|
3730
3825
|
choices: [
|
|
3731
3826
|
...AGENTS.map((innerAgent) => ({
|
|
3732
3827
|
title: getAgentName(innerAgent),
|
|
@@ -3850,11 +3945,8 @@ var init = new commander.Command().name("init").description("initialize React Gr
|
|
|
3850
3945
|
reportToCli("error", void 0, error);
|
|
3851
3946
|
}
|
|
3852
3947
|
});
|
|
3853
|
-
var VERSION4 = "0.1.
|
|
3854
|
-
var remove = new commander.Command().name("remove").description("
|
|
3855
|
-
"[agent]",
|
|
3856
|
-
"agent to remove (claude-code, cursor, opencode, codex, gemini, amp, ami)"
|
|
3857
|
-
).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
3948
|
+
var VERSION4 = "0.1.14";
|
|
3949
|
+
var remove = new commander.Command().name("remove").description("disconnect React Grab from your agent").argument("[agent]", `agent to disconnect (${AGENTS.join(", ")}, mcp)`).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
3858
3950
|
"-c, --cwd <cwd>",
|
|
3859
3951
|
"working directory (defaults to current directory)",
|
|
3860
3952
|
process.cwd()
|
|
@@ -3880,7 +3972,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
3880
3972
|
if (projectInfo.installedAgents.length === 0) {
|
|
3881
3973
|
preflightSpinner.succeed();
|
|
3882
3974
|
logger.break();
|
|
3883
|
-
logger.warn("No agent
|
|
3975
|
+
logger.warn("No agent connections are installed.");
|
|
3884
3976
|
logger.break();
|
|
3885
3977
|
process.exit(0);
|
|
3886
3978
|
}
|
|
@@ -3891,7 +3983,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
3891
3983
|
logger.break();
|
|
3892
3984
|
logger.error(`Agent ${highlighter.info(agentArg)} is not installed.`);
|
|
3893
3985
|
logger.log(
|
|
3894
|
-
`Installed agents: ${projectInfo.installedAgents.map(
|
|
3986
|
+
`Installed agents: ${projectInfo.installedAgents.map(getAgentDisplayName).join(", ")}`
|
|
3895
3987
|
);
|
|
3896
3988
|
logger.break();
|
|
3897
3989
|
process.exit(1);
|
|
@@ -3902,9 +3994,9 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
3902
3994
|
const { agent } = await prompts({
|
|
3903
3995
|
type: "select",
|
|
3904
3996
|
name: "agent",
|
|
3905
|
-
message: `Which ${highlighter.info("agent
|
|
3997
|
+
message: `Which ${highlighter.info("agent")} would you like to disconnect?`,
|
|
3906
3998
|
choices: projectInfo.installedAgents.map((innerAgent) => ({
|
|
3907
|
-
title:
|
|
3999
|
+
title: getAgentDisplayName(innerAgent),
|
|
3908
4000
|
value: innerAgent
|
|
3909
4001
|
}))
|
|
3910
4002
|
});
|
|
@@ -3915,7 +4007,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
3915
4007
|
agentToRemove = agent;
|
|
3916
4008
|
} else {
|
|
3917
4009
|
logger.break();
|
|
3918
|
-
logger.error("Please specify an agent to
|
|
4010
|
+
logger.error("Please specify an agent to disconnect.");
|
|
3919
4011
|
logger.error(
|
|
3920
4012
|
"Installed agents: " + projectInfo.installedAgents.join(", ")
|
|
3921
4013
|
);
|
|
@@ -3923,7 +4015,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
3923
4015
|
process.exit(1);
|
|
3924
4016
|
}
|
|
3925
4017
|
const removingSpinner = spinner(
|
|
3926
|
-
`Preparing to remove ${
|
|
4018
|
+
`Preparing to remove ${getAgentDisplayName(agentToRemove)}.`
|
|
3927
4019
|
).start();
|
|
3928
4020
|
removingSpinner.succeed();
|
|
3929
4021
|
const result = previewAgentRemoval(
|
|
@@ -4020,7 +4112,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
4020
4112
|
}
|
|
4021
4113
|
logger.break();
|
|
4022
4114
|
logger.log(
|
|
4023
|
-
`${highlighter.success("Success!")} ${
|
|
4115
|
+
`${highlighter.success("Success!")} ${getAgentDisplayName(agentToRemove)} has been removed.`
|
|
4024
4116
|
);
|
|
4025
4117
|
logger.break();
|
|
4026
4118
|
} catch (error) {
|
|
@@ -4029,7 +4121,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
4029
4121
|
});
|
|
4030
4122
|
|
|
4031
4123
|
// src/cli.ts
|
|
4032
|
-
var VERSION5 = "0.1.
|
|
4124
|
+
var VERSION5 = "0.1.14";
|
|
4033
4125
|
var VERSION_API_URL = "https://www.react-grab.com/api/version";
|
|
4034
4126
|
process.on("SIGINT", () => process.exit(0));
|
|
4035
4127
|
process.on("SIGTERM", () => process.exit(0));
|
package/dist/cli.js
CHANGED
|
@@ -53,10 +53,19 @@ var onCancel = () => {
|
|
|
53
53
|
var prompts = (questions) => {
|
|
54
54
|
return basePrompts(questions, { onCancel });
|
|
55
55
|
};
|
|
56
|
+
var VALID_PACKAGE_MANAGERS = /* @__PURE__ */ new Set([
|
|
57
|
+
"npm",
|
|
58
|
+
"yarn",
|
|
59
|
+
"pnpm",
|
|
60
|
+
"bun"
|
|
61
|
+
]);
|
|
56
62
|
var detectPackageManager = async (projectRoot) => {
|
|
57
63
|
const detected = await detect({ cwd: projectRoot });
|
|
58
|
-
if (detected
|
|
59
|
-
|
|
64
|
+
if (detected) {
|
|
65
|
+
const managerName = detected.split("@")[0];
|
|
66
|
+
if (VALID_PACKAGE_MANAGERS.has(managerName)) {
|
|
67
|
+
return managerName;
|
|
68
|
+
}
|
|
60
69
|
}
|
|
61
70
|
return "npm";
|
|
62
71
|
};
|
|
@@ -296,7 +305,8 @@ var AGENT_PACKAGES = [
|
|
|
296
305
|
"@react-grab/codex",
|
|
297
306
|
"@react-grab/gemini",
|
|
298
307
|
"@react-grab/amp",
|
|
299
|
-
"@react-grab/ami"
|
|
308
|
+
"@react-grab/ami",
|
|
309
|
+
"@react-grab/mcp"
|
|
300
310
|
];
|
|
301
311
|
var detectUnsupportedFramework = (projectRoot) => {
|
|
302
312
|
const packageJsonPath = join(projectRoot, "package.json");
|
|
@@ -843,6 +853,13 @@ var AGENT_NAMES = {
|
|
|
843
853
|
ami: "Ami",
|
|
844
854
|
droid: "Droid"
|
|
845
855
|
};
|
|
856
|
+
var getAgentDisplayName = (agent) => {
|
|
857
|
+
if (agent === "mcp") return "MCP";
|
|
858
|
+
if (agent in AGENT_NAMES) {
|
|
859
|
+
return AGENT_NAMES[agent];
|
|
860
|
+
}
|
|
861
|
+
return agent;
|
|
862
|
+
};
|
|
846
863
|
var NEXT_APP_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
|
|
847
864
|
<Script
|
|
848
865
|
src="//unpkg.com/react-grab/dist/index.global.js"
|
|
@@ -1596,6 +1613,14 @@ var previewPackageJsonTransform = (projectRoot, agent, installedAgents, packageM
|
|
|
1596
1613
|
noChanges: true
|
|
1597
1614
|
};
|
|
1598
1615
|
}
|
|
1616
|
+
if (agent === "mcp") {
|
|
1617
|
+
return {
|
|
1618
|
+
success: true,
|
|
1619
|
+
filePath: "",
|
|
1620
|
+
message: "MCP does not use package.json dev script",
|
|
1621
|
+
noChanges: true
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1599
1624
|
const packageJsonPath = join(projectRoot, "package.json");
|
|
1600
1625
|
if (!existsSync(packageJsonPath)) {
|
|
1601
1626
|
return {
|
|
@@ -2157,9 +2182,9 @@ var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDoma
|
|
|
2157
2182
|
};
|
|
2158
2183
|
|
|
2159
2184
|
// src/commands/add.ts
|
|
2160
|
-
var VERSION = "0.1.
|
|
2185
|
+
var VERSION = "0.1.14";
|
|
2161
2186
|
var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
|
|
2162
|
-
var add = new Command().name("add").alias("install").description("
|
|
2187
|
+
var add = new Command().name("add").alias("install").description("connect React Grab to your agent").argument("[agent]", `agent to connect (${AGENTS.join(", ")}, mcp)`).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
2163
2188
|
"-c, --cwd <cwd>",
|
|
2164
2189
|
"working directory (defaults to current directory)",
|
|
2165
2190
|
process.cwd()
|
|
@@ -2186,9 +2211,10 @@ var add = new Command().name("add").alias("install").description("add an agent i
|
|
|
2186
2211
|
const availableAgents = AGENTS.filter(
|
|
2187
2212
|
(agent) => !projectInfo.installedAgents.includes(agent)
|
|
2188
2213
|
);
|
|
2189
|
-
if (availableAgents.length === 0) {
|
|
2214
|
+
if (availableAgents.length === 0 && isNonInteractive && !agentArg) {
|
|
2190
2215
|
logger.break();
|
|
2191
|
-
logger.success("All
|
|
2216
|
+
logger.success("All legacy agents are already installed.");
|
|
2217
|
+
logger.log("Run without -y to add MCP.");
|
|
2192
2218
|
logger.break();
|
|
2193
2219
|
process.exit(0);
|
|
2194
2220
|
}
|
|
@@ -2222,11 +2248,11 @@ var add = new Command().name("add").alias("install").description("add an agent i
|
|
|
2222
2248
|
message: "How would you like to proceed?",
|
|
2223
2249
|
choices: [
|
|
2224
2250
|
{
|
|
2225
|
-
title: `Replace with ${
|
|
2251
|
+
title: `Replace with ${getAgentDisplayName(agentIntegration)}`,
|
|
2226
2252
|
value: "replace"
|
|
2227
2253
|
},
|
|
2228
2254
|
{
|
|
2229
|
-
title: `Add ${
|
|
2255
|
+
title: `Add ${getAgentDisplayName(agentIntegration)} alongside existing`,
|
|
2230
2256
|
value: "add"
|
|
2231
2257
|
},
|
|
2232
2258
|
{ title: "Cancel", value: "cancel" }
|
|
@@ -2267,55 +2293,60 @@ var add = new Command().name("add").alias("install").description("add an agent i
|
|
|
2267
2293
|
);
|
|
2268
2294
|
logger.log("Restart your agents to activate.");
|
|
2269
2295
|
logger.break();
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
name: "agent",
|
|
2275
|
-
message: `Which ${highlighter.info("agent integration")} would you like to add?`,
|
|
2276
|
-
choices: availableAgents.map((availableAgent) => ({
|
|
2277
|
-
title: AGENT_NAMES[availableAgent],
|
|
2278
|
-
value: availableAgent
|
|
2279
|
-
}))
|
|
2280
|
-
});
|
|
2281
|
-
if (!agent) {
|
|
2282
|
-
logger.break();
|
|
2283
|
-
process.exit(1);
|
|
2284
|
-
}
|
|
2285
|
-
agentIntegration = agent;
|
|
2286
|
-
if (projectInfo.installedAgents.length > 0) {
|
|
2287
|
-
const installedNames = formatInstalledAgentNames(
|
|
2288
|
-
projectInfo.installedAgents
|
|
2289
|
-
);
|
|
2290
|
-
const { action } = await prompts({
|
|
2296
|
+
agentIntegration = "mcp";
|
|
2297
|
+
projectInfo.installedAgents = [...projectInfo.installedAgents, "mcp"];
|
|
2298
|
+
} else {
|
|
2299
|
+
const { agent } = await prompts({
|
|
2291
2300
|
type: "select",
|
|
2292
|
-
name: "
|
|
2293
|
-
message: "
|
|
2301
|
+
name: "agent",
|
|
2302
|
+
message: `Which ${highlighter.info("agent")} would you like to connect?`,
|
|
2294
2303
|
choices: [
|
|
2295
|
-
{
|
|
2296
|
-
title:
|
|
2297
|
-
value:
|
|
2298
|
-
},
|
|
2299
|
-
{
|
|
2300
|
-
title: `Add ${AGENT_NAMES[agentIntegration]} alongside existing`,
|
|
2301
|
-
value: "add"
|
|
2302
|
-
},
|
|
2303
|
-
{ title: "Cancel", value: "cancel" }
|
|
2304
|
+
...availableAgents.map((availableAgent) => ({
|
|
2305
|
+
title: AGENT_NAMES[availableAgent],
|
|
2306
|
+
value: availableAgent
|
|
2307
|
+
})),
|
|
2308
|
+
{ title: "Skip", value: "skip" }
|
|
2304
2309
|
]
|
|
2305
2310
|
});
|
|
2306
|
-
if (!
|
|
2307
|
-
logger.break();
|
|
2308
|
-
logger.log("Changes cancelled.");
|
|
2311
|
+
if (!agent || agent === "skip") {
|
|
2309
2312
|
logger.break();
|
|
2310
2313
|
process.exit(0);
|
|
2311
2314
|
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2315
|
+
agentIntegration = agent;
|
|
2316
|
+
if (projectInfo.installedAgents.length > 0) {
|
|
2317
|
+
const installedNames = formatInstalledAgentNames(
|
|
2318
|
+
projectInfo.installedAgents
|
|
2319
|
+
);
|
|
2320
|
+
const { action } = await prompts({
|
|
2321
|
+
type: "select",
|
|
2322
|
+
name: "action",
|
|
2323
|
+
message: "How would you like to proceed?",
|
|
2324
|
+
choices: [
|
|
2325
|
+
{
|
|
2326
|
+
title: `Replace ${installedNames} with ${getAgentDisplayName(agentIntegration)}`,
|
|
2327
|
+
value: "replace"
|
|
2328
|
+
},
|
|
2329
|
+
{
|
|
2330
|
+
title: `Add ${getAgentDisplayName(agentIntegration)} alongside existing`,
|
|
2331
|
+
value: "add"
|
|
2332
|
+
},
|
|
2333
|
+
{ title: "Cancel", value: "cancel" }
|
|
2334
|
+
]
|
|
2335
|
+
});
|
|
2336
|
+
if (!action || action === "cancel") {
|
|
2337
|
+
logger.break();
|
|
2338
|
+
logger.log("Changes cancelled.");
|
|
2339
|
+
logger.break();
|
|
2340
|
+
process.exit(0);
|
|
2341
|
+
}
|
|
2342
|
+
if (action === "replace") {
|
|
2343
|
+
agentsToRemove = [...projectInfo.installedAgents];
|
|
2344
|
+
}
|
|
2314
2345
|
}
|
|
2315
2346
|
}
|
|
2316
2347
|
} else {
|
|
2317
2348
|
logger.break();
|
|
2318
|
-
logger.error("Please specify an agent to
|
|
2349
|
+
logger.error("Please specify an agent to connect.");
|
|
2319
2350
|
logger.error("Available agents: " + availableAgents.join(", "));
|
|
2320
2351
|
logger.break();
|
|
2321
2352
|
process.exit(1);
|
|
@@ -2387,7 +2418,7 @@ var add = new Command().name("add").alias("install").description("add an agent i
|
|
|
2387
2418
|
);
|
|
2388
2419
|
}
|
|
2389
2420
|
const addingSpinner = spinner(
|
|
2390
|
-
`Adding ${
|
|
2421
|
+
`Adding ${getAgentDisplayName(agentIntegration)}.`
|
|
2391
2422
|
).start();
|
|
2392
2423
|
addingSpinner.succeed();
|
|
2393
2424
|
const result = previewTransform(
|
|
@@ -2493,7 +2524,7 @@ var add = new Command().name("add").alias("install").description("add an agent i
|
|
|
2493
2524
|
}
|
|
2494
2525
|
logger.break();
|
|
2495
2526
|
logger.log(
|
|
2496
|
-
`${highlighter.success("Success!")} ${
|
|
2527
|
+
`${highlighter.success("Success!")} ${getAgentDisplayName(agentIntegration)} has been added.`
|
|
2497
2528
|
);
|
|
2498
2529
|
if (packageJsonResult.warning) {
|
|
2499
2530
|
logger.warn(packageJsonResult.warning);
|
|
@@ -2512,7 +2543,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
|
|
|
2512
2543
|
var MAX_CONTEXT_LINES = 50;
|
|
2513
2544
|
|
|
2514
2545
|
// src/commands/configure.ts
|
|
2515
|
-
var VERSION2 = "0.1.
|
|
2546
|
+
var VERSION2 = "0.1.14";
|
|
2516
2547
|
var isMac = process.platform === "darwin";
|
|
2517
2548
|
var META_LABEL = isMac ? "Cmd" : "Win";
|
|
2518
2549
|
var ALT_LABEL = isMac ? "Option" : "Alt";
|
|
@@ -3015,7 +3046,7 @@ var configure = new Command().name("configure").alias("config").description("con
|
|
|
3015
3046
|
});
|
|
3016
3047
|
|
|
3017
3048
|
// src/utils/cli-helpers.ts
|
|
3018
|
-
var formatInstalledAgentNames2 = (agents) => agents.map(
|
|
3049
|
+
var formatInstalledAgentNames2 = (agents) => agents.map(getAgentDisplayName).join(", ");
|
|
3019
3050
|
var applyTransformWithFeedback = (result, message) => {
|
|
3020
3051
|
const writeSpinner = spinner(
|
|
3021
3052
|
message ?? `Applying changes to ${result.filePath}.`
|
|
@@ -3068,7 +3099,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
|
|
|
3068
3099
|
};
|
|
3069
3100
|
|
|
3070
3101
|
// src/commands/init.ts
|
|
3071
|
-
var VERSION3 = "0.1.
|
|
3102
|
+
var VERSION3 = "0.1.14";
|
|
3072
3103
|
var REPORT_URL = "https://react-grab.com/api/report-cli";
|
|
3073
3104
|
var DOCS_URL = "https://github.com/aidenybai/react-grab";
|
|
3074
3105
|
var reportToCli = (type, config, error) => {
|
|
@@ -3104,12 +3135,7 @@ var UNSUPPORTED_FRAMEWORK_NAMES = {
|
|
|
3104
3135
|
sveltekit: "SvelteKit",
|
|
3105
3136
|
gatsby: "Gatsby"
|
|
3106
3137
|
};
|
|
3107
|
-
var getAgentName =
|
|
3108
|
-
if (agent in AGENT_NAMES) {
|
|
3109
|
-
return AGENT_NAMES[agent];
|
|
3110
|
-
}
|
|
3111
|
-
return agent;
|
|
3112
|
-
};
|
|
3138
|
+
var getAgentName = getAgentDisplayName;
|
|
3113
3139
|
var formatActivationKeyDisplay2 = (activationKey) => {
|
|
3114
3140
|
if (!activationKey) return "Default (Option/Alt)";
|
|
3115
3141
|
return activationKey.split("+").map((part) => {
|
|
@@ -3124,7 +3150,7 @@ var formatActivationKeyDisplay2 = (activationKey) => {
|
|
|
3124
3150
|
};
|
|
3125
3151
|
var init = new Command().name("init").description("initialize React Grab in your project").option("-y, --yes", "skip confirmation prompts", false).option("-f, --force", "force overwrite existing config", false).option(
|
|
3126
3152
|
"-a, --agent <agent>",
|
|
3127
|
-
|
|
3153
|
+
`connect to your agent (${AGENTS.join(", ")}, mcp)`
|
|
3128
3154
|
).option(
|
|
3129
3155
|
"-k, --key <key>",
|
|
3130
3156
|
"activation key (e.g., Meta+K, Ctrl+Shift+G, Space)"
|
|
@@ -3343,40 +3369,108 @@ var init = new Command().name("init").description("initialize React Grab in your
|
|
|
3343
3369
|
const availableAgents = AGENTS.filter(
|
|
3344
3370
|
(agent) => !projectInfo.installedAgents.includes(agent)
|
|
3345
3371
|
);
|
|
3346
|
-
|
|
3372
|
+
logger.break();
|
|
3373
|
+
const { wantAddAgent } = await prompts({
|
|
3374
|
+
type: "confirm",
|
|
3375
|
+
name: "wantAddAgent",
|
|
3376
|
+
message: `Would you like to ${highlighter.info("connect it to your agent")}?`,
|
|
3377
|
+
initial: false
|
|
3378
|
+
});
|
|
3379
|
+
if (wantAddAgent === void 0) {
|
|
3347
3380
|
logger.break();
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
});
|
|
3354
|
-
if (wantAddAgent === void 0) {
|
|
3381
|
+
process.exit(1);
|
|
3382
|
+
}
|
|
3383
|
+
if (wantAddAgent) {
|
|
3384
|
+
const connectionMode = await promptConnectionMode();
|
|
3385
|
+
if (connectionMode === void 0) {
|
|
3355
3386
|
logger.break();
|
|
3356
3387
|
process.exit(1);
|
|
3357
3388
|
}
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3389
|
+
let agentIntegration2;
|
|
3390
|
+
if (connectionMode === "mcp") {
|
|
3391
|
+
const didInstall = await promptMcpInstall();
|
|
3392
|
+
if (!didInstall) {
|
|
3393
|
+
logger.break();
|
|
3394
|
+
process.exit(0);
|
|
3395
|
+
}
|
|
3396
|
+
logger.break();
|
|
3397
|
+
logger.success("MCP server has been configured.");
|
|
3398
|
+
logger.log("Restart your agents to activate.");
|
|
3399
|
+
agentIntegration2 = "mcp";
|
|
3400
|
+
projectInfo.installedAgents = ["mcp"];
|
|
3401
|
+
const result2 = previewTransform(
|
|
3402
|
+
projectInfo.projectRoot,
|
|
3403
|
+
projectInfo.framework,
|
|
3404
|
+
projectInfo.nextRouterType,
|
|
3405
|
+
agentIntegration2,
|
|
3406
|
+
true
|
|
3407
|
+
);
|
|
3408
|
+
const packageJsonResult2 = previewPackageJsonTransform(
|
|
3409
|
+
projectInfo.projectRoot,
|
|
3410
|
+
agentIntegration2,
|
|
3411
|
+
projectInfo.installedAgents,
|
|
3412
|
+
projectInfo.packageManager
|
|
3413
|
+
);
|
|
3414
|
+
if (!result2.success) {
|
|
3415
|
+
logger.break();
|
|
3416
|
+
logger.error(result2.message);
|
|
3361
3417
|
logger.break();
|
|
3362
3418
|
process.exit(1);
|
|
3363
3419
|
}
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
logger.break();
|
|
3368
|
-
process.exit(0);
|
|
3369
|
-
}
|
|
3420
|
+
const hasLayoutChanges2 = !result2.noChanges && result2.originalContent && result2.newContent;
|
|
3421
|
+
const hasPackageJsonChanges2 = packageJsonResult2.success && !packageJsonResult2.noChanges && packageJsonResult2.originalContent && packageJsonResult2.newContent;
|
|
3422
|
+
if (hasLayoutChanges2 || hasPackageJsonChanges2) {
|
|
3370
3423
|
logger.break();
|
|
3371
|
-
|
|
3372
|
-
|
|
3424
|
+
if (hasLayoutChanges2) {
|
|
3425
|
+
printDiff(
|
|
3426
|
+
result2.filePath,
|
|
3427
|
+
result2.originalContent,
|
|
3428
|
+
result2.newContent
|
|
3429
|
+
);
|
|
3430
|
+
}
|
|
3431
|
+
if (hasPackageJsonChanges2) {
|
|
3432
|
+
if (hasLayoutChanges2) {
|
|
3433
|
+
logger.break();
|
|
3434
|
+
}
|
|
3435
|
+
printDiff(
|
|
3436
|
+
packageJsonResult2.filePath,
|
|
3437
|
+
packageJsonResult2.originalContent,
|
|
3438
|
+
packageJsonResult2.newContent
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3373
3441
|
logger.break();
|
|
3374
|
-
|
|
3442
|
+
const { proceed } = await prompts({
|
|
3443
|
+
type: "confirm",
|
|
3444
|
+
name: "proceed",
|
|
3445
|
+
message: "Apply these changes?",
|
|
3446
|
+
initial: true
|
|
3447
|
+
});
|
|
3448
|
+
if (!proceed) {
|
|
3449
|
+
logger.break();
|
|
3450
|
+
logger.log("Agent addition cancelled.");
|
|
3451
|
+
} else {
|
|
3452
|
+
installPackagesWithFeedback(
|
|
3453
|
+
getPackagesToInstall(agentIntegration2, false),
|
|
3454
|
+
projectInfo.packageManager,
|
|
3455
|
+
projectInfo.projectRoot
|
|
3456
|
+
);
|
|
3457
|
+
if (hasLayoutChanges2) {
|
|
3458
|
+
applyTransformWithFeedback(result2);
|
|
3459
|
+
}
|
|
3460
|
+
if (hasPackageJsonChanges2) {
|
|
3461
|
+
applyPackageJsonWithFeedback(packageJsonResult2);
|
|
3462
|
+
}
|
|
3463
|
+
logger.break();
|
|
3464
|
+
logger.success(
|
|
3465
|
+
`${getAgentName(agentIntegration2)} has been added.`
|
|
3466
|
+
);
|
|
3467
|
+
}
|
|
3375
3468
|
}
|
|
3469
|
+
} else {
|
|
3376
3470
|
const { agent } = await prompts({
|
|
3377
3471
|
type: "select",
|
|
3378
3472
|
name: "agent",
|
|
3379
|
-
message: `Which ${highlighter.info("agent
|
|
3473
|
+
message: `Which ${highlighter.info("agent")} would you like to connect?`,
|
|
3380
3474
|
choices: [
|
|
3381
3475
|
...availableAgents.map((innerAgent) => ({
|
|
3382
3476
|
title: getAgentName(innerAgent),
|
|
@@ -3389,7 +3483,7 @@ var init = new Command().name("init").description("initialize React Grab in your
|
|
|
3389
3483
|
logger.break();
|
|
3390
3484
|
process.exit(0);
|
|
3391
3485
|
}
|
|
3392
|
-
|
|
3486
|
+
agentIntegration2 = agent;
|
|
3393
3487
|
let agentsToRemove2 = [];
|
|
3394
3488
|
if (projectInfo.installedAgents.length > 0) {
|
|
3395
3489
|
const installedNames = formatInstalledAgentNames2(
|
|
@@ -3687,7 +3781,7 @@ var init = new Command().name("init").description("initialize React Grab in your
|
|
|
3687
3781
|
const { wantAddAgent } = await prompts({
|
|
3688
3782
|
type: "confirm",
|
|
3689
3783
|
name: "wantAddAgent",
|
|
3690
|
-
message: `Would you like to
|
|
3784
|
+
message: `Would you like to ${highlighter.info("connect it to your agent")}?`,
|
|
3691
3785
|
initial: false
|
|
3692
3786
|
});
|
|
3693
3787
|
if (wantAddAgent === void 0) {
|
|
@@ -3710,11 +3804,12 @@ var init = new Command().name("init").description("initialize React Grab in your
|
|
|
3710
3804
|
logger.success("MCP server has been configured.");
|
|
3711
3805
|
logger.log("Continuing with React Grab installation...");
|
|
3712
3806
|
logger.break();
|
|
3807
|
+
agentIntegration = "mcp";
|
|
3713
3808
|
} else {
|
|
3714
3809
|
const { agent } = await prompts({
|
|
3715
3810
|
type: "select",
|
|
3716
3811
|
name: "agent",
|
|
3717
|
-
message: `Which ${highlighter.info("agent
|
|
3812
|
+
message: `Which ${highlighter.info("agent")} would you like to connect?`,
|
|
3718
3813
|
choices: [
|
|
3719
3814
|
...AGENTS.map((innerAgent) => ({
|
|
3720
3815
|
title: getAgentName(innerAgent),
|
|
@@ -3838,11 +3933,8 @@ var init = new Command().name("init").description("initialize React Grab in your
|
|
|
3838
3933
|
reportToCli("error", void 0, error);
|
|
3839
3934
|
}
|
|
3840
3935
|
});
|
|
3841
|
-
var VERSION4 = "0.1.
|
|
3842
|
-
var remove = new Command().name("remove").description("
|
|
3843
|
-
"[agent]",
|
|
3844
|
-
"agent to remove (claude-code, cursor, opencode, codex, gemini, amp, ami)"
|
|
3845
|
-
).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
3936
|
+
var VERSION4 = "0.1.14";
|
|
3937
|
+
var remove = new Command().name("remove").description("disconnect React Grab from your agent").argument("[agent]", `agent to disconnect (${AGENTS.join(", ")}, mcp)`).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
3846
3938
|
"-c, --cwd <cwd>",
|
|
3847
3939
|
"working directory (defaults to current directory)",
|
|
3848
3940
|
process.cwd()
|
|
@@ -3868,7 +3960,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
3868
3960
|
if (projectInfo.installedAgents.length === 0) {
|
|
3869
3961
|
preflightSpinner.succeed();
|
|
3870
3962
|
logger.break();
|
|
3871
|
-
logger.warn("No agent
|
|
3963
|
+
logger.warn("No agent connections are installed.");
|
|
3872
3964
|
logger.break();
|
|
3873
3965
|
process.exit(0);
|
|
3874
3966
|
}
|
|
@@ -3879,7 +3971,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
3879
3971
|
logger.break();
|
|
3880
3972
|
logger.error(`Agent ${highlighter.info(agentArg)} is not installed.`);
|
|
3881
3973
|
logger.log(
|
|
3882
|
-
`Installed agents: ${projectInfo.installedAgents.map(
|
|
3974
|
+
`Installed agents: ${projectInfo.installedAgents.map(getAgentDisplayName).join(", ")}`
|
|
3883
3975
|
);
|
|
3884
3976
|
logger.break();
|
|
3885
3977
|
process.exit(1);
|
|
@@ -3890,9 +3982,9 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
3890
3982
|
const { agent } = await prompts({
|
|
3891
3983
|
type: "select",
|
|
3892
3984
|
name: "agent",
|
|
3893
|
-
message: `Which ${highlighter.info("agent
|
|
3985
|
+
message: `Which ${highlighter.info("agent")} would you like to disconnect?`,
|
|
3894
3986
|
choices: projectInfo.installedAgents.map((innerAgent) => ({
|
|
3895
|
-
title:
|
|
3987
|
+
title: getAgentDisplayName(innerAgent),
|
|
3896
3988
|
value: innerAgent
|
|
3897
3989
|
}))
|
|
3898
3990
|
});
|
|
@@ -3903,7 +3995,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
3903
3995
|
agentToRemove = agent;
|
|
3904
3996
|
} else {
|
|
3905
3997
|
logger.break();
|
|
3906
|
-
logger.error("Please specify an agent to
|
|
3998
|
+
logger.error("Please specify an agent to disconnect.");
|
|
3907
3999
|
logger.error(
|
|
3908
4000
|
"Installed agents: " + projectInfo.installedAgents.join(", ")
|
|
3909
4001
|
);
|
|
@@ -3911,7 +4003,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
3911
4003
|
process.exit(1);
|
|
3912
4004
|
}
|
|
3913
4005
|
const removingSpinner = spinner(
|
|
3914
|
-
`Preparing to remove ${
|
|
4006
|
+
`Preparing to remove ${getAgentDisplayName(agentToRemove)}.`
|
|
3915
4007
|
).start();
|
|
3916
4008
|
removingSpinner.succeed();
|
|
3917
4009
|
const result = previewAgentRemoval(
|
|
@@ -4008,7 +4100,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
4008
4100
|
}
|
|
4009
4101
|
logger.break();
|
|
4010
4102
|
logger.log(
|
|
4011
|
-
`${highlighter.success("Success!")} ${
|
|
4103
|
+
`${highlighter.success("Success!")} ${getAgentDisplayName(agentToRemove)} has been removed.`
|
|
4012
4104
|
);
|
|
4013
4105
|
logger.break();
|
|
4014
4106
|
} catch (error) {
|
|
@@ -4017,7 +4109,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
4017
4109
|
});
|
|
4018
4110
|
|
|
4019
4111
|
// src/cli.ts
|
|
4020
|
-
var VERSION5 = "0.1.
|
|
4112
|
+
var VERSION5 = "0.1.14";
|
|
4021
4113
|
var VERSION_API_URL = "https://www.react-grab.com/api/version";
|
|
4022
4114
|
process.on("SIGINT", () => process.exit(0));
|
|
4023
4115
|
process.on("SIGTERM", () => process.exit(0));
|