Eidos 插件
Eidos 插件运行于本地沙箱环境中,全设备仅需安装一份,并按 Space 灵活启用。
插件可以为任意文件格式提供自定义编辑器与查看器,注册全局或文件级快捷指令,在侧边栏挂载独立功能面板,并直接调用本地文件系统 API。
极速上手:30 秒运行 Hello World
Section titled “极速上手:30 秒运行 Hello World”开发 Eidos 插件最简单的方式是编写单个 TypeScript 文件。Eidos Lite 内置编译器直接即时编译运行,无需安装依赖,无需构建配置。
1. 创建 hello.ts
Section titled “1. 创建 hello.ts”在电脑任意位置新建 hello.ts:
import type { ExtensionContext, PluginManifest } from "@eidos.space/plugin-sdk"
export const manifest: PluginManifest = { apiVersion: 1, id: "example.hello", name: "Hello World", version: "0.1.0", actions: [ { id: "say-hello", title: "Hello World", context: "workspace", }, ], placements: [{ location: "command-palette", action: "say-hello" }],}
export default function activate(ctx: ExtensionContext) { ctx.actions.register("say-hello", async ({ ui }) => { await ui.notify("Hello from Eidos Plugin! 🎉") })}2. 加载到 Eidos Lite
Section titled “2. 加载到 Eidos Lite”- 打开 Eidos Lite 并进入任意 Space。
- 在 Space 顶部工具栏中,点击 Plugins 图标(位于搜索框与更多菜单之间)。
- 点击 Load development source…(加载开发源码),选择刚才保存的
hello.ts。 - 确认权限声明并在当前 Space 中启用。
3. 执行命令
Section titled “3. 执行命令”按下快捷键 Cmd+K(Windows/Linux 为 Ctrl+K),输入 Hello World 并回车。
屏幕右上角将立即弹出通知:Hello from Eidos Plugin! 🎉!当你修改 hello.ts 并保存时,Eidos Lite 会自动重编译并热重载。
插件能力概览
Section titled “插件能力概览”所有视图与动作均可通过上下文对象(ctx)调用内置的基础能力(ctx.fs、ctx.storage、ctx.network、ctx.settings、ctx.ui):
| 扩展目标 | 使用的接口 | 用户交互入口 |
|---|---|---|
| 自定义文件视图 接管 Markdown、CSV、视频、PDF、二进制或 .eidos |
View (context: "file") |
文件右键菜单 → 打开方式 (Open with) |
| 独立功能面板 构建 Space 级大盘、统计看板或管理界面 |
View (context: "page") |
侧边栏主导航项 (navigation) |
| 快捷动作与全局命令 文本统计、文件自动化、格式化或一键处理 |
Action (context: "workspace" | "file") |
命令面板 (Cmd+K)、文件右键菜单、自定义快捷键 |
| 数据表增强与批量操作 表格行操作、批量处理与任务进度追踪 |
Table Action Provider (registerTableProvider) |
数据表格右键菜单 (table/context) |
| 数据表内嵌可视化 在数据表内以图表、地图、看板形式展示记录 |
View (context: "table") |
数据表视图菜单 → 新建视图 (table/view) |
| 独立宿主主题 定制整个 Eidos Lite 浅色/深色模式的主题界面 |
Theme Package (kind: "theme") |
插件管理器全局应用 |
两种开发模式
Section titled “两种开发模式”- 单文件轻量模式(
.ts/.js): 仅需在一个文件中导出manifest与默认的activate(后台扩展)或mount(界面挂载)。非常适合编写快捷命令、文本格式化脚本或原型验证,无需任何包管理。 - 完整工程化模式(npx / CLI): 使用
npx @eidos.space/plugin-tools create或eidos plugin create创建完整工程,具备plugin.json、TypeScript、React、CSS 样式管理,支持使用npm run pack:plugin一键打包为.eidos-plugin离线分发归档。