Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/cli/commands/plugin-skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '../../constants.js';
import {
addMarketplace,
findMarketplace,
findMarketplaceRegistration,
listMarketplacePlugins,
updateMarketplace,
} from '../../core/marketplace.js';
Expand Down Expand Up @@ -645,14 +645,14 @@ async function installSkillViaMarketplace(opts: {

// Check if the marketplace is already registered at any scope (user or project)
let marketplaceName: string | undefined;
const existingAnyScope = await findMarketplace(
const existingAnyScope = await findMarketplaceRegistration(
parsed?.repo ?? from,
sourceLocation,
isUser ? undefined : workspacePath,
);

if (existingAnyScope) {
marketplaceName = existingAnyScope.name;
marketplaceName = existingAnyScope.key;
await updateMarketplace(
marketplaceName,
isUser ? undefined : workspacePath,
Expand Down Expand Up @@ -1182,14 +1182,14 @@ async function selectAndInstallSkillsFromSource(opts: {
const sourceLocation = parsed ? `${parsed.owner}/${parsed.repo}` : undefined;

let marketplaceName: string | undefined;
const existingAnyScope = await findMarketplace(
const existingAnyScope = await findMarketplaceRegistration(
parsed?.repo ?? from,
sourceLocation,
isUser ? undefined : workspacePath,
);

if (existingAnyScope) {
marketplaceName = existingAnyScope.name;
marketplaceName = existingAnyScope.key;
await updateMarketplace(marketplaceName, isUser ? undefined : workspacePath);
} else {
const scopeOptions = isUser
Expand Down Expand Up @@ -1534,14 +1534,14 @@ async function installAllViaMarketplace(opts: {
const sourceLocation = parsed ? `${parsed.owner}/${parsed.repo}` : undefined;

let marketplaceName: string | undefined;
const existingAnyScope = await findMarketplace(
const existingAnyScope = await findMarketplaceRegistration(
parsed?.repo ?? from,
sourceLocation,
isUser ? undefined : workspacePath,
);

if (existingAnyScope) {
marketplaceName = existingAnyScope.name;
marketplaceName = existingAnyScope.key;
await updateMarketplace(
marketplaceName,
isUser ? undefined : workspacePath,
Expand Down
15 changes: 11 additions & 4 deletions src/cli/commands/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
updateMarketplace,
listMarketplacePlugins,
findMarketplace,
findMarketplaceRegistration,
parsePluginSpec,
getAllagentsDir,
getMarketplaceVersion,
Expand All @@ -15,6 +16,7 @@ import {
loadRegistryFromPath,
type ScopedMarketplaceEntry,
getMarketplaceOverrides,
getMarketplaceAccessError,
} from '../../core/marketplace.js';
import { syncWorkspace, syncUserWorkspace } from '../../core/sync.js';
import { loadSyncState } from '../../core/sync-state.js';
Expand Down Expand Up @@ -276,7 +278,7 @@ const marketplaceListCmd = command({
if (isJsonMode()) {
const enriched = await Promise.all(
marketplaces.map(async (mp) => {
const version = await getMarketplaceVersion(mp.path);
const version = await getMarketplaceVersion(mp);
return {
...mp,
...(version && {
Expand Down Expand Up @@ -327,7 +329,7 @@ const marketplaceListCmd = command({
console.log(` ❯ ${mp.name} (${mp.scope})`);
console.log(` Source: ${sourceLabel}`);

const version = await getMarketplaceVersion(mp.path);
const version = await getMarketplaceVersion(mp);
if (version) {
const ts = version.date.toISOString().replace('T', ' ').slice(0, 16);
console.log(` Version: ${version.hash} (${ts})`);
Expand Down Expand Up @@ -491,12 +493,16 @@ const marketplaceRemoveCmd = command({
name,
path: result.marketplace?.path,
retainedUserPlugins: result.retainedUserPlugins ?? [],
warnings: result.warnings ?? [],
},
});
return;
}

console.log(`\u2713 Marketplace '${name}' removed`);
for (const warning of result.warnings ?? []) {
console.warn(`Warning: ${warning}`);
}
if (result.retainedUserPlugins && result.retainedUserPlugins.length > 0) {
console.log(`\n \u26A0 ${result.retainedUserPlugins.length} plugin(s) still reference this marketplace:`);
for (const p of result.retainedUserPlugins) {
Expand Down Expand Up @@ -1408,8 +1414,9 @@ const pluginUpdateCmd = command({

return {
parsePluginSpec,
getMarketplace: (name: string, sourceLocation?: string) =>
findMarketplace(name, sourceLocation, workspacePath),
getMarketplaceRegistration: (name: string, sourceLocation?: string) =>
findMarketplaceRegistration(name, sourceLocation, workspacePath),
validateMarketplaceAccess: getMarketplaceAccessError,
parseMarketplaceManifest,
updateMarketplace: async (name: string) => {
// Skip if already updated in this scope during this run
Expand Down
12 changes: 9 additions & 3 deletions src/cli/tui/actions/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
addMarketplace,
removeMarketplace,
updateMarketplace,
findMarketplace,
findMarketplaceRegistration,
getMarketplaceAccessError,
parsePluginSpec,
type MarketplaceEntry,
type MarketplacePluginsResult,
Expand All @@ -42,8 +43,9 @@ function createUpdateDeps(workspacePath?: string) {
const updatedMarketplaces = new Set<string>();
return {
parsePluginSpec,
getMarketplace: (name: string, sourceLocation?: string) =>
findMarketplace(name, sourceLocation, workspacePath),
getMarketplaceRegistration: (name: string, sourceLocation?: string) =>
findMarketplaceRegistration(name, sourceLocation, workspacePath),
validateMarketplaceAccess: getMarketplaceAccessError,
parseMarketplaceManifest,
updateMarketplace: async (name: string) => {
if (updatedMarketplaces.has(name)) {
Expand Down Expand Up @@ -880,6 +882,10 @@ async function runMarketplaceDetail(
continue;
}

if (result.warnings && result.warnings.length > 0) {
p.note(result.warnings.join('\n'), 'Warning');
}

cache?.invalidate();
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
Expand Down
Loading