flare-plugin-sdk 0.1.0-beta.5 → 0.1.0-beta.8

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.
@@ -6,10 +6,52 @@ Defaults below apply when a field is omitted; use omission for optional fields
6
6
  rather than sending null for non-nullable values. Start from the complete
7
7
  [template manifest](../assets/github-template/manifest.json).
8
8
 
9
+ ## JSON Schema and editor support
10
+
11
+ The self-contained [manifest.schema.json](../manifest.schema.json) uses JSON Schema
12
+ draft-07. Editors such as VS Code use it for field completion, descriptions, enum
13
+ choices, required properties, ranges and static login/capability combinations.
14
+ `npx flare-plugin-sdk@next init my-plugin` adds a `$schema` URL pinned to that SDK
15
+ version. The source templates use the npm `next` channel.
16
+
17
+ For an existing project, add this editor hint at the manifest root:
18
+
19
+ ```json
20
+ {
21
+ "$schema": "https://unpkg.com/flare-plugin-sdk@next/skill/flare-plugin/manifest.schema.json"
22
+ }
23
+ ```
24
+
25
+ Keep the other manifest fields. For reproducible editor behavior, replace `next`
26
+ with your chosen SDK version. For offline authoring, install the SDK as a development
27
+ dependency and use `./node_modules/flare-plugin-sdk/skill/flare-plugin/manifest.schema.json`
28
+ as the `$schema` value; all schema references are local to that file.
29
+
30
+ Flare accepts `$schema` as optional editor metadata and never fetches or executes
31
+ it. Older Flare builds that reject it can still use editor assistance: remove
32
+ `$schema` from the manifest and associate the schema in VS Code workspace settings
33
+ (`.vscode/settings.json`):
34
+
35
+ ```json
36
+ {
37
+ "json.schemas": [{
38
+ "fileMatch": ["/manifest.json"],
39
+ "url": "https://unpkg.com/flare-plugin-sdk@next/skill/flare-plugin/manifest.schema.json"
40
+ }]
41
+ }
42
+ ```
43
+
44
+ Schema validation does not fill defaults or replace Host validation. Flare also
45
+ checks unique IDs/interactions, canonical/approved origins, captured Deep Link
46
+ values, referenced timelines, localized catalog keys, relational compose limits,
47
+ actual JavaScript registration and runtime behavior. Some text limits use UTF-16
48
+ length in the Host rather than JSON Schema's Unicode code point count.
49
+
9
50
  ## Root object
10
51
 
11
52
  | Field | Required / default | Contract |
12
53
  | --- | --- | --- |
54
+ | `$schema` | Omitted | Editor schema URL/path only; never loaded by Flare |
13
55
  | `schemaVersion` | `1` | Manifest schema, currently exactly 1 |
14
56
  | `apiVersion` | Required | Runtime ABI, currently exactly 1 |
15
57
  | `id` | Required | Stable reverse-domain plugin ID; `[a-z][a-z0-9]*(?:\.[a-z][a-z0-9-]*)+` |
@@ -31,6 +31,9 @@ copy that example's contents into a repository you own first.
31
31
  by `npx flare-plugin-sdk@next init my-plugin` stable.
32
32
  Keep real tokens, Cookies, passwords, and private fixtures out of Git history.
33
33
  2. Put the required files at root and check that a clean checkout contains them.
34
+ For the TS starter, run `npm run build` and commit `src/`, the build files,
35
+ `package-lock.json`, and the newly built root `plugin.js`. Keep `plugin.js`
36
+ tracked; the generated `.gitignore` excludes dependencies and local artifacts.
34
37
  Include README instructions for supported website/instances, token acquisition
35
38
  if relevant, features, permissions, and tests actually performed.
36
39
  3. Set a stable SemVer manifest version, for example `0.1.0`. Publish a tag
@@ -101,8 +104,19 @@ plugin authors do not control it.
101
104
 
102
105
  ## Optional local installation
