@react-grab/cli 0.1.27 → 0.1.28
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 +28 -9
- package/dist/cli.js +29 -10
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -345,10 +345,29 @@ var scanDirectoryForProjects = (rootDirectory, ignorer, maxDepth, currentDepth =
|
|
|
345
345
|
var MAX_SCAN_DEPTH = 2;
|
|
346
346
|
var findReactProjects = (projectRoot) => {
|
|
347
347
|
if (detectMonorepo(projectRoot)) {
|
|
348
|
-
|
|
348
|
+
const workspaceProjects = findWorkspaceProjects(projectRoot);
|
|
349
|
+
if (workspaceProjects.length > 0) {
|
|
350
|
+
return workspaceProjects;
|
|
351
|
+
}
|
|
349
352
|
}
|
|
350
353
|
const ignorer = loadGitignore(projectRoot);
|
|
351
|
-
|
|
354
|
+
const scannedProjects = scanDirectoryForProjects(
|
|
355
|
+
projectRoot,
|
|
356
|
+
ignorer,
|
|
357
|
+
MAX_SCAN_DEPTH
|
|
358
|
+
);
|
|
359
|
+
if (scannedProjects.length > 0) {
|
|
360
|
+
return scannedProjects;
|
|
361
|
+
}
|
|
362
|
+
let currentDirectory = path.dirname(projectRoot);
|
|
363
|
+
while (currentDirectory !== path.dirname(currentDirectory)) {
|
|
364
|
+
const parentProject = buildReactProject(currentDirectory);
|
|
365
|
+
if (parentProject) {
|
|
366
|
+
return [parentProject];
|
|
367
|
+
}
|
|
368
|
+
currentDirectory = path.dirname(currentDirectory);
|
|
369
|
+
}
|
|
370
|
+
return [];
|
|
352
371
|
};
|
|
353
372
|
var hasReactGrabInFile = (filePath) => {
|
|
354
373
|
if (!fs.existsSync(filePath)) return false;
|
|
@@ -414,7 +433,6 @@ var AGENT_PACKAGES = [
|
|
|
414
433
|
"@react-grab/codex",
|
|
415
434
|
"@react-grab/gemini",
|
|
416
435
|
"@react-grab/amp",
|
|
417
|
-
"@react-grab/ami",
|
|
418
436
|
"@react-grab/droid",
|
|
419
437
|
"@react-grab/copilot",
|
|
420
438
|
"@react-grab/mcp"
|
|
@@ -617,7 +635,8 @@ var installPackages = (packages, packageManager, projectRoot, isDev = true) => {
|
|
|
617
635
|
`);
|
|
618
636
|
child_process.execSync(fullCommand, {
|
|
619
637
|
cwd: projectRoot,
|
|
620
|
-
stdio: "inherit"
|
|
638
|
+
stdio: "inherit",
|
|
639
|
+
env: { ...process.env, REACT_GRAB_INIT: "1" }
|
|
621
640
|
});
|
|
622
641
|
};
|
|
623
642
|
var getPackagesToInstall = (agent, includeReactGrab = true) => {
|
|
@@ -2253,7 +2272,7 @@ var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDoma
|
|
|
2253
2272
|
};
|
|
2254
2273
|
|
|
2255
2274
|
// src/commands/add.ts
|
|
2256
|
-
var VERSION = "0.1.
|
|
2275
|
+
var VERSION = "0.1.28";
|
|
2257
2276
|
var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
|
|
2258
2277
|
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(
|
|
2259
2278
|
"-c, --cwd <cwd>",
|
|
@@ -2614,7 +2633,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
|
|
|
2614
2633
|
var MAX_CONTEXT_LINES = 50;
|
|
2615
2634
|
|
|
2616
2635
|
// src/commands/configure.ts
|
|
2617
|
-
var VERSION2 = "0.1.
|
|
2636
|
+
var VERSION2 = "0.1.28";
|
|
2618
2637
|
var isMac = process.platform === "darwin";
|
|
2619
2638
|
var META_LABEL = isMac ? "Cmd" : "Win";
|
|
2620
2639
|
var ALT_LABEL = isMac ? "Option" : "Alt";
|
|
@@ -3170,7 +3189,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
|
|
|
3170
3189
|
};
|
|
3171
3190
|
|
|
3172
3191
|
// src/commands/init.ts
|
|
3173
|
-
var VERSION3 = "0.1.
|
|
3192
|
+
var VERSION3 = "0.1.28";
|
|
3174
3193
|
var REPORT_URL = "https://react-grab.com/api/report-cli";
|
|
3175
3194
|
var DOCS_URL = "https://github.com/aidenybai/react-grab";
|
|
3176
3195
|
var reportToCli = (type, config, error) => {
|
|
@@ -4029,7 +4048,7 @@ var init = new commander.Command().name("init").description("initialize React Gr
|
|
|
4029
4048
|
reportToCli("error", void 0, error);
|
|
4030
4049
|
}
|
|
4031
4050
|
});
|
|
4032
|
-
var VERSION4 = "0.1.
|
|
4051
|
+
var VERSION4 = "0.1.28";
|
|
4033
4052
|
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(
|
|
4034
4053
|
"-c, --cwd <cwd>",
|
|
4035
4054
|
"working directory (defaults to current directory)",
|
|
@@ -4205,7 +4224,7 @@ var remove = new commander.Command().name("remove").description("disconnect Reac
|
|
|
4205
4224
|
});
|
|
4206
4225
|
|
|
4207
4226
|
// src/cli.ts
|
|
4208
|
-
var VERSION5 = "0.1.
|
|
4227
|
+
var VERSION5 = "0.1.28";
|
|
4209
4228
|
var VERSION_API_URL = "https://www.react-grab.com/api/version";
|
|
4210
4229
|
process.on("SIGINT", () => process.exit(0));
|
|
4211
4230
|
process.on("SIGTERM", () => process.exit(0));
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import pc from 'picocolors';
|
|
|
4
4
|
import basePrompts from 'prompts';
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
6
|
import fs, { existsSync, readFileSync, writeFileSync, accessSync, constants, readdirSync } from 'fs';
|
|
7
|
-
import path, { resolve, join, relative, basename } from 'path';
|
|
7
|
+
import path, { resolve, join, dirname, relative, basename } from 'path';
|
|
8
8
|
import { detect } from '@antfu/ni';
|
|
9
9
|
import ignore from 'ignore';
|
|
10
10
|
import os from 'os';
|
|
@@ -312,10 +312,29 @@ var scanDirectoryForProjects = (rootDirectory, ignorer, maxDepth, currentDepth =
|
|
|
312
312
|
var MAX_SCAN_DEPTH = 2;
|
|
313
313
|
var findReactProjects = (projectRoot) => {
|
|
314
314
|
if (detectMonorepo(projectRoot)) {
|
|
315
|
-
|
|
315
|
+
const workspaceProjects = findWorkspaceProjects(projectRoot);
|
|
316
|
+
if (workspaceProjects.length > 0) {
|
|
317
|
+
return workspaceProjects;
|
|
318
|
+
}
|
|
316
319
|
}
|
|
317
320
|
const ignorer = loadGitignore(projectRoot);
|
|
318
|
-
|
|
321
|
+
const scannedProjects = scanDirectoryForProjects(
|
|
322
|
+
projectRoot,
|
|
323
|
+
ignorer,
|
|
324
|
+
MAX_SCAN_DEPTH
|
|
325
|
+
);
|
|
326
|
+
if (scannedProjects.length > 0) {
|
|
327
|
+
return scannedProjects;
|
|
328
|
+
}
|
|
329
|
+
let currentDirectory = dirname(projectRoot);
|
|
330
|
+
while (currentDirectory !== dirname(currentDirectory)) {
|
|
331
|
+
const parentProject = buildReactProject(currentDirectory);
|
|
332
|
+
if (parentProject) {
|
|
333
|
+
return [parentProject];
|
|
334
|
+
}
|
|
335
|
+
currentDirectory = dirname(currentDirectory);
|
|
336
|
+
}
|
|
337
|
+
return [];
|
|
319
338
|
};
|
|
320
339
|
var hasReactGrabInFile = (filePath) => {
|
|
321
340
|
if (!existsSync(filePath)) return false;
|
|
@@ -381,7 +400,6 @@ var AGENT_PACKAGES = [
|
|
|
381
400
|
"@react-grab/codex",
|
|
382
401
|
"@react-grab/gemini",
|
|
383
402
|
"@react-grab/amp",
|
|
384
|
-
"@react-grab/ami",
|
|
385
403
|
"@react-grab/droid",
|
|
386
404
|
"@react-grab/copilot",
|
|
387
405
|
"@react-grab/mcp"
|
|
@@ -584,7 +602,8 @@ var installPackages = (packages, packageManager, projectRoot, isDev = true) => {
|
|
|
584
602
|
`);
|
|
585
603
|
execSync(fullCommand, {
|
|
586
604
|
cwd: projectRoot,
|
|
587
|
-
stdio: "inherit"
|
|
605
|
+
stdio: "inherit",
|
|
606
|
+
env: { ...process.env, REACT_GRAB_INIT: "1" }
|
|
588
607
|
});
|
|
589
608
|
};
|
|
590
609
|
var getPackagesToInstall = (agent, includeReactGrab = true) => {
|
|
@@ -2220,7 +2239,7 @@ var previewCdnTransform = (projectRoot, framework, nextRouterType, targetCdnDoma
|
|
|
2220
2239
|
};
|
|
2221
2240
|
|
|
2222
2241
|
// src/commands/add.ts
|
|
2223
|
-
var VERSION = "0.1.
|
|
2242
|
+
var VERSION = "0.1.28";
|
|
2224
2243
|
var formatInstalledAgentNames = (agents) => agents.map((agent) => AGENT_NAMES[agent] || agent).join(", ");
|
|
2225
2244
|
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(
|
|
2226
2245
|
"-c, --cwd <cwd>",
|
|
@@ -2581,7 +2600,7 @@ var MAX_KEY_HOLD_DURATION_MS = 2e3;
|
|
|
2581
2600
|
var MAX_CONTEXT_LINES = 50;
|
|
2582
2601
|
|
|
2583
2602
|
// src/commands/configure.ts
|
|
2584
|
-
var VERSION2 = "0.1.
|
|
2603
|
+
var VERSION2 = "0.1.28";
|
|
2585
2604
|
var isMac = process.platform === "darwin";
|
|
2586
2605
|
var META_LABEL = isMac ? "Cmd" : "Win";
|
|
2587
2606
|
var ALT_LABEL = isMac ? "Option" : "Alt";
|
|
@@ -3137,7 +3156,7 @@ var uninstallPackagesWithFeedback = (packages, packageManager, projectRoot) => {
|
|
|
3137
3156
|
};
|
|
3138
3157
|
|
|
3139
3158
|
// src/commands/init.ts
|
|
3140
|
-
var VERSION3 = "0.1.
|
|
3159
|
+
var VERSION3 = "0.1.28";
|
|
3141
3160
|
var REPORT_URL = "https://react-grab.com/api/report-cli";
|
|
3142
3161
|
var DOCS_URL = "https://github.com/aidenybai/react-grab";
|
|
3143
3162
|
var reportToCli = (type, config, error) => {
|
|
@@ -3996,7 +4015,7 @@ var init = new Command().name("init").description("initialize React Grab in your
|
|
|
3996
4015
|
reportToCli("error", void 0, error);
|
|
3997
4016
|
}
|
|
3998
4017
|
});
|
|
3999
|
-
var VERSION4 = "0.1.
|
|
4018
|
+
var VERSION4 = "0.1.28";
|
|
4000
4019
|
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(
|
|
4001
4020
|
"-c, --cwd <cwd>",
|
|
4002
4021
|
"working directory (defaults to current directory)",
|
|
@@ -4172,7 +4191,7 @@ var remove = new Command().name("remove").description("disconnect React Grab fro
|
|
|
4172
4191
|
});
|
|
4173
4192
|
|
|
4174
4193
|
// src/cli.ts
|
|
4175
|
-
var VERSION5 = "0.1.
|
|
4194
|
+
var VERSION5 = "0.1.28";
|
|
4176
4195
|
var VERSION_API_URL = "https://www.react-grab.com/api/version";
|
|
4177
4196
|
process.on("SIGINT", () => process.exit(0));
|
|
4178
4197
|
process.on("SIGTERM", () => process.exit(0));
|