@react-grab/cli 0.1.8 → 0.1.10
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 +91 -5
- package/dist/cli.js +91 -5
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1831,9 +1831,39 @@ var previewPackageJsonAgentRemoval = (projectRoot, agent) => {
|
|
|
1831
1831
|
};
|
|
1832
1832
|
}
|
|
1833
1833
|
};
|
|
1834
|
+
var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDomain) => {
|
|
1835
|
+
const filePath = findReactGrabFile(projectRoot, framework, nextRouterType);
|
|
1836
|
+
if (!filePath) {
|
|
1837
|
+
return {
|
|
1838
|
+
success: false,
|
|
1839
|
+
filePath: "",
|
|
1840
|
+
message: "Could not find React Grab file"
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
const originalContent = fs.readFileSync(filePath, "utf-8");
|
|
1844
|
+
const newContent = originalContent.replace(
|
|
1845
|
+
/\/\/[^/\s"']+(?=\/(?:@?react-grab))/g,
|
|
1846
|
+
`//${targetCdnDomain}`
|
|
1847
|
+
);
|
|
1848
|
+
if (newContent === originalContent) {
|
|
1849
|
+
return {
|
|
1850
|
+
success: true,
|
|
1851
|
+
filePath,
|
|
1852
|
+
message: "CDN already set",
|
|
1853
|
+
noChanges: true
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
return {
|
|
1857
|
+
success: true,
|
|
1858
|
+
filePath,
|
|
1859
|
+
message: "Update CDN",
|
|
1860
|
+
originalContent,
|
|
1861
|
+
newContent
|
|
1862
|
+
};
|
|
1863
|
+
};
|
|
1834
1864
|
|
|
1835
1865
|
// src/commands/add.ts
|
|
1836
|
-
var VERSION = "0.1.
|
|
1866
|
+
var VERSION = "0.1.10";
|
|
1837
1867
|
var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
|
|
1838
1868
|
var add = new commander.Command().name("add").alias("install").description("add an agent integration").argument("[agent]", `agent to add (${AGENTS.join(", ")})`).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
1839
1869
|
"-c, --cwd <cwd>",
|
|
@@ -2169,7 +2199,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
|
|
|
2169
2199
|
var MAX_CONTEXT_LINES = 50;
|
|
2170
2200
|
|
|
2171
2201
|
// src/commands/configure.ts
|
|
2172
|
-
var VERSION2 = "0.1.
|
|
2202
|
+
var VERSION2 = "0.1.10";
|
|
2173
2203
|
var isMac = process.platform === "darwin";
|
|
2174
2204
|
var META_LABEL = isMac ? "Cmd" : "Win";
|
|
2175
2205
|
var ALT_LABEL = isMac ? "Option" : "Alt";
|
|
@@ -2374,6 +2404,9 @@ var configure = new commander.Command().name("configure").alias("config").descri
|
|
|
2374
2404
|
"--allow-input <boolean>",
|
|
2375
2405
|
"allow activation inside input fields (true/false)"
|
|
2376
2406
|
).option("--context-lines <lines>", "max context lines to include").option(
|
|
2407
|
+
"--cdn <domain>",
|
|
2408
|
+
"CDN domain (e.g., unpkg.com, custom.react-grab.com)"
|
|
2409
|
+
).option(
|
|
2377
2410
|
"-c, --cwd <cwd>",
|
|
2378
2411
|
"working directory (defaults to current directory)",
|
|
2379
2412
|
process.cwd()
|
|
@@ -2396,6 +2429,59 @@ var configure = new commander.Command().name("configure").alias("config").descri
|
|
|
2396
2429
|
process.exit(1);
|
|
2397
2430
|
}
|
|
2398
2431
|
preflightSpinner.succeed();
|
|
2432
|
+
if (opts.cdn) {
|
|
2433
|
+
const result2 = previewCdnTransform(
|
|
2434
|
+
projectInfo.projectRoot,
|
|
2435
|
+
projectInfo.framework,
|
|
2436
|
+
projectInfo.nextRouterType,
|
|
2437
|
+
opts.cdn
|
|
2438
|
+
);
|
|
2439
|
+
if (!result2.success) {
|
|
2440
|
+
logger.break();
|
|
2441
|
+
logger.error(result2.message);
|
|
2442
|
+
logger.break();
|
|
2443
|
+
process.exit(1);
|
|
2444
|
+
}
|
|
2445
|
+
if (result2.noChanges) {
|
|
2446
|
+
logger.break();
|
|
2447
|
+
logger.log("No changes needed.");
|
|
2448
|
+
logger.break();
|
|
2449
|
+
process.exit(0);
|
|
2450
|
+
}
|
|
2451
|
+
logger.break();
|
|
2452
|
+
printDiff(result2.filePath, result2.originalContent, result2.newContent);
|
|
2453
|
+
if (!opts.yes) {
|
|
2454
|
+
logger.break();
|
|
2455
|
+
const { proceed } = await prompts({
|
|
2456
|
+
type: "confirm",
|
|
2457
|
+
name: "proceed",
|
|
2458
|
+
message: "Apply these changes?",
|
|
2459
|
+
initial: true
|
|
2460
|
+
});
|
|
2461
|
+
if (!proceed) {
|
|
2462
|
+
logger.break();
|
|
2463
|
+
logger.log("Changes cancelled.");
|
|
2464
|
+
logger.break();
|
|
2465
|
+
process.exit(0);
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
const writeSpinner = spinner(
|
|
2469
|
+
`Applying changes to ${result2.filePath}.`
|
|
2470
|
+
).start();
|
|
2471
|
+
const writeResult = applyTransform(result2);
|
|
2472
|
+
if (!writeResult.success) {
|
|
2473
|
+
writeSpinner.fail();
|
|
2474
|
+
logger.break();
|
|
2475
|
+
logger.error(writeResult.error || "Failed to write file.");
|
|
2476
|
+
logger.break();
|
|
2477
|
+
process.exit(1);
|
|
2478
|
+
}
|
|
2479
|
+
writeSpinner.succeed();
|
|
2480
|
+
logger.break();
|
|
2481
|
+
logger.log(`${highlighter.success("Success!")} CDN updated.`);
|
|
2482
|
+
logger.break();
|
|
2483
|
+
return;
|
|
2484
|
+
}
|
|
2399
2485
|
const hasFlags = opts.key || opts.mode || opts.holdDuration || opts.allowInput || opts.contextLines;
|
|
2400
2486
|
logger.break();
|
|
2401
2487
|
logger.log(`Configure ${highlighter.info("React Grab")} options:`);
|
|
@@ -2669,7 +2755,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
|
|
|
2669
2755
|
};
|
|
2670
2756
|
|
|
2671
2757
|
// src/commands/init.ts
|
|
2672
|
-
var VERSION3 = "0.1.
|
|
2758
|
+
var VERSION3 = "0.1.10";
|
|
2673
2759
|
var REPORT_URL = "https://react-grab.com/api/report-cli";
|
|
2674
2760
|
var DOCS_URL = "https://github.com/aidenybai/react-grab";
|
|
2675
2761
|
var reportToCli = (type, config, error) => {
|
|
@@ -3405,7 +3491,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
|
|
|
3405
3491
|
reportToCli("error", void 0, error);
|
|
3406
3492
|
}
|
|
3407
3493
|
});
|
|
3408
|
-
var VERSION4 = "0.1.
|
|
3494
|
+
var VERSION4 = "0.1.10";
|
|
3409
3495
|
var remove = new commander.Command().name("remove").description("remove an agent integration").argument(
|
|
3410
3496
|
"[agent]",
|
|
3411
3497
|
"agent to remove (claude-code, cursor, opencode, codex, gemini, amp, ami)"
|
|
@@ -3584,7 +3670,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
|
|
|
3584
3670
|
});
|
|
3585
3671
|
|
|
3586
3672
|
// src/cli.ts
|
|
3587
|
-
var VERSION5 = "0.1.
|
|
3673
|
+
var VERSION5 = "0.1.10";
|
|
3588
3674
|
var VERSION_API_URL = "https://www.react-grab.com/api/version";
|
|
3589
3675
|
process.on("SIGINT", () => process.exit(0));
|
|
3590
3676
|
process.on("SIGTERM", () => process.exit(0));
|
package/dist/cli.js
CHANGED
|
@@ -1823,9 +1823,39 @@ var previewPackageJsonAgentRemoval = (projectRoot, agent) => {
|
|
|
1823
1823
|
};
|
|
1824
1824
|
}
|
|
1825
1825
|
};
|
|
1826
|
+
var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDomain) => {
|
|
1827
|
+
const filePath = findReactGrabFile(projectRoot, framework, nextRouterType);
|
|
1828
|
+
if (!filePath) {
|
|
1829
|
+
return {
|
|
1830
|
+
success: false,
|
|
1831
|
+
filePath: "",
|
|
1832
|
+
message: "Could not find React Grab file"
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
const originalContent = readFileSync(filePath, "utf-8");
|
|
1836
|
+
const newContent = originalContent.replace(
|
|
1837
|
+
/\/\/[^/\s"']+(?=\/(?:@?react-grab))/g,
|
|
1838
|
+
`//${targetCdnDomain}`
|
|
1839
|
+
);
|
|
1840
|
+
if (newContent === originalContent) {
|
|
1841
|
+
return {
|
|
1842
|
+
success: true,
|
|
1843
|
+
filePath,
|
|
1844
|
+
message: "CDN already set",
|
|
1845
|
+
noChanges: true
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
return {
|
|
1849
|
+
success: true,
|
|
1850
|
+
filePath,
|
|
1851
|
+
message: "Update CDN",
|
|
1852
|
+
originalContent,
|
|
1853
|
+
newContent
|
|
1854
|
+
};
|
|
1855
|
+
};
|
|
1826
1856
|
|
|
1827
1857
|
// src/commands/add.ts
|
|
1828
|
-
var VERSION = "0.1.
|
|
1858
|
+
var VERSION = "0.1.10";
|
|
1829
1859
|
var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
|
|
1830
1860
|
var add = new Command().name("add").alias("install").description("add an agent integration").argument("[agent]", `agent to add (${AGENTS.join(", ")})`).option("-y, --yes", "skip confirmation prompts", false).option(
|
|
1831
1861
|
"-c, --cwd <cwd>",
|
|
@@ -2161,7 +2191,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
|
|
|
2161
2191
|
var MAX_CONTEXT_LINES = 50;
|
|
2162
2192
|
|
|
2163
2193
|
// src/commands/configure.ts
|
|
2164
|
-
var VERSION2 = "0.1.
|
|
2194
|
+
var VERSION2 = "0.1.10";
|
|
2165
2195
|
var isMac = process.platform === "darwin";
|
|
2166
2196
|
var META_LABEL = isMac ? "Cmd" : "Win";
|
|
2167
2197
|
var ALT_LABEL = isMac ? "Option" : "Alt";
|
|
@@ -2366,6 +2396,9 @@ var configure = new Command().name("configure").alias("config").description("con
|
|
|
2366
2396
|
"--allow-input <boolean>",
|
|
2367
2397
|
"allow activation inside input fields (true/false)"
|
|
2368
2398
|
).option("--context-lines <lines>", "max context lines to include").option(
|
|
2399
|
+
"--cdn <domain>",
|
|
2400
|
+
"CDN domain (e.g., unpkg.com, custom.react-grab.com)"
|
|
2401
|
+
).option(
|
|
2369
2402
|
"-c, --cwd <cwd>",
|
|
2370
2403
|
"working directory (defaults to current directory)",
|
|
2371
2404
|
process.cwd()
|
|
@@ -2388,6 +2421,59 @@ var configure = new Command().name("configure").alias("config").description("con
|
|
|
2388
2421
|
process.exit(1);
|
|
2389
2422
|
}
|
|
2390
2423
|
preflightSpinner.succeed();
|
|
2424
|
+
if (opts.cdn) {
|
|
2425
|
+
const result2 = previewCdnTransform(
|
|
2426
|
+
projectInfo.projectRoot,
|
|
2427
|
+
projectInfo.framework,
|
|
2428
|
+
projectInfo.nextRouterType,
|
|
2429
|
+
opts.cdn
|
|
2430
|
+
);
|
|
2431
|
+
if (!result2.success) {
|
|
2432
|
+
logger.break();
|
|
2433
|
+
logger.error(result2.message);
|
|
2434
|
+
logger.break();
|
|
2435
|
+
process.exit(1);
|
|
2436
|
+
}
|
|
2437
|
+
if (result2.noChanges) {
|
|
2438
|
+
logger.break();
|
|
2439
|
+
logger.log("No changes needed.");
|
|
2440
|
+
logger.break();
|
|
2441
|
+
process.exit(0);
|
|
2442
|
+
}
|
|
2443
|
+
logger.break();
|
|
2444
|
+
printDiff(result2.filePath, result2.originalContent, result2.newContent);
|
|
2445
|
+
if (!opts.yes) {
|
|
2446
|
+
logger.break();
|
|
2447
|
+
const { proceed } = await prompts({
|
|
2448
|
+
type: "confirm",
|
|
2449
|
+
name: "proceed",
|
|
2450
|
+
message: "Apply these changes?",
|
|
2451
|
+
initial: true
|
|
2452
|
+
});
|
|
2453
|
+
if (!proceed) {
|
|
2454
|
+
logger.break();
|
|
2455
|
+
logger.log("Changes cancelled.");
|
|
2456
|
+
logger.break();
|
|
2457
|
+
process.exit(0);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
const writeSpinner = spinner(
|
|
2461
|
+
`Applying changes to ${result2.filePath}.`
|
|
2462
|
+
).start();
|
|
2463
|
+
const writeResult = applyTransform(result2);
|
|
2464
|
+
if (!writeResult.success) {
|
|
2465
|
+
writeSpinner.fail();
|
|
2466
|
+
logger.break();
|
|
2467
|
+
logger.error(writeResult.error || "Failed to write file.");
|
|
2468
|
+
logger.break();
|
|
2469
|
+
process.exit(1);
|
|
2470
|
+
}
|
|
2471
|
+
writeSpinner.succeed();
|
|
2472
|
+
logger.break();
|
|
2473
|
+
logger.log(`${highlighter.success("Success!")} CDN updated.`);
|
|
2474
|
+
logger.break();
|
|
2475
|
+
return;
|
|
2476
|
+
}
|
|
2391
2477
|
const hasFlags = opts.key || opts.mode || opts.holdDuration || opts.allowInput || opts.contextLines;
|
|
2392
2478
|
logger.break();
|
|
2393
2479
|
logger.log(`Configure ${highlighter.info("React Grab")} options:`);
|
|
@@ -2661,7 +2747,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
|
|
|
2661
2747
|
};
|
|
2662
2748
|
|
|
2663
2749
|
// src/commands/init.ts
|
|
2664
|
-
var VERSION3 = "0.1.
|
|
2750
|
+
var VERSION3 = "0.1.10";
|
|
2665
2751
|
var REPORT_URL = "https://react-grab.com/api/report-cli";
|
|
2666
2752
|
var DOCS_URL = "https://github.com/aidenybai/react-grab";
|
|
2667
2753
|
var reportToCli = (type, config, error) => {
|
|
@@ -3397,7 +3483,7 @@ var init = new Command().name("init").description("initialize React Grab in your
|
|
|
3397
3483
|
reportToCli("error", void 0, error);
|
|
3398
3484
|
}
|
|
3399
3485
|
});
|
|
3400
|
-
var VERSION4 = "0.1.
|
|
3486
|
+
var VERSION4 = "0.1.10";
|
|
3401
3487
|
var remove = new Command().name("remove").description("remove an agent integration").argument(
|
|
3402
3488
|
"[agent]",
|
|
3403
3489
|
"agent to remove (claude-code, cursor, opencode, codex, gemini, amp, ami)"
|
|
@@ -3576,7 +3662,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
|
|
|
3576
3662
|
});
|
|
3577
3663
|
|
|
3578
3664
|
// src/cli.ts
|
|
3579
|
-
var VERSION5 = "0.1.
|
|
3665
|
+
var VERSION5 = "0.1.10";
|
|
3580
3666
|
var VERSION_API_URL = "https://www.react-grab.com/api/version";
|
|
3581
3667
|
process.on("SIGINT", () => process.exit(0));
|
|
3582
3668
|
process.on("SIGTERM", () => process.exit(0));
|