103
106
 
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`,
107
+ Use `.fpp` as an alternative for offline transfer or local testing. From the
108
+ generated TS project, run:
109
+
110
+ ```sh
111
+ npm run package
112
+ ```
113
+
114
+ It checks types, rebuilds the root script, stages only runtime files in a fresh
115
+ temporary directory and invokes the SDK packer. The result is `plugin.fpp` at
116
+ project root; temporary staging is cleaned up. GitHub remains the recommended
117
+ distribution path and this file has no GitHub update tracking.
118
+
119
+ For other project layouts, create a new, empty `dist` directory. Copy only `manifest.json`, `plugin.js`,
106
120
  one supported `assets/icon.<extension>`, and optional `locales/*.json` into it,
107
121
  preserving those paths. From the project root:
108
122
 
@@ -114,7 +128,7 @@ The complete skill also includes the standard-library-only packer for use withou
114
128
  npm. For example, from this skill directory:
115
129
 
116
130
  ```sh
117
- node pack.mjs assets/github-template /tmp/example-feed-0.1.0.fpp
131
+ node pack.mjs /path/to/runtime-directory /tmp/example-feed-0.1.0.fpp
118
132
  ```
119
133
 
120
134
  The packer ignores only a root README.md; unlike GitHub import it rejects other
@@ -7,15 +7,19 @@ No demonstration backend is required for authoring this SDK.
7
7
 
8
8
  ## Checks in a generated repository
9
9
 
10
- From the generated repository root, using Node:
10
+ The generated TS project includes a prebuilt root `plugin.js`. From its root:
11
11
 
12
12
  ```sh
13
+ npm install
14
+ npm run check
15
+ npm run build
13
16
  node --check plugin.js
14
17
  node -e 'JSON.parse(require("node:fs").readFileSync("manifest.json", "utf8")); console.log("Manifest JSON parses")'
15
18
  ```
16
19
 
17
- These are syntax checks only: Node accepts APIs that the plugin Host does not
18
- provide, and parsing JSON does not validate the manifest. Also inspect:
20
+ The SDK types help check source code; building emits one self-contained ES2020
21
+ IIFE. CI checks that it matches the committed prebuilt script. Type/syntax checks
22
+ do not replace Host validation, and parsing JSON does not validate the manifest. Also inspect:
19
23
 
20
24
  - Required root files and a valid supported icon; stable IDs and version/tag consistency.
21
25
  - Every declared known operation has its required registration and full method
@@ -27,9 +31,8 @@ provide, and parsing JSON does not validate the manifest. Also inspect:
27
31
  - Auth/cursor/action data is not accidentally inserted into public content or
28
32
  media URLs. No real secrets enter checked-in fixtures.
29
33
 
30
- Use the shipped `.d.ts` as editor/reference input, outside the release package.
31
- For a TypeScript authoring project, reference that file and configure the actual
32
- bundler to emit one classic script. Keep manifest/Host validation even when the
34
+ The generated tsconfig loads the SDK's ambient types with strict checking and no
35
+ browser/Node globals. Keep manifest/Host validation even when the
33
36
  type checker passes: TypeScript optional service properties do not express all
34
37
  capability requirements, and optionality does not make every null value valid.
35
38
 
@@ -39,11 +42,15 @@ In Settings > Plugins, open the overflow menu and choose **Plugin development**.
39
42
  Choose the directory containing `manifest.json`, `plugin.js`, and the plugin assets.
40
43
  Click **Start development** and review access to your existing accounts. Both Compose Desktop and native macOS support this flow.
41
44
 
42
- Edit `plugin.js`, `manifest.json`, `assets/icon.<extension>`, or `locales/*.json`. Flare
43
- automatically validates the files; click **Reload plugin** to apply the validated
45
+ For the TS starter, run `npm run dev` and edit `src/plugin.ts` or its local modules.
46
+ The watcher rebuilds the root `plugin.js`; syntax/build failures preserve the last
47
+ script through atomic replacement. Watch mode does not type-check; use editor
48
+ diagnostics or `npm run check` separately. Changes to the built script,
49
+ `manifest.json`, `assets/icon.<extension>`, or `locales/*.json` are automatically
50
+ validated by Flare; click **Reload plugin** to apply the validated
44
51
  snapshot to this plugin's accounts and open pages. An invalid edit keeps the last
45
- working version running. For TypeScript projects, select your build output directory
46
- and run your own compiler/watch command; Flare does not execute build scripts.
52
+ working version running. Keep the starter project root selected. Other build
53
+ layouts must select their runtime output directory; Flare does not execute build scripts.
47
54
 
48
55
  Only one development directory can be active. Reload is refused while publishing,
49
56
  uploading, deleting, or sending is in progress; retry after the operation finishes.