allagents 0.12.0 → 0.13.0
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 +298 -63
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22437,6 +22437,7 @@ var exports_user_workspace = {};
|
|
|
22437
22437
|
__export(exports_user_workspace, {
|
|
22438
22438
|
removeUserPluginsForMarketplace: () => removeUserPluginsForMarketplace,
|
|
22439
22439
|
removeUserPlugin: () => removeUserPlugin,
|
|
22440
|
+
hasUserPlugin: () => hasUserPlugin,
|
|
22440
22441
|
getUserWorkspaceConfigPath: () => getUserWorkspaceConfigPath,
|
|
22441
22442
|
getUserWorkspaceConfig: () => getUserWorkspaceConfig,
|
|
22442
22443
|
getUserPluginsForMarketplace: () => getUserPluginsForMarketplace,
|
|
@@ -22502,6 +22503,14 @@ async function addUserPlugin(plugin) {
|
|
|
22502
22503
|
}
|
|
22503
22504
|
return addPluginToUserConfig(plugin, configPath);
|
|
22504
22505
|
}
|
|
22506
|
+
async function hasUserPlugin(plugin) {
|
|
22507
|
+
const config = await getUserWorkspaceConfig();
|
|
22508
|
+
if (!config)
|
|
22509
|
+
return false;
|
|
22510
|
+
if (config.plugins.indexOf(plugin) !== -1)
|
|
22511
|
+
return true;
|
|
22512
|
+
return config.plugins.some((p) => p.startsWith(`${plugin}@`) || p === plugin);
|
|
22513
|
+
}
|
|
22505
22514
|
async function removeUserPlugin(plugin) {
|
|
22506
22515
|
await ensureUserWorkspace();
|
|
22507
22516
|
const configPath = getUserWorkspaceConfigPath();
|
|
@@ -23988,10 +23997,15 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
23988
23997
|
if (parsedUrl) {
|
|
23989
23998
|
const basePath = parsedUrl.subpath || "";
|
|
23990
23999
|
for (const agentFile of AGENT_FILES) {
|
|
24000
|
+
const targetFilePath = join10(absoluteTarget, agentFile);
|
|
24001
|
+
if (existsSync9(targetFilePath)) {
|
|
24002
|
+
copiedAgentFiles.push(agentFile);
|
|
24003
|
+
continue;
|
|
24004
|
+
}
|
|
23991
24005
|
const filePath = basePath ? `${basePath}/${agentFile}` : agentFile;
|
|
23992
24006
|
const content = await fetchFileFromGitHub(parsedUrl.owner, parsedUrl.repo, filePath, parsedUrl.branch);
|
|
23993
24007
|
if (content) {
|
|
23994
|
-
await writeFile5(
|
|
24008
|
+
await writeFile5(targetFilePath, content, "utf-8");
|
|
23995
24009
|
copiedAgentFiles.push(agentFile);
|
|
23996
24010
|
}
|
|
23997
24011
|
}
|
|
@@ -23999,10 +24013,15 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
23999
24013
|
} else {
|
|
24000
24014
|
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
24001
24015
|
for (const agentFile of AGENT_FILES) {
|
|
24016
|
+
const targetFilePath = join10(absoluteTarget, agentFile);
|
|
24017
|
+
if (existsSync9(targetFilePath)) {
|
|
24018
|
+
copiedAgentFiles.push(agentFile);
|
|
24019
|
+
continue;
|
|
24020
|
+
}
|
|
24002
24021
|
const sourcePath = join10(effectiveSourceDir, agentFile);
|
|
24003
24022
|
if (existsSync9(sourcePath)) {
|
|
24004
24023
|
const content = await readFile9(sourcePath, "utf-8");
|
|
24005
|
-
await writeFile5(
|
|
24024
|
+
await writeFile5(targetFilePath, content, "utf-8");
|
|
24006
24025
|
copiedAgentFiles.push(agentFile);
|
|
24007
24026
|
}
|
|
24008
24027
|
}
|
|
@@ -24066,11 +24085,11 @@ import { join as join11 } from "node:path";
|
|
|
24066
24085
|
async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
24067
24086
|
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
24068
24087
|
if (!existsSync10(configPath)) {
|
|
24088
|
+
const userPlugins = await getUserPluginStatuses();
|
|
24069
24089
|
return {
|
|
24070
|
-
success:
|
|
24071
|
-
error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
24072
|
-
Run 'allagents workspace init <path>' to create a new workspace`,
|
|
24090
|
+
success: true,
|
|
24073
24091
|
plugins: [],
|
|
24092
|
+
userPlugins,
|
|
24074
24093
|
clients: []
|
|
24075
24094
|
};
|
|
24076
24095
|
}
|
|
@@ -24229,6 +24248,23 @@ async function addPluginToConfig(plugin, configPath, autoRegistered) {
|
|
|
24229
24248
|
};
|
|
24230
24249
|
}
|
|
24231
24250
|
}
|
|
24251
|
+
async function hasPlugin(plugin, workspacePath = process.cwd()) {
|
|
24252
|
+
const configPath = join14(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
24253
|
+
if (!existsSync13(configPath))
|
|
24254
|
+
return false;
|
|
24255
|
+
try {
|
|
24256
|
+
const content = await readFile11(configPath, "utf-8");
|
|
24257
|
+
const config = load(content);
|
|
24258
|
+
if (config.plugins.indexOf(plugin) !== -1)
|
|
24259
|
+
return true;
|
|
24260
|
+
if (!isPluginSpec(plugin)) {
|
|
24261
|
+
return config.plugins.some((p) => p.startsWith(`${plugin}@`) || p === plugin);
|
|
24262
|
+
}
|
|
24263
|
+
return false;
|
|
24264
|
+
} catch {
|
|
24265
|
+
return false;
|
|
24266
|
+
}
|
|
24267
|
+
}
|
|
24232
24268
|
async function removePlugin(plugin, workspacePath = process.cwd()) {
|
|
24233
24269
|
const configPath = join14(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
24234
24270
|
if (!existsSync13(configPath)) {
|
|
@@ -24274,7 +24310,7 @@ var package_default;
|
|
|
24274
24310
|
var init_package = __esm(() => {
|
|
24275
24311
|
package_default = {
|
|
24276
24312
|
name: "allagents",
|
|
24277
|
-
version: "0.
|
|
24313
|
+
version: "0.13.0",
|
|
24278
24314
|
description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
24279
24315
|
type: "module",
|
|
24280
24316
|
bin: {
|
|
@@ -25545,10 +25581,47 @@ var init_dist2 = __esm(() => {
|
|
|
25545
25581
|
ze = `${import_picocolors2.default.gray(h)} `;
|
|
25546
25582
|
});
|
|
25547
25583
|
|
|
25584
|
+
// src/cli/tui/cache.ts
|
|
25585
|
+
class TuiCache {
|
|
25586
|
+
marketplaces;
|
|
25587
|
+
context;
|
|
25588
|
+
marketplacePlugins = new Map;
|
|
25589
|
+
getMarketplaces() {
|
|
25590
|
+
return this.marketplaces;
|
|
25591
|
+
}
|
|
25592
|
+
setMarketplaces(marketplaces) {
|
|
25593
|
+
this.marketplaces = marketplaces;
|
|
25594
|
+
}
|
|
25595
|
+
hasCachedContext() {
|
|
25596
|
+
return this.context !== undefined;
|
|
25597
|
+
}
|
|
25598
|
+
getContext() {
|
|
25599
|
+
return this.context;
|
|
25600
|
+
}
|
|
25601
|
+
setContext(context) {
|
|
25602
|
+
this.context = context;
|
|
25603
|
+
}
|
|
25604
|
+
getMarketplacePlugins(name) {
|
|
25605
|
+
return this.marketplacePlugins.get(name);
|
|
25606
|
+
}
|
|
25607
|
+
setMarketplacePlugins(name, result) {
|
|
25608
|
+
this.marketplacePlugins.set(name, result);
|
|
25609
|
+
}
|
|
25610
|
+
invalidate() {
|
|
25611
|
+
this.marketplaces = undefined;
|
|
25612
|
+
this.context = undefined;
|
|
25613
|
+
this.marketplacePlugins.clear();
|
|
25614
|
+
}
|
|
25615
|
+
}
|
|
25616
|
+
|
|
25548
25617
|
// src/cli/tui/context.ts
|
|
25549
25618
|
import { existsSync as existsSync14 } from "node:fs";
|
|
25550
25619
|
import { join as join15 } from "node:path";
|
|
25551
|
-
async function getTuiContext(cwd = process.cwd()) {
|
|
25620
|
+
async function getTuiContext(cwd = process.cwd(), cache) {
|
|
25621
|
+
const cachedContext = cache?.getContext();
|
|
25622
|
+
if (cachedContext) {
|
|
25623
|
+
return cachedContext;
|
|
25624
|
+
}
|
|
25552
25625
|
const configPath = join15(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
25553
25626
|
const hasWorkspace = existsSync14(configPath);
|
|
25554
25627
|
let projectPluginCount = 0;
|
|
@@ -25571,10 +25644,16 @@ async function getTuiContext(cwd = process.cwd()) {
|
|
|
25571
25644
|
} catch {}
|
|
25572
25645
|
let marketplaceCount = 0;
|
|
25573
25646
|
try {
|
|
25574
|
-
const
|
|
25575
|
-
|
|
25647
|
+
const cachedMarketplaces = cache?.getMarketplaces();
|
|
25648
|
+
if (cachedMarketplaces) {
|
|
25649
|
+
marketplaceCount = cachedMarketplaces.length;
|
|
25650
|
+
} else {
|
|
25651
|
+
const marketplaces = await listMarketplaces();
|
|
25652
|
+
cache?.setMarketplaces(marketplaces);
|
|
25653
|
+
marketplaceCount = marketplaces.length;
|
|
25654
|
+
}
|
|
25576
25655
|
} catch {}
|
|
25577
|
-
|
|
25656
|
+
const context = {
|
|
25578
25657
|
hasWorkspace,
|
|
25579
25658
|
workspacePath: hasWorkspace ? cwd : null,
|
|
25580
25659
|
projectPluginCount,
|
|
@@ -25583,6 +25662,8 @@ async function getTuiContext(cwd = process.cwd()) {
|
|
|
25583
25662
|
hasUserConfig,
|
|
25584
25663
|
marketplaceCount
|
|
25585
25664
|
};
|
|
25665
|
+
cache?.setContext(context);
|
|
25666
|
+
return context;
|
|
25586
25667
|
}
|
|
25587
25668
|
async function detectNeedsSync(cwd, hasWorkspace, pluginCount) {
|
|
25588
25669
|
if (!hasWorkspace) {
|
|
@@ -25607,10 +25688,48 @@ var init_context = __esm(() => {
|
|
|
25607
25688
|
init_marketplace();
|
|
25608
25689
|
});
|
|
25609
25690
|
|
|
25691
|
+
// src/cli/tui/prompts.ts
|
|
25692
|
+
function eraseCancelledPrompt(lines = 2) {
|
|
25693
|
+
process.stdout.write(import_sisteransi3.cursor.move(0, -lines) + import_sisteransi3.erase.down());
|
|
25694
|
+
}
|
|
25695
|
+
async function select(opts) {
|
|
25696
|
+
const result = await qt(opts);
|
|
25697
|
+
if (Ct(result)) {
|
|
25698
|
+
eraseCancelledPrompt();
|
|
25699
|
+
}
|
|
25700
|
+
return result;
|
|
25701
|
+
}
|
|
25702
|
+
async function multiselect(opts) {
|
|
25703
|
+
const result = await Lt2(opts);
|
|
25704
|
+
if (Ct(result)) {
|
|
25705
|
+
eraseCancelledPrompt();
|
|
25706
|
+
}
|
|
25707
|
+
return result;
|
|
25708
|
+
}
|
|
25709
|
+
async function text(opts) {
|
|
25710
|
+
const result = await Qt(opts);
|
|
25711
|
+
if (Ct(result)) {
|
|
25712
|
+
eraseCancelledPrompt();
|
|
25713
|
+
}
|
|
25714
|
+
return result;
|
|
25715
|
+
}
|
|
25716
|
+
async function confirm(opts) {
|
|
25717
|
+
const result = await Mt2(opts);
|
|
25718
|
+
if (Ct(result)) {
|
|
25719
|
+
eraseCancelledPrompt();
|
|
25720
|
+
}
|
|
25721
|
+
return result;
|
|
25722
|
+
}
|
|
25723
|
+
var import_sisteransi3;
|
|
25724
|
+
var init_prompts = __esm(() => {
|
|
25725
|
+
init_dist2();
|
|
25726
|
+
import_sisteransi3 = __toESM(require_src2(), 1);
|
|
25727
|
+
});
|
|
25728
|
+
|
|
25610
25729
|
// src/cli/tui/actions/init.ts
|
|
25611
25730
|
async function runInit() {
|
|
25612
25731
|
try {
|
|
25613
|
-
const targetPath = await
|
|
25732
|
+
const targetPath = await text({
|
|
25614
25733
|
message: "Where should the workspace be created?",
|
|
25615
25734
|
placeholder: ".",
|
|
25616
25735
|
defaultValue: "."
|
|
@@ -25618,7 +25737,7 @@ async function runInit() {
|
|
|
25618
25737
|
if (Ct(targetPath)) {
|
|
25619
25738
|
return;
|
|
25620
25739
|
}
|
|
25621
|
-
const fromSource = await
|
|
25740
|
+
const fromSource = await text({
|
|
25622
25741
|
message: "Template source (leave empty for default)",
|
|
25623
25742
|
placeholder: "GitHub URL, path, or leave empty",
|
|
25624
25743
|
defaultValue: ""
|
|
@@ -25645,6 +25764,7 @@ async function runInit() {
|
|
|
25645
25764
|
var init_init = __esm(() => {
|
|
25646
25765
|
init_dist2();
|
|
25647
25766
|
init_workspace();
|
|
25767
|
+
init_prompts();
|
|
25648
25768
|
});
|
|
25649
25769
|
|
|
25650
25770
|
// src/cli/tui/actions/sync.ts
|
|
@@ -25698,15 +25818,28 @@ async function runStatus(context) {
|
|
|
25698
25818
|
return;
|
|
25699
25819
|
}
|
|
25700
25820
|
const lines = [];
|
|
25701
|
-
|
|
25821
|
+
const userPlugins = status.userPlugins ?? [];
|
|
25822
|
+
const hasProjectPlugins = status.plugins.length > 0;
|
|
25823
|
+
const hasUserPlugins = userPlugins.length > 0;
|
|
25824
|
+
if (!hasProjectPlugins && !hasUserPlugins) {
|
|
25702
25825
|
lines.push("No plugins configured");
|
|
25703
|
-
}
|
|
25704
|
-
|
|
25826
|
+
}
|
|
25827
|
+
if (hasProjectPlugins) {
|
|
25828
|
+
lines.push("Project plugins:");
|
|
25705
25829
|
for (const plugin of status.plugins) {
|
|
25706
25830
|
const icon = plugin.available ? "✓" : "✗";
|
|
25707
25831
|
lines.push(` ${icon} ${plugin.source} (${plugin.type})`);
|
|
25708
25832
|
}
|
|
25709
25833
|
}
|
|
25834
|
+
if (hasUserPlugins) {
|
|
25835
|
+
if (hasProjectPlugins)
|
|
25836
|
+
lines.push("");
|
|
25837
|
+
lines.push("User plugins:");
|
|
25838
|
+
for (const plugin of userPlugins) {
|
|
25839
|
+
const icon = plugin.available ? "✓" : "✗";
|
|
25840
|
+
lines.push(` ${icon} ${plugin.source} (${plugin.type})`);
|
|
25841
|
+
}
|
|
25842
|
+
}
|
|
25710
25843
|
lines.push("");
|
|
25711
25844
|
lines.push(`Clients: ${status.clients.length > 0 ? status.clients.join(", ") : "none"}`);
|
|
25712
25845
|
kt2(lines.join(`
|
|
@@ -25722,10 +25855,26 @@ var init_status2 = __esm(() => {
|
|
|
25722
25855
|
});
|
|
25723
25856
|
|
|
25724
25857
|
// src/cli/tui/actions/plugins.ts
|
|
25725
|
-
async function
|
|
25858
|
+
async function getCachedMarketplaces(cache) {
|
|
25859
|
+
const cached = cache?.getMarketplaces();
|
|
25860
|
+
if (cached)
|
|
25861
|
+
return cached;
|
|
25862
|
+
const result = await listMarketplaces();
|
|
25863
|
+
cache?.setMarketplaces(result);
|
|
25864
|
+
return result;
|
|
25865
|
+
}
|
|
25866
|
+
async function getCachedMarketplacePlugins(name, cache) {
|
|
25867
|
+
const cached = cache?.getMarketplacePlugins(name);
|
|
25868
|
+
if (cached)
|
|
25869
|
+
return cached;
|
|
25870
|
+
const result = await listMarketplacePlugins(name);
|
|
25871
|
+
cache?.setMarketplacePlugins(name, result);
|
|
25872
|
+
return result;
|
|
25873
|
+
}
|
|
25874
|
+
async function installSelectedPlugin(pluginRef, context, cache) {
|
|
25726
25875
|
let scope = "user";
|
|
25727
25876
|
if (context.hasWorkspace) {
|
|
25728
|
-
const scopeChoice = await
|
|
25877
|
+
const scopeChoice = await select({
|
|
25729
25878
|
message: "Install scope",
|
|
25730
25879
|
options: [
|
|
25731
25880
|
{ label: "Project (this workspace)", value: "project" },
|
|
@@ -25764,12 +25913,13 @@ async function installSelectedPlugin(pluginRef, context) {
|
|
|
25764
25913
|
await syncUserWorkspace();
|
|
25765
25914
|
syncS.stop("Sync complete");
|
|
25766
25915
|
}
|
|
25916
|
+
cache?.invalidate();
|
|
25767
25917
|
kt2(`Installed: ${pluginRef}`, "Success");
|
|
25768
25918
|
return true;
|
|
25769
25919
|
}
|
|
25770
|
-
async function runInstallPlugin(context) {
|
|
25920
|
+
async function runInstallPlugin(context, cache) {
|
|
25771
25921
|
try {
|
|
25772
|
-
const marketplaces = await
|
|
25922
|
+
const marketplaces = await getCachedMarketplaces(cache);
|
|
25773
25923
|
if (marketplaces.length === 0) {
|
|
25774
25924
|
kt2(`No marketplaces registered.
|
|
25775
25925
|
Use "Manage marketplaces" to add one first.`, "Marketplace");
|
|
@@ -25777,7 +25927,7 @@ Use "Manage marketplaces" to add one first.`, "Marketplace");
|
|
|
25777
25927
|
}
|
|
25778
25928
|
const allPlugins = [];
|
|
25779
25929
|
for (const marketplace of marketplaces) {
|
|
25780
|
-
const result = await
|
|
25930
|
+
const result = await getCachedMarketplacePlugins(marketplace.name, cache);
|
|
25781
25931
|
for (const plugin of result.plugins) {
|
|
25782
25932
|
const label = plugin.description ? `${plugin.name} - ${plugin.description}` : plugin.name;
|
|
25783
25933
|
allPlugins.push({
|
|
@@ -25790,20 +25940,20 @@ Use "Manage marketplaces" to add one first.`, "Marketplace");
|
|
|
25790
25940
|
kt2("No plugins found in any marketplace.", "Plugins");
|
|
25791
25941
|
return;
|
|
25792
25942
|
}
|
|
25793
|
-
const selected = await
|
|
25943
|
+
const selected = await select({
|
|
25794
25944
|
message: "Select a plugin to install",
|
|
25795
25945
|
options: allPlugins
|
|
25796
25946
|
});
|
|
25797
25947
|
if (Ct(selected)) {
|
|
25798
25948
|
return;
|
|
25799
25949
|
}
|
|
25800
|
-
await installSelectedPlugin(selected, context);
|
|
25950
|
+
await installSelectedPlugin(selected, context, cache);
|
|
25801
25951
|
} catch (error) {
|
|
25802
25952
|
const message = error instanceof Error ? error.message : String(error);
|
|
25803
25953
|
kt2(message, "Error");
|
|
25804
25954
|
}
|
|
25805
25955
|
}
|
|
25806
|
-
async function runManagePlugins(context) {
|
|
25956
|
+
async function runManagePlugins(context, cache) {
|
|
25807
25957
|
try {
|
|
25808
25958
|
const status = await getWorkspaceStatus(context.workspacePath ?? undefined);
|
|
25809
25959
|
if (!status.success || status.plugins.length === 0) {
|
|
@@ -25814,7 +25964,7 @@ async function runManagePlugins(context) {
|
|
|
25814
25964
|
label: `${plugin.available ? "✓" : "✗"} ${plugin.source} (${plugin.type})`,
|
|
25815
25965
|
value: plugin.source
|
|
25816
25966
|
}));
|
|
25817
|
-
const selected = await
|
|
25967
|
+
const selected = await multiselect({
|
|
25818
25968
|
message: "Select plugins to remove",
|
|
25819
25969
|
options: options2,
|
|
25820
25970
|
required: false
|
|
@@ -25828,7 +25978,7 @@ async function runManagePlugins(context) {
|
|
|
25828
25978
|
}
|
|
25829
25979
|
let scope = context.hasWorkspace ? "project" : "user";
|
|
25830
25980
|
if (context.hasWorkspace) {
|
|
25831
|
-
const scopeChoice = await
|
|
25981
|
+
const scopeChoice = await select({
|
|
25832
25982
|
message: "Remove from which scope?",
|
|
25833
25983
|
options: [
|
|
25834
25984
|
{ label: "Project (this workspace)", value: "project" },
|
|
@@ -25861,6 +26011,7 @@ async function runManagePlugins(context) {
|
|
|
25861
26011
|
await syncUserWorkspace();
|
|
25862
26012
|
}
|
|
25863
26013
|
syncS.stop("Sync complete");
|
|
26014
|
+
cache?.invalidate();
|
|
25864
26015
|
kt2(results.join(`
|
|
25865
26016
|
`), "Removed");
|
|
25866
26017
|
} catch (error) {
|
|
@@ -25868,10 +26019,10 @@ async function runManagePlugins(context) {
|
|
|
25868
26019
|
kt2(message, "Error");
|
|
25869
26020
|
}
|
|
25870
26021
|
}
|
|
25871
|
-
async function runBrowseMarketplaces(context) {
|
|
26022
|
+
async function runBrowseMarketplaces(context, cache) {
|
|
25872
26023
|
try {
|
|
25873
26024
|
while (true) {
|
|
25874
|
-
const marketplaces = await
|
|
26025
|
+
const marketplaces = await getCachedMarketplaces(cache);
|
|
25875
26026
|
const options2 = [
|
|
25876
26027
|
{ label: "+ Add marketplace", value: "__add__" },
|
|
25877
26028
|
...marketplaces.map((m) => ({
|
|
@@ -25880,7 +26031,7 @@ async function runBrowseMarketplaces(context) {
|
|
|
25880
26031
|
})),
|
|
25881
26032
|
{ label: "Back", value: "__back__" }
|
|
25882
26033
|
];
|
|
25883
|
-
const selected = await
|
|
26034
|
+
const selected = await select({
|
|
25884
26035
|
message: "Marketplaces",
|
|
25885
26036
|
options: options2
|
|
25886
26037
|
});
|
|
@@ -25888,7 +26039,7 @@ async function runBrowseMarketplaces(context) {
|
|
|
25888
26039
|
return;
|
|
25889
26040
|
}
|
|
25890
26041
|
if (selected === "__add__") {
|
|
25891
|
-
const source = await
|
|
26042
|
+
const source = await text({
|
|
25892
26043
|
message: "Marketplace source (GitHub URL, owner/repo, or name)",
|
|
25893
26044
|
placeholder: "e.g., anthropics/claude-plugins-official"
|
|
25894
26045
|
});
|
|
@@ -25901,19 +26052,21 @@ async function runBrowseMarketplaces(context) {
|
|
|
25901
26052
|
s.stop(result.success ? "Marketplace added" : "Failed to add marketplace");
|
|
25902
26053
|
if (!result.success) {
|
|
25903
26054
|
kt2(result.error ?? "Unknown error", "Error");
|
|
26055
|
+
} else {
|
|
26056
|
+
cache?.invalidate();
|
|
25904
26057
|
}
|
|
25905
26058
|
continue;
|
|
25906
26059
|
}
|
|
25907
|
-
await runMarketplaceDetail(selected, context);
|
|
26060
|
+
await runMarketplaceDetail(selected, context, cache);
|
|
25908
26061
|
}
|
|
25909
26062
|
} catch (error) {
|
|
25910
26063
|
const message = error instanceof Error ? error.message : String(error);
|
|
25911
26064
|
kt2(message, "Error");
|
|
25912
26065
|
}
|
|
25913
26066
|
}
|
|
25914
|
-
async function runMarketplaceDetail(marketplaceName, context) {
|
|
26067
|
+
async function runMarketplaceDetail(marketplaceName, context, cache) {
|
|
25915
26068
|
while (true) {
|
|
25916
|
-
const action = await
|
|
26069
|
+
const action = await select({
|
|
25917
26070
|
message: `Marketplace: ${marketplaceName}`,
|
|
25918
26071
|
options: [
|
|
25919
26072
|
{ label: "Browse plugins", value: "browse" },
|
|
@@ -25927,7 +26080,7 @@ async function runMarketplaceDetail(marketplaceName, context) {
|
|
|
25927
26080
|
}
|
|
25928
26081
|
if (action === "browse") {
|
|
25929
26082
|
try {
|
|
25930
|
-
const result = await
|
|
26083
|
+
const result = await getCachedMarketplacePlugins(marketplaceName, cache);
|
|
25931
26084
|
if (result.plugins.length === 0) {
|
|
25932
26085
|
kt2("No plugins found in this marketplace.", "Plugins");
|
|
25933
26086
|
continue;
|
|
@@ -25937,7 +26090,7 @@ async function runMarketplaceDetail(marketplaceName, context) {
|
|
|
25937
26090
|
return { label, value: plugin.name };
|
|
25938
26091
|
});
|
|
25939
26092
|
pluginOptions.push({ label: "Back", value: "__back__" });
|
|
25940
|
-
const selectedPlugin = await
|
|
26093
|
+
const selectedPlugin = await select({
|
|
25941
26094
|
message: "Select a plugin to install",
|
|
25942
26095
|
options: pluginOptions
|
|
25943
26096
|
});
|
|
@@ -25945,7 +26098,7 @@ async function runMarketplaceDetail(marketplaceName, context) {
|
|
|
25945
26098
|
continue;
|
|
25946
26099
|
}
|
|
25947
26100
|
const pluginRef = `${selectedPlugin}@${marketplaceName}`;
|
|
25948
|
-
await installSelectedPlugin(pluginRef, context);
|
|
26101
|
+
await installSelectedPlugin(pluginRef, context, cache);
|
|
25949
26102
|
} catch (error) {
|
|
25950
26103
|
const message = error instanceof Error ? error.message : String(error);
|
|
25951
26104
|
kt2(message, "Error");
|
|
@@ -25960,6 +26113,7 @@ async function runMarketplaceDetail(marketplaceName, context) {
|
|
|
25960
26113
|
const summary = results.map((r) => `${r.success ? "✓" : "✗"} ${r.name}${r.error ? ` - ${r.error}` : ""}`).join(`
|
|
25961
26114
|
`);
|
|
25962
26115
|
s.stop("Update complete");
|
|
26116
|
+
cache?.invalidate();
|
|
25963
26117
|
kt2(summary || "Marketplace updated.", "Update");
|
|
25964
26118
|
} catch (error) {
|
|
25965
26119
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -25968,7 +26122,7 @@ async function runMarketplaceDetail(marketplaceName, context) {
|
|
|
25968
26122
|
continue;
|
|
25969
26123
|
}
|
|
25970
26124
|
if (action === "remove") {
|
|
25971
|
-
const confirmed = await
|
|
26125
|
+
const confirmed = await confirm({
|
|
25972
26126
|
message: `Remove marketplace "${marketplaceName}"?`
|
|
25973
26127
|
});
|
|
25974
26128
|
if (Ct(confirmed) || !confirmed) {
|
|
@@ -25983,6 +26137,7 @@ async function runMarketplaceDetail(marketplaceName, context) {
|
|
|
25983
26137
|
kt2(result.error ?? "Unknown error", "Error");
|
|
25984
26138
|
continue;
|
|
25985
26139
|
}
|
|
26140
|
+
cache?.invalidate();
|
|
25986
26141
|
} catch (error) {
|
|
25987
26142
|
const message = error instanceof Error ? error.message : String(error);
|
|
25988
26143
|
kt2(message, "Error");
|
|
@@ -25998,12 +26153,13 @@ var init_plugins = __esm(() => {
|
|
|
25998
26153
|
init_sync();
|
|
25999
26154
|
init_marketplace();
|
|
26000
26155
|
init_status();
|
|
26156
|
+
init_prompts();
|
|
26001
26157
|
});
|
|
26002
26158
|
|
|
26003
26159
|
// src/cli/tui/actions/update.ts
|
|
26004
26160
|
async function runUpdate() {
|
|
26005
26161
|
try {
|
|
26006
|
-
const confirmed = await
|
|
26162
|
+
const confirmed = await confirm({
|
|
26007
26163
|
message: "Check for and install updates?"
|
|
26008
26164
|
});
|
|
26009
26165
|
if (Ct(confirmed) || !confirmed) {
|
|
@@ -26025,6 +26181,7 @@ async function runUpdate() {
|
|
|
26025
26181
|
var init_update = __esm(() => {
|
|
26026
26182
|
init_dist2();
|
|
26027
26183
|
init_execa();
|
|
26184
|
+
init_prompts();
|
|
26028
26185
|
});
|
|
26029
26186
|
|
|
26030
26187
|
// src/cli/tui/wizard.ts
|
|
@@ -26084,10 +26241,11 @@ function buildSummary(context) {
|
|
|
26084
26241
|
}
|
|
26085
26242
|
async function runWizard() {
|
|
26086
26243
|
Nt(`${source_default.cyan("allagents")} v${package_default.version}`);
|
|
26087
|
-
|
|
26244
|
+
const cache = new TuiCache;
|
|
26245
|
+
let context = await getTuiContext(process.cwd(), cache);
|
|
26088
26246
|
while (true) {
|
|
26089
26247
|
kt2(buildSummary(context), "Workspace");
|
|
26090
|
-
const action = await
|
|
26248
|
+
const action = await select({
|
|
26091
26249
|
message: "What would you like to do?",
|
|
26092
26250
|
options: buildMenuOptions(context)
|
|
26093
26251
|
});
|
|
@@ -26098,30 +26256,33 @@ async function runWizard() {
|
|
|
26098
26256
|
switch (action) {
|
|
26099
26257
|
case "init":
|
|
26100
26258
|
await runInit();
|
|
26259
|
+
cache.invalidate();
|
|
26101
26260
|
break;
|
|
26102
26261
|
case "sync":
|
|
26103
26262
|
await runSync(context);
|
|
26263
|
+
cache.invalidate();
|
|
26104
26264
|
break;
|
|
26105
26265
|
case "status":
|
|
26106
26266
|
await runStatus(context);
|
|
26107
26267
|
break;
|
|
26108
26268
|
case "install":
|
|
26109
|
-
await runInstallPlugin(context);
|
|
26269
|
+
await runInstallPlugin(context, cache);
|
|
26110
26270
|
break;
|
|
26111
26271
|
case "manage":
|
|
26112
|
-
await runManagePlugins(context);
|
|
26272
|
+
await runManagePlugins(context, cache);
|
|
26113
26273
|
break;
|
|
26114
26274
|
case "marketplace":
|
|
26115
|
-
await runBrowseMarketplaces(context);
|
|
26275
|
+
await runBrowseMarketplaces(context, cache);
|
|
26116
26276
|
break;
|
|
26117
26277
|
case "update":
|
|
26118
26278
|
await runUpdate();
|
|
26279
|
+
cache.invalidate();
|
|
26119
26280
|
break;
|
|
26120
26281
|
case "exit":
|
|
26121
26282
|
Wt2("Bye");
|
|
26122
26283
|
return;
|
|
26123
26284
|
}
|
|
26124
|
-
context = await getTuiContext();
|
|
26285
|
+
context = await getTuiContext(process.cwd(), cache);
|
|
26125
26286
|
}
|
|
26126
26287
|
}
|
|
26127
26288
|
var init_wizard = __esm(() => {
|
|
@@ -26129,6 +26290,7 @@ var init_wizard = __esm(() => {
|
|
|
26129
26290
|
init_source();
|
|
26130
26291
|
init_package();
|
|
26131
26292
|
init_context();
|
|
26293
|
+
init_prompts();
|
|
26132
26294
|
init_init();
|
|
26133
26295
|
init_sync2();
|
|
26134
26296
|
init_status2();
|
|
@@ -27350,7 +27512,7 @@ var pluginInstallCmd = import_cmd_ts3.command({
|
|
|
27350
27512
|
if (result.autoRegistered) {
|
|
27351
27513
|
console.log(`✓ Auto-registered marketplace: ${result.autoRegistered}`);
|
|
27352
27514
|
}
|
|
27353
|
-
console.log(`✓ Installed plugin${isUser ? "
|
|
27515
|
+
console.log(`✓ Installed plugin (${isUser ? "user" : "project"} scope): ${plugin}`);
|
|
27354
27516
|
const { ok: syncOk } = isUser ? await runUserSyncAndPrint() : await runSyncAndPrint();
|
|
27355
27517
|
if (!syncOk) {
|
|
27356
27518
|
process.exit(1);
|
|
@@ -27378,38 +27540,111 @@ var pluginUninstallCmd = import_cmd_ts3.command({
|
|
|
27378
27540
|
},
|
|
27379
27541
|
handler: async ({ plugin, scope }) => {
|
|
27380
27542
|
try {
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27543
|
+
if (scope) {
|
|
27544
|
+
const isUser = scope === "user";
|
|
27545
|
+
const result = isUser ? await removeUserPlugin(plugin) : await removePlugin(plugin);
|
|
27546
|
+
if (!result.success) {
|
|
27547
|
+
if (isJsonMode()) {
|
|
27548
|
+
jsonOutput({ success: false, command: "plugin uninstall", error: result.error ?? "Unknown error" });
|
|
27549
|
+
process.exit(1);
|
|
27550
|
+
}
|
|
27551
|
+
console.error(`Error: ${result.error}`);
|
|
27552
|
+
process.exit(1);
|
|
27553
|
+
}
|
|
27554
|
+
if (isJsonMode()) {
|
|
27555
|
+
const { ok, syncData } = isUser ? await runUserSyncAndPrint() : await runSyncAndPrint();
|
|
27556
|
+
jsonOutput({
|
|
27557
|
+
success: ok,
|
|
27558
|
+
command: "plugin uninstall",
|
|
27559
|
+
data: { plugin, scope, syncResult: syncData },
|
|
27560
|
+
...!ok && { error: "Sync completed with failures" }
|
|
27561
|
+
});
|
|
27562
|
+
if (!ok)
|
|
27563
|
+
process.exit(1);
|
|
27564
|
+
return;
|
|
27565
|
+
}
|
|
27566
|
+
console.log(`✓ Uninstalled plugin (${scope} scope): ${plugin}`);
|
|
27567
|
+
const { ok: syncOk2 } = isUser ? await runUserSyncAndPrint() : await runSyncAndPrint();
|
|
27568
|
+
if (!syncOk2)
|
|
27569
|
+
process.exit(1);
|
|
27570
|
+
return;
|
|
27571
|
+
}
|
|
27572
|
+
const inProject = await hasPlugin(plugin);
|
|
27573
|
+
const inUser = await hasUserPlugin(plugin);
|
|
27574
|
+
if (!inProject && !inUser) {
|
|
27575
|
+
const error = `Plugin not found: ${plugin}`;
|
|
27384
27576
|
if (isJsonMode()) {
|
|
27385
|
-
jsonOutput({ success: false, command: "plugin uninstall", error
|
|
27577
|
+
jsonOutput({ success: false, command: "plugin uninstall", error });
|
|
27386
27578
|
process.exit(1);
|
|
27387
27579
|
}
|
|
27388
|
-
console.error(`Error: ${
|
|
27580
|
+
console.error(`Error: ${error}`);
|
|
27389
27581
|
process.exit(1);
|
|
27390
27582
|
}
|
|
27583
|
+
const removedScopes = [];
|
|
27584
|
+
if (inProject) {
|
|
27585
|
+
const result = await removePlugin(plugin);
|
|
27586
|
+
if (!result.success) {
|
|
27587
|
+
if (isJsonMode()) {
|
|
27588
|
+
jsonOutput({ success: false, command: "plugin uninstall", error: result.error ?? "Unknown error" });
|
|
27589
|
+
process.exit(1);
|
|
27590
|
+
}
|
|
27591
|
+
console.error(`Error: ${result.error}`);
|
|
27592
|
+
process.exit(1);
|
|
27593
|
+
}
|
|
27594
|
+
removedScopes.push("project");
|
|
27595
|
+
}
|
|
27596
|
+
if (inUser) {
|
|
27597
|
+
const result = await removeUserPlugin(plugin);
|
|
27598
|
+
if (!result.success) {
|
|
27599
|
+
if (isJsonMode()) {
|
|
27600
|
+
jsonOutput({ success: false, command: "plugin uninstall", error: result.error ?? "Unknown error" });
|
|
27601
|
+
process.exit(1);
|
|
27602
|
+
}
|
|
27603
|
+
console.error(`Error: ${result.error}`);
|
|
27604
|
+
process.exit(1);
|
|
27605
|
+
}
|
|
27606
|
+
removedScopes.push("user");
|
|
27607
|
+
}
|
|
27391
27608
|
if (isJsonMode()) {
|
|
27392
|
-
const
|
|
27609
|
+
const syncResults = {};
|
|
27610
|
+
let allOk = true;
|
|
27611
|
+
if (removedScopes.includes("project")) {
|
|
27612
|
+
const { ok, syncData } = await runSyncAndPrint();
|
|
27613
|
+
syncResults.project = syncData;
|
|
27614
|
+
if (!ok)
|
|
27615
|
+
allOk = false;
|
|
27616
|
+
}
|
|
27617
|
+
if (removedScopes.includes("user")) {
|
|
27618
|
+
const { ok, syncData } = await runUserSyncAndPrint();
|
|
27619
|
+
syncResults.user = syncData;
|
|
27620
|
+
if (!ok)
|
|
27621
|
+
allOk = false;
|
|
27622
|
+
}
|
|
27393
27623
|
jsonOutput({
|
|
27394
|
-
success:
|
|
27624
|
+
success: allOk,
|
|
27395
27625
|
command: "plugin uninstall",
|
|
27396
|
-
data: {
|
|
27397
|
-
|
|
27398
|
-
scope: isUser ? "user" : "project",
|
|
27399
|
-
syncResult: syncData
|
|
27400
|
-
},
|
|
27401
|
-
...!ok && { error: "Sync completed with failures" }
|
|
27626
|
+
data: { plugin, scopes: removedScopes, syncResults },
|
|
27627
|
+
...!allOk && { error: "Sync completed with failures" }
|
|
27402
27628
|
});
|
|
27403
|
-
if (!
|
|
27629
|
+
if (!allOk)
|
|
27404
27630
|
process.exit(1);
|
|
27405
|
-
}
|
|
27406
27631
|
return;
|
|
27407
27632
|
}
|
|
27408
|
-
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
|
|
27633
|
+
const scopeLabel = removedScopes.join(" + ");
|
|
27634
|
+
console.log(`✓ Uninstalled plugin (${scopeLabel} scope): ${plugin}`);
|
|
27635
|
+
let syncOk = true;
|
|
27636
|
+
if (removedScopes.includes("project")) {
|
|
27637
|
+
const { ok } = await runSyncAndPrint();
|
|
27638
|
+
if (!ok)
|
|
27639
|
+
syncOk = false;
|
|
27640
|
+
}
|
|
27641
|
+
if (removedScopes.includes("user")) {
|
|
27642
|
+
const { ok } = await runUserSyncAndPrint();
|
|
27643
|
+
if (!ok)
|
|
27644
|
+
syncOk = false;
|
|
27412
27645
|
}
|
|
27646
|
+
if (!syncOk)
|
|
27647
|
+
process.exit(1);
|
|
27413
27648
|
} catch (error) {
|
|
27414
27649
|
if (error instanceof Error) {
|
|
27415
27650
|
if (isJsonMode()) {
|