@xbrowser/cli 1.5.1 → 1.5.2
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.js +33 -10
- package/dist/daemon-main.js +2 -2
- package/dist/index.js +33 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5407,8 +5407,8 @@ function parseCommandChain(input, options) {
|
|
|
5407
5407
|
continue;
|
|
5408
5408
|
}
|
|
5409
5409
|
if (char === "," && isSpaceAdjacent(input, i)) {
|
|
5410
|
-
|
|
5411
|
-
|
|
5410
|
+
lastOperator = "sequence";
|
|
5411
|
+
flushPipeline();
|
|
5412
5412
|
continue;
|
|
5413
5413
|
}
|
|
5414
5414
|
if (char === "+" && isSpaceAdjacent(input, i)) {
|
|
@@ -8920,7 +8920,7 @@ var pluginSearchBuiltin = {
|
|
|
8920
8920
|
const query = args[0] || "";
|
|
8921
8921
|
try {
|
|
8922
8922
|
const searchOptions = {
|
|
8923
|
-
query,
|
|
8923
|
+
query: query || (options["tag"] || ""),
|
|
8924
8924
|
tag: options["tag"],
|
|
8925
8925
|
site: options["site"],
|
|
8926
8926
|
limit: options["limit"] ? Number.parseInt(String(options["limit"])) : 20
|
|
@@ -10525,7 +10525,11 @@ Total: ${enrichedPlugins.length} plugins`);
|
|
|
10525
10525
|
case "reload": {
|
|
10526
10526
|
const name = subArgs[0];
|
|
10527
10527
|
if (!name) outputError("Usage: xbrowser plugin reload <name>");
|
|
10528
|
-
|
|
10528
|
+
try {
|
|
10529
|
+
await (await getPluginLoader()).reloadPlugin(name);
|
|
10530
|
+
} catch {
|
|
10531
|
+
outputError(`Plugin "${name}" not found. Use 'xbrowser plugin list' to see installed plugins.`);
|
|
10532
|
+
}
|
|
10529
10533
|
outputResult({ ok: true, name }, mode);
|
|
10530
10534
|
break;
|
|
10531
10535
|
}
|
|
@@ -12485,13 +12489,24 @@ async function routeCommand(argvIn, stdinCommands) {
|
|
|
12485
12489
|
await handleChainInput(argv[0], argv);
|
|
12486
12490
|
return;
|
|
12487
12491
|
}
|
|
12488
|
-
|
|
12489
|
-
|
|
12490
|
-
|
|
12492
|
+
const globalFlags = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--output", "--timeout", "--help", "-h", "--version"]);
|
|
12493
|
+
let chainArgIdx = -1;
|
|
12494
|
+
for (let i = 0; i < argv.length; i++) {
|
|
12495
|
+
if (globalFlags.has(argv[i])) continue;
|
|
12496
|
+
if (globalFlags.has(argv[i]) || i > 0 && globalFlags.has(argv[i - 1]) && !argv[i].startsWith("-")) continue;
|
|
12497
|
+
if (argv[i].includes(" ") && /^[a-zA-Z]/.test(argv[i])) {
|
|
12498
|
+
chainArgIdx = i;
|
|
12499
|
+
break;
|
|
12500
|
+
}
|
|
12501
|
+
}
|
|
12502
|
+
if (chainArgIdx >= 0) {
|
|
12503
|
+
const chainArg = argv[chainArgIdx];
|
|
12504
|
+
const spaceIdx = chainArg.indexOf(" ");
|
|
12505
|
+
const possibleCmd = chainArg.substring(0, spaceIdx);
|
|
12491
12506
|
if (/^[a-zA-Z][\w-]*$/.test(possibleCmd)) {
|
|
12492
|
-
const remainder =
|
|
12507
|
+
const remainder = chainArg.substring(spaceIdx + 1);
|
|
12493
12508
|
const remainderParts = remainder.split(/\s+/).filter(Boolean);
|
|
12494
|
-
argv = [possibleCmd, ...remainderParts, ...argv.slice(1)];
|
|
12509
|
+
argv = [...argv.slice(0, chainArgIdx), possibleCmd, ...remainderParts, ...argv.slice(chainArgIdx + 1)];
|
|
12495
12510
|
}
|
|
12496
12511
|
}
|
|
12497
12512
|
} catch (e) {
|
|
@@ -12685,7 +12700,15 @@ async function routeCommand(argvIn, stdinCommands) {
|
|
|
12685
12700
|
const internalLoader = loader.getCore().loader;
|
|
12686
12701
|
const site = internalLoader.getSite(command);
|
|
12687
12702
|
if (!site) {
|
|
12688
|
-
const
|
|
12703
|
+
const globalFlagSet = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--help", "-h", "--version", "--output", "-o"]);
|
|
12704
|
+
const cleanParts = [];
|
|
12705
|
+
for (let i = 0; i < argv.length; i++) {
|
|
12706
|
+
if (globalFlagSet.has(argv[i])) continue;
|
|
12707
|
+
if (i > 0 && globalFlagSet.has(argv[i - 1]) && !argv[i].startsWith("-")) continue;
|
|
12708
|
+
if (argv[i].startsWith("--session=") || argv[i].startsWith("--cdp=")) continue;
|
|
12709
|
+
cleanParts.push(argv[i]);
|
|
12710
|
+
}
|
|
12711
|
+
const fullInput = cleanParts.join(" ");
|
|
12689
12712
|
if (isChainInput(fullInput)) {
|
|
12690
12713
|
const chainResult = await executeChain(fullInput, { cdpEndpoint, sessionName });
|
|
12691
12714
|
for (const step of chainResult.steps) {
|
package/dist/daemon-main.js
CHANGED
|
@@ -5368,8 +5368,8 @@ function parseCommandChain(input, options) {
|
|
|
5368
5368
|
continue;
|
|
5369
5369
|
}
|
|
5370
5370
|
if (char === "," && isSpaceAdjacent(input, i)) {
|
|
5371
|
-
|
|
5372
|
-
|
|
5371
|
+
lastOperator = "sequence";
|
|
5372
|
+
flushPipeline();
|
|
5373
5373
|
continue;
|
|
5374
5374
|
}
|
|
5375
5375
|
if (char === "+" && isSpaceAdjacent(input, i)) {
|
package/dist/index.js
CHANGED
|
@@ -5724,8 +5724,8 @@ function parseCommandChain(input, options) {
|
|
|
5724
5724
|
continue;
|
|
5725
5725
|
}
|
|
5726
5726
|
if (char === "," && isSpaceAdjacent(input, i)) {
|
|
5727
|
-
|
|
5728
|
-
|
|
5727
|
+
lastOperator = "sequence";
|
|
5728
|
+
flushPipeline();
|
|
5729
5729
|
continue;
|
|
5730
5730
|
}
|
|
5731
5731
|
if (char === "+" && isSpaceAdjacent(input, i)) {
|
|
@@ -9255,7 +9255,7 @@ var pluginSearchBuiltin = {
|
|
|
9255
9255
|
const query = args[0] || "";
|
|
9256
9256
|
try {
|
|
9257
9257
|
const searchOptions = {
|
|
9258
|
-
query,
|
|
9258
|
+
query: query || (options["tag"] || ""),
|
|
9259
9259
|
tag: options["tag"],
|
|
9260
9260
|
site: options["site"],
|
|
9261
9261
|
limit: options["limit"] ? Number.parseInt(String(options["limit"])) : 20
|
|
@@ -10865,7 +10865,11 @@ Total: ${enrichedPlugins.length} plugins`);
|
|
|
10865
10865
|
case "reload": {
|
|
10866
10866
|
const name = subArgs[0];
|
|
10867
10867
|
if (!name) outputError("Usage: xbrowser plugin reload <name>");
|
|
10868
|
-
|
|
10868
|
+
try {
|
|
10869
|
+
await (await getPluginLoader()).reloadPlugin(name);
|
|
10870
|
+
} catch {
|
|
10871
|
+
outputError(`Plugin "${name}" not found. Use 'xbrowser plugin list' to see installed plugins.`);
|
|
10872
|
+
}
|
|
10869
10873
|
outputResult({ ok: true, name }, mode);
|
|
10870
10874
|
break;
|
|
10871
10875
|
}
|
|
@@ -12825,13 +12829,24 @@ async function routeCommand(argvIn, stdinCommands) {
|
|
|
12825
12829
|
await handleChainInput(argv[0], argv);
|
|
12826
12830
|
return;
|
|
12827
12831
|
}
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12832
|
+
const globalFlags = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--output", "--timeout", "--help", "-h", "--version"]);
|
|
12833
|
+
let chainArgIdx = -1;
|
|
12834
|
+
for (let i = 0; i < argv.length; i++) {
|
|
12835
|
+
if (globalFlags.has(argv[i])) continue;
|
|
12836
|
+
if (globalFlags.has(argv[i]) || i > 0 && globalFlags.has(argv[i - 1]) && !argv[i].startsWith("-")) continue;
|
|
12837
|
+
if (argv[i].includes(" ") && /^[a-zA-Z]/.test(argv[i])) {
|
|
12838
|
+
chainArgIdx = i;
|
|
12839
|
+
break;
|
|
12840
|
+
}
|
|
12841
|
+
}
|
|
12842
|
+
if (chainArgIdx >= 0) {
|
|
12843
|
+
const chainArg = argv[chainArgIdx];
|
|
12844
|
+
const spaceIdx = chainArg.indexOf(" ");
|
|
12845
|
+
const possibleCmd = chainArg.substring(0, spaceIdx);
|
|
12831
12846
|
if (/^[a-zA-Z][\w-]*$/.test(possibleCmd)) {
|
|
12832
|
-
const remainder =
|
|
12847
|
+
const remainder = chainArg.substring(spaceIdx + 1);
|
|
12833
12848
|
const remainderParts = remainder.split(/\s+/).filter(Boolean);
|
|
12834
|
-
argv = [possibleCmd, ...remainderParts, ...argv.slice(1)];
|
|
12849
|
+
argv = [...argv.slice(0, chainArgIdx), possibleCmd, ...remainderParts, ...argv.slice(chainArgIdx + 1)];
|
|
12835
12850
|
}
|
|
12836
12851
|
}
|
|
12837
12852
|
} catch (e) {
|
|
@@ -13025,7 +13040,15 @@ async function routeCommand(argvIn, stdinCommands) {
|
|
|
13025
13040
|
const internalLoader = loader.getCore().loader;
|
|
13026
13041
|
const site = internalLoader.getSite(command);
|
|
13027
13042
|
if (!site) {
|
|
13028
|
-
const
|
|
13043
|
+
const globalFlagSet = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--help", "-h", "--version", "--output", "-o"]);
|
|
13044
|
+
const cleanParts = [];
|
|
13045
|
+
for (let i = 0; i < argv.length; i++) {
|
|
13046
|
+
if (globalFlagSet.has(argv[i])) continue;
|
|
13047
|
+
if (i > 0 && globalFlagSet.has(argv[i - 1]) && !argv[i].startsWith("-")) continue;
|
|
13048
|
+
if (argv[i].startsWith("--session=") || argv[i].startsWith("--cdp=")) continue;
|
|
13049
|
+
cleanParts.push(argv[i]);
|
|
13050
|
+
}
|
|
13051
|
+
const fullInput = cleanParts.join(" ");
|
|
13029
13052
|
if (isChainInput(fullInput)) {
|
|
13030
13053
|
const chainResult = await executeChain(fullInput, { cdpEndpoint, sessionName });
|
|
13031
13054
|
for (const step of chainResult.steps) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbrowser/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Browser automation CLI for web scraping, headless browsing, SEO analysis, and AI agent workflows. A command-line alternative to Playwright, Puppeteer, and Selenium.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|