Release RuneStone 0.1.7 with plugin documents and shared menus

This commit is contained in:
Knotty Wyvern
2026-10-06 09:29:09 -07:00
parent 6b7af0d527
commit 5d0a4a24f9
75 changed files with 2286 additions and 1665 deletions
+193 -16
View File
@@ -2,32 +2,52 @@
[Back to development](development.md)
RuneStone installs local JavaScript plugins from package files or folders.
RuneStone installs JavaScript plugins from local ZIP files and experimental Gitea release downloads.
Open Settings → Plug-ins to install, enable, disable, or uninstall them.
Terminal and Table formulas use the same installed package system as all other plugins.
## Build and install the feature packages
1. Run `pnpm build:plugins` from the repository root.
2. In Settings → Plug-ins, choose Install from folder and select `plugin-packages/`.
3. Review both packages, then choose Install and enable.
1. Clone `RuneStone_TableFormulas` beside RuneStone and run `pnpm install --frozen-lockfile` in that checkout.
2. Run `pnpm build:plugins` from the RuneStone repository root for Table formulas.
3. In Settings → Plug-ins, choose Install plugin ZIP.
4. Select the ZIP files in `plugin-packages/`, then choose Install and enable.
The build creates `runestone.table-formulas-0.1.0.zip`.
Table formulas is a development package in its [own repository](https://git.knottywyvern.com/kwyvern-gitea/RuneStone_TableFormulas).
Set `RUNESTONE_TABLE_FORMULAS_ROOT` to use a different checkout location.
That repository also supports `pnpm package:plugin`, with `RUNESTONE_ROOT` selecting the host packager.
The folders beside them contain build output for inspection and tests.
Use the ZIP files for installation and releases.
Terminal development lives in the separate [RuneStone_Terminal repository](https://git.knottywyvern.com/kwyvern-gitea/RuneStone_Terminal).
In that repository, run `pnpm install --frozen-lockfile`, then `pnpm build`.
Install `releases/runestone.terminal-0.1.0.zip` through the same plugin ZIP installer.
Version 0.1.0 marks Terminal as a development package.
The local source folder is `../RuneStone_Terminal/` when both repositories share a parent directory.
No plugin starts automatically in a fresh installation.
The application build does not include these packages. Package builds include their JavaScript dependencies and terminal styles.
Build them again after source changes, then uninstall the old package and install the new folder.
Build them again after source changes, then uninstall the old version and install the new ZIP.
The old bundled switches no longer apply. Existing terminal appearance settings remain available after installation.
Formula source stays in Markdown files when the plugin is absent, disabled, or removed.
Native pseudo-terminal services remain in the desktop host. The Terminal package supplies the interface, shortcuts, and session controls.
## Install a plugin
1. Choose Install from file or Install from folder.
2. Select the packages to install in the review dialog.
1. In Settings → Plug-ins, choose Install plugin ZIP.
2. Select one or more `.zip` files, then review the packages.
3. Choose Install to keep them disabled, or Install and enable to run them.
A plugin file uses the `.runestone-plugin` extension and ZIP format.
You can also select `plugin.json`, its containing folder, or a collection folder containing plugin folders and package files.
Collection discovery checks one level and accepts at most 100 entries.
Each ZIP contains one plugin, with `plugin.json` at its root.
You can open the ZIP with an archive tool to read its manifest, JavaScript, and other files.
You do not need to extract it before installation.
The picker accepts at most 100 ZIP files at once.
Folders and loose `plugin.json` files are not installation inputs.
Earlier `.runestone-plugin` files already used ZIP format. Rename those files to `.zip` before installation.
Installed plugins keep working. This change does not alter their files or saved settings.
RuneStone copies packages into its per-user application data directory. It never modifies the selected source.
The review shows the author, version, source, destination, and access level.
@@ -39,8 +59,8 @@ Plugins cannot overwrite an existing ID. Uninstall the previous package before i
Each package succeeds or fails independently. The result identifies any failures.
A changed source requires a new review. Cancelling the review removes its temporary copies.
Try the example in `fixtures/plugins/workspace-overview/`.
Install that folder, then choose Install and enable.
Try the example with `pnpm package:plugin fixtures/plugins/workspace-overview`.
Install the resulting ZIP from `plugin-packages/`, then choose Install and enable.
Use the puzzle button in the main toolbar to run Show workspace overview or open the Workspace overview view.
## Uninstall with one confirmation
@@ -107,7 +127,7 @@ Install and removal operations share one native service and serialize their stat
## Package contract
Place `plugin.json` at the root of the folder or archive:
Place `plugin.json` at the root of the ZIP archive:
```json
{
@@ -124,6 +144,11 @@ Place `plugin.json` at the root of the folder or archive:
```
The package API is version 1. Its interface lives in `src/lib/plugins/sdk.ts`.
RuneStone 0.1.5 adds optional `placement: "editor"` for views that belong beside documents.
These views open in the editor area with a tab. Document tabs retain their buffers when users switch views.
Closing the plugin tab or disabling the package disposes the view.
The default placement is `"dialog"`, so existing packages keep their current behavior.
Older hosts ignore the placement field. Plugins that require editor placement need RuneStone 0.1.5 or later.
All packages use one API and the same installation, enable, disable, and removal lifecycle.
Versions use three numeric parts. Schema and API versions must match the supported version exactly.
The `runestone.*` prefix follows the same rules as other package IDs. It does not prove the publisher's identity.
@@ -138,6 +163,120 @@ The entry is one compiled `.js` or `.mjs` module. Bundle dependencies into it.
Relative module imports cannot resolve from its Blob URL. Read packaged assets through the API instead.
Raw TypeScript, Svelte source, native libraries, plugin dependencies, and automatic updates are unsupported.
## Build and release a plugin
Use the same package contract for in-house and community plugins.
The ZIP is the release file. Its `plugin.json` describes the contents and is not a separate installer.
```text
org.example.hello-1.0.0.zip
plugin.json
main.js
assets/
README.md
LICENSE
```
The manifest and entry module are required. Assets, a README, and a license are optional package files.
Include a README with the host requirement, purpose, install steps, and help contact.
Keep JavaScript readable where practical. Avoid minification and obfuscation that make inspection harder.
1. Compile the plugin into a clean folder with `plugin.json`, its entry module, and the required assets.
2. Run `pnpm package:plugin <compiled-folder> [output-folder]` from the RuneStone repository.
3. Install the resulting ZIP in RuneStone and test its features, disable action, and uninstall action.
4. Share that same ZIP as the release file.
Use Node.js 24 or later for the packaging command. The default output folder is `plugin-packages/`.
It checks the manifest, paths, entry module, and size limits before it writes `<id>-<version>.zip`.
It includes every file in the input folder. Keep dependencies, credentials, and unrelated build files outside that folder.
The output folder must be outside the input folder.
The command replaces an existing ZIP with the same ID and version. Increase the version for each published release.
Repeated runs with unchanged input produce the same archive bytes.
The native installer checks the package again before installation.
Other build tools can create the same ZIP layout. Do not add a parent folder above `plugin.json`.
Do not tell users to load JSON, select a build folder, rename a new release, or install dependencies.
Authors in other repositories can run `node <RuneStone-path>/scripts/packagePlugin.mjs <compiled-folder> <output-folder>`.
## Experimental installation from a Gitea link
Gitea repository links now supply ZIP packages to the existing review and installation flow.
This trial supports Gitea at the host root, including the personal Gitea server.
GitHub and GitLab support remain future work. Their release APIs need separate tests.
1. In Settings → Plug-ins, choose Install from Git link.
2. Enter the repository root link, such as `https://git.knottywyvern.com/kwyvern-gitea/RuneStone_Terminal`.
3. Enter a release tag for a specific version, or leave it empty for the latest release.
4. For a private repository, enter a Gitea access token with repository read access.
5. Choose Review release, then choose Install or Install and enable after you review the package.
The link can end in `.git`. SSH links, branch links, source archives, and links with credentials are not installation inputs.
Use an explicit tag for a prerelease trial. The [Gitea latest-release endpoint](https://docs.gitea.com/api/operations/repo-get-latest-release/) excludes drafts and prereleases.
RuneStone clears the token after each request and when the form closes. It does not save the token.
Use HTTPS. HTTP is available for trusted local servers, but it sends the token and package without encryption.
Credentials go only to the original API origin. Redirects to another origin do not receive the token.
A release attachment on another private host needs its own access method and is outside this trial.
The downloader reads release metadata, then downloads one attached ZIP.
It does not clone the repository, compile code, install dependencies, or run scripts.
Downloads have size limits, time limits, and a redirect limit.
The metadata limit is 2 MiB. The compressed ZIP limit is 100 MiB.
The existing package limits still apply to the extracted files.
HTTPS links cannot redirect or select an attachment over HTTP.
The review shows the repository, release tag, attachment link, manifest, and destination.
It pins the downloaded content. Installation checks that the staged files still match the reviewed hash.
Changing a remote release after review does not change the pending installation.
The same duplicate-ID, enable, removal, and cleanup rules apply to local and remote packages.
### Release standard for plugin writers and agents
Use one plugin repository and one standard plugin ZIP per release for this trial.
Keep the package contract above. No repository manifest or special branch layout is required.
1. Build the plugin from the source commit that you intend to tag.
2. Run `pnpm package:plugin <compiled-folder> [output-folder]` from RuneStone.
3. Attach the resulting `<id>-<version>.zip` to a Gitea release.
4. Publish the release with a tag that identifies its source commit.
5. Test its repository link and explicit tag in RuneStone.
Use `v<version>` for ordinary release tags. Use a clearly named trial tag for temporary prereleases.
Keep the manifest version and package version equal. Keep published release files unchanged.
Increase the version before publishing different package contents as an ordinary release.
A prerelease can use the same numeric manifest version while the installer uses its explicit trial tag.
The ZIP must contain `plugin.json` at its root, the compiled entry module, and all required assets and dependencies.
Do not attach a source ZIP as the plugin package. Gitea's automatic source archives do not count as release attachments.
The installer rejects releases with no attached ZIP or more than one attached ZIP.
Other attachments, such as checksums and release notes, can accompany the single ZIP.
The installer rejects drafts. Private repositories require read access to the metadata and attachment.
Test local ZIP installation before publication. After publication, test download, review, disabled installation, enable, disable, and removal.
Check that cancellation leaves no installed package. Check that an existing plugin ID blocks another installation.
Keep release notes short. State the host requirement, plugin version, changes, and known limits.
### Trial checks
The four local packages passed a simulated Gitea release download and isolated native installation on October 5, 2026.
The test checked the installed hashes and kept all four plugins disabled.
| Plugin | Package version |
| --- | --- |
| Terminal | 0.1.0 |
| Table formulas | 0.1.0 |
| PDF viewer | 0.0.1 |
| Project management | 0.2.3 |
The authenticated check of the personal Gitea server found no releases in these four repositories.
Live Gitea installation still needs published release attachments. No releases or tags were created during this check.
The browser smoke test covers the link form, download errors, token clearing, cancellation, focus, and disabled installation.
Native tests cover URL parsing, release selection, redirects, credential boundaries, size limits, changed staging files, and invalid ZIPs.
Run the focused native checks with `cargo test --manifest-path src-tauri/Cargo.toml --lib plugin`.
To repeat the four-package trial, place exactly these four ZIPs in a folder and set `RUNESTONE_GIT_TRIAL_PACKAGES` to its absolute path.
Then run `cargo test --manifest-path src-tauri/Cargo.toml --lib four_plugin_release_trial -- --ignored --nocapture`.
Run `node scripts/pluginInstall.smoke.mjs` against the development server for the browser checks.
## Plugin API
The entry exports `activate(api)`. Activation can return a cleanup function or a promise for that function.
@@ -170,16 +309,49 @@ export function activate(api) {
| `api.signal` | An abort signal triggered before shutdown |
| `contribute(key, value)` | Register a typed terminal or table formula contribution |
| `registerCommand({ id, title, run })` | Add a command to the toolbar's plugin menu |
| `registerView({ id, title, mount })` | Add a view that mounts into a supplied DOM element |
| `registerView({ id, title, placement?, mount })` | Add a view in a dialog or the editor area |
| `registerView({ navigation: true, icon?, ... })` | Add an icon button to the ribbon left of the navigation pane |
| `registerDocumentType(type)` | Recognize document content, supply a navigation icon, and mount a document editor |
| `openDocument(path)` | Open a recognized document in its own tab |
| `renameDocument({ id, path }, name)` | Rename a recognized document and return its new workspace path. Optional API |
| `openView(id)` | Open one of the plugin's registered views |
| `onDispose(callback)` | Register synchronous or asynchronous cleanup |
| `workspace.list(path?)` | List a directory in this window's active workspace |
| `workspace.read(path)` | Read a workspace text file |
| `workspace.readBytes(path)` | Read workspace bytes as a Uint8Array, with a 64 MiB limit. Requires the binary document host update |
| `workspace.readOptional(path)` | Read text, or return null when the file is absent. Added in 0.1.6 |
| `workspace.create(path, contents)` | Create complete text without replacing an existing file. Added in 0.1.6 |
| `workspace.write(path, contents, expected)` | Save only if the file still matches the original text |
| `workspace.subscribe(listener)` | Receive workspace change notifications. Returns a cleanup function |
| `settings.read()` / `settings.write(value)` | Read or write retained JSON settings, with a 1 MiB limit |
| `assets.read(path)` | Read package bytes as a `Uint8Array` |
Command and view IDs must be unique within their respective plugin collections.
Document type IDs must also be unique within their collection.
Document types declare file extensions, an `identify` function, and a `mount` function.
The identify function returns a stable document ID or null. Invalid documents remain available through the text editor.
An optional creation action supplies complete file text. Creation never replaces an existing file.
Each document opens in its own editor tab. Opening the same document focuses its existing tab.
Closing one tab disposes only that mount. Disabling the plugin disposes all its mounts and removes its navigation entries.
The host rejects plugin writes when a note has unsaved editor changes.
These document APIs require the current host source. The earlier 0.1.6 installer does not include them.
The optional API method `renameDocument({ id, path }, name)` renames a recognized document and returns its new workspace path.
The host checks the document ID and plugin owner. It keeps the folder and extension, rejects name collisions, and updates open tabs.
Names can contain dots. Hidden names and reserved filename characters are invalid.
Unsaved text edits block plugin renames. This method requires the updated host source.
Binary document types set `content: "binary"`. Text remains the default.
For binary types, `identify(path, source)` receives an empty source string and recognizes the path without reading its contents.
The mount reads bytes with `workspace.readBytes(path)` and reports invalid document data in its own view.
This avoids UTF-8 conversion and full file reads while the file tree identifies binary documents.
The native read command checks the active window's workspace boundary and rejects directories and files larger than 64 MiB.
Binary document support requires the updated host source. The earlier 0.1.6 installer does not include it.
Check for `api.workspace.readBytes` during activation and report a clear host update error when it is absent.
Navigation views appear as icon buttons in the ribbon left of the navigation pane.
The optional view `icon` accepts `list`, `kanban`, or `puzzle`. The default is `puzzle`.
Buttons show the view title in a tooltip on hover and keyboard focus.
The ribbon remains available when the navigation pane is closed.
Views can return asynchronous cleanup. Closing a view and disabling its plugin share the same cleanup promise.
Remove timers, listeners, and other resources in cleanup. Use the abort signal to stop pending work.
The SDK rejects calls after shutdown starts, but it does not isolate JavaScript with full application access.
@@ -202,10 +374,15 @@ The plugin must stop its mounted controls and native sessions in `onDispose` bef
| `src/lib/plugins/PluginTools.svelte` | External commands and views |
| `src/lib/plugins/registry.ts` / `contracts.ts` | Shared feature contributions and their types |
| `src/lib/plugins/TerminalSlot.svelte` | The host element for terminal controls |
| `plugins/terminal/` / `plugins/table-formulas/` | Separate feature packages |
| `scripts/buildPlugins.mjs` | Package compilation into `plugin-packages/` |
| `../RuneStone_Terminal/src/` | Terminal plugin source in its own repository |
| `../RuneStone_TableFormulas/` | Table formulas source, unit tests, and package build |
| `scripts/buildPlugins.mjs` | Table formulas compilation and ZIP release in `plugin-packages/` |
| `scripts/packagePlugin.mjs` | Shared checks and ZIP creation for plugin authors |
Run `pnpm build:plugins`, `pnpm check`, `pnpm test`, `pnpm build`, and `cargo test --manifest-path src-tauri/Cargo.toml --lib --offline`.
Run `pnpm check`, `pnpm test`, and `pnpm build` in `RuneStone_Terminal` for terminal checks.
Build Terminal before host browser tests. They read `../RuneStone_Terminal/dist/` by default.
Set `RUNESTONE_TERMINAL_DIST` to use another compiled terminal folder.
The Rust tests use real temporary files and archives. Browser tests mock desktop calls and exercise the real UI and module loader.
Run `scripts/pluginInstall.smoke.mjs`, `scripts/plugins.smoke.mjs`, and `scripts/settings.smoke.mjs` against the development server.