
Example of a Freelens extension
概览
This repository is the reference template for building, type-checking, testing and releasing an extension for the Freelens application. The Freelens extension documentation describes the extension API and points here for everything around it. Start a new extension from a copy of this repository. The extension adds a cluster page, a details panel and a context menu item for a custom resource, Example, and a setting on the preferences page: - Example is implemented for v1alpha1 and v1alpha2, each with its own model, list page, details and menu item. v1alpha2 renames spec.active to spec.suspended, with the meaning inverted. - The "Examples" page shows the newest version the cluster serves, or a message when the CRDs are not installed. - While the extension is enabled, Example is left out of the Custom Resources tree of the cluster sidebar, so it is listed once, under "Examples". - Per-object logic is a static method that takes the object, such as Example.getSuspended(object).
README
以下为原文 README 节选,完整内容请查看原文。
@freelensapp/example-extension
Overview
This repository is the reference template for building, type-checking, testing and releasing an extension for the Freelens application. The Freelens extension documentation describes the extension API and points here for everything around it. Start a new extension from a copy of this repository.
The extension adds a cluster page, a details panel and a context menu item
for a custom resource, Example, and a setting on the preferences page:
- Two API versions of one CRD.
Exampleis implemented forv1alpha1andv1alpha2, each with its own model, list page, details and menu item.v1alpha2renamesspec.activetospec.suspended, with the meaning inverted. - The served API version picked at runtime. The “Examples” page shows the newest version the cluster serves, or a message when the CRDs are not installed.
- One sidebar entry for the resource. While the extension is enabled,
Exampleis left out of the Custom Resources tree of the cluster sidebar, so it is listed once, under “Examples”. - Static helpers on the model. Per-object logic is a
staticmethod that takes the object, such asExample.getSuspended(object). - An error boundary. Each page, details panel and menu item renders an error message instead of breaking the view when it throws.
- A persisted preference. The “Example checkbox” setting is kept across restarts and shown in the details panel.
Agent skills
Two skills in the Agent Skills format guide a coding agent, such as Claude Code, Codex, GitHub Copilot, Cursor or Gemini CLI, through an extension in its own repository:
create-freelens-extensionstarts a new Freelens extension from a copy of this repository.port-freelens-extension-to-v2ports an extension written for the v1 extension API to v2.
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add freelensapp/freelens-example-extension