@devness/useai-cli 0.3.1 → 0.3.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/index.js +27 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -430,12 +430,13 @@ function writeJsonFile(path, data) {
|
|
|
430
430
|
function isConfiguredStandard(configPath) {
|
|
431
431
|
const config = readJsonFile(configPath);
|
|
432
432
|
const servers = config["mcpServers"];
|
|
433
|
-
return !!servers?.["
|
|
433
|
+
return !!servers?.["UseAI"];
|
|
434
434
|
}
|
|
435
435
|
function installStandard(configPath) {
|
|
436
436
|
const config = readJsonFile(configPath);
|
|
437
437
|
const servers = config["mcpServers"] ?? {};
|
|
438
|
-
servers["useai"]
|
|
438
|
+
delete servers["useai"];
|
|
439
|
+
servers["UseAI"] = { ...MCP_ENTRY };
|
|
439
440
|
config["mcpServers"] = servers;
|
|
440
441
|
writeJsonFile(configPath, config);
|
|
441
442
|
}
|
|
@@ -443,6 +444,7 @@ function removeStandard(configPath) {
|
|
|
443
444
|
const config = readJsonFile(configPath);
|
|
444
445
|
const servers = config["mcpServers"];
|
|
445
446
|
if (servers) {
|
|
447
|
+
delete servers["UseAI"];
|
|
446
448
|
delete servers["useai"];
|
|
447
449
|
if (Object.keys(servers).length === 0) {
|
|
448
450
|
delete config["mcpServers"];
|
|
@@ -453,12 +455,13 @@ function removeStandard(configPath) {
|
|
|
453
455
|
function isConfiguredVscode(configPath) {
|
|
454
456
|
const config = readJsonFile(configPath);
|
|
455
457
|
const servers = config["servers"];
|
|
456
|
-
return !!servers?.["
|
|
458
|
+
return !!servers?.["UseAI"];
|
|
457
459
|
}
|
|
458
460
|
function installVscode(configPath) {
|
|
459
461
|
const config = readJsonFile(configPath);
|
|
460
462
|
const servers = config["servers"] ?? {};
|
|
461
|
-
servers["useai"]
|
|
463
|
+
delete servers["useai"];
|
|
464
|
+
servers["UseAI"] = { command: MCP_ENTRY.command, args: MCP_ENTRY.args };
|
|
462
465
|
config["servers"] = servers;
|
|
463
466
|
writeJsonFile(configPath, config);
|
|
464
467
|
}
|
|
@@ -466,6 +469,7 @@ function removeVscode(configPath) {
|
|
|
466
469
|
const config = readJsonFile(configPath);
|
|
467
470
|
const servers = config["servers"];
|
|
468
471
|
if (servers) {
|
|
472
|
+
delete servers["UseAI"];
|
|
469
473
|
delete servers["useai"];
|
|
470
474
|
if (Object.keys(servers).length === 0) {
|
|
471
475
|
delete config["servers"];
|
|
@@ -476,12 +480,13 @@ function removeVscode(configPath) {
|
|
|
476
480
|
function isConfiguredZed(configPath) {
|
|
477
481
|
const config = readJsonFile(configPath);
|
|
478
482
|
const servers = config["context_servers"];
|
|
479
|
-
return !!servers?.["
|
|
483
|
+
return !!servers?.["UseAI"];
|
|
480
484
|
}
|
|
481
485
|
function installZed(configPath) {
|
|
482
486
|
const config = readJsonFile(configPath);
|
|
483
487
|
const servers = config["context_servers"] ?? {};
|
|
484
|
-
servers["useai"]
|
|
488
|
+
delete servers["useai"];
|
|
489
|
+
servers["UseAI"] = {
|
|
485
490
|
command: { path: MCP_ENTRY.command, args: MCP_ENTRY.args },
|
|
486
491
|
settings: {}
|
|
487
492
|
};
|
|
@@ -492,6 +497,7 @@ function removeZed(configPath) {
|
|
|
492
497
|
const config = readJsonFile(configPath);
|
|
493
498
|
const servers = config["context_servers"];
|
|
494
499
|
if (servers) {
|
|
500
|
+
delete servers["UseAI"];
|
|
495
501
|
delete servers["useai"];
|
|
496
502
|
if (Object.keys(servers).length === 0) {
|
|
497
503
|
delete config["context_servers"];
|
|
@@ -516,12 +522,13 @@ function writeTomlFile(path, data) {
|
|
|
516
522
|
function isConfiguredToml(configPath) {
|
|
517
523
|
const config = readTomlFile(configPath);
|
|
518
524
|
const servers = config["mcp_servers"];
|
|
519
|
-
return !!servers?.["
|
|
525
|
+
return !!servers?.["UseAI"];
|
|
520
526
|
}
|
|
521
527
|
function installToml(configPath) {
|
|
522
528
|
const config = readTomlFile(configPath);
|
|
523
529
|
const servers = config["mcp_servers"] ?? {};
|
|
524
|
-
servers["useai"]
|
|
530
|
+
delete servers["useai"];
|
|
531
|
+
servers["UseAI"] = { command: MCP_ENTRY.command, args: MCP_ENTRY.args };
|
|
525
532
|
config["mcp_servers"] = servers;
|
|
526
533
|
writeTomlFile(configPath, config);
|
|
527
534
|
}
|
|
@@ -529,6 +536,7 @@ function removeToml(configPath) {
|
|
|
529
536
|
const config = readTomlFile(configPath);
|
|
530
537
|
const servers = config["mcp_servers"];
|
|
531
538
|
if (servers) {
|
|
539
|
+
delete servers["UseAI"];
|
|
532
540
|
delete servers["useai"];
|
|
533
541
|
if (Object.keys(servers).length === 0) {
|
|
534
542
|
delete config["mcp_servers"];
|
|
@@ -553,13 +561,14 @@ function writeYamlFile(path, data) {
|
|
|
553
561
|
function isConfiguredYaml(configPath) {
|
|
554
562
|
const config = readYamlFile(configPath);
|
|
555
563
|
const extensions = config["extensions"];
|
|
556
|
-
return !!extensions?.["
|
|
564
|
+
return !!extensions?.["UseAI"];
|
|
557
565
|
}
|
|
558
566
|
function installYaml(configPath) {
|
|
559
567
|
const config = readYamlFile(configPath);
|
|
560
568
|
const extensions = config["extensions"] ?? {};
|
|
561
|
-
extensions["useai"]
|
|
562
|
-
|
|
569
|
+
delete extensions["useai"];
|
|
570
|
+
extensions["UseAI"] = {
|
|
571
|
+
name: "UseAI",
|
|
563
572
|
cmd: MCP_ENTRY.command,
|
|
564
573
|
args: MCP_ENTRY.args,
|
|
565
574
|
enabled: true,
|
|
@@ -572,6 +581,7 @@ function removeYaml(configPath) {
|
|
|
572
581
|
const config = readYamlFile(configPath);
|
|
573
582
|
const extensions = config["extensions"];
|
|
574
583
|
if (extensions) {
|
|
584
|
+
delete extensions["UseAI"];
|
|
575
585
|
delete extensions["useai"];
|
|
576
586
|
if (Object.keys(extensions).length === 0) {
|
|
577
587
|
delete config["extensions"];
|
|
@@ -855,7 +865,7 @@ async function installFlow(tools, autoYes, explicit) {
|
|
|
855
865
|
}
|
|
856
866
|
}
|
|
857
867
|
console.log(`
|
|
858
|
-
Done!
|
|
868
|
+
Done! UseAI MCP server configured in ${chalk6.bold(String(toInstall.length))} tool${toInstall.length === 1 ? "" : "s"}.
|
|
859
869
|
`);
|
|
860
870
|
}
|
|
861
871
|
async function removeFlow(tools, autoYes, explicit) {
|
|
@@ -898,18 +908,18 @@ async function removeFlow(tools, autoYes, explicit) {
|
|
|
898
908
|
}
|
|
899
909
|
});
|
|
900
910
|
if (configured.length === 0) {
|
|
901
|
-
console.log(info("
|
|
911
|
+
console.log(info("UseAI is not configured in any AI tools."));
|
|
902
912
|
return;
|
|
903
913
|
}
|
|
904
914
|
console.log(`
|
|
905
|
-
Found
|
|
915
|
+
Found UseAI configured in ${chalk6.bold(String(configured.length))} tool${configured.length === 1 ? "" : "s"}:
|
|
906
916
|
`);
|
|
907
917
|
let toRemove;
|
|
908
918
|
if (autoYes) {
|
|
909
919
|
toRemove = configured;
|
|
910
920
|
} else {
|
|
911
921
|
const selected = await checkbox({
|
|
912
|
-
message: "Select tools to remove
|
|
922
|
+
message: "Select tools to remove UseAI from:",
|
|
913
923
|
choices: configured.map((t) => ({
|
|
914
924
|
name: t.name,
|
|
915
925
|
value: t.id,
|
|
@@ -934,10 +944,10 @@ async function removeFlow(tools, autoYes, explicit) {
|
|
|
934
944
|
}
|
|
935
945
|
}
|
|
936
946
|
console.log(`
|
|
937
|
-
Done!
|
|
947
|
+
Done! UseAI removed from ${chalk6.bold(String(toRemove.length))} tool${toRemove.length === 1 ? "" : "s"}.
|
|
938
948
|
`);
|
|
939
949
|
}
|
|
940
|
-
var mcpCommand = new Command7("mcp").description("Configure
|
|
950
|
+
var mcpCommand = new Command7("mcp").description("Configure UseAI MCP server in your AI tools").argument("[tools...]", "Specific tool names (e.g. codex cursor vscode)").option("--remove", "Remove UseAI from configured tools").option("--status", "Show configuration status without modifying").option("-y, --yes", "Skip confirmation, auto-select all detected tools").action(async (toolNames, opts) => {
|
|
941
951
|
const explicit = toolNames.length > 0;
|
|
942
952
|
let tools = AI_TOOLS;
|
|
943
953
|
if (explicit) {
|