@react-grab/cli 0.1.9 → 0.1.11

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 (3) hide show
  1. package/dist/cli.cjs +104 -13
  2. package/dist/cli.js +104 -13
  3. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -541,7 +541,8 @@ var AGENTS = [
541
541
  "codex",
542
542
  "gemini",
543
543
  "amp",
544
- "ami"
544
+ "ami",
545
+ "droid"
545
546
  ];
546
547
  var AGENT_NAMES = {
547
548
  "claude-code": "Claude Code",
@@ -550,7 +551,8 @@ var AGENT_NAMES = {
550
551
  codex: "Codex",
551
552
  gemini: "Gemini",
552
553
  amp: "Amp",
553
- ami: "Ami"
554
+ ami: "Ami",
555
+ droid: "Droid"
554
556
  };
555
557
  var NEXT_APP_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
556
558
  <Script
@@ -1831,9 +1833,42 @@ var previewPackageJsonAgentRemoval = (projectRoot, agent) => {
1831
1833
  };
1832
1834
  }
1833
1835
  };
1836
+ var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDomain) => {
1837
+ const filePath = findReactGrabFile(projectRoot, framework, nextRouterType);
1838
+ if (!filePath) {
1839
+ return {
1840
+ success: false,
1841
+ filePath: "",
1842
+ message: "Could not find React Grab file"
1843
+ };
1844
+ }
1845
+ const originalContent = fs.readFileSync(filePath, "utf-8");
1846
+ const newContent = originalContent.replace(
1847
+ /(https?:)?\/\/[^/\s"']+(?=\/(?:@?react-grab))/g,
1848
+ `//${targetCdnDomain}`
1849
+ ).replace(
1850
+ /(https?:)?\/\/[^/\s"']*react-grab[^/\s"']*\.com(?=\/script\.js)/g,
1851
+ `//${targetCdnDomain}`
1852
+ );
1853
+ if (newContent === originalContent) {
1854
+ return {
1855
+ success: true,
1856
+ filePath,
1857
+ message: "CDN already set",
1858
+ noChanges: true
1859
+ };
1860
+ }
1861
+ return {
1862
+ success: true,
1863
+ filePath,
1864
+ message: "Update CDN",
1865
+ originalContent,
1866
+ newContent
1867
+ };
1868
+ };
1834
1869
 
1835
1870
  // src/commands/add.ts
1836
- var VERSION = "0.1.9";
1871
+ var VERSION = "0.1.11";
1837
1872
  var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
1838
1873
  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
1874
  "-c, --cwd <cwd>",
@@ -1929,7 +1964,7 @@ var add = new commander.Command().name("add").alias("install").description("add
1929
1964
  const { agent } = await prompts({
1930
1965
  type: "select",
1931
1966
  name: "agent",
1932
- message: `Which ${highlighter.info("agent integration")} would you like to add?`,
1967
+ message: `Which ${highlighter.info("coding agent")} would you like to connect?`,
1933
1968
  choices: availableAgents.map((availableAgent) => ({
1934
1969
  title: AGENT_NAMES[availableAgent],
1935
1970
  value: availableAgent
@@ -2169,7 +2204,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
2169
2204
  var MAX_CONTEXT_LINES = 50;
2170
2205
 
2171
2206
  // src/commands/configure.ts
2172
- var VERSION2 = "0.1.9";
2207
+ var VERSION2 = "0.1.11";
2173
2208
  var isMac = process.platform === "darwin";
2174
2209
  var META_LABEL = isMac ? "Cmd" : "Win";
2175
2210
  var ALT_LABEL = isMac ? "Option" : "Alt";
@@ -2374,6 +2409,9 @@ var configure = new commander.Command().name("configure").alias("config").descri
2374
2409
  "--allow-input <boolean>",
2375
2410
  "allow activation inside input fields (true/false)"
2376
2411
  ).option("--context-lines <lines>", "max context lines to include").option(
2412
+ "--cdn <domain>",
2413
+ "CDN domain (e.g., unpkg.com, custom.react-grab.com)"
2414
+ ).option(
2377
2415
  "-c, --cwd <cwd>",
2378
2416
  "working directory (defaults to current directory)",
2379
2417
  process.cwd()
@@ -2396,6 +2434,59 @@ var configure = new commander.Command().name("configure").alias("config").descri
2396
2434
  process.exit(1);
2397
2435
  }
2398
2436
  preflightSpinner.succeed();
2437
+ if (opts.cdn) {
2438
+ const result2 = previewCdnTransform(
2439
+ projectInfo.projectRoot,
2440
+ projectInfo.framework,
2441
+ projectInfo.nextRouterType,
2442
+ opts.cdn
2443
+ );
2444
+ if (!result2.success) {
2445
+ logger.break();
2446
+ logger.error(result2.message);
2447
+ logger.break();
2448
+ process.exit(1);
2449
+ }
2450
+ if (result2.noChanges) {
2451
+ logger.break();
2452
+ logger.log("No changes needed.");
2453
+ logger.break();
2454
+ process.exit(0);
2455
+ }
2456
+ logger.break();
2457
+ printDiff(result2.filePath, result2.originalContent, result2.newContent);
2458
+ if (!opts.yes) {
2459
+ logger.break();
2460
+ const { proceed } = await prompts({
2461
+ type: "confirm",
2462
+ name: "proceed",
2463
+ message: "Apply these changes?",
2464
+ initial: true
2465
+ });
2466
+ if (!proceed) {
2467
+ logger.break();
2468
+ logger.log("Changes cancelled.");
2469
+ logger.break();
2470
+ process.exit(0);
2471
+ }
2472
+ }
2473
+ const writeSpinner = spinner(
2474
+ `Applying changes to ${result2.filePath}.`
2475
+ ).start();
2476
+ const writeResult = applyTransform(result2);
2477
+ if (!writeResult.success) {
2478
+ writeSpinner.fail();
2479
+ logger.break();
2480
+ logger.error(writeResult.error || "Failed to write file.");
2481
+ logger.break();
2482
+ process.exit(1);
2483
+ }
2484
+ writeSpinner.succeed();
2485
+ logger.break();
2486
+ logger.log(`${highlighter.success("Success!")} CDN updated.`);
2487
+ logger.break();
2488
+ return;
2489
+ }
2399
2490
  const hasFlags = opts.key || opts.mode || opts.holdDuration || opts.allowInput || opts.contextLines;
2400
2491
  logger.break();
2401
2492
  logger.log(`Configure ${highlighter.info("React Grab")} options:`);
@@ -2669,7 +2760,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
2669
2760
  };
2670
2761
 
2671
2762
  // src/commands/init.ts
2672
- var VERSION3 = "0.1.9";
2763
+ var VERSION3 = "0.1.11";
2673
2764
  var REPORT_URL = "https://react-grab.com/api/report-cli";
2674
2765
  var DOCS_URL = "https://github.com/aidenybai/react-grab";
2675
2766
  var reportToCli = (type, config, error) => {
@@ -2725,7 +2816,7 @@ var formatActivationKeyDisplay2 = (activationKey) => {
2725
2816
  };
2726
2817
  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(
2727
2818
  "-a, --agent <agent>",
2728
- "agent integration (claude-code, cursor, opencode, codex, gemini, amp)"
2819
+ "agent integration (claude-code, cursor, opencode, codex, gemini, amp, droid)"
2729
2820
  ).option(
2730
2821
  "-k, --key <key>",
2731
2822
  "activation key (e.g., Meta+K, Ctrl+Shift+G, Space)"
@@ -2949,7 +3040,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
2949
3040
  const { wantAddAgent } = await prompts({
2950
3041
  type: "confirm",
2951
3042
  name: "wantAddAgent",
2952
- message: `Would you like to add an ${highlighter.info("agent integration")}?`,
3043
+ message: `Would you like to connect React Grab to a ${highlighter.info("coding agent")}? ${highlighter.dim("(optional)")}`,
2953
3044
  initial: false
2954
3045
  });
2955
3046
  if (wantAddAgent === void 0) {
@@ -2960,7 +3051,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
2960
3051
  const { agent } = await prompts({
2961
3052
  type: "select",
2962
3053
  name: "agent",
2963
- message: `Which ${highlighter.info("agent integration")} would you like to add?`,
3054
+ message: `Which ${highlighter.info("coding agent")} would you like to connect?`,
2964
3055
  choices: [
2965
3056
  ...availableAgents.map((innerAgent) => ({
2966
3057
  title: getAgentName(innerAgent),
@@ -3271,7 +3362,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
3271
3362
  const { wantAddAgent } = await prompts({
3272
3363
  type: "confirm",
3273
3364
  name: "wantAddAgent",
3274
- message: `Would you like to add an ${highlighter.info("agent integration")}?`,
3365
+ message: `Would you like to connect React Grab to a ${highlighter.info("coding agent")}? ${highlighter.dim("(optional)")}`,
3275
3366
  initial: false
3276
3367
  });
3277
3368
  if (wantAddAgent === void 0) {
@@ -3282,7 +3373,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
3282
3373
  const { agent } = await prompts({
3283
3374
  type: "select",
3284
3375
  name: "agent",
3285
- message: `Which ${highlighter.info("agent integration")} would you like to add?`,
3376
+ message: `Which ${highlighter.info("coding agent")} would you like to connect?`,
3286
3377
  choices: [
3287
3378
  ...AGENTS.map((innerAgent) => ({
3288
3379
  title: getAgentName(innerAgent),
@@ -3405,7 +3496,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
3405
3496
  reportToCli("error", void 0, error);
3406
3497
  }
3407
3498
  });
3408
- var VERSION4 = "0.1.9";
3499
+ var VERSION4 = "0.1.11";
3409
3500
  var remove = new commander.Command().name("remove").description("remove an agent integration").argument(
3410
3501
  "[agent]",
3411
3502
  "agent to remove (claude-code, cursor, opencode, codex, gemini, amp, ami)"
@@ -3584,7 +3675,7 @@ var remove = new commander.Command().name("remove").description("remove an agent
3584
3675
  });
3585
3676
 
3586
3677
  // src/cli.ts
3587
- var VERSION5 = "0.1.9";
3678
+ var VERSION5 = "0.1.11";
3588
3679
  var VERSION_API_URL = "https://www.react-grab.com/api/version";
3589
3680
  process.on("SIGINT", () => process.exit(0));
3590
3681
  process.on("SIGTERM", () => process.exit(0));
package/dist/cli.js CHANGED
@@ -533,7 +533,8 @@ var AGENTS = [
533
533
  "codex",
534
534
  "gemini",
535
535
  "amp",
536
- "ami"
536
+ "ami",
537
+ "droid"
537
538
  ];
538
539
  var AGENT_NAMES = {
539
540
  "claude-code": "Claude Code",
@@ -542,7 +543,8 @@ var AGENT_NAMES = {
542
543
  codex: "Codex",
543
544
  gemini: "Gemini",
544
545
  amp: "Amp",
545
- ami: "Ami"
546
+ ami: "Ami",
547
+ droid: "Droid"
546
548
  };
547
549
  var NEXT_APP_ROUTER_SCRIPT = `{process.env.NODE_ENV === "development" && (
548
550
  <Script
@@ -1823,9 +1825,42 @@ var previewPackageJsonAgentRemoval = (projectRoot, agent) => {
1823
1825
  };
1824
1826
  }
1825
1827
  };
1828
+ var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDomain) => {
1829
+ const filePath = findReactGrabFile(projectRoot, framework, nextRouterType);
1830
+ if (!filePath) {
1831
+ return {
1832
+ success: false,
1833
+ filePath: "",
1834
+ message: "Could not find React Grab file"
1835
+ };
1836
+ }
1837
+ const originalContent = readFileSync(filePath, "utf-8");
1838
+ const newContent = originalContent.replace(
1839
+ /(https?:)?\/\/[^/\s"']+(?=\/(?:@?react-grab))/g,
1840
+ `//${targetCdnDomain}`
1841
+ ).replace(
1842
+ /(https?:)?\/\/[^/\s"']*react-grab[^/\s"']*\.com(?=\/script\.js)/g,
1843
+ `//${targetCdnDomain}`
1844
+ );
1845
+ if (newContent === originalContent) {
1846
+ return {
1847
+ success: true,
1848
+ filePath,
1849
+ message: "CDN already set",
1850
+ noChanges: true
1851
+ };
1852
+ }
1853
+ return {
1854
+ success: true,
1855
+ filePath,
1856
+ message: "Update CDN",
1857
+ originalContent,
1858
+ newContent
1859
+ };
1860
+ };
1826
1861
 
1827
1862
  // src/commands/add.ts
1828
- var VERSION = "0.1.9";
1863
+ var VERSION = "0.1.11";
1829
1864
  var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
1830
1865
  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
1866
  "-c, --cwd <cwd>",
@@ -1921,7 +1956,7 @@ var add = new Command().name("add").alias("install").description("add an agent i
1921
1956
  const { agent } = await prompts({
1922
1957
  type: "select",
1923
1958
  name: "agent",
1924
- message: `Which ${highlighter.info("agent integration")} would you like to add?`,
1959
+ message: `Which ${highlighter.info("coding agent")} would you like to connect?`,
1925
1960
  choices: availableAgents.map((availableAgent) => ({
1926
1961
  title: AGENT_NAMES[availableAgent],
1927
1962
  value: availableAgent
@@ -2161,7 +2196,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
2161
2196
  var MAX_CONTEXT_LINES = 50;
2162
2197
 
2163
2198
  // src/commands/configure.ts
2164
- var VERSION2 = "0.1.9";
2199
+ var VERSION2 = "0.1.11";
2165
2200
  var isMac = process.platform === "darwin";
2166
2201
  var META_LABEL = isMac ? "Cmd" : "Win";
2167
2202
  var ALT_LABEL = isMac ? "Option" : "Alt";
@@ -2366,6 +2401,9 @@ var configure = new Command().name("configure").alias("config").description("con
2366
2401
  "--allow-input <boolean>",
2367
2402
  "allow activation inside input fields (true/false)"
2368
2403
  ).option("--context-lines <lines>", "max context lines to include").option(
2404
+ "--cdn <domain>",
2405
+ "CDN domain (e.g., unpkg.com, custom.react-grab.com)"
2406
+ ).option(
2369
2407
  "-c, --cwd <cwd>",
2370
2408
  "working directory (defaults to current directory)",
2371
2409
  process.cwd()
@@ -2388,6 +2426,59 @@ var configure = new Command().name("configure").alias("config").description("con
2388
2426
  process.exit(1);
2389
2427
  }
2390
2428
  preflightSpinner.succeed();
2429
+ if (opts.cdn) {
2430
+ const result2 = previewCdnTransform(
2431
+ projectInfo.projectRoot,
2432
+ projectInfo.framework,
2433
+ projectInfo.nextRouterType,
2434
+ opts.cdn
2435
+ );
2436
+ if (!result2.success) {
2437
+ logger.break();
2438
+ logger.error(result2.message);
2439
+ logger.break();
2440
+ process.exit(1);
2441
+ }
2442
+ if (result2.noChanges) {
2443
+ logger.break();
2444
+ logger.log("No changes needed.");
2445
+ logger.break();
2446
+ process.exit(0);
2447
+ }
2448
+ logger.break();
2449
+ printDiff(result2.filePath, result2.originalContent, result2.newContent);
2450
+ if (!opts.yes) {
2451
+ logger.break();
2452
+ const { proceed } = await prompts({
2453
+ type: "confirm",
2454
+ name: "proceed",
2455
+ message: "Apply these changes?",
2456
+ initial: true
2457
+ });
2458
+ if (!proceed) {
2459
+ logger.break();
2460
+ logger.log("Changes cancelled.");
2461
+ logger.break();
2462
+ process.exit(0);
2463
+ }
2464
+ }
2465
+ const writeSpinner = spinner(
2466
+ `Applying changes to ${result2.filePath}.`
2467
+ ).start();
2468
+ const writeResult = applyTransform(result2);
2469
+ if (!writeResult.success) {
2470
+ writeSpinner.fail();
2471
+ logger.break();
2472
+ logger.error(writeResult.error || "Failed to write file.");
2473
+ logger.break();
2474
+ process.exit(1);
2475
+ }
2476
+ writeSpinner.succeed();
2477
+ logger.break();
2478
+ logger.log(`${highlighter.success("Success!")} CDN updated.`);
2479
+ logger.break();
2480
+ return;
2481
+ }
2391
2482
  const hasFlags = opts.key || opts.mode || opts.holdDuration || opts.allowInput || opts.contextLines;
2392
2483
  logger.break();
2393
2484
  logger.log(`Configure ${highlighter.info("React Grab")} options:`);
@@ -2661,7 +2752,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
2661
2752
  };
2662
2753
 
2663
2754
  // src/commands/init.ts
2664
- var VERSION3 = "0.1.9";
2755
+ var VERSION3 = "0.1.11";
2665
2756
  var REPORT_URL = "https://react-grab.com/api/report-cli";
2666
2757
  var DOCS_URL = "https://github.com/aidenybai/react-grab";
2667
2758
  var reportToCli = (type, config, error) => {
@@ -2717,7 +2808,7 @@ var formatActivationKeyDisplay2 = (activationKey) => {
2717
2808
  };
2718
2809
  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(
2719
2810
  "-a, --agent <agent>",
2720
- "agent integration (claude-code, cursor, opencode, codex, gemini, amp)"
2811
+ "agent integration (claude-code, cursor, opencode, codex, gemini, amp, droid)"
2721
2812
  ).option(
2722
2813
  "-k, --key <key>",
2723
2814
  "activation key (e.g., Meta+K, Ctrl+Shift+G, Space)"
@@ -2941,7 +3032,7 @@ var init = new Command().name("init").description("initialize React Grab in your
2941
3032
  const { wantAddAgent } = await prompts({
2942
3033
  type: "confirm",
2943
3034
  name: "wantAddAgent",
2944
- message: `Would you like to add an ${highlighter.info("agent integration")}?`,
3035
+ message: `Would you like to connect React Grab to a ${highlighter.info("coding agent")}? ${highlighter.dim("(optional)")}`,
2945
3036
  initial: false
2946
3037
  });
2947
3038
  if (wantAddAgent === void 0) {
@@ -2952,7 +3043,7 @@ var init = new Command().name("init").description("initialize React Grab in your
2952
3043
  const { agent } = await prompts({
2953
3044
  type: "select",
2954
3045
  name: "agent",
2955
- message: `Which ${highlighter.info("agent integration")} would you like to add?`,
3046
+ message: `Which ${highlighter.info("coding agent")} would you like to connect?`,
2956
3047
  choices: [
2957
3048
  ...availableAgents.map((innerAgent) => ({
2958
3049
  title: getAgentName(innerAgent),
@@ -3263,7 +3354,7 @@ var init = new Command().name("init").description("initialize React Grab in your
3263
3354
  const { wantAddAgent } = await prompts({
3264
3355
  type: "confirm",
3265
3356
  name: "wantAddAgent",
3266
- message: `Would you like to add an ${highlighter.info("agent integration")}?`,
3357
+ message: `Would you like to connect React Grab to a ${highlighter.info("coding agent")}? ${highlighter.dim("(optional)")}`,
3267
3358
  initial: false
3268
3359
  });
3269
3360
  if (wantAddAgent === void 0) {
@@ -3274,7 +3365,7 @@ var init = new Command().name("init").description("initialize React Grab in your
3274
3365
  const { agent } = await prompts({
3275
3366
  type: "select",
3276
3367
  name: "agent",
3277
- message: `Which ${highlighter.info("agent integration")} would you like to add?`,
3368
+ message: `Which ${highlighter.info("coding agent")} would you like to connect?`,
3278
3369
  choices: [
3279
3370
  ...AGENTS.map((innerAgent) => ({
3280
3371
  title: getAgentName(innerAgent),
@@ -3397,7 +3488,7 @@ var init = new Command().name("init").description("initialize React Grab in your
3397
3488
  reportToCli("error", void 0, error);
3398
3489
  }
3399
3490
  });
3400
- var VERSION4 = "0.1.9";
3491
+ var VERSION4 = "0.1.11";
3401
3492
  var remove = new Command().name("remove").description("remove an agent integration").argument(
3402
3493
  "[agent]",
3403
3494
  "agent to remove (claude-code, cursor, opencode, codex, gemini, amp, ami)"
@@ -3576,7 +3667,7 @@ var remove = new Command().name("remove").description("remove an agent integrati
3576
3667
  });
3577
3668
 
3578
3669
  // src/cli.ts
3579
- var VERSION5 = "0.1.9";
3670
+ var VERSION5 = "0.1.11";
3580
3671
  var VERSION_API_URL = "https://www.react-grab.com/api/version";
3581
3672
  process.on("SIGINT", () => process.exit(0));
3582
3673
  process.on("SIGTERM", () => process.exit(0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-grab/cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "bin": {
5
5
  "react-grab": "./dist/cli.js"
6
6
  },