@proagentstore/cli 0.1.2 → 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 +37 -9
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import {
|
|
4
|
+
import { createRequire } from "module";
|
|
5
|
+
import { Command as Command6 } from "commander";
|
|
5
6
|
|
|
6
7
|
// src/commands/check.ts
|
|
7
8
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -362,12 +363,36 @@ jobs:
|
|
|
362
363
|
writeLine();
|
|
363
364
|
});
|
|
364
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
|
+
|
|
365
390
|
// src/commands/publish.ts
|
|
366
391
|
import { execFileSync } from "child_process";
|
|
367
392
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
368
393
|
import { join as join3, resolve as resolve3 } from "path";
|
|
369
|
-
import { Command as
|
|
370
|
-
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) => {
|
|
371
396
|
const dir = resolve3(opts.dir);
|
|
372
397
|
const manifestPath = join3(dir, "agent.json");
|
|
373
398
|
if (!existsSync3(manifestPath)) {
|
|
@@ -446,11 +471,11 @@ var publishCommand = new Command3("publish").description("Publish an agent to Pr
|
|
|
446
471
|
});
|
|
447
472
|
|
|
448
473
|
// src/commands/runner.ts
|
|
449
|
-
import { spawn } from "child_process";
|
|
474
|
+
import { spawn as spawn2 } from "child_process";
|
|
450
475
|
import { existsSync as existsSync4 } from "fs";
|
|
451
476
|
import { resolve as resolve4 } from "path";
|
|
452
477
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
453
|
-
import { Command as
|
|
478
|
+
import { Command as Command5 } from "commander";
|
|
454
479
|
var runnerCommand = createRunnerCommand();
|
|
455
480
|
function runnerBaseUrl(url) {
|
|
456
481
|
return (clean(url) || clean(process.env.PAGS_RUNNER_URL) || "http://127.0.0.1:49171").replace(/\/$/, "");
|
|
@@ -525,7 +550,7 @@ function startRunnerForeground(opts) {
|
|
|
525
550
|
args = [bundledPackage, ...runnerArgs];
|
|
526
551
|
}
|
|
527
552
|
return new Promise((resolvePromise, reject) => {
|
|
528
|
-
const child =
|
|
553
|
+
const child = spawn2(command, args, {
|
|
529
554
|
cwd,
|
|
530
555
|
stdio: "inherit",
|
|
531
556
|
shell: process.platform === "win32"
|
|
@@ -590,7 +615,7 @@ function collectCapability(value, previous = []) {
|
|
|
590
615
|
return [...previous, value];
|
|
591
616
|
}
|
|
592
617
|
function createRunnerCommand() {
|
|
593
|
-
const command = new
|
|
618
|
+
const command = new Command5("runner").description(
|
|
594
619
|
"Manage a local ProAgentStore browser runner"
|
|
595
620
|
);
|
|
596
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) => {
|
|
@@ -706,14 +731,17 @@ function createRunnerCommand() {
|
|
|
706
731
|
}
|
|
707
732
|
|
|
708
733
|
// src/index.ts
|
|
709
|
-
var
|
|
734
|
+
var require2 = createRequire(import.meta.url);
|
|
735
|
+
var { version } = require2("../package.json");
|
|
736
|
+
var program = new Command6();
|
|
710
737
|
program.name("pags").description(
|
|
711
738
|
"ProAgentStore CLI \u2014 create and publish server-powered AI agents"
|
|
712
|
-
).version(
|
|
739
|
+
).version(version);
|
|
713
740
|
program.addCommand(initCommand);
|
|
714
741
|
program.addCommand(checkCommand);
|
|
715
742
|
program.addCommand(publishCommand);
|
|
716
743
|
program.addCommand(runnerCommand);
|
|
744
|
+
program.addCommand(mcpCommand);
|
|
717
745
|
try {
|
|
718
746
|
await program.parseAsync();
|
|
719
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": {
|