feat(plugin): add plugin framework workflow
This commit is contained in:
247 files changed
+33841
-2256
No files matched your search
@@ -0,0 +1,34 @@
|
||||
# {{PLUGIN_NAME}}
|
||||
|
||||
{{DESCRIPTION}}
|
||||
|
||||
Generated by `dbx-plugin create` with the **{{TEMPLATE_LABEL}}** template.
|
||||
|
||||
## Develop
|
||||
|
||||
With Node.js 22+ and the backend compiler installed, run the browser development host without DBX:
|
||||
|
||||
```bash
|
||||
dbx-plugin dev --path . --port 5190
|
||||
```
|
||||
|
||||
The CLI builds the backend and loads the declared UI. Optional `[dev]` `ui_build` and `ui_watch` command arrays configure frontend builds. Development credentials are stored as local plaintext in `.dbx-dev/`; keep that directory out of commits and packages. Use the real DBX host for final integration testing.
|
||||
|
||||
Build an installable candidate:
|
||||
|
||||
```bash
|
||||
dbx-plugin package .
|
||||
```
|
||||
|
||||
The command builds the native backend for the current host, stages `manifest.json`, `assets/`, and `ui/`, then writes an unsigned target-specific `.dbxp` candidate plus matching `.artifact.json` into `dist/`.
|
||||
|
||||
## Release
|
||||
|
||||
1. Publish a GitHub Release. The generated workflow builds unsigned candidates for every target.
|
||||
2. Open a **Plugin submission Issue** in `t8y2/dbx-store` with the source tag and `release-candidates.json` URL.
|
||||
3. After review, DBX Store signs approved candidates with the official repository key and publishes the installable assets.
|
||||
4. Open the final catalog PR against **`t8y2/dbx-store:main`** using the signed artifact metadata.
|
||||
|
||||
Source code and unsigned candidates stay in this repository. DBX users install the DBX Store-signed assets exposed by the official catalog.
|
||||
|
||||
Do not submit ordinary plugin source to `t8y2/dbx`; that repository accepts plugin host, SDK, CLI, schema, documentation, and official-example changes.
|
||||
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="{{PLUGIN_NAME_XML}}">
|
||||
<defs>
|
||||
<linearGradient id="g" x1="8" y1="8" x2="56" y2="56" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#6d5dfc"/>
|
||||
<stop offset="1" stop-color="#2cc9a7"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="64" height="64" rx="16" fill="url(#g)"/>
|
||||
<path fill="#fff" d="M20 18h18a10 10 0 0 1 0 20H28v8h-8V18Zm8 8v4h10a2 2 0 1 0 0-4H28Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 471 B |
@@ -0,0 +1,9 @@
|
||||
schema_version = 1
|
||||
|
||||
[backend]
|
||||
language = "{{LANGUAGE}}"
|
||||
directory = "backend"
|
||||
binary = "{{BINARY_NAME}}"
|
||||
|
||||
[package]
|
||||
include = ["assets", "ui"]
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Release DBX plugin
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: t8y2/dbx/.github/workflows/plugin-release-reusable.yml@plugin-sdk-v1
|
||||
with:
|
||||
release-tag: ${{ github.event.release.tag_name }}
|
||||
package-command: dbx-plugin package .
|
||||
package-path: dist/*.dbxp
|
||||
metadata-path: dist/*.artifact.json
|
||||
plugin-cli-version: 0.1.1
|
||||
@@ -0,0 +1,5 @@
|
||||
/dist/
|
||||
/.dbx-dev/
|
||||
.dbx-repository-signing-key.env
|
||||
.DS_Store
|
||||
*.log
|
||||
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/t8y2/dbx/plugin-sdk-v1/plugins/manifest.schema.json",
|
||||
"manifest_version": 1,
|
||||
"id": "{{PLUGIN_ID}}",
|
||||
"name": "{{PLUGIN_NAME_JSON}}",
|
||||
"version": "{{VERSION}}",
|
||||
"publisher": "{{PUBLISHER_JSON}}",
|
||||
"description": "{{DESCRIPTION_JSON}}",
|
||||
"icon": "assets/plugin.svg",
|
||||
"engines": {
|
||||
"dbx": ">=0.5.68",
|
||||
"host_api": "1"
|
||||
},
|
||||
"entrypoints": {
|
||||
"backend": {
|
||||
"executable": "bin/{{BINARY_NAME}}"
|
||||
},
|
||||
"ui": {
|
||||
"root": "ui",
|
||||
"entry": "ui/index.html"
|
||||
}
|
||||
},
|
||||
"contributions": [
|
||||
{
|
||||
"type": "connection-provider",
|
||||
"id": "{{PLUGIN_ID}}.connection",
|
||||
"label": "{{PLUGIN_NAME_JSON}} connection",
|
||||
"icon": "assets/plugin.svg",
|
||||
"database_type": "{{CONNECTION_TYPE}}",
|
||||
"description": "Connection form contributed by {{PLUGIN_NAME_JSON}}.",
|
||||
"fields": [
|
||||
{
|
||||
"key": "display_name",
|
||||
"label": "Connection name",
|
||||
"type": "text",
|
||||
"default": "{{PLUGIN_NAME_JSON}} connection",
|
||||
"binding": "name",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"key": "host",
|
||||
"label": "Host",
|
||||
"type": "text",
|
||||
"default": "localhost",
|
||||
"binding": "host",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"key": "port",
|
||||
"label": "Port",
|
||||
"type": "number",
|
||||
"default": 0,
|
||||
"binding": "port",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"workbench": "{{PLUGIN_ID}}.workbench",
|
||||
"capabilities": ["test", "connect", "disconnect"]
|
||||
},
|
||||
{
|
||||
"type": "workbench",
|
||||
"id": "{{PLUGIN_ID}}.workbench",
|
||||
"label": "{{PLUGIN_NAME_JSON}} Workbench",
|
||||
"description": "Sandboxed UI contributed by {{PLUGIN_NAME_JSON}}.",
|
||||
"icon": "assets/plugin.svg"
|
||||
}
|
||||
],
|
||||
"localizations": {
|
||||
"zh-CN": {
|
||||
"name": "{{PLUGIN_NAME_JSON}}",
|
||||
"description": "{{DESCRIPTION_JSON}}",
|
||||
"contributions": {
|
||||
"{{PLUGIN_ID}}.connection": {
|
||||
"label": "{{PLUGIN_NAME_JSON}} 连接",
|
||||
"description": "由插件声明的连接表单。",
|
||||
"fields": {
|
||||
"display_name": { "label": "连接名称" },
|
||||
"host": { "label": "主机" },
|
||||
"port": { "label": "端口" }
|
||||
}
|
||||
},
|
||||
"{{PLUGIN_ID}}.workbench": {
|
||||
"label": "{{PLUGIN_NAME_JSON}} 工作台",
|
||||
"description": "由插件提供的沙箱工作台界面。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{{PLUGIN_NAME_HTML}}</title>
|
||||
<style>
|
||||
:root { color-scheme: light dark; font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 32px; background: radial-gradient(circle at top left, rgba(109,93,252,.2), transparent 40%), Canvas; color: CanvasText; }
|
||||
main { width: min(680px, 100%); padding: 32px; border: 1px solid color-mix(in srgb, CanvasText 16%, transparent); border-radius: 20px; background: color-mix(in srgb, Canvas 92%, transparent); box-shadow: 0 24px 80px rgba(0,0,0,.12); }
|
||||
.eyebrow { color: #6d5dfc; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
|
||||
h1 { margin: 10px 0; font-size: clamp(28px, 5vw, 46px); }
|
||||
p { line-height: 1.65; opacity: .74; }
|
||||
button { margin-top: 20px; border: 0; border-radius: 12px; padding: 12px 18px; background: #6d5dfc; color: white; font: inherit; font-weight: 650; cursor: pointer; }
|
||||
button:disabled { opacity: .55; cursor: wait; }
|
||||
pre { margin-top: 20px; min-height: 92px; overflow: auto; padding: 16px; border-radius: 12px; background: color-mix(in srgb, CanvasText 7%, transparent); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="eyebrow" id="eyebrow">DBX plugin workbench</div>
|
||||
<h1>{{PLUGIN_NAME_HTML}}</h1>
|
||||
<p id="description">This sandboxed page talks to the {{LANGUAGE_LABEL}} sidecar only through the DBX Host Bridge.</p>
|
||||
<button id="ping" type="button">Invoke sidecar</button>
|
||||
<pre id="result">Waiting for DBX plugin host…</pre>
|
||||
</main>
|
||||
<script>
|
||||
const result = document.querySelector("#result");
|
||||
const button = document.querySelector("#ping");
|
||||
const copy = {
|
||||
en: { eyebrow: "DBX plugin workbench", description: "This sandboxed page talks to the {{LANGUAGE_LABEL}} sidecar only through the DBX Host Bridge.", button: "Invoke sidecar", ready: "Ready", calling: "Calling sidecar…", error: "Error" },
|
||||
zh: { eyebrow: "DBX 插件工作台", description: "此沙箱页面仅通过 DBX Host Bridge 与 {{LANGUAGE_LABEL}} Sidecar 通信。", button: "调用 Sidecar", ready: "已就绪", calling: "正在调用 Sidecar…", error: "错误" }
|
||||
};
|
||||
let text = copy.en;
|
||||
window.dbxPlugin.ready.then(() => {
|
||||
text = window.dbxPlugin.locale.toLowerCase().startsWith("zh") ? copy.zh : copy.en;
|
||||
document.querySelector("#eyebrow").textContent = text.eyebrow;
|
||||
document.querySelector("#description").textContent = text.description;
|
||||
button.textContent = text.button;
|
||||
result.textContent = text.ready;
|
||||
});
|
||||
button.addEventListener("click", async () => {
|
||||
button.disabled = true;
|
||||
result.textContent = text.calling;
|
||||
try {
|
||||
result.textContent = JSON.stringify(await window.dbxPlugin.invoke("{{METHOD_PREFIX}}/ping", { connectionId: window.dbxPlugin.context?.connectionId }), null, 2);
|
||||
} catch (error) {
|
||||
result.textContent = `${text.error}: ${error.message}`;
|
||||
} finally {
|
||||
button.disabled = false;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user