@proagentstore/cli 0.1.3 → 0.1.4
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/index.js +33 -8
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { createRequire } from "module";
|
|
5
|
-
import { Command as
|
|
5
|
+
import { Command as Command6 } from "commander";
|
|
6
6
|
|
|
7
7
|
// src/commands/check.ts
|
|
8
8
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -363,12 +363,36 @@ jobs:
|
|
|
363
363
|
writeLine();
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
+
// src/commands/mcp.ts
|
|
367
|
+
import { spawn } from "child_process";
|
|
368
|
+
import { Command as Command3 } from "commander";
|
|
369
|
+
var DEFAULT_MCP_URL = "https://mcp.proagentstore.online/mcp";
|
|
370
|
+
function buildMcpRemoteArgs(opts, extraArgs = []) {
|
|
371
|
+
return ["-y", "mcp-remote", opts.url || DEFAULT_MCP_URL, ...extraArgs];
|
|
372
|
+
}
|
|
373
|
+
async function runMcpProxy(opts, extraArgs = []) {
|
|
374
|
+
const child = spawn("npx", buildMcpRemoteArgs(opts, extraArgs), {
|
|
375
|
+
stdio: "inherit",
|
|
376
|
+
env: process.env
|
|
377
|
+
});
|
|
378
|
+
await new Promise((resolve5, reject) => {
|
|
379
|
+
child.on("error", reject);
|
|
380
|
+
child.on("close", (code) => {
|
|
381
|
+
if (code && code !== 0) reject(new Error(`mcp proxy exited with code ${code}`));
|
|
382
|
+
else resolve5();
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
var mcpCommand = new Command3("mcp").description("Run a local stdio proxy for the official ProAgentStore MCP server").option("--url <url>", "Remote MCP endpoint", DEFAULT_MCP_URL).argument("[args...]", "Extra arguments passed to mcp-remote").action(async (args, opts) => {
|
|
387
|
+
await runMcpProxy(opts, args);
|
|
388
|
+
});
|
|
389
|
+
|
|
366
390
|
// src/commands/publish.ts
|
|
367
391
|
import { execFileSync } from "child_process";
|
|
368
392
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
369
393
|
import { join as join3, resolve as resolve3 } from "path";
|
|
370
|
-
import { Command as
|
|
371
|
-
var publishCommand = new
|
|
394
|
+
import { Command as Command4 } from "commander";
|
|
395
|
+
var publishCommand = new Command4("publish").description("Publish an agent to ProAgentStore").option("-d, --dir <path>", "Agent directory", ".").action(async (opts) => {
|
|
372
396
|
const dir = resolve3(opts.dir);
|
|
373
397
|
const manifestPath = join3(dir, "agent.json");
|
|
374
398
|
if (!existsSync3(manifestPath)) {
|
|
@@ -447,11 +471,11 @@ var publishCommand = new Command3("publish").description("Publish an agent to Pr
|
|
|
447
471
|
});
|
|
448
472
|
|
|
449
473
|
// src/commands/runner.ts
|
|
450
|
-
import { spawn } from "child_process";
|
|
474
|
+
import { spawn as spawn2 } from "child_process";
|
|
451
475
|
import { existsSync as existsSync4 } from "fs";
|
|
452
476
|
import { resolve as resolve4 } from "path";
|
|
453
477
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
454
|
-
import { Command as
|
|
478
|
+
import { Command as Command5 } from "commander";
|
|
455
479
|
var runnerCommand = createRunnerCommand();
|
|
456
480
|
function runnerBaseUrl(url) {
|
|
457
481
|
return (clean(url) || clean(process.env.PAGS_RUNNER_URL) || "http://127.0.0.1:49171").replace(/\/$/, "");
|
|
@@ -526,7 +550,7 @@ function startRunnerForeground(opts) {
|
|
|
526
550
|
args = [bundledPackage, ...runnerArgs];
|
|
527
551
|
}
|
|
528
552
|
return new Promise((resolvePromise, reject) => {
|
|
529
|
-
const child =
|
|
553
|
+
const child = spawn2(command, args, {
|
|
530
554
|
cwd,
|
|
531
555
|
stdio: "inherit",
|
|
532
556
|
shell: process.platform === "win32"
|
|
@@ -591,7 +615,7 @@ function collectCapability(value, previous = []) {
|
|
|
591
615
|
return [...previous, value];
|
|
592
616
|
}
|
|
593
617
|
function createRunnerCommand() {
|
|
594
|
-
const command = new
|
|
618
|
+
const command = new Command5("runner").description(
|
|
595
619
|
"Manage a local ProAgentStore browser runner"
|
|
596
620
|
);
|
|
597
621
|
command.command("start").description("Start the local browser runner in the foreground").option("--host <host>", "Host to bind", "127.0.0.1").option("--port <port>", "Port to bind", "49171").option("--data-dir <path>", "Runner data directory").option("--token <token>", "Require this bearer token").option("--instance-id <id>", "Bind runner requests to a PAGS instance id").option("--headless", "Run Playwright headless").action(async (opts) => {
|
|
@@ -709,7 +733,7 @@ function createRunnerCommand() {
|
|
|
709
733
|
// src/index.ts
|
|
710
734
|
var require2 = createRequire(import.meta.url);
|
|
711
735
|
var { version } = require2("../package.json");
|
|
712
|
-
var program = new
|
|
736
|
+
var program = new Command6();
|
|
713
737
|
program.name("pags").description(
|
|
714
738
|
"ProAgentStore CLI \u2014 create and publish server-powered AI agents"
|
|
715
739
|
).version(version);
|
|
@@ -717,6 +741,7 @@ program.addCommand(initCommand);
|
|
|
717
741
|
program.addCommand(checkCommand);
|
|
718
742
|
program.addCommand(publishCommand);
|
|
719
743
|
program.addCommand(runnerCommand);
|
|
744
|
+
program.addCommand(mcpCommand);
|
|
720
745
|
try {
|
|
721
746
|
await program.parseAsync();
|
|
722
747
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proagentstore/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI for creating and
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "CLI for creating, publishing, and running ProAgentStore agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"pags",
|
|
19
19
|
"cli",
|
|
20
20
|
"agents",
|
|
21
|
+
"mcp",
|
|
21
22
|
"browser-runner"
|
|
22
23
|
],
|
|
23
24
|
"publishConfig": {
|