extension-features

Declare extension features and detect them reactively in Podman Desktop Svelte components.

8.0k|560|Updated Mar 3, 2022
One-click install
npx skills add https://github.com/podman-desktop/podman-desktop --skill extension-features
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extension-features
Source: https://github.com/podman-desktop/podman-desktop/tree/main/.agents/skills/extension-features
Command: npx skills add https://github.com/podman-desktop/podman-desktop --skill extension-features

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Podman Desktop extensions can advertise named capabilities, but wiring those declarations through the main process registry, IPC events, and renderer stores is easy to get wrong. This Skill explains the full mechanism so features are declared, propagated, and detected correctly.

Core Features & Use Cases

  • Feature Declaration: Add a features array under contributes in an extension's package.json, automatically registered and unregistered on activation/deactivation.
  • Registry and IPC Flow: Understand how FeatureRegistry stores features per extension and pushes feature-registry:features-updated events to the renderer.
  • Renderer Detection Patterns: Use the registeredFeatures Svelte store or onDidChangeRegisteredFeatures event target to react to feature changes in components.
  • Use Case: When building an extension like kube-context that contributes kubernetes-contexts-manager, write a Svelte component that hides built-in navigation sections only while that feature is active.

Quick Start

Ask the AI to add a new feature declaration to your extension manifest and write a Svelte component that reacts when that feature becomes active or inactive.

Frequently Asked Questions about extension-features

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I declare a feature in a Podman Desktop extension?

Add a `features` array of strings under `contributes` in the extension's package.json. The extension loader reads it at activation and calls featureRegistry.registerFeatures, returning a Disposable that unregisters the feature automatically on deactivation.

How do I detect an active extension feature in a Svelte component?

Import the registeredFeatures store and check `$registeredFeatures.includes('feature-name')` with a $derived value. For imperative side effects, also listen on onDidChangeRegisteredFeatures and subscribe to the store inside onMount to catch both future changes and pre-existing state.

Why is my feature flag not detected when the component mounts?

Listening only to onDidChangeRegisteredFeatures misses features registered before the component mounted. Combine the event listener with a registeredFeatures store subscription in onMount to sync the current state at mount time.

Does a Podman Desktop extension feature need manual cleanup on deactivation?

No manual cleanup is needed. The Disposable returned by registerFeatures is added to the extension's subscriptions, so the feature is unregistered automatically when the extension is deactivated.

What existing feature names does Podman Desktop use?

The kube-context extension registers `kubernetes-contexts-manager`, which hides the built-in Kubernetes section in the Preferences navigation. PreferencesNavigation.svelte is the reference implementation for reacting to it.