(
+ toPrecedenceChoice(marketplace?.public_skill_precedence),
+ );
// Tracks whether the user has hand-edited Name, so auto-derivation from the
// repository stops clobbering an intentional name.
const [nameEdited, setNameEdited] = React.useState(false);
@@ -122,6 +132,7 @@ export function MarketplaceModal({
setAutoLoad(!!marketplace?.auto_load);
// Default new marketplaces to personal; admins can opt into org.
setScope(marketplace?.scope === "org" ? "org" : "personal");
+ setPrecedence(toPrecedenceChoice(marketplace?.public_skill_precedence));
// An existing (edit) name counts as user-owned; a fresh add starts clean.
setNameEdited(Boolean(marketplace?.name));
setNameError(null);
@@ -133,6 +144,9 @@ export function MarketplaceModal({
// Scope selection only applies when adding and the caller allows it.
const showScopeSelector = mode === "add" && allowScopeSelection;
+ const isOrgScoped = showScopeSelector
+ ? scope === "org"
+ : marketplace?.scope === "org";
const handleSave = () => {
// Validate name on click
@@ -172,6 +186,12 @@ export function MarketplaceModal({
ref: ref.trim() || undefined,
repo_path: trimmedRepoPath || undefined,
auto_load: autoLoad,
+ // "legacy" saves null so an unrelated edit keeps the existing winner.
+ public_skill_precedence: isOrgScoped
+ ? precedence === "legacy"
+ ? null
+ : precedence
+ : undefined,
scope: showScopeSelector ? scope : undefined,
};
if (pluginWithoutMarketplace) {
@@ -396,6 +416,36 @@ export function MarketplaceModal({
)}
+ {isOrgScoped && (
+
+
+
+
+ )}
+
{/* Ref field (optional) */}