@waniwani/cli 0.0.29 → 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 +145 -84
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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";
|
|
@@ -637,7 +637,7 @@ var devCommand = new Command("dev").description("Watch and sync files to MCP san
|
|
|
637
637
|
|
|
638
638
|
// src/commands/init.ts
|
|
639
639
|
import { existsSync as existsSync3 } from "fs";
|
|
640
|
-
import { mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
640
|
+
import { mkdir as mkdir4, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
641
641
|
import { join as join4 } from "path";
|
|
642
642
|
import { Command as Command2 } from "commander";
|
|
643
643
|
import ora2 from "ora";
|
|
@@ -718,6 +718,26 @@ function prettyPrint(data, indent = 0) {
|
|
|
718
718
|
// src/commands/init.ts
|
|
719
719
|
var PROJECT_CONFIG_DIR = ".waniwani";
|
|
720
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
|
+
}
|
|
721
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) => {
|
|
722
742
|
const globalOptions = command.optsWithGlobals();
|
|
723
743
|
const json = globalOptions.json ?? false;
|
|
@@ -749,12 +769,12 @@ var initCommand = new Command2("init").description("Create a new MCP project fro
|
|
|
749
769
|
const configDir = join4(projectDir, PROJECT_CONFIG_DIR);
|
|
750
770
|
const configPath = join4(configDir, PROJECT_CONFIG_FILE);
|
|
751
771
|
await mkdir4(configDir, { recursive: true });
|
|
772
|
+
const parentConfig = await loadParentConfig(cwd);
|
|
752
773
|
const projectConfig = {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
774
|
+
...DEFAULT_PROJECT_CONFIG,
|
|
775
|
+
...parentConfig,
|
|
776
|
+
mcpId: result.id
|
|
777
|
+
// Always use the new sandbox's mcpId
|
|
758
778
|
};
|
|
759
779
|
await writeFile4(
|
|
760
780
|
configPath,
|
|
@@ -1204,12 +1224,48 @@ var logoutCommand = new Command4("logout").description("Log out from WaniWani").
|
|
|
1204
1224
|
});
|
|
1205
1225
|
|
|
1206
1226
|
// src/commands/mcp/index.ts
|
|
1207
|
-
import { Command as
|
|
1227
|
+
import { Command as Command20 } from "commander";
|
|
1208
1228
|
|
|
1209
|
-
// src/commands/mcp/
|
|
1229
|
+
// src/commands/mcp/clear.ts
|
|
1230
|
+
import { rm } from "fs/promises";
|
|
1210
1231
|
import { Command as Command5 } from "commander";
|
|
1211
1232
|
import ora4 from "ora";
|
|
1212
|
-
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) => {
|
|
1213
1269
|
const globalOptions = command.optsWithGlobals();
|
|
1214
1270
|
const json = globalOptions.json ?? false;
|
|
1215
1271
|
try {
|
|
@@ -1220,7 +1276,7 @@ var deleteCommand = new Command5("delete").description("Delete the MCP sandbox")
|
|
|
1220
1276
|
throw new McpError("No active MCP. Use --mcp-id to specify one.");
|
|
1221
1277
|
}
|
|
1222
1278
|
}
|
|
1223
|
-
const spinner =
|
|
1279
|
+
const spinner = ora5("Deleting MCP sandbox...").start();
|
|
1224
1280
|
await api.delete(`/api/mcp/sandboxes/${mcpId}`);
|
|
1225
1281
|
spinner.succeed("MCP sandbox deleted");
|
|
1226
1282
|
if (await config.getMcpId() === mcpId) {
|
|
@@ -1238,9 +1294,9 @@ var deleteCommand = new Command5("delete").description("Delete the MCP sandbox")
|
|
|
1238
1294
|
});
|
|
1239
1295
|
|
|
1240
1296
|
// src/commands/mcp/deploy.ts
|
|
1241
|
-
import { Command as
|
|
1242
|
-
import
|
|
1243
|
-
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) => {
|
|
1244
1300
|
const globalOptions = command.optsWithGlobals();
|
|
1245
1301
|
const json = globalOptions.json ?? false;
|
|
1246
1302
|
try {
|
|
@@ -1253,7 +1309,7 @@ var deployCommand = new Command6("deploy").description("Deploy MCP server to Git
|
|
|
1253
1309
|
);
|
|
1254
1310
|
}
|
|
1255
1311
|
}
|
|
1256
|
-
const spinner =
|
|
1312
|
+
const spinner = ora6("Deploying to GitHub...").start();
|
|
1257
1313
|
const result = await api.post(
|
|
1258
1314
|
`/api/admin/mcps/${mcpId}/deploy`,
|
|
1259
1315
|
{
|
|
@@ -1285,13 +1341,13 @@ var deployCommand = new Command6("deploy").description("Deploy MCP server to Git
|
|
|
1285
1341
|
});
|
|
1286
1342
|
|
|
1287
1343
|
// src/commands/mcp/file/index.ts
|
|
1288
|
-
import { Command as
|
|
1344
|
+
import { Command as Command11 } from "commander";
|
|
1289
1345
|
|
|
1290
1346
|
// src/commands/mcp/file/list.ts
|
|
1291
1347
|
import chalk5 from "chalk";
|
|
1292
|
-
import { Command as
|
|
1293
|
-
import
|
|
1294
|
-
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) => {
|
|
1295
1351
|
const globalOptions = command.optsWithGlobals();
|
|
1296
1352
|
const json = globalOptions.json ?? false;
|
|
1297
1353
|
try {
|
|
@@ -1304,7 +1360,7 @@ var listCommand = new Command7("list").description("List files in the MCP sandbo
|
|
|
1304
1360
|
);
|
|
1305
1361
|
}
|
|
1306
1362
|
}
|
|
1307
|
-
const spinner =
|
|
1363
|
+
const spinner = ora7(`Listing ${path}...`).start();
|
|
1308
1364
|
const result = await api.get(
|
|
1309
1365
|
`/api/mcp/sandboxes/${mcpId}/files/list?path=${encodeURIComponent(path)}`
|
|
1310
1366
|
);
|
|
@@ -1341,9 +1397,9 @@ function formatSize(bytes) {
|
|
|
1341
1397
|
|
|
1342
1398
|
// src/commands/mcp/file/read.ts
|
|
1343
1399
|
import { writeFile as writeFile5 } from "fs/promises";
|
|
1344
|
-
import { Command as
|
|
1345
|
-
import
|
|
1346
|
-
var readCommand = new
|
|
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) => {
|
|
1347
1403
|
const globalOptions = command.optsWithGlobals();
|
|
1348
1404
|
const json = globalOptions.json ?? false;
|
|
1349
1405
|
try {
|
|
@@ -1357,7 +1413,7 @@ var readCommand = new Command8("read").description("Read a file from the MCP san
|
|
|
1357
1413
|
}
|
|
1358
1414
|
}
|
|
1359
1415
|
const encoding = options.base64 ? "base64" : "utf8";
|
|
1360
|
-
const spinner =
|
|
1416
|
+
const spinner = ora8(`Reading ${path}...`).start();
|
|
1361
1417
|
const result = await api.get(
|
|
1362
1418
|
`/api/mcp/sandboxes/${mcpId}/files?path=${encodeURIComponent(path)}&encoding=${encoding}`
|
|
1363
1419
|
);
|
|
@@ -1388,10 +1444,10 @@ var readCommand = new Command8("read").description("Read a file from the MCP san
|
|
|
1388
1444
|
});
|
|
1389
1445
|
|
|
1390
1446
|
// src/commands/mcp/file/write.ts
|
|
1391
|
-
import { readFile as
|
|
1392
|
-
import { Command as
|
|
1393
|
-
import
|
|
1394
|
-
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) => {
|
|
1395
1451
|
const globalOptions = command.optsWithGlobals();
|
|
1396
1452
|
const json = globalOptions.json ?? false;
|
|
1397
1453
|
try {
|
|
@@ -1412,7 +1468,7 @@ var writeCommand = new Command9("write").description("Write a file to the MCP sa
|
|
|
1412
1468
|
encoding = "base64";
|
|
1413
1469
|
}
|
|
1414
1470
|
} else if (options.file) {
|
|
1415
|
-
const fileBuffer = await
|
|
1471
|
+
const fileBuffer = await readFile5(options.file);
|
|
1416
1472
|
if (options.base64) {
|
|
1417
1473
|
content = fileBuffer.toString("base64");
|
|
1418
1474
|
encoding = "base64";
|
|
@@ -1425,7 +1481,7 @@ var writeCommand = new Command9("write").description("Write a file to the MCP sa
|
|
|
1425
1481
|
"MISSING_CONTENT"
|
|
1426
1482
|
);
|
|
1427
1483
|
}
|
|
1428
|
-
const spinner =
|
|
1484
|
+
const spinner = ora9(`Writing ${path}...`).start();
|
|
1429
1485
|
const result = await api.post(
|
|
1430
1486
|
`/api/mcp/sandboxes/${mcpId}/files`,
|
|
1431
1487
|
{
|
|
@@ -1445,17 +1501,17 @@ var writeCommand = new Command9("write").description("Write a file to the MCP sa
|
|
|
1445
1501
|
});
|
|
1446
1502
|
|
|
1447
1503
|
// src/commands/mcp/file/index.ts
|
|
1448
|
-
var fileCommand = new
|
|
1504
|
+
var fileCommand = new Command11("file").description("File operations in MCP sandbox").addCommand(readCommand).addCommand(writeCommand).addCommand(listCommand);
|
|
1449
1505
|
|
|
1450
1506
|
// src/commands/mcp/list.ts
|
|
1451
1507
|
import chalk6 from "chalk";
|
|
1452
|
-
import { Command as
|
|
1453
|
-
import
|
|
1454
|
-
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) => {
|
|
1455
1511
|
const globalOptions = command.optsWithGlobals();
|
|
1456
1512
|
const json = globalOptions.json ?? false;
|
|
1457
1513
|
try {
|
|
1458
|
-
const spinner =
|
|
1514
|
+
const spinner = ora10("Fetching MCPs...").start();
|
|
1459
1515
|
const mcps = await api.get(
|
|
1460
1516
|
`/api/mcp/sandboxes${options.all ? "?all=true" : ""}`
|
|
1461
1517
|
);
|
|
@@ -1509,9 +1565,9 @@ var listCommand2 = new Command11("list").description("List all MCPs in your orga
|
|
|
1509
1565
|
|
|
1510
1566
|
// src/commands/mcp/logs.ts
|
|
1511
1567
|
import chalk7 from "chalk";
|
|
1512
|
-
import { Command as
|
|
1513
|
-
import
|
|
1514
|
-
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) => {
|
|
1515
1571
|
const globalOptions = command.optsWithGlobals();
|
|
1516
1572
|
const json = globalOptions.json ?? false;
|
|
1517
1573
|
let reader;
|
|
@@ -1542,7 +1598,7 @@ var logsCommand = new Command12("logs").description("Stream logs from the MCP se
|
|
|
1542
1598
|
}
|
|
1543
1599
|
let cmdId = cmdIdArg;
|
|
1544
1600
|
if (!cmdId) {
|
|
1545
|
-
const spinner =
|
|
1601
|
+
const spinner = ora11("Getting server status...").start();
|
|
1546
1602
|
const status = await api.post(
|
|
1547
1603
|
`/api/mcp/sandboxes/${mcpId}/server`,
|
|
1548
1604
|
{ action: "status" }
|
|
@@ -1659,9 +1715,9 @@ Error: ${event.error}`));
|
|
|
1659
1715
|
|
|
1660
1716
|
// src/commands/mcp/run-command.ts
|
|
1661
1717
|
import chalk8 from "chalk";
|
|
1662
|
-
import { Command as
|
|
1663
|
-
import
|
|
1664
|
-
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(
|
|
1665
1721
|
"--timeout <ms>",
|
|
1666
1722
|
"Command timeout in milliseconds (default: 30000, max: 300000)"
|
|
1667
1723
|
).action(async (cmd, args, options, command) => {
|
|
@@ -1678,7 +1734,7 @@ var runCommandCommand = new Command13("run-command").description("Run a command
|
|
|
1678
1734
|
}
|
|
1679
1735
|
}
|
|
1680
1736
|
const timeout = options.timeout ? Number.parseInt(options.timeout, 10) : void 0;
|
|
1681
|
-
const spinner =
|
|
1737
|
+
const spinner = ora12(`Running: ${cmd} ${args.join(" ")}`.trim()).start();
|
|
1682
1738
|
const result = await api.post(
|
|
1683
1739
|
`/api/mcp/sandboxes/${mcpId}/commands`,
|
|
1684
1740
|
{
|
|
@@ -1725,9 +1781,9 @@ var runCommandCommand = new Command13("run-command").description("Run a command
|
|
|
1725
1781
|
|
|
1726
1782
|
// src/commands/mcp/start.ts
|
|
1727
1783
|
import chalk9 from "chalk";
|
|
1728
|
-
import { Command as
|
|
1729
|
-
import
|
|
1730
|
-
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) => {
|
|
1731
1787
|
const globalOptions = command.optsWithGlobals();
|
|
1732
1788
|
const json = globalOptions.json ?? false;
|
|
1733
1789
|
try {
|
|
@@ -1740,7 +1796,7 @@ var startCommand = new Command14("start").description("Start the MCP server (npm
|
|
|
1740
1796
|
);
|
|
1741
1797
|
}
|
|
1742
1798
|
}
|
|
1743
|
-
const spinner =
|
|
1799
|
+
const spinner = ora13("Starting MCP server...").start();
|
|
1744
1800
|
const result = await api.post(
|
|
1745
1801
|
`/api/mcp/sandboxes/${mcpId}/server`,
|
|
1746
1802
|
{ action: "start" }
|
|
@@ -1758,6 +1814,11 @@ var startCommand = new Command14("start").description("Start the MCP server (npm
|
|
|
1758
1814
|
false
|
|
1759
1815
|
);
|
|
1760
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();
|
|
1761
1822
|
console.log(
|
|
1762
1823
|
chalk9.gray("Run 'waniwani mcp logs' to stream server output")
|
|
1763
1824
|
);
|
|
@@ -1770,9 +1831,9 @@ var startCommand = new Command14("start").description("Start the MCP server (npm
|
|
|
1770
1831
|
|
|
1771
1832
|
// src/commands/mcp/status.ts
|
|
1772
1833
|
import chalk10 from "chalk";
|
|
1773
|
-
import { Command as
|
|
1774
|
-
import
|
|
1775
|
-
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) => {
|
|
1776
1837
|
const globalOptions = command.optsWithGlobals();
|
|
1777
1838
|
const json = globalOptions.json ?? false;
|
|
1778
1839
|
try {
|
|
@@ -1785,7 +1846,7 @@ var statusCommand = new Command15("status").description("Show current MCP sandbo
|
|
|
1785
1846
|
);
|
|
1786
1847
|
}
|
|
1787
1848
|
}
|
|
1788
|
-
const spinner =
|
|
1849
|
+
const spinner = ora14("Fetching MCP status...").start();
|
|
1789
1850
|
const [result, serverStatus] = await Promise.all([
|
|
1790
1851
|
api.get(`/api/mcp/sandboxes/${mcpId}`),
|
|
1791
1852
|
api.post(`/api/mcp/sandboxes/${mcpId}/server`, {
|
|
@@ -1828,9 +1889,9 @@ var statusCommand = new Command15("status").description("Show current MCP sandbo
|
|
|
1828
1889
|
});
|
|
1829
1890
|
|
|
1830
1891
|
// src/commands/mcp/stop.ts
|
|
1831
|
-
import { Command as
|
|
1832
|
-
import
|
|
1833
|
-
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) => {
|
|
1834
1895
|
const globalOptions = command.optsWithGlobals();
|
|
1835
1896
|
const json = globalOptions.json ?? false;
|
|
1836
1897
|
try {
|
|
@@ -1843,7 +1904,7 @@ var stopCommand = new Command16("stop").description("Stop the MCP server process
|
|
|
1843
1904
|
);
|
|
1844
1905
|
}
|
|
1845
1906
|
}
|
|
1846
|
-
const spinner =
|
|
1907
|
+
const spinner = ora15("Stopping MCP server...").start();
|
|
1847
1908
|
const result = await api.post(
|
|
1848
1909
|
`/api/mcp/sandboxes/${mcpId}/server`,
|
|
1849
1910
|
{ action: "stop" }
|
|
@@ -1866,9 +1927,9 @@ var stopCommand = new Command16("stop").description("Stop the MCP server process
|
|
|
1866
1927
|
|
|
1867
1928
|
// src/commands/mcp/test.ts
|
|
1868
1929
|
import chalk11 from "chalk";
|
|
1869
|
-
import { Command as
|
|
1870
|
-
import
|
|
1871
|
-
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(
|
|
1872
1933
|
async (tool, args, options, command) => {
|
|
1873
1934
|
const globalOptions = command.optsWithGlobals();
|
|
1874
1935
|
const json = globalOptions.json ?? false;
|
|
@@ -1883,7 +1944,7 @@ var testCommand = new Command17("test").description("Test MCP tools via the sand
|
|
|
1883
1944
|
}
|
|
1884
1945
|
}
|
|
1885
1946
|
if (!tool) {
|
|
1886
|
-
const spinner =
|
|
1947
|
+
const spinner = ora16("Fetching available tools...").start();
|
|
1887
1948
|
const result = await api.post(
|
|
1888
1949
|
`/api/mcp/sandboxes/${mcpId}/test`,
|
|
1889
1950
|
{ action: "list" }
|
|
@@ -1919,7 +1980,7 @@ Test a tool: waniwani mcp test <tool-name> '{"arg": "value"}'`
|
|
|
1919
1980
|
);
|
|
1920
1981
|
}
|
|
1921
1982
|
}
|
|
1922
|
-
const spinner =
|
|
1983
|
+
const spinner = ora16(`Calling tool "${tool}"...`).start();
|
|
1923
1984
|
const startTime = Date.now();
|
|
1924
1985
|
const result = await api.post(
|
|
1925
1986
|
`/api/mcp/sandboxes/${mcpId}/test`,
|
|
@@ -1956,13 +2017,13 @@ Test a tool: waniwani mcp test <tool-name> '{"arg": "value"}'`
|
|
|
1956
2017
|
);
|
|
1957
2018
|
|
|
1958
2019
|
// src/commands/mcp/use.ts
|
|
1959
|
-
import { Command as
|
|
1960
|
-
import
|
|
1961
|
-
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) => {
|
|
1962
2023
|
const globalOptions = command.optsWithGlobals();
|
|
1963
2024
|
const json = globalOptions.json ?? false;
|
|
1964
2025
|
try {
|
|
1965
|
-
const spinner =
|
|
2026
|
+
const spinner = ora17("Fetching MCPs...").start();
|
|
1966
2027
|
const mcps = await api.get("/api/admin/mcps");
|
|
1967
2028
|
spinner.stop();
|
|
1968
2029
|
const mcp = mcps.find((m) => m.name === name);
|
|
@@ -1998,20 +2059,20 @@ var useCommand = new Command18("use").description("Select an MCP to use for subs
|
|
|
1998
2059
|
});
|
|
1999
2060
|
|
|
2000
2061
|
// src/commands/mcp/index.ts
|
|
2001
|
-
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);
|
|
2002
2063
|
|
|
2003
2064
|
// src/commands/org/index.ts
|
|
2004
|
-
import { Command as
|
|
2065
|
+
import { Command as Command23 } from "commander";
|
|
2005
2066
|
|
|
2006
2067
|
// src/commands/org/list.ts
|
|
2007
2068
|
import chalk12 from "chalk";
|
|
2008
|
-
import { Command as
|
|
2009
|
-
import
|
|
2010
|
-
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) => {
|
|
2011
2072
|
const globalOptions = command.optsWithGlobals();
|
|
2012
2073
|
const json = globalOptions.json ?? false;
|
|
2013
2074
|
try {
|
|
2014
|
-
const spinner =
|
|
2075
|
+
const spinner = ora18("Fetching organizations...").start();
|
|
2015
2076
|
const result = await api.get("/api/oauth/orgs");
|
|
2016
2077
|
spinner.stop();
|
|
2017
2078
|
const { orgs, activeOrgId } = result;
|
|
@@ -2057,13 +2118,13 @@ var listCommand3 = new Command20("list").description("List your organizations").
|
|
|
2057
2118
|
});
|
|
2058
2119
|
|
|
2059
2120
|
// src/commands/org/switch.ts
|
|
2060
|
-
import { Command as
|
|
2061
|
-
import
|
|
2062
|
-
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) => {
|
|
2063
2124
|
const globalOptions = command.optsWithGlobals();
|
|
2064
2125
|
const json = globalOptions.json ?? false;
|
|
2065
2126
|
try {
|
|
2066
|
-
const spinner =
|
|
2127
|
+
const spinner = ora19("Fetching organizations...").start();
|
|
2067
2128
|
const { orgs } = await api.get("/api/oauth/orgs");
|
|
2068
2129
|
const org = orgs.find((o) => o.name === name || o.slug === name);
|
|
2069
2130
|
if (!org) {
|
|
@@ -2096,14 +2157,14 @@ var switchCommand = new Command21("switch").description("Switch to a different o
|
|
|
2096
2157
|
});
|
|
2097
2158
|
|
|
2098
2159
|
// src/commands/org/index.ts
|
|
2099
|
-
var orgCommand = new
|
|
2160
|
+
var orgCommand = new Command23("org").description("Organization management commands").addCommand(listCommand3).addCommand(switchCommand);
|
|
2100
2161
|
|
|
2101
2162
|
// src/commands/push.ts
|
|
2102
2163
|
import chalk13 from "chalk";
|
|
2103
|
-
import { Command as
|
|
2104
|
-
import
|
|
2164
|
+
import { Command as Command24 } from "commander";
|
|
2165
|
+
import ora20 from "ora";
|
|
2105
2166
|
var BATCH_SIZE2 = 50;
|
|
2106
|
-
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) => {
|
|
2107
2168
|
const globalOptions = command.optsWithGlobals();
|
|
2108
2169
|
const json = globalOptions.json ?? false;
|
|
2109
2170
|
try {
|
|
@@ -2122,7 +2183,7 @@ var pushCommand = new Command23("push").description("Sync local files to MCP san
|
|
|
2122
2183
|
"NO_MCP_ID"
|
|
2123
2184
|
);
|
|
2124
2185
|
}
|
|
2125
|
-
const spinner =
|
|
2186
|
+
const spinner = ora20("Collecting files...").start();
|
|
2126
2187
|
const files = await collectFiles(projectRoot);
|
|
2127
2188
|
if (files.length === 0) {
|
|
2128
2189
|
spinner.info("No files to sync");
|
|
@@ -2181,9 +2242,9 @@ var pushCommand = new Command23("push").description("Sync local files to MCP san
|
|
|
2181
2242
|
|
|
2182
2243
|
// src/commands/task.ts
|
|
2183
2244
|
import chalk14 from "chalk";
|
|
2184
|
-
import { Command as
|
|
2185
|
-
import
|
|
2186
|
-
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) => {
|
|
2187
2248
|
const globalOptions = command.optsWithGlobals();
|
|
2188
2249
|
const json = globalOptions.json ?? false;
|
|
2189
2250
|
try {
|
|
@@ -2210,7 +2271,7 @@ var taskCommand = new Command24("task").description("Send a task to Claude runni
|
|
|
2210
2271
|
console.log(chalk14.bold("Task:"), prompt);
|
|
2211
2272
|
console.log();
|
|
2212
2273
|
}
|
|
2213
|
-
const spinner =
|
|
2274
|
+
const spinner = ora21("Starting task...").start();
|
|
2214
2275
|
const baseUrl = await api.getBaseUrl();
|
|
2215
2276
|
const response = await fetch(
|
|
2216
2277
|
`${baseUrl}/api/mcp/sandboxes/${mcpId}/task`,
|
|
@@ -2337,7 +2398,7 @@ var taskCommand = new Command24("task").description("Send a task to Claude runni
|
|
|
2337
2398
|
|
|
2338
2399
|
// src/cli.ts
|
|
2339
2400
|
var version = "0.1.0";
|
|
2340
|
-
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");
|
|
2341
2402
|
program.addCommand(loginCommand);
|
|
2342
2403
|
program.addCommand(logoutCommand);
|
|
2343
2404
|
program.addCommand(initCommand);
|