@checkstack/frontend 0.4.2 → 0.5.0
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/CHANGELOG.md +204 -0
- package/package.json +3 -2
- package/src/components/SignalAutoInvalidator.tsx +1 -1
- package/src/dev-main.tsx +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,209 @@
|
|
|
1
1
|
# @checkstack/frontend
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 50e5f5f: Add `bunx @checkstack/scripts dev` — a local Checkstack dev server for
|
|
8
|
+
plugin authors that runs from the plugin's own repo without a monorepo
|
|
9
|
+
checkout.
|
|
10
|
+
|
|
11
|
+
Mechanics:
|
|
12
|
+
|
|
13
|
+
- The dev command spawns `core/backend`'s production entry as a child
|
|
14
|
+
process with three env vars wired in:
|
|
15
|
+
- `CHECKSTACK_DEV_PLUGIN_PATH=<cwd>` — backend skips filesystem
|
|
16
|
+
discovery and imports the plugin at this path as a manual plugin.
|
|
17
|
+
- `CHECKSTACK_DEV_EXTRA_PLUGIN_PATHS=<JSON array>` — additional
|
|
18
|
+
backend plugins co-loaded as manual plugins. The dev command walks
|
|
19
|
+
the plugin under dev's `package.json#dependencies` recursively to
|
|
20
|
+
discover every `@checkstack/*-backend` package and pass their
|
|
21
|
+
module paths through. Auto-includes
|
|
22
|
+
`@checkstack/queue-memory-backend` +
|
|
23
|
+
`@checkstack/cache-memory-backend` when no other queue/cache
|
|
24
|
+
provider is in the dep graph, so `coreServices.queueManager` /
|
|
25
|
+
`coreServices.cacheManager` always have a registered strategy on
|
|
26
|
+
boot. Without this co-loading, plugins that depend on
|
|
27
|
+
`healthcheck-backend`, `notification-backend`, etc. would hit
|
|
28
|
+
unregistered services and the boot would deadlock.
|
|
29
|
+
- `CHECKSTACK_DEV_AUTH=true` — backend registers a synthetic
|
|
30
|
+
`AuthService` that auto-grants every registered access rule.
|
|
31
|
+
Refused when `NODE_ENV=production` so accidental misuse is loud.
|
|
32
|
+
- A file watcher under the plugin's `./src` triggers a full backend
|
|
33
|
+
restart (debounced) on save. Bun's startup is sub-second for a single
|
|
34
|
+
plugin, so the loop stays tight.
|
|
35
|
+
- For frontend plugins (or bundle primaries with a `-frontend`
|
|
36
|
+
sibling), the dev command additionally spawns a Vite dev server on
|
|
37
|
+
port 5173 (configurable via `--frontend-port`). Vite serves
|
|
38
|
+
`core/frontend`'s new `dev-main.tsx` shell — the same App.tsx,
|
|
39
|
+
loadPlugins(), ThemeProvider, etc. that ship in production. The
|
|
40
|
+
plugin module is mounted via a `virtual:checkstack-dev-plugin` alias
|
|
41
|
+
Vite resolves at config time. React Fast Refresh works for component
|
|
42
|
+
edits.
|
|
43
|
+
- On boot, the dev command validates the plugin's `package.json`
|
|
44
|
+
against the same `installPackageMetadataSchema` the runtime install
|
|
45
|
+
pipeline uses, so missing required fields fail fast.
|
|
46
|
+
|
|
47
|
+
Reuses 100% of the production boot code path — no parallel dev backend
|
|
48
|
+
to drift from. New code surfaces:
|
|
49
|
+
|
|
50
|
+
- `core/backend/src/services/dev-auth.ts` — the synthetic auth service.
|
|
51
|
+
Inert unless `CHECKSTACK_DEV_AUTH=true`.
|
|
52
|
+
- `core/scripts/src/commands/dev-server.ts` — the CLI command.
|
|
53
|
+
- `core/scripts/src/commands/dev-deps-resolver.ts` — pure function that
|
|
54
|
+
walks the plugin's deps and resolves the co-load set; covered by 8
|
|
55
|
+
unit tests.
|
|
56
|
+
- `core/scripts/src/commands/dev-frontend.ts` — Vite spawn helper.
|
|
57
|
+
- `core/frontend/src/dev-main.tsx` — frontend dev-shell entry.
|
|
58
|
+
|
|
59
|
+
`@checkstack/scripts` now depends on `@checkstack/backend`,
|
|
60
|
+
`@checkstack/frontend`, `@checkstack/frontend-api`, `@checkstack/ui`,
|
|
61
|
+
`vite`, and `@vitejs/plugin-react` so a `bunx` invocation pulls in
|
|
62
|
+
everything needed for the dev server in one shot.
|
|
63
|
+
|
|
64
|
+
Replaces the previous "three patterns" plugin-development guide with a
|
|
65
|
+
single `bun run dev` workflow.
|
|
66
|
+
|
|
67
|
+
A new ESLint rule branch in `no-extraneous-runtime-deps` ignores
|
|
68
|
+
`virtual:` module specifiers (resolved by bundler aliases at runtime,
|
|
69
|
+
not installed from npm).
|
|
70
|
+
|
|
71
|
+
Scaffold templates updated for one-click compatibility — `bun run create`
|
|
72
|
+
now produces plugin packages that pass the dev-server's
|
|
73
|
+
`installPackageMetadataSchema` gate and ship `dev` / `pack` scripts plus
|
|
74
|
+
`@checkstack/scripts` in devDependencies, so a freshly scaffolded plugin
|
|
75
|
+
runs `bun run dev` without any further file edits. Required metadata
|
|
76
|
+
(`description`, `author`, `license: "Elastic-2.0"`, `checkstack.pluginId`)
|
|
77
|
+
is filled in by the scaffold; `@checkstack/scripts plugin-pack
|
|
78
|
+
--validate-only` accepts the rendered package.json directly. Templates
|
|
79
|
+
also reformatted from one-line JSON-in-handlebars to readable
|
|
80
|
+
multi-line.
|
|
81
|
+
|
|
82
|
+
New scaffold tests in `core/scripts/src/templates.test.ts` render each
|
|
83
|
+
template type and assert: dev-server validation passes, `dev` script
|
|
84
|
+
present (backend/frontend), `pack` script present, `@checkstack/scripts`
|
|
85
|
+
in devDependencies.
|
|
86
|
+
|
|
87
|
+
In addition, the new `dev-internals.ts`, `dev-lifecycle.ts`,
|
|
88
|
+
`dev-deps-resolver.ts`, and refactored `dev-frontend.ts` ship 58
|
|
89
|
+
unit tests covering arg parsing, package.json validation, backend
|
|
90
|
+
entry resolution, frontend-spawn decision, child env construction,
|
|
91
|
+
the debounce watcher, the spawn → restart → shutdown lifecycle (with
|
|
92
|
+
hard-kill SIGKILL fallback), the dev-auth service, and the bundle
|
|
93
|
+
sibling resolver — all driven through injectable seams so no real
|
|
94
|
+
process / Postgres / Vite is needed at test time.
|
|
95
|
+
|
|
96
|
+
- 50e5f5f: Runtime plugin system: install + uninstall plugins from npm, GitHub releases
|
|
97
|
+
(including private GitHub Enterprise instances), or tarball uploads at
|
|
98
|
+
runtime, with multi-package bundles, dependency-derived compatibility checks,
|
|
99
|
+
multi-instance coordination via a Postgres artifact store, and
|
|
100
|
+
single-coordinator destructive cleanup.
|
|
101
|
+
|
|
102
|
+
Highlights:
|
|
103
|
+
|
|
104
|
+
- New `PluginSource` discriminated union and `PluginInstaller` /
|
|
105
|
+
`PluginInstallerRegistry` interfaces in `@checkstack/backend-api`. The
|
|
106
|
+
GitHub variant accepts an optional `apiBaseUrl` so deployments backed by
|
|
107
|
+
GitHub Enterprise can install from `https://ghe.example.com/api/v3`
|
|
108
|
+
instead of `api.github.com`.
|
|
109
|
+
- New `installPackageMetadataSchema` (Zod) in `@checkstack/common` validates
|
|
110
|
+
every plugin's `package.json` at install time. Required fields: `name`,
|
|
111
|
+
`version`, `description`, `author`, `license`, `checkstack.type`,
|
|
112
|
+
`checkstack.pluginId`. Optional: `checkstack.bundle`,
|
|
113
|
+
`checkstack.usageInstructions`, `checkstack.allowInstallScripts`.
|
|
114
|
+
- New `pluginManagerContract` in `@checkstack/pluginmanager-common` with
|
|
115
|
+
`list`, `previewInstall`, `install`, `previewUninstall`, `uninstall`, and
|
|
116
|
+
`events` procedures.
|
|
117
|
+
- New `@checkstack/pluginmanager-frontend` admin UI: installed-plugins list
|
|
118
|
+
with per-row uninstall (typed-confirmation modal, schema/configs/cascade
|
|
119
|
+
toggles), install page with NPM / Tarball Upload / GitHub Release tabs
|
|
120
|
+
(Catalog tab disabled — coming soon), and an events page surfacing the
|
|
121
|
+
install/uninstall audit log.
|
|
122
|
+
- New `bunx @checkstack/scripts plugin-pack` CLI for plugin authors —
|
|
123
|
+
per-package mode produces an npm-shaped tarball; `--bundle` mode produces
|
|
124
|
+
an outer tarball containing every sibling declared in
|
|
125
|
+
`package.json#checkstack.bundle`. Published to npm so external authors
|
|
126
|
+
can `bunx` it directly without a workspace checkout.
|
|
127
|
+
- Compatibility derived from `package.json#dependencies` ranges
|
|
128
|
+
(`semver.satisfies` against the platform's loaded `@checkstack/*`
|
|
129
|
+
versions) — no separate `compatibility` field.
|
|
130
|
+
- Multi-instance: originator persists artifacts + `plugins` rows + broadcasts
|
|
131
|
+
install/uninstall; receiving instances do in-process register/unregister
|
|
132
|
+
only. Destructive ops (drop schema, delete plugin_configs, delete
|
|
133
|
+
artifacts, delete `plugins` rows) run exactly once on the originator.
|
|
134
|
+
- Fresh-instance bootstrap: `loadPlugins()` hydrates any
|
|
135
|
+
`is_uninstallable=true` plugin missing from `node_modules` from the
|
|
136
|
+
artifact store before normal Phase 1 register.
|
|
137
|
+
- New schema: `plugin_artifacts` (tarball storage), `plugin_install_events`
|
|
138
|
+
(audit/error log). `plugins` extended with `version`, `metadata`,
|
|
139
|
+
`source`, `bundle_id`, `is_primary`. Local plugin sync now writes
|
|
140
|
+
`version` from each plugin's `package.json` so the admin UI shows real
|
|
141
|
+
versions instead of `—`.
|
|
142
|
+
- Tarball-upload endpoint (`POST /api/pluginmanager/upload-tarball`) for
|
|
143
|
+
the install UI; access-gated by `pluginmanager.plugin.manage`.
|
|
144
|
+
- Plugin Manager menu link added to the user menu (main grid, alongside
|
|
145
|
+
Profile / Notification Settings / etc.).
|
|
146
|
+
|
|
147
|
+
Cross-cutting changes:
|
|
148
|
+
|
|
149
|
+
- Backend request/response logging now flows through `rootLogger` (winston)
|
|
150
|
+
instead of `hono/logger`. 5xx responses include the response body inline
|
|
151
|
+
so swallowed early-return errors are visible in the log.
|
|
152
|
+
- The `/api/:pluginId/*` dispatcher now logs which core service is missing
|
|
153
|
+
or which `pluginId` had no metadata when it 500s.
|
|
154
|
+
- New `registerCorePluginMetadata` on `PluginManager` for core routers
|
|
155
|
+
(like the plugin manager itself) that need their metadata visible to the
|
|
156
|
+
RPC dispatcher without going through the full plugin lifecycle.
|
|
157
|
+
- ESLint: `unicorn/no-null` is now disabled globally. Drizzle distinguishes
|
|
158
|
+
between `null` (writes a real SQL NULL) and `undefined` (skip the column
|
|
159
|
+
on insert), so treating them as interchangeable produced latent bugs at
|
|
160
|
+
the persistence boundary. The bulk of the patch-bumped packages above
|
|
161
|
+
reflect lint-fix touches that landed when this rule was relaxed.
|
|
162
|
+
- Workspace-wide license normalization to `Elastic-2.0` (matches
|
|
163
|
+
`LICENSE.md`). Every `package.json` in the workspace now declares the
|
|
164
|
+
same SPDX identifier; the patch bumps capture this.
|
|
165
|
+
|
|
166
|
+
Plugin packages (every `plugins/*`): added a `pack` npm script
|
|
167
|
+
(`bunx @checkstack/scripts plugin-pack`), mirrored each plugin's
|
|
168
|
+
`pluginId` from `plugin-metadata.ts` into `package.json#checkstack.pluginId`
|
|
169
|
+
so install-time validation passes, stubbed any missing required metadata
|
|
170
|
+
fields (`description`, `author`, `license`), and added
|
|
171
|
+
`checkstack.bundle` to multi-package plugin primaries (telegram, rcon, ssh,
|
|
172
|
+
jira, queue-bullmq, queue-memory, cache-memory).
|
|
173
|
+
|
|
174
|
+
Breaking changes:
|
|
175
|
+
|
|
176
|
+
- The legacy single-method `PluginInstaller` interface (`install(packageName)`)
|
|
177
|
+
is removed. Callers must use `coreServices.pluginInstallerRegistry`.
|
|
178
|
+
- The old `pluginAdminContract` and `createPluginAdminRouter` are removed.
|
|
179
|
+
Replaced by `pluginManagerContract` in `@checkstack/pluginmanager-common`
|
|
180
|
+
and `createPluginManagerRouter` in `core/backend`.
|
|
181
|
+
- `@checkstack/test-utils-backend` no longer exports
|
|
182
|
+
`createMockPluginInstaller` / `MockPluginInstaller` (the legacy interface
|
|
183
|
+
it shimmed is gone).
|
|
184
|
+
|
|
185
|
+
Note: bumps are limited to `minor` (for packages with new public API
|
|
186
|
+
surface) and `patch` (for downstream consumers, license normalization,
|
|
187
|
+
and lint fixes). No `major` bumps despite the `PluginInstaller` removal —
|
|
188
|
+
the legacy interface had no third-party consumers in the wild before this
|
|
189
|
+
runtime plugin system landed, and the contract surface is the same shape
|
|
190
|
+
modulo the rename.
|
|
191
|
+
|
|
192
|
+
### Patch Changes
|
|
193
|
+
|
|
194
|
+
- Updated dependencies [50e5f5f]
|
|
195
|
+
- @checkstack/about-frontend@0.2.15
|
|
196
|
+
- @checkstack/catalog-frontend@0.9.1
|
|
197
|
+
- @checkstack/common@0.8.0
|
|
198
|
+
- @checkstack/signal-frontend@0.1.1
|
|
199
|
+
- @checkstack/ui@1.7.1
|
|
200
|
+
- @checkstack/announcement-frontend@0.2.16
|
|
201
|
+
- @checkstack/auth-frontend@0.5.33
|
|
202
|
+
- @checkstack/command-frontend@0.2.34
|
|
203
|
+
- @checkstack/dependency-frontend@0.3.5
|
|
204
|
+
- @checkstack/frontend-api@0.4.2
|
|
205
|
+
- @checkstack/signal-common@0.2.1
|
|
206
|
+
|
|
3
207
|
## 0.4.2
|
|
4
208
|
|
|
5
209
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"license": "Elastic-2.0",
|
|
4
5
|
"checkstack": {
|
|
5
6
|
"type": "frontend"
|
|
6
7
|
},
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@checkstack/scripts": "0.1.2",
|
|
43
|
-
"@checkstack/tsconfig": "0.0.
|
|
44
|
+
"@checkstack/tsconfig": "0.0.6",
|
|
44
45
|
"@types/react": "^18.2.64",
|
|
45
46
|
"@types/react-dom": "^18.2.21",
|
|
46
47
|
"@vitejs/plugin-react": "^6.0.1",
|
package/src/dev-main.tsx
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import App from "./App.tsx";
|
|
4
|
+
import "./index.css";
|
|
5
|
+
import { loadPlugins } from "./plugin-loader.ts";
|
|
6
|
+
import { ThemeProvider } from "@checkstack/ui";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Dev-shell entry point used by `bunx @checkstack/scripts dev` for
|
|
10
|
+
* frontend (or bundle-primary) plugins. It re-uses the production
|
|
11
|
+
* `loadPlugins` flow but sources the plugin module from a Vite alias
|
|
12
|
+
* `virtual:checkstack-dev-plugin` configured by the dev-server's Vite
|
|
13
|
+
* setup.
|
|
14
|
+
*
|
|
15
|
+
* `loadPlugins` accepts an `overrideModules` map; we pass our single
|
|
16
|
+
* imported plugin under a synthetic path. Phase 2 of `loadPlugins`
|
|
17
|
+
* (remote plugin discovery via `/api/plugins`) still runs against the
|
|
18
|
+
* dev backend on :3000 — but Phase 1 has already registered our plugin,
|
|
19
|
+
* so the duplicate is skipped via `registeredNames`.
|
|
20
|
+
*/
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore — `virtual:checkstack-dev-plugin` is provided by the Vite
|
|
23
|
+
// alias the dev-server creates at runtime; TS can't see it.
|
|
24
|
+
import * as devPlugin from "virtual:checkstack-dev-plugin";
|
|
25
|
+
|
|
26
|
+
await loadPlugins({ "virtual:checkstack-dev-plugin": devPlugin });
|
|
27
|
+
|
|
28
|
+
ReactDOM.createRoot(document.querySelector("#root")!).render(
|
|
29
|
+
<React.StrictMode>
|
|
30
|
+
<ThemeProvider defaultTheme="system" storageKey="checkstack-ui-theme">
|
|
31
|
+
<App />
|
|
32
|
+
</ThemeProvider>
|
|
33
|
+
</React.StrictMode>,
|
|
34
|
+
);
|