flare-plugin-sdk 0.1.0-beta.2 → 0.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -42
- package/bin/cli.mjs +59 -0
- package/package.json +3 -1
- package/skill/flare-plugin/README.md +27 -13
- package/skill/flare-plugin/assets/github-template/README.md +120 -19
- package/skill/flare-plugin/references/publishing.md +28 -9
package/README.md
CHANGED
|
@@ -1,60 +1,151 @@
|
|
|
1
1
|
# Flare Plugin SDK
|
|
2
2
|
|
|
3
|
-
`flare-plugin-sdk` contains editor types, a local package command,
|
|
3
|
+
`flare-plugin-sdk` contains a project initializer, editor types, a local package command,
|
|
4
4
|
templates, examples, and a portable AI authoring skill for Social Plugin API v1.
|
|
5
5
|
Flare provides the plugin runtime. Supported targets are Android, JVM Desktop,
|
|
6
6
|
iOS, and native macOS, not Web. Use a Flare build that includes Plugins in Settings;
|
|
7
7
|
this SDK does not promise a minimum public app release.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Create a plugin
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
With Node 22 or newer, run:
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
|
|
14
|
+
npx flare-plugin-sdk@next init my-plugin
|
|
15
|
+
cd my-plugin
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
This copies the GitHub template bundled with that SDK version into `my-plugin`:
|
|
18
19
|
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
```text
|
|
21
|
+
my-plugin/
|
|
22
|
+
manifest.json
|
|
23
|
+
plugin.js
|
|
24
|
+
assets/icon.png
|
|
25
|
+
README.md
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
The directory name becomes the plugin and platform display name. The initializer
|
|
29
|
+
generates unique plugin/platform IDs; keep them stable after publication. New and
|
|
30
|
+
empty directories are accepted, including `init .` in an empty current directory.
|
|
31
|
+
Non-empty directories, files, and symbolic links are rejected without overwriting
|
|
32
|
+
them. The command uses bundled files only and does not install dependencies,
|
|
33
|
+
initialize Git, contact your website, or publish anything. Run
|
|
34
|
+
`npx flare-plugin-sdk@next --help` for usage.
|
|
35
|
+
|
|
36
|
+
Edit `plugin.js` to use your website's real authentication, endpoints, response
|
|
37
|
+
mapping, and pagination. The starter's `/api/me` and `/api/posts` are illustrative;
|
|
38
|
+
no demonstration server is included. Update the description, login methods and
|
|
39
|
+
capabilities in `manifest.json`, and replace the placeholder icon. The plain
|
|
40
|
+
JavaScript starter needs no dependency installation or build step.
|
|
41
|
+
|
|
42
|
+
For manual template copies, replace the example IDs and names before use. For
|
|
43
|
+
`npx` projects, keep the generated IDs. Read the
|
|
44
|
+
[complete developer guide](https://github.com/DimensionDev/Flare/tree/feature/plugin/feature/plugin/sdk/skill/flare-plugin)
|
|
45
|
+
for authentication, Host APIs, capabilities, and Wire data mapping.
|
|
46
|
+
|
|
47
|
+
## Develop and debug in Flare
|
|
48
|
+
|
|
49
|
+
1. From `my-plugin`, check the source syntax:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
node --check plugin.js
|
|
53
|
+
node -e 'JSON.parse(require("node:fs").readFileSync("manifest.json", "utf8")); console.log("Manifest JSON parses")'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Actual execution and manifest/registration validation happen in Flare, which
|
|
57
|
+
provides `definePlugin` and `flare`.
|
|
58
|
+
2. In Compose Desktop or native macOS, open **Settings → Plugins → More → Plugin
|
|
59
|
+
development**. Choose the `my-plugin` directory, click **Start development**,
|
|
60
|
+
and confirm the access review.
|
|
61
|
+
3. Add an account in Flare. Select your plugin platform explicitly, enter the
|
|
62
|
+
website's HTTPS API origin, and import a real access token using the starter's
|
|
63
|
+
login form. Adapt this step if you change the login method. Test login,
|
|
64
|
+
timeline refresh, older pages, end-of-list behavior, and website link clicks.
|
|
65
|
+
4. Edit and save the files. Flare automatically validates changes; click **Reload
|
|
66
|
+
plugin** to apply the validated version. Invalid edits keep the last working
|
|
67
|
+
version running. The development panel shows validation errors and recent-call
|
|
68
|
+
diagnostics; recent calls contain method names and outcomes, without HTTP
|
|
69
|
+
request/response payloads.
|
|
70
|
+
5. Click **Stop development** before installing or updating the same plugin.
|
|
71
|
+
Development temporarily overrides the running version; stopping restores the
|
|
72
|
+
previous version. App restarts do not automatically mount the directory.
|
|
73
|
+
Development uses real accounts and data, and remote writes are not rolled back.
|
|
74
|
+
|
|
75
|
+
Finish active writes before reloading; credential-schema changes may require
|
|
76
|
+
logging in again. For TypeScript, run your own compiler/watch command and
|
|
77
|
+
select its output directory; Flare loads one self-contained classic `plugin.js`.
|
|
78
|
+
See [development and testing details](https://github.com/DimensionDev/Flare/blob/feature/plugin/feature/plugin/sdk/skill/flare-plugin/references/testing.md#develop-locally-in-desktop).
|
|
79
|
+
|
|
80
|
+
## Publish and install through GitHub (recommended)
|
|
81
|
+
|
|
82
|
+
1. Create a public GitHub repository. Its tagged root must contain `manifest.json`,
|
|
83
|
+
the ready-to-run `plugin.js`, exactly one supported `assets/icon.<extension>`,
|
|
84
|
+
and optional `locales/*.json`. Update the project README with the actual website,
|
|
85
|
+
login instructions, supported features, and verification results. Flare reads
|
|
86
|
+
these files directly; commit any compiled output at the root before tagging.
|
|
87
|
+
2. Commit and push the plugin files. For a new project and an empty GitHub
|
|
88
|
+
repository, replace `OWNER/REPO` and run from `my-plugin`:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
git init
|
|
92
|
+
git add manifest.json plugin.js assets README.md
|
|
93
|
+
# If used, also stage translations with: git add locales
|
|
94
|
+
git commit -m "Add Flare plugin"
|
|
95
|
+
git branch -M main
|
|
96
|
+
git remote add origin https://github.com/OWNER/REPO.git
|
|
97
|
+
git push -u origin main
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Use your existing Git setup if the project is already a repository. Keep real
|
|
101
|
+
credentials, private fixtures, `node_modules`, and build caches out of Git.
|
|
102
|
+
3. Set a stable `manifest.version` and push a matching tag. The generated version
|
|
103
|
+
is `0.1.0`, so the first release can use:
|
|
44
104
|
|
|
45
105
|
```sh
|
|
46
|
-
|
|
106
|
+
git tag v0.1.0
|
|
107
|
+
git push origin refs/tags/v0.1.0
|
|
47
108
|
```
|
|
48
109
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
110
|
+
Commit and push any version edit before tagging. npm SDK versions are separate
|
|
111
|
+
from your plugin's version. Flare ignores prerelease plugin tags; pushing only
|
|
112
|
+
a branch does not create an installable version. A GitHub Release and `.fpp`
|
|
113
|
+
upload are unnecessary.
|
|
114
|
+
4. Stop development, then open **Settings → Plugins → Add → Install from GitHub**
|
|
115
|
+
on any supported Flare platform. Enter `https://github.com/OWNER/REPO`, load the
|
|
116
|
+
latest stable version, and review its source and permissions before confirming.
|
|
117
|
+
Installation takes effect immediately. Add/log in to the plugin account and
|
|
118
|
+
verify its behavior on that device.
|
|
119
|
+
5. For updates, increment `manifest.version`, commit and push, then publish a new
|
|
120
|
+
matching stable tag. Keep plugin/platform IDs unchanged. In Flare, check for
|
|
121
|
+
updates and review/confirm the offered version; app restart is unnecessary.
|
|
122
|
+
|
|
123
|
+
See [GitHub publication and update rules](https://github.com/DimensionDev/Flare/blob/feature/plugin/feature/plugin/sdk/skill/flare-plugin/references/publishing.md).
|
|
124
|
+
|
|
125
|
+
## Optional: package and install a local file
|
|
126
|
+
|
|
127
|
+
Use `.fpp` for offline transfer or local testing when GitHub distribution is not
|
|
128
|
+
needed. From your project, create a new, empty `dist` directory and copy only
|
|
129
|
+
`manifest.json`, `plugin.js`, one `assets/icon.<extension>`, and any `locales/*.json`
|
|
130
|
+
into it, preserving those paths. Keep source, `.git`, `package.json`, `node_modules`,
|
|
131
|
+
and previous archives outside `dist`. Then run from the project root:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
npx --package=flare-plugin-sdk@next flare-plugin-pack ./dist ../my-plugin.fpp
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Stop development for this plugin. In **Settings → Plugins → Add**, choose file
|
|
138
|
+
installation, select the `.fpp`, review, and confirm. Installation is immediate.
|
|
139
|
+
Packaging checks archive structure; Flare still validates the manifest,
|
|
140
|
+
registration, permissions, and behavior. File installs have no GitHub update tracking.
|
|
141
|
+
|
|
142
|
+
## Optional: editor types and TypeScript
|
|
56
143
|
|
|
57
|
-
|
|
144
|
+
Install editor types in your authoring project:
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
npm install --save-dev flare-plugin-sdk@next
|
|
148
|
+
```
|
|
58
149
|
|
|
59
150
|
Add the package to your TypeScript project's compiler options:
|
|
60
151
|
|
|
@@ -85,11 +176,18 @@ All documentation is in English. The complete Pixelfed adapter is bundled at
|
|
|
85
176
|
|
|
86
177
|
From `feature/plugin/sdk`, run `npm ci` and `npm test` with Node 22 or newer.
|
|
87
178
|
The tests build an npm tarball, check its complete resource set and license,
|
|
88
|
-
install it offline in an empty project,
|
|
89
|
-
|
|
90
|
-
|
|
179
|
+
install it offline in an empty project, invoke the actual npx initializer,
|
|
180
|
+
type-check a consumer, and package both the generated project and bundled template.
|
|
181
|
+
Initializer tests cover valid unique IDs, empty/nested/Unicode paths, invalid
|
|
182
|
+
arguments, and preserving existing directories, files, and symlinks. They do not
|
|
183
|
+
contact a website or publish to npm. Flare's Host and platform acceptance checks are
|
|
91
184
|
documented in `skill/flare-plugin/references/testing.md`.
|
|
92
185
|
|
|
186
|
+
To try the SDK from a checkout before npm publication, run
|
|
187
|
+
`npm pack --pack-destination /tmp` after those checks, then install the resulting `.tgz` in
|
|
188
|
+
a separate authoring project with
|
|
189
|
+
`npm install --save-dev /path/to/flare-plugin-sdk-VERSION.tgz`.
|
|
190
|
+
|
|
93
191
|
## Publish this SDK (maintainers)
|
|
94
192
|
|
|
95
193
|
For the first publication, use the npm account that will own this unscoped package.
|
|
@@ -121,8 +219,8 @@ Public OIDC publications from this public repository receive provenance automati
|
|
|
121
219
|
For subsequent releases:
|
|
122
220
|
|
|
123
221
|
1. Update the SDK version and lockfile together, for example with
|
|
124
|
-
`npm version
|
|
125
|
-
2. Tag that commit `plugin-sdk-
|
|
222
|
+
`npm version prerelease --preid beta --no-git-tag-version`, and commit the tested changes.
|
|
223
|
+
2. Tag that commit `plugin-sdk-v<version>` using the new version and push only that tag when ready to publish.
|
|
126
224
|
The workflow rejects a tag that does not exactly match `package.json`.
|
|
127
225
|
3. The workflow validates the tarball first, then publishes prereleases to `next`
|
|
128
226
|
and stable versions to `latest`. Existing app workflows exclude SDK tags.
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { cp, lstat, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
5
|
+
import { basename, join, resolve } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const usage = "Usage: flare-plugin-sdk init <directory>";
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
const args = process.argv.slice(2);
|
|
12
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
13
|
+
console.log(usage);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (args.length !== 2 || args[0] !== "init" || !args[1] || args[1].startsWith("-")) {
|
|
17
|
+
throw new Error(usage);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const target = resolve(args[1]);
|
|
21
|
+
const name = basename(target);
|
|
22
|
+
if (!name.trim() || /[\u0000-\u001f\u007f]/.test(args[1])) {
|
|
23
|
+
throw new Error("Choose a directory name without control characters or blank text");
|
|
24
|
+
}
|
|
25
|
+
const metadata = await lstat(target).catch((error) => {
|
|
26
|
+
if (error.code !== "ENOENT") throw error;
|
|
27
|
+
});
|
|
28
|
+
if (metadata && (!metadata.isDirectory() || metadata.isSymbolicLink() || (await readdir(target)).length)) {
|
|
29
|
+
throw new Error("Destination must be a new or empty directory, not a file or symbolic link");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const template = fileURLToPath(new URL("../skill/flare-plugin/assets/github-template/", import.meta.url));
|
|
33
|
+
const manifestPath = join(template, "manifest.json");
|
|
34
|
+
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
35
|
+
const identity = randomUUID().replaceAll("-", "");
|
|
36
|
+
manifest.id = `local.plugin.p${identity}`;
|
|
37
|
+
manifest.name = name;
|
|
38
|
+
manifest.platform.id = `Plugin${identity}`;
|
|
39
|
+
manifest.platform.name = name;
|
|
40
|
+
|
|
41
|
+
await mkdir(target, { recursive: true });
|
|
42
|
+
for (const entry of await readdir(template)) {
|
|
43
|
+
if (entry === "manifest.json") continue;
|
|
44
|
+
await cp(join(template, entry), join(target, entry), {
|
|
45
|
+
recursive: true,
|
|
46
|
+
force: false,
|
|
47
|
+
errorOnExist: true,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
await writeFile(join(target, "manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`, { flag: "wx" });
|
|
51
|
+
|
|
52
|
+
console.log(`Created ${target}\nPlugin ID: ${manifest.id}\nPlatform ID: ${manifest.platform.id}`);
|
|
53
|
+
console.log("Adapt the example API in plugin.js and README.md, then load this directory in Flare's Plugin development.");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
main().catch((error) => {
|
|
57
|
+
console.error(error.message);
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flare-plugin-sdk",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.5",
|
|
4
4
|
"description": "Types, tooling, templates and authoring references for Flare plugins",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://github.com/DimensionDev/Flare#plugins-beta",
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
"url": "https://github.com/DimensionDev/Flare/issues"
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
|
+
"flare-plugin-sdk": "bin/cli.mjs",
|
|
16
17
|
"flare-plugin-pack": "skill/flare-plugin/pack.mjs"
|
|
17
18
|
},
|
|
18
19
|
"types": "skill/flare-plugin/flare-plugin.d.ts",
|
|
19
20
|
"files": [
|
|
21
|
+
"bin/",
|
|
20
22
|
"skill/flare-plugin/"
|
|
21
23
|
],
|
|
22
24
|
"engines": {
|
|
@@ -161,25 +161,39 @@ cases matter. It should identify gaps rather than invent website endpoints.
|
|
|
161
161
|
|
|
162
162
|
## Start a plugin repository
|
|
163
163
|
|
|
164
|
-
1.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
1. With Node 22 or newer, create the starter:
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
npx flare-plugin-sdk@next init my-plugin
|
|
168
|
+
cd my-plugin
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
It generates unique plugin/platform IDs and needs no dependency installation
|
|
172
|
+
or build step for plain JavaScript. For manual copies of
|
|
173
|
+
[assets/github-template](assets/github-template/README.md), replace its example
|
|
174
|
+
IDs and names first. The example API needs adaptation; no demonstration server
|
|
175
|
+
is provided.
|
|
176
|
+
2. Keep the generated IDs stable, replace the placeholder icon, and adapt
|
|
168
177
|
authentication and data mapping to your website. See [manifest](references/manifest.md)
|
|
169
178
|
and [authentication](references/authentication.md).
|
|
170
179
|
3. Implement the required capability methods and map the responses into
|
|
171
180
|
[Wire data](references/wire-data.md). The starter uses token import and a
|
|
172
181
|
read-only timeline whose posts open their website URLs.
|
|
173
182
|
4. Use [Desktop plugin development](references/testing.md#develop-locally-in-desktop)
|
|
174
|
-
to
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
to start the local directory, test an account, and apply saved edits with
|
|
184
|
+
**Reload plugin** after automatic validation. Follow the syntax, behavior and
|
|
185
|
+
platform checks. Stop development before installing/updating the same plugin.
|
|
186
|
+
5. Prefer GitHub distribution: commit the ready-to-run files at a public repository
|
|
187
|
+
root, then push a stable tag matching `manifest.version`. In Flare's plugin
|
|
188
|
+
management, enter `https://github.com/OWNER/REPO` and click **Install**. Review
|
|
189
|
+
source and permissions, then confirm to use the plugin immediately. Follow the
|
|
190
|
+
plugin's README to select the platform, origin, and login method.
|
|
191
|
+
|
|
192
|
+
The generated [project README](assets/github-template/README.md) contains the full
|
|
193
|
+
adaptation, local debugging, Git setup/tagging, GitHub installation and update path.
|
|
194
|
+
See [publishing](references/publishing.md) for exact tag rules, updates, and
|
|
195
|
+
[optional local `.fpp` installation](references/publishing.md#optional-local-installation).
|
|
196
|
+
Flare reads the tagged repository root; a subdirectory in the Flare repository itself
|
|
183
197
|
is not a plugin installation URL. A GitHub Release or `.fpp` upload is unnecessary.
|
|
184
198
|
|
|
185
199
|
## Reference and example index
|
|
@@ -6,15 +6,21 @@ Adapt the paths, authentication, and mapping to your website before publishing.
|
|
|
6
6
|
No demonstration server is included. Tests in Flare exercise this template with
|
|
7
7
|
fixture HTTP responses through the real QuickJS runtime.
|
|
8
8
|
|
|
9
|
-
## Adapt the
|
|
9
|
+
## 1. Adapt the plugin
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
If you created this project with `npx flare-plugin-sdk@next init my-plugin`, work
|
|
12
|
+
inside `my-plugin` and keep its generated plugin/platform IDs. If you copied the
|
|
13
|
+
template manually, first copy its contents to your repository root and replace
|
|
14
|
+
the example `manifest.id`, `platform.id`, and names. Keep IDs stable for updates.
|
|
15
|
+
|
|
16
|
+
1. Update the description, login methods, and declared capabilities in
|
|
17
|
+
`manifest.json`. Replace the one-pixel placeholder PNG with your own icon.
|
|
18
|
+
2. Adapt `plugin.js` using the
|
|
19
|
+
[developer guide](https://github.com/DimensionDev/Flare/tree/feature/plugin/feature/plugin/sdk/skill/flare-plugin)
|
|
20
|
+
and your website's API evidence.
|
|
15
21
|
It currently verifies an imported bearer token with `/api/me`, then reads
|
|
16
22
|
`/api/posts`. It registers no detector, so choose the platform explicitly.
|
|
17
|
-
|
|
23
|
+
3. Update this README with the actual website, token acquisition steps, supported
|
|
18
24
|
features, verification results, and remaining limitations.
|
|
19
25
|
|
|
20
26
|
The template requests no media permission and emits text-only posts. Every post
|
|
@@ -22,6 +28,112 @@ uses `detailType: "link"`, opening its HTTPS website URL. There is no arbitrary
|
|
|
22
28
|
profile lookup, internal post detail, write capability, or guest access. The
|
|
23
29
|
authenticated profile returned at login supplies the saved account identity.
|
|
24
30
|
|
|
31
|
+
## 2. Develop and debug locally
|
|
32
|
+
|
|
33
|
+
The plain JavaScript starter needs Node 22 or newer for tooling, with no dependency
|
|
34
|
+
installation or build step. From this project directory, check syntax:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
node --check plugin.js
|
|
38
|
+
node -e 'JSON.parse(require("node:fs").readFileSync("manifest.json", "utf8")); console.log("Manifest JSON parses")'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Flare supplies the `definePlugin` and `flare` globals and performs the actual
|
|
42
|
+
manifest, registration, and runtime checks. Use a Flare build with Plugins in Settings.
|
|
43
|
+
|
|
44
|
+
1. In Compose Desktop or native macOS, open **Settings → Plugins → More → Plugin
|
|
45
|
+
development**. Choose this directory, click **Start development**, and confirm
|
|
46
|
+
the access review.
|
|
47
|
+
2. Add an account, explicitly select this plugin platform, and enter your website's
|
|
48
|
+
HTTPS API origin. Import a real access token. After adapting the endpoints,
|
|
49
|
+
verify the account identity, Home refresh, older/empty/end pages, and link clicks.
|
|
50
|
+
3. Edit and save `plugin.js`, `manifest.json`, the icon, or translations. Flare
|
|
51
|
+
automatically validates them; click **Reload plugin** to apply the validated
|
|
52
|
+
version. Invalid edits leave the previous working version running.
|
|
53
|
+
4. Check validation errors and recent-call diagnostics in the development panel.
|
|
54
|
+
Recent calls show method names and outcomes, without HTTP request/response
|
|
55
|
+
payloads. Reproduce authentication, HTTP, response-mapping, and paging failures
|
|
56
|
+
against your website's documented API.
|
|
57
|
+
5. Click **Stop development** before installing or updating this plugin. Stopping
|
|
58
|
+
restores the version that was running before development; app restarts do not
|
|
59
|
+
automatically mount this directory. Development uses real accounts and data,
|
|
60
|
+
and remote writes are not rolled back.
|
|
61
|
+
|
|
62
|
+
For TypeScript, run your own compiler/watch process and select its output directory.
|
|
63
|
+
Emit one self-contained classic `plugin.js`; Flare provides its Host APIs rather
|
|
64
|
+
than Node/browser APIs. Commit that built script at the repository root for release.
|
|
65
|
+
See [development and testing details](https://github.com/DimensionDev/Flare/blob/feature/plugin/feature/plugin/sdk/skill/flare-plugin/references/testing.md#develop-locally-in-desktop)
|
|
66
|
+
for reload restrictions, credential changes, and platform acceptance checks.
|
|
67
|
+
|
|
68
|
+
## 3. Publish and install through GitHub (recommended)
|
|
69
|
+
|
|
70
|
+
Create a public GitHub repository with these ready-to-run files at its root:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
manifest.json
|
|
74
|
+
plugin.js
|
|
75
|
+
assets/icon.png
|
|
76
|
+
README.md
|
|
77
|
+
locales/en.json # optional; other locale catalogs as needed
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The icon can also be JPEG, WebP, GIF, or ICO; keep exactly one supported icon.
|
|
81
|
+
Development files may coexist in the repository, but keep credentials,
|
|
82
|
+
`node_modules`, build caches, and private fixtures out of Git. Flare reads the
|
|
83
|
+
committed plugin files directly, so build TypeScript before committing/tagging.
|
|
84
|
+
|
|
85
|
+
For a new project and an empty GitHub repository, replace `OWNER/REPO` and run:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
git init
|
|
89
|
+
git add manifest.json plugin.js assets README.md
|
|
90
|
+
# If used, also stage translations with: git add locales
|
|
91
|
+
git commit -m "Add Flare plugin"
|
|
92
|
+
git branch -M main
|
|
93
|
+
git remote add origin https://github.com/OWNER/REPO.git
|
|
94
|
+
git push -u origin main
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use the existing Git setup if the project is already a repository. The generated
|
|
98
|
+
`manifest.version` is `0.1.0`. After pushing the matching commit, publish its stable tag:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
git tag v0.1.0
|
|
102
|
+
git push origin refs/tags/v0.1.0
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If you changed the manifest version, commit/push it and use that exact version
|
|
106
|
+
after the optional lowercase `v`. npm SDK versions and plugin versions are
|
|
107
|
+
independent. Flare ignores prerelease plugin tags; a branch alone is insufficient.
|
|
108
|
+
A GitHub Release and uploaded `.fpp` asset are unnecessary.
|
|
109
|
+
|
|
110
|
+
Stop development, then in **Settings → Plugins → Add → Install from GitHub** enter
|
|
111
|
+
`https://github.com/OWNER/REPO`. Load the latest stable version, review its source
|
|
112
|
+
and permissions, and confirm. Installation takes effect immediately. Select the
|
|
113
|
+
plugin platform, HTTPS API origin, and real access token to verify it on each target
|
|
114
|
+
device. For later updates, increment `manifest.version`, commit/push, and publish
|
|
115
|
+
a new matching stable tag while preserving IDs. Check for updates in Flare and
|
|
116
|
+
review/confirm the new version. See the
|
|
117
|
+
[publication and update rules](https://github.com/DimensionDev/Flare/blob/feature/plugin/feature/plugin/sdk/skill/flare-plugin/references/publishing.md).
|
|
118
|
+
|
|
119
|
+
## Alternative: package a local file
|
|
120
|
+
|
|
121
|
+
Use `.fpp` for offline transfer or local testing. Create a new, empty `dist`
|
|
122
|
+
directory and copy only `manifest.json`, `plugin.js`, one supported
|
|
123
|
+
`assets/icon.<extension>`, and any `locales/*.json` into it, keeping those paths.
|
|
124
|
+
Keep `.git`, `package.json`, `node_modules`, tests, and old archives outside `dist`.
|
|
125
|
+
From this project directory, run:
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
npx --package=flare-plugin-sdk@next flare-plugin-pack ./dist ../my-plugin.fpp
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Stop development for this plugin, then choose file installation in **Settings →
|
|
132
|
+
Plugins → Add**, select the `.fpp`, review, and confirm. It becomes available
|
|
133
|
+
immediately. The packer checks archive structure; Flare still validates the
|
|
134
|
+
manifest, registration, permissions, and behavior. Local file installs have no
|
|
135
|
+
GitHub source/update tracking.
|
|
136
|
+
|
|
25
137
|
## Illustrative website API to replace
|
|
26
138
|
|
|
27
139
|
The selected origin is an absolute HTTPS origin such as `https://api.example.org`
|
|
@@ -56,16 +168,5 @@ the actual API, including token expiry and rate-limit responses. The helper maps
|
|
|
56
168
|
401/404/429 to typed errors, treats other HTTP failures as `Remote`, and parses
|
|
57
169
|
the response's string `body` explicitly.
|
|
58
170
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- Commit `manifest.json`, the self-contained `plugin.js`, one `assets/icon.png` (or JPEG/WebP/GIF/ICO), and
|
|
62
|
-
any `locales/*.json` at the root of a public GitHub repository.
|
|
63
|
-
- Publish a stable tag matching the manifest version, initially `v0.1.0`.
|
|
64
|
-
- In Flare plugin management, install `https://github.com/OWNER/REPO`, confirm the
|
|
65
|
-
review. The plugin becomes available immediately. A GitHub Release or `.fpp` asset is not required.
|
|
66
|
-
- Select your platform and HTTPS API origin, then import a real access token.
|
|
67
|
-
Verify that the saved account, Home timeline, pagination, and link clicks work.
|
|
68
|
-
|
|
69
|
-
Publish later changes under a new version tag. Keep tokens and Cookies out of
|
|
70
|
-
the repository. Describe separately which checks passed with fixtures and which
|
|
71
|
-
passed against the actual website and Flare UI.
|
|
171
|
+
Describe separately which checks passed with fixtures and which passed against
|
|
172
|
+
the actual website and Flare UI. Keep tokens and Cookies out of the repository.
|
|
@@ -26,7 +26,9 @@ copy that example's contents into a repository you own first.
|
|
|
26
26
|
## Prepare and publish
|
|
27
27
|
|
|
28
28
|
1. Adapt the website endpoints and verify the advertised features. Replace the
|
|
29
|
-
|
|
29
|
+
name, description, and placeholder icon before publication. For manual template
|
|
30
|
+
copies, replace the example plugin/platform IDs; keep the unique IDs generated
|
|
31
|
+
by `npx flare-plugin-sdk@next init my-plugin` stable.
|
|
30
32
|
Keep real tokens, Cookies, passwords, and private fixtures out of Git history.
|
|
31
33
|
2. Put the required files at root and check that a clean checkout contains them.
|
|
32
34
|
Include README instructions for supported website/instances, token acquisition
|
|
@@ -45,6 +47,10 @@ copy that example's contents into a repository you own first.
|
|
|
45
47
|
retry. Successful installs take effect immediately; verify the installed
|
|
46
48
|
tag/version and running behavior without restarting Flare.
|
|
47
49
|
|
|
50
|
+
For a first release from a generated project, follow the complete Git setup,
|
|
51
|
+
commit/push and tag commands in the [project walkthrough](../assets/github-template/README.md#3-publish-and-install-through-github-recommended).
|
|
52
|
+
Stop development for the same plugin before installation or updating it.
|
|
53
|
+
|
|
48
54
|
Private repositories, arbitrary branch tracking, prerelease tags, automatic
|
|
49
55
|
installation, and build-on-device are unsupported. A public repo without a stable
|
|
50
56
|
version tag has no installable version, even if its default branch has valid files.
|
|
@@ -95,17 +101,30 @@ plugin authors do not control it.
|
|
|
95
101
|
|
|
96
102
|
## Optional local installation
|
|
97
103
|
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
Use `.fpp` as an alternative for offline transfer or local testing. In your plugin
|
|
105
|
+
project, create a new, empty `dist` directory. Copy only `manifest.json`, `plugin.js`,
|
|
106
|
+
one supported `assets/icon.<extension>`, and optional `locales/*.json` into it,
|
|
107
|
+
preserving those paths. From the project root:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
npx --package=flare-plugin-sdk@next flare-plugin-pack ./dist ../my-plugin.fpp
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The complete skill also includes the standard-library-only packer for use without
|
|
114
|
+
npm. For example, from this skill directory:
|
|
100
115
|
|
|
101
116
|
```sh
|
|
102
117
|
node pack.mjs assets/github-template /tmp/example-feed-0.1.0.fpp
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
that directory to pack.mjs. The packer ignores only a root README.md; unlike
|
|
108
|
-
GitHub import it rejects other development files, including .git, tests, and type
|
|
120
|
+
The packer ignores only a root README.md; unlike GitHub import it rejects other
|
|
121
|
+
development files, including .git, tests, and type
|
|
109
122
|
declarations. Keep the output outside the input directory. Packaging success is
|
|
110
|
-
not full manifest/registration/behavior validation.
|
|
111
|
-
|
|
123
|
+
not full manifest/registration/behavior validation.
|
|
124
|
+
|
|
125
|
+
Stop development for this plugin, then in **Settings → Plugins → Add** choose file
|
|
126
|
+
installation, select the `.fpp`, review its source/permissions, and confirm. Local
|
|
127
|
+
packages are unverified and still require review. Installation takes effect
|
|
128
|
+
immediately; test the account and declared features on the target device. No
|
|
129
|
+
GitHub source/update tracking is recorded, so later file updates require manually
|
|
130
|
+
importing another package.
|