@waniwani/cli 0.0.28 → 0.0.30
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 +171 -98
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command26 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/dev.ts
|
|
7
7
|
import { relative as relative2 } from "path";
|
|
@@ -337,7 +337,7 @@ var api = {
|
|
|
337
337
|
|
|
338
338
|
// src/lib/sync.ts
|
|
339
339
|
import { existsSync as existsSync2 } from "fs";
|
|
340
|
-
import { readdir, readFile as readFile3, stat } from "fs/promises";
|
|
340
|
+
import { mkdir as mkdir3, readdir, readFile as readFile3, stat, writeFile as writeFile3 } from "fs/promises";
|
|
341
341
|
import { dirname, join as join3, relative } from "path";
|
|
342
342
|
import ignore from "ignore";
|
|
343
343
|
|
|
@@ -474,6 +474,24 @@ async function collectFiles(projectRoot) {
|
|
|
474
474
|
await walk(projectRoot);
|
|
475
475
|
return files;
|
|
476
476
|
}
|
|
477
|
+
async function pullFilesFromSandbox(mcpId, targetDir) {
|
|
478
|
+
const result = await api.get(
|
|
479
|
+
`/api/mcp/sandboxes/${mcpId}/files/pull`
|
|
480
|
+
);
|
|
481
|
+
const writtenFiles = [];
|
|
482
|
+
for (const file of result.files) {
|
|
483
|
+
const localPath = join3(targetDir, file.path);
|
|
484
|
+
const dir = dirname(localPath);
|
|
485
|
+
await mkdir3(dir, { recursive: true });
|
|
486
|
+
if (file.encoding === "base64") {
|
|
487
|
+
await writeFile3(localPath, Buffer.from(file.content, "base64"));
|
|
488
|
+
} else {
|
|
489
|
+
await writeFile3(localPath, file.content, "utf8");
|
|
490
|
+
}
|
|
491
|
+
writtenFiles.push(file.path);
|
|
492
|
+
}
|
|
493
|
+
return { count: writtenFiles.length, files: writtenFiles };
|
|
494
|
+
}
|
|
477
495
|
async function collectSingleFile(projectRoot, filePath) {
|
|
478
496
|
const fullPath = join3(projectRoot, filePath);
|
|
479
497
|
const relativePath = relative(projectRoot, fullPath);
|
|
@@ -619,10 +637,9 @@ var devCommand = new Command("dev").description("Watch and sync files to MCP san
|
|
|
619
637
|
|
|
620
638
|
// src/commands/init.ts
|
|
621
639
|
import { existsSync as existsSync3 } from "fs";
|
|
622
|
-
import { mkdir as
|
|
640
|
+
import { mkdir as mkdir4, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
623
641
|
import { join as join4 } from "path";
|
|
624
642
|
import { Command as Command2 } from "commander";
|
|
625
|
-
import degit from "degit";
|
|
626
643
|
import ora2 from "ora";
|
|
627
644
|
|
|
628
645
|
// src/lib/output.ts
|
|
@@ -701,6 +718,26 @@ function prettyPrint(data, indent = 0) {
|
|
|
701
718
|
// src/commands/init.ts
|
|
702
719
|
var PROJECT_CONFIG_DIR = ".waniwani";
|
|
703
720
|
var PROJECT_CONFIG_FILE = "settings.json";
|
|
721
|
+
var DEFAULT_PROJECT_CONFIG = {
|
|
722
|
+
defaults: {
|
|
723
|
+
model: "claude-sonnet-4-20250514",
|
|
724
|
+
maxSteps: 10
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
async function loadParentConfig(cwd) {
|
|
728
|
+
const parentConfigPath = join4(cwd, PROJECT_CONFIG_DIR, PROJECT_CONFIG_FILE);
|
|
729
|
+
if (!existsSync3(parentConfigPath)) {
|
|
730
|
+
return null;
|
|
731
|
+
}
|
|
732
|
+
try {
|
|
733
|
+
const content = await readFile4(parentConfigPath, "utf-8");
|
|
734
|
+
const config2 = JSON.parse(content);
|
|
735
|
+
const { mcpId: _, ...rest } = config2;
|
|
736
|
+
return rest;
|
|
737
|
+
} catch {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
704
741
|
var initCommand = new Command2("init").description("Create a new MCP project from template").argument("<name>", "Name for the MCP project").action(async (name, _, command) => {
|
|
705
742
|
const globalOptions = command.optsWithGlobals();
|
|
706
743
|
const json = globalOptions.json ?? false;
|
|
@@ -725,26 +762,21 @@ var initCommand = new Command2("init").description("Create a new MCP project fro
|
|
|
725
762
|
const result = await api.post("/api/mcp/sandboxes", {
|
|
726
763
|
name
|
|
727
764
|
});
|
|
728
|
-
spinner.text = "
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
cache: false,
|
|
732
|
-
force: true,
|
|
733
|
-
verbose: false
|
|
734
|
-
});
|
|
735
|
-
await emitter.clone(projectDir);
|
|
765
|
+
spinner.text = "Downloading template files...";
|
|
766
|
+
await mkdir4(projectDir, { recursive: true });
|
|
767
|
+
await pullFilesFromSandbox(result.id, projectDir);
|
|
736
768
|
spinner.text = "Setting up project config...";
|
|
737
769
|
const configDir = join4(projectDir, PROJECT_CONFIG_DIR);
|
|
738
770
|
const configPath = join4(configDir, PROJECT_CONFIG_FILE);
|
|
739
|
-
await
|
|
771
|
+
await mkdir4(configDir, { recursive: true });
|
|
772
|
+
const parentConfig = await loadParentConfig(cwd);
|
|
740
773
|
const projectConfig = {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}
|
|
774
|
+
...DEFAULT_PROJECT_CONFIG,
|
|
775
|
+
...parentConfig,
|
|
776
|
+
mcpId: result.id
|
|
777
|
+
// Always use the new sandbox's mcpId
|
|
746
778
|
};
|
|
747
|
-
await
|
|
779
|
+
await writeFile4(
|
|
748
780
|
configPath,
|
|
749
781
|
JSON.stringify(projectConfig, null, " "),
|
|
750
782
|
"utf-8"
|
|
@@ -1192,12 +1224,48 @@ var logoutCommand = new Command4("logout").description("Log out from WaniWani").
|
|
|
1192
1224
|
});
|
|
1193
1225
|
|
|
1194
1226
|
// src/commands/mcp/index.ts
|
|
1195
|
-
import { Command as
|
|
1227
|
+
import { Command as Command20 } from "commander";
|
|
1196
1228
|
|
|
1197
|
-
// src/commands/mcp/
|
|
1229
|
+
// src/commands/mcp/clear.ts
|
|
1230
|
+
import { rm } from "fs/promises";
|
|
1198
1231
|
import { Command as Command5 } from "commander";
|
|
1199
1232
|
import ora4 from "ora";
|
|
1200
|
-
var
|
|
1233
|
+
var clearCommand = new Command5("clear").description("Delete the local MCP project folder").option("--force", "Skip confirmation").action(async (_options, command) => {
|
|
1234
|
+
const globalOptions = command.optsWithGlobals();
|
|
1235
|
+
const json = globalOptions.json ?? false;
|
|
1236
|
+
try {
|
|
1237
|
+
const cwd = process.cwd();
|
|
1238
|
+
const projectRoot = await findProjectRoot(cwd);
|
|
1239
|
+
if (!projectRoot) {
|
|
1240
|
+
throw new CLIError(
|
|
1241
|
+
"Not in a WaniWani project. No .waniwani directory found.",
|
|
1242
|
+
"NOT_IN_PROJECT"
|
|
1243
|
+
);
|
|
1244
|
+
}
|
|
1245
|
+
if (projectRoot === "/" || projectRoot === process.env.HOME) {
|
|
1246
|
+
throw new CLIError(
|
|
1247
|
+
"Refusing to delete home or root directory.",
|
|
1248
|
+
"UNSAFE_DELETE"
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
const spinner = ora4(`Deleting ${projectRoot}...`).start();
|
|
1252
|
+
await rm(projectRoot, { recursive: true, force: true });
|
|
1253
|
+
spinner.succeed("Project folder deleted");
|
|
1254
|
+
if (json) {
|
|
1255
|
+
formatOutput({ deleted: projectRoot }, true);
|
|
1256
|
+
} else {
|
|
1257
|
+
formatSuccess(`Deleted: ${projectRoot}`, false);
|
|
1258
|
+
}
|
|
1259
|
+
} catch (error) {
|
|
1260
|
+
handleError(error, json);
|
|
1261
|
+
process.exit(1);
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
// src/commands/mcp/delete.ts
|
|
1266
|
+
import { Command as Command6 } from "commander";
|
|
1267
|
+
import ora5 from "ora";
|
|
1268
|
+
var deleteCommand = new Command6("delete").description("Delete the MCP sandbox").option("--mcp-id <id>", "Specific MCP ID").action(async (options, command) => {
|
|
1201
1269
|
const globalOptions = command.optsWithGlobals();
|
|
1202
1270
|
const json = globalOptions.json ?? false;
|
|
1203
1271
|
try {
|
|
@@ -1208,7 +1276,7 @@ var deleteCommand = new Command5("delete").description("Delete the MCP sandbox")
|
|
|
1208
1276
|
throw new McpError("No active MCP. Use --mcp-id to specify one.");
|
|
1209
1277
|
}
|
|
1210
1278
|
}
|
|
1211
|
-
const spinner =
|
|
1279
|
+
const spinner = ora5("Deleting MCP sandbox...").start();
|
|
1212
1280
|
await api.delete(`/api/mcp/sandboxes/${mcpId}`);
|
|
1213
1281
|
spinner.succeed("MCP sandbox deleted");
|
|
1214
1282
|
if (await config.getMcpId() === mcpId) {
|
|
@@ -1226,9 +1294,9 @@ var deleteCommand = new Command5("delete").description("Delete the MCP sandbox")
|
|
|
1226
1294
|
});
|
|
1227
1295
|
|
|
1228
1296
|
// src/commands/mcp/deploy.ts
|
|
1229
|
-
import { Command as
|
|
1230
|
-
import
|
|
1231
|
-
var deployCommand = new
|
|
1297
|
+
import { Command as Command7 } from "commander";
|
|
1298
|
+
import ora6 from "ora";
|
|
1299
|
+
var deployCommand = new Command7("deploy").description("Deploy MCP server to GitHub + Vercel from sandbox").option("--repo <name>", "GitHub repository name").option("--org <name>", "GitHub organization").option("--private", "Create private repository").option("--mcp-id <id>", "Specific MCP ID").action(async (options, command) => {
|
|
1232
1300
|
const globalOptions = command.optsWithGlobals();
|
|
1233
1301
|
const json = globalOptions.json ?? false;
|
|
1234
1302
|
try {
|
|
@@ -1241,7 +1309,7 @@ var deployCommand = new Command6("deploy").description("Deploy MCP server to Git
|
|
|
1241
1309
|
);
|
|
1242
1310
|
}
|
|
1243
1311
|
}
|
|
1244
|
-
const spinner =
|
|
1312
|
+
const spinner = ora6("Deploying to GitHub...").start();
|
|
1245
1313
|
const result = await api.post(
|
|
1246
1314
|
`/api/admin/mcps/${mcpId}/deploy`,
|
|
1247
1315
|
{
|
|
@@ -1273,13 +1341,13 @@ var deployCommand = new Command6("deploy").description("Deploy MCP server to Git
|
|
|
1273
1341
|
});
|
|
1274
1342
|
|
|
1275
1343
|
// src/commands/mcp/file/index.ts
|
|
1276
|
-
import { Command as
|
|
1344
|
+
import { Command as Command11 } from "commander";
|
|
1277
1345
|
|
|
1278
1346
|
// src/commands/mcp/file/list.ts
|
|
1279
1347
|
import chalk5 from "chalk";
|
|
1280
|
-
import { Command as
|
|
1281
|
-
import
|
|
1282
|
-
var listCommand = new
|
|
1348
|
+
import { Command as Command8 } from "commander";
|
|
1349
|
+
import ora7 from "ora";
|
|
1350
|
+
var listCommand = new Command8("list").description("List files in the MCP sandbox").argument("[path]", "Directory path (defaults to /app)", "/app").option("--mcp-id <id>", "Specific MCP ID").action(async (path, options, command) => {
|
|
1283
1351
|
const globalOptions = command.optsWithGlobals();
|
|
1284
1352
|
const json = globalOptions.json ?? false;
|
|
1285
1353
|
try {
|
|
@@ -1292,7 +1360,7 @@ var listCommand = new Command7("list").description("List files in the MCP sandbo
|
|
|
1292
1360
|
);
|
|
1293
1361
|
}
|
|
1294
1362
|
}
|
|
1295
|
-
const spinner =
|
|
1363
|
+
const spinner = ora7(`Listing ${path}...`).start();
|
|
1296
1364
|
const result = await api.get(
|
|
1297
1365
|
`/api/mcp/sandboxes/${mcpId}/files/list?path=${encodeURIComponent(path)}`
|
|
1298
1366
|
);
|
|
@@ -1328,10 +1396,10 @@ function formatSize(bytes) {
|
|
|
1328
1396
|
}
|
|
1329
1397
|
|
|
1330
1398
|
// src/commands/mcp/file/read.ts
|
|
1331
|
-
import { writeFile as
|
|
1332
|
-
import { Command as
|
|
1333
|
-
import
|
|
1334
|
-
var readCommand = new
|
|
1399
|
+
import { writeFile as writeFile5 } from "fs/promises";
|
|
1400
|
+
import { Command as Command9 } from "commander";
|
|
1401
|
+
import ora8 from "ora";
|
|
1402
|
+
var readCommand = new Command9("read").description("Read a file from the MCP sandbox").argument("<path>", "Path in sandbox (e.g., /app/src/index.ts)").option("--mcp-id <id>", "Specific MCP ID").option("--output <file>", "Write to local file instead of stdout").option("--base64", "Output as base64 (for binary files)").action(async (path, options, command) => {
|
|
1335
1403
|
const globalOptions = command.optsWithGlobals();
|
|
1336
1404
|
const json = globalOptions.json ?? false;
|
|
1337
1405
|
try {
|
|
@@ -1345,7 +1413,7 @@ var readCommand = new Command8("read").description("Read a file from the MCP san
|
|
|
1345
1413
|
}
|
|
1346
1414
|
}
|
|
1347
1415
|
const encoding = options.base64 ? "base64" : "utf8";
|
|
1348
|
-
const spinner =
|
|
1416
|
+
const spinner = ora8(`Reading ${path}...`).start();
|
|
1349
1417
|
const result = await api.get(
|
|
1350
1418
|
`/api/mcp/sandboxes/${mcpId}/files?path=${encodeURIComponent(path)}&encoding=${encoding}`
|
|
1351
1419
|
);
|
|
@@ -1355,7 +1423,7 @@ var readCommand = new Command8("read").description("Read a file from the MCP san
|
|
|
1355
1423
|
}
|
|
1356
1424
|
if (options.output) {
|
|
1357
1425
|
const buffer = result.encoding === "base64" ? Buffer.from(result.content, "base64") : Buffer.from(result.content, "utf8");
|
|
1358
|
-
await
|
|
1426
|
+
await writeFile5(options.output, buffer);
|
|
1359
1427
|
if (json) {
|
|
1360
1428
|
formatOutput({ path, savedTo: options.output }, true);
|
|
1361
1429
|
} else {
|
|
@@ -1376,10 +1444,10 @@ var readCommand = new Command8("read").description("Read a file from the MCP san
|
|
|
1376
1444
|
});
|
|
1377
1445
|
|
|
1378
1446
|
// src/commands/mcp/file/write.ts
|
|
1379
|
-
import { readFile as
|
|
1380
|
-
import { Command as
|
|
1381
|
-
import
|
|
1382
|
-
var writeCommand = new
|
|
1447
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
1448
|
+
import { Command as Command10 } from "commander";
|
|
1449
|
+
import ora9 from "ora";
|
|
1450
|
+
var writeCommand = new Command10("write").description("Write a file to the MCP sandbox").argument("<path>", "Path in sandbox (e.g., /app/src/index.ts)").option("--mcp-id <id>", "Specific MCP ID").option("--content <content>", "Content to write").option("--file <localFile>", "Local file to upload").option("--base64", "Treat content as base64 encoded").action(async (path, options, command) => {
|
|
1383
1451
|
const globalOptions = command.optsWithGlobals();
|
|
1384
1452
|
const json = globalOptions.json ?? false;
|
|
1385
1453
|
try {
|
|
@@ -1400,7 +1468,7 @@ var writeCommand = new Command9("write").description("Write a file to the MCP sa
|
|
|
1400
1468
|
encoding = "base64";
|
|
1401
1469
|
}
|
|
1402
1470
|
} else if (options.file) {
|
|
1403
|
-
const fileBuffer = await
|
|
1471
|
+
const fileBuffer = await readFile5(options.file);
|
|
1404
1472
|
if (options.base64) {
|
|
1405
1473
|
content = fileBuffer.toString("base64");
|
|
1406
1474
|
encoding = "base64";
|
|
@@ -1413,7 +1481,7 @@ var writeCommand = new Command9("write").description("Write a file to the MCP sa
|
|
|
1413
1481
|
"MISSING_CONTENT"
|
|
1414
1482
|
);
|
|
1415
1483
|
}
|
|
1416
|
-
const spinner =
|
|
1484
|
+
const spinner = ora9(`Writing ${path}...`).start();
|
|
1417
1485
|
const result = await api.post(
|
|
1418
1486
|
`/api/mcp/sandboxes/${mcpId}/files`,
|
|
1419
1487
|
{
|
|
@@ -1433,17 +1501,17 @@ var writeCommand = new Command9("write").description("Write a file to the MCP sa
|
|
|
1433
1501
|
});
|
|
1434
1502
|
|
|
1435
1503
|
// src/commands/mcp/file/index.ts
|
|
1436
|
-
var fileCommand = new
|
|
1504
|
+
var fileCommand = new Command11("file").description("File operations in MCP sandbox").addCommand(readCommand).addCommand(writeCommand).addCommand(listCommand);
|
|
1437
1505
|
|
|
1438
1506
|
// src/commands/mcp/list.ts
|
|
1439
1507
|
import chalk6 from "chalk";
|
|
1440
|
-
import { Command as
|
|
1441
|
-
import
|
|
1442
|
-
var listCommand2 = new
|
|
1508
|
+
import { Command as Command12 } from "commander";
|
|
1509
|
+
import ora10 from "ora";
|
|
1510
|
+
var listCommand2 = new Command12("list").description("List all MCPs in your organization").option("--all", "Include stopped/expired MCPs").action(async (options, command) => {
|
|
1443
1511
|
const globalOptions = command.optsWithGlobals();
|
|
1444
1512
|
const json = globalOptions.json ?? false;
|
|
1445
1513
|
try {
|
|
1446
|
-
const spinner =
|
|
1514
|
+
const spinner = ora10("Fetching MCPs...").start();
|
|
1447
1515
|
const mcps = await api.get(
|
|
1448
1516
|
`/api/mcp/sandboxes${options.all ? "?all=true" : ""}`
|
|
1449
1517
|
);
|
|
@@ -1497,9 +1565,9 @@ var listCommand2 = new Command11("list").description("List all MCPs in your orga
|
|
|
1497
1565
|
|
|
1498
1566
|
// src/commands/mcp/logs.ts
|
|
1499
1567
|
import chalk7 from "chalk";
|
|
1500
|
-
import { Command as
|
|
1501
|
-
import
|
|
1502
|
-
var logsCommand = new
|
|
1568
|
+
import { Command as Command13 } from "commander";
|
|
1569
|
+
import ora11 from "ora";
|
|
1570
|
+
var logsCommand = new Command13("logs").description("Stream logs from the MCP server").argument("[cmdId]", "Command ID (defaults to running server)").option("--mcp-id <id>", "Specific MCP ID").option("-f, --follow", "Keep streaming logs (default)", true).option("--no-follow", "Fetch logs and exit").action(async (cmdIdArg, options, command) => {
|
|
1503
1571
|
const globalOptions = command.optsWithGlobals();
|
|
1504
1572
|
const json = globalOptions.json ?? false;
|
|
1505
1573
|
let reader;
|
|
@@ -1530,7 +1598,7 @@ var logsCommand = new Command12("logs").description("Stream logs from the MCP se
|
|
|
1530
1598
|
}
|
|
1531
1599
|
let cmdId = cmdIdArg;
|
|
1532
1600
|
if (!cmdId) {
|
|
1533
|
-
const spinner =
|
|
1601
|
+
const spinner = ora11("Getting server status...").start();
|
|
1534
1602
|
const status = await api.post(
|
|
1535
1603
|
`/api/mcp/sandboxes/${mcpId}/server`,
|
|
1536
1604
|
{ action: "status" }
|
|
@@ -1647,9 +1715,9 @@ Error: ${event.error}`));
|
|
|
1647
1715
|
|
|
1648
1716
|
// src/commands/mcp/run-command.ts
|
|
1649
1717
|
import chalk8 from "chalk";
|
|
1650
|
-
import { Command as
|
|
1651
|
-
import
|
|
1652
|
-
var runCommandCommand = new
|
|
1718
|
+
import { Command as Command14 } from "commander";
|
|
1719
|
+
import ora12 from "ora";
|
|
1720
|
+
var runCommandCommand = new Command14("run-command").description("Run a command in the MCP sandbox").argument("<command>", "Command to run").argument("[args...]", "Command arguments").option("--mcp-id <id>", "Specific MCP ID").option("--cwd <path>", "Working directory").option(
|
|
1653
1721
|
"--timeout <ms>",
|
|
1654
1722
|
"Command timeout in milliseconds (default: 30000, max: 300000)"
|
|
1655
1723
|
).action(async (cmd, args, options, command) => {
|
|
@@ -1666,7 +1734,7 @@ var runCommandCommand = new Command13("run-command").description("Run a command
|
|
|
1666
1734
|
}
|
|
1667
1735
|
}
|
|
1668
1736
|
const timeout = options.timeout ? Number.parseInt(options.timeout, 10) : void 0;
|
|
1669
|
-
const spinner =
|
|
1737
|
+
const spinner = ora12(`Running: ${cmd} ${args.join(" ")}`.trim()).start();
|
|
1670
1738
|
const result = await api.post(
|
|
1671
1739
|
`/api/mcp/sandboxes/${mcpId}/commands`,
|
|
1672
1740
|
{
|
|
@@ -1713,9 +1781,9 @@ var runCommandCommand = new Command13("run-command").description("Run a command
|
|
|
1713
1781
|
|
|
1714
1782
|
// src/commands/mcp/start.ts
|
|
1715
1783
|
import chalk9 from "chalk";
|
|
1716
|
-
import { Command as
|
|
1717
|
-
import
|
|
1718
|
-
var startCommand = new
|
|
1784
|
+
import { Command as Command15 } from "commander";
|
|
1785
|
+
import ora13 from "ora";
|
|
1786
|
+
var startCommand = new Command15("start").description("Start the MCP server (npm run dev)").option("--mcp-id <id>", "Specific MCP ID").action(async (options, command) => {
|
|
1719
1787
|
const globalOptions = command.optsWithGlobals();
|
|
1720
1788
|
const json = globalOptions.json ?? false;
|
|
1721
1789
|
try {
|
|
@@ -1728,7 +1796,7 @@ var startCommand = new Command14("start").description("Start the MCP server (npm
|
|
|
1728
1796
|
);
|
|
1729
1797
|
}
|
|
1730
1798
|
}
|
|
1731
|
-
const spinner =
|
|
1799
|
+
const spinner = ora13("Starting MCP server...").start();
|
|
1732
1800
|
const result = await api.post(
|
|
1733
1801
|
`/api/mcp/sandboxes/${mcpId}/server`,
|
|
1734
1802
|
{ action: "start" }
|
|
@@ -1746,6 +1814,11 @@ var startCommand = new Command14("start").description("Start the MCP server (npm
|
|
|
1746
1814
|
false
|
|
1747
1815
|
);
|
|
1748
1816
|
console.log();
|
|
1817
|
+
console.log(chalk9.bold("Test with MCP Inspector:"));
|
|
1818
|
+
console.log(
|
|
1819
|
+
` npx @modelcontextprotocol/inspector --url ${result.previewUrl}`
|
|
1820
|
+
);
|
|
1821
|
+
console.log();
|
|
1749
1822
|
console.log(
|
|
1750
1823
|
chalk9.gray("Run 'waniwani mcp logs' to stream server output")
|
|
1751
1824
|
);
|
|
@@ -1758,9 +1831,9 @@ var startCommand = new Command14("start").description("Start the MCP server (npm
|
|
|
1758
1831
|
|
|
1759
1832
|
// src/commands/mcp/status.ts
|
|
1760
1833
|
import chalk10 from "chalk";
|
|
1761
|
-
import { Command as
|
|
1762
|
-
import
|
|
1763
|
-
var statusCommand = new
|
|
1834
|
+
import { Command as Command16 } from "commander";
|
|
1835
|
+
import ora14 from "ora";
|
|
1836
|
+
var statusCommand = new Command16("status").description("Show current MCP sandbox status").option("--mcp-id <id>", "Specific MCP ID").action(async (options, command) => {
|
|
1764
1837
|
const globalOptions = command.optsWithGlobals();
|
|
1765
1838
|
const json = globalOptions.json ?? false;
|
|
1766
1839
|
try {
|
|
@@ -1773,7 +1846,7 @@ var statusCommand = new Command15("status").description("Show current MCP sandbo
|
|
|
1773
1846
|
);
|
|
1774
1847
|
}
|
|
1775
1848
|
}
|
|
1776
|
-
const spinner =
|
|
1849
|
+
const spinner = ora14("Fetching MCP status...").start();
|
|
1777
1850
|
const [result, serverStatus] = await Promise.all([
|
|
1778
1851
|
api.get(`/api/mcp/sandboxes/${mcpId}`),
|
|
1779
1852
|
api.post(`/api/mcp/sandboxes/${mcpId}/server`, {
|
|
@@ -1816,9 +1889,9 @@ var statusCommand = new Command15("status").description("Show current MCP sandbo
|
|
|
1816
1889
|
});
|
|
1817
1890
|
|
|
1818
1891
|
// src/commands/mcp/stop.ts
|
|
1819
|
-
import { Command as
|
|
1820
|
-
import
|
|
1821
|
-
var stopCommand = new
|
|
1892
|
+
import { Command as Command17 } from "commander";
|
|
1893
|
+
import ora15 from "ora";
|
|
1894
|
+
var stopCommand = new Command17("stop").description("Stop the MCP server process").option("--mcp-id <id>", "Specific MCP ID").action(async (options, command) => {
|
|
1822
1895
|
const globalOptions = command.optsWithGlobals();
|
|
1823
1896
|
const json = globalOptions.json ?? false;
|
|
1824
1897
|
try {
|
|
@@ -1831,7 +1904,7 @@ var stopCommand = new Command16("stop").description("Stop the MCP server process
|
|
|
1831
1904
|
);
|
|
1832
1905
|
}
|
|
1833
1906
|
}
|
|
1834
|
-
const spinner =
|
|
1907
|
+
const spinner = ora15("Stopping MCP server...").start();
|
|
1835
1908
|
const result = await api.post(
|
|
1836
1909
|
`/api/mcp/sandboxes/${mcpId}/server`,
|
|
1837
1910
|
{ action: "stop" }
|
|
@@ -1854,9 +1927,9 @@ var stopCommand = new Command16("stop").description("Stop the MCP server process
|
|
|
1854
1927
|
|
|
1855
1928
|
// src/commands/mcp/test.ts
|
|
1856
1929
|
import chalk11 from "chalk";
|
|
1857
|
-
import { Command as
|
|
1858
|
-
import
|
|
1859
|
-
var testCommand = new
|
|
1930
|
+
import { Command as Command18 } from "commander";
|
|
1931
|
+
import ora16 from "ora";
|
|
1932
|
+
var testCommand = new Command18("test").description("Test MCP tools via the sandbox").argument("[tool]", "Tool name to test (lists tools if omitted)").argument("[args...]", "JSON arguments for the tool").option("--mcp-id <id>", "Specific MCP ID").action(
|
|
1860
1933
|
async (tool, args, options, command) => {
|
|
1861
1934
|
const globalOptions = command.optsWithGlobals();
|
|
1862
1935
|
const json = globalOptions.json ?? false;
|
|
@@ -1871,7 +1944,7 @@ var testCommand = new Command17("test").description("Test MCP tools via the sand
|
|
|
1871
1944
|
}
|
|
1872
1945
|
}
|
|
1873
1946
|
if (!tool) {
|
|
1874
|
-
const spinner =
|
|
1947
|
+
const spinner = ora16("Fetching available tools...").start();
|
|
1875
1948
|
const result = await api.post(
|
|
1876
1949
|
`/api/mcp/sandboxes/${mcpId}/test`,
|
|
1877
1950
|
{ action: "list" }
|
|
@@ -1907,7 +1980,7 @@ Test a tool: waniwani mcp test <tool-name> '{"arg": "value"}'`
|
|
|
1907
1980
|
);
|
|
1908
1981
|
}
|
|
1909
1982
|
}
|
|
1910
|
-
const spinner =
|
|
1983
|
+
const spinner = ora16(`Calling tool "${tool}"...`).start();
|
|
1911
1984
|
const startTime = Date.now();
|
|
1912
1985
|
const result = await api.post(
|
|
1913
1986
|
`/api/mcp/sandboxes/${mcpId}/test`,
|
|
@@ -1944,13 +2017,13 @@ Test a tool: waniwani mcp test <tool-name> '{"arg": "value"}'`
|
|
|
1944
2017
|
);
|
|
1945
2018
|
|
|
1946
2019
|
// src/commands/mcp/use.ts
|
|
1947
|
-
import { Command as
|
|
1948
|
-
import
|
|
1949
|
-
var useCommand = new
|
|
2020
|
+
import { Command as Command19 } from "commander";
|
|
2021
|
+
import ora17 from "ora";
|
|
2022
|
+
var useCommand = new Command19("use").description("Select an MCP to use for subsequent commands").argument("<name>", "Name of the MCP to use").option("--global", "Save to global config instead of project config").action(async (name, options, command) => {
|
|
1950
2023
|
const globalOptions = command.optsWithGlobals();
|
|
1951
2024
|
const json = globalOptions.json ?? false;
|
|
1952
2025
|
try {
|
|
1953
|
-
const spinner =
|
|
2026
|
+
const spinner = ora17("Fetching MCPs...").start();
|
|
1954
2027
|
const mcps = await api.get("/api/admin/mcps");
|
|
1955
2028
|
spinner.stop();
|
|
1956
2029
|
const mcp = mcps.find((m) => m.name === name);
|
|
@@ -1986,20 +2059,20 @@ var useCommand = new Command18("use").description("Select an MCP to use for subs
|
|
|
1986
2059
|
});
|
|
1987
2060
|
|
|
1988
2061
|
// src/commands/mcp/index.ts
|
|
1989
|
-
var mcpCommand = new
|
|
2062
|
+
var mcpCommand = new Command20("mcp").description("MCP sandbox management commands").addCommand(listCommand2).addCommand(useCommand).addCommand(statusCommand).addCommand(startCommand).addCommand(stopCommand).addCommand(logsCommand).addCommand(deleteCommand).addCommand(clearCommand).addCommand(testCommand).addCommand(deployCommand).addCommand(fileCommand).addCommand(runCommandCommand);
|
|
1990
2063
|
|
|
1991
2064
|
// src/commands/org/index.ts
|
|
1992
|
-
import { Command as
|
|
2065
|
+
import { Command as Command23 } from "commander";
|
|
1993
2066
|
|
|
1994
2067
|
// src/commands/org/list.ts
|
|
1995
2068
|
import chalk12 from "chalk";
|
|
1996
|
-
import { Command as
|
|
1997
|
-
import
|
|
1998
|
-
var listCommand3 = new
|
|
2069
|
+
import { Command as Command21 } from "commander";
|
|
2070
|
+
import ora18 from "ora";
|
|
2071
|
+
var listCommand3 = new Command21("list").description("List your organizations").action(async (_, command) => {
|
|
1999
2072
|
const globalOptions = command.optsWithGlobals();
|
|
2000
2073
|
const json = globalOptions.json ?? false;
|
|
2001
2074
|
try {
|
|
2002
|
-
const spinner =
|
|
2075
|
+
const spinner = ora18("Fetching organizations...").start();
|
|
2003
2076
|
const result = await api.get("/api/oauth/orgs");
|
|
2004
2077
|
spinner.stop();
|
|
2005
2078
|
const { orgs, activeOrgId } = result;
|
|
@@ -2045,13 +2118,13 @@ var listCommand3 = new Command20("list").description("List your organizations").
|
|
|
2045
2118
|
});
|
|
2046
2119
|
|
|
2047
2120
|
// src/commands/org/switch.ts
|
|
2048
|
-
import { Command as
|
|
2049
|
-
import
|
|
2050
|
-
var switchCommand = new
|
|
2121
|
+
import { Command as Command22 } from "commander";
|
|
2122
|
+
import ora19 from "ora";
|
|
2123
|
+
var switchCommand = new Command22("switch").description("Switch to a different organization").argument("<name>", "Name or slug of the organization to switch to").action(async (name, _, command) => {
|
|
2051
2124
|
const globalOptions = command.optsWithGlobals();
|
|
2052
2125
|
const json = globalOptions.json ?? false;
|
|
2053
2126
|
try {
|
|
2054
|
-
const spinner =
|
|
2127
|
+
const spinner = ora19("Fetching organizations...").start();
|
|
2055
2128
|
const { orgs } = await api.get("/api/oauth/orgs");
|
|
2056
2129
|
const org = orgs.find((o) => o.name === name || o.slug === name);
|
|
2057
2130
|
if (!org) {
|
|
@@ -2084,14 +2157,14 @@ var switchCommand = new Command21("switch").description("Switch to a different o
|
|
|
2084
2157
|
});
|
|
2085
2158
|
|
|
2086
2159
|
// src/commands/org/index.ts
|
|
2087
|
-
var orgCommand = new
|
|
2160
|
+
var orgCommand = new Command23("org").description("Organization management commands").addCommand(listCommand3).addCommand(switchCommand);
|
|
2088
2161
|
|
|
2089
2162
|
// src/commands/push.ts
|
|
2090
2163
|
import chalk13 from "chalk";
|
|
2091
|
-
import { Command as
|
|
2092
|
-
import
|
|
2164
|
+
import { Command as Command24 } from "commander";
|
|
2165
|
+
import ora20 from "ora";
|
|
2093
2166
|
var BATCH_SIZE2 = 50;
|
|
2094
|
-
var pushCommand = new
|
|
2167
|
+
var pushCommand = new Command24("push").description("Sync local files to MCP sandbox").option("--dry-run", "Show what would be synced without uploading").action(async (options, command) => {
|
|
2095
2168
|
const globalOptions = command.optsWithGlobals();
|
|
2096
2169
|
const json = globalOptions.json ?? false;
|
|
2097
2170
|
try {
|
|
@@ -2110,7 +2183,7 @@ var pushCommand = new Command23("push").description("Sync local files to MCP san
|
|
|
2110
2183
|
"NO_MCP_ID"
|
|
2111
2184
|
);
|
|
2112
2185
|
}
|
|
2113
|
-
const spinner =
|
|
2186
|
+
const spinner = ora20("Collecting files...").start();
|
|
2114
2187
|
const files = await collectFiles(projectRoot);
|
|
2115
2188
|
if (files.length === 0) {
|
|
2116
2189
|
spinner.info("No files to sync");
|
|
@@ -2169,9 +2242,9 @@ var pushCommand = new Command23("push").description("Sync local files to MCP san
|
|
|
2169
2242
|
|
|
2170
2243
|
// src/commands/task.ts
|
|
2171
2244
|
import chalk14 from "chalk";
|
|
2172
|
-
import { Command as
|
|
2173
|
-
import
|
|
2174
|
-
var taskCommand = new
|
|
2245
|
+
import { Command as Command25 } from "commander";
|
|
2246
|
+
import ora21 from "ora";
|
|
2247
|
+
var taskCommand = new Command25("task").description("Send a task to Claude running in the sandbox").argument("<prompt>", "Task description/prompt").option("--mcp-id <id>", "Specific MCP ID").option("--model <model>", "Claude model to use").option("--max-steps <n>", "Maximum tool use steps").action(async (prompt, options, command) => {
|
|
2175
2248
|
const globalOptions = command.optsWithGlobals();
|
|
2176
2249
|
const json = globalOptions.json ?? false;
|
|
2177
2250
|
try {
|
|
@@ -2198,7 +2271,7 @@ var taskCommand = new Command24("task").description("Send a task to Claude runni
|
|
|
2198
2271
|
console.log(chalk14.bold("Task:"), prompt);
|
|
2199
2272
|
console.log();
|
|
2200
2273
|
}
|
|
2201
|
-
const spinner =
|
|
2274
|
+
const spinner = ora21("Starting task...").start();
|
|
2202
2275
|
const baseUrl = await api.getBaseUrl();
|
|
2203
2276
|
const response = await fetch(
|
|
2204
2277
|
`${baseUrl}/api/mcp/sandboxes/${mcpId}/task`,
|
|
@@ -2325,7 +2398,7 @@ var taskCommand = new Command24("task").description("Send a task to Claude runni
|
|
|
2325
2398
|
|
|
2326
2399
|
// src/cli.ts
|
|
2327
2400
|
var version = "0.1.0";
|
|
2328
|
-
var program = new
|
|
2401
|
+
var program = new Command26().name("waniwani").description("WaniWani CLI for MCP development workflow").version(version).option("--json", "Output results as JSON").option("--verbose", "Enable verbose logging");
|
|
2329
2402
|
program.addCommand(loginCommand);
|
|
2330
2403
|
program.addCommand(logoutCommand);
|
|
2331
2404
|
program.addCommand(initCommand);
|